Posts

Showing posts from April, 2015

ios - Start/stop image view rotation animations -

sorry if newbie question, new ios & swift. i have start/stop button , image view want rotate. when press button want start rotating , when press button again image should stop rotating. using uiview animation, haven't figured out way stop view animations. i want image rotate, when animation stops image shouldn't go starting postion, instead continue animation. var istapped = true @ibaction func startstopbuttontapped(_ sender: any) { ruotate() istapped = !istapped } func ruotate() { if istapped { uiview.animate(withduration: 5, delay: 0, options: .repeat, animations: { () -> void in self.imagewood.transform = self.imagewood.transform.rotated(by: cgfloat(m_pi_2)) }, completion: { finished in ruotate() }) } } it code, doesn't work aspect. swift 3.x start animation let rotationanimation : cabasicanimation = cabasicanimation(keypath: "t...

python - Reading a random seed of a jupyter notebook -

is there way read "state" of random number generator in jupyter notebook? for example, if ran cell specify neural network architecture, , train on data without specifying seed, there way can read seed used run this? you can indeed read (and store) current state of rng, changes every time used, i.e. cannot describe after have run cell. here example (since have tagged question with keras , assume interested in numpy rng , 1 used in keras): import numpy np current_state = np.random.get_state() # produce random numbers: = np.random.randn(3) # array([-0.44270351, 1.42933504, 2.11385353]) # now, restoring rng state , producing again 3 random numbers, same result: np.random.set_state(current_state) b = np.random.randn(3) b # array([-0.44270351, 1.42933504, 2.11385353]) == b # array([ true, true, true], dtype=bool)

python - Solve multiple independent optimizations in scipy -

i need minimize cost function large number (1000s) of different inputs. obviously, can implemented looping on scipy.optimize.minimize or other minimization routine. here example: import numpy np import scipy sp def cost(x, a, b): return np.sum((np.sum(a * x.reshape(a.shape), axis=1) - b)**2) = np.random.randn(500, 40) b = np.array(np.arange(500)) x = [] in range(a.shape[0]): res = sp.optimize.minimize(cost, np.zeros(40), args=(a[none, i], b[none, i])) x.append(res.x) it finds x[i, :] minimize cost each a[i, :] , b[i] , slow. guess looping on minimize causes considerable overhead. a partial solution solve x simultaneously: res = sp.optimize.minimize(cost, np.zeros_like(a), args=(a, b)) this slower loop. minimize not know elements in x group-wise independent. computes full hessian although block-diagonal matrix sufficient, considering problem structure. slow , overflows computer's memory. is there way inform minimize or optimization function pr...

angular - Retain the value in Global filter after refreshing the page in angular2 -

