Archive for the 'Linux' Category

Software Release: battery_status.py

Tuesday, August 21st, 2007

Annoyed that Fedora 7 doesn’t have the same CLI tools to get battery status, I coded up a little python script last night to do just that. It was a pretty straight-forward project that took me about an hour, but I was pretty happy with the end result. It reads the proper files out of the /proc/acpi/battery hierarchy, does some calculations on that data and the gives you what you really want.

You start with this:

thesis|18:46|~% cat /proc/acpi/battery/BAT0/info
present:                 yes
design capacity:         65520 mWh
last full capacity:      69150 mWh
battery technology:      rechargeable
design voltage:          14400 mV
design capacity warning: 3457 mWh
design capacity low:     200 mWh
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            42T5229
serial number:           35751
battery type:            LION
OEM info:                SANYO
thesis|18:46|~% cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            8595 mW
remaining capacity:      66620 mWh
present voltage:         16690 mV

And you get this:

Battery 0: 96.46% (0:17 until charged)

In the spirit of sharing and trying new things, I thought I would register it as Google Code project and give it away under a BSD License. It was about a ten minutes process, start to finish and now the world can have it:

http://code.google.com/p/batterystatus/

Hurray for non-scarce economics!

Java debugger back to full speed in Linux

Thursday, September 14th, 2006

When I started this job at unamed company, it was my return the Java development world after a hiatus of about seven years.

In my day, we used xemacs, xterms, and Netscape Communicator and we liked it!But seriously, when I last seriously wrote Java, there were some not-so-useful proto-IDEs out there. My short return in 2002 didn’t show that the world was much better.

But in 2006, Eclipse is king. And since I spent most of time in Eclipse, cranking out the objects, I didn’t mind too terribly to be working on Windows. But those who know me know that I prefer to use Linux and my 10-year old FVWM config (ported a few years back to fvwm2) to get “real work” done.

So after 6 months on Windows, I switched to Linux (Fedora Core 5, for the curious… I’m a total Red Hat whore). Eclipse is pretty much the same. The only problem was that the debugger seemed to run painfully slow. I’ve lived with this for like 3 months. And finally, FINALLY, I have a remedy:

Small JDWP packets with the socket transport causes slow debugging on linux 2.6.15 kernel and newer

I installed jdk-1.5.0_08 and suddenly the sun is shining, the birds are singing, and the debugger is responsive again!

What was the problem? Evidently, the debugger was behaving badly, but this was masked by some behavior in the Linux kernel that was fixed in version 2.6.15:

Java remote debugging is slow due to apparent networking bug

Hallelujah!