Posts

Showing posts from July, 2014

assign number every time an event occurs in r -

i have data: t <- c(na,na,na,1,na,na,na,na,1,na,1) dt <- data.table(t) t 1: na 2: na 3: na 4: 1 5: na 6: na 7: na 8: na 9: 1 10: na 11: 1 is possible create new column z , assign number in ascending order every time 1 occurs in t column, this: t z 1: na na 2: na na 3: na na 4: 1 1 5: na na 6: na na 7: na na 8: na na 9: 1 2 10: na na 11: 1 3 thank you we can create logical index of non-na elements in 'i' , assign ('z') sequence of 't' dt[!is.na(t), z := seq_along(t)] dt # t z # 1: na na # 2: na na # 3: na na # 4: 1 1 # 5: na na # 6: na na # 7: na na # 8: na na # 9: 1 2 #10: na na #11: 1 3

reporting services - Bar Chart with Vertical Axis Max value set but can't see data label -

Image
i have report have set max value axis range. once rendered , bar graph has exceeded max value axis can't see data labels. have tried playing smart labels no avail. how can see data label bar graph once exceeds max value axis? increase max value on vertical axis (or set auto)?

How do I read Element in specific XML file in C#? -

my file xml: <document xmlns="http://www.abbyy.com/finereader_xml/finereader10-schema-v1.xml" version="1.0" producer="abbyy finereader engine 11" languages="" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.abbyy.com/finereader_xml/finereader10-schema-v1.xml http://www.abbyy.com/finereader_xml/finereader10-schema-v1.xml"> <page width="1006" height="636" resolution="300" originalcoords="1" rotation="rotatedupsidedown"> <block blocktype="text" blockname="" l="979" t="613" r="1006" b="636"><region><rect l="979" t="613" r="1006" b="636"/></region> <text> <par linespacing="890"> <line baseline="17" l="985" t="620" r="1006" b="636"

android - Removing Sherlock Actionbar library Theme not found -

i have removed actionbarsherlock library , adapted code. errors in style.xml <style name="theme.mytheme" parent="theme.sherlock.light"> what have use instead of sherlock.light theme? if using appcompat library, use appcompat.light @style/theme.appcompat.light else try using holo.light. @android:style/theme.holo.light

in need of an arduino i2c lcd libary -

i have uno r3 atmega328 can't seem match i2c lcd library (i have 20x4 lcd). see websites offer broken links. can tell me can right library at? ide should using board windows 7? all you'll need wire library (included w/ arduino ide) , library lcd here

JavaFX: Run ChangeListener -

ho can run change method inside changelistener in initialization. since run when changes happen. example have textfield want set it's value 0 when it's empty, , this: textfield.textproperty().addlistener(new changelistener<string>() { @override public void changed(observablevalue<? extends string> observable, string oldvalue, string newvalue) { if (!newvalue.matches("\\d*")) { textfield.settext(newvalue.replaceall("[^\\d]", "")); } if (newvalue.isempty()) textfield.settext("0"); } }); but @ start of application changed method not called. how work around issue? there's no way access listener added property. keep reference it: changelistener<string> textfieldlistener = (observable, oldvalue, newvalue) -> { if (!newvalue.matches("\\d*")) { textfield.settext(newvalue.replaceall(

javascript - Make navbar responsive without changing custom css and effects -

