Wednesday, December 17, 2008

Why do alt,ctrl and space get stuck in Windows?

This has been buggin me since I ran WinXP (Or was it 2000?).

I discovered yesterday it's because of the Sticky keys Lock-modifier-keys-when-pressed-twice-in -a-row misfeature (under control panel - easy access centre).

Disabling that lowers your daily stresslevel. Enjoy. :)

Tuesday, December 16, 2008

The singularity is coming...

I've begun re-reading the book Accelerando by Charles Stross. The first half is pretty mind-boggling and fascinating and definitely worth a read if you're into software development, sci-fi and wonder where humanity is going. The latter half falters a bit as the story is trying to wrap itself up, but if you only manage the first part I hope you'll still found it worthwhile.

It resonates well with Ray Kurzweil's talk on TED.com, which I've just watched. Even though the video is old news (being from 2005 and released in 2006) I feel it needs to be spread a bit more. I guess we're not at the point where everyone knows everything new within a few weeks, but I wager that the time for spreading news is shrinking in the same way as everything else. :)

If you haven't heard about universal exponential growth or the singularity: watch the talk and, if you fell intrigued, read the book. Period.

Sunday, December 14, 2008

Mercurial and python 2.6! :)

This is a follow up on my previous post 'Distributed Version Control Systems on Windows' where I just want to note that I've made some progress with Mercurial by using Python 2.6 instead of 2.5.2.

The good thing is that Python 2.6 uses MSVS 2008, which I do have available. So with that, I can use setuptools to compile python libs. Including Mercurial!

Compiling and install Mercurial into my Python 2.6 64-bit installation was dead easy, by the books all the way! Yay!

