Our relationship has only just started but it's already time for me to move on. Although I think you're great, Mecurial has become my new best friend. Things with her are just a little easier. We just clicked.
It's also hard to ignore recent developments. It seems like Mercurial is going to become quite important in the future.
No hard feelings I hope. I truly wish you all the best for the future.
posted: Wed, 29 Jul 2009 01:03 | permalink | comments
Emacs with Viper mode: editor nirvana?
I've been a long time Vim user and fan. Once you're used proficient with the Vi way of editing it's difficult go back to anything else. Other editors just feel inefficient and clunky.
That said, I've been jealous of certain Emacs features that I've seen while looking over the shoulders of my colleagues. Multiple frames (GUI windows), the clean extension system (via elisp), the tight process integration (shell, SQL, debuggers etc) and all sorts of unexpected bells and whistles; these goodies slowly ate away at my curiosity.
So 2 weeks ago I caved and decided to give Emacs another go. I hadn't really used it since university. Starting with my colleague's configuration and making some minor tweaks, I began using Emacs for serious work.
A few days in and I was enjoying exploring my new toy but it didn't feel quite right. Although I had a reasonable grasp of Emacs' editing keys and commands, most tasks took way too long, requiring convoluted hand gymnastics. My left pinky was permanently sore from constantly reaching for the Ctrl and Alt keys. I was missing those surgical, efficient Vi commands.
At the suggestion of one Emacs-using colleague I gave Viper (viper-mode) a try. It's an emulation that attempts to provide a fairly accurate Vi experience while still allowing full access to the rest of Emacs. To be honest I was expecting it to be a half-assed kludge. I was wrong. Viper is a mature Emacs extension and it does a great job of mitigating conflicts between the Emacs and Vi ways of doing things.
Viper mode proved to be the tipping point; because of it I'm sticking with Emacs. As far as I'm concerned it's the best of both worlds.
For anyone who's interested, my Emacs config is available in the repository browser here or via bzr. This is my personal configuration branch so it will update as I make changes to the setup. Note that I'm using the latest development (but rock solid) Emacs so there might be references to features in the config which only exist in this version.
Some items of note in my config:
- Viper mode only emulates classic Vi. vimpulse provides a bunch of extra features which a Vim user will probably miss such as various "g" commands and visual select mode.
- This is a standard feature of Emacs which isn't bound to keys by default. It gives amazing power by replacing the standard find-file and switch-buffer keystrokes with beefed up alternatives. The key features are quick directory switching and fuzzy, recursive name matching (but that's not all).
- I've replaced the standard buffer list binding (C-x C-b) with ibuffer. This gives a more powerful and easier to use version of the standard buffer list and allows for crazy batch manipulation of buffers.
- Mode specific template expansion. Powerful and super useful for cranking out commonly used sections of text (programming is full of them).
- flymake - pyflakes integration
- Flymake runs arbitrary programs over buffers on-the-fly. For Python files flymake has been configured to run pyflakes and highlight errors in code as I type. I might change this to use pylint at some stage because pylint finds a wider range of problems.
Some useful Emacs config hacking links:
posted: Mon, 22 Jun 2009 21:36 | permalink | comments
bzr repositories now available
I've just made my personal bzr repositories publically available so that anyone can easily get to them (including me!) and so I can refer to things from blog articles. The repos are available for branching using bzr under http://freshfoo.com/repos/ and in human browseable form. See also the links in the left sidebar and in the code section of the site.
I'm using Loggerhead to provide the web viewable form (proxied via the main lighttpd server). It was very easy to setup (using serve-branches). I just wrote a simple init.d script to ensure it stays running.
posted: Sun, 21 Jun 2009 21:41 | permalink | comments
PyCon UK 2008
PyCon UK 2008 is approaching fast. If you're a Python programmer in the UK (or are just Py-curious) then you really should be going. The talk schedule looks hugely exciting and the in-the-hallways and at-the-pub action will undoubtably be fun and engaging. I guarantee you'll learn something about Python and come away feeling inspired.
posted: Fri, 29 Aug 2008 10:15 | permalink | comments
Photos, photos, photos
I've posted heaps of photos over the last week. Here's the summary.
- Our camping road trip from London to Ukraine and back last summer.
- Bestival 2007
- New York last Christmas and NYE.
- Our visit to Bletchley Park yesterday. As well as having lots of facinating exhibits about code breaking and the infamous Enigma, the site is also the home of the National Museum of Computing. It's filled with historic computer hardware from the first programmable digital computer onwards. Highly recommennded to anyone with an interest in computing.
- Today's Olympic Torch run through London. We watch it near City Hall. It was freezing cold and still snowing slightly but plenty of people still turned out. There were a large number of Chinese supporters as well as many pro-Tibet protestors. Police ran with the torch bearer, completely surrounding the runner. Pro-Tibet chanting and booing was drowned out most of the cheering. The pro-Tibet message was pretty clear.
posted: Sun, 06 Apr 2008 17:45 | permalink | comments
Making Python Do the Hard Stuff
At work we use a Python decorator to restrict access to certain web controller methods based on the current user's permissions. This was done using by simplying ANDing the permissions together. For example:
@permissions('read', 'write') def some_method(...): ...
permissionsdecorator only adds an attribute to the function being decorated. The actual permission enforcement is done in the base controller class as the request comes in.
This approach worked well for a while but then requirements started appearing for more complex relationships between permissions. What if a method required that a user has "read" and "write" or just "admin"? What about negation?Read more...
posted: Sun, 11 Nov 2007 13:21 | permalink | comments
FuzzyFinder is a useful Vim extension that I've discovered recently (nothing to do with Fuzzyman). It has proven to be a great productivity enhancer, especially when dealing with large codebases with many files.
FuzzyFinder provides a mechanism to search through files on disk or Vim
buffers using fuzzy filename matching. When activated it interactively searches the
current directory for files matching the name you entered. Matching
is very loose, so if for example you enter "abc", you'll get a list of all
*a*b*c*. It sounds strange at first but is very
effective in practice.
Here's a screen shot of FuzzyFinder when first activated. A list of all files in the current directory is displayed. The arrow keys can be used to make a selection from the list (useful if you can see what you want). If the list is long, start filtering!
posted: Thu, 11 Oct 2007 13:55 | permalink | comments
Hours and hours and hours....
Perhaps I've been living under a rock but I just discovered Best Tech Videos On the Net today. It's a site that indexes all the best technology related videos on the web. There's so many good screencasts and conference sessions. Especially exciting is that there's sessions I wish I'd gone to at conferences I've attended. I could spend hours on this site (and probably will!).
posted: Fri, 16 Mar 2007 15:32 | permalink | comments
Starting with Ruby
This excellent read from Arto Bendiken has inspired me to do 2 things:
- start learning Ruby
- keep going with learning Scheme which I haven't touched much since I started teaching myself on the plane to Australia
- Ian Bicking's awesome comparison between Python and Ruby: Ian tries hard to stay impartial and keep the discussion on the really important issues.
- A Ruby introduction for programmers: useful quick notes for those who already program in other dynamic languages.
- The intro from the Programming Ruby book isn't bad.
posted: Fri, 05 Jan 2007 16:22 | permalink | comments
Scheming on the way to Oz
I arrived in Australia 2 days ago to sort out various passport related issues and to get some time in the office (it's been 6 months). Since the flight gave me a spare 24 hours to fill I decided it would be an excellent time to start learning Scheme. This is something I've been meaning to do for ages, just to stretch my programming mind in new ways, but also because I'm just curious about Scheme/Lisp.
Before I left I installed the Fred Bayer's excellent LispMe Scheme interpreter on my Palm. This is a relatively complete, almost standard, Scheme implementation which includes APIs for Palm graphics, databases and UI elements. Not that I got that far ... I'm definitely closer to the "Hello world" end of the spectrum when it comes to Scheme.
For documentation I downloaded Dorai Sitaram's excellent free tutorial Teach Yourself Scheme in Fixnum Days on to my Palm. It's freely available in HTML, a page per chapter. A bit of fiddling with Pyrite Publisher gave me a suprisingly readable Palm version, one document per chapter. The output wasn't perfect but completely useable. Given a little more preprocessing I reckon I could get the whole tutorial into one document.
Although I would have loved to, I didn't get the classic Scheme/Lisp text Structure and Interpretation of Computer Programs onto my Palm. It's damn big and I couldn't figure out a way to convert it nicely in the time I had to do it. I think it is doable though.
By setting up shortcuts in the Palm launcher I was able to quickly switch between the book and LispMe and happily spend the much of the flight(s) teaching myself the basics of Scheme. Some thoughts:
- LispMe is cool! There wasn't anything that I covered in the tutorial that it couldn't do. Some of the demos programs are really impressive too, for example a 3D rotating cube!
- Teach Yourself Scheme in Fixnum Days is a nice tutorial. It doesn't mess around much and gets into more difficult ground fairly quickly. It's probably a good introduction for programmers experienced in other languages.
- I'd still like to go through SICP at some stage to get a more complete grounding in Scheme.
- Entering Lisp-like code via the Palm graffiti input system requires a certain amount of dedication. There is a Palm hack that comes with LispMe to help with parentheses matching but unfortunately it doesn't work on more recent Palm's like my Tungsten.
- I don't think I could see myself using Scheme for any major projects, not when I already find Python to be such a good fit for most things. That isn't really the point of this exercise though (and I should never say never).
I have a lot more to learn. I certainly didn't get through the whole tutorial but skipped ahead a bit to see what other stuff is covered. Continuations, the non-deterministic operator (amb) and macros look really interesting. The brain stretching really begins when you start getting on to these more advanced topics. Maybe for the flight back to the UK...
posted: Thu, 19 Oct 2006 23:06 | permalink | comments
Why PHP is bad
Now look at the standard library that comes with PHP. There is no consistency whatsoever, and any units of functionality larger than a single function are a mess on the semantic level. The distribution of responsibilities is often peculiar. So just like I could never get my Tk-centric code into a reasonable shape, I never manage to get my PHP-standard-library-centric code into any reasonable shape either. The whole thing is a gigantic mass of hodge-podge quick&dirty hacks. As Larry Wall said, the PHP philosophy is I thought of a way to do it so it must be right.
posted: Wed, 04 Oct 2006 14:27 | permalink | comments