pre-endgame_

Setting up Mercurial on IIS

Setting up Mercurial on IIS

I have just set up a Mercurial server using IIS to serve the requests. I found that the following blog post was a great step by step guide to setting it up http://blog.schuager.com/2010/03/how-to-setup-mercurial-server-on.html. However I had a few issues that were not covered in the blog post: The first was that I was getting a “DLL load failed” error for several modules. The reason for this is that I had installed the standalone version of Mercurial and that it could not reference the compiled C versions of the python modules. I fixed this by copying the pure python modules into the lib directory. You can find the pure python modules for the 1.8.3 version of Mercurial at http://selenic.com/repo/hg/file/3cb1e95676ad/mercurial/pure The second issue was that IIS refused to serve cs files, as the Request Filtering feature was enabled. I disabled this for the whole repo by adding the following to the web.config at the top level of the IIS hg app.

Simple Python Command to generate a random GUID

Simple Python Command to generate a random GUID

Every so often I need to generate a GUID for a MS Proj file. The simple python command will create one for me:

python -c "import uuid;print uuid.uuid4()"

Changing that to a emacs function so I can insert them where ever I need we get:

(defun genUUID ()
  "Generates a UUID"
  (interactive)
  (shell-command "python -c \"import uuid;print uuid.uuid4()\"" t)
)

Remember to just read the code

Remember to just read the code

The problem that I had was that I needed a repeating Timer object in python. I googled, but the answers that I found didn’t sit right, and then I remembered that I could just read the code for the threading module and see how the Timer object was implemented, then just use that. Below is the code I came up with.

But the moral of the story is that having the source code for your language’s core libaries around is a good thing.

Installing org-googlecl.el on Windows

Installing org-googlecl.el on Windows

Here is how I installed org-googlecl.el (found at http://www.emacswiki.org/emacs/org-googlecl) onto my Windows 7 box at work.

  • I droped the el file into my emacs extentions directory
  • I added the following to my .emacs
(setq load-path (cons "C:/emacs/org-googlecl" load-path))
(require 'org-googlecl)
(setq googlecl-blogname "Technology and Me")
(setq googlecl-username "my google username")
(setq googlecl-footer "") ;;Add no footer
(setq googlecl-blog-exists t) ;;Ask me if the blog exists before posting
(setq googlecl-list-regexp "\\(.*\\),\\(http.*\\),?\\(.*\\)$") ;;update the reg-ex for listing (see below)
python c:\python\26\Scripts\google %*
  • Once the google command was working I found that the org-googlecl-list-blogs was not running.
    • The problem was that the regex was wrong as I had not added any tags to my posts. So I updated the googlecl-list-regexp to account for the missing ,
  • The final tweek is that the quoting was wrong for windows on some of the commands so I changed it to match the windows style within org-googlecl

Testing org-googlecl

Testing org-googlecl

Just installed the org-googlecl emacs module. Hoping it will mean that I will blog more than once a year :)

N900 - now with Emacs!

N900 - now with Emacs!

Thanks to this post. I have installed and configured emacs 23.1.1 onto my N900. The only problem was that the minibuffer wasn’t displaying, I found that the fix for this was to specify a max-height to the maxframe configuration mentioned in the post. I added the following line to my .emacs:

(setq mf-max-height 430)

A simple solution to downloading matching instance files in CC.net

A simple solution to downloading matching instance files in CC.net

At Serverside we use Cruise Control .Net as our continuous build server. I have found it to be easy to use and it integrates with NAnt and NUnit really well. Today I hit upon a interesting problem in one of our builds: We needed a instance code line to be updated every time the base code line was updated. Where an instance is just a specific branded website of the base code. The instances are in the same repo, but in different “lines” of the repository, so we couldn’t just update the whole trunk line. The way I solved it was that every time the CC.Net project is triggered, the first task that CC.Net runs is a svn update on the instance lines. I run svn in a exec task. The trick here is to remember to use the –username and –password arguments to make sure that you update with the right user. My final exec node looks something like:

Inserting the BOM into a file

Inserting the BOM into a file

I have been working with Windows UTF-8 files a lot today, and I found that just saving the file as UTF-8 isn’t enough for ASP.NET (well 1.1 at least). Even though emacs says that it will save the buffer with the BOM (Byte Order Mark) it doesn’t seem to if the file doesn’t start with one. So I wrote myself a little helper function to add the BOM into the start of the file. It works by going to the start of the buffer you are in, and adding the BOM FEFF. The exact bytes comprising the BOM for the Unicode character U+FEFF are converted into the UTF-8 format by emacs when it saves the file (which for reference are EF BB BF – thanks to pnkfelix for pointing that out).

Why didn't I follow the checklist!?!

Why didn’t I follow the checklist!?!

Today I upgraded our Subversion server to 1.6.5. It was a nightmare and all because I tried to do it from memory. It seemed simple, just uninstall and install a few services and then I would be away laughing. However I was shown why pride comes before a fall. All was going well till Apache wouldn’t start. After pushing and pulling at the configuration and reading the error logs, it turned out I should have installed mod_python. All shiny, but why isn’t Trac working! Many hours later, oh yes I should reinstall the python bindings to Subversion. Look at that now it works. Later checking the wiki (to make sure it still works) I read the article I wrote on how to upgrade subversion. There in black and white was the steps as I should have taken them. Including the missing mod_python and python bindings. Why didn’t I just follow my own checklist.