Hello there!

This is a site for stuff I write that doesn’t fit in 280 characters or simple images.

Mount USB devices in Virtualbox-based Vagrant

If you want to mount USB in Virtualbox, you have to do this solution. At the time of this post, a typical Google search for this would go to a solution at advocated using the attachusb command in VboxManage in the Vagrantfile provider customization section. This will not work because the VM is off at the time of bootup. It looks like the original author of this gist did not repost his solution back to the thread.

The solution, in other words, is to use USB filters to automatically connect devices to your VM. USB filters can be added while the machine is powered off. They’ll be applied upon boot or, in this case, vagrant up.

5:03 pm / Vagrant , Virtualization

My current vagrant setup

I firmly believe that Vagrant is the quickest way from nothing to a running and preconfigured development environment on any machine and especially Macs. For me, the ‘works on my machine’ problem is the biggest reason I run Vagrant. Day-to-day though, Vagrant is probably the easiest to use UI for Virtualbox. If my work actually had money to give me for the VMWare plugin, I believe it would be a better UI for VMWare Fusion as well.

The Basics

This is enough to get started with Vagrant and to reap the rewards.

  1. Virtualbox
  2. Vagrant

That’s great and all, but these are the basics. At the very least, you’ll be able to bring up some boxes that don’t require special plugins up.

Frills

You don’t need these but I do! I usually build my Vagrant boxes with Opscode Chef, a configuration management system. For reference, a Chef cookbook is a series of statements about how a machine should be setup.

Most of these frills are plugins. To build the boxes I make, you’ll usually have to install or use these.

  1. Berkshelf is a dependency resolution manager for Chef. I use Berkshelf as a gem along with the corresponding vagrant plugin. With this, when I run berks cookbook <name>, I can make a Virtual Machine that can be created and destroyed quickly from scratch for whatever purpose. I could do vagrant init but berks cookbook has it beat by creating a directory structure that’s pretty much a Chef cookbook. Even if I don’t intend to redistribute said cookbook, the VM made is perfectly fine for tryout purposes.
  2. I like using the Opscode Bento boxes. They are minimal and they have already been uploaded to S3 on Opscode’s dime. In a Vagrantfile, you can set the box URL for a Vagrant basebox to be downloaded. These boxes are great.
  3. You can’t use the Opscode Bento boxes without the Vagrant Omnibus plugin. Those boxes do not include Chef so you must install Chef at runtime.
  4. Just so you don’t get warnings about the Virtualbox additions being out of date, there’s a Vagrant plugin to automatically update the guest additions if needed. This one is really optional and it’s use just surpresses that warning you get if you bring up a vagrant box with old guest additions.

The Future

In the future, I’ll like to be able to test my boxes to make sure they stay working as the things they pull from the internet change. For this, there’s Test Kitchen.

Unfortunately, it’s still really cutting edge. However, there are guard plugins and this Youtube Video and blog post. That video is very much a must see for anybody who appreciates TDD.

Full integration testing on your own laptop is very attractive to me. I keep mine plugged in and I find it disturbing that the rest of the cores on this MacBook Pro just lie cool.

And also, maybe if I get some cash, I might drop some money on the VMWare plugin and VMWare Fusion. If I want to simulate multiple servers at a time and heavier loads, it would make that much faster.

8:09 pm / Vagrant , Virtualization

A Windows "QuickStart"

I paid Swish $25 and $8 shipping for this two months ago. I think I had my share donated to the Khan Academy.

The box

It’s the “Windows Quickstart Kit for Mac Developers”. It includes:

  • A full Windows 8 Pro license
  • A Parallels Desktop license
  • A USB Stick with an ISO on it with a real Microsoft Certificate of Authenticity. Genuine Windows!

I’m not sure why Microsoft saw fit to spend two months packaging a “quickstart”. Why Microsoft did not see fit to provide this quickstart through digital distribution is beyond me. They could have emailed a link to some keys and ISOs and maybe even let a distributor like Digital River do this. Instead, they saw fit to contract this work out to a physical media distribution company. It seems with these charity-ware deals that the best way to donate money is to allocate a large chunk to some physical distributor.

I’m so stoked to try and develop for Windows Phone. I’m going to virtualize Windows 8 and develop a native app for a platform on which I have no way to run natively. I’m also going to jump over some chairs in celebration.

Nuh uh, virtualization is cheating and is really anti-dogfood. If I have to boot up a RAM hungry OS to RUN the app, it’s a failure. If I have to develop the app inside a virtualized OS, that would be even more of a failure since I would have to bear with the performance and non-nativeness penalty. There’s no way a good app can come out with so many barriers like that. Google realized that its Eclipse toolkit was a problem and switched to IntelliJ IDEA to reduce their barriers and gain an awesome IDE in the meantime. I highly doubt Microsoft will provide a free cross-platform and light SDK. The technical barriers are just too high. It’s totally not like their Xbox where game developers are used to putting up with shit like that. Mobile developers are in general more finicky and prefer native tools. I’m not sure if this is still the case now but the Android team saw fit at one point to maintain the Android compilation toolchain for the entire OS on OS X. You can compile a Linux system on OS X!

With that said, this cool cardboard box is all that remains. It would be well designed if it never existed. It’s way too late for that though.

It’s made up of two big pieces. After ripping off the plastic wrapper, there’s a windows logo cutout sleeve thing to keep the box with a flap closed. It’s a pretty retail package for something that is only sold online.

