Posts

Showing posts from January, 2015

How to run function on JavaScript? -

i want run function sent parameter on javascript, example create script, want script print "successful test" script print whale function text. thus, how can run function sent parameter function? test=function (p1) { return p1; } var result=test(function(){ return "successful test"; }); console.log(result); you should return return p1(); var test=function (p1) { return p1(); } var result=test(function(){ return "successful test"; }); console.log(result); jsfiddle demo

python - What causes the error "_pickle.UnpicklingError: invalid load key, ' '."? -

i'm trying storage 5000 data elements on array. 5000 elements storage on existent file (therefore it's not empty). but i'm getting error , don't know causing it. in: def array(): name = 'puntos.df4' m = open(name, 'rb') v = []*5000 m.seek(-5000, io.seek_end) fp = m.tell() sz = os.path.getsize(name) while fp < sz: pt = pickle.load(m) v.append(pt) m.close() return v out: line 23, in array pt = pickle.load(m) _pickle.unpicklingerror: invalid load key, ''. pickling recursive, not sequential. thus, pickle list, pickle start pickle containing list, pickle first element… diving first element , pickling dependencies , sub-elements until first element serialized. moves on next element of list, , on, until finishes list , finishes serializing enclosing list. in short, it's hard treat recursive pickle sequential, except special cases. it's better use smarter patt

c++ - Visual Studio runs wrong file -

Image
this question has answer here: visual studio runs unwanted code [closed] 1 answer as can see in screenshot, have 2 files. want run source2.cpp, vs runs source1.cpp. how can make run file want? i'm using vs 2013. cpp files source files, , not executable. source files added project , compiled together. of source in of included files added resulting assembly or executable building. run executable, don't run .cpp file. don't run .h file or .vcxproj or else. executables run. .exe files executables.

Java Unable to return variables -

