Sunday, December 6, 2009

vmrun cool tool!

In the last two posts I have introduced you to running VMware virtual machines headless and the basics of the vmrun command. In this post I want to outline some of the other great things you can do with vmrun. I will assume you know by now how to launch the vmrun command and run a virtual machine headless. So lets get to the good stuff.

1. Starting stopping pausing etc with vmrun

We already know the start command can be passed to vmrun but there are a whole bunch of other commands to do with vm powering on and off that we can exploit to control our virtual machine.


vmrun -T fusion start /path/to/vm/vmname.vmx nogui
This starts the virtual machine gui free.

vmrun -T fusion stop /path/to/vm/vmname.vmxhard
Stop the virtual machine without running any shutdown scripts (analogous to yanking the power cord from the wall).

vmrun -T fusion stop /path/to/vm/vmname.vmx soft
Stop the virtual machine and run the shutdown scripts (analogous to choosing shutdown from the apple/start menu depending on your preference).

vmrun -T fusion reset /path/to/vm/vmname.vmx hard
Restart the virtual machine without running any shutdown scripts (analogous to pressing the reset button on the front of your computer).

vmrun -T fusion reset /path/to/vm/vmname.vmx soft
Stop the virtual machine and run the shutdown scripts (analogous to choosing restart from the apple/start menu depending on your preference).

vmrun -T fusion pause /path/to/vm/vmname.vmx
Pause the virtual machine while running or in replay.

vmrun -T fusion unpause /path/to/vm/vmname.vmx
Unpause a paused virtual machine.

2. Snapshots
vmrun command can also control the taking and reverting of snapshots by passing the following commands.

vmrun -T fusion snapshot /path/to/vm/vmname.vmx snapshotname
Create a snapshot with the desired name.

vmrun -T fusion deleteSnapshot /path/to/vm/vmname.vmx snapshotname
Delete a snapshot with the desired name.

vmrun -T fusion revertToSnapshot /path/to/vm/vmname.vmx snapshotname
Revert to a snapshot with the desired name.

vmrun -T fusion listSnapshots /path/to/vm/vmname.vmx
List the snapshots associated with this virtual machine

3. Running commands on the virtual machine

This is possibly one of the most powerful tools that vmrun offers. The ability to run a commanf on the virtual machine without having any access like ssh or vnc. The only disadvantage is that you must know the exact location of the program you want to run. I will take the example of a linux guest running headless and creating a file using the touch command.

a) vmrun -T fusion -gu USERNAME -gp PASSWORD runProgramInGuest /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx /bin/touch /var/www/hello.txt

First we pass the username and password of an account on the guest virtual machine

b) vmrun -T fusion -gu USERNAME -gp PASSWORD runProgramInGuest /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx /bin/touch /var/www/hello.txt

Next we issue the runProgramInGuest command and tell vmrun which guest to run it in.

c) vmrun -T fusion -gu USERNAME -gp PASSWORD runProgramInGuest /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx /bin/touch /var/www/hello.txt

Finally we tell vmrun which application to run and what parameters to pass. In this case we touch the file hello.txt located in /var/www/

4. Listing and killing processes in the guest

vmrun -T fusion -gu USERNAME -gp PASSWORD listProcessesInGuest /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx
This command lists all the running processes in the guest but requires a valid username and password and for vmware tools to be installed.

vmrun -T fusion -gu USERNAME -gp PASSWORD killProcessInGuest/Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx PID
Once you know a list of processes it is very easy to kill the desired rouge process

For more information and a complete list of all the cool things that can be done with vmrun checkout this pdf file from the vmware website. Happy VMing

vmrun deconstructed

In my last post I introduced the vmrun command to allow vmware fusion 3 to run a virtual machine headless. Sit down and get comfortable because now I am going to give a brief tutorial on the vmrun command and why it might be the most valuable addition to vmware fusion.

Ok so why would you ever want to run a virtual machine from the command line? Well if you are asking the question you probably wouldn't want to but I will answer it anyway. Not every use of a virtual machine requires graphical input. Sure its great to run windows on mac and VMware fusion really is the way forward in that respect. But if you want to run a virtual LAMP server for example (Linux Apache MySQL and PHP) the graphical user interface (gui) of Fusion is mostly useless can often get in the way. Running in headless mode eliminates the gui and leaves you with a clean clutter free desktop in addition to saving that extra bit of RAM that the gui takes up which is no small reward when running multiple vm's simultaneously.

