02.22.10
Posted in Software Development at 8:13 am by sam
Poor, neglected blog. Normal life as an Indianapolis software developer just isn’t as exciting to write or read about as three-legged dog-riding monkeys in Belize. Be that as it may, I do have a little something to share with the world today…and hopefully we’ll have more entertaining travel stories in the near future.
Geek Post Warning – those of you who are here for entertainment and are not particularly fond of the geeky software talk might want to skip the rest of this post.
I’ve been doing quite a bit of side development with Google App Engine for Java and the Restlet 2.0 framework as a backend server for a couple of different iPhone projects lately — Google App Engine is badass technology suite for web developers, but more on that some other time. JSON is a pretty important data interchange format for iPhone development, so I tried out a whole bunch of Java-to-JSON and JSON-to-Java serialization/deserialization open source libraries. There are plenty of options and lots of strengths and weaknesses to compare and contrast, but I eventually settled back on the first JSON serialization framework I learned, the JsonPlugin for Struts 2. One problem…I’m doing Restlet work now, not Struts 2. It turned out to be not too difficult to remove the Struts dependencies from the JsonPlugin code, however, and I’ve decided to release my changes back to the open source community under the Google Code project named “json-libre” – it’s the Struts2 Json Plugin code, freed from its dependence on Struts. Head nod to Garrett for helping me come up with a name.
Check it out here: http://code.google.com/p/json-libre/
I’m not crazy about forking projects, so I wrote the Struts Development team to see if they’d be interested in somehow making this part of the normal codebase. If I hear back from them and they’re interested, there’s a chance that this project might get deprecated and moved back into their codebase. For now it’s out there and free for your use.
Permalink
04.17.09
Posted in Software Development at 9:25 am by sam
I had an annoying day of trying to track down memory leaks and other memory-related iPhone development problems yesterday which turned out to be caused by a really simple and careless absence of the word “self” in one of my initialization methods. Observe.
itemId = itemIdentifier;
is definitely not the same as
self.itemId = itemIdentifier;
This is nothing new or earth-shattering. It just can cause you a lot of pain if you aren’t careful about it. The first one is a direct variable assignment. The second is a syntactically nicer way of sending this message:
[self setItemId:itemIdentifier];
Here is the implementation of the really bad initWithItemId:name method that was causing all my pain:
- (id)initWithItemId:(NSString *)itemIdentifier name:(NSString *)nameOfItem {
if (self = [super init]) {
itemId = itemIdentifier;
itemName = nameOfItem;
}
return self;
}
Because I didn’t use the dot syntax, the setter methods for itemId and itemName properties were never getting called, and the ref counts for their variables were not getting incremented. This resulted in them becoming pointers to invalid memory as soon as the itemIdentifier and nameOfItem variables went out of scope and were released by the code that owned them…and that resulted in bizarre functionality and crashes that caused me to grind my teeth, pull my hair, and get angry at myself for taking so long to track them down. No one likes an angry Sam. From now on I will be double-chiggity checking my self.
Permalink
03.18.09
Posted in Software Development at 8:54 am by sam
Whew! It has been a busy couple of weeks. We started, finished, and released to the App Store our first iPhone application and launched a new iPhone consultancy company, Believe in Science Software. Right now it’s all still pretty exciting, so I’m feeling both exhausted and extremely energized at the same time.
The app is called Beatnik, and it’s a simple little auxiliary percussion application that features 21 different instruments.
Get hip to the vibra-slappa, rata-tat-tatta.
Clap it, kick it, crash it, hit it.
Bang a gong and get it on.
Dangle your angle or jingle your jangles.
Beatnik…play it over iTunes…Play it to your own tune…yeah.
Our launch story so far is an international affair with sales in Japan, Great Britain, Ireland, Australia, Canada, The Russian Federation, and the good ol’ U.S. of A. — all in the first three days! The App Store experience is amazing and solidifies my belief that iPhone development is where it’s at.
We have already submitted a new version with significant improvements to Apple for review, so hopefully it will be available within a week or so.
Permalink
01.12.09
Posted in Family, Software Development at 7:02 am by sam
2009 is here. The weather in Indiana is just as depressing as it usually is this time of year: gray skies, brown trees, too cold to enjoy very many non-snowy outdoor activities, not consistently cold enough to keep some snow around. Spring can’t get here fast enough.
Weather aside, though, 2009 is gearing up to be a good one. My sister is planning her wedding, and we’re all pretty psyched about that…looking forward to having a new bro! Our nephew is turning 1 next month. He’s very close to walking and talking, and I can’t wait to talk to that happy little guy and find out what he thinks about all of us and this world. We’re enjoying our work-from-home lifestyle and are hoping that the economy will bounce back and allow us to continue it.
It wouldn’t be a new year without a couple of resolutions. This year I have 2, and they’re both software-related. In fact, they’re both iPhone-related:
1. Release something for the iPhone on the App Store.
2. Start working on a game development engine for the iPhone. I’m just not altogether pleased with the current low cost and open source offerings, which are all ports of existing game engines from other platforms. I think an engine that is written from the ground up in Objective C for the iPhone would be a lot more fun to use.
Here’s to 2009!
Permalink
12.19.08
Posted in Software Development at 4:15 pm by sam
I recently had a cool experience with open source software and the worldwide internet community.
A while back I was working at a giant insurance company that had a history of ginormous development teams and projects that grew way beyond original scope, went way over budget, and were occasionally canceled even after completion because the final product didn’t really end up meeting the users’ real needs. A couple of my bosses had read up on agile software development methods, Scrum in particular, and wanted to give it a try. Our team was pumped, and we found a toolset that would fit well with the agile approach (mostly centered around Trac and Subversion)…almost. We couldn’t find anything to display a real-time burndown chart, one of the key elements of Scrum. I dusted off some Python skills I’d used a few years earlier at a game dev job and learned how to write basic plugins for Trac. One weekend and a couple evenings later we had the ScrumBurndownPlugin. It was a quick and simple hack, but it got the job done. The team flourished under the agile approach. We rapid-prototyped and cranked out an application that was/is valued highly and used heavily by the company’s employees. But that’s not really the point of this story. The point is that I wrote the plugin at home, on my own time, so I was free to do with it what I chose.
I decided to release it to the open source community. I’ve used a ton of open source software in my career, but I hadn’t ever contributed before. I put it out on the trac-hacks.org site, and it didn’t take long until teams of people all over the world were finding, downloading, and using my little plugin to help manage their own development projects. I gotta tell you, that was a pretty fun feeling! That fun feeling, however, came with a new problem…feature requests and bug reports. Now I’m the type of person who tends to over-commit. Besides my real job I always have a half-dozen business ideas to work on, lots of friends and family to spend time with, a huge list of books to read, and a few crazy adventures to attempt. People were using my plugin in all kinds of configurations and setups that I had neither the time nor the inclination to debug. It was a simple weekend hack, and that’s it. This is where it gets cool. When I didn’t jump right into fixing the problems, other strangers started taking care of them for me. Every so often I’d get a code patch and an e-mail explaining how somebody somewhere fixed such-and-such issue or enhanced the plugin in some other way. Usually the fixes were pretty simple, so I’d look the code over real quick and apply the patch. How easy is that? Apparently it’s not easy enough for me because eventually I fell way behind even on applying other people’s fixes. We started using Redmine instead of Trac at my new employer, and I just didn’t have time to test anything.
A few months ago I put a note up on the wiki page for the plugin apologizing for being so far behind and suggesting that I’d like to hand the whole thing over to someone who would be faster/smarter/better at maintaining it. That’s where my new Dutch friend, Daan, comes in. Within a week of my post I got an introductory e-mail from him. He had been one of the people who had previously submitted some patches and upgrades. He explained that he had already made a bunch of feature improvements on the plugin that he was using internally at his company, and it would be a pretty natural fit for him to maintain it from now on. I was sold, and we switched the control over to him within a week. Now the plugin is back on track with a growing user base, Daan and I follow each other on Twitter, and we subscribe to each other’s blogs. How freakin’ cool is that?! Did I mention that he’s from the Netherlands, 2300 miles away? I intend to do a lot more traveling before I die, but so far I haven’t managed to make it beyond North America…and even though I know that this global collaboration thing has been happening more and more for quite a while now, it’s a really fun experience when it happens to oneself.
Permalink
08.07.08
Posted in Software Development at 4:21 pm by sam
Close on the heels of my last post, here’s a little pre-commit script to help integrate Redmine issues with svn commits. The basic idea is that you can’t commit code to the repository without referencing a Redmine ticket. I searched the tubez for quite a while looking for something else like this. I found this forum post, but it had a bunch of shell syntax that didn’t work for me on Dreamhost.
I hereby disclaim that this was a quick hack for me and understand that there is probably a better way to do this. If, however, you’re not passionate about this sort of thing and just want something that works, it’ll do.
I’ve actually got 2 scripts for ya:
The SVN Hook
Copy and paste this first one into a file named ‘pre-commit’ (no file extension), and drop it into the hooks directory of your svn installation. This script will be called automatically by svn whenever someone tries to commit. All it really does is pass the submitted comment string on to our ruby script, featured below.
#!/bin/bash
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
# change to the current working directory
cd `dirname $0`
# svnlook at the comments being submitted with the commit request
COMMENTS=$($SVNLOOK log -t "$TXN" "$REPOS")
# Holla out to a little ruby pre-commit script. if it fails, exit with a return
# code of 1, which means that errors occurred
/usr/bin/env ruby pre-commit.rb "$COMMENTS" || exit 1
A Ruby pre-commit script (pre-commit.rb)
Copy the following code and paste it into a file named ‘pre-commit.rb’. Drop the file into your svn/hooks directory alongside the pre-commit script created above.
#!/usr/bin/env ruby
comments = ARGV[0]
if /[a-zA-Z0-9]/ !~ comments
raise "You must include a comment with your commit."
end
if /refs|fixes|closes\s#([0-9]+)/ !~ comments
raise "You must reference a Redmine issue in your commit comments (e.g. 'refs #1234')."
end
issue_number = comments[/#([0-9]+)/][/([0-9]+)/]
# Change the username, password, hostname, and dbname in the following line
# to match your settings
command_line_output = `/usr/bin/mysql -N -u your_mysql_username -pyour_password \
-h mysql.yourhostname.com your_redmine_dbname -e \
"SELECT COUNT(*) FROM issues I INNER JOIN issue_statuses S \
ON S.id = I.status_id WHERE S.is_closed = 0 AND I.id = #{issue_number};"`
redmine_issue_open = command_line_output[0,1]
if '0' == redmine_issue_open
raise "Issue ##{issue_number} is not in an open state."
end
Whew! That’s 2 techie posts in a row! I’ll try to come up with something more fun for everyone next time.
Permalink
08.05.08
Posted in Software Development at 11:23 am by sam
I recently switched a couple of side projects I had hosted with Dreamhost from Trac to Redmine. The process was surprisingly easy.
Even though the actual migration was easy, it took me a long time (almost longer than my patience would tolerate) to find the command that would do the import of wiki data, tickets, milestones, etc. In an effort to pull another soul out of the time suck that is ‘googling for a quick how-to’, here’s a quick how-to:
I use Dreamhost, but these commands should be adaptable to any hosting environment with an ssh terminal.
$cd your.redmine.subdomain
$rake redmine:migrate_from_trac RAILS_ENV="production"
Trac directory []: /home/.orchid/path/to/your/trac_site
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: mysql
Trac database host [localhost]: mysql.your_hostname.com
Trac database port [3306]:
Trac database name []: trac_db
Trac database schema [public]:
Trac database username []: trac_db_username
Trac database password []: trac_db_password
Trac database encoding [UTF-8]: latin1
Target project identifier []: redmine-project-id
This project already exists in your Redmine database.
Are you sure you want to append data to this project ? [Y/n] y
Migrating components....
Migrating milestones..
Migrating custom fields
Migrating tickets........
Migrating wiki........................
Components: 4/4
Milestones: 2/2
Tickets: 8/8
Ticket files: 0/0
Custom values: 0/0
Wiki edits: 24/24
Wiki files: 1/1
The import works pretty well. The only big thing I noticed missing so far is “reply-formatted” text in the wiki page:
> wiki text that begins with a greater-than sign to indicate e-mail
> replies did not get imported.
Hope it’s helpful!
Permalink