.net

Why is function isprefix faster than Startswith in C#?

Hi, Does anyone know why C# (.NET)'s StartsWith function is considerably slower than IsPrefix? ...

DataRelation from a single query

Hi, i have the following piece of VB.NET code: Dim conn As New MySql.Data.MySqlClient.MySqlConnection(ConnectionString) conn.Open() Dim sql = "SELECT * FROM users" Dim com = New MySql.Data.MySqlClient.MySqlCommand(sql, conn) Dim ds As New DataSet("dsUsers") Dim da As New MySql.Data.MySqlClient.MySqlDataAdapte...

Reflection.Emit - access topmost-but-one item from stack

Is there a way in .NET, using Reflection.Emit, to access the topmost-but-one item from the stack? So if A is topmost, and B next - I want to process B then A. It would be fine to duplicate B above A (since I can simply "pop" the second B when I get to it). Currently, I am declaring a local: LocalBuilder loc = il.DeclareLocal(typeof...

How can I force my WPF main window to have a Vista look on a XP machine?

I'm developing a WPF application and I wonder if it's possible for the main window to have a Vista look. Some applications like MS Live Messenger and Google's Chrome already do that. Any ideas? Thanks. ...

Fastest way/algorithm to find one different keyword between two set of text files

I've got 4 text files, 2 of them contains a keyword which other 2 text files don't. What's the fastest way/algorithm to find this "keyword" shared in the first 2 text files but don't exist in the other 2 files? I can think of really slow ways such as go word by word and then search with IndexOf etc. But sounds like it's going to be r...

Downloading webpage image from SSL + WatiN

I've been thinking about this and can't seem to find a way to do this: I've got some code running on WatiN 2.0 which connects to a site via an SSL tunnel, and after performing certain tasks (which there're no other feasible ways to automate without relying on a browser) should be able to download an image from the very same SSL connectio...

WordPress or Community Server or N2?

I am starting a website where i would like to post technical articles. I am looking for a system that helps me post code easily, is optimized for Search engines and is easy to use and operate. For now, I don't have any plan of having a forum in there, maybe in the future. Any suggestions? ...

.net: how do debug XmlSerializer.Deserialize errors?

During development I've seen xml read errors like this more than once: TestData.ReadFromXml: xml Deserialize error:There is an error in XML document (2, 2).. What exactly does (2, 2) refer to? Is it line 2 in the xml file? Line 2, token 2, what? Are there any debug options I can add to shed more light on the problem? Edit: here are ...

EDI equivalent in the .net world

I work for a small company. Currently we are re-writing our legacy application in c#. There is one part of the application that uses EDI, and I don't know where to look for solutions in the .net world. I have heard about BIZTALK but not sure as to if that is the solution. Also there is no BIZTALK EXPRESS edition like SQL SERVER EXPRESS E...

How to best insert 350,000 rows with ADO.Net

I have a csv file with 350,000 rows, each row has about 150 columns. What would be the best way to insert these rows into SQL Server using ADO.Net? The way I've usually done it is to create the SQL statement manually. I was wondering if there is any way I can code it to simply insert the entire datatable into SQL Server? Or some shor...

Writing plug-ins for Adobe (Reader and PhotoShop) using .NET(C#)

I want to write plug-ins for Adobe products in .NET (C#) (specifically Acrobat Reader and PhotoShop). The requirement is to add a new command in the File menu. So for example in Acrobat Reader, I need to add a new "File >> Open My File" command that displays my dialog to open some file. I have heard about the Adobe Development Kit. Is t...

How can I use the Windows look'n'feel for a system tray context menu?

I'm working with a NotifyIcon and ContextMenuStrip, I don't want to use the default menu look and feel which is shipped out of the box with this control which is different to Windows (Vista in my case) by using contextMenu.RenderMode = ToolStripRenderMode.ManagerRenderMode or contextMenu.RenderMode = ToolStripRenderMode.Professional: ...

What are Delay Signed Assemblies?

Probably a simple question.. but I don't know what it is... ...

Proxying Videos locally with a TCP Socket

Iv'e been really interested in adding support for video podcasts to Media Browser. I would like users to be able to navigate through the available video podcasts and stream them from the internets. That's really easy cause media player etc.. will happily play a file that lives in the cloud. The problem is that I want cache these file...

C# dictionary<> missing key

When i do val = dict["nonexistent key"] i get System.Collections.Generic.KeyNotFoundException Is there a way i have my dictionary call a member function with the key as a param to generate a value? -edit- Maybe i should of been more specific. I want to AUTOMATICALLY call a member function to do what it needs create the proper value for ...

To return IQueryable<T> or not return IQueryable<T>

I have a repository class that wraps my LINQ to SQL Data Context. The repository class is a business line class that contains all the data tier logic (and caching and such). Here's my v1 of my repo interface. public interface ILocationRepository { IList<Location> FindAll(); IList<Location> FindForState(State state); IList<L...

dll copied to output path from wrong folder

all of the projects in my solution have an output path of "..\Release" for Release builds and "..\Debug" for Debug builds. All of the projects works fine except for one. Whenever I build the problematic project in Release the dll that gets copied to "..\Release" comes from "obj\Debug" instead of "obj\Release". This happens both in VS ...

Thread-safe one time calculation best practices

It's quite common that I need a property in my class which needs to be calculated and cached. Generally I use a lock and a boolean top check if it's processed or not. Sometimes I do it in accessors. What's the performance hit of this approach? Is there any better way to it. Sample Code of my common approach to this: Sub Main() ...

Entity Framework: Should the EntityContainer name contain at least two words?

I am using entity framework, using (almost) hand-crafted csdl, ssdl, and msl files. I've noticed that object construction seems to fail if the name of the EntityContainer consists of a single word. For example, for the following two csdl files : <Schema Namespace="BestProduct" Alias="Self" xmlns="http://schemas.microsoft.com/ad...

How do I do a custom projection with the Criteria API in NHibernate?

With HQL I can use dynamic instantiation like this: select new ItemRow(item.Id, item.Description, bid.Amount) from Item item join item.Bids bid where bid.Amount > 100 Now I need to create my queries dynamically with the Criteria API. How can I obtain the same results that I would have obtained with HQL, but using the Criteria API? Th...