RSS 2.0
 Friday, May 07, 2004

So I was playing with .NET and XML today, and ran into a strange problem. I was loading in an XML document, and the SelectNodes method was never returning any results. Here is my VB.NET code:

Dim xmldoc As New System.Xml.XmlDocument
xmldoc.Load("C:\Accounts.xml")

Dim xmlroot As System.Xml.XmlNodeList
xmlroot = xmldoc.SelectNodes("account")

I expected this to work and it didn't. xmlroot.Count returned 0. I searched the web for a few examples, and they seemed to confirm I was using SelectNodes correctly. All other examples I could find used it that way.

Now taking a look at the XML created (I used VS .NET 2003 to create the XML), nothing looked odd to me:

<?xml version="1.0" encoding="utf-8" ?>
<accounts xmlns="
http://tempuri.org/Accounts.xsd">
  <account acctno="1">
    <name>Acct 1</name>
      <weight>10</weight>
      <value>0.00</value>
  </account>
  ... etc ...
</accounts>

When poking around in the documentation for SelectNodes, I noticed there was an optional second parameter, XmlNamespaceManager. Could the fact that my XML document had a default namespace be messing with my code? So I tried the following:

Dim xmldoc As New System.Xml.XmlDocument
xmldoc.Load("C:\Accounts.xml")

Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmldoc.NameTable)
nsmgr.AddNamespace("acct", "
http://tempuri.org/Accounts.xsd")

Dim xmlroot As System.Xml.XmlNodeList
xmlroot = xmldoc.SelectNodes("//acct:account", nsmgr)

And, lo and behold, it worked. Most experienced .NET and XML developers probably already knew this, but it seems like odd behaviour to me. Anyways, I hope this tip helps someone out there.

 

Friday, May 07, 2004 4:17:47 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Technology | .NET
Del.icio.us Digg Technorati Blinklist Furl reddit

Mark Cuban tells a few interesting stories about his early years in business. Worth a read for would-be entrepreneurs (like myself).

Friday, May 07, 2004 2:21:46 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Business and Investing
Del.icio.us Digg Technorati Blinklist Furl reddit
 Thursday, May 06, 2004

There are only a handful of people in this world whose hearts are presumed to be so pure that they are beyond reproach. The Dalai Lama is one. The Pope is another. And Mother Theresa was one before she died. And of course Ghandi too.

Yet here is an article that says that the Dalai Lama would have been better off leading a violent uprising against Tibet's occupiers (China) than the current peaceful protest method. It's an interesting theory.

 

Thursday, May 06, 2004 2:43:57 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Politics
Del.icio.us Digg Technorati Blinklist Furl reddit

When the U.S. first decided to invade Iraq, the stated reason was the flagrant violation of U.N. Security Council resolutions requiring Iraq to declare and destroy any weapons of mass destruction.

When the weapons were not found, the reason for war quickly became Iraq's association with known terrorists such as Al Qaeda.

When no association between Iraq and terrorism could be found, the reason for the war shifted to human rights. For six months, Bush used the phrase “the rape rooms and torture chambers of Iraq are now closed.”

Now that we learn that the rape rooms and torture chambers of Iraq remained open during the war (just under new management), what is the next reason for invading Iraq going to be? I can't wait to find out.

 

Thursday, May 06, 2004 11:29:31 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Politics
Del.icio.us Digg Technorati Blinklist Furl reddit
 Wednesday, May 05, 2004

I recently completed a contract at a small financial company (let's call it OldCo). After a much-needed vacation, I then started a new contract at another small company (NewCo), which is in the marketing industry. The two companies couldn’t be more different in their approach to technology; it is like night and day. I sit here today basking in the warm sun, after almost a year of almost freezing to death in the dark.

 

It’s odd. You’d think the financial company would recognize the necessity of information technology more than a marketing firm. But the marketing firm has some extremely smart IT people on staff, and what they are doing here is amazing.

 

When I arrived at OldCo in mid 2003, I knew they had some major IT issues that needed some attention. At first, I looked at these problems as an interesting challenge that I could overcome with determination. By the end, I realized that an outsider’s determination would not be enough, and these problems will eventually be their undoing.

 

OldCo is a classic example of the way some family-run companies are run. The owners of OldCo trust noone but themselves. They are deeply involved in the day-to-day operations, and no decisions are made without their approval. In fact, if you were to draw an org chart, it would be extremely flat – everyone reports to the owners.

 

This works well for a 5-person company, but becomes a bit more difficult to manage for a 50-person one. In order for this organization structure to work, a company has to be extremely good at communications and have efficient business processes in place. OldCo was lacking in both areas.

 

Working at OldCo taught me several important lessons. Some of them related to the specific project I was on. I learned the importance of identifying issues before they became problems. And I saw how important strong and clear leadership is to project success. 

 

The way the company itself operated also provided some important lessons for me. These have to do with understanding how important management support of IT is for a successful project, and how important a positive office environment is. Lack of either can negatively affect a project. Lack of both spells unavoidable doom.

 

When I arrived at NewCo this week, I could tell right away they have their act together. This company is about the same size as OldCo, but they are extremely efficient in their communications and have excellent business processes in place. The project I am working on has a strong foundation, and the office environment is very positive.

 

Only time will tell if NewCo will continue to be a great place to work when the pressures to deliver the project intensify. But it’s off to a great start.

 

Wednesday, May 05, 2004 11:41:50 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] -
Technology | The Blogging Life
Del.icio.us Digg Technorati Blinklist Furl reddit

I guess it shouldn't really be a surprise to learn that Americans use some heavy handed methods to get information on possible terrorist activities. If you think about it, American intelligence officials probably aren't just politely asking Saddam Hussein where he's hidden his weapons.

US Military: “Saddam, could you please tell us where some weapons are hidden?“

Saddam: “Sorry, I don't remember.“

US Military: “Oh. OK then. You're free to go.“

Man, if the American public ever really found out what their military does to get information, I am sure there would be shock and public outrage. No doubt, they use any and all mind-altering drugs available, and some mental and physical torture for good measure.

Wait a second. There's a story going around about prisoner abuse in Iraq by “a few“ members of the US Military. Some reputable sources are even suggesting that abuse is directly related to the interrogation, and that what those pictures depict ARE the softening up of prisoners to prepare them for interrogation.

I have always said that military and intelligence operations are like the wizard of Oz. Looking behind the curtain will ruin the trick. The American news networks have shown Americans a peek behind the wizard's curtain. Quick, close it! Before Americans find out any more of the disturbing things there government must do in the name of gathering vital intelligence.

 

Wednesday, May 05, 2004 7:27:01 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Politics
Del.icio.us Digg Technorati Blinklist Furl reddit

To combat spam, I have installed a Bayesian filter on my home computer that does an excellent job of recognizing spam and sending it to a special folder I have setup in Outlook. It is very effective: 99.28% correct in determining the type of email coming in (personal, work, spam, etc.). My spam filter has only mistakenly classified 4 emails as spam, out of the 5000+ total emails I have received over the last 6 weeks, which is beter than 99.9%.

I do however, spend a few minutes each day combing through the spam just on that 0.1% chance a good email has been misidentified. What amazes me are the ineffective techniques spammers are using to try and trick Bayesian filters into accepting the message:

* Totally nonsensical subject lines, such as “apprise”. I can see what the spammers are trying to do. They're trying to pick a dictionary word that will likely not be considered spam by any spam filters. Luckily, my spam filter catches those emails all the time.

* Breaking up spam words with funny symbols and characters. How many emails have tried to sell me “V1@gr@” or “C.i.a.l.i.s”. I think the use of these non-alphabetic characters is a dead giveaway. That never works either.

* Adding random characters into the subject, like that's supposed to stop any modern spam filter.

* Leaving the subject field blank, hoping I would be curious enough to open the email just to see what it's about. It's easy to delete a subject advertising “We1ght Loss Pill“ but harder to delete one with no subject.

* A subject line that tries to pretend like it's a non-spam email. “Re: Your order“ is a favorite spammer subject line.

* Having only a little bit of spam (like a URL and a few words), and then a whole lot of unrelated non-spam-like text. I've seen spam that contain one bad sentence, and then 10-15 quotations from famous writers filling out the rest of the message.

None of the above types of messages ever make it into my Inbox.

The type of spam people are kind of worried about, as they could theoretically beat any Bayesian filter, is one that contains actual text that you (as the individual receiver) might be interested in. Say you are a computer programmer, and you send and receive emails regarding Linux and Oracle all day. Any spam that mentions Linux and Oracle a few times (and neglects to mention high-probability spam keywords) is likely to get through. But the problem is, each person's non-spam keywords will be slightly different. How can a spammer design an email message that gets through in my email, but does not get rejected by 99.999% of other Bayesian filters out there?

Luckily for us, in 2004, they can't. In order to do such a thing, you would literally have to have not only a list of 25 million email addresses, but a bunch of context sensitive keywords relating to each email address. I mean, you would have to link a spam database with Lexis-Nexis (or Google I guess). They may be able to do something like that in a few years, but I don't see that the technology is available today. And even if it was, there are two main reasons it still might not work:

(a) anyone who employs an aggressive spam filter is not likely to order products advertised as spam thus defeating the whole purpose; and

(b) in order for spam to be effective you have to mention the product you are advertising (mortgages, drugs, adult web sites, etc.) so those keywords will be automatically caught as spam anyways, despite how many non-spam keywords that are used. I would like to think that a spam email that mentions “online pharmacy“ will always be caught regardless of how relevant the rest of the content is to me personally.

 

Wednesday, May 05, 2004 12:22:19 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Technology
Del.icio.us Digg Technorati Blinklist Furl reddit
 Tuesday, May 04, 2004

I recently blogged about how my last contract had ended and I was available for new work. I am happy to report that I am no longer available for the next little while. I am excited, as this company sounds like it will be a lot of fun to work at, which I need right now. (FYI: My definition of fun is working on an interesting project with talented teammates.)

I do have several friends who are well qualified as Microsoft developers and are still available in the Toronto GTA area, so if anyone sends me a job description, I will surely forward it on to them on your behalf.

 

Tuesday, May 04, 2004 11:48:06 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
The Blogging Life
Del.icio.us Digg Technorati Blinklist Furl reddit
Archive
<May 2004>
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Scott Duffy
Sign In
Statistics
Total Posts: 464
This Year: 23
This Month: 1
This Week: 0
Comments: 73
Themes
Pick a theme:
All Content © 2008, Scott Duffy
DasBlog theme 'Business' created by Christoph De Baene (delarou)