free hit counter

Saturday, October 29, 2005

Java constants- round 2

Ok, well it seems that implementing a Contant Interface( which I discussed previously ) is considered a bad idea, so in JRE 1.5 they introduced a static import language feature so you can say:

import static java.lang.Math.PI;

Wow. I'm surprised it took 'em so long


Thursday, October 27, 2005


I'm a devout thinkpad user. At a previous job we had 40+ laptops for compatibilty testing and development with our WLAN card. Across the board the Thinkpads were the most trouble free, tough, useful machines of the bunch.

ThinkWiki has much linux on thinkpad info as well as a little bit of windows info as well.

ThinkWiki - ThinkWiki

TT troubles

Well, I've got some troubles with the TT. Instrument cluster may be bad, fuel sending unit may be bad, the turbo bypass valve is bad, and the backup lights don't work.

I don't have the time to futz with it, but am afraid of how many hours I might have to pay someone to get to the bottom of all these problems.

Here are the resources I was using:
hum at 2900 RMP:
$100 repair manuals:
$229 windows based VW diagnostic reader (goes beyond OBD-II):
good forums:

Wednesday, October 12, 2005

missed interview questions

I had a quality phone interview yesterday. It lead off with a ranking of some skills from 1-10, (10 being Stroustrop for C++), then some technical questions based on those answers.

Dead on missed:
describe C++ const methods
const methods are methods that are guaranteed not to modify the members of the class. They are the only methods you can call on objects declared const, but are more usefull as compiler enforced check on methods that should be "read only".

in C++ what is the mutable keyword used for
Used on member declarations in a class declaration, allows a data member to be modified even if an instance is declared const.

besides classes and inheritance, name 5 differences between C and C++
ones I came up with on my own once I was out of the spotlight:
* exception handling
* don't have to declare variables all in one block at the top of a new scope
* new and delete
* operator overloading
* changed headerfile naming
* iostream instead stdio
* templates
* need extern "C" {} construct for intermingling with C

Ones I researched after the fact:
* C++ requires prototypes
* in C++ f() declares a function that takes no parameters. In C, a function declared using f() can be passed an arbitrary number of parameters of arbitrary types
* sizeof('x') is equal to sizeof(char) in C++ but is equal to sizeof(int) in C
* C++ puts structure "tags" in the same namespace as other names, whereas C requires an explicit struct. e.g., the typedef struct Fred Fred; technique still works, but is redundant in C++

Update with a rather definitive website:

Debunking some Java performance myths

"Pop quiz: Which language boasts faster raw allocation performance, the Java language, or C/C++? The answer may surprise you -- allocation in modern JVMs is far faster than the best performing malloc implementations. The common code path for new Object() in HotSpot 1.4.2 and later is approximately 10 machine instructions (data provided by Sun; see Resources), whereas the best performing malloc implementations in C require on average between 60 and 100 instructions per call (Detlefs, et. al.; see Resources). And allocation performance is not a trivial component of overall performance -- benchmarks show that many real-world C and C++ programs, such as Perl and Ghostscript, spend 20 to 30 percent of their total execution time in malloc and free -- far more than the allocation and garbage collection overhead of a healthy Java application (Zorn; see Resources)."

Tuesday, October 11, 2005

java references: SQL and resources

Monday, October 10, 2005

getting at textfiles that are packaged up in a JAR

I'm trying to get my SQL out of inline code and into individual text files. However, I don't want to distribute these text files to the end user. So, I think a decent solution is to stick them into the JAR and access them using getResouceAsStream().

It would be a bit more overhead, but you could also have an ANT task that calls a script to generate some java code to wrap the SQL statements so you don't have to make your textfiles public in the jar.

Wednesday, October 05, 2005

Cohesion and coupling

All my office stuff is a mess and I can't find my Code Complete book which allegedly contains an elaboration on cohesion and coupling.

As an alternative, Wikipedia has good articals on cohesion and coupling:

Feature Driven Development

I'm a big fan of Feature Driven Development having good success with it at TI. Though, at TI we thought we were making it up based on a collection of best practices!

This link has some more official resources

Monday, October 03, 2005

Artical Source- Software Reality

If you can survive the cheesy web graphics, it looks to be an interesting source for articals on creating and surviving software.