Saddest Programming Concept Ever

Python has spoiled me for other languages – I accept that – but I still wasn’t fully prepared for some of the horrors I discovered in Javascript. Which made the satiric article by James Mickens, “To Wash It All Away“, all the more enjoyable. Here is a slice I especially liked:

Much like C, JavaScript uses semicolons to terminate many kinds of statements. However, in JavaScript, if you forget a semicolon, the JavaScript parser can automatically insert semicolons where it thinks that semicolons might ought to possibly maybe go. This sounds really helpful until you realize that semicolons have semantic meaning. You can’t just scatter them around like you’re the Johnny Appleseed of punctuation. Automatically inserting semicolons into source code is like mishearing someone over a poor cell-phone connection, and then assuming that each of the dropped words should be replaced with the phrase “your mom.” This is a great way to create excitement in your interpersonal relationships, but it is not a good way to parse code. Some JavaScript libraries intentionally begin with an initial semicolon, to ensure that if the library is appended to another one (e.g., to save HTTP roundtrips during download), the JavaScript parser will not try to merge the last statement of the first library and the first statement of the second library into some kind of semicolon-riven statement party. Such an initial semicolon is called a “defensive semicolon.” That is the saddest programming concept that I’ve ever heard, and I am fluent in C++.

Nice deal on programming books

First a disclosure – I will be getting two free e-books for promoting the Packt Sale ;-). But I wouldn’t bother writing this up unless I thought Packt books would be of some value to me – so that makes it a genuine endorsement. For reference, here are the three I’m weighing up:

  1. Learning IPython for Interactive Computing and Data Visualization
  2. Git: Version Control for Everyone
  3. Responsive Web Design with jQuery

Buy One - Get One Free

Apparently the deal is:

  • Unlimited purchases during the offer period
  • Offer is automatically applied at checkout

I procrastinated a bit so there are only a couple of days left (ends 26th March). So be fast! Here’s the promotion link

Installing iNZight on Ubuntu (13.10)

Existing documentation for installing iNZight on Ubuntu covers a wide range of possible scenarios in Step 1. For my own specific case, however, I needed to translate it into a series of precise step-by-step instructions.

So here are the instructions that worked for me for Step 1. Once that is done, just follow steps 2 onwards in the official docs.

STEP 1 STEP-BY-STEP

It is probably best you don’t already have R already installed. And if you’re using iNZight, you probably won’t. But if you do, purge it! Installation may or may not work depending on the version of R you install so remove one source of difference from what the support people will have tested.

  1. ctrl-alt-t to open terminal window
  2. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
  3. sudo gedit /etc/apt/sources.list

    and then append
    deb-src http://cran.stat.auckland.ac.nz/bin/linux/ubuntu saucy/
    Note: must have trailing slash (/) at end
  4. Click on “Save” button on toolbar or enter ctrl s on keyboard to save
  5. sudo apt-get update
  6. sudo apt-get install r-base
  7. Open R by typing R into terminal
  8. From R prompt:
    update.packages(ask = FALSE)

    y to everything

  9. q("no")

    to quit the R prompt.

  10. Then follow steps 2 onwards in the official instructions …

USB 2 on VirtualBox

Get the appropriate version of the VirtualBox extension pack installed – I found the correct version in here: Download VirtualBox (Old Builds): VirtualBox 4.2

Add self to vboxusers group as per Set up USB for Virtualbox. Must reboot for change to take effect.

sudo usermod -aG vboxusers

Then follow the additional steps. For Windows XP at least, must add a filter before opening so that the USB is recognised by the File Manager and displayed as an extra drive.