April 14, 2008

Coconut gets a facelift

Ever since I first wrote Coconut, the web interface to CONGO, I've been using the same stylesheet. It was really my first foray into stylesheet-driven design and layout, and while it was a good first try, it was ugly as sin.

Last night I finally sat down to rewrite the stylesheet into something reasonably attractive. I got rid of the dark background and greytones, and the 'All Caps' font styles, and used more pastels.

I'm pretty happy with the result, but for the hundred or so folks who are used to the old look and feel, it'll be a dramatic change!

Posted by dbs at 9:56 AM | Comments (1) | TrackBack

November 30, 2007

Dear Intarweb...

Somewhere, back in the mists of UI design, some bright light came up with the idea of making options in an application or desktop environment selectable by using a mouse to point at a menu along the top of a work area, clicking on the menu, and having it present more options.

This was called a 'Pull down menu'

Handy! Picks were readily available when needed, and stayed out of the way until requested.

I'm fairly sure the original designers of menuing systems never said to themselves, "Hey guys, I think it would be a good idea to SHOW A PULLDOWN MENU JUST BECAUSE YOUR MOUSE HAPPENED TO ROLL ACROSS IT ON ITS WAY TO PAUSE YOUR MUSIC!

I'm flabbergasted that the 'popup menu' has become de rigeur in web pages. It's a terrible UI design, and consistently gets in the way when trying to do other things. There's no other menuing system on the planet that does this. Menus should show up when you ASK for them, not because you happen to TOUCH it. That's what the little button the mouse is for. See? Clicky clicky. Now you try it.

Not that I expect this to change anytime in the near future. There's a revolution going on in UI design now, with AJAX services redefining what it means to write a UI. Unfortunately, I have yet to see any AJAX application that comes near the functionality of existing systems. It appears programmers are going back to 1985 and starting over, thus jettisoning all the lessons learned in the last 20 years.

Posted by dbs at 10:10 AM | Comments (5) | TrackBack

November 12, 2007

Zorching Memory Leaks. I Am Teh Stud

Tonight, I am Da Man.

It's rare I get to sit down and see, so directly, a problem in the code I'm working on. In this case, while running at Ubercon the other weekend, I noticed that CONGO was showing every sign of a memory leak. After a while I'd get sluggish performance, and eventually I'd get an OutOfMemory error from the JVM. Didn't look good.

This had me in somewhat of a panic, since Arisia is right around the corner, and I need the system stable and useable for the event. With the help of the wonderous tool that is JConsole, I was able to actually see the memory usage going up in the JVM as I worked with the server. There was definately a problem.

It turns out my hastily set up code to handle changes to my JDBC driver was not being handled correctly. Apparently with the old mm.mysql driver, SQL handles were automatically closed at the end of use. With the new Connector/J driver from MySQL, you had to explicitely issue a close() statement on any Statement, or the handle would never be freed. This was probably always the case, it was just my sloppy code and a twitch of the old driver that made it never come up.

Unfortunately, this necessitated changing just about every SQL call in the server, all 10,000 lines of it. It was long, painful, boring work. I had some help from blk, but it still took a good week of off-hour fiddling to finish the changes and do some basic regression tests.

Tonight, I made the last set of changes, did some basic runthroughs, and didn't have a single crash. With someone trembling fingers, I started up JConsole again, connected to the application server, and started working with CONGO. Registrant lookups, reports, modifications, creations, subscriptions, convention detail editing - throughout it all, JConsole happily continued showing the normal 'sawtooth' pattern of memory usage. Things would get allocated, used, and then the garbage collector would come along and reap the memory.

Success! I had successfully searched for, found, and fixed a major memory leak that was persistent throughout the code.

For those insisting on the details, here's a properly structured, Prepared, and appropriately exception-managed call to get a number from the database. (And, before I get abusive comments all over the place, the Exception handling here is VERY POOR, and will result in a clean result coming back from the method, even though the call may have crashed. I know, thank you, now go away).

private static int calcRegistered(int cid, String typeName) {
        PreparedStatement p = null;
        ResultSet rset = null;
        String sql = "SELECT count(*) AS total FROM reg_state " +
            "WHERE state_cid=? AND state_regtype=? " +
            "AND state_registered=1";
        int value = 0;
        try {
            p = cserver.Conn.prepareStatement(sql);
            p.setInt(1,cid);
            p.setString(2,typeName);
            rset = p.executeQuery();
            if (rset.next()) {
                value = rset.getInt("total");
                logger.debug("\tcalcRegistered: count for conference '" + cid + "', type '" +
                   typeName + "' is --: " + value);
            }
        }
        catch (Exception e) {
            dumpException(e);
        }
        finally {
            try { p.close(); }
            catch (Exception e) { dumpException(e); }
        }
        return value;
    }

I feel all geeklystudly.

Next is to start seriously hammering away at the buglist, and get a test environment set up so other CONGO users can test out the new Merge function against 'real' data. If all goes well, we'll roll this version into production in time to run Arisia.

Posted by dbs at 9:46 PM | Comments (2) | TrackBack

November 5, 2007

Deep Breath.

Aaaaand, we're back.

What an insane couple of days. There's a whole series of posts brewing in my head right now, but I'll just touch on probably the one that's most on my mind.

Last week, I was in mid-preparation for Ubercon, an awesome gaming convention I regularly work down in NJ. CONGO has been pretty idle for the last few months as the summer is not a big time for conventions. With a week to go until Ubercon started, it was time to pull out all the hardware and make sure everything was working.

Well, unsurprisingly, it wasn't.

The first major issue was coming to the conclusion that endor, the venerable server of dozens of conventions, really wasn't going to handle Yet Another Apt Upgrade. It was still running on a baseline Debian Sarge install that had been upgraded a dozen times over the years, and finally, after enough apt tweaking had gone on, a dependency just wouldn't resolve, and the machine would not take new upgrades. It was time to nuke from orbit and reinstall the OS from an Ubuntu baseline.

No problem, sez I. I whip out my Gutsy Gibbon Ubuntu CD, do a quick database dump and backup, install Ubuntu, and restore my home directory and databases. Reinstalled CONGO, loaded the working databases and...

stopped.

See, CONGO was my first big Java application. And as such, it has some... intriguing ways of doing database work. And by 'intriguing' I mean butt-ass stupid. In particular, not using PreparedStatements for SQL commands, not checking for failed transactions, etc etc. While this was okay for a fairly static application, once you replace the entire OS underneath it, things start to get a little squirrely. And, well, we had squirrels aplenty.

So over the space of 3 days I basically had to rewrite every SQL interraction in CONGO, resulting in some fairly major code changes, and all of this 3 days before a con.

Add on top of this the fact that I'm also using a brand new printer from Evolis for the first time under Linux. There's a whole nother post about this experience, but it did bring yet another variable into play. Oh, and did I mention that I rewrote the print routine in CONGO to generate PDFs on the fly and use them for badge rendering? Yep, also new.

Needless to say, things were a little panicy leading up to the event. Fortunately, by Wednesday afternoon, I had things fairly well stabilized, the code worked, endor was stable and functioning properly, and I could start packing for the event with a clear conscience.


The end result? It all worked. The convention went fine, the printer behaved wonderfully, running badges twice as fast as my old Fargo printers, and we had only minor glitches through the weekend. There's still some work to do to get endor ready for larger events, but for a week that started out with totally broken software, an unuseable server, and an untested printing system, things went mighty well.

Onwards.

Posted by dbs at 12:17 PM | Comments (2) | TrackBack

