Going Dark to Fight SOPA.


Copyrights vs. human rights by opensourceway

Copyrights vs. human rights by opensourceway


On January 18, this blog, alongside many other websites, is going dark for a day to protest against the proposed introduction of the Stop Online Piracy Act (SOPA) and its Senate counterpart, the PROTECT IP Act (PIPA) in the USA. SOPA will not just affect those in the USA; its knock-on effects would touch every website in the world. Under the proposed legislation, it would be illegal for us (or you) to link to any website – any website at all, including community-driven behemoths like YouTube, Flickr, Blogspot or WordPress (where we’re hosted) – without checking first that nothing on that site infringes copyright. And we’d have to review those sites continually after a link was made.

Under these Acts, every person making a link to such a site would have to check the millions of other pages on that site to ensure that nobody, anywhere, is breaching copyright. Even search results would be covered under the proposed law. And if a website like ours were to be prosecuted for linking to another site where copyrighted material was hosted, our domain could be confiscated and our IP address added to a USA-wide blacklist, even though we are not US-based.

So far, so ridiculous. It’s censorship and shifting of responsibility on a grand scale. But despite a loud chorus of opposition to the Acts from legal experts, internet experts, journalists, website owners like us, human rights activists (want to publicise the next Arab Spring using Twitter, Facebook, YouTube or another site that potentially infringes? You’ve just provided the powers that be with an instant excuse and mechanism to shut you down) and ordinary people who just surf the web, the Acts stand a genuine chance of being pushed through. Lobbyists like the Motion Picture Association of America (MPAA), the Recording Industry Association of America (RIAA) and the movie and music studios have much louder voices and deeper pockets than we individuals on the internet do; but by joining together on January 18 we hope that we can make enough of an impact to be noticed by those voting on the legislation, and by the news outlets that they read and watch.

So on January 18, this blog intends to join the planned shutdown organised by Reddit. This site will be unavailable from 8am EST to 8pm. We encourage those of you who can to join us – and if you’re a US citizen, please call or email your representative.

Exploring Arduino


Arduino Uno by Snootlab

Arduino Uno by Snootlab

A few months ago, my local maker-space (091 labs) presented a few informal tutorials on Arduino.  Having seen it mentioned online, I decided to bite the bullet and drop by to learn more.  Shortly later I purchased the Experimenter’s Guide for Arduino, which was used during the tutorials.  Being further interested in Arduino and it’s capabilities, I subsequently bought the Arduino Cookbook, by Michael Margolis (O’Reilly).

Continue reading

Dependency Injection – Why Bother?


dependencies

dependencies by jonathanvlarocca

In this post we discuss the various mechanisms of Inversion of Control (IoC) including Dependency Lookup and Dependency Injection.  We look at the differences between the various IoC approaches and present the advantages and disadvantages of each.

Continue reading

Handling Shell Script Interrupts

A Real Screen Shot

A Real Screen Shot

If you do much shell scripting, then handling shell interrupts is something you should consider.  As a user is interacting with your script, they may decide to interrupt it by typing Ctrl-C, for example.  Typically this will interrupt your shell script execution, forcing it to exit.

Depending on what your shell script is doing, this could leave behind temporary files, or leave other files in a broken state.  It would be useful if you could trap the interrupt, and handle it safely, before exiting the script.
This can be achieved on most shells using the ‘trap’ command.  The trap command takes the following syntax:

trap [OPTIONS] [[ARG] SIGSPEC ... ]

The ARG is the command to be executed on signal delivery, while SIGSPEC is the name of the signal(s) to trap.  Options include -h for help, -l to list signal names, or -p to print all defined signal handlers.

For example, to always return a ‘user aborted’ error code, the following line in your script could be used.  Whatever value given to $exit_user_abort would be returned.

trap 'echo "`basename $0`: Ouch! User Aborted." 1>&2; exit $exit_user_abort' 1 2 15

The numbers 1, 2 and 15 at the end of this example define which interrupts we’re interested in trapping.  These numbers correspond to different kinds of interrupts.  A short list is given here, but you can use ‘trap -l’ for a complete list.

Signal Number Signal Name Explanation
0 EXIT exit command. Script has executed successfully.
1 HUP Hang Up. The user session has disconnected.
2 INT Interrupt.  Ctrl-C (or other shell interrupt signal) has been given.
3 QUIT Quit.  Ctrl-\ (or other shell quit signal) has been given.
6 ABRT Abort signal.
15 TERM Terminate.  Kill command has been issued against your script.