the code fine, when need take variables out of functions , put them public static void, says variable cannot found. know how solve issue? import java.util.*; public class greetings { public static void main(string[] args) { system.out.println("greetings, " + string(s) + ". " + string(j) +"!" + " " + int(z) + " years old"); } public static string fnamegenerator(string s){ scanner scan1 = new scanner(system.in); system.out.println("please enter first name: "); string first = scan1.next(); s = first.substring(0,1).touppercase(); return s; } public static string lastname(string j){ scanner scan2 = new scanner(system.in); system.out.println("please enter last name: "); string second = scan2.next(); int x = second.length(); string y = second.substring(0, x).tolowercase();

python - Plot semilogx with matplotlib then convert it into Bokeh -

i plot figure containing several curves using matplotlib , try convert bokeh: import numpy np import matplotlib.pyplot plt bokeh import mpl bokeh.plotting import show, output_file num_plots = 6 colormap = plt.cm.gist_ncar time = np.random.random_sample((300, 6)) s_strain = np.random.random_sample((300, 6)) def time_s_strain_bokeh(num_plots, colormap, time, s_strain): plt.gca().set_color_cycle([colormap(i) in np.linspace(0, 0.9, num_plots)]) plt.figure(2) in range(0, num_plots): plt.plot(time[:,i], s_strain[:,i]) plt.grid(true) # save bokeh output_file('anywhere.html') show(mpl.to_bokeh()) time_s_strain_bokeh(num_plots, colormap, time, s_strain) it works fine. however, want have semilogx plot. when change plt.plot in "for" loop plt.semilogx , have following error: unboundlocalerror: local variable 'laxis' referenced before assignment what can change x-axis onto log scale? as of bokeh 0.12 , pa

javascript - Difference between child and isolated scopes in directives -

i trying understand scopes in angularjs directives. gather there 3 types: scope inherited parent controller child scope ( scope: true ) isolated scope ( scope: {} ) i understand first one. second one, 'child scope' defined as: scope prototypically inherited parent controller and 'isolated scope' defined scope specific directive , not inherited parent controller in layman terms, difference between 'child scope' , 'isolated scope'? what respective use cases? with respect type of scope use, here of guiding principles follow. knowledge stem looking number of angular , third party directives use parent scope if need add behaviour existing dom elements, ng-click , ng-show , ng-class examples of it. these directives not come own template ui extend behaviour of exiting html elements. use scope:true , or child scope when directive plans add new properties on scope , not want pollute parent scope such properties. few ang

objective c - ObjectiveC framework in Swift app causing errors (MobFox ad network framework) -

i'm trying implement mobfox ad network swift app. framework built in objc i'm not familiar with. i have added bridging header. im getting 2 errors cannot figure out. code producing errors: class viewcontroller: uiviewcontroller, mobfoxnativeaddelegate { ... func nativeadfailedtoloadwitherror(error: nserror!) { } func nativeadwasclicked() { } func nativeadwasshown() { } func publisheridformobfoxnativeadcontroller(controller: mobfoxnativeadcontroller!) -> string! { return "publisher_id_here" } func nativeaddidload(ad: mobfoxnativead!) { } } these issues: class viewcontroller: uiviewcontroller, mobfoxnativeaddelegate { the above code causes error: type 'viewcontroller' cannot conform protocol 'mobfoxnativeaddelegate' because has requirements cannot satisfied i'm sure there no other methods need implement - unless im mistaken. the other issue is: func nativeaddidload(ad: mobfoxn

ruby - MySQL2: Lost connection to MySQL server during query -

i getting following error when trying use union: actionview::template::error (mysql2::error: lost connection mysql server during query: select `apps`.* `apps` `verve_apps`.`status` in (1, 2) , (apps.id in (select apps.id `apps` `apps`.`status` in (1, 2) , (app_name '%b%') union select apps.id `verve_apps` inner join taggings on taggings.taggable_id = apps.id inner join tags on tags.id = taggings.tag_id , taggings.taggable_type = 'app' `apps`.`status` in (1, 2) , (tags.name = 'b') order id asc)) order app_name asc limit 10 offset 0) app.rb class app < activerecord::base include activerecord::unionscope acts_as_taggable attr_accessor: :user_name, :age, :country, tag_list scope :tagged_with, lambda { |tag| { :joins => "inner join taggings on taggings.taggable_id = user.id\ inner join tags on tags.id = taggings.tag_id , taggings.taggable_type = 'app'", :conditions => [

ibm mobilefirst - IBM mobile first development server unable to start in eclipse? -

ibm mobilefirst development server failed start showing error objc[77281]: class javalaunchhelper implemented in both /library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/jre/bin/java , /library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/jre/lib/libinstrument.dylib. 1 of 2 used. 1 undefined. error: transport error 202: bind failed: address in use error: jdwp transport dt_socket failed initialize, transport_init(510) jdwp exit error agent_error_transport_init(197): no transports initialized [../../../src/share/back/debuginit.c:750] fatal error in native method: jdwp no transports initialized, jvmtierror=agent_error_transport_init(197) /users/test/documents/sathyarajworkspace/eclipse/plugins/com.worklight.worklight-artifacts_7.1.0.00-20151012-1525/liberty/wlp/bin/server: line 764: 77281 abort trap: 6 "${java_cmd}" "$@" since lost eclipse version of 6.3 copied eclipse mac. when tried run development server error shown. have upda

R POSIXct and as.Date -

i have date , time value i'm using posixct store in variable. , when use as.date date different - why ? x<-as.posixct("2012-02-25 19:00:00") as.date(x) [1] "2012-02-**26**" why incrementing day 1? by using x<-as.posixct("2012-02-25 19:00:00") setting time zone, tz , current systems time zone, est. however when use as.date without declaring time zone default gmt. gmt 5 hours ahead of est 25/02/2012 19:00 00:00 26/02/2012.

python - How do I pass a variable by reference? -

the python documentation seems unclear whether parameters passed reference or value, , following code produces unchanged value 'original' class passbyreference: def __init__(self): self.variable = 'original' self.change(self.variable) print(self.variable) def change(self, var): var = 'changed' is there can pass variable actual reference? arguments passed assignment . rationale behind twofold: the parameter passed in reference object (but reference passed value) some data types mutable, others aren't so: if pass mutable object method, method gets reference same object , can mutate heart's delight, if rebind reference in method, outer scope know nothing it, , after you're done, outer reference still point @ original object. if pass immutable object method, still can't rebind outer reference, , can't mutate object. to make more clear, let's have examples. list - mut

c# - Xunit.net and Moq Assert that method is called regardless of an exception being thrown -

in method i'm testing want assert call has been made before exception thrown. currently act/assert section of test looks this: assert.throws<exception>(() => sut.handlemessage(messagetoprocess)); mock.verify(n => n.method(it.isany<string>()), times.once); but breaks rule of asserting once since i'm asserting handlemessage throws exception (which has own test case) , verifying mock.method called. means test fails if exception hasn't been thrown isn't i'm testing here. how verify method has been called if exception hasn't been thrown, try-catch-finally acceptable here (as below)? try { sut.handlemessage(messagetoprocess); } catch{} { mock.verify(n => n.method(it.isany<string>()), times.once); }

c# - smallest float that can be summed to another float -

assuming there's float number 7 digits how find smallest number can added float? example 1: 1234.567f + 0000.001f = 1234.568f example 2: 0.01234567 + 0.00000001f = 0.01234568f op added c# after posting of c answer. will leave c solution reference. print number out in exponential format , change each digit, '0' or '1' float smallest_float_summable(float f, int digs) { char buf[20]; sprintf(buf, "%.*e", digs - 1, f); char *p = buf; while (*p != 'e') { if (isdigit(*p)) { *p = '0' + (p[1] == 'e'); } p++; } float y; sscanf(buf, "%e", &y); return y; } printf("%e\n", smallest_float_summable(1234.567f, 7)); // 1.000000e-03 this not smallest typically number near 1/2 value of smallest_float_summable() effect change, yet seems match op's intent. to smallest number effect change, simple use nextafter() the nextafter functions determine n

javascript - Array.push replaces all my array elements with the last one inserted -

i have following code: var ship_array = new array(); var ship_object = new object(); ship_object.builder_id = 0; ship_object.list_id = 0; ship_object.ship_id = 0; ship_object.title_id = 0; then in save function, do: function saveall() { // array cleaning while (ship_array.length) { ship_array.pop(); } // cyclic save function $.each($(".ship-block"), function () { ship_object.builder_id = parseint($(this).attr("data-counter")); ship_object.list_id = list.id; ship_object.ship_id = parseint($(this).attr("data-ship-id")); ship_array.push(ship_object); }); console.log(ship_array); } while debugging chrome, every ship_object has correct values in every cycle, when print array, every object has same values, corresponding last 1 inserted. literally have no clue why happening. ideas? basically using reference of object , updating same object again , again. try creating ne

ms access - Multiselect rows in listbox based on string -

i have multiselect listbox has around 60 values, user can go through , select want can read selected , output 1 line "1,2,3,4,5" , store value. problem have when user needs edit selected. how can reselect listbox items based on string "1,2,3,4,5" stored earlier? i figured out after lot of searching, here code dim strvalue string dim strarray() string dim x integer dim startrow integer strvalue = rsprints("ctype")'get string of row values strarray = split(strvalue, ",", -1, vbtextcompare)'my string required splitting remove commas , moving array x = 0 'set array start point 0 q = lbound(strarray) ubound(strarray) 'run through array startrow = strarray(x) me.formctype.selected(startrow) = true x = x + 1 next

javascript - Sliding div off-screen -

Image
i’m having little trouble template: basically, i’m trying add functionality if click box expand sliding other ones off-screen, instead sliding div off-screen it’s disappearing completely. here have far: jsfiddle . $(function() { $(".box").click(function() { var isopened = $(this).attr("isopen"); if (isopened == "true") { $(this).css("position", "relative").css("width", $(this).attr("data-ow")); $(this).attr("isopen", "false"); } else { $(this).attr("data-ow", $(this).css("width")); $(this).css("position", "relative").css("width", "40%"); $(this).attr("isopen", "true"); } }); }); * { margin: 0; padding: 0; } .container { width: 100%; max-width: 100%; max-height: 600px; overflow: hidden; } .box { height: 600px; d

java - How to ignore "peer not authenticated" error for RemoteWebDriver -

my selenium hub running on ssl https . certificate installed in couple of days. in testenvironment, , selenium hub running on computer within network, ignore ssl errors now. i using remotewebdriver connect hub. keeps on giving me exception: javax.net.ssl.sslpeerunverifiedexception: peer not authenticated how ignore error? the htmlunitdriver gives method override like:- @override protected webclient modifywebclient(webclient client) { client.getoptions().setuseinsecuressl(true); } but need use remotewebdriver.

Android Google Map multiple markers on same location -

i have simple app google map , dynamicly loading markers. in case 2 or more markers have same lat , long 1 presented. there solution this? how plot markers map private void plotmarkers(arraylist<mymarker> markers, string markericon) { if(markers.size() > 0) { (mymarker mymarker : markers) { // create user marker custom icon , other options // toast.maketext(getapplicationcontext(), mymarker.getmlatitude().tostring(), toast.length_short).show(); markeroptions markeroption = new markeroptions().position(new latlng(mymarker.getmlatitude(), mymarker.getmlongitude())); markeroption.icon(bitmapdescriptorfactory.fromresource(managemarkericon(markericon))); marker currentmarker = mmap.addmarker(markeroption); mmarkershashmap.put(currentmarker, mymarker); mmap.setinfowindowadapter(new markerinfowindowadapter()); }

html5 - Change place of DOM elements with jQuery -

i want change places of dynamic elements in webpage jquery, here code have code. <div class="div1"><label>name</label></div> <div class="div2"><label>address</label></div> <div class="div3"><label>user no</label></div> and how want jquery @ run time <div class="div1"><label>name</label></div> <div class="div3"><label>user no</label></div> <div class="div2"><label>address</label></div> i want move div2 after div3 . in advance! try use .insertafter(selector) @ context, $("div.div2").insertafter(".div3"); demo

CSS Color the container -

i new language want know how can color container (the part between header , footer). possible without using div? have tried this, problem when change position of container "absolute" overlaps header more on changes page's width please give example code. thanks. html , body { height: 100%; } body { background: red; } i made html , body 100% in case. don't need it. suggest never have naked body background. edit : or if want image body { background:url('http://www.planwallpaper.com/static/images/canberra_hero_image.jpg'); }

Insert into Database Groovy Grails -

i'm new developer groovy grails , have table named user under database test. succeed login database using grails couldn't succeed register new user. here register.gsp <g:form controller="user" action="registration"> <fieldset class="form"> <div class="fieldcontation ${haserrors(bean: userinstance, field: 'fullname', 'error')}"> <label for="fullname"> <g:message code="enduser.fullname.label" default="full name" /> </label> <g:textfield name="fullname" value="${userinstance?.fullname}"/> </div> <div class="fieldcontation ${haserrors(bean: userinstance, field: 'username', 'error')}"> <l

java - search text for strings in between strings android -

i have long json text have locate string of movie title between following: ((((((( .","title":" , ","type":" ))))))) i have read on other solutions : string mydata = json; pattern pattern = pattern.compile(".\",\"title\":\"(.*?)\",\"type\":\""); matcher matcher = pattern.matcher(mydata); while (matcher.find()) { testare += (matcher.group(1)); } and way messier: list<string> strings = arrays.aslist( json.replaceall("^.*?.\",\"title\":\"", >>"") .split("\",\"type\":\".*?(.\",\"title\":\"|$)")); arrayadapter<string> myadapter = new arrayadapter<string>(mainactivity.this, android.r.layout.simple_list_item_1, st

c - allocating null pointer when passed to function -

this program contains typical node struct linked list (so pointer next node , int containing value). have following test functions: void f(node** y, int value) { node* x = *y; if(!x) { printf("case1...\n"); x = (node*)malloc(sizeof(node)); x->data = value; return; } printf("case2...\n"); x->next = (node*)malloc(sizeof(node)); x->next->data = value; return; } void myprint(node** y) { node* x = *y; printf("printing...\n"); printf("%d %d\n", x->data, x->next->data); return; } int main() { node* n = null; f(&n, 5); f(&n, 10); myprint(&n); } this code produces following output in linux: case1... case1... printing... segmentation fault i don't understand why passing null pointer function cause first case occur. seems pointer being passed value, don't think that's what's going on. if call mall

html - Responsive image and text at same time -

is there way make text on right side, scale image on left side @ same time. when try resize browser text height goes outside. try media queries doesn't work. don't want use height on element. possible? here jsfiddle: [http://jsfiddle.net/mbole87/a9zstjzb/1/] you use "vw" value in css? along css image of course... .some-class{ font-size: 2vw }

amazon web services - appspec.yml failed to call scripts -

i trying setup ci using aws codedeploy , circleci. right stuck @ step aws codedeploy should copy stuff ec2 , run scripts. somehow circleci tells me wrong. know might happening? thanks. the appspec.yml is: version: 0.0 os: linux files: - source: / destination: /home/ubuntu hooks: beforeinstall: - location: scripts/setup.sh timeout: 3800 runas: root applicationstart: - location: scripts/start.sh timeout: 3800 runas: root and setup.sh is: #!/bin/bash sudo apt-get install nodejs npm npm install in above code tried apt-get install nodejs npm it's still nor working. the error message in /var/log/aws/codedeploy-agent/codedeploy-agent.log follows: 2015-10-22 08:02:54 error [codedeploy-agent(1314)]: instanceagent::plugins::codedeployplugin::commandpoller: error during perform: instanceagent::plugins::codedeployplugin::scripterror - script @ specified location: ./scripts/setup.sh run user root failed exit code 127 - /opt/coded

ruby on rails - Display or not Apipie documentation -

i'm using apipie on rails app. i'm using cancancan manage authorizations according user's status. i wondering if has try join these 2 gems allow users see api documentation or not. basically, i'm wondering if there way dismiss api documentation according variables. well yes can. should write own check of authorization, have @ second answer here: https://github.com/apipie/apipie-rails/issues/349

node.js - How do I stream JSON from node? -

i'm working on node/express ( sails , technically) based service used retrieve large number of items. several calls need return many thousands of items json serialized array. inside node basic control loop retrieve items in pages. each page retrieved, have minor processing performed, , have items returned client. at present i'm doing "store , forward" approach, in each page's items concat() results array, , once items have been retrieved results returned. what more of yield or streaming approach, in items added response they're ready--avoiding need build large in-memory collection , beginning send usable data possible. if need generate 1 large json string data, you're pretty stuck storing in memory , json.stringify -ing it. an alternative have each item separate json string, using newline character delimiter. way, have processed item, can stringify , pipe response using node streams, , in client can process data receive line line w

xml - Ruby SOAP with Savon 2 and nested attributes -

my first time work soap. having looked savon document couldn't figure out how turn following xml hash. i'm using savon 2.11.1. should use ":attributes!" or "@" "version" , "language" attribute in "fp:example" element? so, question how can this? <fp:example version="1.0" language="en"> <fp:findsomething id="id-1"> <fp:somestuff> <fp:number>50</fp:number> </fp:somestuff> </fp:findsomething> </fp:example> thanks! for version 2.11.1, @ working me. find below example client.call(:create, { :message => { :sobjects => { :'@xsi:type' => 'urn1:contact', :firstname => 'jane', :lastname => 'doe' } } }) yields: <tns:sobjects xsi:type="urn1:contact"> <tns:firstname>jane</tns:firstname> <tns:lastname&g

uiimage - UIDevice.currentDevice().model not returning as a simulator anymore -

i have image i'm generating in app, , trying save in simulator examine after generation. in previous versions of app, save image computer while running on simulator, use following code: let img = self.getimagefromdrawingview() uiimagewritetosavedphotosalbum(img, self, "image:didfinishsavingwitherror:contextinfo:", nil) let string = uidevice.currentdevice().model if ( string nsstring).containsstring("simulator") { let documentsdirectoryurl = nsfilemanager().urlsfordirectory(.documentdirectory, indomains: .userdomainmask).first nsurl! let fileurl = documentsdirectoryurl.urlbyappendingpathcomponent("image" + savedimagecounter.description + ".jpg") nslog("doc url " + documentsdirectoryurl.description) uiimagejpegrepresentation(img, 1.0)!.writetourl(fileurl, atomically: true) } the following line : let string = uidevice.currentdevice().model used return "ipad sim

user interface - How can I create this menu button in Javafx? -

Image
i'm working on college project, , create menu button allow users decide whether search id or search date, cannot find out how, or if it's possible. i appreciate if tell me if possible create such button displayed in image within black circle, , how. thanks in advance. you can use following code: checkmenuitem checkmenuitem1 = new checkmenuitem("id search"); checkmenuitem checkmenuitem2 = new checkmenuitem("date search"); menubutton menubutton = new menubutton(); menubutton.setgraphic(new imageview(new image(getclass().getresource("path.fileextension").toexternalform()))); menubutton.getitems().addall(checkmenuitem1,checkmenuitem2); alternatively, can use custommenuitem : custommenuitem iditem = new custommenuitem(new checkbox("id search")); custommenuitem dateitem = new custommenuitem(new checkbox("date search")); menubutton menubutton = new

Conditionally adding term filters to elasticsearch filter query -

i've been wondering how go checking if search parameter not empty before adding term filter filtered query. limited experience elasticsearch, seems have build exact query ahead of time. if using node / mongo, know along lines of var searchterms = {}; if(req.body.country){ searchterm['user.country'] = req.body.country; } if(req.body.company){ searchterm['user.company'] = req.body.company; } if(req.body.salary){ searchterm['user.salary'] = req.body.salary; } users.find(searchterm) .exec(function(err, users) { if(!err){ res.send(200, users); } else{ res.send(200, err); } }); and in angular i've built query elasticsearch works correctly long parameters filled in. guess question how conditionally , dynamically build filtered query based on parameters have been filled in user. i.e. user fills out country , company leaves out salary. therefore, salary wouldn't included term filter. client.search(

php - Invalid factory registered Zend Framework 2 tutorial and everything seems to be in place -

here's module/blog/config/module.config.php <?php return array( 'service_manager' => array( 'invokables' => array( 'blog\service\postserviceinterface' => 'blog\service\postservice' ) ), 'controllers' => array( 'factories' => array( 'blog\controller\list' => 'blog\controller\listcontrollerfactory' ) ), 'router' => array( // open configuration possible routes 'routes' => array( // define new route called "post" 'post' => array( // define routes type "zend\mvc\router\http\literal", string 'type' => 'literal', // configure route 'options' => array( // listen "/blog"

regex - MySQL find and replace XXX if it's between YYY and ZZZ -

i'm working on wordpress-based project , need batch edit posts database. at moment have cells, content text <pre> text\r\ntext\r\ntext </pre> what need find \r\n strings , replace them \r\n\r\n . far have this: update `table_name` set `field_name` = replace(field_name, '\r\n', '\r\n\r\n\') the issue is, there \r\n\ text outside <pre> tags, don't want affect. that's why need find (start: '<pre>' end: '</pre>') before calling replace. have no idea how in mysql. when web searching, found stuff regex have no idea how works. mysql doesn't have regexp replace functionality. i'd have 2 options - either create user defined function kind of replacement, or, if can't / don't know how to, have use script/program written in different language. may e.g. php script connect db , desired replacement. way dump table containing posts file, use sed or similar , import data once again. us

scala - How to manage HTTP requests in Akka? -

i'm using spray in application , examples i've see on github looks people handle http requests in akka passing httpcontext object around actors , calling oncomplete { } on future in last actor. is sending context deep down in application idea ? way every event object have context parameter. how handle http requests & response in akka? i've read this article know people's thoughts run akka in production on right way of achieving this. i prefer use ask pattern in spray service, , onsuccess directive, e.g.: trait myservice extends httpservice { def worker: actorref implicit def timeout:timeout implicit def ec:executioncontext def askworker: future[string] = (worker ? "hello").mapto[string] def myroute = path("/") { { onsuccess(askworker){ case str => complete(str) } } } } then concrete actor such as: class serviceactor extends myservice actor { implicit val ec = context.syst

javascript - NW.js: Failed to parse SessionDescription. Failed to parse audio codecs correctly -

we building video chat peerjs (webrtc). have nodewebkit version , chrome version. reason, if chrome start mediastream nodewebkit, follow errors in nw. peerjs: creating rtcpeerconnection. peer.min.js:1 peerjs: listening ice candidates. peer.min.js:1 peerjs: listening `negotiationneeded` peer.min.js:1 peerjs: listening data channel peer.min.js:1 peerjs: listening remote stream peerjs: setting remote description rtcsessiondescription {sdp: "v=0↵o=- 2956768960815374026 2 in ip4 127.0.0.1↵s…5525 label:87a9904d-945d-4393-ad98-68be98482104↵", type: "offer"} peer.min.js:1 peerjs: error error: failed parse sessiondescription. failed parse audio codecs correctly. callingmanager.js:293 webrtc:failed parse sessiondescription. failed parse audio codecs correctly. peer.min.js:1 peerjs: failed setremotedescription, failed parse sessiondescription. failed parse audio codecs correctly. 8peer.min.js:1 uncaught syntaxerror: failed execute 'addicecandidate' on

javascript - Can't add jQuery handler to HTML site -

i have single page site: <!doctype html> <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" /> <link type="text/css" rel="stylesheet" href="stylesheet.css" /> <script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script> </head> <body> <h1>hello world</h1> <p>i'm hosted github pages.</p> <div id="map"></div> <form> <input id="but" type="button" value="about me" /> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src=script.js></script> </body> </html> and add handler button #but , , try use script in script.js : var mapclicked = function() { alert("map!"

javascript - how can I get something in Object with a Array? -

i want change value in object,but object nest,like obj = { 'a': { 'b': { 'c': { 'name': 'bob' } } } } and there array: ['a','b','c'] want name array how can change array obj['a']['b']['c']['name'] ? must consider nested object different layers? how can this? or in pure javascript : ['a','b','c', 'name' ].reduce(function( t , v ){ return t[v];} , obj) el = document.getelementbyid('dbg'); var json = function(val){ return json.stringify(val) }; var log = function(val){el.innerhtml += '<div><pre>' + val + '</pre><div>'} /****************************************************************/ var obj = { 'a': { 'b': { 'c': { 'name': 'bob' } } } } var keypath = ['a

haskell - Stack build tool: compatibility issue with LTS resolver -

being advertised breakthrough in haskell tooling, tried switching cabal stack. however, still have problem getting projects run stack run cabal. believe issue there global constraints set resolver (e.g. long term support packages stackage) don't comply local package dependencies. for concrete example, used snap framework ( http://snapframework.com/ ) in version 0.14.0.6. after creating full snap project snap init , tried instantiate stack build plan cabal file stack init . however, there no build plan found stack satisfies constraints. on other hand, cabal install builds project. is there mistake in understanding of stack? how can 1 resolve issue? the complete error log show below, project's name snapfull: checking against build plan lts-3.7 * build plan did not match requirements: base version 4.8.1.0 found - snapfull requires >=4 && <4.4 lens version 4.12.3 found - snapfull requires >=3.7.6 && <3.8 snap-loader-dy

add webview links to favorites -

i developing news app shows on 50 news sites in webview , users can open links , read news. want save news headlines or links , show them in favourite page. , in favourite page can clicked , deleted after reading it. i worked on thought long press on page write link file , read file , make list of favorites. tested text view , writing file seems ok reading not. codes are: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view myinflater= inflater.inflate(r.layout.fragment_main, container, false); textview txtview = (textview) myinflater.findviewbyid(r.id.txtview); txtview.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { // todo auto-generated method stub toast.maketext(getactivity(), "you have pressed long :)", toast.length_long).show();

android - Why are permissions being automatically added to my AndroidManifest when including Google Play Services library -

i noticed following permissions automatically added when use following in build.gradle file compile 'com.google.android.gms:play-services:7.5.0' this did not occur earlier versions of play-services. have solution remove these unwanted permissions? i using ads function (internet , accessnetwork_state). got no need location , use_credentials permissions. how remove these unwanted permissions? i noticed 'manifest-merger-xxx-debug-report.txt' file contains following ...<snipped bunch of other merges> merged com.google.android.gms:play-services-maps:7.5.0:22:5 android:name added com.google.android.gms:play-services-maps:7.5.0:22:22 uses-permission#android.permission.access_coarse_location added com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 android:name

ios - Chaining background NSURLSession uploads -

has been successful in chaining nsurlsession background uploads? i trying upload huge video file in 5 mb parts using background upload of nsurlsession. uploads has in order. whole thing works fine in foreground. using afnetwoking this, , multi part upload. when app in background, first item uploads fine , starts second 1 in background (in setdidfinisheventsforbackgroundurlsessionblock of afurlsessionmanager). stops abruptly (my best guess in 30 seconds, app woken in background has max lifetime of 30 sec) , nothing happens. expected second session finish in background , call third etc - chain behaviour, not seem work. i have tried adding file parts single nsurlsession in 1 go httpmaximumconnectionsperhost = 1 - works fine , uploads full file in parts. file parts picked in random order, i.e. part 1 gets uploaded, part 5, part 3, part 10 etc …. tried adding in nsoperationqueue dependency between operations , seems mess entire thing - upload not work @ all. i know video file can

Elasticsearch term query does not give any results -

i new elasticsearch , have perform following query: get book-lists/book-list/_search { "query":{ "filtered":{ "filter":{ "bool":{ "must":[ { "term":{ "title":"sociology" } }, { "term":{ "idowner":"17xxxxxxxxxxxx45" } } ] } } } } } according elasticsearch api, equivalent pseudo-sql: select document book-lists title = "sociology" , idowner = 17xxxxxxxxxxxx45 the problem document looks this: { "_index":"book-lists", "_type":"book-list", "_id":"avbrsvhixb7carzwceps",

java - neo4j upgrade 1.9.x -> 2.x failing -

i'm trying run upgrade neo4j 1.9.8 2.3.0 i'm using neo4j in embedded java mode, additional webadmin configured via org.neo4j.server.configuration.serverconfigurator . i have allow_store_upgrade=true and following appears in messages.log 2015-10-22 09:45:19.263+0000 info [o.n.k.i.s.storemigrator] starting upgrade of database store files 2015-10-22 09:45:19.609+0000 info [o.n.u.i.b.parallelbatchimporter] import starting 2015-10-22 09:45:19.662+0000 warn [o.n.k.i.s.metadatastore] missing counts store, rebuilding it. 2015-10-22 09:45:19.870+0000 info [o.n.k.a.i.i.lucenelabelscanstore] no lucene scan store index found, might first use. preparing rebuild. 2015-10-22 09:45:20.011+0000 info [o.n.k.a.i.i.lucenelabelscanstore] rebuilding lucene scan store, may take while 2015-10-22 09:45:20.013+0000 info [o.n.k.a.i.i.lucenelabelscanstore] lucene scan store rebuilt (roughly -1 nodes) 2015-10-22 09:47:40.676+0000 info [o.n.k.i.s.storemigrator] store upgrade 10% comple

Material Angular md-autocomplete clear and blur after selection (multi select) -

i trying use md-autocomplete in angular material multi selector. idea is, selected element autocomplete added object array after selection , selection removed md-autocomplete. able clear md-autocomplete, focus stays on md-autocomplete input , autocomplete suggestions still visible. example: http://cdpn.io/qjqgvq code: function selecteditemchange(item) { $log.info('item changed ' + json.stringify(item)); if(item) { //check if item selected if($filter('filter')(vm.contactsselected, function (d) {return d.id === item.id;})[0]) { $log.info('item selected. not add again.'); } else { //add id object vm.contactsselected.push(item); } // clear search field vm.searchtext = ''; vm.selecteditem = undefined; //somehow blur autocomplete focus //$mdautocompletectrl.blur(); } } ps: aware use contact chips of angular material instead, still wondering how blur achieved.

javascript - js append div to only current parents child -

i have div block repeated on page each product. using js cycle through instances of div class , move div div in same block. wrote this: $(value).appendto('.product-image') and adds each div product-image divs on page. how can add each div product-image div child of $(values) parent? this did not work me: $(value).appendto($(value).parent().find('.product-image')) try select first parent div. $(value).appendto($(value).parent('div:first()').find('.product-image'))

elasticsearch - ELK Stack using Docker on EC2 Container Service -

i contemplating setting elk (elasticsearch, logstash , kibana) stack on aws using docker images. unsure performance , persistent storage. if deploy docker images ec2 container service configuration, guess need point place persistent storage both logstash , elasticsearch. s3 storage fast enough, or matter when talking logs. pretty sure can live minutes delay on indexing, using kibana, data reasonably fast. is viable solution production setup couple of gigs worth of logs daily. expect log volume rise once see value of , start logging more more insight. so: is fast enough use s3 storage of log files? is viable solution production site produces 5+ gigs of data day? you might take @ aws elasticsearch service . it's elastic search , kibana service on aws don't have manually manage. i've started using application-level events (desktop app) users voluntarily reporting, , it's been useful.

java - What is the best way to initialise a dynamic JTable with custom renderers? -

currently initialise jtable in jpanel so: private arraydata data; private jtable table; private customtablemodel model; public extendedjpanel() { data = arraydata.getdata(); model = new customtablemodel(data); table = new jtable(model); tablecolumn col = table.getcolumnmodel().getcolumn(0); col.setcellrenderer(new column0renderer()); col = table.getcolumnmodel().getcolumn(1); col.setcellrenderer(new column1renderer()); // other stuff } when want modify values in jtable i interact tablemodel directly creating new object[][] array , calling firetablecellupdated(row, column) cells. my problem that, @ point in program, jtable loses custom renderers. i've been told because updating tablecolumnmodel . what's best way initialise jtable such cellrenderers stay constant throughout life of jtable ? when want modify values in table, interact tablemodel directly creating new object[][] array , calling firetablecellupd