[Solved] Display content of directory Ruby [duplicate]
Give this a shot: Dir.foreach(“/path/to/your/dir”) { |file| puts file } solved Display content of directory Ruby [duplicate]
Give this a shot: Dir.foreach(“/path/to/your/dir”) { |file| puts file } solved Display content of directory Ruby [duplicate]
Your code should work. It is better to have some protection against SQL injection as below. I have changed addslashes to mysql_real_escape_string. So now it should be alright. $name1 = mysql_real_escape_string($_POST[‘name1’]); $name2 = mysql_real_escape_string($_POST[‘name2’]); $name3 = mysql_real_escape_string($_POST[‘name3’]); mysql_query(“INSERT INTO tb_people (name) VALUES (‘$name1’), (‘$name2’), (‘$name3’);”); 5 solved about mysql query in php [closed]
If just want to handle “quit” or a float, that’s easy: total = 0.0 while True: value = raw_input(“enter a number or quit to finish”)) if value == “quit”: break total += float(value) print total But if the user types, say, qiut or 2..137, the program will bail out with a ValueError. How do you … Read more
Because your first dict’s key is number. Not ‘nom’. for k in test: print test[k][‘nom’] solved parser dict in python [closed]
The error you have comes up in your method of printing out the results: for i in range(len(teams)): print(team[i],team[i+1]) First of all, you have team instead of teams in the print statement, which is actually the string where you were storing user input, and should be ‘-1′ by the time you’re printing scores. You’re getting … Read more
Does it crash at the line that defines defaults, or at the setObject line? The most likely reason to crash at setObject would be an invalid “message” object. Set a breakpoint at the line that’s crashing and examine self, message, etc. solved nsuserdefaults setobject crashes in iOS [closed]
You can’t make a video file into an executable. You can write a video player in Python which implements the functionality you desire and then use something like py2exe to make it into an executable, but that would involve writing a video player in Python. There is no programming language that will make a video … Read more
Your posts are in ul list. you need to count the length of the li‘s under this ul#postlist [assuming that each li is a post] <ul data-filter=”true” data-filter-placeholder=”Search blog posts…” id=”postlist”> </ul><!– content –> Change your $(‘#postlist’) var currentPost = $(‘#postlist’); with var currentPost = $(‘#postlist li’); $(‘#postlist li’) is what you are looking for, … Read more
So, just output the even lines. i = 1 f = open(‘file’) for line in f.readlines(): if i % 2 == 0 : print line i += 1 6 solved Python. Even-numbered lines in text file
You need to do the assignment yourself (or there is no point in learning to program) and if you don’t understand the question, you should ask your teacher for clarification. That said, shifting is quite simple in principle. You can do it by hand. If you have a letter, say A, shifting it by 1 … Read more
You need to declare a variable to hold the sum: int f, sum = 0; for (int k = 1; k <= 6 ; k++){ System.out.println(“Type ” + k +”. number”); f = userInput.nextInt(); sum += f; } solved Counting amount in Java loop [closed]
You just compile it using your normal C++ compiler. Then compress the resulting .exe file using UPX. solved How to compile file .cpp to exe with comperssion natively? [closed]
function extract_regex($subject, $regex, $index = 1) { preg_match_all($regex, $subject, $matches); if (count($matches[$index])) { if (count($matches[$index]) == 1) { return trim($matches[$index][0]); } return $matches[$index]; } return ”; } $out = extract_regex(“<label class=”area”><font class=”bg_info” onmouseover=”land_convert_txt(this,3067)” onmouseout=”tooltip_hide()”>3,067 Sq. Ft.</font></label>”,”/<label class=\’area\’>(.*)<\/label>/i”); echo “<xmp>”. $out . “</xmp>”; 11 solved Regex scraper challenge [duplicate]
Yes, by design. The single-equals means set the left operand to the right operand. The 4th element of Array1 is set to the value of the fourth element of Array2. This changes the contents of the array, though not the structure. If you’re trying to do a comparison, you’ll want to use == for “is … Read more
It translates to this: <td> <?php if($contact[‘Contact’][‘sex’] == ‘m’): ?> Male <?php else: ?> Female <?php endif ?> </td> But there is really nothing wrong with the line that is actually in your file. 7 solved Unknown php syntax [closed]