i have used data table , global filter filters data data table in angular2.i performing following operation. when entered value in filter, records getting filtered. when perform operation(for e.g., approve record),the page gets refreshed removing particular record(as expected) , filter gets cleared.but want is,the filter should not cleared , has display records present(except deleted record) before performing action after performing approve action. able retain value in filter using ngmodel records not getting filtered.they getting filtered after focusing , press enter button or pressing key space or entering letter. so please me in filtering data after refreshing page you can use router query parameters filter data get filter in constructor constructor(private router: router, private route: activatedroute) { this.route .queryparams .subscribe(params => { const filter = params['filter'] || ''; this.applyfilter(filt...

trim - How to filter out the characters from user inputed string in c#? -

this question has answer here: remove characters c# string 12 answers how can filter out specific characters inputed string? please see below how have tried. using system; namespace plaintest { class arraytest { static void main(string[] args) { bool doalways = true; int = 1; { console.writeline("test number : {0}", i++); console.write("key in string: "); char[] alpha = { 'a', 'b', 'c' }; string text = console.readline(); string filteralphabet = text.trim(alpha); console.writeline("the input : {0}", text); console.writeline("ater trimed alpha a,b,c : {0}...

add/update libpng latest version in my android studio project -

please tell me way can add/update libpng latest version in android studio project fix libpng vulnerability issue. project has src/main/jnilibs has /x86 & /armeabi *.so files. please me. thanks i suspect, based on way asked question, did not add libpng directly project. if had, obvious need download newer version, specified in google faq . so identify library using uses libpng , install later version of library/framework. instance, if using opencv , instance, check this answer addresses versions of library has updated libpng .

filter - Tableau dual axis map exclude zero value bubbles -

Image
i working dual axis map in tableau , displaying 1 measure color density on map , measure bubbles on same map. the 2nd measure has null values - null values display little dots in map. there way exclude them? i tried filter 2nd measure exclude null values, first measure filtered same way.

java - How to give relative path in a executable jar? -

i have spring app deploying .jar. the app has write folder located in /src (precisely /src/main/resources/patches ). have path directly in code. in application.properties: patch_dir = src/main/resources/patches the app has read json file src/main/resources/myjson.json , path being directly written in code. prior deploying, while running ide goes well, app sees file , folder , reads , writes correctly. after building .jar paths change, file located in myjar.jar/boot-if/classes/myjson.json , folder respectively in myjar.jar/boot-if/classes/patches . how can specify these paths in code in way after building jar stay relevant application? edit: can specify path of file as: patchapplication.class.getclassloader().getresource("myjson.json").getpath(); this should solve problem, path relative class , not root of project, not improve anything. you should specify path in file system,instead of path inside .jar.when run app ,it access given path.

reduce - Swift - Cleaner Syntax for Reducing an Array inside Guard -

i have uiview driven 2 arrays: [float] "data" , [uicolor] "colors". if view isn't given proper data displaying empty state, controlled guard statement see here: private func unwrap() -> ([float], [uicolor]) { guard let data = data, !data.isempty, let colors = colors, data.count == colors.count else { return ([1], [uicolor.lightgray]) } // empty state let total = data.reduce(0) { $0 + $1 } if total == 0 { return ([1], [uicolor.lightgray]) } return (data, colors) } i don't repetition of empty state return ([1], [uicolor.lightgray]) being used twice. i've tried add data.reduce call inside guard statement, like: private func unwrap() -> ([float], [uicolor]) { guard let data = data, !data.isempty, let colors = colors, data.count == colors.count, data.reduce(0) { $0 + $1 } != 0 else { return ([1], [uicolor.lightgray]) } // empty state return (data, colors) } ...

rest - What is the correct way to implement fast, tolerant crud apps -

what best way implement crud applications fast , fault tolerant crud apps. for example in gmail when select mail(or hundreds) , delete, finishes operation fast , moves mail archive. i don't think simple ui makes request rest back-end, rest back-end executes request, changes entity state , response back. instead of such flow think there should async flow ui makes request , gets ok everytime; back-end executes request , inform ui when real result whenever operation finished. back-end should handle failures , retries think.. this not gmail architecture, wonder how design crud apps smooth , fast.. there pattern, set of best practices etc.. regards.

java - Need to print the values of an array that is parallel to one I sorted using bubble sort -

i have school project supposed make car rental application in bluej using java. 1 part, have 2 arrays, 1 price , 1 name of car. have print name of car in descending order of price . have managed sort price array in descending order using bubble sort not able figure out how print name of car when sorted price array. please help. string carmodel[] = {"a", "b", "c"}; //names of cars int costperday[] = {100, 75, 250}; //rental cost per day for(int x = 0; x < costperday.length-1; x++) { //sort cost per day array in descending order using bubble sort for(int j = x + 1; j < costperday.length; j++) { if(costperday[x] < costperday[j]) { int t = costperday[x]; costperday[x] = costperday[j]; costperday[j] = t; } } } this code snippet. need print names of cars in descending order of corresponding cost. thanks in advance! string carmodel[] = {"a", "b", ...

ReactJS - "Keys" error when adding components in loops -

i following tutorial on how build react tic tac toe example, , found interesting. at end of tutorial, found 1 of following challenges: rewrite board use 2 loops make squares instead of hard coding them. this original render method render() { return ( <div> <div classname="board-row"> {this.rendersquare(0)} {this.rendersquare(1)} {this.rendersquare(2)} </div> <div classname="board-row"> {this.rendersquare(3)} {this.rendersquare(4)} {this.rendersquare(5)} </div> <div classname="board-row"> {this.rendersquare(6)} {this.rendersquare(7)} {this.rendersquare(8)} </div> </div> ); } i first did 1 loop , working great render() { let col_count = 3; let row_...

impressions - Do a lot of Admob Requests translate to low RPM? (Swift, Xcode) -

i have app has bannerads implemented, along reward based video , interstitial ad. every time home screen loaded, requests new reward based video user view. have 100+ reward video requests 100% match rate, no income ads. granted, impressions ad not near requests, still thought should gaining incoming impressions have. for interstitial ad, presented after many times user restarts game. have handful of impressions on ad no income. the ad receiving income on banner ad shown user besides when in game. my question is, if requesting ad many times (such reward based video ad), lower income or rpm ad or give me no income? otherwise, there reason not gaining income? thank you!

graph - How can I plot a tree on R with several parents for a node? -

i'm trying plot tree-like graph on r this expect here goes code (i'm using library "data.tree"): library(data.tree) <- node$new("a") b <- node$new("b") c <- node$new("c") d <- node$new("d") a$addchildnode(b) a$addchildnode(c) b$addchildnode(d) c$addchildnode(d) plot(a) but got

c# - A new expression requires () -

i following microsoft tutorial , got code doesn't work. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapp1 { class program { static void main(string[] args) { int[] liczby = new int liczby[] { 5, 6, 7, 8 ,9, 10 }; console.writeline(liczby[5]); console.readkey(); } } } change line instantiating int array this: int[] liczby = new int[] { 5, 6, 7, 8 ,9, 10 }; this syntax error.

access vba - What is a Regex equivalent of the 'Trim' function used in languages such as VB and Java..? -

Image
i'm using regex in microsoft access 2007 database vba project reference microsoft vbscript regular expressions 5.5. all well...mostly. know regular expression act 'trim' function..? (remove leading , trailing spaces) i have this: ((?:.?)*) "capture after last match". matches spaces remove. below relevant code, followed screenshot of debugger. item 4 in submatches has " can". how remove space regex, don't have use trim function..? pattern = "^(\d{1,2})(?:\/)(\d{1,2}(?:\.\d{1,3})?)(oz)((?:.?)*)" regex.pattern = pattern set matchcollection = regex.execute(workstring) if matchcollection.count > 0 matchsection = "loose cases" itemtype = "case" percase = matchcollection(0).submatches(0) perpack = 1 unitsize = matchcollection(0).submatches(1) uom = matchcollection(0).submatches(2) other = vba.trim(matchcollection(0).submatches(3)) end if ... ok, figured out. reiterate (and c...

confluent - what is identityMapCapacity means in schema registry -

what identitymapcapacity means in confluent schema registry cachedschemaregistryclient . per documentation declaration like: public cachedschemaregistryclient(@notnull string baseurl,int identitymapcapacity) i saw couple of posts initialized int 10 , somewhere 1000. not sure means , should use.

How can I set my title in the URL or routing module using Angular 2+? -

i need this home.routing.module.ts @ngmodule({ imports: [ routermodule.forchild([ { path: 'car/<any content>/:id', component: cardetailcomponent } ]) ) i did quick check couldn't find examle this it placeholder /:title , same of did id routermodule.forchild([ { path: 'car/:title/:id', component: cardetailcomponent } ]) for redirecting on above url use routerlink directive appropriate parameter. [routerlink]="['car', title, id]"

c# - How to post MultipartFormDataContent (with attached files) to REST API? -

i have api in asp.net mvc: public class uploadcontroller : controller { ... public actionresult post(uploadmodel uploadmodel) i wish call api test client, attaching files. using (var httpclient = new httpclient()) { httpclient.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("multipart/form-data")); var bytearraycontent = new bytearraycontent(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); bytearraycontent.headers.contenttype = mediatypeheadervalue.parse("text/csv"); var uploadmodel = new uploadmodel { allergene = "anders", description = "desc", email = "and@juu.com" }; var content = new stringcontent(jsonconvert.serializeobject(uploadmodel), encoding.utf8, "application/json"); var multipartformdatacontent = new multipartformdatacontent { {content}, ...

amazon web services - Query S3 logs content using Athena or DynamoDB -

i have use case query request url s3 logs. amazon has introduced athena query s3 file contents. best option respect cost , performance? use athena query s3 files request urls store metadata of each file request url information in dynamodb table query amazon dynamodb poor choice running queries on web logs. dynamodb super-fast, if retrieving data based upon primary key (" query "). if running query against all data in table (eg find particular ip address in key not indexed), dynamodb need scan through rows in table, takes lot of time (" scan "). example, if table configured 100 reads per second , scanning 10000 rows, take 100 seconds (100 x 100 = 10000). tip: not full-table scans in nosql database. amazon athena ideal scanning log files! there no need pre-load data - run query against logs stored in amazon s3. use standard sql find data you're seeking. plus, pay data read disk. file format bit weird, you'll need correct create tabl...

uialertview - Swift3 UITextField in UIAlert validation after button pressed -

i have implemented alert window 2 text fields. , want perform validation: if 1 of text fields blank (user did not input value), application should not allow user press "done" button. don't want show alerts, want not allow user save blank data. i have created function listed below. added 2 guards return. in case if user did not input anything, alert closes , nothing saved. don't want alert window closed. how can done if can be? have not found answer. have checked this question, looks it's not applicable me. appreciate help! private func addtable() { let alert = uialertcontroller(title: nslocalizedstring("inputtableparams", comment: ""), message: nil, preferredstyle: .alert) alert.addtextfield(configurationhandler: configuretablenametextfield) alert.addtextfield(configurationhandler: configuretablecapacitytextfield) alert.textfields?[0].autocapitalizationtype = .sentences alert.textfields?[1].autocapitalizationtype ...

python - How to write the output of data in tensorflow -

i have been following tutorial understand linear classification model , applications. have taken different example outside census data , can accuracy evaluate . now interested print out rows of test data predicted column values. https://www.tensorflow.org/tutorials/wide import random import pandas import tensorflow tf import tempfile import numpy np df_train = pandas.read_csv('input/train.csv', usecols=['sex', 'age', 'fare','survived', 'sibsp']) df_test = pandas.read_csv('input/test.csv', usecols=['sex', 'age', 'fare', 'sibsp']) df_test['survived'] = 0 categorical_columns = ['sex'] continuous_columns = ['age', 'fare', 'sibsp'] df_train_nona = df_train.dropna() df_test_nona = df_test.dropna() print(df_test_nona) def input_fn(df): continuous_cols = {k: tf.constant(df[k].values) k in continuous_columns} categorical_cols...

php - Drupal 8 How to create custom block in a theme -

i have created custom theme , added regions. want create , assign custom block regions. how can it? as experimental purpose have created folder named 'blocks' in path /themes/custom_theme/templates , named block 'block--regionname.twig.html'. no hope. please advice. think i'm on wrong track. if make "custom block" in template in theme, not available in block layout page in drupal site , can't place region. you can create custom blocks in structure -> block layout -> add custom block. or can create custom module. these available in block layout page, , can place region. can define twig template block in custom module, , can write html it. https://www.drupal.org/docs/8/creating-custom-modules/create-a-custom-block

python - headers and oauth in get_quote for E*Trade API using Python3 -

after authorizing application, request access token passing oauth credentials through header. signature , headers generated through code; api_module = 'oauth' api_restful = 'access_token' if renewal: api_restful = 'renew_access_token' production_url = 'https://etws.etrade.com/{0:s}/{1:s}'.format(api_module, api_restful) oauth_timestamp = int(time.time()) rand_str = lambda n: ''.join([random.choice(string.hexdigits) in range(n)]) oauth_nonce = rand_str(40) key = oauth_consumer_secret + \ '&' + \ quote_plus(oauth_token_secret) base_string = quote_plus('get') + '&' + \ quote_plus('https://etws.etrade.com/oauth/access_token') + '&' + \ quote_plus('oauth_consumer_key={}&'.format(oauth_consumer_key)) + \ quote_plus('oauth_nonce={}&'.format(oauth_nonce)) + \ quote_plus('oauth_signature_method=hmac...

powerquery - Power Query - best way to sub select? -

suppose have column representing object type , column representing object color. want remove blue , red fruits (example of object type) keep other red , blue objects. how can acheive in power query ? thanks, just (un)select (not) matching rows let source = excel.currentworkbook(){[name="table1"]}[content], filtered = table.selectrows(source, each not ([objecttype] = "fruit" , ([objectcolor]="red" or [objectcolor]="blue"))) in filtered

arrays - Parse a multi level json in php -

i have json file , "host_name" values items. below, php code, tried things, using true decode json in array or without , use foreach() , can't it. { "href": "https://webservice:8080", "items": [ { "hosts": { "cluster_name": "cluster1", "host_name": "server1" }, "href": "https://server1:8080" }, { "hosts": { "cluster_name": "cluster1", "host_name": "server2" }, "href": "https://server2:8080" }, { "hosts": { "cluster_name": "cluster1", "host_name": "server3" }, "href": "https://server3:8080...

javascript - Using Flask Session with new EventSource -

sorry poorly worded title. my goal set flask page using ajax can add dynamic content page python program running. i using flask_oauthlib access token rest api, , querying rest api paginated content. i want show "progress" repeat rest call different pages of content api. rest api access token stored in user's session variable. i have followed these steps basic dynamic page , running. however, when start modifying "progress" function, add access session variable, starts fail. i error: runtimeerror: working outside of request context. tells me not in right session context. my guess because endpoint being called javascript using new eventsource ... how able access session context in way? am going down right path, or there better option available? here various code blocks have: <!doctype html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <lin...

linux - Finding an exact match in QNX without using grep -w -

i'm writing script needs find exact match in file compatible qnx , posix compliant linux more detail: im trying find user of process original command wrote user=$(ps -aux | awk '{print $1 " " $2}' | grep -w ${process} | awk '{}print $1') which works in posix compliant linux however, qnx isn't totally posix compliant , grep -w isn't usable target...so need find exact match without grep -w i think want print field 1 if field 2 matches something: ps -aux | awk -v p=$process '$2==p{print $1}'

AWS4 request signing with Ruby -

i have codebase work aws cloudfront in limited capacity , trying status of distribution invalidation through api endpoint documented here: http://docs.aws.amazon.com/cloudfront/latest/apireference/api_getinvalidation.html this endpoint requires request headers signed using aws4 signature, i'm stuggling with. i've modeled of request signing code based on signing code in aws sdk ruby: https://github.com/aws/aws-sdk-ruby/blob/master/aws-sdk-core/lib/aws-sdk-core/signers/v4.rb my code follows: class cfagent rfc8601basic = "%y%m%dt%h%m%sz" cf_agent_access_key = "validaccesskey" cf_agent_secret_access_key = "validsecret" def self.cf_dist_invalidation_status dist_id = "abc123" invalidation_id = "xyz" url = "https://cloudfront.amazonaws.com/2017-03-25/#{dist_id}/invalidation/#{invalidation_id}" headers = { "content-type" => "application/json; charset=utf8" ...

sql server - BCP pausing during upload - continues after ctrl-C -

i've been uploading tsql server bcp , upload intermittently stops. when know has stopped can press ctrl-c , carry on instead of cancelling upload. doesn't lose data, correct number of rows inserted. have idea why might happening? volume in millions , don't want babysit upload though uploads @ around 50,000 per second when functioning properly. the command is: bcp [server].[schema].[table] in "some.csv" -t -s [server name, port] -c f1 -t "¬" b 50000 -a65535 -h tablock the same error occurs without -a65535 -h tablock section there increase upload speeds. thanks in advance! it appears bcp pauses when click on it. seems happen when unattended haven't been able recreate scenario past 24 hours perhaps clicking error. appears powershell error clicking on shell interrupt program you're running. odd

What is the appropriate way to add a widget to an existing Android project in Android Studio? -

i created new android widget (using appwidgetprovider ) integrate pre-existing standard android application. want both distributed 1 .apk file when user installs app, widget, too. before integrating original app, wrote widget in separate project, want create separate module called "appwidget" java/res/etc. files widget remain separate of rest of app. however, doing allows 1 of modules (whichever declared active in drop-down menu left of run button) installed in emulator @ time. install each 1 separately, makes me doubt both included in 1 .apk file upon distribution. so question is: how can compile 2 different modules (one app , 1 widget) in android studio such installed in 1 .apk file? i've searched many other threads including app widgets guide, talks how make widget, not how integrate pre-existing application, , no 1 has mentioned multiple-module problem i'm talking about.

c# - Firebird Database with Visual Studio 2008 not working -

i on windows 7 visual studio 2008. installed firebird 3.0 (the latest version), , wanted connect database using c#. installed firebird ddex visual studio 2008. however, when tried add firebirdsql.data.firebirdclient.dll reference in project, gave yellow triangle exclamation mark inside. some old stack overflow solutions said should install older version of firebird, uninstalled version 3.0, , replaced version 2.5.2. have firebirdsql.data.firebirdclient.dll added reference without yellow triangle problem. however, looks not issue. wrote program similar this example : string connectionstring = "user=sysdba;" + "password=masterkey;" + "database=temp.fdb;" + "datasource=localhost;" + "port=3050;" + "dialect=3;" + "charset=none;" + "role=;" + "connection lifetime=15;" + "pooling=true;" + "minpoolsize=0;" + "maxpoolsize...

javascript - How replace the text in a huge number of content controls via word-js? -

i trying write function takes list of rich text content controls , single string argument, , replaces content of matching content controls string. while works smaller amount of content controls, fails documents huge amount of them. have work documents on 700 content controls individual titles. in case, code replaces first 66x ccs , aborts generalexception. assume due huge amount of content controls. having similar problems, when try register bindings these ccs (generalexception). different topic. i tried work around problem, limiting amounts of changes per .sync() , looping through ccs, performing many loops necessary. however, not easy, due asynchronous nature of office-js. not familiar javascript-async-promise-programming far. have come with: function replacecctextwithsinglestring (cctitlelist, string) { var maxperbatch = 100; /* * first .then() block executed proxy objects selected ccs * * replace text-contents in 1 single .then() block. but: *...

javascript - CAML query not working when week has split month i.e 31st-4th only return 31st -

so, have been using query in sharepoint app months , has worked fine. realized if week i'm trying has split month july 31st august 4th, return list items july 31st??? i've tried can think of work , nothing. how work? i'm @ loss. tried using daterange overlap tag, fails query, tried every other format of date think of, returns empty enumerator. looked through msdn hours, no on issue, searched google , stack overflow few hours , can not find answer question. works fine in querys except startdate = startdate.toisostring(); enddate = enddate.toisostring(); var camlquery = new sp.camlquery(); var filterstring = '<view><query>'; filterstring = filterstring + '<where>'; filterstring = filterstring + '<and>'; filterstring = filterstring + '<geq>'; filterstring = filterstring + '<fieldref name=\'estimateddelivery\'/>'; filterstring = filterstri...

c# - Programmatically print an XPS file to a physical printer -

i have c# winforms application. user uploads .xps file , specifies printer settings (number of copies, paper tray, etc). program needs programmatically print document these settings. is, there can no user interaction print. i can come close system.printing addjob method. ( https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/how-to-programmatically-print-xps-files ). however, can't define specific settings here, paper source, number of copies, etc. i prefer use printdocument method can't figure out how printdocument render/print xps document. i've looked @ resource, https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage(v=vs.110).aspx , can't see how can printpageeventhandler render xps document. any ideas on how proceed? appreciated! c# .net 4.5 update: based on below answer, can send printticket when add job, this: printticket pt = printqueue.defaultprintticket; pt.copycount = 2; // pt.inputbin = [ i...

angular - How can I get route name from app.component? -

in app.component.ts have code below route name, / . know why? expect example home , contact . import { component } '@angular/core'; import { router } '@angular/router'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.scss'] }) export class appcomponent { constructor(private router: router) { console.log(router.url); } } the appcomponent initialized, , constructor executed, when application loaded. hence reason shows "/". navigate other routes, appcomponent remains loaded , constructor not executed again. if provide more information on trying accomplish, may able provide alternative suggestion you. if want watch routes , obtain url, can use observable here instead. this: this.router.events.subscribe((event: event) => { if (event instanceof navigationend) { console.log((<navigationend>event).url); } }); or if want debugging...

html - How to update $rootScope in Angular 1 inside an async callback? -

i'm sure common issue reason can't find solution works. i have simple setup firebase realtime database , angular 1. have directive in html <div id="userslistwrapper" ng-controller="userslistcontroller" ng-init="loaduserslist()"> then inside loaduserslist() method, make call firebase database fetch data $rootscope.users = []; var usersref = firebase.database().ref('/users'); usersref.on('value', function(snapshot) { console.log("loaded users list"); var users = snapshot.val(); updateuserstable(users); }); then finally, inside updateuserstable(users) , update $rootscope.users variable var updateuserstable = function(users) { $.each(users, function(key, value) { var user = { username: key, ... } $rootscope.users.push(user); } } however, though $rootscope.users variable updates correctly (i verified using devtools inside chrome), h...

sql server - How to grab everything before a 3rd occurrence of a character in SQL query -

how can grab data before 3rd '-'? below have sample data: 000700- - - 8 015111- - 005 - 019999- - 005 - a01- 01200- 0 - 5 a01-012000- - 5 a02-015450- - 5 a02-015450- 003 - 1 d08-020700- - 8 d08-020710- - 5 d08-020710- 013 - 1 d08-020710- 013 - 3 this have done , proper info. because there spaces missing being removed cannot proper comparison data in crystal reports. reverse(substring(reverse(a.projectioncode), charindex('-', re‌​verse(a.projectionco‌​de)) + 1, len(reverse(a.projectioncode))))) phasecode this should need , work in event there more or less 3 dashes given row. -- test data... insert #testdata (somestring) values ('000700- - - 8'), ('015111- - 005 -'), ('019999- - 005 -'), ('a01- 01200- 0 - 5'), ('a01-012000- - 5'), ('a02-015450- - 5'), ('a02-015450- 003 - 1'), ('d08-020700- - 8'), ...

c# - Is it possible to read all strings in the intern pool? -

it's known in cases when using strings in c#, clr string interning optimization. so questions are: it possible read strings in intern pool? is there way reference count each interned string? would possible read intern pool separate process space? if none of these possible, what's reasoning not allowing these use cases? i see being useful when monitoring memory usage in cases. may useful when working sensitive information (although think securestring more preferable in many scenarios). as far can tell, public methods related string interning string.intern(string) , string.isinterned(string) i'm asking out of curiosity, not trying solve real problem. realize doing logic based off of string intern pool bad idea. looking interned strings via code has no use case it's feature not added in language. however looking strings in memory while debugging program common use case, , there tools that. you need use tool windbg.exe comes windows sdk. a...

Linux: grep for multiple strings in a log file on a certain date -

sorry seemingly asked question, other thread answers did not work me. log trying search through formatted so: jul 24 23:11:08 tg-12345 gateway [words] tools 987654321 join request i want grep log found in /var/etc/messages instances of date, let's 'jul 24' in case, , '987654321'. proper instruction this? thank you. edit: though not necessary, if know how throw in timeframe (the hour, not date) in same search, great; need @ least date , tool# working first. again. just use command twice: grep 'jul 24' <filename> | grep '987654321'

excel - Selecting specific lines in spreadsheet -

i have massive spreadsheet need select rows of data out of , rest can deleted. of rows want select begin rc followed 6 numbers. numbers can different rc125468 , rc212548. there blank rows in spreadsheet, don't know if make difference. cover of rows in spreadsheet have cycle through 30000. here code (it's bad, it's things found on google thought work): sub macro1() dim x integer dim rng range set rng = range("a2:a35000") set x = x + 1 until x = 30000 if range(x, 1).value <> ("rc??????") delete.row (x) end if loop end sub i've tried couple of different things, keep running different errors , can't put run let alone select info need. appreciated. try this: dim long = 30000 1 step -1 if not activesheet.range("a" & i) "*rc*" activesheet.range("a" & i).entirerow.delete end if next

schema.org - Google SDTT: "The property 'availability' is not recognized by Google for an object of type Product" -

situation: need add availability property product page. schema.org recommends format microdata: <link itemprop="availability" href="http://schema.org/instock" />in stock i'm combining code on our site: <li> <i class="fa fa-check-square-o">&nbsp; <link itemprop="availability" href="http://schema.org/instock"> <span>in stock</span> </i> </li> problem: google structured data testing tool reports: http://schema.org/instock (the property availability not recognized google object of type product .) is code issue? or missing schema/google "wrapper" availability property? ack. figured out. availability has inside offer : <div itemprop="offers" itemscope itemtype="http://schema.org/offer"> <h1> <ul> <li> <i class="fa fa-check-square-o...

amazon web services - AWS CodeDeploy appspec parse issue: invalid version value () -

i trying deploy project, , keep getting following error: the deployment failed because invalid version value () entered in application specification file. make sure appspec file specifies "0.0" version, , try again. the spec file down bare minimum (see below), has been created in visual studio, named (appspec.yml) , formatted, far can see, , being executed latest version of aws codedeploy agent on windows server 2016. i've tried making line endings unix-style, no joy. i not see valid reason why agent should not reading version correctly. version: 0.0 os: windows files: - source: '\' destination: 'c:\inetpub\wwwroot' the problem turned out visual studio saves files default utf-8 byte order mark (visual studio refers "signature") @ beginning. the codedeploy agent choking on bom. when saved file straight utf-8, deployment processed expected. it appears regression, , i've reported such, it's worth documenting is...

ms access - SQL only returns sum for ids with multiple occurences -

so have 3 tables (acdd, ah, life) multiple amounts per customer. customer can have combination of types. created query each table sum amounts of each acdd, ah , life. created fourth query combining of them together. problem getting ids 3 queries have in common...a customer might have life , no acdd or ah--this id missing fourth query. doing wrong? query table(the same query exists each of 3 tables): select distinctrow [customers-personal].[customer id], sum([newb-coverage: ah].[ah monthly benefit]) [sum of ah monthly benefit] [customers-personal] inner join [newb-coverage: ah] on [customers-personal].[customer id] = [newb-coverage: ah].[customer id] group [customers-personal].[customer id]; 4th query (combining all) select [customers-personal].[customer id], sum_acdd.[sum of acdd amount], sum_ah.[sum of ah monthly benefit], sum_life.[sum of decr life amount], sum_life.[sum of level life amount] sum_life inner join (sum...

python - Send PIL Image from Django View to Browser for Download via HttpResponse -

i'm trying send pil image django view browser automatic download. code below seems work many: response = httpresponse(content_type='image/jpg') pil_imagetosend.save(response, "jpeg") response['content-disposition'] = 'attachment; filename="name.jpg"' return response i call django view through ajax, , when print callback looks jpeg image, no download triggered. missing download automatically trigger?

tensorflow - Serving the inception model v3 in Java using SavedModelBundle -

using org.tensorflow:tensorflow:1.3.0-rc0. i have generated inception model checkpoints per tutorial https://tensorflow.github.io/serving/serving_inception : inception_saved_model --checkpoint_dir=/root/xmod/inception-v3 this went ok , generated saved_model.pb , variables/ subdirectory data , moved content /tmp/inception-model directory. i'm trying use model converting https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java/src/main/java/org/tensorflow/examples/labelimage.java loading model no errors: savedmodelbundle modelbundle = savedmodelbundle.load("/tmp/inception-model", "serve"); now trying formulate query (similar https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java/src/main/java/org/tensorflow/examples/labelimage.java#l112 ) i'm stuck trying figure out how use feed , fetch methods: private static float[] executeinceptiongraph(savedmodelbundle modelbundle, tensor image) throws exception { tensor...

javascript - Convert this cURL command with proxy to a Node.JS code -

i have following curl command: curl.exe -x -k _https://url --proxy proxy.example:80 --proxy-user "user:password" i've been trying using global proxy global-tunnel or node-tunnel dont know if correct approach the question how transform curl command in node.js code i guess must simple solutions couldn't figure out i use request library. import request 'request' const params = { method: 'get', url: 'https://url', proxy: 'http://user:password@proxy.example:80' } request(params, (err, result) => { if (err) throw err // handle result... })

Elasticsearch Global timeout setting not reflected in search response's took parameter -

we have setup global timeout elasticsearch (5.3.3) cluster in elasticsearch.yml - search.default_search_timeout: 1nanos but responses this, in cases, have "timed_out": true. however, sometimes, expected response elasticsearch "timed_out": false. however, when "timed_out" false, see "took" returning values > 30 means time taken elasticsearch around 30ms > 1 nanosecond. ideally query should have timed out @ 1 nanosecond. thsis bug?

How get input text changer with [IONIC,javascript,HTML,cordova] -

i'm starting learning javascript. i'm fallowing tutoriel version of ionic has been updated directory , folder not same. template has changer. for each page of app, have : 1 *.html, 1 *.scss , and *.ts (not *.js) so have dificutly developpe app. try add function, function should "username" value after change , show using alert popup code show text value of username default value ="#" , if change , presse 'enter' popup show "username = #" so attribute can use or current value , not default value. note: if have course/tutoriel last version on ionic, i'm interested ;) html part of login.html <ion-header> <ion-navbar> <button ion-button menutoggle> <ion-icon name="menu"></ion-icon> </button> <ion-title>login</ion-title> </ion-navbar> <!-- <script src="login.js"></script>--> </ion-header> ...

c# - check a string array from a list contains a string from another list or vice versa -

is there easy way using linq? i want check , return true or false, whether string list1 contains string array1. in below example string2value , want return true. also want check whether array1 contain string list1. string1blah , return true well. thanks! list<string> list1 = new list<string>{"string1","string2value"}; string[] array1 = new string[2] {"string1blah","string2"}; i have couple of versions, not work time. array1.tolist().any(a=>list1.contains(a)) list1.any(l=>array1.tolist().contains(l)) you can try this: var result= list1.where(s=>array1.any(s1=>s.contains(s1))); per each string in list1 , see if there element in array1 contained in s string.

Javafx tableview not showing data in all columns -

ok, new java several weeks, have been programming 30 years. following code executes, first column showing anything. data object showing multiple rows of data, fields of data filled in. i'm sure i'm missing something, , have looked through similar questions on here. apvoucher_batchgridcontroller.java import java.net.url; import java.util.resourcebundle; import javafx.event.actionevent; import javafx.fxml.initializable; import javafx.fxml.fxml; import javafx.scene.control.tableview; import javafx.scene.input.mouseevent; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import java.util.logging.level; import java.util.logging.logger; import javafx.collections.fxcollections; import javafx.collections.observablelist; import javafx.scene.control.tablecolumn; import javafx.scene.control.cell.propertyvaluefactory; /** * fxml controller class * * @author kmitchell */ public class...