Blog Home  Home Feed your aggregator (RSS 2.0)  
What did you learn today? - Thursday, September 22, 2005
Phil Denoncourt's Technology Rants
 
 Thursday, September 22, 2005

Code Camp IV – Developers Gone Wild

If you are looking for a lot of great information, check out Code Camp IV this weekend.  Here's a link to register hereI’ll be presenting three sessions:

 

Sept 24, 2005, 7:15PM – Rhode Island Room

Scraping Data from Websites with the .NET Framework

 

Sept 25, 2005, 10:45AM – Providence Room

Introduction to Code Access Security

 

Sept 25, 2005, 1:15 PMTechnical Briefing Center

Improving the performance of your SQL 2000 database

 

See you there!

Thursday, September 22, 2005 7:07:30 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Speaking Engagements  | 
 Tuesday, May 04, 2004
Dealing with strings by Phil Denoncourt

http://www.joelonsoftware.com/articles/Unicode.html

This article is awesome!  True to the author's claim, dealing with Unicode is not hard once you understand it.  I've been one of those developers that did kind of hope that everything would return to normal where a character is alway 8bits.  I've been putting off understanding string encoding issues because it seemed to be a complicated issue for a problem I rarely have.  It really isn't.  Give Joel's article a read.

Tuesday, May 04, 2004 4:27:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
 Wednesday, March 24, 2004
HTML Agility Pack by Phil Denoncourt

As I was preparing for my talk tonight on web scraping, I came across a class library that has proved to be invaluable.  The HTML Agility Pack is awesome.  It allows you to download the HTML from a website and navigate through it like an XML document or using XPath queries.  You could do this before by hosting an IE Browser control in your scraping app, and going through the document using DOM.  However the IE browser control has a problem with badly formed HTML and unfortunately, most of the data on the web is not well formed.  The HTML Agility Pack deals with badly formed HTML just as easily as it does with well formed HTML.  This cut down the time required for me to write a scraper from a couple of days to a couple of hours.

People in my fantasy baseball league, beware.  I've downloaded a significant amount of baseball data and I know how to use it!

Wednesday, March 24, 2004 5:44:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 

Tonight I'm speaking at the NH VB.NET user group.  If any of you are around the Manchester NH area, stop by.

NHVBUG Meeting - March 24
3/24/2004 - SNHU Campus
5:30 - 6:00 General Announcements & Questions

6:00 - 7:00 Marc Thevenin will be demonstrating how to create .NET applications that are self-updating using a freely available component. Never worry about deploying software updates again!

7:00 - 7:30 Phil Denoncourt will continue his talk on web scraping. Web scraping is the process of writing software agents that download information from the internet, parsing the information, and then loading it into a database.

7:30 - 8:00 Windows XP Service pack 2. This is not your typical service pack. Fundamental changes to the operating system will change the way your application works. Come find out what you need to be aware of.

Wednesday, March 24, 2004 5:36:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
 Tuesday, March 16, 2004
Bloated GUIDs by Phil Denoncourt

Me and a few other developers at work were discussing GUID/UUIDs and why they are the ultimate primary key.  I love them!  Every new database I start, I use a GUID as the datatype for primary keys.  This frees me from the semantic key problem.  It also gives you the freedom to create the primary key from within your application, rather than making a call to the database to get the next primary key.  This gives you tremendous flexibility in disconnected apps, and increases your scalability in traditional apps.  Best thing since shoes without laces.

Marc Thevenin was convinced that there was no real way to guarantee a key based on a number could be created that would be truely unique.  I considered this a challenge and set out to prove him wrong.

Turns out, he's theoretically right, at least in the way GUIDs are generated.  Information provided at opengroup.org outlines the algorithm used to generate GUIDs.  If you look at it, it's based completely on two things.  The Time and a MAC address.  Many motherboards that have integrated network adapters, allow you to change the MAC address.  So, if you set two computers to have the same MAC address(of course, not on the same network segment), and power them on at the exact same time (or within 100 nanoseconds), the two computers could generate identical GUIDs.  Therefore it is possible in theory, but I suspect that the chances of this happening in reality is comparable to winning 5 different state lotteries on the same day.

Looking at the routine, I am amazed at the simplicity and robustness, but I do wonder about the following:

