tadhg.com
tadhg.com
 

Posts concerning coding

Public Projects, Finishing Things, and bitbucket

11:46 06 Apr 2010

I’ve been writing Python fairly steadily for the past couple of years, and a significant amount of that has been for my own projects; Python is what I tend to use to scratch workflow-related itches. That’s great, but many of these projects reach a point short of “finished” when I stop working on them.
[more...]

Permalink     Comment     [, , ]    

Refactoring, Geeky Enjoyment, and Readability

12:16 05 Apr 2010

Refactoring is rewriting source code while preserving the functionality of that code. I’m currently refactoring my Python script for Subversion status, because I want to experiment with sharing code on bitbucket and it seemed like a reasonable first project to put up there.

Some people hate refactoring, but I often enjoy it. I get a kick out of figuring out how to make code “better”, although that’s often a subjective judgment. In this case, when I opened up the script to have a look at it, I immediately saw a function that I knew I wanted to refactor. I’m amused by the enjoyment I derived from making the fairly simple change.
[more...]

Permalink     Comment     [, , ]    

Clearing Growl Notifications

14:43 02 Apr 2010

I use a notification system for OS X called Growl, which provides a single channel for various applications to use when they have something to tell me. I mainly use it for IM and email. I’m fairly happy with it, but one issue that irked me was dealing with clearing a bunch of the notifications off the screen.
[more...]

Permalink     Comment     [, , , , ]    

2010 Goals: First Quarter Review

11:12 30 Mar 2010

Yes, clearly my progress (or lack thereof) needs quarterly reports. And here’s the first one for this year.
[more...]

Permalink     1 Comment     [, , , , , , , , , , ]    

Giles Bowkett on Finding New Programming Jobs

15:52 23 Mar 2010. Updated: 17:58 23 Mar 2010

It’s too long, it’s full of self-promotion, and really it’s an ad for a video he’s selling, but it’s entertaining and contains some good advice: “Programmers: What to do if You Get Fired”.

This might be the best line:

If you’re looking for a better job, writing an amazing resume is a good place to start. I don’t mean just a better resume; I mean a resume that makes people stop asking if they should hire you and start asking if they can afford you.

Annoyingly, I find myself tempted to buy that video after reading his post…

So far, his 2008 presentation at RubyFringe seems pretty entertaining too. Maybe you should watch it after you’ve updated your résumé.

Update: at the end of that presentation, he says “build something because you believe it should exist”, which I agree with 100%.

Permalink     1 Comment     [, , , ]    

A Little More Functional Programming

23:55 25 Feb 2010. Updated: 01:41 26 Feb 2010

After reading Dhananjay Nene’s comment on my post about a functional style approach to the “find longest repeater” problem, I decided to follow the line from that comment and divide the program into functions for finding the longest contiguous block and then for comparing the blocks. Naturally, I wanted to do this without using any variables…
[more...]

Permalink     1 Comment     [, ]    

Minor Foray into Functional Programming

15:56 23 Feb 2010

Last night a friend asked me what functional programming was, and as part of my answer I decided to rewrite a trivial program in the functional style to see what it was like. I did this in Python without using the functional module.
[more...]

Permalink     5 Comments     [, ]    

Some Vim Script Implementation, Testing, and Hackery

23:50 16 Feb 2010. Updated: 00:57 17 Feb 2010

As a result of my porting over jEdit (Jython) macros to Vim, I now have a fair amount of (Python) Vim scripts, and have learned some things about how to set up those scripts. I’ll go through some of that below, and hopefully other people writing Python scripts for Vim will find it useful.
[more...]

Permalink     1 Comment     [, , , , , , ]    

First Post With Vim

20:05 14 Feb 2010

Over the last couple of weeks I’ve been hacking away on scripts to customize Vim, replicating the scripts I made for jEdit. I’m more or less done, and this blog post is being written in MacVim. This hopefully means that when I’m done with it I’ll be able to publish it from within Vim, the same as with jEdit.
[more...]

Permalink     1 Comment     [, , , , , , , ]    

The Python Challenge

15:18 04 Feb 2010

The Python Challenge seems like a good way to have fun with Python through puzzle-solving. As with all riddles, it’s important to read the questions carefully…

Permalink     Comment     [, ]    

jQuery Project

23:36 21 Jan 2010

I’ve been a big fan of jQuery more or less since it came out, and I’m happy to see the launch of The jQuery Project. I’ve used jQueryUI a couple of times and find it fairly useful; I haven’t tried Sizzle yet but it looks great for situations where you’re really concerned about keeping file sizes low but need decent CSS selector support; and I wish QUnit had been around when I was writing a lot of client-side code.

Permalink     Comment     [, , ]    

Better Word Count in Vim

