Archive for May, 2008

Status Screen Saver

I just finished and released a new product that I am excited to present to everyone. For the longest time, I wanted to be able to show the status of some of my applications while my computer was running the screen saver, so that I could tell from across the room wether I had new emails or news items. As a result, I created Status Screen Saver. Basically, it shows the current status of a few applications in the status bar at the bottom of the screen and any other screen saver above it.

The best part about the implementation is that I made it very easy to add what I call modules. If you would like to see some other application in the status bar, it’s extremely easy to add it to Status Screen Saver, as long as that application works with AppleScript. All that is required is a .bundle file that contains an application icon and a AppleScript that returns a numeric value. I added three applications, (Mail, NetNewsWire and Twitterrific) that I use on a regular basis, but I’m hoping that other users will create modules for their favorite apps and Status Screen Saver can eventually come with a ton of bundles installed.

Anyway, you can download the new product at http://www.loganrockmore.com/StatusScreenSaver/. I hope that everyone else finds it as useful as I do.



A Better NSLog

I looked a bit today at improving the way I use NSLog() and wanted to share my findings here. Recently, I’ve had to use logging as a method of debugging while writing a screen saver, which has been unfortunate. However, I’ve been able to improve it using a #define in my code, inspired by the following sites:

  • The Big Bucket Blog just recently published a blog post which makes available a few custom BBTrace functions. These functions were a great starting point, but I wanted something more compact and that didn’t require adding extra files to my projects.
  • In the comments of the same blog post, Gus Mueller discusses his solution: a simpler #define within an ifdef block that removes logging in Release builds. This is great, but I don’t really need to worry about logging showing up in public builds since I tend to remove all of my logging before committing code to my VCS. Also, I didn’t want to have to add any flags in the target settings of my projects.
  • The Lap Cap Software Blog discusses logging in Leopard, with the goal of removing the log messages from the Console. Again, this isn’t important to me, but the interesting use of arguments to his JJLog() function are what helped me. Also, the idea of adding this code to the .pch file in any project was exactly what I was looking for.

So, after looking at these different options and deciding what information I’m looking for, I came up with the following directive:

#define LRDebug(...) NSLog(@"%s (%d) \n\t %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__])

With this, I’m able to send LRDebug() arguments exactly as NSLog() handles them, using a formatted string. Also, I tried to get the most readable logging I could, so I added the line break and tab after the function and line number. So, some code could call LRDebug(@"The path is: %@", path) and the log would read:

-[Controller awakeFromNib:] (23)
    The path is: /Applications/Mail.app

Perfect!



Mail Unread Menu 3.1

NNW Unread Menu iconI just released version 3.1 of Mail Unread Menu, which includes a few improvements and bug fixes to the Mail utility. In my opinion, one of the largest improvements is a change in the way that the menu is shown, so that we’re back to the NSStatusItem standard of having sharp corners at the top of the menu. I at least know that Shaun Inman will be happy with this change and that’s good enough for me.

Download version 3.1 or run “Check For Updates…” from the application’s menu.

  • New Features
    • Separated unread counts from mailboxes which are shared between accounts.
  • Changes
    • Simplified the way the menu is generated.
  • Fixes
    • Fixed an issue with a slow down when only getting count from Inbox.
    • Fixed small delay when running scripts.
    • Fixed issue if a custom icon could not be found.
    • Fixed an issue with the count showing 0 when sending an email.

[Update]: In the comments, Trevor Cortez pointed out a small bug with the newly released version 3.1. As a result, I released a version 3.1.1 which fixes this bug and also makes one small interface change.




:: RSS Feed :: Archive :: Categories :: Admin