Jan

22

Posted by : Billy | On : January 22, 2012

Recently upgraded my laptop to an SSD after using a Seagate Momentus XT 500 GB drive for over a year and a half. The XT is a wonderful drive: it is a hybrid drive, combining storage of a 7200-RPM disk with speed of a small SSD, all in a normal 2.5″ hard drive form-factor. It actually uses the SSD as a type of cache, so it appears as one drive. Much faster than a typical 7200-RPM drive. I like it so much, than as I’ve bought new laptops, I’ve always moved it to the new machine, selling the “new” hard drive in the old laptop.

Well, I jumped up as high as I could go, finally springing for a 512 GB SSD. I wanted to do a clean OS install, and just copy files over from the XT, by putting the XT in an external enclosure. Typically with 2.5″ drives the power consumption is such that you can use a USB powered external enclosure. Not so for the XT. When I put it in the enclosure (NexStar SX) the drive started beeping. Thought it was the enclosure, but turns out it was the drive. I then tried jury rigging the drive with a Western Digital MyBook interface (it took a fall, breaking the enclosure, but the circuitry and the drive itself work great). For whatever reason, that didn’t work either, though no beeping (perhaps that interface is designed to only work with WD drives)

I ended up putting the XT back in my laptop, doing a full backup of it, and now I’m restoring off of that backup.

Turns out the SSD part of the XT requires a bit more power to start the drive than a normal 2.5″ drive. So if you want to use it in an external enclosure, you’ll need either a powered one (use a 3.5″ enclosure) or if your 2.5″ enclosure doesn’t support external power, you can use a USB cable that draws from multiple USB ports. See http://forums.seagate.com/t5/Momentus-XT-Momentus-Momentus/Momentus-XT-500go-as-an-external-mass-storage-experience-and/td-p/88486

Jan

22

Posted by : Billy | On : January 22, 2012

For a while now, I’ve been using Sublime Text instead of ColdFusion Builder/CFEclipse – it’s faster and just gets out of the way. (I do still use Eclipse for MXUnit plugin however)

Getting ColdFusion support wasn’t too hard – I used the great package at https://github.com/indynagpal/coldfusion-sublime-text-2. However, it felt a little too “hands-on” for me for 2011.

