Monthly Archives: November 2004

Magic folders – win32 and also .net

Raymond Chen explains why folders like My Pictures would reappear after you delete them.

There’s actually something that caught me by surprise in .NET that I learned to accept that is along the same lines. I have some code that needs to look for a file in the Application Data folder area for a particular program. But I don’t want to use the CommonAppDataPath, as this creates a new folder for each version of the application. Therefore, I use the GetParent function combined with the folder name I always want to use like this:

dirStore = System.IO.Directory.GetParent(System.Windows.Forms.Application.CommonAppDataPath).ToString & “\filestore”

But this actually creates the CommAppDataPath folder anyway! Maybe there’s an overload I’m missing and I learned to accept it. My data goes where I want it to in the long run and the users never look there anyway.

 

Posted from BLInk!

Vermont IT Jobs: Web Developer:PHP/Perl/MySQL

800Response has a Web Developer job listed in www.sevendaysvt.com. They don’t have the job listed on their website (that I can find). The job descrip says “must be familiarl with Dreamweaver, Fireworks and Flash, and have excellent system architecture and application/database design skills.” There’s more. If you can’t find 7Days, maybe email blesperance@800reponse.com for a job description.

Posted from BLInk!

Bulk Copy in ADO.NET 2.0 – pop quiz

BulkCopy sounds great on paper, but have you actually tried it?

I did. I took a 104,000 record table from SQL2000 on one server and used BulkCopy to import those records into a pre-existing table in SQL2005 on another server.

But first I tried the same operation with DTS as a benchmark and that took 21 seconds. (note that I’m doing this on an older computer that is 700 mhz and I think 512MB Ram. The remote server is an old dog, too.)

Then I wanted to see what it was like in code without bulk copy. I thought I would at least leverage some of the new features in ADO.NET 2.0 for this. I grabbed the same 104,000 records into a DataReader and used DataTable.Load (new feature in ado.net 2.0) to pull it into a DataTable. Then rather than let a DataAdapter.Update insert this one at a time (puh-lease!), I leveraged the new batch capabilities.  SQLServer did not like 1000 records at a time (too many parameters in one execute command) so I set UpdateBatchSize to 100. I also am using the beautifully simple little System.Diagnostics.StopWatch class in this test. It’s been running a while. I will come back and insert the time here when it finishes > 41 minutes <. If the lights start dimming in Burlington, you’ll know why!

Before this test though I did the same operation using BulkCopy. Again, I pulled the 104,000 records from the remote server (on the same hardwired network) into a datareader and then passed that datareader into a SqlBulkCopy object, then called it’s WritetoServer method.

So remember the DTS took 21 seconds. How long did the operation take in ADO.NET 2.0?

Let’s have a few guesses and then I’ll tell you. Heh heh heh.

OKAY – it was 23 seconds! Basically the same as the DTS! Rather than 180 times as long as with the batch updating which would have been impossible with ADO.NET 1.1 where there is no batch updating. So that may have been 100 times longer than the batch update way.


Posted from BLInk!

Thank you Hervey

Hervey had to listen to me whine about this one. I have a remote web server and could not create policy files from the settings tool.

“The Security Settings Wizard can support creating Policy files for remote service.”

thanks! It’s minor, but helpful.

A quick perusal of the readme which Hervey Wilson has on his blog, shows some helpful stuff with X509 tokens (like friendly names) some help with managing custom security tokens

ok ok back to my ado.net 2.0 now



Posted from BLInk!