Posts

How to import ActionBarSherlock in android SDK version 23 -

i trying implement sherlock actionbar in android studios, new android studios not understand need put build.gradle file dependencies section in android in order imported. i using lastest version of andriod studos sdk version 23. please help. someone has advised me no longer available in andriod studios how can below then. so how can then. public class menuactivity extends sherlockactivity implements public class menuactivity extends sherlockactivity implements actionbar.onnavigationlistener, since actionbarsherlock has been deprecated, can use toolbar class appcompat-v7 library. on gradle file, add: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.1.1' } for layout, can use this: <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="0dp" a...

angularjs - Angular within Bootstrap remote tabs -

i have basic angular page, pulls records database , displays in table via ng-repeat - working fine standalone page. i'm using bootstrap remote tabs https://github.com/thecodeassassin/bootstrap-remote-data , calling above page 1 of tabs' content. angular page loaded angular not initialising though reason. nothing binding. i've tried putting angular scripts both inside / outside of tab, , putting ngapp inside of tab (remote page) , outside of tab (parent page) , doesn't make difference. there i'm missing? i not sure trying do, think problem angular finishes loop initializing content before pages loaded inside tabs. have tried use ng-include load content of tabs dynamically. also may need call angular apply re initiate binding. another note, if trying use tabs load data asynchronously, can use regular tabs , let angular handles loading of data using ng-include.

Run a series of tasks, but depending on progress start on task x in bash (continue switch case) -

i have series of tasks run 1 after other, depending on progress, saved in variable has start @ appropriate step. for instance, have 5 tasks. task 1 supposed start, followed task 2, task 3 , on. if variable progress contains value 2, should start @ task 2, continue task 3 , on. i thought achievable switch case, like: case $progress in 1) echo "task1" $progress=2;; 2) echo "task2" $progress=3;; 3) echo "task3";; *) echo "null";; esac the problem here switch case ends, after first match. how have switch case continue after first match? to complement boolean.is.null's own helpful answer , here's overview of case -branch terminators : ;; [the option bash 3.x] exit case statement right away (from matching branch). ;& [bash 4.0+] unconditionally fall through next branch - in c switch statement's case handler without break . note unc...

How to read matrix of integers from file in C? -

i writing function in c that, given dimension d of square matrix stored in filepath f , reads integers 1-dimensional array m of size d*d . a sample file sample.dat may be: 10 20 30 12 24 36 1 2 3 my function is: void readmatrix(int d, char *f, int *m) { file *fp; int = 0; fp = fopen(f, "r"); while (i<d*d) { fscanf(fp, "%d ", &m[i]); i++; printf("%d\n", m[i]); } } however when run function, outputs 0: dimension: 3 filename: sample.dat 0 0 0 0 0 0 0 0 0 what doing wrong here? many problems in little code you never check whether file did open. you never check whether fscanf() succeeded. you increment i before printf() printing next element instead of current. you never fclose() open file. correct way of maybe doing this void readmatrix(int dimension, char *path, int *data) { file *file; ...

php - PHP7 Code now doesn't work anymore -

this question has answer here: replace deprecated preg_replace /e preg_replace_callback [duplicate] 1 answer this code used remove bad words text entered users on forum. somehow code not correctly interpreted , remove string empty. know what's wrong. worked fine until php5.6 $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?' . '>([^><]+|(?r)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1)); that's not code can't understand procedure behind str_replace substr , 2 preg_replace. if transform code callback function or @ least working 1 make me happy. you can replace with: $message = preg_replace_callback('~(?<=>|^)[^<>]*+(?=<|$)~', ...

python - Unpickle namedtuple with backwards compatibility (ignoring additional attributes) -

here's scenario simulates running older version of python program against shelve database written newer version. ideally, user object still parsed , read in; favouritepet attribute ignored. understandably, throws error complaining tuple doesn't match. is there way of making scenario work namedtuples, or better switch storing dictionary or class if sort of flexibility required? import shelve collections import namedtuple shelf = shelve.open("objectshelf", flag='n') user = namedtuple("user", ("username", "password", "firstname", "surname", "favouritepet")) shelf["namedtupleandrew"] = user("andrew@example.com", "mypassword", "andrew", "smith", "cat") # redefine user simulate previous version of user object didn't record favouritepet; # using old version of program against database written new version user = namedtuple("user...

css - HTML form input text not showing -

my page not showing input text form. whenever select text box, glows not accept text. i know there's wrong css, can't seem figure out problem. html: <div class="container" id="signin"> <h2>sign in</h2> <form method="post" action="index.html"> <!-- <input style="display:none" type="password" name="fakepasswordremembered"/> --> <input type="text" name="password" placeholder="password" > <br /> <input class="button" type="submit" name="commit" value="login" /> </form> </div> css: a { text-decoration: none; position: absolute; right: 0; text-align: right; color: #fff; } a:hover { text-decoration: underline; } .container { position: fixed; top: 50%; left: 50%; width: 55%; paddin...