[Solved] How to add pthreads to MAMP PRO PHP

This question was an XY problem and it didn’t deserve so many downvotes. The real problem how to perform a long running task while returning a response to the client so they don’t feel the app is slow The solution Using PHP-FPM and function fastcgi_finish_request Example <?php // This is the output that we return … Read more

[Solved] Why does python give me a TypeError for this function? (new to coding) [closed]

You’ve used the same name, list, for both a built-in type and a local variable. Don’t re-use the built-in names. Quoting PEP-8: If a function argument’s name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption. Thus class_ is better than … Read more

[Solved] Changing js variable from different script

If the two scripts are on the same page, and if the value to change is global, then it’s possible. Like: <script> var variable = value1 var function1 = function() { var variable2 =value8 } </script> [Some html here] <script> variable = value2 </script> Variable2 is not accessible because it was declared in a function … Read more

[Solved] Getting to be displyed in the heading tag

I found a few mistakes in your code. You need to use document.body.appendChild(bannerBox); instead of document.appendChild(bannerBox); I ran your code after making this correction http://jsbin.com/zavoyuyife/1/edit and the bannerBox element got added to the body. You can see it in Firebug (firefox) or Chrome inspector. To make it visually appear you need to give proper height … Read more

[Solved] php need working code as example of password hashing

Follow the examples provided in PHP the Right Way under password hashing: require ‘password.php’; $passwordHash = password_hash(‘secret-password’, PASSWORD_DEFAULT); if (password_verify(‘bad-password’, $passwordHash)) { // Correct Password } else { // Wrong password } DO NOT under any circumstances “invent” your own algorithm. These are notoriously tricky to get right and unless you have a background in … Read more

[Solved] Issue in taking character input to C program

You can’t use strcasecmp to compare characters. It’s not completely wrong, but a single character is not a properly terminated string. If you must do comparison this way, use strncasecmp: if(strncasecmp(&gender,&word_M, 1) == 0) That will limit it to comparing one character. Also, your retry loop doesn’t check for ‘F’, but checks ‘M’ twice. solved … Read more

[Solved] beginner trying to apply a tax rate to an individual’s income

I wonder how much of that was a template. Oh by the way, have faith in yourself. I don’t know how much of that you wrote yourself, but for the function itself, only the IncomeInput<=20000 comparator needed to be switched. <html> <head> </head> <body> <script> function calcTax() { var IncomeInput, TaxRateCalc; IncomeInput = parseInt(document.TaxInfo.Income.value); if … Read more

[Solved] Getting all ordered sublists of ordered lists

from itertools import combinations, permutations perm=[] index = [9,7,6,5,2,10,8,4,3,1] perm.append(index) M = 3 slicer = [x for x in combinations(range(1, len(index)), M – 1)] slicer = [(0,) + x + (len(index),) for x in slicer] result = [tuple(p[s[i]:s[i + 1]] for i in range(len(s) – 1)) for s in slicer for p in perm] 1 … Read more

[Solved] how to save file image as original name

The reason you have the error is because the lists made by glob and os.listdir are not the same, either different files (glob is only getting jpg files and listdir gets everything) or different order, or both. You can change the filenames in a list, orig_files, to make a corresponding list of new filenames, new_files. … Read more