All posts by ajohnson

Delegates, Components, and Simplexity on artima.com

Delegates, Components, and Simplexity, great quote:

.. There’s one kind of simplicity that I like to call simplexity. When you take something incredibly complex and try to wrap it in something simpler, you often just shroud the complexity. You don’t actually design a truly simple system. And in some ways you make it even more complex, because now the user has to understand what was omitted that they might sometimes need. That’s simplexity. So to me, simplicity has to be true, in the sense that the further down you go the simpler it gets. It shouldn’t get more complicated as you delve down.

ASP.NET Tracing

ASP.NET has a feature called tracing, which according to the ASP.NET Trace documentation… allows you to view diagnostic information about a single request for an ASP.NET page simply by enabling it for your page or application.” If you’ve used ColdFusion before, you’re probably yawning, “.. we’ve had debugging since version 3.0..”, but wait, it gets cooler. You can also view the information from a page (Trace.axd) called the “trace viewer”, which allows you to view detailed information the last N requests (read: requests that other people have made to your site), which would/could be extremely helpful during any phase of development, including production. Unlike ColdFusion, you configure this per application in the web.config file:

<trace
   enabled=”true”
 traceMode=”SortByCategory”
 requestLimit=”40″
 pageOutput=”false”
 localOnly=”false”
/>

Anyone know if there is a tool like this for servlet containers? Or if certain servlet containers support something like this?

J2ME Recipe Browser

As an exercise, I wrote up a J2ME client for Karensrecipes.com. As I mentioned a couple days ago, it sends HTTP requests to a servlet to receive a list of recipes as XML, and then (given a specific recipe), sends another HTTP request for the recipe details (again returned as XML). It works great on the emulator, not so good on the 3650. It looks like the phone can’t establish a connection to my server, because as I tail the Apache logs, I don’t see the request come through (I do see the request when using the emulator). I’m guessing it has something to do with the default connection for Java apps on the phone. Anyone have any experience with making wireless connections on the 3650 through J2ME?

If you’re interested, you can download the application and the source:

RecipeViewer.jar
RecipeViewer.jad
RecipeViewer source

NAnt

I mentioned a couple days ago that my current project is based on a C# and ASP.NET. I don’t have access to Visual Studio (should I try to get it? is it worth it?) so I’ve been using the Improv C# plugin with Eclipse. The combination works alright, but there are a couple things that need improvement. First, when compiling an assembly in C#, you have to specify each module that it references per class, there isn’t a way to to say that MyProject.dll should be included in the classpath for the entire C# project. Second, there’s no way to say that you want all the compiled assemblies to be placed in ../classes/ instead of ../build (ie: you can’t specify an output folder). But that’s where NAnt comes to the rescue. I downloaded NAnt today and was able to get a build script running within a couple minutes that accomplishes the two things I needed above.

I do have a question for those of you who have done .NET programming before. In Java, you compile .java files to .class files. Using C#, you compile a .cs file to a .dll (or .exe, etc..) which is called an assembly. Then in Java you’d usually package up your class files into a jar file. After using NAnt today, I see that you can compile a bunch of .cs files into a single dll, also called an assembly, which you can then use just like a jar file. Do I have that right? Are there different ways of doing this?

Parsing XML in J2ME

Spent a couple hours tonight working on a MIDP client for the recipe site. Initially I tried serving up pipe delimited plain text (ie: response.setContentType(“text/plain”);) and then parsing that using the J2ME classes, but then I saw the light that is XML, in this case kXML. kXML “… provides an XML pull parser and writer suitable for all Java platforms including the Java 2 Micro Edition (CLDC/MIDP/CDC). Because of its small footprint size, it is especially suited for Applets or Java appications running on mobile devices like Palm Pilots or MIDP enabled cell phones.” I’ll post some code after I’m done with it, this article is a great introduction.

Alternative Uses for RSS

At work we use a homemade bug tracking system I built a couple years ago during a slow month. Although the code isn’t exactly stellar, it works pretty well and most importantly, people actually use it(!). My biggest beef with it (and all our internal web-based applications) is that every time I want to use the application, you have to login. It might be ok if I only used it once a day, but it’s something that I want to see immediately. Multiple times throughout the day someone will say “hey, what’s the status on issue #14044?” so after falling in love with SharpReader this week, I created an RSS feed for each project. Now I can keep SharpReader open in the system tray, it’ll automatically refresh the data every n minutes, and I don’t have to login each time to view the bugs.

I mention it because I think it’s one of those examples of an application being used for something that wasn’t originally intended by their creators. Luke Hutteman, who created SharpReader, probably never imagined that his 3 paned aggregator would be used to view tickets in a bug tracking system. What other ways are you using RSS?