Saturday, January 23, 2010

Mercurial on IIS 5.1 (XP) in 12 easy steps

Yes, I know W7 is out, but some of us are still using XP for some things.

Introduction:
With the upsurge in the use of Mercurial for version control (Even Codeplex is using it), I thought it was time to give it a try. It will take some getting used to, but a distributed VCS should fit my development style well. I carry an external drive between home and work. Right now it holds my latest code. I have to remember to commit the changes occasionally and don't always do so in a timely manner. Also, if I want to go back to an earlier version, I have to do it at work (instead of my home office when I really need it)

There are several pages showing how you can install Mercurial or HG, but my searching found none showing a straightforward "get it done set" of directions. Here's my instruction book. I've done this several times and found no issue. If you find a difference in your install, please let me know.

On with the show:
1. Install Python 2.5 - don't argue. don't resist. Mercurial is built with 2.5. Anything else WILL break it. (http://www.python.org/download/releases/2.5.4/)

2. Download and install Mercurial (http://www.selenic.com/mercurial/wiki/BinaryPackages) (Select the Windows installer)

3. Clone the Mercurial repository - you'll need some of the source code
hg clone http://selenic.com/repo/hg

4.
Create a folder to hold all the mercurial scripts
mkdir c:\hg_iis

5. Create a folder to hold your repositories (mkdir c:\hg_repos)

6. Create a virtual folder in IIS
  • Name it HG
  • Local path = c:\hg_iis
  • Execute permissions = Scripts and Executables
  • Click the configuration button
  • Click on the mappings tab
  • click the add button
  • In the Executable field enter c:\Python25\python.exe -u "%s"
  • In the Extension field enter .cgi
  • Under Verbs select All Verbs
  • Check Script engine
  • DO NOT Check Check that file exists
  • Click OK
  • Click OK
  • Click OK

7. copy the web page script to your IIS directory
copy c:\hg\hgwebdir.cgi c:\hg_iis

8. Change directories c:\program files\mercurial and unzip the file library.zip to c:\hg_iis. If you have problems with the .zip file download and run unzip.exe from stahlforce.com (http://stahlforce.com/dev/index.php?tool=zipunzip as pointed to by Selenic's site)

9. Copy the templates
copy C:\Program Files\Mercurial\Templates c:\hg_iis\Templates

10. In a text editor open hgwebdir.cgi and edit the last few lines

change
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)

to
#http://blog.mdmsolutions.org/index.php?entry=entry080508-091813
import os
os.environ["SCRIPT_NAME"] = '/hg/hgwebdir.cgi'
os.environ["REQUEST_URI"] = os.environ["SCRIPT_NAME"]

if os.environ.has_key("PATH_INFO"):
os.environ["REQUEST_URI"] += os.environ["PATH_INFO"]
if os.environ.has_key("QUERY_STRING"):
os.environ["REQUEST_URI"] += "?" + os.environ["QUERY_STRING"]

application = hgwebdir('hgweb.config')
wsgicgi.launch(application)

(indentation is important)

11. In a text editor edit or create the file hgweb.config
# Mercurial web interface config file
# To add a repository to be published, add an entry here for it.

[paths]
/ = /HG_Repos/**

[web]
style = coal

12. Now, open a browser and navigate to http://localhost/hg/hgwebdir.cgi

13. (optional) Download and install TortoiseHG http://bitbucket.org/tortoisehg/stable/downloads/

Sunday, December 6, 2009

Oracle documentation

Found out why one of my other weekend projects failed. Oracle Lite doesn't like having the mobile server and the database workbench on the same machine. Something gets twisted around and prevents clean publishing.

I'm sure I'll find this somewhere in the documentation, but there's just so much of it.

It's sort of like when we looked into R.U.P. at work. So many choices and not enough guidance. Here's some rope. You could catch a cow or hang yourself. Instructions for both are included, but very little information about which one would be better.

Gonna throw a Blackberry...

I'm going to throw a Blackberry against the wall. The stupid thing generates interference, so when I started a coding session I turned off my speakers. I then put it on my desk in silent mode. It was supposed to be a good programming session. You know, silence, a few drinks, everyone else asleep.

It didn't turn out so well. I was getting random system lockups at random points. At first I thought my code was at fault, so I started working on writing documentation. Hey, if I'm on a roll and the code is breaking, I might as well do SOMETHING. Anyway Word started dieing at random points. After about an hour of that I figured I'd hit the sack.

I spent the entire next day trying to figure out what was wrong with my system. My code may be buggy, but Word (2003)? Something else had to be wrong!

I ran full diagnostics, defragmented the drive etc. Then I started going through e-mails I'd been ignoring the night before. One had a Youtube link that looked good. Half way through it, I got the familiar bzzz bzzz bzzz of interference from my Blackberry then my system hung. I reached down and grabbed the offending piece of electronic !@##$! and noticed that I'd placed it on top of the mouse cord Friday night.

Since moving the offender to the other side of my desk, I have had No, Zero, Zip, Zilch, Nada problems. After writing this, I'm a little calmer and it won't be hitting the wall. It won't be going in my pocket either

Thursday, November 19, 2009

It's Here!!!!

The Psion iKon has arrived. I've been playing with it for a few hours.

Installing via Visual Studio CAB files is as easy as could be. Nothing too troubling, but the excitement of deploying an app on a new platform is amazing.

Setting the background though was a pain. You can set the background from Settings --> Today --> Use this picture as background. When you do it that way your image will be 50% transparent. Probably not what you were looking for. The easiest way to set the background AND set the transparency to:
Open File Explorer
Open the image you want to use as the background
Menu - Set as Today Background
Set transparency level to 0
Press OK.

Sunday, November 15, 2009

Resolution Support System

What ever happened to Decision Support Systems? When I was in college, I had a professor who made it seem like the world would be running on DSSs by 2000.

Anyway, the reason I ask. I'm putting together a web site to support users of an in house piece of software and I wanted something more than a FAQ.

I have a script that is used by the help desk when they get a phone call and wanted to create it as a web page. Just a quick weekend project huh? Well I ended up searching for an existing template or even an example for 12 hours. (I'll bet someone replies with one within the hour).

Finally I sat down and tried to pick my brain about the basics of a DSS. In case you're wondering, it's really just one question leading to another until a reasonable answer is arrived at. I DID say basics didn't I?

The design ended up working out to be pretty easy. Questions are stored in XML files and served up in an HTML page. Possible answers are also shown. Each answer leads to another question. Answers are really just questions, because at the bottom I ask the user if they were able to solve their problem.

If a user cannot solve their problem, I end up sending an email to the help desk containing the questions the system already asked the user and their response.

6 hours of work and I've got a good foundation.

Saturday, November 14, 2009

Special Hardware

Wow! Jumping from consumer grade hardware to commercial isn't easy.

No, the programming isn't any different, but ordering... That's a different story.

I just spent two weeks going from manufacturer to distributor and finally hunting for a reseller who would sell Psion Ikons to my company.

Many of the resellers I called were not interested in selling just the hardware. (They sell the hardware for a loss and want the development money). I finally found one who would sell the bare unit. As I was talking to them, I found out that they also do development work. I was 10 minutes into the call before I was even asked if I wanted them to do the work.

Anyway, along the way I learned a few things.
1. Manufacturers don't want to do any type of one-time sales. They want a steady income stream.
2. Distributors (see #1)
3. Many Value Added Resellers want you to pay for their "added value" and make poor "resellers"
4. Finding the right person is worth the hunt.
5. Don't get frustrated when you end up on a wild goose chase.
and finally
Ask as many questions as you can at every step. You never know what you'll learn.

I have 4 pages of notes that I've collected at each step. Having these notes has made each successive step that much easier. By the time I got to the reseller, I knew most of my options. I also knew that they might know more about the product than I could. They were able to put together a good combination at a good price.

The real fun begins next week when I get my hands on the real thing. (Emulators only go so far)

More to follow

Sunday, November 8, 2009

Going Mobile

NEW CHALLENGES COMING!!!

Yes, I'm excited! I'm entering the world of handheld devices. I'm not talking wimpy I-Phones or temperamental Blackberries. I'm talking full blown drop it on the ground, stomp on it, pick it up and keep working Psion Ikons. http://www.psion.com/us/products/handheld/ikon.htm

I'm entering the world of Windows Mobile!

Add to that Oracle Lite. No, it isn't a lightweight Oracle database. It's a full-blown synchronization platform for hand held devices.

My head is spinning with all the pieces. Just like it did when I started .Net. And MFC before that and...