Skip to content

How to run Java samples from VMware SDK on Ubuntu 10.04

There are subtle differences in all Linux platforms and when I got to run VMware SDK Java samples on Ubuntu 10.04 I found there is something that is worth to share in addition to my first post about it.

First of all, there are very convenient “default” packages for JRE and JDK that have openjdk-6-jre and openjdk-6-jdk:

apt-get install default-jre defalt-jdk

Of course that means a different value for JAVAHOME:

export JAVAHOME=/usr/bin/openjdk-6/

Second, in my first post I did not describe how to get and store VMware server certificates.

If you follow the Setup Guild then you have to connect to a VMware server by SSH or use the vClient. But you can get the certificate from the Firefox browser: when connecting to a VMware server and asked to confirm the certificate, there is a button to export it. This allows to save the certificate locally and then add it to the keystore:

keytool -import -file XXX.XX.XX.XX.XX.cer -alias XXX.XX.XX.XX.XX \
-keystore vmware.keystore VMKEYSTORE=~/vmware-certs/vmware.keystore
export VMKEYSTORE

Also the tofrodos package has different name for the dos2unix utility, it is called fromdos now:

apt-get install tofrodos
cd %SDKHOME%\samples\Axis\java
fromdos *.sh

Unfortunately the axis binaries I still had to download manually.

HowTo: Install New ALSA Driver

During initial installation of Ubuntu 10.04 it detected my audio chip (integrated with my Gigabyte motherboard) without any problems, but after a couple of hibernations or for some other reason it lost it:

aplay -l
no soundcard found

I actually was surprised it found it at the first place as on any platform this kind of audio requires installation of hi-def drivers.

Anyway, first I tried to reload ALSA:

sudo alsa force-reload

It did not help.

Then after some digging I decided to compile and install the ALSA driver for my codec. My codec happened to be Realtek ALC888:

cat /proc/asound/card*/codec#* | grep Codec
Codec: Realtek ALC888

I got the driver from the Realtek web site.

Then untared, compiled and installed it:

tar xf LinuxPkg_5.15rc5.tar.bz2
cd realtek-linux-audiopack-5.15/
tar xf alsa-driver-1.0.23-5.15rc5.tar.bz2
cd alsa-driver-1.0.23/
./configure --with-cards=hda-intel
sudo make install

After rebooting got Rhythmbox loaded with Dire Straits and Tracy Chapman, sounds amazing.

Restore Vista MBR

When I removed a failed to load Kubuntu partition on my dual boot laptop, I did something stupid: I rebooted the computer.

Of course I ended up with Grub “Error 22″.

Fortunately I had a recovery DVD with system files and after booting from this DVD and getting into the command line, I found file bootrec.exe.

Executing it as:

bootrec.exe /fixmbr

restored the MBR and I was able to boot into Vista.

How to Assign Task Description

In one of comments the following code did not set a task description (shown in vSphere Client in Details column):

LocalizableMessage lm = new LocalizableMessage();
lm.setMessage(“Hello World”);
myTask.getTaskInfo().setDescription(lm);

The problem is in missing key property of the newly created LocalizableMessage: it must be assigned from the task itself.

This is how it’s suppose to be done (Java):

LocalizableMessage lm = new LocalizableMessage();
lm.setKey(myTask.getTaskInfo().getKey());
lm.setMessage(“Hello World”);
myTask.getTaskInfo().setDescription(lm);

This is an example in C# (taskInfo is known value of Vim.TaskInfo type):

LocalizableMessage myDetailMessage = new Vim25Api.LocalizableMessage()
   { key = taskInfo.key, message = "my details" };
connection.Service.SetTaskDescription(taskInfo.task, myDetailMessage);

VMware Host IP Address

VMware host IP address is something of a phantom property: everybody knows it exists and use it all the time, but nobody knows where it is.

Well, this is probably because its location in the model changes depending on the host version and current network configuration.

This is how I get it.

1. For ESX systems, the system IP address is the IP address of the console, so its located at

config.network.consoleVnic["key"].spec.ip.ipAddress

where “key” is usually the only key in that collection.

2. For ESXi systems, the system IP address is the IP address of the HostVirtualNic class instance that is associated with the Management Network:

config.network.vnic["key"].spec.ip.ipAddress

where the “key” is the key of vnic that belongs to the management network portgroup.

Printing from Emacs on Windows

I’m a Emacs guy and this is how I got it printing on on of my Windows boxes (XP SP2) where I already had Cygwin.

1. Install PDF Creator.

2. Update .emacs file with the following:

(setenv "PRINTER" "PDFCreator")
(setq ps-printer-name "PDFCreator")
(setq ps-printer-name-option "-d")
(setq ps-lpr-command "/cygwin/bin/lpr")

3. Print into a PDF file with ps-print-buffer and then to any printer (or not at all).

How to Retrieve Task Info

This is how to retrieve a task info in you have the task MOR:

ObjectContent[] objs =
connection.Service.RetrieveProperties(
   connection.ServiceContent.propertyCollector, new PropertyFilterSpec[]
   {
      new PropertyFilterSpec()
      {
          objectSet = new ObjectSpec[]
             { new ObjectSpec() { obj = taskMOR } },
          propSet = new PropertySpec[]
          {
             new PropertySpec()
             {
                all = false, allSpecified = true,
                type = "Task", pathSet = new String[] { "info" }
             }
          }
      }
   });
TaskInfo result = (TaskInfo)objs[0].propSet[0].val;

Simple .NET Profiler

Every developed needs a profiler. When I worked for Cognos our internal standard was Rational Quantify; I think it was alright.

Now when I deal with .NET and want to see a physical proof of my internal vision of how my application works I use a profiler from Eqatec: simple and effective if the only thing you need is a list of your routines, a number of times they have been called and their average.

Work with in three steps: build (instrument), run and view (analyze).

Good SSH client under Vista

I have been looking for a PuTTY replacement for awhile now not just because it is so old and ugly looking but also because it would drop connections from time to time.

Last week I installed a free-for-personal -use version of Tunnelier from Bitvise on my corporate laptop’s stripped down (meaning kindа usable) Vista Home Premium Edition and it seems to be functioning well.

It comes with a nice basic FTP client and easy on eye.

VMware APIs

Currently there are a few APIs and this post is a short summary of them.

- vSphere Web Services SDK a.k.a. VMware VI API, last version is 4.0, released May 21st, 2009.

This is a SOAP over HTTP/S protocol that exposes everything you can do on a virtual data center: configure resources, manipulate with virtual machines, retrieve events and performance metrics etc. Complex. I work with it every day.

- vCloud API, still in preview version.

RESTful web service that is kind of meta of super API for allocating an collapsing resources of VMware-software based cloud computing implementations.

- VIX API, version 1.8.1

One of the first VMware APIs I got to know. Allows simple manipulation with virtual machines. As I understand was designed for partners making agents for VMware servers console.

- vSphere Guest SDK, now in version 4. Strange, but I have always been thinking it is a brand new API.

If you code an application that for sure will be running on a virtual machine, use this API to make your product aware of it by consuming the hypervisor resource management information.

- CIM SDK (SMASH, SMI-S) latest version is here.

If you don’t know what CIM is, this SDK won’t help you, if you do, then you don’t need anybody to tell you what you use it for.

- Also there are Chargeback, vNetwork, SNMP MIB, VDDK and little more that is of a special interest of a very special kind of people who I doubt ever read this blog.

Good summary document at VMware web site.

Soft & Virt is Digg proof thanks to caching by WP Super Cache