Software Development in Brisbane

Bayside House For Sale

June 30th, 2009

My father-in-law is experimenting with selling his home privately. I’m not sure how it will go, but it will be interesting to see how the internet helps make it all happen. He’s started with an early launch of the website, before sending it out to some of the relevant Real Estate sites soon.

If you are interested in having a look at the site he put together, or if you are interested in buying a house in the coastal suburb of Wynnum, in Brisbane, Australia, take a look at Bayside House For Sale.


Phishing Spam Fail

June 25th, 2009

 

I always find the latest incarnations of phishing spam entertaining.  I almost clicked on one of the fake facebook links a while ago, but really wasn't at all tempted to click on the links in the one that came in today..

outlook_update

Yes, I am looking at that message in Mail.app, and viewing the source did show that the link didn't go to where it said it would go.


Making the Home and End Keys work in Eclipse 3.4 on Apple Mac OSX

June 12th, 2009

Hidden in the comments of the article of Starry Hope - Mac Home and End Keys are some instructions for how to make the home and end keys work well as begin and end line in eclipse.  I've done all the other tricks to make this work on my Mac, so was getting really frustrated with Eclipse.  double home and double end are common key combinations for me in IntelliJ and Eclipse on Windows, so the current behaviour of going to the beginning or end of the file drives me crazy.  The details of doing this differ slightly in Eclipse 3.4.1, so I'll list the steps I followed below.

  1. open the eclipse preferences pane
  2. general->keys
  3. in the filter type line start and note that there will be existing bindings when editing text.
  4. select line start type home, and ensure that the "when" field stays with Editing Text
  5. apply
  6. follow this process for select line start, line end, and select line end.

After doing this, expect your anger at eclipse on Mac to decrease to much more manageable levels.

 


Influence: The Psychology of Persuasion - Book Review

June 3rd, 2009

Influence: The Psychology of Persuasion is a good little book. It provides a readable interesting introduction to the lifework of Robert Cialdini PhD. Robert's research is an interesting mix of Psychology and Marketing, and while I know that it isn't normal for an Engineer to read something like this, but I like to be atypical (I also am an Aussie who doesn't drink ;)). 

Robert presents the findings of his research, and what he has discovered about persuasion, distilled into the form of six principles . What makes this particularly interesting is the active way he did the research.  He studied the results of experiments, performed his own studies, and worked hard to understand the results (which he presented well).  Also Robert tells of his excitement in trying to analyse situations in which someone persuaded him to do something, and his adventures in trying to understand some of the persuasive people out there.  The wide range of examples in the book includes:

  • Boy scouts selling chocolates
  • How the Krishna work
  • Used car salespeople
  • Celebrity endorsements
  • Limited time specials
  • Some very interesting scientific studies

If nothing else reading through each of the examples of the persuasion and the discussion of what happened was brilliant.  My perspective of free gifts has completely changed. I'd argue that there is much more value in the book.  Getting an idea of why people say yes, and some of the principles behind this is very valuable. The principles are:

  • Reciprocation
  • Commitment and Consistency
  • Social Proof
  • Liking
  • Authority
  • Scarcity

The following provide a very brief note of each area. They are not complete, instead opening up some of the things that most impressed me, and that are worth noting.  Read the book if you want to get the real sense of what's being talked about.  (Failing reading the book you can visit the website).

Reciprocation

After someone does something nice we are likely to reciprocate and do something nice for them. What we do in return may be much greater in value.  Also if we say no to what feels like a big request, we are likely to reciprocate by saying yes to a smaller request.

In sales. Try and start big. Then be nice and sell smaller.

Commitment and Consistency

Once we have made a commitment to something we are likely to act in a way that is consistent with that action.

If we say that we start doing something small we are likely to continue.  This provides an interesting trade-off between this principle and reciprocation.  The way I would reconcile things is the start with a big request, then graciously let someone turn it down and go with a small request in the initial meeting.  The later use the principle of consistency to continue with additional requests.

Social proof

We will often look to others when deciding how to act in a situation. This mostly works well, but can be the cause of problems in situations like if someone has had an accident in a crowd.  People in the crowd will look to how others respond, which can lead to inactivity.

Liking

We will often behave differently if we like someone, or if they like us.  The best example of using this principle comes from Tupperware.  Women will often buy Tupperware when at a party to help their friends, even when they only went to the party because of the friendship.  Blokes aren't immune to this either.

Authority

We treat authority figures differently.  Even young college students (who we expect to have a healthy disrespect for authority) treat authority figures differently.  What is particulary interesting is that experimental results show that we have a poor self perception of how much we do value authority.

Scarcity

A cookie tastes better if there aren't many, and even better again if the limited supply is caused by lots of other people wanting it.  Tech manufactures use this principles.  There is an art form to ensuring that you run out of stock on release day.

Being aware of these principles is a valuable skill to have. We all are in situations where we need to communicate important information.  Being able to persuade people is important. We are all in situations where others are trying to persuade us.  Robert does a good job in helping us think through strategies of how to avoid being manipulated. 

Go Read the book and learn about persuasion, and use your powers for good.

 


Port forwarding with iptables and debain

June 2nd, 2009

 

Subtitle: 

Avoid Remembering that VMWare Server Listens on Port 8333 

Alternate subtitle:

Make Tomcat Listen on Port 80

It's increasingly common for applications to have web front ends.  These all tend to run on their own port, which is nice in that it stops services from running into each other (and means that they can run as non-root), but is somewhat painful in that there are always a whole heap of different ports to remember.  Exposing a service over port 80 makes it much easier to use (especially on ie which is dumb, and doesn't know to make requests to non standard ports default to port 80, generating much rsi, and many hours logged into the IE Waste Recorder).  Making services listen on port 80 on Debian is pretty straight forward.  Follow the process below (which I pinched from someone somewhere in the blogosphere a while ago, put on a server as a part of some work with SSH Tunnelling, and only remembered recently when we were getting some VMWare servers setup). So here is the script. In your /etc/network/if-up.d add a script with the following:

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Flush any existing firewall rules we might have
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Perform the rewriting magic.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8222
iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8222

This forwards requests from port 80 to port 8222, and will work for local and remote requests.  I keep this in a script called /etc/network/if-up.d/firewall, because iptables is firewallish, and I believe this is the standard place for this to live.  Remember to chmod +x the script. 8222 is the http port for vmware, and will redirect to 8333 using https. By putting the script in the /etc/network/if-up.d it will automatically be run when the networking layer of your debian installation is brought up.

As per the NewInstance post, this will work for Tomcat as well (Luigi put the iptables rules in a different spot, but that was in 2005, and /etc/network/if-up.d is the right place for this).

So with the above iptables rules, it will be easy to make any service available on port 80.


Updating RubyGems in OSX 10.5.7

May 27th, 2009

.7When recently trying to install Sinatra via RubyGems, I got a message that RubyGems was out of date. I figured that gem would be smart enough to have an easy upgrade command, so there had to be a command to easily upgrade. Naturally there is:

gem update –system

I only found this when looking through google, and I got a series of pages warning to be careful when using gem update –system as it can kill existing gems (http://puctuatedproductivity.com/2007/11/01/unistalling-ruby-installed-by-source-on-os-x, http://thenoobonrails.blogspot.com/2008/06/doing-gem-update-system-might-lose-all.html) so I was a bit nervous.  Since I have a periodic use of ruby and I'm lazy enough to make Larry Wall proud, I figured I'd take a punt on just using gem update –system.  Turns out it just works, and I've kept all my old gems.  Hooray.  Given that the posts talking about issues are old, I'm either assuming that they've done things differently to me, or things have been fixed since then… so… if you need to update gems due to a message:

ERROR: Error installing sinatra:
fastthread requires RubyGems version >= 1.2

or similar, just use gem update –system


A Review of 5 Java JSON Libraries

May 7th, 2009

 

json.org lists 18 different Java libraries for working with JSON (Flexjson gets a double mention). These provide varying levels of functionality, from the simplest (the default org.json packages), to more comprehensive solutions like XStream and Jackson. Join me on a quick review of some of these, focusing on those which have friendly licenses, and meet my requirements.  If you are lazy, you can fast forward to my summary

My Requirements

  1. Serialises and Deserialises JSON
  2. Lightweight and Simple
  3. runs on Java 1.4
  4. Friendly license

The contendors

  1. org.json
  2. Jackson
  3. XStream
  4. JsonMarshaller
  5. JSON.simple

Serialises and Deserialises JSON

This might sound like an obvious requirement, but I’ve seen at least one library which was completely focused on spitting out JSON, without any support for reading JSON. I’m actually using this as a pre-requisite for inclusion in my comparison. If a library can’t read AND write JSON, I’m not going to consider it.

Lightweight

I’ll begin by stating that my actual usecase is to operate within a plugin for EditLive!. I don’t need a all singing all dancing JSON serialisation/deserialisation library. There are some very cool libraries out there that do awesome stuff, but all I need to do is read and write JSON data.

Coupled with this is that I’ll want to be able to keep the memory footprint pretty low, so want to work with Java Streams without needing to necessarily pull in the whole serialised object if I don’t need it.

Runs on Java 1.4

Yep it’s still out there. Thankfully Java 1.4.2 has reached it’s EOL, but businesses can still request patches, and there are most definitely still Ephox clients running on this JRE, even though more recent JRE’s work so much better. (side note: If you have the option of upgrading your JRE to Java 6, please do it, the children in Africa will be much happier. Everytime someone runs up a 1.4 JRE a puppy dies). 1.4 is in it’s final death throws, but it is still kicking.

Friendly License

For Ephox to make money from the product/component that uses JSON (gotta think about the $$$ at the end of the day), I’ll need to make sure that the license is non-viral and Enterprise friendly. Apache license good. GPL bad. (sorry FSF)

Assessment 

So having run through the requirements, we can now consider the options. For each library, I’ll provide a simple table.

The metrics I’m using to judge the libraries are included in the table. The most crude metric that I’ve got is the number of classes. I’m more than happy to admit that this is a very crude way to measure how lightweight the library is, but it does provide an ok rough heuristic, particularly given that there are order of magnitude differences.

org.json

The granddady of them all. This comes pretty close to being a reference implementation. It provides a nice simple API (7 classes), doesn’t try and do any magic, and just makes sense. I’ve used it before when working with small amounts of data. Unfortunately it doesn’t provide any streaming goodness.

url http://www.JSON.org/java/index.html
classes 7
Streaming support No
Friendly License Yes
Java 1.4 Yes

Jackson

Jackson advertises itself as a fast powerful conformant JSON processor. It provides heaps of features, and looks to be a good tool for reading and writing JSON in a variety of ways (see the Jackson tutorial for more). The drawback of Jackson for my purposes is that it isn’t exactly svette at 250 classes.

url http://jackson.codehaus.org/
classes ~250
Streaming support Yes
Friendly License Yes
Java 1.4 Yes

XStream

XStream gets a mention because it’s cool :). I haven’t really considered it because it provides more of a direct object serialisation format, which wasn't quite what I'm looking for. Also, it’s heritage as an xml serialisation format shows, and it likes Java 5 much better. The ability to directly go between Javabeans and JSON java classes is cool, but I don't need this magic or the 200+ classes that come with it.

url http://xstream.codehaus.org/
classes >200
Streaming support Yes
Friendly License Yes
Java 1.4 Yes

Json Marshaller

Json Marshaller sells itself (it almost sounds like a bolierplate project description by now) as “Fast, Lightweight, Easy to Use and Type Safe JSON marshalling library for Java”. It’s been under consistent active development for a number of years, and looks to be headed in the right direction. Unfortunately the current version has 3 deal stopping flaws for my environment at the moment.

  1. It requires Java 5
  2. It has a dependancy on ASM (the developers are looking to remove his dependancy)
  3. While it hasn’t quite piled on the bulk of XStream or Jackson, it still has a couple to many classes for me to consider

These constraints make it not quite fit for my purposes, but like all decisions, it depends on your own situation.

url http://code.google.com/p/jsonmarshaller/
classes ~50
Streaming support Yes
Friendly License Yes
Java 1.4 No

JSON.simple

JSON.simple advertises itself as “a simple Java toolkit for JSON”. It provides reading and writing to JSON streams. It’s lightweight and focused on generating JSON from Java code. The critical feature it provides is support for Java IO readers and writers.

url http://code.google.com/p/json-simple/
classes 12
Streaming support Yes
Friendly License Yes
Java 1.4 Yes

Summary 

For the interested, here’s a table that summarises my findings.

  org.json Jackson XStream Json Marshaller JSON.Simple
classes 7 ~250 >200 ~50 12
Streaming support No Yes Yes Yes Yes
Friendly License Yes Yes Yes Yes Yes
Java 1.4 Yes Yes Yes No Yes

 

Conclusion

If you are looking for a simple lightweight Java library that reads and writes JSON, and supports Streams, JSON.simple is probably a good match. It does what it says on the box in 12 classes, and works on legacy (1.4) JREs.


Choosing a data storage format

May 6th, 2009

In case you haven’t noticed, XML is not a silver bullet. (google xml+silver+bullet). It is not, and should not be an automatic choice when thinking of a data storage format. The ubiquitous libraries for working with XML are often hard to use, and are often overkill for a simple storage format. In today’s world, I’d suggest that the following options should be considered (at least briefly).

  1. Native Object Serialisation
  2. Custom format
  3. XML – Extensible Markup Language
  4. YAMLYAML Ain’t a Markup Language (obviously created by geeks with the recursive name)
  5. JSON – JavaScript Object Notation

Join me in having a look at these formats, and I’ll let you know some of the issues to consider. The main problem I’m solving is for data that belongs to your own application. I’m not considering databases or interoperability.

Native Object Serialisation

