My Brain on Code

Debugging Android With Jdb

At work I’m a big proponent of vim. Needless to say, I code Android in vim. One thing that many Android developers do is debug their apps using their IDEs built in debugger. Luckily, there is still a way to debug Android apps without an IDE such as Eclipse or Android Studio. What you can use is jdb, a simple command-line debugger for Java classes.

A GeoPoint Converter for GSON

I’ve been working with the Google Maps library for an Android app I have been working on. The app uses an external api I created that sends back GPS coordinates (longitude and latitude) in JSON form. I needed to be able to serialize and deserialize this data to/from the GeoPoint class that the Maps library uses.

Importing JSON Into MongoDB

Lets say you have a bunch of data in a JSON file to import into your MongoDB database. Luckily, you can use the mongoimport command to do this. However, there are a few things you need to know:

  • MongoImport expects only one document per line.
  • You will be importing into an actual collection in the database.

Git-Svn and You

My work uses Subversion and I wish they wouldn’t. It’s not that I don’t like Subversion, I just feel there are better alternatives. Subversion just feels slow and clunky. We do all of our coding in trunk and very rarely create branches. This doesn’t meet my style of coding. I’m a big fan of creating feature/bug fix branches. With Subversion it’s certainly possible, but pretty painful. Since there’s a central server that houses everything, I can’t just create a branch for my own sake on my local machine. This is why I prefer DVCS.

Getting SpaceChem to Work on ArchLinux

I just recently bought the latest Humble Bundle which comes with SpaceChem. They support Linux which is great because I run ArchLinux and not many games support it. However, the makers of SpaceChem only provide a .deb to install. Luckily, there is a way to “install” it without much hassle. This is what I did:

Tumblr Recent Posts With Javascript

I recently moved the entirety of my site (save this blog) to using jekyll. I have to admit, it’s really nice and eases maintenance tenfold. One thing I wanted to do was have a recent posts feed on my front page. Luckily, tumblr has an API I took advantage of. With a little bit of jquery, I was able to write out the top 5 recent posts on this blog.

Getting Gameboid to Use mednafen/VirtualBoys Sav Files

I recently purchased an HTC Incredible. I found out a neat app called gameboid which is a GBA emulator for Android phones. I’ve been playing Golden Sun on my computer for quite some time now because I’ve misplaced my game cartridge. Not wanting to lose all my progress I decided to try and get gameboid to use the same sav file that my GBA emulator creates.

X Server on Gentoo Virtual Box Guest

Well, after a very long time of playing around with my Gentoo Virtual Box Guest, I finally got X Server working!

I first needed to make sure hal was installed:

# emerge hal

Then I started it up:

# /etc/init.d/hald start

Then I made sure it started at boot:

# rc-update add hald default

Gentoo Guest in Virtual Box

Recently I wanted to test drive Gentoo Linux and so I decided to install it as a VirtualBox Guest on a 64 bit Windows 7 machine. I basically followed the Gentoo Docs so I won’t go into much detail about it here. However, I did download the weekly x86 minimal install iso. Mounted that as a CD in VirtualBox and went from there. I also used this to help configure the kernel. One odd thing about the Gentoo docs was that it used sda for the first hard drive whereas in my virtual machine it was seeing hda. I do not know why. So, I simply replaced any instances of sda in the docs with hda.