October 29, 2007

Thank you Sun and Ubuntu!

... and the cast of thousands that made installing a Sun JDK onto Linux as simple as:

root@endor:~# apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
gcc-3.3-base java-common libstdc++5 odbcinst1debian1 sun-java6-bin sun-java6-jre unixodbc
Suggested packages:
equivs binfmt-support sun-java6-demo sun-java6-doc sun-java6-source sun-java6-plugin ia32-sun-java6-plugin sun-java6-fonts
ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming libmyodbc odbc-postgresql
libct1
Recommended packages:
libxp6 libnss-mdns gsfonts-x11
The following NEW packages will be installed:
gcc-3.3-base java-common libstdc++5 odbcinst1debian1 sun-java6-bin sun-java6-jdk sun-java6-jre unixodbc
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 42.3MB/43.1MB of archives.
After unpacking 128MB of additional disk space will be used.
Do you want to continue [Y/n]?

For those on the sidelines, Sun has not been particularly forthcoming regarding a licensing arrangement that makes the RMS-ites at least mildly comfortable with automating an installation. In point of fact, I believe Debian is still uncomfortable with the whole license arrangement, though they do have it in the non-free repository.

Up until recently, getting Java onto a Linux box was, well, not difficult, but certainly not trivial. I'm happy to say it's gotten as easy as installing any other package, which, with current package managers, means it's a breeze.

Yay progress.

Posted by dbs at 1:50 PM | Comments (1) | TrackBack

October 9, 2007

A Peek Under the Covers - Windows XP Registry Keys

While working on my current Java project, I needed to better understand how the Preferences API stores data. My initial instinct was to dig around in my home directory looking for a .java/Preferences file or something similar. Perhaps under Linux, this would have been the case, but Preferences is platform agnostic, and under Windows, it uses the Windows Registry.

I've long since tried to drive out my knee-jerk reaction to the Registry. The initial implementations of it were awful, and prone to easy corruption. Navigating the registry has never been what one would call 'simple', but after a while things settled down a bit and stabilized.

In this case, I was using a simple Java command to store some values for a Webstart launched client:

prefs = Preferences.userRoot().node(nodeName);
prefs.put("ExpoLoginName",userField.getText());
prefs.put("ExpoPassword",new String(passwordField.getPassword()));

Pretty straightforward stuff. In general, the code was working as expected, but I was seeing doubling of some of my values. What I needed to be able to do was actually see the registry stored values themselves, without going through the interface, to see if I was actually storing the values properly, or things were going wrong on the way out.

This unfortunately brought me in contact with the Windows native tool 'REGEDIT'. This tool came out quite a while ago, and is the defacto standard way of editing, browsing, and searching the Windows Registry. Unfortunately, regedit hasn't seen any interface upgrades in approximately an eon. It is painfully difficult to work in, and while yes, it gets the job done, little interface quirks can flat out destroy productivity. For example. The FIND function (amazingly, bound to '^F'), does in fact let you search the registry for a key or value. But, it is a one-way search, from the current position forward. It does not wrap. It also does not RESET when you change to a new search term. So if your first search finds a match, say, at the 5th from the bottom key (by the way, the window does not scroll to show you where your match hit. You have to scroll it manually), and you decide to search for a second term, it will only search the last 5 rows in the registry.

I lost half an hour searching for keys I KNEW were in the registry, because my first search had set the pointer so low. GAARRRHHHH!

What I found most entertaining about this path was it gave me a chance to look under the thin veneer of civility that Windows brings to the operating system experience. Take for example the screen shot above. Note that the keys stored in the registry have been altered from their internal values. Some bright Windows developer back in the dark ages realized they should tell the difference between an upper case letter and a lower case letter. Rather than, say, writing that into the logic of the registry, they cleverly decided simply to preface upper case characters with a forward slash.

Ah, but that brought up a problem! You could now not store a forward slash into the registry! Not to worry, we'll just change any forward slashes in the registry to backslashes! Sounds like a great plan!

This sort of tortured logic is what you see happening in student built technology experiments, hacked together during all night jolt-driven marathons. It's not something you'd see in the largest software company in the world. Their programming practices, in theory vastly improved from the early days, wouldn't allow such awful hacks.

Would they?

Update - it appears, due to notes in the comments, that the registry values hack is due to Java's interpolation, not Windows. Java needs to specify slashed items because the backing store being used in this instance (Windows Registry) is case insensitive. If a different backing store were being used, that wouldn't be happening. My apologies to Redmond for assigning blame. On this one thing. :)

Posted by dbs at 5:38 PM | Comments (4) | TrackBack

August 8, 2007

Windows as a useable Java development environment?

Recently I had to spend a fair amount of time working on CONGO on a Windows XP platform. Stonekeep is doing doing it's first event where CONGO will be running entirely on Windows XP, so all the environmental stuff I'm used to having under Linux doesn't work, naturally. Things needed to be updated. This presented many challenges...

Normally I'd just import CONGO into Eclipse (where I've been doing most of my Windows development), and run with it, but CONGO was my first 'big' Java app, and, well, I made some poor design decisions that make moving it into a formal structured environment like Eclipse... somewhat problematic.

What I needed to do was set up my Windows XP environment to behave very in a similar fashion to my Linux environment, without trying to reproduce Linux-under-windows. I've gone the Cygwin route before (which tries to emulate a Unix environment completely), but I found the inconsistencies got in the way of being productive, and the installation overhead is enormous. So I needed a compromise.

The needs

There were several basic functions I needed to have in order to run the two sides of my application successfully. CONGO consists of a standalone 'application server' (called 'cserver') which runs in it's own standalone Java process, answering XMLRPC requests, and a PHP-based webclient called "Coconut", providing the user interface. To run both these pieces I needed Java, PHP, a webserver, a database, an installation tool, an editor, and a way to interact with my SVN repository.

The Tools

LAMP
A large part of my needs were covered with XAMPP, a bundled set of tools that provides LAMP functionality to a windows environment (WAMP?). With one swell foop, I had a PHP interpreter, an Apache webserver, and a MySQL instance, plus a database tool (phpMyAdmin).

The Compiler
Sun provided the appropriate JDK (Java Development Kit) to compile the application server as needed. I don't have a binary distribution of the code yet, so an installation consists of checking it out of SVN and compiling it. The JDK installed just fine (into C:\Program Files\Java\jdk-versionumble)

The Editor
For an editor, I chose to work with JEdit for a while. It's a pretty editor, and is completely Swing based. It has some annoying twitches, and I'm not sure if I'll continue using it in the long term, but for this event-cycle, it was fast, workable, and did the job just fine.

The Build Tool

Build tool - This is one of the sticking points for portability into Eclipse. I don't actually compile CONGO in a 'normal' fashion, and my class definitions are all screwed up. To address my odd setups, I use Ant, a very very good build tool specifically designed to work with Java projects. I had already been using Ant build scripts on my Linux installations, so having this available under Windows was a huge win.

I downloaded the Apache Ant binary distribution, and unpacked it. Because Ant is basically just a simple command line tool, it really doesn't have a Windows installation process, it just needs to be unzipped. I put it in C:\Program Files\ant.

The SVN Client

This one was a toss up. All my code is stored in an SVN repository on a remote machine in a colo facility. In order to check in and out code, I needed to have an SVN client on the machine.

The natural inclination would be to download the command line SVN client, which is available from Tigris.org, but that seemed to be me falling into the "it must be just like Linux!" mode, which I was trying to avoid. Instead, I opted to install Tortoise SVN, a tool that integrates SVN functionality right into the Windows explorer. This turned out to be an EXCELLENT choice. I found TortoiseSVN to be stable, fast, and eminently useable for my checkins and updates, without having a steep learning curve.

