Wednesday 21 November 2012

Subversion plugin for Notepad++

As I use Notepad++ for almost all code editing these days, it was something of a revelation that there is a plugin to enable svn commits from within this excellent editor.

See http://www.switchonthecode.com/tech-news/notepadplusplus-subversion-plugin

You can download the plugin from: http://www.switchonthecode.com/sites/default/files/319/source/NPPSvn_v1.2.zip

Friday 18 May 2012

count preceding siblings in a flat structure

If there was a degree in the bleeding obvious I swear I would fail it.
A recent need to create an xpath to find the number of preceding siblings from a specific point in those preceding siblings was perplexing me. The xml was something like:
<items>
    <item/>
    <item/>
    <item/>
    <item/>
    <item marker="true"/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
    <item/>
</items>
What was needed was an xpath to calculate how many preceding siblings an item element was from the item element with the marker attribute. After playing around a little, I came up with:
count(preceding-sibling::*[preceding-sibling::*/generate-id() = current()/preceding-sibling::*[@marker = 'true'][1]/generate-id()])
which worked a treat but was rather over-wieldy. It wasn't until looking at this from an Arbortext Styler persepective which refused to accept the current() and generate-id() functions (probably because these are xslt only functions rather than true xpath functions) that the bleeding obvious poked its head up and whacked me around the chops with a proverbial wet fish.
count(preceding-sibling::*) - count(preceding-sibling::*[@marker='true'][1]/preceding-sibling::*)
simple when you think about it!

Monday 30 April 2012

create Admin account on Vista


Enable the Administrator Account

  1. Open the command prompt with Administrative privileges by opening the Start Menu, and typing cmd in the search box, and then press Ctrl+Shift+Enter or click the Start orbAll ProgramsAccessories, right-click Command Promptand select Run as administrator.
  2. Type the following in the command prompt and press Enter after:
    net user administrator /active:yes
  3. Restart your computer and logon as Administrator.