DCSIMG
C# - .NET Geek

.NET Geek

"It is upon the Trunk that a gentleman works" - Confucius

Browse by Tags

All Tags » C# (RSS)
Importing Large Xml Files to SQL Server Using SqlBulkCopy
Say you have a large Xml file that contains relatively tabular data that you want to import into SQL Server. There are several ways to go about this. Let’s look at a couple of options. Load the file into an XDocument. Extract elements from the DOM using Linq and then use ADO.Net to insert the data into the database. Load the data into a DataSet using ReadXml and save the data to the database Read through the data using an Xml reader and save each record to the database Options number 1 and 2 requires...
Solving an Expensive Database Lookup
We had an interesting problem the other day. In our database (SQL Server 2008) we have a few tables with possibly many millions of records. We send some of the data from these and related tables to a third party service for processing and get status reports back. The problem was that the reports that we get back cannot easily be correlated back to the original records in our database. Let’s say we have a person table and an address table with a 1:m relationship between person and address. The tables...
Posted: Apr 26 2009, 10:57 PM by Kim | with no comments
תגים:, , ,
Adapters and Functional Abstraction
I can’t decide what I think about the following implementation so I decided to throw it out here. Any thoughts are welcome. In a previous post I wrote about our wrapper around Bouncy Castle PGP encryption. Turned out it worked pretty well except one little problem. The PGP implementation on the receiving end would complain about our signature. In despair I even posted (and later answered) a question on StackOverflow. :-) The problem was that they use an old version of a PGP library that couldn’t...
PGP Zip Encrypted Files With C#
On a recent project here at Renaissance , we needed to send files over FTP to some third party vendor. One of the requirements was that the files had to be encrypted using PGP (Pretty Good Privacy). After some research we decided to use Bouncy Castle . Bouncy Castle is an open source C# implementation of the OpenPGP standard. It is available in Java as well. An additional requirement was that the PGP Encrypted files needed to be signed as well. If you have no background in cryptology or PGP and this...
Posted: Jan 23 2009, 12:14 PM by Kim | with 41 comment(s)
תגים:, , , ,
Windows Service Shutdown Problem
In our current project we have a service that handles messages sent to the application over MSMQ. On startup the service initiates a configurable numbers of listeners that processes messages as they arrive. The main reason this listener initialization is bootstrapped through a Windows Service is because we must be able to “survive” a system shutdown/restart. After a restart the queue listeners must get back to their task of processing and endless stream of messages. I’m not going to go into too much...
How to add words to an already loaded grammar using System.Speech and SAPI 5.3
I asked a question on StackOverflow about a week ago. Since I’ve gotten no response there, I thought that I’ll post it here. Maybe someone has a solution. Before I get to the question, a short detour. If you are building custom grammars with the System.Speech API here’s a neat little trick that I found when assembling some complex grammars. If you spell the words in your grammar more like they sound than how they’re really spelled, the recognition engine often gives me better results. Let’s say you...
Posted: Dec 07 2008, 03:49 PM by Kim | with no comments
תגים:, , ,
CodeRush Plugin – Navigate to Implementation Part 4
This is the last post in series on developing the navigate to an implementing method plugin. Here are links to the previous posts, part 1 , part 2 and part 3 . Just to recap, the goal of the plugin is to be able to position the caret (what most people call the cursor), on a method call on an interface variable and navigate to specific implementations of the method. In this post we’ll look at how we navigate to the correct method. The call to navigate is made when the navigation provider (part of...
Beauty is in the eye of the beholder
In the last edition of Visual Studio Magazine, a reader-mail entry stated that he preferred VB.Net over C# because C# is ugly. Without entering that discussion, I find C# pretty at times. That reminded me of a an episode from high school. Our math teacher was ill and none of the regular replacement teachers were available. Instead we got a math professor from a university who stepped on late notice. I don’t remember much, but one thing got burnt into my memory. During that class she stood by the...
Posted: Nov 28 2008, 04:23 AM by Kim | with 2 comment(s)
תגים:, ,