Archive for 2007

Updated RIAA Radar Greasemonkey Script

Some time ago I came across the RIAA Radar site, which uses Amazon’s E-Commerce Web Service to cross-reference the labels musical albums are published under with known RIAA members. The idea is that you can use the service to help restrict your music purchases to labels that do not affiliate themselves with the RIAA, and by extension the RIAA’s strongarm tactics against music fans. I liked the idea but didn’t want to have to visit the site every time I looked at an album. Fortunately the site had a Greasemonkey script called RIAA Radar that would automatically insert a little icon on the Amazon detail page indicating whether it was from an RIAA label or not. Unfortunately, the script was broken. I went ahead and fixed up the script, as well as optimizing it and expanding its functionality. Since the site’s maintainer never accepted the revised version, so I’ve been maintaining a fork ever since.

RIAA Radar Greasemonkey Script example

Anyway, with the launch of Amazon’s new MP3 Downloads store, I figured I could get RIAA Radar working with that too. It turned out to be pretty easy, and I was able to fix a bad URL in the script while I was at it. So the script should serve music fans even better as they browse the DRM-free music available at Amazon.

TopProcess Sidebar Gadget - Now with memory usage display

I didn’t think I had anything more to do with my TopProcess Windows Vista Sidebar Gadget after its minor update a couple months ago. However, I got a suggestion emailed to me from a TopProcess user that was easy to implement and adds a lot to the gadget. So, TopProcess now allows you to choose between measuring the top consumers of CPU, and the top consumers of RAM. So all you need to do is add two copies of the gadget to your sidebar, and set one to track memory and one to track CPU. Check it out (Firefox users will not be surprised that it always sits at the top):

In CPU mode it displays percentages, and in RAM mode it displays absolute memory footprint values. Remember that some apps (like .NET or Java apps) look like they’re taking a lot of memory, but will give it back when you get low on RAM, so it’s not a worry if they gobble up some extra RAM when you’ve got it. Of course, for most native apps (like Firefox or Photoshop), the value displayed in TopProcess represents a less flexible chunk of resources.

A couple of bugs and less-than-desirable behaviors have been fixed, too. Whenever you change settings the changes will be reflected in the gadget immediately, and turning text fade off and then on again won’t cause text to overlap in a big mess. Also, some of the comments on the Windows Live Gallery page for TopProcess suggest that people have been seeing performance problems with the gadget. I haven’t actually seen any problems myself, but I went through the code and tightened it up a bit here and there - hopefully it’ll work better for those people.

So pick up the new version, rate it on Windows Live Gallery, and enjoy the new functionality.

PS: I was holding this back until my friend could come through with the Russian and Japanese translations, but he’s just too busy and I had to fall back to Google Translate. I apologize if the translations are awful. If you would like to help fix them, or to translate TopProcess into your favorite language, please contact me.

Eclipse NoClassDefFoundError near installFont on startup

At work and at home I use Eclipse as my IDE of choice for Java development, along with Eclipse-in-disguise Aptana for web development. I’ve never had a problem with Eclipse on Windows or on my Mac, but on my Linux machine (and many of my co-workers’ machines) Eclipse tends to crash rather violently. I suspect that it isn’t Eclipse at all, but the primitive P4WSAD Perforce plugin. I don’t use Perforce at home, so that might be the difference. Anyway, what happens is that in the middle of doing something Eclipse will run out of PermGen memory, throw up some errors, and die in the least pleasant way possible. When you try to start it back up, you get something like this:

 !SUBENTRY 1 org.eclipse.team.core 4 0 2007-08-20 16:58:25.979
 !MESSAGE Could not instantiate provider com.perforce.team.core.PerforceTeamProvider for project SampleProject.
 Exception in thread "Thread-1" java.lang.NoClassDefFoundError
         at org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(ThemeElementHelper.java:101)
         at org.eclipse.ui.internal.themes.ThemeElementHelper.populateRegistry(ThemeElementHelper.java:57)
         at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1426)
         at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
         at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
         at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
         at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3296)
         at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2974)
         at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
         at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
         at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
         at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
         at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
         at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
         at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
         at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
         at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
         at org.eclipse.equinox.launcher.Main.run(Main.java:1169)

