How to see if ‘foo’ is a unique entry in comma-separated list ‘foo,bar,foobar,foo,foo’?
We want to match the ‘foo’ at the beginning, at the end, and also in the middle, but not as part of the word ‘foobar.’ Also the comma-separated list might only be ‘foo’.
Plain wrong, because ^ means something different inside a set
Works, but clunky.
Works perfectly. Especially when you remember to escape the ” in your .NET string assignment 🙁
Thanks to the Rad Software Regular Expression Designer too!
The shine is starting to wear off Visual Studio 2010 Professional for me. Recently the IDE has started to hang, in a rather strange way. The code editor still appears to respond to mouse events, but nothing actually happens. E.g. you can highlight some code, right mouse click and choose copy from the context menu, but then when you come to paste, nothing happens. Or you’ve been coding away, and you see the file name has an asterisk against it, so you hit ‘Control+S’ to save, but nothing happens. And the only way you can save your changes is by closing the file – at this point VS prompts you if you want to save.
This seems to be something that others have noticed, certainly in the Beta:
One of the tips is to uncheck the ‘Enable the Visual Studio hosting process’ checkbox in Project Properties > Debug pane – and this seems to have fixed it for me.
This is not very impressive. I’ve used all of the previous .NET editions of Visual Studio, and never seen this kind of stuff before.
Here’s something that’s been winding me up for ages. Whenever I access my Hotmail account through Internet Explorer, it launches Windows Live Messenger. I spend half my day shutting it down in my system tray.
Finally have found out how to turn the blooming thing off – it turns out it is not something you can do through Messenger options at all:
To my mind this is poor usability – isn’t the ‘Hotmail launches Messenger’ option something you’d expect to either be in Hotmail or Messenger?
Spent a long time trying to get data from one instance of SQL Server to another with BCP. Couple of things I learnt along the way:
1. SQL_Latin1 _General_CP1_CI_AS v. Latin1 _General_CP1_CI_AS
May as well be Latin v. Russian as far as BCP is concerned. Was unable to import data from a Latin1 _General_CP1_CI_AS column into a SQL_Latin1 _General_CP1_CI_AS column. Banged my head against the wall for a good while on this, until eventually just manually set the collation on each column in the target database to match the source.
2. Identify columns
Because my identity values had a few gaps in in one table, the master-detail relationships became jumbled up, and the data was no longer consistent. Worked around this by inserting some dummy rows in the BCP files so that there was a row for every identity column.
Since I had deleted all of the rows in the target table after a failed attempt at importing, also needed to reset the seed. Which is straightforward:
DBCC CHECKIDENT (TableName, reseed, 0)
This means that when you use BCP to import, the first value will be 1, and so on.
Embedded WordPress in a site for someone today, with different categories feeding different pages. Pretty simple to do – the instructions here are more or less correct, although the example code doesn’t quite work with the latest version of WordPress:
A finesse you can apply with the LARGE() function is to consider the case where you have rows with the same value, e.g:
The LARGE(A1:A5,1) function will simply tell you that 3 is the largest value. But you may actually want the top three rows, e.g. to return the set (Fred, Nigel, Ian)
The way to achieve this is to add some unique key value to each ranking value so that they become distinct. In the example above, we could create a new column with value as follows:
This will then give us:
A B C
1 James 1.000001
3 Fred 3.000002
2 Ian 2.000003
1 Graham 1.000004
3 Nigel 3.000005
If we run the LARGE() function against Column C, we now have our unique values, which we can then feed into a VLOOKUP to return the person’s name.
Was banging my head against the wall a bit tonight trying to close my ADODB.Connection object down cleanly. My mistake was writing something like the following:
If Not objConnection Is Nothing Then objConnection.Close
It seemed that objConnection was both not nothing, and throwing an error about already being closed.
Solution was to check the State property first, so now I have:
If objConnection.State <> adoStateClosed Then objConnection.Close
Used this to find the top 5 of 200 values. Never know you could do this before!
I vaguely knew you could sum across worksheets before, but cool to rediscover this.
Just got an Ubuntu LAMP server running on VirtualBox. Bought the disk image from TradeBit, which turned out to be a good move, as the chap selling the image was incredibly helpful. Talked me through various tweaks to get me up and running which I would basically have never found (No PAE support? Resetting DHCP client?)
But now, I have a little Ubuntu server running on my Windows machine! I managed to set up port forwarding under my own stream, and also installed a Gnome GUI layer, Firefox and Webmin. I can browse to it from my Windows host, and am now all set to start a WordPress site development exercise without needing to be online.
I think this is the first time I’ve had an ‘aha’ moment with Linux. I’ve had a go through the years, but never managed to get the OS running, for one reason or another. Particularly enjoyed the GUI package manager that gives me a whole universe of softare to choose from and install in an apparently reliable way.
Here’s the VDI image, in case you are interested: