header

Torsten Curdt’s weblog

Java File Links

Unfortunately dealing with links and permissions is not really easily possible in java. At least with the following code you can figure out whether you dealing with a link or not. A similar piece code has recently been contributed to the commons-io project. Found that really useful and worth sharing.


public static boolean isLink( final File file ) throws IOException {
        if (file == null || !file.exists()) {
                return false;
        }

        return !file.getCanonicalFile().equals(file.getAbsoluteFile());
}

Battery Statistics

An easy way of finding out about the health of your MacBook/MacBookPro battery is to use this little command line.

$ ioreg -w0 -l | grep Capacity
"CurrentCapacity" = 5259
"LegacyBatteryInfo" = {"Capacity"=5279,"Voltage"=12596,"Flags"=7,"Current"=5259,"Amperage"=267,"Cycle Count"=48}
"DesignCapacity" = 5500
"MaxCapacity" = 5279

MaxCapacity is the current capacity your battery can still hold on a full charge. DesignCapacity was the original capacity. So if the difference gets too big your battery is probably end of life and ready to be replaced. Most likely the related Cycle Count is high then as well.

It would actually be a neat little project to collect this information over time with RRDTool. If you are OK to shell out a few bucks there already is a software called ibat that seems to do this.

Update: There is also a freeware tool called coconutbattery that shows this information in a nice UI.

Cocoon Screencast

Unfortunately Cocoon has always had a marketing problem. Finally there is now a screencast available showing off the class reloading (done through jci). Wish it was using a better player and be with voice. But it’s a good start – we just should have done that ages ago. At that time it wasn’t all that well integrated but something similar I’ve already presented at the Cocoon GetTogether in 2005.

Apple’s iPhone NDA

I guess no one is really able to follow the rationale behind Apple’s iPhone NDA tactics. One thing is sure though: People are really getting annoyed! Not being able to talk and discuss iPhone code before the release of the SDK was already unpleasant – but people were OK with it. Now unpleasant has turned into frustration. While Apple always had this thing for secrecy – this is becoming ridiculous. The NDA is still in effect. Discussions e.g. on Cocoa mailing lists are still not allowed. The whole world should still stay quiet.

Scotty from macdevnet has started an online petition. Maybe if sensibly passed on to the right people… Not much – buch at least something we can do. Please sign!

What compression is this?

Dear lazyweb, I have come across a set of compressed data. I am trying to decompress it. It’s no inflate, it’s not bzip2 and it’s not gzip. Anyone recognizing what this could be?

000  2a 1f 8d 24 65 11 59 37  c8 47 91 a2 7d 5d 1d 5a  |*..$e.Y7ÈG.¢}].Z|
010  0d 1c 95 6b 7c 1b f9 f9  fa e0 56 8a 54 cd 0f ba  |...k|.ùùúà V.TÃ.º|
020  37 18 73 01 cc c5 20 23  63 9c 29 38 5d 50 3c fc  |7.s.ÌÅ #c.)8]P<ü|
030  9e 31 9b 49 5b 17 82 25  d5 91 a4 a9 62 40 10 ca  |.1.I[..%Õ.¤©b@.Ê|
040  54 4a 7c 7b 8a 07 95 71  2f 2d 22 bb 74 a2 e2 56  |TJ|{...q/-"»t¢âV|
050  f8 94 8d 62 a1 f7 6d 7c  a8 c2 78 1d f9 a6 04 16  |ø..b¡÷m|¨Âx.ù¦..|
060  f3 e3 08 7e 52 b9 90 57  aa 8c d4 e9 e6 ec cb 76  |óã.~R¹.Wª.ÔéæìËv|
070  24 4d d7 c2 2f 43 09 b1  09 12 68 cb b0 0e b9 b8  |$M×Â/C.±..hË°.¹¸|
080  5a 48 b3 b7 77 e3 5c 0b  ad cf 40 ce 00 b5 e4 62  |ZH³·wã\.-Ã@ÃŽ.µäb|
090  44 0e ad c4 ce bd 87 44  1e 15 40 0f 07 53 0f 0a  |D.-Äν[email protected]..|
...

Update: Turns out this is still deflate - but DES enrypted. Boy I so hate this proprietary limbo. A new release of uif2iso4mac is out that supports the new format.