insomnihack

When sleep eludes, the keyboard beckons

R&D Week One Wrap Up

January 9, 2010 Dale Leave a Comment

Its a new year, and at work, the emphasis is definitely on the ‘new’. I’ve joined a new team, social media, in a new department: R&D. I have a new desk (to be honest, its just a new spot in the cube farm), and new operating system: Linux. We’re working with what is for most of the team a new programming language, Python, and a new continuous integration server: Hudson.

Hudson

Hudson is pretty impressive. I’d never even heard about it before Ed found it last Tuesday. In addition to continuous integration, it can also monitor executions of externally-run jobs. We’re trying to favor simpler cron jobs running scripts over the complex service-oriented architectures we’ve worked with on previous projects, so this is a nice bonus. Hudson comes with a ton of plug-ins that enable it to integrate with SCMs such as git, execute scripts of various languages including Python, and run an assortment of tools including nose, coverage, and pylint (just to name a few we’re using). Hudson is written in Java, and it is pretty easy to set up.

VMWare

We’re running all of our Linux systems on VMWare: Workstation 7.0 on our desktops and ESXi on the server. Workstation’s easy install makes setting up Ubuntu 9.10 with an initial user and VMWare toolkit a snap. However, I did notice that for some reason it didn’t install the shared folders driver, so I had to run VMWare tools setup manually anyway to get shared folders working. I still have Windows on my desktop with Visual Studio, IIS, and SQL Server installed in case I have to go back and fix a Studio bug.

Why Python?

The reasons behind the switch from C# and .NET to Python were faster development and easier scalability. I’m not saying we couldn’t achieve scalability with .NET, IIS, and SQL Server. I’m saying for what we’ll be doing, its easier to accomplish with Python, Tornado, and nginx. Since we’re new team, any budget increases have to be earned by achieving specific milestones, so it doesn’t hurt that all of our software tools with the exception of VMWare Workstation are now free.

Small Team

Finally, its really nice to be back on a small development team. I only have to report to one person, so those CC’d email sh*t storms where you’re trying to keep several stake holders informed of your status is no longer an issue. The other two developers I work with are on either side of me and both highly skilled, so most design and implementation discussions are usually resolved pretty quickly. We even pair programmed a few days last week. It was occasionally frustrating as everyone gets up to speed on Python, but there was definitely value in it. We’re being pretty aggressive with our milestones, so I don’t think we’ll be pairing all the time.

Programming Linux, Python, tools

C# XML Comments – Tools of the Trade

January 2, 2010 Dale 1 Comment

A few months back, someone at work commented on the amount of XML comments in my C# code. I admit, I do tend to prefer more comments in my C# code. Unless I’m working on the quickest and dirtiest of throw-away apps, I try to comment my classes as if they were going to be used as a framework by other developers. I find that the process of creating the documentation actually helps me focus on what the class or method should actually be doing.

Also, I’ve been on the receiving end of poorly documented code.

Cut the next poor bastard a break and comment your code.

To be clear, I’m not talking about comments in the body of a method itself. I’ve found that if the body of a method requires more than a few comments to describe what it’s doing, that method probably needs to be refactored. I’m talking specifically about the XML comments (or JavaDoc comments in the case of Java source code) of the public and protected members of my non-private classes.

This post describes the tools I use on a regular basis to produce good code documentation. These tools are primarily targeted towards C# developers working in Visual Studio. I may do another post later to describe tools useful for recreating this process in other languages and platforms. If you’re a VB.NET programmer, there’s a good MSDN article on XML comments in Visual Basic you might want to check out.

GhostDoc

GhostDoc is a free Visual Studio add-in originally created by Roland Weigelt. It was recently acquired by SubMain, but they’ve stated that it is their intention to keep it free.

Options screen for GhostDoc

Configuration screen for GhostDoc

Visual Studio 2008 already helps a little with XML documentation by inserting the tags for you when you type three forward slashes (i.e. ///) and hit Enter.

[csharp]
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public string GetName(int id)
{
return string.Empty;
}
[/csharp]

GhostDoc does you one better by filling out the empty XML comment tags with text based on code element type, parameters, name, and other contextual information. The default keyboard shortcut is Ctrl-Shift-D. You can also get at GhostDoc via the context menu.

[csharp]
/// <summary>
/// Gets the name.
/// </summary>
/// <param name="id">The id.</param>
/// <returns></returns>
public string GetName(int id)
{
return string.Empty;
}
[/csharp]

Usually, a bit of modification to the comments generated by GhostDoc is all I need.

Agent Smith

Agent Smith is a C# coding style validation plug-in for ReSharper hosted on Google Code. You need to have ReSharper installed in order to use it. In addition to naming validation and smart paste, Agent Smith provides some valuable features for writing XML commenting including comment validation, re-flow, and spell check.

Agent Smith - Code Style Settings

Agent Smith - Naming Convention Settings

Agent Smith - Spell Check Settings

Agent Smith - Dictionaries

I use this plug-in primarily for pestering me about naming conventions and for the the spell checking. I’ve tried other Visual Studio plug-ins for spell checking, but by far this is the one I like the best.

Programming c#, documentation, tools

Tracking followers with python-twitter

December 25, 2009 Dale 1 Comment

There are a lot of applications out there to help manage your twitter account. Much of what these applications have to offer can be achieved with very little python code. For example, say you want to find out who is following you that you’re not following. Alternately, say you want to find out who you’re following, but who isn’t following you in return. You can find this information out easily with python-twitter and a few lines of code.

[python]
#!/usr/bin/env python

import twitter

if __name__ == ‘__main__’:
api = twitter.Api(username=’username’, password=’password’)
i_follow = api.GetFriends()
follow_me = api.GetFollowers()
i = [u.name for u in i_follow]
f = [u.name for u in follow_me]
i_should_follow = [n for n in f if n not in i]
i_should_drop = [n for n in i if n not in f]

print ‘I follow:’
print ‘\n’.join(i)
print
print ‘Following me:’
print ‘\n’.join(f)
print
print ‘I should consider following:’
print ‘\n’.join(i_should_follow)
print
print ‘I should consider not following:’
print ‘\n’.join(i_should_drop)
print
[/python]

Replace the dummy user name and password and give it a go.

Programming Python, twitter

« Previous Page
Next Page »

About Me

Hi, my name's Dale, and this is my tech blog. Read More…

Search

Tags

blogging c# database Django documentation Email furniture git hacks htpc IPython Linux mac nas packaging PyCharm Python Roleplaying tools twitter unit tests virtualenv Visual Studio vmware Windows

Copyright © 2025 · Equilibre Theme on Genesis Framework · WordPress · Log in