VMware Releases VI3 Perl Toolkit Virtual Machine

Recent stock market darling VMware has just released a Perl toolkit for it’s Virtual Infrastructure virtualisation product, as well as a Perl toolkit virtual machine that you can download for free to play around with.

VMware describes the toolkit as “an easy-to-use Perl scripting interface to the VMware Infrastructure API (VI API). Administrators and developers who may be more familiar with Perl (rather than with Java, C#, or other programming languages) can readily leverage the VI API. For developers who have previously worked with the Scripting API (VmPerl API), the VI Perl Toolkit is the tool of choice.”

An example VI3 Perl script, perf.pl, can be downloaded at the VMware forums site. Perf allows you to measure the performance of your virtual machines running on ESX 2.x or 3.x servers during a specified period of time.

9 Great, Free Applications that Work with Vista

This is a list of my favorite Windows applications that I honestly couldn’t live without that also work on Microsoft Windows Vista RC as well, much to my surprise. All of the software is free to download and use, and in fact most of them are open source.

ConTEXT – ConTEXT is a free and lightweight editor for programming or can be used as a notepad replacement. ConTEXT supports find and replace in multiple files at once so changing one method in loads of files is no longer an issue. Works in Vista with no problems whatsoever.

Synergy – Synergy is like a software KVM, but only shares keyboard and mouse capabilities. Synergy is multiplatform, and I currently use it to have my keyboard and mouse work in Ubuntu, Vista, and my Mac Mini running Leopard with no problem at all! This way I get to use my favorite keyboard and mouse and get to free up some space on my desk at the same time.

VLC – VLC has been my favorite media player for years now. VLC comes with most of the codecs you will need to watch videos on your PC already. VLC is very lightweight, and JUST WORKS, something that can’t be said about many media players. The only issue with VLC in Vista is that it turns Aero Glass off while it is playing.

FileZilla – I use FileZilla to interface with clients that still haven’t moved to SCP. FileZilla is an open source FTP client that gets the job done, supporting drag and drop, SSL, and NAT to NAT connections. The only thing it is missing is FXP support, but that’s not really a big deal in my case. Works fine in Vista with no problems at all.

IMGBurn – I love IMGBurn. This is hands-down the easiest way to burn .IMG, .ISO and BIN/CUE disk images to backup CDs or DVDs. Free, open source, and awesome. Works a treat in Microsoft Vista Beta 2 as well.

WinSnap – I use WinSnap to make many of the screen shots you see on blandname. WinSnap supports full screen and windowed screen shots, and also allows for rotation and drop shadows if you feel the need.

Electric Sheep – I often refer to Electric Sheep as “the best screensaver ever”, but truth be told, it’s really a collection of computer-generated screensavers that allow users to vote on them using a Digg-like system. On Windows, Electric Sheep uses bit torrent to transfer the sheep data. Again, working just fine in Vista!

Xming – Xming is my prefered interface to remote Linux boxes. Xming is for Linux what RDP is for Windows – you get a local X server and acceleration that displays data from remote applications running on Linux machines. Tested more than a few times to a remote Ubuntu computer, and one Gentoo box with no caveats.

WinSCP3 – SCP is now my preferred file transfer method. Luckily my favorite client also works on Vista, or I may not have used it at all. Much like FileZilla, WinSCP3 has a very simple, streamlined interface that is feature-rich and gets the job done, even on Vista.

So there you have it: 9 free applications I couldn’t live without that work just fine on Vista, and make it easy for me to do my day-to-day tasks. Hopefully someday this list will include F-Spot and Amarok, but I’m happy with this as a start considering neither of them work on Windows XP SP2 either!

Make Prototype.js TINY – Keep Compatibility

Prototype.js is a very popular AJAX framework used when building dynamic websites. You will find Prototype in most Ruby on Rails projects as it is included by default, and for good reason; Prototype.js is a great library that includes a lot of functionality.

Unfortunately it is rather large in size, weighing in at roughly 50KB.

Although many have managed to reduce the file size of Prototype by paring down the code and gzipping the file, we’re going to use an additional tool to approach the problem, one from the Mozilla foundation that appears to work very well – Rhino.

(Oh, in the interest of full disclosure, I am a Java fanboy, having studied at a university that got a lot of Sun funding back in the day. I hope you can see past that and check out this Javascipt hack, I really do.)

An informative quote from the Mozilla page for the Rhino project goes like this:

“Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.”

Alright then, so what you have is a Java bytecode version of Javascript that will work in most browsers.

Sounds interesting, let’s see what we can do with Protoype.js!

I decided early on to use a Rhino tool that I found on the Dojo site that allows me to compile Javascript and make it Rhino compatible. The page give you a brief walkthrough and some examples on how to use the tool, so I won’t need to cover that here in detail.

So we compile our Prototype Javascript file, let’s see what our results are then, shall we?

Before: 47445

After Rhino: 32716

After Rhino and gzip: 9454

So it’s at about 9KB now!

In order to utilize the new file, upload it to the directory that houses your original Prototype javascript file, then any instances of prototype.js in your code to prototype.jgz (zipped javascript).

You’ll also want to change your .htaccess file so that you handle the new script properly by typing pico (or nano or vi or what-have you) .htaccess:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ".*Safari.*" [OR]
RewriteCond %{HTTP:Accept-Encoding} !gzip
RewriteRule (.*)\.jgz$ $1\.js [L]

AddType "text/javascript;charset=UTF-8" .jgz
AddEncoding gzip .jgz

You'll notice here that we're doing user agent detection for Safari. When I did my testing it seemed to be spotty, so what we're doing is falling back to javascript if we see that the user is using Safari. We're still compatible, and the code works everywhere else.

blandname launches prefoc.us beta

We finally launched our online RSS reader today, and are looking for testers. The site is called prefoc.us

prefoc.us (prefocus) will eventually allows (!) for more interactivity (!!) but since it’s still in beta these functions aren’t available yet. You can also add feeds to be parsed, and view pictures, listen to audio, and even watch videos!

Stay tuned to blandname as the site develops.

Oh, and more tech tips coming soon!

Ruby on Rails installed by default in Leopard

This is more of a teaser, but my dream has come true! Ruby on Rails is now installed by default on Apple Mac OS X 10.5 Beta (Leopard WWDC edition). Getting it up and running is really a snap.

Here’s the quick and dirty way to make a sample Rails environment and start the server.

Firstly, open the Terminal application. You know the scary black window with white text. Well actually it could even be white with black text – your mileage may vary (mine is black with green, for example).

Anyway, we’re wasting time – this is quick and dirty right? Otherwise I would be talking about chunky bacon.

In Terminal, type:

rails example

You’ll be met with a nice list of scrolling lines and when it’s done your “example” Rails application will have been initialised.

And that’s pretty well it!

Moving on, we want to see something tangible to prove to ourselves just how flippin’ impressive this really is, and why you knew when you saw that Apple Developper Connection article about Rails you knew good things were to come.

In Terminal, once more, sweating profusely now, we type:

cd example

ruby script/server

This runs the server for us. Once it has been set up, you can safely minimize the Terminal, and fire up Safari, Firefox, Camino, iCab, heck even Internet Explorer. We’re navigating ourselves to: 127.0.0.1:3000

Here’s what we find there (click the thumbnail to enlarge the screenshot):

Ruby on Rails 1.1.2 running on OS X Leopard

The nitty-gritty (no dirt band):

  • Ruby version – 1.8.4
  • RubyGems Version – 0.9.0
  • Rails version – 1.1.2
  • Active Record version – 1.14.2
  • Action Pack version – 1.12.1
  • Action Web Service version – 1.1.2
  • Action Mailer Version – 1.2.1
  • Active Support version – 1.3.1

It’s set up in a development environment by default (where you want it), using the sqlite3 database adapter (pretty typical).

Next time we’ll show you how to update these and run irb. Until then feel free to vote in our poll and support us!

Ruby and FTP

I came across a great tip that should help anyone trying to make an FTP client in Ruby. Basically it seems the Net/FTP library is attempting reverse lookups of addresses you try to connect to (which is in itself fine, but perhaps unnecessary). The problem arises because the reverse lookup is called each time a new file transfer is initiated. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/112801

Here’s the resolution I found in the japanese forum:

BasicSocket.do_not_reverse_lookup = true

Dreamhost Stats Rewriting and Typo with .htaccess

If you run Ruby on Rails apps, or a Typo installation on Dreamhost, you may have noticed that you cannot access your stats page. Here’s the code that will get it running, quick and dirty, and have you poring over stats for HOURS!

You’ll want to login to your server using SSH, then edit the .htaccess file in your public folder, from within your home directory. Here’s how I did it as an example:

# pico /ruby.doesrails.com/public/.htacess

Cut and paste the following code:

# This is the stats rewrite rule for use with Dreamhost

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]

(select the code, use CTRL+C on windows, or APPLE+C on a Mac, then to paste use SHIFT+INSERT on most SSH clients, or simply right-click and select paste from the menu)

You can put this anywhere in the .htacess file and it should work, as long as it is after the

RewriteEngine On

rule that already exists.