Posts

Showing posts from April, 2014

c++ - How to make statifier work on 32-bit system? error loading libc.so.6 -

i've jun fresh new 32-bit ubuntu distribution , installed statifier usual(make all, make install). after tried statify compiled(on device) program. after it, i've got error message: /lib/ld-linux.so.2 --library-path /lib /bin/ln -s /lib/libc-2.5.so /lib/libc.so.6 what actions should make statifier work in case? here additional error code: ld_assume_kernel=4.10.0 statifier async_record_test async_record_static /usr/lib/statifier/32//elf_symbols: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory) /usr/lib/statifier/32//elf_data: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory) /usr/lib/statifier/32//elf_data: can't open '/lib/ld-linux-armhf.so.3' file. errno = 2 (no such file or directory)

swift3 - html swift 3 uikit link inside webview -

i have build simple intro page external links. , dont know how write external links, i'm trying on code below not working. secondly how can add more css. thanks! import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var mywebview: uiwebview! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let webview = uiwebview() mywebview.loadhtmlstring("<html><body><center><img src=\"logo.png\"><h1 style=\"font-family: helvetica\">faithway center</h1><h2 style=\"font-family: helvetica\"><a href=\"https://www.myhealthmatters.co.uk\">test</a></h2></body></html>", baseurl: nil) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }

r - What is -c and nrow doing in body of function -

can please explain me what bdf <- by(bdf, bdf$serial_number, function(sn, k) { sn[-c(1:k, (nrow(sn)-k+1):nrow(sn)),] }, k = 10) is doing? by() splits data frame bdf second argument serial_number , applys function function(sn, k) in third argument. don't understand body of function. c() creates vector. - makes numbers in vector negative. vector in "row" position of [ , omitting rows 1 k , , nrow(sn) - k + 1 end of data frame. it's chopping off first k , last k - 1 rows of data frame.

android - Firebase serialization names -

