HomeSite+ and the Bazaar DVCS

Monday 27 December 2010

I’ve finally come around to releasing the toolbar I use in Homesite for working with Bazaar. There might be some people still enjoying Homesite as their editor of choice, and seeking a solid VCS system, so here’s an explanation of how I work, and a link to the toolbar I created for using Bazaar from Homesite.

VCS versus DVCS

There are a lot of well-known version control systems. Traditionally they had a central location for storing files, and a developer would “check out” a file, work on it, and check it in again, together with a description of what he (or she) did. Examples of VCS’s that work(ed) like that are Visual Sourcesafe and Subversion.

Lately there is a  new breed of VCS that doesn’t keep the sourcecode in a single central location. Every developer has his (or her) own repository (a repository is where the sourcecode is stored, together with all of the changes and descriptions.)
This allows developers to work and commit changes to their own repository, independent of the “main” code. Whenever they see fit, they then merge these commits with the “main” code. A developer can work on a bunch of files to add new features or fix a bug, and then commit them as a single new revision. Bazaar and GIT are examples of these new DVCS versioning systems.

There is an excellent explanation of the differences between traditional VCS systems and a DVCS here.

Using Bazaar under Windows

I’m writing this article to give you a quickstart in using Bazaar under Windows using HomeSite. It is in no way a complete reference to Bazaar. It just explains the way I use Bazaar currently. Bazaar has numerous other usage scenarios besides the one I use.

To start off, download Bazaar and Install it. I use the standalone version myself. When selecting the options for installation, make sure you have Bazaar add itself to your PATH environment variable, also make sure you install QBZR (a GUI for Bazaar). If you accept the default settings, this will automatically be done.

Now that Bazaar is installed, test it by opening a command window and typing “bzr”. Bazaar should respond with:

Bazaar 2.2.1 — a free distributed version-control tool
http://www.bazaar.canonical.com/
….

Setting up Bazaar for solo or team development using a central repository

The way I work with Bazaar is I store my source-code in a central location, I develop locally and I commit my changes to that central spot. This is in fact how traditional VCS’s work. As I mentioned, Bazaar has more scenarios to work in, but this one suits me well. I have my “main” repository on a NAS drive, and I work locally on one or more Windows machines, developing websites under IIS.

To set things up this way, what I do is the following:
I have mapped a drive letter to the directory on my NAS that has all of my different folders with sourcecode. In my case the drive letter is W:, on that disk there is a folder called “websites” and in there, there are folders for the sourcecode of all of the websites I’m developing.

When starting a new webproject, I create a new folder in W:\Websites\, in this example let’s call it “www.demosite.com”. So now I have a folder called W:\Websites\www.demosite.com\. In this folder I add all of the files and folders I already have for this project. I always have an images folder, a script folder and a css folder for example. Also, because most of the sites I maintain are classic ASP, I also have a global.asa file in there. Anyhow; add the files you want to start out with, and when you’re done, open a CMD window and navigate to the corresponding folder (in the example W:\Websites\www.demosite.com\)

Initialise a folder for version control

So now we have a directory of files and folders, and we want bazaar to keep track of any changes there. Note that it doesn’ t matter that you’re working on a networked drive, bazaar works over a networked connection aswell as locally. It can also work using SSH, FTP or HTTP connections, but that is out of the scope of this article.
Back to the CMD prompt; type “bzr init” to start versioning this directory and everything in it (no pun intended). Bazaar will respond with: “Created a standalone tree (format: 2a)”.

Bazaar will have created a hidden folder called .bzr where it will store its information. Unlike Subvsersion, which puts a hidden folder like this in every subfolder, this is the only folder Bazaar needs and uses. So removing versioning is as simple as throwing away this single .bzr folder.

Adding the contents of the folder and subfolders to Bazaar

Now that this folder is in version control, we need to add the files and subfolders in it to Bazaar. We do that by typing “bzr qadd”. This will invoke a GUI tool for adding files to bazaar. By default it will try to add all new files and folders under the versioned directory. Sometimes you will want to exclude some files from being versioned (like Windows’ thumbs.db files, for example). You can do so by creating an “ignore” file, or using “bzr ignore”. The ignore file is beyond the scope of this article, but it’s easy to setup and well documented on the bazaar website.
In the qadd dialog, add all of the files and folders you want bazaar to keep track of and click ok.

Commit the files and folders in Bazaar

