Posts

Showing posts from July, 2012

java android osm showInfoWindow when a marker changed possition -

i display show info window when click on marker , when update possition marker possion infowindow doesn't changed i try : mpin.setposition(activeitemizediconoverlay.getitem(index).getpoint()); but doen't work. : mpin.hideinfowindow(); mapview.getoverlays().remove(mpin); mpin.setposition(activeitemizediconoverlay.getitem(0).getpoint()); mpin.showinfowindow(); mapview.getoverlays().add(mpin); but show infowindow don't need click try use method isinfowindowshown() marker. , can check if infowindow show , when method return true can : if(mpin.isinfowindowshown()){ mpin.hideinfowindow(); mapview.getoverlays().remove(mpin); mpin.setposition(activeitemizediconoverlay.getitem(0).getpoint()); mpin.showinfowindow(); mapview.getoverlays().add(mpin); }

language agnostic - Is floating point math broken? -

0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 why happen? binary floating point math this. in programming languages, based on ieee 754 standard . javascript uses 64-bit floating point representation, same java's double . crux of problem numbers represented in format whole number times power of two; rational numbers (such 0.1 , 1/10 ) denominator not power of 2 cannot represented. for 0.1 in standard binary64 format, representation can written as 0.1000000000000000055511151231257827021181583404541015625 in decimal, or 0x1.999999999999ap-4 in c99 hexfloat notation . in contrast, rational number 0.1 , 1/10 , can written as 0.1 in decimal, or 0x1.99999999999999...p-4 in analogue of c99 hexfloat notation, ... represents unending sequence of 9's. the constants 0.2 , 0.3 in program approximations true values. happens closest double 0.2 larger rational number 0.2 closest double 0.3 smaller rational number 0.3 . sum

web services - SOAP PHP - SimpleType error response -

