[Solved] Displaying error message “Email not valid” but still saving to database file

Because all of your code is outside of your if block. So it’s going to execute every time, regardless of the condition. Put the code in the if block: Regex regMail = new Regex(@”^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$”); if (regMail.IsMatch(mailID.Text)) { Email email = new Email(); string emailAdd = mailID.Text; string phone = phoneBox.Text; string messageEmail = email.Text; System.IO.StreamWriter … Read more

[Solved] Why isEmpty not working here ?

A struct with two generic placeholder types ≠ dictionary. If you need a dictionary, then create an instance of a dictionary like so: var dictionaryInstance = [Int: String]() isEmpty works now: print(dictionaryInstance.isEmpty) // true You can also create a typealias: typealias MyDictionary = [Int: String] var myDictionaryInstance = MyDictionary() 2 solved Why isEmpty not working … Read more

[Solved] Java and Arrays

Perhaps this is what you are looking for import java.util.Scanner; class A{ public static int []PriorGreen = new int[6]; public static int []AfterGreen = new int[6]; public static String []month = {“Jan”,”Feb”,”Mar”,”April”,”May”,”June”}; static void PriorG() { System.out.println(” Enter Cost for Prior Green Month’s Below !!!”); Scanner in = new Scanner(System.in); for(int i=0;i<6;i++){ System.out.println(” Please enter … Read more

[Solved] json object value to select dropdown update using jquery

Further @Rory McCrossan comment, A. You need tun each on the dropDownField.roles not on dropDownField. B. You can “collect” the html for each item in the array, then append it to the select. var roles = { “roles”: [{ “role_id”: 2, “role_name”: “admin” }, { “role_id”: 4, “role_name”: “QA” }, { “role_id”: 3, “role_name”: “TL” … Read more

[Solved] Check if row in table is ‘equal’ to other row

Try this: <?php if (!empty($_POST)) { $code = $_POST[‘code’]; mysql_connect(“$dbhost”,”$dbuser”,”$dbpass”); mysql_select_db(“$dbname”); $result = mysql_query(“SELECT * FROM files WHERE id=” . $code . ” LIMIT 1″); if (mysql_num_rows($result) > 0) { while($rows = mysql_fetch_array($result)) { echo ‘Exists’; $url = $rows[‘url’]; } } else { echo ‘Does not exist’; } } ?> 11 solved Check if row … Read more

[Solved] How to measure user distance from wall

In the comments, you shared a link to a video: http://youtube.com/watch?v=PBpRZWmPyKo. That app is not doing anything particularly sophisticated with the camera, but rather appears to be calculate distances using basic trigonometry, and it accomplishes this by constraining the business problem in several critical ways: First, the app requires the user to specify the height … Read more

[Solved] python script from youtube video doesn’t work

I am pretty sure this is all the code needed for the video, It might help as a reference. import urllib import webbrowser import time from xml.etree.ElementTree import parse u = urllib.urlopen(“http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22”) data = u.read() with open(“rt22.xml”, “wb”) as f: f.write(data) f.close() office_lat = 41.980262 doc = parse(“rt22.xml”) def distance(lat1, lat2): ‘Return approx miles between … Read more

[Solved] if statement based on Label tekst [closed]

Well, what is label? Does it have a text property? If you’ve identified the <label> element using a jQuery selector, you can get the text therein with the text() function. Something like this: <label>This Text</label> <script type=”text/javascript”> var label = $(‘label’); if (label.text() === ‘This Text’) { alert(‘hi’); } </script> Example here. 3 solved if … Read more

[Solved] why do i have this infinite for loop

remove below code from toString() Scanner in = new Scanner(System.in); System.out.print(“Enter a name: “); name = in.next(); System.out.print(“Enter a meal: “); mealType = in.next(); You are already reading these from the for loop. Also, your do-while loop is all wrong. The condition doesn’t make sense. It should be option > 0 && option <4 3 … Read more

[Solved] JavaScript. forEach return an undefined

You need .some to check if any items in an array pass a test. forEach returns undefined: const data = [ {prop1: false, prop2: ‘someValue’}, {prop1: true, prop2: ‘someValue’}, {prop1: false, prop2: ‘someValue’} ] const isSomeProp1EqualToTrue = data.some(({ prop1 }) => prop1 === true); console.log(isSomeProp1EqualToTrue); 4 solved JavaScript. forEach return an undefined