The last thing we need to do now, is make our first commit! We have initialised the folder, added the files we need to keep track of, and now we need to tell bazaar to store this information in a commit. Type “bzr qcommit” in the cmd window and in the dialog that appears, type a description of what you’ve done. In this example we can just write “added all of the base files” or something. Bazaar will now add the changes and your message, and you have just committed revision one of your project!

Working in a team or from multiple computers

This is ofcourse very nice, but I want to work on this code from different computers in my house, and if it is a website, I want the code in the inetpub directory of my local IIS. Because the repository (yes, your sourcecode folder is now a repository) is in a central location, this is all possible.

To accomplish this, just open a cmd prompt in the spot where you want the sourcecode folder on your local machine, say “C:\inetpub\wwwroot\”. Now type “bzr checkout W:\Websites\www.demosite.com”. Bazaar will now fetch the sourcecode from that directory on W:, copy it to the local folder and hey presto, you have a local repository.
Please note that this works on a directory level, so the entire folder http://www.demosite.com is copied to c:\inetpub\wwwroot\. Keep that in mind when creating repositories.

Because we used the “bzr checkout” command, instead of  “bzr branch” which  does something similar, bazaar now knows that your local version of http://www.demosite.com is linked to the “main” repository on W:\Websites\. That means that every time you change something in your code locally on C:, and you do a “bzr qcommit”, it will commit to the repository on W:\Websites\www.demosite.com\ as well as to c:\inetpub\wwwroot\www.demosite.com\. This means both repositories are being kept up-to-date.

An advantage of bazaar is that when, for example, the NAS is out of order, or you have your laptop away from your network, you can still change code locally and add the changes to your local bazaar repository using “bzr qcommit”. There’s a checkbox in the GUI that allows you to commit locally only, when you return to your network, you can merge all of your commits again with the repository in the central location.

Also, if you’re working with a team of people, all of these individual developers can do the same “bzr checkout” from the central location like we did above, and have a copy of the repository on their local machine. They can commit their changes, and these changes will also be added locally and to the central location. The only extra step involved is that you’ll have to do a “bzr update” command before you can do a commit.
In a team scenario, it’s possible that one of your co-developers has added a feature and commited it to the main repository. In order to update your own (local) repository with the latest code from the main repository, use “bzr update” to update. Again, because we used “bzr checkout” to create a local repository, bazaar knows where the main repository is stored, and typing “bzr update” will fetch the latest version from that location.
This way of working enables you to work in a team using a central repository of your sourcecode.

To recap, a few bazaar commands:

bzr init – prepares a folder for version control, bazaar adds a .bzr hidden folder to store information.
bzr qadd – GUI tool to add new files you have created in your project and want to add to version control
bzr remove [file] – remove files from version control. The –force option will delete these files from disk, –keep will remove them from bazaar, but not from disk.
Note: deleting a file from disk using homesite or Windows explorer will mark the file as “missing” in Bazaar, use this if you want to keep the version history of the deleted file.
bzr checkout – create a copy repository from an existing repository, “binding” the copy to the original, this is called a “checkout”
bzr qbranch –  GUI tool to create a copy repository from an existing repository, not “binding” the copy to the original, this is called a “branch”.
bzr qpush – GUI tool to push any changes in one repository to another (unbound) repository
bzr qcommit – GUI tool to commit changes to the local repository. If the local repository is bound to another repository, the other repository is also updated.
bzr bind – bind a branch to a repository. (If you used bzr branch, but later on you decide you still want to bind to the original  repository)
bzr qannotate [file] – GUI tool for looking at a file and seeing all changes per line.
bzr qlog [file] – GUI tool for looking at all revisions that changed a file

An example of the workflow in the current setup

The way of working, when the repository is setup and you are working locally on a checkout (a bound repository from another location), is :

– start editing, add a feature, or fix a bug in your local code
– go to the local directory in a CMD window (I usually have one open the entire time)
– use “bzr update” to see if your local code is up to date with the central version, if not, bazaar will update your local version
– use “bzr qadd” if you have added any new files to the code
– use “bzr qcommit” to add a description of what you did and commit your changes to the local and the central repository

The Bazaar toolbar for Homesite

Finally for the Homesite toolbar;
I’ve found that working with bazaar is very easy, but as you can see, it does require some work in the command prompt. Especially when working in an editor, it can become tiresome to go back and forth to the command prompt every time, so here’s what I did:

