Monday 26 May 2014

Eclipse: Maven m2eclipse shows 'Missing plugin' but JAR file is present and project builds

In my Eclipse Kepler installation, Maven plugin m2eclipse reported a missing dependency artefact, but I could see that the parent project had been built, the JAR in question was visible in my local Maven repository but somehow Eclipse 'couldn't see it'.

I tried a lot of different things to get the problem fixed, but Eclipse also built the project without any errors, so in the end it seemed like some kind of bug or 'feature' in the Maven Eclipse plugin that was causing this.

The solution (for me) turned out to be as follows:

  1. Right click on the project in Eclipse and choose Maven > Disable Maven Nature. This changes the \.settings\org.eclipse.m2e.core.prefs to show resolveWorkspaceProjects=false.
  2. The error disappeared from Eclipse.
  3. Delete the project from Eclipse.
  4. Change the file \.settings\org.eclipse.m2e.core.prefs to show resolveWorkspaceProjects=true.
  5. Import the Maven project again to Eclipse.
I'm still not sure what the actual issue was, but I'm pretty sure that in my case, there was no other way to resolve this one.

I was able to reproduce this same issue in other projects, and the fix above cleared the issue.

Tuesday 12 November 2013

Sudden fatal issues with .NET Framework 4 - "Faulting module name: clr.dll" - FIXED

One of the applications I built and deployed some time ago had been ticking over nicely for months, when suddenly the users reported that they were no longer able to access the application.

When trying to access it, they were getting 'Page cannot be displayed' errors - which meant their request was not even getting as far as starting their session in the application.

After rooting around, trying various things in IIS to no avail, I finally identified a Microsoft Hotfix which did the trick. Having cleared out the application logs in Event Viewer, I could see that the .NET framework was throwing errors in clr.dll.

Information on the Hotfix (and details of the specific errors which showed in the Event Viewer) available from this link:
http://support.microsoft.com/kb/2640103

However, you can't actually download the hotfix directly from there - I think because Microsoft are trying to encourage you to carefully review your situation versus their described issue, and for you to be extra cautious about installing it.

I decided that this hotfix had to be the only option I could take, other than trying to get some tailored (and expensive) support from Microsoft by supplying them with a dump of the logs etc, and I eventually found that the hotfix can be directly requested using this URL (for some reason I had to access the site using Google Chrome since IE was throwing JavaScript errors):
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2640103

Within 5 minutes, the link to the hotfix had arrived in my email and I was able to download and install it.

It's worth noting that I stopped IIS (net stop w3svc) before applying the hotfix, which meant that I did not need to restart the remote server.

Now, the application seems to be back to normal. Well, let's see what the users tell me tomorrow.

Note: As usual, I have to declare myself free of blame if you install this hotfix and it doesn't work or causes any issues for you! :)

Tuesday 30 April 2013

FIXED: iPhone 5 with iOS6 keeps dropping Wi-Fi connection

My iPhone 5 keeps dropping its wi-fi connection, showing up with the Log In page and a weird HTTP 404 error at Apple.com.

This fixed it:
http://forums.macrumors.com/showpost.php?p=15759186&postcount=177

Wednesday 30 January 2013

Flex: Add or subtract days from date

It's been a long time since I've posted anything! Possibly because I haven't been doing much development recently :(

Anyway I needed to be able to subtract a day from today's date in Flex, so that I could default one DatePicker field to today and a second DatePicker to yesterday's date.

Turns out it's pretty easy.

Today's date:
<pre class="brush: html">
<mx:DateField id="endDate" width="150" formatString="MM/DD/YYYY" showToday="true" styleName="Date" yearNavigationEnabled="true" editable="true" selectedDate="{new Date()}"/>
</pre>


Yesterday:
<pre class="brush: html">
<mx:DateField id="startDate" width="150" formatString="MM/DD/YYYY" showToday="true" styleName="Date" yearNavigationEnabled="true" editable="true" selectedDate="{DateUtils.addDays(new Date(),-1)}"/>
</pre>

In my project, DateUtils refers to org.as3commons.lang.DateUtils



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]
GO

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

   SELECT @pos = 0, @nextpos = 1

   WHILE @nextpos > 0
   BEGIN
      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
   END
   RETURN
END

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:


Name
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:

CSS
/* 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;    
}

Markup
<asp:ComboBox ID="cmbCity" runat="server" 
    AutoPostBack="False" 
    DropDownStyle="DropDownList" 
    AutoCompleteMode="SuggestAppend" 
    CaseSensitive="False"  
    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>
</asp:ComboBox>

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.