I'll keep adding any changes that I make to the project to this post. I'll also try and answer any questions that I see from other blogs/ sites. Heres 2 videos of the controller in action.
Me
Saturday, August 30, 2008
Wednesday, August 27, 2008
Bound properties in Scala
I've been doing some GUI programming in Scala recently. Following the bean conventions in Java, I tend to require three things of each property I have on an object that will be used in a GUI:
The key problem with the ad-hoc implementation of properties (as in JavaBeans) is that they tend to make classes noisy, with all of the
In a search for simplicity, I have been investigating JavaFX and the even more impressive ScalaFX. However, JavaFX does not yet allow bindings to properties implemented in a Java model, and ScalaFX, although very promising, is not quite ready for prime time. (It's more the potential for bugs I can't understand rather than API changes that have put me off ScalaFX for the time being.)
Until ScalaFX is ready, I have found a neat stop-gap solution. Inspired by the Scala wiki entry on Properties, I have set up my own properties as follows:
My Properties extend
So, what advantages do these kinds of properties have over normal
Firstly, the contract of a property is clearly defined. There is no bean-like assumption that a
Secondly, each property is nicely modularized. Properties often refer directly to a value stored in a class, and it's easy to define a
Instead of something like this:
At first glance, the properties version of
Clients of the code will then be able to use the
This method of defining a clear contract for a property can also be extended to vector properties, in which the property contains a collection. It can be done fairly generally, so that the collection property may be backed in various ways by pre-existing collections (in the same way that you could implement a
A final advantage of these properties arises when they are bound into a GUI. For example, I have a text field derivative called
And... that's it! The
- A getter method.
- A setter method.
- A listener / notification mechanism for when the property changes.
The key problem with the ad-hoc implementation of properties (as in JavaBeans) is that they tend to make classes noisy, with all of the
getX()
, setX()
stuff, and the listener mechanism. Things become even more complicated when properties take on the nature of collections, where multiple objects can conceptually be added or removed.In a search for simplicity, I have been investigating JavaFX and the even more impressive ScalaFX. However, JavaFX does not yet allow bindings to properties implemented in a Java model, and ScalaFX, although very promising, is not quite ready for prime time. (It's more the potential for bugs I can't understand rather than API changes that have put me off ScalaFX for the time being.)
Until ScalaFX is ready, I have found a neat stop-gap solution. Inspired by the Scala wiki entry on Properties, I have set up my own properties as follows:
My Properties extend
scala.swing.Publisher
so it's possible to listenTo
them for events. I defined a PropertyChanged
event that is intended to be fired when a property changes. The properties also have apply()
and update()
methods which act as getters and setters respectively.So, what advantages do these kinds of properties have over normal
getX()
, setX()
and a listener mechanism?Firstly, the contract of a property is clearly defined. There is no bean-like assumption that a
setX()
method on a class is related to a corresponding getX()
method, nor that a particular event will be fired when a change occurs.Secondly, each property is nicely modularized. Properties often refer directly to a value stored in a class, and it's easy to define a
ValueProperty
which performs this automatically. Then, for the enclosing class, you can write something like this:Instead of something like this:
At first glance, the properties version of
x
may appear to break the principle of encapsulation, but it doesn't. If, in the future, I wish to change the implementation of x
, I could do something like this:Clients of the code will then be able to use the
x
property in the same way they always did.This method of defining a clear contract for a property can also be extended to vector properties, in which the property contains a collection. It can be done fairly generally, so that the collection property may be backed in various ways by pre-existing collections (in the same way that you could implement a
Map
as a HashMap
or a TreeMap
or whatever).A final advantage of these properties arises when they are bound into a GUI. For example, I have a text field derivative called
BoundIntField
which displays an integer value. To create an instance of this class, bound to property x
I do the following:And... that's it! The
BoundIntField
automatically listens for changes to x
and updates itself. Also, when BoundIntField
loses focus or receives an enter key press, it updates x
. This is all done without breaking encapsulation, and without me having to write any duplicate glue code at all!
Sunday, August 24, 2008
Ticketing - Fail

Public transport here is also expensive. As a result, our trains and stations are policed by small tribes of trench-coat-clad transit police who will gladly dispense large fines to those who are not in possession of a ticket. They are also notorious for being heavy-handed. I don't blame the individual transit police themselves; they're clearly under-staffed and over-worked. I hope readers can see that I'm describing a larger problem here.
The tickets themselves work by a process known as "validation". You insert the ticket into a machine, and the machine prints the date and time of the next expiry of the ticket. This information is also encoded in a magnetic strip that runs down the side of the ticket. Simple right? What could possibly go wrong?
A couple of weeks ago, this validation process failed me. I inserted my ticket into a machine, only to receive it back without a printed date stamp! I was fully aware that if I were to be stopped by one of the transit police, they would only see me as being in possession of a ticket that had not been validated. I would have no proof that I had actually validated the ticket and the machine had failed. Knowing this, I decided to buy a new ticket, and pay for my journey twice, rather than risking a large fine or a discussion with an unreasonable, dim-witted individual.
However, the proof of the machine failure is clearly evident in the picture of the ticket. Where the second trip (and second expiry date of the ticket) should appear, I have a blank line. I assure you that, even though I am entirely capable of it, there is no photographic trickery at work here. The machine simply failed me. Clearly, the magnetic strip encoding did not fail, and kept a record of my validation. Unfortunately, however, the transit police have no way to inspect the magnetic strip, so that would have been useless to me.
In the past, I've heard people claim that they tried to validate a ticket and it didn't work. The transit police still fined them. Now I wonder: were some of them actually telling the truth? I pay some $2500 to ride the trains each year. For that kind of money, I should have enough room at least to stand on a train when a seat is not available; I should have courteous, reasonable transit police; and I should have a ticket machine that works. So, of those three, let's see what I do have: Fail, Fail, and... oh yes, Fail.
Wednesday, August 13, 2008
Ego boosting news paper scans!
To anyone actually following this blog; sorry about the very slow rate at which I post here.
I figure it is better to do less posts, with lots of substance, than more posts that are just pointless and completely uninteresting.
Also, I've been working like 15 hours a day on my final semester uni project, which is sending me slightly mental, so I haven't had time to try anything else constructive (I'll make sure to post some updates on how that is going a bit further down the track).
Anyway, since a couple of friends have been asking to see them, I thought I'd better scan-in-and-upload a few of me super famous news paper appearances of the last few weeks.
So here you go:
This was the first one to be published, the guys from the Extra:Tech section of the Herald sun decided to do a short write up for the July 16th news paper:

Soon after that, The Australian called me to ask a few questions, they also sent out a photographer to get some snaps, this article was published on the front page of the Higher Education section in the 23rd of July paper.

Also that week, the Moonee Valley Community News called as well as the Leader, to organise a photographer to be sent out , unfortunately I was going away on a ski trip with some friends that week, so the leader wasn't able to get a photographer out in time, but the community news was able to.
The photographer from the community news was really nice and totally took the best pictures I reckon (the guys from the bigger papers were a lot older and kind of hostile).
So I totally hit the front page of the local paper as you can see here:

And there was a photo of both me and Emily on page 12.
Holy crap, I am so pasty white in this picture, you can't even see where my T-shirt ends and my arm starts....

So yeah, all this has been quite beneficial for me, especially since I am finishing uni in a few months and will be looking for a job soon, and any publicity is good publicity.
I reckon the coolest part so far though is hearing from other people who have been inspired to make their own giant videogame accessories and stuff.
That's a pretty fucking cool feeling; inspiring people.
My favourite so far is definitely Matt from http://scadinc.blogspot.com/ who has (apparantly just finished) making a giant SNES pad.
That thing looks fucking awesome, I'm pretty impressed by how he has done the round edges, that's a whole lot of gap filler he must have used there...
The only problem I've got is the colours, he totally should have done the PAL/Jap colours, the US version of the SNES just looked like arse, with it's pansy purple colours.
But either way, that takes nothing away from his awesome craftsmanship.
Oh also; every asking for a wiring diagram for the controller;
There is none! Just locate ground on the pad and wire it to the ground wire in the buttons, then link each of the "active" (or whatever you call them) wires to their corresponding ones.
The Male/Female plug was just so that I could unplug the controller from the original.
Either way, I might post a tutorial in the future explaining how to wire old controllers into USB-computer controllers, so you can play NES/SNES/Megadrive etc. emulators with their original controllers.
Till next time, awesome.
I figure it is better to do less posts, with lots of substance, than more posts that are just pointless and completely uninteresting.
Also, I've been working like 15 hours a day on my final semester uni project, which is sending me slightly mental, so I haven't had time to try anything else constructive (I'll make sure to post some updates on how that is going a bit further down the track).
Anyway, since a couple of friends have been asking to see them, I thought I'd better scan-in-and-upload a few of me super famous news paper appearances of the last few weeks.
So here you go:
This was the first one to be published, the guys from the Extra:Tech section of the Herald sun decided to do a short write up for the July 16th news paper:

Soon after that, The Australian called me to ask a few questions, they also sent out a photographer to get some snaps, this article was published on the front page of the Higher Education section in the 23rd of July paper.
Also that week, the Moonee Valley Community News called as well as the Leader, to organise a photographer to be sent out , unfortunately I was going away on a ski trip with some friends that week, so the leader wasn't able to get a photographer out in time, but the community news was able to.
The photographer from the community news was really nice and totally took the best pictures I reckon (the guys from the bigger papers were a lot older and kind of hostile).
So I totally hit the front page of the local paper as you can see here:
And there was a photo of both me and Emily on page 12.
Holy crap, I am so pasty white in this picture, you can't even see where my T-shirt ends and my arm starts....

So yeah, all this has been quite beneficial for me, especially since I am finishing uni in a few months and will be looking for a job soon, and any publicity is good publicity.
I reckon the coolest part so far though is hearing from other people who have been inspired to make their own giant videogame accessories and stuff.
That's a pretty fucking cool feeling; inspiring people.
My favourite so far is definitely Matt from http://scadinc.blogspot.com/ who has (apparantly just finished) making a giant SNES pad.
That thing looks fucking awesome, I'm pretty impressed by how he has done the round edges, that's a whole lot of gap filler he must have used there...
The only problem I've got is the colours, he totally should have done the PAL/Jap colours, the US version of the SNES just looked like arse, with it's pansy purple colours.
But either way, that takes nothing away from his awesome craftsmanship.
Oh also; every asking for a wiring diagram for the controller;
There is none! Just locate ground on the pad and wire it to the ground wire in the buttons, then link each of the "active" (or whatever you call them) wires to their corresponding ones.
The Male/Female plug was just so that I could unplug the controller from the original.
Either way, I might post a tutorial in the future explaining how to wire old controllers into USB-computer controllers, so you can play NES/SNES/Megadrive etc. emulators with their original controllers.
Till next time, awesome.
Monday, August 11, 2008
Giant SNES table Phase IV: Wiring, Button Adjusting, Detail Painting... etc
The Controller is finally finished! It has taken me all summer to do it, mainly because of classes and the new job... which by the way also helped me build the controller.
Button Mounting and wiring. The mounting was a bit tricky getting all these clamps in while it dried... but I somehow made it work.
Soldering for the SNES controller card, actually quite easy.
I used these screw plates to connect each button so I could disconnect each seperately for potential repair/ maintanence.


I used stencils made on the computer and cut on a machine to get the lettering just right. Turns out that the SNES font is almost identical to Hattenschweller, I think thats how its spelled. Its a standard font italicized. I also made a few stencils for the skateboards I'm making (the ones that say "meret"), and the Lost logo for some potential surfboard airbrushing.
I also stenciled out the circle for the A B X Y buttons, came out pretty clean.
I had originally tried a rubbery brush-on material for the start select, but it stuck too much on the sides when pressed.
You can see the contacts are just springs, and the other side of the contact are metal plates.

Subscribe to:
Posts (Atom)