Wednesday, 5 September 2012

Update: HTC Desire HD turns itself off, hope for nice new phones

An update to my original post concerning random rebooting of the HTC Desire HD.

Even after an update was applied to the phone over the air, I found that it would regularly reboot itself even when I'd left it unattended.

The answer turned out to be that the SIM card was gradually loosening from its slot, which I think was the original root cause of the phone rebooting unexpectedly (I thought this was something to do with the Alarm Clock, but it seems that was more of a symptom than a cause).

I taped my SIM card down inside the phone so that it couldn't budge from its slot, and it has never rebooted itself again.

That's the good news. The bad news is that the phone is badly playing up these days. When I call other people it randomly puts them on hold and dials other people's numbers, and more often than not it will just terminate the call without warning.

So I think it's almost time to lay the ol' HTC Desire HD down to rest. It will be interesting to see what comes of the Apple, Nokia (not so much) and other phone launches. 

When they announce the iPhone 5 (seems like it will actually happen this time!), I hope that the new version of iOS includes proper 'Android-esque' widget functionality - for me this will make or break my decision to buy an iPhone. 

So come on Apple, make your OS properly content-centric - not just a bunch of brightly coloured icons.

Monday, 3 September 2012

SQL Server: Split delimited string to table variable

In one of my projects I had to split a string which held a list of names delimited by the forwardslash '/' character into a proper table structure, so that the values could be used in a relational format.

I tried a few things including putting a bunch of PATINDEX type commands together, until I found a solution which works (it may not be particularly scalable). This also trims whitespace from either side of the delimiter in case they aren't evenly spaced:

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fnSplitDelimitedString]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
 DROP FUNCTION [dbo].[fnSplitDelimitedString]

CREATE FUNCTION fnSplitDelimitedString (@list nvarchar(MAX),@delimiter VARCHAR(1))
   RETURNS @tbl TABLE (name varchar(255) NOT NULL) AS
   DECLARE @pos        int,
           @nextpos    int,
           @valuelen   int

   SELECT @pos = 0, @nextpos = 1

   WHILE @nextpos > 0
      SELECT @nextpos = charindex(@delimiter , @list, @pos + 1)
      SELECT @valuelen = CASE WHEN @nextpos > 0
                              THEN @nextpos
                              ELSE len(@list) + 1
                         END - @pos - 1
      INSERT @tbl (name)
         VALUES (convert(varchar(255), ltrim(rtrim(substring(@list, @pos + 1, @valuelen)))))
      SELECT @pos = @nextpos

SELECT name FROM fnSplitDelimitedString('Gerry Smith /   Tom Martin / Michael Green/Rohil Sen/Dominic Davidson/Richard Wilson','/') as Split 

You can pass in your own delimiter (comma, semicolon etc), and the function returns a table in this format which is a whole lot more useful:

Gerry Smith
Tom Martin
Michael Green
Rohil Sen
Dominic Davidson
Richard Wilson

I found this solution on a blog post by Erland Sommarskog which has a lot more potential solutions. If the solution I posted doesn't work for you and you need something which will scale up, try reading his detailed write-up.

This solution was tried and tested on SQL Server 2005.

Tuesday, 28 August 2012

Blackberry Deleted Emails Do Not Synchronize with Mailbox

It was annoying me that when I delete an email on BlackBerry, it didn't delete it in Outlook. So when I got to the office there were still lists of crap emails I didn't want.

Here's the fix (I nicked this from another blog):

Problem Description: This article describes where to change the setting to force emails deleted on the Blackberry to Synchronize with Outlook. When the user deletes an email on their Blackberry handheld device, it does not automatically delete the email in Outlook.

Troubleshooting Steps/ Resolution: By default, the Blackberry is set to not Synchronize any emails deleted on the Blackberry with the users mailbox. A setting must be set to force any e-mail deletions done on the handheld to also delete in Outlook. This setting can be found in the following:

  1. On the Blackberry device, go into the mail (the icon looks like three envelopes). 
  2. Single click the trackwheel to display the menu 
  3. Select Options 
  4. At the bottom of the 'Message List Options', under the 'Email' subheader, highlight 'Handheld' next to 'Delete On:' 
  5. Single click the trackwheel and choose 'Change Option'

