Sunday, July 14, 2013

PhoneGap on Ubuntu 12.04 VirtualBox Guest with Windows 7 Host

My favorite customer hired me again to work with her, this time on a Javascript-based project. She wants to port her existing Javscript, HTML and CSS code base to both Android and IOS native (ish?) apps. We're getting started with PhoneGap to accomplish this single-codebase-two-platform project. I thought I would put together a quick post about the "gotchas" that I ran into while setting up my development environment. All of the guides I found don't really cater to a virtualized Ubuntu setup, so I figured that some of the problems I overcame might help someone else.

One important lesson I learned at my last 9-5 job was to take advantage of the tools and support an integrated development environment (IDE) can provide you with. A lot of the Android + PhoneGap documentation is present for Eclipse, so that's what I went with.


This is what my first virtual Android device looks like.


I'm using Eclipse with the Android Development Tools (ADT) pre-bundled, and linking in PhoneGap version 2.9.0 on my Ubuntu 12.04 Virtual Machine running inside VirtualBox.

The main things I learned so far are:
  1. Running the ARM emulator takes a TON of resources. For the basic web development I mostly do, my Ubuntu VM is normally sufficient. I had to add another gig of RAM and double the processing capability to make this even responsive at all. It was basically taking about 5 minutes for the Android virtual device to boot before increasing the resources. After making this VM stronger, it became feasible to develop inside it.
  2. 3D acceleration inside VirtualBox and the 3D acceleration for the Android simulation don't play well together. Simulating 3D inside a simulated 3D environment seems like it might have some problems. I disabled 3D acceleration for VirtualBox, and now I only get one warning from Android. I'm pretty sure this is 100% not supported but it seems to be working for me, right now. Previously, I received a ton of errors.
  3. super.loadUrl("file:///android_asset/www/index.html");         super.loadUrl("file:///android_assets/www/index.html");

    are not the same. If you make this mistake, you will receive a "There was a network error. (file:///android_assets/www/index.html)" error. It needs to be "asset" not "assets." This is a little bit tricky, since inside Eclipse and my file system, you have "assets/www/" but when this gets moved to a phone, it's "android_asset/www/". 
PhoneGap development has been fun so far, even if I just barely finished with getting a "Hello World" program running. I'm not sure if I'll end up getting a Mac, or running on some sort of a weird virtualized Hackintosh to compile this for IOS using XCode. I don't yet have access to my customer's code base, so I cannot take the next reasonable step of trying to get their code running to see how native it looks, or if it works.

With getting this to actually run on my physical device, I had to install the Oracle VM VirtualBox Extension Pack on my Windows 7 host. I installed version 4.2.16. Then, my host went through some additional USB configurations, I rebooted the host and my guest, and I was able to see my phone from my Ubuntu VM.

DDMS Perspective in Eclipse

Inside my VM, I switched Eclipse to the perspective to DDMS. I didn't really know what DDMS stood for, or what it was, but all the other options seemed wrong. That was the correct guess, and I could select my device. I went to "Run" -> "Run", selected my device, clicked OK and then cheered when my Hello World program showed up on my screen.

Screen Shot of my Actual Screen - I'll try to take a picture, but my phone cannot take a picture of itself.

Task Manager While Running

The running app seems like it's taking a decent amount of memory. This is likely because PhoneGap requires a big .JAR file to be included with the project, in order for it to work.

Hopefully this post helps someone else, or me the next time I need to setup a PhoneGap development environment.

Thursday, July 11, 2013

417 Princeton - My Apartment

From time to time, I receive inquires about renting out my apartment located at 417 Princeton Dr SE, in Albuquerque, New Mexico. The two types of leases I've considered have been short term (daily) and long term (for a period of twelve months.) Regardless of which type of lease I actually go with, I thought that putting together a blog post about my place would be fun. That way, I can showcase some of the beautiful pictures my artistic friends took for me, and have something to look back on when I'm no longer living in this place.

My apartment is a big one-bedroom. They layout is such that from the front door, you walk into the living room. That leads into the kitchen. The kitchen can either lead into a hallway that goes into the bathroom, or the bedroom, or you can exit the kitchen. At the very end of this post, I have included a carefully constructed, artist rendition, of the layout of my apartment. It is included at the end of the post as opposed to the beginning to avoid scaring people away because I am the artist that constructed this crude rendition.

To start with the virtual picture show, the front room is the first thing people normally walk into. My friend Efrain Grijalva took this pictures for me, and helped arrange my furniture to make the place look good. Thanks Efrain! And thanks Efrain for helping refinish the beautiful hardwood floors too.

As you walk into the front door, this is what you see (when my place is clean!)

Then, if you walk forward and take a look to the right, this is where I have my dinner table setup.

Why not sit down, and enjoy some ale and fruit...?

Or perhaps go on a picnic* 

Walking through the front room leads into the kitchen. My girlfriend Lyric helped me take pictures of the kitchen. Thanks Lyric!

У меня много русских друзей. Казахстан!
Note the washer, but no dryer. The dryer is also known as a clothesline. Hey, it's New Mexico and usually dry and hot. I've been looking into getting a stackable washer/dryer combo like I did for my tenant's apartment next door.

I had a new dishwasher and a new stove installed. The fridge was a gift from my old boss at Flow Science, John Ditter.

My father and I installed the floating laminate floor together. It was a fun project, and I'm still amazed by how easy the installation was. Thanks Dad for the help, and the materials!

Lyric and I put up the tapestries together. I like those blue sarongs, tapestries, and other pieces of (potentially) decorative fabric.


The is the view looking from the corner of my room back toward the hallway.

This is the hallway leading from the kitchen into either the bathroom, or my bedroom.


Lyric strongly suggested I replace my shower head. This new Kohler shower head is awesome! I should have installed it a long time ago.




Artist's rendition of apartment layout, version 2.0. Scales are approximate, and the bedroom is bigger than I the artist made it. Additionally, the rooms are actually square. My measurements are not perfect. The black blurry things in the bedroom at the closets (2.)

Overall, I hope this gives people a decent idea of what my apartment looks like. Ideally, I would like to add more pictures from the outside of the place, and perhaps some videos. For now, I think that this is good enough. Thanks for reading!


* Picnic set only available for short term rentals.
** Please note, I only have a laptop and a ruger 10/22 worth stealing. The laptop is almost always with me, and the rifle is loaded.