[Solved] How to set path of a text file created by an visual studio 2010 application?

[ad_1] The folder where the executable resides is: string executableLocation = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location); And so you want to save your file to: System.IO.Path.Combine(executableLocation, “myfile.txt”); 3 [ad_2] solved How to set path of a text file created by an visual studio 2010 application?

[Solved] Automatically changes code through out the application at many places

[ad_1] Below code will do the needfull. var replaces = new Dictionary<string, string>() { { “A”, “B” }, { “C”, “D” }, {“E”,”F”} }; var files = Directory.GetFiles(@”C:\Folder\”, “*.txt”,SearchOption.AllDirectories); foreach (var file in files) { var text = File.ReadAllText(file); foreach (KeyValuePair<string, string> ky in replaces) { text = text.Replace(ky.Key.ToString(), ky.Value.ToString()); } string [] splittedpath = … Read more

[Solved] Syntax for arrays as operands

[ad_1] In C++, if you have a C++11 capable compiler and you use std::vector instead of raw arrays, you could use initializer lists: void kilos(const std::vector<int> percentage, const std::vector<std::string> liquid); // … kilos({40, 60}, {“water”, “milk”}); [ad_2] solved Syntax for arrays as operands

[Solved] Programming tests [closed]

[ad_1] your answer is that you should try your self more! But some goods: the ACM site: http://icpc.baylor.eduhttp://acm.uva.es/contest/http://www.codeforces.comhttp://code.google.com/codejam/ and alsohttp://www0.us.ioccc.org/index.htmlhttp://www.mycplus.com/featured-articles/programming-contests-and-challenges/ [ad_2] solved Programming tests [closed]

[Solved] How to insert a variable in a query in asp.net c#? [closed]

[ad_1] Your method is open to SQL Injection. You should try this: protected void Button1_Click(object sender, EventArgs e) { string email = Request.QueryString[“Email”]; cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = “INSERT INTO Job (Industry, JobPosition, ExactAddress, Region, Salary, JobDesc, EmployerID) VALUES (@industry, @jobPosition, @exactAddress, @region, @salary, @jobDesc, (Select employerid from employer where email = … Read more

[Solved] Regex pattern for file extraction via url?

[ad_1] Regex for this is overkill. It’s too heavy, and considering the format of the string will always be the same, you’re going to find it easier to debug and maintain using splitting and substrings. class Program { static void Main(string[] args) { String s = “<A HREF=\”/data/client/Action.log\”>Action.log</A><br> 6/8/2015 3:45 PM “; String[] t = … Read more

[Solved] Another coredump issue in C

[ad_1] I would think you would need to add check on your externally accepted values (using assert might be a start) Like : checking tm>0 ler>0 C[i]<tm A[i]!=NULL B[i]!=NULL As mentionned in the comment it an off by one issue : in LER the values should be from 0 to tm-1 or use B[i][j]=C[k]-1; at … Read more

[Solved] C# Add nodes in xml

[ad_1] This projects both sets into an anonymous object List, makes comparisons, and gives you a set of anonymous objects that don’t yet exist by which you can add to the out XML. public static List<object> GetInStudents(XDocument sourceXmlDoc) { IEnumerable<XElement> inStudentsElements = sourceXmlDoc.Root.Elements(“Classes”).Descendants(“Class”) .Descendants(“Students”).Descendants(“Student”); return inStudentsElements.Select(i => new { Id = i.Elements().First().Value, Name = i.Elements().Last().Value … Read more

[Solved] Postfix notation stack C++ [closed]

[ad_1] Using stack.top() is illegal if the stack is empty. Change while((!highPrecedence(stack.top(),c)) && (stack.size()!=0)){ to while((!stack.empty()) && (!highPrecedence(stack.top(),c))){ The initiali value of i is not good and you are printing uninitialized variable, which has indeterminate value. Change int i=0; to int i=-1; 1 [ad_2] solved Postfix notation stack C++ [closed]

[Solved] Converting a code from c++ 11 to c++ 98?

[ad_1] Convert the range-based for to loops using iterator Stop using auto and write the type manually code: #include <iostream> #include <map> #include <string> int main() { std::string input = “slowly”; std::map<char, int> occurrences; for (std::string::iterator character = input.begin(); character != input.end(); character++) { occurrences[*character] += 1; } for (std::map<char, int>::iterator entry = occurrences.begin(); entry … Read more