Monthly Archives: July 2007

Subversion on Windows with Remote Access

A quick guide to setting up Subversion in Windows and making sure it works from remote locations as well. There are a few other guides out there but they’re all out-dated from what I can tell or they’re missing the few things that have bit me in the past. There is also a great little project called Svn1Click that will get you setup with Subversion, only problem is that it seems to also be out of date, it installs Subversion 1.4.2 and the current is 1.4.5. So, roll up your sleeves. I guarantee you’ll be able to setup svn faster than it took me to write this thing.

Install Subversion

1. Download latest version of Subversion. Right now that’s version 1.4.5. You’ll want the Windows installer which is svn-1.4.5-setup.exe.

2. Install using defaults.

3. Open a command prompt (Win+R, Cmd, Enter)

4. Check to make sure that Subversion’s bin directory was added to your path. Type “svnadmin help“, you should see a list of available svnadmin command. If not you’ll need to add it manually (Right-click My Computer, Properties, Advanced Tab, Environment Variables, System variables, double-click Path, add ;c:program filessubversionbin to end, OK out of all dialogs).

Install TortiseSVN

While not needed to get a svn repository working it’s such a rocking way to access your repository you should be using it.

1. Download TortiseSVN (1.4.5 as of this writing) and install it. Yup, that easy.

Create Repository

1. At a command prompt…

2. Decide where you want your software repository. Personally I picked the highly imaginative “d:repository”.

3. From the command-line type “svnadmin create d:repository“. Don’t worry if the folder doesn’t already exist, the create command will automatically create the folder for you.

Lock It Down

You’ll probably want some security. Determine who should be able to view it vs. who can commit back to it.

1. Browse to “d:repositoryconf” and open svnserve.conf.

2. If you’re going open-source and anyone can do a checkout but only the chosen can do commits then leave it like it is. If you’re a little more picky over who can see your source then uncomment the “anon-access = read” line and change it to “anon-access = none“.

3. Uncomment the “password-db = passwd” line.

3. Save & Close.

4. Open passwd in same folder.

5. Under the users section add your username + password in the form of “username = password“.

6. Save & Close.

Running Subversion As a Service

1. Subversion is most useful when you’re running it as a service and the nice svn devs have provided a windows service that’ll run happily in the background serving up your code. Type the following into the command-line:

sc create svn binpath= “”C:Program FilesSubversionbinsvnserve.exe” -service -r D:repository” displayname= “Subversion Server” depend= Tcpip start= auto

This command line is tricky, two things to remember:

  • Resist your natural urge to clean up the command line, you need exactly one space after the equals of each key pair and no space before it.
  • Since the default install of Subversion installs it in C:Program Files you need those escaping backslashes in the command-line. Forget those at your peril.

2. You’ve created the service, now start it, “net start svn

3. To access a repository being served by svnserve the url is “svn://<machine name, ip or url here>”. So, to access a repository running locally you can simply do “svn://localhost” (but don’t, read the tips below for why).

Is This Thing On?

1. Type “svn info svn://localhost

2. If you went open-source you’ll see some info, otherwise you’ll be prompted for your login/password. Enter it.

3. You’ll get back a bit of info on the repository you’re now serving. Sweet.

Accessing SVN from the Road

You probably want to access your repository from more than just your home network so here are a few things you may or may not need to do.

1. If you’re like 90% of people you don’t have a static IP address to serve your svn repository from. No problem, go to a service like DynDNS or No-IP.com and get yourself a free dynamic IP domain. You’ll end up with something “mycode.dyndns.org” or “sourceaccess.servehttp.com”. Doesn’t matter, get creative, express yourself. I’ve used both, no problems with either so it really comes down to which “vanity” domain you like, both have a large selection of domain names you can pick and then you tack your sub-domain onto the front of it.

2. Your repository url is now: svn://yourname.dynamicip.com

3. Now that you have an actual address to use you need to make sure svn traffic actually gets to your computer. If you have a router you probably need to forward port 3690 to the machine hosting the svn service. Check your router’s manual on how to do this but here is what I do on my NetGear router:

  1. In a browser go to http://192.168.1.1, enter login/password if needed
  2. Look for a section “Attached Devices” or “LAN IP”, basically you’re trying to figure out the local IP address of the machine running svnserve.
  3. Look for a “Port Forwarding/Port Triggering” section
  4. Add a new Port Forwarding
  5. Name it SVN, select TCP if offered a choice between UDP or TCP. Selecting both won’t hurt anything either.
  6. Port is 3690
  7. Forward to IP is the local IP address of the machine running the svn service. You should have found this in step 2. If not you can type “ipconfig” from the command-line and it should show you your current IP address.
  8. OK, Enter, all that stuff, you’re good to go.

4. Lastly if you have a firewall it may decide to mess up your day. There are many firewalls out there but the jist is that you need to allow inbound and outbound traffic on port 3690. Some programs let you browse to the EXE and allow it, others do it strictly by port. Some don’t block it at all so this step may not be needed.