windows properties

The Configuration

So far so good. I had all the tools I needed, but Windows isn't normally comfortable with command line only interaction. I could spend time configuring tools into JEdit like Ant Farm and the like, but that runs the risk of being distracted with some serious yak shaving, something I didn't have the time or the inclination for. Instead, I opted to set up Windows to handle command line use of Ant.

The primary challenge here was setting up the paths correctly. Under Linux, I'd simply add the path to my .profile and off I'd run. Under windows it's slightly more challenging. I found a handy little shortcut for doing a 'fast' path change similar to using $PATH in Linux:

In Linux:
$ cd /usr/ant
$ export PATH=$PATH:`pwd`
In Windows:
C:\> cd "\Program Files\ant\apache-ant-1.7\bin"
C:\Program Files\ant\apache-ant-1.7\bin> path=%path%;%cd%

This shortcut is a great way to make sure all the things work correctly before actually modifying the system. I did this for both the JDK and for Ant, and lo! I was able to do 'ant' commands, builds, and run my app. Hooray!

CONGO under Windows

The last bit was to change my default system path under Windows to include these new directories. This was accomplished by following the tortuous path:
Right click on My Computer->Properties->Advanced->Environment Variables...
Then scrolling through the 'System Variables' until you find 'Path', click 'Edit', and append on the JDK and Ant binary home directories. Windows thoughtfully makes this input window only about 30 characters wide, without the option to resize, so expect to do a little scrolling. Phew. But this meant these paths were set every time I started up a CMD.exe shell

At the end of it all, I had a clean environment where I could not only run my appserver, but also use Firefox to access Coconut. Hooray!

Conclusions

It's hard to buck trends. There's no question that Windows is used for serious work, but many Linux users scoff at the concept of using Windows as a viable development environment unless you're doing Windows specific coding, such as .NET or Visual Studio type work. Much of this derision comes from the different approaches to environment. Windows tends to be pointy-clicky, doing a lot of 'assistance' to the developer. Linux programmers prefer command line editing and compilation (though that is rapidly changing as tools like Eclipse, IDEA, and Netbeans gain popularity). Regardless, this article shows it is possible to set up Windows for simple command line operation, with some of the benefits of a full GUI, without spending hours upon hours tweaking and installing random tools.

Posted by dbs at 10:32 AM | Comments (2) | TrackBack

June 20, 2007

Updating Jarindex

Grump. I had no idea, but Jarindex was not working at all. Searches were coming up blank. Frustrating, when it's supposed to be a handy search tool for finding classes in the vast swampland of Jar files out on the net.

Anyway, I fixed the indexer, and loaded up Hibernate 3.2 and Jboss 4.2.0 into it. Probably should update other packages as well. Currently I have:

apache-ant-1.6.5 eclipse-SDK-3.1.2 jakarta-oro-2.0.8 jboss-4.0.2 jdk1.5.0_04 jetty-5.1.10 junit3.8.1 OROMatcher-1.1.0a velocity-1.4
axis2 hibernate-3.2 jakarta-slide-webdavclient-bin-2.1 jboss-4.2.0.GA jdom-1.0 jpcap-0.01.16-win32 lps-3.1.1 rss_utils_1.1 velocity-tools-1.2

If any Java geeks want to see other packages loaded into it, let me know.

Posted by dbs at 11:37 PM | Comments (0) | TrackBack

June 18, 2007

JBoss Release Grumpiness

This is a geek gripe. Particularly for Java programmers. If you're not doing JEE development, this probably won't make a lot of sense unless you like seeing open source companies being beaten up for version incompatibilities.

Hello, I'm Dave, and I'm a JBoss developer. (Hi Dave...)

Until recently, I was quite content with the series of tools available for JBoss4, and my chosen IDE, Eclipse. JBoss provided a lovely little plugin interface called JBoss IDE. I encourage people to click on that link, because you'll walk through a series of redirects until you land on a page that, amazingly, has no information on where to get JBoss IDE! How wonderful!