First I installed a “command prompt here” menu option in the (right-click) context menu of Windows. Here is an explanation of how to do this. This option will show up in HomeSite aswell, when you right-click a folder. Windows 7 has this feature built-in when you press shift and right-click a folder, but that doesn’t work in HomeSite. I used the registry-hack from  the aforementioned site, this works fne in Windows 7 aswell. I no longer need to press the shift-key and it works from HomeSite.

Using this context-menu item I can easily open a command prompt to any of my website folders from Homesite, I no longer have to navigate in DOS to the correct folder.

The second thing I did was create a toolbar for Bazaar for HomeSite. It has the functions in it I use most. Please note that it is made for the way of working I described above. (so using a checkout). It is also possible to use a repository that is not linked to a central location, but in that case you have to use “bzr push” to push any changes you make locally to another repository. These are the buttons I have implemented:

* bzr status -> shows the status of your current repository
* bzr update -> updates your files if they are bound to a master branch
* bzr commit-> commits your files
* bzr anotate -> shows the changes in the file that is currently open in Homesite
* bzr log (current file) -> shows all revisions of the current file
* bzr log -> shows all revisions of the current repository
* register WSC -> this is not bazaar related, but a tool I use a lot personally in ASP development. You can easily remove this button in HomeSite.

You can find the Bazaar toolbar for Homesite here. To download it, you’ll need Bazaar installed :) The instructions for using Bazaar to download code from Launchpad is here.

Note that you can edit the toolbar yourself, you’re very welcome to implement things further, some buttons are just a call to one of the qbzr GUI tools, others have some more intelligence: HomeSite can use vbscript scripts to automate things, and for example, I have implemented a script that can figure out where the current root of the repository is as seen from the current open file. Let me know if you have an interesting addition so I can integrate it on Launchpad.

Advertisements

Classic ASP and Access under Windows 7 x64

Monday 27 December 2010

Hi All,

A quick tip for those of you that want to run a classic ASP website using an access database under a 64-bit operating system; this doesn’t work out of the box.

The problem you’ll see is that IIS reports the driver as mismatched or missing. You’ll get one of these errors:

Microsoft OLE DB Provider for ODBC Drivers error ‘80004005’

