Wednesday, July 02, 2008

SQL 2005 32 bit on Vista 64 bit

I've decided to upgrade my work system to Vista 64bit (mainly due to larger memory). As I go on installing stuff, i keep running into various issues which I'll try to post here.
SQL 2005 Developer Edition (32 bit).
First issue is with the compatibility check-list - namely IIS and ASP.Net

This KB article outlines which features need to be turned on Vista in order for Reporting Services to work.

This link describes how to fix ASP.Net by running following:
cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1

Thursday, May 01, 2008

Read and parse Excel data from clipboard using Javascript

IE7 prevent clipboard from being read - you can enable it in the title-bar (blocked content). For Firefox read this info.
Following sample reads data from clipboard and tries to parse them and format back to table.

// prepare result
var resE = document.getElementById("result");
var res = "";
resE.innerHTML = "";
// read clipboard
var s = window.clipboardData.getData("Text");
// parse clipboard data
var lines = s.split(String.fromCharCode(13,10));
if (s.indexOf(String.fromCharCode(13,10)) == -1 || s.indexOf(String.fromCharCode(9)) == -1)
{
res = "(invalid data)";
}
else
{
var cols = lines[0].split(String.fromCharCode(9));
res = "Table size: " + lines.length + "x" + cols.length + "
";
res += "";
var i = 0, j = 0;
for(i = 0; i < lines.length; i++)
{
res += "";
cols = lines[i].split(String.fromCharCode(9));
for(j = 0; j < cols.length; j++)
res += "
" + (cols[j] == "" ? "~" : cols[j]);
}
res += "
";
}
// output result
resE.innerHTML = res;


Friday, December 14, 2007

Iterating through Enum

Every time i need to iterate through enum, i forget how to do it... so, for the last time:

foreach(byte b in Enum.GetValues(typeof(CounterPartyVO.CounterPartyTypes)))
Console.WriteLine("{0} : {1}"
, b
, Enum.GetName(typeof(CounterPartyVO.CounterPartyTypes), b)
);

Tuesday, December 11, 2007

ReSharper

Just ran into this add-in and it seems extremely usefull - ReSharper. I especially like the null detection (nightmare with junior devs)... at $199 looks like a good deal to me.
Also, Elegant Code is definately worth keeping an eye on - can't wait for some more in-depth feedback on the VS 2008 stuff (especially testing, since i'm still not ready to give up n-unit).

Friday, December 07, 2007

Graphs on Web

Google came up with yet another cool service - graphs!
Here's kind of SDK and there's also very nice article about it (in czech though).

There's also a paid site here - i believe it's $69 or so. Pretty cool!

Wednesday, November 28, 2007

UserControls based on abstract classes in designer

I really hate the fact, that VS doesn't allow to display design of user controls (of forms) based on abstract classes.
Here i found solution to the problem - basically "fooling" the designer with substitute artificial instance. It's just a little messy (especially when you have abstract classes in different assemblies), but it seems to work. Mentioned example is done for forms, but works equally well with user controls.

Tuesday, November 27, 2007

Extending indexer on collection in C#

I was looking for a way to implement alternative way to access members of List (or any other collection) through index. By default i could use only:

myCol[0].Value

What i'd like to use is:

myCol[strKey].Value

The way to implement it is through property (code-fragment only):

public MyColItem this[string strKey]
{
get { return #code to get the item#; }
set { #your code#; }
}