two pieces

When you open the box, you have a welcome card with some very basic instructions on the back on the left and some coupon card things on the right.

open box

Beneath the welcome card is a USB drive. It has a Microsoft certificate of authenticity on it, so you know its real and has real Microsoft binary bits. There’s also a tracking ID on it too. The Microsoft logo is embedded in plastic on the back and not some cheap printer job. It’s certainly done with style to make the USB drive seem to be actually worth something.

beneath the card

On the USB Drive is just an ISO. There are no other files The drive itself isn’t bootable. It is formatted with NTFS though. At the very least, it’s readable on all platforms. It also enumerates as a device of the name Windows 8 Pro in system profiler. Quite a Matroska doll. I guess having an ISO is easier than mounting a USB drive in a virtual machine in terms of instructional material.

drive contents

The cards on the right had keys on them. They’re business card sized and feel like them too.

key cards

On the back were some keys. Why they felt the need to kill all these trees and grow soy beans to produce the ink for printing on said dead tree material to wrap around these numbers is beyond me.

key codes

It took two months for these two alphanumeric strings to get here. The lack of timeliness on delivering these two codes and an ISO does not look well for Microsoft’s Windows efforts at all. It would take 30 minutes to illegally obtain these materials. 30 minutes is far less than two months. Oh, I almost forgot, they don’t even include Parallels in the package. You will have to go download that from Parallel’s site. What a “quickstart” indeed.

8:33 pm / Windows , Virtualization

Here's a compiled version of Keycastr.

Update: Keycastr is currently maintained at github.com/keycastr/keycastr. Please use that repository first.

I just compiled a version of keycastr and put it here since I could not find a precompiled version that’s relatively new. The release artifacts are available here:

Keycastr releases

Keycastr is used for presentational demos. It’s free and the source is here in this GitHub repo. You will need a modern version of Xcode to compile it.

The version that is compiled is by creemama. I only blindingly updated the settings with Xcode recommendations. This “works for me” on OS X 10.8.3.

1:02 pm / Osx

Boot Camp, Windows 7, and USB Installation Gotchas

A few days ago, I decided to pull the trigger and install Windows on my Retina MacBook Pro at a LAN Party. It’s a perfectly fine machine with a decent graphics card and CPU. I started Boot Camp Assistant and followed through with the instructions to install from the USB drive using the ISO of Windows 7 I had on my Desktop. If you follow Apple’s steps to the letter, your installation of Windows will never proceed.

If you do follow the steps, you will most certainly get an error of “Setup was unable to create a new system partition or locate an existing system partition. " when you select the BootCamp partition that you had just formatted in the Windows installer on your Mac. This can occur on PCs too but basically the issue is that the USB drive is initialized as another valid bootable disk. If you were to Google this, you will find solutions online that involve yanking out the USB drive and reinserting it before pressing “Install Now” on the Windows 7 installation screen. This “Install Now” screen is a big centered button that prompts your to install now and the arrow is set inside a blue circle that’s like a gem.

This is where Apple’s helpfulness can get in your way. By default, Boot Camp Assistant copies the Boot Camp support files to your USB drive. It also adds an Autounattend.xml file to the root of your drive to automatically install Boot Camp support drivers and utilities in Windows. With Autounattend.xml present, you will not have the opportunity to yank out and reinsert the USB drive before continuing. Instead, the setup just proceeds as if that button was pressed. While this is a good file for disc installations, it causes a massive problem for USB installation which is most likely to be the case for all new Macs from now on since they do not include disc drives by default. If you try to ask Apple to ‘fix’ this, they will just blame Microsoft which admittedly isn’t blame free either.

To solve this problem, move or delete Autounattend.xml on the root of the USB drive and proceed with the normal steps afterwards . After Windows is done installing and since Autounattend.xml was nullified, you will have to run the Boot Camp support installer from the BootCamp folder on the USB drive.

It’s a shame Apple’s instructions just do not work. The fix required would probably mean removing Autounattend.xml functionality for USB Drive installations. In the meantime, this worked for me.

3:23 pm / Windows , MAC

And suddenly, nearly a decade later, a blog appears! Again.

I’m ashamed to say I’ve neglected this domain and site for 9 years. In that time I’ve gone through high school and university in that time. In each period, I’ve attempted putting up blogs, forums, another blog, and other similar nonsense. I did not follow through with whatever resolutions I may have made to keep the site maintained or write down the latest results from my last screwing around with my projects. Basically, for the past 9 years, I don’t really have much to show for it other than being able to rattle off some helpful anecdote from experiences I have never written down here and there.

Remember kids, the only difference between screwing around and Science is writing it down.

– Adam Savage, Video

I thought I was conducting Science for the past few years; in reality, I’ve only been really screwing around.

Most of my experiments in the past few years have also ended in spectacular failures. I never wrote about my failures even during the times I had a blog available. This is where my fails turned into an epic fail. I recently watched a TED talk on this and learned that this phenomenon is called research bias. I should not have withheld what I had learned from failing. My memory of my failures only fade away until someone mentioned it and I rattle off some anecdote. This obviously won’t scale and does not do much to help me demonstrate any skills when I can’t even get my foot in the door.

[... 1,835 words]

10:05 pm / Meta , Blog , Because of hope

Projects