18 December 2007
Job vacancy at 4RF
This is a new position, advertised on Seek and on the company's web site.
Stephen Colebourne's Weblog
The strongest support was for Improving Generics, String Switch and Multi-catch. Attendees were giving a clear 'yes' to these being in Java 7.
I've been wanting to post about multiple catches for a while... I didn't know there would be such a strong demand for it!
Ok, for generics... the Java implementation (when compared with C#'s one) is just horrible.
But 'erasure' doesn't seem to want to go away
17 December 2007
09 December 2007
Understanding dependency injection and Guice
I've just seen the first 20 minutes, but it's sufficient for me to clarify:
1 - the usefulness of dependency injection
2 - how this new framework, designed by Google's Bob Lee, can help reducing the amount of code one needs to write, and more
From now on I will look at factories with suspicion...
07 December 2007
Back to ASM
For the first time I've realized that it's probably more challanging for the compiler to output efficient code for such a small processor, rather than a bigger one, say an ARM.
No wonders why you can't easily find an open source toolchain.
I've been amazed by the unexpected number of assembly instructions a simple instruction can translate to.
And sometimes it seems the case that what wouldn't be the quickest way of doing things in C, translates in effect into a fewer number of assembly instructions.
22 November 2007
NZ$600 Asus Eee PC quick review
Breakfast's tech test-driver Gary Steel reviewed the Asus Eee PC, a laptop designed primarily for Internet use.
20 November 2007
4RF on TV, as a success story
Business Nov 20: Declining productivity (1:54)
New Zealanders may work some of the longest hours in the world
but latest statistics show that it is not translating into
increased productivity. In fact, workplace productivity is
declining.
19 November 2007
Open Inheritance versus Designed Inheritance
Final means different things depending on where it’s found. If you put it in front of variables, that means ‘constant’. Final variables can just be assigned a value once.
It’s different if it’s put in front of methods and classes. In that case it means that it closes them from being overridden through inheritance. A final class can’t be extended, and a final method can’t be overridden by methods with the same signature in derived classes.
I’ve just discovered that closing or not a class to inheritance is behind two different school of thoughts: Open Inheritance and Designed Inheritance.
Here’s a little introduction to these two different approaches:
http://martinfowler.com/bliki/DesignedInheritance.html
DSP... in Java
Sphinx-4 A speech recognizer
FreeTTS 1.2 - A speech synthesizer
And something else, that might come useful sometimes :-)
jMATLAB - an interpreter for the matlab language and a plugin for Eclipse
16 November 2007
java.util.zip
That's good because I don't have to add any additional library to perform the task of zipping, that would steal some additional precious embedded storage room.
XML files are notoriously redundant so the idea of gzipping an XML file before saving it onto flash can lead to significant savings.
The only problem, I had to learn a bit more about the difference in Java between byte-based and character-based streams.
As you probably already know, these two types, byte and char, are different.
Byte is an 8 bit signed type, while char is a 16 bit unsigned byte. The reason for char is to allow support for internalization and localization by carrying character set information.
Some classes use byte based streams, some others char based ones.
The java.util.zip library uses byte based streams, so in order to interface it with character based classes (like an XML parser) I needed to use some sort of bridge classes.
Examples. To Gzip a String:
String str = ...;
ByteArrayOutputStream ba = new ByteArrayOutputStream();
GZIPOutputStream gz = new GZIPOutputStream( ba );
DataOutputStream os = new DataOutputStream( gz );
os.writeBytes( str );
os.close();
byte result[] = ba.toByteArray()
To UnGzip from an InputStream:
InputStream is = ...;
GZIPInputStream igz = new GZIPInputStream( is );
InputStreamReader isr = new InputStreamReader( igz, "ISO-8859-1" );
StringBuilder strb = new StringBuilder();
int c;
while(( c = isr.read() ) != -1 )
{
strb.append( (char)c );
}
String result = strb.toString();
12 November 2007
I'm loving unit tests!
09 November 2007
Java Swing Survival Guide - Software Reality
This is an old but spot-on article that highlights the limitations of Java as a language for desktop applications. It also finds some qualities in it.
We'll see whether the latest development (SwingLabs, JavaFX) can give some hopes to Java as a language for desktop applications.
How to compare a Byte[] and a byte[] ?
But a lot of functions return just plain arrays.
So I happen to compare an array of objects Byte (returned by an ArrayList
I know an array of Bytes is an array of p... ehm, references so its nature is totally different from the one of an array that contains primitive types.
But I wish there was a method to compare the two, so clever to do boxing/unboxing automatically.
Eclipse and Make projects on Linux
I love to run it from within Eclipse, so that the output from the console is piped nicely into the IDE. Before I thought I could safely run Eclipse as root for that purpose. That choice has caused though a lot of pain...
So I've looked for other ways like adding myself to 'sudoers' with no password, and adding 'sudo make' to the project compile settings
But Eclipse fails and returns an error like 'exec failed to run sudo make'.
A quick workaround I've found is to create an additional dummy makefile in another directory with the same targets as our make, and each targets just calls the real makefile, by prepending sudo to the make command, for example:
all:
cd .. ; sudo make all
The real solution to my problem would be not to have to run 'make' as root.
In order to do that I need to find a way to grant users privileges like running the 'chmod' command on files they don't own. There must be a way to do it...
07 November 2007
JavaScript To Fragment, The End Of The Reign Of The Browsers - Weiqi Gao's Observations
A very interesting point:
JavaScript has become an assembler of the web. And it needs to grow up. Or it risk being overtaken by other languages.
The browser platform is passé. The race for the next round of cross-platform (note: not cross-browser) internet applications (note: not web applications) has already started
26 October 2007
Guglielmo Marconi
Did you know that Mussolini was best man at Marconi's second wedding?
24 October 2007
My new blog
I've been a programmer for about 5 years now, started with Digital Signal Processing (which I still love and would love to do) but later expanded to generic embedded software (C for ARMs), C++ (multithreading on Linux) and Java 4-5-6.
About Object Oriented design I love learning about Design Patterns and discovering more elegant and robust ways of doing things.
I'm an employee of 4RF Communications Ltd., an 8 year old company based in Wellington, New Zealand. It's a young, vibrant, mid-sized company and I feel very lucky to work for them.
What I'll write in this blog will not necessarily reflect the opinion of my employer.
By the way I'm starting this blog in English, so that everyone can read it :-)