Posts

Showing posts from August, 2010

MATLAB swapping rows with zero in its pivot position, partial pivoting? -

i want matrix turn into a = 1 2 -1 4 5 1 -6 7 5 6 0 0 4 7 5 0 -3 4 7 7 1 5 1 5 6 this kind of matrix. a = 1 2 -1 4 5 1 -6 7 5 6 1 5 1 5 6 0 -3 4 7 7 0 0 4 7 5 so, row 0 in pivot position should go down. i able find rows 0 in pivots using following code: count=0; i=1:n j=1:n if a(i,j)~=0 break else count=count+1; row(count)=i; break end end end row >> row = 3 4 but don't know how can proceed after point. want make code applies kind of matrix. plz help. i think need: a =[1 2 -1 4 5; 1 -6 7 5 6; 0 0 4 7 5; 0 -3 4 7 7; 1 5 1 5 6]; % find last 0 in each row [val,lastzero

Is there a way to check for duplicates with jquery getscript? -

i have case have 2 modules loading on web page , both reference same scripts. in past dealt appending script tags in head id , checking id ahead. interested in dynamically loading script s through jquery. load or getscript, it's there way check existence ahead? thanks.

ggplot2 - Incorrect Long/Lat Plotting with ggplot -

Image
dat <- read.table(text=" 'country_of_asylum' 'iso_3' 'refugees_1000_inhabitants' lat long lebanon lbn 208.91 33.8333 35.8333 jordan jor 89.55 31.0000 36.0000 nauru nru 50.60 -0.5333 166.9167 chad tcd 30.97 15.0000 19.0000 turkey tur 23.72 39.0000 35.0000 'south sudan' ssd 22.32 4.8500 31.6000 mauritania mrt 19.36 20.0000 -12.0000 djibouti dji 16.88 11.5000 43.0000 sweden swe 14.66 62.0000 15.0000 malta mlt 14.58 35.9000 14.4000", header=true) data.frame(top_ten_pcapita) library(ggplot2) library(maps) mdat <- map_data('world') str(mdat) ggplot() + geom_polygon(dat=mdat, aes(long, lat, group=group), fill="grey50") + geom_point(data=top_ten_pcapita, aes(x=lat, y=long, map_id=iso_3, size=`refugees_1000_inhabitants`), col="red") i tried make map on ggplot, longitudes , latitudes off. i'm not entirely sure

Can't get ffmpeg to generate an MP4 file on iOS -

i'm having serious problems trying ios app create mp4 file rtsp stream using ffmpeg. i can open stream, decode it, show video on screen , play live audio without issues. problems arise when try output av stream file. if ask ffmpeg create mp4 file, fails, informing me audio codec in stream incompatible mp4 files. if attempt transcode audio acc, ffmpeg lets me continue, during file output multiple "aac bitstream error" messages, , recording silent. i tried having ffmpeg create mov (quicktime) file instead of mp4. if that, seems work: mov file plays audio. being done, tried transcode mov file mp4 using avassetexportsession. doesn't work: reports decode failed. i'm not sure try next.

java - Optimizing arrayRotateLeft method -

my method works apparently hackerrank it's not fast enough when dealing big numbers. how optimize it? n array size, k number of times array's elements should rotated left. public static int[] arrayleftrotation(int[] a, int n, int k) { int[] holder = new int[n]; for(int m=0; m<k; m++) { for(int b = 0; b<n; b++) { if(b==0) holder[n-1]=a[b]; else holder[b-1]=a[b]; } = holder; holder = new int[n]; } return a; } you can following public static int[] arrayleftrotation(int[] a, int n, int k) { int[] b = new int[n] for(int = 0; i<n; i++) b[i] = a[(i+k)%n] return b; }

What is the meaning of line breaks in a SQL Server stored procedure -

stored procedure works set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[allottectonbay] @date datetime, @addtech [dbo].[addtechnicianbayallotment] readonly begin set nocount on; begin try begin transaction commit transaction end try begin catch rollback transaction; declare @errormessage nvarchar(max), @errorseverity int, @errorstate int; select @errormessage = error_message() + '' line '' + cast (error_line() nvarchar(5)), @errorseverity = error_severity(), @errorstate = error_state(); raiserror (@errormessage, @errorseverity, @errorstate); end catch end go but when put on 1 line doesn't work. why? sql server have line end ; in c#? the problem on go command. must put in single line (and maybe include comments) a transact-sql statement cannot occupy same line go command. however,

html - View overlapping for small screens -

Image
i using bootstrap grid design html pages. working fine except small screens. in small screens views overlapping below i using below code div class="container" > <div class="row"> <div class=" col-xs-6 col-sm-offset-1 col-sm-4 col-md-offset-2 col-md-3"> <div id="poster"> <img src="http://ia.media-imdb.com/images/m/mv5bmtk2nti1mtu4n15bml5banbnxkftztcwodg0oty0nw@@._v1_sx300.jpg"> </div> </div> <div class="col-sm-offset-1 col-sm-4 col-xs-6 col-md-2" > <div id="ratingdiv"> <label>your rating</label> <div id="rateyo"></div> <div class="editbtn"> <button type="button" class="btn btn-info btn-lg" data-toggle="m

