Posts

Showing posts from February, 2010

create and initialize dictionary in typescript in same line -

i want create dictionary using typescript , initialize in same line instead of first creating , populating value below var persons: { [id: string] : iperson; } = {}; persons["p1"] = { firstname: "f1", lastname: "l1" }; how combine above one? just create object. objects in ecmascripts associative arrays. here example object: const persons: { [id: string] : iperson; } = { p1: { firstname: "f1", lastname: "l1" } }; it's better use const or let instead of var . wiki

ios - SKShapeNode motionless when made the scene.frame a physicsBody -

it's first post in coding forum - means i'm reeaaaaallly stuck (i've searched everywhere , tested many options). creating simple bouncing ball on ipad screen, coding app using spritekit. the below code prevent ball move @ when remove skphysicsbody created out frame.edge : ball falls. i've got feeling self.physicsbody made volume despite ask made edge... can please ? override func didmove(to view: skview) { self.physicsworld.gravity = cgvector(dx: 0,dy: -6) self.physicsbody = skphysicsbody(edgeloopfrom: self.frame) // ball's cage self.physicsbody?.friction = 0; let fbound = skshapenode(rect: self.frame) fbound.linewidth = 1 fbound.strokecolor = .red addchild(fbound) let path = cgmutablepath() path.addarc(center: cgpoint(x: view.bounds.width / 2, y: view.bounds.height / 2), radius: 15, startangle: 0, endangle: cgfloat.pi * 2, clockwise: true) let ba

c# - Outputing log file to WPF listbox -

i want display log file listbox on wpf application . have modified this sample application that. have question regarding displaying of contents of file. void displayfilesystemwatcherinfo(system.io.watcherchangetypes watcherchangetypes, string name, string oldname = null) { dispatcher.begininvoke(new action(() => { addlistline(string.format("{0} -> {1} - {2}", watcherchangetypes.tostring(), name, datetime.now)); })); } it prints when file has changed. rather have contents of log file displayed on screen. how do that? what have right way monitor changes in file , add these changes listbox. if want read file , add content listbox, this question has been asked before . here's code sample it: listboxobject.datasource = file.readalllines("pathtoyourfilehere"); wiki

Restricting access to data by user in Spring with Spring Expression Language -

i have task management application, tasks defined so: @entity @data public class taskrecord { @id @generatedvalue(strategy = generationtype.auto) private long id; @column(length = 999) private string name; @manytomany(cascade = cascadetype.all, fetch = fetchtype.eager) private set<user> users; } i want wire things such user can retrieves tasks s/he in set of users for. a user object has unique id , i've configured principal object have correct user member (following successful authentication). is using @postauthorize spring expression language way go doing this? have , works skeptical quality or worthwhileness. @repository public interface taskrepository extends crudrepository<taskrecord, long> { @override @postauthorize("!returnobject.users.?[id == principal.user.id].empty") taskrecord findone(long id); } also use of empty @ end right way go this? feels bit hackish. finally, there way @preautho

c++ - How a class that does not initialize its all members in its constructor to be initialized in C++11 -

the code class c{ public: int m1; int m2; c(int m); } c::c(int m):m1(m){}; int main(){ c* c = new c(1); cout << c->m2 << endl; } i want know value m2 initilized. think c value initialized, , m2 default initialized. i test c++11 , g++4.8.4, , m2 seems 0. think 0 default initializing, default initializing not 0. initializing 0 can guaranteed? c copy initialized , , not value initialized. m2 in fact default initialized, yes, not mean value 0 (that guaranteed value , aggregate initialization). int(); // value initialized - 0 int{}; // value initialized - 0 int a; // default initialized - indeterminate value struct x {}; x x{}; // aggregate initialized wiki

c# - add multiple cookie schemes in aspnet core 2 -

how add multiple cookie schemes in aspnet core 2.0 ? i've followed instructions here auth 2.0 migration announcement , here migrating authentication , identity asp.net core 2.0 unable add multiple schemes. for example : services.addauthentication("myscheme1").addcookie(o =>{ o.expiretimespan = timespan.fromhours(1); o.loginpath = new pathstring("/foruser"); o.cookie.name = "token1"; o.slidingexpiration = true; }); services.addauthentication("myscheme2").addcookie(o =>{ o.expiretimespan = timespan.fromhours(1); o.loginpath = new pathstring("/foradmin"); o.cookie.name = "token2"; o.slidingexpiration = true; }); adding multiple schemes in aspnet core 2.0 simple. i've solved doing this. services.addauthentication() .addcookie("myscheme1", o => // scheme1 { o.expiretimespan = timespan.fromhours(1);

ruby on rails - Logstash with Jruby - how does it works? -

i'm bit confused jruby/ruby versions in logstash. according this github page, current jruby version 9.1.9.0 . when build new gem following steps here see gemfile created "1.9" ( gemfile.jruby-1.9.lock ) old ruby (or jruby?) version. isn't supposed created 2.x ? i've started looking because want use google-cloud-pubsub works ruby 2.0+ wiki

python - How to get the index of a list items in another list? -

consider have these lists: l = [5,6,7,8,9,10,5,15,20] m = [10,5] i want index of m in l . used list comprehension that: [(i,i+1) i,j in enumerate(l) if m[0] == l[i] , m[1] == l[i+1]] output : [(5,6)] but if have more numbers in m , feel not right way. there easy approach in python or numpy? another example: l = [5,6,7,8,9,10,5,15,20,50,16,18] m = [10,5,15,20] the output should be: [(5,6,7,8)] you looking starting indices of list in list. approach #1 : 1 approach solve create sliding windows of elements in list in searching, giving 2d array , use numpy broadcasting perform broadcasted comparison against search list against each row of 2d sliding window version obtained earlier. thus, 1 method - # strided_app https://stackoverflow.com/a/40085052/ def strided_app(a, l, s ): # window len = l, stride len/stepsize = s nrows = ((a.size-l)//s)+1 n = a.strides[0] return np.lib.stride_tricks.as_strided(a, shape=(nrows,l), strides=(s*n,n)) def

java - How to find particular code in AVS Sample App Library -

Image
i trying find piece of java code in avs sample app library ( https://github.com/alexa/alexa-avs-sample-app ), want change little bit. what happens when run alexa java client is, windows pops , can control alexa it. i want connect hw button rpi , change code when press hw button, same action performed if pressed "tap speak alexa" button. any ideas how achieve this? not skilled in java if knew look, learn proper stuff. wiki

c# - Dynamic menu through use of repeater -

i using repeater create menu (bootstrap styled). need make first item active , can't figure out how. have: <!-- nav tabs --> <ul id="teamtab" class="nav nav-pills pill-marg" role="tablist"> <asp:repeater runat="server" id="rptmenu"> <itemtemplate> <li role="presentation"> <a class="circular" href='#<%# databinder.eval(container.dataitem, "groupabbrev") %>' aria-controls="home" role="tab" data-toggle="tab"><%# string.format("{0}", eval("groupname").tostring().toupper()) %></a> </li> </itemtemplate> </asp:repeater> </ul> to make first menu item active, style has "active", like: <li role="presentation" class="active"><a class="circul

android - open alertDialog in kotlin, how to set both message with radio buttons -

trying open alertdialog in kotlin, dialog needs show title , text message , radio button list. made dialog part work, cannot set message (body), if set message radio button not shown(???). i guess might limitation of alertdialog, or knows work around? fun openalertdialog(title: string, alertmessage: string, items: arraylist<string>) { val poistion = 0 val alertdilogbuilder = alertdialog.builder(activity, r.style.mydialogetheme) alertdilogbuilder.settitle(title) //alertdilogbuilder.setmessage(alertmessage) //<== if setmessage radio button not show .setsinglechoiceitems(list, poistion, object : dialoginterface.onclicklistener { override fun onclick(dialog: dialoginterface, index: int) { onselectedcategory(items[index]) toast.maketext(activity.applicationcontext, items[index], toast.length_short).show()

java - Customize the way TreeSet prints Map.Entry values -

i have treeset containing map.entry<string, double> values , when try use iterator iterate on structure , print key-value pairs, standard output looks like: tolkien=40.25 jkrowling=35.5 obowden=14.0 however use custom format output , replace = sign -> like: tolkien -> 40.25, jkrowling -> 35.5, obowden -> 14.0 this code now: iterator iterator;. iterator = lib.getsortedbooks().iterator(); while (iterator.hasnext()) { system.out.printf(iterator.next() + " "); } which best way properly format output ? printing methods in system.out use tostring() internally, when call tostring() same thing see in output. replace equals sign arrow. system.out.printf(iterator.next().tostring().replace("=", " -> ") + " "); a more elegant approach (actually right way since map.entry makes no promise tostring() format): map.entry<k, v> entry = iterator.next(); system.out.printf(entry.getkey() + &quo

exchangewebservices - Exchange EWS GetSearchAbleMailboxes Paged Results? -

i've been doing research try figure out if there way retrieved paged results (or other method). far results negative. at present seems if call getsearchablemailboxes on server 10k mailboxes, entire list of 10k @ once. is aware of alternative way mailboxes paged result? wiki

java - stream from microphone, add effect and save to wav file using tarsos android library -

notes: i'm using android studio , i'm using latest tarsos audio library supposed compatible android, , in fact have added library android studio project. tried using jtransforms , minim libraries no luck. edited 8/23/17: found , fixed bugs, reposted current code, still made no progress actual problem summarized below: summary: in 5th code block have posted, on line 15 commented out, need know how line work , not throw compile error what i'm trying record microphone, , while recording use dsp bandpass filter tarsos library , output results .wav file. can stream microphone .wav file following this tutorial using android.media imports, doesn't allow me add bandpass filter, , using tarsos imports functions don't allow me use save .wav methods that tutorial has , know i'm missing and/or doing wrong, i've been googling week , haven't found working solution, i've found links java files inside library isn't helpful couldn't find tutorials o

c# - How to set Data Source In Crystal Report from View Model in MVVM pattern WPF Application -

below code setting document in view model reportdocument report = new reportdocument(); report.load("reports/test.rpt"); var data_ = db.det_qualificationmaster.where(x => x.mua_id == 6) .select(x => new { x.collagename, x.startyear, x.endyear }).tolist(); report.setdatasource(data_); code in page <viewer:crystalreportsviewer horizontalalignment="left" name="crystalreportsviewer1" verticalalignment="top" height="400" width="400" > how can bind data view model page i found solution myself thought share all.big thank andre-alves lima blog here's link http://www.andrealveslima.com.br/blog/index.php/2016/07/20/utilizando-o-crystal-reports-com-mvvm-no-wpf/ it's in portuguese translate i'm putting code below add static class reportsourcebehaviour.cs public stat

MYSQL importing is slow on all sql files -

i have 2 databases 1 around 127mb , other 2.5gb. tried import sql files using mysql.exe -u root {dbname} < {sqlpath.sql} but takes time 127mb database took around 2 hours , 2.5 gb database around 2 days. tried again adding set autocommit=0; set unique_checks=0; set foreign_key_checks=0; to beginning of import file , commit; set unique_checks=1; set foreign_key_checks=1; to end of import file there no change. tables innodb , using mysql 5.7.14 . idea ? wiki

c - How to use for loop to use a partion of a table? -

i have code , want partion table inp[2560] 4 parts , each part want calculate this: mi = calcul__min(inp,640); ma = calcul__max(inp,640); moy = calcul__moy(inp,640); ectt = calcul__ect(inp,640); i don't know how use for-loop this. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define order 65 #define np 2560 float inp[2560]; float ed1, ed2, ed3, ed4, ap4; float d1, d2, d3, d4, a4, total; int i; double calcul__max(float tab[], int n) { double max; int i; (i = 0; < n; i++) { if(tab[i]>max) max=tab[i]; } return max; } double calcul__min(float tab[], int n) { double min; int i; (i = 0; < n; i++) { if(tab[i]<min) min=tab[i]; } return min; } double calcul__moy(float tab[],int n) { double moyenne,somme; int i; (i = 0; < n; i++) { somme = somme + tab[i]; moyenne = somme /640; } return

apache spark - Jboss drools: Memory leak when using accumulate collectList function -

i using jboss drools execute rules on spark big data platform. using accumulate function in "when" (lhs) collect objects matching condition. works cases list size small. however, 1 of cases, have 25000 matches condition. collectlist should have 25000 items. not work. when checked logs, see full gc being done , job gets stuck there. please can me out here. alternatives working good. i tried increasing executor memory no luck. example of rule: rule "get people name alfredo , age 55" salience 1 when accumulate($p: person(name == "alfredo", age == 55); $personlist: collectlist( $p ), $cnt: count($p); $cnt>0) create_person_result(kcontext, min($personlist, "name")) end thanks, pranoti wiki

json - Get data from firebase realtime database in android -

Image
i trying data firebase realtime database in android. have created json data file , imported json file in firebase database. data file looks : { "data": [ { "name" : "one", "age" : "ten" },{ "name" : "two", "age" : "twenty" } ] } i have created pojo class. how can json objects array? i've searched while can't understand reference & child here. i recommend changing firebase structure following: replace [] {} firebase recommends using practice add specific unique id every user(or item) have in data node. take example: as can see in picture every user has specific id. firebase provides every user unique id can string userid= user.getuid(); . you can create unique ids aswell , them using string key = database.child("users").push().getkey(); (not advised used user ids) if wish read dat

laravel 5 - How to get paymentMethodNonce in Braintree API? -

i'm working in laravel 5.4 transactions successfull when try 'fake_nonce' type of string provided braintree docs. when tried paymentmethodnonce gives me error nonce not found. , http error!!! if try configure myself! take @ controller function below public function addorder(request $request){ $customer = braintree_customer::create([ 'firstname' => $request->guest_name, 'email' => $request->guest_email, 'phone' => $request->guest_phone ]); $customer->success; $customer->customer->id; $find = braintree_customer::find($customer->customer->id); $noncefromtheclient = braintree_paymentmethodnonce::find($find); $result = braintree_transaction::sale([ 'amount' => $request->subtotal, 'paymentmethodnonce' => $noncefromtheclient, 'options' => [ 'submitforsettlement' => true ] ]); if ($result->success) { $settledtrans

dictionary - map.end() error "iterator not dereferenceable" c++ -

this question has answer here: iterators can't access problems properly 3 answers //works cout << "map[0] value " << doublestatsmap.begin()->first<< endl; //gives error cout << "map[last value " << doublestatsmap.end()->first << endl; im trying value of last element of map. works correctly "map.begin->first" giving "map/set iterator not dereferencable" "map.end()->first". cant empty map has beginning has end. i've read says should work. suggestions appreciated! trying end iterator causes undefined behavior. to last item, can use std::map::rbegin() . // cout << "map[last value " << doublestatsmap.end()->first << endl; cout << "map[last value " << doublestatsmap.rbegin()->first <<

C# solution with 2 Projects (Email Manager and Console Application). Console sends email but does not work when executing its EXE from the debug -

i have c# solution several projects. 1 project email manager used send email, , console project references first. when executing console project able make calls , send emails. upon executing bare exe emails executes code no emails sent. please help!!!!!!! wiki

c# - How do I make an asynchronous HTTP request with RxNET? -

currently i'm using await inside observable.create(). executerequestasync wrapper class call httpclient.getasync method (string) public iobservable<ilist<exampleresponsemodel>> listexamplesrx() { return observable.create<ilist<exampleresponsemodel>>( o => { try { var url = string.format(routes.examples.list); ilist<exampleresponsemodel> exampleresponse = await executerequestasync<ilist<exampleresponsemodel>>(url, httpmethod.get); o.onnext(exampleresponse); o.oncompleted(); } catch (exception e) { o.onerror(e); } return disposable.empty; } ); } is best practice? there more appropriate rx solution? task<t>.toobservable() you're looking for:

entity framework - How to extract outerhtml of div tag having class named story-body__inner using HTML Agility Pack and EF -

i extract whole outer html string using html agility pack. tried way unsuccessful. part of htmldocument <div class="story-body__inner" property="articlebody"> <figure class="media-landscape has-caption full-width lead"> <span class="image-and-copyright-container"> <img class="js-image-replace" alt="vice admiral joseph aucoin, u.s. 7th fleet commander, attends media briefing on status of u.s. navy destroyer uss fitzgerald, damaged colliding philippine-flagged merchant vessel, , 7 missing fitzgerald crew members, @ u.s. naval base in yokosuka, south of tokyo, japan 18 june 2017." src="https://ichef.bbci.co.uk/news/660/cpsprodpb/7af6/production/_97487413_308af0da-df48-40e4-80ca-3c4c35a8be7c.jpg" width="976" height="650" data-highest-encountered-width="660"> <span class="off-screen">image copyright</s

javascript - Unnecessary white space on the right side of bootstrap webpage -

in bootstrap webpage margin right side showing. new bootstrap, have tried don't know why space coming? in console showing html tag has width, have tried, html, body { margin: 0; padding: 0; width: 100 %; } wiki

objective c - Center the subview in UIView using constraints in IOS -

Image
i have 3 subview subview1,subview2,subview3 in uiviewcontroller inside uiview . i'm using constraints on them, constraints i'm using show in center when button clicked these, horizantally in container, vertically in container, width and height. issue : when run app , click button once comes in right position. when dismiss , try again open it, subview change position , comes on top left of uiviewcontroller , as can see in screen shot, want show view every time when click button in center of uiviewcontroller . i'm confused constraints right why changes position when open again. my code , - (ibaction)precord:(id)sender { _dateview.hidden=no; [self.dateview bounceintoview:self.view direction:dcanimationdirectionleft]; } the contents in story board , enter image description here it depends on way dismissing view. tried below code , worked me - (ibaction)btn_tapped:(id)sender { _smallview.hidden = false; [_sma

django - all-auth SMTPAuthentication Error -

i'm getting smtpauthenticationerror @ /rest-auth/password/reset/ error. i'm using all-auth-rest , set these on settings.py email_use_tls = true email_host = 'smtp.gmail.com' email_host_user = 'randomemail@gmail.com' email_port = 25 # or 587 email_host_password = 'mypassword' also enabled displaying unlock captcha , allowed less secure app access what missing? thanks this configurations if work smtp.gmail.com , other smtp similiar configurations. unlock captha: https://accounts.google.com/displayunlockcaptcha change active: https://www.google.com/settings/security/lesssecureapps email_host = 'smtp.gmail.com' email_port = 587 email_host_user = 'your_gmail@gmail.com' email_host_password = 'your_password' email_use_tls = true default_from_email = email_host_user email_backend = 'django.core.mail.backends.smtp.emailbackend' i think missed: email_backend wiki

Division using recursion in python -

i pretty sure must glaringly stupid mistake me. can explain wrong in division code using recursion. know there lot of alternatives need know wrong this def division(a,b): x = 0 if < b: return x else: x += 1 return division(a-b,b) return x when division(10,2), gives me 0 output this might work little better you: def division(a,b,x=0): if < b: return x else: x += 1 return division(a-b,b,x) return x every time function ran through new recusion, setting x 0. way, defaults 0 if x not specified, , should work think want. also note not work negative numbers, knew :) wiki

ios - Sending events over RCTEventEmitter from native side to React Native while app is in background -

on ios, when detecting ibeacon in background mode, need send beacon data react-native side in order perform api requests. currently app awakes when entering beacon range, event transmitted on bridge using sendeventwithname:body: method of rcteventemitter not received react-native. is there way activate rcteventemitter on react-native side while being in background? (without rendering components) wiki

rust - Why is pointer arithmetic the cause of a segfault? -

why pointer arithmetic (without reading or writing data behind these pointers) cause of segfault? #![allow(dead_code,unused_variables)] use std::cell::cell; struct bar<t: ?sized> { a: cell<usize>, value: t, } unsafe fn foo<t: ?sized>(v: &t) { let fake: &bar<t> = std::mem::zeroed(); // segfault on line // not reading or writing uninitialized data behind reference, // doing pointer arithmetic. not reading or writing // uninitialized vtable, copy vtable pointer. let fake_val = &fake.value; } fn main() { use std::any::any; let some_ref: &any = &42 &any; unsafe { foo(some_ref) }; } ( on playground ) output: segmentation fault in rust, merely creating dangling reference undefined behavior ! allows compiler perform aggressive optimizations around references, wouldn't possible otherwise. in particular case, compiler generates code calculates offset field using align val

google maps - iOS - GoogleMaps SDK: Using WKWebView for a custom info window does not load contents -

setup ios 10.0 xcode 8.3.3 swift 3.1 googlemaps sdk 2.2.0 problem when trying replace contents of marker's info window per documentation on markerinfocontents wkwebview , infowindow remains blank. happens if using markerinfowindow . background this seems happen when trying refresh other contents ( ref ), since infowindow rendered static image (even if comes uiview ) mentioned in google docs. other people have replaced view completely, using smcalloutview lib (ie: along lines of getting screen location of infowindow , adding subview) ref. 1 ref. 2 ref. 3 question is there way use wkwebview? managed make load contents configuring marker marker.tracksinfowindowchanges = true , when tapping marker infowindow, cpu gets stuck in excessive use, if webview reload continuously or couldn't figure out yet. example code func mapview(_ mapview: gmsmapview, markerinfocontents marker: gmsmarker) -> uiview? { //fixme: can not use webview if let

VirtualBox Ubuntu 16.04 (and 17.04) guest with bad resolution -

Image
i have installed following iso in virtualbox guest on windows 10 host: ubuntu-16.04.3-desktop-amd64.iso edit: looks same happens 17.04. the host is: microsoft windows [version 10.0.15063] vbox version: after following normal ubuntu install procedure decided install guest additions, via: devices -> insert guest cd... it opened terminal window, installation proceed no-errors , said "press enter close". after restarting guest os, see , it's possible use keyboard mouse clicks broken!: and solution uninstall guest additions via: open terminal ctrl + alt + t go mounted additions disk in /media sudo ./vboxlinuxaddtions.run uninstall does know how fix that? x11 related? note: i've tried installing guest additions via: sudo apt-get install ...-dkms but returned errors in lines of "this module old". note: i've tried going system -> additional drivers , enabling vbox driver, did not affect resolution problem. dis

angularjs - Converting base64 to file and posting using formdata append gives 0 contentlenght for httppostedfilebase -

when try convert base64 image url--> blob--> file --> post controller using formdata.append, works smooth desktop fails work in iphone 6s chrome/firefox or ie, httppostedfilebase contentlength seems "0" javascript: croppedpicupload: function () { function datauritoblob(datauri) { // convert base64/urlencoded data component raw binary data held in string var bytestring; if (datauri.split(',')[0].indexof('base64') >= 0) bytestring = atob(datauri.split(',')[1]); else bytestring = unescape(datauri.split(',')[1]); // separate out mime component var mimestring = datauri.split(',')[0].split(':')[1].split(';')[0]; var content = new array(); (var = 0; < bytestring.length; i++) { content[i] = bytestring.charcodeat(i) } return new blob

c# - Do I need Apple Developer account to use ARKit? -

Image
in order develop arkit apps unity, must have apple developer account, , there no way avoid it? as heard, possible install ios 11 free, without apple developer account can't install app on iphone using xcode-beta, right? for example, can't follow this tutorial, because apple id not part of apple developer program, can see in xcode 9 (which, understand, must use in order develop arkit , unity): you can create account free , since xcode 7 can install , run app on devices connect mac (on xcode 9 can wirelessly) in order distribute app have enroll developer program free. the developer account includes arkit wiki

javascript - How do you dynamically apply style to an element, type and class in jQuery? -

i need apply style: <style> #elementid td[role='gridcell'] { height: 136px !important; } </style> but need calculate height dynamically. how can set style using javascript? thanks! in advance! 1) in css use of calc function. read more calc : https://www.w3schools.com/cssref/func_calc.asp for example : #elementid td[role='gridcell'] { height: calc(100%-20px) !important; } 2) in jquery. for example: $(document).ready(function(){ var dynamic = calculate.... $("#elementid td[role='gridcell']").css("height", dynamic); }) wiki

ios - How do I remove black line between table view cells? -

Image
this question has answer here: is there way remove separator line uitableview? 9 answers i have no idea showing black line while tap on header section in table view. kindly share idea fix issue. try this: tableview.separatorstyle = .none wiki

how to insert records using django models then run a update query -

hi have following model, class members(models.model): auto_id = models.autofield(primary_key=true) created = models.datetimefield(auto_now_add=true) member_name = models.charfield(max_length=25, blank=false, default='') father_name = models.charfield(max_length=25, blank=false, default='') wife_name = models.charfield(max_length=25, blank=false, default='') hid = models.integerfield(blank=true) i using django-rest serializers insert records. in above hid number given each member may change depending upon insertion. eg: 1,2,3...10 hid numbers given 10 members new member child of 3 number 4 , 4 should become 5 until end should update if member 4 deleted 5 should become 4 , 6 should become 5 show happen how can implement concept django models , views? note: know number after insertion should happen can choose person or hid wiki

scala.js - "Yield" doesn't work in binding.scala -

several days ago read binding.scala , found cool therefore decided write own single page app. the problem i'm trying add "li" items "ul" element, seems component want doesn't see updates. the code below: case class movie(title: var[string], raring: var[int], watched: var[boolean]) var movies = vars.empty[movie] @dom def want = { println(movies.bind, "!@#!@#!@#!") <div class="want"> <ul> {for (movie <- movies.value) yield { <li> <div> <span> {movie.title.bind} </span> <button onclick={event: event => { event.preventdefault() movies.value.remove(movies.value.indexof(movie)) println(movies.value) }}></button> </div> </li> }} </ul> </div> when change movies nothing happens. update after comment below updated code: def remove(movie:movie) = {

sass - CSS is loading from SCSS instead of CSS -

i have integrated sass in magento project gulp. whenever fired command gulp watch, working perfected , app.css generated. when access page, while css style loading app.css after css applied .scss files. not able find solution this. fyi - above scenario occurring when disable option enable soucemap. when enable option sourcemap, css applying .scss files. whenever interpreted sass, must have pre-compile make changes, in compilation process scss files copied css files , load css fortunately magento auto task you. have followed guide lines here http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/css-topics/gulp-sass.html wiki

html - Angularjs bootstrap modal pop up not working -

i have about.html shows 6 images in each column. when click on individual profile new pop window should pop (open up) show background info of individual. bootstrap hard codes inside angularjs app. have been trying create angularjs modal pop shown: <div class = "container"> <div class="row"> <div class="col-md-4 col-sm-6 portfolio-item"> <a href="#profile-1" class="portfolio-link" data-toggle="modal"> <div class="portfolio-hover"> <div class="portfolio-hover-content"> <p class="p-hover">my profile...</p> </div> </div> <img src="images/pic1.jpg" class="img-responsive" alt=""> </a> <div class="portfolio-caption">

java - How to make a runnable where the run code is able to access a variable provided in the trigger -

i have class listening websocket , when message received, should execute code depending on message type. throughout application want able register more listeners. i created following messagelistener class: static class messagelistener { private string triggermessage; private runnable runnable; messagelistener(string message, runnable runnable) { this.triggermessage = message; this.runnable = runnable; } private void trigger(string message) { if (message.equals(triggermessage)) { runnable.run(); } } } i add listener this: ws.setlistener(new ipdwebsocket.messagelistener("disconnect", new runnable() { @override public void run() { log.e("xx", "received message: "); } } ) ); when message received trigger listeners this: for (int nr=0; nr < listeners.size(); nr++) { listeners.get(nr).trigger(msg); } now problem in runnable able

javascript - Serializing Coordinates: Object.keys() fails on instances of native interfaces? -

i have javascript running in chrome using geolocation api : navigator.geolocation.watchposition((pos) => { console.log(pos.coords); console.log(object.keys(pos.coords); }, (err) => { alert('geolocation error.\n' + err.message); }, { enablehighaccuracy: true }); when chrome detects change in location, fires off first callback. working well. the problem comes when try data. when callback fired, on console first able see coordinates object called console.log(pos.coords) : coordinates {latitude: 5.520007, longitude: 13.404954, altitude: null, accuracy: 150, altitudeaccuracy: null, …} however, next line call console.log(object.keys(pos.coords)) , empty array: [] likewise, if try use json.stringify(pos.coords) , empty object {} . is there reasonable way loop through keys of pos.coords ? must make own list of keys loop through? object.keys(pos.coords) gets empty array yes, properties of coordinates interface

oracle - Detecting a Deadlock in a Stored Procedure -

i trying write deadlock proof stored procedure. based on following concept. i have been trying write stored procedure based on following concept. procedure try drop constraint on table , if in case detects deadlock situation, wait time before trying again. important thing should retry in case of deadlock or nowait error, other errors handled via exceptions. procedure test begin <<label>> drop constraint on table if (deadlock(ora-00060)/nowait error (ora-0054)) detected sleep 60 seconds goto label exception when others. it great if of experts please me this. similar example highly helpful. thank help. while people harbour irrational aversion goto remains true can implement same logic without using construct. true here: simple while loop necessary: create or replace procedure drop_constraint_for_sure ( p_table_name in varchar2 , p_constraint_name in varchar2 ) x_deadlock exception; pragma exception_init(x_deadlock, -60); x

bash - Does a simple way exist to eliminate the data transfertime when measuring the speed of a storage service? -

i developed simple bash script ( s3perf ) measures required time carry out different object-based storage service operations. tool creates bucket, uploads , downloads set of files , afterwards removes bucket. consumed time per operation measured , printed out on command line. my script uses tools s3cmd , mc , swift client interaction storage services. does simple way exist eliminate data transfertime measurements? idea 1: measure first network speed iperf , calculate required time upload/download files. these values substracted time values when interacting storage services. idea 2: upload , download files (e.g. scp or wget) first steps , measure required time. these values substracted time values when interacting storage services. both ideas not result in exact values because each operation individual , data transfertime (at least little bit) different. wiki

java - How can I pass a variable as a value in an API.. Im using Geocoding API. But i can't get the location -

double lat = 13.630754; double longi = 123.18484; jsonobjectrequest myrequest = new jsonobjectrequest( request.method.post, // here used variables latitude , longitude string.format(" https://maps.googleapis.com/maps/api/geocode/json?latlng=",lat,",",longi,"&key=my key"), new jsonobject(jsonparams), new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { toast.maketext(getapplicationcontext(),response.tostring(),toast.length_short).show(); // t.settext(response.tostring()); string address = null; try { address = response.getjsonarray("results").getjsonobject(0).getstring("formatted_address"); } catch (jsone

html - Submenu with full screen width -

i have top menu submenu listing images , slider. submenu extend background full screen , content goes center align. can't not changes in html structure. have try set submenu it's not showing full screen. here screenshot . here fiddle link below code: header { border-bottom: 1px solid #000; } .menu { margin:0; list-style: none; padding: 0; } .menu li { float: left; } .menu li .submenu{ display: none; } .menu li { color: #000; padding:10px; text-decoration: none; display: block; text-transform: uppercase; font-weight: bold; position: relative; } .menu li a:hover{ color:#999; } .menu > li > a::before { border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 13px solid #fff; bottom: -13px; content: ""; display: none; height: 0; left: 50%; position: absolute; transform: translatex(-50%); width: 0; z-index: 2; } .menu >

c# - WPF CrystalReportsViewer: Change position of sidebar -

Image
i'm trying change position of left side bar in crystalreportsviewer wpf element, don't know how. i'd have sidebar on top or @ bottom... <sap:crystalreportsviewer name="crystalreportsviewer" width="auto" height="auto" horizontalalignment="center" verticalalignment="center" showprevpagebutton="false" showstatusbar="false" showtoolbar="false" sourceupdated="crystalreportsviewer_sourceupdated" targetupdated="crystalreportsviewer_targetupdated" togglesidepanel="none" /> i found solution: have style tab control , tab items... <style targettyp

JDBC connection lost while UNLOADing from Redshift to S3. What should happen? -

reshift newbie here - greetings! trying unload data s3 redshift, using java program running locally issues unload statement on jdbc connection. @ point jdbc connection appears lost on end (exception caught). however, looking @ s3 location, seems unload runs completion. true unloading rather small set of data. question is, in principle, how unload supposed behave in case of lost connection (say, firewall kills or kill -9 on process executes unload)? run completion? stop senses connection lost? have been unable find answer neither rtfm'ing, nor googling... thank you! the unload run until completes, cancelled, or encounters error. loss of issuing connection not interpreted cancel. the statement can cancelled on separate connection using cancel or pg_cancel_backend . http://docs.aws.amazon.com/redshift/latest/dg/r_cancel.html http://docs.aws.amazon.com/redshift/latest/dg/pg_cancel_backend.html wiki

magento - solr not re indexing products -

i getting error when trying rebuild index in solr: workng perfect on local when moved server started happening. org.apache.solr.common.solrexception: error: [doc=1p19] unknown field 'textautocomplete' @ org.apache.solr.update.documentbuilder.todocument(documentbuilder.java:182) @ org.apache.solr.update.addupdatecommand.getlucenedocument(addupdatecommand.java:82) @ org.apache.solr.update.directupdatehandler2.donormalupdate(directupdatehandler2.java:280) @ org.apache.solr.update.directupdatehandler2.adddoc0(directupdatehandler2.java:214) @ org.apache.solr.update.directupdatehandler2.adddoc(directupdatehandler2.java:169) @ org.apache.solr.update.processor.runupdateprocessor.processadd(runupdateprocessorfactory.java:68) @ org.apache.solr.update.processor.updaterequestprocessor.processadd(updaterequestprocessor.java:48) @ org.apache.solr.update.processor.distributedupdateprocessor.dolocaladd(distributedupdateprocessor.java:934) @ org.apac