.net

How do you run Lucene on .net?

Lucene is an excellent search engine, but the .NET version is behind the official Java release (latest stable .NET release is 2.0, but the latest Java Lucene version is 2.4, which has more features). How do you get around this? ...

How do I add a console like element to a c# winforms program

I have a program that monitors debug messages and I have tried using a TextBox and appended the messages to it but it doesn't scale very well and slows way down when the number of messages gets large. I then tried a ListBox but the scrolling was snapping to the top when appending new messages. It also doesn't allow for cut and paste lik...

Creating a TCP Client Connection with SSL

I'm trying to create a TCP connection and send/read data that uses SSL, but I haven't been able to successfully accomplish this. What I'd like to do is something like this: TcpClient _tcpClient = new TcpClient("host", 110); BinaryReader reader = new BinaryReader(new System.Net.Security.SslStream(_tcpClient.GetStream(),...

How to truncate a date in .net?

Besides the DateTime ctor (new DateTime(year, month, day)) , is there any other way to truncate a date? ...

Create a cross platform Windows, Mac OS X application

Hello, I would like to build an application that runs on both Windows and Mac OS X. I would also like it to leverage the best of what the platform it runs on has to offer with regards to Frameworks, API's etc. Is there a way to do this without having to write Objective-C code and then C# code? I've been thinking of C++ as an alternative ...

Streaming directly to a database

I'm using c#, and have an open tcpip connection receiving data. Is it possible to save the stream to an ms sql server database as I'm receiving it, instead of receiving all the data then saving it all? If the stream could be sent to the database as it's being received, you wouldn't have to keep the entire chunk of data in memory. Is t...

When is SqlConnection.RetrieveStatistics() useful?

What are the problems that calling this method can help with? Do you ever use it in debugging you data access? ...

.Net: FtpWebRequest "(503) Bad sequence of commands" error

On large files (~200+ MB), I get the 503 error when I read the stream. ftp = (FtpWebRequest)WebRequest.Create(new Uri(address.AbsoluteUri + @"/" + file.Name)); ftp.Credentials = new NetworkCredential(username, password); ftp.Method = WebRequestMethods.Ftp.DownloadFile; response = (FtpWebResponse)ftp.GetResponse(); Any clues on what I...

How can I create an ASP.NET web service that isn't hosted in IIS?

I want to create a stand-alone (i.e. not hosted in IIS) web service in ASP.NET. Is this possible, and if so what's the best way to do it? ...

Locking down valid characters in a Textbox

I need to be able to lock down the valid characters in a textbox, I presently have a regex which I can check each character against such as [A-Za-z] would lock down to just Alpha characters. protected override void OnKeyPress(KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Back) { base.OnKeyPress(e); return; } ...

Can ADO.NET Data Services use named pipes as a transport

I am well aware that the Rest based approach is targeting HTTP. I would love to use the REST APIs and other goodness between processes on the same computer. Since ADO.NET data services is built on top of WCF it would seem reasonable to assume that the transport in configurable to work with any of the WCF supported transports. Anyone k...

Why does the DoubleBuffered property default to false on a DataGridView and why is it protected?

We had a performance issue with DataGridViews where the redraw was horridly slow and found the solution Here to create a derived type and enable double buffering on the control. (Derived type is necessary since the DoubleBuffered property is protected) It doesn't seem like there's any drawback to having the DoubleBuffered property set t...

Where are some good tutorials on writing a custom LINQ Provider?

I would like to build a custom LINQ Provider. Mostly for learning purposes, but it may be usefull in the future. I've heard it's not a simple thing to do, but... Where are some good tutorials on writing a custom LINQ Provider? ...

What is the difference between IQueryable<T> and IEnumerable<T>?

What is the difference between IQueryable<T> and IEnumerable<T>? ...

VB control crashes my app

I am using this - otherwise excellent - vb tab control in one of my c# apps. When the app using it is installed on another machine, Windows tells the user in its usual friendly and descriptive manner that "The application encountered a problem and needs to close". I guess the control has some hidden vb-related dependency, but what can th...

Get a list of members of a WinNT group (C#)

There are a couple of questions similar to this on stack overflow but not quite the same. I want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a user is already a member so that I don't add the same account twice, and presumably get an e...

Use Silverlight Isolated Storage To Keep Authentication Token?

Hi, I would like to hear some opinions about using the isolated storage in Silverlight for storing sensitive data. For example, is it OK to store an authentication token (some GUID that identifies a server-side session) in this storage, or is it better to use cookies? The isolated storage gives an advantage over cookies in that it is s...

Best online reading to understand .NET Code Access Security?

I'm thinking about learning CAS, but I need to quickly grasp basic architecture, performance implications and if it at all suits my needs. What should I read? ...

How do I do a many-to-many relationship in LINQ?

I have two tables say, t1 and t2 that have t1.t1_id and t2.t2_id as primary keys. They are related by table t3 with columns t3.t1_id and t3.t2_id, respectively. Using LINQ I get an EntitySet<t3> on class t1 and t2, but what I want is an EntitySet<t2> on class t1 and EntitySet<t1> on class t2. How do I do this? ...

Anonymous method in Invoke call

Having a bit of trouble with the syntax where we want to call a delegate anonymously within a Control.Invoke. We have tried a number of different approaches, all to no avail. For example: myControl.Invoke(delegate() { MyMethod(this, new MyEventArgs(someParameter)); }); where someParameter is local to this method The above will resu...