Further digging reveals that the culprit is definitely the Perforce plugin. To fix it, you need to go to where Eclipse is installed, and move the plugins/com.perforce.* files away. Then start Eclipse, which will start but complain about the missing plugin. Then shut down Eclipse, move the plugins back, and start up again. You’ll need to reconfigure any Perforce windows you had open, but at least Eclipse will start.

This seems to be caused by Eclipse crashing after running out of PermGen memory. To prevent future crashes, edit eclipse.ini in your Eclipse install directory. It should look something like this:

-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx512m
 -XX:MaxPermSize=256m
-Dosgi.bundlefile.limit=100

The -XX:MaxPermSize is especially important for preventing Eclipse crashes. The other option, –launcher.XXMaxPermSize only works in Windows.

WebLinkLabel Windows Forms Control

While I was updating my PopupNotify control today, I realized that I had created another useful little control for XBList that I hadn’t released, the WebLinkLabel Control. This simple control wraps the standard LinkLabel control to make it easier to embed multiple hyperlinks in a label, each of which will load up a URL in the user’s default browser when clicked. It’s not the most complex thing in the world, but it has proven useful for inserting help links into XBList’s error dialogs, so I suspect it might be of some utility to others. Using it is about as simple as using a standard Label. Just drag the WebLinkLabel onto your form, customize it however you like, then assign a specially-formatted string to the Text property. You use “url” tags to specify where you want links, like this: “Hello, this is text <url=https://benhollis.net>with a link in it</url>.” You can of course have as many links, pointing to as many different URLs, as you would like. If you want to get that formatted string back out, use the LinkText property, or if you want to get a flattened view out (“Hello, this is text with a link in it.”), use the Text property.

This code is licensed under the LGPL, like the other XBList bits I’ve released. As usual, I would appreciate it if whoever uses this code would email me to let me know how they’re using it, just for my own amusement. You can download the control right here.

New Version of the PopupNotify Windows Forms Control

A couple years back I posted the source of XBList‘s tray notification control on my site as the PopupNotify control. I licensed it under the LGPL so people could use it for their own applications. While I requested that whoever used it should let me know, I’ve never received any email about it until this week, when somebody wrote to tell me that they had been using it but it didn’t work on Vista, and they wanted some help getting it to work. Despite the fact that I would rather they had told me about this beforehand, I’ve taken this as an opportunity to update the component. I just pulled out the current version of the control that I’m using for XBList, which has a much prettier Vista-style look, less P/Invoke calls, and other .NET 2.0 improvements. I’ve left the 1.1 version of the control around for anyone who wants to use it but hasn’t updated to .NET 2.0 yet.

The new, Vista-style popup

Hopefully this component will continue to be useful to other developers, and they’ll let me know if they’re using it in their projects, since it’s just so much more fun to release stuff for free when you get to see it in action.

Collapsible Amazon Greasemonkey Script Update

I’ve taken another crack at my Collapsible Amazon Greasemonkey script, and I think it’s pretty complete now. Once you’ve installed the script, you’ll be able to click on the orange title of any section of an Amazon product detail page to collapse it out of sight, and the script will remember your preference for other pages. So you can customize your product page however you like, and it’ll stay that way. This new version makes it possible to collapse any of the orange-titled sections in the page (in older versions, a couple of them weren’t collapsible), and collapsing a section will now get rid of everything in the section, not just the main part. It should be a much nicer experience overall, and result in cleaner, more relevant product pages for everyone.

An Example Screenshot of Collapsible Amazon

Top Process Windows Sidebar Gadget Updated

Just a quick update on the Top Process Windows Sidebar Gadget I made a couple months ago. First, I’ve added an option to disable the crossfade effect whenever the list of processes is updated. When this setting is checked, there’s no more smooth fade, but your text is also not bold. I actually prefer it without the fade, and based on some feedback I’ve gotten, this will be a welcome change.

