Educating the world

Our blog has over 10,000 readers a month

Shared mouse with Synergy

November 7th, 2011

I upgraded my PC at work which meant transferring all my old files and configuration from one computer to another. The pain is having 2 keyboards and 2 mice cluttering up my desk which is pretty messy already! Files and the like are easy to transfer; you can just set up shares and copy the stuff over - don’t get me started on windows copying. Keep an eye on Sourceforge for my application JustF’ingCopyIt, JustF’ingMoveIt or JustF’ingDoIt not sure which yet! It’s all the other bits that you want to move over like application configurations or the contents of ini files that you want to copy without the actual application.

This is where Synergy comes in. Synergy lets you use one keyboard and one mouse across multiple computer desktops. It makes it feel like you are using one computer with 2 monitors and not 2 computers. It is effortless to switch between the PCs. Cutting and pasting is shared between the two.

While it isn’t common, you can mix the platform desktops. Synergy shares a single mouse across Windows (XP/Vista/7), Mac OS X (10.4/10.5/10.6), Ubuntu/Debian, Fedora/Red Hat to provide a multiple desktop feel.

On each PC:
Download the application for the operating system you are using from :

The setup is more like and X-Windows environment, in that your primary PC is a client to loads of other PCs that serve you.

Choose the PC that you are going to be primarily using as the master. If you are using them all equally then select the most powerful as the master and if they are all the same specification then pick the one closest to the door!

  1. On the master load the Synergy program and make sure the Server (share this computer’s mouse and keyboard).
  2. Click Configure Server….
  3. Drag a picture of the monitor in the top right of the screen and place it where you would like it to appear in relation to you.
  4. Double click it.
  5. Change the Screen name to the name of the computer that will be connecting with you.
  6. Click ok.
  7. Then click Start and close when you are done.

On all the clients load the Synergy program and make sure the Client(use another computer’s keyboard and mouse). Enter the name of the master PC and click Start, and then close when you are done.

In both cases closing will move the application to the System Tray.

Words I can never spell

November 1st, 2011

One of the greatest obstacles facing a dyslexic is how do you look up a word if you can’t spell it? Most of the time I can recognise the correct spelling so can pick it out of the list provided by the spell checker. But what if your spell checker can’t recognise it either.

There aren’t many phonetic spell checkers or dictionary sites and there are only a couple of words that get me each time, so I thought I’d list them here:

  • He goes to the shops.
  • He does his best.
  • I want to precis this text.
  • There are five scenes in this play.
  • We are running 2 scenarios.
  • The Lake District has lovely scenery.
  • I have 5ish cousins
  • My mortgage is really expensive.
  • I’ll definitely be there.
  • You must guarantee there are no underscores in host names
  • French pastry croissant

I’ve decided to expand this page to include helpful information on grammar.