The time used to generate a GUID is the number of 100 nanosecond intervals that have occurred since Oct 15, 1582.  Near as I can tell between 1582 and 1990, over 128,502,443,520,000,000 intervals have passed that will never be used to generate GUIDs.  That's a waste of between 47-48 bits.  That means only 79-80 bits in the GUID are meaningful.

Tuesday, March 16, 2004 1:12:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
 Thursday, March 11, 2004

When I first started programming Windows applications back in the early 90's, I used to read all of the KB articles that Microsoft put out.  This kept me relatively well informed of some of the more advanced features in their products.  It also made me aware of their limitations.  Over time, there were too many articles and too little time to keep up with them, so I've since stopped trying. 

Now the KB articles can be retrieved using RSS!  If you go to http://www.kbalertz.com/allKbs.aspx drill into the category you're interested in and subscribe using the link on the XML icon. This is a great way to keep track of developments out of Microsoft.

Thursday, March 11, 2004 5:05:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
Fastest way to split strings by Phil Denoncourt
I've written quite a few HTML scrapers (reading an HTML page, and parsing out information contained in it) and the biggest part of these programs are the string manipulation.  I usually break the HTML page up into string arrays and run through the array looking for keywords.  In .NET, you can break strings up using the .Split method of a string object or you can use Regular expressions.  I find regular expressions powerful, but cryptic to write and maintain, so I use the split method more often than not.  Darren Niemke has benchmarked different methods of spliting strings in .NET
Thursday, March 11, 2004 10:10:00 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
 Wednesday, March 10, 2004
AndAlso / OrElse by Phil Denoncourt

I've been a VB developer since version 2.0.  Everytime a new version of VB comes out, I skim the “What's New” section of the documentation and then begin using it.

Something that has escaped my scrutiny is two new operators that were added in VB.NET: AndAlso / OrElse

These are related to the And / Or operators, but work a little differently.  Consider the following routine that checks to see if data was returned from a method:

Dim obj As DataSet

obj = GetMeADataSet()

If Not (obj Is Nothing) Then

    If obj.Tables.Count > 0 Then

        If obj.Tables(0).Rows.cout > 0 Then

            'Check out the data

        End If

     End If

End If

It would easier to write the statement as:

Dim obj As DataSet

obj = GetMeADataSet()

If Not (obj Is Nothing) And obj.Tables.Count > 0 And obj.Tables(0).Rows.Count > 0 Then

    'Check out the data

End If

Unfortunately, this statement will fail if obj is nothing or there are no tables in the dataset.  Why?   Because VB will execute all three parts of the if statement, resolve them to boolean values and then perform the boolean math with the AND operator.

The AndAlso operator, has a “short circuiting mechanism“.  As soon as it encounters a false value, it know that the IF statement will not be true, so it either goes to the ELSE section or leaves the if statement.  The opposite is true for the OrElse operator.  As soon as a true condition is found, VB knows that the final result will be true, so it jumps into the IF statement.

So the statement can be rewritten as follow and it will not fail:

 Dim obj As DataSet

obj = GetMeADataSet()

If Not (obj Is Nothing) AndAlso obj.Tables.Count > 0 Andalso obj.Tables(0).Rows.Count > 0 Then

    'Check out the data

End If

Frankly, I don't know why anyone would continue to use the And / Or operators anymore. 

Wednesday, March 10, 2004 12:14:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
The Start by phildenoncourt

I just got this application up, configured and running!  My hope is to add entries as I come across interesting tidbits about .NET during the day

So if you've come across this page randomly, let me tell you about myself.  Married with kids(5) for 14 years.  I'm currently employed as a Senior Software Engineer at SunGard BSR in Waltham MA writing ASP.NET apps in VB.NET.

I've been a computer enthusiast(geek) for over 20 years, and have worked in the industry as a programmer in some capacity for the past 15 years.  Right now, I'm focused on .NET and the upcoming Whidbey release.  I run the New England C# user group, and present at other area user groups from time to time.  If you're further interested in my professional bio, my resume is posted at www.denoncourtassociates.com

I appreciate feedback on what I post here – is it helpful? 

-Updates: Changed number of kids and URL

Wednesday, March 10, 2004 10:51:00 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
Copyright © 2008 Phil Denoncourt III. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: