DevelopmentNow Blog
 Friday, May 04, 2007
Dan North has a nice intro to BDD over on his site. BDD = Behavior Driven Development, an evolution of TDD (Test Driven Development). He also has some other blog posts about BDD that help illustrate the difference between BDD and TDD and explain why BDD isn't just TDD with prettier names.
May 4, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Tuesday, May 01, 2007

I've been doing some work with full-text searching in MySQL lately & came across a few solutions that could really use a wiki. So I wanted to recommend a free, hosted wiki solution, but the only one I've used is Wikispaces (which IME is slow & annoying). But I learned/read about a few others, so here's a short list of free, hosted wikis, in case your community needs a wiki, but you don't want to bother with installing/hosting one yourself:

There are many others, of course -- wikipedia has a big list of wikifarms showing which ones are free. The biggest risk in using a third party wiki IMO is that they have your data, and if it's a free plan and/or a small company, what guarantee do you have that your content won't go "poof" one day & disappear? Oddwiki (one place you can get a free wiki) even tells you

"Nothing is permanent. Use at your own risk. We plan to delete all wikis that were not edited in 180 days"

Heh. So, that's one reason I'd go with a bigger provider if you don't feel like installing your own wiki (which is pretty easy to do if you have a server you can install one on).

 

Hosting | Web
May 1, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Wednesday, April 11, 2007

I've been trying to do more meeting and networking here in Portland, OR, and I also enjoy a good cup of joe. And I need to get more anyhow since I work from home. So when I read some posts about Open Coffee Club, I thought that sounded like a great way to interact, socialize, & meet some of the other web-centric folks in PDX.

"The OpenCoffee Club was started to encourage entrepreneurs, developers and investors to organise real-world informal meetups to chat, network and grow."

Since there wasn't one listed for Portland, I decided to register an Open Coffee Club for Portland. If you're in the area, feel free to swing on by. I'm not yet sure when the best time/place to hold the meetings is, but I figure that can be ironed out.

April 11, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Tuesday, April 10, 2007

I may have mentioned before that I'm doing a LAMP project these days (among other things). As I go along I'm taking notes on various tasks, etc. so I figured I could post some of them to my blog. Currently the site is hosted on a virtual dedicated server running Fedora Core 4. Anyhow...

Logging MySQL Queries

You may need to turn on query logging for mysql from time to time in order to see what SQL is being passed to the database. Here's how to do so in Linux. This makes some assumptions about directories, so you may need to execute the commands in different places depending on your setup. FYI, I did the following on a Fedora Core 4 distro. Also, if you're running a busy server, your query log will probably get really huge, so be forewarned! I wouldn't leave query logging running all the time, or at least not on a production machine.

Anyhow, shell into your server, log in with an administratively enabled account, and follow the below steps.


Create the MySQL logging file

If you haven't created the MySQL logging file before, you'll need to do so.

First create an empty file with

touch /var/log/mysqlq.log

That makes an empty file. Now change the ownership to the mysql account to it via

chown mysql /var/log/mysqlq.log

Now the mysql user account can write to that file.


Enable MySQL logging

Now you need to stop mysql

/usr/bin/mysqladmin -u root -p shutdown

you'll be prompted for the root password, enter it and mysql will shut down. You may need to hit ENTER after you get the shutdown message in order to get your prompt back.

Now start mysql with logging enabled.

/usr/bin/mysqld_safe --log="/var/log/mysqlq.log" &

The trailing ampersand is important, otherwise you won't get your shell prompt back.

You should see a message about logging and mysql starting. Hit ENTER to get your shell prompt.


Using the Log

You can now run some web sites or do some things that query the MySQL database and the results should be logged.

You can look at the log using vim or other editors. You can look at the last 100 lines of the log via

tail -100 /var/log/mysqlq.log

Note that your log will get pretty big, so to turn off logging, stop MySQL using the shutdown command above, and then start it back up with

/usr/bin/mysqld_safe &


Clearing the Log

You may want to clear your log from time to time if it gets too big. To do first, first make sure that MySQL is not currently logging to the file. You can see if any process is accessing the log by running this command & seeing if anything is returned. If no lines return then nothing is using the log.

fuser /var/log/mysqlq.log

Before clearing the log you could make a backup of it using

cp /var/log/mysqlq.log "$(date +%Y%m%d)-mysqlq.log"

That will create a copy of the log file with today's date in the filename, e.g. 20070408-mysqlq.log

You can then clear the log file using

> /var/log/mysqlq.log

Yes, you type the > in that command. :)


Troubleshooting

If you don't see commands being written to your log, look at the /var/log/mysqld.log log file to see what the problem is.

April 10, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Sunday, April 08, 2007

Well it's been a while since I wrote something, and even longer since I wrote something management-related. So I need to play a bit of catchup.

Programmer To Manager

