.net

Why cant the compiler infer that a large number is a long?

This compiles var fourGb = (long)4*1024*1024*1024; But this fails var fourGb = 4*1024*1024*1024; With "The operation overflows at compile time in checked mode". So if the compiler knows this will be an overflow why cant it infer that the variable type should be a long? ...

Is my use of ConcurrentQueue here between 2 threads ok?

Hi, Is my use of ConcurrentQueue here between 2 threads ok? I wanted to check I don't need to "lock" anywhere explicitly. In particular look at the lines where I have in COMMENTS would I drop a packet here... public class PacketCapturer { private static ConcurrentQueue<Packet> _packetQueue = new ConcurrentQueue<Packet>(); public Pa...

Problem with Environment.StackTrace

On a thread that is processing new data in the system, if the data is invalid I write a message in the event log, containing the Environment.StackTrace information. Writing in the event log throws an exception with no text message Message: CallStack - at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at ...

DateTime parsing issue.

I am trying to parse this datetime, but it always return false. DateTime.TryParseExact("07/01/2007 12:15", "mm/dd/yyyy HH:mm", new CultureInfo("en-US"), DateTimeStyles.None, out met) ...

C# timer that fires every X seconds, but stays in synch with real time (i.e. with no drift)

Is there a .NET Timer available in C# that can ensure there is no "drift" in between events? That is, if you set the timer to go off every X seconds, that after days of operating it won't drift, i.e. to ensure that approach number of X seconds events in a day remains in synch with what it should be? If not, is there a well known code ex...

Object Serialization on different platform

Hi guys I'm creating a very simple socket server that lets its clients save its own object state based on Keys by sending it over the wire. I'm using a very simple protocol encoding the serialized object to base64 string and will be sent out as part of my custom xml format. I wanted to know if the serialization will still be the same if ...

inserting a floating point value with a culture where comma (,) is used for "floating point"

I have something like this: foo { a = 1, b = 2, c = 98,3 } I generate the insert query dynamically so end up with this: insert foos(a,b,c) (1, 2, 98,3) anybody knows how to workaround this ? ...

The execution time of my threaded code does not benefit from threads with Join

I'm creating three threads in one of my application. The requirement I have is that the method that creates these three threads and starts them off should not return unless all these three threads are executed. I tried to use Join on all three threads. However, I observe that when I use Join the total execution time of my method is the ...

How to set the min/max distance for the Splitter control?

I want to set the minimum and maximum distance for the splitterdistance to move around... how to set that... i tried using panelMinSize it didnt worked... Actually in one of the panel of the splitter i have a control and the splitter should adjust based on the control.. ...

Send document with default e-mail client

For example, when you click a link in your web browser, it automatically opens default e-mail client installed on your PC and fills that e-mail address in. I need to perform similar operation, but with file attachment. It will look like "Send file with default e-mail client" option in the software interface. Is there any API available f...

Java equivalent of .NET's System.Xml.Schema classes?

The .NET Framework exposes a rather useful set of classes as part of the System.Xml.Schema namespace. Among other things, classes such as XmlSchema and XmlSchemaElement provide a useful API for defining/writing and parsing/reading/traversing XML schema files. Does an equivalent library exist for Java? ...

How to integrate NSIS with a build system and supporting versioning

I have a nsis script to create an installer package of a tool in .NET, and works fine. The problem is that I want to integrate it in my build system (currently using NANT, but migrating to rake using ironruby) The version for the product is stored in a txt file which is read to generate the assemblyinfo, currently the build system au...

Expiration date NET 4 Beta 1

I have 25 days left to use VS2010 Beta 1. Will I still be able to use an application made in this version after that or is there an expiration date of the framwork itself? And yes I am upgrading but for different reasons I need to use this application a couple of months more. Anyone knows? Edit: The application needs to run in Beta 1 ie...

.NET Error Reporting Framework Client/Server?

Anyone knows of one? Preferred open source? Basically some framework that I can hook up that collects error information, forwards it to a central location via web service including collecting crash dump information (exception stak trace, but possibly some other files on the machine per my extension) and does some statistical analysis + ...

ASP.NET MVC2 and clean URLs for GET requests

...

MCImageManager installation for .NET

Just bought MCImageManager for .NET yesterday. Followed the installation instructions to the letter. Now my .NET 4.0 VB VS2010 web project won't build. Full details at http://tinymce.moxiecode.com/punbb/viewtopic.php?id=22436. What I need is "proper" installation instructions. It doesn't seem right that you have multiple copies of dll'...

Scalable freetext & parametric searching (C#)

Hey, Currently, we've got an application that needs to perform very fast searches on ~2 mill records. Searches need to search both a large free-text field, and a number of integer/decimal fields between different ranges, along with various functions/computations & sorting. Currently, we're handling this with a big MSSQL database, usin...

What is Extension method and Why do we need to use it?

Possible Duplicate: What are Extension Methods? Hi, After googlin got to know a bit about Extension methods but not very clear why we need to use extension methods and how does it work? Please suggest. Thanks, Subhen ...

Convert JSON string into "complicated" class?

I have this JSON string: { "success":true,"user_id":"309","id":"309","sessId":false,"email":null,"name":"Mai Van Quan","username":"quanmv","role":"Reseller Admin","messages":"","org_name":null,"microPayNumber":"4949","microPayWord":"neocam","mobile":null,"permissions":{"ADD_CAMERA":true, "REMOVE_CAMERA":true, "EDIT_CAM_GENERAL"...

Automatic join with NHibernate / Many-to-one / HQL

Hello everyone, I'm working on a .NET C# project on which I had to use NHibernate Mapping Attributes to map my objects to my tables in my database. Now let's explain what my problem is. I have two mapped classes, for example ClassA and ClassB. In my database, table A contains a foreign key referencing the primary key of table B. Hence...