If your trap runs several commands, it’s possibly neater to call a shell function than list the commands in-line, as above.  For example:

trap funcname 1 2 15

funcname
# Function to handle interrupts
{
echo "`basename $0`: Ouch! User Aborted." 1>&2
exit $exit_user_abort
}

Ini files and Apache Commons Configuration

Trashing old software

Trashing old software

The project I’m currently working on uses a simplistic object store for persistence.  The original authors, in their collective wisdom, decided that whenever something needed to be saved they would save it to a hashtable, and use Java serialization to save that to a file.

In a way I can see why they did. It’s a quick way of getting a simple to use object store.  The project has been through several revisions since, but the data store stayed the same.  It should have been replaced with something more robust a long time ago.  I’ll explain more after the jump …

Continue reading

Automatically Unmount Network Shares on Ubuntu

Hard disk dissection

Hard disk dissection

I’ve mentioned before, how I mount shared drives in Ubuntu both at home and at work.  While this is quite useful, it seems the default setup for Ubuntu stops the network interface before disconnecting these drives.  This results in Ubuntu hanging for a while on shutdown while these drives time out.  After the jump we describe how to solve this problem.

Continue reading

Keeping it Simple

Moleskine and Pen

Moleskine and Pen

George Bernard Shaw is quoted as saying, “The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.”  While we all appreciate progress, I sometimes have to wonder at the way people look at the world.

Continue reading

FARTing Around

INBOX 0: Tarditas et procrastinatio odiosa est

INBOX 0: Tarditas et procrastinatio odiosa est

I’ve recently become aware of Getting Things Done, and have been attempting to practice it for the last six weeks.  In many ways, it is very similar to what I had been doing previously.  You could call my method a lightweight GTD, and it’s based on the FART mnemonic.

For any item that crosses my desk, be it email, IM, memos, or stickies, I follow the same basic triage process.  Four directives (File, Act, Redirect or Trash) are applied based on a few simple considerations.  These are as follows:

  • Do I need to refer to this item again?

If so, file it somewhere easily searchable such as a mail folder, content management system, Wiki, etc.  Remove the item from your In-box to the file location.  Continue to consider the other questions.

  • Do I need to act on this?

If so, add a to-do to your to-do list.  Prioritise and schedule work on the action using your to-do list.  Remove the item from your In-box by Filing, Redirection, or Trashing.

  • Am I the best person to work on this?

If not, redirect or delegate it to someone else.  You may, if you feel you need to, add a reminder to your to-do list to follow up with the delegate.

  • Trash it, you’re done.

By now, you’ve filed the item if necessary, decided to act on it, or delegated it.  What other possible action can you now take?  You have extracted all value from the item, so the only other option is to remove it from your In-box.  If you have not done so already, or filed the item to a folder, move the item to the trash.  You are now done with processing your incoming items.  All that remains is to tackle your to-do list.

Repeat as necessary, and you will soon find that heap of email shrinking.  In-box 0 is not an impossible goal.  All you need to do, is think outside the In-box!

Decisions, decisions, …

It is our choices. . . that show what we are, far more than our abilities.

It is our choices. . . that show what we are, far more than our abilities.

So we’re beginning a new project, and it has come time to decide what we’re going to build. In many ways, we are spoiled for choice. There are many ways in which the existing software could be improved. Do we pay down some technical debt, include a new feature or support new hardware?

Continue reading

Pre-Merge Formatting

Merge Right

Merge Right

A problem with formatting code on a branch, is when you come to merge it back to the trunk, you end up having to work thorough lots of file changes which are really only formatting changes.  The larger your project size, the more work this involves.  I was faced with a similar task recently.

While editing file by file, I usually do the Ctrl-A Ctrl-Shift-F combo to ensure the file is formatted according to our corporate standards before saving any edits.  Since much of the code I touched on the branch was formatted under a different standard, and I touched a lot of files while introducing log4j logging, the end result was heading for a hairy merge.  What I really needed was a way to bulk format both the branch and the trunk versions of the code-base.

Luckily, I realised that that same formatter embedded in Eclipse can be used to bulk format Java source.  Here’s how …

Continue reading