side tabs are the future

Our screens have gotten wider. Our browsers have also gotten wider. But our tabs remain a thin, barely visible line drawn across the top that become two letters when we have more than 10 tabs open? This is 2021. You need side tabs.

my firefox setup
  1. Download and install https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/
  2. Enable userChrome.css https://winaero.com/enable-loading-userchrome-css-usercontent-css-firefox/
  3. Open about:profiles and click Open Folder next to the Root Directory.
  4. Create a folder named chrome
  5. Create a file named userChrome.css inside that folder.
  6. Paste the following into it and save
.tabbrowser-tab:not([selected]) {
    display: none !important;
}

.tabbrowser-tab[visuallyselected="true"] {
	max-width: none !important;
}

Enjoy!

emulators are cool

I started working hacking together a Game Boy emulator the other day and wanted to see how quickly I can get from absolute zero to something. I have achieved what I set out to do:

classic

I took the absolute minimalist route and wanted something that wasn’t abstracted away like most (good) emulators are these days. Since my goal was understanding, abstraction wasn’t a high priority.

First, I wrote the parser for the ROMs to ensure I handled all of the instructions correctly in the bootrom. When that was looking good, I had to do a bit of refactoring now to actually execute those instructions and modify my state. After about a week or so of digging in, I had the basics working. For now, I’ll be putting this project on hold because other things have captured my attention. The code is available at https://github.com/AugustKarlstedt/gameboyemu but I warn: it isn’t pretty. 🙂

I chose to use CMake for dependency management and I must say, THIS is the way to use C++ these days. Wonderful all around.

A higher-level discussion

Why do we write an emulator that gets compiled into machine code for a specific CPU? E.g. in my case I wrote my emulator in C++ and compiled it into x86 instructions using MVCC. What’s the point? Our CPUs already have instructions to do what these older CPUs did.

Why don’t we use LLVM to simply translate from e.g. Game Boy instruction set to e.g. x86 instruction set?

Luckily a smart dude already has worked on this: https://andrewkelley.me/post/jamulator.html

Going Through Old Source Code

After backing up some files, I remembered that I wanted to go through some of the old programs and code that I’ve written. It would be a fun experiment: seeing how far I’ve come, what I actually spent my time doing as a teenager, and probably get a few laughs. Well, here are some of the interesting bits I found.

The first thing I came across was a C++ program I made for my friend Jose’s 17th birthday using SFML and Bass. It consisted of a single main.cpp file and most likely completed the night before.

Jose Birthday project

I wasn’t very clever in naming projects. Something I called “Google” was actually a really cool start of a physics puzzle game. Worked on sometime in May through July 2011, it has a complete level format based on XML. The player drags a path for a ball to enter the designated “win” zone. It used Lua scripting, Box2d Physics, and SFML for rendering. Again C++.

“Google” game project

(30 minutes later…) wow, ok, I found something that I really enjoyed! It’s called ParticleSim, written in June of 2011. I’m beginning to think that the dates on the files might be incorrect, or I was just quite productive in 2011? Not sure yet. Anyhow, at the time I was trying to replicate another Facepunch forum member’s work that I found really fun. My take on it was a game where the player can place attractors and repellers and then create particles that will interact with them. I started with the math to get that all working, then added a quick feature to make the particles’ size based on the bass of the current song. I got to play around with FMOD, Lua, and Boost all in C++.

ParticleSim demo

That’s all for now! More to come later.

Learning about Android and FireOS

Note: these are my notes from a session learning about Amazon’s Kindle FireOS and the possibility of using Linux kernel exploit to gain root access.

What I’ve tried in chronological order:

Connected to device over USB via ADB.

The command service list lists all of the available services running. You can send a command to these services by running service call [service] [integer]

I’ve tried service call statusbar 1 and service call statusbar 2 and can see the statusbar appear and disappear, respectively.

What happens if we poke into some Amazon stuff?

New Blog Stuff!

As a first post on my newly updated blog, I figured I’ll explain my setup. After experimenting with Jekyll, Gatsby, and Hugo I realized I didn’t want to learn an entire static site generator system for something so simple. While learning is important (my favorite thing to do, in fact), what mattered more was the TTL (time to live). I needed something that I could work with and quickly get results.

