Posts

Showing posts from February, 2012

python - Group m groups with regex -

i have regex replaces letter n (\w{1,}) -- meaning word can stand in letter n. want make group out of m instances of (\w{1,}) -- i.e add parens around m instances of (\w{1,}) , this: "(" + "(\w{1,}), (\w{1,}), (\w{1,}) .... (\w{1,})" + ")", (\w{1,}) occurs m times how can that? know like re.sub(\w{1,}){2,}, inputstring, "(" + many instances of (\w{1,}) pattern able match + ")) how express, in regex, pattern matched m times? (so can replace, surrounded parenthesis). if understand question correctly, you're writing 1 regex produce regex. is, you're using regex replacement build pattern regex search. input includes kind of wildcard value (e.g. "n" ) need replace create search pattern. in search pattern, adjacent wildcard values should combined single capturing group (so "n n bacon n" give 2 capturing groups, 1 first 2 words , 1 more last). think can if first capture adjacent wildcards, substitut

asp.net - Unable to access Public properties of usercontrol from aspx in vb -

i have googled , saw post of other users same problem. of post have same solution. followed steps , codes still can't solve problem. still i'm not able access declared properties. i'm new vb.net, pardon if stupid question. here code usercontrol public class customusercontrols dim msg string dim innermsg string dim modal boolean public property setmessage() string return msg end set(value string) msg = value end set end property public property setinnermsg() string return innermsg end set(value string) innermsg = value end set end property public property popupmodal() boolean return modal end set(value boolean) modal = value end set end property end class this usercontrol design code: <%@ control language="vb" autoeventwireup="false" codefile="showmessagecontrol.ascx.vb" inherits="usercontrols_showmessagecontrol" %>

sql - How to use GROUP with DATEPART? -

i using following script count number of shopid 1 year. i need breakdown result month year. so end result should be month 1 shopid 5 100 shopid 4 90 month 2 shopid 1 150 shopid 4 80 select shopid, count(shopid) interest dbo.analytics datecreated >= '2014' , datecreated < '2015' group shopid order interest desc table structure create table analytics ( datecreated datetime2(2), shopid int ); what should change in script? shall use datepart near group by you can use datepart . try this select datepart(mm,datecreated) 'month',shopid, count(shopid) interest dbo.analytics year(datecreated) = '2015' group datepart(mm,datecreated),shopid order interest desc datepart return month number only. if need result have month name should use datename try this select select datename( month , dateadd( month , datepart(mm,datecreated) , -1 ) ) 'month&

Android Studio Androidmanifest.xml contains garbage characters -

i creating app on android studio 0.6.1. androidmanifest.xml file contains special characters , shows manifest file read only. when building app error "failure [install_parse_failed_manifest_malformed]". on windows 7 64 bit. can run app on emulator without manifest file? please help!

c++ - Extract one object from set of objects -

Image
i want extract 1 leaf bunch of leaves detect features using opencv (c++). first tried find edges of image , extract 1 object. see question here ., seems way not going work. want extract 1 leaf image taken in real environment of plant (see following example image example. image going process not known user has take image , upload system) as example consider want cut off leaf marked red line. can proceed identify features of leaf. can 1 please suggest step step method this. i'm using opencv , c++ language. thank in advance.

javascript - Multiple values of same JSON Tag -