Advice & Troubleshooting

  • Always use your dynamic address, even at home, even when working on the same machine hosting the repository. This will save you from having to run the relocate command on your working copies. First time you go to a coffee shop on your laptop and attempt to connect to your home repository and don’t get the “unable to connect to repository svn://home-pc” you’ll thank me.
  • If a working svn url suddenly craps the bed and stops working there are usually two reasons, either a) your public IP address has changed and you need to go to your dynamic IP provider and update your IP or b) your machine grabbed a different IP address from your router so now your port forwarding is going to the wrong machine. Either update your port forwarding or setup a static route in your router to always give your svn machine the same IP. 98% of the time though your svn machine will get the same IP so it’s not too much to worry about but it’s happened.
  • Add your repository folder to your backup if you’re not doing a full system backup.

ZuneKeys: Global Hotkey Support for Zune

Before the Zune software I used Winamp and one of the things I really liked was it’s Global Hotkey support, the ability to control the player using just hotkeys.  Ever since using the Zune I’ve found myself hitting Ctrl + Alt + Home to pause the player about a 100 times so instead of whining about it in yet another blog post I thought I’d actually do something.  It was a slow afternoon at work on a Friday so I whipped up this, ZuneKeys, global hotkey support for the Zune software.

Install

  1. Download ZuneKeys
  2. Unzip and copy somewhere, personally I use c:program fileszunekeys
  3. Run ZuneKeys.exe…
  4. …and Bob’s yer uncle!  Now you have global hotkey support for your Zune software.

I’d suggest adding ZuneKeys to your startup menu so it’s always available.

The Keys

Play Ctrl + Alt + Insert
Pause Ctrl + Alt + Home
Stop Ctrl + Alt + End
Previous Track Ctrl + Alt + Page Up
Next Track Ctrl + Alt + Page Down
Volume Up Ctrl + Alt + Up
Volume Down Ctrl + Alt + Down
Fast Forward Ctrl + Alt + Right
Rewind Ctrl + Alt + Left

 

How it Works

I’m basically sending the same commands that your fancy media keyboards send, except I don’t use media keyboards as they take up entirely too much space on my already cramped desk.  Nothing too magically here.  I’m pretty sure the Winamp one actually sends Winamp messages that it knows how to respond to but since the Zune software doesn’t *have* anything like that I’m sorta faking it.

There is no customization of hotkeys and it could probably do a lot more but I wanted to keep it as tiny as possible since I already seem to have a 100 other things running in the background trying to compete for my system’s resources.  If someone besides me actually uses this puppy I’m sure I could accommodate customized keys or other small enhancements.

This works with the Zune right now because that’s where I needed it but it could easily be adapted to work for Windows Media Player, iTunes, Winamp, etc.

Oh, it seems to work just fine under Vista and XP.

The (Open) Source

It’s written in Delphi as a standard Win32 application.  Since it’s Delphi that means the only thing you need is the EXE, no .NET or Java Virtual Machine needed here.  Since I avoided using the VCL and went old-school Windows app it’s only 30.5kb instead of the more usual 300kb Delphi app.  If you’d like the source just ask, I’ll put it some place public or give you access to my subversion repository.  A special thanks to IconBuffet as the icon I’m using is from one of their "Free Delivery" icon sets, Dresden Symphony.

ZuneKeys Source

UPDATED: Some people noticed that the source zip was missing ZuneKeys.inc.  Sorry for not having it there the first time.  I’ve updated the download with all the files I have in my source folder.  I’ll probably be moving this to Github or CodePlex so it’s more formally hosted and people can share their work.

Living With The Zune

I've had my Zune for about 6 months now and wanted to revisit my thoughts on it since I first got it.

First, the hardware is great, there is only one issue I have with it (bookmarking) and I consider that more of a software/firmware issue than a problem with the actual device. The interface is great, navigation is fast and easy, the screen is great looking, the matte finish has prevented any scratches and I find I like it's over-all look more each day.

The software, ahh, the software. Ever had an itchy shirt tag or a pebble in your shoe that at first you thought you could live with but after a few hours you feel like you're being tortured and you'll tell all secrets just to get rid of the agonizing pain? Yeah, that's been my experience with the Zune's software. Here are the "pebbles" that have grown into throbbing pains in my arse:

Metadata and Tagging

Almost everything about the tagging support bothers me and I have a whole list of items.

  • Copying songs from Zune to PC results in any songs that don't have their "Album Artist" field set ending up in "Unknown Artist" folder. Extra annoying because both the Zune and the software itself understand that you should fall back to Artist, a standard ID3 tag, when Album Artist, a non-standard tag, is used. Why couldn't they extend the same logic to file copying?
  • Unable to set metadata for pictures or video. So while Vista supports tagging of photos forget being able to access that in the Zune software.
  • "Find Album Info" is painfully slow when trying to find missing album information. It's also not very robust and it's tied into a cumbersome wizard, song-by-song approach. It should be tied directly to the Marketplace so you can find the album or song and say, "see these songs I've selected? map their info onto these other songs I have in my library, including album art."