Image
i created object send data firebase. example, use firebase user example: public class user { public string username; public string email; public user() { // default constructor required calls datasnapshot.getvalue(user.class) } public user(string username, string email) { this.username = username; this.email = email; } } i want encode property names sent firebase. keys sent using variable names. want encode keys useraname , email , gson doing. don't want change variable names. @serializatename("username") public string username; @serializatename("username") public string email; i used @serializatename() , not working. same @propertyname used firebse, not working. can use in order serializare custom keys? update 1 public class pojo { @propertyname("guid") public string guid; @propertyname("name") public string name; public string getpojoguid() { retu...

c# - Cross-Origin Requests WebApi -

i reading https://docs.microsoft.com/en-us/aspnet.... security prevent ajax requests domain , makes me wonder, if enable this, able make request android client? cu'z seems outside of domain, can't requested. it? thanks! would like: context.owincontext.response.headers.add("access-control-allow-origin", new[] { "*" }); using (iuserrepository _repository = new userrepository(new data.datacontexts.oauthserverdatacontext())) { var user = _repository.authenticate(context.username, context.password); if (user == null) { context.seterror("invalid_grant", "the user name or password incorrect."); return; } } if making request domain need set access-control-allow-origin header. can use * if aren't concerned security it's best specify domains know need access. non-browser-based clients may not send origin header (e.g...

google spreadsheet - copy cell range and paste below -

i have google sheet names "queue tracker" , in tab named "compiled dispositions". auto select , copy multiple ranges (which contain formulas) , paste "n" number of rows below. n can 100 or 1000 or 3000. the ranges select , copy : b3:k3, m3:v3, x3:ag3, ai3:ar3, at3:bc3, be3:bo3, bq3:bz3, cb3:ch3, ck3:cp3, cs3:cx3, da3:df3 i don't believe it's possible access multiple range selections google apps script. using active selections won't work. treats selected ranges 1 range in null out unwanted columns. not planning on copying areas populated dated. haven't tested can use starting point. give chance know our script editor , debugger. function copyyourrowtorange(row, numrows) { var leaveblank=['0','11','22','33','44','55','67','78','86','87','94','95','102','103']; var ss=spreadsheetapp.getactive(); var sht=s...

Is it possible to use the third party plugins or modules which feature or plugins are not available in Nativescript official plugins? -

is possible use third parties plugins features not avail in nativescript official plugins. like angular-trix angularjs- " http://sachinchoolur.github.io/angular-trix/ " if possible means how should achieve? thank reading, looking forward reading responses! this bit of crosspost https://discourse.nativescript.org/t/can-i-use-non-nativescript-specific-third-party-plugins/2054/2 , here's duped answer well: usually answer yes, in specific case, according github account library angular 1 - not supported nativescript.

haskell - How do `do` and `where` mix? -

from book have following code snippets mutableupdateio :: int -> io (mv.mvector realworld int) mutableupdateio n = mvec <- gm.new (n + 1) go n mvec go 0 v = return v go n v = (mv.write v n 0) >> go (n - 1) v mutableupdatest :: int -> v.vector int mutableupdatest n = runst $ mvec <- gm.new (n + 1) go n mvec go 0 v = v.freeze v go n v = (mv.write v n 0) >> go (n - 1) v like hindent indents them. want introduce braces , semicolons, whitespace isn't relevant more. because curious. the second example suggests, where belongs whole runst $ ... expression, first example suggests, somehow part of go n mvec statement. reading in haskell report chapter 2.7 tried introduce braces , semicolons in first example like mutableupdateio :: int -> io (mv.mvector realworld int) mutableupdateio n = { mvec <- gm.new (n + 1); go n mvec; { go 0 v = return v; go n v = (mv.write v n 0) >> go (n - 1) v; } ;...

polymorphism - TypeScript declaration for polymorphic decorator -

Image
i’m in process of writing ambient declaration react-tracking . exposes track decorator can used on both classes and methods. a simplified example taken docs: import track 'react-tracking' @track({ page: 'foopage' }) export default class foopage extends react.component { @track({ action: 'click' }) handleclick = () => { // ... } } in ambient declaration file expected able following , have typescript choose right overload: declare function track(trackinginfo?: any, options?: any): <t>(component: t) => t declare function track(trackinginfo?: any, options?: any): export default track while works component classes, fails methods following error: [ts] unable resolve signature of method decorator when called expression. looking @ typing ts chooses application of decorator indicates it’s not falling signature should match anything, instead component class one. is possible type polymorphic decorator @ all? and, if so, doin...

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -

Image
struggling find exact wording need use images. i have model called statements , want change way admin page editing or submitting statement looks. particularly field statement has called statement-contexts . right now, doesn't accurately represent field supposed , doesn't accomodate multiple entries. statement-contexts draws many-to-many relationship model called context . context consists of 2 fields pair 2 words: word field , keyword field draws many many relationship model keyword , pool of keywords in database. this drop down menu doesn't accomodate submitting pair of words that's supposed comprise statement-contexts , beyond selecting 2 words (which hope indicate context 's word field , keyword field respectively. it isn't user friendly since people have submit many pairs of contexts , keywords. more 1 drop down menu needed, , way see many different pairs of words need add. so need figure out how change interface. i looking @ creating...

.net - ASP.NET Viewstate bug - updating some controls (incorrectly) and not others -

i have combobox which, when select different options, triggers updatepanel containing gridview refresh new data depend on combobox selected item, via ajax postback. all works fine, except if i: select different entry in combobox 1 selected on page load (which first one). triggers gridview refresh. hit refresh. the refreshed screen loads first entry in combobox selected, , appropriate content first item in gridview. combobox changed entry selected in step 1 above - presumably restored viewstate. gridview not updated - shows data default combobox selection - 2 out of sync. if click in browser url box , hit enter, plain get of url, resets correctly. i tried adding add enableviewstate="false" viewstatemode="disabled" on combobox, still, when refresh, gridview resets, combo returns non-default value. in fact seems make things worse - if load page, select different combobox item, , hit refresh - selecting default combo item calls postback, receives 200 re...

vue.js - Extend vueJs directive v-on:click -

i'm new vuejs . i'm trying create first app. show confirm message on every click on buttons. example: <button class="btn btn-danger" v-on:click="reject(proposal)">reject</button> my question is: can extend v-on:click event show confirm everywhere? make custom directive called v-confirm-click first executes confirm , then, if click on "ok", executes click event. possible? i recommend component instead. directives in vue used direct dom manipulation. in cases think need directive, component better. here example of confirm button component. vue.component("confirm-button",{ props:["onconfirm", "confirmtext"], template:`<button @click="onclick"><slot></slot></button>`, methods:{ onclick(){ if (confirm(this.confirmtext)) this.onconfirm() } } }) which use this: <confirm-button :on-confirm="confirm" confirm-te...

How to set android camera2 preview and capture size? -

i using surfaceview show preview capture. want use width=1080,height=1920 preview. can set size of preview? i googled answer, camera version one. using android.hardware.camera2. private void takepreview() { try { final capturerequest.builder previewrequestbuilder = mcameradevice.createcapturerequest(cameradevice.template_preview); previewrequestbuilder.addtarget(msurfaceholder.getsurface()); mcameradevice.createcapturesession(arrays.aslist(msurfaceholder.getsurface(), mimagereader.getsurface()), new cameracapturesession.statecallback() // ③ { @override public void onconfigured(cameracapturesession cameracapturesession) { if (null == mcameradevice) return; mcameracapturesession = cameracapturesession; try { previewrequestbuilder.set(capturerequest.control_af_mode, capturerequest.control_af_mode_continuous_picture); previewrequestbui...

arraylist - Java Array returns Null -

so when use pick string of random events returns null: public static list<string> picknrandom(list<string> lst, int n) { list<string> copy = new linkedlist<string>(lst); collections.shuffle(copy); return copy.sublist(0, n); } static list<string> randomp; public list<string> items(){ list<string> teamlist = new linkedlist<string>(); teamlist.add("team1"); teamlist.add("team2"); teamlist.add("team3"); teamlist.add("team4"); teamlist.add("team5"); teamlist.add("team6"); list<string> randompicks = picknrandom(teamlist, 3); randompicks = randomp; return randompicks; } public static void store() { random rand = new random(); int people = rand.nextint(50) + 1; list<string> itemsin = randomp; system.out.println("people in store: "+people + "\nitems in store: "+itemsin); } public s...

php - Error: "Illegal characters found in URL" - Code: 3 -

i want info api , code like: <?php $curl = curl_init(); $authorization = "authorization: token token='xxxxxx'"; $header = curl_setopt($curl, curlopt_httpheader, array($authorization)); curl_setopt($curl, curlopt_url, "https://customr.heliumdev.com/api/v1/customers/xxxx"); $result = curl_exec($curl); if(!curl_exec($curl)){ print_r('error: "' . curl_error($curl) . '" - code: ' .curl_errno($curl)."<br>"); } curl_close($curl); print_r(json_decode($result)); ?> and got error error: "illegal characters found in url" - code: 3 the origin curl should curl https://customr.heliumdev.com/api/v1/customers/xxxx --header "authorization: token token="xxx"" , idear illegal characters? i not reproduce problem. however, suggest avoid unnecessary double-execution of curl_exec , use $result instead... ... $result = curl_exec($curl); if (!$result) { ......

python - AssertionError when trying to assert return value from two dictionaries with py.test -

i'm testing text-based game i've been making learn python. last few days have been busy finding solution problem keep encountering. have tried multiple test methods, end giving me same error. the problem following assertionerror (using py.test ): e assertionerror: assert <textgame.waffle.winefields object @ 0x03bdecd0> == <textgame.waffle.winefields object @ 0x03bd00d0> obviously, object ( textgame.waffle.winefields ) correct, location different. don't care location. assume because i'm using 2 separate dictionaries same contents. however, prefer keep using dictionary if possible. the minimal working example of test looks follows: import textgame.waffle def test_change_map(): roomnames = { "the wine fields" : textgame.waffle.winefields(), } room = "the wine fields" next_room = roomnames[room] assert textgame.waffle.map(room).change(room) == next_room the textgame.waffle game i'm ...

java - Immovable alert window -

Image
i'm trying stop users being able move alert pops up. have found 1 option set style undecorated remove border click on move alert, think looks ugly. are there other options? i suggest going stagestyle.undecorated , adding decoration want inside. not having system decoration, in case, benefit . because people used standard controls (close button, moving dragging title, etc) , removing them give clear sign don't want windows movable. small example: stage alert = new stage(stagestyle.undecorated); alert.initmodality(modality.application_modal); vbox root = new vbox(30); root.setstyle("-fx-background-color: antiquewhite"); root.setalignment(pos.center); root.setpadding(new insets(25)); root.setborder(new border(new borderstroke(color.black, borderstrokestyle.solid, cornerradii.empty, borderwidths.default))); button btn = new button("got it!"); btn.setonaction((e)-> {alert.close();}); label label = ...

angular - Angular2 - Focus on input after modal load -

i built component in angular 2, , i'm trying set focus on specific input after modal loaded. here i'v done far: @component({ selector: 'login', templateurl: './login.component.html' }) export class logincomponent { showmodal: boolean = false; @viewchild('username1') el: elementref; constructor(private elementref: elementref, private modalservice: modalservice { this.modalservice.loginmodal.subscribe((show) => { this.showmodal = show; if (show) { $('#modal_login_root').modal(); this.el.nativeelement.focus(); } else { $('#modal_login_root').modal('hide'); } }); } and input is: <input #username1 type="email" class="form-control email active" name="username" placeholder="{{ 'login_emailfield' | translate }}" [(ngmodel)]="username" /> and not working :( ...

android - How to make sign out from firebase -

this code using firebase sign in. after completing verification signing out. when try sign in again same number doesn't send me otp. help me signout it. in advance. code: @override public void onverificationcompleted(phoneauthcredential credential) { // callback invoked in 2 situations: // 1 - instant verification. in cases phone number can instantly //     verified without needing send or enter verification code. // 2 - auto-retrieval. on devices google play services can automatically //     detect incoming verification sms , perform verificaiton without //     user action. // log.d(tag, "onverificationcompleted:" + credential); //mauth.signout(); mauth= firebaseauth.getinstance(); if(mauth!=null) mauth.signout(); toast.maketext(mainactivity.this,"verification complete",toast.length_short).show(); } @override public void oncodesent(string verificationid, phoneauthprovider.forceresendingtoken token) { //...

c# - Entity Framework 1-1 relationship: "The navigation property was not found on the dependent type " -

i'm trying define 1:1 relationship in entity framework 6, code first. i've followed tutorial: http://www.entityframeworktutorial.net/code-first/configure-one-to-one-relationship-in-code-first.aspx in example, 1 customer can have 1 specific address. regarding 1:1 relationships i've read , have no idea what's correct way define type of relationship. so, here classes: public class customer { public int customerid { get; set; } public string customername { get; set; } public address address { get; set; } } public class address { [foreignkey("customer")] public int addressid { get; set; } public string addressname { get; set; } } here initialization: list<address> addresses = new list<address> { new address { addressname = "12 main st., houston tx 77001" }, new address { addressname = "1007 mountain dr., gotham ny 10286" } }; list<customer> customers = new list<customer> { ...

how to provide Custom interpolation technique in OpenGL for filling triangle -

i trying implement custom interpolation technique in glsl shader. i have switched off default opengl bilinear filters using flat interpolation specifier texture coordinates. followed technique specified in below link: how switch off default interpolation in opengl while rasterizing, image gets image based on provoking vertex . is possible me introduce interpolation mechanism decide on colors filled between vertices in triangle ? or hardcoded in opengl ? i newbie in glsl world , hence request provide me non complicated answer. interpolation hard-coded opengl. if want own interpolation, have provide fragment shader: the barycentric coordinates particular fragment. can done passing, 3 vertices of triangle, vec3(1, 0, 0) , vec3(0, 1, 0) , , vec3(0, 0, 1) . all 3 uninterpolated values triangle's data wish interpolate. require 3 flat input variables in fs (or array of 3 inputs, same thing). of course, you'll need match 1, 0, 0 triangle particular uni...

python 3.x - Searching for errors in a number of files -

new python have been seeking develop script allows me search errors in multiple files in 1 large folder. problem, think, @ moment code returns first error comes across in file , not seek find anymore. problematic have no idea how many, if there any, errors file contain. this have written far: # importing libraries import os os import listdir # !/usr/bin/env python # defining location of parent folder base_directory = 'folder' output_file = open('folder', 'w') output = {} file_list = [] # scanning through sub folders (dirpath, dirnames, filenames) in os.walk(base_directory): f in filenames: if '.log' in str(f): e = os.path.join(str(dirpath), str(f)) file_list.append(e) f in file_list: print (f) txtfile = open(f, 'r') output[f] = [] line in enumerate(txtfile): if 'error' in line: output[f].append(line) elif 'warning' in line: output[f].append(line) elif ...

apache - htaaccess with parameters and base URL change -

have 2 rewrite rules racking brain combine. basically, want following re-write rule transform parameter url string like the original url: https://example.com/?language=english the rewritten url: https://example.com/english rewriterule ^([^/]*)$ /?language=$1 [l] i have covered. trying figure out in rule, how can change base url example.com example2.com ? this how change urls 301 redirect.. rewriterule ^(.*)$ https://mywebsite/$1 [r=301] just not sure how combine two? been experimenting while. edit: have modified there no need modify base url longer. can rewrite. so input url: http://example.com/redirect/index.php?language=english , desired output url: http://example.com/english/ i have placed .htaacess inside of /redirect directory this: rewriteengine on rewriterule ^([^/d]+)/?$ index.php?language=$1 [qsa]

php - How can i get query result id in controller from Laravel? -

i want take houses lists , houses pictures on mysql laravel. but, have problem. using process below: $houses = houses::query() ->orderby('sort', 'asc') ->take('6') ->get(); this query, give houses list me. , need use houses retrieve photos, best think of: $pictures = housephotos::query() ->where('house_id', '=', $houses->house_id) ->get(); question one: process correct? question 2 : how can this? add relation houses: class houses extends model { public function photos() { return $this->hasmany(housephotos::class); } } and can photos like: $houses = houses::query() ->orderby('sort', 'asc') ->take('6') ->get(); foreach ($houses->photos $photo) { echo $photo->id; } the problem is, select query run n times (5 times example). if add wi...

asp.net - Build with Roslyn, but leave the "compile-at-runtime" executables at the door? -

Image
there has been lot of talk c# compiler roslyn on stackoverflow , internet in general. lot of people ask what , why roslyn, while others ask how get rid of it . my question pertains latter question. quoted kemal kefeli here , iterated verbatim dozens more (e.g. another example of iteration), in order remove roslyn: when create new web project, 2 nuget packages automatically added project. if remove them, problem should solved. package names are: " microsoft.codedom.providers.dotnetcompilerplatform " , " microsoft.net.compilers ". this approach, however, not work if using c# 6 features roslyn offers. removing these 2 nugget packages, give chance of using these features. my question is, how compiler roslyn, avoid having compiler-at-runtime actions occurring , importantly, csc.exe , vbc.exe , , vbcscompiler.exe being placed in final release version (in roslyn folder). i porting on stackoverflow's opserver piece of software. software allows...

python - The included urlconf module does not appear to have any patterns in it -

i have code urls.py inside blog file, accessed urls.py in mysite folder. from django.conf.urls import url, include blog import views django.views.generic import listview blog.models import post urlpatters = [ url(r'^(?p<year>\d{4})/(?p<month>\d{2})/(?p<day>\d{2})/(?p<post>[-\w]+)/$', views.post_detail, name='post_detail'), url(r'^$', listview.as_view(queryset=post.objects.all().order_by("date"),template_name="blog/base.html")), ] when try access /blog/ file, should lead blog/base.html file, gives following error: the included urlconf module 'blog.urls' '/mysite/blog/urls.py' not appear have patterns in it. if see valid patterns in file issue caused circular import. any highly appreciated! you have typo: urlpatters should urlpatterns .

javascript - CSS animation only triggers upon first creation -

this first project using vuejs. i've got main component. in main component i've got data variable array. example: export default { name: 'example-component', data() { return { options: [ { text: { nl: 'jan', en: 'john', }, action: 'x1', },{ text: { nl: 'jansen', en: 'doe', }, action: 'x2', }, ], } }, } in template <example-component> i'm using v-for loop inside of component. shown below: <my-other-component v-for="option in options" v-on:click.native="select(option.action)" :key="option.id"></my-other-component> this seems work fine. <my-...

apache zookeeper - Storm 1.1.0 Multi Node Cluster -

i using storm v1.1.0, , building storm on different machines, lets have 5 machines, machine1: zookeeper machine2: nimbus machine3: supervisor1 machine4: supervisor2 machine5: ui and configuration of each machine following: machine1 ticktime=2000 initlimit=10 synclimit=5 datadir=/tmp/zookeeper clientport=2181 machine2 storm.local.dir: "/mnt/storm" storm.zookeeper.servers: - "zookeeperip" machines(3-4) storm.local.dir: "/mnt/storm" storm.zookeeper.servers: - "zookeeperip" nimbus.seeds: ["nimbusip"] machine5 storm.local.dir: "/mnt/storm" storm.zookeeper.servers: - "zookeeperip" nimbus.seeds: ["nimbusip"] ui.port: 8080 all running okay no errors, , checked logs, no errors of them running , starting fine! the problem ui showing , gives error in console machine5 storm.local.dir: "/mnt/storm" sto...

On removing variant image from shopify backend, webhook "product/update" is not called -

i facing strange behaviour on calling webhook topic "product/update". have created webhook through api. fine on except problem noticed recently. problem if adding image variant backend webhook topic "product/update" being called successfully. if removing image variant same webhook not being called. can please me in it. have surfed articles did not find answer. thank in advance

r - mean function producing same result -

the mean function acting weird, producing 0.3880952 h10 <- h10 %>% rowwise() %>% mutate(t10dv = mean(c(fd$dv1_c, fd$dv2_c, fd$dv3_c, fd$dv4_c), na.rm = true)) head(h10) dv1_c dv2_c dv3_c dv4_c t10dv <int> <int> <int> <int> <dbl> 1 1 0 0 1 0.3880952 2 -1 0 2 -1 0.3880952 3 0 0 0 0 0.3880952 4 0 2 1 1 0.3880952 5 -1 -1 -1 -2 0.3880952 6 -2 0 0 0 0.3880952 what should simply: h10$t10dv <- rowmeans(h10[c("dv1_c", "dv2_c", "dv3_c", "dv4_c")...

elixir - Could not render "app.html" for X.Web.LayoutView, please define a matching clause for render/2 -

after renaming app livestory citybuilder, can't launch it. mix phx.server returns: could not render "app.html" citybuilder.web.layoutview, please define matching clause render/2 or define template @ "lib/citybuilder/web/templates/layout". no templates compiled module. i've checked, , app.html.eex in file structure, should be. the fault may lay in file structure or cases of words. i recloned app. did case sensitive replace of livestory citybuilder another case sensitive replace of livestory citybuilder i changed lib/livestory/web/templates/layout to lib/citybuilder/web/templates/layout and app ran ok.

interfaceKit.getSensorValue python -

description: i'm trying voltage signal of rh sensor phidget 1018 board using statement interfacekit.getsensorvalue(), idle says "nameerror: name 'interfacekit' not defined". did install phidget22 library manually. thought reason don't have interfacekit module. call "from phidgets.devices.interfacekit import *" @ beginning of code, idle said "modulenotfounderror: no module named 'phidget22.devices.interfacekit'". however, can't find installable library of interfacekit. question is: going wrong direction? or there wrong library? please help. thank much!

php - Upload files via SFTP with phpseclib -

i uploading csv files via sftp using phpseclib class. following: include('vendor/autoload.php'); use phpseclib\crypt\rsa; use phpseclib\net\sftp; $sftp = new sftp($sftpserverhost); $key = new rsa(); $key->setpassword($sftpkeypassword); $key->loadkey(file_get_contents($sftpkey)); if (!$sftp->login($sftpusername, $key)) { throw new exception('login failed'); }else{ $sftp->chdir('upload'); $sftp->put($filename, $output); } $output - content of csv file. if content less ~40 lines file uploading no issues though if content >40 lines script hangs while outputs several lines of error: php notice: uninitialized string offset: 0 in /vendor/phpseclib/phpseclib/phpseclib/net/ssh2.php on line 3167 php notice: connection closed prematurely in /vendor/phpseclib/phpseclib/phpseclib/net/ssh2.php on line 3025 php notice: connection closed server in /vendor/phpseclib/phpseclib/phpseclib/net/ssh2.php on line 3373 php notice: expected ssh_fx...

java - Is there a way to obtain the request information from javax.ws.rs.Client in Jersey? -

i trying make standard in logging projects build on top of jersey, , want provide simple way log request information , response in case exception occurs. following code illustrates idea : client client = null; response response = null; try { client = clientbuilder.newclient(); response = client.target("<url>") .request(mediatype.application_json) .post(entity); } catch( exception ex) { //send information exception mapping json log throw new serviceexception( client,response ); } the problem how can obtain following in serviceexception class: string url = client.geturi().tostring(); //only 1 using webtarget multivaluedmap<string, string> headers = client.getheaders(); string body = client.getentity(); multivaluedmap<string, string> queryparams = client.getqueryparams(); string method = client.getmethod(); i tried accessing webtarget withou...

javascript - visible binding in knockout.JS used with click binding -

Image
i working on mini project in want following feature- when hdfc bank row clicked, related graph(showing company's growth on period of time) gets visible below. i trying work out using 2 knockout.js concepts-- visible binding inside click binding . have tried follows- this.showgraph = ko.observable(false); //initially graph <div> invisible self.drawgraph = function(company) { //console.log(company.name+"=="+self.companyportfolio()[0].name); self.showgraph = ko.computed(function() { return company.name == self.companyportfolio()[0].name; }); // console.log("showgraph="+self.showgraph()); } i got idea of using computed observables a stackoverflow post . here html - <table class="table table-hover"> <thead> <tr> <th>company</th> <th>investment(%)</th> <th>nos</th> <th>...

xcode - Wrong UITableView position after pull to refresh -

Image
in app tableview position: when run pull refresh, position is: why tableview stay down? can show how use uirefreshcontrol in code ? looks miss refreshcontrol.endrefreshing()

javascript - how to trigger an event for an element when some other element is clicked in jQuery? -

here code: https://jsfiddle.net/2vvle0ko/2/ i want hide div class droppointercontainer when user clicks other region except click me! div. , show droppointercontainer div when user clicks click me! div. how jquery? html: <body> <div class="click" id="click1">click me! <div class="droppointercontainer" id="droppointercontainer1"> <div class="droppointer"></div> <div class="dropmenu" id="dropmenu1"> <h4>option1</h4> <h4>option2</h4> <h4>option3</h4> </div> <div class="dropmenutop"></div> </div> </div> <div class = "click" id="click2">click me! ...

javascript - Error in Auth Google Video API -

i'm trying use google api: i downloaded sample project , followed steps are: 1) cd project folder api video 2) npm install 3) set gcloud_project = neorisvideo 4) downloaded json credential , inserted inside project folder 5) ran command node analyze.js labels-file resources / cat.mp4 and gave following error: error: error: not load default credentials. browse https://developers.google.com/accounts/docs/application-default-credentials more information. @ c:\users\thiago.saad\downloads\nodejs-docs-samples-master\nodejs-docs-samples-master\video\node_modules\google-auth-library\lib\auth\googleauth.js:316:21 @ c:\users\thiago.saad\downloads\nodejs-docs-samples-master\nodejs-docs-samples-master\video\node_modules\google-auth-library\lib\auth\googleauth.js:346:7 @ request._callback (c:\users\thiago.saad\downloads\nodejs-docs-samples-master\nodejs-docs-samples-master\video\node_modules\google-auth-library\lib\transporters.js:70:30) ...

python - How to get a complete topic distribution for a document using gensim LDA? -

when train lda model such dictionary = corpora.dictionary(data) corpus = [dictionary.doc2bow(doc) doc in data] num_cores = multiprocessing.cpu_count() num_topics = 50 lda = ldamulticore(corpus, num_topics=num_topics, id2word=dictionary, workers=num_cores, alpha=1e-5, eta=5e-1) i want full topic distribution num_topics each , every document. is, in particular case, want each document have 50 topics contributing distribution and want able access 50 topics' contribution. output lda should if adhering strictly mathematics of lda. however, gensim outputs topics exceed threshold shown here . example, if try lda[corpus[89]] >>> [(2, 0.38951721864890398), (9, 0.15438596408262636), (37, 0.45607443684895665)] which shows 3 topics contribute document 89. have tried solution in link above, not work me. still same output: theta, _ = lda.inference(corpus) theta /= theta.sum(axis=1)[:, none] produces same output i.e. 2,3 topics per document. my question how change th...

logging - Laravel 5.4 listener to save users login -

i want save via event listener users login , have following code in custom listener. when try id of user returns each time null . approach how should proceed or on wrong track? <?php namespace app\listeners; use app\user; use app\loginlog; use illuminate\queue\interactswithqueue; use illuminate\contracts\queue\shouldqueue; use event; class logsuccessfullogin { protected $user; /** * create event listener. * * @return void */ public function __construct(user $user) { $this->user = $user; } /** * handle event. * * @param illuminateautheventslogin $event * @return void */ public function handle($event) { var_dump($this->user->account_id); die; $login = new loginlog(); $login->ip = \request::ip(); $login->notiz = 'login'; $login->login_date = \carbon\carbon::now(); $login->user = $...

java - facebook android sdk doesn't show account picker -

i'm trying implement facebook sdk 4 ( com.facebook.android:facebook-android-sdk:[4,5) ) authentication in app. i'm using loginbutton login app. problem arises after first login. the account picker displayed first time. , onwards when click login button, automatically logs in account chose first time. this code i'm using logout: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); .... .... facebooksdk.sdkinitialize(getapplicationcontext()); }); protected void logoutfacebook() { firebaseauth.getinstance().signout(); loginmanager.getinstance().logout(); accesstoken.setcurrentaccesstoken(null); } can please tell me how show account picker each time user clicks login button ?

Lua 4 "n" property of tables -

in lua 4, many tables have "n" property tracks number of items inside table. do tables have property? can overridden? i ask, because i'm trying develop routine prints of table's elements recursively in valid lua syntax, , want know if it's safe filter "n" items out of result? thanks. [edit] here's script: -- thoughtdump v1.4.0 -- updated: 2017/07/25 -- ***************** -- created thought (http://hw2.tproc.org) -- updated mikali -- description -- *********** -- parses globals table , __tdprints contents "hw2.log". -- can used parse (i.e., pretty-print) generic tables in cases. -- note: functions & variables must declared in order parsed. -- otherwise, ignored. -- note: if parsing table other globals table, __tdprinted table -- values may in different order written. values -- numerical indices moved "top" of table, followed values -- string indices, followed tables. functions appear in different -- locatio...

python - Configure IPython (i.e. Jupyter) History with Custom Information -

i want customize way ipython saves history. ipython creates sqlite3 database contains history of typed commands, want customize allow me save additional information, such current working directory when line of code executed. table of like: command directory import sys /users/home import os /users/home os.chdir("~/data") /users/home data = open("input_file", 'r').read() /users/home/data also, want have done each line executed (as opposed saving @ end of session manually). does know how this? ipython not seem have configurable options allow add custom information history find on documentation, or looking @ option available in config historymanager within ipython after playing around, figured out. key modify ipython code runs ipython interactive shell. within script interactiveshell.py (for me, located in ~/anaconda/lib/python3.6/site-packages/ipython/core ), put following block of code in script interactiveshell.py , @ ...

ios - trying to store values from Firebase to NSDictionary -

i accessing firebase database , getting values , storing in property. when try access property outside method getting "null". can me new obj c programming -(void)buildusersindatabase { firdatabasereference *referencetodatabase = [[firdatabase database]reference]; [[referencetodatabase child:@"users"]observeeventtype: firdataeventtypechildadded withblock:^(firdatasnapshot * _nonnull snapshot) { self.dict = @{@"name": snapshot.value[@"name"], @"email":snapshot.value[@"email"]}; }]; } the method -[firdatabasereference observeeventtype:withblock:] asynchronous; code insisde block executed when observed event occurs. in contrast, method -buildusersindatabase registers block , exits right away; self.dict nil until observed event happens , pased block executed. source: firebase official documentation

borrow checker - Rust loop on HashMap while borrowing self -

i have element struct implements update method takes tick duration. struct contains vector of components. these components allowed modify element on update. i'm getting borrow error here , i'm not sure do. tried fixing block, block doesn't seems satisfy borrow checker. use std::collections::hashmap; use std::time::duration; pub struct element { pub id: string, components: hashmap<string, box<component>>, } pub trait component { fn name(&self) -> string; fn update(&mut self, &mut element, duration) {} } impl element { pub fn update(&mut self, tick: duration) { let keys = { (&mut self.components).keys().clone() }; key in keys { let mut component = self.components.remove(key).unwrap(); component.update(self, duration::from_millis(0)); } } } fn main() {} the error error[e0499]: cannot borrow `self.components` mutable more once @ time --...

java - JSP set javascript variable without hidden input -

i'm looking better way set javascript variable in jsp. not hidden inputs transfer data javascript. there better solution can think of? currently on project, javascript variables handled via jsp in fashion: <input id="javavalue" type="number" value="${java_variable}" class="hidden"> where in javascript (jquery) following: var valuefromserver = $("#javavalue").val(); however, feel approach kinda... inelegant. causes problem way project handles 508 compliance, wave pick on these fields, , developers required add labels them. i'm looking better way. i'm aware of setting variables in own mini script tag so: <script> value=${java_variable} </script> are there drawbacks i'm not seeing approach? seems cleanest , most-simple solution. i'm aware can set them directly on model , grabbing using jquery. seems better approach option 1, there limitations or problems arise type of approach?: ...

Oracle SQL - compare date with range of dates -

i have problem compare 1 date partition product_id. need check whether last date_to ordered date_to desc between date_from , date_to in range of dates. here's example of partition: product_id | date_from | date_to 1 | 2017-01-01| 2019-05-01 1 | 2017-04-15| 2017-06-10 1 | 2017-03-15| 2017-03-25 1 | 2017-01-19| 2017-02-01 how can check whether date in last row between range of date in partition product_id. order have intact. tried lag function check previous range, tried min(date_from) , max(date_to) here problem because min first row , max second , qualification false because need check every range of dates product not whole range. solution check: *2017-02-01 between (first row of partition) 2017-01-01 , 2019-05-01 (true) *2017-02-01 between (second row of partition) 2017-04-15 , 2017-06-10 (false) *2017-02-01 between (third row of partition) 2017-03-15 , 2017-03-25 (false) result: yes! date between range of dates ;) ok flag 1 enough :) i ...