Posts

Showing posts from September, 2015

renaming files in a directory using python or R -

i went across similar questions of renaming files in directory using python. i have these files in directory want rename: -statistical_analysis_with_r -statistical_pattern_recognition_3rd_edition -statistical analysis r -statistical pattern recognition 3rd edition for wrote script in windows: def naming(so): import re w=re.split('[ _]+',so) r=[] in w: r.append(i.capitalize()) print(' '.join(r)) import os c in os.listdir(os.getcwd()): if c.endswith(".pdf"): os.rename(c,naming(c)) print(os.listdir(os.getcwd())) but getting error: statistical analysis r.pdf traceback (most recent call last): file "<ipython-input-79-d7f645d6d3e5>", line 4, in <module> os.rename(c,naming(c)) typeerror: rename: can't specify none path argument can what's going on? and doing same thing using r (www.r-project.org)? loads of in advance. your naming functio

ruby on rails - Carrierwave Timeout -

i have used carrierwave users upload files in rails app. when user uploads multiple files of size more 400mb (approx.) timeout error. note: i've hosted app rails app on heroku. uploading large files through heroku not recommended. limit request 30 seconds , not enough time 400mb. if open using s3, heroku provides potential rails solution that.

vbscript - How to batch combine PDFs with sub-folder based non-JavaScript bookmarks -

