Posts

Showing posts from June, 2012

java - Retrieve time tag with Jsoup -

this html: <div id="trestlelifts"> <header class="tableheader"> <time>as of 4/23/15 @5:18 mst</time> <h2>lifts</h2> </header> i need time tag, cant resolve it. i try code, app crash document docw = jsoup.connect(url).get(); element doc = docw.getelementbyid("header.tableheader"); elements h1=doc.getelementsbytag("time"); string tit = h1.text(); element doc = docw.getelementbyid("header.tableheader"); doesn't make sense since there no tag id="header.tableheader" attribute. you want use select instead if want pick <header class="tableheader"> . elements doc = docw.select("header.tableheader"); than can pick time tag elements h1= doc.select("time"); based on comment in include address of page want parse seems problem solution <

ruby on rails - Best way to find Users with certain associations -

lets have user model , each user has association called user_logins created every time login, storing information login. what need find users have 5 user_login records, fifth record created today. something this: users = user.all.where(user_logins_count == 5, user_login.last.created_at == today) user_logins_count counter cache have set up. of course code brutal, it'll elaborate on i'm trying achieve. pg error rake aborted! activerecord::statementinvalid: pg::undefinedtable: error: missing from-clause entry table "last " line 1: ...n_logins_count" = 5 group humans.id having max(human_logi... ^ new code: humans = user.humans.joins(:human_logins).where(human_logins_count: 5) .group('humans.id') .having('max(human_logins.created_at) >= ?', date.today) you can define scope inside user class: class user scope :logged_in_a_lot_today, -&

javascript - Datetime parser function keeps returning days on Tuesday -