Consider this briefly before running away. I’m particularly familiar with the idea of Java Object serialisation. I’ve used Prevayler in the past storing java objects, and xml (So while I’m having a dig at Java Object serialisation in general, I’m not specifically having a go at prevayler).

While the use of native object serialisation is often easy, it has costs, making the content unreadable by humans, coupling the data storage to your implementation language, and can create object migration issues. These costs will typically outweigh the benefits. Having human readable data to aid debugging would provide reason for not using native object serialisation if there was nothing else.

Custom Format

The use of a custom simple text format should not be discarded out of hand. The lack of any third party dependancies is a useful feature, and should be considered. That said, if you have a library that does the parsing for you, that should not be sneezed at.

XML

As wikipedia says, “XML is a general-purpose specification for creating custom mark-up languages” (Wikipedia on XML). Parsers and tools exist for many platforms and environments, which makes it a useful tool when you want to share information between different environments. While a good tool, the syntax is verbose, and can be hard for humans to read.

XML has influenced the birth of two of two more recent notations which are useful for data storage: YAML, and JSON

YAML

YAML purports to be “a human friendly data serialization standard for all programming languages” (Yaml.org). It has a well defined specification (YAML Spec), and makes for an easy to understand data storage format. Implementations of YAML exist for a wide range of languages, including Java, C++, Ruby and Javascript. It’s been around for a while, and has a decent amount of uptake. If it wasn’t for JSON, it would probably be a good default choice.

JSON

At first glance JSON seems much less suitable than YAML for languages other than JavaScript. The kicker against it is that it has “JavaScript” in the name, which has always made people feel icky. That said, it does make for a good cross platform format, it is human readable, and is implemented on a wide range of platforms (Json.org).

JSON has also has the advantages of having mindshare, and is slightly more familiar to developers than YAML. Every developer who has had anything to do with the web has done stuff with JavaScript, so the basic format will be familiar to them. Also in JSON’s favour is the fact that JSON and YAML are syntactically very close (see Redhanded). JSON appears to be very close to a subset of YAML(Ajaxian). In addition, the general applicability of JSON is higher, particularly for people who are going to be doing Javascript development. Also, if you have any possibility of playing with JavaScript, JSON is a very good option because of the native support in JavaScript.

These factors combine to make JSON an excellent choice.

Summary

Tim Bray makes a good case for this being an automatic choice based on your circumstances(http://www.tbray.org/ongoing/When/200x/2006/12/21/JSON ). You’ll still need to think about the pros and cons of the different technologies for your situation (see http://webignition.net/articles/xml-vs-yaml-vs-json-a-study-to-find-answers/), but you’ll often find that JSON is a good format to use for data storage.


Bridged Network Connection + VMWare Fusion 2 + SMEServer + WiFi = Fail

April 25th, 2009

When recently doing some testing of a SME Server VM using my wireless network I was getting a variety of different connection failures. 

Accessing the server manager in Safari was giving messages containing text like: Safari can’t open the page…. Safari can’t establish a secure connection to the server.  Occasionaly connections would work but 9 times out of ten the connection error was occuring. 

In addition to the https related issues, ssh connections were being reset. A ssh connection attempt with full debug (-vvv) can be seen below.

ssh -vvv *****
OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data ****
debug2: ssh_connect: needpriv 0
debug1: Connecting to ****
debug1: Connection established.
debug1: identity file ****
ssh_exchange_identification: read: Connection reset by peer

Strangely google wasn't much help with my issue.  It was only after reinstalling a new VM using NAT that I saw things working.  From what I can see it must be the combination of the services running on SME Server, WiFi and Bridged networking.  

So if you have a Apple laptop, wireless, and SMEServer running in a VMWare virtual machine, use NAT for your test server and things will work much much better for you.

 


Online Sermons

March 28th, 2009

  It's been a very long time since I've posted anything in the Theistic Thought category of this blog.  Long enough that people might not have ever seen one :).

This isn't so much of a Theistic Thought, as more of a sharing of a resource.  I've just come across The Gospel Coalition website, which has a great set of sermons from good preachers available for people to download.  What I've heard so far, and seen is great, and well worth a listen if you are that way inclined.

I stumbled across the site while looking for recent sermons from Don Carson, and was stoked to find a list of Don Carson sermons, which it looks like they will keep up to date.  This list on it's own is great to see, but combined with the other people it is awesome.  I'm particularly stocked to see the inclusion of the sermons from funniest, most challenging bible based preacher I've heard, Mark Driscoll.  (Mark Driscoll views preachers and stand-up comics as the professions that he can learn the most from, with Chris Rock being one of the important people that he tries to learn technique from).

The resources form a great portal for how to get to good biblical resources.  I'll be using it as a starting point to listen and learn more about God.