[Solved] C# how to check if a string contains 3 times the same letters in a row [closed]

Sometimes (rarely) regexes are the response to the question, especially if the question is like this. bool ism1 = Regex.IsMatch(“AABAC”, @”(.)\1\1″); // false bool ism2 = Regex.IsMatch(“AAABC”, @”(.)\1\1″); // true Matches any character (.) followed by the first match (\1) twice. 0 solved C# how to check if a string contains 3 times the same … Read more

[Solved] Read content from the xml file in C#

Use xml linq like code below : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; namespace ConsoleApplication58 { class Program { const string FILENAME = @”C:\TEMP\TEST.XML”; static void Main(string[] args) { XDocument doc = XDocument.Load(FILENAME); List<KeyValuePair<string, string>> names = doc.Descendants(“Employee”) .Select(x => new KeyValuePair<string, string>((string)x.Element(“FirstName”), (string)x.Element(“LastName”))) .ToList(); } } } solved … Read more

[Solved] C++ copying char to a char array (Debug assertion failed) says string is not null terminated

strcat() (which is a “less-safe” version of strcat_s()) requires both strings to be null-terminated. That’s because strcat() appends its second parameter (source) where first parameter (dest) ends. It replaces null-terminator of dest with first character of source, appends rest of source and then a null-character is included at the end of the new string formed … Read more

[Solved] C++ fstream getline parameters

If you mean std::basic_stream::getline(), you provide a pointer to character array and the size of that array. You have to create the array somewhere by yourself. If some line is longer than sz – 1, only part of it with length sz – 1 will be read. If you don’t know the maximum length of … Read more

[Solved] C++ pow(400,-9) is giving wrong answer [closed]

calculator output of 4E-7 You entered the wrong calculation into your calculator. You entered 400×10-9, instead of 400-9.These are absolutely not the same thing! The C++ program is correct: pow(400, -9) calculates 400-9, which is approximately 3.815×10-24. Here is some further reading for you: http://en.wikipedia.org/wiki/Scientific_notation#E_notation 7 solved C++ pow(400,-9) is giving wrong answer [closed]

[Solved] How to return a string from a method?

Your return type is void, not string. Change it to: private string SQLSelection() A void is a “returnless” action that is performed upon something and does not “return” back the values of the return statement. If you try to return a value, you get a compiler error as you are experiencing. In addition, you keep … Read more

[Solved] Asp.net button avoid pageload onclick

The framework fundamentally does not work that way. If you stay true to the framework, you can wrap your button in an update panel. That will remove the visible postback, but that will still fire the postback and perform the page load and click event. In essence the update panel will dump your entire page … Read more

[Solved] Port reading application in .Net which is better Windows service or Windows application

Yes, a windows service would be fine. I’d like to use a little library called TopShelve to make a service / console app. Then I’d add NancyFx to expose the service and it’s data (or read it from a shared database). You also asked if there was a ‘better’ way. You might argue that polling … Read more