23 February 2009


Use netstat to See Internet Connections | Linux Journal
$ netstat -tpe

The -t flag limits the output to show only TCP connections.
The -p flag displays the PID and name of the program making the connection.
The -e flag displays extra information, such as the user name under which each program is running.

package protected methods java puzzler

An excellent Java puzzler

comments by xeukun JOU

package m1;
public class M1 {
     void doIt() {System.out.println("M1");}

package m1;
public class M2 extends M1 {
    void doIt() {System.out.println("M2");}

package m2;
public class M3 extends M2 {
    void doIt() {System.out.println("M3");}

package m1;
public static void main(String[] args) {
     M1 m=new M3();

This will show "M2", not M3, even though M3's doIt() should be invoked, based on what a vtable would indicate.

It's not a common thing; I wouldn't have put main() in the m1 package, and if it's not local to M1 you won't see the behavior (it won't compile). But it's still an interesting corner case, and I think it's not obvious unless you've run into it.

20 February 2009

Add a Binary Payload to your Shell Scripts

Add a Binary Payload to your Shell Scripts | Linux Journal
Adding a binary payload to a shell script could, for instance, be used to create a single file shell script that installs your entire software package which could be composed of hundreds of files. You merely append the tar or gzip file of your package as a binary payload to the script file, when the script runs it extracts the payload and does its task with the extracted files.

17 February 2009

Popcorn Hour A-110

I'm getting tempted to buy a Popcorn Hour A-110 media server to replace my old xbox running XBMC. XBMC is great but the old xbox hardware isn't capable of display HD (1080p) content. Like XBMC, the Popcorn Hour A-110 can play just about any format.

15 February 2009

Delay the messages you send from Microsoft Outlook

Delay the messages you send from Microsoft Outlook | Workers' Edge - CNET News
Have you ever wished you had reconsidered sending that e-mail to your boss, explaining in detail his shortcomings as a manager? Or perhaps you regret complaining to a client about her unprofessional behavior for canceling a meeting at the last minute--before learning that the cab she was riding in hit a bus.

12 February 2009

Mysql diagnostics

You can see which queries are running and who is connected by running

mysqladmin processlist -i10 -u root -p

you can kill a listed connection by running

mysqladmin kill pid1,pid2 -u root -p

02 February 2009

Some Maven humour :)

Java Performance Tuning comments on ReadWriteLocks

Tips December 2008
Starvation with ReadWriteLocks (Page last updated October 2008, Added 2008-12-30, Author Dr. Heinz M. Kabutz, Publisher The Java Specialists' Newsletter). Tips:

* ReadWriteLock should only be used in cases where the critical section is at least 2000 code statements
* For most applications concurrency classes such as ConcurrentHashMap and ConcurrentLinkedQueue are more efficient than using ReadWriteLock.
* ReadWriteLock with many readers compared to writers can cause the write threads to be starved of access to the lock.
* Using fairness et to true in ReentrantLock reduces throughput significantly.
* You should probably never use ReadWriteLocks in Java 5. In Java 6, use ReadWriteLock when you are willing to wait for writers to get an opportunity to acquire the lock - they won't get locked out completely, but it might take some time before they are serviced.

Gmail offline mode

SQL Editor in IntelliJ IDEA