Posts

Showing posts from July, 2010

ios - GMSAutoCompleteViewController Crashing - Swift 3 -

i upgraded app swift 3 , has been crashing whenever has tried call autocomplete view controller in google maps. know api key isn't problem because working fine when using before upgraded swift 3 , xcode 8. know because app still able display google map. here code: extension additionalsetupviewcontroller: gmsautocompleteviewcontrollerdelegate { func viewcontroller(_ viewcontroller: gmsautocompleteviewcontroller, didautocompletewith place: gmsplace) { let locationcoordinate = place.coordinate if homeclicked { homeaddress = [locationcoordinate.latitude, locationcoordinate.longitude] } else if homeaddress == [] { } else { let coordstring = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".replacingoccurrences(of: ".", with: ",") // let coordstring = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".stringbyreplacingoc...

c++ - Finding the Indexes of a minimum sum subarray recursively -

i need find substring of lowest sum in given array, i.e {2, -3 , -5 , 6, 7,} giving -8 adding bolded numbers. found way retrieve sum recursively program retrieve sum not indexes using namespace std; int min(int a, int b) { return (a < b)? : b; } int min(int a, int b, int c) { return min(min(a,b), c); } int mincrossingsum(int a[], int l, int m, int h){ int sum = 0; int leftsum = int_max; for(int = m; >= l; i--){ sum += a[i]; if (sum < leftsum) leftsum = sum; } sum = 0; int rightsum = int_max; for(int = m+1; <= h; i++){ sum += a[i]; if (sum < rightsum) rightsum = sum; } return leftsum + rightsum; } int minsubarraydac(int a[], int start, int arraysize) { if (start == arraysize) return a[start]; int m = ((start + arraysize)/ 2); return min(minsubarraydac(a, start, m), minsubarraydac(a, m+1, arraysize), mincrossingsum(a, start, m, arraysize)); } int main() { int arr[] = {2...

java - How can I get my for each loop to print once for each number in the array -

assignment: write program reads in integers between 1 , 100 user , counts occurrences of each number. user input ends when enter 0. must use enhanced for-loop solve problem. if number occurs more 1 time use plural word “times” instead of “time”. not display numbers not entered. i know , understand why code's current output below appears duplicates. print logic inside for-each loop code block. if close code block no longer able use variables initialized inside loop. have tried can think of. suggestions appreciated current output: - 1 occurs 1 time, - 1 occurs 2 times - 2 occurs 1 time - 2 occurs 2 times - 3 occurs 1 time - 3 occurs 2 times needed output: - 1 occurs 2 times - 2 occurs 2 times - 3 occurs 2 times package com.company; import java.util.scanner; public class main { public static void main(string[] args) { scanner in = new scanner(system.in); int[] numbers = new int[10]; system.out.print("enter integers:"); (int = 0; < ...

python - ValueError: operands could not be broadcast together with shapes (51,51) (100,) -

im trying assigment, error: valueerror: operands not broadcast shapes (51,51) (100,) def get_velocity(strength, xs, ys, x, y,): u = strength /(2*np.pi)*(x-xs)/((x-xs)**2 +(y-ys)**2) v = strength /(2*np.pi)*(y-ys)/((x-xs)**2 +(y-ys)**2) return u, v i want use function given points x_naca0012 = np.loadtxt('naca0012_x.txt') y_naca0012 = np.loadtxt('naca0012_y.txt') strength_naca0012 = np.loadtxt('naca0012_sigma.txt') using function: u_naca0012, v_naca0012 = get_velocity(strength_naca0012, x_naca0012, y_naca0012, x, y) here goes wrong, search error , find not matching arrays, checked lengths of each array , match (100). noticed 50th element of naca0012_y positive value , 51th element negative value. think messes there.

Google Maps API 3 - Custom marker color using SVG (easy) -

i've seen lots of other questions similar. after, have tried many ways, have found solution easy implementation. i have downloaded svg image , save in folder. i have set url icon icon : { url : yoururl/marker.svg' } open svg file (sublime text) set fill property. <style type="text/css"> .st1{fill:#0a2b82;} </style> <ellipse class="st1" cx="23.5" cy="44.7" rx="10.4" ry="3.3"/>

java - Horizontal tiling background -

i'm coding game , want background repeat itself on , over. this code i'm using xoffset = (int) (camera.getx() % width); g.drawimage(bginv, xoffset - width, 0, width, height, null); g.translate(xoffset, 0); g.drawimage(bg, 0, 0, width, height, null); g.translate(-xoffset, 0); g.drawimage(bginv, xoffset + width, 0, width, height, null); the first drawimage draws image when camera's x negative , third when camera's x positive. bg normal background bginv background inverted the problem when i'm moving , xoffset goes width 0 , gives effect of "teleportation" . click here see the console outputting xoffset i know because i'm using modulo xoffset didn't figure out better way... thanks in advance if understood correctly, want repeat 2 * width height image, left half background image , right half same image horizontally inverted. so can following: xoffset = (int) (camera.getx() % (2 * width)); // draw background i...

python - Group similar dict entries as a tuple of keys -

i group similar entries of dataset. ds = {1: 'foo', 2: 'bar', 3: 'foo', 4: 'bar', 5: 'foo'} >>>tupelize_dict(ds) { (1,3,5): 'foo', (2,4): 'bar' } i wrote function, sure there way simpler, isn't? def tupelize_dict(data): itertools import chain, combinations while true: rounds = [] x in combinations(data.keys(), 2): rounds.append((x, data[x[0]], data[x[1]])) end = true k, a, b in rounds: if == b: k_chain = [x if isinstance(x, (tuple, list)) else [x] x in k] data[tuple(sorted(chain.from_iterable(k_chain)))] = [data.pop(r) r in k] end = false break if end: break return data edit i interested in general case content of dataset can type of object allows ds[i] == ds[j] : ds = {1: {'a': {'b':...

ruby on rails - How do I set use_ssl param when running a web request through a proxy? -

i’m using rails 4.2.7. how set “use_ssl” parameter when sending web request through proxy? have this res1 = net::http.socksproxy(tcpsocket::socks_server, tcpsocket::socks_port).start(uri.host, uri.port) |http| http.use_ssl = (uri.scheme == "https") resp = http.get(uri, initheader = headers) status = resp.code.to_i if status == 302 || status == 301 redirect = resp['location'] end content = resp.body content_type = resp['content-type'] content_encoding = resp['content-encoding'] end but when line — “http.use_ssl = (uri.scheme == "https”)” exception ioerror: use_ssl value changed, session started /users/davea/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:758:in `use_ssl=' /users/davea/documents/workspace/myproject/app/helpers/webpage_helper.rb:96:in `block in get_content' /users/davea/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:853:in `start'...

python - How to call modal dialog from inside Flask function -

with bootstrap modal dialog's id="mymodal" : <div id="mymodal" class="modal fade" role="dialog"> ... </div> i can call clicking simple <a> . happens because <a> s data-target attribute linked modal dialog's id mymodal : <a data-toggle="modal" data-target="#mymodal">click here</a> i wonder if there way call modal dialog id inside of flask python function. @app.route('/call_modal', methods=['get', 'post']) def call_modal(): # ... call modal dialog id? you can use modal plugin make work, such remodal . bootstrap modal, every modal has id, can call anchor, this: //example.com#mymodal . in view.py: @app.route('/call_modal', methods=['get', 'post']) def call_modal(): redirect(url_for('index') + '#mymodal')

Python: Incident causing wrong result? -

the following code expected return 'none', however, seems i've done wrong incident: def function_that_prints(): print "i printed" f1 = function_that_prints() print f1 i've tried putting 3rd line left aligned it's still not happening. please correct me, thanks! with third line indented part of function, function_that_prints() recurses (it calls itself) indefinitely , python raise runtimeerror complaining maximum recursion depth has been exceeded. if not indent third line have following code snippet: def function_that_prints(): print "i printed" f1 = function_that_prints() print f1 # running produce: # printed # none the statement f1 = function_that_prints() print "i printed" , set f1 none , suggested. then statement print f1 print value of f1 , none .

java - How to apply suits to the cards in matching game? -

basically, project description asks user create matching game, consisting of: a blueprint creation of playing card attributes are: suit, face value, faceup status, , optional unicode value suit icon a 2 dimensional playing table (4x4), 16 pairs of matching cards, , running count of number of face-down cards. include method retrieve specific card table @ input x,y position. a gameboard, , loop continues play until cards remain face up. loop includes interface user pick 2 cards (inputting x,y table positions), checking if 2 cards equal, decrementing count of facedown cards, , setting faceup boolean of cards. essnetially, program should run until cards face up, , game won. separated program in 4 separate classes below. 1. public class card { private final int cardvalue; private boolean faceup; public card(int value) { cardvalue = value; faceup = false; } public int getvalue() { return cardvalue; } public boolean isfaceup() { return faceup; } public void ...

python - How to minimize matrix w with given equation and conditions? -

w 3*1 matrix , want minimize (w' seccov w), given w'*secmu = 6.5, w'*1 = 1. thank you! import pandas pd import numpy np scipy.linalg import solve scipy import optimize seccov = np.matrix('1 2 3, 4 5 6, 7 8 9') secmu = np.matrix('1.1 1.2 1.3').t def minfunc (w, cov): return w.t*cov*w

python - How to use groupby method to combine rows or columns by using their mean? -

for example: b c coffee 1 2 3 sprite 2 3 1 coffee 1 3 2 coke 2 4 5 sprite 2 3 1 coke 3 4 5 if wanna use groupby method combine these rows (or columns) using mean, how can that? b c coffee x x x sprite x x x coke x x x x mean as said, it's call groupby . use level=0 group again index: df out[65]: b c coffee 1 2 3 sprite 2 3 1 coffee 1 3 2 coke 2 4 5 sprite 2 3 1 coke 3 4 5 df.groupby(level=0).mean() out[66]: b c coffee 1.0 2.5 2.5 coke 2.5 4.0 5.0 sprite 2.0 3.0 1.0

anko - Kotlin addTextChangeListener lambda? -

how build lambda expression edittext addtextchangelistener in kotlin? below gives error: passwordedittext.addtextchangedlistener { charsequence -> try { password = charsequence.tostring() } catch (error: throwable) { raise(error) } } addtextchangedlistener() takes textwatcher interface 3 methods. wrote work if textwatcher had 1 method. i'm going guess error you're getting relates lambda not implementing other 2 methods. have 2 options going forward. 1) ditch lambda , use anonymous inner class edittext.addtextchangedlistener(object : textwatcher { override fun aftertextchanged(p0: editable?) { } override fun beforetextchanged(p0: charsequence?, p1: int, p2: int, p3: int) { } override fun ontextchanged(p0: charsequence?, p1: int, p2: int, p3: int) { } }) 2) create extension method can use lambda expression: fun edittext.aftertextchanged(aftertextchanged: (string) -> unit) { this.addtextchangedlistener(...

class - Atom LESS classes -

as known code editor atom hackable , let's client modify , wringle as client wants to, point atom customisable. , has it's own less-css updates / compiles whenever save it, , gets applied atom style. i having hard times understanding how things in less-css file, problem not less language, classes atom using. , killing both me , time not knowing classes use. in past days have tried search want change takes long find out correct class. so wonder if so has nice tips or can use make easier knowing , understanding how classes , structure of how atom built.

Jmeter 3.0 Dashboard graph not match with listener graph -

Image
am using thread group , stepping thread group. running jmeter command line , generate .jtl file csv format. generate report using -o command line options. the problem graph output different compare graph output in listener ui e.g response times on time graph listener when load .jtl file graph dashboard granularity of jmeter-plugins graph seems different jmeter core one. you can try different settings changing in user.properties: jmeter.reportgenerator.overall_granularity=60000

Python code count letters for loop -

write function countletter() should have 'for' loop steps through list below , prints name of city , number of letters in city's name. may use len() function. citylist = ["kentucky","new york","la", "toronto", "boston","district of columbia"] i using python 3.5 in spyder. having trouble extracting letters list , having them print out within loop. what have: def countletter(citylist): city = len(citylist) ct = 0 in citylist: city = (ne[i]) and stuck. fear may entirely wrong. struggling on how print this. the output should be: kentucky has 8 letters. new york has 12 letters. la has 2 letters. toronto has 7 letters. boston has 6 letters. district of columbia has 20 letters. thank help! you don't need use indices. iterate citylist ; for loop yield each city. def countletter(citylist): city in citylist: n = len(city) print(cit...

java - How can I call my class gui_Game from Main via button's action listener? -

when clicked button named "start", i'd launch class in gui_game . in gui_game set title , there have 3 button. this code in main class: private class start implements actionlistener{ public void actionperformed(actionevent e) { jbutton b = (jbutton) e.getsource(); if (b.gettext().equals("start")) // want add here } } this gui_game source: public class gui_game extends jframe{ private jbutton button; private jbutton button1; private jbutton button2; private jbutton button3; private jbutton button4; private jbutton button5; private jbutton button6; private jbutton button7; private jbutton button8; private jlabel stage; public gui_game() throws ioexception { // .. code .. } public static void main(string[] args) throws ioexception { gui_game main = new gui_gam...

How to stop flask from running my server when creating migrations? -

whenever run command flask db migrate or flask db upgrade using flask-migrate framework, starts running application on localhost, , have press ctrl+c quit before allowing server stop , generate migration. how can avoid this? another question have whenever run, first run in debug mode , after hitting ctrl+c quit again run without debug mode on, on different port. how limit running former? thanks. somewhere within application have app.run() call. flask runs application itself, call 1 causing db commands run server before carrying out command, , causes server run twice when flask run . if find , remove line think fine.

Redux-form: How can I get the value of a name property passed into a Field via FieldArray? -

using fieldarray redux-form , name gets passed field this: <field name={`${obj}.description`} component={textfield} hinttext={`${obj}.description`} /> the name string value "myarray[0].description" . obviously, redux-form performs lookup of property, in array element display in field . how can same? want display value of myarray[0].description property (not inside field ). stateless component has, however, fields object contains number of elements not array. the answer appears nested fields : <field name={`${obj}.description`} component={textfield} hinttext={ <field name={`${obj}.description`} component={(props) => { return ( <div> <span>{props.input.value}</span> </div> ) }}/> } />

encryption - How can I decrypt an RSA cipher knowing only p and q? -

knowing p , q, how can definitively find e , d in order able decrypt ciphertext? given "well aware" of rsa algorithm (i'm assuming textbook rsa) aware e can chosen value between 1 , φ(n), provided both e , φ(n) co-prime. if question boils down can determine, 100% certainty, values of e , d given p , q? answer no . this because valid value of e selected decrypt ciphertext something, not neccessarily original, something. you'd have have indication of plaintext's context, e.g. english? if knew this, , provided p , q relatively small, could test possible values of e until received result in english. in practice, e chosen 3 or 65537.

Time Complexity for Insertion Sort on Ref. Based Linked-List? -

here actual question: "what time complexity if insertion sort done on reference-based linked list?" i thinking o(1), right? because check nodes until find previous, , should node after, set pointers, , you're good. therefore, not every node need checked can't o(n). big o notation refers worst case complexity. inserting sorted list (which think how understanding question based on final paragraph) have complexity of o(n), since worst case inserting element goes @ end of list, meaning there n iterations. performing insertion sort on unsorted linked list involve inserting n elements linked list, giving complexity of o(n^2).

Calculate Difference between dates by group in R -

i'm using logistic exposure calculate hatching success bird nests. data set quite extensive , have ~2,000 nests, each unique id ("clutchid). need calculate number of days given nest exposed ("exposure"), or more simply, difference between 1st , last day. used following code: hs_hatch$exposure=na for(i in 2:nrow(hs_hatch)){hs_hatch$exposure[i]=hs_hatch$datevisit[i]- hs_hatch$datevisit[i-1]} where hs_hatch dataset , datevisit actual date. problem r calculating exposure value 1st date (which doesn't make sense). what need calculate difference between 1st , last date given clutch. i've looked following: exposure=ddply(hs_hatch, "clutchid", summarize, orderfrequency = as.numeric(diff.date(datevisit))) df %>% mutate(exposure = as.date(hs_hatch$datevisit, "%y-%m-%d")) %>% group_by(clutchid) %>% arrange(exposure) %>% mutate(lag=lag(datevisit), difference=datevisit-lag) i'm st...

android - Values from the Intent is not showing -

i don't know did wrong on here. have followed tutorial values end being empty. passsing values intent listview lvitems = (listview) view.findviewbyid(r.id.lvdashboardcompleted); lvitems.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { //toast shows id on here intent intent = new intent(getactivity(), categoryactivity.class); intent.putextra("category_id", id); startactivity(intent); } }); reviving value intent public class categoryactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getsupportactionbar().hide(); setcontentview(r.layout.activity_category); string recevied_cat_id = getintent().getstringextra(...

cordova - Phonegap Plugin Shutdown -

can please explain me phonegap means it's deleting plugin repository , "please sure update these apps use plugins npmjs.com or git repositories before november 15th, 2016, after time apps not built." mean plugins manually installed github won't work past november 15? here link i'm talking about: http://phonegap.com/blog/2016/10/13/pgb-repository-shutting-down/ at beginning, phonegap build allowed use plugins knew compatible platform, , hosted them on own repository. on time, have improved product making compatible more plugins , allowing use sources such github or npm, there no point of keeping repository plugins there, outdated or have same code of official plugins. so, if using github plugins go, if using npm plugins too. make sure don't have gap:plugin tag in config.xml , double check plugins use . on id, core plugins moved - syntax (example, org.apache.cordova.device , cordova-plugin-device)

web scraping - Getting 'global name not defined' error in Python using scrapy -

i've been learning scrapy book called web scraping python ryan mitchell. there's code in book gets external links website. though i'm using same code in book (the thing did changing 'urllib.request' 'urllib2'), keep getting same error. python version 2.7.12. error: file "test.py", line 28, in <module> getallexternallinks("http://www.oreilly.com") file "test.py", line 16, in getallexternallinks internallinks = getinternallinks(bsobj, splitaddress(siteurl)[0]) nameerror: global name 'getinternallinks' not defined this code i'm using. from urllib2 import urlopen urlparse import urlparse bs4 import beautifulsoup import re allextlinks = set() allintlinks = set() def getallexternallinks(siteurl): html = urlopen(siteurl) bsobj = beautifulsoup(html) internallinks = getinternallinks(bsobj,splitaddress(siteurl)[0]) externallinks = getexternallinks(bsobj,splitaddress(siteurl)[0]) link ...

java - How to embed FileChooser into application with JavaFX? -

i'm trying figure out how can use javafx make filechooser panel directly embedded application. essentially, filechooser should open since application relies on filechooser, i'm looking have filechooser directly inside window rest of gui is, won't have opened in separate window. is possible, or entire filechooser have manually coded?

html - How to make section 100% size with margins? -

i want border pictures , parallax scrolling, added section in body , had content in that. when make section 100% or 100vh , add margin goes outside body. you need section full height 20px margin. have added fiddle here and code here <body style="margin:0;background: red; width:100%;height:100%;"> <section style="position: absolute; display: inline-block; top:0; left:0; bottom:0; width:200px; margin:20px; background:green;"> </section> </body>

spring mvc - URL pattern servlet mapping -

i created hello world example using spring mvc, there 1 thing didn't understand in servlet url mapping, did following in web.xml: <servlet> <servlet-name>helloweb</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>helloweb</servlet-name> <url-pattern>/test/*</url-pattern> </servlet-mapping> now if want call following controller: @controller @requestmapping("/hello") public class helloworld { @requestmapping(method = requestmethod.get) public string printwelcome(modelmap model){ model.addattribute("message","hello world"); return "index"; } } it work using following link: http://localhost:8080/test/hello but when change servlet url-pattern "/*" , try: h...

python - Having trouble using cached tokens with Spotipy for Spotify? -

i'm trying use spotipy access user's spotify library running bit of trouble. background, i'm using flask, sqlalchemy, , flask-login. i looked off of this tutorial on github started, 1 doesn't quite work me because if use cache, users can access playlist of user token cached, , since there cached token, user after first user can't login spotify. here initial setup: sp_oauth = oauth2.spotifyoauth(os.environ['spotipy_client_id'], os.environ['spotipy_client_secret'], os.environ['spotipy_redirect_uri'], scope="user-library-read") to solve this, first tried storing each user's access code in database (i'm using sqlalchemy well). looked (under method page spotipy redirects access code): if request.args.get("code"): dbsession.query(user).get(current_user.uid).addservice( request.args["code"]) dbsession.commit() however, route meant return names of playlists user owns...

javascript - How to hide and unhide div section in wordpress using page builder? -

currently , have page display testimonies year 2012 until 2016. create hyperlink user can view testimony year. example, graduate of 2016 | 2014 | 2013 | 2012 when user click 2016, other year's testimonies hidden , vice versa. link http://caa.org.my/demo/testimonial-2/ i tried add javascript block whole year seem not working @ page builder. by way, don't use jquery pure javascript. anyone can help? regards, steve why don't create taxonomy "year" testimonial post type? assign every post type specific year. can access slug of taxonomy , value of term ( i.e. year/2016, or testimonials_year/2016 ) . adjust template it. see: https://developer.wordpress.org/themes/basics/template-hierarchy/ template hierarchy.

Rcpp - Define a C++ function that takes an R function and an ellipsis argument -

i have r function bar takes r function foo , defined follows: foo <- function(x,y) x + y bar <- function(foo, z, ...) z + foo(...) a call bar of form: bar(foo, 1,2,3) now foo defined above, want create c++ version of bar . here's i've tried: library(rcpp) cppfunction( ' double bar(function foo, double z, ...) { return z + foo(...); } ') this doesn't work. right way define function in c++? thanks. it might easier turn ellipsis list before feeding rcpp bar <- function(foo, z, ...) { args <- list(...) bar_internal(foo, z, args) } and rcpp function can take rcpp::list instead of ellipsis. double bar_internal(function foo, double z, list args){ }

json - Apply Access restriction to properties inside a model in loopback [Strongloop] -

i have model named employee , it's properties "name":"", "dob":"", "location":"" some of default roles in loopback frameworks $authenticated $everyone i wanted to 1.allow $authenticated roles on accessing model employee [ read , write ]. 2.allow $everyone role [read] model properties except location property [location allowed read role $authenticated] . , i added below config in employee.json, did't work. { "accesstype": "read", "principaltype": "role", "principalid": "$everyone", "permission": "allow" }, { "accesstype": "read", "principaltype": "role", "principalid": "$everyone", "permission": "deny", "property": "location" } searched lot, not able ...

sql - Delete relative row from three different tables in mySQL -

i have following tables. corp_id (pk) | corp_name ---------------------------------------- 1 | freshfruit 2 | realsteel 3 | firmwall corp_id (fk)| empl_id (pk) | empl_name -------------------------------------------------------- 1 | 1 | andy 1 | 2 | maria 2 | 3 | john 2 | 4 | neil 3 | 5 | stephan 3 | 6 | darwing empl_id (fk)| client_id (pk)| client_name --------------------------------------------------------------- 1 | 1 | moris 1 | 2 | bean 1 | 3 | bay 3 | 4 | phill 4 | 5 | hank 5 | 6 | suzy ...

grails 3 - push notification -

i need implement push notification in grails 3 project. searched while , not reach plugin/ documentation/ dependency help. it great if can full documentation or hint on how implement push notification in grails 3. i have tried add dependency of cometd , event-push, in grails 3 failed download dependency. is there way integrate of these? grails-events-push events-push client-side events bus based on superb portable push library atmosphere , grails platform-core plugin events propagation/listening. it allows client listen server-side events , push data. it uses websockets default , falls use comet if required (server not compliant, browser old...). events-push white-list broadcaster (client-side events scope 'browser'). need define events can propagated server modifying events dsl use 'browser' scope. 4.to register listeners client, need define them well. git hub demo: https://github.com/smaldini/grails-events-push or cometd plugin http...

How to round in bigquery -

how round 0.2356 0.23 in google bigquery? remember round returns float , hence has 2 parameters , in 2nd parameter able define decimals want returned. others ceil , floor return integer , hence no second parameter, can mimic decimals using math. select floor(0.2356*100)/100

android java.lang.NoClassDefFoundError: org.bouncycastle.crypto.engines.AESEngine api 16 -

i using com.nimbusds.jose.crypto library in android client doing jwt stuff. this declare in gradle file : compile 'com.nimbusds:nimbus-jose-jwt:4.23' everything works fine on api >=19, when running code on api 16, getting exception : java.lang.noclassdeffounderror: org.bouncycastle.crypto.engines.aesengine . what's issue here? why class aesengine not available on api 16? if dependecy list of nimbus-jose-jwt there no bouncycastle library. however, if source code, , more precisely package com.nimbusds.jose.crypto.bc can see, uses bouncycastle without declaring dependency. library assumes bouncycastle present. the solution add dependencies manually. first of all, follow link implement standard way of using bouncycastle on android. however not solve problem, because org.bouncycastle.crypto.engines.aesengine not in 1 of libraries. solution add 1 more dependency: dependencies { compile 'org.bouncycastle:bcprov-jdk15on:1.54...

javascript - get current time as PT08H10M00S -

how can convert current time in format pt08h10m00s. use odata service communication , expects time in format pt08h10m00s 8:10:00 in time. there inbuild js function same. if pt dynamic can add code derive @ runtime how ever want var d = new date(); var customdate= 'pt'+ d.gethours()+'h'+d.getminutes()+'m'+d.getseconds()+'s'; console.log(customdate);

zap - ZAProxy Jenkins plug in how to configure browser for ajax spider -

i started using zap proxy plug-in jenkins. using zap version 2.5.0. have managed configure plug-in in jenkins. there way can choose different browser ajax spider url(instead of default firefox)? in standalone version of zap, there option choose different browsers. if use firefox(version 49) getting following error. while running jenkins planing use phantomjs or htmlunit. -------------------------------------------------------------------- status spider = running alerts number = apiresponseelement numberofalerts = 92 org.openqa.selenium.firefox.notconnectedexception: unable connect host 127.0.0.1 on port 7055 after 45000 ms. firefox console output: xpi debug updating database changes installed add-ons 1478780397489 addons.xpi-utils debug updating add-on states 1478780397490 addons.xpi-utils debug writing add-ons list 1478780397494 addons.xpi debug registering manifest c:\program files (x86)\mozilla firefox\browser\feat...

arrays - C, printf loop and line change -

i new @ c programming. i have 1-d array (size of array given user, containing seat numbers) i want print result in screen divide results in multiple rows. each row should have 4 elements of array, , last 1 more elements. probably use loop combined printf can't think of way combine them. so have tried , works not elegant code, have repeat 15 times. (i = 0; < 4; i++) { if (seatnr[i] = 1) printf("1"); else printf("0"); } printf("\n"); (i = 4; < 8; i++) { if (seatnr[i] = 1) printf("1"); else printf("0"); } printf("\n"); (i = 8; < 12; i++) { if (seatnr[i] = 1) printf("1"); else printf("0"); } for (j = 0; j < n; j+=4) { (i=j; < j+4; i++) { if (seatnr[i]==1) printf("1"); else printf(...

ios9 - How do you distinguish between an iOS app entering background via the press of lock button vs otherwise? -

in app want show playing info on lockscreen, if app still main 1 when lock screen button pressed. don't want show info if app backgrounded through switching app or via press of home button. either case triggers resign active , did enter background, how distinguish between ios app entering background via press of lock screen vs otherwise?

No such method/property 'isString' in Firebase Database rule -

Image
i'm new in firebase, want each project property string of minimum length 32 { "rules": { "project": { "$a": { ".read": true, ".write": "auth != null && $a.isstring() && 32 <= $a.length", here $a project property name $a.isstring() not aviliable & getting error how check $a string of minimum 32 length ? keys strings, don't need (and apparently can't even) check that. { "rules": { "project": { "$a": { ".read": true, ".write": "auth != null && 32 <= $a.length", by way: yoda conditions don't make difference in firebase security rules, since we'll never assign value left-hand side of expression anyway.

javascript - How to call to function with parameter from event -

i use following code working: yauzl.open(filepath, function (err, zipfile) { zipfile.on('entry', (entry) =>{ //console.log(entry.filename); if (/\/$/.test(entry.filename)) { return; } zipfile.openreadstream(entry, (err, readstream) => { if (err) { logger.info(err); reject(err); } else { ... now want change code bit make more readable doing following: yauzl.open(filepath, (err, zipfile) => { //zipfile = zipfile; if (err) { __rejectandlog(err); return; } zipfile.on('entry', __processentry(zipfile)) .once('error', __rejectandlog) .once('close', () => { console.log(`unpacked ${numoffiles} files`); resolve(); }); }); this processentry: function __processentry(zipfile) { zipfile.openreadstream(entry, (err, readstream) => { if ...

facebook - error : java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservi -

i getting following error in xamarin android while building solution. 2> uncaught translation error: java.lang.illegalargumentexception: added: landroid/support/v4/accessibilityservice/accessibilityserviceinfocompat; (taskid:343) 2> uncaught translation error: java.lang.illegalargumentexception: added: landroid/support/v4/accessibilityservice/accessibilityserviceinfocompat$accessibilityserviceinfoicsimpl; (taskid:343) 2> uncaught translation error: java.lang.illegalargumentexception: added: landroid/support/v4/accessibilityservice/accessibilityserviceinfocompat$accessibilityserviceinfostubimpl; (taskid:343) 2> uncaught translation error: java.lang.illegalargumentexception: added: landroid/support/v4/accessibilityservice/accessibilityserviceinfocompat$accessibilityserviceinfoversionimpl; (taskid:343) 2> uncaught translation error: java.lang.illegalargumentexception: added: landroid/support/v4/animation/animatorcompathelper; (taskid:343...

What is the best source to learn DirectX technology -

i computer engineer. wanted learn directx. question source or book learn directx scratch. prerequisite , proficiency in component object model necessary learn directx. -thank you. you haven't specified if want use c/c++ or .net language vb or c#. if wanting use c++, recommendation start directx tool kit tutorials . see getting started direct3d 11 . if want use managed languages, slimdx or sharpdx reasonable place start. direct3d "com lite". makes use of iunknown reference counting, , few aspects make use polymorphism of queryinterface , you'd ever need com well-handled microsoft::wrl::comptr smart-pointer (at least in c++).

firebase - How to get an array with all pictures? -

i'm working upload images, works great, have 100 pictures , show them in view, complete list of images in folder, can not find in new api option. there no api call in firebase storage list files in folder. if need such functionality, should store metadata of files (such download urls) in place can list them. firebase realtime database perfect , allows share urls others. you can find (but involved) sample of in our friendlypix sample app. relevant code web version here , there versions ios , android.

c# - dotnet-core could not found base Interface method -

Image
i'm facing odd situation, if tried in vs 2015 navigates base symbol method without problem.even vs code omnisharp on ubuntu 16.04 has no problem navigate method. when run, throws odd exception. i'm %100 sure method there... here dotpeek screenshot /yakari.tests/{outputdir}/yakari.dll here structure: public interface icacheprovider : idisposable { ..... void set(string key, object value, timespan expiresin, bool ismanagercall = false); ..... } public interface ilocalcacheprovider : icacheprovider { .... } public abstract class basecacheprovider : icacheprovider { ..... public abstract void set(string key, object value, timespan expiresin, bool ismanagercall = false); ..... } public class littlethunder : basecacheprovider, ilocalcacheprovider { ..... public override void set(string key, object value, timespan expiresin, bool ismanagercall = false) { .... } ..... } when this: public class sometestclas...

c# - Does WCF support several client authentication types on same binding? -

i have working wcf service. should add windows authentication service not want break backwards compatibility. there way enable ntlm authentication per request/client on same binding? i looking similar httplistener authentication schemas ..

java - Use custom (unicode) fonts in WebView for my Android app -

i wanted use custom fonts in android app, custom fonts in textview works fine couldn't find way add custom (unicode) fonts in webview , have tried every way possible failed, take @ code see whether missed something. thankyou.! i've created css file custom font-family in asset folder , called loaddatawithbaseurl doesn't work. htmltextview = (webview) findviewbyid(r.id.htmltextview); string text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />"; htmltextview.loaddatawithbaseurl("file:///android_asset/", text, "text/html", "utf-8", null); htmltextview.getsettings().setjavascriptenabled(true); htmltextview.setbackgroundcolor(color.transparent); htmltextview.getsettings().setdefaultfontsize( webhelper.getwebviewfontsize(this)); css file: @font-face { font-family: 'iskoola pota'; src: url('fo...

node.js - How to parse this data provided by python? -

i have program written in python - rednotebook . modern journal being saved on pc locally in text files format: $ cat ~/.rednotebook/data/2016-01.txt gives me this: 10: {text: плов} 11: {text: '#переход Легли около часа Встали около 12 часов'} 12: {text: '{} '' ''{ ''} \'' \{ \}'} note format looks json, single quotes ' instead of double quotes, has integers primary keys(?) indicate day in month. , escapes special characters prepending ' single quote. so, question this: how format of data called? are there libraries parsing format in nodejs or golang? upd1: have found post how merge 2 versions of rednotebook - it's quite easy mess yaml markup used in month files, rednotebook issue warning when sees such file , can fix it. i'll try parse yaml code it turned yaml code. can parsed https://github.com/nodeca/js-yaml

orm - Tell doctrine to ignore a class when looking for mapping metadata -

i have doctrine.orm config: course_scheduling: auto_mapping: false mappings: coursescheduling: type: yml dir: '%kernel.root_dir%/../app/resources/config/doctrine/coursescheduling' alias: 'coursescheduling' prefix: 'akademia\institution\coursescheduling\domain\model' is_bundle: false common: type: yml dir: '%kernel.root_dir%/../app/resources/config/doctrine/coursescheduling/common' alias: 'common' prefix: 'akademia\institution\common\domain\model' is_bundle: false the classes under namespace akademia\institution\coursescheduling\domain\model : scheduledcourse coursesession courseschedule inside folder '%kernel.roo...

algorithm - pseudopolynomial time and polynomial time -

i confused pseudopolynomial time in compare polynomial time input(n); (int i=0; i<n;i++){ dostuff; } the runtime o(n) writing out number n takes x=o(log n) bits. so, if let x number of bits required write out input n, runtime of algorithm o(2^x) , not polynomial in x. conclusion correct? edit: @ simple primetest. function isprime(n): 2 n - 1: if (n mod i) = 0, return false return true the runtime o(n) . remember, formal definition of time complexity talks complexity of algorithm function of number of bits of input. therefore, if let x number of bits required write out input n, runtime of algorithm o(2^x), not polynomial in x. edit2: got points @ knapsack problem. // input: // values (stored in array v) // weights (stored in array w) // number of distinct items (n) // knapsack capacity (w) j 0 w do: m[0, j] := 0 1 n do: j 0 w do: if w[i] > j then: m[i, j] := m[i-1, j] else m[i, j] := max(m[i-1, j], ...

c++ - Few rigidbody cause Bullet Physics slowly -

i'm doing job intergrating physics engine, bullet physics, graphics engine, before that, implemented easy collision system sap , narrowphase algorithm, cost of time 3ms sap , narrowphase 300 objects. because of bugs of algorithm, decided change real physics engine, bullet physics. followed tutorial official articles. when thought know how implement in graphics engine, , output screen becomes 3 fps. it seems problem on understand. make real simple example reproduce lag encountered. btbroadphaseinterface* broadphase = new btdbvtbroadphase(); btdefaultcollisionconfiguration* collisionconfiguration = new btdefaultcollisionconfiguration(); btcollisiondispatcher* dispatcher = new btcollisiondispatcher(collisionconfiguration); btsequentialimpulseconstraintsolver* solver = new btsequentialimpulseconstraintsolver; btdiscretedynamicsworld* dynamicsworld = new btdiscretedynamicsworld(dispatcher, broadphase, solver, collisionconfiguration); dynamicsworld->setgravity(btvector3(...