Posts

php - CodeIgniter - MySql timestamp/datetime keep giving me zeros when inserting -

i current using codeigniter 2.2.2 , have following code inside modal: $this->createdate = time(); $this->db->insert('somedb_table', $this); where createdate type timestamp (i tried datetime). giving me zeros when inserting inside db. there other way around this? such: 0000-00-00 00:00:00 try this(array input method) $my_array = array( 'database_field' => $this->input->post('input_form_field'), 'time_stamp' => date('y-m-d h:i:s'), ); $this->db->insert('somedb_table', $my_array);

javascript - How to disable or uncheck a checkbox in ng-grid? -

i need disable or uncheck checkbox depending on condition. try solution how disallow selection beforeselectionchange select chekbox selection in ng-grid , row (the data) it's selected. $scope.gridqueryreporte = { data: 'datapaginadaintegrantes', columndefs: [{ field: 'numerosolicitud', displayname: 'label_id_solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'tiponumidsolicitud', displayname: 'tipo y no. id solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'nombresolicitud', displayname: 'nombre solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'tiponumidintegrante', displayname: 'tipo y no. id integrante', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'nombreintegrante', d...

Ending a Game Based on a Boolean not running any more code afterwards In Java -

i'm making text based version of game "are smarter 5th grader. it's not quite same, asked first grade question, , if miss it, 1 more redemption 1st grade question, , if miss 1 game over, if right can move on 2nd grade question(s). public boolean correct; public void firstsection() { scanner scan = new scanner(system.in); main man = new main(); system.out.print("the first category 1st grade math. here question... \n 5 * 2 + 4 / 2 ?" + " \n a. 18 \n b. 15 \n c. 12 \n d. 20"); string answer; answer = scan.nextline(); if(answer.equalsignorecase("c")) { system.out.print("congrtulations smarter 1st grader!"); correct = true; } else { system.out.print("you missed first question, have 1 chance redeem yourself. here 1st" + " grade social studies question... \n name of ship pilgrims sailed america named?" + " ...

r - How much data can be loaded in a shiny app without causing stability issues? -

right i'm loading 100mb of data in global.r file of shiny app. while app runs fine locally, shiny server regularly crashes. culprit following error (after waiting 30 seconds app load): an error has occurred application failed start. application took long respond. i've tried every possible setting app_init_timeout , including setting -1 , still no luck. i'm wondering if there upper bound amount of data can loaded in shiny server session. here's shiny server config file looks like: # instruct shiny server run applications user "shiny" run_as shiny; # define server listens on port 3838 server { listen 3838; # define location @ base url location / { # host directory of shiny apps stored in directory site_dir /vagrant/sites/; # log shiny output files in directory log_dir /var/log/shiny-server; # when user visits base url rather particular application, # index of applications available in directory shown. directory_index on; } } you...

Transform Data in R -

i have uploaded data set r. dataset has 2 columns user_id merchant_id 514729 14852,16695 1240327 23590 7457 211 359027 2483 463149 5802 514730 5460,1896 41953 7183,147105 927805 304,3909,4151,32,3,39171 as can see user ids associated multiple merchants. looking transform data in such way have following schema user id merchantid1 merchantid2 merchantid3 merchantid 4 123445 0 1 0 1 123453 1 0 0 0 basically want create matrix of userid , merchant ids 1 or 0 based on if user_id has merchant_id or not. any suggestions/help on how can accomplish this? i looking use build recommendation system. great. my interpretation after following: library(splitstackshape) csplit_e(mydf, "merchant_id", ",", type = "character", fill = 0) ## user_id merchant_id merchant_id_147105 merchant_id_14852 merchant_id_16695 ## 1 514729 14852,16695 0 1 ...

python - PyJWT, Expecting a PEM-formatted key -

i have copy pasted code layer: https://github.com/layerhq/support/blob/master/identity-services-samples/python/controller.py i have been told 2 other people ran on mac machines. using windows 7, , getting typeerror: expecting pem-formatted key when running code: #read rsa key root = os.path.dirname("__file__") open(os.path.join(root, rsa_key_path), 'r') rsa_priv_file: #not sure adding utf-8 @ priv_rsakey = rsa.importkey(rsa_priv_file.read()) #create identity token #make sure have pyjwt , pycrypto libraries installed , imported identitytoken = jwt.encode( payload={ "iss": provider_id, # string - provider id found in layer dashboard "prn": user_id, # string - provider's internal id authenticating user "iat": datetime.datetime.now(), # integer - time of token issuance in rfc 3339 seconds "exp": datetime.datetime.utcnow() + ...

How to get webcam video feed in a firefox addon? -

i developing addon requirement capture webcam video. did testing , noticed navigator.mediadevices.getusermedia() available within panel , hence have written following content script panel webcam video feed addon. var mediastream; var mediarecorder; // instance of mediadevices object use. navigator.mediadevices = navigator.mediadevices || ((navigator.mozgetusermedia || navigator.webkitgetusermedia) ? { getusermedia: function(c) { return new promise(function(y, n) { (navigator.mozgetusermedia || navigator.webkitgetusermedia).call(navigator, c, y, n); }); } } : null); function startvideocapture(width, height, framerate) { // check if browser supports video recording if (!navigator.mediadevices) { return; } // lets initialize video settings use our video recording session var constraints = { audio: false, video: { width: 640, height: 320, framerate: 25 } }; // make request start video capture navigator.mediadevices.getusermedia(const...