Before I came to Portland, I was the software development director at ShopLocal, a Chicago-based startup that did a lot of growing, a lot of changing, graduated to medium-business status, did some acquiring, got acquired, and became a popular comparison shopping site, among other things. I was with ShopLocal for over 6 years and started out in 1999 as the (main/only) programmer, working in ASP, VB6, and COM+. The company grew & grew, and over the years I had the opportunity to move up in leadership roles, first as a team lead, then manager, then director.

Towards the end I still considered myself a technical person, but I didn't do any programming, and instead dealt with staff, departments, projects, clients. It was an interesting transition, from programmer to manager, and when I left ShopLocal I thought it would be helpful if I wrote down some of the things I learned and/or struggled with, since I felt that there would be a lot of programmers & other techies who would become managers, some reluctantly, some willingly, some in order to get a pay bump, some to grow professionally, and some in order to stay employed.

Whew. Ok, that's out of the way. Blah blah blah, I wanted to write stuff for new programmer-turned-managers. :)

New Managers Need a New Focus

Anyhow, if you're a new IT manager, and you used to be a programmer or other technical person, you have a new focus and role that you need to bear in mind. I'll just assume you used to be a programmer, but you can mentally substitute in what you used to do.

When you were a programmer, your goal was pretty much to produce code. Your personal technical productivity and effectiveness was the measure of how valuable you were to the company and how well you were doing your job. Sure you mentored others, worked on a team, collaborated on things, etc. But at the end of the day, it was mostly about how well you could produce.

As a manager, it's different. The technical productivity and effectiveness of your department (or team, or group, or whatever) is the new measuring stick. You are judged on how well your team does as a whole -- your personal productivity doesn't matter.

Your personal level of technical productivity is of secondary importance. I can't stress that enough, because many new IT managers (myself included) go through a phase where they're trying to "be a manager" but also crank out code, and they sometimes find themselves doing programmer-type tasks because they are "better at it," or they're the only one who knows how to do it, or it's fun, or it's "only an hour" of work, or whatnot. Don't fall into that trap.

To be a good manager, you need to make sure that your department is producing at optimum level. If you're still cranking out code at a rapid clip, and everyone else in your department is under-utilized, or coding slowly, or putting out too many bugs, you have failed. It doesn't matter if your personal code output is stellar.

Your Department is Like a Web Server

Think of it in terms of multithreaded applications, e.g. a web server. Web servers get tons of simultaneous hits, and their output is measured in requests per second. In order to have a fast web application, the total output of all involved threads is what matters. If you have one thread that's really fast, and all the other threads are dog slow, that's not as effective and scalable as if all threads are decently fast, but you can scale out to dozens or hundreds of threads.

You should keep that in mind as you ponder the question, "now that I'm promoted to manager, how can I be even more valuable to the company than before?" Because that's the truth -- you got promoted, and the last thing your company wants is for the IS department to get worse (other than an initial adjustment period). The irony is often really good programmers have an opportunity to get promoted to managers, which can be a big initial blow to the team's productivity. So to be a successful programmer-turned-manager, how can you help the company produce even more software before, when you're no longer coding as often or at all? The key of course is to ensure that your staff becomes more productive. Think of your staff as the threads of a multithreaded application, and work on ways that each of them can be more effective.

That may be harder than you think. If you were a good programmer, think about why you were good. Was it because you typed quickly? Was it because you knew the API and coding environment? Were you good at managing scope and detecting pitfalls ahead of time? Did you estimate well? As a manager, you'll have an opportunity to teach your staff some of your tricks. Plus, you'll probably be involved in projects enough to still utilize some of your skills (e.g. detecting project pitfalls).

Ok that's probably enough rambling for now. Remember, you are now orchestrating a multithreaded application, and your goal is optimimum combined output. Don't worry about the performance of a single thread (e.g. you) if the other threads (e.g. your staff) are doing poorly or average. Instead, focus on ways to make most or all threads better. You can cherry pick caveats to this, but you need to focus in the right direction first.

April 8, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [1]



 Friday, March 23, 2007

I've been using Webmin to manage my Linux server, but I wanted the backup files to be timestamped so that subsequent backups didn't overwrite them. Since I didn't see an option for that, I created a simple Linux shell script that will prepend a timestamp to a filename. So for example, if the shell script is called stamp_file, then running the command

./stamp_file /var/backup/apache_config_backup.tar.gz

will make a copy of /var/backup/apache_config_backup.tar.gz file, and call it something like like /var/backup/20070323142367-apache_config_backup.tar.gz. Note that the original file is maintained, and that the copy starts with YYYYMMDDhhmmss.

Anyhow, here's the script

#!/bin/sh
# timestamp a file
# args: <fullfilename>

echo -e "\n\n"

