Saturday, March 24, 2007
iAlertU - Alarm System for your Apple MacBook Computer
When I saw the light saber fight video and tried the app I thought that it was cool, but sort of useless. The other day I stumbled upon the iAlertU application that uses the sudden motion sensor (SMS) to protect a Mac against thieves. Too bad that it is so easy to bypass it by using earphones :-/. But I have to admit that it is a creative idea and more useful than the mac saber.
doc.java.sun.com - Multilingual JavaDoc and Source Preview Site for JDK6
If you are a Java developer, the doc.java.sun.com site is worth checking out. I don't care so much for the translations part of the project, but what is great is that you have access to both JavaDocs as well as the source files of JDK6.
James Gosling announced the project in mid October and since then the site matured a lot!
James Gosling announced the project in mid October and since then the site matured a lot!
Tuesday, March 20, 2007
Apple 10.4.9 Software Update follow-up
Today, I got an email from Apple Tech Support:
It seems that they have noticed my activity on Apple support forums, where I was helping users to resolve the problem with the latest 10.4.9 software update, that I wrote about last week.
The good thing is that Apple is interested in knowing more about this issue - hopefully with the intention to prevent similar problems in the future.
The bad thing is the way they are doing it. How do I know that this email really comes from Apple? How can I be sure that it's not a Trojan horse mass mailed by some malicious person who's trying to misuse my willingness to help?
Attached to this email email is a binary application, that I'm supposed to run. I don't know if it's just me and my strong sense of self-preservation, but isn't it something like rule #1 in all "security for dummies" books not to run applications coming to your email from unauthenticated sources?
I think that Apple should have just send me an email pointing me to an apple.com website where I could download the application from or they should have signed the email and the attachment with a key which certificate was pre-distributed with MacOS X.
Besides, if all that Apple wants to do on my computer is to gather some data, they could have used a script that I could easily review instead of a binary application that can do a lot more than just "capture data".
I'm not pleased that my blog has turned into a Apple complaint site. I really hope that Leopard will bring enough excitement to have me forget about all of this.
UPDATE: I sent an email back to the Apple Tech Support asking them to publish the application on their website.
UPDATE2: An Apple engineer contacted me regarding the email. I ran the application and reviewed the content of generated dmg file. It contained all the system logs present on the computer and some extra files, like output from the
One think I really don't like is that I had to agree to this License Agreement that protects Apple, but I haven't seen a single sentence mentioning how Apple is going to protect my private information contained in the logs. :-/
Dear Apple Customer:
You've expressed an issue on Apple's Discussions forum with the recent Mac OS X 10.4.9 software update.
Apple would like to investigate the issue by collecting some data from your system.
If this is acceptable to you, please run the attached "Capture Data" application. Then, simply attach the file that's generated into a reply email (to this email) This file will contain logs, configuration information etc.
Thanks for your support in assisting Apple Inc.
It seems that they have noticed my activity on Apple support forums, where I was helping users to resolve the problem with the latest 10.4.9 software update, that I wrote about last week.
The good thing is that Apple is interested in knowing more about this issue - hopefully with the intention to prevent similar problems in the future.
The bad thing is the way they are doing it. How do I know that this email really comes from Apple? How can I be sure that it's not a Trojan horse mass mailed by some malicious person who's trying to misuse my willingness to help?
Attached to this email email is a binary application, that I'm supposed to run. I don't know if it's just me and my strong sense of self-preservation, but isn't it something like rule #1 in all "security for dummies" books not to run applications coming to your email from unauthenticated sources?
I think that Apple should have just send me an email pointing me to an apple.com website where I could download the application from or they should have signed the email and the attachment with a key which certificate was pre-distributed with MacOS X.
Besides, if all that Apple wants to do on my computer is to gather some data, they could have used a script that I could easily review instead of a binary application that can do a lot more than just "capture data".
I'm not pleased that my blog has turned into a Apple complaint site. I really hope that Leopard will bring enough excitement to have me forget about all of this.
UPDATE: I sent an email back to the Apple Tech Support asking them to publish the application on their website.
UPDATE2: An Apple engineer contacted me regarding the email. I ran the application and reviewed the content of generated dmg file. It contained all the system logs present on the computer and some extra files, like output from the
top
and ps
commands.One think I really don't like is that I had to agree to this License Agreement that protects Apple, but I haven't seen a single sentence mentioning how Apple is going to protect my private information contained in the logs. :-/
End of the MacBook Problem Saga?
Back in November I wrote an entry about all the problems I had with a MacBook, that I bought for my sister and how I returned four MacBooks before I finally got a fifth that actually worked (see "A Basket of Rotten Apples").
After posting the entry I though that my troubles were over, but had no idea how wrong I was. Only one week later the battery on that MacBook died.
There were no signs of problems before, the battery performance was good and it was already formatted according to Apple's instructions. MacOS X failed to recognize the battery and the charger would not detect it either. It look as if there was no battery in that notebook. There was just a battery crossed with an X and text "No batteries available" in the menu.
Since at that time, I was already in Slovakia (my home country), I was happy to find out that the 1 year complementary Apple Care warranty program had worldwide coverage. After browsing a little I found out that it usually takes no time to get the battery replaced. With all this information I called the closest Apple dealer and explained to him my situation. I got an estimate 4-6 weeks!!!
It seems that Apple has no direct representation in Slovakia and thus all the service parts as well as regular orders are being handled via a Slovak company that is somehow connected with Apple in some other EU country. The whole thing is very confusing, nontransparent and worst of all causes enormous delays in orders and repairs. The Apple dealers in Slovakia are pretty unhappy about this whole situation, but as one of them told me, there is nothing they can do about this.
So I waited and waited and finally on the last day of January (about 6 weeks later) I got an email from the dealer that he finally got my replacement battery. So I borrowed my sisters notebook and went to visit the dealer. New battery worked fine, but during this repair I noticed yet another problem - the infamous MacBook Discoloration!
The dealer was kind enough to order a new keyboard cover immediately, but he wasn't able to give me estimate on this repair.
Only one week later, my sister called me and told me that the second battery had just died - in a same mysterious way as the one before. So besides the keyboard cover, yet another battery replacement was on my repair list.
According to discussion on this blog, there is a bunch of people who had two or more batteries replaced, one after another due to the same issue. Apple claimed that that this was not a notebook, but rather battery related issue.
Another month went by and I finally got my sisters notebook fixed. It has been more than two weeks now and the battery is still working and there haven't been any new issues so far. I don't want to be premature, but I hope that this is it - end of the saga!
All the problems are fixed now but I still feel ashamed for all the trouble I had with a notebook that was supposed to be great.
After posting the entry I though that my troubles were over, but had no idea how wrong I was. Only one week later the battery on that MacBook died.
There were no signs of problems before, the battery performance was good and it was already formatted according to Apple's instructions. MacOS X failed to recognize the battery and the charger would not detect it either. It look as if there was no battery in that notebook. There was just a battery crossed with an X and text "No batteries available" in the menu.
Since at that time, I was already in Slovakia (my home country), I was happy to find out that the 1 year complementary Apple Care warranty program had worldwide coverage. After browsing a little I found out that it usually takes no time to get the battery replaced. With all this information I called the closest Apple dealer and explained to him my situation. I got an estimate 4-6 weeks!!!
It seems that Apple has no direct representation in Slovakia and thus all the service parts as well as regular orders are being handled via a Slovak company that is somehow connected with Apple in some other EU country. The whole thing is very confusing, nontransparent and worst of all causes enormous delays in orders and repairs. The Apple dealers in Slovakia are pretty unhappy about this whole situation, but as one of them told me, there is nothing they can do about this.
So I waited and waited and finally on the last day of January (about 6 weeks later) I got an email from the dealer that he finally got my replacement battery. So I borrowed my sisters notebook and went to visit the dealer. New battery worked fine, but during this repair I noticed yet another problem - the infamous MacBook Discoloration!
The dealer was kind enough to order a new keyboard cover immediately, but he wasn't able to give me estimate on this repair.
Only one week later, my sister called me and told me that the second battery had just died - in a same mysterious way as the one before. So besides the keyboard cover, yet another battery replacement was on my repair list.
According to discussion on this blog, there is a bunch of people who had two or more batteries replaced, one after another due to the same issue. Apple claimed that that this was not a notebook, but rather battery related issue.
Another month went by and I finally got my sisters notebook fixed. It has been more than two weeks now and the battery is still working and there haven't been any new issues so far. I don't want to be premature, but I hope that this is it - end of the saga!
All the problems are fixed now but I still feel ashamed for all the trouble I had with a notebook that was supposed to be great.
Thursday, March 15, 2007
500GB eSATA External Storage with Throughput Upto 67MB/s
I was suffering from full-hard-drive disease for a couple of months. So last week I finally ordered an external drive to hold the piles of data I store on my MacBook Pro. This is what I got:
The Seagate 7200.10 hard drive is a hard drive, there is not too much to say about it, except for the usual complaint that 500GB ain't 500GB of free space, you get 465.8GB with this baby.
The Vantec enclosure looks really good and has a very good feel to it. It feels much better than any other enclosure I put my hands on. Very sturdy, slim, well designed and well assembled. Thanks to the fact that it's aluminum based it keeps the hard drive REALLY cool - during heavy use it is just a bit warmer than my hand.
I picked the Vydeo/Meritline eSATA card based on the "feature set /price" ratio and didn't really know what to expect because there is not as much written about it on the Internet as I'd like. Luckily there were no surprises so far.
The card is based on SiI3132 chipset and the driver supplied with the card is an unmodified Silicon Image driver (version 1.1.5). When I tried to install it however, it didn't work. But the one I got from Silicon Image support site worked fine (version 1.1.9). I had to restart my MBP to get MacOS X to recognize it though.
An interesting thing that I noticed is that when I copy stuff from the external drive to my internal drive (not the other way around), my computer gets sluggish. Particularly, all the operations that needed to access the internal drive became almost unusable because of slow responsiveness. I'm not sure if it's the internal drive getting overloaded with all the traffic, or something else, but it happens only in this one scenario (using loading data from the external drive to memory causes no problems).
The only other complaint I have about the card is that it is relatively easy to accidentally unplug. It is safe enough to use on a desk, but I don't even want to think about the data corruption caused by an accidental unplugging while using the computer on my lap.
I ran a few very unscientific benchmarks to see what to expect from my new toys. Here are the results.
- Hard drive: Seagate Barracuda 7200.10 SATA 3.0Gb/s 500-GB Hard Drive (16-MB cache buffer) - ST3500630AS
- Enclosure: Vantec NEXSTAR3 NST-360SU-BK
- eSATA Express Card 34: Vydeo eSATA 34: Dual Port 34mm Express Card
The Seagate 7200.10 hard drive is a hard drive, there is not too much to say about it, except for the usual complaint that 500GB ain't 500GB of free space, you get 465.8GB with this baby.
The Vantec enclosure looks really good and has a very good feel to it. It feels much better than any other enclosure I put my hands on. Very sturdy, slim, well designed and well assembled. Thanks to the fact that it's aluminum based it keeps the hard drive REALLY cool - during heavy use it is just a bit warmer than my hand.
I picked the Vydeo/Meritline eSATA card based on the "feature set /price" ratio and didn't really know what to expect because there is not as much written about it on the Internet as I'd like. Luckily there were no surprises so far.
The card is based on SiI3132 chipset and the driver supplied with the card is an unmodified Silicon Image driver (version 1.1.5). When I tried to install it however, it didn't work. But the one I got from Silicon Image support site worked fine (version 1.1.9). I had to restart my MBP to get MacOS X to recognize it though.
An interesting thing that I noticed is that when I copy stuff from the external drive to my internal drive (not the other way around), my computer gets sluggish. Particularly, all the operations that needed to access the internal drive became almost unusable because of slow responsiveness. I'm not sure if it's the internal drive getting overloaded with all the traffic, or something else, but it happens only in this one scenario (using loading data from the external drive to memory causes no problems).
The only other complaint I have about the card is that it is relatively easy to accidentally unplug. It is safe enough to use on a desk, but I don't even want to think about the data corruption caused by an accidental unplugging while using the computer on my lap.
I ran a few very unscientific benchmarks to see what to expect from my new toys. Here are the results.
- Copying my 13.22GB of mp3 files from the internal drive to the external drive:
time cp -r ~/Music /Volumes/ExternalHDD/BackUp/
8m29.645s = 26.5MB/s
(Keep in mind that the internal drive is the bottleneck in this test, not the eSATA drive)
I ran this test while in USB2.0 mode (the enclosure supports both eSATA and USB2.0) and the results were:
16m8s = 14MB/s
That makes the eSATA configuration 1.89x faster than the USB2.0 one. - Copying 13.22GB of mp3 files from one folder on the internal drive to another one:
time cp -r /Volumes/ExternalHDD/BackUp/Music/ /Volumes/ExternalHDD/
7m1.298s = 32.2MB/s
Considering that the files had to be read and then written to the drive, the number can be doubled to get the combined throughput. This makes it 64.4MB/s - Creating a 10GB file using mkfile command and storing it on the external drive:
time mkfile 10g /Volumes/ExternalHDD/10GB.file
2m37.377s = 65.2MB/s - Creating a 5GB dmg image file using Disk Utility and storing it on the external drive:
1m17s = 66.5MB/s - Encrypting a 5GB file stored on the external drive using openssl and storing the encrypted file on the external drive:
time openssl enc -in /Volumes/ExternalHDD/5GB.file \
3m24.313s = 25.1MB/s
-out /Volumes/ExternalHDD/5GB-encrypted.file -e -aes-128-cbc
Again, since I'm reading and storing the file on the same drive, the combined throughput is the double: 50.2MB/s.
Since this is a test that is very close to the real world usage, I ran it with the disk connected via USB2.0. The results were:
8m27.985s = 10.1MB/s or 20.2MB/s combined
That makes the eSATA configuration 2.49x faster than the USB2.0 one. - Copying a 5GB file from the external drive to the internal drive:
time cp /Volumes/ExternalHDD/5GB-encrypted.file .
2m39.271s = 32.3MB/s - Copying a 5GB file from the external drive to the internal drive and at same time copying another 5GB file from the internal drive to the external drive:
time cp 5GB-encrypted.file /Volumes/ExternalHDD/5GB-encrypted2.file&
5m46.592s = 29.6MB/s (counting with 10GB of data being transferred )
time cp /Volumes/ExternalHDD/5GB-encrypted.file .
Again the internal drive is the bottleneck in this test.
Wednesday, March 14, 2007
MacOS X 10.4.9 Update Killed My Mac!
The same problem can occur with update 10.4.10 and 10.4.11 and the same instructions can be used to resolve it. See Update9 below.
Today I tried to install the 10.4.9 update for MacOS X that Apple has just released. Unfortunately something went wrong when installing the update and I got an error message saying that the installation was unsuccessful and the installer was moved to the Trash. After that I was prompted to restart, because of other updates.
So I restarted my MacBook Pro and let it run for some time. When I came back a bit later (at least 10minutes after the restart), I found the computer stuck at the blue screen, that appears just before the login screen comes up.
In hopes that another restart will fix everything I powered off the notebook and started it again. This time it got stuck on the gray screen with the Apple logo and a wheel spinning forever:
I tried the verbose mode:
As well as single user mode:
But both of them were unusable with this an error message appearing on the screen:
It seems that I'm not the only one who's having this problem. I wonder what is triggering this and why only certain users are experiencing these difficulties.
UPDATE: It seems that Apple doesn't like any discussion on this topic as two threads (1st, 2nd) on Apple forums discussing these issues were deleted/blocked by forum administrators. Come on Apple, that's lame!
UPDATE2: Some users claim that this issue is caused by messed up disk permissions. It is not a bad idea to repair your disk permissions before (and after) installing an update. I wonder why this procedure is not executed automatically before the system update.
UPDATE3: Many people are having problems with all the backslashes and forwardslashes in the commands, so I got rid of most of them by putting paths into quotes. I hope this will make it easier for people not used to working in the Terminal window.
UPDATE4: Apple has contacted me regarding this issue.
UPDATE 5: A friend of mine pointed me to this blog entry that provides a possible explanation to the software update issues.
UPDATE 6: Some users pointed out that you can fix a broken Mac by starting the computer in the target mode (requires second healthy Mac), running the update and selecting the broken Mac as the installation destination - this bypasses working with the terminal, which some users found difficult.
UPDATE 7: According to experience of some users, PowerPC Macs can't read usb drives formated as FAT. That complicates the recovery process quite a bit :-/
UPDATE 8: I put together a small shell script that runs all the command for you - no more pain for "average" users who don't live on the command line. Download the script, read the instructions in it, run it and provide feedback.
UPDATE 9:This issue happened to at least one user during upgrade to 10.4.10 (see comments for this blog entry). The same instructions resolved the issue - just replace MacOSXUpdCombo10.4.9Intel.dmg with MacOSXUpdCombo10.4.10Intel.dmg.
Today I tried to install the 10.4.9 update for MacOS X that Apple has just released. Unfortunately something went wrong when installing the update and I got an error message saying that the installation was unsuccessful and the installer was moved to the Trash. After that I was prompted to restart, because of other updates.
So I restarted my MacBook Pro and let it run for some time. When I came back a bit later (at least 10minutes after the restart), I found the computer stuck at the blue screen, that appears just before the login screen comes up.
In hopes that another restart will fix everything I powered off the notebook and started it again. This time it got stuck on the gray screen with the Apple logo and a wheel spinning forever:
I tried the verbose mode:
As well as single user mode:
But both of them were unusable with this an error message appearing on the screen:
Load of /sbin/launchd, errno 88, trying /sbin/mach_init Load of /sbin/launchd failed, errno 88Fortunately I managed to fix this and this is the way to do it, just in case more of you get stuck with this issue:
- Use another computer (or a live CD/DVD OS) to download the Mac OS X 10.4.9 Combo Update from the Apple website: Intel, PPC
- Put the update on a USB key
- Boot from Mac OS X Installation Disc (put the disc in, restart and hold c key)
- When the installer starts, run Disk Utility and repair disk permissions
- Open a Terminal and copy the update from the USB key to your computer's hard drive
cp "/Volumes/YOUR_USB_KEY/MacOSXUpdCombo10.4.9Intel.dmg" \ "/Volumes/YOUR_HDD/"
- Mount the dmg file
hdiutil attach \ "/Volumes/YOUR_HDD/MacOSXUpdCombo10.4.9Intel.dmg"
- Run the update (for less experienced: the command has 4 lines, hit enter at the each line!). A GUI installer will start if the command was entered properly.
"/Volumes/YOUR_HDD/usr/bin/open" \ /Applications/Utilities/Installer.app \ "/Volumes/Mac OS X 10.4.9 Combined Update (Intel)/\ MacOSXUpdCombo10.4.9Intel.pkg"
- Restart your computer when prompted
- Delete the dmg file
It seems that I'm not the only one who's having this problem. I wonder what is triggering this and why only certain users are experiencing these difficulties.
UPDATE: It seems that Apple doesn't like any discussion on this topic as two threads (1st, 2nd) on Apple forums discussing these issues were deleted/blocked by forum administrators. Come on Apple, that's lame!
UPDATE2: Some users claim that this issue is caused by messed up disk permissions. It is not a bad idea to repair your disk permissions before (and after) installing an update. I wonder why this procedure is not executed automatically before the system update.
UPDATE3: Many people are having problems with all the backslashes and forwardslashes in the commands, so I got rid of most of them by putting paths into quotes. I hope this will make it easier for people not used to working in the Terminal window.
UPDATE4: Apple has contacted me regarding this issue.
UPDATE 5: A friend of mine pointed me to this blog entry that provides a possible explanation to the software update issues.
UPDATE 6: Some users pointed out that you can fix a broken Mac by starting the computer in the target mode (requires second healthy Mac), running the update and selecting the broken Mac as the installation destination - this bypasses working with the terminal, which some users found difficult.
UPDATE 7: According to experience of some users, PowerPC Macs can't read usb drives formated as FAT. That complicates the recovery process quite a bit :-/
UPDATE 8: I put together a small shell script that runs all the command for you - no more pain for "average" users who don't live on the command line. Download the script, read the instructions in it, run it and provide feedback.
UPDATE 9:This issue happened to at least one user during upgrade to 10.4.10 (see comments for this blog entry). The same instructions resolved the issue - just replace MacOSXUpdCombo10.4.9Intel.dmg with MacOSXUpdCombo10.4.10Intel.dmg.
Monday, March 12, 2007
March 24, 2007 - Shutdow DayShutdown Day 2007
This is a great video of alternative uses of notebooks :). Will your computer be shut down on March 24?
Wednesday, March 07, 2007
Cloning a CD/DVD Disc on MacOS Using a Console
MacOS has a handful of good command line tools for working with discs, images and burning devices. Unfortunately direct support for disc cloning is missing.
I wrote a little shell script that makes it very easy to create a 1:1 copy of CD/DVD discs.
The script discoveres the name your DVD drive $DEVICE_NAME at runtime, e.g. disk1 for (/dev/disk1). This requires that the disc is present in the drive before you start the script.
Note: This script won't copy DRM protected discs (DVD movies, protected Audio CDs) :-(
Btw I didn't know what was the correct usage of the words "disk" and "disc", this article from apple makes it clear.
Update(07-03-24): I found a bug in my scripts that I fixed and I changed the scripts so that the DEVICE_NAME is discovered at run time.
I wrote a little shell script that makes it very easy to create a 1:1 copy of CD/DVD discs.
#!/bin/sh DEVICE_NAME=`drutil status | grep dev | cut -d / -f 3` diskutil unmountDisk $DEVICE_NAME watch ls -lh /tmp/disk2burn.iso& WATCH_PID=$! dd if=/dev/$DEVICE_NAME of=/tmp/disk2burn.iso kill $WATCH_PID hdiutil burn /tmp/disk2burn.iso if test $? -eq 0; then rm -r /tmp/disk2burn.iso echo 'DONE!!!' fiThis script uses
watch
command to display the progress of the dd
command that creates an iso dump of the original media. You can get the watch
from darwinports/macports. If you don't care about the progress of creating the iso dump, you can just use:#!/bin/sh DEVICE_NAME=`drutil status | grep dev | cut -d / -f 3` diskutil unmountDisk $DEVICE_NAME dd if=/dev/$DEVICE_NAME of=/tmp/disk2burn.iso hdiutil burn /tmp/disk2burn.iso if test $? -eq 0; then rm -r /tmp/disk2burn.iso echo 'DONE!!!' fi
The script discoveres the name your DVD drive $DEVICE_NAME at runtime, e.g. disk1 for (/dev/disk1). This requires that the disc is present in the drive before you start the script.
Note: This script won't copy DRM protected discs (DVD movies, protected Audio CDs) :-(
Btw I didn't know what was the correct usage of the words "disk" and "disc", this article from apple makes it clear.
Update(07-03-24): I found a bug in my scripts that I fixed and I changed the scripts so that the DEVICE_NAME is discovered at run time.
Sunday, March 04, 2007
One More Way How to Get the Current PID in Java
Yesterday I wrote a post about getting the current PID in Java.
I knew that there had to be at least one more way to do this because I read about using perl and the Runtime.exec() method to get the PID. But I didn't like the perl part of the hack so I didn't mention it in my post.
Today after some time playing with bash and an annoying behavior of
Why not to pass the command as one string? Because of problems with quotes described in this bug report.
As I mentioned before even this approach is not perfect, because it depends on *nix and bash, but it is an improvement compared to depending on perl :)
I knew that there had to be at least one more way to do this because I read about using perl and the Runtime.exec() method to get the PID. But I didn't like the perl part of the hack so I didn't mention it in my post.
Today after some time playing with bash and an annoying behavior of
Runtime.exec(String)
method I came up with a 5th approach of retrieving the current PID. This approach uses $PPID
and Runtime.exec(String[])
:
import java.io.IOException; public class Pid { public static void main(String[] args) throws IOException { byte[] bo = new byte[100]; String[] cmd = {"bash", "-c", "echo $PPID"}; Process p = Runtime.getRuntime().exec(cmd); p.getInputStream().read(bo); System.out.println(new String(bo)); } }The code is pretty straight forward. Get Runtime object, call exec(String[]) method pass it
bash -c "echo $PPID"
(after splitting it into a String array) and read the output.Why not to pass the command as one string? Because of problems with quotes described in this bug report.
As I mentioned before even this approach is not perfect, because it depends on *nix and bash, but it is an improvement compared to depending on perl :)
Private Wiki Dilemma
I've been using GTDTiddlyWiki as my private offline wiki for over a year now and I was pretty happy with it for a long time.
At the time when I picked GTDTiddlyWiki as my private wiki I didn't realize how much and how often I would use it. It's about that time when my needs have outgrown what GTDTiddlyWiki has to offer, so I'm looking around for something with a few more features and ongoing development.
I like the idea of a client-side wiki as a private wiki, and TiddlyWiki and all its flavors seems to dominate this area. I was considering switching to TiddlyWiki, but I found a very interesting feature called TagglyTagging of MonkeyPirateTiddlyWiki (yet another TiddlyWiki flavor). I though that content tagging couldn't get any better, but it seems that I was wrong. :)
I'll give MonkeyPirateTiddlyWiki a shot!
BTW tiddlyspot is hosting TiddlyWiki, MonkeyPirateTiddlyWiki and a few other TiddlyWiki flavors. By using their service you can easily upload your wiki to their servers and make it available to the public (or password protect it). Pretty neat, but after being among security geeks at Sun for some time I'm hesitant to use this cool feature. :-/
Am I getting paranoid enough Martin? ;-)
At the time when I picked GTDTiddlyWiki as my private wiki I didn't realize how much and how often I would use it. It's about that time when my needs have outgrown what GTDTiddlyWiki has to offer, so I'm looking around for something with a few more features and ongoing development.
I like the idea of a client-side wiki as a private wiki, and TiddlyWiki and all its flavors seems to dominate this area. I was considering switching to TiddlyWiki, but I found a very interesting feature called TagglyTagging of MonkeyPirateTiddlyWiki (yet another TiddlyWiki flavor). I though that content tagging couldn't get any better, but it seems that I was wrong. :)
I'll give MonkeyPirateTiddlyWiki a shot!
BTW tiddlyspot is hosting TiddlyWiki, MonkeyPirateTiddlyWiki and a few other TiddlyWiki flavors. By using their service you can easily upload your wiki to their servers and make it available to the public (or password protect it). Pretty neat, but after being among security geeks at Sun for some time I'm hesitant to use this cool feature. :-/
Am I getting paranoid enough Martin? ;-)
Saturday, March 03, 2007
How a Java Application Can Discover its Process ID (PID)
Occasionally it is important for an application to know its PID, specially if this application cooperates with other non-java applications. Currently there is no direct support for retrieving an application's process id by using standard Java api (this might change in the future if RFEs like 4250622, 4244896 or 4890847 are resolved).
I found five ways how to get the PID from my Java code:
I know that one of Sun's main priorities for Java is cross-platform compatibility, but I have to agree with the comments on the RFEs above which support the addition of a getPid() method to JDK. I especially like this one:
UPDATE (06-03-05): added 5th approach
I found five ways how to get the PID from my Java code:
- Using the java management and monitoring API (java.lang.management):
ManagementFactory.getRuntimeMXBean().getName();
returns something like:28906@localhost
where 28906 is the PID of JVM's process, which is in fact the PID of my app.
This hack is JVM dependent and I tested it only with Sun's JVM.
From Javadocs for getName() method of RuntimeMXBean:Returns the name representing the running Java virtual machine. The returned name string can be any arbitrary string and a Java virtual machine implementation can choose to embed platform-specific useful information in the returned name string. Each running virtual machine could have a different name.
So even though this approach is the most comfortable one, your app can break if the implementation of this method changes. - Using shell script in addition to Java properties
Start your app with a shellscript like this:
exec java -Dpid=$$ -jar /Applications/bsh-2.0b4.jar
then in java code call:System.getProperty("pid");
- Using shell script's $! facility as described on this blog - this approach is fine if all you want is to create a pid file.
- Using Java Native Interface (JNI) - a very cumbersome and platform dependent solution.
- Using
$PPID
andRuntime.exec(String[])
method - described in detail in this postimport java.io.IOException; public class Pid { public static void main(String[] args) throws IOException { byte[] bo = new byte[100]; String[] cmd = {"bash", "-c", "echo $PPID"}; Process p = Runtime.getRuntime().exec(cmd); p.getInputStream().read(bo); System.out.println(new String(bo)); } }
I know that one of Sun's main priorities for Java is cross-platform compatibility, but I have to agree with the comments on the RFEs above which support the addition of a getPid() method to JDK. I especially like this one:
Come on Sun, this started 4.5 years ago. Give us thePosted by Rarb@GB on 05-MAR-2004
PID. We need it. We want it. We demand it.
And another thing ... you will save a lot of developers a
lot of time currently spent searching through the
documentation trying to find a getPID method that isn't
there!
UPDATE (06-03-05): added 5th approach
Friday, March 02, 2007
Yeah, I got tagged as well
Someone somewhere far far in the internet galaxy started this “viral” chain letter-ish tagging game . The game spread across the blogsphere like a flood and no banks were left dry. Some of my colleagues were more than happy to spread it by picking 5 more victims for this game and so I got tagged twice. At first my boss Rama tagged me, followed by a friend and ex-team mate Martin.
So here are 5 things you probably didn't know about me:
So here are 5 things you probably didn't know about me:
- I used to be an MS user, living with Windows OS every day, but fortunately my salvation came almost two years ago when I joined Sun. Ever since then I had no need to fix crashing computers :)
- I shook hands with Arnold Schwarzenegger. Being a European and actually a neighbor of Austria this is a big deal! It's good to know that foreigners in California can be so successful.
- I'm a performance junkie. I love to play with profilers, tweaking the code and trying different strategies to squeeze as much performance as possible from apps that deal with a lot of data.
- I'm a Slovak, not Slovakian, not Slovenian or Slovene, not Czech. And I'm proud to be one.
- I hate chain letter games of any form. Most of the chain letters games are just scams or a waste of time. So besides me being busy, this is one of the reasons for this post coming with such a delay.
Thursday, March 01, 2007
Busy as a bee
I'm sitting in a train on my way back from Vienna to Bratislava and I decided that it's about time to finally post something on to my blog (to prove that I'm still alive). So I am alive, just very busy with my personal life as well as projects like zoom23.com and another one that I don't dare to name yet :).
Subscribe to:
Posts (Atom)