11 September 2012

IntelliJ IDEA Community Edition on Arch Linux

or, The Best Java IDE on the Best Operating System


Why IntelliJ IDEA

If you're writing Java, IntelliJ IDEA is the only IDE worth using.

The interface is sensible and snappy.
Navigating projects is easy.
It gives you immediate code suggestions and completions, intelligently and unobtrusively.
It integrates with your favourite DVCS.
It has bundled Android tools and handles XML nicely.
The Community Edition is open-source and cross-platform.

Compare this with buggy Eclipse, bloated NetBeans, and all those other small and incomplete or poorly supported IDEs, and what more do I need to say?

Why Arch

Arch Linux is one of those things that you either love or hate.  From its wiki:

"Arch Linux is a versatile and simple distribution designed to fit the needs of the competent Linux user. It is both powerful and easy to manage, making it an ideal distro for servers and workstations. Take it in any direction you like."

If this doesn't sound like your cup of tea, don't bother.  If it does though, go install it right now and you'll never look back.  Be warned though, initial configuration can be a daunting task.

Installing

To install IntelliJ IDEA on Windows, just get the installer from the official page.

On Arch there are some quirks, so here's a walkthrough.

First you need Oracle's implementation of Java from the Arch User Repository.  If you have OpenJDK installed, you'll need to remove it first.  For OpenJDK 7:
pacman -Rdd jre7-openjdk jre7-openjdk-headless jdk7-openjdk

Now jre and jdk need to be installed from AUR.  I recommend using a tool like yaourt:
yaourt -S jre jdk

Next, IntelliJ IDEA:
pacman -S intellij-idea-community-edition

Finally you need to edit the launcher script, found by which idea.sh, to include these lines before the last one:
export PATH=$PATH:/opt/java/bin:/opt/java/jre/bin
export JAVA_HOME=${JAVA_HOME:-/opt/java}


Et voilà!  Just launch IntelliJ IDEA from the applications menu, or from a terminal with idea.sh.

On an unrelated note, I am growing to like Cinnamon as my desktop environment.

28 August 2012

An arbitrary L-system

In CSC2003S (game design) today we had a brief look at L-systems.  In particular we examined this L-system for a turtle:
  • ω: xF
  • P_0: x<F → yF+(30)xF
  • P_1: +(a) → +(a-2)
  • P_2: y<F → FF
where F represents drawing a segment and +(a) represents turning a degrees.  Other symbols are ignored by the turtle.

For up to 30 iterations, this makes a pretty cool sort of flattened spiral.  Once you pass that, though, it also circles the other way, and once you reach around 60 iterations things just get weird as the angles eventually become acute, then finally wrap back to 30.

Have a look at some code I wrote to evolve and draw the L-system.  You'll need Python >2.6 installed to run it.

Here's a screenshot with 100 iterations.

20 July 2012

Making the Arduino Leonardo work with Windows 8

Look what arrived today!


Time to build and code awesome things!  ...Except that I'm running Windows 8 Release Preview 64 bit.  This makes things awkward.


I had downloaded the Arduino software, and I knew from the official instructions that the driver had to be installed manually, but I didn't expect the runaround required to do it.  So here are some unofficial instructions to avoid future suffering of others.


(I don't know if this works or is needed for other versions of Windows 8, but I would guess so.)


First, disable enforcement of driver signatures (thanks to Xark on #arduino for the link - very cool people over there).  The contrived chain of things to click goes as so:

  • Settings
  • Change PC settings
  • General
  • Restart now under Advanced startup
  • (wait for a reboot)
  • Troubleshoot
  • Advanced options
  • Windows startup settings
  • Restart
  • (wait for a reboot again)
  • Disable driver signature enforcement
Now Windows will start up and let you install the drivers.  The process for this is also not totally obvious, so here it is:
  • Start
  • Control Panel (type to search for it - much faster)
  • Hardware and Sound
  • Device Manager under Devices and Printers
  • Right-click Arduino Leonard under Other devices
  • Update Driver Software...
  • Browse my computer for driver software
  • Browse... and find where you downloaded the Arduino software
  • Include subfolders
  • Next
Then it finds the drivers all nicely and tells you that it's done and you can close everything.

One last thing to remember is the slightly fiddly procedure when uploading a sketch to the Leonardo.  Now go forth and make amazing things!

19 July 2012

The dawn of a new era

Term is starting soon
I have created a blog
See what I did there?

Back to the busy life of university.  Exciting enough to warrant a haiku (constant-width no less).

Anyway, I've decided to start this blog for a few reasons.  Firstly, and most significantly, I was frustrated out of my mind with prerelease software crashing on me and I needed to do something to distract myself.

Secondly, I'm attempting to get my name out there early, write useful stuff that people want to read, all that.  That sort of thing is all the rage with the tech startups at the moment.  I'm going to start doing this by posting about computer science (and maybe maths) assignments.  I'll probably release my code after each one.

And thirdly, science.  I want to see if I can keep it up.

So go on, tell all your friends doing CSC2002S, CSC2003S, or MAM2000W.