So the great guys at VMware have given us a really neat way into interacting with virtual machines from the command line and in the next few posts I am going to try and give you a brief introduction to the kind of things you can do with this cool tool.

Let's start by deconstructing the command I introduced in my last post on running headless.

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

1. Location

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

The vmrun tool is located in the VMware Fusion folder in Application Support in the Library folder at the root of your hard disk.

2. The vmrun command

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

This tells the vmrun application to start and hey by the way we are going to run vmware fusion.

3. Starting the virtual machine

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

The start command which we are passing to vmware fusion tells it that we want to start a virtual machine located at the following path.

4. Headless

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

Now we have told vmrun to start the virtual machine of choice with vmware fusion the last option we pass is nogui. Up to this point you could have done everything from within the VMware Fusion gui but this is the deal breaker. We are now saying can you do all of this but by the way I don't want to see any graphical output please.

I hope this has helped iron out any teething problems with vmrun, in the next post I will go through some of the other cool things that can be done with vmrun.


VMware Fusion 3 headless

VMware fusion has been out for a while now and I have just gotten round to trying to run a headless LAMP with client only networking for web development. Shock horror, the headless hack no longer works in Fusion 3, all is not lost. There is a little used tool introduced in Fusion 2 that most power users from the linux and windows community have been aware of for a long time. The command line vmrun is hidden away in /Library/Application Support/VMware Fusion/ directory. With a little digging one soon realizes the power of this tool to interact with virtual machines from the command line. It is now very easy to launch and run a virtual machine from the command line and interact with it in a variety of ways. I am going to give a brief tutorial on how to launch a headless virtual machine from the command line or a shell script. Remember to replace the USERNAME with your own username or the command will not work!! I have assumed that you have used headless mode before if not please refer to the full post on using the vmrun command.

1. You may or may not want to add the location of vmrun to your default path. I chose not to as I will mostly be interacting with vmrun through shell scripts.

2. To Launch the virtual machine named VA-LAMP.vmx which is located in the standard virtual machine directory enter the following command into the Terminal app.

/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

To make this a command to launch the headless terminal from a file on the desktop just open text edit and enter the following text

#!/bin/bash
/Library/Application\ Support/VMware\ Fusion/vmrun -T fusion start /Users/USERNAME/Documents/Virtual\ Machines.localized/VA-LAMP.vmwarevm/VA-LAMP.vmx nogui

Save the file as plain text to the desktop as headless.command

Now to make it executable fire up the terminal application and type

chmod +x $HOME/Desktop/headless.command

Congratulations! You can now run headless again!


Friday, October 2, 2009

Apple broke Acrobat 8 - How to make pdfs now

After upgrading to Snow Leopard I found that my PDF printer was broken. The good news is that if you upgrade to Acrobat 9 then you can again print to PDF however the bad news is its not free. After no luck from Adobe technical support I took the bold move to e-mail one of the Acrobat team and ask how to create pdf files in the same way it was before. Luck was in my
favour and he responded very quickly and was very helpful. The following is a quick tutorial on how to generate a pdf file in Acrobat 8 pro under OS X 10.6.

1. Select the document you want to turn into a pdf. In this case I chose the apple home page in safari. Go to the file menu and select print.
2. From the print dialogue box click on pdf in the bottom left of the window and select "save as PDF..."
3. Choose a name and location to save the pdf and click save
4. Open your newly created pdf file in Acrobat Pro and from the Advanced menu select "PDF Optimizer"
5. At this point you can either review and change the optimisation settings such as picture compression or font embedding or just accept the default settings and let Acrobat do its thing.
6. I have included a screen shot showing the file size change from the original file to the smaller optimised file produced by Acrobat






Wednesday, August 12, 2009

It is truly amazing how small we are.

Monday, August 10, 2009

Green Hosting



As you sit surfing the net have you ever thought about how much energy is being consumed to deliver web content to your home? Until recently I had not. It is so simple to surf the web expecting pages to load lightning fast but this comes with a cost. Vast data centers consuming large amounts of power are required to deliver rich web content in this plugged in age.

I was very pleased to find out that my webhost 1&1 is now 100% green hosting. Does this mean that they have windmills sitting on top of their data centers or some fancy geothermal energy production plant on site? Well the answer is no. Well in this case does it mean that there is some special renewable energy electricity grid? Again the answer is no, all the energy produced is delivered to the same energy grids.

