[Solved] Ruby Regex – get persons name [closed]

While it’s better to use nokogiri, here is a simple regex: ▶ /(?<=\D)(\d+)\”>([^<]+)<\/a>/ =~ \ ‘<a href=”https://test/builds/browse/user/b234556″>John Doe</a>’ #⇒ 42 ▶ $~ #⇒ ⇓⇓⇓⇓⇓⇓ ⇓⇓⇓⇓⇓⇓⇓⇓ #⇒ #<MatchData “234556\”>John Doe</a>” 1:”234556″ 2:”John Doe”> To get the number and person, use: num, person = /(?<=\D)(\d+)\”>([^<]+)<\/a>/. match(‘<a href=”https://test/builds/browse/user/b234556″>John Doe</a>’). captures #⇒ [“234556”, “John Doe”] 3 solved Ruby Regex – get … Read more

[Solved] Sql injections may be possible

It is difficult to ans your query without source code, but still try this: Try binding parameters which you pass in query instead of directly passing in it. for example: $query = UserMaster::model()->findAll(’email = :email ‘, array(‘:email’ => “[email protected]”)); Here email id is binded in an array, this will prevent sql injection to much extent. … Read more

[Solved] Java equals function not working correctly [closed]

may be case is not matchingyou can try 1) if (newString.matches(aVar)){ } or 2) if (newString.equalsIgnoreCase(aVar)){ } or try with newString.trim() then compare trim() method removes spaces after and before the variable like if String s=”abc “; //space at last s.trim() will remove last space and return “abc” 3 solved Java equals function not working … Read more

[Solved] Unexpectedly found nil while unwrapping an optional value while reading JSON [closed]

Instead of guard the data parameter handle the error returned in the completion handler. If there is no error then data can be safely unwrapped. let task = session.dataTaskWithURL(shotsUrl!, completionHandler: { (data,response,error) -> Void in if error != nil { // do proper error handling } else { do { let json = try NSJSONSerialization.JSONObjectWithData(data!, … Read more

[Solved] C#: How to check all Radio Button’s on forms

Get all RadioButtons and iterate over the list to get the Checked one: foreach (RadioButton rBtn in this.Controls.OfType<RadioButton>()) { if(rBtn.Checked) { label2.Text = “Installation location:'” + rBtn.Text; break; } } 1 solved C#: How to check all Radio Button’s on forms

[Solved] How to call an Object Method in Java

public class newCharacters { Character person1 = new Character(2, 4, 3); person1.getStat(“atk”); } This should not be in a class. This does not mean anything. A class can have bunch of instance variables and methods. Please study the basics well 😉 Put it in a main method inside the Character class public static void main(String … Read more