.net

Automatic updating of C# programs

I'm writing a suite of programs for client PCs -- a Windows Service a user-space Windows Forms application I need to be able to publish an updated version of these programs and have the client PCs automatically and transparently (with no user interaction) update themselves. This update will be done over an unreliable 3G connection (E...

C# - what is wrong with the code (generics, static method etc)

I'm getting a "cannot convert from 'int' to 'TValue'" in the following code. How can I fix this? I understand why there is an issue, but I'm wonder the best way around this. Do I need to make a decision to specific type the ReturnValuesDict, and not leave it generic? public class ReturnValuesDict<TKey, TValue> : CloneableDictionary<T...

Problem with DataGridView.RowValidating

I'm trying to link a DataGridView to a data table in a database. I want the DataGridView to update the data table automatically (without having to click "Save" or anything like that). Seems to me that the best way to do this is by handling the RowValidating event. I've been testing this code and this is my problem: let's say I add row #1...

How to implement bi-directional classes ?

I've got two classes : Unit and User. a Unit class has a User as leader, and a User can be part of many units. class Unit { User Leader; public void SetLeader(User leader) { this.Leader=leader; } } class User { Unit UnitLed; public void LeadUnit(Unit unit) { this.UnitLed=unit; unit.SetLeader(this...

Best asp.net WCF application design

I am working with a financial application and am looking for the best solution for designing my application. We have 100's of stored procedures where most/all of our business logic sits. We have WCF web services projects built using Web Service Software Factory (http://servicefactory.codeplex.com/). We have stored procedures built for...

Articles/Links on Asp.Net pipeline and internal request processing architecture

I am looking details on the internal working of asp.net architecture. The topics need to include the following: Asp.Net Thread/Application Pools HttpRuntime HttpApplication - When and how it is set up How HttpContext is set up How objects can passed along the pipeline using HttpContext.Current.Items Why does modification of static va...

Better way to download mysql table using C#?

I currently use the code below but its not uncommon for it to throw an "tried to read past the stream" error once the mysql table has reached over 20 thousand entries. MySqlConnection connection = new MySqlConnection(MyConString); MySqlCommand command = connection.CreateCommand(); connection.Open(); c...

Schedule a Microsoft Dynamics CRM 4.0 Workflow

I am in the process of puting together a custom workflow activity to be used in Microsoft Dynamics CRM 4.0 What I would like to ultimatly acheive is configure a workflow that runs on a schedueled basis i.e run every 2 hours Monday to Friday, rather than on a particular "CRM event" like create, delete status change ect. Does anyone ha...

LINQ Query on ConcurrentDictionary of 19710 items slow

Hi All I have the following method: /// <summary> /// Calculates the last trade date. /// </summary> /// <param name="tradesDictionary">The trades dictionary.</param> /// <returns>The last trade date.</returns> public DateTime CalculateLastTradeDate(ConcurrentDictionary<Guid, TradeRecord> tradesDictionary) {...

How do I define custom datatype in xsd?

Hello. I want to check if a field in my XML is of type positive double/decimal. There is a type="xs:positiveInteger" datatype in XSD but no positive double or decimal. Is there a way to achieve this either by defining custom datatype or some other way? ...

Download the first 1000 bytes

I need to download a text file from the internet using C#. The file size can be quite large and the information I need is always within the first 1000 bytes. Is this possible? ...

Question about Code Access Security (CAS).

Hi guys, I am studying the Code Access Security of .NET 2.0. My current understanding is as below: The basic mechanism of the CAS is for the CLR to collect certain evidences from the assembly, and then use the evidence and policy to work out a permission set for the assembly's code. And the assembly's code can do nothing beyond that pe...

Problem in conversion from number to char

Hi i want to convert following number to character equivalent but without using any special character. Please Help me. Thank you very much 32545352515049515448524848495270484848484870706670666970 ...

Hide Console Window in C# Console Application

The thing is, i really dont want the console window to show up...but the solution should be running. My point here is, I want to keep the application running in the background, without any window coming up. ...

Log4Net: How to add simple indexer (row number) to each log line

Here is the problem: I want to add row indexer (row number or iterator) to each row in log file. I don't need it to be unique for the whole log file, but only for the "application session" (i. e. each time Win32 application started, we begin our countdown: 1, 2, 3 and so on) Is where any built-in way (conversionpattern tag syntax) or so...

Are there any free CRC libraries that covers a lot of the CRC algorithms?

Been searching for a free reliable CRC library. I've tried rolling my own from the wikipedia algorithms posted but I read from some other sources that I have to take some other things like performance, endian, etc. into account. I don't think I have the time to explore every small thing. Can you recommend any libraries? Also this is i...

What's the name of the highlight when you select "Get" and "Return" and "End Get" are highlighted?

Hi, Sorry for the lame question, but I can't think of a decent way to ask. When I have certain text selected, Visual Studio highlights certain other related text. If my caret is within "Get", the "Return" and "End Get" lines are highlighted. If I put the caret within the name of an instance, all references to it are highlighted. "If" h...

Why lock is needed to implement a readonly int property?

I'm new to threading and I came accross a custom thread pool implementation example in a blog. I'm pasting just the necessary parts of the code: Public Class ThreadPool Private CountLock As New Object Private _Count As Integer Public ReadOnly Property ThreadCount() As Integer Get SyncLock CountLock ...

wpf scrollbar lineDown method

Hi Is there any way to slow down a bit scrolling ? I have a canvas where I put some controls witch I can move. If control reaches current maxWidth of canvas I use method called LineDown to scroll my canvas. However the scrolling is very fast. Is there any way to slow it down a bit ? Maybe I can set some property wich 'tell' scrollviewer ...

webservice for Daylight Saving

Hi All, I am looking for a web service that accepts a (date, Latitude Degrees, and Longitude Degrees) for a certain City,and returns if Daylight Saving is on for that city in the given date or not. any help please? thanks, ...