How does it work?
Consumers buy renewable energy credits (RECs). For every 1000kW hour of energy produced by a renewable energy generator a single unique REC is issued. This provides an audit trail which ensures that although the energy a consumer receives may not technically have been generated in a renewable manner the energy they are funding is renewable energy.

For more information look at the following links









Sunday, August 2, 2009

QtiPlot

QtiPlot is a great full featured open source alternative to Origin. It is free for the linux platform but for OS X and windows 32 a fee of 20-50 euros is required for access to the binaries. In the spirit of open source I decided to compile it myself. After failing a few times I investigated compiling it via macports. Again the process failed with an error relating to python scripts. The following workaround details how to disable python scripting and successfully install qtiplot on osx using macports.

1. Install macports from the macports website.
2. Open Terminal and issue the following command
sudo port install qtiplot (all the dependencies should install however the qtiplot build will fail)

3. Remove the qtiplot download with the following command
sudo port clean qtiplot
4. Fetch the qtiplot archive
sudo port fetch qtiplot
5. Configure the qtiplot install
sudo port configure qtilot
This will extract the qtiplot files

6. Navigate to the qtiplot folder in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qtiplot/work/qtiplot-XXX/qtiplot

7. Open qtiplot.pro with TextEdit and comment out the # SCRIPTING_LANGS += Python line with a #

8. Return to the Terminal and issue
sudo port build qtiplot

9. Install qtiplot with
sudo port destroot qtiplot

10. Finally issue the following command to install qtiplot in /Applications/Macports

sudo port install qtiplot

Tuesday, June 23, 2009

ClamShell Mode for Macbook

Following on from my KVM post here is another little trick. Sometimes I just want a bigger screen for my macbook, I don't want two screens especially when I am working with a large number of paper documents simultaneously. MacBooks have a great feature called clamshell that allows you to just use the external monitor. 

1. Set your MacBook up with a USB keyboard and mouse
2. Plug in an external monitor. 
3. Close the lid and jiggle the mouse. 

If you are lucky you will see your desktop and you will be back to a single monitor, occasionally your mac will decide to sleep but if you are insistent it will wake up again.

Sunday, June 21, 2009

Virtual KVM

I have and old G4 quicksilver which belongs to the group which I use to backup my work and access old files that require classic mode. So for a long time I have been struggling with an extra keyboard and mouse on my desk. A KVM is pretty much useless as I prefer using my macbook keyboard and VNC and remote desktop are a little slow. 

Yesterday I came across a great little program called KMremoteControl which allows you to use the keyboard and mouse of one computer on another essentially creating a virtual KVM. KMremoteControl is free to use and installation and setup are really straight forward. All you need to know is the ip address or domain name of the computer you wish to control.



With KMremoteControl you can either allow the controlled computer to advertise its availabili
ty or not and there are built in features to require the user to log on before use and encrypt the traffic between the two computers.











KMremoteControl works on both mac OS X and Windows and is a great solution for anyone who has two computers and for which a KVM is not suitable. 

Wednesday, June 17, 2009

iWork 09

After much wrangling with Office 2008 particularly Excel I decided to try out iWork 09.Priced at $40 from my local campus bookstore it really can't get much better!

1. Keynote
The biggest pain with powerpoint 2008 for mac is that large ppt files take an age to load. This is where keynote comes in. Keynote opens those old powerpoint files like lightening, the only problem I have encountered so far is that some bulleted lists are not formatted well but this is easy to fix. The interface is intuitively laid out and the smart guides are great.


2. Numbers

Excel for mac 2008 is a nice improvement and a great middle ground between the office ribbon interface from windows and the old style layout. However it really is unreliable when working with old file formats. Again iWork steps in with Numbers, while numbers is grossly underpowered for scientific data analysis it again comes with a very intuitive interface and the ability to quickly produce professional looking results.


Conclusions
I have not had much use for Pages however it also seems to have the intuitive interface and great compatibility with other office products. I cant help but wonder if it would be possible to write a paper in iWork and if anyone would tell the difference. All in all I have found iWork to offer value for money great and excellent compatibility with office. The interface is more polished than Office Mac and it is much more geared to producing professional results.

Friday, May 29, 2009

NMR and Mac

