.net

Generating a Protocol Buffers definition

Hi, I have a large set of XML files of a propriatary schema -the XML files define binary communication protocol (message structure). I'd like to leverage Google's protocol buffers technology. I am using existing code to load the XML files into an object model (in memory). I'd like to generate a .proto file from that object model. ...

In .NET CF 2.0, will a global keyboard hook interfere with P/Invokes that require a keypress?

My details: custom mobile device running Windows CE 4.2, Compact Framework 2.0 SP1. C# app making decent use of P/Invokes with no problems until now. I've written a low-level keyboard hook (similar to, but not identical to, this CodeProject post) which works marvelously with one exception. One thing that our software does is allow acces...

C# .NET Uploading file to a web form using HttpWebRequest

Does anyone have a working example using HttpWebRequest in C# to submit a file from the local drive to a multipart/form-data web form? ...

powershell outlook interop send email

I'm developing a script that involves creating an email contact, and forwarding mail to that contact. Last part of the script is to automatically send a test email to the address to make sure the forwarding works. So I use the following code: [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Core") $olApp = new-object...

Are all .NET exceptions serializable?

Can all .NET exception objects be serialized? Summary of responses: They should be, but historically, there have been exceptions. Objects in the Data dictionary may prevent the exception from serializing. ...

GUI Locking up when using PrintDialog and PrintPreviewDialog in .net

I'm using .net's PrintPreviewDialog and whenever it's generating a preview, it locks up my GUI in the background and makes it look like it has crashed until the preview is finished. Seeing how the .net's page progress window that pops up isn't a dialog, the back ground can be selected which then comes to the front in a half drawn, locked...

Do you know any run-time differences between Compact and Full Framework code?

There are a number of run-time differences in compatible code between these two versions of .NET. Here is a list of differences so far: Graphics.DrawRectangle - differs by 1 pixel Graphics.DrawString - Loses the line wrap if used with a StringFormat with both StringAlignments set to Center. Most file operations - compact framework nee...

Unit Testing Legacy ASP.NET Webforms Legacy Applications

I've inherited a legacy web application that has no unit tests in it. I'd like to add some, but am at a loss of where to start. Should I add them to old code? Or just new code going forward? What if that code interacts with legacy code? What would you suggest? ...

Managing database connectivity with ADO.NET

We have an application that is built upon ADO.NET. We follow some simple best practices that allow us to make use of the connection pool. For example, a block of code that is using a database might look something like this: using( DbConnection dbConnection = GetDatabaseConnection() ) { doWork(); } FWIW, there's nothing spec...

Best place to start decoupling objects

This is a C# question, but really could be language-agnostic I have inherited a large object model (100+ types), with a hierarchy of objects that 'own' 0..n of other typed objects that all share a base (where there is a 'relatively' strict type hierarachy). I want to start decoupling these objects though inheritance to put together an ...

Rhino Mocks - Setting up results for non-virtual methods

I'm playing around with Rhino Mocks and am trying to set some dummy results on my mocked objects so when they are called in my factory methods I don't have to worry about the data. But I've hit a snag, the methods I want to have the dummy results for are causing exceptions because they aren't virtual. I've got code like this: using(mo...

Searching phrases in Lucene

Could somebody point me to an example how to search for phrases with Lucene.net? Let's say I have in my index a document with field "name", value "Jon Skeet". Now I want to be able to find that document when searching for "jon skeet". ...

.NET Events more common in winform than webform?

Are declaring custom .NET event such as this, more common in a winform app than webform? ...

Are there any winforms spinner like controls for adjusting floating point values?

I have .NET app with a floating point value that I want to adjust up and down by a user adjustable increment with something like a spinner control. Before I go off and build my own, does something like this already exist? ...

Database size via WMI in .NET

Is there a way to find out the size of a SQL Server database using WMI from .NET? I've had a look at the WMI documentation but I'm not clear how I'd be able to locate that information. We're using SQL Server 2008. -dave ...

asp.net survey questionnaire engine

I am looking to implement (or build as a last resort) a type of survey engine that allows for extensibility and integration into an existing workflow engine. The survey/questionnaire engine should allow for admin users to add new questions and response types (text/bool/multiple/etc), should use SQL Server for persistence and ASP.NET 2.0...

Whats ResolveAll do

Hi guys Just a quick one. In IOC's what does ResolveAll do?? I know that the offical answer is "Resolve all valid components that match this type." but does that mean that it will return any class that implements a given interface? Cheers Anthony ...

How to get .NET version (1.1, 2.0, 3.0 etc.) under which an Assembly was built?

I have an assembly. Is there a way to detect which version of .NET was used to build that assembly? ...

Tools for Data Capturing from Scanned Images

What are best tools available for Data Capturing from Scanned Images? Doesn't matter they are free or paid. They should be able to convert scanned images to data (text, image, tables etc.). Most importantly they should have API to integrate with .NET 2.0 for automation. Edit: The input data will generally be Text, Images, Tables places...

Bulk Insert to Oracle using .NET

What is the fastest way to do Bulk insert to Oracle using .NET? I need to transfer about 160K records using .NET to Oracle. Currently, I'm using insert statement and execute it 160K times.It takes about 25 minutes to complete. The source data is stored in a DataTable, as a result of query from another database (MySQL), Is there any bet...