[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

OR

Microsoft OLE DB Provider for ODBC Drivers error ‘80004005’

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The reason is that there are no 64-bit odbc access drivers (yet). I read somewhere that Ofiice 2010 might have them, but for now, the solution is to run the application pool your website runs in, in 32-bit mode.

To do that, open IIS manager, in the treeview on the left go to the application pools and select the application pool your misbehaving website runs in. The advanced settings link on the right opens a popup where you can find an option to enable 32-bit applications. Set it to TRUE, recycle the pool, and your access driver/website should work.

 

 

server-side couchdb access using classic ASP

Saturday 22 August 2009

Once in a while some new technology pops up that makes me want to experiment a little. CouchDB is one of these technologies. If you haven’t heard of CouchDB before, Matt Aimonetti has a neat presentation on it over on slideshare.

Although I’m trying to find out what programming language to dive into next (python and c# being my main candidates), I’m still most proficient in classic ASP.

Now the interesting thing about CouchDB is that it’s API’s are in javascript. Querying is done by javascript and it returns JSON (Javascript Object Notation) objects as results. The people at couchDB have included a client-side javascript library to interface to the database client-side, so directly from a browser. Now that’s nice and all, In theary this allows you to build a web-app totally client-side, but I’d really like my data access code on the server, where it’s not visible to everyone.

Classic asp ofcourse has javascript support built-in, so ironically, classic asp is a language that lends itself quite well by default to talk to CouchDB server-side. So one of the oldest web-languages is (unintentionally) one of the most fit to talk to one of the latest database technologies.

Anyway, it seems I’m not the first one that figured this out, and I found an extended version of the javascript library included with CouchDB, by Nathan Smith. This is already something that’s directly useable from ASP. You can include the script in your server-side ASP page, and talk to a couchDB database.

I needed to take this one step further though, I wanted this library encapsulated in a .WSC file. If you’ve read some of my other posts, you know I use wsc’s to create objects in ASP, so the spaghetti-code argument a lot of people have against classic ASP is no longer valid.
The thing with WSCs is that, unlike includes, you can conditionally use them. An include in an ASP file has a lot of overhead, because it is, by default, always included. The server includes the file, and then the ASP interpreter goes ahead and processed the page. In a WSC you can keep your code separate from your ASP pages and conditionally (I.E. in an if…then statement) load them. Anyway, let’s not get sidetracked here.

It was kind of hard to encapsulate the code the way I wanted to, ideally  I would have the WSC and use it like so:

var couchdb;
couchdb=GetObject("script:"+Server.MapPath("/~components/couchdb.wsc"));
couchdb.allDbs();
var newDb = couchdb.createDb('testdb');
....

Instead, I had to have a function in the WSC that creates a new object and internally instantiates and returns the couchDBserver object. The code now looks like this:

var couchdb;
couchdb=GetObject("script:"+Server.MapPath("/~components/couchdb.wsc"));
var server = new Object();
server = couchdb.server("http://192.168.2.197:5984");
server.allDbs();

Also, I haven’t figured out yet how to use the library using VBscript instead of javascript, but the proof of concept is there. The code is hosted on launchpad, so it can be looked at and improved upon.

Please note that the code needs a couchDB database set up somewhere. I have done this by installing it on my linux laptop and running it from there. The ASP code runs on my Windows workstation. The installation of CouchDB on Windows seems to be quite cumbersome still, so a separate machine (this could also be a virtual machine) is propably the simplest way to go at this point in time.

If you have an improvement or something nice you’ve done with this library, please share in the comments, or better yet, on launchpad. I’m curious to see if I’m the only living classic ASP developer left tinkering with this stuff :)

When a cover becomes better than the original

Wednesday 10 September 2008

While I’m posting video’s anyway, I thought I’d publish my favorite one too. This is a video of Matt Weddle of a band called Obadiah Parker, performing Outkast’s “Hey Ya” acoustically. It’s too bad the sound-quality isn’t great, but still… This rendition made me play the video over and over and over again. Enjoy.

UPDATE: The video can also be seen on YouTube, but I couldn’t embed the youtube video in my blog (the owner prevents this video from being embedded), so if the Google video doesn’t work you’ll have to click the link below:

http://www.youtube.com/watch?v=8-8nkkOA_AM

Hug a developer

Wednesday 10 September 2008

Finally

A video that says it all. A video that touches on the problem us developers have to face day in and day out. The message is clear. Hug a developer. Do it today. We really need it.

Bazaar and Windows part II

Saturday 21 June 2008

As promised, a little update on how bazaar is working for me under Windows. As it turns out, the plans I had for implementing SVN at work are now obsolete, I liked bazaar so much, we are now using it at work as well.

In the last post we saw how to create a local repository and see some changes between that and your working copy. All nice, but what if you’re not solo’ing a project? Most of the time, you’ll have a development server, maybe even a testing server available. In my case, I have a central server set up from which I run my local websites. I have a local DNS and that simplifies webdevelopment a lot. I have URL’s to all my projects I can use internally.

Anyway, what you probably want, is for your server to contain the main project, work locally on that project and when you’re done editing your branch, publish it back to the server. What I did to accomplish that is to go to my server and into the WWW root. My server is setup much the same way as my workstation (see last post). In my wwwroot are all the websites I’m currenty working on, so the thing to do here is cd into one of them and use the exact same procedure as described in the last post, to create a new project.

Okay then, we have a working repository on a shared server. The next step is to go to your local workstation and go into the wwwroot there. According to Bazaar’s documentation it should be possible to create a new branch from a remote location using different protocols (FTP, SFTP, HTTP, BZR and FILE). To be honest with you, the only one that worked for me right away was FILE. I have FreeSSHD set up on my server and I tried SFTP using that, but the branch command, after asking for my password, just gave me a cryptic:

Authentication (password) successful!
Secsh channel 1 opened.
[chan 1] Opened sftp connection (server version 3)
bzr: ERROR: Operation unsupported

After that, I though I’d try branching via HTTP, this is read-only, bazaar does not (yet) support writing back revisions to a webserver, but alas, another cryptic error:

“bzr: ERROR: Not a branch: “http://%5BURL to my project]/”.

I can imagine this being a showstopper for people, but I had another option to try, the FILE protocol. (I admit I haven’t sought out any help on this in the bazaar community, so if someone finds out how to use SFTP with freeSSHD under windows, leave me a message.) UPDATE: This seems to be  a problem with freeSSHd, using CopSSH on Windows works!

I have a share on my workstations to the wwwroot on my server, mapped to my local W: disk, so I used

bzr branch w:\pure.precompiled.local\

This created a branch of the project on the server on my local machine. Yay!. So now we can develop locally, commit locally, and when we like what we’ve done, push it to the server. For a quick test, open up your editor, edit a file and save. Now use

bzr status

You’ll see that you have (a) modified file(s). Suppose you are happy with your changes, you can commit them (locally) into a revision.

bzr commit -m “edited the title”

Nice, we now have a local revision 2. Now I’d like to see that revision pushed to the server:

bzr push w:\pure.precompiled.local –remember

The –remember option makes sure bazaar remembers where to push changes. If all went well, bazaar should say:

All changes applied successfully.
Pushed up to revision 2.

Quickly pointing my browser to http://pure.precompiled.local; and presto! My server shows me the version with the pagetitle changed.

Now this is all very nice, working locally, commiting locally and then pushing to the server. But if you work with a central server there is an easier way.

Type: “bzr bind w:\pure.precompiled.local” to bind your local repository to the server’s repository. What this does is make sure that any commit is done locally as well as on the central server, at the same time. So there’s no need to use “bzr push” anymore.

To work like this there are only a few key commands to use:

1. bzr update – updates your local repository with any new changes on the server
2. bzr commit – commit your local changes locally and to the server

This is the way I work now at home (solo) and at work (in a team). There is one caveat: the commit to the server doesn’t UPDATE the files on the server. So your changes are stored on the server, but the files on the server stay the way they are until you run “bzr update” locally on the server. There are a few plugins that claim to be a way around this, but for me it’s just a minor problem. I scheduled a bzr update to run every day at work so our server can be looked at by our test-team. If we need an immediate update, I run it manually, no biggie.

In the meantime I made a bazaar toolbar for homesite that lets me do these things and more in a GUI directly from homesite. It’s not really polished, but when I come around to that I’m thinking of posting it on launchpad. If anyone is interested right now, leave me a message.

Happy versioning!

Bazaar, Araxis Merge, Homesite and Windows

Wednesday 7 May 2008

As promised, some more info on how I’m getting along using Bazaar as my VCS of choice under windows, using homesite for classic ASP development.

Let’s start with the basics, there are two possible ways of installing Bazaar under Windows; installing the version for Python, or installing a standalone .EXE with Python “built-in”. Not all plugins work with the standalone version, but I installed it anyway, because it’s an easier install. Also, it shouldn’t be too hard to uninstall the standalone version and install Python and Bazaar for Python later on, if the need arises.

After installing Bazaar, you should be able to start bazaar from any command prompt. So start a command line (for example by using Start…run… and typing ‘cmd’) and type ‘bzr [ENTER]’. You should get a general explanation of Bazaar’s most used functions. If not, try rebooting. Bazaar should have added itself to your PATH environment variable. This way bzr.exe is found no matter where you type it in a DOS prompt. Sometimes it takes a reboot for Windows to see a new addition to the environment variables.

If you verified that Bazaar can be started, it’s time to set up your workstation. Usually, when working with a version control system, you work on your local machine. In webdevelopment, this is a little trickier than in application development, but not a lot. The workstation version of Windows (XP pro, 2000 workstation) DOES have the irritating limitation within IIS of 10 concurrent users and only one active site at any time. For developing a website, this is usually not a problem. There are a few tools that can run in your tray and allow you to switch between sites easily. I use IISadmin.NET myself, but there are more. Using a tool like this makes developing on your local machine quite do-able.

If you have installed and configured Internet Information services (IIS) on your workstation, you can go to the wwwroot (c:\inetpub\wwwroot\ by default) and create a few folders for your different projects (that’s the way I work, YMMV). Set them up in the IIS console and fill the folders with your files. This is just plain old setting up IIS, I won’t go into that, there are enough sites explaining the procedure. Now, say for example I have a site called “pure”. I have the folder “pure” created under C:\inetpub\wwwroot\ and I have added my html/asp/js/css files to it. I activated the site in Windows IIS console (set the root folder to “C:\inetpub\wwwroot\pure\”), started the site and I checked to see if it worked by going to http://localhost/. Congratulations, you are now developing locally.

Anyway, back to the repository. Say I want to version-control this site with Bazaar. The first thing to do in Bazaar is to let bazaar know you want to version-control this directory. Start a command prompt, change directories to the folder you want to version-control, and initialise Bazaar:

cd C:\inetpub\wwwroot\pure
bzr init

Bazaar will have created a hidden folder called .bzr in the directory, and this is the only extra folder that it creates (As opposed to Subversion that creates a .svn folder in ALL your subdirectories aswell). This folder is actually your local repository. Now we’re ready to let bazaar know what files we want in this crispy new repository:

bzr add

You will see bazaar recurse through the subfolders of ‘pure’ and add all the files it finds. (You can exclude certain files if you wish, check the bazaar user manual to find out how). Okay, we’re still not done yet, bazaar knows what files to track, but these files have no ‘state’ yet. To give them an initial state, commit them to the repository by typing:

bzr commit -m "Initial import"

This will add the files in their current form into the repository. Always use the -m option to give your commit action a short description. This is version control 101; You have to know what you’ve done to any changed files, the comment after -m lets you describe what you’ve done.

Now, the advantage of working on a local webserver is that you have now already published the repository! If you have the .bzr file in the root of the ‘pure’ folder, it means that it can be reached from any other location that can reach your workstation via HTTP. You’ll have to decide for yourself what the security implications are in your situation, but for me this is a plus. I have a few workstations and a server, and this allows me to quickly pull a repository from my workstations.

Now, fire up homesite if you will and edit some of the files. Maybe even get some serious work done while you’re at it. After you’ve changed a couple of things and saved them, switch back to the command prompt and type:

bzr status

If all went wel, bazaar will tell you what has changed since your initial import. If you are happy with your work, tested it and you want to start on your next task or bug, you can commit these changes:

bzr commit -m "fixed a bug"

Bazaar will tell you what revision you’ve just commited and you can start with a clean slate (a new revision) for your next work (you can check this by running bzr status again, nothing will show up). Now to demonstrate what bazaar can do, you might want to check the difference between your current version and revision 1:

bzr diff -r1

You will see what has changed, in which files, by who and at what time. I have to admit though that this isn’t quite friendly to read. Not everything has to be command-line based though, and although Bazaar is, your DIFF/MERGE tool doesn’t have to be. I use Araxis Merge myself, and there is a plugin for bazaar that lets you use your own visual DIFF tool. For araxis merge do the following (after installing it ofcourse)

Install the Difftools GUI plugin (just copy the folder in the ‘plugins’ directory of bazaar: C:\Program Files\Bazaar\plugins\)

Add araxis merge to the PATH environment variable
Windows needs to be able to find the Araxis executable even if the command prompt is in an entirely different directory. Adding the folder to your PATH environment variable will do just that. To do this right-click on the computer icon on your desktop and choose ‘manage’. On the ‘advanced’ tab there’s a button ‘environment variables’. Click it and add “C:\Program Files\Araxis\Araxis Merge v6.5;” to the PATH variable under “system variables”. (Check the path, this is for MY version of Araxis Merge). Reboot or log out/in after changing the variable, or else Windows won’t pick it up.

setting the path environment variable

Configure araxis to ignore .bzr folders
Araxis needs to ignore the .bzr folder for it to work correctly. You can do this in Araxis itself under “view…options…filters”. Just add a type “exclude”, matches “folders” and pattern “.bzr”

araxis options

Now try it by using the following command:

bzr diff --using consolecompare.exe -r1

This should give you all the changes neatly summed up in araxis. To make things even easier, you can create an alias for comparing in araxis. You can create command aliases in the bazaar.conf file. You can find this file in windows under “C:\Documents and Settings\[YOUR USERNAME]\Application Data\bazaar\2.0”
Just edit the file with a text-editor and add the following lines:

[ALIASES]
vdiff=diff --using consolecompare.exe

Now try it by typing the following statement in the command prompt:

bzr vdiff -r1

Pretty easy he?
well that’s enough for one evening. I’ll post the rest of my experiences with bazaar under windows in a next post.

Version control

Tuesday 6 May 2008

During the last few days I’ve been looking into version control systems for use with my projects at work as well as at home. In the past I have used Microsofts Visual Sourcesafe in combination with Homesite. This works fine, create a project in Homesite, link VSS as the Source Control software and Homesite shows you what’s checked in, what’s checked out and the world is a happy place. This works because Visual Sourcesafe has an interface called SCC. Homesite supports SSC, but unfortunately not a lot of other versioning systems have an SCC interface.

Ofcourse, VSS costs money, and lately there have been more than a few open source competitors gaining momentum. Looking into them I found that version control seems to be focused on linux more than on windows. Cool new systems like Bazaar, Mercurial and Git have little or no support for windows. I know my friend Tjarko over at Carlos Gallupa uses Subversion, but that needs apache, and I really feel uncomfortable installing a complete webserver for the sole purpose of hosting a repository.

Bazaar and Mercurial look promising, because they are Distributed VCS’s instead of regular VCS’s like SourceSafe or Subversion. Branching is much easier in DVCS software. For an excellent explanation of the differences, look here. I’m really leaning towards Bazaar or Mercurial for that reason, especially at work, it would be nice to create branches and revisions on-the-fly.

The biggest problem is the lack of windows clients for both systems, let alone integration into Homesite. Oh well, probably I’m a little ahead of the game again. Maybe I should just try subversion and try mercurial or bazaar when the tools for windows appear… Or I could use Homesite under WINE and use a linux GUI :)

