Category Archives: dotNET

Go to DevDays 2004 and go home with Whidbey!

http://www.microsoft.com/seminar/devdays2004/default.mspx

It will be in 32 cities during the month of March.

Not only do you get a full day of awesome training. Not only is it cheap ($75 before Feb 10th, $99 after). But you will walk away with the “technology preview“ of Whidbey. Ummm- I think that translates as the Alpha Bits.

How cool.

So when you see this little description on the website:

In either track, you’ll see a local expert build a real-world best-practice application, see the application in action, and leave with the code at the end of the day.

you can think of me, because in Boston, MA and Hartford, CT, I’ll be that “local expert”, building the secure ASP.NET app.

Exception Declaration Convention

In a Catch statement I often try to catch specific types of exceptions and then a generic exception.

The generic is

catch ex as Exception

A HTTP

catch hEx as HTTPException

But a SQL

catch exS as SQLException

Isn’t that silly, that I can’t bring myself to follow the convention for SQLExceptions?

Crystal Reports and my phone bill

A discussion on the ASPAdvice listserv about Crystal Reports brought back a crusty old memory. First I should say, I use Crystal Reports and have been since Crystal 6.0. I have a love/hate relationship with Crystal. I love the reports I am able to create. I hate when I am forced to delve into any new territory with them. (I have not even considered going to web reporting with Crystal for other reasons.) The worst was the nightmare upgrade to Crystal 8. Granted, I was going from 6 all the way to 8 in one leap. All of my apps were broken. I spent innumerable [unbillable] hours fixing applications and on the phone with [very unhappy yet thankfully, patient] clients trying to get the proper components installed on win95 and win98 machines. The one thing that was the saving grace was the free technical phone support. I didn’t mind as my long distance rate was 5 cents a minute. I got to be a pro at checking the status and wait times on their website before trying to dial in. And everyone was very helpful and very friendly. And then my phone bill came. I was calling Canada at $1.25/minute. I had $550 of phone calls to the free tech support. I could have purchased a one year tech support plan for a lot less than $550. I wrote them a long email tale of woe, explaining also how they lost out on selling a 1 year support contract. I had no expectation of them paying my bill, but I was trying to convince them to find some way of letting people know that this was most likely going to be long distance. When VS.NET was released with CR.NET in there, I saw the same lovely offer of free phone tech support for a certain period. And the same phone number. And no warning.

Longhorn video brings t.v./movie computers to life

How many times have you watched CSI or some other t.v. show and laughed when their computer does ridiculous things and say “computer programs don’t DO that!” ? Well, I just watched the video of the Longhorn based real estate application by Carter Maslan – and guess what, computers *do* do that now! Especially the Avalon stuff that you see with the mapping and satellite data. Definitely check this out! I am going to email my 3 friends who have been involved with mapping data software (one for IBM’s Geo Coding Plus, one for MapInfo and one for GDT.

Fun with Compressing Web Service Data Returns

I’ve been playing with Xceed’s .NET Stream Compression component and also fiddling with a compression soap extension written by Paul Glavich . I have this kinda big dataset I need to bring down via a webservice to persist for off line use. It’s almost 4 megs. On my DSL it was taking 2.9 minutes to download. Pity the poor user with dial-up. XCeed got it down to 12 seconds. I wanted to compare it to Paul’s component but have been doing something wrong, so he and I have been emailing back and forth. A lot has been just experimenting. Most of the wasted time has been spent editing the damned WSDL every time I update the webservice on the client side. That’s for WSE and for the soap extensions. What a pain. (Hopefully will discover big changes for that with wse2) Since 10:30 I have said “okay maybe tomorrow….” Finally went upstairs at 11:40 and while loading the toothbrush up with goo, I thought…hmmmm maybe… and here I am still at 12:40. Aaach. But really I’m going to bed right now. After I stick in these hyperlinks. Paul and I have been having fun though and I have learned tons about Soap Extensions thanks to the work that he did.

More Microsoft Hires…

Addy Santo – A fellow blogger from NYC who keeps trying to tempt me to travel south for u.g. meetings and other Manhattan based events. Poor Addy. He just doesn’t realize that after 8 years of living large in NYC, I live in Vermont for a reason now! 🙂

Robert Levy – one of the youngest MVPs (mobile), Student Ambassador and chief of SmartPhoneThoughts.com. Robert was the winner of “who has the most pocket pc devices with them” at the MVP Regional Summit in L.A. just before PDC. Robert and I had emailed, but actually talked briefly on the plane into L.A. without introduction and therefore didn’t realize who we were! We had a good laugh at that when we saw each other at the MVP summit.

I’m sure we’ll be hearing from more in the next weeks.

Persisting a dataset as encrypted XML

I had to revisit this functionality today. I am pretty certain that I tested decrypting back to a dataset with the previous method I was using, but today it just wouldn’t work at all. After a lot of reading, googling and research, I learned a lot about various methods of cryptography, yet I was still unable to solve my problem on my own. Finally I came upon a code sample (not in the first 4 searches, mind you!) and thought I better persist THAT here!! Here is the link. If for some reason that link goes away here’s my particular (VB.Net) treatment of the code:

Public Sub encryptDS(ByVal ds As DataSet, ByVal filename As String)
Dim aCryptoStream As
CryptoStream
Try
 Dim aXmlTextWriter As
XmlTextWriter
 aXmlTextWriter = New
XmlTextWriter(filename, Text.Encoding.UTF8)
 Dim aUE As New
Text.UnicodeEncoding
 Dim keyBytes() As Byte
= {……} ‘your secret bytes go here
 Dim RMCrypto As RijndaelManaged = New
RijndaelManaged
 aCryptoStream = New
CryptoStream(aXmlTextWriter.BaseStream,  RMCrypto.CreateEncryptor(keyBytes, keyBytes), CryptoStreamMode.Write)
 
ds.WriteXml(aCryptoStream)
Catch ex As
Exception
 …
Finally
 aCryptoStream.Close()
End Try
End Sub

Public Sub DecryptDS(ByRef ds As DataSet, ByVal filename As String)
 Dim aFileStream As New
FileStream(filename, FileMode.Open)
 Dim aStreamReader As
StreamReader
 Try
  aStreamReader = New
StreamReader(aFileStream)
  Dim aUE As New
Text.UnicodeEncoding
  Dim keyBytes() As Byte
= {….} ‘ your secret bytes go here
  Dim RMCrypto As RijndaelManaged = New
RijndaelManaged
  Dim aCryptoStream As New CryptoStream(aFileStream,
  RMCrypto.CreateDecryptor(keyBytes, keyBytes), CryptoStreamMode.Read)
  ‘Restore the data set
  ds.ReadXml(aCryptoStream)
 Catch exS As
IOException
  …
 Catch ex As
Exception
  …
 Finally
  aStreamReader.Close()
  aFileStream.Close()
 End Try
End Sub

 

Working with the Blogging APIs from .NET

Holy moly! That was hard work. I have never spent any time with the blogging APIs (blogger and metaweblog) and needed to at least push a post out from BLInk!. I wanted to make sure I could do this against dasBlog and dotText (from which so many blog sites are now derived). With help from :

I was able to scrap together some functioning code (in C# no less!!!!!) to successfully post test posts to both my dasBlog blog and my dotText blog.

Now I have to take those tests, tighten them up (eg: passwords, urls, etc are currently hardcoded) and wrap them into BLInk!.

My intention is not to build a full-fledged blogging tool (get posts, edit posts, etc) because the real purpose was to work out some concepts for blogging with ink. But I think pushing up a post that is created in ink is pretty necessary. From there, the user can go into there regular interface to edit, etc.