As an organic chemist and mac fan boy I have often lamented the lack of free NMR software for the mac. I have had the fortune of using both Bruker and JEOL instruments during my PhD and Post Doctoral careers and have found both to have their strengths and weaknesses ( it is well beyond the scope of this post to discuss either). I have however always been amazed at the lack of support by Bruker to the apple platform, I am sure they have good reason for such a decision however I find it rather a pain that TopSpin is a. Not free at least for processing and b. not available for OS X. JEOL on the other had has always made their DELTA NMR suite free for users on Microsoft Windows, Linux and OS X. Having a fondness for JEOL this has always been a big plus for me. 

In the last few years two products risen to the front as real contenders to the OS X crown.


iNMR Reader is suitable for most general 1D and some 2D applications is ideal for the PhD student or Post-Doc who wants an economic solution for their personal computer. Price € 50 for the first copy and 30 for each additional copy on the same order

MNova is much more polished and very capable of complex analysis and production of publication quality figures with its higher price tag is aimed primarily as a laboratory purchase. Price €305 for the full version and €105 for the lite version.

UPDATE: Thank you to Marcello for pointing out that there are great reviews on both these products at the nmr-software blog

Tuesday, May 26, 2009

Adium and Google Translation


I have been using Adium for around 2 years as my main chat client and have found it to be reliable and convenient to use. I can chat with google talk, Yahoo, MSN, and facebook all from the same application!

When I thought things could not get any better I found a great addition which sends the output via google translate to translate into any of the available languages!!!! I have attached a screen shot to demonstrate the magic! 

Just type %_tr{translate from, translate to, Text to translate} 

e.g. %_tr{en, de, Hello Simon I am pleased to meet you.}

Monday, May 4, 2009

Where have I been??

Sorry for not posting in so long. I have been concentrating on my website and fixing problems with my hosting. Currently I am hosted by 1and1 in the uk. They seem to offer the best value for money as far as features in my opinion the only problem is that their customer service is awful and it takes forever to get anything done.

Thursday, April 9, 2009

PCGAMESS/Firefly

I am somewhat of a hobby molecular modeller and have had much sucess with PCGAMESS a piece of software orginally based on GAMESS US and since 1999 an independant project developed by Moscow State University in the group of Prof Granovsky.
Until recently this software only ran on LINUX and Windows however much to my delight I recently recieved an e-mail from Prof Granovsky giving me details of the beta test for program for Firefly running on Mac OS X. I eagerly downloaded onto a quad core mac pro and registered the binaries along with Bret Bodes MacMolPlot.
The Mac version is very intuatively laid out and once the input file is generated in MacMolPlot the user simply draggs the input file to the icon corresponding to the number of required cores. I have carried out a few simple calculations and found it to be both stable and reliable.
I found a great tutorial posted here on pc gamess.

Wednesday, April 8, 2009

Chem Draw Woes

So I am one of these mac fanboys I love my mac however one piece of software has given me no end of problems. ChemDraw you either love it or hate it. It is an incredibly powerful piece of software with some pretty bad luck with OS X 10.5. In this post I am going to be looking at one pretty good alternative to ChemDraw.

ChemAxon MarvinSketch - Free for academic use

MarvinSketch is part of the larger ChemAxon suite of applications, written in Java it will work equally well on OS X, Windows and Linux. Its friendly intuitive interface is great for migrating from ChemDraw, you can even set out the menubars with a chemdraw look and feel although I find the Marvin layout much more intuitive. MarvinSketch has built in templates for many structures and more importantly journal specifications.

The acid test for me was how quickly can I draw a porphyrin and does it look right. The answer was in less than 30 seconds and a quick 2d clean made it look pretty good. I love the UI for rotation just select the molecule and hover over the selection and drag (see screen shot green molecule). There a built in templates for constructing polymers and a variety of R groups. The fully licensed version includes a whole treasure chest of plug-ins for everything from property estimation to naming and conformer search. All in all I would highly recommend MarvinSketch to anyone who wants to try something different


For lists of chemistry software visit the macs in chemistry blog.
Update:
One small annoyance arrises from the ease at which ChemDraw allows users to insert abbreviated structures such as OC12H25, MarvinSketch however requires a much longer winded process involving drawing the structure and setting a contraction label.

Who am I

As the blog suggests my name is Chris Wilson. I was born in Wolverhampton and spent both my undergrad and post grad in Hull. I am now working as a research scholar (post doc) at The University of Pennsylvania. I  was trained as an organic chemist and cut my teeth on both porphyrin and dendrimer chemistry my interests now lie in the soft self-assembly and self-organization of condensed matter. You can find more about me at my home page

Dr Chris Wilson

Hello Blog followers.

Welcome to my Blog!