Posts

sql - insert row into the table from values in two tables -

i want insert row in table. problem how values 2 different tables tables. itable has 3 columns ( studentphoto , studentname , studentid ) dtable has (studentphoto , studentid ) ltable have (studentname, studentid) i want insert data table itable table dtable , ltable . is possible , if yes, how? try insert itable (studentphoto , studentname , studentid) select d.studentphoto,l.studentname,d.studentid dtable d inner join l ltable on d.studentid= l.studentid

php - Hide columns if user want that -

this has super simpel solutions, can't wrap head around it. i have sql query: select traning.type_name,users.user_id, users.user_name,user_traning.min_puls, user_traning.medel_puls,user_traning.max_puls, user_traning.duration,user_traning.date, user_traning.view traning inner join user_traning on traning.tr_id=user_traning.tr_id inner join users on user_traning.user_id=users.user_id order `user_traning`.`date` desc i have colum in user_traning called view . the input form inputs either null or 2 . im thinking null means view input, , 2 user want hide input. i have been trying way: while($row = $users_traning->fetchobject()) { if($row->user_id == $_session['user_id'] && $row->view == null) { echo '<span class="glyphicon glyphicon-user"></span> <a href="userinfo.php='.$row->user_id.'">you </a> have ' .$row->type_n...

How can I manipulate translation methods of cakephp 3 to become case insensitive? -

this part of src/locale/en_us/default.po file msgid "acg_id" msgstr "access control group identifier" msgid "acg_id" msgstr "access control group identifier" msgid "acg_id" msgstr "access control group identifier" my default.po file long. , think impossible write this. msgid "acg_id" msgid "acg_id" msgid "acg_id" msgstr "access control group identifier" how can implement function below in cakephp core function __($token){ $translation = translation(strtolower($token));//translation returns translation of token if exists else returns null return $translation ? $translation : $token; } then default.po file become shorter :) this msgid "acg_id" msgstr "access control group identifier" while think case insensitive translations kinda bad practice (why not use proper message ids?), can pre-declare of shorthand translation functions in a...

jQuery .ajax() access to beforeSend local variable in javascript loop -

have jquery ajax call inside javascript cycle. here code: var number_of_ping_for_average = 4; var ping_start_time; for(i = 0; i++; < number_of_ping_for_average){ $.ajax({ type: 'get', url: "http://www.exmple.com/pkt.ext", timeout: 1000, cache: false, beforesend: function(){ ping_start_time[i][new date().gettime()]; }, success: function (data) { var ping_arrive_time = new date().gettime(); var ping_val = ping_arrive_time - ping_start_time[i]; }, error: function(data){ //timeout or 500 error //@todo fare funzionare tutto } }); } as see... need call variable "i" inside anonymous fun...

xcode - How to embed a file in an objective-c project and extract it in running time? -

i have code written in objective-c os x. want create text file right after user runs program , save under documents folder. right stored text in string variable , on run time write in file. problem don't want have hardcode content of text file in code. is there way embed text file in project , when user runs application extract , store under path? p.s. using xcode. thanks. just add file project. in build phases add new copy files build phase , choose resources folder. in code use nsbundle

javascript - Stripe security issue -

i'm integrating stripe online store. can see code below, payment form inserted html values each form field. means user change price of field, , fraud. is secure? if not, how can add security measures? thanks! :) <form action="" method="post"> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="deleted_for_demonstration" data-amount="2000" data-name="demo site" data-description="2 widgets ($20.00)" data-image="/128x128.png"> </script> </form> i assume using stripe.js in case wouldn't required use price in form. i try , change code flow below... for instance... user selects product id 123 via post request on product page. store have selected product in session. when checkout... use stripe js on card details on frontend exchange form card details token. post token server. th...

node.js - Sails Hook route forbidden -

i try make installable hook make security verifications under hook.js set : routes : { before : { "/" : function (req, res, view) { ..... res.forbidden(); } } }, and have error if try send forbidden page user : error: sending 500 ("server error") response: typeerror: object #<serverresponse> has no method 'view' @ object.forbidden (/users/jaumard/documents/workspaceide/kikilib/api/responses/forbidden.js:56:19) @ serverresponse.bound [as forbidden] (/usr/local/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21) @ isrouteallowed (/users/jaumard/documents/workspaceide/kikilib/api/hooks/acl.js:66:18) @ routetargetfnwrapper (/usr/local/lib/node_modules/sails/lib/router/bind.js:179:5) @ callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37) @ param (/usr/local/lib/node_modules/sails/node_modules/express/lib/...