Real Artists Ship

Sat Feb 26 15:18:46 EST 2011

Tags: gcd projects

Getting Crap Done checklist:

  • iCalendar feed? Check.
  • Email reminders? Check.
  • Basic mobile support? Check.

I have a couple more little things I'd like to add and some UI changes I'll no doubt make, but I'd call the quick development of GCD a success. Which is good, since the idea is to get me to do stuff, and quickly.

So what's next?

The big thing is to get Raidomatic, my new guild forums and raid composition tool, released and into use. It's mostly there, but there are little problems to take care of and a couple small features I should add before release. The vital thing will be to get it out there - I can add any other big features (like sorting loot rollers by how proper the item is for their spec) in later revisions.

After that, I want to make a Mac client for GCD. It's not like the site is screaming out for native clients, but I want to learn Cocoa programming and nothing helps learning a new environment more than having a very explicit and attainable goal to reach.

In addition, I've got a family-company web site to work on. Between that and the other couple things I have to do, I should be able to keep myself pretty busy for a while.

Dirty and inefficient (but programmer-friendly) SQL queries in XPages

Thu Feb 24 18:39:39 EST 2011

Tags: sql xpages

If you spend enough time working with XPages, you're eventually going to want to access some SQL data, either because of an integration project or because you just want to. It's pretty well-trodden ground, but, in one of my recent projects, I came up with an approach I rather like.

Now, before I get into it, fair warning: this is not scalable, efficient, or good programming practice. This is for when you just want to do a quick query and get back data in a usable fashion. It doesn't handle paging properly and it can easily stomp all over separation of concerns. But if your needs are simple, it may do the job perfectly.

Basically, the problem I had was this: I want to do a couple quick SQL "select" queries on an XPage, but I got tired of writing out similar "stmt = conn.prepareStatement(...); stmt.setString(...)" stuff over and over. Ideally, the solution would be to abstract it all away, but it was a small page deserving of a small fix, so I wrote myself a function:

SQLTools = {}
SQLTools.fetchQuery = function(query, args) {
args = args == null ? [] : args

var stmt = SQL.getConnection().prepareStatement(query)
for(var i = 0; i < args.length; i++) {
    stmt.setObject(i+1, args[i])
}
var rs = stmt.executeQuery()

var cols = []
var meta = rs.getMetaData()
for(var i = 0; i < meta.getColumnCount(); i++) {
    cols.push({
        name: meta.getColumnName(i+1),
        type: meta.getColumnType(i+1)
    })
}

var result = []
while(rs.next()) {
    var row = {}
    for(var i = 0; i < cols.length; i++) {
        row[cols[i].name] = rs.getObject(cols[i].name)

    }
    result.push(row)
}
return result

}

The actual job of connecting to the SQL DB with the right driver is handled by a Java bean called SQL - the aforementioned link covers that part pretty well. What makes this code different is how easy it makes a quick query with some interleaved parameters and how useful the resultant value is for standard XPage controls. For example, you could do a search like this...

SQLTools.fetchQuery("select firstname,lastname,degree from people where age > ? and lastname like ?", [30, "%son"])

...and you'd get back an array containing column-keyed hashes. Your XPage doesn't have to care about ResultSets or ".getString()"s or anything. You could end up with relatively clean code like:

<xp:repeat var="person">
<xp:this.value><![CDATA[#{javascript:
SQLTools.fetchQuery("select firstname,lastname,degree from people where age > ? and lastname like ?", [30, "%son"])
}]]></xp:this.value>

<xp:div><xp:text value="#{person.firstname}"/> <xp:text value="#{person.lastname}"/>, <xp:text value="#{person.degree}"/></xp:div>
</xp:repeat>

That's probably not a final product for displaying the information, but it gets the point across - it's a pretty clean traversal from "I want to query the database" to having XPages-friendly Server JavaScript objects.

Ready For Use

Wed Feb 23 11:18:41 EST 2011

Tags: gcd

Well, Project One is down: I set up a first draft of my new Getting Crap Done database. I did indeed set it up on Domino, so I didn't have to worry about user authentication, and that helped quite a bit. It's very quick and dirty, using some basic controls and a certain old style I had sitting around:

Getting Things Done: Items

It really does just what I need: keeps tracks of item names, the date or range (now, short, medium, long), and allows for repeating items, plug a big ol' rich text field for generic notes:

