Sunday, September 25, 2011

Build your own (killer) Drone

Droning On Towards A Date With Destiny? is a thought-provoking post that "connects the dots" with a number of stories I've seen recently, pointing out that Drone technology is quickly becoming a commodity.

DIY Drones gives you step-by-step instructions for building your own drone.

Can't easily acquire a part? Then use one of those new 3D printers to print your own drone. (It is going to be a real issue in the near future for governments and law enforcement to prevent people from "printing" all sort of dangerous or illegal things.)

Friday, September 16, 2011

The Ultimate Base Class

An interesting proof-of-concept ruby library called Base (source) was released last week - at least I hope it is not a serious project!.

The author describes it like this:

People love Base classes! They have tons of methods waiting to be used. Just check out ActiveRecord::Base's method list:

>> ActiveRecord::Base.methods.length
=> 530

But why stop there? Why not have even more methods? In fact, let's put every method on one Base class!

Yep, I've got to agree that many developers I've worked with love making beefy base classes.

So how does Base work? First, you create a class that inherits from Base like so:

class Utility < Base
end

and through the magic of ruby's method_missing it will effectively attach every method of every Module in its runtime environment (which will be quite a few if running under Rails, for example) to your class.

And what happens if two or more modules have the same method name? You'll get the first one that was loaded!

I like it! Now we need one database table to rule them all!

Now he is no longer CEO of Apple, what does a typical day for Steve Jobs look like?

Courtesy of The Joy of Tech :



Thursday, August 18, 2011

Installing the Sun (Oracle) JDK on Ubuntu

Update: Due to changes by Oracle in licensing for the JDK all Java packages in the Ubuntu Partner archive to be removed on 2012-02-16. Bummer. It looks like you will have to manually download and install a TAR or RPM version of the JDK from the Oracle download site.

I've had to do this a lot lately, so it's worth writing a post to remind myself of the steps.

By default Ubuntu packages that depend on Java (JRE or JDK) usually depend on OpenJDK. OpenJDK seems 98% compatible with the Sun (now Oracle) JDK, but chances are you'll hit an edge case that works only on the Sun JDK.

So let's install the Sun JDK!

The following steps will work with Ubuntu 9.10 (Karmic Koala) or newer.

Install wget

I personally prefer wget over curl for the simple stuff.


sudo apt-get install -y wget


Install python-software-properties

The python-software-properties includes a handy command-line utility called add-apt-repository, which adds packages repositories to you apt sources.list file. Instead of using this utility you can hand edit /etc/apt/sources.list if you prefer.


sudo apt-get install -y python-software-properties


Add the 'Canonical partners' package repository to the package sources list


sudo add-apt-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -s -c) partner"


or manually add the corresponding entry to your /etc/apt/sources.list file. e.g.


deb http://archive.canonical.com/ubuntu natty partner


Rebuild the package index


sudo apt-get update


Avoid the annoying prompt to accept the license

When you install the Sun JDK you will be prompted to read and accept a license. I personally like stuff to install without requiring manual interaction, so do the following to bypass the license prompt (of course we accept the license!):


echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections


Install Sun JDK 6


sudo apt-get install -y sun-java6-jdk sun-java6-plugin


Update the Java system default to the Sun version

Ubuntu allows multiple JVMs to be installed at any one time. To switch the "default" to the Sun JVM do the following:


sudo update-java-alternatives -v -s java-6-sun


And that's it! Phew!

The future is OpenJDK

Oracle are currently saying the official JDK reference implementation from Java 7 onwards will be OpenJDK, so assuming OpenJDK gets fully functional then you won't have to go through all of the steps in this blog post!