Posts

Showing posts from August, 2013

datetime - How to count days between string date java -

i have dates in variable , b, this. string = "2016-01-28 21:50"; string b = "2016-01-31 21:49"; how count how many days there between variable , b? in java 8, can use chronounit achieve this. here example code snippet consider. import java.time.localdate; import java.time.format.datetimeformatter; import java.time.temporal.chronounit; public class daysinbetween { public static void main(string[] args) { string = "2016-01-28 21:50"; string b = "2016-01-31 21:49"; final datetimeformatter fmt = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm"); final localdate d1 = localdate.parse(a, fmt); final localdate d2 = localdate.parse(b, fmt); final long daysinbetween = chronounit.days.between(d1, d2); system.out.println("number of days in between:" + daysinbetween); } }

javascript - Can an Ajax function birth another Ajax function? -

i have .live ajax function (let's call x) executes onclick , connects database url: myphpvalues.php. inside php have added ajax .live function (let's call y) output once user clicks first ajax link. is allowed? first, .live has nothing ajax. allows trap user event (click, hover, etc) on controls not yet exist in dom. if using version of jquery later 1.7, .live has been replaced .on (essentially same syntax). if little foggy, please read this. basically, if didn't use .on() jquery code not bind clicked element because element didn't exist when binding attempted. also, if little foggy on ajax, please review this before continuing. because ajax allows javascript routine request/receive data back-end (php) file, there no need use ajax within back-end file -- it's php (or asp.net or whatever) , can include (or whatever) routines other php files. however, if asking if can return new javascript/jquery code originating html/js page, yes can.

c++ - Sequential programing in CUDA -

i realize simple loop in cuda. for (int = 1; <= n; i++) { (int j = 1; j <= n; j++) { x[i, j] = (x0[i, j] + a*(x[i - 1, j] + x[i + 1, j] + x[i, j - 1] + x[i, j + 1])) / c; } } the problem is: compute e.g. x[i,j] need know new value of x[i-1,j] , x[i,j-1] easy if want calculate on cpu (calculations sequential). gpu calculating parallel results received cpu , gpu different. found info dynamic parallelism in cuda , cudadevicesynchronize() , believe useful anyway still have no idea how implement loop in kernel. grateful help. comments above right , pure sequential implementation, need copy data. here kernel (without memory management code or further details): __global__ void update(...) for(int = threadidx.x + blockdim.x * blockidx.x; <= n; += blockdim.x * griddim.x) { for(int j = threadidx.y + blockdim.y * blockidx.y; j <= n; j += blockdim.y * griddim.y) { output[i,j] = update_func(input, i, j);

unity3d - IPhone 6 Vuforia ImageTarget model rendering -

Image
i have been developing ar application using vuforia imagetarget, run on android, iphone devices except iphone 6 (this happen on iphone6 device). please take @ image, have searched on vuforia developer forum & can't find solution. unity 5.3.1f vuforia 5.5.9

c# - Integer only validation for dynamically added Textbox inside Asp.net Gridview -

below how gridview code , since datatable pivoted value number of columns cannot predicted. adding textbox dynamically through code. <asp:gridview id="gvdata" emptydatatext="there no data records display." runat="server" autogeneratecolumns="false" headerstyle-backcolor="#3ac0f2" headerstyle-forecolor="white" onrowdatabound="gvdata_rowdatabound" > <rowstyle bordercolor="lightblue" /> </asp:gridview> protected void page_load(object sender, eventargs e) { foreach (var item in columnnames) { templatefield tfield = new templatefield(); tfield.headertext = item; gvdata.columns.add(tfield); } gvdata.datasource = ds.tables[0]; gvdata.databind();} protected void gvdata_rowda

Python searching patterns in lists of strings -

i have list of strings following in python: ss = ['t', 'q', 't', 'd', 'q', 'd', 'd', 'q', 't', 'd'] is there anyway check how many ts directly followed d, in case, there 2 ts (second , last t) meet requirement. i tried not working though, advice? thx! if ['t','q'] in ss: print ("yes") you iteratively checking if next character d , implementing sort of counter. (probably) tersest, although maybe not best way. ss = ['t', 'q', 't', 'd', 'q', 'd', 'd', 'q', 't', 'd'] print("".join(ss).count("td")) result: 2

ios - How can I change text color of certain cells in UITableView? -

so, i'm making app in xcode 6 (swift 1). i'm trying make cells' text colors green, , others' red, however, i'm not successful. here's code: import foundation import uikit class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { @iboutlet var tableview: uitableview! var items: [string] = ["green", "red"] override func viewdidload() { super.viewdidload() self.tableview.registerclass(uitableviewcell.self, forcellreuseidentifier: "cell") } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return self.items.count; } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell:uitableviewcell = self.tableview.dequeuereusablecellwithidentifier("cell") uitableviewcell cell.textlabel?.text = self.items[indexpath.row] return cell } func tableview(tableview: uitableview!,

multithreading - Exception: java.lang.OutOfMemoryError, unable to create a new native thread -

i creating new threads every 5 seconds , using threadpool exector. making sure threads getting closed. getting exception in thread "timer-0" java.lang.outofmemoryerror: unable create new native thread. is happening because creating many threads , not closing them? or creating new ones frequently? can please tell me if doing wrong in code? public class api{ private mongostoreexecutor executor = new mongostoreexecutor(10,50); private class mongostoreexecutor extends threadpoolexecutor { public mongostoreexecutor(int queuesize, int maxthreadpoolsize) { super(10, maxthreadpoolsize, 30, timeunit.seconds, new arrayblockingqueue<runnable>(queuesize), new threadpoolexecutor.callerrunspolicy()); } } public timertask alertingpoolsdata() throws exception, unknownhostexception { timeertask task = new timertask(){ public void run(){ pools = alertingpools.

r - summarizing data based on a pre-set condition and adding a (0,1) flag -

i have following data frame df following columns: df <- rep metric 1 1 2 0 3 1 1 b 1 2 b 1 3 b 1 1 c 0 2 c 1 3 c 1 i want summarize data rep such each unique rep if be 1 both metric a , b add new column beboth 1 otherwise 0 (i.e. if of them zero, beboth zero). the output should be: rep beboth 1 1 2 0 3 1 how may in r? triled use ifelse statement didn't right! here's came with library(dplyr) df <- data_frame(rep = c(1,2,3,1,2,3,1,2,3), metric = c("a", "a", "a", "b", "b", "b", "c", "c", "c"), = c(1,0,1,1,1,1,1,1,0)) res <- df %>% group_by(rep) %>% mutate(beboth = ifelse(grep("a|b", metric) && be==0, 0, 1)) res #source: local data frame [9 x 4] #groups: rep [3] # # rep metric

Python: object of type 'Response' has no len() -

issue: when try execute script, receive error message "typeerror: object of type 'response' has no len(). tried passing actual html parameter, still doesn't work. import requests url = 'http://vineoftheday.com/?order_by=rating' response = requests.get(url) html = response.content soup = beautifulsoup(html, "html.parser") you getting response.content . return response body bytes ( docs ). should pass str beautifulsoup constructor ( docs ). need use response.text instead of getting content.

javascript - Angular 2: Implementing HTTP POST Request -

in angular 1.x application doing following on form submit. $scope.submit = function() { console.log('saving form data..'); $scope.selection_array = []; ( var j = 0; j < $scope.checkboxlist.length; j++ ){ if ($scope.checkboxlist[j].selected) { console.log($scope.checkboxlist[j]); $scope.selection_array.push($scope.checkboxlist[j].key); } } if ($scope.selection_array.length>0) { $http({ method : 'post', url : base_url + '/user/selection', headers : { 'content-type' : 'application/json' }, params : { access_token : localstorage.getitem("access_token") }, data : $scope.selection_array }).success(function(response) { console.log('response=>' + response); $window.alert('your items have been saved succes

vbscript - How to add a descriptive object to object repository in UFT? -

in uft, if i'm creating descriptive object via code manually specifying various micclass , value, can object added existing object repository (*.tsr)? descriptive object nothing creating object manually via code i.e making object( not recording or adding via object spy ) , assigning properties. the same thing can done in object repository using define new test object option. in object repository manager (or object repository) window menu bar select object->define new test object , select properties want assign object. please go through below link reference: http://www.c-sharpcorner.com/uploadfile/9dc5d3/1/

java - How to remove new ArrayList<>? -

i have try methods remove, removeall, delete. of these words not available in android studio. word should used instead? public list<contactobject> receipt = new arraylist<>(); receipt.add(new contactobject(object.product_title, object.product_price, object.img1, object.quantity)); i know how add list receipt, how remove data added? the remove() of arraylist depends on implementation of equals() method, in case in contactobject . invoking remove() solve issue. receipts.remove(contactobject);

Force loading RDD from file to memory in Spark -

i have demo application runs spark computation. loads rdd stored in object file, , perform tasks depends on user's input. loading rdd using sparkcontext.objectfile() lengthy operation. since time issue, load before demo starts, , perform calculations depend on input during presentation. however, spark's lazy policy leads reading file once entire computation triggered. rdd.cache() not trick its-own. caching lazy operation too. is there way force-load rdd file? if not, there way speed rdd load, and/or keep in memory future spark jobs? spark version 1.5 , runs in single-node standalone mode. file read local file system. can tweak spark's configuration or these settings if needed. after calling cache() , call action on rdd (usually 1 uses count() ) "materialize" cache. further calls rdd use cached version: rdd.cache().count() // load rdd // use rdd, it's cached

php - How to pass total amount with order details in payeezy demo payment gateway -

i have integrated payeezy payment gateway 1 of e-commerce site. can pass order details price , quantity not able pass total amount order details. here code using----> <form action="https://demo.globalgatewaye4.firstdata.com/pay" id="pay_now_form_1dcc971562" method="post"> <input name="x_login" type="hidden" value="xxx-xxxx-xxxxxxxxxx" /> <input name="x_show_form" type="hidden" value="payment_form" /> <input name="x_fp_sequence" type="hidden" value="14605299651823126780" /> <input name="x_fp_hash" type="hidden" value="pnb-1.0-eba46929895e57fc4254e9ef11cdbcbcf647334c" /> <input name="x_amount" type="hidden" /> <input name="x_currency_code" type="hidden" value="usd" /> <input name=&

ios - Discovering insteon Hub using Bonjour -

i trying build app on iphone can detect if insteon hub connected same router phone. know insteon hub advertises as? how can detect , details present users. insteon not release information how app discovers insteon hub. can try sniff network wireshark while connecting insteon app insteon hub , see how goes.

xml parsing - How can I add changes of one XML file to another in java -

i have 2 xml files.i need add changes in 1 xml file using java code, not copy second file contents first file. tried xmlunit finding differences between xml files, not provide writing functionality look xslt transforms allow set rule rewrite xml based on xml/datafile

XPages inputTextArea is not editable -

when use multiline editbox (shown in first one) cannot editable if document in editmode. second 1 editable. point if use formula @ value of inputtextarea can not editable. not find missed? first one: <xp:inputtextarea id="muvname" rows="2" cols="70"><xp:this.value><![cdata[#{javascript:@implode(document1.getitemvalue("muvname"))+ @newline() + "c/o";}]]></xp:this.value></xp:inputtextarea> second one: <xp:inputtextarea id="muvname" rows="2" cols="70" value="#{document1.muvname}"> </xp:inputtextarea> use property defaultvalue define default value: <xp:inputtextarea id="muvname" rows="2" cols="70" value="#{document1.muvname}"> <xp:this.defaultvalue><![cdata[#{javascript: @implode(document1.muvname)+ @newline() + "c/o&qu

accessing multiple elements in a matrix matlab -

this question has answer here: how can change values of multiple points in matrix? 3 answers how can 1 access vector of elements different columns efficiently in matlab example: a = [1 2 5 4 4 6 2 5 3 6 8 9 2 4 5 7 2 9 4 2] retrieve: (1, 1) (2,2) (3,1) (4,4) (5,3) use sub2ind : ret = [1 1; 2 2; 3 1; 4 4; 5 3]; a( sub2ind(size(a), ret(:,1), ret(:,2)) )

kurento: How to pass guint8 * to java server as an int[] -

i trying send gstbuffer objects map.data java server. have created event parameter int[] when raising event getting following error @ compile time. error: no matching function call ‘kurento::module::vadcustomfilter::bufferreceived::bufferreceived(std::shared_ptr<kurento::mediaobject>, const char [16], int*)’ bufferreceived event (shared_from_this (), "buffer received", ((int *)buffer)); map.data of type guint8 * is there wrong doing in type casting ? i tried sending map.data std::string @ java side not receiving complete string. casting guint8* char* fine, because sign changes. casting int * not ok because size different, in order send kind of events, may need copy array of guint8 array of int . think not fast operation, nor serializing big event, not expect have great performance. furthermore, kurento events expects (you should check signature of bufferreceived ) when declare array std::vector<int> , in case need create array , c

android - set tab Selected Text Color do not work -

i want change color of tab when it's selected .in matrial design tutorial said set tabselectedtextcolor can that. did n't work me .and force in ontabselected below code: public void ontabselected(tablayout.tab tab) { textview v = (textview) tab.getcustomview().findviewbyid(r.id.text_tab_counter); v.setvisibility(view.invisible); textview vv=(textview) tab.getcustomview().findviewbyid(r.id.text_tab); vv.settextcolor(getresources().getcolor(r.color.notify)); v.settext(""); tab.getcustomview().invalidate(); viewpager.setcurrentitem(tab.getposition()); } why didn't work out? edit becuse have custom tab layout? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent"

Internet access between WiFi-IoT in Access Point mode with mobile phone connected -

i did lot of brain-storming this, , couldn't reach solution. i posting can ideas. i have developed wifi-iot based device sensor, shows in ap mode. mobile phone connects ap , device starts sending sensor data mobile phone. mobile application plots , displays data. now, want send data mobile internet. connecting mobile ap internet not option, don't want break continuous data transmission. using internet of data provider 1 option, brings constraint of have mobile data. what other options have send data mobile internet ?? edit:- i worked on suggestions, , came point:- 1) wifi-iot device (in station mode) , mobile phone connect same internet-enabled wifi access point. wifi-iot device has ip address of mobile phone current network, , sends data tcp port (eg. 9801) of ip address. application in mobile phone reads data port no. 9801 , stores , hosts on internet. this works fine. 2)wifi-iot device comes in access point mode, , mobile phone connects access point.

How to write spring AOP for jax-rs -

i beginner in spring aop. requirement log before invoketestserver method execution.please find code below: application-context.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc

python - One test case fails due to runtime error -

i trying project euler problem 25 on hackerrank. i attempted brute force method using binet's formula . import math _ in range(int(input())): numlen = int(input()) x in range(1, 5000): fib = 1/pow(5,.5)*(pow(((1+pow(5,.5))/2),x) - pow(((1-pow(5,.5))/2),x)) if(numlen == len(str(int(fib)))): print(x) break here 5000 arbitrary number based on assumption input not more , problem not here runtime error i'm think because it's exceeding integer range(not sure). it calculates other test cases in less 0.25 seconds. i did searching , found this . but recurrence method: import math _ in range(int(input())): = 1 b = 0 n = int(input()) term = 1 while len(str(a)) != n: a, b = a+b, term+=1 print (term) gives timeout exceeds 10 seconds. can please me find way improve first method , optimize second method. note: tried storing pow() values in variables instead of recomputing ,

arrays - How to get the key of a Firebase Object -

how can key of firebase object without using snapshot? i have done research below. using code: var ref = new firebase('https://johnsoncompany.firebaseio.com/people') var firstperson = ref.orderbychild("first").limittofirst(1); var key = $firebaseobject(firstperson); ..i object below: { "5":{ "first":"jennifer", "last":"robert", "mobile":"121 364 135", } } firebase had given object key "5" since data contained in array of values. 6th value. the challenge in-order value "jennifer", have know key "5". i use code: var firstperson = $firebaseobject(ref.child('5')) var firstname = firstperson.first; //returns jennifer i know can use code below key '5': ref.orderbychild("first").limittofirst(1).once("child_added", function(snapshot) { alert(snapshot.key()); }); the c

Selenium objects out of the screen -

i have selenium test runs smooth on 1920 * 1080 resolution. have task make test on different common resolutions such 1366 *768. problem when run selenium test on smaller resolutions 1920 * 1080 can't find elements below window (as expected) how solve this? i've tried javascriptexecutor jse = (javascriptexecutor)driver; jse.executescript("window.scrollto(0,math.max(document.documentelement.scrollheight,document.body.scrollheight,document.documentelement.clientheight));"); to scroll bottom of page no success. appreciate loads. using java, selenium, testng , pom. hi scroll please use below scrolling bottom of page driver.navigate().to(url); ((javascriptexecutor) driver) .executescript("window.scrollto(0, document.body.scrollheight)"); scrolling element on page driver.navigate().to(url); webelement element = driver.findelement(by.id("id")); ((javascriptexecutor) driver).executescript( "arguments[0].

javascript - Youtube API v3 return wrong response -

i have problem youtube api version 3. if upload video foreign rights (e.g. video of windows ) , reponse "duplicate" youtube video exists in account. isn't correct, because have never uploaded video before. i expect response "copyright" youtube. error in api?

HTML email sent by Laravel MailGun driver is not displayed property by GMail -

when using mailtrap driver in laravel 5, html email displayed properly. when switched use mailgun driver email , check in gmail, css styling not working properly. here sample original email displayed gmail: to: user@gmail.com mime-version: 1.0 content-type: text/html; charset=utf-8 content-transfer-encoding: quoted-printable <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.= w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns=3d"http://www.= w3.org/1999/xhtml"> <head> <meta name=3d"viewport" content=3d"width= =3ddevice-width" /> <meta http-equiv=3d"content-type" content=3d"text= /html; charset=3dutf-8" /> <title>ischolar registration</title> = <style type=3d"text/css"> /* -----------------------------------= -- i can see lines appended = symbol. here how send email: mail::send( 'e

debugging - stm32f207 program doesn't work without entering debug -

there microcontroller sends udp packets on ethernet. problem - after restarting power mc sends nothing on ethernet if don't enter debug mode. i use iar 6.6 , works fine if enter debug mode without downloading code. added delay few seconds doesn't work without debug. what can problem?

Java Reflection calling constructor with primitive types -

i have method in test framework creates instance of class, depending on parameters passed in: public void test(object... constructorargs) throws exception { constructor<t> con; if (constructorargs.length > 0) { class<?>[] parametertypes = new class<?>[constructorargs.length]; (int = 0; < constructorargs.length; i++) { parametertypes[i] = constructorargs[i].getclass(); } con = clazz.getconstructor(parametertypes); } else { con = clazz.getconstructor(); } } the problem is, doesn't work if constructor has primitive types, follows: public range(string name, int lowerbound, int upperbound) { ... } .test("a", 1, 3); results in: java.lang.nosuchmethodexception: range.<init>(java.lang.string, java.lang.integer, java.lang.integer) the primitive ints auto-boxed in object versions, how them calling constructor? use integer.type instead of integer.class . a

Update object identified by composite key with rails -

i have table components. each component have specific version describe above (there other attributes name, component_type_id, ...): id | version_id -----+------------ 167 | 1 167 | 96 167 | 97 167 | 98 167 | 99 166 | 1 166 | 92 the attributes "id" , "version_id" composite primary key, , want edit object identifying composite pk. if want update version 99 of component #167 => with rails when : component.where(id: 167, version_id: 99).first.update({"component_type_id"=>"5", "name"=>"ccc"}) rails : select "components".* "components" "components"."id" = $1 , "components"."version_id" = $2 order "components"."id" asc limit 1 [["id", 167], ["version_id", 99]] update "components" set "name" = $1, "updated_a

html - Weird margin in editable table -

when try code editable table in pure html & css, run in indesiderate issue. if table-layout attribute set auto have strange margin applied right of cell i'm editing. is there way keep full width of table without strange margin applied content i'm edit? below code snippet better explain i'm talking about: table { width: 100%; } table,tr,th,td { border: 1px solid black; border-collapse: collapse; padding: 10px; table-layout: auto; } <table contenteditable='true'> <thead> <tr> <th>header1</th> <th>header2</th> <th>header2</th> </tr> </thead> <tbody> <tr> <td>content</td> <td>content</td> <td>content</td> </tr> </tbody> <tbody> <tr> <td>content</td> <td>content</td> <

C# Console Application connecting to a 1.1 web service (WCF/WSE/WebRequest) -

i have been provided soap 1.1 wsdl , password protected p12 x509 certificate connect web service periodically transmit records. have been provided how guide sign message using x509. example provided illustrates how sign message , provide appropriate security message headers. sample code in java, , includes functions signing message interact soap message directly. the application i'm writing c# console app entity framework elements retrieve data. my question related best approach tackling problem: use wcf static configuration possible. use wcf programmatic configuration (e.g. using custom messageheaders). use webrequest/webresponse , craft messages manually. use wse 3.0 , convert wsdl proxy class using older command line tools. i've been investigating wcf routes - wcf ideal if control both sides of equation - articles thinning out specific use case.

Concatenating Matrices with for loop command in R -

consider reproducible data in generate 5 random matrices. want combine data in first row of each matrix set.seed(123) result <- foreach(i=1:5) %do%{ # randomly select number of rows , columns random.rows <- sample(1:5, 1) random.columns <- sample(1:5, 1) # generate matrix out of matrix(sample(1:100, random.rows*random.columns), random.rows) } the desired output should take form: c(result[[1]][1,], result[[2]][1,], result[[3]][1,] # ........ ) i trying implement for-loop in real life, have more 5 matrices. can guide me towards desired output for (i in 1:5) { desired_out <- c(result[[i]][1,]) }

Access to Excel: boolean is changed to numeric -

i noticed when transfering query result access excel, whether copy/paste or using docmd.outputto , true / false values become -1 or 0 in excel. of course write vba proc fill excel wondering: there trick use make simple transfer work? in other words, value should assign query column proper true / false in excel ? noticed in excel, true not equal -1. it's not matter of formatting, in access. tried far without success: using ´cbool´: nice true / false in access, turns in -1/0 in excel changing format field property in query "true/false": same result in query, can use expression force true/false string excel during export: spelledboolean: format([yourbooleanfield], "true/false") to return 0 or 1, use abs: zerooneboolean: abs([yourbooleanfield])

Elixir/Phoenix: How to use third-party modules in config files? -

it seems way configuration files in phoenix loaded , compiled pose problem when using third-party modules in config.exs or dev.exs/prod.exs/test.exs . example: set guardian jwt authentication trying use jose.jwk module jwk creation / loading in config.exs . can use module alright in console iex -s mix phoenix.server . of course installed dependency. error i'm getting ** (mix.config.loaderror) not load config config/config.exs ** (undefinedfunctionerror) undefined function jose.jwk.from_file/2 (module jose.jwk not available) this code in config.exs # configure guardian jwt authentication config :guardian, guardian, allowed_algos: ["hs512"], # optional verify_module: guardian.jwt, # optional issuer: "myapp", ttl: { 30, :days }, verify_issuer: true, # optional secret_key: system.get_env("guardian_key_passphrase") |> jose.jwk.from_file(system.get_env("guardian_key_file")), serializer: myapp.guardianserializer

javascript - Background image for animated SVG Path element -

hello came across interesting looking website : http://digitalbakery.org/ i wonder how did provide background image animated svg path elements? i have tried set background image svg before. did not work. looking in dom see in fact images , svg entirely separated. img in ul element specified somewhere. is path element, when hover , has opacity reduced 0 hence revealing img underneath? if cannot seem figure out how exact location worked out. how can effect achieved? i have used named clippath crop images. simplest example: <svg id="playout"> <g> <clippath id="hex-mask"> <path d="..."></path> </clippath> </g> <image x="..." y="..." xlink:href="..." **clip-path="url(#hex-mask)"** /> </svg> location calculates container's vertexes.

ios - Fully replacing app that has been submitted to the apple app store -

my client wants update iphone app doesn't have access source code. possible update existing app building scratch? yep, need use same bundle id in app , maintain versioning (just make higher in app store). long have developer account published app, fine

operators - RxAndroid response of one call to make another request -

i'm new rxandroid , trying chain responses. i'm using github api retrieve data. along each issue there comments link , events link associated want fetch , update existing object list of comments , events form this. [ issue: { comments: [ { . . }, { . . } ] events : [ { . . }, { . . } ] ] ] i retrieve initial response following code githubservice githubservice = servicefactory.createservicefrom(githubservice.class, githubservice.endpoint); githubservice.getissueslist() .subscribeon(schedulers.newthread()) .observeon(androidschedulers.mainthread()) .map(issues -> arrays.aslist(issues)) .subscribe(adapter::add); now how retrieve comments , events before updating adapter ? want show 3 comments , 3 events well. thanks @riccardo ciovati example ! here solution. , works ! public static void getissuesforrepo(final issuesl

python - Removing all but one tick on x-axis -

Image
i have graph tick remove ticks , corresponding labels bar first tick , label on x-axis. how go this? import pylab import numpy np import matplotlib.pyplot plt a=np.linspace(0,10,10000) print def f(x): return 1/(1-(x**2)*np.log((1/(x**2)+1))) b=f(a) fig, ax = plt.subplots(1) ax.plot(b,a) pylab.xlim(0.5, 5) pylab.ylim(0, 1.5) fig.show() you can use ax.set_xticks([1]) set 1 xtick @ 1,0. also, there's no need import both pylab , matplotlib.pyplot . the recommended way import matplotlib.pyplot , use axes methods. e.g., can use ax.set_xlim instead of pylab.xlim . here's full script , output plot: import numpy np import matplotlib.pyplot plt a=np.linspace(0,10,10000) print def f(x): return 1/(1-(x**2)*np.log((1/(x**2)+1))) b=f(a) fig, ax = plt.subplots(1) ax.plot(b,a) ax.set_xlim(0.5, 5) ax.set_ylim(0, 1.5) ax.set_xticks([1]) plt.show()

Wrap each form in formset with a div including unmentioned fields with django crispy forms -

i'm using following code wrap form fields of form in formset in div django crispy forms: class operatorform(forms.modelform): def __init__(self, *args, **kwargs): super(operatorform, self).__init__(*args, **kwargs): self.helper = formhelper(self) self.helper.form_tag = false self.helper.all().wrap_together(div, css_class="operator-form") self.helper.render_unmentioned_fields = true class meta: model = operator fields = tuple(fields_list) instantiating formhelper 'self' autogenerates layout without having specify fields. need because fields dynamically generated. problem delete , order fields not added layout. set render_unmentioned_fields true. setting these 2 fields @ least show in form, not wrapped rest of fields in div. i know can manually iterate on forms in formset , wrap them div, i've been doing now, requires manual handling of non form errors of formset, done aut

java - Javax ClientBuilder post() removes file before sending to web service -

i'm trying send temporary file restful web service. i'm using following function this: private static string nlpfileupload(string filepath) throws ioexception { // check file exists file file = new file(filepath); if(!file.isfile()) { throw new filenotfoundexception(); } // upload file web service return clientbuilder.newclient() .target(nlpresturl + "upload") .request() .post( entity.entity(file, mediatype.application_octet_stream) ).readentity(string.class); } the problem is, in method .post() file removed disk , filenotfound exception returned: [error] [04/18/2016 19:04:35.945] [application-akka.actor.default-dispatcher-2] [taskinvocation] java.io.filenotfoundexception: /tmp/multipartbody3655134388737861177astemporaryfile (no such file or directory) javax.ws.rs.processingexception: java.io.filenotfoundexception: /tmp/multipartbody3655134388737861177astemporaryfile (no such f

javascript - how can I apply Datatable jquery on asp.net GridView? -

<asp:gridview id="grddonationrequests" runat="server" selectmethod="grddonationrequests_getdata" autogeneratecolumns="false" allowpaging="true" pagersettings-mode="numericfirstlast" pagesize="10" datakeynames="donationrequestid" itemtype="tayf.models.donationrequest" allowsorting="true" width="100%" cssclass=" table-striped table-condensed table table-bordered table-hover" meta:resourcekey="grddonationrequestsresource1"> i tried $(function () { $("#<%=grddonationrequests.clientid%>").prepend( $("thead>/thead>").append($(this).find("tr:first"))).datatable({ }); }); but gives me error uncaught typeerror: cannot read property 'classname' of undefined upd

dart - Handling clickevents from webcomponents inside of other webcomponents -

Image
i have used dart webui create component contains component this. the desired respons clicking had when click on inner component fires inside of inner component , not affect component contains it. click event on inner component fires both in inner , in outer component. is there way handle click on inside , prevent "bubbling" parent element? <!doctype html> <html> <head> <link rel="import" href="coloritem.html"> </head> <body> <element name="color-item-with-inside-color-item" constructor="coloritemwithinsidecoloritem" extends="coloritem"> <template> <style scoped> #inner-color-item div{ border:5px solid whitesmoke; } #inner-color-item { margin-top:10px; margin-bottom:0px; } </style> <color-item colo

node.js - can not insert document (record) into mongodb -

i developing project in mean stack , need import countries, states , cities following code. can import countries , states json files cities can import first document (record) instead of all. route.js router .route('/api/user/loadcity') .get( function(req, res, next) { var fs = require("fs"); fs.readfile('/home/user7/downloads/city.json', 'utf8', function (err,data) { data = json.parse(data); for(var = 0; < data.length; i++) { console.log(data[i].city_name); var newcity = new city({ id:data[i].id, country_id : data[i].country_id, state_id : data[i].state_id, city_name : data[i].city_name, is_active : data[i].is_active }); newcity.save(function (err) { if(err){ conso

javascript - Hide toolbar of pdf file opened inside iframe using firefox -

other browsers such chrome,ie working fine when given #toolbar=0.but not working in firefox. please help. this code. <html> <body> <iframe src="reports/reports.pdf#toolbar=0" width="100%;" height="80%"> </iframe> </html> i think it's dependent on application/plugin in browser opens pdf, works differently , might ignore there directives (depending on browser, plugin, platform, pdf viewer). the general recommendation here use these "directives" @ end of url: #toolbar=0&navpanes=0 you may try recommendations http://blogs.adobe.com/pdfdevjunkie/web_designers_guide : embedding using pdfobject you use basic html markup embed pdf files in page there more elegant solution out there. take @ pdfobject philip hutchison. pdfobject pretty easy scripting tool dynamically embedding pdf files web pages. uses javascript inject element dom tree of html file. there’s

html - what will be the css path of the Export csv element -

Image
below content of drop down. want click on export csv. what css path export csv can click on through selenium web driver. select class not applicable since no select present in html. can write css path select export csv you can take id on building css selector. build css id need use # li#ui-menu-item-exportcsv thank you, murali

linux - ipv6 validation using regex -

#!/bin/bash echo "enter ip address:" read s if [[ $s =~ ^(([0-9a-fa-f]{1,4}:){7,7}[0-9a-fa-f]{1,4}|([0-9a-fa-f]{1,4}:){1,7}:|([0-9a-fa-f]{1,4}:){1,6}:[0-9a-fa-f]{1,4}|([0-9a-fa-f]{1,4}:){1,5}(:[0-9a-fa-f]{1,4}){1,2}|([0-9a-fa-f]{1,4}:){1,4}(:[0-9a-fa-f]{1,4}){1,3}|([0-9a-fa-f]{1,4}:){1,3}(:[0-9a-fa-f]{1,4}){1,4}|([0-9a-fa-f]{1,4}:){1,2}(:[0-9a-fa-f]{1,4}){1,5}|[0-9a-fa-f]{1,4}:((:[0-9a-fa-f]{1,4}){1,6})|:((:[0-9a-fa-f]{1,4}){1,7}|:)|fe80:(:[0-9a-fa-f]{0,4}){0,4}%[0-9a-za-z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fa-f]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; echo -e '\e[47;31m'"\033[1mipv6 format\033[0m" echo -n "the ipv6 address expanded form:" expanded=`sipcalc $s | fgrep expand | cut -d '-' -f 2` echo -e "\033[32m $expanded\033[0m"

How setbounds of drawable works in android? -

i confusing setbounds method of drawable in android. know used drawable , set drawable , how large is. briefly, defines, bounding rectangle drawable. confusing sets border or padding or or height.please let me explain how confusing. this how use setbounds drawableinstance.setbounds(l,t,r,b); first scenario so in above case, if set 5,5,5,5 l,t,r,b respectively, l,t,r,b of drawable aways forom parent respectively? mean setting hidden 5px border every side?besides, if image not large enough meets border width parent, image bigger? second scenario i set 5,5,100,100 l,t,r,b respectively. confusing is, starts drawing away parent 5px top , 5px left. start point. image 100px cause set 100 right. goes right 100px. same bottom right. but tested it. think both not think. please explain me how works. explain me each parameter of setbounds. having problem it. much. please me. the bounds values absolute, not relative. is, width == right - left , , height == bot

android - Collapsing toolbar title overlaps with my menu icons -

Image
i using collapsing toolbar in project working on currently. setting title of collapsing toolbar code problem if title big overlaps menu icons in toolbar. how can fix issue? title overlaps menu icon: my xml code: <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="205dp" android:fitssystemwindows="true" android:theme="@style/apptheme.appbaroverlay"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/agent_profile_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginbottom="87dp" app:expandedtitlemarginstart="130dp" app:expandedtitlete

authentication through web service SonarQube -

i'm working on web application highly requires sonarqube (version 5.3) web services. want authenticate sonarqube instance using application. web service should use? question : while using issues web service noticed web service returns issues of last project analysed sonar. there way have issues of projects or have issues of given project?

saxon:evaluate equivalent for MarkLogic xdmp:xslt-eval -

i need use stylesheet calls saxon:evaluate() in marklogic. throws error when try use xdmp:xslt-eval not recognizable ml saxon specific. does have idea how overcome this? far know there isn't similar saxon:evaluate() in ml, know available default in xslt 3.0 doesn't atm. there similar function in marklogic? the closest equivalents http://docs.marklogic.com/xdmp:unpath http://docs.marklogic.com/xdmp:value , http://docs.marklogic.com/xdmp:eval

javascript - How to get single specific values for keys in json structure? -

i doing exercise like: var jsonres; jsonres = json.stringify(jsonobjectarray); alert(jsonvals); // getting below json structure jsonres = { "key01": [10, "key01 description"], "key02": [false, "it's false value"], "key03": [null, "testing null"], "key04": ["tests", "another test value"], "key05": [[25, 50], "some testing values"] } but need like: jsonres = { "key01": 10, "key02": false, "key03": null, "key04": "tests", "key05": [25,50] } how can above structure(means need single values, don't need second values/multiple values respective keys) ? please me , in advance. var jsonres = { "key01": [10, "key01 description"], "key02": [false, "it's false value"], "key03": [null, "testin

java - indexing numeric field as both int and string in elastic search -

how can index numeric field both integer , string using multi_field . multi_field deprecated now. how can achieve same using "fields" field in version 2.x. have heard field can indexing , analysed in different ways using "fields". can indexed different types in elastic search? the issue facing classical numeric field search highlighting issue in elastic search.where not numeric fields highlighting. want index field string , int can search, highlight , perform range operations on data. you can use fields have numeric string well: { "mappings": { "test": { "properties": { "my_numeric": { "type": "integer", "fields": { "as_string": { "type": "string", "index": "not_analyzed" } } } } } } }