Posts

php - CodeIgniter some issues with subomain and subdirectory -

i have problems codeigniter 3.0.1 installation. have installed codeigniter subdirectory on subdomain, example subdomain.domain.com/codeigniter. i have created .htaccess file remove index.php url when try access default controller got 404 error. my htaccess file. rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] my config file $config['base_url'] = ''; $config['index_page'] = ''; $config['uri_protocol'] = 'request_uri'; and default controller in routes.php $route['default_controller'] = "auth"; why $0 - segment 0? htaccess: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] and try switch request uri parameter, auto should work in cases.

C++ create linked list and print -

i created linked list , wanted print items. struct node{ int item; node *next; }; typedef node* nodeptr; void insertat(nodeptr headnode, size_t index, int item); int main(int argc, const char * argv[]) { nodeptr head; head = new node; nodeptr constructor = new node; head->item = 0; head->next = constructor; for(int n = 0; n<8; n++){ constructor->item = n+1; constructor->next = new node; constructor = constructor->next; } constructor->item = 9; constructor->next = new node; constructor->next = nullptr; for(nodeptr begin = head; begin != nullptr; begin = begin->next){ cout << begin->item << endl; } return 0; } if write code this, works fine (print 0123456789). after making slight change after loop: constructor->item = 9; constructor->next = new node; constructor = constructor->next; constructor = nullptr; i assumed work same way...

Liquibase: runOnChange + rollback -

according liquibase docs stored procs/triggers etc should stored separately in single copy , added changeset runonchange update them each change. recommended way rollback previous change? idea have copy them separate folder each release , add apply operation of version rollback (for example, have sql\procs\current last version added changelog apply , sql\procs\1.0.0 copy of sql\procs\current when started new 1.0.0 release). there best practices it? thanks! we keep single copy of replaceable objects (procs/triggers/views etc) , use version control system (vcs) - git in our case. when want rollback previous version, revert relevant commit in vcs , run liquibase update. tutorial using oracle - working tutorial 2 years.

awk to count lines in column of file -

i have large file want use awk count lines in specific column $5 , before the : , count -uniq entries, seem having trouble getting syntax correct. thank :). sample input chr1 955542 955763 + agrn:exon.1 1 0 chr1 955542 955763 + agrn:exon.1 2 0 chr1 955542 955763 + agrn:exon.1 3 0 chr1 955542 955763 + agrn:exon.1 4 1 chr1 955542 955763 + agrn:exon.1 5 1 awk -f: ' nr > 1 { count += $5 } -uniq' input desired output 1 $ awk -f'[ \t:]+' '{a[$5]=1;} end{for (k in a)n++; print n;}' input 1 -f'[ \t:]+' this tells awk use spaces, tabs, or colons field separator. a[$5]=1 as loop through each line, adds entry associative array a each value of $5 encountered. end{for (k in a)n++; print n;} after have finished reading file, counts number of keys in associative array a , prints total.

Push notifications do not show for iOS devices -

Image
on bluemix dashboard, need see analytics information of push service both ios , android devices. can see in following screen shot, analytics information android devices displays expected: however, shown in screen shot, analytics information ios devices missing: what need analytics information ios devices display? push analytics not enabled correctly application. service connection needs made. otherwise, full push analytics data not received , see no version information available message in bluemix dashboard. push documentation explains how initialize push , enable notifications.

php - Killing session after certain time and update database -

i write following php code destroy session after 10 sec if user not on web page, not functioning properly. kills session after 10 sec not updating database. update database had refresh index.php page on browser updates database. want session destroyed automatically after 10 sec of start if close browser or inactive, , update database whether i'm on browser or not. don't want refreshing thing update database. $inactive = 10; // check see if $_session["timeout"] set if (isset($_session["timeout"])) { // calculate session's "time live" $sessionttl = time() - $_session["timeout"]; if ($sessionttl > $inactive) { $new_status= 0; $checkbox = "update online set status=($new_status) id=1 "; $stmt = $conn->prepare($checkbox); // execute query passing array toe execute(); $results = $stmt->execute(array($new_status)); // extract values $result ...

Racket - How to count the number of elements in a list? -

i wondering how count number of elements example, counting number of elements in (list 'a 'b 'c' 'd). thank you! based on racket documentation : http://docs.racket-lang.org/reference/pairs.html#%28def. %28%28quote. ~23~25kernel%29._length%29%29 (length lst) returns number of elements in lst.