Posts

How to stop Android navigation drawer from opening automatically? -

how stop navigation drawer in android app opening automatically? it used work fine. out of sight @ first , able swiped visibility. needed title it. @ first listview. after modifying drawer xml (see below) give title above list view, began opening automatically. didn't add code my_nav_drawer.openonstartup(). <!-- navigation drawer --> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- main content view --> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/a...

html - Login php code not doing anything? -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 22 answers i'm using simple text document holds password in site directory public_html/users/matt/password.txt issue i'm having code when submit button pressed nothing seems happening. i'm sure it's silly mistake, have ideas here? <?php ob_clean();session_start(); if (isset($_get['logout'])){ session_destroy(); } $username = $_post['username']; $enteredpassword = $_post['password']; if (isset($_post['submit'])){ if (is_dir("users/".$username) === true){ $myfile=fopen("users/".$username."/password.txt","r") or exit("can't open file!"); $correctpassword = fgets($myfile); fclose($myfile); echo 'u...

ios - Any ideas for a sorted array that is easily indexed by key value range? -

scenaro: ios/objective-c application. have anywhere few dozen few thousand entries must collect , place in order timestamp. easy -- nsarray sorted descriptor. however, need able access array , select multiple entries time range (where start/end times may not correspond entry). , modestly performance sensitive, both setup time , access time. best can come sort array , binary search start/end points. doable , sufficiently fast. however, doesn't quite "feel" right (though can't articulate why). any other ideas? 1) sort array (optional, said needed) 2) instead of binary search, use nspredicate find entries interested in. here sample code 1 of projects have adapt own class, 1 has timestamp. // property wher store data @property nsarray *data; // custom struct hold timestamp values, min , max typedef struct cmttimestamprange { uint64 min, max; } cmttimestamprange; // return sub array objects between 2 time stamps - (nsarray *)samplesintime...

r caret - LOOCV in R returns error -

in past days began getting familiar r (i come matlab , python). wanted try out caret package (pretty awesome) , keep getting following error message when try train loocv error in `[.data.frame`(tuneacc, , params, drop = false) : undefined columns selected now, @ beginning thought "ok, i'm doing wrong here". used code http://machinelearningmastery.com/ : library(caret) # load iris dataset data(iris) # define training control train_control <- traincontrol(method="loocv") # train model model <- train(species~., data=iris, trcontrol=train_control, method="nb") # summarize results print(model) which returns same error. full code can found @ following address http://machinelearningmastery.com/how-to-estimate-model-accuracy-in-r-using-the-caret-package/ . did mess installation of r? doing wrong? it bug in print.train function. see issue 435 on github. should fixed next update of caret (version 6.0-70 or higher). btw there no...

Python Regex Date -

i'm trying create regex looks dates in format mm-dd-yyyy, , came far: dateregex = re.compile(r''' (0[1-9]|1[0-2]) # month - (10|20|[0-2][1-9]|3[01]) # day: not [0-2][0-9]|3[01] avoid 00 matching - ((198[0-9]|20(0[0-9]|1[0-6])''' # year: matches 1980 - 2016 , re.verbose) is there easier way allows me create range of numbers? , wanted create 1 allows legal dates (for example, june shouldn't have 31 days), easiest way match months different days, like: ((01|03|05|07|08|10|12)-(31 day regex pattern)-(year regex) # 31-day months | (04|06|09|11)-(30 day regex pattern)-(year regex) # 30-day months | 02-(regex depending on leap year)) # 28 or 29 days not sure how february besides putting leaps years , 29 days together, , remaining years 28 days. i agree jonrsharpe way combine regex dateti...

javascript - CSS transition of a div does not animate -

when click div, want second div expand/collapse. done using js, html, , css. want css transition animate. right jumping expansion , either scroll (edge) or jump after wait (chrome, opera, firefox). i've tried set height 1px instead of 0px, doesn't change anything. function growdiv(id) { var ele = document.getelementbyid(id); if (ele.style.height == '100%') { ele.style.height = '0px'; } else { ele.style.height = '100%'; } } .main { font-weight: 700; overflow: hidden; cursor: pointer; } .secondary { -webkit-transition: height .5s ease; -moz-transition: height .5s ease; -ms-transition: height .5s ease; -o-transition: height .5s ease; transition: height .5s ease; overflow: hidden; padding-left: 20px; height: 0px; cursor: pointer; } <div class="main" onclick="growdiv('expandable')"> expand </div> <div class="secondary" id=...

linux - Why clearing entropy count requires root privileges? -

in order clear entropy count when using linux's /dev/random through system call ioctl (rndclearpool), caller must have root privilege (according this: http://lxr.free-electrons.com/source/drivers/char/random.c ). why necessary prevent user space applications being able clear entropy count? clearing entropy count can cause significant reductions in performance affect processes run users of system.