The second change is that Top Process has been translated into 3 more languages. This is the first software I’ve ever written that has been localized, and I’m super excited, even though there wasn’t that much to translate. User Stefano Pirovano contributed an Italian translation, and my multilingual college buddy Mitch provided Japanese and Russian translations. If anyone else wants to take a crack at it, just email me. Hopefully some of my .NET stuff can be ready for localization at some point too.

MSN Messenger needs to be able to sign in from multiple locations at once

,

Like most Americans, I’ve been using the AOL Instant Messenger IM network for the last 10 years or so. As I’ve made more friends who prefer other networks, I expanded to multi-platform IM clients that let me sign into all the major IM networks at once. I’ve used Trillian, Adium, Meebo, and Pidgin over the years, and I have active screen names on AIM, MSN, Yahoo, GTalk, and various Jabber services. So when it was announced that the Xbox 360 would include an MSN Messenger client with the Spring update, I was excited. I’m already signed in to MSN all the time, so I thought this would just be another great way to stay connected.

Unfortunately, MSN has a pretty big problem. Whenever you sign in to your MSN account from one location, it signs off, all the other locations. If I’m running Pidgin on my desktop and I open Meebo on my laptop, my desktop gets signed out. And when I start my Xbox, it automatically signs on and knocks everybody else off. The end result is that I’m almost never signed in to MSN, which pretty much defeats the purpose. My buddy list reflects this - my friends are online only when their Xboxes are on. It’s worth pointing out that Yahoo Messenger suffers from this problem too, but it doesn’t bother me as much since I don’t have many Yahoo friends.

MSN getting kicked off

With more and more devices getting IM capability, I can’t see how this restriction can continue. My desktop is always on and signed in to my IM client. My phone will have an always-on IM client. Another one on my Xbox. Another on my laptop. Another at work. And I’m switching between them all the time. And with more and more people using multi-protocol clients, they’re less likely to notice the one account that’s decided to sign itself off. It’s especially frustrating on the Xbox, since it means I can’t just use my laptop to send IMs to my friends while I play and still get notifications on my TV. IM has the potential to be awesome on the Xbox, but not as long as it’s stuck with a one-device-at-a-time protocol.

Required driver signing in Vista x64 cramps my style

The other day I tried to move my Hogmonitor application to my Vista x64 machine, so that I could shut down the XP machine that has been running it. I thought it’d be a nice way to save the power used by running the XP box 24/7, since it is otherwise used infrequently. However, I quickly hit up against a brick wall - Windows Vista 64-bit doesn’t allow you to run drivers that haven’t been digitally signed. Since the Hogmonitor uses the InpOut32 library, which relies on a custom driver, I’m out of luck. InpOut32 even has a 64-bit port, so I could have used it fine on a Windows XP 64-bit machine, and it would work on a 32-bit Vista machine. But on 64-bit Vista, there is no way around driver signing.

I understand why Microsoft chose to require driver signing - it’s to keep home users from messing up their systems with weird drivers. But making signed drivers a requirement on 64-bit only is really weird. Aren’t the 64-bit users going to be the power users? I’d be fine with requiring signing by default if I were allowed to turn it off through Group Policy or something, but as far as I know there’s no way to disable this at all in Vista RTM (in the Betas there was a way to disable it, but it doesn’t work anymore). This is the first thing I’ve hit that I can do with an XP machine that I can’t do with a Vista machine (OK, printing too, but that’s HP’s fault). And I don’t hold out hope for the drivers getting a signature, either - those certificates cost $895! That basically prevents any drivers written by people in their spare time from being used in Vista x64. This includes stuff like InpOut32, overclocker fan and temperature monitors, hardware tweakers, and a host of other goodies.

This is really awful, Microsoft. I want to use my computer’s hardware however I want. And if that involves voiding my warranty by installing unsigned drivers so I can communicate with my hobby-project hedgehog sensor, then let me do that. Don’t make me keep around another computer just so I can use simple hardware.

JavaOne 2007

