Posts

php - SQL Update Query - Attempt to put 0 in a field -

i'm using following update row in sql server database: "update bmraconfig set [pn operator] = '".$pnop."', [pn value] = '".$pnvalue."', [mel operator] = '".$melop."', [mel value] = '".$melvalue."', [ndz operator] = '".$ndzop."', [ndz value] = '".$ndzvalue."', [fuel type] = '".htmlentities($fueltype, ent_quotes)."' [pn operator] = '".$default["pnop"]."' "; however when 1 of variables equal 0 , example $melvalue == 0, field isn't updated. if value 51 example change, not when it's 0 .

Git commits linked to wrong user on Github, correct in git log output -

i have been using git months now. working on own, working on repository of .html , .txt files little (terrible) python. coding skills average @ best, , have been using linux & unix command line 2 years @ basic level. while visiting parents in uk, installed git on mac mini continue working on repository. set second repo different purpose , used git config in repo set local values user.email user.name etc. set second github account using different email address , pushed once. since then, every time push 1st git repository on own computer, commits listed being second user set on mac, though never pushed there own computers. output of git log on local repo has author ought "author: pocketapocketa ", github has "christopher-rozruch". (in fact, looking on commit history, "christopher-rozruch" commits pre-date use of mac mini , setting of christopher-rozruch identity in form week or so.) i have searched problem found issues involving changed config...

php - Mailgun : Fatal error: Uncaught exception 'Guzzle\Common\Exception\InvalidArgumentException' with message 'Unable to open -

i have used following code , have placed these files in same directory of script running send mail. exception continues thrown when try give online link. i trying piece of php code in local host can figure out error below # include autoloader (see "libraries" install instructions) require 'mail/vendor/autoload.php'; use mailgun\mailgun; # instantiate client. $mgclient = new mailgun('key-secret'); $domain = "mydomain"; $result = $mgclient->sendmessage($domain, array( 'from' => 'email', 'to' => 'email', 'bcc' => 'email', 'subject' => "sending attachment 2", 'text' => "sending attachment", 'html' => "sending attachment", 'attachment-1'=> 'test.xml' ), array("attachment" => array( ...

javascript - Find nested order of ul's and add specific classes -

i trying figure out way loop through container <nav id="container"> <ul> <li>text</li> <li> <ul> <li>text</li> <li> <ul> <!-- , on --> </ul> </li> </ul> <li> </ul> </nav> and check how deep ul nested in if first 1 add class="level-1" it, if second .level-2 etc. bear in mind, each <ul> can contain more 1 nested ul (multi level navigation). demo simply iterate through ul s , create classname based on how many parent ul s each has, using parentsuntil() in case #container within ul . $(function(){ $('#container ul').each(function(){ var classname = 'level-' + ($(this).parentsuntil('#container', 'ul').length + 1); $(this).addclass(classname); }); }); a shorter way write (courtesy of arun p johny) is ...

javascript - Regular expression for remove last n characters -

i have requirement remove last n characters string or remove 'page' particular string. eg: var string = 'facebookpage'; expected output string = 'facebook' i remove 'page' string. done using substring. var str = "facebookpage"; str = str.substring(0, str.length - 4); could me find better way it. regex this: //str - string; //n - count of symbols, return function(str, n){ var re = new regexp(".{" + n + "}","i"); return str.match(re); }; edit: for remove last n characters: var re = new regexp(".{" + n + "}$","i"); return str.replace(re, ""); update: use regex task, not way; example, avg runtime 100000 iterations: str length solution = 63.34 ms regex solution = 172.2 ms

Is there a way to edit the source of a network request in Firebug? -

can source of post tab of specific post request in firebug's net panel edited? firebug version 2.x not allow edit network requests. there longstanding enhancement request this . though firebug 3 designed integrate firefox built-in devtools. , allow edit network requests , resend them. inherit feature them. to need select request within network panel, click edit , resend , edit parameters , click on send .

recursion - Find node in javascript tree by some params -

i try write mixin underscore, can find node params, example: _.finddeep(tree, {id: 5456, parent_id: 555}) tree: var tree = [ { id: 22, name: 'qqqq', depth: 0, parent_id: 11, children: [ { id: 222, name: 'ttttt', depth: 1, parent_id: 444, children: [], positions: [] }, { id: 5456, name: 'yyyy', depth: 1, parent_id: 555, children: [ { id: 6767, name: 'dfgfdg', depth: 3, parent_id: 6564, children: [], positions: [] }, { id: 4345, name: 'dfgdgfg', depth: 3, parent_id: 45234, children: [], positions: [] }, ], positions: [] }, ], positions: [ { id: 14, name: 'rere', pri...