It turns out that JBoss (now wholly owned by Redhat has pulled JBoss IDE in favor of another Eclipse plugin called Exadel. Fantastic, a new IDE plugin that has a lot more functionality than JBoss-IDE ever had. Lets take a look!

An hour later, and Exadel is installed and running and grand. But. Wait a moment, the latest version of the JBoss application server is 4.2-GA. That's General Availability. Meaning the platform is released and is the recommended system for users.

Exadel has no configuration support for 4.2-GA. Only for 4.0.x releases.

And JBoss-IDE has been pulled completely (and even it's '2.0.0-beta' version, the most recent version they posted, did not support 4.2).

"Must be coming out shortly." So I mailed off to Exadel tech support asking if there was 4.2 support in the works, or when it will come out.

I get a direct, and undeniable response from them:


Dave Belfer-Shevett wrote:
> > Exadel Support Team wrote:
>> > > Exadel Studio Pro is going to be re branded as Red Hat Developer Studio in
>> > > later summer. Red Hat Developer Studio will support JBoss 4.2 .
> >
> > So the answer is "no, it does not support 4.2 now, and won't until late
> > summer" ?

That's correct.

-The Exadel Team

Excuse me, but WHAT THE F??? We've pulled the old IDE toolset. We've released a new product. But you CAN'T USE IT WITH OUR IDE TOOLS! Hahahahha! And you won't for a couple months. Sorry bout that, have a nice day.

There are workarounds. You can run the jboss server externally in a windows shell and deploy to it. This is a painful arrangement, but I guess I have no choice?

Thanks for leaving us all in the lurch, JBoss.

Posted by dbs at 5:37 PM | Comments (6) | TrackBack

May 30, 2007

Getting a release out the door

It feels good when you finally push a release of a product out the door.

The last 2 months I've been spending a chunk of time doing updates on Keystone. It's always fascinating working on code that is pushing 10 years old, seeing things I remember writing during the dotcom boom, and finding other tidbits that make me go "What the HECK was I thinking?"

This release is interesting in that much of the work was pay-for contract updates from a customer who wanted to see some bugs fixed and a few enhancements added in. It's nice working on something you enjoy, and getting paid for it as well.

The code is just about ready for it's next major overhaul though. I'm trying to get up the gumption to rip out the entire database back end code and replace it with ADODB. I wrote my own database abstraction layer back in, oh, 1998-ish, but really, the world has moved on a bit since then. It's time to move with the times.

Posted by dbs at 12:55 PM | Comments (0) | TrackBack

March 29, 2007

Subversion + SSH - Close but no banana

About a year ago, I switched my primary source code control system from the venerable old CVS to the (relatively) new kid on the block, Subversion. On the whole, I've been ecstatically happy with the system. It patched many of the ridiculous problems with CVS, and added on things that opensource community has been asking for for ages (like 'rename'), but never made it into CVS.

Now I have all my projects stored in SVN, and my main client is using it as well for their code (they've chosen to go with SVN and are planning to End Of Life their VSS server - to the dismay of no one).

Subclipse
One of the best tools that made this switchover workable (aside from SVN's similarity CVS in many respects, particularly on the command line) is the Subclipse plugin for Eclipse. Subclipse provides a great easy to use interface into SVN servers, giving all the functionaly one would have on the command line via a very simple, tightly integrated GUI.

One thing that had been bugging me, however, was the access methodology I was using to get to my (remote) SVN server. It involved setting up a tunnel in SecureCRT (though Putty can do it as well), and then telling subclipse to use my 'svn://localhost/stonekeep' repository.

SVN+SSH configuration under EclipseWhile doing some surfing, I found that Subclipse supports the svn+ssh syntax for specifying the repository. "Great!" says I, "I won't need to set up the tunnel each time!"

A few more fiddles, a pleasant discovery of a configuration screen in Subclipse, and I had an SVN over SSH connection to my repository, even using my ssh key pair.

Danger, Will Robinson!
But wait! All is not well. When I tried to browse the repository from Subclipse, I quickly hit this error:

Could not open file system at /var/lib/svn/stonekeep (13)Permission Denied: Berkley DB Error while opening environment for file system /var/lib/svn/stonekeep/db:

This vexed me, because I had been having no problems accessing the repository locally on the server, and over my ssh tunnel. Both used the locally running 'svnserve' on the repository host, so why wasn't the svn+ssh connection using it?

The answer comes in the SVN documentation, and via a little research:


What's happening here is that the Subversion client is invoking a local ssh process, connecting to host.example.com, authenticating as the user harry, then spawning a private svnserve process on the remote machine, running as the user harry. The svnserve command is being invoked in tunnel mode (-t) and all network protocol is being “tunneled” over the encrypted connection by ssh, the tunnel-agent. svnserve is aware that it's running as the user harry, and if the client performs a commit, the authenticated username will be attributed as the author of the new revision.

When running over a tunnel, authorization is primarily controlled by operating system permissions to the repository's database files; it's very much the same as if Harry were accessing the repository directly via a file:/// URL.

The Problem With This
I'm really unhappy with this model. The problem is that now the user must have read/write access to the entire repository tree. When using a local socket connection (or one over ssh via a normal tunnel), the Subclipse client connects directly to the svnserve process running on the repository box, and interactions with the server happen under that processes ownership.

The svn+ssh protocol does not use the svnserver on the target machine. It tunnels the command to a user-invoked svnserve process, and that process must have read-write access to the repository.

"Well gosh, that doesn't seem too bad. What's the issue?"

The issue is that to make this methodology work, I have to give the user read/write access to the repository tree. Meaning, they could happily type 'rm -rf /var/lib/svn' and destroy the entire repository. Even worse, the configuration files (including the password / access file, which has passwords in plaintext) must be made available to the general users.

Why svn+ssh doesn't simply make a local socket connection to the svnserve process already running, I don't know. But I can find no way to make that happen.

The fix?
As far as I can tell, there really is no direct fix for this. There are various workarounds, which the SVN documentation discusses, including setting up an 'svn user' for the svn+ssh logins, and the possibility of using unix groups for permissions, but I feel that if you have a listening socket server on your repository host, you should use it, not introduce a second methodology and have to jump through hoops to implement it.

For now, I have to abandon the svn+ssh possibility, and go back to my hand-configured socket tunnels. There's no real loss here - they work remarkably well, are very secure, and quite stable. The slight annoyance of having to open up a SecureCRT session before doing work in Eclipse is just that - a slight annoyance. I've dealt up until now, and I'll just continue to deal.

Posted by dbs at 3:34 PM | Comments (8) | TrackBack

March 25, 2007

Strictly Hamburger Coding

I ended up with a sort of special bonus afternoon today as Cat is off in town, and Zach is over his friends house. The basic idea was to make up for a very interrupted week of work and try to get some long-neglected work out of the way.

Mostly, it worked quite well. I got caught up on a couple things that had been nagging, and that's good. But what really got me grooving was working on... well, a project that a couple folks know about, but I'm not -quite- ready to release to the public. I've been referring to it simply as the "Secret Squirrel" app, or just 'The Squirrel' for short.

What's been good about this has been the basicness of the design and implementation. I've been spending SO much time delving into the deep complexities of EJB3, JBoss, Hibernate, and more recently Terracotta, I don't get much of a chance to just sit down and whack out simple code.

Today had 2-3 hours of basic grunt 'hamburger' coding, to borrow a phrase from MASH. No fancy libraries, environments, or oddities. Well, okay, one new library that handles OpenGL rendering, but everything else was basic data application coding and design.

It felt good! It sort of underlined where I've gotten with Java programming over the last 2 years or so, and now basic coding is second nature. Eclipse has become my environment of comfort, whether it's running on Windows or Linux (in fact I'm leaning toward moving back to Linux full time soon - with both machines up and running cleanly on my desk, I find myself doing more on the Linux box than on Windows... but I digress...) , and the Java OOP approach to program development Just Plain Makes Sense. It's nice.

Tomorrow it'll be back to EJB3 and Terracotta land, and all the mysteries therein, but for now, I can look at what I did today and do a "That felt good!" happy dance.

And the code even worked.

Posted by dbs at 4:55 PM | Comments (0) | TrackBack

December 4, 2006

Can lightning strike twice?

About 10 years ago, I started writing an application that would have a profound impact on my life. Keystone started out a simple problem tracker, grew into a mature product that was getting 3000+ downloads everytime I did an update (about once every 3 months), and was ultimately sold to a DotCom that basically killed it in its tracks. That sale let me have a few toys and was a high point of the dotcom bubble for me.

3 years ago I re-aquired the rights to the application from the failed dotcom, and set about upgrading the vastly outdated software. My user base had for the most part wandered away to other applications, but there was still interest and heck, it was my application, I wanted to do things with it.

But other projects were taking precedence, and Keystone languished.

On a recent trip down to DC, I had the opportunity to spend 7 uninterrupted hours on the train, each direction, with nothing but a laptop and a music library to keep me company. After trying to get my current projects working, I settled back into "well, maybe I'll work on Keystone some more."

In those 2 train rides, I did more upgrading, tinkering, and fixing in Keystone than I've done in the last 3 years. I revived the contact manager and fixed all the dependency problems. I continued the changes needed to bring a PHP application, written in 1995, up to 2006 standards. Keystone is over 12,000 lines of code - not a trivial application, but not so huge that it is an unassailable target.

The question is - why do this? Sure, part of it is 'this is my baby, I want to see it succeed', but in the back of my head, the question burbles... "Can lightning strike twice?" - can I make this a successful opensource application again?

I'm certainly not deluding myself into thinking "THIS WILL BE THE NEXT KILLER APP!" - that's a foolish and unrealistic mindset. But can I bring it back to where people are using it, they like it, they contribute suggestions and fixes, and the application continues to grow?

I'd like to think I can. But the code still needs a lot of work, and there are some design decisions that will most likely require huge chunks of code being ripped out at the roots (database connection methodology has advanced SIGNIFICANTLY since 1995).

It's a nice dream, I sort of miss my users. Maybe they'll come back.

Posted by dbs at 9:35 PM | Comments (0) | TrackBack

November 10, 2006

It's all about the tools.

In a previous post I admitted to the world that I, an avowed Linux weenie, was now using a Windows desktop for all my geeky endeavours. This continues to be true, but I've taken the steps necessary to make my environment comfortable to work in, without going the easy route of "I will do everything in my power to make Windows look and feel just like my Linux box." To me this defeats the purpose of potential learning experience of working with a new environment.

So about those tools...

Very few operating systems are useful right out of the box. Generally the first thing a person does when sitting down to work in a new environment is to add in the necessary tools and fidget some personal settings. This latter element can take days away from your life and result in permanent "No, that color just isn't quite right, lets try bringing the blue content down 2%" mania.

After setting a background from Digital Blasphemy, I was ready to tackle getting the components in place that I needed.

IDE - Eclipse

An Eclipse screenshotMy preferred environment is Eclipse. Since I'm mostly working in Java, this makes a lot of sense. One of the big advantages is that Eclipse runs on Windows, Mac, and Linux, so moving from yawl to clipper and occasionally on to hunter really requires no mental shift. Eclipse works the same way on all 3 machines.

SSH connections - SecureCRT

I'm an old stick in the mud on this aspect. I use ssh for just about everything - accessing my mail server (via tunnels), remote connections and other VPN activity (SVN, RDP, etc) - all possible over ssh connections. Though my client is keen on using Microsoft VPN tools (like PPTP), I still like the flexibility and simplicity of SSH tunnels.

Originally I was using PuTTy for a client, but the now woefully out of date interface and lack of decent features (such as tabbed connections) made me return to Van Dyke's SecureCRT. While it is a commercial application, I'm comfortable laying out the $70 or so it'll take to upgrade my now quite old license. Tabbed windows, interactive dialogs for setting up tunnels, very good font support, and excellent emulation make it well worth the investment.

Web browser - Firefox, natch

Don't really need to go into detail here. Firefox continues to be faster, more stable, less susceptible to phishing and virus attacks, and standards compliant (yes I know it has it's own issues, but compared to the nightmare that is IE6, it's leaps and bounds above it). It's also consistent across platforms (I run Firefox on Windows and Linux), and using the Google Browser Sync, I even keep my bookmarks consistent. Coupled with Sage, it makes for a great environment.

One note on this, I have not transitioned to Firefox 2.0 yet, nor have I had a chance to evaluate IE7.

Email client - Thunderbird

My loathing of Outlook knows no bounds. Since that was not an option, the world is wide open for alternatives. I've worked with many different mail clients, from console-based tools like 'pine' up through full environments like 'Evolution', I've worked with them all. My latest love affair is with Thunderbird, an exception free opensource application written by and supported by the Mozilla foundation. It's quite fast and the user interface is outstanding.

Calendaring - Google Calendar

Calendaring has always been the achilles heel for folks not willing to suck up to Microsoft and go whole hog into an Exchange solution. There just is no toolset around that can duplicate the level of calendar interaction that Exchange can.

Google Calendar is the best of the free services on the net, at least as far as I've seen. It has the best supported API, excellent sharing between multiple users, and quite a good interactive toolset.

What really cinched it for me though was finding Companionlink for Google Calendar, a tool that syncs up Palm desktop calendars directly to and from Google Calendar. This means I can have my calendar moving with me on my Treo, and hotsync it to clipper, and have it sync right up to Google where my friends and family can see / change / update it.

Graphics editing - The Gimp

To be sure, Adobe has the photo and graphic editing world in it's pocket with the massive application Photoshop. Because the thought of forking out $500 just to edit some pictures does not appeal to me, I use Gimp for the basic photo manipulation I do. It's fast, powerful, and extremely flexible, unlike many of the handholding 'basic' photo tools that every camera on the planet seem to come with.

IRC / Chat / IM - Various

These don't really require their own seperate groupings, but I do a lot of communication with folks online - in the more interactive sense, not just email. To handle that, I have a few tools I use:


  • IRC - X-Chat - The legendary IRC client. This one is an old sticky one for me. Sure there are other newer clients, but this is something I'm quite comfortable with, and chances are when I go in for a job interview in 5 years, the fact that I haven't evaluated and gotten familiar with newer IRC clients probably won't be an impediment to getting hired.
  • Jabber - Exodus - I use Jabber for connecting to MSN, IRC, Yahoo chat, and of course Jabber chat (which gets me onto Google talk and the Livejournal jabber network).
  • VOIP - X-Lite from xten - An excellent free VOIP client for Windows. I use this every day for morning conference calls.

Conclusions

I feel that I've built up a set of tools that makes my experience with Windows quite tolerable, without feeling like I'm particularly in bed with my worst enemy. My interaction with Windows on the level Microsoft wishes is pretty minimal, as I'd say 98% of my time is spent in the above apps. Granted, I'm running Windows as my core OS, and in many ways it has helped me spend time doing the things I need to do (like work on my projects), rather than spending half a day building a new kernel because a switch was set wrong. In this way, I'd say I'm comfortable with the end result. But every time I boot up, I still hear Bill Gates laughing maniacally in the distance.

Posted by dbs at 1:06 PM | Comments (2) | TrackBack

November 8, 2006

The code, she is a flowin.

Rain. Cold. Cloudy.

These to me are the harbingers of only one thing.

An excellent day of coding.

And an excellent day it was. Almost 12 hours, with a meeting and a good lunch to interrupt, had me rewriting an entire interface to the application, reworking a build script so it was more efficient, and implementing a 'Priority 1' change for the current programming sprint.

I'm coming to a happy medium with Eclipse and my forced migration. All in all, a very good couple days, with this one as a topper.

Tomorrow I have another bit of work, then drive back up to Boston. But tonight, it's time for food, then rest.

Posted by dbs at 6:55 PM | Comments (2) | TrackBack

September 20, 2006

My Daily Conversations with Eclipse, Pt II

My ongoing conversations with Eclipse (see this older post for Pt 1)

dbs "Edit that."
eclipse "no."
dbs "but it's open in the editor."
eclipse "nuh uh."
dbs "*enter*enter*enter* CMON!"
eclipse "nope"
dbs "owait, i'm in the svn browser aren't i?"
eclipse "_I_ knew that. Don't know what your problem is.."
dbs "fine, java perspective, now edit."
eclipse "if you insist."

Posted by dbs at 1:49 PM | Comments (1) | TrackBack

September 18, 2006

An old programmer...

... can learn new tricks?

As part of my current contract, my employers are embracing new procedures and techniques for application development. While the normal buzzwords of "EXTREME PROGRAMMING" and "Agile Development" are being bandied about, they're not being whole-hog embraced, with the managers marching zombie-like into an undeliverable product schedule. We're trying new techniques such as scrum product development, and utlitizing sprints to structure short-term deliverables and milestones.

Since I got the core of my production programming experience with this same company almost 18 years ago, when there were only 3 employees, me being number 3, I find it fascinating to see the same programmers trying new tacks to take on the complexity of developing modern code.

In the Good Old days, our entire code base was perhaps 80,000 lines. One developer easily understood every aspect of the application, and could comfortably keep up with customer and internal needs. The current codebase is over a million lines and growing, and no one programmer understands it all. This is not a disaster story, it is one companies' normal evolution as they grow and expand. In this case, they have lucked out to have a person in charge who is not only a brilliant programmer, but also an open-minded manager and a good communicator. He recognized the pitfalls of 20 years of development on his product line, and is making careful, planned, and deliberate changes to the company's development methodology.

Of course, the panic element for this is... the changes being applied involve shifting their platform onto a framework I designed for them over the last 18 months. No pressure, really. It's only the future of this company and it's 20-some odd employees, not to mention the respect and 20 years good will of the owner. The same owner who gave a young programmer his first production development position.

Posted by dbs at 9:19 PM | Comments (2) | TrackBack

August 28, 2006

QuickReview: Synergy2

Have to point this handy tool out to folks.

My busy deskBecause of the complexity of my desk, I can't really have a pile of keyboards and mouse lying around. I switch between machines constantly, and switching keyboards would just drive me batty. I had been using X2VNC for quite a while, which, while 'okay', had it's own quirks. One of which was it couldn't work in reverse (I could go from an X host to a Windows box, but not the other way around). It also wouldn't let me slide from an X display to another X display. Pretty limiting.

Enter Synergy2, a simple client-server tool set that lets you configure multiple displays to a single 'server' that controls the mouse and keyboard. With Synergy2, I'm able to configure all my machines in whatever configuration I want. At the moment I can slide my mouse off my primary Linux display onto my WindowsXP box, across it's display, and onto my laptop.

That's pretty neat, but.. the kicker? Synergy2 manages clipboard cut n paste operations across machines. If I slide over to hunter (the laptop running Ubuntu linux), highlight something and click 'Copy', then slide back to my primary desktop on yawl, I can just click 'paste' and it works. This is miraculous to my eyes!

If you run more than one machine on your desk, I highly recommend Synergy2. Available in apt repositories everywhere.

Posted by dbs at 7:59 PM | Comments (0) | TrackBack

May 11, 2006

Travelling in Style

This week I'm on the road to scenic Pittsburgh for a few days. While there are various wonderful aspects of this trip, there is also the bonus of being to test out various geeky projects that have been percolating around.

VOIP! VOIP!
The first biggie was finally exploring VOIP clients under Linux. I had tinkered with Wengophone a bit, but the Linux version of it didn't seem particularly well suited for general VOIP operations. This week I downloaded and installed Twinklephone (one of the oddest names for a FOSS application I've found to date), and set it up.

One of the big wins for twinkle is that it supports ALSA devices directly. This is a boon in particular for me because it avoids the "/dev/dsp is already in use by another application" problems that so plagued other sound applications.

Once twinkle was installed (since hunter runs Kubuntu, all I needed to do was 'apt-get install twinkle'), it was just a matter of specifying my VOIP providers hostname and account information, and voila! I was online. I can place or receive calls while listening to music, from anywhere. At the moment, I'm on a wireless connection in Pittsburgh, connected to my VOIP account, able to receive and send calls directly from the laptop. Outstanding.

"Okay, so it's another VOIP client. Whatever." - Actually, I think it's more than that. It's not just a VOIP client, it's also an integrated KDE app. When twinkle runs under KDE, it integrates directly into the other KOffice applications, most importantly KAddressBook. This means when I sync my Treo to my desktop system, all the phone numbers and addresses I keep are also available to twinkle, without having to import, export, or whatever.

ACPI Actually Works
The other big win was one of those mysteries that happens with a 'dynamically' updating OS, as most Debian-like systems are. A year or so ago I was curious whether I could suspend / hibernate my laptop just lke every other laptop in the world. Alas, this met with... abject failure. Lockups of the machine, failed reboots, etc. The ACPI tools in Linux were just not ready for prime time.

Last night I decided to try again. In KDE, I clicked on my power icon, and selected 'Hibernate'. The system quietly shut itself down, turned on the little moon LED, and that was it. I closed the lid, waited a few minutes, then opened it again. Sure enough, it powered up cleanly, restored my session, and I was back in business. All my applications were still loaded and running correctly, even my Tomcat and MySQL servers.

Yes yes, other laptops have been doing this since the dark ages. But Linux has not. I'm ecstatic. Linux takes a while to boot from scratch, and I had been resigned to requiring a full boot from scratch everytime I wanted to sit down and crank out a piece of email. Now, that's not the case. Hooray!

Coding on the Plane
I seem to have some deep empathic link with airplanes. I do enjoy flying, though the accomodations really aren't suited for someone my size - I can usually get a bulkhead or exit row seat, so I'm merely compressed as opposed to being in complete agony. But once settled, and in the air, I pull out the laptop, plug in the headphones, and start coding. I've done some of my best coding in the air. A reporting and query engine for Keystone was written during a 5 hour flight to San Francisco. Last night's flight out was no different. I was able to fix a problem with Eclipse that was preventing my project from deploying locally into my Tomcat server. Now my development environment is stable again, and the logjam i was stuck behind has been cleared. I did a small (compressed) happy dance as this was fixed somewhere over New Jersey, getting a strange look from the fellow in 1A, but I was seriously happy. On to pillage!

Posted by dbs at 11:48 AM | Comments (2) | TrackBack

May 7, 2006

JRemoteforMyth Released

Folks, family, and friends may have noticed I've been fairly absent from posting, chatting, and general socializing for the last few days. A chunk of this mysterious quietness can be attributed to digging my fingers into a coding project I've been thinking about for a while.

I've just released JRemoteforMyth. This is a webstart-enabled app for folks who tend to hang around on their laptops or desktop machines, with a MythTV box nearby. It allows for a small 'remote' application to sit on their desktop and control the Myth box remotely via normal "up" "down" "enter" buttons.

There were a number of challenges writing this. I haven't written Swing applications in a few months, and I'll be needing to get back in the saddle shortly for some consulting work I'm doing. This was a great 'simple' defined application I could whip up that had a fairly definite design, goal, and completion metric.

The second challenge was this was my first full webstart-enabled app written entirely inside Eclipse. For the most part, this didn't present any particular problems, and went quite smoothly. I'm still ecstatic about Eclipse' SVN and CVS repository integration. Using CVS to hold my working files, I was able to switch from my laptop to my desktop machine with only a Project->Team->Commit on one machine, and a Project->Team->Update on the other. Yay!

Last but not least, a grump. When writing a Webstart enabled app, the resulting 'jar' file that containst he app is published onto a webserver, and the JNLP descriptor file tells webstart well to download it. Webstart, however,will only install and run 'signed' jar files. Eclipse provides no mechanism for signing jar files internally. It can generate the jar file for the application, but several command line tools need to be run to actually sign the file. Very annoying.

I've announced the app to the mythtv-users list, and I'm seeing downloads, so SOMEONE is interested in it.

Next will be some basic enhancements to it, adding things like keyboard entry, an multiple tabs so the 'keypad' can be displayed along with normal navigation keys.

Posted by dbs at 9:24 AM | Comments (0) | TrackBack

May 3, 2006

Coding horrors from the past!

It's nice to be back into coding for a while. Of course, one of the drawbacks is coming across code written over half a decade ago that should never have seen the light of day. Take for example this gem I ran across while continuing with my updating Keystone project...

$pq = db_query("select dtable,dcolumn,dflags from dictionary $wclause");
while ($pd = db_fetch_array($pq)) {
        $varname = "op_$pd[dcolumn]";
        eval("\$oval=\"\$$varname\";");
        $varname = "sp_$pd[dcolumn]";
        eval("\$sval=\"\$$varname\";");
        if (empty($oval)) {
                        $oval=0;
        }
        $active = $sval ? "1" : "0";
        $subtable = ($pd[dtable] == $proptable) ? '' : $pd[dtable] ;

It's been said there's a special hell for people who write code that uses the eval statement in production code. Apparently I'm headed there already. This was a very bad coding decision, but I remember actually writing this particular snippet. It was around 1998, and I was flying to California to talk with the company that would eventually buy Keystone from me. I seem to do some of my best coding work while flying on airplanes, though this sample isn't exactly a sterling example of it. It did, however, enable one of the cooler features of the product - the ability to, using any of the various data sets, set up a custom browse view based on the structure of the table.

Using 'eval()' statements and depending on global variables was NOT the way to implement it though. Now that I'm converting all 12,000 some odd lines of Keystone code over to support running on a system that doesn't have register_globals enabled, it was time to update this particular code snippet. It took a good 1/2 hour to figure out exactly what it was doing, but once I did that, it was a simple change to:

            $pq = db_query("select dtable,dcolumn,dflags from dictionary $wclause");
            while ($pd = db_fetch_array($pq)) {
                $oval = $_POST["op_" . $pd[dcolumn]];
                $sval = $_POST["sp_" . $pd[dcolumn]];
                if (empty($oval)) {
                    $oval=0;
                }
                $active = $sval ? "1" : "0";
                $subtable = ($pd[dtable] == $proptable) ? '' : $pd[dtable] ;
              }

Don't see much of a difference? It's a big one from a code security and design standpoint. Don't sweat it too much, it means a lot to me at least.

The conversion is moving along nicely though. I think I can have eval versions ready for folks to test out within a day or three, if I keep this pace up. I'll be curious to see what sort of response I'll get on the net to the system. It's been a while.

Posted by dbs at 1:12 AM | Comments (0) | TrackBack

May 1, 2006

Dusting off the Old

Back in the dark ages, I wrote a very successful ticketing system called Keystone. This was a successor to another reasonably successful program called PTS, which I wrote while working at Fidelity using this new fangled thing called 'PHP/FI'. Online ticketing systems were still something of a novelty, and none existed in the opensource world (save for GNATS which, at the time, was an abysmal piece of code.

PTS, and later Keystone - flourished. In the dotcom runup, Keystone was a hot item. Whenever I posted a new version and announced it on Freshmeat, I would see thousands of downloads of the updated package within days. At conventions, I was well known. "YOU WROTE KEYSTONE? HOT DAMN!"

Alas, the dotcom era came along and an opportunity to sell Keystone dropped into my lap. I took it, along with a sizeable check, in exchange for an agreement with the new owners, that they would continue to support the product, as well as let me continue working on it.

Neither of these things actually happened. When the bubble burst, the owners found themselves holding a piece of software that they were not using, and still owed money on. The crunch came, I called in the debt, they couldn't pay, so the entire system reverted back to me, lock stock and copyright, in exchange for me foregoing the outstanding balance.

On the one hand, yay, I got my program back. Hard to argue with that. On the other hand, 2 1/2 years had passed. The new owners had not touched the code, the industry had advanced a LOT in that time, and the competitors, which had excellent products at the time of the buyout, now had a 2 1/2 year jump on me.

Keystone languished.

Over the last few months, several people have been poking me about the code. Some clients have been running versions for YEARS, and are asking if there are updates coming. Others would like to set up new installations. I've half-heartedly worked on updating Keystone off and on a few times, but never really finished the changes into something I could release again.

Tonight I spent 2-3 hours dusting off the old code and continuing the updating process. Files with revisions half a decade old are coming up in my editor, with me vaguely remembering even writing them. But, the system works. It has some interface designs that I still find intriguing and useful, as well as it's share of "WHAT WAS I THINKING?!?!?" elements. Like an old friend, though, the motions and patterns started up again - edit, save, flip, reload, flip, edit more... a dance step long disused, but not forgotten.

I fixed 4 bugs reported by the new users, committed and posted the changes, and updated the users' vhost. Fixed. Problems brought up and addressed. Happy users.

I remember this.

It's nice to be back with you, my old friend.

Posted by dbs at 11:47 PM | Comments (0) | TrackBack

April 12, 2006

Today in the Book of Why

Friendzzzz, open our K&R to page 32, psalm 12. Today we shall recite from the Book of Why, wherein all manner of faults in life are exposed for cleansing...

Let us begin...

  • Why... did my MythTV primary volume kick the bucket just at the point where I'm ready to start working on some code to interract with it? We thank the powers at Maxtor for not taking the half a terabyte of other storage with it during it's death throws. Amen.
  • Why... does the Linux kernel decide to number ethernet ports, particularly wireless ethernet ports, in a totally arbitrary way? Booting up may provide us with the mysteries of eth1, or perhaps today it's eth2, or even something like eth1_someoddtext. Amen.
  • Why... is the Eclipse WTP project, such an awesomely wonderful and fantastic environment, be occasionally revealing itself as 'not -quite- 100% stable', particularly when I'm in the middle of convincing a client to use it? Amen.
  • Why... does the Bluetooth stack on the Treo 650 suck so bad? Simple requests for OBEX services cause the phone to crash and reboot. Connections to it are spotty at best, and it offers NO services up to a remote requestor. Makes it very hard to say "Please get my photos off my phone." It is safe to note that almost every other Bluetooth phone on the market today at least provides a Bluetooth FTP service. The Treo doesn't even have decency to say "no services", it simply drops the connection. Amen, dammit.
  • Why... is there no easy way to hit the Tab key in Firefox in a textarea, and have it generate a Tab? Amen.

We shall ponder these life puzzles as we ommm around the coffeemaker and await enlightenment via it's gurgly goodness.

Posted by dbs at 9:52 AM | Comments (5) | TrackBack

February 17, 2006

New Java Tool - JarIndex

I was getting tired of having problems when building Java apps that required a certain library to be on the classpath or imported into the current app. Another site on the net had a simple lookup mechanism, but that site has gone to a paid subscription model. That just seems silly.

Enter JarIndex

The idea is if you get a compiler error like this:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/wsdl/OperationType
at org.apache.axis.description.OperationDesc.(OperationDesc.java:59)
at org.apache.axis.client.Call.setOperationStyle(Call.java:650)

You can just go to JarIndex, enter 'javax/wsdl/OperationType', and JarIndex will tell you what library that class comes from. Add it to your classpath, and you're back into happy compilation mode!

If you program in Java, check it out, let me know if there's anything missing!

Posted by dbs at 1:11 PM | Comments (0) | TrackBack

February 2, 2006

Good Programmer. Have a biscuit!

Occasionally, an application does something unexpectedly right.

I've switched to using KMail as my primary mail client in my continued immersion into All That Is KDE. So far it's a capable, well performing, surprisingly robust IMAP mail client.

This morning it surprised me by doing something unexpectedly pleaseant. I was editing / writing a new mail message (new window open, everything) when I realized i hadn't set an identity for sending mail to this particular group. I use identities so a copy of my outbound mail is saved into the same folder I use for that list). So i flipped back to the main window, went to identities, set up a new one, and went back to my new message editor. Without really expecting it to be there, i clicked the down arrow on Identity, and lo, the new one was there.

I had expected needing to save a draft and re-run the editor to have it 'reload' the identities, but KMail just did the right thing and had it all set up for me on the fly.

Sometimes. Occasionally. Programmers do neat stuff.

Posted by dbs at 8:47 AM | Comments (1) | TrackBack

January 25, 2006

My Daily Conversations with Eclipse

Having now converted my development environment to Eclipse, I'm going through the normal growing pains associated with going from a total command line "edit, save, exit, compile, look at error, re-edit..." cycle to a totally integrated interactive IDE. The last immersion I did in this type of environment was using Turbo Pascal 7 somewhere back in the mid 90's.

Mostly it's going okay, but I'm sort of entertained at the 'compile on the fly' functionality that Eclipse has. Errors are shown immediately, not at compile-time, so you can see the state of your app at any moment. I just find some of my conversations with Eclipse amusing. The 'Problems' pane at the bottom of the screen shows the current state, and I feel like I see this sort of convo happening all the time:

dbs - typeitytypetyptyp type type. think. typetype

eclipse - Warning: variable foobar is never used.

dbs - yes yes, i know. I'm still working on it.

eclipse - Warning: you type too slow.

dbs - You're not helping.

I'm sure it's only a matter of time before the "Dave. Your code is absolute garbage." HAL-like plugin will be available.

Posted by dbs at 12:05 PM | Comments (3) | TrackBack

September 16, 2005

What I do...

In the midst of hyper-geekery today, Barb msgs me and asks what I'm working on.

So I answer...

publishing WSDL-driven servlets into an Axis environment to expose J2EE stateless session beans' methods via webservices - then i don't have to have the client apps deal with JNDI and RMI calls directly to the jboss server, they can just use SOAP calls, browsing via wsdl.

And just realized how much that looks like total gobbledygook. No wonder I sometimes feel like I'm in my own little world.

Posted by dbs at 3:40 PM | Comments (1) | TrackBack

September 15, 2005

Mambo patching - a brief interlude

So one of my many hats involves helping out running the Arisia website. We changed the site over to being managed by Mambo several months ago, and have been 'mostly' happy with it, though it has its quirks.

One quirk raised its head today. We couldn't upload files via the media manager other than graphics and pdfs. One of the users wanted to punch up a preformatted HTML page, and the system was not allowing it.

After digging around the code, I found the culprit. The system was hardcoded to only accept certain extensions, and I have to admit, the code that did it was... er... painful:

if ((strcasecmp(substr($file['name'],-4),".gif")) && (strcasecmp(substr($file['name'],-4),".jpg")) && (strcasecmp(substr($file['name'],-4),".png")) && (strcasecmp(substr($file['name'],-4),".bmp")) &&(strcasecmp(substr($file['name'],-4),".doc")) && (strcasecmp(substr($file['name'],-4),".xls")) && (strcasecmp(substr($file['name'],-4),".ppt")) && (strcasecmp(substr($file['name'],-4),".swf")) && (strcasecmp(substr($file['name'],-4),".pdf"))) {

Ew. Just. Ew. Bleah. Ick. In the immortal words of Tim Allen... "So I rewired it!" :

# The valid file extension list is:
$validList="fluff|gif|jpg|png|bmp|doc|xls|ppt|swf|html|htm|rtf|";
$fileInfo = pathinfo($file['name']);
if (! strpos($validList,$fileInfo['extension'] . '|')) {

Muuuuch better. This patch goes around line 139 of admin.media.php, if folks are looking for an update.

Posted by dbs at 12:39 PM | Comments (5) | TrackBack

August 30, 2005

Java JNDI + Jboss + ssh help wanted!

Well, I'm stuck on something. If you or someone you know is a JBoss guru, they should take a look at this posting and see if you or they can offer any help. I'm stumped. :(

Posted by dbs at 5:15 PM | TrackBack

August 29, 2005

Does this make ANY sense?

I'm not a computer scientist. I didn't go to school to get letters by my name to learn how languages are built and designed, and I never wrote a compiler in my life. I'm just a fairly high end programmer who writes in high level languages, and builds large applications.

I'm certainly a big user of PHP - less so recently, but since Claimit is written in it, I've been getting my wheels back on it.

But, occasionally I run across design decisions that just don't seem to make sense. Case in point, the 'asort()' function. It sorts an array, in this case backwards (as opposed to sort). One would assume you'd use it like this:

$sortedArray = asort($oldarray);

Not so! This function works, does not throw any errors, but the resulting value in $sortedArray is 'true' (or '1'). The asort function returns a BOOLEAN value (successful completion of a sort??) What actually happens is the asort() function reorders an existing array. So in order to have a new version of the array sorted, or to sort the result of a function call, you use this tortured syntax:

asort($sortedArray = $oldarray);

In my case, I'm actually sorting the returned array from a function call, so we have:

asort($sortedArray = getFiles())

I understand this is a Perl-ism. That doesn't mean it has to be perpetuated further on the masses. Ick.

Posted by dbs at 12:43 PM | Comments (3) | TrackBack

June 10, 2005

Java JBoss Geek Trick du jour

I'm doing a lot of work in JBoss, and one of the bugs I've run into is that if an applications initial deployment fails, JBoss refuses to un-deploy it. It throws this error when you try to redeploy the app (in this case, the app is called 'app1' and is deployed as an EAR file) :


23:19:23,054 ERROR [MainDeployer] Could not initialise deployment: file:/home/dbs/jboss/jboss-4.0.1sp1/server/default/deploy/app1.ear
org.jboss.deployment.DeploymentException: Error in accessing application metadata: ; - nested throwable: (javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EARDeployment,url='app1.ear' already registered.)

Sometimes restarting JBoss appserver from scratch will fix it, but only if you've remembered to delete the .ear file before restart.

JBoss comes with a great little tool called 'twiddle'. It sends commands via JMX right into the appserver. You can force an app to unregister right from the command line:

twiddle.sh unregister jboss.j2ee:service=EARDeployment,url='app1.ear'

Voila :)

Posted by dbs at 11:26 PM | TrackBack

May 24, 2005

The J2EE vs .NET argument

I've had a couple conversations with people regarding .NET vs J2EE as a choice for application development and deployment. From a purely technical standpoint, the two technologies are very similar. The tools are powerful and detailed in both environments, and the end result is a distributed, object-based application platform.

But to me, taking the 'C# is just like Java' argument doesn't actually address the underlying problem of a Microsoft vs Not-Microsoft solution. It took me a bit, but I think the best way to summarize it is thus:

The purpose of C# and .NET is to make money for Microsoft in tools, platform, and training sales. The purpose of J2EE is to get the job done. No one automatically gets rich when you decide to use J2EE as a platform. Which would you rather invest your time and money in, something where everything from the operating system on up to the deployment tools cost money, primarily to Microsoft, or a platform where the entire system can be designed, developed, distributed, and deployed on free software with the same level of stability and functionality? If support and training is important to you, then pay the people who know best to train you and support you, but you should not be charged just for your choice in platform.

So there.

Posted by dbs at 1:12 PM | TrackBack

April 20, 2005

Web Developer Firefox Plugin

I do a fair amount of 'web development', meaning I tend to write things that are viewable via a web browser. Whether they're posted on my blog, or on other sites I sometimes maintain, generally my preferred 'user interface' is a web browser.

I've been using a plugin for quite a while called "Web Developer Extension". It's a set of tools that integrates tightly with Firefox and lets you do all the things a web developer needs to do to make sure his or her application is displaying properly.

The most useful feature I've found is 'Outline block elements' and 'Display ID and Class Detail' - these functions change your displayed page and draw lines around all your block level elements (such as 'div' and 'table' and 'span'), and can also label them with what class and ID they are.

When dealing with multiple nested CSS elements, this sort of display can save HOURS trying to track down what element belongs to what container, particularly when working with content management systems like Movable Type.

The plugin is non-intrusive, and is only triggered when you select it off the menu. I can't imagine doing web development without it.

Posted by dbs at 12:10 AM | Comments (1) | TrackBack

CSS noodling, PHP coding, and other geek fun.

I've just arisen from my death-like existence for the past 2 days, and it appears I've just about shaken off the evil cold that has had me in it's grips since Sunday night. I wasn't even able to read email for more than 5 minutes without getting woozy. Talk about tragic.

So, in a burst of "I'M BACK!" I've done a bunch of LONG needed updates to Planet-Geek and the MT Comments Counter:


  • Fixed the Comments preview function so it actually renders properly.
  • Revamped the color scheme in the individual archive view - so comments and their authors are no longer in that weird green tint. Not sure what I was thinking there.
  • CSS layout on individual archives and the main page were blocked wrong so it was very easy to have the 'links' sidebar disappear, relegated to the bottom of the page. This should be fixed so that sidebar will only move if you make your browser VERY narrow (comments on this please, I'm only evaluating wit