Pay Calculator
![]()
I have put up a new site, paycalculator.com.au that will calculate your net pay. It works for Australian incomes (single) and has the latest tax brackets. It also shows 2006-2007 and 2007-2008 financial years so you can see how the tax system has changed over the years. My pay is going up by $50 a month!
I used the same css as this blog but updated the header swf feature. I also added a more information section to help explain how the calculations work. There is a links page too, but it’s a bit dry.
I built this in responce to a lack of a good, simple, accurate online tax calculator. During my research, I became a bit suspicious of the calculator on the ATO website, as the numbers just don’t add up! I think there is a rounding problem that causes the calculations to drift. Moreover, all their calculators are awkward to use and often not complete or out of date. Having said this e-Tax rocks.
I’m also thinking of building a google gadget for it. I have a resized version ready to go. Building a google gadget is a pain. During the build I found that their API documentation was out of date and I also get a “can’t publish” error without explanation for no logical reason. At that point I gave up.
Arithmetic
I have just finished my first proper AS3 site (about time).
I inherited some work done by another developer, but it was left in a state - I think it got a bit too overwhelming for him. So I decided to rebuild the site structure and add a layer of logic behind the code. I used a simple form of mvc where the control and view were grouped. I also built it with swfAddress in mind. This added considerable complication as I have to have a single point of entry from which I could build the site from. The site structure was also described in xml so that it could be content managed - currently manually. I decided not to use E4X as the xml data’s structure was required. I have used E4X back in AS2, it is good for pulling data out of xml, but not so useful as a way of simply parsing xml into object data. I build a rock-solid XML parser in AS2 which would deserialise xml data into object/array structure. It has been used on hundrends of little jobs over the years and saves hours of development time. But as soon as I step into AS3 all my AS2 libraries are made redundant.
I learnt alot about AS3 whilst building the site. The hardest part was probably dealing with errors - in my case errors which occurred when I had to deal with a dynamic menu structure which may have 0, 1 or n nodes. In AS2 you can get away with using an undefined state as a valid condition, but in AS3 it will trigger a nasty error that will only express itself at runtime. Ouch.
The next phase of development will involve building a fileshare component to allow files to be uploaded/downloaded and commented upon by an administrator and client.
JSON - by the code for the code
Just finished building the json flash feed:
http://blog.robshearing.com/wp-flash-json.php
I used a handy php JSON parser to encode the string. I’m not entirely convinced about JSON. Evangelists go on about it’s inherent readability, however characters have to be escaped and this results in some messy looking text. I see this notation best suited for code and not for humans to read. It’s best if it’s encoded by code and then decoded by code and never sees the light of day. In this respect it is a very readable notation, lightweight and easy to ingest.
For example:
encoding (using PHP JSON parser):
$output = $json->encode($json_feed);
decoding (using adobe’s AS3 JSON parser):
var myObject:Object = JSON.decode( jsonString );
I don’t think it’ll ever replace xml. If I have to manage the data myself I will opt for xml - I can add comments, I can add CDATA, I can waste time deciding whether to use attributes or text nodes and I can take pleasure in making it look nice. But if I just want to shift a big chunky object from one platform to another I’l be encoding with JSON.
Custom rss feeds
I’m working on setting up this wp blog to manage the blog and to act as a CMS for a flash site. I have a Category Visibility plugin that hides website posts and only shows blog entries in the blog. For the non-blog posts I’m adding some custom fields that will be used to link to assets. I can then expose these categories to the flash site via rss.
Blog posts:
http://blog.robshearing.com/wp-rss2.php
or
http://blog.robshearing.com/feed
or
http://blog.robshearing.com/?feed=rss2
Actionscript experiments feed:
http://blog.robshearing.com/wp-rss2.php?cat=8
Work feed:
http://blog.robshearing.com/wp-rss2.php?cat=7
I am however finding flaws in this model. The problem is twofold - dealing with those custom fields and making my life easier when I parse the data in flash. I’m thinking of either adding the meta data to the rss feeds, making a custom feed, or make a bespoke JSON feed. I don’t want to add meta to the rss as it may start to break the feeds compliance, also I don’t want no trouble if I upgade WordPress. Making a custon rss fleed is boring, so I’m going to attempt to build a bespoke JSON feed…
AS3 - learning the ropes
I’m getting stuck into AS3 to build my new site and it’s not as straight forward as I first thought. Almost everything I have learnt and taken for granted I now have to revisit and rebuild. Generally however, I’m pleased with all the new coding procedures and class re-writes that adobe have given in the updated language.
Here are three interesting ‘features’ I discovered yesturday:
Stage
Stage can only be accessed though a visible displayObject.
I discoved this when tying to build an AS3 stageManager class. I didn’t want to make the class extend a sprite and have to add it to the displayList. So I decided to pass it a displayList object as a reference that it uses to measure the stage size.
AS3 Singleton
You can’t make the constructor private! So the old singleton is broken. I googled this problem and found that many people pass the constructor a private variable or method so it can only be successfully implemented internally. Problem is that the class looks a bit messy. Then I discovered another implementation by Daniel Hai on http://www.onflex.org/code/
package
{
public class Singleton
{
private static var instance:Singleton = new Singleton();
public function Singleton()
{
if( instance ) throw new Error( "Singleton and can only be accessed through Singleton.getInstance()" );
}
public static function getInstance():Singleton
{
return instance;
}
}
}
E4X and namespace
I was attempting to read a feed from here: http://kuler.adobe.com/kuler/API/rss/get.cfm?listtype=rating
If you look closly the swatches are on nodes under a kuler namespace:
…
<kuler:themeItem>
…
<kuler:themeSwatches>
<kuler:swatch>
<kuler:swatchHexColor>468966</kuler:swatchHexColor>
</kuler:swatch>
</kuler:themeSwatches>
…
</kuler:themeItem>
…
I haven’t come accross this notation before. In AS2 I could just barge in and parse the nodes as “kuler:themeID”. So this led me to discover the namespace class. Whereby, if I understand it correctly, you target the nodes within a specific namespace. Combined with the beauty of E4X, my query became:
var kuler_ns:Namespace = xml.namespace("kuler");
var hexList:XMLList = xml..kuler_ns::swatchHexColor.text();
Isn’t that pretty.
astronaut - music and flickr
A series of tag searches from flickr is done against lyrics to a song. Results are unexpected and amusing.
http://www.avoision.com/experiments/astronaut/
This has got me thinking. I might have a go at ths some time, afterall I’ve already built the engine:
flickr rss reader
Eames’ information machine
A short animated film written, produced & directed by Charles & Ray Eames for the IBM Pavilion for the 1958 Brussels World’s Fair. The movie topic is the computer in the context of human development, more specifically it traces the history of storing & analyzing information from the days of the cavemen to today’s age of electronic brains.
Lee Brimlow on AIR
A video has just been added to the onAIR tour:
http://onair.adobe.com/blogs/videos/2007/08/01/lee-brimelow-transitioning-to-the-desktop-with-adobe-air/
Lee is great and he works at such a great company too. As for all this AIR, I really have to get started. The results are so much similar to ZINC, but with a much cleaner interface (and I presume more stable and less quirky)