i have 1 json object coming html transferring javascript function defined below. problem getting same foldername listed in repition on html page. json object: { "foldername": "arjunram-test", "objects": [ { "keyname": "shadowbalancemismatch_april.csv", "keyvalue": "shadowbalancemismatch_april.csv" }, { "keyname": "rawlogs.txt", "keyvalue": "rawlogs.txt" }, { "keyname": "expiredpoints.txt", "keyvalue": "expiredpoints.txt" } ], "childdirs": [ { "foldername": "20140601.csv", "objects": [ { "keyname": "expiredpoints.txt", "keyvalue": "201406

jquery - How do I save article ids in Javascript or HTML? -

i have list of links in web-page , users can click , comment on them. load links via json , each link uniquely identified id. my question how know link has been clicked? though have id, store it(if javascript object, how?)? guess cannot have tag attribute because users may change it. it sounds want able create link page specific id, without displaying id? if case, think you'll face difficulties doing in simple way, javascript client-side , user able alter id anyway. i'd recommend keeping id in link ( <a href="url.com/post/42> , example) , rather, when page loaded, in way or another, check if provided url valid, existing id.

android - how to get columncount in gridview -

how column count in gridview when gridview noofcolumn="autofit" mode how single row no of column <gridview android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@android:color/white" android:gravity="center" android:numcolumns="auto_fit" android:stretchmode="columnwidth" /> you can column count in java code.. gridview mgridview = (gridview)findviewbyid(r.id.gridview); int column_coutnt = mgridview.getnumcolumns(); second way: int columns = 0; int children = mgridview.getchildcount(); if (children > 0) { int width = mgridview.getchildat(0).getmeasuredwidth(); if (width > 0) { columns = mgridview.getwidth() / width; } }

push notification - Urban airship and android in mobile data -

i using urban airship service android app. when trying push during mobile data usage didn't receive push messages. after try have turned on wi-fi. can receive push message couldn't receive in mobile data. my query , urban airship pushes message in wi-fi data connection? urban airship don't push data themselves. use google cloud messaging. google cloud messaging works both mobile data , wifi.

javascript - espressjs, node, mongo saving method -

i have function "saveuser", gets value textbox, , updates information of user , uses ajax post object our updateuser service. function saveuser(event){ event.preventdefault(); var errorcount = 0; $('#edituser input').each(function(index, val) { if($(this).val() === '') { errorcount++; } }); if(errorcount === 0) { var existinguser = { 'username': $('#edituser fieldset input#inputusername').val(), 'email': $('#edituser fieldset input#inputuseremail').val(), 'fullname': $('#edituser fieldset input#inputuserfullname').val(), 'age': $('#edituser fieldset input#inputuserage').val(), 'location': $('#edituser fieldset input#inputuserlocation').val(), 'gender': $('#edituser fieldset input#inputusergender').val() } $.ajax({ type: 'post',

python - Pyside signals, slots, affinity and object existence -

i have piece of code in custom widget class: def import_data(self, fname): worker = dataread(fname) readthread = qtcore.qthread(self) worker.movetothread(readthread) readthread.started.connect(worker.read_data) readthread.start() the 'worker' class looks this: class dataread(qtcore.qobject): def __init__(self): super(dataread, self).__init__() @qtcore.slot() def read_data(self): print 'hi!' the code above not work. work if store worker instance attribute of custom widget class. i.e: def import_data(self, fname): self.worker = dataread(fname) readthread = qtcore.qthread(self) self.worker.movetothread(readthread) readthread.started.connect(self.worker.read_data) readthread.start() i can't head round why so? also, if required, why not required qthread instance ( readthread ) stored attribute? i've googled , seen lot of talk 'affinity' , 'persistence&#

r - rStudio autocompletion description and usage -

i pretty new in package development r , might stupid question, hope can here... i develop small package in r using manual hadley wickem http://adv-r.had.co.nz/package-development-cycle.html i switched dev_mode(), install() package , load library(package name) so 1 example: #' logging function #' #' function tries use logging functionality. if logging package #' isn't installed, uses normal print command #' #' @param string string print #' @param level level of log output, example \code{warn}, #' \code{info} or \code{error} #' @examples #' \dontrun{ #' mylog('for information') #' mylog('this warning','warn') #' } mylog <- function(string,level='info') { trycatch( switch(level, warn=logwarn(string), error=logerror(string), info=loginfo(string), {logwarn(sprintf('warnlevel "%s" not defined!',level)) login

Postgresql: detecting which foreign key triggered the "on before delete" trigger -

let t table 2 columns: a , b , reference, respectively, tables a , b . such references of type "delete cascade", if row a or b deleted, row in t matches origin reference deleted. now, want set trigger "on before delete row" on t : there way detect of reference triggered row deletion in t ? in other words: can know if trigger triggered cascading a or b ? thank you. edit ok, i've simplified problem. have following tables: users : id: integer serial primary key name: character varying(128) validatorchains : id: integer serial primary key name: character varying(128) validatorchainslinks : chain: integer foreign key validatorchains.id on delete cascade user: integer foreign key users.id on delete cascade next: integer foreign key users.id on delete set null prev: integer foreign key users.id on delete set null the code of "on before delete" trigger on validatorchainslinks is: begin update validatorcha

jquery - PhantomJs : Screen capture of webpage loading data with $.POST fails -

i using phantomjs screen-capture website. it happens on webpages loads data jquery ajax call instead of requesting given remoteurl , phantomjs requests current webpage url. leads re-including current page current page given example: this code executed on $('document').ready() on webpage i'm trying screen-capture: remoteurl = $('#my-placeholder').data('api-url'); $.post( remoteurl, { foo: bar }, function(response){ $('#my-placehoder').html(response); // instead of retrieving remoteurl's content, // result contains same content current page } ); here's code use phantomjs: page.open(address, function (status) { if (status !== 'success') { console.log('unable load address!'); phantom.exit(); } else { page.evaluate(function() { document.body.bgcolor = 'white'; }); var arr = page.evaluate(function

vb.net - If and Else Statements causing multiple messageboxes to show up one after another -

i @ slump here these if , else statements, not cup of tea confuse me. issue experiencing follows: have 5 checkboxes, 1 button, , progress bar, , issue @ hand when checkbox1 ticked, , click on button1, infested multiple messageboxes popping 1 after another. doesn't matter tick off in checkbox, same sequence of things happens on , over, , can not life of me figure out. how correct this? here line of code need resolving. i want check if file directory exists, , if doesn't downloads file. if exist, message comes once saying "file exists" , on , forth. public sub server1() if (checkbox1.checked = true) if (file.exists("c:\something1")) messagebox.show("some message", "hi", messageboxbuttons.ok, messageboxicon.exclamation) else s1.downloadfileasync(new uri("https://dl.dropboxusercontent.com/something1"), "c:\something1") end if if (file.exists("c:\somet

c++ - How to modify elements of a QSet? -

i have qset<quadpattern> texture; , modify quadpattern in loop. foreach not solution because makes copy. with code : qmutablesetiterator<quadpattern> it(texture); while (it.hasnext()) { it.next(); it.value().setcoordinate(...)); } i compilation error : error: c2662: 'quadpattern::setcoordinate' : cannot convert 'this' pointer 'const quadpattern' 'quadpattern &' conversion loses qualifiers the function setcoordinate : inline void setcoordinate(const std::pair &value) { _coordinate = value; } why error ? error because try modify const object returned qmutablesetiterator::value() function. i believe cannot modify set's items in way, , therefore there no such api. need modify items clearing set , inserting new items again.

javascript - Loading external text to HTML -

for project here @ work have create file several chapters , lot of text in 1 big html file, since text has translated different languages, want load text external text file. i've seen topics like: loading external text .txt html file jquery load txt file .html() but can't manage make work. as test created basic html file: <html> <head> <script type="text/javascript"> $('#text').load("/textdoc.txt"); </script> </head> <body> <div id="text"> </div> </body> but doesn't work. expected see text within "textdoc.txt" file in <div id="text"> </div> . remains blank. text document in same directory html file. doing wrong here? as side note, system create file runs on ie7. work that? as mrn00b noted, assuming have left out inclusion of jquery js file itself? please include it, if have not already, not implicitly part of web

javascript - changing the background on keydown event -

i trying change background color of ul when keydown event occurs.when press down arrow corresponding ul should change background color. here code <div class=".container"> <ul> <li>one</li> </ul> <ul> <li>two</li> </ul> <ul> <li>three</li> </ul> <div> var chosen = ""; $(document).keydown(function(e){ // 38-up, 40-down if (e.keycode == 40) { if(chosen === "") { chosen = 0; } else if((chosen+1) < $('.container ul').length) { chosen++; } $('.container ul').removeclass('selected'); $('.container ul:eq('+chosen+')').addclass('selected'); return false; } if (e.keycode == 38) { if(chosen === "") { chosen = 0; } else if(chosen > 0) { chosen--; } $('.container ul').removeclass('selected'); $('.container ul:eq('+chosen+')').addcla

java - Calling jardesc in Ant -

i have collection of projects build process described .jardesc each. dont want build single projects of them @ once. possible make ant build calls/executes list of jardescs? in question using ant build multiple jars same thing asked answer marked correct works building multilple jars using multiple ant builds, not jardescs. there way this?

c++ - In boost::posix_time, how to construct time_duration from volatile time_duration? -

i'm trying compile code: #include <boost/date_time.hpp> using boost::posix_time::time_duration; int main() { volatile time_duration t0; time_duration t1 = t0; return 0; } with command: g++ test01.cpp -std=c++11 -i /boost_1_55_0/ -o test01 and error: test01.cpp:6:22: error: no matching function call ‘boost::posix_time::time_duration::time_duration(volatile boost::posix_time::time_duration&) i'm using gcc 4.8.2; idea how fix this? this due a gcc bug . workaround so: volatile time_duration t0; time_duration t1 = const_cast<time_duration&>(t0); it works because const_cast can remove volatility constness. i'm not sure how strictly safe is, mind you. an alternative fix rid of volatile in first place; serves purpose nowadays.

wordpress - hook to add author name in woocomerce product single page -

i working plugin , going integrate woocomerce. using plugin want add product author name in product single page . so need hook how add author name in product single page. please me how solve this. you can use action : add_action('woocommerce_before_single_product_summary','mycustomfuncion',11); function mycustomfuncion() { global $product; $productid = $product->id; } in mycustomfuncion() can product id , product id can fetch author name database , echo author name.

jQuery animations lag and jam -

i'm working on single-page site, few things (h1 opacity, nav height, etc) animated based on scrolling. works, after scrolling around bit, heavy lag , unexpexted behaviour experienced (eg. non-stop toggling of nav height few seconds). tried velocity.js , transit.js, same thing happens. i've made simplified pen demonstrate: http://codepen.io/galingong/pen/bheyz/ am doing wrong or browser issue?i'm testing in chrome 35. simple use stop() before animation. problem happenning cause animation queued after each other, , queue longer each animatio. using stop() ensure stop previous animation specific element & starting new point. e.g. $('header h1').animate({opacity:0},300); change to $('header h1').stop().animate({opacity:0},300);

treeview - java treeviewer add element -

basically working treeviewer in java (org.eclipse.jface.viewers.treeviewer). problem is, want add childelement/ item existing knot. first of tree looks this: knot knot b knot c >child1 >child2 these children(child1, child2) arent added manually, generated before hands on tree itself. i create treeviewer: viewer = new treeviewer(parent, swt.multi | swt.h_scroll | swt.v_scroll); i populate treeviewer: viewer.setinput(....elements()); generates state above. viewer.gettree().getitem(0) returns correct knot of tree. but cant add new child existing knot. tried following , other things: treeitem newitem = new treeitem(items[0], swt.none); , viewer.add(items[0], newitem); newly created item viewer.refresh(); theoretically manipulate arraylist populates treeviewer in first place bad think. i not know doing wrong right now. guess quite silly question. if case, sorry.^^ thank help, grateful every hint can offer. updating 'model' (the

Android imagebutton toogle click -

i have imagebutton , want write setonclicklistener method toggle click(like togglebutton).i know how working togglebutton not need use it.it possible write toggleclick method in imagebutton.i wrote code not woking such togglebutton strada_chart.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { if(arg0.isclickable()==true) { toast.maketext(getapplicationcontext(), "1", toast.length_short).show(); } else { toast.maketext(getapplicationcontext(), "2", toast.length_short).show(); } } }); try this.. like_btn.setonclicklistener(new onclicklistener() { public void onclick(view v) { if(fun) { like_btn.setimageresource(r.drawable.unlike); fun=false; } else

Eclipse wont create new Android Activity source or layout. Tried updates and sdk -

when create new android project select blank activity fragment (tried empty activity , blank activity well) , go through naming process layout name when project created, there's no .java source file , no layout folder or xml contents. i've tried following still nothing: adt not allow creation of android activity eclipse doesn't create main activity , layout go "help menu bar" -> "install new software" , install (this update it) url: https://dl-ssl.google.com/android/eclipse/ it says installs have been done adt plugin, installs done sdk manager, no updates found under - check updates. i uninstalled eclipse, got newest version no luck. have newest adt plugin version 23.0 well. tried restarting eclipse , going task manager , stopping adb.exe process , restarting eclipse nothing. tried changing work space location still nothing. suggestions anyone? i had same problem yersteday. tried many things, installing clean eclipse (latest ver

I have ng-grid and columns in that I have field country id, but I want to print country name in cell. So how can I do that? -

i have ng-grid. inside have bind columns firstname, last name, country, state city. in country, state, city columns have stored ids in table, on base of id want print country name. how possible? { field: 'city', displayname: 'ישוב', celltemplate: '<div> {{getcityname(row.getproperty(col.field))}}</div>' },

android - login Google account in webview using account manager token -

i got access token account manager access google java client api, need open webview having google has logged in through access token got account manager. have idea of this. i tried using cookies (through this ), couldn't achieve it. if know way, please share code snippet. i found way through cookies use of ubertoken. function should call in separate thread public void setcookiestowebview(accountmanager am,account account,context context){ string sid = ""; string lsid = ""; thread ubertokenthread = new thread(new runnable() { @override public void run() { try { sid = am.getauthtoken(account, "sid", null, context, null, null) .getresult().getstring(accountmanager.key_authtoken); } catch (operationcanceledexception e) { e.printstacktrace(); } catch (authenticatorexception e) {

android - Adapter error while running code -

i new android development , working on listview .. code not have error when try run it, application crashes. this mainactivity code: package com.example.view; import java.util.arraylist; import android.app.activity; import android.os.bundle; import android.widget.listview; public class mainactivity extends activity { listview lv; arraylist<listviewitem> items; customlistviewadapter adapter; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); lv = (listview) findviewbyid(r.id.listview); items = new arraylist<mainactivity.listviewitem>(); items.add(new listviewitem(r.drawable.ic_launcher, "item1", "item1 description")); items.add(new listviewitem(r.drawable.ic_launcher, "item2", "item2 description")); items.add(new listviewitem(r.drawable.ic_launcher, "item3", "item3 description")); items.

java - Internal widows don't show up in desktop pane -

after little research on internet, created desktop pane , want put internal frames. use factory pattern create multiple internal frames (windows) i have abstract class import javax.swing.*; public abstract class internalwindowtemplate extends jinternalframe{ jinternalframe internalwindow; public final void createinternalwindow(string title, int width, int height, int xoffset, int yoffset, boolean isresizable, boolean isclosable, boolean ismaximizable, boolean isiconifiable){ internalwindow = new jinternalframe(title, isresizable, isclosable, ismaximizable, isiconifiable); setinternalwindowsize(width, height); setinternalwindowlocation(xoffset, yoffset); internalwindow.setvisible(true); internalwindow.setdefaultcloseoperation(jinternalframe.exit_on_close); try { internalwindow.setselected(true); } catch (java.beans.propertyvetoexception exception) { exception.getmessage(); } catch(exception exception){ exc

c# - public string's value is always null -

i started learning c# few days ago , i'm having problem public strings, i'm trying write program copies , replaces files practice i'm having problem public strings no matter how try change code couldn't figure out myself came here help what doing wrong? here's code: namespace extractor { public partial class form1 : form { public string s { get; set; } public string sselectedpath { get; set; } public string beckup { get; set; } public form1() { initializecomponent(); } private void direc_click(object sender, eventargs e) { folderbrowserdialog fbd = new folderbrowserdialog(); fbd.description = "select folder"; if (fbd.showdialog() == dialogresult.ok) { string sselectedpath = fbd.selectedpath;

ios - Passing Core Data attributes from viewController to another viewController -

i'm complete beginner in ios , core data. i've followed lynda.com's core data example , still trying grasp gist of everything. my current build has uitableviewcontroller (let's call resultstvc) passes selected objectatindex uiviewcontroller (displayuservc). wondering there possibility pass details loaded uiviewcontroller (displayuservc) uiviewcontroller (addmoviesvc)? basically - have save current fetched items in uiviewcontroller (displayuservc) somewhere, or there possibility access loaded in uiviewcontroller (displayuservc) new uiviewcontroller (addmoviesvc)? thanks guys the way i've seen done , recommend create singleton managedobjectcontext accessible multiple vcs. in prepareforsegue pass in object identifier next vc. vc on load can reference context , load need it. allows vc have moc in case need changes (i.e. editing/deleting/inserting coredata).

javascript - HTML5 canvas curve anti-aliasing worse than SVG -

i started study canvas, drawing circle , found anti-aliasing curve worse circle in svg. my code this: context.arc(0, 0, radius, 0.5 * math.pi, 0.5 * math.pi - radian, true); i reversed y-axis make natural me. have scale canvas make adapt retina display. the result on mac picture here . my complete code here . update: code doing animation of completing circle. i noticed if fps set 1-3, anti-aliasing applying. strange.

java - How to alter the body of a http response in a filter -

i attempting use filter check html tags in response body. problem if alter body in filter, isn't altered when gets client. tried solution shown here: looking example inserting content response using servlet filter didn't help. i have 2 filters. securewrapperfilter wraps request/response objects in our custom wrapper, , xssfilter uses owasp encode encode html content. filters this: public class securewrapperfilter implements filter { @override public void init(final filterconfig filterconfig) throws servletexception { } @override public void dofilter(final servletrequest request, final servletresponse response, final filterchain chain) throws ioexception, servletexception { final servletrequestwrapper securityrequest = new servletrequestwrapper((httpservletrequest)request); final servletresponsewrapper securityresponse = new servletresponsewrapper((httpservletresponse)response); esapi.ht

jquery - Background-x position on stellar JS -

i'm trying background-x have @ 50%, i've read stellar documentation , seen demo. unfortunately change x position 50%. missing? this container image <div class="break stageone" data-stellar-background-ratio="0.5"></div> this default stellar js initiate $.stellar({ horizontalscrolling: false, verticaloffset: 0 }); my class holds background image .break{ background-attachment: fixed; background-position: 50% 0; background-repeat: no-repeat; position: relative; float: left; width: 100%; height: 700px; } my background image .stageone{ background: url(http://matthewduclos.files.wordpress.com/2012/04/canoncine.jpg); margin-top: 60px; } stellar.js nothing problem. because use background: url after background-position: 50% 0; just replace it: .stageone{ background: url(http://matthewduclos.files.wordpress.com/2012/04/canoncine.jpg); margin-top: 60px; } .break{ background-attachment: fixed; background-position: 50

php - Song won't load/play in the Flash Player -

i working on online radio website. here use flash player plays selected song list of songs (xml). issue songs playing in chrome, when try play song in other browsers shows message "buffering..." song won't load/play in flash player. browsers testing on are: 1.mozilla( version 31.0) 2.safari( version 31.0) 3.chrome( version 35.0.1916.153) 4.opera( version 31.0) 5.internet explorer( 9.0 ) my flash player pure actionscript 3 project compiled flex4.5 sdk ( did not work on part). there 2 swf files shipped: player.swf (application swf) player_skin.swf (skin/asset swf containing visual elements of player) my site link: http://www1.977music.com/ buffering ss: http://screencast.com/t/jiqf47wnmcp please follow steps encounter issue: click on stations you'll see under "stations" tab. screenshot: http://screencast.com/t/ltzzzq9v when click on station name, default random song station start playing. mentioned songs don't play in firef

ruby - RAILS error NET::HTTP.post_form “private method `methods' called for #<Net::HTTP url open=false>” -

i want send require other url using net::http method post_form , rescue of backtrace returns error: private method methods' called #<net::http my_url open=false> ["/home/duglas/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/http.rb:576:in start'", "/home/duglas/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/http.rb:507:in post_form'", "/home/duglas/sgc/app/business/external/connection/export/hawk.rb:31:in export!'", "/home/duglas/sgc/app/business/external/connection/export/hawk.rb:11:in export!'", "/home/duglas/sgc/app/business/external/export/hawk/balance.rb:27:in send_balance!'", "/home/duglas/sgc/app/business/external/export/hawk/balance.rb:7:in send_balance!'", "/home/duglas/sgc/lib/tasks/send_balance_control.rake:5:in block (3 levels) in '", "/home/duglas/.rvm/gems/ruby-2.1.0@sgc/gems/activerecord-4.0.5/lib/active_record/relation/delegatio

java - Write GPIO value from Android application using Binder -

i want change value of gpio android application on android 4.2.2. i tried using application jni can not write value file. reason root able write file , application runs user permission given android or system user. none of them can write value file. a possible solution create native daemon , have app communicate through sockets. load system , not sure if secure. another solution create server , client process , have them communicate through binder. client application , send commands server. my question is: type of process should server in order able have root permissions , used binder , android app? thanks if building own custom rom via daemon or custom service, noted. either way work , wouldn't impact system cpu load, if done correctly. using service , binder typical way done in android , how of system services work. need careful, though. not open security hole in system (allowing app bind service , therefore "talk" kernel), inadvertently viol

css - Want to make a padded color line across a page -

i want make line lets green padded 20px across page. html or css this? i have tried simple code found on other website no success. want have line going across page, used additional background image. why not use <hr> element , style accordingly? html <p>some content</p> <hr class="line"> <p>some more content</p> css .line { height:20px; background-color: green; border:0; } fiddle

NUL char in strings in C++ -

in below code trying replace first character '\0' . i expected print empty string, in output omits , displays rest of characters. int main() { string str; cin >> str; str[0] = '\0'; cout << str << "\n"; return 0; } output : testing esting how terminate string in c++? ps: trying approach of terminating string in different question in need terminate in between. std::string not null terminated string. if want empty use clear() method. if want remove element of string use erase() method.

asp.net mvc - ModelState.IsValid is false - But Which One - Easy Way -

Image
in asp.net mvc, when call post action data, check modelstate , in case validation error, falst. big enter user information form, annoying expand each value , @ count see key (9 in attached example image) has validation error. wondering if knows easy way figure out element causing validation error. i propose write method: namespace system.web { using mvc; public static class modelstateextensions { public static tuple<string, string> getfirsterror(this modelstatedictionary modelstate) { if (modelstate.isvalid) { return null; } foreach (var key in modelstate.keys) { if (modelstate[key].errors.count != 0) { return new tuple<string, string>(key, modelstate[key].errors[0].errormessage); } } return null; } } } then during debugging open immediate window ,

sas - How to use all variable names in variable list inside proc freq -

i trying use variable names in variable list (varlistc) inside proc freq. however, proc freq provided output last variable name in varlistc. how can fix this? proc sql noprint; select name :varlistc separated ' ' data2c; quit; proc freq data=&data1; table &varlistc*site; run; just reference, proc freq allows clearer syntax: every variable list in first brackets cross-applied variable (or list of variables in brackets) after asterix. proc sql noprint; select name :varlistc separated ' ' sashelp.class; quit; proc freq data=&data1; table ( &varlistc ) * site; run; could e.g.: proc freq data=&data1; table ( &varlistc ) * (site1 site2); run;

java - select items in ListView<items> and return null in JavaFX -

shapefx class contains arraylist shapes public class shapefx { private arraylist<shapes> shapes; public shapefx () { this.shapes= new arraylist<>(); } public shapefx (arraylist<shapes> shapes) { this.shapes= shapes; } public arraylist<shapes> getshapes() { return this.shapes; } public void setshapes(arraylist<shapes> shapes) { this.shapes= shapes; } @override public int size() { return this.shapes.size(); } @override public void add(shapes element) { this.shapes.add(element); } @override public void remove(shapes element) { if (element != null) { this.shapes.remove(element); } } @override public string tostring() { stringbuilder str = new stringbuilder(); iterato