[Solved] interesting problem with map [closed]

Actually it does not found the node by “aaa” nor “ccc”, it founds the node by the memory address a points to. Comparison between pointers does just that, it does not perform a string comparison. If you want to index by a string, then use an std::string. 2 solved interesting problem with map [closed]

[Solved] SQL query to linq to SQL query

Use OrderBy for the ordering, and First or possibly FirstOrDefault for the equivalent of TOP 1: var session = db.Sessions.OrderBy(x => x.StartTime).FirstOrDefault(); if (session != null) { // Use the session } else { // There weren’t any sessions } You could use a query expression for the first part, but it seems pretty pointless … Read more

[Solved] how to copy a folder contained in my project to anothe location when i am installing project

I have specified the Build action on my .rdlc file as Embedded Resource and then it is referenced like this in the code: this.reportViewerScraps.LocalReport.ReportEmbeddedResource = “Backa_Artiklar_2.ScrapReportDocument.rdlc”; EDIT: Added info according to askers comment I have the rdlc file here in the Solution Explorer: Change your line of code to: reportViewer1.LocalReport.ReportEmbeddedResource = “<namespace>.Manufacturer.rdlc”; Remember to change … Read more

[Solved] Novice C++ project using loops, if else and switch [closed]

This’ll work. Please cross-check output for different inputs for coz haven’t had the time to do so. #include<iostream> using namespace std; int main (){ int units; double priceA,priceB,priceC; char package, goAgain; do { cout << “Enter the Package chosen. Enter ‘A’ or ‘a’ for package A.\n”; cout << “Enter ‘b’ or ‘B’ for package B.\n”; … Read more

[Solved] Dynamic textbox validation [closed]

Assuming cmbRateChart.SelectedValue contains qty value with respect to RangeChart. private void textBox_Validating(object sender, CancelEventArgs e) { bool cancel = false; int number = -1; if (int.TryParse(this.textBox.Text, out number)) { var validRange = Convert.ToInt32(cmbRateChart.SelectedValue) * 6; if (number <= validRange) cancel = false; //passed validation. else cancel = true; //failed validation, number is not in valid … Read more

[Solved] C++: virtual functions with multiple derivations

You’re right, C::fn() is called when my example is ran alone. My problem actually was that I was dynamically loading this class (C) with ros:pluginlib (http://ros.org/wiki/pluginlib) so the multiple inheritance issue is probably coming from there. That’s a completly different issue I’ll have to look into. solved C++: virtual functions with multiple derivations

[Solved] std::map operation by value or pointer? [closed]

Will that cause memory leak ? There are no memory leak in your program, but a compilation error, since there are no operator[] defined for struct B. Assuming you add to map here: while(true) { A a; a[0] = 0; b[inx] = a; ++inx; } there are no memory leaks. The memory will increase until … Read more

[Solved] Read Json using C# [closed]

Your json is broken and many json parser would complain about it. I’ll use Json.Net for parsing. string json = @”{data: { “”1000″”: { “”country-id””: 1000, “”name1″”: { “”name””: “”Afghanistan””, }, }, “”4000″”: { “”country-id””: 4000, “”name1″”: { “”name””: “”Albania””, } }”; var countries = ((JObject)JsonConvert.DeserializeObject(json))[“data”] .Children() .Select(x => new { Id = (int)x.First()[“country-id”], Name … Read more

[Solved] Why null is returned?

This shouldn’t be the case. from wp in context.WorkPanels select wp; is equivalent to context.WorkPanels.Select(wp => wp);. The MS implementations of Select (Enumerable.Select / Queryable.Select) never return null. There must be something else wrong somewhere else. 4 solved Why null is returned?

[Solved] Get text between 2 same symbols [closed]

You are on the right track. Use the overload of IndexOf that takes a start index when you look for the second character: int first = picture.IndexOf(‘_’); int second = picture.IndexOf(‘_’, first + 1); string part = picture.Substring(first + 1, second – first – 1); solved Get text between 2 same symbols [closed]

[Solved] What is the use of multiple classes

Reason 1 To make the code easier to understand. (Don’t underestimate how important easy to understand code is) Imagine this: class Student { public string First { get; set; } public string Last {get; set;} public int ID { get; set; } public string Street { get; set; } public string City { get; set; … Read more

[Solved] Can’t use void() [closed]

Try :- if (stringInput == “attack ennemy”) { cout << endl << “You dealt 100 attack points to: ENNEMY” << endl; ennemyHealthPoints = ennemyHealthPoints – attackPoints; **displayEnnemyStatus(ennemyAttackPoints, ennemyHealthPoints)**; } Instead of :- if (stringInput = attack ennemy) { cout << endl << “You dealt 100 attack points to: ENNEMY” << endl; ennemyHealthPoints = ennemyHealthPoints – … Read more