This is the only the tip, I could fill three blogs worth of posts with my issues with the tagging support.

Large Library Support

My 80GB networked library seems to almost choke the software. When I plug in my Zune it seems to take 5 minutes for it just to re-read everything that's on the device. There really is nothing snappy feeling about the software when it's loaded up with 80GB of music. Free software like Winamp does a much better job with large libraries.

No Bookmarking Support

This is an issue if you listen to long podcasts or books. I'll often want to mark an interesting place in a podcast or remember my position in an audio book. I should be able to set a bookmark, go play a few songs and then return to my prior bookmark in my audio book. I can think of a few ways this could be implemented, such as "turning on" bookmarking support for a track so anytime you navigate away it's position is auto-saved and if you press play again it auto-resumes. Another less fancy but still usable process would be bringing up a song's menu and selecting bookmark. Either way it's a sorely lacking feature and I curse the lack of it almost every day when I lose my place in my daily BBC podcast. Seriously, this should probably be my #1 annoyance.

Unable to Play Directly

If you want to play any music that's on your Zune via your PC you have to first copy it off the device. Obviously it's annoying because you have to take the time to copy it off, then it's doubly annoying if the Album Artist isn't set (see metadata and tagging above) because your songs end up in the great Unknown Artist folder. A subtle yet more insidiously annoying issue is that a lot of my songs go unrated because of this. Since I copy the music off in 'Guest' mode there is no syncing, because there is no syncing anything I rate in the Zune software on the Guest machine is worthless. If I want the rating to "stick" I have to manually copy it *back* to the Zune and that's a crapshoot, as sometimes it over-rights correctly while other times it just creates a copy. If I could just play the music directly I could avoid all of this.

No API

The more iTunes widgets I see the more I realize that the Zune community is missing out. There is a huge database of information and I should be able to easily write plug-ins that both interact with the UI as well as mine the data for great Sidebar gadgets. Great community driven widgets and plug-ins can really add to a product. For example CoverFlow, the lovely ability to flip through album art in iTunes and the iPhone, started out as a plug-in created by a third-party, not as some great Apple genius.

One-Liners

The little bits that annoy:

  • Unable to see album art in the software for songs on your Zune.
  • No global hotkeys.
  • When using a media keyboard to control volume the volume slider doesn't adjust up or down in the software.
  • Recalculates remaining Zune space when you're copying music *off* the Zune. How is that going to affect the available remaining?
  • Marketplace landing page takes too long to load.
  • Limited file renaming choices.
  • No way to tag a song or album as "download for later" or "interesting" in the Marketplace.
  • Zero community or "social" aspect built into the software. Where is the playlist sharing? The user reviews?

The Rest

It's worth mentioning that I'm *not* annoyed by the lack of people to "squirt" songs to or lack of greater wifi abilities. All the little feature some people want, like a calendar, alarm and clock don't phase me. Podcasts? I use FeedDemon to download them. My first desire is a robust music player and music *manager*. It used to be you could have an amazing hardware device and the software could suck since you could manage the device in a number of ways. Take a Creative Zen, you can either copy files directly, use their software, use Media Player, Winamp or a handful of other utilities. Create's music management software could suck all day and it wouldn't really matter. Now, with the software/hardware lock-model of the iPod and Zune the software has to be *at least* as good as the device. Currently the Zune hardware gets a "B+" while the software gets a "D-". I'm really hoping a new version comes along soon that fixes some of these issues.

With all of that being said though don't confuse constructive criticism for dismissal, I still really like the Zune and it's still a joy when it comes to doing the one thing it was really meant for, playing music.

Running a .NET 2.0 App from a Network Share

Just ran into an issue trying to run a simple .NET 2.0 file writing command-line app across a network share. No matter how much beating we couldn’t get it to run until we ran across this little batch file in the comments on the .NET Security Blog post, Using CasPol to Fully Trust a Share:

call %windir%Microsoft.NETFrameworkv2.0.50727caspol -q -m -ag 1.2 -url %1* FullTrust -n %1 -d “FullTrust granted to: %1″

I dropped the code into a batch file called trustshare.bat and ran it like this:

trustshare.bat //machine/sharename

Suddenly the three hours of hair pulling finally ended. The batch file needs to be run on each machine that’s attempting to run the application, not on the machine that’s actually sharing the application.

While I really enjoy .NET for web applications I go crazy trying to use them as stand-alone desktop apps. I much prefer CodeGear’s Delphi when creating standard Win32 apps, you get a single EXE and don’t have to worry about a secondary layer of security permissions beyond the file system during deployment.