15 March 2008
14 March 2008
27 February 2008
07 February 2008
Working Around Type Erasure
Gosh, that hurts! but I'm glad there are ways to carry the generic type information with you
05 February 2008
23 January 2008
Serial Port and flow control with javax.comm
But I was having trouble getting the RTS/CTS hardware flow control going, like someone else.
It seems like some CTS events are missed.
At the end I succeeded by adding a wait loop for the CTS to go high before writing each character:
import gnu.io.*;
private SerialPort sPort;
private void osWrite( int val ) throws IOException
{
while( !sPort.isCTS() );
os.write( val );
os.flush();
}
One would expect this to happen in the background, but it doesn't with this particular implementation of javax.comm.
See also: http://en.wikibooks.org/wiki/Serial_Programming:Serial_Java#JavaComm
19 January 2008
12 January 2008
Tait split-off breaks ownership model
Mimomax Wireless will work in high spectral efficiency radio, a technology which Tait has been working on for three years. It allows large quantities of data to be sent at high speed over wireless networks.
The company will initially target utility companies wanting real-time monitoring of resources and distribution networks.
03 January 2008
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();