Getting Crap Done: Item

Since it's Domino, multi-user functions were a cinch and it was easy to add in some items for making items available for viewing or editing by others, and those fields also handled showing only your items with no chance of stumbling across anyone else's illicitly.

I also added a feed to my home page to keep it in my face at all times. In later phases, I'll add in stuff like RSS feeds and email reminders. More importantly, though, this should help me hold my own feet to the fire on on the other things I need to get done.

Getting Crap Done

Tue Feb 22 10:21:23 EST 2011

Tags: gcd

So I think my first project should be a quick little app to keep track of the things I need to do. This is well-trodden ground and I could easily just pick up a free app to do it, but it should provide a good exercise, and I'll get to do it like I want.

Basically, the way I want to do it is pretty similar to the project-tracking database I wrote for work, or at least the sidebar view I made for it. The basic UI is just a list of things to do with short summaries, categorized by their due date, and icon- and color-coded for status and rushness. In a non-work setting,Ā The former could translate to vague timeframes of "now", "soon", "long-term", etc. and the latter could translate to "importance". I'll also have to work in some support for recurring events, like "pay the non-automatic bills." I don't think I'd need all the categorization I have at work - my personal projects are much looser than the client-driven work ones, so maybe just a tag or two would do the job.

Really, the goal is to just get a list of things that I have to do in my face at all times (or, at least, in a place I will actually check regularly, so maybe I'll have it send me email). I've historically had a nasty tendency to let things drift out of mind, but I'm putting an end to it, and I'll make this app reflect that. I'll use my natural aversion to red "past due" text to keep me going.

I'll have to pick a medium. My default lately is XPages, which is my work development environment, but I'm always itching to try something else. Nonetheless, XPages may win out - if nothing else, I don't want to bother writing a user authentication and DB access system or any of the other "structural" elements that would stand in between me and getting it started. The whole point is to make sure I actually get crap done, after all, not spin my wheels with abandoned drafts.

Gaze Upon My Works

Mon Feb 21 21:26:21 EST 2011

Tags: projects

So I think I need a project to work on.

Back during my education, when I had weeks of time on my hands, I had projects going all the time, the mostĀ prominentĀ of which was my old blogging site. Aside from that, though, I had lots of little things - server admin stuff like setting up mail access, getting Gaim to work on OS X back when that meant using the non-Apple XFree86 build, and my on-again-off-again relationship with building pseudo-filesystems with MySQL in Java, Objective-C, or Ruby.

Then, I started working and actually doing Ā things with my time, and my beloved projects have gone by the wayside. For a while, even when I had free time, I'd be too tired and annoyed from work to do much other than play WoW or watch TV. I've still finished a couple small-time projects here and there, like my new home page when I finally got fed up with my ancient My Yahoo home page, my AIM log parser DB, and a little runeword-tracking app for Diablo II. My big project lately, which has been taking longer than it realistically should have, has been the new forums/raid comp utility for my guild. That's finally just about good to go, which means my spare programming time will be free.

So: what's next? A couple candidates come to mine:

  • Another blogging platform. I've already done this, but I'd love to take a whack at it in Ruby or another modern language, not PHP. I have to admit, though, that (NIH flareups aside) WordPress is doing a fine job.
  • Some just-for-fun apps in Cocoa. I have only a cursory knowledge of Cocoa, and it'd serve me very well to learn how to write Mac and iOS apps.
  • Some stuff in Cappuccino. This would have much the same effect as learning Cocoa, but would keep within my usual web-dev domain (which could be either a plus or a minus).
  • More Minecraft Server work. This could be fun, but I'm getting pretty tired of looking at Java all day.
  • Plugins for Plex. I've recently switched to using my Mac mini in lieu of a proper cable TV subscription, but there are some rough edges. Namely, Plex's YouTube app is pretty feature-light, but XBMC doesn't support Hulu or Netflix. Plex plugins are just Python, though, which is like Ruby if you squint, so maybe I could fix it myself.
  • More WoW stuff. I'm not sure what specifically I'd do next, but there are plenty of places I can improve the forums and raid comp tool.

The important thing, though, is that, now that I've written it down in a public forum, I'll have to do something. All I have to do is decide what, and the rest is an implementation detail.