.net

Events and Delegates in F#

I don’t have any experience in F# but have a few lines of test code in C# for a framework I've made that I need to rewrite in F#. Any help would be appreciated. bar.Ready += new Agent.ReadyHandler(bar_Ready); static void bar_Ready(string msg) { Console.WriteLine(msg.body); } ...

Translate LINQ to sql statement

Hi, I want to translate LINQ expression tree to SQL statement and I don't want to write my own code for this. Example: var query = from c in Customers where c.Country == "UK" && c.City == "London" select c); To SELECT ... FROM Customers AS c WHERE c.Country = "UK" AND c.City = "London" I know DataContext.Log, but I want to use: quer...

ToolStripButton with Popup Menu?

I'm doing the GUI for a paint-like program, where the user will be able to select a drawing tool from a ToolStrip. Some of these tools have variations, and I'd like the user to be able to select one via a popup menu. Anyone familiar with the Photoshop toolbar interface will know what I'm after: the user can either click the button and s...

Testing SMTP with .net

I need to configure a SMTP server for testing my website which sends emails (for registration confirmation etc). I dont actually want the email to be sent, I just want to make sure that my code is correct. So I want to be able to check that the email is placed in a queue folder for example. Can anybody recommend a SMTP server which is...

Change Cursor HotSpot in WinForms / .NET

I'm creating a cursor at runtime from a image resource. The HotSpot of the new Cursor is always set to 16x16 (32x32 image). Is it possible to change the HotSpot at runtime or will I need to create .cur files? ...

Some suggestions on which .NET ORM to look at learning

I am a little ashamed to say that I have never used an ORM; as you may recall most of my career experience is hacking around with Classic ASP and the little .NET I do tends to be maintenance only. For my own career as well as in preparation for a new project at work (done in .NET finally!) I'm looking at adding an ORM to my skillset - b...

Trim an MP3 Programatically

What is the best way to trim a mp3 file programatically. For example, say I want to get rid of the first 2 minutes or last 2 minutes or both. Is there a good way to do this from .NET? Or .NET calling out to a command line tool? Thanks. ...

What technology are they using?

We just purchased a webcam to visually monitor some equipment remotely. Currently we are monitoring thorough the intranet only. The software that came with the webcam is installed on the computer that is physically connected to the webcam. From anywhere on the intranet, I can type that computer's address in the browser, for ex., http://1...

Load an assembly in parent folder - probing?

I'm developing a class library that uses a very simple plugin structure - to simple to start creating new appdomains for each plugin. This is the folder structure: Bin Modules Plugins.dll Main.dll Library.dll During runtime I load the types in Plugins.dll using Reflection. I would like to pass one of my own obje...

Should the LINQ context be closed every time?

Hello, In LINQ to SQL, is it necessary to close the context after performing a select on the database (and of course, after consuming the data)? if I leave it open, doesn't it mean that the connection to the server is left open? Thanks, Lucian ...

Semaphore Timeout Period

Hey guys, I've recently wiped and reinstalled/configured all the components of my web and DB servers. I'm running IIS 6, .NET 3.5, SQL Server 2005. The two servers are separate VM's in the same domain. My web app functions perfectly... 90% of the time. But every now and then I get this error or a generic runtime error: System.Data.SqlC...

Which C#/.NET blogs do you read?

What are your favourite C#, .NET and programming blogs? I'm thinking more along the lines of blogs for experienced profesionals who as well as being interested in keeping up to date with the latest developments in .NET and C# are also interested in: Agile methodologies, but particulary anything with a .NET slant Managing an SOA enviro...

DESCryptoServiceProvider .net and restricting the encrypted character set

So I'm encrypting a string using the .net DESCryptoServiceProvider Is it possible to restrict the character set of the encrypted string so that it doesnt contain specific character ranges? For example / or \? ...

Check if no user is currently logged on to Windows

I'm writing a Windows Service application which listens for connections and performs certain tasks as instructed from a different application running on another computer on the network. One of the tasks ensures no user is currently logged on, locks the workstation, delete some files, and then restarts the system. I considered using this...

Are there an alternative to System.IO.BufferedStream in C#?

I receive the follow exception: System.NotSupportedException : This stream does not support seek operations. at System.Net.Sockets.NetworkStream.Seek(Int64 offset, SeekOrigin origin) at System.IO.BufferedStream.FlushRead() at System.IO.BufferedStream.WriteByte(Byte value) The follow link show that this is a known problem for ...

Can you compile C# without using the .Net framework?

Can this be done? Is it possible to force it to pull all the of the referenced calls out of the framework and pack them into dlls or even a single executable? I like writing quick one off apps with C# however I don't want to have to install the whole framework on the target machine once its ready to go. Thanks! sweeney ...

Speed-optimise Windows Forms application

How to speed optimize WinForm applications. I am not talking about apparent .NET opt. technics - like ngen-ing, caching objects, etc. Already tried that and what I am up to is to reduce the form initilization time from a 1500 msec down to 500msec. Profiling has identified the slowest code and almost all of it is in the InitializeCompone...

How effective is obfuscation?

A different question, i.e. Best .NET obfuscation tools/strategy, asks whether obfuscation is easy to implement using tools. My question though is, is obfuscation effective? In a comment replying to this answer, someone said that "if you're worried about source theft ... obfuscation is almost trivial to a real cracker". I've looked at t...

Is there an alternative to Dictionary/SortedList that allows duplicates?

Basically I'd like to make a Dictionary work with duplicate keys without going into custom comparer implementations. There is an idea of: Dictionary<key, List<value>> but it still has some overhead. I wish Dictionary had "AllowDuplicates". ...

SQL temp table sharing accross different SQL readers

I am trying to do a many different queries on a result set which has a very large creation time. To get performance gains I wish to use a temp table and just do many queries on this temp table. Seems pretty standard. Yet I am struggling to share this temp table in dynamic sql. As I understand it, each SqlCommand object executes in its o...