September 10, 2010   

Recent Blog Entries


Convert VirtualBox (vdi) to VMWare (vmdk)
August 27, 2010
Recently I decided to switch from VMWare desktop to VirtualBox desktop VM software. I've heard great things about VirtualBox (speed and less-overhead being two very nice features). I did not need to migrate a VM because I wanted a fresh install of Win2008 R2 Enterprise and MSSQL 2008 R2 64-bit. I've been using VirtualBox for a few months now and for the most part it's worked out great, but there were certain things I missed from VMWare desktop. The reasons aren't really that important (I have nothing against VirtualBox and still think it's pretty awesome), but I thought I'd just share how I converted it.

I did a lot of research on the web and found many tutorials and walkthroughs for earlier versions of VirtualBox, but when I went to use those lengthy methods, I found that they weren't possible anymore (at least not the same way). The old way (which is still possible, but with a different utility) also required another program called qemu-img. You actually can still use the old method of converting the VM to raw format and then convert it again to VMWare's vmdk format using Quem-img (each conversion can take a while depending on the size of the VM). However, as of VirtualBox 3.1+ you can now do it all in one command line (and only have to do one conversion).

I'm on a Mac, so the example below is for Mac (using VMWare Fusion). But the same command line should work for Windows (you just need to substitute the paths and point to the vboxmanage.exe file instead of the contents in the app file as seen below). Also, the source and destination paths are custom in this case (I'm currently storing mine on an external storage device).

In the following example I'm calling my virtual machine filename windows.vdi for simplicity (most likely your filename is long and has spaces like mine. Thus I suggest wrapping your file locations in quotes). /Applications/VirtualBox.app/Contents/MacOS/Vboxmanage clonehd "/Volumes/Drobo/Virtual Machines/windows.vdi" "/Volumes/Drobo/Virtual Machines/windows.vmdk" -format VMDK -variant standard -type normal -remember

Note: It is VERY important to have the full paths to the source and destination files otherwise you'll get an ambiguous error message as I found out the hard way (with some google searching I was able to figure it out though). I believe this effects Windows users as well (not positive on that).

I wish I could give credit to the forum post that I dug most of this up in (I believe it was somewhere in the VirtualBox forums). Sorry to whomever I'm not giving proper credit.

After the conversion is complete, open VMWare and create a new virtual machine. Choose the option to open an existing VM.

I converted the VM with VirtualBox v3.2.8 and then opened the new file in VMWare Fusion 3.1.1. VMWare said the vmdk file was an older format and needed to be updated (I agreed of course). A few seconds later the VM opened successfully. As expected, new drivers were auto-detected and added (I believe I had to reboot the VM OS twice) and then I installed the latest VMWare Tools (followed by another reboot - all expected).

In all the process took about 30-40 minutes on a 50GB VM (about 10 minutes was the auto-update for drivers and the VMWare Tools install and reboot).

comments(0)



Hospital ER Wait Times
July 3, 2010
Last fall I helped a client of mine (Middlesex Hospital) release a new website to display their ER wait times for their three locations. It received national news. At the time they were one of only three hospitals (that we knew of) that were doing it in the nation. Since then many other hospitals have followed suit, but MHS still gets critical acclaim for it.

