.net

log4net versus TraceSource

In this thread many people have indicated that they use log4net. I am a fan of TraceSources and would like to know why log4net is used. Here is why I like trace sources: Pluggable listeners - XML, TextFile, Console, EventLog, roll your own Customisable trace switches (error, warning, info, verbose, start, end, custom) Customisable co...

Is "Dying is Awesome" preferred?

Recently I attended Jeffrey Richter's training courses about .NET. He mentions one strategy of coding "Dying is awesome". That is, don't write "catch (Exception ex)" even at the root of program or event loop. If some exception thrown that is not handled, just let the process die. I'm not sure this is right. Personally, I prefer to have...

connecting remote mysql database using c#.net

i am developing c# windows application.In that i want to connect to mysql database which resides in another system.please help me to solve this? thank you in advance ...

Error (2147024894) while opening .Net (C#) COM application into VB

Hi All, I am developing plug in application for a third party software (They using COM technology to launch the plug in applications to their Software).I am using .Net(C#) for application development. The third party software was developed by VB. When i am trying to launch my plug in application to Third party software i am getting follo...

Get timezone from DateTime

Does the .Net DateTime contain information about time zone where it was created? I have a library parsing DateTime from a format that has "+zz" at the end, and while it parses correctly and adjusts a local time, I need to get what the specific time zone was from the DateTime object. Is this possible at all? All I can see is DateTime....

What is the use of a static class

Hi All, What is the use of a static class? I mean what are benefits of using static class and how CLR deals with static classes? ...

How to avoid Winforms radio button container auto grouping

The background In .Net windows forms (2.0) radio buttons are automatically grouped by their container control, whether it is a Form, Panel or GroupBox. That means that when you select one radio button, every other radio button in the same container is automatically changed to unchecked state. Now, consider the following form layout: ...

[c#] The name 'loginrand' does not exist in the current context

hi every one , i just try to create bot for travian , i find some login code //download html WebClient client = new WebClient(); client.Encoding = System.Text.Encoding.UTF8; string source = client.DownloadString(@"Http://" + server + "/login.php"); source = source.Replace("\"", ""); //s...

Enterprise Services Alternative

Are there any alternatives to Serviced Components (COM+) in .NET? I am looking for an on-demand (not always-running like Windows Service) manageable components to be hosted by the OS and be accessible locally (no requirement for remote connections). ...

C# Parsing a webpage's source

Among the wall of text that is a pages source; I need to get the video_id,l and t without the quotes so for a section like this. "video_id": "lUoiKMxSUCw", "l": 105, "sk": "-2fL6AANk__E49CRzF6_Q8F7yBPWdb9QR", "fmt_map": "35/640000/9/0/115,34/0/9/0/115,5/0/7/0/0", "t": "vjVQa1PpcFMbYtdhqxUip5Vtm856lwh7lXZ6lH6nZAg=", i need the following...

When should I remove a UserControl from the message filter?

I'm implementing a UserControl which implements IMessageFilter. It calls Application.AddMessageFilter in its constructor. I'd like to remove it from the message filter in its Dispose(bool disposing) method, but I don't know whether to place the call to Application.RemoveMessageFilter inside the test (so it gets called when disposing is...

How deep does the Control.Contains method search?

I need to check whether a control is a descendant of another control. Will Control.Contains do the job, or does that only search for first-level child controls? ...

I only want to match the start tags in regex

I am making a regex expression in which I only want to match wrong tags like: <p> *some text here, some other tags may be here as well but no ending 'p' tag* </p> <P>Affectionately Inscribed </P><P>TO </P><P>HENRY BULLAR, </P><P>(of the western circuit)<P>PREFACE</P> In the above same text I want to get the result as <P>(of the west...

i want to match only start tags in regex

i am making a regex expression in which i want to only match wrong tags like <p> *some text here, some other tags may be here as well but no ending 'p' tag* </p> <P>Affectionately Inscribed </P><P>TO </P><P>HENRY BULLAR, </P><P>(of the western circuit)<P>PREFACE</P> like in the above same text i want to get the result as <P>(of th...

How do commercial obfuscators achieve to crash .net Reflector and ILDASM ?

Some commercial obfuscators claim they can crash ILDASM (and other similar tools such as Reflector) Any idea on how they achieve that? As stated in numerous threads here, someone with enough motivation/time/skill will always find a way to read your code (aka if it's runnable, it's decompilable), but it seems to me that most casual code...

How can I find the state of NumLock, CapsLock and ScrollLock in .net ?

How can I find the state of NumLock, CapsLock and ScrollLock keys in .net ? ...

c# equivalent to php associative array?

hi ive decided to learn c# recently. ive done some php before. i see c# has dictionaries. thats equivalent to an associative array in php right? as far as i can tell the dictionary doesnt maintain insertion order like php associative arrays right? is there some other equivalent i should use if insertion order is important? thanks ...

Agile Documentation Frameworks (NTestDox?)

I was reading this blog post: http://www.shakie.co.uk/ramblings/feature-driven-development-riding-the-waves-of-change/ and came across the part about TestDox: Direct quote (hence PHP): Take the following test case as an example class InvoiceTest extends PHPUnit_Framework_TestCase { public function testValueIsInitiallyZero() ...

Using Timer with For Loop to Halt Execution

for(int i=0; i<mylist.items.count; i++) { if(i==myvalue[i]) { //call Timer! Wait timer interval if timer is tick, continue for loop! } timer_click() { // application } } How can I use the for loop with timer to pause execution if the value in the conditional is a certain value? ...

Pair-wise iteration in C# or sliding window enumerator

If I have an IEnumerable like: string[] items = new string[] { "a", "b", "c", "d" }; I would like to loop thru all the pairs of consecutive items (sliding window of size 2). Which would be ("a","b"), ("b", "c"), ("c", "d") My solution was is this public static IEnumerable<Pair<T, T>> Pairs(IEnumerable<T> enumerable) { ...