Enter WordPress! According to W3Techs, WordPress accounts for 60% of the market share for content management systems on the web! I’ve used it at work, for clients, and through WordPress.com, where my blog was originally located.

WordPress.com was a bit too restrictive compared to a self-hosted WordPress installation. You can’t add plugins or JavaScript or tweak the theme files and such. For this reason, I started to look into self-hosting a WordPress environment. But then it hit me – why not just export the site and host it for free on GitHub pages?

Since I didn’t need to have a publicly-accessible WordPress site, I decided to use Docker to setup the WordPress and MySQL environment for rapid deployments and easy backup purposes (and because I’m running Windows and didn’t want to pollute it with all the installs for PHP and the like).

My docker-compose.yml file looks like this:

version: '3.6'
services: wordpress: image: wordpress:latest ports: - "80:80" - "443:443" command: 'bash -c /usr/local/bin/apache2-custom.sh' volumes: - ./config/php.conf.uploads.ini:/usr/local/etc/php/conf.d/uploads.ini - ./config/wp-init.sh:/usr/local/bin/apache2-custom.sh - ./wp-app:/var/www/html # Full wordpress project #- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development #- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development restart: always environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_NAME: wordpress WORDPRESS_DB_USER: root WORDPRESS_DB_PASSWORD: password depends_on: - db
db: image: mysql:latest command: [ '--default_authentication_plugin=mysql_native_password', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci' ] volumes: - ./wp-data:/var/lib/mysql restart: always environment: MYSQL_DATABASE: wordpress MYSQL_ROOT_PASSWORD: password

Running docker-compose up -d on this results in WordPress being started using a self-signed SSL cert (see wp-init.sh below) and connects it over to MySQL. All of the data files are mounted as volumes for easy access in Windows/the host environment.

#!/bin/bash
# modified from https://github.com/docker-library/wordpress/issues/46#issuecomment-358266189
apt-get update apt-get install -y --no-install-recommends ssl-cert rm -r /var/lib/apt/lists/*
a2enmod ssl a2ensite default-ssl
# finally execute default command docker-entrypoint.sh apache2-foreground

With that, my local WordPress environment was set up. This admittedly took a few hours across multiple days to get configured just right. I then exported my WordPress.com content and imported it over here. Finally, when I want to update my site here, I simply navigate to the WP Static Site Generator plugin and click export. Voilà!

It works wonderfully well. You get all of the power of WordPress + plugins (SEO, minification, etc.) and all of the speed + security of a static site.

Long Short-Term Memory Neural Networks and Guitar Tablature

Just messing around with LSTM neural nets, I had the idea to train it on some guitar tabs and see what happened.

Data

My dataset was a collection of guitar tabs for The Who’s album, Tommy.

Some stats
Text total length: 277,155
Distinct chars : 91
Total sequences : 92,369

So yes, it’s a tiny little dataset.

Training

I’m using TFLearn’s implementation of an LSTM neural net. My setup is as follows:

Input data -> LSTM layer (512 units, returns full sequence (3d tensor)), -> dropout (50%) -> another LSTM layer (512 units, returns only output of last sequence (2d tensor)) -> dropout (50%) -> fully connected layer (softmax activation).

Results

On the first epoch with a temperature of 1.0 (meaning we’re trying to generate novel sequences, less likely to repeat the input data), we get:

Spring Quarter 2017

CSC 426 ΓÇô Research Methods and Practice in Computing

CSC 478 ΓÇô Programming Machine Learning Applications

CSC 594 ΓÇô Topics in Artificial Intelligence: Natural Language Processing

Fall Quarter 2016 (First Graduate Quarter!)

My schedule included

CSC 421 – Applied Algorithms and Structures

CSC 447 – Concepts of Programming Language

CSC 453 – Database Technologies

But that’s not the interesting part.

What’s interesting is that I took these courses online and collected data on how long I spent watching each lecture. This let me optimize my study habits and see which courses I needed to devote the most time to. The color corresponds to the color above.

Right off the bat, I knew that CSC 421 will be taking a majority of my time. A very heavy course: algorithm analysis, design, implementation, NP-completeness, and the like – things which I know I can get better at.

Overall, for the other two courses, I was saving 80-90% versus being in-class. The materials covered in these courses were not new to me, so I could get by by watching the “interesting” parts of the lecture, reading the book, and looking at the slides.

I wound up with an A and an A-, for CSC 447 and CSC 453, respectively.

CSC 421 was one of those courses that is really tough, but you where you learn so much. I probably could have benefited taking this course in-person, but I still managed to save some time. Since this is the first time I’ve ever recorded data like this, it’ll be interesting to compare to next quarter (where I am taking an in-person course). All said and done, I wound up with a C+ in CSC 421, bringing my GPA for the quarter to a not-too-shabby 3.33.

Kali Linux on Raspberry Pi 2

Quick setup instructions.

  1. Download the image located here https://www.offensive-security.com/kali-linux-arm-images/
  2. Extract using 7-zip
  3. Use Rufus to DD the image to your MicroSD
  4. Pop it in the Pi, boot it up, and login using root:toor for the username:password
  5. If you want to install additional tools (you will), you can check them out here https://www.kali.org/news/kali-linux-metapackages/
    1. e.g. apt-get install kali-linux-wireless

Warning: Don’t Install the Windows Subsystem for Linux (Beta) if you have BitLocker Enabled

I found out the hard way.

After upgrading my laptop to Windows 10 Version 1607 (Anniversary Update), I was excited to try Bash in Windows. That’s where my problems started.

After enabling the feature in the “Turn Windows Features On or Off” dialogue, I rebooted my system and was faced with blue screen stating BitLocker encountered a TPM issue.

Resolution: make sure your BIOS is up-to-date and has TPM enabled, then roll back the latest changes using a recovery drive. Finally, manually enter your BitLocker key to boot into Windows, run tpm.msc, and prepare the TPM.

Philosophy on Relationships

View each person as a locked safe of experiences and wisdom that one cannot access until they (you) find the key.

Sometimes the key is a common interest that allows you two to open up to each other. Other times it can be a moment shared without any form of verbal communication. Whatever the key may be, I find it the part of relationships that intrigues me the most. How do I get to know this person?

How can one get past that initial barrier that people shield themselves with to strangers?

Winter Quarter 2015 in Retrospect

Last year I posted about Winter Quarter courses I was about to take and stated that I would explain my consideration to switch majors. A year later, I’ll now explain my thought process and where I am today. I hope to also discuss the classes I took during this quarter and the work and projects completed during this time.

Computer Game Development vs. Computer Science

The future is scary. Who knows what it holds? So why not try to make it as concrete as possible for yourself and choose a path that will most likely lead to whatever it is you desire? That was my thinking when I was considering switching from Computer Game Development to Computer Science.

If one were to evaluate a Computer Game Development degree just by its name, it would be reasonable to assume that the end goal is to just make video games. In fact, that was one of my fears when I was thinking about switching to CS. Working alongside engineers that have degrees in Computer Science, Electrical Engineering, Mechanical Engineering, and more at my internship with a local engineering consulting company, I felt that their degrees would be considered more thoroughly than mine would.

Shortly after, I started researching what it would take to switch my course plan from game dev to CS. Unfortunately, because I had taken so many major courses already, I wouldn’t have been able to complete my degree in the same time frame. I was bummed – what was I going to do now? I’m stuck.

As I entered my second quarter of my Junior year, I was enrolled in CSC 395 – Research Colloquium. As I described in an earlier post, it’s a course where every week a new speaker presents their research to the class. Going in, I hadn’t realized how influential this course would be to me. Not once was I disinterested in a topic, no matter how difficult it was to grasp or how I couldn’t understand the title. The presentation of these ideas interested me and motivated me to start thinking about graduate school.

That leads me to where I am today. I am still pursuing a degree in Computer Game Development, but I no longer feel like Computer Science or any other degree would be more worthwhile. I’m not pigeonholed into just making video games. Still at the same internship, I’ve been able to work on a lot of cool projects and get a good taste of the professional world. But I am still compelled by the idea of academia. Therefore, I am applying to graduate schools for Master’s programs in Computer Science.

This has been in my drafts for a few days now. So I guess I’ll post this and give each course a separate post in the coming days.

Dat College Feel

Walking to class this morning is the first time I’ve ever actually felt college-y. I don’t know what’s different this morning, but the brisk air, morning sun, and overall atmosphere seems… Different.

Maybe it’s the realization that this path isn’t what everyone chooses. I see so many people from when I was younger choosing one of the billions of other paths there are and I believe I’ve chosen the best one for me.

For the first two years of college (I’m a junior now), I only took it semi-seriously. To me, it was just something I had to do, not something I wanted to do. I felt most of the classes I had been taking were pointless, and that the idea that college finally lets someone explore the things they are most interested in was false.

I understand now that one cannot look at it as black and white as that. College is a place where, yes, you learn about certain specific things you’re interested in, but it also shows you that there’s a world where there’s so much more to learn, understand, and contemplate that it doesn’t make sense to ignore it.

MAT 140 & PGP Encryption

I was in MAT 140 – Discrete Mathematics last quarter and I found that the fundamental theorem of arithmetic is super interesting. When the professor was speaking about it, I asked if it was the base for PGP encryption and it turned out it was. I had an inkling for this, because I previously heard that PGP generates super large numbers and that’s where the security lies.

I’m kind of skeptical. Sure, with the current state of computing these cryptography keys are nearly impossible to crack, but the fact is that they still are possible to crack. I’m betting on sooner rather than later.

Well, I’ll be looking into how this works in greater detail whenever I have time.

Anyone know some places to learn more?

New Classes – Winter Quarter

Alright so I’m finally going to discuss the new courses I’m taking now.

CSC 395 – Research Colloquium – I’m pretty excited about this course. It’s completely online and every week there will be a lecture by a guest speaker on new work in areas of computing. Hopefully there are some talks relevant to my interests, but nonetheless I love TED talks, so this should be similar.

GAM 341 – Introduction to Level Design – Since I’m majoring in Computer Game Development and focusing on the programming portion of it, I figured I should also get a little more experience in the non-programming parts. We’re going to be using Unreal Engine 4, which I’m pretty stoked about!

GAM 376 – AI for Computer Games – I’ve always been interested in artificial intelligence. Actually, in the class I’ll describe next we’re discussing AI through a philosophical perspective. I’ll probably post more on this later. As for this course, I hope we don’t just use some already-implemented AI algorithms and we can actually write our own. I doubt it though.

PHL 242 – Philosophy & Technology – We’re discussing what technology actually is. Admittedly, when asked this question I thought it was going to be easy to define. I was horribly wrong. While it isn’t required, I may read the recommended material, “War in the Age of Intelligent Machines” by Manuel De Landa. We read the first chapter and thinking about how a robot historian would describe its history is something that made me extremely intrigued.

SOC 281 – Sociology of Rock Music – This is kind of weird, yes, and I know that. It fulfills some requirement that I needed to complete, so hey why not? We’re going to trace Rock Music from the beginning to now, and I’m thinking I’ll learn a lot. The professor asked in the first day of class what we knew about rock. While I do know some stuff, and I listen to rock all the time, I wrote that I had no knowledge of rock. I think this will benefit me because starting with a blank-ish slate should be fun.

Anyhow, I wasn’t going to take these classes and considered switching majors. I’ll explain why in the next post.

GPH 321 – Completed

In this class we created a ray tracer from the ground up. I by “we” I mean our professor wrote most of the code and we had to fill in certain class functions. It was pretty terrible, but overall the end result was good. Oh and we had to zip our source code and send it in, instead of simply using something like GitHub or Bitbucket. The midterm and final SUCKED, simply because it’s 2015 (well, it was 2014) and written exams for programming finals are absurd. Writing code on paper completely lacks the feel of typing it out using an IDE. Plus, come on, who doesn’t use IntelliSense, Resharper, Visual Assist X, or some kind of code-completion tool? A fool! And that’s exactly what we are when we write code by hand.

Anyhow, here are some screenshots from the course.

First we simply had to get rays working and detecting collisions.

Rays & Intersections
Rays & Intersections

Then we had to ray-trace our first object, a sphere. This is because it’s pretty simple to represent in math.

First Ray-traced Object
First Ray-traced Object

Then we had to add some shading to that sphere. I know,Γö¼├íit isn’t 100% correct. Spot the error!

Phong shading
Phong Shading

Next came shadows. These are awesome.

Ray-traced Shadows
Ray-traced Shadows

Next was reflections. Super easy thanks to how ray-tracing works.

Ray-traced Reflections
Ray-traced Reflections

Then we had to create a checkerboard pattern.

Checkerboard
Checkboard

Finally we were to implement Fresnel equations to properly simulate glass. I didn’t finish this one fully.

Ray-traced Fresnel
Ray-traced Fresnel

And that was the end of the course. This course was online only, which probably had an impact on my view of it. The course notes weren’t that great. I repeatedly found myself Googling things that were phrased in strange ways to figure out how to implement them. And variable names like V, N, n1, n2, etc. used throughout the given code made things unnecessarily complex.

Oh well, it’s over and done with!

ANI 230 – Completed

Well I totally forgot to update this during class, but that’s okay.

IT IS TIME FOR UPDATES.

The class was about Maya so it was recommended that we download Maya 2015. I was a bit too lazy and decided that my installation of Maya 2014 would have to do. Here are a few of the things we had to make.

So our first homework was simple, but introduced us to Maya. We made a fan.

Simple Fan - Maya 2014
Simple Fan – Maya 2014

It had limitations, so it really looks bad. Luckily this is a course about low-poly modeling, so super-detailed isn’t what we aimed for.

Second homework was to model some animals, again with limitations.

Animals - Maya 2014
Animals – Maya 2014

I chose to model a snail, a T-Rex, a kiwi, and a human. I think improvements can be seen!

Next up was a shoe, and a lot of revisions.

Shoe - Maya 2014
Shoe – Maya 2014

Somehow turned into this after a lot of messing around:

Revised Shoe - Maya 2014
Revised Shoe – Maya 2014

Then I chose to model a guitar capo which proved an interesting challenge:

Guitar Capo - Maya 2014
Guitar Capo – Maya 2014

Skip a few and we arrive at our toy store assignment. It was pretty simple, with a animated camera flying around.

First revision:

Second revision:

Final revision:

Jump ahead to the final assignment:

GIMP was difficult to get working properly with the PSDs Maya exported, but it kind of worked. Oh well. That was the end of that class and I learned a lot about low-poly modeling. Nice!

Updates!

Obviously I haven’t posted anything in a while. But it’s time for a change – and change is good!

I am now currently in three courses that are at least semi-relevant to this blog.

  • ANI 230 – 3D Design & Modeling
  • CSC 298 – Internship
  • GPH 321 – Computer Graphics Development I

In ANI 230, we’re learning Maya 2015. Starting with low-poly and now (it’s about midterms time) we’re onto animation with keyframes. I’m particularly interested in ray tracing, because we are building our very own in C++ in GPH 321.

As for CSC 298, it basically runs alongside the internship that I already have. Here, I’ve been working with a ton of Java stuff lately interfacing with a USB HID. Through this, I’ve learned to use Maven – let me just say it’s awesome.

Anyhow, I’ll be posting some images of the stuff I’ve been working on soon.

Also, I may move this entire blog to a domain/host I pay for now. Or maybe even use GitHub Pages and Jekyll, those look fun.

Oh and I read a few Android books, great stuff. Loving Android dev.

Finished with GAM 374

Well, I chose to turn in exactly what you see in that last blog post. Everything that was required for the assignment was there and it earned me a 95%.

I am now focusing my efforts into work with a near-full-time schedule of 38 hours a week. I will be posting stuff about happenings relating to that from here on out.

I’m also working on an Android app, so there will be some Java tossed in.

And last but not least, my love for C++ is growing as I discover C++11 features. There’s a little code I wrote to test out the functionality of some of the new stuff if you read on.

Continue reading →

Player Tank!

I’ve finally done some work on this and got the player tank working. Azul doesn’t handle mouse input very well (I’m spoiled by Unity), so it’s all keyboard controls.

WASD controls the tank movement

LEFT/RIGHT control the turret

I’m thinking the up arrow will fire a shell and the down arrow will lay a landmine.

DePaul Azul Engine - Tanks!
DePaul Azul Engine – Tanks!

Screenshot taken with Greenshot.

First Day of Final Project

Today marks the first day I’ve started working on the final project for my GAM 374: Fundamentals of Game Programming I class. I’ve decided to recreate Tank – well actually, the Wii Play version called “Tanks!“.

We’re using the DePaul game engine called Azul – which I think could definitely use an engine overhaul since it’s based on the singleton design pattern. Gross.

Click to learn about Game Programming Patterns