Sunday, December 18, 2005

Using blocks are new to us VB developers. I get the basic concept - it's cleaner than try/catch/finally blocks when all you are doing is disposing an object and it's super great when dealing with unmanaged resources and good ol' SqlConnections.

But the intricacies of using it are a little less obvious. Luckily, this code construct has been around in C# (and I will guess C++??) so we can learn from those folks.

I was trying to find a better way to deal with a file stream and memory stream today. Porting some code over from vs2003 to vs2005, the compiler was moaning about the following code block (I am only writing it loosely here...) where I am passing in a file name, opening up the file into a streamReader and then doing something to the streamreader and then closing both objects at the end. Maybe it wasn't written perfectly to begin with, but the compiler issue was a new one.

dim fs as new FileStream(myfilename,FileMode.Open)
dim sr as new StreamReader

Try
   myStreamReader=new StreamReader(fs)

  ... do some stuff

Catch exS as IOException
 ... do something
Catch ex as Exception
 .. do something
Finally
   If  Not fs is nothing then
      fs .Close
  EndIf
  If Not sr is Nothing then
     sr.Close
  End If
End Try

So when I ported this to VS2005, the compiler was not happy about accessing the streamReader in the Finally block because it was possible that no value would be assigned and I'd get a null ref exception (on the bold red line.)

I knew that I could get rid of those Close methods with a using block but was not sure if nesting them was a) possible b) good code or c) something that would bite me in the rear down the road.

Once I figured out what I was dealing with: "nested using blocks" I quickly found this blog post by Scott Hanselman, who specifically says in the comments of this post that he is thumbs up with "nested using blocks (but ONLY if theare are pure nestings without any other code following the inner block."

So, considering the source, I'm confident that I'm doing good by doing well (or however that goes) with nested using blocks (with out extra code after the inner block). :-)

Using fs as New FilesStream(myfilepath,FileMode.Open)
  Using sr as new streamReader(fs)
     Try

       ... still need exception handling around the other code

     catch ....
    Finally
    End Try
  End Using
End Using



Don't Forget: www.acehaid.org
Sunday, December 18, 2005 2:08:58 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

When I moved to .NET from VB6, I loved the ability to name variables beginning with an underscore. Now that I am porting some .NET 1.1 code to .NET 2.0, I am seeing that this in non-CLS compliant.

However, because the handful of variables that use the underscore are in a class that has many subclasses and some of these variables are used in the subclasses (shared, protected) AND because this class is not something that anyone else will ever use outside of my application, I have made an executive decision NOT to fix the variables but to set the CLSCompliant attribute from the Assembly information to False.



Don't Forget: www.acehaid.org
Sunday, December 18, 2005 12:26:42 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Saturday, December 17, 2005

This newest version is built and compiled in .NET 2.0.

I suppose this means it's time to get serious about porting a particular app that uses Infragistics controls to VS2005...

Congrats Jason, Devin et alia...

 



Don't Forget: www.acehaid.org
Saturday, December 17, 2005 9:07:27 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Charles Petzold and Chris Anderson are both writing WPF books. Then Chris got an XBox, but then realized this might not bode well for finishing his book and "lent it" to a friend. The result is a very funny post by Charles.



Don't Forget: www.acehaid.org
Saturday, December 17, 2005 8:34:20 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
Very cool!! (by way of Bill Ryan)

Don't Forget: www.acehaid.org
Saturday, December 17, 2005 8:19:54 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Leon Bambrick suggests that Windows may just end up being a means to another end for Microsoft... [read more ...]

[A DevLife post]



Don't Forget: www.acehaid.org
Saturday, December 17, 2005 10:22:17 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

I didn't realize it was done yet as I hadn't gotten the print copy. (Update: it arrived within a few  hours of posting this!!)

But the jam packed special issue of CoDe Mag, filled solely with Tablet and Mobile PC Articles, is online here!

There are articles by Markus Egger, Billy Hollis, Larry O'Brien, Dr. Neil, Ellen Whitney and myself. Also, there's a forward by Frank Gozinski, from the Mobile Platforms Division of Microsoft. Additionally, there are quotes throughout from some of the key players at Microsoft in research and design of TabletPCs as well as the developer platform.

Here is the description from Frank's blog:

Code Magazine has put together a complete end to end developer reference for building applications tuned for the Tablet PC and Mobile PC applications. Are you mobilizing your applications? With the continued move by customers who want anywhere access to their data and applications mobilizing software applications is taking on a new sense of urgency.  This Focus Issue of Code Magazine is a reference you’ll want to have and it’s free, check out the work Markus and company have done http://www.code-magazine.com/focus/TabletPC/ 