javascript - Typescript/Angular2 TypeError: Cannot read property of undefined -

ang2 component: import { component, oninit } '@angular/core'; import { angularfire, firebaselistobservable, firebaseobjectobservable } 'angularfire2'; import chart 'chart.js' @component({ selector: 'app-prchart', templateurl: './app-prchart.component.html', styleurls: ['./app-prchart.component.css'] }) export class appprchartcomponent implements oninit { useremail: any; email: string; uid: any; records = []; newrecords = []; filteredrecords = []; labels = []; public barchartoptions:any = { scaleshowverticallines: false, responsive: true, legend: { display: false } }; public barchartcolors: [] =[ { backgroundcolor:'rgba(30, 136, 229, 1)' } ]; public barcharttype:string = 'bar'; constructor(public af: angularfire) { var auth = this.af.auth.subscribe( (user) => { if (user) { this.useremail = this.af.auth.subscribe(auth =&

scheme - Maintaining list structure when duplicating -

i writing function duplicate items in list, list (a (b c)) becomes (a (b b c c)), function returns (a b b c c). how ensure retain internal list structure? here current code: (define double (lambda (l) (cond ((null? l) '()) ((list? l) (append (double (car l)) (double (cdr l)))) (else (append (list l) (list l)) ) ) )) to preserve structure of list, have avoid using append . here implementation: (define (double lst) (cond [(null? lst) empty] [(list? (car lst)) (cons (double (car lst)) (double (cdr lst)))] [else (cons (car lst) (cons (car lst) (double (cdr lst))))])) for example, > (double '(a (b c) ((a b) (c d)))) '(a (b b c c) ((a b b) (c c d d)))

ios - How to split bytes from NSData? -

so.. have encrypted data server need decrypted can full response json. thing need split first 16 bytes of data iv decryption , rest of bytes encrypted data. tried below method: nsdata *wholedata = [[nsdata alloc] initwithbase64encodedstring:@"iysayh92saft5t/ueqqtltaft1ow33fxpldusrmatblury/6z1vgk1kfmyerwhpbi85t7znzdqal5v8cu60dcjlwvqdi6kdwbmcq0+l62im7ixw60+g8gtkm+6+mltye" options:0]; nsdata *d1 = [wholedata subdatawithrange:nsmakerange(0, 16)]; nsdata *d2 = [wholedata subdatawithrange:nsmakerange(17, wholedata.length)]; nsdata *enc = d2; nsdata *key = [[nsdata alloc] initwithbase64encodedstring:@"alskd81039aisdf/tusd8341iasldkjfy=" options:0]; nsdata *enciv = d1; nsdata *decrypted = [fbencryptoraes decryptdata:enc key:key iv:enciv]; then got below error: terminating app due uncaught exception 'nsrangeexception', reason: '*** -[nsconcretedata subdatawithrange:]: range {17, 96} exceeds data length 96' how can fix issue? nsdata

android - Unable to generate FCM token from dynamically instantiated Firebase -

our business logic requires instantiate firebase during runtime. fetch firebase credentials (app id, api key etc.) default firebase location after knowing user's public key , create firebase instance using credentials. this means there 2 firebase instances used within app: the default "index" firebase gives credentials second the actual firebase intend use point forward the second firebase initialised this: firebaseapp app = firebaseapp.initializeapp(<context>, <options>, <app_label>); our problem traditional method of retrieving fcm token using firebaseinstanceidservice , ontokenrefresh() fails since ontokenrefresh() method called first firebase instance. directly calling string token = firebaseinstanceid.getinstance(app).gettoken(); returns null never ready when called. have tried polling test if token generated @ point. no luck. how can generate fcm token reliably firebase instance instantiated during runtime? i

R ggplot2 - How to plot 2 boxplots on the same x value -

Image
suppose have 2 boxplots. trial1 <- ggplot(completiontime, aes(fill=condition, x=scenario, y=trial1)) trial1 + geom_boxplot()+geom_point(position=position_dodge(width=0.75)) + ylim(0, 160) trial2 <- ggplot(completiontime, aes(fill=condition, x=scenario, y=trial2)) trial2 + geom_boxplot()+geom_point(position=position_dodge(width=0.75)) + ylim(0, 160) how can plot trial 1 , trial 2 on same plot , same respective x? have same range of y. i looked @ geom_boxplot(position="identity"), plots 2 conditions(fill) on same x. i want plot 2 y column on same x. edit: dataset user condition scenario trial1 trial2 1 1 me 67 41 2 1 me b 70 42 3 1 me c 40 15 4 1 me d 65 23 5 1 me e 45 45 6 1 se 100 34 7 1 se b 54 23 8 1 se c 70 23 9 1 se d 56

java - Subscribe to different event bus in same class -

i using greenrobot event bus 3.0 event bus , have 2 publishers: private static final eventbus event_bus = new eventbus(); //publish event event bus public static void sendevent(loggingevent event){ logpublisher.event_bus.post(event); } //publish event event bus public static void sendevent(otherloggingevent event){ logpublisher.event_bus.post(event); } i have 2 subscribers: @subscribe(threadmode = threadmode.async) public void onevent(loggingevent event){ logevent( event); } @subscribe(threadmode = threadmode.async) public void onevent(otherloggingevent event){ logevent( event); } the issue when make call like: mypublisher.sendevent(new otherloggingevent(vara, varb, varc)); both subscribers called , can't figure out why. think might have fact otherloggingevent subclass of loggingevent , i'm not sure. question becomes how maintain 1-1 relationship publisher , subscriber. want call: mypublisher.sendevent(new otherl

cypher - Neo4j: weighted relationships, how to reflect important relationships in query? -

i have data in relationships important others , weighted indicate it. example, have graph this: (city_a:city)-[:has{weight:10}]->(casino:event) (city_a:city)-[:has{weight:1}]->(restaurant:event) (city_a:city)-[:has{weight:30}]->(university:event) (city_a:city)-[:has{weight:25}]->(library:event) ...... (city_b:city)-[:has{weight:2}]->(casino:event) (city_b:city)-[:has{weight:2}]->(restaurant:event) (city_b:city)-[:has{weight:5}]->(university:event) (city_b:city)-[:has{weight:10}]->(library:event) ...... and have input following input: {casino, restaurant, university} and should output output: city_a as answer since has relationships weighted more other cities. (maybe graph model not right one, not think of also. advices welcomed). so, how write cypher query case? thanks in advance! here's example graph based on description, 'city_c' thrown in cover case of city fewer desired input e

css - how to create cell border of xls using xml in ruby on rails? -

Image
how create cell border of xls using xml in ruby on rails? trying generate xls file following way <?xml version="1.0"?> <workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/tr/rec-html40"> <worksheet ss:name="grn register"> <worksheetoptions xmlns="urn:schemas-microsoft-com:office:excel"> <pagesetup> <layout x:orientation="landscape"/> <header x:margin="0.1"/> <footer x:margin="0.1"/> <pagemargins x:bottom="0.5" x:left="0.4" x:right="0.4" x:top="0.5"/> </pagesetup> <fittopage/> <print> <

c# - Retrieve comma-separated values from IQueryable and add to list -

iqueryable<string> scannedbarcodes = xyzdb.tblscannedbarcodes .where(i => i.pullno == lblpullno.text) .select(i => i.barcode); the result view shows "678765,090909,243454,675434" now want add comma-separated values list. rest of code below: foreach (var item in scannedbarcodes) { list<string> _barcodes = new list<string>(); _barcodes.add(item); } how split it? thanks in advance the splitting can done using linq follows. var _barcodes = scannedbarcodes.selectmany(istring => istring.split(new char[]{ ','})) .tolist();

generics - Using a template type in a swift protocol definition -

how can declare protocol in swift function argument types depend on type adopts protocol? something protocol endianconvertible<t> { init( litteendian: t ); func litteendian() -> t; } background: i'm trying write stream decoder little endian binary stream in swift. part of generic function class readstream { var offset : int = 0; var data : data; func readintle<t : integer>() -> t { var d : t = 0 let intbits = data.withunsafebytes({(bytepointer: unsafepointer<uint8>) -> t in bytepointer.advanced(by: offset).withmemoryrebound(to: t.self, capacity: memorylayout<t>.size) { pointer in offset += memorylayout<t>.size return pointer.pointee } }) d = t(littleendian: intbits) } } which fails compile integer protocol not specify init(litteendian: t) available, , obvious way fix seemed have protocol adds specification. you can use self in protocol refe

ANGULAR 2 Using a class within a test case provided that the class is already being used as a provider in the module -

i using class named params provider within module , want use same class inside test case. 'export class params { public firstname: string = 'abhishek'; public lastname: string = 'parashar'; public website: string = 'parashar.com'; }` here spec file want use it. 'import { usersparams } '../../../comp/users/core/users.params'; export class testdata { static userparams: usersparams = { public firstname: string = 'abhishek'; public lastname: string = 'parashar'; public website: string = 'parashar.com'; }; describe('test case', () => { beforeeach(() => { testbed.configuretestingmodule({ providers: [ { provide: usersparams, useclass: usersparams} ] }); });' it('should users list', inject([componentparams], fakeasync() => {} );); i want use componentparam

reactjs - Ex-navigation Tab Bar background color change from particular screen -

Image
i change background color of tab bar when changing tabs. i tried changing state of tab bar when title of tab rendering it's not working because starts rendering infinity times , app crashes: rendericon = (isselected, title) => { if (title === 'home') { } else if (title === 'profile') { if (isselected) { this.setstate({ isdefault: false }); return (<image style={{ width: 29, height: 24, margintop: 8, marginbottom: 1 }} source={images.profileselected} />); } return (<image style={{ width: 29, height: 24, margintop: 8, marginbottom: 1 }} source={images.profile} />); } render() { return ( <tabnavigation ref='tabber' id="main" navigatoruid="main"

How to open generated souce code from an apk file as a single project file in Android Studio? -

i have decompiled apk source code. i'm being able open classes seperately in android studio. i'm unable find project file android studio thumbnail. how done? want understand built in classes , user defined. please there no "project file" inside apk. information project useless app work on phone, increase weight of file. apk contains classes , resources bundled installed , executed on phone, nothing more.

node.js - Node Sass missing binding for multiple node versions -

i using nvm switch between node versions. my package.json: "scripts": { "dev": "rm -rf public/assets/*.hot-update.js && node_env=development webpack --env=dev --progress --profile --colors", "prod": "node_env=production webpack --env=prod --progress --profile --colors" }, "author": "", "license": "isc", "devdependencies": { "babel-core": "^6.18.2", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", "babel-preset-stage-0": "^6.16.0", "babel-preset-stage-2": "^6.18.0", "compression-webpack-plugin": "^0.3.2", "css-loader": "^0.26.2", "extract-text-webpack-plugin": "^2.0.0", "file-loader": "v0.10.0", "imports-loader": "

html - Alter the order of text selection across elements -

say have this div { position:absolute; top:0; } #right { left:50px; } #left { left:0; } <div id="right">world</div> <div id="left">hello</div> when go select text left right, behaves in visually unintuitive way. in chrome @ least, order in elements considered selection seems depend on order of elements. there way change order without changing order of elements? you can using css flexbox. have change values of div id properties css. code: #blockcontainer > div { border: 1px dashed #000; } #blockcontainer { display: -webkit-box; display: -moz-box; display: box; -webkit-box-orient: vertical; -moz-box-orient: vertical; box-orient: vertical; } #right { -webkit-box-ordinal-group: 3; -moz-box-ordinal-group: 3; box-ordinal-group: 3; } #left { -webkit-box-ordinal-group: 1; -moz-box-ordinal-group: 1; box-ordinal-

exporting table to excel using tableExport jquery -

i exporting table excel using tableexport jquery plugin. want know how can customized table i.e have edit column heading name , apply formulas table , send excel. excel file has bit different of html table. there needs of sum values. can me ? in advance! here code $("#data").tableexport({ bootstrap: true, headings: true, footers:true, formats:["xls"], filename:"claim", ignorerows:arr });

jsreport with phantom-pdf recipe: how / where to set basic settings like format, margin, orientation...? -

i'm using jsreport (through npm) render pdf html using phantom-pdf recipe. rendering started via https call: https://127.0.0.1/api/report ...and post data string one: { "template": { "content": /*...my html content template render...*/, "recipe": "phantom-pdf", "engine": "handlebars" }, "data": /*json string data pass template*/ } i know there basic settings phantom-pdf (margin, format, width, height, orientation, printdelay, waitforjs), didn't understand put them: - in html template? - in dev.conig.json file of jsreport? - in separate file? ...and how? thank in advance! you can send these settings part of api request body, inside template.phantom property. { "template": { "content": /*...my html content template render...*/, "recipe": "phantom-pdf", "engine": "handlebars", "phan

python - Linter pylint is not installed -

i want run python code in microsoft visual code gives error "linter pylint not installed" i installed python extension python3 anaconda open terminal ( ctrl+~ ) run command pip install pylint if doesn't work: on off chance you've configured non-default python path editor, you'll need match python's install location pip executable you're calling terminal. this issue because python extension's settings enable pylint default. if you'd rather turn off linting, can instead change setting true false in user or workspace settings: "python.linting.pylintenabled": false

android - Use two controller in the same page -

i'm making first app on ionic2 , i'm little confused typescript. display popup , modal on same page: have import modalcontroller , alertcontroller 'ionic-angular'. can use alerts following code: import { alertcontroller } 'ionic-angular'; export class mypage { constructor(public alertctrl: alertcontroller) { } } or modal using following code: import { modalcontroller } 'ionic-angular'; import { modalpage } './modal-page'; export class mypage { constructor(public modalctrl: modalcontroller) { } } but when want use two, have used 2 constructors it's impossible... correct way use these 2 components? thanks in advance! you can inject multiple providers in constructor.. this: constructor(public alertctrl: alertcontroller,public modalctrl: modalcontroller) {

android - using startsWith and replaceFirst not working for me. -

i print phone contacts in android monitor code below. phone number begins 00 want change 00 + . not working. can tell me wrong please ? protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); contentresolver cr = getcontentresolver(); cursor cur = cr.query(contactscontract.contacts.content_uri, null, null, null, null); if (cur.getcount() > 0) { while (cur.movetonext()) { string id = cur.getstring( cur.getcolumnindex(contactscontract.contacts._id)); string name = cur.getstring(cur.getcolumnindex( contactscontract.contacts.display_name)); if (cur.getint(cur.getcolumnindex( contactscontract.contacts.has_phone_number)) > 0) { cursor pcur = cr.query( contactscontract.comm

optimization - SQL SERVER 2012, 10 Million Rows, Match Multiple Fields In Same Table To Get Results -

have 10 million records in temporary table called #temp . columns are primarykey, field1, field2, fields3, field4, field5, field6, datefield where primarykey in numeric while other fields varchar except datefield. now want duplicate records table in format. isduplicate, primarykey1, primarykey2, datefield1, datefield2 currently, following query running it's taking very long time execute. data (select d.field1 key1, d.* #temp d d.field1 not null union select d.field2 key1, d.* #temp d d.field2 not null union select d.field3 key1, d.* #temp d d.field3 not null union select d.field4 key1, d.* #temp d d.field4 not null union select d.field5 key1, d.* #temp d d.field5 not null ) select distinct isduplicate, pk1, pk2, date1, date2 ( select case when case when t1.field1 = t2.field1 , t1.field1 not null , t1.field1 != ' ' 1 else 0 end+case when t1.field2 = t2.field2 , t1.field2 not null , t1.field2 != '' 1 else 0 end+case when t1.field3 = t2.field3 ,

angularjs - Angular 2 this.generateTree is not a function -

i have 2 functions in component. onelementclick binded element in html. every time click on element, get: this.showhalo not function why case? showhalo(view, opt) { // code } onelementclick(view) { // code function click() { this.showhalo(view, { animation: true }); } } i tried this, same thing. myfunc(){ console.log("test"); } onelementclick(view) { self = this; self.myfunc(); } correct this pointer. : showhalo(view, opt) { // code } onelementclick(view) { // code var _this = this; function click() { _this.showhalo(view, { animation: true }); } }

floating point - Handling large numbers and precision of Ricean Fading PDF python -

i'm trying calculate ricean fading pdf using following equation. ricean fading pdf . 'y' normalized envelope , 'gamma' snr if k value large, math.exp(-((1.+_gamma)*pow(_y,2.) + _gamma)) exp results in big floating point (e.q. 1.01e-5088). in python shows '0.0' value mpmath.besseli(0,2. * _y * np.sqrt(_gamma * (1. + _gamma))) the value of bessel function shows big int value (e.q. 7.78e+5092). in python shows '**inf**' value how can store big integer , floating point value in python , calculate pdf? def rice_pdf(self, _y, _gamma): return 2. * _y * (1. + _gamma) * math.exp(-((1.+_gamma)*pow(_y,2.) + _gamma)) * special.i0(2. * _y * np.sqrt(_gamma * (1. + _gamma))) thanks. if have way compute logarithm of bessel function, can avoid multiplication of large , small numbers transforming summation subsequent exonentiation, should solve numerical problems (exploit fact exp(a) * exp(b) == exp(a + b) ). def rice_pdf(_y, _gamma)

How to detect what changed in array in Ember.js? -

i'm on ember 2.12. i have array selecteddays: [object] in controller passed component. component has array monthdays: [object] . objects in component need have selected property set if can found in array controller. the problem comparing objects costly, based on moment library method ( moment1.issame(moment2, 'day') ). right when add selecteddays array, every object in monthdays needs compared every object in selecteddays . can hundreds or thousands of costly comparisons. the monthdays have 42 length (6 weeks) selecteddays can tens or hundreds. i wonder possible optimize without bruteforce custom sorting/finding optimization. the simplest solution be: on controller array change, check changed , modify 1 day matches change. far know: you can't send action controller component array observers don't "know" changed in array (?) what other options have? i set ember twiddle there's visible 200-300ms delay every time click day bef

javascript - Share with custom content on facebook like Spotifty -

Image
i want create spotify post when sharing via spotify app. possible or partner facebook can create type of post?

javascript - Testing the Web API by comparing the response with that of WCF -

i have owin hosted web api servicing odata v4 endpoint integrated windows authentication . solution has tested wcf odata v1,v2,v3 endpoints. 60% of endpoints give same results of wcf on changing url /v3 /v4. since wcf endpoints already tested , thought of comparing endpoint's response of wcf. is right way go? on server side have used specifying auth scheme: listener.authenticationschemes = authenticationschemes.integratedwindowsauthentication; i'm thinking of using javascript purpose login chrome , capture token. paste token in js file. attach authorization: negotiate token header every request. query both /v3 , /v4 , obtain response in either json or xml , compare. will same token valid in js?

ios - Determining the position of the end of the last line in UILabel -

Image
this question has answer here: how embed small icon in uilabel 13 answers the solution below works correctly names fit on 1 line cell.accessorytitlelabel.text = data.title cell.accessorytitlelabel.sizetofit() cell.discounticon.frame.origin.x = cell.accessorytitlelabel.frame.maxx + 7 cell.discounticon.hidden = discount == 0 but need put discount icon @ end of last line: the best way insert image directly on label nstextattachment , resizing image per requirement , in way don't have calculate spacing , width. swift 3 solution var img_attachment = nstextattachment() img_attachment.image = uiimage(named: "name_of_image") img_attachment.bounds = cgrect(x: cgfloat(0), y: cgfloat(0), width: cgfloat(imgwidth), height:cgfloat(imgheight)) // can specify size , bounds of discount image var attributedstring = nsa

How can I pass the argument to docker-compose.yml using shell file -

i have docker-compose.yml follows: version: '2' services: eureka-server: image: some-dtr-name/some-orgname/some-reponame:some-versionname mem_limit: somememory environment: spring_profiles_active: some-profile java_opts: -xms256m -xmx512m ports: - "some-port:some-port" restart: networks: - cloud networks: cloud: driver: bridge i want pass some-dtr-name,some-orgname,some-reponame,some-versionname,somememory,some-profile,some-profile,some-port aurgument docker-compose file. doing task using shell file. #!/bin/bash some-dtr-name="$1" some-orgname="$2" some-reponame="$3" some-versionname="$4" somememory="$5" some-profile="$6" some-profile="$7" some-port="$8" docker-compose how can task ?? docker compose supports environment variable substitution, using ${} syntax: https://docs.docker.com/compose/compose-file/#variable-

c# - WPF MVVM DataGrid filtering using ComboBox -

i have wpf mvvm application datagrid , combobox binded same list of entities in viewmodel class. want filter datagrid entries through combobox selection, proper way this? since i'm working mvvm, want achieve data bindings, , avoid useless code behind. my xaml code following <datagrid itemssource="{binding posts}" autogeneratecolumns="false" isreadonly="true"> <datagrid.columns> <datagridtextcolumn header="id" binding="{binding id}" /> <datagridtextcolumn header="title" binding="{binding title}" /> <datagridtextcolumn header="blogurl" binding="{binding blog.url}" /> </datagrid.columns> </datagrid> <combobox itemssource="{binding posts}" displaymemberpath="blog.url" /> viewmodel public class mainwindowviewmodel { private sqlitedbcontext context; public list<post> posts

ajax - Error while Image upload in javascript -

i trying upload image on reader.onloadend() getting error: uncaught typeerror: illegal invocation @ function.n.param (jquery.min.js:4) @ filereader.reader.onloadend (bundle.js:3513) code: previewfile(e){ var previewimage = self.root.queryselector("#previewimage"); var file = self.root.queryselector('input[type=file]').files[0]; var reader = new filereader(); if(file){ reader.readasdataurl(file); } else { previewimage.src = ""; } reader.onloadend = function(){ var blob = self.b64toblob(reader.result.split('base64,')[1]); var bloburl = url.createobjecturl(blob); previewimage.src = bloburl; var data = { post_id: e.target.dataset.id, imageblob: blob, imageurl : bloburl, imagename: file.name } $.ajax({ url: '/uploadimage', type: 'post', data

java - How to set Google map on max zoom level to 30 in Android? -

Image
let me tell start doesn't work: mmap.setmaxzoompreference(30.0f); i know google maps doesn't allow zoom above 21 saw in javascript can add new maptype , set max zoom level 30 or whatever want. https://developers.google.com/maps/documentation/javascript/examples/maptype-overlay i find link java add new tile dont understand how use adding new map type , set max zoom: google maps api v2 draw part of circle on mapfragment how set google map on max zoom level 30 in android? yes, maybe reason android sdk on v2 not have same feature set (yet) js sdk. but maybe there way or hack something. there other solution? looking @ android docs: https://developers.google.com/android/reference/com/google/android/gms/maps/cameraupdatefactory it states: "the desired zoom level, in range of 2.0 21.0. values below range set 2.0, , values above set 21.0. increase value zoom in. not areas have tiles @ largest zoom levels." i believe reason can in javascript beca

bash - Composer installs a package not present in .json file -

i using laravel 5.4 composer , when try install requirement bash tells me: package illuminate/html abandoned, should avoid using it. use laravelcollective/html instead. which ok, illuminate/html abandoned , replaced laravelcollective/html package in composer.json file, included in following code snippet, problem though illuminate/html not present in composer.json file, installed when issue composer update command in console. new laravel fw, managed remove illuminate/html aliases , providers arrays in config/app.php file. tried several times manually removing illuminate/html folder vendor directory, succeeded, new composer update returns... how can delete package , ensure, wont install next time add new package composer? ps: not sure whether has problem, had problem post-update-cmd, replaced previous "php artisan optimize" "php customisan.php", customisan.php clear folder bootstrap/cache , of content. { "name": "laravel/laravel&qu

jquery - ValidationMessageFor printing default message and not the custom one -

i trying print custom message through mvc model using jquery validation still printing default message , not 1 have specified code: model public class task_runsmodel //user use add tasks , comments { public int task_run_id { get; set; } [required(errormessage = "you can't leave empty.", allowemptystrings = false)] public int project_id { get; set; } public string start_time { get; set; } public string end_time { get; set; } public int dead { get; set; } [required(errormessage = "you can't leave empty.", allowemptystrings = false)] [range(0, int.maxvalue, errormessage = "you can't leave empty.")] public int task_id { get; set; } public int active { get; set; } public datetime timestamp_dtm { get; set; } public int userid { get; set; } [required(errormessage = "you can't leave empty.", allowemptystrings = false)] public string status { get;

jsf - How to use a default generated ID in a Facelet tag -

i've created custom facelet tag . id fall default j_idtxxx if have left out entire id attribute when not set in xhtml. so, <my:tag id="fiets"/> rendered <span id="fiets"/> . but, <my:tag/> should rendered <span id="j_idtxxx"/> . if use <h:anytag id="#{id}"/> in tag file, fails on empty id attribute. there way rendered default generated id? create like: <c:set var="id" value="#{empty id ? use_default : id}" /> but don't know use @ use_default . the functionality available uiviewroot#createuniqueid() . current uiviewroot instance in el available implicit object #{view} . so, should do: <c:set var="id" value="#{empty id ? view.createuniqueid() : id}" />

ubuntu - How can I get volume level (or dB) of microphone input with alsa API? -

i can command line : arecord -vv , need finish code , don't known api can make . arecord looks @ captured samples (it uses maximum in interval). you can same yourself. need know level full-scale sample corresponds to. also see detect silence when recording .

logstash on docker: set multiple pipeline -

i using this elastic search stack on docker. want able run multiple logstash instance since logstash instance does not support multiple pipeline how that? possible run multiple instance in same docker container? thanks!

sql - Full Outer Join returning too many rows -

what i'm trying achieve data set have set of holdings data against benchmark , show holdings either on or off benchmark. data set should this: positiondate portfoliocode benchmark securitydesciption portfolioweight benchmarkweight 2017-03-31 port1 jpm sec1 1.00 1.5 2017-03-31 port1 jpm sec2 0.54 null 2017-03-31 port1 jpm sec3 null 0.5 my sql looks following full outer join can return weights both portfolio data , benchmark data depending on whether portfolio holds or not: select lt.positiondate positiondate , lt.portfoliocode portfoliocode , gpi.indx_desc benchmark , i.iss_desc

ruby on rails - follow and following with status -

i'm working on follow , following functionality of article https://www.railstutorial.org/book/following_users it's working fine added column name status boolean present follow request has been accepted. current_user.following return relations of current_user need users relationship status true. code totally same mention article , added status column in relationship table. kindly me i don't know original code, intuitively should work current_user.following.where(status: true)

r - Adding rows after specific timestamp -

short story: - while doing analysis, forgot account inter-day , inter-week values. need add them table. long story: have table: library(tidyverse) library(lubridate) df<-structure(list(time = structure(c(1488987000, 1488988800, 1488990600, 1488992400, 1488994200, 1488996000, 1488997800, 1488999600, 1489001400, 1489003200, 1489005000, 1489006800, 1489069800, 1489071600, 1489073400, 1489075200, 1489077000, 1489078800, 1489080600, 1489082400, 1489084200, 1489086000, 1489087800, 1489089600, 1489091400, 1489093200, 1489156200, 1489158000, 1489159800, 1489161600, 1489163400, 1489165200, 1489167000, 1489168800, 1489170600, 1489172400, 1489174200, 1489176000, 1489177800, 1489179600, 1489411800, 1489413600, 14894154

ruby on rails - Are you allowed to use a find_each query with an includes statement? -

example: foobar.joins(:baz).includes(:baz).count => 22926 foobar.joins(:baz).includes(:baz).find_each.count => 998 foobar.joins(:baz).find_each.count => 22926 the generated sql in correct case (third) several batches of sql looks like: select "foobar".* "foobar" inner join "baz" on "baz"."foobar_id" = "foobar"."id" order "foobar"."id" asc limit $1 in failing (second) case there single query looks like: select "foobar"."id" t0_r0 "baz"."id" t1_r0 "baz"."foobar_id" t1_r1 "foobar" inner join "baz" on "baz"."foobar_id" = "foobar"."id" order "foobar"."id" asc limit $1 where of fields listed different temporary variable (e.g. t0_r0 ) different columns on each table (in actual query there 37 split 30 on first object, 7 on second). i

PHP MongoDB: Fatal error: Class 'MongoClient' not found -

Image
when executing following php code: $m = new mongoclient("mongodb://localhost:27017"); i following error: fatal error: class 'mongoclient' not found in (...) mongodb extension seems installed (i copied php_mongodb.dll ext folder , updated php.ini). php seems confirm extension running following code confirms loaded: echo extension_loaded("mongodb") ? "loaded\n" : "not loaded\n"; also, phpinfo() shows mongodb extension has been loaded. update problem still not solved. phpinfo() shows driver loaded: but still receive same fatal error. tl; dr the class mongoclient part of legacy pecl package mongo not anymore of up-to-date mogodb package. on mongodb php driver github repo, release note version 1.0.0, suggesting developers use mongodb\driver\manager instead of mongoclient changes our legacy mongo extension most significantly, legacy driver's mongoclient, mongodb, , mongocollect

python - Can't add title to pie chart (matplotlib) -

plt.title('survival rate') plt.pie(total_survival, labels=[str(survival_percent) + "% " + "survived", str(100- survival_percent) + "% " + "died"]) i trying add title pie chart getting error: --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-250-7e0f3cd8c625> in <module>() ----> 1 plt.title('survival rate') 2 plt.pie(total_survival, labels=[str(survival_percent) + "% " + "survived", str(100- survival_percent) + "% " + "died"]) 3 typeerror: 'str' object not callable all resources have seen online write title string within parentheses , don't include argument in plt.pie() i'm not sure going wrong. the following code works fine: import matplotlib.pyplot plt survival_percent = 67 total_survival = [67,33] plt.title('su

java - Get Values from List and insert into String -

i have string need place values list,but when loop list 1 value @ iteration. public class test2 { public static void main(string[] args) throws parseexception, jsonexception { list<string> value=new arraylist<string>(); value.add("ram"); value.add("26"); value.add("india"); for(int i=0;i<value.size();i++){ string template="my name "+value.get(i) +" age "+value.get(i)+" country is"+value.get(i); system.out.println(value.get(i)); } o/p should this: string ="my name +"+ram +"age "+26+"country is"+india; } } what's happening in each iteration you're taking i-th element of list , you're placing in positions of string template. as @javaguy says, there's no need use for loop if have 3 items in list, , solution use string.format : string template = "my name %s age %s c

jquery - how to upload large files using chunk method using vue.js & laraval? -

uploading file using html5 file reader & read file , upload in laraval please follow url answer, https://github.com/githubgobi/fileupload-using-chunk-method

javascript - how to set proxy in casperjs code -

here options try none of them work me there way change proxy before hit particular website ? var casper = require("casper").create({ setproxy: "proxy here", // --proxy: "proxy here", websecurityenabled: false, verbose: true, loglevel: "debug", waittimeout: 100000, pagesettings: { useragent: "mozilla/5.0 (windows nt 6.3; wow64; rv:52.0) gecko/20100101 firefox/52.0", proxy: 'proxy here' }}); var url = 'http://whatismyipaddress.com/'; var fs = require('fs'); var path = 'ip_check.txt'; casper.start(url, function() { casper.cli.options["proxy"] = "proxy here"; var js = this.evaluate(function() { return document; }); fs.write(path,js.all[0].outerhtml,'w'); }); casper.run(); you can send proxy argument this casperjs --proxy="switchproxy.proxify.net:7498" xyz.js

tv - How to debug TVHeadend "scan no data, failed" -

i have compiled driver geniatech t230c dvb-t2 usb receiver according https://www.linuxtv.org/wiki/index.php/geniatech_t230c , seems work. when try scan channels tvheadend 4.0.8 on raspbian jessie system tvheadend reports: : 2017-04-06 02:22:34.000 mpegts: 706mhz in dvb-t2 - scan no data, failed 2017-04-06 02:22:34.000 subscription: 01fc: "scan" unsubscribing 2017-04-06 02:22:44.000 mpegts: 546mhz in dvb-t2 - tuning on silicon labs si2168 : dvb-t #0 2017-04-06 02:22:44.000 subscription: 01fe: "scan" subscribing mux "546mhz", weight: 2, adapter: "silicon labs si2168 : dvb-t #0", network: "dvb-t2", service: "raw pid subscription" comet failure [e=this.el.dom undefined] 2017-04-06 02:22:49.000 mpegts: 546mhz in dvb-t2 - scan no data, failed 2017-04-06 02:22:49.000 subscription: 01fe: "scan" unsubscribing : only 3 sd channels no hd channels found. http://www.dvbviewer.com/de/ receive hd channels in quality on wi

postgresql - How to combine multiple sql queries into single query? -

i working on spring boot framework postgressql. below example queries 1,2,...n. these queries working fine. have combine these queries single query because table having huge data can not run query multiple times(in loop) due performance issue. not getting idea combine these query. 1. select product_name, count(*) products product_name='pro_a1' , price between 20 , 30 group product_name; 2. select product_name, count(*) products product_name='pro_b1' , price between 50 , 70 group product_name; i want combine above queries 1 below unable achieve. select product_name, count(*) products product_name in("pro_a1", "pro_b1", ...) , price between (20,30) , (50,70) , on. group product_name; any idea task. beginner level developer in spring , hibernate world. please suggest solution or helpful link. thanks in advance you can use conditional aggregation. select product_name ,count(case when product_name='pro_a1' , price between