February 16, 2006

Advantage Database Server goes .NET 2.0

In the long list of technologies that I have been meaning to work with, but haven't had the time yet, is Advantage Database Server. You can get it for free, light-weight, native SQL support, and available from their DevCenter and they have been good about supporting our local developer groups.

And now, it has a native .NET 2.0 data provider.

Check them out: http://www.advantagedatabase.com

February 14, 2006

ASP.NET: AJAX with Anthem

OK, here is my take on AJAX at this point in history: a lot of talk, a lot of work, and little reality.

But, I have found one library that I actually like for doing AJAXy stuff: Anthem
http://jason.diamond.name/weblog/2006/01/31/anthem-100

Why do I like this one: it is easy to implement. They didn't go out and recreate a bunch of controls, but inherited the existing standard ASP.NET control library. So if you want a AJAX dropdownlist instead of a standard dropdownlist, change your asp:dropdownlist to an anthem:dropdownlist; or, my personal favorite, change your asp:calendar to an anthem:calendar (no more full post backs just for selecting a day).

OK, there are a couple of other steps involved, but all told it amounts to 4 extra lines of code, and there is a nice set of samples to tell you everything involved.

Did I mention this is an open-source source forge project?

January 26, 2006

Knee update

I remember writing about my knee a number of months ago, and I thought this would be a good time for an update.

Why is this a good time? I just got back from my doctor after having an MRI on my knee.

Now, lets be fair -- I was hoping he would find something that could be fixed. He didn't. That isn't to say he didn't find something wrong, just nothing that can be fixed. That would be Arthritis, also known as osteoarthritis.

So, I got into a talk with the doctor about injecting chicken parts into my knee, and there is a 70% chance that will work. But it isn't a long term fix of any sort. Just my luck, I need chicken parts right when bird flue is running laps around the world.

In the mean time, I just bought a home gym (commonly known as an expensive clothing rack) and will be looking for a stationary bike. Apparently some of this can be worked out through some exercises.

January 24, 2006

Unit Testing for customers

OK, here is an interesting thought. A new .NET Rocks is out today and they are interviewing Adam Cogan of SSW. He is known for having a long list of rules for developers working at his company.

This includes rules for writing rules that check dependencies like datasets, schemas, and web services. How to format code, how to respond to email. You just have to read some of them.

But there was one interesting rule that caught my eye: Menu - Do you have a standard 'Help' menu that includes a way to run your unit tests?

This is something that I haven't thought about. Letting users run your unit tests at any given time. How would this be a good thing. How many times have you had a "it works on my machine" moment, followed by a screen shot that apparently displays the problem -- but it doesn't.

But, if you can have your users run the unit tests on their machine, and you have written them in a logical fashion, you could game some valuable insight to what is wrong...without having to be on the users machine!

Now, what are the hidden requirements of this? You have to be able to distribute your unit tests, and the application that runs the unit tests as part of your executable. So NUnit is fine, but you will have some trouble with Team Systems.

I am going to have to think about this a bit more, but I am really liking the sound of this idea for many cases.

January 13, 2006

Retrieving Query Parameters in a Smart Client

OK, so there is this little cool feature in Smart Clients that allows you to start a .NET executable from a web page. You can set it up so the program is always started from the web page, or just use it as a distribution method.

I'm interested in the "only start from a web page" option.

But, this is only useful if you can pass data to the smart client from the web page. Preferable thru the URL. And guess what -- You CAN! You just have to pile through a lot of help docs to find the documentation on it.

So here is what you do.

In you program, you will need some code that looks like this:



if (ApplicationDeployment.IsNetworkDeployed)
{
// retrieve the url. It will look something like this:
// http://localhost/myapp.Application?Param=Var
string url =
AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0];
// do something with the url
}



Next step is to call your application through your url with a parameter attached. It will probably look like this:
http://localhost/MyApp/MyApp.Application?Param=Var

Everything after the ? is up to you. Also left up to you is parsing the url for the parameters and values.

December 13, 2005

VB and loathing: in search of an SID

Seems that once every six months or so I have to brush off my VB6 knowlegde to get some work done. Have I mentioned I hate VB6. Did I mention I REALLY hate VB6 when I have to make calls to the Win32 API.