Happy reading (I really like the welcome letter)



Don't Forget: www.acehaid.org
Saturday, December 17, 2005 9:26:16 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Friday, December 16, 2005

Working with some sub-standard Tablet PC code (umm, that would be my own code) in VS2005 made me realize that this version is much more sensitive to bad practices when it comes to threading [read more...]

[A DevLife post]



Don't Forget: www.acehaid.org
Friday, December 16, 2005 11:44:18 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Thursday, December 15, 2005

In June 2004, I returned from DevTeach in Montreal and couldn't find my Pocket PC anywhere. I asked Marcie who I had shared my room with if she had found it. I called the hotel to see if it was still in the room. Nope. It did have a return address sticker on the back with my address and cell phone, so maybe just maybe...   Oh well.

Today I received a mysterious package from St. Louis, MO with no return address on it. In it? My pocket PC! One and a half years later.



Don't Forget: www.acehaid.org
Thursday, December 15, 2005 5:12:59 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Wednesday, December 14, 2005

On Monday night, I did a somewhat lengthy overview of developing software for Tablet PCs at GUVSM, one of the .NET groups in Montreal.. As I started the session, I learned that only one person in the room had ever seen a tablet pc, so I decided to spend a little time showing them a bit about the technology, otherwise developing inkable software wouldn't make too much sense! I did the whole presentation in VS2005, which says a lot about the updated API working pretty well with VS2005. It was also a great exercise for me because I haven't played with a great variety of functionality in a while and preparing the demos gave me an excuse to refresh my memory.

The meeting was sponsored by MSDN Canada, who covered my travel expenses and enabled me to stay overnight rather than do the 3 hour drive back home so late at night. Thanks to Sasha and Wendy from MSDN Canada and for Guy and Jean-Rene for bringing me up. Naturally, the meeting was followed by a late night dinner of smoked meat. Though we normally go to the all-time classic Ben's, this time we went to Reuben's. I always have a blast with these guys: Mario Cardinal, Jean-Rene Roy, Eric Cote and Etienne Tremblay. The biggest lesson of the night was to stay away from Bell as your ISV if you can and to befriend a geek who likes to keep up with the latest toys, so when they shed their antiques (like 2 month old cell phones) you might be first in line!

To top it off, before I drove back home Tuesday morning, I got to go see an exhibit that I have been wanting to get to: Right Under the Sun. Landscape in Provence, from Classicism to Modernism (1750–1920) at the Montreal Museum of Fine Arts. Though attempting to view about 200 works of art in a mere 2 hours was a little quick, it was wonderful to see. Provence has a beautiful combination of landscapes - mountains, canyons, harbors, the sea - and it was a magnet for painters including those that are more commonly known, such as VanGogh, Cezanne, Monet, Georges Braque, Renoir. Some of the landscapes became familiar as many painters had captured them - most memorable were Mt. Saint-Victoire and a canyon whose name I can no longer remember. It was also fascinating to watch the styles evolve. Perhaps I'll get up there one more time before the show ends in early January to linger a bit longer.



Don't Forget: www.acehaid.org
Wednesday, December 14, 2005 9:37:25 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Monday, December 12, 2005
I will be doing 4 [new] talks at Connections this spring. I was happy to learn that both Alex Homer and Dave Sussman will be also there this time. These guys are in the U.K. so they can't always make it. Now to find a great sushi restaurant and see what other squiggly things I can talk Dave into trying!

Posted from BLInk!
Monday, December 12, 2005 10:17:14 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Sunday, December 11, 2005

In the past, the December "meeting" for Vermont.NET has been a pot-luck gathering at either someone's office or house. This year, with other (less stingy? ;-)) folks than myself in charge, we are having a real party! It's going to be at Parima Thai in Burlington which has a really cool private party room designed in the feel of Frank Llloyd Wright. And member, Paul Swider, has somehow gotten his friends from Pine Street Jazz to play at the party! It's like a real office party. Appetizers will be provided and there will be a cash bar. Parima is even offering a discount to any of our members who want to have dinner at their Thai Buffet before or after the party. We will still do our pot-luck in the form of desserts as well as collect food for Vermont Foodbank.

Thanks to Parima and Pine Street Jazz for making this affordable and to local c-tech, Knowledgewave, for their sponsorship!



Don't Forget: www.acehaid.org
Sunday, December 11, 2005 11:37:08 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

In addition to having a great time presenting at WeProgram.NET last week, there were two other things I wanted to share.

