Posts

Showing posts from July, 2010

c++ - Check the license in the constructor -

i need protect c++ library writing. library has single entry point via class called foo . did is: //.hpp class foo{ public: foo(); .... } //.cpp foo::foo(){ if(check_for_lic()==result::failed){ throw no_lic_exception(); } } the class has 1 constructor. my question enough? in other words, without reverse engineering, possible developer construct foo without checking license? p.s. distribute headers , static library .lib (or .a ) if has header file, can add another, overloaded constructor foo, doesn't check license, , use that.

dictionary - How to return coordinates to input html tag when click in a google map -

i'm new in group , need situation. need put maps in page html dinamically activities users must click in map , code must return link of position in input html tag, next user must save, because position showed in other site. case, need know, if must buy service in google, because reading use api, , in other hand, if can me example code, how do? thank help. javier.

playframework - Map data from a Scala Future -

i'm implementing task calling rest endpoint in play framework, here's code in service: override def getaccesstoken(logindata: logindata): future[unit] = { logger.info("get access token hat") val accesstokenurl = // url called logger.info(accesstokenurl) ws .url(accesstokenurl) .withhttpheaders( headernames.accept -> contenttypes.json, "username" -> logindata.username, "password" -> logindata.password ) .withrequesttimeout(timeout) .get() .map { response => response.status match { case status.ok => val responseasjson = response.json future.successful((responseasjson \ "accesstoken").as[string]) case _ => val message = (response.json \"message").asopt[string] throw new generalbadrequestexception(message.get) } } } the response of val acce

setting parameters of openCV tracking API in python -

i'm trying use opencv tracking api in python object tracking. tried code in this link , don't have problem running code. but, looking @ opencv documentation here , realized there parameters each of tracking algorithms. how can set these parameters in python? had hard time trying figure out, no success.

import packages not work python 3 -

i create packages in python 3 , went try import in main folder not work my architecture --mainfolder --__init__.py --start.py --packages --__init__.py --file1.py --file2.py when start programme console this python3 start.py i have error traceback (most recent call last): file "start.py", line 8, in <module> packages import class1 importerror: cannot import name 'class1' my fist init file in mainfolder empty in init in packages try 1 from .file1 import class1 2 from . import class1 3 from . import file1 in start.py try call module in many ways 1 from packages import class1 2 from .packages import class1 3 from . import class1 edit in packages/file1 code this import time import sys class class1(objet): def run(self): print('test') in call file in start.py this class1().run() i try how import module sub directory this cannot import modules in python3 sub directory

javascript - Positioning Element of jQuery using append -

Image
when dragging 1 container want element append inside container. feature can't seem decipher why when element appends offset container trying drop in. it might have css cannot pinpoint going on. depicted below happening. to this i want box in borders of new box appending to. the code html <!doctype html> <html > <head> <meta charset="utf-8"> <title>grid-cell playground</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/li

php - How to Auto serving laravel -

is there way auto serving laravel project? i'm using virtual host. <virtualhost *:80> #laragon magic! documentroot "c:/laragon/www/pos/public/" servername apk.dev serveralias *.apk.dev </virtualhost> and access locally open cmdr , write php artisan serve --host 192.168.1.100 --port 80 every single time. and access other device 192.168.1.100 it's working fine, want know there way don't need repeat it, , running laragon can access apk.dev other device local network?

r - Dropping columns in a data frame that are not in another data frame -

i facing problem matching data in 2 data frames. have 1 data frame stock prices , company revenues. however, companies in both data frames not same. here reproducible example of dealing with: aapl <- c(50,55,75,40,60) msft <- c(80,65,70,75,80) ge <- c(20,25,30,25,35) prices <- data.frame(aapl,msft,ge) aapl <- c(100,110,120,110,100) msft <- c(200,185,195,170,180) pfe <- c(80,70,80,75,75) revenues <- data.frame(aapl,msft,pfe) i have new data frame ratio price/revenues companies in both data frames. this. aapl.ps <- c(0.5,0.5,0.625,0.364, 0.6) msft.ps <- c(0.4,0.351,0.359,0.441,0.444) price.sales <- data.frame (aapl.ps,msft.ps) i new in r , have been struggling while. any insight on how can this? thank in advance you this... common <- intersect(names(prices),names(revenues)) #common column names price.sales <- prices[,common]/revenues[,common] #just use columns price.sales aapl msft 1 0.5000000 0.4000000 2 0.

python - Selenium - Collect info from every item in a list -

sorry newbie question here, i'm trying learn web scraping working on yelp's eat24.com site. able 1) driver eat24.com, 2)choose pickup, 3) search location, 4) click on first menu , 5) collect menu items. i'm unable, however, go original list of restaurants , choose next menu in list. here code: from selenium import webdriver import time selenium.webdriver.support.ui import webdriverwait selenium.webdriver.common.keys import keys driver = webdriver.chrome() #go eat24, type in zip code 10007, choose pickup , click search driver.get("https://new-york.eat24hours.com/restaurants/index.php") search_area = driver.find_element_by_name("address_auto_complete") search_area.send_keys("10007") pickup_element = driver.find_element_by_xpath("//[@id='search_form']/div/table/tbody/tr/td[2]") pickup_element.click() search_button = driver.find_element_by_xpath("//*[@id='search_form']/div/table/tbody/tr/td[3]/button") s