update:

In the end I decided on Subversion at work, as we can work with a central repository there. There is a pretty painless server setup for subversion called Visual SVN server. It includes a Windows MMC tool for managing your repositories and the apache server is included and installed automagically.

On the client side I found there is an SCC plugin available for subversion. So using it from Homesite and later on from Visual Studio should not be a problem.

At home I decided to go the bazaar route. I think programmers should really not care about using the command line, I’m figuring it out as I go along. In a next post I’ll give you my findings and some pointers on using bazaar under windows.

Tools of the webdevelopment trade

Monday 10 March 2008

Having to re-install my PC at work the other day made me realize what a diversity of little tools I use to do what I do. I decided to make a list, so here goes.

Homesite

Still my editor of choice. For working in classic ASP nothing beats it, not even Visual Studio 2xxx (of which the new versions don’t support classic asp anymore) or dreamweaver (too much WYSIWYG). It really is too bad there’s no replacement under linux. I’ve tried different editors and none have vbscript highlighting. Propably the one that comes closest (and the one I’m using right now under linux) is Komodo Edit. (which is open source now by the way). Eclipse is a little too bloated and slow to my taste.

Toptools

Every webdeveloper needs a colorpicker, screenruler and screengrabber, especially in the beginning of a project when the design has to be made into XHTML/CSS. I used to have these tools seperate, and I was especially fond of screenruler. But recently I discovered toptools. It has all of these little tools in one handy free package that runs in your tray.