Learn Web Application Project Tutorials (with C#)

October 21st, 2011

I’ve been learning how to use Microsoft’s Web Application Projects in C-Sharp. I started with the MSDN documentation and in spite of being familiar with all the web concepts I found Microsoft’s documentation confusing. The code examples that were listed appeared to be incomplete snippets. I had searched the internet looking for tutorials but couldn’t find anything.

After altering my search a bit, I found a tutorial which was all based on Visual Studio 2003 & 2005. The instructions are just the same for Visual Studio 2010.

I found a set of 6 tutorials which takes you from creating a web page with a simple calender on it through to data binding and on to user control libraries. Each tutorial contains step-by-step instructions with plenty of screen shots.

If you want to learn then this is an excellent and surprisingly simple starting point.

Working in teams with Visual Studio and Clearcase

October 20th, 2011

This article talks about how you can use Visual Studio and Clearcase in combination in order to provide more effective team integration and operation.

Visual Studio has 2 important features that facilitate this:

  1. Grouping project configuration with the project.
  2. The ability to split the configuration of the IDE between team settings and personal settings.

One of the great things about integrating with a source controller is that the more configuration you put into it the easier it will be for everyone who uses it. Shared files can be added to the source controller instead of being placed on network resources because you want them to change as the projects move along.

Project configuration

Variables can be used in the project definition file to point to various places e.g. for header files or pre-compiled libraries:


If you have a set of variables that map to the latest versions of a supporting package you would expect those variables to change as the code base moves forward. If you looked at a version from last year you would like those variables to point to what they pointed to a year ago.

I currently work for a company that uses normal environment variables in order to get around this problem. As far as I can work out there are no advantages of doing this and several disadvantages:

  1. Every user needs to set up all the variables on their PC, or their new PC, or the dedicated PC they are using as a build machine.
  2. Every user has to keep track of when these variables are modified or new ones are created.
  3. Once an environment variable is set up you can’t have a different definition, for that environment variable, per project.
  4. You need a master document to hold all these configuration options, so that when you are trying to use a new machine you don’t miss anything out.
  5. Don’t know about you, but I use ten’s of supporting libraries, and so the more you have the longer it takes to configure a machine and the more error prone this process can be.

As a consequence of not being able to change what an environment variable points to, per project, it has meant that they needed to set up an environment variable for each version of each supporting library:


So when someone updates the support library:

  1. They must get every developer to add a new environment variable SUPLIB_3_0=z:\lib3.0 to their machine.
  2. They must also update a master document containing all the configuration items that must be configured to do a build.
  3. All the projects that use this supporting library must have their project files changed to use this new location to pick up the latest libraries.

Visual Studio has a solution file and one or more project files. The solution file is just a container for project files, their inter-dependencies and what kind of build you would like to do (Debug/Release). Project files hold all the settings required to build the project including locations of header files, supporting libraries, etc. A single project may appear in many solutions, so you may need to be careful about what you add because it will be applied to all solutions that use that project. This is ok because you want all the projects to move forward at the same time. It’s a developer’s nightmare to have to support many different supporting library versions; particularly when it comes to finding bugs.

Irrespective of whether you use snapshot views or dynamic views these supporting library locations can change significantly. A good trick is to use relative references to the supporting libraries but thanks to Microsoft that doesn’t work if you want to change to a different drive letter.

The best way to share project information across the source is to use user defined macros. This is quite simple to set up.

  1. Firstly navigate to the location of the solution file ending .sln.
  2. Create a file called SolutionProperties.vsprops in your favourite editor.
  3. Enter the following definitions. You can see that ZDRIVE is defined as the first macro and it is used in subsequent macros. Under Clearcase (and every other source controller) everything is relative to the root. It’s just that the root can change its location.


    <?xml version="1.0" encoding="Windows-1252"?>
        ProjectType="Visual C++"
  4. Check in the SolutionProperties.vsprops
  5. For each project file:
    1. Load the solution/project into Visual Studio.
    2. Right click on the project and select Properties.
    3. Under Configuration Properties, click General.
    4. In the right hand configuration panel change Inherited Project Property Sheets to:
    5. Save project configuration file.
    6. Check the project files into the source controller.

The $(SolutionDir)\SolutionProperties.vsprops’s location is defined using a standard Visual Studio macro and so it becomes independent of file system paths.

There is a precedence order to the configuration files, newer variables overwrite predefined variables. Now instead of having a multitude of variables defining all the versions of a supporting library, you just need one to be defined in the SolutionProperties.vsprops. The project needs to be updated to change the SUPLIB_3_0 to SUPLIB, but once that is done there shouldn’t be any other need to update the project file again.

When you need to update the supporting library the person in charge of doing it can update their local copy of SolutionProperties.vsprops, build and test the new library. When they are happy they check in their local copy of SolutionProperties.vsprops. The change to the new library is reflected in all the other developers views without them needing to know or care. They have been decoupled.

Team configuration in the IDE

There are many options that should be set up in a team configuration file. These settings should apply to everything and everyone. The best example of this is TABs or spaces. If you checkout a file with spaces making up the indentation and your IDE is set to use TABs then when you check it in, every line (or the line you have edited (depending on the preference)) will be different to the last version which makes spotting differences between files that bit more difficult. You may have a code formatter that needs to be allied to code before it’s checked-in, or want extra warning flagged switched on (warning free code - is good code!).

Unlike library and header locations there will be a lot of personal preferences that will have to be contended with. You will have to arbitrate between what you consider team settings and personal preferences. The easiest thing to do is:

  1. Set up a Visual Studio installation the way you want.
  2. From the menu bar select Tools -> Options
  3. From the Options panel, select Environment -> Import and Export Settings
  4. The Automatically save my settings to this file option will point to your current settings file.
  5. Copy the current settings file to the solution directory of the source controller and call it TeamSettings.vssettings
  6. Edit it, only keep the settings that apply to the team and remove everything else.
  7. Check in the team file.
  8. Send notification to your developers. Each developer must:

    1. Inside Visual Studio, click the Tools -> Options
    2. From the Options panel, select Environment -> Import and Export Settings
    3. Check the Use team settings file
    4. Unfortunately macros are not supported here, although they maybe in the future. Edit the location box to point to the team settings file.
    5. Click OK

Like projects, there is a precedence to these settings so they may be overwritten by a user setting. If everyone is overwriting a team setting then it’s a really good candidate for updating the team settings file so everyone doesn’t have to do it. The next time you colleague launches Visual Studio it will pick up the new team settings and you will have saved them a bit of time.

Small comparison of PHP Frameworks

October 11th, 2011

I’m working on a PHP web site and I want to add a user authentication component. In the past I’ve written hundreds of these things and couldn’t be bother to write the same code all over again. You know the story: create user table in the database, add a load of database table management web pages to create, modify and delete users, then add the concept of a logged-in user to each page. It’s a lot of work. Those of us in the “know” call this boiler plate code and it is basically a laborious distraction away from writing our application.

I thought I’d check out some of the PHP Framework tools available to see what there is out there that could handle this for me. This is by no means a comprehensive list. I wanted to briefly look at a couple and choose; I didn’t want to spend all day trying to pick holes in each one. I figured that for such a small requirement it wouldn’t take long to implement the user authentication. If one of my short list didn’t shape up then I could just swap it out.

My only goal is to find something that will handle users for me. The framework that gets me closest to this wins.

There is a handy web site called PHP Frameworks that lists the majority of the frameworks. It has a really handy table that describes which features are supported by which frameworks. The features it tracks are: PHP4, PHP5, MVC, Multiple DB’s, ORM, DB Objects, Templates, Caching, Validation, Ajax, Authentication Module, Modules and EDP.

The Akelos framework describes itself as a Ruby on Rails port for PHP. I’ve used Grails before. Although they can save you a lot of time, you lose the time benefits in trying to learn all the commands. One just seems to spend all of ones life trying to figure out why it didn’t work and hunting for bizarre error messages in forums.
There is a “Creating a blog in 20 minutes using the Akelos PHP Framework” screen cast. A Spanish guy with an unpronounceable name whizzes through the tutorial. It’s quite comprehensive but you really need to run through it with him feeling your way along with the application and trying different things. There are many commands to create controllers, models and views, but if Grails is anything to go by, there are a host of other things you can create which will slowly suck the life out of you! There just seems to be loads to do and read before you can do anything.
Verdict: Once bitten twice shy. Anything which uses convention over configuration requires you to learn all the conventions which are often not obvious or conventional. I don’t really want to spend the rest of my life doing this. For what I need this is too much effort and work.

Dingo on the other hand has a really simple website. This project works less like a framework which is all encompassing and more like a set of classes that can be slotted in. You need only learn and use the helper classes that suit you. Dingo is still an MVC framework but it is so unobtrusive you should be able to fit it in to an existing development. If you need a nice simple example of how an MVC system works then this is a really good starting point. Documentation is clear, the examples are straight forward and simple. The project probably doesn’t have a million options to fulfil everyone’s requirements but if you want to use the more general cases then you should be more than happy. There was several modules to help handle XML, pagination, Capcha, Sessions and user authentication. Reading through the project’s Twitter feed suggests that the project is struggling to find developers. It would be a real shame if development stopped on this project.
Verdict: I definitely liked this. It was what the Spring Framework is to JBoss. The project is still in it’s infancy (version 0.7.1 at the time of writing this) and there also didn’t seem to be much in the way of example projects, but it kind of doesn’t matter because what there is there should be enough to get anyone up and running.

Verdict:This is another Ruby on Rails port. Comprehensive documentation although the webcasts were a bit slow and tended to be people talking at seminars rather than tutorials.

The best introduction you could have is to watch the 4 tutorial presentation screencasts. Each one is 5 to 7 minutes and takes you from downloading the application to writing a Hello World program where the Hello World text is stored: in the page, in a template and then in a database. This application is also an MVC but unlike Akelos many of the steps have helper web pages to guide you through, rather than expecting you to remember all the options. The user interface helps with the setting up and configuration of Models, Views and Controllers. The Class Reference documentation looks generated and as a result it’s comprehensive and easy to navigate with a similar feel to JavaDocs.
Verdict: After watching all the videos I am raring to go. From the outside it has probably the same amount of features as Akelos or CakePHP but my fears have been allayed by a very good support web site and a set of accompanying books.

I did like Dingo but I’ve decided to go with Yii because it looks like I can just use it for a small part of my site and yet there is plenty of scope for it to grow if needs be. My next blog post will probably be along the lines of setting up a user authentication system in Yii. So watch this space.