.net

Need help with a Regex for parsing human typed times

I'm really new to Regex and working hard, but this has gone beyond simple in my opinion. I understand how to create the Regex object in .Net but I'm not sure how to use it for my specific purpose once I have a pattern. Regex regex = new Regex("(at ){0,1}[0-9]{1,2}(:[0-9]{2}){0,1}(?:[ap]m?){0,1}"); I need to be able to take a sentence...

what pattern should I use to couple .NET UI to a .NET library class that will provide callback updates

Hi, What's the best approach/pattern I should use for the following? Have a C# UI solution that will have (a) Winforms/WPF UI, and (b) class library. The UI will have to start a separate thread for the routine in the class library that will be polling The class library will then need to trigger a callback function in the UI to update ...

Help me to sort a List

Hello every one, I have a class: public class MyObject { public string Name; public int Age; } I have a List of Myobject objects: Name Age ABC 12 BBC 14 ABC 11 How to sort this list with condition: sort Name first & sort Age later. With this list, the result after sorting: Name Age ABC 11 ABC 12 BBC 14 Please help me how to do. ...

Is Enumerable.ElementAt<TSource> O(1) for HashSet?

Is the implementation in HashSet.ElementAt O(1) and if not, what is it? ...

Lock file for writing/deleting while allowing any process to read.

I am developing an application in C# (.NET), and am having trouble dealing with file locking. My main application (A) needs read/write access to a certain file. A separate application (B) needs read access to the same file. I need to prevent the user from editing or deleting the file while my application (A) is running. The applicatio...

Remove item from list based on condition

public struct stuff { public int ID; public int quan; } I want to to remove a product where ID = 1. I'm trying this currently: prods.Remove(new stuff{ prodID = 1}); and it's not working. THANKS TO ALL ...

Direct database connection vs Web Service, for MySQL+SQL eCommerce integration?

Hi, I need to integrate orders from an online eCommerce site (Linux/PHP) into a client-server system (.Net/MSSQL), as well as checking stock levels and products from the client-server side into the eCommerce site. I found these answers, but they don't satisfy me. The MySQL database is not exposed publicly, while the MSSQL database is. ...

.Net AssemblyName.version Build versus Revision

The MSDN documentation states: Version numbers consist of two to four components: major, minor, build, and revision. The major and minor components are required; the build and revision components are optional, but the build component is required if the revision component is defined. All defined components must be intege...

Help me to combine sorting & filtering on a list

Hello every one, I have a class: public class MyObject { public string Code; public string FullName; } I have a List of Myobject objects: Code FullName "ABC" "The abc company" "BBC" "The bbc company" "CPA" "The cpa company" My requirement: a matched condition is a Code or FullName contains input word. With matched records, I will s...

Entity Framework 4: Problem mapping column to complex type

I have a table with about 30+ columns, so i decided to group them using complex types. When trying to build the assembly, i get the following error: Error 3023: Problem in mapping fragments starting at line 933:Column TableName.ColumnName in table TableName must be mapped: It has no default value and is not nullable. One of my complex t...

C# SQL query exception

I'm using C# in .NET 2.0 and I'm trying to access and manipulate a database. I can read as many times from the DB as I want and everything works, but as soon as I try to insert an item I get the following error message: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed. I've tried to l...

.NET control for spellchecking html files (.NET)?

I would like to spell check html files programmatically using C#? The text only without the tags. Any recommendations? Please mention ones that strip out the tags. ...

Change Language in C#

I am developing a multilingual program in C# on Windows How to change Windows writing language on certain actions... e.g. to change from English to Arabic on focus event. Thanks ...

relation-table in dataset always returns 0 rows

I have created a strongly typed dataset in the VS 2005 Dataset Designer. There are two tables that relates to each other in a one to many relationship: Claim and ClaimDetail. The designer automatically creates a function GetClaimDetailRows which returns all ClaimDetailRows for a ClaimRow. Why is this Array's length always 0? Because Cl...

Issues with Entity Framework Self Tracking Entities and ASP MVC .NET and Managed Extensibility Framework

BIG EDIT: This problem is probably being caused by MEF! I'm using a service oriented architecture and have all my MVC controllers perform actions through the services. I have a base service that looks like this: public abstract class BaseService { protected MyObjectModel context; public BaseService() { co...

When should [assembly: InternalsVisibleTo()] be used?

I understand that the InternalVisibleTo attribute is used to expose types and methods with the internal access modifier to a specified assembly. I have only ever used this for exposing internal methods to a separate assembly containing a suite of unit tests. I am struggling to think of another scenario when this should be used. Was this...

AppFabric debug persistence activity

Hi, I created a workflow with a Persist activity inside. Hosting it into AppFabric leads to this error: An error processing the current work item has caused the workflow to abort. See the inner exception for details. InnerException Message: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activit...

How to get exact RGB values for 24-bit image in .NET Compact Framework?

Hello, I have a 24 bit BMP image, but when I load it on my Pocket PC using Bitmap object and do GetPixel, it returns me slightly wrong RGB values. I guess it converts it to 16 bit on the fly. I get the same results when using LockBits and working with the bitmap data directly. Is there any way of getting exact RGB values for given pixel...

Quick check of all sub items in a List

I have a list with a boolean value as one of the properties. I need to check if every one of these is true. Now normally LINQ would give a nice clean answer here, but as I am using .NET 2.0 I can't use that. If there a nicer way to do this or am I going to have to do a for each loop and break out on finding a false? Edit: Seems I cou...

How to add parameters into a WebRequest?

I need to call a method from a webservice, so I've written this code: private string urlPath = "http://xxx.xxx.xxx/manager/"; string request = urlPath + "index.php/org/get_org_form"; WebRequest webRequest = WebRequest.Create(request); webRequest.Method = "POST"; webRequest...