Royal TS

To quickly log into remote webservers and SQL servers, this little gem unites all of your terminal server connections and lets you manage them from one interface. It saves settings and password per connection if you want and you can categorize everything. Oh and it’s free :)

Launchy

Launchy is really one of my favorites, not especially for webdevelopment, but on the whole. It is a tool that let’s you quickly start any application in your taskbar. Pressing alt+space gives you a textbox and you can start typing the name of the program you need. It autocompletes the name, so as soon as you see the complete name, press ‘enter’ to start it. This really saves time, because you don’t need a mouse at all. Also, it ‘learns’ what programs you use more often and they come to the top of the list. The other thing it let’s you do is use special commands like “wikipedia”, pressing tab then lets you type any keywords you’d like to search for on wikipedia. It has more plugins, but I suggest you just try it out, I guarantee you will be hooked.

FreeSSHD and winSCP/puTTY

For people that dislike terminal server or need access to linux machines, theres an alternative. FreeSSHD is a service you can install and run on a Windows machine. It gives you file transfer and a secure shell to log into from the outside. To do that from windows you can use winSCP in combination with puTTY. WinSCP gives you Secure File Copy and SFTP, which is much safer than regular FTP. PuTTY lets you log into the SSH server and gives you a command prompt. This setup has actually saved me a trip to one of my servers a few times. I used to manage a server that didn’t completely reboot after installing windows updates. It closed most running services (including Terminal Server services) and after that it gave up rebooting. The result being that I couldn’t connect to it anymore and the machine still hadn’t rebooted. After installing FreeSSHD I could still connect to the command prompt with puTTY, after the machine got stuck, and manage the server from there.
By the way, another thing freeSSHD allows you to do is tunnel any service in a secure sockets layer.

