Sunday, July 12, 2009

How to modify http headers in Internet Explorer

When developing for the web, you may want to simulate various HTTP Header values for your application. This is easy in Firefox - there are a number of plugins that allow you to do this like Modify Headers.

However for IE6 it is more difficult. The best solution I have found is this one:

- Download Fiddler.
- Open the 'Customize Rules' window (Rules->Customize Rules...)
- find this function: static function OnBeforeRequest(oSession: Session)
- inside this function, add the header values that you would like to add, in this format:

oSession.oRequest["headerName"] = "headerValue";

-save


Voilà! Internet Explorer will now accept your custom header values. You will probably need to clear your browser cookies before it takes effect.

Tuesday, June 30, 2009

How to enable internet tethering (phone as modem) for iPhone 3GS on Australia's Three network

Go Here:

http://andrew.harrison.org/notes/3-tethering-and-mms/using-your-iphone-on-3/

Follow the instructions in section 3 - "Enable tethering and MMS".

I've done this and it works beautifully on a Windows machine.

Then:

Pair your iphone with windows in:
Start -> Control Panel -> Bluetooth devices.

Once it has been paired, you can connect to the internet simply by going to:
Start -> Connect to -> Bluetooth network connection

The iphone will appear in here as an access point.

How to update page text using javascript (and prototype)

$('blah').innerHTML = '${valueToSet}';
<label id="blah"/>

Note: .innerText only works in IE.

And if you want to display end-of-line characters correctly, for example, if the data has been entered using a textfield (using Freemarker and prototype)

$('commentsView').innerHTML = '${closeout.comments!""?js_string}'; 
<label id="commentsView"/>

Wednesday, June 17, 2009

13" Macbook Pro vs Vaio : Initial Hardware Impressions

I just took delivery of a 13" Macbook Pro, after being a long time 13" Vaio user. Here are my initial impressions of the hardware, divided into WIN and FAIL Categories. I'll start with fail, because that is the most fun.

FAILZ

High Gloss Screen == FAIL
There's no question - it is too glossy. UQ has issued a health and safety warning for it.

Missing keys == FAIL
No Home, End, Page Up, Page Down and Delete keys? What were they thinking? There's plenty of room to put them in, I guess I'll have to adjust my habits somehow - anyone know what mac users do to make up for these keys?

Sharp wrist rest == FAIL
The front lip of the macbook (when open) is a machined 90 degree angle, and is about as sharp a 90 degree angle as I have ever seen. When I'm lounging on my couch, this is where the heel of my hands rests (and rubs against). Painful! Yeah apple it makes the laptop look cool when it is closed, but this is one sacrifice of form over function that you shouldn't have taken.

Click anywhere trackpad == FAIL
I'm pretty sure I read somewhere that you can click anywhere on the oversized trackpad. Well you can't - you can click in about the bottom third of the trackpad, any higher than that the clicking action progressively diminishes into no click at all.

Glowing Apple Logo == FAIL
This is something I'd like to turn off. I don't consider myself an apple fanboy, and having that glowing apple log on the bus is embarrassing,

WINZ

Backlit Keyboard == WIN
It is very well designed, has nice keys and the backlighting is great at night. I still think they could have made the keys bigger though - my old Vaio managed to have full size keys with the same overall width.

Stylish == WIN
It's a beautiful machine, the aluminium and glass just looks superb. What amazed me is that when you turn it over - the bottom is just flat aluminium. They've managed to hide all the ugly bits very well.

External Buttons, Lights, Plugs == WIN
Superbly designed - hidden notification lights, a built in battery indicator on the side and the thing feels REALLY solid. It makes a precision 'thunk' when you close it like nothing I've ever heard.

Oversize trackpad == WIN
Nice and sensitive - almost as good as a Vaio. My tap to click occasionally doesn't register, but perhaps I just need to adjust my tap a little bit. The large size of the trackpad is brilliant too - why doesn't everyone make them this size?

Low Weight == WIN
It feels a LOT lighter than my Vaio - especially when in my back pack.

Sound == WIN
The speakers are hidden somewhere - (in front of the keyboard I think?) and they are excellent. The sound is stereo, it goes loud, and it is directed towards me, which the Vaio was notoriously lacking in.

Friday, June 5, 2009

Maven jetty plugin can't find applicationContext.xml?

If you get this error, in your web.xml you need to be explicit about the location of your applicationContext.xml (even if you have a Spring ContextLoaderListener defined).

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

I would have thought that being a maven-jetty-plugin it would know where to look, but apparently it is too stoopid.

Friday, May 29, 2009

How not to inspire your team to achieve greatness

Today the data team leader sent out an email to the entire IT team that was only two paragraphs long, and yet managed to cram in all of the following phrases:

  • "governance imperative"
  • "business initiative"
  • "management-driven"
  • "critical success factor"
  • "proactively"
  • "process and control"
  • "integrated, consolidated, improved"
  • "cross functional"
  • "fuels that power the modern corporation"
  • "mired in the prenatal lifecycle"
  • "need for effective collaboration"
  • "support mechanism for initiatives"
  • "effective collaborative structure for data-intense business initiatives"


In the words of Lisa Simpson: "Excuse me, but aren't these just buzzwords that dumb people use to sound smart?"

Wednesday, May 27, 2009

Maven, Quartz and Spring 2.x

If you have tried to use scheduling in Spring 2.x and you are using Maven - you will probably be having trouble.

In your stacktrace, you might be seeing this:

Caused by: java.lang.NoClassDefFoundError: org/quartz/ObjectAlreadyExistsException
at java.lang.Class.getDeclaredConstructors0(Native Method)

or this:

Caused by: java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set;
at org.quartz.JobDetail.(JobDetail.java:85)


It seems that the good folks over at OpenSymphony (makers of Quartz) couldn't care less about Maven (I don't blame them) and making sure their pom.xml is correct (which it isn't).

And Spring, which uses Quartz for scheduling, doesn't seem too concerned either about making sure that their pom.xml has the correct dependencies for Quartz (which it doesn't).

The short of it is, if you want everything to just work, you'll need to explicitly include these two dependencies in your pom.xml:

        <dependency>
<groupid>opensymphony</groupid>
<artifactid>quartz-all</artifactid>
<version>1.6.1</version>
</dependency>
<dependency>
<groupid>commons-collections</groupid>
<artifactid>commons-collections</artifactid>
<version>3.2</version>
</dependency>


And so, if you are in the unfortunate position of having to use Maven, I empathise. Let us weep together.