That will probably help with running buildbot/mercurial/trac on a pure windows-based server (as in no cygwin). But I'm considering using a linux box for this anyway, since it's smoother and more easy to add misc minor stuff to. (Not disregarding setting up ssh-accounts for mercurial users, which is what I've done currently.)

I'm currently using it to try to assist the Mercurial situation on BuildBot, which is lacking a bit, especially when it comes to in-repo branches. There are patches on the buildbot trac, but they haven't been applied and the crucial one won't be added until it gets a proper test-case.

So, I'm working on that. There's some issue with line-endings preventing try-patches to apply cleanly in the tests. (It works in real life, as I did use the try-functionality at my last job. Never got it ready for every developer though...)

Saturday, December 13, 2008

patch.exe on vista - part 2

I've updated my previous post on getting patch.exe to work on Vista with UAC.

Short version: msysgit has a patch.exe that convinces Vista it doens't need to be omnipotent.

Updated 2010-11-26: There is also a comment on my SourceForge bug regarding unxutils's patch.exe.  The suggested fix works well.

Monday, November 24, 2008

Python - list clearing?!!

Today's trick question: How do you clear a list in python?

Not by .clear(), as you do with other python containers set or dicts (or _any_ in C++/Java/whatnot).

Nonono, you assign the entire slice of the list to the empty list, or delete the whole slice!

mylist[:] = []
del mylist[:]


.. .. .. .. Arrghh!!!!

Why do I have to learn the slice syntax, and the fact that there is a slice of the whole pie, and that I can assign a list to a slice, just to clear the list?!

Appending, concatenating and clearing are simple & common ops, that should be represented clearly and simply. Slicing is advanced, and when I want to do slicing, I read up on it, but I should need it for that. It's like requiring someone to learn discrete integration just to do addition; valid but only correct in the very bad technically-correct kind of way.

(And no, just assigning the empty list to it does not work, as that rebinds the name, it does not change the original list. I have no issue with that, as it's all pointers/references everywhere.)

Apparently, they haven't fixed this in Py3k either.

Looking through forums where this appear every month since Python was first created, the sentiment seems to be that since you can do it with slicing, there's no need for another way to do it!

I began to understand why people feel that the python community is regarded as a bit 'frosty' and cold.

I still like python a lot, but ... Bah!

patch.exe on vista - the workaround

Vista apparently thinks that any exe with 'patch' in it's name needs to be run with admin priviliges, probably to make a slew of pre-UAC install wizard patches work properly.

But this applies to good old unix:y 'patch' (which I have in windows-form) too!

Argh!

Update 2008-12-13: The patch.exe in the git-for-windows distribution (msysgit) seems to have the correct magic bits set to allow it to run without UAC getting in the way. So, try replacing your gnuwin32-patch (or whatever you're using) with that.

If that's not an option, here's how to do a workaround:




The trick is to rename patch.exe to pootch.exe (or whatever fancies you) and create a batch file call patch.cmd, with this content:

@"%~dp0\pootch" %*

That makes it work.

(I learn this when running the unit tests of buildbot, a pretty nice tool for distributing automated tests across compilers, computers & os:es!)

Monday, November 17, 2008

No Clutter For You

.. at least not with Python bindings. They use autoconf/automake, and didn't compile well on cygwin either, so I've given up.

QT has some animation options. Maybe those will do instead. :)

Tuesday, October 28, 2008

iPod:y gui on win32

Trying to find a toolkit for those newfangled, fancy, animated GUI, I stumbled across Clutter which seems to have a few tricks up its sleeve.

It uses GTK and autoconf/automake but offers a sliver of hope since it has a win32 backend, so I was banging my head against various pieces of code trying to get it to compile. (I even stumbled across Wascana, a Eclipse CDT/MinGW package) but that didn't help either.)

Nevertheless, the nice folks on the mailing list pointed me towards OABuild which is, believe it or not, a complete set of vcproj/sln files for a lot of GTK libs, including Clutter.

And it did compile. I'll go play with it tomorrow and see if I can get the python bindings up and running too.

Friday, October 17, 2008

Distributed Version Control Systems on Windows...

It's never easy...

So, having used Subversion and Trac successfully for roughly three years, I now have the oppurtunity to research and choose the technology base at the startup where I'm currently at.

DVCS:es seems to be all the rage, with Git and Mercurial being the two topmost contenders (I know about bazaar and a few others, but I didn't bother looking too much.)

Now, my prerequisites was that I wanted to get this to run on a Windows server (for various reasons). Open Source on the bleeding edge and Windows is never easy, but I've learnt a few things and gotten halfway there.

I'm using:

* Apache 2.2
* ModPython
* Python 2.5
* Trac 0.11
* Windows XP (server) and Vista (client)

Git

Git has a standalone installer for windows build on MSys (Mingw) which works well, both from the command-line and using the Tcl GUI.

By using Cygwin on the server, one can use ssh to access the common repo and push/pull. (Cygwin can import domain passwords, so you don't need to bother with dual user/password lists)

Pulling from http using webdav/apache is possible. With mod_auth_sspi you can again use windows domain usernames/password. (It might be possible to use LDAP too, haven't tried yet)

Git in daemon mode with by cygwin and inetd works too. (fast download path)

Trac and Git on windows does _not_ work, yet. This is because GitPlugin uses an old version of PyGit (not the PyGit on PyPi), for detail see this ticket. I might get around to do some hacking there.

I'm working on getting gitweb.cgi to run. I just get "403 Forbidden - No project found." all the time.

Mercurial

There are clients both for command-line (py2exe standalone builds, no python required) as well as windows shell integration (although it still has some rough edges, being 0.5 at the time of writing).

Trying to use Mercurial with mod_python is tricky, since the command-line dist has everything in library.zip (including dll's), which regular python can't import. So you need to unpack it somewhere and add that dir to sys.path. Also, Mercurial expects it's Templates to be in the same dir, so you need to copy that as well (otherwise you'll get hit an assert when using hgweb.cgi). See here for details.

hgweb.cgi works! See here for some tips.

Using MercurialPlugin in Trac from mod_python does not work. There is an issue with demandimport, or expat (under unix), or something. Which simply makes apache or python crash.

Installing Mercurial into c:\Python25 using easy_install might help (to avoid importing library.zip from the stand-alione cmd-line binaries), but that requires Visual C++ 7.1, which I don't have. I haven't found anyone who has precompiled for that use yet. (Copying the files to lib/site-packages did not work.)

I did get trac to run in tracd mode by modifying tracd-script.py and adding 'sys.path.append(r'C:\Program Files\Mercurial\lib')' and running it with 'python tracd-script.py --port ...' !! I have .py files associated with python so can just run py-files as .bat/.cmd, but this did not work here! Very strange.

So, tracd is slower than mod_python (or mod_wsgi, which I haven't tried, but I expect it to have the same wierd issues as mod_python), so I guess I'm stuck with using tracd.

Tracd can be run as a service
with the help of the Windows Resource Kit, but you don't get apache authentication (LDAP/SSPI). :(

Anyway, that seems to be the best bet.

Final words

I'm thinking of using apache under cygwin instead. That might help somewhat. Or just usel ighttpd/fastcgi on cygwin and windows-apache's mod_proxy. But.. the layers.. the jumping.. the hoops... arggh..

OTOH, I might go for subversion and wait until the DVCS-on-Win32 state improves (perhaps with my help), or until I get a Unix based server to toy with...

To be continued, as they say...

Thursday, August 28, 2008

First p0st!

So, apparently one has to start somewhere. Might as well be here and now.

I figured it'd be a good idea to start writing a bit, just to see if I can get some stuff out of my head and work on my English skills a bit. As there's been a lot of reading of other development blogs (notably Steve Yegge & GameArchitect.net) I've felt a bit inspired. My life is also evolving quite a bit, as I'm shifting employment (and moving up a step or two on the career ladder), just had my 30th birthday and the relationship with my girlfriend is just getting better and better, in spite of the (not unexpected) pains of constant male-female miscommunication ;).

So, the headline tells, the following is what I (partly) plan to write about:

Software development

It's what I do, it's my job and I kinda like it actually.

I've programmed since I was 7 years old, started out on an Swedish Z80 computer named ABC80. 32k & a basic interpreter. Been doing C++ since I was 14 and have touched various languages since then. Lately I've been working on a quite wide basis (source control, build systems, web servers, web apps, graphics) and had had 'Systems architect' on my card for a while. It'll be 'Lead Developer' in a few weeks.

Trying to make the major part of my daily life easier is something I strive at. Thus I'll try to jot down some experiences on coding, software engineering & related stuff.

During my free time, I've hacked a bit on a Django application for the band. There are (unrealized) ambitions on contributing to good free software such as Boost, OpenSG & Python, to name a few. Hopefully I'll get somewhere.

Gaming

Well, as one might have guessed, I am a bit of a gamer. The good thing is that so is my girlfriend (albeit much less addicted). This means that we've got a PS2, PS3 and Nintendo DS. Yay! Too bad there's so few party games for the PS3 (We've got four controllers, but no game that supports them all).

Currently I'm playing GTA4 (not as funny as GTA:SA), SC4 (just started) and GT5:Prologue, plus TM Nations and Trials 2. Trials 2 (http://www.redlynxtrials.com/) is a fun finnish game that I've actually bought (after playing the demo, which is a life-first thing). I did play an earlier, 2d-graphics version of this back in .. 1998-1999 .. The physics are decent and it's good fun in small bits. (Even though you might get frustrated as hell on the harder levels... :)

Band life

I'm the bassist in seven piece cover band (70-90's rock/pop/funk) that's been going for about ten years, and we do about three to six gigs a year. Weddings, company parties and that sort of thing. Usually good fun and a great outlet for every musician's wallet's enemy #1, Gear Acquisition Syndrome. As everyone in the band has a master's degree (give or take), we don't need to pay the rent with our gig money, instead we spend it on getting More Stuff(tm). :) This means that we now have all the equipment we need for a small gig (a crowd of no more a hundred).

Also, given that there are seven of us, and two of the three guitarists play synth/keyboard on some songs, we do use almost all of the 24 channels on the mixer. This requires good equipment and we're getting closer with each gig. It's not yet becoming Too Much Stuff(tm) since we try to be sensible and make sure everything is transportable. Lots of cases help immensely, but we're getting worried about the weight.

I'm managing the band's wiki site (good for keeping updated info) and also working on a Django app for managing all songs (about 50 on last count) together with playlists, misc data (lyrics, tabs, who-plays-what, bpm, etc) as well as voting (it's not easy to agree on songs when you're that many, especially given our differences in musical preferences).

A band is also, I think, a pretty interesting social construct. A bunch of people are doing something together volountarily, just because it's fun and gives them some exciting moments in life. Our band is not really built around one or two people controlling and everyone else following (there are of course various levels of engagement) so it's a bit of a struggle trying to balance everything so that everyone is happy. But we've managed pretty well so far. :)

Random web links

Webcomics are fun, these are the ones I keep myself updated with. I'd especially recommend SinFest.

Conclusion

That's it for an introduction. The intention is that further posts will be more focused on a single topic, but now you'll (perhaps) know what to expect.