[Solved] Python Regular Expression from File

This will return the elements you want: import re s=””‘journey (a,b) from station south chennai to station punjab chandigarh journey (c,d) from station jammu katra to city punjab chandigarh journey (e) from station journey (c,d) from station ANYSTRING jammu katra to ANYSTRING city punjab chandigarh ”’ matches_single = re.findall(‘journey (\([^,]+,[^,]+\)) from (\S+ \S+\s{0,1}\S*) to (\S+ … Read more

[Solved] php value display [closed]

try adding >= insead of just = if ( $valuecredits >= “10” ) { echo “<img src=”https://stackoverflow.com/questions/8290601/pbar/100.png” width=”700″ height=”61″ />”; } 1 solved php value display [closed]

[Solved] is it possible that when recyclerview load items just load one time and dont reload scrolling?

You can absolutely do that. Load all the data (through a web service call or by any other means). When data are retrieved, set them to the RecyclerView‘s adapter and call notifyDatasetChanged()). Use the RecyclerView normally (i.e. binding data objects to the views in onBindViewHolder(). This way you will get what you want (having all … Read more

[Solved] This just bugs me [closed]

Because for-loop needs 3 parameters. If you just give 2 parameters with 3rd parameter not being given, compiler expects the loop variant parameter there. Usually – for(iteration variable; condition; increment/decrement ) for(;condition;increment/decrement ){} for(iteration variable;;increment/decrement) {} for(;;increment/decrement) {} … 1 solved This just bugs me [closed]

[Solved] Parsing xml in string [duplicate]

I’d use LINQ to XML, with a helper method: var movies = from element in XDocument.Parse(xml).Descendants(“Movie”) select new Class1 { Id = (int) element.Attribute(“ID”), Subject = (string) element.Element(“Name”), OtherName = (string) element.Element(“OtherName”), Duration = (int) element.Element(“Duration”) .Attribute(“Duration”), Property1 = (string) element.Element(“Properties”) .Elements(“Property”) .Where(x => (string) x.Attribute(“Name”) == “Property1”) .Single(), Property2 = (string) element.Element(“Properties”) .Elements(“Property”) .Where(x … Read more

[Solved] C++: Using for loop I need to take infinite values of a point using arrays. How can I take values of point [ ] until 2 points of are equal

To test if two consecutive numbers are equal, you dont need 100 elements, you need 2: int points[2], counter = 1; // Read in first point: cin >> points[0]; // Read until we meet our condition: do { // Read a point into the next part of the array. cin >> points[counter]; // toggle counter … Read more

[Solved] C++ append to existing file [duplicate]

You can’t. Files don’t really have lines, they just store a bunch of characters/binary data. When you have 1,2,3,4,5 6,7,8,9,0 It only looks that was because there is an invisible character in there that tells it to write the second line to the second line. The actual data in the file is 1,2,3,4,5\n6,7,8,9,0 So you … Read more

[Solved] Defining and adding values to arrays inside an array in VBA Excel

Based on the description you’ve given, follow my suggestion. Please, give us your feedback. Private Function AmazingFunction(inputArray As Variant) Dim size As Long Dim i As Long Dim tmp As Variant Dim newArray() As Variant size = UBound(inputArray) ‘ Array size ReDim newArray(size) ‘ Resizes another array to the same size For i = 0 … Read more

[Solved] Generating list in a following format [closed]

Something like this would work var results = from x in context.Tests group x by new { x.DeptId, x.StudentId, x.TeacherId } into grp select new { grp.Key.DeptId, grp.Key.StudentId, grp.Key.TeacherId, A = grp.FirstOrDefault(x => x.TestName == “A”)?.TestValue, B = grp.FirstOrDefault(x => x.TestName == “B”)?.TestValue }; This requires C# 6 for the null-conditional operator ?., but you … Read more

[Solved] Vigenere Cipher logic error

There are several problems with your code: You’re error checking isn’t correct. You check if(argc!=2||!apha) after you’ve already evaluated strlen(argv[1]) — by then it’s too late! Check the validity of argc before accessing argv and don’t double up the argument count error and alphabetic key error, they’re independent. Also, error messages should go to stderr, … Read more

[Solved] Finding repeated lines in Python [duplicate]

I assume you have read in the lines and stored them in an array lines Then, set(lines) gives you a set that contains all unique lines. If every line is unique the length of lines and set(lines) will be the same. Ergo: if len(lines) == len(set(lines)): print ‘all lines are unique’ else: print ‘not all … Read more

[Solved] Parse error: syntax error, unexpected T_IF, expecting ‘)’ What should I do? [duplicate]

try this, get role value outside array $role = “”; $option = $_GET[‘I-would-like’]; $option = trim($option); if ($option == ‘A quotation’ || $option == ‘Information’) { $role=”customer”; } else if($option == ‘To become a Partner’) { $role=”partners”; } else if ($option == ‘Training / Coaching’) { $role=”students”; } $userdata = array( ‘user_login’ => $username, ‘user_pass’ … Read more