Apple Magic Mouse in Windows

November 25th, 2009

Following on from my previous post about using Apple wireless keyboards in Windows, here is a little help in getting the fancy new Apple Magic Mouse to work in Windows.

Apple Magic Mouse

Taking the Apple Bluetooth Update the Magic Mouse’s driver can be extracted using WinRAR, or your extractor of choice, giving you both a 32-bit and 64-bit version driver for your mouse that you can install on your PC (Windows XP to Windows 7), allowing you to enjoy all the ‘magic’ of the Magic Mouse.

If you don’t fancy doing this yourself you can simply grab the 32-bit version here, and the 64-bit version here. Taadaa, Isn’t that just magic!

PhoneGAP – build hybrid HTML/apps for mobiles

September 14th, 2009

PhoneGap is an open source development tool for building fast, easy mobile apps with JavaScript.

If you’re a web developer who wants to build mobile applications in HTML and JavaScript while still taking advantage of the core features in the iPhone, Android and Blackberry SDKs, PhoneGap is for you.

http://phonegap.com/

50 new jQuery hints

August 24th, 2009

50 new’n'nifty hints and tricks to use with jQuery…

http://www.smashingmagazine.com/2009/08/23/50-useful-new-jquery-techniques/

Flash Error 5003 & 5005

August 18th, 2009

“5003: Unknown error generating bye code.”

“5005: Unknown error optimizing byte code”

You may find yourself receiving either of the above errors when working –in the Flash IDE– with FLA files that make use of large amounts of code. These two errors both stem from the same problem; Flash not handling an “Out Of Memory” error exception from Java (from the asc_authoring.jar file). This error will be apparent if compiling using the Flex SDK.

There are several possible solutions you can try to get around this error. Firstly, check that the Flash Optimiser in the Publish Settings dialog box is disabled (select Publish Settings and disable the “Reduce file size and increase performance” option under Script Settings), and recompile. In any other case where you are not getting a 5003 or 5005 error this option should be left enabled.

Another solution you can try, if disabling the Optimiser does not resolve the issue, is to delete the ASO files and recompile (Control -> Delete ASO Files and Test Movie).

Depending on the size of your project it is possible that these two solutions do not resolve the issue. If it is not possible to compile the project using the Flex SDK (which allows you to easily set the Java VM heap memory) you will need to set an environment variable on your system to increase the Java VM heap memory size. How you do this will depend on your system:

Windows:
Right click on My Computer -> Properties -> Advanced -> Environment Vars
Make a new var like this:

JAVA_TOOL_OPTIONS

and its value

-Xmx256M


Mac OS X:
Create the directory and file (if not already there) ‘Users/{your user}/.MacOSX/environment.plist’
Note: The folder will be hidden in finder unless you enabled the view of hidden folders.
The Easiest way to create/edit this file is by using RCEnvironment, which will handle the creation and management of the file for you.

Enter variable JAVA_TOOL_OPTIONS

and its value -Xmx256M

Now Logout/restart.

In our tests we were able to successfully compile with values of -Xmx128M and -Xmx256M. A value of -Xmx512M and higher gave the error “Error initializing JRE. You may need to reinstall Flash”. Your mileage may vary based upon your machine specifications, if you find yourself receiving this error simply reduce the amount of memory allocated to the Java VM heap and restart again. After following the above steps you should be able to compile your project once again with the Optimiser enabled.

N.B. YOU CANNOT RUN FLASH FROM SPOTLIGHT OR OTHER LAUNCHERS
For some reason, Spotlight ignores the environment.plist options. An issue has been logged with Apple regarding this, in the meantime be careful when launching Flash from Spotlight or other application launchers.

Customisable UIs are the best. Or are they?

August 17th, 2009

Many pundits have, for quite some time, insisted that web interfaces that allow a degree of personalisation or customisation out-perform those interfaces that present the same face to all visitors. Much of the research on this aspect of interfaces has centred around applications, rather than websites or applications delivered over the web.

New research suggests that, rather than being the “best of all worlds”, websites that allow customisation have the same measured usability as non-customised sites. Additionally, those sites that allow products customisation come up even worse in the usability stakes, thus possibility reinforcing the belief that “less really is more”.

http://www.useit.com/alertbox/customization.html

Amazon API

August 10th, 2009

Every request to the Amazon API needs to be signed by using HMAC-SHA signatures. The request needs a signature and a timestamp. “A signature is created by using the request type, domain, the URI, and a sorted string of every parameter in the request (except the Signature parameter itself) with the following format <parameter>=<value>&. Once properly formatted, you create a base64-encoded HMAC_SHA256 signature using your AWS secret key.” Amazon API [1]

The timestamp needs to be in YYYY-MM-DDThh:mm:ssZ Format.

Examples can be found in the Amazon API Docs [2]. For the encryption I used the as3crypto lib [3] and a solution of Brendon Wilson [4].

[1] http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?HMACAuth_ItemsRequired.html