I had the opportunity to go to the JavaOne conference two weeks ago, in San Francisco. It was quite an experience for me as I had never been to a technical conference before, let alone one of that size. I’m not exactly a Java enthusiast, but I am a Java developer. I spend most of my day writing Java code, so going to all the presentations about making better Java code, as well as interacting with Java developers from all over the world, was really educational.

I noticed a few things from the conference that I wanted to write down before I forgot. The first is that even in Java-land, scripting languages are hot. Lots of people were talking about JRuby, Groovy, JavaScript, JavaFX Script, and more. JRuby in particular was getting a lot of excitement from everyone who’s been hearing for the last couple years about how cool Ruby on Rails is. I’ve seen a lot of Rails demonstrations and they’ve failed to impress me but the Ruby language itself is very appealing, especially to someone like myself who mainly scripts in Perl or JavaScript. I’ve definitely been convinced to use Ruby for my next personal web app project, and the combination JRuby’s speed and native access to Java code will make me feel a lot better about it.

There were a lot of talks about static analysis tools, and FindBugs in particular. I’ve been using FindBugs on my Java code (and FxCop for my .NET code) for quite a while, but a few of the presentations gave me a much better idea of how powerful static code analysis can be. One of the best ideas is using special annotations that more clearly document the intended behavior of your code. Not only does this serve as additional documentation, it helps you design your classes better and helps out your code analysis tools. One of the first things I did when I got back was grab the latest FindBugs release and start sprinkling those magic annotations all over my code, and from now on I’ll be writing them in whenever I write new code.

I also got more in-depth exposure to the REST philosophy, which I had heard a lot about but not really thought about too much. I really like the idea, but until the tools get to the point where I can write up some sort of service description and generate client code like I can do with WSDL, I’m going to hang back a bit. Maybe WADL will catch on. I also got a better explanation of OpenID than I had gotten previously, and I’m really impressed. I like that it’s so simple, and that it can still integrate with technologies like CardSpace in a way that adds value to both sides. I searched for an open implementation of an OpenID provider that uses CardSpace, but it doesn’t look like any exist yet.

Another, less explicit theme at the conference was that the Java community has noticed the great design of C# and the .NET framework and are trying to fit some of that back into Java. I’ve always felt that C# was “Java done right”, and the number of JSRs (Java Specification Requests) that I saw for C#/.NET features is a testament to that. JavaSE 5 already added annotations (attributes), generics, foreach, enums, variable length arguments lists, and autoboxing, all features from C# 1.0 or 2.0. The stuff that’s being discussed for JavaSE 7 and beyond includes “superpackages” that look a lot like assemblies, continuations, a “using” statement, generics that don’t use type erasure, indexers, and switching on strings. I think this is great - C# made a lot of great improvements that were no doubt based at least in part on experience with Java, so it’s natural for Java to get back some of that. I didn’t see much talk of any of the C# 3.0 features like LINQ, object and list initializers, extension methods, etc. I did see some talk about incorporating lambda expressions, though, which would be pretty nice.

Despite the fact that the Java language has some catching up to do, one glaring advantage of Java over .NET became apparent to me while I was there. I’m not talking about the platform-independence advantage, though that is certainly there - I don’t think I could imagine building a large, scalable distributed service with Windows machines. No, what I’m talking about is the community. That’s not to put down the large and active .NET community, it’s just that the Java community is huge. And especially through open source, there’s just a lot more going on. I feel like a large part of this is that Sun and other Java leaders have been willing to incorporate the community’s best products into the standard toolset. Products like ant, Eclipse, Spring, JUnit, and even JRuby are accepted tools. Meanwhile on the .NET side, you’re basically taking whatever Microsoft gives you. And while that can usually be good, Microsoft runs the risk of ignoring the direction people are actually heading in.

In the end, I left the conference with much the same opinion of Java that I had in the beginning. Java is a tool, and a good tool, but not a particularly exciting tool. It does have some exciting features (I love JMX), and after my week in the Moscone Center, I feel like I can be more competent at creating Java-based software. Maybe I just haven’t worked on the right Java projects. I hope as my experience with the platform grows, I’ll be able to contribute more, either through this blog or through open-source projects. And who knows, maybe one day I’ll really feel like a Java Guy.