Inkscape

Inkscape is actually an open source vector program, like Illustrator, but it allows me to quickly create a flowchart or a diagram. So that’s mainly what I use it for. The files it creates are saved as SVG, so if you make use of SVG in your work, you could also use it to create SVG and integrate it in your websites. I don’t really use advanced UML tools, so for the simple stuff inkscape is great. If anyone can recommend a good UML tool (preferrable free), let me know.

Photoshop

The photo-editor to rule them all. It’s an expensive piece of software, but once you get to know it (or the 10% of it you’re likely to use), you’re hooked. I had Photoshop classes in school and every employer I’ve had since made use of it, luckily. There’s not much you can’t do with Photoshop. I’ve tried GIMPshop under linux and Windows, but it just doesn’t come close enough…

SQL server / SQL manager

This is the SQL server client tool. It allows you to create, edit and query data in SQL server. Not really exiting, but I need it because almost all the database work is done in SQL server. If you’re looking for a free alternative, I can recommend mySQL, which also has nice management tools, works under windows and seems to be a pretty fast database. By the way, the upcoming version of SQL management tools (2008) has intellisense, which is very nice.

Mozilla Firefox | webdeveloper toolbar | FireBug

Firefox is the browser I focus on first when creating a webpage. If it works in Firefox, I tweak it to work in IE , Safari and Opera (if need be). Firefox just has the nicest tools for debugging CSS and javascript. The webdeveloper toolbar gives you a lot of handy tools to quicky trobleshoot any layout issues you might have. Firebug is a javascript debugger. Internet explorer has a similar webdeveloper toolbar, but IE’s javascript debugging sucks like a black hole. If you want an even more advanced javascript debugger in Firefox, you might want to take a look at Venkman. I find Firebug does the job for me almost always, though.