# check arguments
if [ $# -ne 1 ]; then
        echo -e "Usage: $0 <fullfilename> \n\n"
        echo -e "e.g. $0 /var/backups/apache_backup.tar.gz \n\n"
        exit 127
fi

echo -e "Timestamping $1 \n\n"

# get file, directory, and new filename
fname=$(basename $1)
newname="$(date +%Y%m%d%H%M%S)-$fname"
dname=$(dirname $1)

# make a copy
cp -vf $dname/$fname $dname/$newname

echo "\n\nDone, created $dname/$newname\n\n"

Now for all my backup tasks I can just run the stamp_file script to make sure that I don't overwrite older backups, which means I can do daily or weekly backups & go back in time when I need to. Ideas for future expansion might be to have the script make folders for each month, copy the backups into those.

Linux | Tools
March 23, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



This was inspired by a form post over in startupping, where people were discussing doing projects in ASP.NET or PHP (specifically, LAMP: Linux, Apache, MySQL, and PHP).

I do both ASP.NET (.NET 2.0, C#, SQL Server) & PHP development (LAMP). PHP is pretty easy to pick up (especially if you've programmed in classic ASP), and there's a lot of information, libraries, etc. out for it. For an IDE you could use Zend Studio ($99-$300), PHP Designer ($50+), or free ones like SciTE or PSPad (both are good).

If you just want to try out some PHP development, I'd suggest getting a cheap hosting account from GoDaddy, Dreamhost, or somewhere else. Or even e-rice.net ($10/year). While you could install Linux locally & play around with shell access & administering Linux, Apache, MySQL, and PHP, you could end up spending a lot of time being a Linux sysadmin -- time that you could have instead spent strengthening your PHP & MySQL skills. One step up from a cheap hosting account would be to run LAMP as a virtual machine by downloading the free VM player and ready-to-go LAMP packages.

Once you get beyond coding some basic stuff, you may want to look into better PHP frameworks to help accelerate your development. I like Code Igniter, but here's a list of other frameworks you can read about.

FWIW, I develop in both environments b/c I have a range of clients & projects w/ different needs. One of my current projects is a site that includes a lot of features (social networking, wiki, CMS, data management), but the client wanted to leverage existing open source libraries & avoid building everything from scratch. So LAMP was a natural way to go. Other clients are Microsoft shops, so they want .NET apps built that their existing IT staff can take over.

Like any project, I think deciding on a technology involves many factors -- how skilled are you in it? Do you want to learn a new technology? What does the technology cost? Are there things about this technology (language features, environmental features, pre-existing libraries & applications) that will help the project to be more successful?

Lastly, if it's costs that you're concerned about, IMO Microsoft projects aren't as expensive as some may think. You don't need to spend a lot of money on the IDE -- there are cheap or free IDEs you can develop in, or (if you qualify) you can enroll in the MS Empower for ISVs program for $375, which gets you an MSDN Universal license w/ OSes & dev tools. The .NET framework is free, and you can run IIS on XP Pro. SQL Server Express is free & has (almost) all the features that you'd be using in SQL Server Workgroup/Standard/Enterprise. I have a client that didn't have a very large database, so their production site runs on SQL Express.

Also, if you're using a hosting provider for your site (which you usually should), choosing a Windows OS & SQL Server for your hosting account isn't usually significantly more expensive than Linux.

Still, obviously LAMP is cheaper (free, unless you pay $$ for a better IDE), and Microsoft costs can add up if you're looking at big server farms or are buying your OS & SQL Server licenses outright (for some reason). But of course switching frameworks has its own cost in terms of time & mistakes made while learning. If I were building something simple from the ground up, I might just choose the platform I was strongest in.

March 23, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Tuesday, March 13, 2007

I've been having some issues with a hosting provider getting HTTP Compression set up correctly for ASP.NET pages in IIS. It's not hard to set up, but you need to do it using command line tools, not the IIS Management Tool. Thus it's probably not well-known, and possibly viewed as an unsupported hack by some hosting companies.

Believe me, when you're working with a hosting provider, you don't really want to do too much stuff that they don't support. Otherwise, if anything goes wrong, they'll say "well, of course you're having problems, it's probably because you're doing that crazy unsupported stuff."

So I was worried that I'd never get HTTP Compression running for this ASP.NET site, when today I ran across this HTTP Compression module from Ben Lowery that you can literally drop into your bin directory, add a few things to your web.config, and shazam! your ASP.NET pages are compressed. Now that's frickin awesome. And it's free & open source. And it seems to work.

So...if you have an ASP.NET site that you'd like to try compressing, and you either can't or won't configure compression in IIS, give Ben's module a try. Note that compression uses up CPU, so if you're using shared hosting, you should probably use the deflate algorithm on the low setting to minimize the CPU usage. And even that might be too much CPU utilization -- you'll have to see.

Also one thing I noticed ... the high/medium/low compression settings only affect deflate, not gzip. :/

Edit: well, looks like it's somehow corrupting the AJAX return calls in Anthem. Or, trimming out most of the JSON. Or something. Anyhow, the non-AJAX pages seems to work pretty well, but I'll test it a bit further. I like how to can specify URLs & mime types to not compress, although the ability to provide a regex to skip compression on would be nice.

March 13, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [1]



 Friday, March 09, 2007

Brian Benzinger put together a big list of developer-oriented sites listing things about project collaboration, code control, bug/issue tracking, etc.. Basecamp is of course on there, but I saw a bunch of new sites that seems interesting.

His post merges well with this one.

March 9, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]