|
<<"European Copyright far too short!" [Main Index] "Follow Nerve's Popularity!">>
Cool 'Where's Dave' Added to Site24 April 2003
Added a cool little feature over on the right sidebar - Tells you if I am currently at my computer or how long it has been since I have logged on if I'm not.
*Update* MSN's recent (September) update has killed this client :( Will have to look at getting it working again sometime.
It uses a java MSN client with a user which has only my everyday MSN id as a contact. It notes all my status changes and writes the current MSN status code to a file. The short java client code looks like this: import org.hn.sleek.jmml.*; import java.io.*; /* call this (with jmml.jar in your CLASSPATH) as follows: java SimpleMSNResponder mypassport@msn.com mypassword */ class WhereDave { public static void main (final String[] args) { final MessengerServerManager msn = MessengerServerManager.getInstance(); msn.addMessengerClientListener (new MessengerClientAdapter() { public void contactPropertyChanged (ContactChangeEvent e) { try { File outFile = new File("WhereDJG.txt"); int c; FileWriter out = new FileWriter(outFile); out.write(e.getNewValue().toString()); out.close(); } catch ( IOException IOE) { /* stuff */ } } }); /* msn.signIn (userName, password */ msn.signIn (args[0], args[1]); } }
I used the Linux program 'screen' to enable the java app to run in the backbround (eg/ without a console open) Then the Greymatter blog software that powers this site uses PHP to read in the file and output a message depending on the MSN status - Easy!
To get the status into GreyMatter, I made the GreyMatter index file an interpreted php file by renaming it index.php. Then I used a custom tag shown below to print the status:
$filename = '/home/djg/jmsn/WhereDJG.txt'; $status = file($filename); if ($status[0] == "FLN") { $p = "Last online "; $p = $p.date("H:i, d M", filemtime($filename)); } elseif ($status[0] == "NLN") { $p = "online"; } elseif ($status[0] == "LUN") { $p = "at lunch"; } elseif ($status[0] == "AWY") { $p = "away from his desk"; } elseif ($status[0] == "BSY") { $p = "busy"; } print("$p");
|
nav:
home
archives
photos
my other sites:
- New York Running
- ISOGA Heavy Metal Band!
- Vacations in France!
friends:
- simon's scene
- mark's musings
previously:
- More Like it
- Worst Webhost ever?
- Against Bottled Water
- Recovering Disk Space in Windows
- Sun Ray Deployment at IS195
- Running Route Database - Update
- Pics from Mike's Bike Trip
- Central Park Moonlight Cycle
- Kristin Plater's Next Show...
- Kristin Plater Plays the Alphabet Lounge
- Your Chance to Influence US Energy Policy!
- Practical NY Energy Tips - PCs
- Missing the Point
- Practical NY Energy Tips - Lighting
- Making the Switch to Firefox
- Belize to Gutemala and Back Again
- Diving in Cancun
- Today...
- Peru and Belize!
- PC Fix Up Tips
|