i've problem response of soap webservice. i've structure: <xsd:element minoccurs="0" name="sesso"> <xsd:simpletype> <xsd:restriction base="xsd:string"> <xsd:enumeration value="m" /> <xsd:enumeration value="f" /> </xsd:restriction> </xsd:simpletype> </xsd:element> and need response is: <sesso xsi:type="xsd:string">m</sesso> but ns1:sesso type: <sesso xsi:type="ns1:sesso">m</sesso> why this? my php code one: $server = new soapserver("assistiti.wsdl", array('soap_version' => soap_1_2)); $server->addfunction("aggiornaassistiti"); $server->handle(); function aggiornaassistiti() { $assistito = new stdclass(); $assistito->sesso = "m"; return $assistito; } (i'm using soapui tests) try using soapvar . third par

java - Can't access SharedPreferences in class that extend Application -

i'm trying code global method extending application class. i'm trying add 2 method rapidly access 1 value stored in sharedpreferences . unfortunately can't make sharedpreferences work, here code: package postfixcalculator.mattiarubini.com.postfixcalculator; import android.app.application; import android.content.context; import android.content.sharedpreferences; public class postfixcalculatorextendapplication extends application { public void changepreference (boolean flag){ //i'm updating preference file based on purchase sharedpreferences sharedpref = getactivity().getpreferences(context.mode_private); sharedpreferences.editor editor = sharedpref.edit(); editor.putboolean(getstring(r.string.purchase_status), flag); editor.commit(); } public boolean retrievepreferences (){ sharedpreferences sharedpref = this.getpreferences(context.mode_private); /*if file doesn't exist, create file , i&#

ios - HTTP request in swift 3 Xcode 8.3 -

i getting stuck http request.it did not show error.compiler reads first 2 lines , skip code "task.resume()".i fetching data same code on other view controller creats problem here func getcustomers() { let url = nsurl(string: "myurl.com") let task = urlsession.shared.datatask(with: url! url) { (data, response, error) in guard let _:data = data, let _:urlresponse = response , error == nil else { print("error: \(string(describing: error))") return } { self.getcustomersarray = [getcustomers]() //json parsing if let data = data, let json = try jsonserialization.jsonobject(with: data) as? [string: any] { let results = json["result"] as? [[string : any]] let getcustomersobject:getcustomers = getcustomers() result in results! {

ios - Open UIImagePickerController in landscape in Swift 3 -

Image
i trying present uiimagepickercontroller in landscape mode iphone 7 , iphone se (iphone 7 plus , ipad use popover). create sub class of uiimagepickercontroller : class landscapeuiimagepickercontroller: uiimagepickercontroller { override var supportedinterfaceorientations: uiinterfaceorientationmask { return .landscape } override var shouldautorotate: bool { return true } override var preferredinterfaceorientationforpresentation: uiinterfaceorientation { return .landscaperight } and call : func importfromgallery(_ sender:uibutton) { let imagepicker = landscapeuiimagepickercontroller() imagepicker.modalpresentationstyle = .popover imagepicker.popoverpresentationcontroller?.sourceview = sender imagepicker.popoverpresentationcontroller?.sourcerect = sender.bounds imagepicker.popoverpresentationcontroller?.permittedarrowdirections = .down imagepicker.delegate = self present(imagepicker, animated: true, completion: n

php - passing variables in url without using $_GET method -

i want send variables this: examplesite/var1/var2/var3/... instead of this: examplesite/?ex1=var1&ex2=var2&ex3=var3&... you're question poorly constructed, guess need apache rewriteengine , i.e.: create file named .htaccess on root of website , add following content: rewriteengine on rewriterule ^([^/]*)/([^/]*)/([^/]*)$ /some_page?ex1=$1&ex2=$2&ex3=$3 [l]

osx - QToolButton looks ugly -

Image
on mac os x qtoolbutton looks ugly. how apply qpushbutton style qtoolbutton? use menu button popup mode. qpushbutton hasn't such mode. use qpushbutton not decision. it looks ugly because os x doesn't have such native control, mac style has approximate something. you'd have implement proxy style draws control differently, perhaps redirecting pushbutton's appearance , overdrawing line , triangle.

python - Pandas: Fill in missing indexes with specific ordered values that are already in column. -

i have extracted one-column dataframe specific values. dataframe looks like: commodity 0 cocoa 4 coffee 6 maize 7 rice 10 sugar 12 wheat now want respectively fill each index has no value value above in column should this: commodity 0 cocoa 1 cocoa 2 cocoa 3 cocoa 4 coffee 5 coffee 6 maize 7 rice 8 rice 9 rice 10 sugar 11 sugar 12 wheat i don't seem pandas documentation working text data. help! i create new index pd.rangeindex . works range need pass number 1 greater max number in current index. df.reindex(pd.rangeindex(df.index.max() + 1)).ffill() commodity 0 cocoa 1 cocoa 2 cocoa 3 cocoa 4 coffee 5 coffee 6 maize 7 rice 8 rice 9

import Python module when there is sibling file with the same name -

suppose have following files tata/foo.py tata/yoyo.py foo/__init__.py foo/bar.py in file foo.py do import foo.bar i run pythonpath=. python tata/yoyo.py , get traceback (most recent call last): file "tata/yoyo.py", line 1, in <module> import foo.bar importerror: no module named bar issue disappears when delete tata/foo.py . please suggest way resolve situation when have global module name , local file name coincides. use: from __future__ import absolute_import

bash - About getopts function -

i'm again :( still problem bash, question make script read option -r further further operation. think make right when tried run it, got feedback saying:" ./stripchars: line 20: -r: no such file or directory". , 1 saying:" ./stripchars: line 26: ne: command not found" here code: #!/bin/bash file=$1 while getopts "r:" o; case "${o}" in r) r=${optarg} ;; *) ;; esac done shift $((optind-1)) if [ ! -z "$file" ] exec 0< "$file" fi while ifs='' read -r line echo "$line" | tr -d '${r}' done if [ -z "${r}" ] if [ ! -z "$file" ] exec 0< "$file" fi while ifs='' read -r line echo "$line" | tr -d '[:punct:]' done fi if file name first argument (as implied file=$1 ), getopts has non-zero exit status immediately (since first argument not option), , never enter loop. need change call like

Selenium WebDriver by xpath: search by text in child elements -

i using selenium webdriver. (java, if matters). i need find element, searching, among other things, text under subordinate element. looping through list of elements , comparing gettext() value want, suspect better let browser through xpath. for example, here element want find: <span role="button" class="mbltoolbarbutton mbltoolbarbuttonhasleftarrow" tabindex="0" id="dojox_mobile_toolbarbutton_3" dir="ltr" widgetid="dojox_mobile_toolbarbutton_3"><span class="mbltoolbarbuttonarrow mbltoolbarbuttonleftarrow mblcolordefault mblcolordefault45"></span><span class="mbltoolbarbuttonbody mblcolordefault"><table cellpadding="0" cellspacing="0" border="0" role="presentation" class="mbltoolbarbuttontext"><tbody><tr><td class="mbltoolbarbuttonicon"></td><td class="mbltoolbarbuttonlabel"

c# - Selenium find element -

so created 2 generic functions findelement , findelements : public class find { public static iwebelement element(iwebdriver driver, func<iwebdriver, iwebelement> expectedcondtions, locator, iwebelement finder = null, int timeoutinseconds = 120) { webdriverwait webdriverwait = createwebdriverwait(driver, timeoutinseconds); webdriverwait.until(expectedcondtions); if (finder != null) return finder.findelement(locator); return driver.findelement(locator); } public static readonlycollection<iwebelement> elements(iwebdriver driver, func<iwebdriver, readonlycollection<iwebelement>> expectedcondtions, locator, iwebelement finder = null, int timeoutinseconds = 120) { webdriverwait webdriverwait = createwebdriverwait(driver, timeoutinseconds); webdriverwait.until(expectedcondtions); if (finder == null) return driver.findelements(locator);

python - Hybrid oriented multigraph networkx -

using networkx, there way make multigraph directed edges , bidirectional edges? i can't use 2 oriented edges instead of bidirectional 1 because mean different things in graph. networkx.multidigraph() alows directional edges , networkx.multigraph() alows bidirectional edges. my suggestion draw nodes, labels, draw edges twice once graph , other digraph on top of undirected or split 2 sets. nx.draw_networkx_nodes(g) nx.draw_networkx_labels(g) nx.draw_networkx_edges(g) #directed nx.draw_networkx_edges(h) #undirected if fails, can play around edgewidth cover directed , scale ones want seen.

.net - CA0053 unable to load rule assembly dataflowrules.dll VS 2017 -

Image
all of sudden, getting error when trying build project - i recetnly upgraded visual studio 2017 2015. saw answers have suggested update csproj or solution file not working. please help. can't think further.

lisp - Write a function that takes a number as its argument and construct a list -

i start learning lisp, , have question need help. write function new-list takes number argument , constructs list of length containing t. this try, doesn't work. me figure out? (defun same-length (x) (make-list x:initial-element 't)) thanks in advance. you're there: * (defun make-t (size) (make-list size :initial-element t)) make-t * (make-t 10) (t t t t t t t t t t) * :initial-element keyword parameter, refer functions of common lisp more info. , please refer doc of make-list more info , examples.

java - MyEclipse can't load TLD file -

i learn jsp in myeclipse. when want open .tld file, myeclipse appear error. plug-in com.genuitec.eclipse.j2eedt.ui unable load class org.jboss.tools.jst.web.ui.editors.tldcompoundeditor. error myeclipse version 2017 ci 4 search in google there nothing. caused error?? how can fix it?? thank you!!

Sending mail with php and html -

Image
i using phpmailer send normal pre-defined mails , works fine. want is, connect texteditor php script can send nice html mails. texteditor template ckeditor. everything write in textedtior written html tags then have php script phpmailer send mail. have been thinking of maybe posting html tags post method , getting them in php script. maybe not best idea, , if dont know how post stuff out of input tags. any appreciated. ps. php code date_default_timezone_set('etc/utc'); require '../phpmailerautoload.php'; $mail = new phpmailer; $mail->issmtp(); $mail->smtpdebug = 2; $mail->debugoutput = 'html'; $mail->host = 'smtp.gmail.com'; $mail->port = 587; $mail->smtpsecure = 'tls'; $mail->smtpauth = true; $mail->username = "??????@gmail.com"; $mail->password = "?????"; $mail->setfrom('????@gmail.com', 'first last'); $mail->addreplyto('????@gmail.com', 'first last&#

networking - UNET LLAPI: is it possible to use another client's connection to send data to server? -

when using unet llapi receive requests, function uses host , connection ids out parameters - https://docs.unity3d.com/scriptreference/networking.networktransport.receive.html so let's listening network traffic , prepares packet want use impersonate client has established connection. can done? not networking expert, guess yes.

java - Transformer not accepting Message as the input -

i've begun migrating java dsl we've used our project java 7 8, , i'm facing weird issues. have success channel expressionevaluatingrequesthandleradvice expecting advicemessage . in java 7 version, working fine with: .transform(new generictransformer<advicemessage, message<?>>() { @override public message<?> transform(advicemessage source) { return source.getinputmessage(); } }) but when convert java 8: .<advicemessage, message<?>>transform(advice -> advice.getinputmessage()) it gives me exception: org.springframework.integration.handler.advice.expressionevaluatingrequesthandleradvice$ messagehandlingexpressionevaluatingadviceexception: handler failed; nested exception org.springframework.integration.transformer.messagetransformationexception: failed transform message; nested exception org.springframework.messaging.messagehandlingexception: nested exception java.lang.classcastexception: java.

Operator "[<-" in RStudio and R -

by accident i've encountered strange behaviour of "[<-" operator. behaves differently depending on order of calls , whether i'm using rstudio or ordinary rgui. make myself clear example. x <- 1:10 "[<-"(x, 1, 111) x[5] <- 123 as far know, first assigment shouldn't change x (or maybe i'm wrong?), while second should do. , in fact result of above operations is x [1] 1 2 3 4 123 6 7 8 9 10 however, when perform these operations in different order, results different , x has changed! meaningly: x <- 1:10 x[5] <- 123 "[<-"(x, 1, 111) x [1] 111 2 3 4 123 6 7 8 9 10 but happens when i'm using plain r! in rstudio behaviour same in both options. i've checked on 2 machines (one fedora 1 win7) , situation looks same. know 'functional' version ( "[<-"(x..) ) never used i'm curious why happening. explain that? ========================== edit: ok, com

Is there a way to paint network graph using XChart in a java application? -

Image
i'm using xchart in java application draw graphics, can't figured out how draw network graph 1 example: is there way how such graphics using xchart in java application ?

jasmine - sinon mock typescript class -

i'm trying test typescript class that's used in one. suppose i've got api like: class api { foo() { return 40 + 2; } } and i've got consumer: class consumer { constructor(api: api) { } bar() { console.log(this.api.foo()); } } now, want validate api.foo called when consumer.bar called. so i've got following jasmine spec: describe('consumer', () => { let mockapi; beforeeach(() => { mockapi = sinon.mock(new api()); }); it('should call foo when calling bar', () => { const sut = new consumer(mockapi); mockapi.expect('foo').once.return(666); sut.bar(); mockapi.validate(); }); }); this test fails though giving following error message: typeerror: undefined not constructor (evaluating 'mockapi.expect('foo')') any ideas i'm doing wrong?

Appcelerator - Hide UI element in list generated by dataCollection -

i using alloy , alloy collections generate list of views in app. need able hide child elements within each view based on data within model object. for example have alloy view: <view datacollection="$.collectionofstuff"> <label>always visible</label> <label>only show when {isvisible} true</label> <label>another label visible</label> </view> assuming models in $.collectionofstuff has isvisible property, able hide second label based on value. setting visible property on label easy enough hides element , doesn't reclaim space - meaning there gap between first , third label. need second label stop taking space well. i have tried using data binding syntax add hidden class element ( <label class="{hiddenwhennotvisible}"> ) alloy doesn't appear resolve data binding tags in class attributes. this doesn't seem should difficult i'm hoping i'm missing obvious. you

jquery - Toggle arrow only for currently selected table header -

how can target selected table header (just color changes selected header), arrow next 1 toggled rotate on click? <table class="container cf"> <thead class="cf"> <tr> <th class="numeric">amount <i class="glyphicon glyphicon-triangle-bottom"></i></th> <th class="numeric">case <i class="glyphicon glyphicon-triangle-bottom"></i></th> <th class="numeric">field 3 <i class="glyphicon glyphicon-triangle-bottom"></i></th> <th class="numeric">field 4 <i class="glyphicon glyphicon-triangle-bottom"></i></th> <th class="numeric">location <i class="glyphicon glyphicon-triangle-bottom"></i></th> <th class="numeric">date <i class="glyphicon glyphicon-triangle-bottom">&l

python - Best practice for using datetime in Pymongo query path? -

how can use datetime object in case need complex path? example want increment counter located in jumps/datetime.date()/country code : database['data'].update_one( {'some_data' : 'asdasd'}, {'$inc' : {'jumps.{}.{}'.format(datetime.now().date(), "us") : 1}}, ) this code work, (as expected) there string instead of datetime object: "jumps" : { "2017-04-14" : { "us" : 4 } } it's impossible store date object key in mongodb document. also, shouldn't use value key, because can't use keys in queries or indexes. better if change structure of document , simplify it. something that: "jumps" : {[ {'date': isodate('2017-04-14'), "us" : 4}, {'date': isodate('2017-04-14'), "ru" : 9} ]} or can create new collection jumps contain documents: {'date':

recursion - how to recursively group products by its category in django -

i have category model related , products model related category model. category(models.model): name = ... subcategory = models.foreignkey(self, related_name="subcategory", null=true, blank=true) product(models.model): name = .... category = models.foreignkey('category', related_name='productcategory') i need list products in template recursive category groups, instance: 1st main category: products linked 1st main category 1st level sub category of 1st main category: products linked 1st level sub category 2nd level sub category of 1st level sub category: products linked 2nd level sub category 2nd level sub category of 1st main category: products linked 1st level sub category 2nd main category: products linked 2nd main category 1st level sub category of 2nd main category: products linked 1st level sub category 2nd level sub category of 1st le

node.js - Issues Getting Highcharts Export Server Running Under iisnode -

i working on trying set highcharts export server under node.js using iisnode ( https://github.com/tjanczuk/iisnode ). acts pipe between requests iis through node. great! only, how "install" highcharts export server using iisnode? did instructions on how install highcharts-export node module installed under (windows) appdata\roaming\npm. how move or point iisnode export server? export server run via following once installed npm: highcharts-export-server --enableserver 1 so, installed , used in iis8 + iisnode 1) right directory install export server locally (on windows modules pulled in via npm go c:\users\\appdata\roaming\nmp\ logged in user using npm install package)? 2) iisnode configuration necessary this? i have iisnode setup , running on our development box , examples work. confusion lies partly utter lack of documentation issnode. links have found repeat items listed in links issnode developer no actual "here how take node app exists in npm , have work in

How to make figure rectangle in Matplotlib -

i have drawn following figure. possible make figure length 2 unit & height 1 unit? possible change plt.xlabel('time (s)') plt.xlabel('$\alpha \rightarrow$')? import matplotlib.pyplot plt import numpy np t=[0,1,2] s=[0.05,0.1,0.2] plt.plot(t, s) plt.xlabel('time (s)') plt.ylabel('voltage (mv)') #plt.title('about simple gets, folks') plt.grid(true) plt.savefig("test.png") plt.show() you answered own question figure size. for second question need raw string, e.g.: plt.xlabel(r'$\alpha \rightarrow$') to make alpha bold -- requested in comment -- it's little more involved. per https://tex.stackexchange.com/a/99286 you'd do: import matplotlib matplotlib.rc('text', usetex=true) matplotlib.rcparams['text.latex.preamble']=[r"\usepackage{amsbsy}"] t=[0,1,2] s=[0.05,0.1,0.2] plt.plot(t, s) plt.ylabel('voltage (mv)') plt.xlabel(r'$\pmb{\alpha}$ \rightarrow$')

oauth 2.0 - Can the tyk.io Dashboard be customized with a different authentication method? -

we using version 2.0 of tyk.io, , wanted know if there way customize tyk.io dashboard ui use custom authentication method such oauth2? to clarify - mean using oauth controlling access tyk dashboard itself? if so, take @ tyk identity broker - should trick. https://tyk.io/tyk-documentation/concepts/tyk-components-2/identity-broker/

sql server - SSIS - Get data from db2, load into staging tables, and then merge into destination tables? -

i'm working on ssis package data couple of db2 tables, , insert preliminary tables. there need merge destination tables. i'm having trouble don't understand why staging/preliminary tables necessary. there happens when merging staging tables destination table? way rid of duplicate data?

PhpStorm Xdebug how do I configure path mapping for full folder -

i have setup 1 plugin in project symlinked different folder on local machine. something this: /sites/mywebproject <-- contains application , phpstorm project /myplugins/mycustomplugin <-- contains custom plugin working on. /sites/mywebproject/plugins/mycustomplugin --> symlinked to: /myplugins/mycustomplugin now when run xdebug , add breakpoint phpstorm open symlinked file. can add 'path mapping' , file recognised expected. my issue want setup 'path mapping' whole directory. , not on 'per-file' base. is possible?

javascript - D3 to Append Inputs of Desired Type -

first consider how easy populate drop down menu d3: var options = [ "option 1", "option 2", "option 3", "option 4" ]; d3.select("#my_select") .selectall("option") .data(options) .enter().append("option") .attr("value", function(d) { return d; }) .text(function(d) { return d; }); however, i'm not quite sure how can append html user input not preexisting, , doesn't need 'populated' data() call. in case want append number input user. tried (and many similar variants): graphgroup.append('input') .attr('type','number'); that didn't work. looked @ pure javascript solution, looks this: var newdiv = document.createelement('div'); newdiv.innerhtml = "new entry " + " <br><input type='number' name='myinputs[]'>";

android - Input overlapped by keyboard on mobile -

i'm developing app angular-meteor , every time focus input on bottom of screen keyboard overlaps it. i tried adding mobile-config.js doesn't work: app.setpreference('fullscreen', false); app.setpreference('android-windowsoftinputmode', 'adjustresize'); and meta on index.html: <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, target-densitydpi=device-dpi, width=device-width" /> am forgetting something? so have 2 options android (ios handles bit nicer you). in androidmanifest.xml file see android:windowsoftinputmode inside of first <activity> tag. adjust how keyboard interacts screen. here more information on how works.

node.js - Heroku , pull sqlite3 database -

hello everyone i using heroku host app, seems working (i using node.js, express.js , sqlite3, data seems updating) yesterday wanted "download" database when downloaded database seems outdated (the version downloaded, in fact, the database downloaded original database uploaded when create app , changes not there, but when query database online seems updated. ) i used following command in order files online in app heroku git:clone -a myapp is there correct way or command in order database online? thanks in advance i usign database created module of sqlite3: "use strict"; var express = require("express"); var app = express(); var sqlite3 = require('sqlite3').verbose(); var bp = require('body-parser'); app.use(bp.urlencoded({extended:true})); var dbios = new sqlite3.database('appbienestar.db'); //this database using. created //the database same metho

mysql - SQL query to do division -

please on below sql query divide first set of query second one. select ( select `business_unit`, count(`joining_month`) `jl` `final_status` = 'joined' , `source_wise` = 'referral' , `hiring_catg` in ('lateral','contract conversion') group `business_unit` ) div ( select `business_unit`, count(`joining_month`) b `jl` `final_status` = 'joined' , `hiring_catg` in ('lateral','contract conversion') group `business_unit` ) ; the query posted dead-end; cannot made work in direction. i try count number of rows pass condition source_wise = 'referral' , total number of rows each group , compute ratio. the query this: select `business_unit`, sum(if(`source_wise` = 'referral', 1, 0)) ref count(`joining_month`) total `jl` `final_status` = 'joined' , `hiring_catg` in ('lateral','contract conversion') group `business_unit` you

Regex - Looking for a number either at the BOL or EOL but also not embed in other numbers or text -

this question has answer here: regex match entire words only 3 answers i want find '106'. can't in longer number 21067 nor can in text string y106m. want find if @ beginning, or end of line, or if line. so these lines out: 106m 1106 106in string bad if starts line , may finish target not tail of string106 but these in: 106 else 106 , of couse "106' work want 106 show not embedded in other numbers or text it's ok end of line 106 106 may start line i have tried following search string , many variations of it: (^|[^0-9a-za-z])106($|[^0-9a-za-z]) i'm new-ish regex, , don't have handle on how anchor characters work. you can use \b word boundary assertion: \b106\b demo or more specific lookarounds : (?<=^|\w)106(?=$|\w) demo or, pointed out in comments, (?<!\w)106(?!\w) works too. or (?<

javascript - How to fix the error "Selection.addRange()"? -

this question has answer here: selection.addrange() deprecated , removed chrome 1 answer i need fix error : the behavior selection.addrange() merges existing range , specified range deprecated , removed in m58, around april 2017. see https://www.chromestatus.com/features/6680566019653632 more details. i can't edit, or destroy element of website. from this github issue , have call removeallranges() before adding range selection: selection = window.getselection(); // save selection. range = document.createrange(); range.selectnodecontents(elem); selection.removeallranges(); // remove ranges selection. selection.addrange(range); // add new range.

java - index of in Arraylist<ABC> compare with other Arraylist -

i trying find index of element in arraylist based on value of 1 of properties, giving me -1. //returnabclinklist method returns abc linked list , cannot use index of on linked list trying convert arraylist list<abc> temp=new arraylist<abc>(somemethod.returnabclinklist()); list<xyz> other=new arraylist<xyz>(); lets abc has 3 fields ( rollnum , name , state ) , xyz has 5 fields, 3 of in common abc ( rollnum , name , state , secondname , dob ). want iterate through 1 list , find each corresponding element in other list, based on rollnum values being same. goal fill out other corresponding fields ( name , state ). here's tried: iterator<abc> itr = abclist.iterator(); while(itr.hasnext()){ abc tempabc=itr.next(); int index = xyzlist.indexof(tempabc.rollnum()); //this comes -1 } the problem indexof() returning -1. can implementation? actual working snippet import java.util.arraylist; import java.util.iterator; import java.util

java - WARNING: Exception encountered during context initialization -

before work not working.and when worked use session null in credicarddao.java updating customer status , inserting new creditcard record database. apr 14, 2017 9:32:36 org.springframework.context.support.filesystemxmlapplicationcontext preparerefresh info: refreshing org.springframework.context.support.filesystemxmlapplicationcontext@68de145: startup date [fri apr 14 09:32:36 cdt 2017]; root of context hierarchy apr 14, 2017 9:32:36 org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions info: loading xml bean definitions file [c:\bcj_dec_2016\workspace\corejava\creditcardprocess\spring.xml] apr 14, 2017 9:32:37 org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter initcontrolleradvicecache info: looking @controlleradvice: org.springframework.context.support.filesystemxmlapplicationcontext@68de145: startup date [fri apr 14 09:32:36 cdt 2017]; root of context hierarchy

python - How to write a custom aggregation function for strings? -

Image
i have dataframe of millions of records, i'm trying make whole dataframe grouped 1 column 'napciente', done. there 63 columns need aggregate string based on specific match, example, if series contain "si" , other strings want return "si" result of aggregation. so need define own aggregation finds string in series , returns it. here i'm posting data 1 group , truncated columns data.groupby('npaciente')['asistencia'].apply(lambda x: if x.str.find("si"): return "si") the above invalid, suggestions? you can use apply directly on groupby object, in custom function, return pd.series in order pandas refer columns: def agg_func(group): """group dataframe containing relevant rows""" result = {} if group["asistencia"].str.find("si").any() result["asistencia"] = "si" return pd.series(result) data.groupby(&

oracle - Using PL/SQL Cursor to return a result set for reporting tool -

i'm report writer. queries select statements source (in case oracle exadata) selects 1 or more tables, joins, filters in where, further filters groups in having, etc. have read rights whatever source i'm connecting to. so, can't create sprocs, packages, or functions. i have need use advanced functionality on complex query, using for..loops, if else structures, etc. refine derived result-set output reporting tool such qlikview or tableau. as i'm learning go, i've found many lessons on using cursors in complex logic structures every lesson uses dbms_output.put_line result of each iteration. output ends in buffer, instead of result set. i've learned sys_refcursor pointer result set. sound promising examples start create or replace procedure/package. there gaps in understanding i'm hoping can fill if explain desired outcome is: i have complex query synthesizes multiple select statements union'ing them, uses sub-selects in join , clauses, et

react native - Can a GraphQL server return images? -

i'm working on react-native app, , wondering if graphql can return image file opposed json, i.e. content-type - (image/jpeg etc). <image source={{uri: 'http://localhost/graphql?query{getimage(imageid)}'}} style={{width: 400, height: 400}} /> is possible? or have create separate non-graphql server achieve this? graphql servers can return images. if you're looking graphql client image handler, check out library . the way scaphold handles appending image using formdata , in variables references key image stored. on graphql server, can have piece of middleware plucks image off of key , can handle wish. here's how work client. hope helps!

Primeface Theme does not apply (maven) -

i trying change default theme (aristo) of web application "cupertino". followed several tutorials without success. used following instruction https://www.primefaces.org/documentation/ : picture of instruction theme did not change i using - spring framework - maven - eclipse - primefaces 5.3 here whole web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <error-page> <exception-type>org.springframework.security.access