Friday, 18 April 2008

THe business...

Long time no posts - check my new business cards out..

sany7232 (by t1mthet00lman)


Yes thats 5 colors! My travel blog will have all the deets, this is the pre-release teaser.

Monday, 31 March 2008

Work blog

For those of you who don't know, I'm working at JTeam here in Amsterdam. I have started my first professional blog. That doesn't mean its any better, has smarter content or anything, only that I get paid to write on it.. sorta.

http://toolman.jteam.nl/


Yes I have 3 blogs - subscribe to them all!

Thursday, 6 March 2008

Sterling engine in your PC:

http://www.extremetech.com/article2/0,1558,2272507,00.asp?kc=ETRSS02129TX1K0000532

A great idea, use the waste heat that the CPU throws off to power the cooling fan. I wonder how noisy this is? Also, sterling engines are fickle, as they use a sort of resonance between the expansion inside the cylinder and the cooling that the output fan creates. Still its a neat idea, and maybe we'll see it becoming more common, if the tech is stable (and cheap) enough.

Monday, 3 March 2008

RIP Netscape

As many of you probably know, Netscape officially removed support for its eponymous browser.
Official: http://blog.netscape.com/2007/12/28/end-of-support-for-netscape-web-browsers/
BBC: http://news.bbc.co.uk/2/hi/technology/7270583.stm
I was an early convert well before Firefox came about. I loved tabbed browsing, but everyone I showed just thought that it was a duplication of the task bar list of windows. Oh how wrong you all were - who still uses a browser without tabs? (Shut up anyone using iE6 - you shouldn't be reading this blog on such a crap browser)

Then Mr. Sam told me about this new browser that was a fork of netscape, and cut out the rest of the clutter that was the Mozilla / Netscape bundle. The Netscape / Mozilla bundle had all sorts of fluff that not many people used: email client, HTML composer, calendaring etc. And then Firefox came along and showed how small, focussed and fast was better...

And we all rejoiced. And the plugins were good. And we looked upon those still using internet exploder and laughed.

Netscape - you lead the internet revolution for a time, and now your offspring, Firefox, is keeping the other browsers honest.

Tuesday, 26 February 2008

element.offsetLeft

I just figured out what has been giving me grief all morning. iE6 doesn't give correct values for element.offset(Left|Top|Right|Bottom) until after the page has loaded under some circumstances. Especially when the element is inside a table. Until the page finishes render, it returns 0.

Urggg! I guess it is still adjusting the table size to fit so its ambiguous as to the correct size. I spent a while seeing if it was this bug (http://support.microsoft.com/kb/811808) but I think they aren't quite related.

Vent over.

RAM longevity in the absence of electricity

This shows how the GNU dd command is a leet hax0r tool...



Nice!

Tuesday, 5 February 2008

More to learn!

Its amazing how 6 months off working can affect you. Traveling thru Asia was excellent, but I didn't really think much, it was more like 24/7 experiencing. Towards the end of the trip I felt like I needed to exercise my brain!

I have been revising so much Java material recently (its all coming back), I need to re-learn so many things! I want to be on top of my game for interviews, but I haven't got anything to practice with, so I'm having to research and make my own dummy projects. Oh well, I'm sure I'll be getting paid for doing this eventually.

I had an interview today where they asked me lots of technical questions to gauge my level - fair enough. Unfortunately I was rusty in a few areas, so I am going to write another essay on the topics I should know more about.

Singletons:

A Singleton is a design pattern designed to guarantee only a single instance of an object. What do you use them for? They are good for objects used in many areas of a system - cross cutting objects. Also used for object factories, facade objects, state objects. Yes I do know what a singleton is.

Whats the technique in Java again? urg... well I can now tell you: nutshell is that you have a private constructor (so it cant be instantiated) and a static variable (to hold the single instance), then a static method which can instantiate (if needed) and return the singleton. In multi threaded objects, you need to be very careful to ensure that 2 objects can't be created due to synchronous access.

While I was reviewing this pattern, I found some interesting Java issues with the compiler optimization of the double locking pattern. This pattern is a nice way to not need to synch on every singleton request, eg:

public Object getSingletonObject() {

if(obj == null) { //lock1
syncronized (this) { if(obj == null) //lock2 obj = new Object(); } }

}
The idea here is that the method only synch's once - on first request. Every other request for the singleton doesn't (need to) synch. Unfortunately it doesnt work (until java 5) as a second call during the synch block by another thread might try the first lock and find non null, half instantiated object. The compiler reordering means that you can't guarantee the behavior without the whole method being synched. Or by ensuring java 5+ environments and marking the singleton field as volatile. This technique compiles and may appear to work in earlier JDKs, but isn't threadsafe.


Spring FactoryBean:
(quoting the FactoryBean’s JavaDoc here)
an ‘Interface to be implemented by objects used within a BeanFactory that are themselves factories. If a bean implements this interface, it is used as a factory, not directly as a bean.’

So a Spring FactoryBean is a special bean, it has implemented the FactoryBean interface. This special interface marks the bean as a factory, to provide generation of objects (or a singleton) and inject them into the application context. So it is a special bean in that its methods are not directly accessible, but it provides access to (other) bean(s) indirectly - it is a factory and its getObject() method passes back whatever the factory dispenses.. It can be a singleton or regular factory.

This forms a vital part of creation and injection of objects into the context. The Spring packages have many default implementations of factories and they all implement this interface.