for reason, datetime parser keeps returning dates tuesday, idea why? for example: <div class="datetime">2015-06-04 16:00:00</div> <div class="datetime">2015-06-05 13:00:00</div> output tuesday 04 june - 16:00 tuesday 05 june - 13:00 code html <div class="datetime">2015-06-04 16:00:00</div> <div class="datetime">2015-06-05 13:00:00</div> js $('.datetime').each(function () { var value = $(this).text().trim().split(' '), date = value[1].split(':'), day = value[0].split('-'), days = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday'], months = ['january','february','march','april','may','june','july','august','september','october','november','december']

xml - Access node based on attribute value -

within xml document, each lead or passenger has pickup , dropoff attribute, has matching waypoint id. <r:rides> <r:ride> <r:lead pickup="1" dropoff="2"> </r:lead> <r:passengers> <r:passenger pickup="1" dropoff="3"> </r:passenger> </r:passengers> <r:waypoints> <r:waypoint id="1"> <a:place>hall</a:place> </r:waypoint> <r:waypoint id="2"> <a:place>apartments</a:place> </r:waypoint> <r:waypoint id="3"> <a:place>train station</a:place> </r:waypoint> </r:waypoints> </r:ride> </r:rides> how select a:place each lead or passenger in xsl? example: <xsl:for-each sele

scala - Spray Routing template not working -

i try run spray template @ https://github.com/spray/spray-template . i error @ step 5 (start application) [error] [04/26/2015 12:49:18.613] [on-spray-can-akka.actor.default-dispatcher-4] [akka://on-spray-can/user/io-http/listener-0] 762 akka.actor.actorinitializationexception: exception during creation @ akka.actor.actorinitializationexception$.apply(actor.scala:164) @ akka.actor.actorcell.create(actorcell.scala:596) @ akka.actor.actorcell.invokeall$1(actorcell.scala:456) @ akka.actor.actorcell.systeminvoke(actorcell.scala:478) @ akka.dispatch.mailbox.processallsystemmessages(mailbox.scala:279) @ akka.dispatch.mailbox.run(mailbox.scala:220) @ akka.dispatch.mailbox.exec(mailbox.scala:231) @ scala.concurrent.forkjoin.forkjointask.doexec(forkjointask.java:260) @ scala.concurrent.forkjoin.forkjoinpool$workqueue.runtask(forkjoinpool.java:1339) @ scala.concurrent.forkjoin.forkjoinpool.runworker(forkjoinpool.java:1979) @ scala.concurrent.for

php - Parse error: syntax error, unexpected end of file in -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers i have code id php export xml, , dont know, problem ? <?php $data=mysql_query("select * ``"); while($zaznam=mysql_fetch_array($data)){ $select = "select * `` id=".$zaznam['id'].""; $proved = mysql_query($select) or die ( mysql_error() ); $xml_output = "<?xml version=\"1.0\"?>\n"; $xml_output .= "<kurzy>\n"; for($x = 0 ; $x < mysql_num_rows($proved) ; $x++){ $row = mysql_fetch_assoc($proved); $xml_output .= "\t<kurz>\n"; $xml_output .= "\t</kurz>\n"; } $xml_output .= "</kurzy>"; echo $xml_output; ?> my code write error, no. problem ? missing closest of while loop } last line $data=mysql_query("select * ``&qu

javascript - Simple web SPA with API and MONGOOSE (issue with id's) -

i creating simple anjularjs spa connecting mongoose via api. app take in new member, display new member , if click on members name in list should able edit member in screen. but when click on members name edit it not give me member on page edit, cannot specify correct member edit. when hover on member name expect see id mongoose member instead see: localhost:4000/#/members/ (i think should seeing (with id mongoose)???? : localhost:4000/#/members/553778bb92de243be1c61c6d ) where going wrong index's / id's?? here members.html page showing list of members, should able move new page when click members name edit member can't. see "{{memb.name | uppercase}}" below... members.html <div class="col-sm-7 col"> <div class="csstablegenerator" > <h2 align="center">registered club members</h2> <table> <tr><td>name</td>&

javascript - d3 choropleth map having problems with filling colors -

i followed mike bostock choropleth example trying make world population choropleth map i'm having trouble filling in colors correctly. here's code , data: http://bl.ocks.org/jeremycflin/572ca92be1dfe68ac0d3 really, answers or can take me right direction appreciated. thank in advance! maybe try different scale? china has quite lot of people, pushing of countries lower segments. everyone starting place 4 @ lowest segment. quantize(1330141295) // china >"q8-9" quantize(1173108018) // india >"q7-9" quantize(310232863) // united states >"q2-9" quantize(242968342) // indonesia >"q1-9" quantize(201103330) // brazil >"q1-9" if replace maximum scale example population of brazil you'll see there more colors used. var quantize = d3.scale.quantize() .domain([0,201103330]) .range(d3.range(9).map(function(i) { return "q" + + "-9"; })); you use the quantile

html - How to trigger neighbour element to "this" object in jquery -

i have 1 button - <a> link , list - ul. need show/hide list when click on button. here code: <div class="wide-tile" id="tile-1"> <div class="size-set"> <a href="#" class="toggle-btn"> > </a> <ul class="size-list"> <li>1x1</li> <li>1x2</li> <li>2x1</li> <li>2x2</li> </ul> </div> <a href="details.html" class="wide-tile-link"> <span class="title">about us</span> </a> </div> the problem is: have many tiles , each of has same "set-size" class div. when press on link need toggle ul list. far i've done on jquery $(".size-set").click(function(){ $(".toggle-btn",this).click(function(){ $(".size-list",this).toggle("

ios - Make UIAlertViewController action unclickable? -

i want make uialertaction unclickable. have uialertview pops when try download something. when download finishes, want uialertview's action go being unclickable clickable. when becomes clickable, means download has finished. here's have far: @iboutlet var activityview: uiactivityindicatorview! var alert = uialertcontroller(title: nil, message: "please wait...", preferredstyle: uialertcontrollerstyle.alert) override func viewdidload(){ self.activityview = uiactivityindicatorview(activityindicatorstyle: uiactivityindicatorviewstyle.whitelarge) self.activityview.center = cgpointmake(130.5, 65.5) self.activityview.color = uicolor.blackcolor() } @ibaction func importfiles(sender: anyobject){ self.alert.view.addsubview(activityview) self.presentviewcontroller(alert, animated: true, completion: nil) alert.addaction(uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil)) //somehow here want make uialertact

webserver - How to solve lighttpd "No input file specified." -

last time using apache2+php5 web server , run unless slow when server process script , had change lighttpd + fastcgi. faster , low memory usage. my problem when lighttpd running time "no input file specified." time ok. when restart lighttpd every come normally. don't know why , how solve it. this config. $server["socket"] == ":80" { $http["host"] == "xxx.xxx.xxx.xxx" { server.document-root = "/var/www/public_html" server.errorlog = "/var/www/public_html/logs/error.log" accesslog.filename = "/var/www/public_html/logs/access.log" compress.cache-dir = "/var/www/public_html/cache" } $http["host"] == "sub.domain.com" { server.document-root = "/var/www/public_html" server.errorlog = "/var/www/public_html/logs/error.log" accesslog.filename = "/var/www/public_html/logs/access.log", compress.cache-dir = "

python - Conditional summing of columns in pandas -

i have following database in pandas: student-id last-name first-name hw1 hw2 hw3 hw4 hw5 m1 m2 final 59118211 alf brian 96 90 88 93 96 78 60 59.0 59260567 anderson jill 73 83 96 80 84 80 52 42.5 59402923 archangel michael 99 80 60 94 98 41 56 0.0 59545279 astor john 93 88 97 100 55 53 53 88.9 59687635 attach zach 69 75 61 65 91 90 63 69.0 i want add columns have "hw" in them. suggestions on how can that? note: number of columns containing hw may differ. can't reference them directly. you df.filter(regex='hw') return column names 'hw' , apply sum row-wise via sum(axis-1) in [23]: df out[23]: studentid lastname firstname hw1 hw2 hw3 hw4 hw5 hw6 hw7 m1 0 59118211 alf brian 96 90 88 93 96 97 88 10 1 59260567 anderson jill 73 83

get - PHP append content to a file (reading/writing of a file) -

i'm still rather new php , i'm working on trying kinda this; down.php?days=numberhere take number , write file , display file in spot, know how display file i'm not sure how write file if point me in direction learn or me out that'd great, i've looked around few days , haven't seen help thanks edit: i've re-read question , of answers, , don't know if clear in i'm trying accomplish; basically, if cooldowns.txt has "10" , ?days=7, cooldowns.txt needs become 17 instead of adding numbers file update: i've come based on replies question, i'm wondering if there's way make add ? (ie = 1 + whatever file has, if file has 25 , = 1 file becomes 26) from quote: i've come based on replies question, i'm wondering if there's way make add ? (ie = 1 + whatever file has, if file has 25 , = 1 file becomes 26) // retrieve data file.txt , type cast integer $current = (int) file_get_contents('f

java - Drools, if one of multiple values not equals null then assign this values to variable -

drools, if 1 of multiple values not equals null assign values variable how can resolve logic accodting drools syntax ?? when man ($vallet : man.vallet != null || man.getattribute("vallet") != null) ... only 1 wont equal null you can rewrite rule bind either value of vallet or getattribute("vallet") based on 1 not null: rule when man( $vallet : vallet != null ) or man( $vallet : getattribute("vallet") != null ) ...

How do I retrieve a value from two objects in Java? -

i want following: myobject obj1 = new myobject(); myobject obj2 = new myobject(); myobject obj3 = new myobject(); myobject obj4 = new myobject(); values[obj1][obj2] = 1; values[obj2][obj4] = 2; values[obj1][obj4] = 3; int somevalue = values[obj1][obj2]; int someothervalue = values[obj2][obj4]; int anothervalue = values[obj1][obj4]; how create these getter , setters 2 objects key in java? you can use class return 2 object.. may can work around this final class myresultobject { private final myobject firstobject; private final myobject secondobject; private final int key; public myresult(myobject firstobject, myobject secondobject ,int key) { this.firstobject = firstobject; this.secondobject = secondobject; this.key=key; } public int getkey() { return key; } public int getkeyvalue(myobject object1, myobject object2){ }

debugging - c# snake game list of button -

i confused below code: public partial class form1 : form { struct movedata { public button s; public point pos; }; struct snake { public point headpos; public list<movedata> snob; public point posfood; }; int limx; int limy; list<point> food; list<snake> simpan; snake temps; movedata temd; random rnd = new random(); public form1() { initializecomponent(); limx = groupbox1.width; limy = groupbox1.height; simpan = new list<snake>(); temps = new snake(); temps.posfood = new point(); temps.headpos = new point(); temps.snob = new list<movedata>(); temd = new movedata(); temd.s = new button(); temd.s.width = 30; temd.s.height = 30; // temd.s.visible = false; temd.pos = new point(); createsnake(150, 150, 4); } private void form1_l

python 2.7 - Error using pytesseract -

i using pytesseract convert images text. installed pytesseract pip command. when run script, shows me error : no module named tesseract . these codes : from tesseract import image_to_string image = image.open('input-nearest.tif') print image_to_string(image) error : traceback (most recent call last): file "c:\users\j's magic\desktop\py\new1.py", line 1, in <module> tesseract import image_to_string importerror: no module named tesseract pil import image import pytesseract tess print tess.image_to_string(image.open('3.png'), lang='tur') try this

css - How can use JavaScript to set a style with !important? -

this question has answer here: i'm unable inject style “!important” rule 6 answers i have no problems except when trying add !important . not take. need add in order override font size dynamically. here how adjusting style: function newfont(newsizea) { var elems = document.getelementsbyclassname('a'); for(i=0; i<elems.length; i++) { elems[i].style.fontsize = newsizea + 'px!important'; } } newfont(20); with !important fails, without !important works. edit: needs work ie8 hoping there cross browser solution knows of. your css won't parse !important declaration when written way (it's expecting legal values fontsize in value space, means numbers, not numbers , string). instead, can write way, setting style attribute. this should supported ie8 , up, according quirksmode , msdn . function

Issues with loading dump file in to redis database -

i have dump.rdb file obtained redis server. trying load dump file in redis database unsuccessful. here sequence of steps performed: stop redis on machine sudo /etc/init.d/redis_6379 stop copy dump file on system sudo cp downloads/dump.rdb ../../../var/lib/redis/6379/ start redis sudo /etc/init.d/redis_6379 start open client connection locally redis-cli check dbsize dbsize (integer) 0 not sure doing wrong. newbie redis , went through other answers explaining how load dump file unsuccessful. check redis.conf configuration file make sure dbfilename , dir configurations match of dump file. # name of dump file dbfilename dump.rdb # directory name of dump file. dir /var/lib/redis/6379/ ensure dump.rdb file has proper permissions setting; i.e. user:group should redis:redis , mode 644 .

python - How to get the name of lists for comparison purposes -

this may sound bit funny, trying do: have 2 lists: mylist1 , mylist2 . passing these lists function perform specific task depending on list receives (i.e., based on name of list, not content). def listprocessor(data): if data == 'mylist1': perform task1 else: #meaning data mylist2 perform task 2 is there way in python 3 inquire of name of list (or tuple, dictionary, etc.) , comparison this? obviously, way doing here isn't working since it's comparing content of list 'data' single string 'mylist1', isn't working! :-). there few ways this: you can create separate functions if needs done each list separate. you can update function either: take 2 lists argument: def list_processor(list1=none, list2=none): if list1: # stuff list1 if list2: # stuff list2 you can add flag, identifying kind of action performed, , set default well: def list_processor(some_list=none, type_of_list=1):

python - Set the color of y axis coefficient in matplotlib -

Image
this python code: import matplotlib.pyplot plt import numpy np # create data data = np.random.randn(200, 2) data = data * 1e20 assert(data.ndim == 2) assert(data.shape[1] == 2) x = np.arange(data.shape[0]) fix, ax1 = plt.subplots() ax1.plot(x, data[:, 0], 'b') in ax1.get_yticklabels(): i.set_color('b') ax1.set_ylabel('', color='b') ax2 = ax1.twinx() ax2.plot(x, data[:, 1], 'r') in ax2.get_yticklabels(): i.set_color('r') plt.show() i trying plot 2 curves sharing same x axis on 1 plot. want have different colors 2 y axes. result: the thing is, on left y axis, there coefficient "1e20" on top. want colored blue too. how can achieve that? in matplotlib, coefficient referred "offset text" axis associated with. can access calling get_offset_text() method on appropriate axis object. can use various formatting methods. in case, you'll want call set_color() method on each of y axes. can accomp

c++ - Why do I get the error "configure: error: Cannot find glib: Is glib-config in path?"? -

i tried sudo apt-get install libglib2.0-dev , got libglib2.0-dev newest version. and still error configure: error: cannot find glib: glib-config in path? i trying install netdude. getting problem when trying install libnetdude. glib-config glib 1.x, not glib 2.0.

How to loop NSTimer in SWIFT with a specific number of counting -

i trying loop timer specific number of counting... eg... 1, 2, 3, 4, 5 then loop again, same counting, 10 times, stop. i able counting, can't looping of counting. what doing wrong? var times = 0 var stopcounting = 10 @ibaction func buttonpressed(sender: uibutton) { self.starttimer() } func starttimer(){ self.timer = nstimer.scheduledtimerwithtimeinterval(1.0, target: self, selector: selector("startcounting"), userinfo: nil, repeats: true) } func startcounting (){ times += 1 if times < stopcounting + 1{ if counter > -1 && counter < 6 { counting.text = string(counter++) } else if counter == int(counting.text) { counting.text = "0" } } import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var strtime: uilabel! var timer = nstimer() var endtime: nstimeinterval = 0 var now: nstimeinterval { return nsdate().timeintervalsincer

c - Is there a way to use rand() with a variable? -

i want use rand in loop int variable decrements during each loop. can randomnumber = rand()%d, otherintvar; ? edit: everyone, can put name of integer variable there instead of number , work. i think you're trying accomplish this: #include <stdio.h> #define iteration_count 10 // define loop count here #define init_value 100 // define initial value here int main() { int i, num, val; val = init_value; for(i = 0; i<iteration_count; ++i) { num = rand() % val; // yields random number between [0-val] --val; // define how needs decremented // program logic } // program logic return 0; } however, should add control logic otherwise not results predicted. (set iteration count , decremential rate proportional eachother example.)

scala - Using an implicit parameter in a recursive function -

consider following hypothetical binary tree traversal code: def visitall(node: node, visited: set[node]): unit = { val newvisited = visited + node if (visited contains node) throw new runtimeexception("cyclic tree definition") else if (node.hasleft) visitall(node.left, newvisited) else if (node.hasright) visitall(node.right, newvisited) else () } i reduce duplication making visited parameter implicit, so: def visitall(node: node)(implicit visited: set[node]): unit = { implicit val newvisited = visited + node if (visited contains node) throw new runtimeexception("cyclic tree definition") else if (node.hasleft) visitall(node.left) // newvisited passed implicitly else if (node.hasright) visitall(node.right) // newvisited passed implicitly else () } however, gives following compile error: ambiguous implicit values: both value visited of type set[node] , value newvisited of type scala.collection.immutable.set[node] match expected

c# - Making a progress bar update in real time in wpf -

i'm having trouble making progress bar show updates in real time. this code right now for (int = 0; < 100; i++) { progressbar1.value = i; thread.sleep(100); } but reason progress bar shows empty when function runs, , nothing until function finishes running. can explain me how can done? i'm new c#/wpf i'm not 100% sure on how implement dispatcher on different thread (as seen on other posts) fix problem. to clarify, program has button when press, grabs value textbox, , uses api retrieve info, , create labels based on it. want progress bar update after every row of data finished processing. this have right now: private async void search(object sender, routedeventargs e) { var progress = new progress<int>(value => progressbar1.value = value); await task.run(() => { this.dispatcher.invoke((action)(() => { pre-processing before actual loop occur (int = 0; < numberofrows; i++)

How to bypass java.nio.file.DirectoryNotEmptyException? -

this question has answer here: how delete folder files using java 18 answers is there way bypass java.nio.file.directorynotemptyexception? want able delete folder content in it. is there way bypass java.nio.file.directorynotemptyexception ? no. there no way bypass it. on linux / unix, restriction imposed operating system. see man 2 rmdir , , enotempty error code. also, try running rmdir command prompt on non-empty directory, , see happens. as other comments state, need empty directory first.

Allow use of system python in conda env? -

is there way force conda use system version of python (along of system libraries) in given env? i have conda enabled default in shell, can bit annoying, because if try run system python app, gets different version of python expecting (python still defaults 2.7 on *buntu), , won't run. root env of conda redirect system python install. you need edit user shell run commands such .bashrc file prepend bin directory of anaconda path export path=~/anaconda/bin:$path , while in root run commands append export path=$path:~/anaconda/bin . in both cases have access conda command. can check python run typing $env python --version . can check other versions available , order of priority (if other removed) using $type -a python . of course ensure executable python files have #!/usr/bin/env python , not other direct route python executable. further info google bash shell queries http://www.cyberciti.biz/tips/an-example-how-shell-understand-which-program-to-run-part-ii.html .

javascript - Audio tag, how to handle it from Angular -

i using html5 audio tag, want control angular, according guidelines don't have touch dom controllers have create directive. let's have 2 buttons <button onclick="playmusic()" type="button">play music</button> <button onclick="pausemusic()" type="button">pause music</button> and in js part var music = document.getelementbyid("mymusic"); function playmusic() { music.play(); } function pausemusic() { music.pause(); } but need transcript angular, so, how can create directive ? or hoy can implement in controller ? in angular, dom manipulation should handled in directive (see documentation ). separate concerns , improve testability of other angular actors such controllers , services . a basic directive play audio might ( fiddle ): app.directive('myaudio', function() { return { restrict: 'e', link: function(scope, element, attr) {

python - Execution Code Tracking - How to know which code has been executed in project? -

let have open source project borrow functionality. can sort of report generated during execution and/or interaction of project? report should contain e.g.: which functions has been called, in order, which classes has been instantiated etc.? would nice have graphic output that... know, if else tree , highlighted executed branch etc. i interested in python , c (perl fine too) if there universal tool cover multiple languages (or 1 tool per language) that, nice. ps: familiar debuggers not want step every singe line of code , check if correct instruction. i'm assuming if functions/methods/classes etc. named 1 can hints find desired piece of code. naming not enough because not know (from brief overview of code) if looking function foo() not require data generated obscure function bar() etc. reason looking can visualize relations between running code. ps: not know if question or programmers.stackexchange. feel free move if wish. ps: i've noticed tags i've used

c - Android Studio, LOCAL_C_INCLUDES += /foo/bar/include not working? -

i have android studio project uses ndk , can't include paths work. let have app/src/main/jni/foo/bar/file.c and includes "my/lib/inc.h" when add local_c_includes += /home/user/include/ (to app/src/main/jni/android.mk) where folder "my" located still file not found ndk-build if add "my" app/src/main/jni works fine. what missing? android studio ignoring android.mk , generating own. at present instant in time, ndk isn't supported android studio, , although find various version-specific gradle rule modifications have apparently worked authors, may easier build ndk code , merely let packaging stage pickup results.

cocoa - Objective-C: Why is my object being instantiated as __NSMallocBlock__? -

i running strange problem trying dynamically create new instance of class property ( arrayclass ) have set , stored previously: nsobject *instance = [[self.arrayclass alloc] init]; if ( ![instance iskindofclass:self.arrayclass] ) nslog(@"say what?!"); if break , log self.arrayclass , shows proper class on console (in case, called store ), when attempt create instance of dynamically , log type of instance, showing class __nsmallocblock__ . what heck going on?? it turns out silly mistake indeed. had somehow created empty init method in class trying instantiate, had forgotten implement (or return anything). strangely, compiler didn't complain this. here's empty init method looked like: - (instancetype)init { } obviously since i'm not defining or returning self , runtime doesn't object init expects. does get, oddly enough, comes __nsmallocblock__ type, , trying pretty object result in crash.

bash - Building the find regex parameters in shell scripts -

i'm trying build parameters used in regex expression in find command shell script seems not work. objective of shell script able find files according specified parameters in shell script. the shell script looks like: #!/bin/bash ids=$1 folder="/tmp" modulenamepattern=`echo $ids | sed "s/,/|/g"` modulenamepattern=".*\\.\\($modulenamepattern\\)" echo "find command: find $folder -follow -type f -regex \"$modulenamepattern.suffix\"" filefound in `find $folder -follow -type f -regex "$modulenamepattern.suffix"`; echo $filefound done; to launch it, use following command: ./test pattern1,pattern2 it generate following output: find command: /tmp -follow -type f -regex ".*\.\(pattern1\|pattern2\).suffix" but nothing more. unfortunately, if execute generated find command terminal, generate following output: /tmp/folder1/.pattern1.suffix /tmp/folder2/.pattern1.suffix /tmp/folder2/.pattern2.suffi

diagram - How to generate dependency graph with text -

is there simple online tool generate dependency graph (boxes linked arrow lines) based on text input like: a -> b much one: www.websequencediagrams.com (it generates sequence diagram) after fact, better solution graphviz. see here: http://www.webgraphviz.com/ digraph g { a->b }

Android lib-project generated from command line misconfigured by default -

i need generate android library projects , build them command line. i'm running issue misconfigured default when generated , i'm not sure how fix other manually editing misconfigured files. i run android command commandline this: android create lib-project -n test -t 2 -k net.marklar.test -g -v 1.1.3 -p . this causes project generated declares dependency on gradle 1.12 in test/gradle/wrapper/gradle-wrapper.properties, though android gradle plugin requires 2.1+ work: distributionurl=http\://services.gradle.org/distributions/gradle-1.12-all.zip once replace line in gradle-wrapper.properties still have issue build.gradle file has following line: runproguard false runproguard has been renamed minifyenabled in plugins version 1.0.0+. replacing line minifyenabled fixes build. does know have setup incorrectly cause projects generated old/deprecated configuration?

javascript - Best way to 'return true' based on conditions from nested functions -

this may novice question trying create function returns true . however, based on happens within several other functions inside. function checkgeo(){ // check geolocation if( "geolocation" in navigator ) { navigator.geolocation.getcurrentposition( function(position){ sessionstorage.pinlat = position.coords.latitude; sessionstorage.pinlon = position.coords.longitude; // position object set! }); // position not defined if ( position.coords.latitude && position.coords.longitude ){ return true; } } } this order want things happen geolocation check i'm bit surprised nested if tested before getcurrentposition method finishes. putting condition within getcurrentposition success function , returning true there not make checkgeo return true. how check if asyncronous function has ended , therefore check results in order return true ? have function ha

Is it possible to use javascript to set the return value of an html file called from a batch file? -

in win7, want pass arbitrary integer return code or errorlevel html/javascript file batch file started it. is there way can use javascript in html program set return or errorlevel code? edit: woohoo! thanks! yeah, ie executes sample hta code. that leaves question of how can manipulate errorlevel code out of javascript in hta program. wikipedia blurb says can control system hta file, javascript doesn't seem have commands so, though hta allows it. i still feel 1 of paralyzed 'locked-in' patients have communicate trying blink eyes.

python - pip install test dependencies for tox from setup.py -

i made project setuptools , want test tox . listed dependencies in variable , added setup() parameter ( tests_require , extras_require ). project needs install of dependencies listed in tests_require test pip install not installing them. i tried did not work: install_command = pip install {opts} {packages}[tests] how can install test dependencies without having manage multiple dependency lists (i.e. having dependencies listed in both test_requirements.txt , tests_require variable)? i've achieved committing slight abuse of extra requirements . there trying extras syntax, tests_require deps aren't automatically available way. with setup.py this: from setuptools import setup test_deps = [ 'coverage', 'pytest', ] extras = { 'test': test_deps, } setup( # other metadata... tests_require=test_deps, extras_require=extras, ) you can test dependencies installed extras syntax, e.g. project root directory:

java - Divide n Conquer (Secret Sharing through minimum calls) -

there n number of students in class. teacher tells 1 secret each student. way share secret through phone call. using divide , conquer, design algorithm find minimum number of phone calls required each student secrets. one of friend asks me this. put time make sketch i.e. have array of students , i'll break recursively until have 1 student , upon joining them i'll make count call has been made between these two. while combining 2 pairs i'll count 2 calls , on. point troubling me or may here missing something. x1 x2 (1 call) x3 x4 (1 call) x1 -----> x3 x2 -----> x4 (2 more calls) any assistance appreciated. the optimum scheme n>=4 people share n pieces of information 2n-4 shown in paper . the divide , conquer approach problem illustrated follows: for 4 persons a, b, c , d, say, take conversations ab, , cd, followed ac , bd. every additional person p, schedule 1 conversation ap, before a, b, c , d interc

node.js - Issue selecting collection properties using Mongoose mixed schema -

i'm working on project involves creating pages external source. since these external sources variable in nature, cannot strictly define schema use. did research , learned mongoose's mixed schema type , created following model: var pagetemplate = new mongoose.schema( { }, { strict: false } ); during import process, perform upsert operation update existing entries , insert new ones: pagetemplate .findoneandupdate( { slug: page.slug }, page, { upsert: true } ); everything works great far. problem arises when later try fetch entries. when console.log entire object, expect--the entire object. reason, when go access single property, undefined . pagetemplate.findone( { slug: slug }, function(err, page) { console.log(page); // prints entire object console.log(page.slug); // undefined } ) have misunderstood how mixed schemas supposed b

Need guidance on whether to use Telerik WPF controls or Caliburn Micro or both -

not sure if appropriate forum this, need guidance further down road wpf. i've used telerik winform controls years , have mixed feelings them. good, nested, have steep learning curve, , don't perform best. example, working radwindow in wpf designer, it's slow compared native wpf controls. i caliburn.micro mvvm framework , mahapps metro styles, keep same , feel ribbon bar i'd need use third party tool (like fluent) or use microsoft ribbon view control , figure out how use templates , styles myself (or find existing metro template it). i tried combine telerik , caliburn had trouble getting them work. there caliburn telerik library based on caliburn micro 1.5.2 , i'm trying use caliburn.micro 2.0.2. problem aero-looking full window title bar , frame wrapped around telerik styled window. i don't know enough conventions , such make work together. , frankly, not sure it's worth trouble. i'm looking more streamlined approach lessens dependence on pri

performance - Reduice time computation using parallel package in R -

i searched couldn't find similar question, apologies in advance if duplicate question. trying generate data frame within loop in r. what want use package parallel compute function n=10^9 differents values. so code did: 1- generate sample of data, , parameters of model : data=data.frame(c=rnorm(10,150,12),k=rnorm(10,95,7),s=rnorm(10,125,9.5),t=rnorm(10,25,5)) round(data, digits = 0) para_h<-c(0.001,0.002,0.0000154,0.00052,-0.68) 2- function use : fc_q<-function(x,para_h,data){ t=data$t; s=data$s; k=data$k; r=0.05/250 w=para_h[1];b=para_h[2];a=para_h[3]; c= para_h[4]; neta=para_h[5] nu=(1/(neta^2))*(((1-2*neta)^(1/2))-1) u=1i*x ; z=length(s) fc_q <- rep(na, z) (i in 1:z){ a_q=0 ; b_q=0 steps<-round(t[i]*250,0) (j in 1:steps){ a_q= a_q+ r*u + w*b_q-(1/2)*log(1-2*a*(neta^4)*b_q) b_q= b*b_q+u*nu+ (1/neta^2)*(1-sqrt((1-2*a*(neta^4)*b_q)*( 1- 2*c*b_q - 2*u*neta))) } fc_q[i]= exp(log(s[i])*u + a_q + b_q*(0.001

r - How to add percentage or count labels above percentage bar plot? -

Image
using ggplot2 1.0.0 , followed instructions in below post figure out how plot percentage bar plots across factors: sum percentages each facet - respect "fill" test <- data.frame( test1 = sample(letters[1:2], 100, replace = true), test2 = sample(letters[3:8], 100, replace = true) ) library(ggplot2) library(scales) ggplot(test, aes(x= test2, group = test1)) + geom_bar(aes(y = ..density.., fill = factor(..x..))) + facet_grid(~test1) + scale_y_continuous(labels=percent) however, cannot seem label either total count or percentage above each of bar plots when using geom_text . what correct addition above code preserves percentage y-axis? staying within ggplot, might try ggplot(test, aes(x= test2, group=test1)) + geom_bar(aes(y = ..density.., fill = factor(..x..))) + geom_text(aes( label = format(100*..density.., digits=2, drop0trailing=true), y= ..density.. ), stat= "bin", vjust = -.5) + facet_grid(~t

html - what is <meta charset="utf-8">? -

this question has answer here: what happens when don't specify <meta charset=“utf-8”>? 2 answers i started learning html (no coding background) , don't know means. write when start code after have no idea means. not know doctype means. happen if don't use it? the characters reading on screen each have numerical value. in ascii format example letter 'a' 65, 'b' 66, , on. if @ table of characters available in ascii see isn't use wishes write in mandarin, arabic, or japanese. characters / words languages displayed needed system of encoding them , numbers stored in computer memory. utf-8 1 of encoding methods invented implement requirement. let's write text in kinds of languages, french accents appear fine, text this Бзиа збаша (bzia zbaşa), Фэсапщы, Ç'kemi, ሰላም, , right-to-left writing such السلام عليكم

ios - NSString wordwrapping like UILabel NSLineBreakByWordWrapping -

i want wordwrapping string wanted dynamic height calculations purpose, because in uilabel nslinebreakbywordwrapping, counting string height dynamic purpose easy adjust uilabel height please can buddy let me know wordwrapping in string ? cgsize size = cgsizezero; nsstring *carnamestring = cars.name; carnamestring = [carnamestring stringbyreplacingoccurrencesofstring:@"\n" withstring:@"\n\n"]; cgrect f1 = [carnamestring boundingrectwithsize:cgsizemake([[uiscreen mainscreen]bounds].size.width, cgfloat_max) options:nsstringdrawinguseslinefragmentorigin attributes:@{ nsfontattributename:[uifont fontwithname:@"copperplate" size:20] } context:nil]; size = cgsizemake(f1.size.width, f1.size.height + 1); note: using ios version 6.3 edit: here uilabel code: [carlabel setbackgroundcolor:[uicolor clearcolor]]; [carlabel settext:carnamestring]; [carlabel setadjustsfontsizetofitwidth:yes]; [carlabel setlinebreakmode:nslinebreakbywordwrapping]

c# - Why do I get a 'System.ArgumentOutOfRangeException' when setting the Text for a row cell? -

using number of queries, shown in code below, following exception: an exception of type 'system.argumentoutofrangeexception' - specified argument out of range of valid values on line: e.row.cells[3].text = count; what problem? tried countless different things, can't working. novice @ this. sqlconnection conn; conn = new sqlconnection("data source=.\\sqlexpress;attachdbfilename=" + server.mappath("~\\app_data\\forumdb.mdf") + ";integrated security=true;user instance=true"); conn.open(); sqlcommand comm; comm = new sqlcommand("select count(threadid) [threads] [topicid] = @topicid", conn); sqlcommand comm2; comm2 = new sqlcommand("select max(posteddate) [threads] [topicid] = @topicid", conn); sqlcommand comm3; comm3 = new sqlcommand("select postedby threads posteddate=(select max(posteddate) [threads] [topicid] = @topicid", conn); //for command1 cmd comm.parameters.add("@topicid", system

Bubble Sort Manually a Linked List in Java -

Image
this first question here. trying manually sort linked list of integers in java , can not figure out wrong code. suggestions? don't error, still have output unordered. tried few different ways, nothing worked. appreciate if can me that. public class node { int data; node nextnode; public node(int data) { this.data = data; this.nextnode = null; } public int getdata() { return this.data; } } // node class public class datalinkedlist implements datainterface { private node head; private int size; public datalinkedlist(){ this.head = null; this.size = 0; } public void add(int data) { node node = new node(data); if (head == null) { head = node; } else { node currentnode = head; while(currentnode.nextnode != null) { currentnode = currentnode.nextnode; } currentnode.nextnode = node;

javascript - text ouptut in form validation running out of the output message box -

i have form after submission displays result in box, when enter information (text) in text box (textarea) runs out of box in output. solution thought work, modify style of id="output" @ bottom of page width:450px, didn't work.... there other suggestions? here's link form here's code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta content="computer repair, laptop repair, wireless installation, printer installation, printer repair, system administration, website design, web administration, logo design, web application development, computer repair miami fl, web design miami fl, system administration miami fl" name="keywords"> <meta name="computer soloution small busin