23:40 17 Jan 2010

I’m currently trying out Vim (again), and have made more progress this time, mainly due to Seth’s help. The key things that have made it better:

  • :set hidden. Absolutely critical, this. Stops Vim from complaining when you try to switch buffers and your current buffer has unsaved changes.
  • bufexplorer. Makes switching buffers a lot easier.
  • A better Python syntax file. I didn’t like the defaults.
  • My own indentation and syntax files for reStructuredText.

Really, though, the key first one was :set hidden. Before that I felt that I had completely misunderstood Vim’s file management model.
[more...]

Permalink     1 Comment     [, , , , , , , ]    

Code Katas

17:26 15 Jan 2010

I really like this idea from Dave Thomas: code katas, small pieces of programming practice involving some repetition. I came by it via Katacasts, a collection of screencasts of people doing the katas. I particularly recommend Gary Bernardt’s String Calculator in Python and Vim. (Which has inspired me to try once again to get past the vim file management issues I have.)

Permalink     Comment     [, , ]    

WordPress 2.9 Upgrade

15:56 10 Jan 2010

I upgraded this blog to WordPress 2.9 today, and it appeared to go entirely smoothly. Please let me know if you notice any breakage.

Permalink     Comment     [, , , , , ]    

Python Coding Exercise: Nested Dictionaries

23:54 08 Jan 2010. Updated: 15:26 18 Jan 2011

I’ve been looking at a bunch of coding exercises recently, including the demo for Codility, and recalled an exercise that I came up with as an interview question. It’s not incredibly difficult, but strikes me as a good “real-world” exercise—it’s based on a task I had to perform while working on the discuss functionality for freebase.com.
[more...]

Permalink     Comment     [, ]    

Python Optimization Tips

06:34 05 Jan 2010. Updated: 09:41 14 Jan 2010

I came across these on Hacker News recently, and think they’re worth calling out: Python Speed Performance Tips.
[more...]

Permalink     4 Comments     [, ]    

2010 Goals

08:53 01 Jan 2010

Happy New Year!

Once again, my goals for the coming year.
[more...]

Permalink     1 Comment     [, , , , , , , , , , , ]    

CrossFit and Coding (and Meat)

10:28 31 Dec 2009

In 2009 I achieved some significant things that weren’t on my list of goals, although they’re not concrete achievements in the same sense.
[more...]

Permalink     1 Comment     [, , , , , , , ]    

Some Python Tips and Tricks

05:08 21 Dec 2009

Python Tips, Tricks, and Hacks at Siafoo is an excellent overview of useful Python knowledge. I was familiar with most of it but still think it’s worth reading over. I did learn a couple of new things, too.
[more...]

Permalink     Comment     [, ]    

GPS, URLs, Math, Python, Featuritis

23:53 08 Dec 2009. Updated: 01:43 09 Dec 2009

Earlier this evening Gever suggested a service dedicated to shortening URLs that had geolocation data in them. My immediate responses were that a) this was a great idea, and b) that I wanted the shortened URLs to still be human-readable in some sense—specifically, I wanted a person to be able to look at two URLs returned by this service and have some idea of how close to each other they were.
[more...]

Permalink     1 Comment     [, , , ]    

Open Source Thanks

23:54 26 Nov 2009. Updated: 03:56 27 Nov 2009

It’s traditional on Thanksgiving to list things you’re thankful for. It struck me today that I should be extremely thankful for the existence of free software, and the contributions of thousands and thousands of programmers who have made their work freely available for others to use.
[more...]

Permalink     Comment     [, , ]    

addons.mozilla.org Moving from CakePHP to Django

20:43 17 Nov 2009

This post details why they’re making the move. I find this of interest partly because it’s a move from a very popular web language (PHP) to one that’s become vastly more popular in the last couple of years (Python), and also because Django is the one major Python framework I haven’t tried out yet. Because of my liking for Python, I have a personal bias that makes me happy to see a prominent project such as this one move to the language.

I find it odd that they’re going from Subversion to git instead of to Mercurial, but I like the fact that they’re moving their documentation to the reStructuredText-based Sphinx.

Permalink     3 Comments     [, , ]    

HTML Past and Future

16:04 10 Nov 2009

Mark Pilgrim, author of the excellent Dive Into Python, is working on Dive Into HTML5, and his draft chapter on HTML5 semantics is an excellent introduction to the advantages of the new HTML standard. It’s unfortunately quite far from becoming a real standard, but as a web developer, I’d like to see it happen as soon as possible.

I came across a contrasting Mark Pilgrim article that’s also worth reading: “Why do we have an IMG element?”, which goes over the history of that element in HTML, the objections raised at the time, and how it won out over alternatives.

Permalink     Comment     [, , ]