Select one of the following options:

'Handheld' - deletes the e-mail on the handheld only
'Mailbox & Handheld'- deletes the email on the handheld as well as in Outlook 'Prompt'- Prompts the user to choose whether they want the email deleted in their Mailbox each time they delete an email on the Blackberry.

Click the trackwheel once and choose 'Save' to save your settings.

Monday, 23 April 2012

ASP.NET: AJAX Combo Box Item List placement problem - CSS Hacks

Occasionally, I like to use the ComboBox control from the Ajax Control Tookit. I hadn't used it for quite a while and added one to a recent project - one which I need to work in Chrome, Firefox and IE.
But the issue was that the ComboBox's item list would appear in a random place on the page, about 150 pixels away from the text box. No good.
It seems to be related to my use of Master pages but I couldn't find a solution which worked, so I decided (reluctantly) to hack the CSS. On my ComboBox control I have the CssClass set to 'CustomComboBoxStyle' and in my CSS I have a default selector for Chrome, then a hack for Firefox, followed by a second hack for IE 8 and 9 (if you're on any version of IE below 8, I don't care about you). The CSS ended up looking like this:

/* AJAX Combo Box Styles - HACKS here for item list */
.CustomComboBoxStyle table {margin-bottom:3px!important; top:0px!important;}
.CustomComboBoxStyle {position:relative;} 
.CustomComboBoxStyle ul { 
    position:absolute ! important; 
    left:2px ! important; 
/* Chrome - default */
.CustomComboBoxStyle ul 
    top:2px ! important;    
/* Firefox */ 
@-moz-document url-prefix() {
        .CustomComboBoxStyle ul {
        top:22px ! important;
/* IE 8 + 9 */
.CustomComboBoxStyle ul 
    top:15px \0/ !important;    

<asp:ComboBox ID="cmbCity" runat="server" 
    ItemInsertLocation="Append" CssClass="CustomComboBoxStyle"  >
    <asp:ListItem Value=""> -- Select city -- </asp:ListItem>
    <asp:ListItem Value="Aberdeen"></asp:ListItem>
    <asp:ListItem Value="Dundee"></asp:ListItem>
    <asp:ListItem Value="Edinburgh"></asp:ListItem>
    <asp:ListItem Value="Glasgow"></asp:ListItem>
    <asp:ListItem Value="Paisley"></asp:ListItem>
    <asp:ListItem Value="Perth"></asp:ListItem>
    <asp:ListItem Value="Stirling"></asp:ListItem>

In my solution, this worked (with pangs of guilt at such hackery). I absolutely do not guarantee or even assert that it will work for you, but it could be worth a shot. 

Monday, 16 April 2012

HP N40L Windows Home Server 2011: Mount Linux EXT2 drive and clone disk

Realising that I needed a home server to keep all my files on and run IIS, SQL Server etc, I recently upgraded from my D-Link DNS-320 to an HP N40L Microserver.

Of course, I needed to copy my files from the DNS-320 (Linux) to the N40L (Windows) and didn't fancy leaving it to copy the files over the network and I couldn't get Windows to mount the drive (when you put the Linux formatted disk into the N40L, Windows can see the physical disk but can't mount it as a drive with a letter etc).

So after rooting around a bit for solutions regarding mounting Linux EXT2/EXT3 drives in Windows, I found EXT2 File System driver on SourceForge and installed it (version 0.51). Then I put the drive from the DNS-320 into the new server and booted it up.

Note that the main solution which tends to come up is EXT2 IFS, which at the time of writing wasn't compatible with WHS 2011 (though it works with Windows 2008). So that was of no use to me but if you're running a supported version of Windows it may be of use to you.

Back to the problem in hand; when I ran the EXT2 volume manager I was able to mount the drives in Windows and use SyncToy to clone one disk to another - since the intention is to copy the data off the Linux drive and then once done, format with NTFS.

It worked nicely for me, and I hope this info is of use to someone!

Monday, 12 March 2012

Come on Apple, get your Googles on and see the need for widgets!

I am tired of Android.

I find it to have generally poor implementation in a lot of apps, poor usability and half-hearted attempts to Apple-ify the user experience. There have been vast improvements in the past few months, but it's still lacking.

After I'd had my iPhone 3GS for 18 months I genuinely wanted to give Android a chance, not only because I was tired of the locked-down iOS ecosystem, but because I thought maybe it was a viable alternative for the fairly serious phone user.

Having owned an Android phone in the form of an HTC Desire HD for over a year, I am on the verge of returning to Apple via iPhone, iPad and my next computer will be a MacBook.

In my opinion, Android is the PC of phones and tablets. It's just not quite there. There's no 'ooh-ahh', in the experience - just mediocrity. I want a tablet for home and travel, but I wouldn't consider an Android tablet for a minute - not even with the knocked down prices we're seeing at the moment. I'm intrigued by Windows 8, but it's too long away.

Now to the point - my only sticking point with my return to iOS is homescreen widgets.

The best thing about Android is the great widgets you can add to your homescreen. Instantly accessible and useful information, quick shortcuts to the information you need, and general interest. Every section of my homescreen is rammed full of something I find useful.

Compare that to iOS' sweety box of colourful icons which mean virtually nothing. You can see which apps you have to launch as well as a few basic pieces of information, but nothing particularly useful to you at a glance. I really wish Apple would realise that they need to add user widgets to the iOS homescreen - the lack of widgets was one of the reasons I plumped for Android 12 months ago and it's the only thing which somewhat puts me off buying Apple iOS devices.

If I think that, then I very much doubt I'm alone.

Sort it out Apple - you may have queues out the door and up to the distant horizon when you launch a new product, but that queue could be a few people longer if you do the right thing and add widgets to iOS.

Saturday, 10 March 2012

Dell laptop: HDMI output has black border

When I upgraded to WIndows 7, my Dell Studio 17 suddenly lost the ability to display 1920x1200 (1080p) in full screen mode, either on the laptop display or my Philips 24 inch monitor.

I couldn't find any answer to it within the Windows display settings or control panel, and after a long time rooting around on Google and trying various things, I discovered I needed to:

a) Download the latest Catalyst drivers and control suite.
b) Once installed, use the 'scaling options' to adjust the size of the output display to 'match my flat panel'.

Finally! Back to a usable full screen without having to compromise on resolution.

Wednesday, 1 February 2012

Solved: DNS-320 P2P folder disappeared

I upgraded the firmware on my D-Link ShareCenter Pulse DNS-320 to version 2.02, and suddenly the P2P folder disappeared.

I thought everything had been deleted, but it continued to download torrent files - where was it saving them to?

Turns out that the new firmware changes the way your P2P folder is shared on your network, and that all you need to do is disable and then re-enable the P2P service using the web interface.

Back to normal!

Tuesday, 17 January 2012

Solved: Visual Studio 2010: ASP.NET project - can't add web reference

I hadn't worked on a project for a while (since upgrading to Visual Studio 2010), and I needed to add a web reference to get it to compile. The normal method is just to right-click on your project name in Solution Explorer and click Add Web Reference.

But I had no option to Add Web Reference, only an option to 'Add Service Reference' which seems to be designed for WCF references.

It's a legacy project though, so I needed to add the reference in the legacy format - adding a service reference creates different components in your project than a web reference.

I got round it by:

1. Change the target framework to .NET 2.0
2. Close and reopen the solution - you should see the option to Add Web Reference.
3. Add the web reference.
4. Change the target framework back to whatever you had before.
5. Close and reopen the project.
6. Continue upon your way.

This might not work for everyone since I don't really know why the option to add web reference disappeared in the first place - but it worked for me.