Friday, 8 November 2013

Oracle VM VirtualBox Manager

Today I 'ave mainly been thinking about VirtualBox.

For several years I have felt it would be useful to have a basic linux box so that I could be in a more standard "work" type environment. OS X is fine but some things are just different.

I had been advised that VirtualBox was an option to load a linux OS onto my Mac and run it in parallel with OS X in its own window.

So I downloaded version 4.2.18 and was pleasantly surprised how easy it was to install from a downloaded iso image.

I started with Centos because I was using this at work. However this turned out to be very disappointing. The installation went fine but it always hung up while downloading upgrades. This was annoying because I had several attempts that all ended in failure.

Anyway not put off too much I downloaded ubuntu. This installed fine and managed to upgrade its self but ultimately this was also very disappointing as it ran dog slow (no offence to dogs intended). I think it was the fancy graphics. This was so bad that I gave up for a few weeks.

After chatting to a couple of mates I decided to have one last try with xubuntu. I picked the latest LTS version 12.04.3. And yippee it worked. It installed quickly, it updated quickly, I installed guest additions for virtual box from the package manager, it came with python 2.7.3. I have started working on it it does not seem to slow my mac down and it runs fast enough. I like the user interface. I even loaded my own copy of sublime text 2!

Result!

Saturday, 5 January 2013

Javascript - Memory Jogger

Today I 'ave manly been thinking that I need a page if Javascript facts. So I will put it here and see how I get on. I expect it will be a translation of Python to Javascript. (I am considering CoffeScript but more on that later.)
  • I HATE curly brackets and the option to have them or not. Thats what Python has done for me. I LOVE indentation! Bad Javascript/C/C++ etc. 
  • string to int:
  • int to string:
  • dictionary OMG I cant believe the code to sort:
for i in sorted(dict):

is:
var keys = Object.keys(dict);
keys.sort();
for (var i=0; i<keys.length; i++) {
    var key = keys[i];
    var value = dict[key];
    // do something with key and value here...
}
My Rules:

Python has local variables with no declaration but globals need marking as global. This is good because you do not have many global variables ... do you! Of course you have lots of local variable and they all need a var declaration. Hey ho I can get used to this.

I will always use braces even when I don't need them.