.net

.NET String parsing performance improvement - Possible Code Smell

The code below is designed to take a string in and remove any of a set of arbitrary words that are considered non-essential to a search phrase. I didn't write the code, but need to incorporate it into something else. It works, and that's good, but it just feels wrong to me. However, I can't seem to get my head outside the box that thi...

MySQL DataCOnnection and ADO.NET

I want to use mysqlconnection, command and datareader or sqlconnection, command and datareader based on a condition. I want to use same variables for both type of connection Ex: Currently i have dim _c as New mySqlConnection() dim _cmd as New mysqlCommand() dim _reader as New mysqlreader() _reader = _cmd.executereader() 'loop through ...

How to close on pressing X on PocketPC

On PocketPC, when you tap the (X) to "close" the application, it stays open in the background. The only way to close it (without third-party programs) is to go to the settings->memory and close the program. Or you can run other programs so when the PPC gets to no memory it will close the earlier programs. I am developing an application ...

Recommend a good db4o viewer

I'm playing around with db4o, and I have the Object Manager viewer thingy for Visual Studio. It seems okay, but not exactly on par with tools like HeidiSQL/SQL Studio/etc., not to mention that it locks the db4o file--I can't use my db4o app and Object Manager at the same time. Maybe I'm using it wrong, but regardless, I'd like to know ...

How can I tell that ILMerge has been used

I'd like to be able to tell whether or not an assembly is the output/result from using ILMerge on two different assemblies. It doesn't matter how nitty gritty it is, if I have to parse IL, I'm willing to do it. Is there anything that would be indicate that the assembly author used ILMerge? ...

"Can´t open socket or connection refused" with .NET

Im getting a connection refused when I try to send some data to my server app using netcat. server side: IPAddress ip; ip = Dns.GetHostEntry("localhost").AddressList[0]; IPEndPoint ipFinal = new IPEndPoint(ip, 12345); Socket socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); socket.Bind(ipFinal); so...

What is the preferred sql server column definition to use for a LINQ to SQL Version property?

We are using the IsVersion property on the ColumnAttribute on a property in a LINQ to SQL class for optimistic concurrency checks. What should the column definition be in the database? Currently we are using version_number int NOT NULL IDENTITY (1, 1) Do we need Identity? Can we get LINQ to SQL to update the version number for us? T...

Supporting a subset of ODF in a .net application.

I'm building a simple CMS for an ASP.net-based website and would like to store the site content in files that use a subset of the ODF file format. Ideally, the site should be able to save the content created in a format that any ODF-compliant editor can open and edit. It should also be able to open any ODF compliant file and load it if...

P/Invoke dynamic DLL search path

I have an existing app which P/Invokes to a DLL residing in the same directory as the app itself. Now (due to the fact that Canon produces one of the crappiest API's around) I need to support two versions of this API and determine at run-time which one I should use (old or new). Since the DLLs have the same name (the first one loads oth...

Please explain "How Fanboys See .NET Data Access Strategies"

This chart has been linked a number of times on blogs that I follow and I feel like a rube not getting it. So, going out on a limb here and asking this community. Please explain this grid from the blog post here. ...

When using out parameters in a function, is it good practice to initialize them in the function?

I have a function that uses out parameters to return multiple values to the caller. I would like to initialize them in the function, but I wasn't sure if that's a bad idea since you don't know when you call the function that it's going to change the values right away. The caller might assume that after the function returns, if whatever i...

How can I get a smooth, flicker-free GUI for an app run via Remote Desktop?

I realize there are a ton of questions floating around the internet about reducing flicker in Windows Forms applications. After copious experimentation, I found that the solution in my particular case was quite straightforward: setting the Control.DoubleBuffered property to true for the controls that were exhibiting flicker. I accomplish...

C# update a varying property on each item within a collection

I have this code (which is way simplified from the real code): public interface IAmount { decimal Amount { get; set; } } public class SomeAmount : IAmount { public decimal Amount { get; set; } } public static void UpdateAmounts( this IEnumerable< IAmount > amounts, decimal totalAmount ) { foreach ( IAmount amount in amounts ) ...

How do I provide a ExpressionBuilderContext to a ExpressionBuilder without a 'virtualpath'?

How can I construct an ExpressionBuilder which takes an ExpressionBuilderContext as parameter, without the use of a virtualpath in the context? I would like to parse expressions which retrieve data which is stored based on business-id rather then a virtualpath belonging to some view. Extra info: I have this to retrieve localized resou...

WCF UriTemplate won't match a single string parameter with slashes (/'s)

Here is the scenario, I have a WCF service call that takes one string parameter and that string has slashes in it (e.g. "123/456.xml"). I want to setup a UriTemplate like this "/{file}" so that I can access the method at http://www.example.com/File.svc/123/456.xml rather than http://www.example.com/File.svc/GetFile?file=123/456.xml. Is...

Can Object.GetType also be used for late binding?

a) Can Object.GetType also be used for late binding ( Book I’m reading says it can’t be used for late-binding )? For example, assuming we use late binding ( by dynamically loading an assembly A, calling A.GetType(“T”) and then calling Activator.CreateInstance) to create an instance (I) of type (T) not known at compile time and if we t...

Is it possible to get a reference to a WCF ServiceHost Singleton Instance before the first WCF client request comes in?

I am trying to access the singleton instance created by my WCF service but .SingletonInstance seems to be null even after .Open is called on the ServiceHost. Is there any way to force the ServiceHost to create the instance before the first WCF client request comes in (which presumably automatically spawns the singleton instance)? ...

Image API/App which can perform image manipulation on the fly?

Do any of you know an API or application which can handle real time image manipulation? Basically if I provided an image, this app would output perhaps a silhouetted version, or perform some other form of image manipulation, like roshak type blotting? If you don't know of an application like this, do you know if this is possible using ...

Unity framework - reusing instance

nobody loved my first question about this: http://stackoverflow.com/questions/2407636/creating-entity-framework-objects-with-unity-for-unit-of-work-repository-pattern so I've managed to rephrase it to something you can read without falling asleep/losing the will to live. I'm creating an object, DataAccessLayer, that takes 2 interfaces ...

TreeView owner draw glitch when selecting

I'm trying to add a few more icons to elements of a standard System.Windows.Forms.TreeView control. My plan was to only change the label area of the treeview control, but it shows a strange behaviour. If I click a node to select it, when the mouse button is depressed the background is draw correctly with the highlight color. However, th...