Valid XHTML 1.0!

Valid CSS!

Powered by PHP

Get FireFox

1&1 Internet

Archived News

BizTalk date handling gone spookyWednesday 14th April 2010
This happened around this time last year too...

Suddenly we started receiving errors around the parsing of dates in our production BizTalk 2006 environment. BizTalk could no longer successfully run this code:

DateTime d = Convert.ToDateTime("14/04/2010");

"String was not recognized as a valid DateTime"

Somebody tinkering with regional settings? No, as a hard-coded app with the same values run under the same user on the same box produced successful results. Only one Application was experiencing the issue.

More strangely, it appeared to be only happening with today's date. Other dates (e.g. 20/04/2010) worked successfully, so no issue with not understanding UK date formats.

I'd like to say it's due to X, Y or Z, but alas restarting the App Host in question cleared the issue. I've seen it once before last year, bugger knows why!

Anybody with a clue, please feel free to contact me.

VI ^M carriage returnsWednesday 7th April 2010
I've been have a little trouble with ^M appearing where carriage returns should be in some documents in VI.

The reason for this is because I've been editing the documents on both Linux and Windows. VI reads the document as a Unix file as I started it in Unix, but then my new-lines change half way through to Windows.

Unix = LF
DOS (by extension Windows) = CR LF
Mac = CR

Nobody cares about Mac though, as OS X is Unix, so uses LF

The fault is of the editor in Windows as it should have sorted the lines out (although this may have just been me disabling this feature deliberately for some reason).

There are numerous articles on the Interweb that suggest doing a complex search and replace in VI to remove the ^M, but this is (a) impossible to remember, and (b) causes problems in some Windows editors (like Notepad).

The easier solution, in my opinion is just to fix it.

  1. Open VI, but not the document

  2. Open the file like such: :e ++ff=dos myfile.txt

  3. Save the file: :w

The ++ff=dos will set the file to open as a DOS/Windows format, and then you save the file back and it'll sort out the endings. No more problems.

Previous Next