[2] http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?rest-signature.html

[3] http://code.google.com/p/as3crypto/

[4] http://www.brendonwilson.com/

the final function:

public function aws_signed_request(p : Array):void{
var public_key : String = "Your Access Key ID";
var private_key : String = "Your Secret Access Key:";

var requestBytes:ByteArray = new ByteArray();

var hmacc:HMAC = new HMAC(new SHA256());
var keyBytes:ByteArray = new ByteArray();
var hmacBytes:ByteArray;
var encoder:Base64Encoder = new Base64Encoder();
var formatter:DateFormatter = new DateFormatter();
var now:Date = new Date();
var string_to_sign : String = "";
var timestamp : String;
var method : String = "GET";
var host : String = "ecs.amazonaws.com";
var uri : String = "/onca/xml";
var pattern:RegExp = /%7E/gi;
var signature : String;
var params : Array = new Array();

// Do not change the order of following commands
params["AWSAccessKeyId"] = public_key;

for(var i:int = 0; i params[p[i]] = p[(i+1)];
}

// creating Timestamp
formatter.formatString = "YYYY-MM-DDTHH:NN:SSZ";
now.setTime(now.getTime() + (now.getTimezoneOffset() * 60 * 1000));
timestamp = formatter.format(now);

params["Version"] = "2009-03-31";
params["Timestamp"] = timestamp;
params["Service"] = "AWSECommerceService";

params.sort();

// cannonicalized_query
var can_query : Array = new Array();
for( var key in params ) {
key = escape(key.replace(pattern, "~"));
params[key] = escape(params[key].replace(pattern, "~"));
can_query.push(key + "=" + params[key]);
}

var fin_query : String = "";

// implode the query
for(var i:int = 0; i fin_query += can_query[i];
if(i != (can_query.length-1))
fin_query += "&";
}

string_to_sign = method + " " + host + " " + uri + "\n" + fin_query;

requestBytes.writeUTFBytes(string_to_sign);
keyBytes.writeUTFBytes(private_key);
hmacBytes = hmacc.compute(keyBytes, requestBytes);
encoder.encodeBytes(hmacBytes);
encoder.toString();
signature = encoder.toString() + encoder.toString();
signature = escape(signature.replace(pattern, "~"));
var request : String = "http://" + host+uri+"?"+fin_query+"&Signature="+signature;

somaLoader.add(request, null, SomaLoader.TYPE_XML);
somaLoader.addEventListener(SomaLoaderEvent.COMPLETE, responseReceived);
somaLoader.start();

}

AS3 Traversing associative arrays

August 10th, 2009


var params : Array = new Array();
params["Version"] = "2009-03-31";
params["Service"] = "Test";

for( var key in params ) {
  trace(key + " => " + params[key]);
}

FireVox screen reader

August 4th, 2009

FireVox is a free opensource screen reader and keyboard navigation plug-in for the Firefox. It’s available to download for Windows, Mac and Linux.

http://firevox.clcworld.net/

Migrate from AS2 to AS3

July 21st, 2009

These are a few links for those who haven’t migrated from AS2 to AS3 yet. Feel free to edit it and expand it as much as you want.

Adobe’s guide. Use it only when you think “where the hell is this AS2 stuff I’ve always used“
http://livedocs.adobe.com/flex/2/langref/migration.html

This is a pdf to boost your morale and see how as3 is not that different from as2.
http://www.adobe.com/devnet/actionscript/articles/as3_migration_cookbook/as3_migration_cookbook.pdf
(PDF)

A tutorial to get started on the basics of AS3 (using FlashCS3):
http://www.senocular.com/flash/tutorials/as3withflashcs3/

Grant’s skinner workshop. A little bit more detailed/difficult than previous links.
http://gskinner.com/talks/as3workshop/

Worth a look through is also Kirupa’s ‘Tip of the day’, good to search through when you come up against problems with AS3:
http://www.kirupa.com/forum/showthread.php?t=223798

I hope that’s enough to start.

For almost anything else you also have:
http://www.kirupa.com/developer/flash/index.htm#ActionScript_Basics

And of course, you can ask us anything you need.
:]

Django : another web framework

July 16th, 2009

This time it’s Python-based, and takes the scaffolding metaphor to a new height (no pun intended) by including a lot of auto-build stuff and encouraging developers to build-by-exception all of the time whilst remembering the key elements of the DRY idiom. Take a look.

Designed and built from the ground up to work in a “fast-paced online news operation” the framework allows quick and easy development of web applications, without compromising on the amount of control that a developer has over the code. Major “we like this” points are:

1. built-in URL design with no limitations from the framework

2. template language to separate your view code from the model and controller code

3. super caching to speed up application performance

4. free cherries with each application

5. automatic admin interfaces – out of the box, once you define your data. Don’t waste time in building yet another admin interface

6. multi-language and internationalisation ready

* The cherries are not free, nor do they exist.