Two weeks ago we launched a new main hospital website for them (http://middlesexhospital.org) and placed the ER wait times on the homepage (as well a few key places on the website).

I've been getting a lot of questions lately asking how we did it. So I thought I'd walk through the process for those who might be interested. First the data itself comes from the hospital's clinical systems (specifically a system called Cerner). I don't know the process they use to get the actual numbers. Unfortunately Cerner isn't designed to distribute data (ie. web service, XML, or any other type of data feed), so we had to find a loop hole. One of the guys at MHS figured out a way to do it using Cerner's custom query system where he runs a custom query and outputs it to an ASCII-based file (text file) which is sort-of like a CSV format. It's very messy, but with a little Regex I'm able to clean it up to be pretty decent (but I'm getting ahead of myself :) ). Next they FTP the file every 5 minutes to the web server through the DMZ. Now it's in my domain and I get to use ColdFusion to do the rest.

Once on the server I have a ColdFusion directory watcher that detects the file and triggers a script to run. The script runs the regex to cleanup the data and allow the CSV file to be easily consumable. Then it consumes the data from that file into a DB. From there it queries the DB and outputs the data to a static XML file for which I have an API (Thanks to my friend Simon Free for the lessons on proper API coding and documentation). Why an API you ask? Because it allows us to use the data for other devices, systems, and apps (and an iPhone app that I believe is in development).

The final piece is to display the data. To do that I do it in two parts. Let's take the MHS homepage for example. Since we know the data gets updated every five minutes they wanted the data on the homepage to auto-update every five minutes. So, since we use jQuery quite heavily on that website I made a jQuery script (using jQuery's get() function to consume XML data) to grab and display the data every five minutes.

But what if the user doesn't have javascript enabled? No problem. I have a separate ColdFusion script that runs before jQuery has access to the DOM where it runs against a CFC to grab the data and display it in HTML with no help from javascript. That CFC script gets a little trickier since the client wanted the items returned in a different order than they appear in the XML. Sure I could have hit the XML three separate times per page load, but since this is the homepage (which gets more hits than any other page on the site) that would just be poor programming on my part. So I figured out a way to hit the XML feed once and sort the data in a desired fashion (and allow the client to change the order easily at any time).

What about the font? Did I use Flash? Nope :). At first I wrote the whole thing to work in sIFR which allows you to display custom fonts on a website using Flash. It worked great, but I wasn't really happy with it. For one, we don't use Flash anywhere else on the homepage, so why load it for just this one item? (note: we do use Flash elsewhere on the site for things like videos. Don't think I have anything against Flash like Mr. Jobs. In fact, I love Flash.). Okay, so how did I get a custom font on the website and get it to still work in things like the iPhone that doesn't support Flash? I used a feature called @font-face{} which allows you to have your clients browser download and use a custom font of your choosing in their browser. There is lots of documentation and how-to's on the web for implementing @font-face{}, but if you really want to jump in and play with it quickly I strongly suggest checking out fontsquirrel.com's font-face generator (you can use one of their free fonts or use their tool to upload one of your own). Not only do they convert your font into the appropriate format, they'll create sample code based on your font... pretty cool. Once you get your testing done though there are some things you need to be smart about, like cleaner code, small/condensed font size (try to keep the font size under 20k if possible. I try to shoot for 12k or better. There are tutorials on how to do this if you search the web), and a few other common sense developer things to keep in mind. Most importantly you want to make sure you have a fallback font (and font size) that will work well for those people with older browsers that don't support @font-face{}. Also, for legal reasons make sure you are allowed to use the font on your website (font licensing can get pretty expensive). I was lucky enough to find an open-source font that allowed us to use the font freely on the website.

Here's an interesting tidbit to know for @font-face{}. Of all the major browsers to support the feature, Firefox was the last one to the party (not supporting it until v3.5) and Microsoft's IE6 was the browser that actually first supported the feature (I know... weird). However, I have to give Mozilla props. They have a slightly better implementation for it where it allows you to offer FF browsers a much smaller/compact file size for the user to download (if you use the fontsquirrel @font-face generator mentioned above, it creates all of these files for you, including a pretty cool font just for the iPhone).

Side Note: When I created the XML files (I'll probably offer JSON soon as well if they ask for it) I decided to make the file static instead of dynamically created on each page hit. Normally you want to dynamically create the XML on each page load, however the reason I chose to statically save the XML file was because the hospital only sends the data to me once every five minutes. Since this data is requested a lot from many sources, it would be unwise programming to hit the database repeatedly for the same information. Sure I could have cached the query, but technically this uses less resources.


UPDATE: For those interested, I made a quick little video showing off a few of the features of the site. I tried to keep the video to one minute, so it only shows a small percentage of the site's features. It was a huge project that involved a lot of people. Thanks everyone who contributed. Your efforts are greatly appreciated. Special thanks go out to Sean Coyne and Marco Pace for their endless hours and dedication to get the project done on a tight deadline. With their help and the coding speed of a good CF framework we were able to release the website with a plethora of features beyond the client's expectations.

comments(5)



cfObjective 2010 Presenation: ColdFusion & jQuery - Two Great Tastes That Go Great Together
April 24, 2010
Yesterday I gave my presentation on ColdFusion 9 and jQuery integration. It was more of an intro approach to some of the topics and I'm glad that it was well received.

The presentation originally housed content about a mock company I made called Widgets Inc. I decided instead to swap out most of the media content with some content from the conference (a few photos and videos). It was done simply to make it a little more fun while hopefully learning something new.

Sorry for the large file size on the zip (~30MB). The reason is because of the final video at the end of demo 8 which was nothing more than just something for fun where I included pictures of many attendees at the conference (many of whom were in the audience). I kept it for the end and only showed it once Q/A was completed and we still had a minute to spare. I had planned to pull it from the final downloadable presentation zip file, but several people have asked me to keep in in there (sorry for the extra 19MB :).

I purposely have very little slides (mostly just the topic title and a slide about the presenter). I prefer to have the "meat & potatoes" be in the live demos of my presentations when possible. The attached zip does have a PDF for slides though in case you're interested. I did spend a little time yesterday and today adding notes to the top of each demo file before I uploaded the presentation to my blog. Definitely read those as well as the readme.txt file in the root. they help explain a little what I was talking about during my presentation (without having to bloat slides). To deploy the demo, you don't need a database. You just need access to CF9.

I've attached the zip file as an enclosure. If you're browsing my blog, there should be a "Download" link associated with the blog entry to get the file. Enjoy.

Side note: As I sometimes like to do, I have subtle jabs/jokes I take at Simon Free (someone I knew would be in the audience). Although we may have funny banter and jokes back and forth at conferences (and sometimes in our sessions) I still make sure that it doesn't overshadow the content or spoil the presentation. The subtle jokes are merely there for our amusement (and the amusement of others). But I'll be honest, we tend to "one-up" each other each time, so I fear how he will retaliate in his session at the next conference :). Oh, and if you ever run into Simon, ask him if he's French (he likes that ;)

comments(1)



Speaking at cf.Objective() 2010
January 6, 2010
I'm happy to announce that I'll be speaking at cf.Objective() 2010 this year. I have been fortunate enough to speak at the conference in the past (every year since it opened in 2006) and am excited to present once again. This year my topic will be ColdFusion & jQuery: Two Great Tastes That Go Great Together.

The early bird price ends on January 29, 2010, so make sure you register early in order to get a good discount (and before they sell out).

comments(2)



FarCry: Bulk Image Resize Script
October 1, 2009
Last week I finished writing a bulk image re-size script for a client of mine. It went through several revisions before finalizing on the version you can now download. Because I found it so useful I decided to release it to the public.

The script can be used for several reasons, but here are a few examples:

  • You've added new image fields (and sizes) to an existing content type with existing images.
  • You've decided to resize an existing image field.
  • You want to use a new image compiler on all existing images.

Although I've only tested the script in FarCry 5.1+, it should work in FarCry 4.x (but no promises :) ).

To download the script, please use the download link associated with this blog post (for RSS readers, refer to the enclosure file).

Here is a quick video tutorial where I show a couple examples of the script in use.

FarCry: Bulk Image Upload Script from Jeff Coughlin on Vimeo.

comments(0)