i created site using jekyll , used this theme. however, problem site navbar has links, not collapse when opening website in mobile. in all, navbar not responsive @ all. want make responsive, without changing css. should do? site has bootstrap , jquery included. this header html code: <header class="site-header"> <div class="container"> <a id="site-header-brand" href="/" title="xyz"> site title </a> <nav class="site-header-nav" role="navigation"> <a href="/" class=" site-header-nav-item hvr-underline-from-center" target="" title="home"> home </a> </nav> </div> </header> and here css: .site-header{ padding-top:20px; padding-bottom:20px; width: 100%; posi

list - MySql select all records and show in a single column with comma seperator -

this question has answer here: php mysql group concat , group by 2 answers my mysql table this; id name 1 test1 2 test2 3 test3 and want write tsql , list them this; test1,test2,test3 is possible? thanks. in mysql, can use group_concat this: select group_concat(name separator ',') table;

sas variable difference with same id -

i appreciate lot guys, when got problems modulating sas . i have data set follows. id key score 10002817 200207826243 0 10002817 200207826271 0 10002817 200208532180 0 10002976 200301583978 0 10003685 200302311690 0 10006588 200401613047 0 10006588 200502882618 0 10009377 201007510866 1 10009377 201111777969 0 10011044 200801328219 2 10011044 200803290654 3 10011044 200803290728 1 10011044 200803290905 1 10011044 200803291161 0 sometimes id repeated in data or not. want see maximum difference in score according id. is, form followings. id key score diff_score 10002817 200207826243 0 0 10002817 200207826271 0 0 10002817 200208532180 0 0 10002976 200301583978 0 0 10003685 200302311690 0 0 10006588 200401613047 0 0 10006588 200502882618 0 0 10009377 201007510866 1 1 10009377 201111777969 0 1 10011044 200801328219 2 3 10011044 200803290654 3 3 10011044 200803290728 1 3 10011044 200803290905 1 3 10011044 200803291161 0 3 how can make sas?

python - How do I repeat a for loop while maintaining values from the previous for loop? -

i have written function gradient descent , stuck on figuring out how repeat loop "iters" times. x 2d array , y 2d array. y target value , x data corresponds target value. want iterate through both simultaneously hence zip() in loop, want able repeat iterating through x , y updated coefficients. i tried wrapping loop in while loop, error saying zip argument #2 must support iteration. i'm assuming happening once loop iterates through 2 ndarrays, compiler cannot "reset" , loop through arrays again. correct , how fix this? def gradient_descent_lr(x,y,alpha,iters): x_coef = 0 y_int = 0 coef_list = [] x, y in zip(x,y): #evaluate func (0 first) f_eval = (x_coef * x) + y_int #find error error = f_eval - y #update coefficients y_int = y_int - (alpha*error) #adjust bias coefficient error x_coef = x_coef - (alpha*error*x) coef_list.append((float(y_int),float(x_coef))) return coef_list

ios - Getting objects from NSSet and populating TableView -

i have piece of code shown below func getitemsonlist(){ let app = uiapplication.shared.delegate as! appdelegate let context = app.persistentcontainer.viewcontext //fetchrequest list let fetchrequest = nsfetchrequest<nsfetchrequestresult>(entityname: "list") let predicate = nspredicate(format: "title == %@", listname) fetchrequest.returnsobjectsasfaults = false fetchrequest.predicate = predicate if let fetchresults = try? context.fetch(fetchrequest){ if fetchresults.count > 0 { listentity in fetchresults { let list = listentity as! list print(list.title any) itemsonlistset = list.contains! what gets items specified list using .contains relationship between 2 entities, , saves items in nsset. what want populate tableview objects in nsset. is there function related nsset allows me items set? or should save items in array instead of nsset. p.s. .

Max size for keys in cassandra table with cfstats -

problem: i know max size (and average size) of data partitionkey in cassandra table. what did far: cfstats gives many information. keyspace: my_keyspace read count: 0 read latency: nan ms. write count: 1 write latency: 0.289 ms. pending flushes: 0 table: my_table sstable count: 1 space used (live): 63915 space used (total): 63915 space used snapshots (total): 0 off heap memory used (total): 258 sstable compression ratio: 0.21345907193641897 number of keys (estimate): 24 memtable cell count: 13 memtable data size: 406 memtable off heap memory used: 0 memtable switch count: 0 local read count: 0 local read latency: nan ms local write count: 1 local write latency: 0,289 ms

how to load image as base layer for further drawing in openlayer 3 -

how load selected image base layer further features point/polygon/shape draw onto it. of examples shown on openlayer website, using "ol.source.osm" base layer source. don't want use osm based layer. an example of loading custom images can found in openlayers site, under image load event . you have take care format of picture want load. didn't provide more information, use single, untiled image wms server. the following snippet part of code should you. var map = new ol.map( { layers: [ new ol.layer.image( { source: new ol.source.imagewms( { url: 'https://ahocevar.com/geoserver/wms', params: { 'layers': 'topp:states' }, servertype: 'geoserver' } ) } ) ], target: 'map', view: new ol.view( { center: [-10997148, 4569099], zoom: 4 } ) } ); <script src="https://openlayers.org/en/v3.20.1/build/ol.js">

angularjs - Restangular post in loop -

i need call list of restangular.post inside of loop, add many user (for example) i have factory that: createuser (user) { return restangular.all(url).post(user); } then in controller in need call factory inside of loop: for( var in users){ createuser(us); } the problem cant this! add last user object!, how $q.all() using restangular, or there other solution?? okay problem small. the problem call createuser function inside loop. loop continues execute post request not gets fulfilled. , hence last user object saved only. so can do: you have make recursive function when first objects saved call same function second object , on. or you can try callback function . please read first how callback function works. here used callback function. may you. function createuser(userobject, cb){ restangular .all(url) .post(user) .then(function (response){ if(response){ cb(null, response); //user created.. callback function }else{ cb

cq5 - Which tool you are using to format the xml in aem dialogs? -

i try external formatters, broke dialog structure. you can use any online editors :: code beautify , xmlformatter , free formatter , xmlbeautifier , etc,. or some tools :: notepad++ , brackets , sublime editor, etc,. or browser plug-ins :: chrome , firefox , etc,.

Chrome extension: Get browser logged in user -

i want logged user/people (into chrome app itself, not google service; litt) email address. this chrome.identity.getprofileuserinfo(function(userinfo) { console.log(userinfo) }); returns shows user , id empty. do?

java - Maven- Could not resolve dependency -

i beginner in using maven.. tried add grobid (for pdf parsing) in maven. dependency gave : <dependency> <groupid>org.grobid</groupid> <artifactid>grobid-core</artifactid> <version>0.3.4</version> </dependency> but on building pom shows following error: [error] failed execute goal on project miner: not resolve dependencies project miner:war:1.0-snapshot: failed collect dependencies @ org.grobid:grobid-core:jar:0.3.4 -> org.chasen:crfpp:jar:1.0.2: failed read artifact descriptor org.chasen:crfpp:jar:1.0.2: not transfer artifact org.chasen:crfpp:pom:1.0.2 from/to 3rd-party-local-repo (file:///${basedir}/lib/): repository path /${basedir}/lib not exist, , cannot created. -> [help 1] i have gone through different questions related..i tried after adding pom etc. still not working.. why error comes..do have codes grobid..? add below repository in pom or .m2/settings.xml <repositories> <rep

php - Create a function to output a category hierarchy into a select drop down form input by passing the $categories array to the function -

create function output category hierarchy select drop down form input passing $categories array function. the given set array of data: $categories = array( 1 => array(‘id’ => 5,‘name’ => ‘fruits’,‘sort’ => 0,‘parent’ => 0), 2 => array(‘id’ => 6, ‘name’ => ‘donuts’,‘sort’ => 1,‘parent’ => 7), 3 => array(‘id’ => 7, ‘name’ => ‘hard candy’,‘sort’ => 0,‘parent’ => 11), 4 => array(‘id’ => 8, ‘name’ => ‘pears’,‘sort’ => 3,‘parent’ => 1), 5 => array(‘id’ => 9, ‘name’ => ‘apples’,‘sort’ => 1,‘parent’ =>1), 6 => array(‘id’ => 18, ‘name’ => ‘oranges’,‘sort’ => 4,‘parent’ => 1), 7 => array(‘id’ => 19, ‘name’ => ‘sweets’,‘sort’ => 2,‘parent’ => 0), 8 => array(‘id’ => 20, ‘name’ => ‘red delicious’,‘sort’ => 5,‘parent’ => 5), 9 => array(‘id’ => 21, ‘name’ => ‘granny smith apples’,‘sort’ => 8,‘parent’ => 5), 10 =>

ajax - javascript keyboard functions -

how can make function when press down example "a" key on keyboard pushes down on , sends out signal nupp('/ts'). on "a" key relase should top sending signal nupp('/ts'). <html> <head> <script src=\"https://code.jquery.com/jquery-2.2.4.min.js\"></script> <script> client.println("function nupp(url){ $.ajax(url); }"</script> <button type=\"button\" onclick=\"nupp('/ts');\">on</button> </head> <body> you can this: function checkkeydown(key) { if (key.keycode == "38") { $.ajax("/f"); } else if (key.keycode == "37") { $.ajax("/l"); } else if (key.keycode == "39") { $.ajax("/r"); } else if (key.keycode == "40") { $.ajax("/b"); } } function checkkeyup(key) { if (key.keycode == "38"

windows - Access denied for unload HKU registry -

i loading particular user profile using sid change 1 field , after changes trying unload loaded registry ,but getting "error: access denied." while trying unload registry. reg load hku\s-1-5-21-1286830622-92648133-863679050-1002 c:\users\user\ntuser.dat reg add hku\s-1-5-21-1286830622-92648133-863679050-1002\software\microsoft\windows\currentversion\policies\system /v shell /t reg_sz /d "myapplication.exe" reg unload hku\s-1-5-21-1286830622-92648133-863679050-1002

javascript - Locking the scroll(onmousewheel="false") in X3D model -

how lock mousewheel in x3d model in html? <x3d showstat="false" showlog="false" x="0px" y="0px" width='750px' height='600px'> <scene> <viewpoint position="0 0 0" orientation="1 1 1 2"></viewpoint> <matrixtransform id="teapotrotation"> <inline namespacename="deer" mapdeftoid="true" onclick='handlegroupclick(event);' url="new.x3d"/> </matrixtransform> </scene> </x3d> you can use navigationinfo restrict movement in scene. " type " parameter need use: "examine" best rotating solitary objects "fly" allows zooming in, out , around "walk" allows exploration, on ground "lookat" use pointer select geometry of interest "any" lets user select mode "none" gives user 0 control of navigation

tcpdf - PHP code to read and delete page from pdf file -

i have system generates pdf files, each file consists of 2 pages. reason need write php code can delete second page each pdf file. herer i've done , results: 1- used tcpdf library write folowing code: require_once('tcpdf-master/examples/tcpdf_include.php'); require_once('tcpdf-master/tcpdf_import.php'); $pdf = new tcpdf_import( 'test.pdf' ); if (@file_exists(dirname(__file__).'/lang/eng.php')) { require_once(dirname(__file__).'/lang/eng.php'); $pdf->setlanguagearray($l); } $pdf->deletepage(2); $pdf->output('test_output.pdf', 'i'); the result: blank 1 page pdf file. in other words, content original file not available in new file 2- used fpdf , fpdi libraries read 1 page original file. require_once('fpdf-master/fpdf.php'); require_once('fpdi-1.6.1/fpdi.php'); $pdf = new fpdi(); $pagecount = $pdf->setsourcefile('test.pdf'); $tplidx = $pdf->importpage(1, '/mediabo

angular - Using @ngrx/store and @ngrx/core with System.js module loader -

in order use @ngrx/store [ 2.2.1 ] , @ngrx/core [ 1.2.0 ] state management in sample angular 2 [2.4.0] application followed below steps installed @ngrx/store [ 2.2.1 ] , @ngrx/core added below import root module import { storemodule } '@ngrx/store'; 3 added below code in packages section of systemjs.config.js file '@ngrx/core': { main: 'bundles/core.umd.js', format: 'cjs' }, '@ngrx/store': { main: 'bundles/store.umd.js', format: 'cjs' } i getting below error in browser console , when browse website failed load resource: server responded status of 404 (not found) " http://localhost:62818/@ngrx/store/bundles/store.umd.js " any idea needs modified fix issue. as @ estus mentioned , path issue . adding below lines map section correct path resolved issue '@ngrx/core': 'node_modules/@ngrx/core/bundles/core.umd.js&

android - how to change multiple text on button on button click and how to store that text in database -

this code text change, need know how change multiple text on button on button click , how store text in database. can help? public void onbuttonclick(view v) { btn3 = (button) v.findviewbyid(r.id.btn2); if ( count==0) { btn3.settext("a"); btn3.setbackgroundcolor(color.parsecolor("#e20d10")); count = 1; } else if (count == 1) { btn3.settext("l"); btn3.setbackgroundcolor(color.parsecolor("#0d1be2")); count = 2; } to save value db follow code sqlitedatabase db; db=openorcreatedatabase("mydb",mode_private,null); db.execsql("create table if not exists table(col_name varchar(20))"); db.execsql("insert table values("+bt3.gettext().tostring()+")");

php - Three Dimensional Array Changing -

i'm calling 3 dimension array api, after different calls api data different, array keys change. example first array may relate type 1 in 1 case, whereas in case relates type two. it's laid out array ( [id] => [stats] => array ( [0] => array ( [type] => [option] => [modifydate] => as stated before relates different types, there way of getting array based on inside of it, example if "type" in first array equals type 1 assign variable type1? perhaps in better example, in scenario 1 shows this: array ( [summonerid] => 39562006 [playerstatsummaries] => array ( [0] => array ( [playerstatsummarytype] => aramunranked5x5 [wins] => 4 [modifydate] => 1481110651000 [aggregatedstats] => array

angular - ion-tabs vs using child-components as tabs -

what advantages, disadvantages of both methods? i've tried using ion-tabs show 2 different tabs when tried push new view did not require tabs, transition buggy. it first show blank screen , view slide in right. same when pop navcontroller stack. show blank screen , previous page slide in left. so work around use child components own tabs trigger component show. there performance issues method? above problem have fix? right biggest issue scroll position remains same when switch between 2 tabs. ie. when scroll way bottom of first tab , switch second tab, second tab scrolled way bottom. idea keep track of scroll position , when user switches tabs, know he/she @ , scroll accordingly. see problems this? love follow best practices.

How to write while loop with responseInputStream.read in kotlin android - - while ((i = responseInputStream.read(byteContainer)) -

Image
this question has answer here: best way translate java code kotlin 2 answers how use while loop responseinputstream.read in kotlin android here added responseinputstream read while loop .kt val responseinputstream = conn.inputstream val responsestringbuffer = stringbuffer() val bytecontainer = bytearray(1024) var i: int while ((i = responseinputstream.read(bytecontainer)) != -1) { responsestringbuffer.append(string(bytecontainer, 0, i)) } log.w("tag", "res :" + responsestringbuffer.tostring()) kotlin don't java, can't composing multi-expression in single line. should break one-line expressions multi-lines, example: while(true){ val i= responseinputstream.read(bytecontainer); if(i==-1) b

ios - How to use glVertexAttribPointer function in Swift 3? -

when working buffers , vertex attributes in opengl es (3.0) , objective-c use glbufferdata(gl_array_buffer, sizeof(attributes), attributes, gl_dynamic_draw); to load vertex data (attributes) buffer, , then glenablevertexattribarray(0); glvertexattribpointer(0, sizeof(vertexcoordinatesstruct) / sizeof(glfloat), gl_float, gl_false, sizeof(vertexattributesstruct), 0); glenablevertexattribarray(1); glvertexattribpointer(1, sizeof(texturecoordinatesstruct) / sizeof(glfloat), gl_float, gl_false, sizeof(vertexattributesstruct), (void *)sizeof(vertexcoordinatesstruct)); to specify vertex data memory layout in buffer vertex shader. notice how cast sizeof(oglvertexcoordinates) void* in second glvertexattribpointer call. if offset in gl_array_buffer @ texturecoordinatesstruct data lying. and i'm trying implement same exact type of code in swift 3. glvertexattribpointer function takes unsaferawpointer last parameter, not void*. and problem can't solve: i'm unable crea

javascript - interate through nested json file using ng-repeat not working -

so have json file nested elements. json file: [ { "qid": "1", "contester": "0", "answer": "0", "question": "what after getting argument? ", "images": [ { "qid": "1", "imageid": "ab100", "imgname": "doghug_q1", "imgpath": "images\/q1\/doghug_q1.jpg" }, { "qid": "1", "imageid": "ab101", "imgname": "eq_q1.jpg", "imgpath": "images\/q1\/eat_q1.jpg" }, { "qid": "1", "imageid": "ab102", "imgname": "headache_q1", "imgpath": "images\/q1\/headache_q1.jpg"

bash - reference array of folders without variable -

if can actual folder array to: myarray=./* and can count elements of array this: ${#myarray[@]} how can without assign variable? this: ${#./*[@]} bash not have anonymous arrays. have create , populate array variable, then apply parameter expansion operator it. said, there alternatives using array; @sorontar provides 1 feasible.

automation - Selenium check for selecting and clicking an element in dropdown -

Image
i had written selenium command via ide clicking element in drop-down. tried selecting element via id , passing label value there no success. tried click element via copying xpath ide not select on play though highlights step in green. since drop-down hidden on first load tried passing id of active 1 here no success well. can me solve problem ? try value instead of label : command: select target : id = weekwisecycleid value : value=30076 let me know if worked ;)

Two-way OOP design-pattern -

this kind of general question, let me formulate in particular scenario. coding pricing system. in 1 hand there several "engines", on other, several "instruments". created class hierarchies both of them. my problem comes want implement pricing mechanism. given specific engine , specific instrument, determine algorithm calculate price. nice code in 2-entries table. both instances contain vital information, none seems more important other. in oop methods belong 1 class, see no decent design deal this: "pricing" method should in instruments class, or engines? whatever way go have same problem. suppose decide should in engines. then, inside pricing methods should have 'if-then-else' instruction dealing each possible instrumentclass? seems way ugly (and tight coupling!), specially if going have check like isinstance(inst, instrclass1) i can imagine similar situations arise in many contexts. best design-pattern deal them? rephrased vehicle +

gradle - Android Data binding debugging -

i'm starting android's databinding tools every time come run program build error my.package.databinding not exist. error get: error:(15, 47) error: package a.b.c.d.databinding not exist the try review bindings , find problem. process slow , slower use more bindings. is there way build process or gradle tells me probelm code , why could'nt create binding classes. thanks. the best place report b.android.com. we've received reports when there java code mistake, sometimes, not build binding files wrong struggling reproduce it. so if can create bug report w/ project reproduce, we'll try fix asap.

angularjs - Errors with .passThrough() using angular E2E -

i trying test real api using angular mocke2e, getting errors using .passthrough function. here code: describe('simple test', function () { var $controller, $httpbackend; beforeeach(module('uca-app')); beforeeach(inject(function ($rootscope, _$controller_, _$httpbackend_, _signupservice_, _userservice_) { $controller = _$controller_; $httpbackend = _$httpbackend_; signupservice = _signupservice_; userservice = _userservice_; $scope = $rootscope.$new(); $httpbackend.whenget('http://localhost:2684/api/account/getpasswordpolicymessage').passthrough(); })); }); which returns error: error: unexpected request: http://localhost:2684/api/account/getpasswordpolicymessage the method trying test runs default on controller, when change passthough expect so: $httpbackend.expectget('http://localhost:2684/api/account/getpasswordpolicymessage').passthrough(); i error: typeerror: $httpbackend.exp

datastax - Issue with blobs (Cassandra driver, Python) -

as part of testing, i'm using cassandra python driver trying select , delete rows on 1 of tables generated cassandra stress tool (standard1, on keyspace1). standard1 consists of several blob columns. my approach extract (primary) key rows , run loop delete rows based on that. the problem i'm facing looks cassandra driver converts blobs (hex bytes) strings, when try pass delete statement fails "cannot parse 'xxxxxx' hex bytes". the data in table on cqlsh looks "0x303038333830343432", whereas below select extracts keys as, i.e., '069672027'. is there way of preventing hex bytes being converted strings? other approach should using? thanks! query = simplestatement("select (key) \"standard1\" limit 10", consistency_level=consistencylevel.local_quorum) rows = session.execute(query) row in rows: query = simplestatement("delete \"standard1\" key = %s", consistency_level=consistencylevel.lo

javascript - Removing properties in mapStateToProps -

i'm wrapping material textfield redux component. of properties should used in mapstatetoprops , not passed component itself. otherwise, i'm getting unknown prop warning. specifying undefined value doesn't help. function mapstatetoprops(state = {}, ownprops) { var datakey = ownprops.datakey; return { value: state[datakey], datakey: undefined } } const store = createstore(reducer, {stuff: 123}); const todraw = <textinput datakey="stuff"/> jsfiddle is there simpler way remove ownprops in mapstatetoprops rather creating wrapper component? you supplying function connect's 3rd argument mergeprops , defaults to: function mergeprops(stateprops, dispatchprops, ownprops) { return object.assign({}, ownprops, stateprops, dispatchprops); } write own version cherry-picks props want send component.

How to get a substring from a MYSQL table TEXTFIELD -

assume db structure is table1 - id, field1 and sample entry is 1 <div class="image" data-content="contact"><img style="margin: 0px auto;display: table;" src="link" alt="contact" title=""></div> now trying value link under src tag. tried useing regex, search none of them working correctly. select * table1 field1 between 'src' , 'alt'; and, select substring_index(substring_index(field1, 'src=', -1), 'alt', 1) table1 you can use below command select substring(@str, charindex('src', @str)+5 , (charindex('alt',@str)+5) - (charindex('src', @str) + len('alt'))-9) table1

html - What should I put in the for attribute of the label tag -

what should put in for attribute of label tag? i thought should id of element want bind label seems many people uses name instead. who's right? according mdn should use id : the id of labelable form-related element in same document label element. first such element in document id matching value of attribute labeled control label element. source https://developer.mozilla.org/en-us/docs/web/html/element/label

Reconnect to same Zookeeper server with session id fails -

my client application connects zookeeper server , creates ephemeral node: zookeeper zk = new zookeeper(hosturl, 40000, null); if (zk != null) { try { zk.create(zpath, "test node".getbytes(), zoodefs.ids.open_acl_unsafe, createmode.ephemeral); } catch (keeperexception e) { e.printstacktrace(); } catch (interruptedexception e) { e.printstacktrace(); } } if client application crashes , restarts within session timeout period, want reconnect same zookeeper server session id received previous session: zookeeper zk = new zookeeper(hosturl, 40000, null, previoudsessionid, null); however, when try session expired exception: 12:20:26.737 [main-sendthread(172.20.34.24:2181)] info org.apache.zookeeper.clientcnxn - opening socket connection server 172.20.34.24/172.20.34.24:2181. not attempt authenticate using sasl (unknown error) 12:20:26.737 [main-sendthread(172.20.34.2

c# - AJAX Auto Complete Extender not working in ASP.NET -

i using ajax auto complete extender auto complete functionality in text box in asp.net, not working. here textbox , autocomplete extender: <div class="col-md-6 nopadding paddingr-5"> <span>airline</span> <asp:textbox id="txtairline" runat="server"></asp:textbox> <cc1:autocompleteextender servicemethod="searchairline" minimumprefixlength="2" completioninterval="100" enablecaching="false" completionsetcount="10" targetcontrolid="txtairline" id="autocompleteextender1" runat="server" firstrowselected="false"> </cc1:autocompleteextender> </div> and here service method in code behind file: [system.web.script.services.scriptmethod()] [system.web.services.webmethod] public static list<string> searchairline(string prefixtext, int count) { list<string>

javascript - Cache Versioning on Progressive Web Apps -

what current best practice service worker caching? after using service workers , caching number of projects, having bit of maintenance headache manage cached assets project. in cases using static cache (most cause of our headache) , our sw.js code pretty standard , looks follows: var cachename = 'v1:static'; // cache static assets during install phase self.addeventlistener('install', function (e) { e.waituntil( caches.open(cachename).then(function (cache) { return cache.addall([ './', './css/style.css', './css/vendor.css', './js/build/script.min.js', './js/build/vendor.min.js' ]).then(function () { self.skipwaiting(); }); }) ); }); self.addeventlistener('fetch', function (event) { event.respondwith( caches.match(event.request).then(functi

python - What is default_view used for? -

i saw code example in flask-appbuilder website .but never explained default_view used for. try dig documentation no avail. care explain me this? from flask.ext.appbuilder import appbuilder, expose, baseview, has_access app import appbuilder class myview(baseview): default_view = 'method1' @expose('/method1/') @has_access def method1(self): # param1 # , return previous page or index return 'hello' @expose('/method2/<string:param1>') @has_access def method2(self, param1): # param1 # , render template param param1 = 'goodbye %s' % (param1) return param1 appbuilder.add_view(myview, "method1", category='my view') appbuilder.add_link("method2", href='/myview/method2/john', category='my view')

android - Add custom checkbox to ArrayAdapter -

i using sqlite database save records, on returning them using code: mydb = new dbhelper(this); arraylist array_list = mydb.getallitems(); arrayadapter arrayadapter=new arrayadapter(this,android.r.layout.simple_list_item_1, array_list); mrecyclerview =(recyclerview) findviewbyid(r.id.items_list); obj = (listview)findviewbyid(r.id.listview1); obj.setadapter(arrayadapter); but showing me normal list of items , want display list checkbox on every row. tried using baseadapter , tried recyclerview not working. there way customize simple_list_item_1? you must write own adapter , in getview() method, inflate own view , pass data it: myadapter.java public class myadapter extends baseadapter { private final arraylist data; private final textview text; private final checkbox check; private final layoutinflater inflater; private final context context; public myadapter(context context, arraylist data) { this.context = context; this.data = data; inflater

xcode8 - PLManagedAlbumList identifier warning on console -

is there cure this: warning: dynamic accessors failed find @property implementation 'identifier' entity albumlist while resolving selector 'identifier' on class 'plmanagedalbumlist'. did remember declare @dynamic or @synthesized in @implementation ? this answer won't since warnings coming apple framework rather own code. i'll go ahead , put here in case other people searching on same warning. in case getting similar warning own code, puzzling since declaring @property @dynamic. problem while main class added target, auto-generated core data category (e.g. myclass+coredataproperties.m ) wasn't. adding target silences warnings. the code works fine either way, think stricter warning new xcode 8. unfortunately apple fix log spew coming own frameworks.

Adobe Flex iOS application ipa too large when deployed -

i developing adobe flex app web, desktop, android , ios. when package ipa ios, size 31mb. after deployment, size becomes 106mb refused apple publication. when unzip ipa, size of swf 3.5mb, other files' size 2.5mb <my app name> file 95mb. i using flash builder 4.7 packaging. do have idea, why case , how reduce size? i reduced app size removing unused code , images. under limit.

Show data in a-b format in sql server 2008 -

i using sql server 2008. i have table has distinct numbers i.e int data type. need query shows data in increasing order in format cast(a varchar)+'-'cast(b varchar) i.e a-b a smallest number has yet not been shown , b subsequently next smallest number. i know sql server 2012 has lead function make question moot how do on sql server 2008? create table #nr(nr int); insert #nr(nr)values(9),(7),(1),(2),(25),(33),(10),(3); select cast(n_o.nr varchar)+'-'+cast((select min(n_i.nr) #nr n_i n_i.nr>n_o.nr) varchar) #nr n_o (select min(n_i.nr) #nr n_i n_i.nr>n_o.nr) not null order nr; drop table #nr; results in: ╔══════════════════╗ ║ (no column name) ║ ╠══════════════════╣ ║ 1-2 ║ ║ 2-3 ║ ║ 3-7 ║ ║ 7-9 ║ ║ 9-10 ║ ║ 10-25 ║ ║ 25-33 ║ ╚══════════════════╝

data munging - Building Sentences from a dataframe in R -

im trying generate sentences dataframe below dataframe # code mycode <- c("aaabbb", "aaabbb", "aaaccc", "aaabbd") mycode <- sample(mycode, 20, replace = true) # date mydate <-c("2016-10-17","2016-10-18","2016-10-19","2016-10-20") mydate <-sample(mydate, 20, replace = true) # resort myresort <-c("gb","ie","gr","dk") myresort <-sample(myresort, 20, replace = true) # number of holidaymakers holidaymakers <- sample(1000, 20, replace = true) mydf <- data.frame(mycode, mydate, myresort, holidaymakers) so if take mycode example, want create sentence "for code mycode , biggest destinations myresorts top days of visiting mydate total of holidaymakers " if assume there multiple lines per code. want single sentence example instead of having 1 sentence per mydate , myresort ,

Java Swing: alignment of right element in JSplitPane -

for programming exercise using jsplitpane make window nice render of fractal on right, , other garbage on left. however, have come across strange issue: left element fine, right element left aligned. far can tell, right element given size of right part of screen, it's left, left element on top of it. i create jsplitpane , add elements this: splitpane = new jsplitpane(jsplitpane.horizontal_split, true); splitpane.add(sidebar, jsplitpane.left); splitpane.add(fractalwindow, jsplitpane.right); frame.add(splitpane); i've tried many different ways of constructing jsplitpane , adding components (using setleftcomponent , setrightcomponent, etc), whatever do, both components left aligned. doing wrong? edit: sidebar jpanel, fractalwindow subclass of jpanel. i've tried adding fractalwindow jpanel , adding splitpane, right component not drawn @ all. have not specified layout jframe frame. edit 2: it's solved. fractal class using methods getx() , gety() , didn'

makefile - Execute a phony target with no dependencies first in a parallel make? -

in parallel make, target: dependency should 1:1 order of execution same make no -j. have phony target has no dependencies want execute prior other targets: .phony: makedirectories makedirectories: make -p /path-to-directory this target not require dependency needed executed first in parallel make. solution have found following: -include makedirectories which works. way make sure phony target makedirectories executed first. another approach make targets depend on directory. e.g.: .secondexpansion: %.o : %.cc | $$(dir $$@) # <---- order-only dependency on directory % : # must last pattern rule mkdir -p $@ yet approach create directories using $(shell ...) function: objdir := release $(shell mkdir -p ${objdir})

scripting - run a script in multiple folders in bash -

i have folder cabo_verde, , inside folder have several folders (001 300) several files each, this: filename: cabo_verde 001 2008.001.00.00.cvbr1.lhz.sac 2008.001.00.00.cvbr2.lhz.sac ... 002 2008.002.00.00.cvbr1.lhz.sac 2008.002.00.00.cvbr2.lhz.sac ... i want run script in each folder , did: for dir in `ls $cabo_verde`; subdir in `ls $cabo_verde/$dir`; $(for file in *sac; sac <<eof echo on read $file chnhdr kcmpnm lhz write on quit eof done) done; done in end got ls:cannot access /001: no such file or directory ls:cannot access /002: no such file or directory can me please? thanks as reliability aid, suggest writing , running scripts set -u , parameter name typo obvious. you want run script in each directory, true? anyway... you can either nest 2 loops this: for d in cabo_verde/*/; cd $d f in *.sac; sac ... $f done done or can single loop this: for f in cabo_verde/*/*.sac; cd $

security - Where to store user credentials when using fingerprint authentication in Android -

as title suggests, i'm making app allows user login using fingerprint authentication. problem i'm having store credentials submit? the flow -> user logs in first time credentials -> enable fingerprint auth , store these credentials -> validate fingerprint access stored credentials. i thought of using sharedpreferences if device rooted these accessible. so safest , secure place store these credentials avoid them being accessed outside of app? edit: i'm using wrapper handle fingerprint authentication https://android-arsenal.com/details/1/4493

Download build.xml from Jenkins job build -

i can download jenkins job config.xml curl -x http://server.org/job/myjobname/config.xml -o localconfig.xml inside builds/${build_number}/ folder have couple of files each build: build.xml changelog.xml injectedenvvars.txt log the log file example can with: curl -x http://server.org/job/myjobname/7/consoletext -o log.txt the file of interest build.xml how can download ? with path relative workspace not working. curl -x http://server.org/job/myjobname/ws/../builds/6/build.xml -o log <title>error 404 not found</title> i can download workspace guess problem here /../ not getting properly.

javascript - Creating a Chrome Extension that has button links to websites -

i've written code extension should launch given websites , html file when launched works properly; however, when click on extension, buttons not anything. <!doctype html> <html> <head> <title>google apps launcher</title> <script src="popup.js"></script> </head> <body> <h1>google apps launcher</h1> <form> <input type="button" value="gmail" onclick="window.location.href='https://www.gmail.com'"> <input type="button" value="google drive" onclick="window.location.href='https://drive.google.com/drive/u/0/'"> <input type="button" value="google calendar" onclick="window.location.href='https://calendar.google.com/calendar/render#main_7'"> <input type="button" value="google docs" onclick="window.location.href='https://docs.g

python - Find if a sorted array of floats contains numbers in a certain range efficiently -

i have sorted numpy array of floats, , want know whether array contains number in given range. note i'm not interested in positions of number in array. want know if there @ least 1 number falls in range. since have same operation on large numbers of intervals (the array remains constant during entire operation), i'm concerned efficiency. can me? as talked in comments, np.searchsorted useful , indeed is. stated in question, array stays same, while have different ranges across iterations. so, let's ranges stored in (n,2) shaped array, such first column represents start, while second column stop values of ranges. we have solution np.searchsorted , - np.searchsorted(a,ranges[:,0]) != np.searchsorted(a,ranges[:,1]) the idea if there's number within range, sorted indices found using first column (start values) lesser , not equal indices second column (stop values). sample run - in [75]: # input data array out[75]: array([ 13., 20., 22., 24

Detection of Loops in Java Bytecode - Distinguishing back edge types -

background: before asking question, wish state have checked following links: identify loops in java byte code goto in java bytecode http://blog.jamesdbloom.com/javacodetobytecode_partone.html i can detect loops in bytecode (class files) using dominator analysis algorithm-based approach of detecting edges on control-flow graphs ( https://en.wikipedia.org/wiki/control_flow_graph ). my problem: after detection of loops, can end having 2 loops (defined 2 distinct edges) sharing same loop head. can created following 2 cases have realized: (case 1) in source code, have or while loop continue statement, (case 2) in source code, have 2 loops - outer loop do-while , inner loop; , no instructions between these loops. my question following: by looking @ bytecode, how can distinguish between these 2 cases? my thoughts: in do-while loop (that without continue statements), don't expect go-to statement goes loop head, in other words, creating edge. for while or loop (tha

python - Pearson Correlation after Normalization -

i want normalize data , compute pearson correlation. if try without normalization works. normalization error message: attributeerror: 'numpy.ndarray' object has no attribute 'corr' can solve problem? import numpy np import pandas pd filename_train = 'c:\users\xxx.xxx\workspace\dataset\!train_data.csv' names = ['a', 'b', 'c', 'd', 'e', ...] df_train = pd.read_csv(filename_train, names=names) sklearn.preprocessing import normalizer normalizeddf_train = normalizer().fit_transform(df_train) #pearson correlation pd.set_option('display.width', 100) pd.set_option('precision', 2) print(normalizeddf_train.corr(method='pearson')) you need dataframe constructor, because output of fit_transform numpy array , work dataframe.corr : df_train = pd.dataframe({'a':[1,2,3], 'b':[4,5,6], 'c':[7,8,9], 'd':[1,

android - Get the Location Name in onLocationChanged(Location location) method -

i want location-name inside onlocationchanged(location location)() method. can latitude , longitude onlocationchanged(location location) location.getlatitude(); , location.getlongitude(); but need location name . has no method of getting location name. can that? i doing in way : public void onlocationchanged(location location) { double la = location.getlatitude(); double lo= location.getlongitude(); // location name? } amar there method in geocoder class getfromlocation (lat,lng,maxresults) gives timed out exception sometimes.it has been bug geocoder. instead of calling method make request asynchronously in locationchanged callback method @override public void onlocationchanged(location location) { new locationadressasync(this,this).execute("http://maps.googleapis.com/maps/api/geocode/json?latlng=" + location.getlongitude() + "," + location.getlatitude()+ "&sensor=true"); }

R Shiny: downloadButton styling and icon -

is there way change icon or @ least control padding of downloadbutton in shiny? i've tried setting class: downloadbutton("html_link", label = null, class = "download_this") then in css: .download_this{ height:40px; width:57px; color:blue; padding-top: 3 !important; } this changes size , color, reason padding doesn't work on icon , appears high on button. it seems error in .css , css padding generates space around content, 3 means nothing css , try: padding-top: 3px

I am using Swift-SRWebClient to upload multiple images in single post but i am not able to do so with swift 2.2? using REST API -

here code : srwebclient.post("http://www.tiikoni.com/tis/upload/upload.php").data(messagedata, fieldname:"photo", data: ["createdby":"4","name": "test", "description" :"test","categoryid": "0", "sendtosupplier":"0","deliverydate":"25/10/2016","fileextension":"png"]) .send({(response:anyobject!, status:int) -> void in // process success response },failure:{(error:nserror!) -> void in // process failure response }) this method gives me error cannot invoke argument list of type ..... srwebclient.post("your url/m/api").data(yorarrayofimagedata, fieldname:"photo", data: [ "createdby":"4",

Remove toolbar button padding Android -

Image
i'm trying fit more button toolbar removing padding on button didn't find way that. i'm trying remove padding in red. i tried adding manifest <item name="android:actionbuttonstyle">@style/actionbuttonstyle</item> and styles.xml <style name="actionbuttonstyle" parent="@android:style/widget.holo.light.actionbutton"> <item name="android:minwidth">0dip</item> <item name="android:paddingleft">0dip</item> <item name="android:paddingright">0dip</item> </style> but didn't work. there other solution? in default action bar cannot reduce padding. create custom toolbar , keep padding 0dp

c# - How do I use Rx to iterate through a series of strings with pauses and fade ins and outs? -

my requirement take series of strings array starting first , after 5 seconds move next 1 whilst fading out , fading in next string using rx xaml in xamarin. can assume taking place on view model has 'message' property , 'messageopacity' property take text , decimal between 0 , 1 applicably. can assume have background scheduler , uischeduler setup. i'm new rx become apparent , have got far far: var messages = new[] { "welcome", "we settings things you", "this may take little while first time" }; observable.interval(timespan.fromseconds(5), scheduler.backgroundscheduler) .selectmany((long arg) => messages) .buffer(1, 1) .subscribeon(scheduler.uischeduler) .subscribe((obj) => { message = obj[0]; }); the above doesn't work, buffer isn't worki