prototype

Not really a tool, but I thought I’d mention it anyway. Prototype is a library you can use in your webpages to simplify Javascript programming and take care of any cross-browser issues in Javascript. There are a lot of libraries around these days, like jQuery and the Yahoo Javascript libraries, but I started out using prototype and I really liked it. I tried making the switch to jQuery once, but I came back to prototype. I guess this is just a matter of taste, however, if you’re on a big project, it’s probably a good idea to use a javascript library to simplify your programming.

lookout for outlook

At work, I’m forced to work with Outlook, which isn’t too bad, but I prefer Mozilla Thunderbird at home. Anyway, a really nice tool for searching your Outlook mail is Lookout. Originally developed by Lookoutsoft, this company was bought by Microsoft, so Microsoft could integrate it into Outlook themselves. Soon after that Microsoft brought out Windows Desktop Search, a tool that can search though all data on your local computer. However, I have tried MS desktop Search to search my Outlook e-mail and I just couldn’t get it to work. Lookout just works… It’s fast and using keywords like from: and to: you can specify exactly what mails you want to filter out. Microsoft has deleted all references to lookout on its site, but the link in the title of this chapter still seems to work.

ToDoList

I’ve been looking long and hard for some sort of project-management tool, and for development this little gem seems to have most of the things I need. It’s open-sourced, so that’s a plus, also, it has features like prioritizing, setting due dates, assigning tasks to different people, time-tracking and the possibility to use it among a group of people. At work we have an existing web-based system for bug-tracking and ToDolist integrates with systems like this by letting you create a button and setting an ID for a task. Pressing the button launches a browser and you can set it to go to your web-based bugtracker with the ID as a parameter. Very nice, especially in a small company or for a freelancer where bugzilla or something similar might be too much.

A warning to classic ASP programmers

Saturday 16 February 2008

I have been working on a very large corporate web application using ASP/WSC. The application was very fast and performance was not an issue.
UNTIL we updated our servers a few months ago. Performance went down 400% and IIS hung and crashed very often. The asp pages were slow and unresponsive.

We have been working our butts of to solve the problem, de-installing servicepacks for windows and sql server and in the end re-installing complete servers.
We noticed the difference in the end when we had one IIS server that was fast and had a few updates that another IIS server missed.

These updates were:
– .net 2.0
– .net 3.0
– internet explorer 7 (includes microsoft windows script 5.7)
– msxml6

Although we are not 100% sure which one of these updates breaks classic asp (or at least cripples it), we are fairly sure it is the new vbscript.dll 5.7 distributed with IE7.
I also am not sure if this problem only arises when you use WSC’s in your ASP code or if it is a generic problem in classic asp.
Anyway, removing these four updates resulted in our asp / wsc application accelerating back to the performance we were used to and to the crashes in IIS stopping.

So please if you use classic asp, be careful to install IE7 on your IIS server. At least check performance levels.
Hope this message helps anyone struggling with the same problem, as we were unable to find any leads towards a solution.

I’d also like to hear if any other people are running into these problems and can verify the solution. Specifically, I am curious if this problem only happens on asp using WSC objects, or if it also happens on classic asp websites without the use of WSC.