However, today I discovered another ColdFusion package. The folks over at sublimetext.info (as best I can tell, not connected to the official company) have a GitHub repo at http://github.com/SublimeText with a number of Sublime Text packages for various languages. ColdFusion is one, and while it doesn’t have the massive snippet support of indynagpal’s, it does do a good job of mirroring some of the most common shortcuts used in Eclipse. You can do the downloading and unzipping thing (or git clone) – uggh – but you can also use the very excellent package manager over at http://wbond.net/sublime_packages/package_control to install ColdFusion support in Sublime Text in just a few steps:

  • Install Sublime Text from http://www.sublimetext.com if you haven’t already (unregistered version currently never times out, but I recommend purchasing it – the time you’ll save not waiting around for Eclipse to load will pay for itself quickly!)
  • Open Sublime, press CTRL (Update: both Mac and PC – *NOT* CMD on Mac) + ` (For the confused: hold down those 2 keys at the same time – note it’s the character below ESC, not a single quote)
  • Copy and paste the following into the console that comes up in Sublime Text: (from http://wbond.net/sublime_packages/package_control/installation)
    import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
  • When it finishes (“Please restart Sublime Text to finish installation” shows in the bottom line of console), close Sublime Text and reopen
  • Click Preferences > Package Control
  • Click “Package Control: Install Package”
  • Scroll to or just type “ColdFusion” – hit Enter
  • You’ll see some action in the status bar of the app – it’ll tell you when it’s installed
  • Code your little ColdFusion heart out now – for into on shortcuts, etc, see the readme at https://github.com/SublimeText/ColdFusion

 

Nov

28

Posted by : Billy | On : November 28, 2011

Every EC2 instance is based on an Amazon Machine Image (AMI), which is basically a VM image. These can be “off the shelf”, or even better, you can customize one to your exact needs.This is really useful when you want to replicate machines, spreading work load across a mini cluster.

You can automate this from ColdFusion. Typically I’ll have a URL I call that starts up a series of tasks on each machine. Since the address for each machine is assigned by Amazon (you can get fancy with Elastic IPs if you’d like, but there’s really no need), it’s a matter of querying Amazon for the list of server names. Of course, if you’re running different types of machines, you want to filter by AMI ID, which of course changes each time you build a new image.

I won’t get into the exact code for querying here, but here’s how you get the AMI for a given machine from within ColdFusion: (Assumption is that this machine is one of your cluster machines, so once you have its AMI ID, you can filter for other machines like it)

<cfscript>
if (! isdefined("application.amiId")){
application.amiId=fileRead("http://169.254.169.254/2011-01-01/meta-data/ami-id");
}
request.amiID = application.amiId;
</cfscript>

Note: above tested in Open BlueDragon 2.0 – use <cfhttp> tag for engines that don’t support fileRead(uri)

As you might guess, that IP address is an API for EC2 metadata. The date is the API version (call the root IP address to get a list of API versions), “meta-data” is the API service, and “ami-id” is the value you’re requesting. (Call the URL without “ami-id” for a list of available values). For more information, go to http://docs.amazonwebservices.com/AWSEC2/2008-08-08/DeveloperGuide/index.html?AESDG-chapter-instancedata.html

Nov

27

Posted by : Billy | On : November 27, 2011

Small tip, but this held me up a bit.

For unit testing in ColdFusion, MXUnit is the standard. Even better, you can run your tests from within Eclipse, via a plugin.

After dropping MXUnit into my app (OSX 10.7.2 on dev machine, Eclipse+CFEclipse, Tomcat 7.0, Open BlueDragon 2.0 – had some pathing issues, but that’s another post…)

Right clicking on a unit test (such as in mxunit/samples/MyComponentTest.cfc) and selecting Run MXUnit Test, I received the following error:

Turns out it was going to port 80, rather than the port my CFML engine was running on (8080 in my case). This is an Eclipse preference:

Change the port to “http://localhost:8080/…” (or whatever you’re running) and it should work

Nov

27

Posted by : Billy | On : November 27, 2011

I’m trying to get back on the git train. I worked with it on a project a couple of years ago, and really liked it, but since then, I really haven’t strayed from Subversion. Truth is, svn is easy: there are more tools, and you don’t have to deal with SSH keys and whatnot. However, on my current project, I really run the technology, so I really wanted to do thing the “right way”.

Our project management solution is Assembla. We were on Unfuddle, which is pretty good, but Assembla offers more. (I flirted with using a private GitHub repo) Some of the advantages Assembla offers:

  • Single project workspace, multiple repos. I like being able to tie checkins to tickets, but don’t want a single set of tickets: other solutions are one-to-one or many-to-many with their tickets projects and repos.
  • Support for post-commit hooks
  • Integrated chat (not really useful, but makes impromptu chats without requiring folks to run IM clients)
  • Agile planning tools: This was the thing that no one else seemed to do. It features burn down charts, a Kanban card wall, virtual stand-up meetings, per sprint hour summaries, and more.

On agile: I’m the only developer – does agile make sense? Absolutely!! I frequently have to drop things at a split moment’s notice and work on something else: it’s imperative I inject tasks and still keep sight of the overall progress. I could really go into this, but that’s for another blog post.

So I set up my git repo in Assemba, committed locally, and was ready to push. (This isn’t a git tutorial … we’ll get to the point here in a minute) However, the connection failed when doing the following:

git remote add origin git@git.assembla.com:myrepo.git
git push origin master

You want to make sure you properly set up your SSH keys:

  • When setting up your SSH public key in Assembla, it’s easiest to upload (https://www.assembla.com/user/edit/edit_git_settings) your pub file (for example, id_rsa.pub). If you’re on a Mac, you’ll either have to enable seeing hidden folders (since it’s in ~/.ssh), or copy it someplace you can easily get to from browser:
    cp ~/.ssh/id_rsa.pub ~/Desktop/id_rsa.pub
  • Make sure you have git configured with the email address that you use to login to Assembla:
    git config --global user.email myassemblaemailaddress@example.com
  • This was the one I still had to do to make it work .. configure your SSH hosts by editing ~/.ssh/config with the following: (if there’s other entries, just add to bottom of file)
    Host git.assembla.com
    IdentityFile ~/.ssh/id_rsa
    GSSAPIAuthentication no
    PubkeyAuthentication yes
    PasswordAuthentication no

That did the trick. I realize I left much about git out here (for example, you may not want to globally set your email address) but I just wanted to show what worked for me.

Oct

16

Posted by : Billy | On : October 16, 2011

I’m running Selenium on headless Ubuntu Linux servers (in EC2), using a virtual X-server (Xvfb – X Virtual Frame Buffer). This is of course means that all installs happen via the command line. (You can actually set up a VNC or NX server if you want to login and get a GUI, but that’s really not necessary, eats up resources, and is a fairly slow experience)

This is always very easy when you’re dealing with software you can “apt-get” (such as Firefox), but for other software, it can be a challenge (for example, Google Chrome).

First of all, finding where to download Google Chrome is a bit challenging; unlike a browser where you can just click a link and let the redirects bounce around, when downloading via the command line (using wget) you need the exact URL. Tracking this down isn’t immediately obvious (loading the download page up in a normal browser you see various forms and get some redirects). However, I found it:

https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

So login to your server via SSH, and:

cd /tmp
sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

Now to install it:

sudo dpkg -i google-chrome-stable_current_i386.deb

Hmmm.. big oops – unmet dependencies. (At least on my server.) So let’s knock those out:

sudo apt-get -f install

At this point, Chrome should be good to go. Of course, there’s some gotchas with how you’d start Selenium, etc, but that’s for another post …..

Oct

15

Posted by : Billy | On : October 15, 2011

I picked up an iPhone 4S yesterday. The plan was to give my current iPhone 4 to my wife (she’s upgrading from a Blackberry Torch)

Easy: go to AT&T store, get my new phone. They put a new SIM card in the iPhone 4, with her number (the Blackberry uses a standard SIM, iPhone 4 uses Micro SIM)

Then I reset her phone, and try to set it up. However, I run into problem, due to the fact that I was running a beta of iOS 5 on it: it doesn’t recognize the phone as provisioned for development. Even though it had been, and it is the same phone, apparently with a new SIM it is seen as a different device.

So I need to reset it, not only to get it working, but so it can be bumped up to release of iOS 5; no need for my wife’s phone to use the developer release.

First, put phone into DFU mode.

Hooking it up to my computer and attempted to reset resulted in an error message after running the restore. At first, I thought it was iTunes: I was running the beta of iTunes 10.5, which apparently expired yesterday. So I download latest version, and try again – it tells me the phone isn’t authorized for that version (it was trying to restore to iOS 4.3.5). I believe the restore checks with Apple to confirm the OS (it’s signed), and with the release of 5, Apple was revoking older versions.

The key: you need to update to iOS 5, not an older version. This requires downloading the iOS 5 update manually, rather than using iTunes/iPhone to do it (since you’re phone is in DFU mode).

  • download it from Apple’s servers – here’s a list (Make sure you download the correct version for your device)
  • in DFU mode, with iPhone connected to USB, hold Alt (Mac OSX) or Shift (Windows) key and click Restore while key is held  (in iTunes, select your phone > Summary tab) – it will then prompt you for the location of the IPSW file you downloaded
  • Should be able to update your phone correctly at this point, restoring to clean iOS 5

Sep

15

Posted by : Billy | On : September 15, 2011

A couple of weeks ago I had the pleasure of having a conversation with Carl Franklin and Richard Campbell on .NET Rocks!, one of the premier .NET podcasts out there. While I ColdFusion is definitely my first love, I do plenty of .NET development, mostly C# WinForms and plain ole C# objects. That said, I think the show is great for more than just .NET – I can’t tell you the number of times I’ve learned new information on their site unrelated to .NET.

The Show

Our conversation was a follow-up to some email I sent them regarding a show where Rey Bango was a guest (talking about JavaScript). Rey, currently at Microsoft, was a ColdFusion guy back in the day, and on the show, ColdFusion was referred to as a “blast from the past”. I think that’s far from true: while ColdFusion is an “old” technology, it’s highly relevant today. So… a few emails later, they brought me on the show to talk up some ColdFusion.

When you speak in a public venue, you generally have an unlimited list of things you want to discuss, but a limited amount of time. So as you can imagine, there were tons of things I wanted to talk about that I’ll try to touch on here.

To the ColdFusion community: You’ll probably find a lot of things I failed to mention, which I did, but the focus was to emphasize that ColdFusion is a modern day language that is as relevant as .NET, PHP, and others. I think we accomplished that purpose. Also, the conversation was a very candid one, and looking back, I fear I may have come off as bashing Adobe a bit. I hope that’s not how my comments were received, but rather, but in the spirit they were given: a desire that Adobe more eagerly embraces its role as a server-side leader and putting ColdFusion more front and center.

To the .NET developers: Based purely on what you heard on the show, you probably have some impressions about what ColdFusion is, and what it isn’t, and how it’s deficient. I’ll attempt to address some of those ideas here

Event handling

ColdFusion does have a large degree of event handling, but it’s more like ASP.NET’s page lifecycle approach: onServerStart/End, onApplicationStart/End, onSessionStart/End, onRequestStart/End, etc. There are error events as well: onError, onMissingMethod, etc. There is also event handling inside of ColdFusion 9′s Hibernate integration, based on various ORM events. It also has an event gateway, which let’s you respond to various non-request events (such as watching a directory or message queue and responding based on defined listeners).

Moreover, the various MVC frameworks add more. (In speaking on MVC, I’ll be referencing ColdBox, which I know best. However, I’m certain most or all of what I address with apply to the others.) These frameworks have additional events (or extend the ones built into ColdFusion) accessible via framework methods, and you can even define your own events.

What you don’t really have are client events triggering events on the server. (I’m not talking things like jQuery events, but rather, ASP.NET code-behinds) ColdFusion doesn’t care about your markup, or how it received it’s headers: it just responds to what it’s given. This how all languages work, and it’s purer to the heart of what HTTP really is. (Hence, the movement away from WebForms towards ASP.NET MVC)

Tag-based syntax

Many think of ColdFusion as HTML++, since it has a tag-based syntax. This is true, but this in no way takes away from the language – it is a fully featured programming language. (Looping, calling web services, threading, PDF integration, database integration, objects, etc….)

However, for those who don’t like this syntax, ColdFusion has an C-style syntax that anyone familiar with C# should feel comfortable with. In the past, it was simply a way to do basic variable manipulation. However, over time, it has grown to include more and more of the language. As of the most recent version, you can query databases, send mail, write log files, create threads, and pretty much everything you’d do in tags, with only a short list of exceptions (rarely used platform-specific tags). You can even write objects fully in “CFScript” (while that goes back to CF’s roots, it’s now a misnomer in my opinion, as it’s more of a “second language” than scripting)

I had an app doing a lot of crazy things with Selenium RC. Originally the app was written in C# (because iterations of it used WebClient and then the iMacros .NET object), and I was utilizing the Selenium .NET object. However, I recently migrated over to using ColdFusion, relying on CFSelenium. I was able to copy and paste this code from C# directly into ColdFusion, and it ran with very little modification (in the catch block, the Exception type is different, and I removed “System.Threading.” from my Sleep() calls).

ORM

ORM has extensive use in the .NET space, whether you’re using the built-in Linq-to-SQL, or Entity Framework, or an add-on framework like NHibernate. ColdFusion integrates Hibernate as a core feature. You can even create objects, give them a “persistent” attribute, and they’ll become entities with no boilerplate needed. In addition, there’s a couple of great custom ORM frameworks that came out in the years prior to the Hibernate integration, Transfer and Reactor.

What about the rest of LINQ, where you can use SQL-like syntax to query non-database resources? ColdFusion has a feature called Query-of-Queries. This allows you to take a recordset, perform an in-memory query of it, and create a new recordset. Yes, ColdFusion has its own built-in SQL parser. This is cool, but this can be used for more than databases, as a number of ColdFusion functions return query objects, such as <cfdirectory>. Moreover, ColdFusion allows you to construct your own recordsets using functions like queryNew(), querySetCell(), etc, so you could mold any data structure into a format that lets you query, essentially doing what LINQ-to-Objects does.

.NET integration

You can integrate .NET classes into your ColdFusion applications – it can call them the same way it can call ColdFusion objects you’ve written, Java classes, or SOAP web service, via createObject().

Some of ColdFusion’s winning moves are the integrated features that other platforms require add-on components for: easily sending and receiving email, image or chart generation, PDF file generation, etc. ColdFusion exposes a number of these features (known as ColdFusion as a Service) via a series of SOAP services.

 

ColdFusion is a great platform, and like all platforms, it has its pros and cons. I hope I’ve helped the intelligent developer out there see that most of the worn-out arguments about the platform don’t hold much water or are outright incorrect, and that it’s a valuable thing to have in your toolbox, like .NET, Ruby, etc. I want to thank Carl and Richard for having me on .NET Rocks!, and want them to keep up the awesome work.

Sep

04

Posted by : Billy | On : September 4, 2011

Due to how Google Chrome handles “untrusted” SSL certs and the fact that Selenium uses its own cert when running tests, if you hit an SSL URL in Chrome when running a Selenium test, you’ll get a big ugly red screen asking you to confirm the security exception – and you’ll have to do this for every single test! Not good if you’re automating multiple tests, and unlike Firefox, you can’t permanently set the exception.

Solution is readily found, but I want to clarify how you use it, since I had trouble with it. You use the -trustAllSSLCertificates flag, but you specify this when launching Selenium (I was under the impression you specified this to the browser arguments when calling .start())

java -jar selenium-server-standalone-2.2.0.jar -trustAllSSLCertificates

Sep

01

Posted by : Billy | On : September 1, 2011

This afternoon I was interviewed for a pretty big podcast – .NET Rocks. .NET Rocks is of course focused on .NET, but it also talks a ton on other technologies as well. I had the privilege of talking up ColdFusion on their show. As in any situation where you’re speaking in a “public” setting, there are things you wish you had said, or had said differently, but on the whole, it went well. The show is to be published on September 8, 2011.