When it's possible, I try to bring back a local beer for Rich. Unfortunately, there was no bringing a 6pack of Castle back from South Africa, but in Virginia Beach, the local brewery is St. George. I had to find them via google, but was able to grab a 6-pack at the local market. Since my laptop is not too heavy, it wasn't so bad carrying it back home in my backpack.

While there, my brother brought me to one of his favorite lunch spots, the Warriors Grill, which does a buffet in the style of the Mongolian warriors of centuries past. I love the history of this, described in ther menu and got a good laugh out of "at the Warrior's Grill, we do the gathering and preparing for you. No need to place the meat under your saddle to tenderize it as the Mongol Warriors would sometimes do."

At the restaurant, you pile prepared vegetables and meats along with a great variety of oils into a bowl and then they are cooked on a hot surface.

Unfortunately, the whole history is not on their website, so here's a quick scan for you.



Don't Forget: www.acehaid.org
Sunday, December 11, 2005 10:24:52 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

GridviewGUY.com

GridviewGIRL.com (that's Marcie)

Notice the color schemes of the sites, too. Blue for boys and pink for girls. ;-)

(Not battle really going on here. It's just more info for us!!)



Don't Forget: www.acehaid.org
Sunday, December 11, 2005 8:30:24 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
Etienne Tremblay is a real VSTS wonk. (Etienne is French Canadian, so I should be sure to remind him that "wonk" is a good word..). He works at EDS, which is one b-i-g company, and is excited about the fact that Microsoft has just changed it's Team Foundation Server recommendations from "Teams of up to 500 users" to "Teams of up to 2000" users. That's a lot of programmers mucking with your code. But one has to understand that I am an independent so it's basically unfathomable to me....

Don't Forget: www.acehaid.org
Sunday, December 11, 2005 8:26:13 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Saturday, December 10, 2005
At DevConnections, I had a fun lunch with 3 great (and smart, man oh man!) young guys who's names all start with R and work for a company in Chicago. They love their job and their company was named as the 3rd best place in Chicago to work by Chicago Magazine. And they are looking for some help... read more on Ryan Rinaldi's blog and Ray Jezek.

Don't Forget: www.acehaid.org
Saturday, December 10, 2005 10:20:26 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Friday, December 09, 2005

A number of noteworthy items related to women in the .NET development community crossed my radar this week and I thought I would set them down in one place. (Read more...)

[A DevLife post]



Don't Forget: www.acehaid.org
Friday, December 09, 2005 5:49:59 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Thursday, December 08, 2005

Susan Lennon picks me up in her BMW Z4 to speak at WeProgram.NET in Virginia Beach! Zoooom! (read more...)

[A DevLife post]



Don't Forget: www.acehaid.org
Thursday, December 08, 2005 6:33:07 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

When someone told me that the AGP interface for plug in cards for my PC was "like pci but better" I made the assumption that it would plug into my PCI port. Dumb me. After 20+ years with computers, I should know better.

AGP is different from the ground up and requires it's own interface on the motherboard.

PCIe (PCI Express) is also different and is even newer than AGP.

These two are mostly for the high intensity graphics that are used in gaming.

PCI-X is not another way of saying "PCI Express". It's totally different and was an enhancement to PCI.

My Dell 170LN does not take AGP or PCIe. I was lucky to find a dual DVI card that can plug into my PCI slot. It took me a long time to find it because when I saw pictures of this one, I passed it by. It only has one port to plug a cable into. However, it is designed to sort out sending signals to multi-monitors. You only need a special Y cable to plug the two in.

So if you are stuck with "Conventional PCI" but want to use dual digital monitors the thing to get is an NVIDIA Quadro4 VNS 280 PCI card. This is made by PNY and also HP. You also need a separate Y cable. Be careful because you can get Y cables that have one VGA and one DVI or one that has two VGAs or one that has 2 DVIs.



Don't Forget: www.acehaid.org
Thursday, December 08, 2005 9:50:15 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Wednesday, December 07, 2005

I did an experiment a few months ago by putting some google ads on my blog. I was just curious what would happen. I replaced one of them after Katrina with a more worthy cause than my own, but left the others there. I have basically forgotten about them until I had a nice email from DonXML with some suggestions about how I could make the ads more effective.

This reminded me to go check my earnings. Here's where they stand:

You can't collect on this until you reach a certain amount  (is it $50? I forget). Maybe sometime next year, I'll collect the $50 and donate it to a local Vermont charity. I get free hosting from Alentus (thanks Alentus) so I have no real need for the adsense anyway.



Don't Forget: www.acehaid.org
Wednesday, December 07, 2005 4:31:50 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  |