typescript - Angular 4 Firebase Observable with .map() apears two times on refresh and not reversed -

Image
i using angular 4 firebase , angularfire. want display on html code first top 10 users, code is export class homefillercomponent implements oninit { topusers: observable<any>; constructor(db: angularfiredatabase,public authservice: authservice) { this.topusers = db.list('users', { query: { orderbychild: "totalscore", limittolast: 10, } }).map((topusers) => {console.log(topusers); return topusers.reverse();}) } my firebase database is: "users" : { "test1" : { "totalscore" : 50, "username" : "test1" }, "test2" : { "totalscore" : 30, "username" : "test2" }, "test3" : { "totalscore" : 20, "username" : "test1" }, "test4" : { "totalscore" : 10, "username"

.net - How to dynamically change ListView color (skip one line) -

using vb.net , tried many times achieve couldn't worked. i need achieve below on listview dim myrow string each myrow in listview listview1.backcolor = color.blue next listview image listview1 you can use mod operator. dim mylistview listview dim myrow listviewitem dim rowcnt integer = 0 each myrow in mylistview.items if rowcnt mod 2 = 0 myrow.backcolor = color.blue else myrow.backcolor = color.gray end if rowcnt = rowcnt + 1 next

awk - I want to check the numbers in the 1st column is equal to 2nd column -

i want check numbers in 1st column equal 2nd column, , 1st column should starting abc , ending def , number between these should matching 2nd column. can me here please. my input: abc 12345 def | 12345 |23132331331| abc 95678 def | 45678 |23132331331| abc 87887 def | 86187 |23132331331| abc 89043 def | 89043 |23132331331| output should be: abc 12345 def | 12345 |23132331331| abc 89043 def | 89043 |23132331331| i'm trying use foollowing one, it's not working. awk -f '|' '($1 !~ /abc+[$2]+def/)' whtfile.txt > qc2valid.txt this should work requirement: awk -f'|' '{s=$2;sub(/\s/,"",s)}$1 ~ s' input abc12345def |12345 |23132331331| abc89043def |89043 |23132331331| the problems in codes: you cannot concatenate strings in awk + you cannot concatenate strings in awk between /.../ , static regex expression you should use ~ instead of !~ , requirement describ

jenkins - Run stages in multiple nodes -

i have declarative pipeline. in pipeline want various stages not executed 1 multiple nodes (later stages, node specific, depend on these). somehow possible? sure, can select different nodes in different stages based on label: pipeline { agent none stages { stage('build') { steps { node('docker') { sh 'echo $hostname' } } } stage('test') { steps { node('rbenv') { sh 'echo $hostname' } } } } } does make sense?

java - Add dual color notification to app? -

Image
how add dual color notification icon app one: it seems apps have feature except mine. why? icon stays white. as can see, notification white , it's in color when user pulls down notification bar. simple ideas? my current code: notificationcompat.builder notificationbuilder = new notificationcompat.builder(this) .setstyle(new notificationcompat.bigtextstyle()) .setsmallicon(r.drawable.white_icon) .setcontenttitle("hello") .setcontenttext("test")

cloudfoundry - Spring Cloud Config Server - Constant Polling -

i have deployed instance of spring cloud config server in pivotal cloud foundry env. there 3 instances of app running. tailed logs , can see polling github server. [rtr/11] out ctpconfigserver.app.cloud.net - [2017-08-14t16:02:36.740+0000] "get /application/sp-prd,cloud/master http/1.1" 200 0 93 "-" "java/1.8.0_101" "" "" x_forwarded_for:"" x_forwarded_proto:"https" vcap_request_id:"f48aaa7a-1210-4fee-4471-9be18113c7b5" response_time:1.754105382 app_id:"74b03aee-f6be-4ea5-9063-d1db83d61f70" app_index:"1" x_b3_traceid:"8a4bf40fb7d4675e" x_b3_spanid:"8a4bf40fb7d4675e" x_b3_parentspanid:"-" is there way determine causing config server poll github , stop polling frequently?

Excel macro: Code for combining data from specific worksheets and refresh? -

i have workbook has 20 sheets. 11 of sheets data-based have external connections update , add lines of data entries added , workbook refreshed. other worksheets sheets tables , charts. trying use vba combine data 11 data-based sheets 1 sheet , have combined sheet refresh , update more entries added individual 11 sheets. i have code combines specific 11 sheets, however, need on refresh part. tried adding button re-run code, deletes , re-adds combined sheet, messes references in formulas. i'm hoping able re-write of code combined sheet doesn't deleted , new 1 doesn't have added, , data can updated combined sheet without screwing references. thanks. here code have far... sub copyrangefrommultiworksheets() dim sh worksheet dim destsh worksheet dim last long dim copyrng range application .screenupdating = false .enableevents = false end 'delete sheet "combinedreport" if exist application.displayalerts = false on error resume ne

resolving map function issue in python 3 vs python 2 -

i'm interested in functional programming python , working through mary rose cook's blog post a practical introduction functional programming . apparently, written in python 2 this: name_lengths = map(len, ["mary", "isla", "sam"]) print name_lengths # => [4, 4, 3] in python 3 yields this: <map object @ 0x100b87a20> i have 2 questions: why so? other converting map object list , use numpy , there other solutions? as documented, in migration guide , in python 2 map() returns list while in python 3 returns iterator. python 2 : apply function every item of iterable , return list of results. python 3 : return iterator applies function every item of iterable, yielding results. python 2 equivalent of list(imap(...)) , python 3 allows lazy evaluation.

c# - Modern UI passing parameters in Link -

i'm using modern ui, , have usercontrol viewmodel,... need reuse , need same usercontrol but, managing other data, idea send parameter in uri, in userpage constructor , set in viewmodel , problem how parameter in constructor of user control? or there better aproach? send parameters user controls in modernui ? this.menu = new linkgroupcollection(); linkgroup reportes = new linkgroup() { displayname = "show report", groupkey = "1" }; reportes.links.add(new link() { displayname = "see report", source = new system.uri("/views/reportes.xaml", urikind.relative) }); reportes.links.add(new link() { displayname = "process something", source = new system.uri("/views/process.xaml?tipo=1", urikind.relative) }); this.menu.add(reportes); linkgroup abmreporte = new linkgroup() { displayname = "report", groupkey = "1" }; abmreporte.links.add(new link() { d

bash - How to redirect part of standard output from a shell command -

i have below shell commands generate ssh key , add public key authorized keys. but, want redirect out put of command file while have prompt generated these commands enter output. ssh-keygen -f /home/$cu/.ssh/${ssh_key}_rsa -t rsa -n '' # add public key authorized keys ssh-copy-id -i /home/$cu/.ssh/${ssh_key}_rsa.pub $linux_user@$linux_machine could please provide suggestions. the answer looking command called tee split stream 2. although can complicated it, common use write file while letting streams still print out normal looking for. ssh-keygen -f /home/$cu/.ssh/${ssh_key}_rsa -t rsa -n '' | tee -a $log_file ssh-copy-id -i /home/$cu/.ssh/${ssh_key}_rsa.pub $linux_user@$linux_machine | tee -a $log_file

xsd - How to reference a local XML Schema file correctly? -

i'm having problem referencing xml schema in xml file. i have xsd in path: c:\environment\workspace\maven-ws\projectxmlschema\email.xsd but when in xml file i'm trying locate schema this, xsd not found: <?xml version="1.0" encoding="utf-8" ?> <email xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.w3schools.com file://c://environment//workspace//maven-ws//projextxmlschema//email.xsd"> the way xsd found when it's in same folder: xsi:schemalocation="http://www.w3schools.com email.xsd" so question this: how path have xsd found if xml file wasn't in same folder xsd file? by way, example i've been using msdn : they're claiming it's supposed work way tried to. doesn't. add 1 more slash after file:// in value of xsi:schemalocation . (you

python - How to post on multiple pages using django -

for project, trying build basic forum-like website; however, trying post on multiple pages instead of 1 , cannot add extend on part allows post added page: {% extends 'blog/base.html' %} {% block content %} <div class="post"> {% if post.published_date %} <div class="date"> {{ post.published_date }} </div> {% endif %} {% if user.is_authenticated %} <a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}"><span class="glyphicon glyphicon-pencil"></span></a> {% endif %} <h1>{{ post.title }}</h1> <p>{{ post.text|linebreaksbr }}</p> </div> {% endblock %} is there way make website display these posts on multiple pages using method? i guess asking "include" keyword? , "with" template tag? pos

pandas how to assign column name when aggregate same column -

following command returns df contains 'website_id' , 'ctr':'var' 2 column. how can return df contains 4 columns appropriate column name? df.groupby(['website_id']).agg({'ctr':'count','ctr':'mean', 'ctr':'var'} it easier work sample df , expected output think need df.groupby(['website_id']).agg(['count','mean', 'var'])

Searching the Youtube Playlist in android app -

i followed this sample show youtube videos in android app stuck @ implementing search bar in it. how can implement logic of search bar? tried implement searchable interface failed @ setup part. this adapter: public class playlistcardadapter extends recyclerview.adapter<playlistcardadapter.viewholder> { ....... public static class viewholder extends recyclerview.viewholder { public playlistcardadapter(playlistvideos playlistvideos, youtuberecyclerviewfragment.lastitemreachedlistener lastitemreachedlistener) { mplaylistvideos = playlistvideos; mlistener = lastitemreachedlistener; } // create new views (invoked layout manager) @override public playlistcardadapter.viewholder oncreateviewholder(viewgroup parent, int viewtype) { // inflate card layout view v = layoutinflater.from(parent.getcontext()).inflate(r.layout.youtube_video_card, parent, false); // populate viewholder viewholder vh = new viewholder(v); return vh; } // replace content

installation - Installing python-dev in virtualenv -

i trying install mysqlclient python in virtualenv. fails following: #include "python.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed exit status 1 after research, found out require python-dev installation. have installed in main directories (i.e /usr/bin ... ) not installed virtualenv each time type: sudo apt-get install python-dev i following response: reading package lists... done building dependency tree reading state information... done python-dev newest version. 0 upgraded, 0 newly installed, 0 remove , 453 not upgraded. showing availability, outside virtualenv mysqlclient installs properly. issue how rectify python-dev installation virtualenv

java - GUI using JLayer -

Image
i have used jlayer decorate gui background color changed every second. here image. in image see blue , yellow line appearing in timer. realized these line appearing because text changing in text area similar thing happens when new expression displayed in text area. how these lines removed? class mylayeruisubclass extends layerui<jcomponent>{ /** * */ private static final long serialversionuid = 1l; public void paint(graphics g, jcomponent c){ super.paint(g, c); graphics2d g2 = (graphics2d) g.create(); int red = (int) (math.random()*255); int green = (int) (math.random()*255); int blue = (int) (math.random()*255); color startcolor = new color(red, green, blue); red = (int) (math.random()*255); green = (int) (math.random()*255); blue = (int) (math.random()*255); color endcolor = new color(red, green, blue); int w = c.getwidth(); int h = c.gethe

node.js - api.ai looping the same intent with different input -

i using api.ai implement assistant app, found it's hard looping on same intent collect different user input (correct me if expression wrong, explain in details.) problem is, have list of elements, , each time want assign exact 1 element 1 person (collected via use input assistant.getargument()), however, want speaks user every time 'who want assign element x to?' (x refers name of element in list). current implementation is, creating separate function, make ask question , collect input/assignment in other function using while loop, @ end of while body call ask function, doesn't work api.ai gives not available in response. ideas on how this? let me know if there unclear. here brief code snippet showing what's issue & want achieve. want make asks 4 times in api.ai, user input, , store them in output string. var output = ''; function do_sth(assistant){ let get_name_input = assistant.getargument('name'); output = output +

delphi - Changing Task Manager Application Name in FMX -

Image
when loaded fmx application displays exe name on task manager: however can have many of these applications loaded (they called application) , differentiate them context, in case adding user name it. application.title not trick (actually changes title icon on taskbar) edit: make clearer question, need change made during run-time, since not know user connected. title according user. edit 2: while explanation of remy led me take closer how app running: as see there no sub tasks available. server running thinfinity kind of rdp application, app screen rerouted thru user´s browser. the problem here don´t know in server using application, or if application went rogue, task manager easy way see that. (btw can see connected on db server, or in front end http server, cant trace who in server) the main entry app displays filedescription value app's version info resource, if present, otherwise displays filename. thus, text static , can't changed @ runtime. d

matlab - How to calculate the width, height or length (in pixels) of an object? -

this question has answer here: bounding box of object in image matlab 1 answer is there function calculate horizontal or vertical length of object obtained applying bwboundaries? you can width/height looking @ min , max values (range) of x,y coordinates in each individual boundary object. solution use bwconncomp->regionprops-> boundingbox

Phantomjs windows path is set but still can't run from cmd prompt -

Image
the above image snippet took path system variable. whenever attempt run phantomjs following message: can tell me might missing? you should close , reopen command prompt after changing path variable changes take effect.

wordpress - Advanced Custom Fields Slideshow Gallery / Thumbnail Carousel -

using flexslider 2 - i'd able use acf's repeater field create thumbnail carousel slideshow ( as seen here ) produce both slides (which can using repeater field - , producing actual thumbnail image (on upload wordpress) , using thumbnail instead of larger image thumbnail. you'll notice in example slideshow's html thumbnail used same full image, if possible, i'd use smaller version of image. know can create thumbnails in wordpress , define new size produced when image uploaded wordpress admin. please let me know if there's better method doing this.

c# - setting combo box value through property winform -

i have combobox need set class, trying set value within public property. have far, combo box not populating. public string title { set { _title = value; cmb_title.text = value; } { return _title; } } i have tried cmb_title.selectedtext = value , index , can think i'm not sure if because setting in property. ideas appreciated. please note pass form1 owner form2 can access property title. also, example. if collection should same across forms, in real life bind collection in dal or business layer can shared, not add items this. public partial class form1 : form { private string _title = ""; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { cmb_title.items.add("cat"); cmb_title.items.add("dog"); cmb_title.items.add("bear"); } public string title { s

nlp - Stemming words in a Python list -

have list "l" distinct words this: 'gone', 'done', 'crawled', 'laughed', 'cried' i try apply stemming on list way: from stemming.porter2 import stem l = [[stem(word) word in sentence.split(' ')] sentence in l] but nothing seems happen , nothing changes. doing wrong stemming procedure? your code has 1 mistake. l list of words, not sentences. have this: l = [stem(word) word in l] for example: >>> l = ['gone', 'done', 'crawled', 'laughed', 'cried'] >>> [stem(word) word in l] ['gone', 'done', 'crawl', 'laugh', 'cri']

python - Efficient way to determine total time taking overlap into account -

i using pandas dataframe following: i trying find best way determine total time spent ship @ particular berth taking account overlap in duration of visit. here data looks like: in out berth 2015-01-14 13:57:00 2015-01-15 17:15:00 01 2015-01-14 14:30:00 2015-01-15 02:50:00 01 2015-01-14 14:30:00 2015-01-16 06:10:00 01 2015-01-25 02:15:00 2015-01-26 13:41:00 01 what want find out total time particular berth used. looking @ data there overlaps , cant add times each record. looking @ above data can see 2nd ship timing within first time recorded 0, , 3rd ship comes before first stays till after 1st 1 leaves here time = (out of 3rd ship - in of 1st) , move next 1 there no overlap there , add [out of 4 - in of 4] total time spent on berth 1, , continue till end producing : berth hours worked 01 7.750 02 10.275 03 5.585 08 31.980 here's solution 1 berth. hope can

Separate duplicate riders in excel worksheet -

Image
i have workbook 4d barrel racing jackpots designed. perfect in it, except want able make sure duplicate riders separated @ least 10 rows. possible? if so, how? i know how find , rid of duplicates. that's not problem. want separate them each other. thanks! take @ below example based on elements reallocation hold queues. takes input data column a, process it, , outputs result column b. option explicit sub separate() dim nseparate long dim cqholds object dim qinput object dim qresult object dim long dim nlength long dim content variant dim sqname variant dim sqtarget variant ' set number of rows separate nseparate = 4 ' init objects set cqholds = createobject("scripting.dictionary") set qinput = createobject("system.collections.queue") set qresult = createobject("system.collections.queue") ' push data worksheet column input queue = 1 content

What is the correct way to format a REST URL that sets object relationships? -

i reading rest web service tutorial here: www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069?pgno=3 it in, example "club" has "person"s members. the suggested url format reading , updating person is: http://myservice/persons/{personid} the suggested url format reading , updating club is: http://myservice/clubs/{clubid} my question is, appropriate restful url format doing things making person member of club, or removing person club? for example, i'm imagining ... http://myservice/addmembertoclub?clubid=1&personid=2 ... doesn't seem conform restful standard format. those responsibilities club not person. means person should have nothing resource trying update, being club, not person, person should not change nature adding club (even though might have foreign key club). so best approach /myservice/clubs/{clubid}/person/{personid} this same url delete method should delete person club , put method

Laravel Route for Search -

i try tutorial on laravel live search but it's on homepage(index) i want access localhost/laravel/public/search here controller class searchcontroller extends controller { public function index() { return view('search.search'); } public function search(request $request) { if ($request->ajax()) $output =""; $orderinfo=db::table('tb_order')->where('shipcustomername','like','%' . $request->search.'%' ) ->orwhere('orderid','like','%' .$request->search. '%')->get(); if ($orderinfo) { foreach ($orderinfo $key =>$orderinfo ){ $output.='<tr>' . '<td>' .$orderinfo->orderid .'</td>' . '<td>' .$orderinfo->email .'</td>' . '<td>' .$orderinfo->subsource

image - Using logic when working with Sikuli plug-in in Java (NetBeans) -

first time post here! so, i've have been trying solve (hopefully) rather simple issue i'm having code. so, scenario i'm making sikuli search 2 images, , execute different actions based on finds. example of code looks following: int x=2; int y; while(x>1){ if(s.exists(victory.similar((float)0.70)) != null){ y=1; } else if(s.exists(defeated.similar((float)0.70)) != null){ y=2; } else{ x++;} } but problem having, fact works only when find first alternative - being blind other one. this happening on several scenarios within code, of similar structure. a detail worth mentioning fact running code swingworker, yet still not see reason influence code due rest of part of script working (as long not part 1 mentioned above!). thank in advance help! the other alternative seen if first ( false ) if want check 2 if statements must delete else word

Android: Only make certain part of custom view be clickable -

Image
i have custom view, assume looks this: i custom view respond onclicks, catch respond clicks on red portion/circle. not whole view. is possible make make text above , grey portion not clickable? thank you. in custom view, handle clicks overriding ontouchevent method of android's view class. first check location user has clicked within circle. give feedback on motionevent.action_down event let user know have clicked, such highlight circle. on motionevent.action_up can call onclick method. @override public boolean ontouchevent(motionevent event) { boolean istouchincircle = checktouchincircle(event.getx(), event.gety()); switch (event.getaction()) { case motionevent.action_down: if (istouchincircle) { circlecolor = highlightcolor; invalidate(); } break; case motionevent.action_move: if (istouchincircle) {

Scala programming mystery -

i expecting below program print each character of string "this test" on seperate line , when run snippet on scalafiddle.io , not print , can please me find why ? abstract class absiterator{ type t def hasnext:boolean def next():t } class stringiterator(s:string) extends absiterator{ type t = char private var = 0 def hasnext = < s.length def next()={ val ch = s charat += 1 ch } } trait richiterator extends absiterator{ def foreach (f:t => unit):unit = while(hasnext) f(next()) } object stringiteratortest extends app{ class iter extends stringiterator ("this test") richiterator val iter = new iter iter foreach println } since said tried on scalafiddle, not executing inside main method. println("as script - executed") object x extends app { println("as main app - not executed") } you need

http - Procedure that get information from other pages from network -

how can create procedure in programming language create iconic call page , data network? simulator user standard activity. example, user every day search on google key words , list of websites close search. possible action simulate program create call google standard key words , results network? logic can used in other sites without hardcore part of code?

sorting - largest fromed number in a list python -

question: given list of non negative integers, arrange them such form largest number. so given [1, 20, 23, 4, 8], largest formed number 8423201. i couldn't understand following solution: what num.sort(cmp=lambda x, y: cmp(y + x, x + y)) do? and why have 2 parameters x , y? if input list, x , y represent in list? class solution: # @param num, list of integers # @return string def largestnumber(self, num): num = [str(x) x in num] num.sort(cmp=lambda x, y: cmp(y + x, x + y)) largest = ''.join(num) return largest.lstrip('0') or '0' if __name__ == "__main__": num = [3, 30, 34, 5, 9] print solution().largestnumber(num) can explain code solution? thanks. python 2.x sort functions allowed cmp function comparing 2 items. cmp(a, b) returns -1 if < b, 0 if == b, or 1 if > b. this code uses cmp "creatively" needed sort order solve problem; sort "8" be

r - Delete rows without a full year data -

i got big data set contains monthly returns of given stock. i'd delete rows not have full year data. subset of data shown below example: date return year 9/1/2009 0.71447 2009 10/1/2009 0.48417 2009 11/1/2009 0.90753 2009 12/1/2009 -0.7342 2009 1/1/2010 0.83293 2010 2/1/2010 0.18279 2010 3/1/2010 0.19416 2010 4/1/2010 0.38907 2010 5/1/2010 0.37834 2010 6/1/2010 0.6401 2010 7/1/2010 0.62079 2010 8/1/2010 0.42128 2010 9/1/2010 0.43117 2010 10/1/2010 0.42307 2010 11/1/2010 -0.1994 2010 12/1/2010 -0.2252 2010 ideally, code remove first 4 observations since don't have full year of observation. the op has requested remove rows large data set of monthly values not make full year. although solution suggested wen seems working op suggest more robust approach. wen's solution counts number of rows per year assuming there one row per month . more robust count number of unique months per year in case there

php - Laravel - Test run in terminal - OK vs Test run in - Run ...test... with Coverage in PhpStorm - Error -

Image
test run typing phpunit in phpstorm's terminal. all ok. the same test run right click on , run test coverage . error! :< run phpstorm's auto conf didn't set anything

python - How to place a panedWindow behind another panedWindow tkinter -

the title says it. right have 2 panedwindows attached root window. windows either lift() or lower() 1 panedwindow on top of other when button pressed rather panedwindows being stacked on top of each other in same window. i understand there may better way of implementing sort of menu feature. if know better way, great too. i used .grid(row = 0) on both panedwindows. called lift on window wanted raise , worked.

ruby on rails - Twilio Child Call Status incorrect? -

i'm experimenting twilio , i'm confused bit ultimate status of calls. here's i'm doing. i'm making call twilio phone number hooked application endpoint. app makes database record of call , uses twiml make secondary call out phone. after call complete, call record updated data retrieved twilio secondary call record created call in account parent_call_sid original call's sid. my issue is, if call twilio number let twiml dial timeout, child call status ends being 'completed' instead of 'no-answer'. my question why happening? need configure how dial out differently in order receive appropriate status calls? update: has been resolved. issue voicemail picking before twilio's default timeout of 30 seconds ended call, resulting in 'completed' status. reducing timeout twilio able end call 'no-answer' before voice mail picked up.

vba - How to filter 4 numbers in column -

Image
i know how filter 2 numbers less 25 , greater 50 , on, i'm wondering how filter 4 numbers between 250 , 290 or if between 70 , 110. the codes have tried far activesheet.range("$f$4:$ak$18").autofilter field:=26, _ criteria1:=">=70", operator:=xland, criteria2:="<=110" activesheet.range("$f$4:$ak$18").autofilter field:=26, _ criteria1:=">=250", operator:=xland, criteria2:="<=290" and activesheet.range("$f$4:$ak$18").autofilter field:=26, _ criteria1:=array(">70", "<110", ">250", "<290"), operator:=xlfiltervalues and activesheet.range("$f$4:$ak$18").autofilter field:=25, _ criteria1:=">=70", operator:=xland, criteria2:="<=110", operator:=xland, _ criteria2:=">=250", operator:=xland, criteria2:="<=290" none of these work can im wondering if im trying po

PayPal Express Checkout: Setting logo_image and name using REST API -

paypal's express checkout documentation says can customize checkout using experience api. , when go experience api documentation , see ability set custom name, logo_image, , more. in our implementation, hiding shipping fields (no_shipping: 1) works - , uses experience api - setting name , logo_image not. code below. know if there's way set name and/or logo_image? payment: function(data, actions) { return actions.payment.create({ payment: { transactions: [ { amount: { total: '9.99', currency: 'usd' } } ] }, experience: { name: 'custom name', presentation: { logo_image: 'https://i.imgur.com/customimage.png' }, input_fields: { no_shipping: 1 } } }); },

javascript - How to use SetTimeout correctly (typescript) -

i working on ionic-cordova app uses geolocation . according app flow necessary accurate position. i wrote dedicated methods achieve location , used settimeout in them. according logs seems didn't use settimeout correctly - or worst chose poorly , settimeout not need here. this code: getfixedlocation() { let coordinates: coordinates; let maxtries = 15; let isfixedlocation = false; this.forcefixlocation(10); { console.log("getting location, try #" + maxtries) this.geolocation.getcurrentposition(geolocation_options) .then((position) => { coordinates = position.coords; }); if (coordinates.accuracy < 25 && coordinates.speed < 1) { isfixedlocation = true; } else { maxtries -= 1; } } while(maxtries > 0 && !isfixedlocation); if (isfixedlocation) { return coordinates; } else { return null; } } forcefixlocation(cou

Python PANDAS get averages across multiple slices of data -

consider following dataset: import pandas pd data = {"store_name":{"0":"storename","1":"storename","2":"storename","3":"storename","4":"storename", "5":"storename","6":"storename","7":"storename","8":"storename","9":"storename", "10":"storename","11":"storename","12":"storename","13":"storename","14":"storename", "15":"storename","16":"storename","17":"storename","18":"storename","19":"storename", "20":"storename","21":"storename","22":"

PHP/JavaScript cookie acting like a pointer so when I clear it, I lose the value; how do I grab the value from the cookie? -

<script type="text/javascript"> var test = "test"; document.cookie = "some_test=" + guid; </script> <?php $_post['important_value'] = ((isset($_cookie['some_test'])) ? ($_cookie['some_test']) : ('')); ?> <script> //document.cookie = "some_test=;expires=thu, 01 jan 1970 00:00:00 utc;"; console.log(document.cookie); </script> this code works intended long don't uncomment line clear cookie. goal move javascript variable ( test ) php variable ( $_post['important_value'] ). i think what's happening $_post['important_value'] , $_cookie['some_test'] pointing same thing wrong. there anyway print address of variables? update: debug_zval_dump($_post['important_value']); // string(39) "750118664537365903071115537365768136624" refcount(3) debug_zval_dump($_cookie['some_test']); // string(39) "7501186645

html - Transparent overlapping circles without border in background -

Image
is possible implement transparent overlapping svg circle elements without circles border in transparent area? you can clip bits don't want draw... <svg height="100" width="150"> <defs> <clippath id="clip" clippathunits="objectboundingbox"> <rect width="0.79" height="1.2" x="-0.1" y="-0.1"/> </clippath> </defs> <rect width="100%" height="100%" fill="blue" opacity="0.2" /> <circle cx="80" cy="50" r="40" stroke="black" stroke-width="3" fill="none" /> <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="none" clip-path="url(#clip)"/> </svg>