How’s that iPhone going?

August 23rd, 2008

A week or so on and I’m still playing with the thing.

First sad story - turns out that the SDK is only for people with Macs.  So no thinkquick iPhone apps any time soon.

I am charging it a bit more often than once a day.  I think maybe I use it too much.  Mind you, I have not been playing audio or video.

I was wrong about the web browser.  I am using it a lot.  Mainly because of the excellent websites that have an iPhone specific version.  News.com.au, Google Reader, etc.   I still use an application rather that the browser if possible -Facebook, Google.

I have installed probably about 40 applications on my phone.  Some I even paid for.  A lot I deleted soon after.  The vast majority are actually very nice.  The free iPint application that mimics a glass of beer (the surface of the beer moves according to how you tilt the phone) is probably my favorite ‘watch this’ application.

I still think it’s too big.  It would be great if the iPhone Nano rumours come true.

Ok, I’m off to see if I can buy a super cheap Mac..

My iPhone 3G

August 19th, 2008

I caved in.  I now own an iPhone 3G (16 gig, white).

First impressions? Pretty cool/slick/sexy.  Very smooth (literally).  I think it will be quite easy to drop it.  I really want to get a case of some kind for it (I’ve never had a need for a phone case/condom before).   The $8 a month for insurance might actually be a good idea (I don’t have it).

I’m on the Optus $39 a month deal.  500 meg of data and a few phone calls thrown in.  Plus $12 a month for 24 months to pay for the phone.

It sure it fun to play with.  Push the button at the bottom, then slide your finger across the screen to unlock.  Press the various buttons and watch things slide across, bounce out, and spin around.  Sweet.

It isn’t a perfect phone.  In fact, there are many many flaws/omissions.   But I don’t want to go on about those things.  Suffice to say that a top end Nokia or SE will certainly have more gadgets and options, but not come close to the package that is the iPhone.  Horses for courses, blah blah blah.

What are the*wow* things that I like?  The tilt sensor is really nice - for games and for rotating the screen.  The touch and drag support in almost every screen is wonderful.  The built in YouTube, Stocks, and Weather apps work straight out of the box - nice.  And just the general ‘look’ of the screens with the great color, fonts, buttons, etc.

The email program is great.  I have been reading my email on the iPhone even while sitting at the PC.

I doubt I will use the web browser much (it’s a bit too small, really).  I will probably almost never use the iPod functionality (not my bag).  And the less I have to use iTunes, the happier I will be.

So, in conclusion.. I could give it a score or list pros and cons.  But instead… I’ll mention the top three things I wish were different.

  1. It’s size.  I want it smaller.  Thicker would be fine.  Maybe it could fold out somehow.  It’s just not really convenient to carry.  (and it’s too slippery - for me).
  2. It’s camera.  The quality looks fine.  But I would like a flash.  And an easier to use shutter button.  Video would be a bonus.  Slow motion video would be super.
  3. Support for other applications (other than iPhone applications).   Flash apps.  Java apps.  Windows apps.  Etc.  This is unlikely to happen, of course, as it is in Apple’s interest to leave things as they currently are.  This third wish is heavily influenced by my delusions as a programmer, of course.

So now I’m off to see what damage I can do with the iPhone SDK.  Look for me in an AppStore near you.

Flex up front, LAMP down back, XML in the middle

June 2nd, 2008

We all know LAMP. It’s the free and open source basis for many a web server. L for Linux (the OS), A for Apache (the web server software), M for MySql (the database) and P for PHP (the coding language).

 

Usually.. or, at least, in the past.. php was used to return html to the browser. Based on some database query, you echoed a name or a number with some tags and such. Your presentation layer (the html) was therefore intermingled with your code. There are lots of ways to make this nice.. but.. it’s not needed anymore, now Flex is here.

 

A Flex front end basically asks a server somewhere for some data, it comes back, and it gets displayed. This sounds nice, but Flex takes a little bit of convincing to get it to work. Here’s how I did it..

<mx:HTTPService
id="myhttpservice"
url="http://www.thinkquick.com.au/example_xml.php"
resultFormat="e4x"
result="myhttpservice_result(event)"
/>

This first ‘bit’ is the HTTPService (from the Flex code). It controls sending the request to the server. Note the url. This is where your php file is. This php file must not return HTML. It must return XML. The xml should look something like this:

<?xml version="1.0" encoding="utf-8" ?>
<response>
<rows>
<row>
<thingOne>something</thingOne>
<thingTwo>1234</thingTwo>
<thingThree />
</row>
<row>
<thingOne>hello world</thingOne>
<thingTwo>999999</thingTwo>
<thingThree />
</row>
</rows>
</response>

To get the HTTPService to ‘fire’, just call myhttpservice.send();.
Then the function defined as the ‘result’ takes over:

[Bindable]
private var result2:XML;
private function myhttpservice_result(event:ResultEvent):void {
result2 = XML(event.result);
}

Presuming you were using a DataGrid to display the data, you would set dataProvider="{result2.rows.row}"
And then refer directly to the fields for your columns dataField="thingOne"

 

And just to prove it works…
The working example
A zip file with the source code

 

Note also that you will probably want to send extra data with your initial request like a search term. To do this, add a few lines before your send() command:

var parameters:* = {
"parameterOne": "555",
"parameterTwo": "something"
};
myhttpservice.request = parameters;
myhttpservice.send();

They can then be read in your PHP as normal, with a reference like $_REQUEST['parameterOne'].

Adobe Flex isn’t Flash

May 14th, 2008

But it is pretty cool. 

Adobe will tell you that Flex is Flash.  And the file extention is swf, so really it is Flash.  But.. it is far closer to HTML and Javascript than to the movie clips and timelines of Flash.  I’ve done a bit of Flash, and now a bit of Flex, and developing the two seems worlds apart.

Extensive knowledge of HTML, CSS, Javascript and all of the various browser handling tricks will let you begin creating a modern RIA (Rich Internet Application).  But now the much simpler option is to just do it in Flex. 

No need for AJAX calls, just use the very neat HTTPService object.  No worries positioning your screen items, just drag and drop them.  Nothing to do to handle different browsers, as a Flash file is going to look identical on any browser.

And it certainly helps that the available controls look very nice.  And some very advanced controls they are, also.  The default data grid’s standard abilities would take a huge amount of difficult to manage Javascript to duplicate (resizable columns, automatic sorting by column, click a value and it changes to an edit field, highlighting on mouseover, highlighting of selected row, etc.).

I’m not exactly sure how Adobe makes money out of this kind of thing.  It all seems free, although I believe the original Flex did have some big licencing costs.  I plan on taking advantage of Flex whereever possible from now on, so I’m hoping it stays free and it continues to be supported.

And how about Adobe AIR..  Well, there’s a whole new interesting approach that is really a very short hop from Flex. 

Flex product page : http://www.adobe.com/products/flex/ 
Coding examples : http://blog.flexexamples.com/
RIA examples : http://flex.org/showcase/
Language reference : http://livedocs.adobe.com/flex/3/langref/
Design : http://www.adobe.com/devnet/flex/articles/fig_pt1.html

Chumby

April 5th, 2008


Google will tell you what one is. 

In my words - it is a cute little box that acts just like a little digital photo frame.  But this photo frame has a brain, and wifi..

It can show you the latest news reports, or the weather, or the time, or a webcam, or stream music from the web, etc.  And you can touch the screen, and make it do stuff.  Like play a game of chess.  And you can pick it up and shake it, and tilt it, and the screen will respond.  Cool, eh?

So you set it up, put it somewhere, and glance at it every now and then.  Just like a photo frame, but with much more interesting and relevant information.

Whilst this is cool, it is not why I bought one.  I bought one because I can code stuff for it.  Now it is very cool.

So buy one.  If you are in Australia, like me, then try priceusa.com.au (they are only sold in the USA currently).

Line Rider

March 7th, 2008

Line rider is a very cool flash program that animates a tobogganist sliding along a user created path.  There are some amazing paths people have created, just check out YouTube.  Anyway, I am currently writing something similar as it is an interesting physics/mathematics challenge.

One problem that came up was rotating objects in Flash.   Flash lets you set the angle of rotation, but does not offer a nice way to define the point to rotate around (the pivot point).  By default, this is the top left corner of an object.  After a fair bit of googling, I found a fancy prototype class that could do it.  In the aim of helping others, I thought I’d post my generic function based on the method used in that class.  My function is not as fancy, but much easier to use.  Note that this does not actually change the pivot point, it just does the rotate based on 0,0 and then moves the object to the correct location to generate the correct rotation position.

The function should be self explainatory.  Pass the object(ie. movie clip) as o, px & py are the co-ordinates of the intended pivot point (0,0 would be the top left of the object), r is the angle to rotate by (10 would be ten degrees clockwise).


function rotate(o:Object, px:Number, py:Number, r:Number) {
 var a = {x:px, y:py};
 o.localToGlobal(a);
 o._parent.globalToLocal(a);
 o._rotation=o._rotation+r;
 var b = {x:px, y:py};
 o.localToGlobal (b);
 o._parent.globalToLocal (b);
 o._x -= b.x - a.x;
 o._y -= b.y - a.y;
}

Cowon D2 Flash

February 9th, 2008

I have written another little Flash app for my Cowon D2

If you have a D2 (or a Clix - I’m guessing it will work), then here is my program.

The original problem was getting the D2 to save, which seems to be fixed now in this firmware version (I am using 3.54).

To save some data:
mydata=”Hello World!”;
fscommand2(”SetPersistentData”, “data=” + mydata);

Then to retrieve it:
fscommand2(”GetPersistentData”, “data”);
trace(data);

The larger bulk of the programming for this app was coding the text edit field and getting things like return, backspace, and the cursor keys to work. 

If people find my app useful, then I might take the time to add multiple save files.  Let me know!

Facebook Applications

November 9th, 2007

I have recently been spending a bit of time using Facebook.  More specifically, I have been playing around with Facebook Applications.

For the last few months, developers have been going crazy pumping out applications that embed themselves into Facebook and interface with the Facebook API.  I have written a few basic ones, and it really is easy.

However.. what the real point of writing one of these applications is remains unclear.  A few developers are getting a trickle of cash from advertising.  Ironically, most of the advertising is currently for other facebook applications. 

One interesting element of these applications is the need for a unique ‘name’.  This must be at least seven characters and cannot contain the word face or facebook.  This potentially creates a bit of a domain-name-grab scenario, especially given that they are free to grab, and there doesnt seem to be a limit (I have about 23).

If things keep going the way they are heading, then this will only be better for users.  Not only do we have competition between social websites that forces them to increase functionality and performance, but we also are seeing huge competition between application developers to provide better products that meet user needs.

Is Facebook worth so much money?  I would say no, but… if someone is willing to pay it, then that is what it is worth.  Fifteen billion dollars for a company with nothing much on the books besides a list of people and their photos seems incredible.  I suppose a marketing company would love the data, and the access to that advertising space.  But.. my tip is that the current web advertising model (pay per click) is doomed to fail and that the thousands of websites propped up by that revenue will therefore suffer.

Anyway, back to programming related things.  I do intend to finish off a facebook app (or two) this year.  If nothing else, at least I will be able to have an application on my profile that does exactly what I want.

TiddlyWiki

September 18th, 2007

I have started using TiddlyWiki as my knowledge management tool.

It is a wiki that is contained all within a single html file.  It uses javascript to edit its own DOM to allow all of its functionality.   It then uses ActiveX to allow save the file and to also save backup versions.

It is all based around little packets of information referred to as Tiddlers.  These have a title, some text, and can have several tags.  There is also a long list of special syntax for adding functionality and for formatting.

There seems to be many people using it for a variety of purposes.  However, the information about TiddlyWiki and how to use it is pretty limited.  I have perservered and now have it up and running very efficiently.

At some point, I will post my tips on using TiddlyWiki including the list of syntax I have discovered and some quick pointers on implementing themes and macros.  I will also give you my guide for locking down TiddlyWiki so you can publish your wiki on the web in a tamper-proof state.

Cowon D2

August 24th, 2007

Two days ago, I bought a Cowon D2.  It’s a PMP (Portable Media Player).  I bought it online from MiniDisc Australia after deciding against the cheaper/riskier options (eBay, Amazon, etc).

It is basically an MP3 player.  It is also very cool.  It plays videos.  It has a touch screen.  It runs FlashLite 2.1 files.

The review over at Anything But iPod (excellent site name) first got me interested in the D2, and also the strong community at iAudiophile.net .  I also found plenty of great hands on product reviews on YouTube.

I have now written a few Flash programs and I’m very impressed by what can be done.   The touchscreen interface of the D2 allows for some very interesting applications.

Here is a rough version of touch screen whack-a-mole for you to enjoy.  40 seconds to squash as many smileys as you can.  If you are too slow, they flip upside down and stay there.  Countdown timer in the top left, score in the top right.  My highscore is 72.  Click the square in the bottom right to start/restart.

To download the file, right click this link and save the target.

Thanks to Kimili for his WordPress plugin for embedding flash without breaking Firefox.