Posts

php - Is this code safe against mysql injections? -

$stmt_update = $db->prepare("update 2_1_journal set recordday = ?, number = ? "); $stmt->execute(array($amount1, $date_day1)); is safe against mysql injections? if safe, understand because of "= ?". question how "= ?" works/helps question because here http://php.net/manual/en/pdo.prepare.php written prepared statements project sql injection if use bindparam or bindvalue option. for example if have table called users 2 fields, username , email , updates username might run update `users` set `user`='$var' where $var user submitted text. now if did <?php $a=new pdo("mysql:host=localhost;dbname=database;","root",""); $b=$a->prepare("update `users` set user='$var'"); $b->execute(); ?> and user had entered user', email='test test injection occur , email updated test user being updated user. in code (above) there no bindparams , no bi...

java - What happens if I initialize an int variable to something other than an int? -

let's have following line of code: int number = b/2; where b odd int. happen? also, if b instead long, java automatically convert long int? if b char, or else ridiculous? java widen types automatically, must narrow types cast. i suggest try might learn something. can't learn program without doing @ point.

Netty: How to make sure Channel.close() was fired by the I/O thread -

i using netty 3.6.2, here pipeline factory pseudocode: private final static threadpoolexecutor executor = new orderedmemoryawarethreadpoolexecutor(8, 4194304, 4194304, 5l, timeunit.minutes); public channelpipeline getpipeline() throws exception { channelpipeline p = pipeline(); p.addlast("framedecoder", protobufframedecoder); p.addlast("protobufdecoder", protobufdecoder); p.addlast("executor", new executionhandler(executor)); p.addlast("handler", handler); p.addlast("frameencoder", protobufframeencoder); p.addlast("protobufencoder", protobufencoder); return p; } in way, handler's messagereceived() called in different thread pool instead of worker thread pool, want close channel in case exception happened in messagereceived(), according here: http://netty.io/wiki/thread-model.html , any upstream events triggered side effect of downstream event must fired i/o thread. simply ...

jquery - Check whether an item from a dropdown list is selected -

i have multi-select html dropdown list. want check on button click whether there item selected or not. if there no element selected, alert "item not selected" else selected items alert "selected". if ($("#ddl1 >option").length >= 1) { if ($("#ddl1 >option:selected").val() == 'undefined') { alert("not selected"); } else { alert("deleted"); } } else alert("list empty"); you can use length <= 0 here if ($("#ddl1 > option").length >= 1) { if ($("#ddl1 > option:selected").length <= 0) { alert("not selected"); } else { alert("deleted"); } } else alert("list empty");

actionscript 3 - How i can create a .ppt file from as3? -

how can create .ppt file as3? need add 1 image powerpoint , save .ppt file on button click. there as3 library available saving files ppt? immensely appreciated. thanks in advance.. i write vba code in microsoft office powerpoint you. can achieve goal code. you must create text file name "info.txt" in following order when want create powerpoint presentation (path of text file must in have placed attached "insertpicture-office 2007.pptm" , "insertpicture-office 2010 & 2013.pptm" files): line 1. distance of image left of slide line 2. distance of image top of slide line 3. image width in slide line 4. image height in slide line 5. full path , name (with extension [.pptx]) saving powerpoint presentation file line 6. full path , name (with extension) of image inserting in slide of powerpoint presentation after save text file, must run "insertpicture-office 2007.pptm" or "insertpicture-office 2010 & 2013.pptm...

Reading bit by bit from a binary file with C -

i need read 256 bit each step until binary file ends.is there operation in c read bit bit? use fread function , read 32 chars. chars shift bit bit 8 times. after reading ı write 256 bits file. ı have same thing write? mean ı write 32 chars => 32*8 = 256 bit. no, minimum item can read or write char (and keep in mind that's not necessarily 8 bits, depends on implementation). if want manipulate parts of char once have in memory, you'll need use bitwise operators sich & , | << , >> ( and , or , left/right shift ). and yes, can fwrite write arbitrary number of characters (in same manner use fread read them).

jquery - JWPlayer Error Loading player -

i use jw player in wordpress. , error error loading player. no playable source found. i on mobile. in firefox , safari works, nut customer told in pc in firefox , safari doesn't work. jwplayer("myelement").setup({ sources: [{ file: "http://www.mydomain.com/v/v.flv", width: "480", height: "270" }] });