So the reason for my displeasure at this point was I need to get any domain users SID (Security ID). BTW: you can't seem to get this in .NET either, without going back to into the Win32 API -- no nice OO wrapper goodness for this one. How fun.

The particular API I am using actually requires one to be able to add a user. It is part of their security process. Lovely. So after a day of searching through the bowels of Google, I found my answer -- not all in one place. No, that would be too easy.

So, if any of you are needing a user's SID and are playing with the LookupAccountName and ConvertSidToStringSid APIs from VB6, here is some help.



Private Declare Function ConvertSidToStringSid Lib "ADVAPI32.dll" Alias "ConvertSidToStringSidA" (ByVal Sid As String, ByRef lpStringSid As Long) As Long
Private Declare Function IsValidSid Lib "ADVAPI32.dll" (ByRef pSid As Any) As Long
Private Declare Function LookupAccountName Lib "ADVAPI32.dll" Alias "LookupAccountNameA" (ByVal lpSystemName As String, ByVal lpAccountName As String, ByVal Sid As String, ByRef cbSid As Long, ByVal ReferencedDomainName As String, ByRef cbReferencedDomainName As Long, ByRef peUse As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Private Declare Function GlobalFree Lib "kernel32.dll" (ByVal hMem As Long) As Long
Private Declare Function LocalAlloc Lib "kernel32.dll" (ByVal wFlags As Long, ByVal wBytes As Long) As Long
Private Declare Function LocalFree Lib "kernel32.dll" (ByVal hMem As Long) As Long

Private Sub Command1_Click()
MsgBox GetSid("DOMAIN\USER")
End Sub


Private Function GetSid(accountName As String) As String

Dim userName As String
Dim UserNameSize As Long
Dim Sid As String
Dim SidSize As Long
Dim Domain As String
Dim DomainSize As Long
Dim snu As Long
Dim sReturn As String

userName = String$(255, 0&)
Sid = String$(255, 0&)
Domain = String$(255, 0&)
sReturn = String$(255, 0&)

UserNameSize = 255
SidSize = 255
DomainSize = 255

Call LookupAccountName(vbNullString, accountName, Sid, SidSize, Domain, DomainSize, snu)
If IsValidSid(ByVal Sid) = 0& Then Exit Function

Call ConvertSidToStringSid(Sid, snu)
Call CopyMemory(ByVal sReturn, ByVal snu, 255)

sReturn = Left$(sReturn, InStr(vbNull, sReturn, vbNullChar, vbBinaryCompare) - vbNull)
Call GlobalFree(snu)

GetSid = sReturn
End Function

December 08, 2005

Delphi News: Thorpe gone to Google

OK, this can't be good for the Delphi community.

According to CNET (see article here), Danny Thorpe has left Borland for Google.

I dont see this as a death nel for Delphi, but it is another set of shoes that now have to be filled.

November 18, 2005

My Visual Studio.Net Launch event

So, my Visual Studio.Net 2005 launch event was last night. it was on "Creating cutting edge web applications with ASP.NET 2.0"

When I say "My launch event", I mean I was giving the presentation to a tent full of developers, next to a hospital, and within earshot of a freeway.

And when I say "tent", I mean a massive industrial tent with 1 foot thick walls, air-conditioned with aluminum duct work, anchored to the ground with steel beams bolted in concrete, sound system, overhead projector, and fluorescent lighting. Everything we needed but a bathroom. But it was still a tent.

Anyway, the presentation went ok. Not great, but not terible either, just a nice solid "it could have been better" ranking.

Being a canned presentation I recieved from Microsoft less than month before I was supposed to give it...I'm almost happy with how I did. And of course, I recieved a few questions that I didn't know the answer to. Luckely, there was usually someone in the audience who did know the answer.

In the end, it was a lot of work to prepare for this -- a lot of time my wife wants back now. It seems even worse when you consider that I was not paid it. But...I like doing this sort of thing. I actually think it is kind of fun.

Just out: NUnit 2.2.3

A new version of NUnit is out that is compatible with Visual Studio.Net 2005 and the 2.0 framework.

Read about it here:
http://nunit.com/testweb/index.php?p=releaseNotes&r=2.2.3

Download it from here:
http://nunit.com/testweb/index.php?p=download

November 17, 2005