having been avid reader here many years, have question of own couldn't find answer for. i looking solution, preferably vb scriptable, combines several pdf files different subfolders 1 new pdf , adds bookmarks based on folder structure, i.e. first page originating first file folder gets first level bookmark based on folder name, , second level bookmark based on file name. subsequent files folder second level bookmarks linked under first level bookmark. as added complication, bookmarks must point location in document; must not javascript based , call actions. this should happening on win7 pc. unfortunately don't know how internal workings of pdfs (yet), can't quite believe that problem uncommon isn't solved already!? can pointing me in right direction (or providing script, of course, if it's easy), or confirming above isn't possible, or else, really? thank much! best

Images won't display through CSS -

if try set background image using css, flat out not load. if use same path in html, will. making slider of these images, hence need work css. i've browsed every answer on internet similar problems , nothing works. relevant html: <div class="slider-container"> <div class="slider5"></div> <div class="slider4"></div> <div class="slider3"></div> <div class="slider2"></div> <div class="slider1"></div> </div> css: .slider-container { overflow: hidden; width: 100%; height: auto; } .slider1, .slider2, .slider3, .slider4, .slider5 { width: 100%; height: auto; position: static; top: 0px; cursor: pointer; transition: 0s linear; -webkit-transition: 0s linear; -moz-transition: 0s linear; -o-transition: 0s linear; }

html - outline-style different in chrome compared to firefox and internet explorer -

seems firefox , ie have default of black dotted outline while chrome has default of light blue solid outline. i tried change doing this: a{ outline-style: dotted; outline-color: black; } this seems catastrophe links got dotted black outline not hovered or focused. terrible because "outline" thing can differentiate mouse focus keyboard key focus. any other idea on how make chrome's outline others ? <!doctype html> <html> <head> <style type="text/css"> body{ font-size: 1.5em; font-family: verdana; } .zone2 a{ outline-width: thick; outline-color: red; } .zone3 a{ outline-style: solid; } </style> </head> <body> outline tests:<br/> <div class="zone1"> <a href="#">test link 1</a><br/> <a href=&quo

javascript - Spinner in Angular.js -

i want use spinner can show during of rest api calls better ux. have come across many existing github projects similar things. https://github.com/cgross/angular-busy https://github.com/urish/angular-spinner but i'm not able use of existing projects. think before start writing of own, want know if things i'm looking can done using these projects or other existing project. requirement: during of rest api calls uploading images, fetching data, deleting images, etc, want show spinner background faded. once have result, can show background again , remove spinner. i want use spinner start/stop controller not html. i don't want spinner xhr requests default. i think angular-busy demo solves of above requirements except needs promise param in html. there anyway can control start/stop dynamically controller rather giving promise. angular-spinner demo doesn't fade out background. there way fade out background ? can give me pointers how can solve prob

c# - Valueinjecter map base derived class -

i have base class ad . public class ad { public int id{get;set;} public string title{get;set;} public string price{get;set;} } then have lot of derived classes like: public class carad : ad { public string modelname {get;set;} } public class mobilead : ad { public string companyname {get;set;} } and accordingly have viewmodels these classes well. public class adviewmodel { public int id{get;set;} public string title{get;set;} public string price{get;set;} } public class caradviewmodel : adviewmodel { public string modelname {get;set;} } public class mobileadviewmodel : adviewmodel { public string companyname {get;set;} } i trying map derived class base class using value injecter. like: [httppost] public async task<ihttpactionresult> post([frombody] caradviewmodel caradmodel) { var ad = new ad(); ad.injectfrom(caradmodel); } but not mapping properties of derived class. can tell me if

javascript - How to open a third party HTML project from a web application ,in a separate browser tab -

i'm developing java web application. , want add help component that.(so user clicks on help button page open in separate tab) the help page separate html project it's own css , js. (let's it's small separate html project) . , can manually run clicking index.html file in project.( help/index.html ) so how can add button in web application user clicks on , open help page in new browser tab. you put web application: <a href="#" onclick="window.open('help/index.html', '_blank');"> click here</a>

bash - display text file and update when the file contents change -

i want have window open content of file file.txt . not care command use open it, nano, cat, vi or whatever. want update every time changes, if open in window, edit , save it, file in original window update, kind of screen . suggestions? i have tried having open new cat file.txt command every few seconds, unreliable. use watch cat file.txt that should update when changes occur, try man watch to see options has can update frequency of updates.

osx - Creating a png image from SpriteKit Node/SpriteNode in Xcode for Mac -

currently i'm making isometric map editor (in swift) each map tile added sknode called maplayer . want know whether possible produce png image maplayer , once have finished designing map? not in swift should give idea on how it. you can capture screen uiimage doing this: cgrect bounds = self.scene.view.bounds; uigraphicsbeginimagecontextwithoptions(bounds.size, no, [uiscreen mainscreen].scale); [self drawviewhierarchyinrect:bounds afterscreenupdates:yes]; uiimage* screenshotimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); then create png image uiimage (and write disk) this: // create paths output images nsstring *pngpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.png"]; nsstring *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.jpg"]; source here . // write uiimage jpeg minimum compression (best quality) // value 'image' must uiimage object

Java, Catching an exception and passing it to a method -

i created method accepts ioexception argument. method opens out stream , prints information exception text file. problem seem running into.. how call method catch block? try{ if(true) throw new ioexception(); } catch(ioexception e){ //pass method } :::edit::: public void logerrors(ioexception e){ printwriter out = yada yada; out.println(e.getcause()); } basically have call name of method, want method's code executed this: try{ if(true) throw new ioexception(); } catch(ioexception e){ //pass method methodtoexecute(e); } also, can see throw ioexception in both cases perhaps may want consider modifying code use block edit on second thought, can use if statement throw always. if (...) { yourmethod(throw new ioexception()); }

How to plot the discrte form of the logistic model in matlab -

i want plot y(k) againts k of following formula in matlab: y(k+1)=r(y(k))(1-y(k)) so did following: %logistic model in discrete form. r=2.5; y=rand(1); j=1:100 y(j+1)=r*y(j)*(1-y(j)); end plot(y(j+1),j) but when run it, thing gives me white plot, is, axis. did wrong here?, can me fix it? thanks lot in advance. you need create array of values of function. %logistic model in discrete form. r=2.5; y = zeros(100, 1); y(1) = rand(1); j=1:100 y(j+1)=r*y(j)*(1-y(j)); end plot(1:101, y) plot function 2 arrays, first values of x axis, second values of y axis.

Run as Ant build' Missing in my eclipse -

i unable right click , run build.xml file choosing 'run ant' . whenever click says run configuration , goes running java file options . this works me. go to.. 1. -> install new software work -> " http://download.eclipse.org/releases/juno " drop down list "general purpose tools" select "eclipse plug-in development environment" after doing this...eclipse started showing option of ant build in run as

ios - Xcode Display Image if there is no image on Imageview -

i need make this iboutlet uiimageview *imageview; iboutlet uiimageview *imageview2; if(imageview have no image){ set image @"x"; }else if(imageview2 have no image){ set image @"x"; } and save , load code nsuserdefaults try this uiimageview *myimageview; if(myimageview.image){ myimageview.image = [uiimage imagenamed:@"myimage1"]; //image exists } else { myimageview.image = [uiimage imagenamed:@"myotherimage"]; //image doesnt exists } //by time image or other set save image [[nsuserdefaults standarddefaults]setobject:myimageview.image forkey:@"myimage"]; i dont know if nsuserdefault can set image object coz havnt tried u might exception, best if can save image's name right in if statement using [[nsuserdefaults standarddefaults] setobject:@"imagenameoftheimage" forkey:@"myimagename]"

Gradle leaves java as a process even after closing android studio -

Image
on mac system whenever close android studio leaves java process , java process keep running , keep hogging ram memory.having mac 4gb sometime painful if see java process taking upto 1gb of ram is there option in android studio quit process related should closed or command can run cleanup? from the documentation : daemon processes automatically terminate after 3 hours of inactivity. if wish stop daemon process before this, can either kill process via operating system or run gradle --stop command. --stop switch causes gradle request running daemon processes, of same gradle version used run command, terminate themselves.

c - Why this code not giving desired output? -

#include <stdio.h> //compiler version gcc 6.3.0 int main() { float da,hra,s,gs; scanf("%f",&s); da=40/100*s; hra=20/100*s; gs=s+da+hra; printf("%f",gs); return 0; } for example if entered 25000 s output must 40000 showing 25000.000000. try fix below. note 40.0 , 20.0 instead of 40 , 20 . issue doing integer division. 40 / 100 == 0 , da 0 . using 40.0 / 100 instead gives floating point division , value 0.4 , want make calculations correct. (the same holds computation of hra .) #include <stdio.h> int main() { float da, hra, s, gs; scanf("%f", &s); da = 40.0 / 100 * s; hra = 20.0 / 100 * s; gs = s + da + hra; printf("%f", gs); return 0; }

python - For loop in matplotlib only plots first iteration -

i want read several columns csv file , plot them on single window. have this: fig1=pl.figure(num=1, figsize=(8, 4), dpi=80, facecolor='w',edgecolor='k') a=np.random.rand(50,9) ax = pl.gca() in range(0,6,2): ax.errorbar(a[:,i], a[:,i+1], yerr= a[:,i+2]) ax.set_xscale('log') ax.set_xlim(1e19, 1e22) pl.show() i no error message, output plot first iteration, when there should 3 in sample file. have put different parts of code in loop @ best first plot window , 2 empty windows not looking either. why isn't loop cycling through values? or assuming cycling through why plotting first one? thanks! update: tcaswell, x range restrictive. classical case of not looking @ data close enough. embarrassing.

c++ - What's the point of logical operators vs. bitwise operators -

given statement logical operation ((a > 5) && (b > 4)) and statement bitwise-operation ((a > 5) & (b > 4)) above 2 statements not equivalent. because (a > 5) element of {0,1} so, why need logical operators & bitwise-operation ? edit : of feedback. regarding short circuit behaviour of logical operators, not want behaviour - writing code gpu branches degrade performance: short circuit results in 2 branches instead of 1 in code. for numerical comparisons in c, in case short circuit not needed, seems logical , bitwise have identical behaviour. in case, bitwise ops faster logical. i apologize not putting these details in original posting. i think no, take example (0b - means binary): a = 0b00000010 b = 0b00000100 now, neither a nor b 0. a & b == 0 (due way bitwise , defined). however a && b != 0 (because logical , result 0 if @ least 1 operand 0 - not case a , b above). also there short circ

R: Number of obs between min and max -

i need extract number of observations between min , max. know can subset data, creating new df calculate length interested in less involved process. example, have , number of observations min max, ddd <- mydf[,list(minvar1 = min(var1, na.rm=true), maxvar1 = max(var1, na.rm=true)), by="group"] is there direct approach without intermediate df? thanks. edit: guess bit more complicated stated. group = 1, minimum value 2 need minimum indexed lower max value index/position. so, range 3 7 length of 3. idx variable scores measured index/position of var1. so, max position of var1 must first identified, insure min position extracted idx less of max position. group var1 idx 1 3 4 1 5 5 1 7 6 1 3 7 1 2 8 2 5 12 2 6 13 2 9 14 2 11 15 2 5 16 group min max length 1 3 7 3 2 5 11 4 by using data.table , expected output. convert 'data.frame' 'data.table' ( setdt(df1) ). grouped 'group', order 'idx', position of maximum

node.js - Divide Node App in different files -

i'm developing first node.js app socket.io , fine app getting bigger , i'd divide app-code different files better maintenance. for example i'm defining mongoose schemas , routings in main file. underneath functions socket.io connection. want have file schemas, file routing , 1 functions. of course, i'm aware of possibility write own module or load file require. not make sense me, because can't work vars app, io or db without making them global. , if pass them function in module, can't change them. missing? i'd see example how done in practice without using global vars.. it sounds have highly coupled application; it's difficult split out code modules because pieces of application should not depend on each other do. looking the principles of oo design may out here. for example, if split dataabse logic out of main application, should able so, database logic should not depend on app or io --it should able work on own, , require other p

java - Unable to get JSON Object in request to the servlet -

i have created json object manually using data obtained in java script , sent json object servlet using ajax. the object able receive unable convert json object again. using json-simple-1.1.jar . i tried jsonobject json=(jsonobject)new jsonparser().parse("json_data"); but ended following error aug 31, 2015 2:28:13 source.main.updatedetails doget severe: null unexpected character (j) @ position 0. @ org.json.simple.parser.yylex.yylex(yylex.java:610) @ org.json.simple.parser.jsonparser.nexttoken(jsonparser.java:269) @ org.json.simple.parser.jsonparser.parse(jsonparser.java:118) @ org.json.simple.parser.jsonparser.parse(jsonparser.java:81) @ org.json.simple.parser.jsonparser.parse(jsonparser.java:75) @ source.main.updatedetails.processrequest(updatedetails.java:55) @ source.main.updatedetails.doget(updatedetails.java:107) @ javax.servlet.http.httpservlet.service(httpservlet.java:621) @ javax.servlet.http.httpservlet.service(https

vba - Insert data from a form into a table -

this question exact duplicate of: inserting data form table 1 answer it's been 3 years since have had use vb or vba code. working on project work using microsoft access need take information listed on form , insert table. stuck on last part of code values part. have far. insert volunteers (name, email, number, emergency contact, emergency number) values (and stuck) thank in advance! you want single-record table append query : insert volunteers (name, email, number, emergency contact, emergency number) values ("value1", "value2", "value3", "value4", "value5") assuming constructing sql statement in code-behind of form, can access controls name: dim sql string sql = _ "insert volunteers (name, email, number, emergency contact, emergency number) " & _ "values ("&quo

CSS images path in eclipse -

Image
the following screen shot of project structure , please guide me how specify image path url body { background-image: url(../webcontent/css/expenses2.jpg); } on giving above path jpg file not come background colour. given css folder in same folder expenses.jsp file should able do css/expenses2.jpg so body { background-image: url(css/expenses2.jpg); }

stat - C - size of a file from an absolute path -

question: there means obtain file's size off_t absolute file path when file path relative current working directory not known this may marked duplicate believe sufficiently varys questions such this or this not wish use relative path. like many folk -it appears- fell trap of assuming when looking obtain file information stat() used absolute rather relative (to current working directory) pathnames. have absolute path file need identify size of off_t . second issue discovered absolute pathnames -aside pointing in wrong place- may exceed path_max limits.h ?. the function below found here offers means obtain off_t relative path. return no such file or directory via errno absolute path because uses stat() . #include <sys/stat.h> #include <string.h> #include <stdio.h> #include <errno.h> off_t fsize(const char *filename) { struct stat st; if (stat(filename, &st) == 0) return st.st_size; fprintf(stderr, "cannot

objective c - ios - Control some values of AutoLayout at runtime -

i'm trying implement custom slider , want slider's y position set in auto layout (center y bar) want control x position in code (so = 0 unless it) everything seems fine, everytime auto-layout updates slider's x position goes 0. how can fix that? another thing thought of make reference constraint between slider , bar, problem don't know how make constraint between slider's center , bar's left side.

sql server - Is there a better way to check the database for a unique value that works for both update and insert then below -

if exists(select * mytable (nolock) mytable.recordid <> @recordid , mytable.uniquecolumn = @uniquevalue) begin select 1 end else begin select 0 end note: use nolock checks pending inserts , update (i.e update / changing uniquecolumn) note: use "if exists(" stops search after finding first match note: use "mytable.recordid <> @recordid" not find match. note: if inserting recordid negative 1 or zero. don't know if it's "better", it's more to-the-point: select case when exists ( select * ... ... ) 1 else 0 end isthereornot ...and can used other expressions (if need 'em). note: select * appropriate existence checks, , nolock isn't going change - there's implicit transaction scope of select. i think it's better (easier use results consumers) if name columns (isthereornot in example)

javascript - get top N values' keys of an Object -

demo object: var foo = {a:1, b:2, c:3, d:4, e:5, f:6, g:7} wanted result: (get top 3 keys value) {e:5, f:6, g:7} explenation: for given key/value basic object, how 3 top values, not values keys? keys anything. lets values integers. performance should in mind. you can extract properties array, sort array: var foo = {a:1, b:2, c:3, d:4, e:5, f:6, g:7} var props = object.keys(foo).map(function(key) { return { key: key, value: this[key] }; }, foo); props.sort(function(p1, p2) { return p2.value - p1.value; }); var topthree = props.slice(0, 3); if want result object, reduce one var topthreeobj = props.slice(0, 3).reduce(function(obj, prop) { obj[prop.key] = prop.value; return obj; }, {});

javascript - jQuery click and scroll to next div with class not working -

this simple function i've done not seem want play ball; have ideas? the error i'm getting is: uncaught typeerror: cannot read property 'top' of undefined does not scroll or show hidden div i've asked for. $(document).ready(function() { // show examples $(document).on("click",".show-syntax",function(e){ $(this).next(".render-syntax").show(); $('html,body').animate({ scrolltop: $(this).next(".render-syntax").offset().top}, 'slow'); e.preventdefault(); }); }); /** * github theme * * @author craig campbell * @version 1.0.4 */ pre { border: 1px solid #ccc; word-wrap: break-word; padding: 6px 10px; line-height: 19px; margin-bottom: 20px; position: relative; } code { border: 1px solid #eaeaea; margin: 0px 2px; padding: 0px 5px; font-size: 12px; } pre code { border: 0px; padding: 0px;

python - Numpy array integer / float division -

this question has answer here: python augmented assignment issue 4 answers i found following behaviour in python/numpy strange: in [51]: = np.arange(10, 20) in [52]: = / 10.0 in [53]: out[53]: array([ 1. , 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9]) in [54]: = np.arange(10, 20) in [55]: /= 10.0 in [56]: out[56]: array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) i felt a=a/10.0 , a/=10.0 should return same result. inteded , documented somewhere? the problem a /= 10.0 modifies array in place, , won't change the dtype of array, floats converted integers. on other hand a = / 10.0 created new array, , type can changed if new array being created. from docs : note assignments may result in changes if assigning higher types lower types (like floats ints) or exceptions (assigning complex floats or ints):

android - Cordova's splash screen doesn't show -

i building small mobile app using cordova + angularjs, far good. spent whole day trying splash screen show, , failed. here global config.xml <preference name="fullscreen" value="true" /> <preference name="webviewbounce" value="false" /> <preference name="disallowoverscroll" value="false"/> <preference name="statusbaroverlayswebview" value="false"/> <preference name="detect-data-types" value="true"/> <preference name="stay-in-webview" value="false"/> <preference name="android-targetsdkversion" value="22"/> <preference name="splashscreen" value="screen" /> <preference name="splashscreendelay" value="10000" /> <preference name="loadingdialog" value="loading, please wait!"/> <platform name="android"> <sp

How to convert excel cell to html? -

i've got excel cell contains html content this: what <b>the</b> answer <i>this</i> question? see table <table><tr><td>.... you idea. it's cell intensive purposes contains webpage. i able view cell's content after interpreted browser in way. thinking microsoft web control ideal, i'm not quite sure how go setting actual html of web control. can navigate web pages, i'm not sure how set html equal cell's value. any ideas? with embedded "microsoft web browser" activex control named "wbtest" on worksheet: (code in worksheet module) sub testhtml() showhtml me.range("a1").value end sub sub showhtml(s string) me.wbtest .document.open "text/html" .document.write s .document.close end end sub

jquery - Unable to save Ordering to database - Codeigniter -

i using codeigniter , within trying save ordering of list first drag , drop re-order , click save save reordering. however, list not saved. appreciated. view file: <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <section> <h2>order songs</h2> <p class="alert alert-info">drag order songs , click 'save'</p> <div id="orderresult"></div> <? echo form_button('save', 'save', 'class="btn btn-default" id="save" value="save"')?> </section> </div> </div> </div> <script> $(function() { $.post('<?php echo site_url('admin/songs/order_ajax'); ?>', {}, function(data){ $('#orderresult').html

design - Limiting a value in a user form input -

say if have text box input user key in value. this value passed function, say: f(x,y) = x / y; where x,y user inputs. in case, if y == 0 , divide 0 error occur. my question practice, section of code should responsible error checking? it 1) read text box value, automatically change value else if equal 0. or 2) when 0 passed function f(x,y) , within function, handle potential divide 0 error. you want errors apply (such divide 0 error) caught function itself. don't want use function in different part , need rewrite same error checking (or worse, forget to).

ios - RLMArray<> returns different instances each time -

@realm: why rlmarray gives different instances of objects @ runtime? this how defined rlmarray: @property rlmarray<houseimage> *images; i add/remove houseimage objects array time (in transactions). when i'm accessing images as: _house.images[indexpath.row] every time different instances i.e. (lldb) p _house (rlmaccessor_v0_house *) $52 = 0x00000001701a5780 2015-08-30 23:02:07.695 apt note[5992:1308601] loading image named: 1c178a31-5f33-4cd3-9b7c-b026df7a5e19_2 2015-08-30 23:02:07.731 apt note[5992:1308601] loading image named: cfd99689-12c4-49cb-aab6-850ffcd902d7_3 2015-08-30 23:02:07.750 apt note[5992:1308601] loading image named: 194d55ea-125a-4cfc-8ccf-758e929be7d5_4 // first time when iterating array. [house] object remains same, not images array items. (lldb) p _house (rlmaccessor_v0_house *) $53 = 0x00000001701a5780 (lldb) p _house.images[0] (rlmaccessor_v0_houseimage *) $54 = 0x00000001740bbf60 2015-08-30 23:02:36.947 apt note[5992:1308601] loadi

How to pass an array created in javascript to another jsp and then use that array in a java function on that jsp? -

here script have , want able pass array "playernames" java function on .jsp. i'm wonder how pass array page , retrieve java function. <script> function getplayernames() { var selected = document.queryselectorall("#selected-players > tr > td"); var playernames = []; for(var i=0; i<selected.length; ++i){ var id = selected[i].getattribute('id'); if (id.indexof('player')>-1) { playernames.push(selected[i].textcontent); } } } </script> edit: <td style="vertical-align: top;"><button onclick="getplayernames()"id="generate">generate</button><br></td> <input type="hidden" id="players" /> <script> function getplayernames(){ var selected = document.queryselectorall("#selected-players > tr > td"); var playernames = []; for(var i

Show debug toolbar on Android Monitor Android Studio 1.4 preview 3 -

ok... i'm sure able on previous versions. want able step while watching logcat @ same time. on separate panes. there way show debug toolbars step options on android monitor/logcat tab? right can detaching , resizing panes painful. or can "lock" debug toolbar on side of screen somewhere? btw. know using split debugger tab , logcat tab full size.

ios - Core Data Light weight Migration Issue -

i have did light weight migration in app using following link. http://code.tutsplus.com/tutorials/core-data-from-scratch-migrations--cms-21844 it works fine till have old app, when uninstalled existing app , installed again new added field not working. gives following error. -[table setcolumnname:]: unrecognized selector sent instance 0x16e523c0

android - Response handling with Volley -

i using volley in project handling network requests. here sample json server returns json object response {"code":"success", "data":{"some data"}} json array response {"code":"success", "data":["some data"]} when validation error or other error occurs, server returns following response: {"code":"failed", "error":"access denied"} the problem parsing data. when request successful, in onresponse of responselistener , content of data key. as, expecting result same posted above. not getting why volley returning content of data , not complete json . had used volley earlier also. never faced such type of problem. parsing code: private void getonboardingcategories() { response.listener<jsonarray> responselistener = new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) {

How to Cluster Sequential Categorical Data in R -

consider data set users can choose among 3 activities, , have data choice of first 10 activities. example data: for (i in 1:10) { # sample list of 3 strings using set probability x <- sample( c("a", "b", "c"), 1000, replace=true, prob=c(0.5, 0.3, 0.2) ) # assign variable created on fly assign( paste("cat", i, sep=""), x ) } first10 <- data.frame(cat1, cat2, cat3, cat4, cat5, cat6, cat7, cat8, cat9, cat10) what's best approach in r cluster users according activity sequence? i've looked around on stackoverflow, , similar questions ask how cluster categorical data in r (which part of analysis), in , of doesn't account sequential nature of data. there r packages well-suited analysis? look frequent itemset mining instead of clustering. most clustering methods continuous numerical data, , assume vector field. take every position account. a frequent pattern, however, may part if sequence, sequ

javascript - How to open data uk modal on page load -

i using data-uk-modal open modal box open perfect when click on button want open when page load, have tie following code <button class="md-btn md-btn-success" data-uk-modal="{target:'#my_id'}">open dialogue</button> <div class="uk-modal" id="my_id" > <div class="uk-modal-dialog"> <div class="uk-modal-header"> custom content here </div> </div> <div class="uk-modal-footer uk-text-right"> <button type="button" class="md-btn md-btn-flat uk-modal-close">close</button> </div> </div> this js code please tell me how can open diwlogure box on page load give button id , trigger click on page load. html <button class="md-btn md-btn-success" id="openmodal" data-uk-modal="{target:'#my_id'}">open dialogue</button>

call Function in specific time interval using pthread in linux c++ -

i want call function in specific time (2 micro second) interval using pthread in linux c++. i want call function inside pthread till specific condition occur after rest of code inside thread run. procedure occur continue. please give solution or example code ?? usleep use loop , call function, after/before it, put usleep . the usleep() function suspends execution of calling thread (at least) usec microseconds. sleep may lengthened system activity or time spent processing call or granularity of system timers.

Docker Debian apt Error Reading from Server -

it seem apt-get having issues connecting repository servers. suppose compatibility issues, mentioned here , proposed solution of apt-get clean not work me. surprised, if case, there not more people having issue. mwe dockerfile from debian:jessie run apt-get clean && apt-get update && apt-get install -y --no-install-recommends \ git $ docker build . docker build . sending build context docker daemon 2.048 kb step 0 : debian:jessie ---> 4a5e6db8c069 step 1 : run apt-get clean && apt-get update && apt-get install -y --no-install-recommends git ---> running in 43b93e93feab get:1 http://security.debian.org jessie/updates inrelease [63.1 kb] ... omitted ... get:6 http://httpredir.debian.org jessie-updates/main amd64 packages [3614 b] fetched 9552 kb in 7s (1346 kb/s) reading package lists... reading package lists... building dependency tree... reading state information... following packages installed: ... omitted ... 0 upgraded,

actionscript 3 - Why are my numeric stepper values so far out past the decimal point? -

i'm using flex 4.6 spark numeric stepper in app , when enter .9 returns, "0.9000000953674316". can enter value actually. doing of them. if use arrow buttons moves 0 1 sets value "0.09999990463256836". update: running more tests. if start , 0 , go down it's: 0 -0.1 -0.2 -0.30000000000000004 -0.4 and if go it's: -0.30000000000000004 -0.20000000000000004 -0.10000000000000003 -2.7755575615628914e-17 nan here formatter code: precision = 100; public function formatnumericstepper(value:number):string { return string(int(value*precision)/precision); } note: value gets stuck @ -.7 or .28. works fine whole numbers it's buggy heck numbers less one. or i'm doing wrong. with finessing , helpful direction @dodgerthud following seems working: mxml: <s:numericstepper id="numericstepper" snapinterval="0" stepsize=".01" valueformatfunction="formatnumericstep

angularjs - Best practice of Rails + Angular e2e tests -

we developing enterprise (single page) application using rails back-end , angular front-end. we don't have problem regarding back-end tests writing integration tests angular not easy. have simulate back-end api. what best practices functional/integration/e2e tests of front-end of single page application?

python - How can I avoid this "variable referenced before assignment"? -

this question has answer here: assigning variable parent function: “local variable referenced before assignment” [duplicate] 5 answers ran following problem. it's simple solution, , has been asked here before, couldn't find it. def a(): lia = [] def b(): in lia: += 1 lib = generatelist() in lib: -= 1 lia = lib def generatelist(): return [1,2,3,4] b() a() unboundlocalerror: local variable 'lia' referenced before assignment lia variable in b() function never initialized. so, should edit code in followed way: def a(): lia = [] def b(lia): in lia: += 1 lib = generatelist() in lib: -= 1 lia = lib def generatelist(): return [1,2,3,4] b(lia) a() hope helped yo

java - Using Eclipse JDT to find all identifiers visible within a specific node -

i'm working on plug-in eclipse jdt parses java files , offers automatic corrections them. i'm doing using eclipse's api analyzing ast. i'm trying write method calculates environment of method - list of identifiers visible within scope of method. way @ list of identifiers can auto-completed specific point in eclipse. for example: import ... public class myclass { private static final int = 3; private boolean b; float somemethod(string s) { int c = 3; (x); } } the environment in (x) composed of identifiers a , b , c , s . how can calculate environment of method in eclipse? you have obtain icompilationunit class want parse. can make visitors node types need, methoddeclaration . public class mainmethodvisitor extends astvisitor { list<methoddeclaration> methods = new arraylist<methoddeclaration>(); @override public boolean visit(methoddeclaration node) { ... //do stuff node

csv - How to convert xls encoded number in php -

this question has answer here: display float value w/o scientific notation 4 answers i working on csv import functionality.but while creating csv using ms excel, ms excel converts 806842000000 8.07e+11. how can convert 8.07e+11 806842000000 in php. thanks in advance. you can't, actually. 8.07e+11 means 8.07 * 10^11 whitch 807000000000. excel has rounded number , lost precision. you can stop excel doing - change column type text before saving cvs. text fields don't rounded.

css - Hi Help for the following javascript issue -

i have issue following code safari browser(8.0/7.2) in macbook pro os x 10.x. working when stop page redirect next page or press "esc" button or when run javascript code in debug mode. working fine versions of browser. tried opacity possibility. <script> function myfunctio(){ document.getelementbyid("waiting_popup").style.display = "block"; document.getelementbyid("waitingdiv").style.display = "block"; } </script> <style type="text/css"> .popupboxbg{ display: none; background-image: url("/shared/wallet/images/common/bgcover.png"); background-repeat: repeat; top: 0; left: 0; position:fixed; vertical-align: middle; z-index:10; min-width:100%; min-height:100%; } .popupboxdiv{ display: none; width:300px; border:3px solid #6495ed; background-color:#ffffff;

AWK array from split not sorted -

i have (demo) text in variable arttext. {1}: reporting problems , bugs. {2}: other freely available awk implementations. {3}: summary of installation. {4}: how disable gawk extensions. {5}: making additions gawk. {6}: accessing git repository. {7}: adding code main body of gawk. {8}: porting gawk new operating system. {9}: why derived files kept in git repository. it 1 variable lines delimited indent. indent = "\n\t\t\t"; i want loop through lines , check in each line. so split array using indent split(arttext,lin, indent); then loop through array lin l = 0; (l in lin) { print "l -- ", l, " lin[l] -- " ,lin[l] ; } what lines of arttext beginning in line #4 l -- 4 lin[l] -- {3}: summary of installation. l -- 5 lin[l] -- {4}: how disable gawk extensions. l -- 6 lin[l] -- {5}: making additions gawk. l -- 7 lin[l] -- {6}: accessing git repository. l -- 8 lin[l] -- {7}: adding code main body of gawk. l -

variable comparision in a batch file -

i have batch file in need call 2 other batches depending on condition. , condition is, have 2 variables in text file (two strings. eg:2016janfcst , 2016febfcst). have t0 read these 2 variables batch , check if these 2 equal. , if these 2 variables equal have call 1 batch else other one. can let me know how can achieved? below have tried @echo off setlocal enabledelayedexpansion set vidx=0 set var1=a set var2=b /f "tokens=*" %%a in (d:testing.txt) ( set /a vidx=!vidx! + 1 set var!vidx!=%%a ) echo !var1! echo !var2! if !var1! == !var2! goto :success else goto :failure but it's giving me error syntax of command incorrect i think if/else off. i got run following: if !var1! == !var2! ( goto :success ) else ( goto :failure ) here's looked: http://ss64.com/nt/if.html

sql server - Find the tables affected by SQL injection -

recently, discovered 1 of our aspx handlers targeted sql injection attack. made possible fact took substring of url starting @ index x until end of url string , matched records in database made easy attackers. here example of injection performed: ;declare @c cursor; declare @d varchar(4000); set @c=cursor select 'update ['+table_name+'] set ['+column_name+']=['+column_name+']+case abs(checksum(newid()))%7 when 0 ''''+char(60)+''div style="display:none"''+char(62) +''are abortions safe '' +char(60)+''a href="http:''+char(47)+char(47) +''www.ooblong.com''+char(47)+''blog''+char(47) +''template''+char(47)+''page''+char(47)+''abortion-clinics-nyc.aspx"'' +char(62)+case abs(checksum(newid()))%3 when 0 ''reasons against abortion'' when 1 ''pregnant abortion''

java - Set values of multiple lists which are received from different sql queries in same refcursor -

i have stored procedure outputs ref cursor. the stored proc. contains 2 different queries, each of returns list. say, query1 returns list of serial_numbers. query2 returns list of serial names. how should set these 2 lists in same ref cursor variable . when retrieve refcursor in java should refcursor[0] => serial_number refcursor[1] => serial_names each of these objects contains respective list.

android - java.lang.NoClassDefFoundError: org.apache.http.impl.conn.PoolingHttpClientConnectionManager -

i have create 1 demo based on mashape api call.but error.i tried lots of suggestion.but not solution. java code: public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); new callmashapeasync().execute(); } private class callmashapeasync extends asynctask<string, integer, httpresponse<jsonnode>> { protected httpresponse<jsonnode> doinbackground(string... msg) { httpresponse<jsonnode> request = null; try { request = unirest.get("https://indianpost.p.mashape.com/getoffices.php?pincode=394101") .header("x-mashape-key", "my api") .header("accept", "application/json") .asjson(); } catch (unirestexceptio

html - How to show/edit URL in this approach using jquery -

this form it's working. <form id="form1" runat="server"> <input type='file' id="inputfile" /> <img id="image_upload_preview" src="http://placehold.it/100x100" alt="your image" /> </form> this jquery , working: function readurl(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('#image_upload_preview').attr('src', e.target.result); } reader.readasdataurl(input.files[0]); } } $("#inputfile").change(function () { readurl(this); }); i want happen url shows below , can edit(so uploaders can edit url) like: check image: http://i.stack.imgur.com/tsobg.jpg jsfiddle: http://jsfiddle.net/lesson8/9nexg/light/