23:55 25 Feb 2010.
Updated: 01:41 26 Feb 2010
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...]
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...]
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...]
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…
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.
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...]
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.
23:54 08 Jan 2010.
Updated: 03:05 09 Jan 2010
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...]
06:34 05 Jan 2010.
Updated: 09:41 14 Jan 2010
08:53 01 Jan 2010
Happy New Year!
Once again, my goals for the coming year.
[more...]
Permalink 1 Comment [
coding,
community,
CrossFit,
exercise,
games,
goals,
MTG,
personal,
reading,
roleplaying,
web-development,
writing]
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...]
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...]
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...]
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.
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.
15:09 11 Oct 2009
“JavaScript Programming Patterns”, by Klaus Komenda, is an excellent walkthrough of several JS patterns. If you code JavaScript regularly you probably know at least some of these but will likely still find something useful in it—I particularly like the lazy function definition, a pattern originated by Peter Michaux:
var foo = function() {
var t = new Date();
foo = function() {
return t;
};
return foo();
};
Simple, elegant, solves the problem of making sure that the heavy lifting only gets done once.
23:59 05 Oct 2009
Test-Driven Development (TDD) is a programming methodology that calls for programmers to first write tests that will only be passed by code that meets the specifications for whatever component they’re working on, and then to write the code for the component and keep working on it until it passes the tests.
I don’t tend to use Test-Driven Development, even though I often think I should. When working on personal projects, I don’t even write many tests after the code is done, and that’s something I should definitely do. But I generally regard it as a good practice.
[more...]
23:18 01 Oct 2009.
Updated: 08:20 02 Oct 2009
I never knew about this optional third parameter to list slices—in addition to e.g. getting the third to fifth items in a list with somelist[2:5], you can also get every nth item with somelist[::n].
This makes it very easy to get every odd or even item in a list, odd with somelist[::2] and even with somelist[1::2].
Where I think this is particularly handy is if you have to grab e.g. three-line chunks out of some text:
chunks = []
lines = text.split("\n")
for i in range(0, len(lines))[::3]:
chunk = []
chunk.append(lines[i])
chunk.append(lines[i+1])
chunk.append(lines[i+2])
chunks.append("\n".join(chunk))
The docs on extended slices are here.
12:05 24 Sep 2009.
Updated: 14:19 06 Oct 2009
It took me a while to get there, but I now have a working toolchain to automate going from an RTF file (or a Word document) to reStructuredText. The final link took the longest to find, and turned out to have been right there all along (no, I’m not going to turn this into a retelling of The Alchemist). But if you’re interested in how to get from Word to a sane format (like reStructuredText), this post will interest you.
[more...]
09:14 09 Aug 2009
There are three kinds of major text editors: Emacs, vi (now really Vim), and “other”. I’m sure there are some other quirky small ones out there, but those are basically the major categories. “Other” encompasses what I think most people would expect from a text editor: a window in which you can type freely and see your text appear, and which behaves somewhat like other applications, including word processors, in its basic functionality.
I’ve used the “other” category for years. I think that the first one I used heavily (I’m not counting MS-DOS Editor) was TextPad. I stuck with that for quite some time, and then started using HomeSite. I think I played with UltraEdit for a while too. Eventually, however, I wanted a cross-platform and free software editor, and shifted over to jEdit. I’ve used it heavily for several years, and consider it the best of the “other” class.
I have, however, always thought about making the effort to learn vi, because I’ve always loved the keyboard-only approach and like to save time by making my text editor use more efficient.
[more...]