Posts

Showing posts from June, 2014

javascript - How to sort an array of objects in the order of another array containing the unique values of a property present in each object? -

i have have 2 arrays, want merge them 1 object. have given examples of have , want achieve. tried _.union , few other underscore methods. var original = [ { country: 'us', value: '10' }, { country: 'turkey', value: '5' } ]; var newlist =["afghanistan", "antarctica","turkey"] the results want: var results= [ { country: 'afghanistan', value: '0' }, { country: 'antarctica', value: '0' }, { country: 'turkey', value: '5' } ]; the not appear in final results because newlist doesn't have us. values new list appear in results values original list. a non-underscore solution, .map() s new array, returning object original array if can .find() it, otherwise returning new object: var original = [ { country: 'us', value: '10' }, { country: 'turkey', value: '5' }

android - ListView in ArrayAdapter order get's mixed up when scrolling -

i have listview in custom arrayadapter displays icon imageview , textview in each row. when make list long enough let scroll through it, order starts out right, when start scroll down, of earlier entries start re-appearing. if scroll up, old order changes. doing repeatedly causes entire list order seemingly random. scrolling list either causing child order change, or drawing not refreshing correctly. what cause happen? need order items displayed user same order added arraylist, or @ least remain in 1 static order. if need provide more detailed information, please let me know. appreciated. thanks. i having similar issues, when clicking item in custom list, items on screen reverse in sequence. if clicked again, they'd reverse originally. after reading this, checked code overload getview method. getting view convertedview, , if null, that's when i'd build stuff. however, after placing breakpoint, found calling method on every click , on subsequent cl

java - Queue copy constructor -

i'm not sure if there wrong copy constructor queue (dsqueue) or if there reason problem. copy constructor seems copy contents fine if try manipulate queue copied, program fails. i've done testing in queue's main method (see below) , i've run through debugger. ide points out nullpointerexception when try change queue in line testq.list.add(new token(1)); in main method. line gets token fine doesn't begin add method. not sure why... public class dsqueue extends queue { public static void main(string[] args) { dsqueue testq = new dsqueue(); system.out.println("size of testqueue: " + testq.thequeue.size()); testq.offer(new token(100)); testq.offer(new token(200)); system.out.println("size of testqueue after adding: " + testq.thequeue.size()); system.out.println("\ntestqueue: " + testq); // teting copy constructor dsqueue newq = new dsqueue(testq); syste

sql server - Bulk insert using loop -

i have been trying insert 500 records table ( dbo.product ) getting error: msg 102, level 15, state 1, line 31 incorrect syntax near 'p' here query: declare @startloop int, @endloop int, @productid int, @productname nvarchar(250), @bestbefore datetime, @manufacturedate datetime, @productnumber nvarchar(25), @weight decimal, @productstocklevelid int select @startloop =1, @endloop = 500, @productid = '', @productname = 'yoghurt', @bestbefore = '', @manufacturedate = '' , @productnumber = '', @weight = '', @productstocklevelid = '' while @startloop <= @endloop begin insert dbo.product p (productid, productname, bestbefore, manufacturedate, productnumber, [weight], productstocklevelid) select @productid + cast(@startloop int), @productname + cast(@startloop nvarch

ios - ReactiveCocoa: why subscriber has "sendNext" method rather "receiveNext" method -

i'm learning reactivecocoa , understand racsignal must subscribed racsubscriber signal send event. clear racsignal send event racsubscriber , racsubscriber receive event racsignal . however, when customize own racsignal following code: racsignal *racsignal = [racsignal createsignal:^racdisposable* (id<racsubscriber> subscriber) { //why subsriber "sendnext" not "receivenext"? [subscriber sendnext:@100]; return nil; }]; the racsubscriber protocol has sendnext method confuses me because method name of receivenext should more appropriate understanding. can body me clarify that? technically, object implementing racsubscriber protocol doesn't consume events, forwards them subscribers. in case there one, great thing racsignal can observed different objects , threads. so right naming of racsubscriber might bit misleading, wouldn't put attention on that, documentation say: you shouldn't need implement p

matlab - Complexity of recursive least squares (RLS) algorithm -

Image
which operation(s) make complexity of recursive least squares (rls) algorithm equal o(n^2) , why? % filter parameters p = 4; % filter order lambda = 1.0; % forgetting factor laminv = 1/lambda; delta = 1.0; % initialization parameter w = zeros(p,1); % filter coefficients p = delta*eye(p); % inverse correlation matrix e = x*0; % error signal m = p:length(x) % acquire chunk of data y = n(m:-1:m-p+1); % error signal equation e(m) = x(m)-w'*y; pi = p*y; % parameters efficiency % filter gain vector update k = (pi)/(lambda+y'*pi); p = (p - k*y'*p)*laminv; % inverse correlation matrix update w = w + k*e(m); % filter coefficients adaption end full code this paper has great explanation, here relevant section in image:

Maknig solid/Surface from lines imported to blender -

Image
i have a series vertical ring type , open ring rings depicting boundaries of geological formation. want connect them make solid them. how can this? managed import lines blender already.

java - Better design approach for having a variable in a class not present in Database -

say have class: class x { private int a; private int b; private int c; } id & d list well. list<x> result = getresult(id, d); now while processing result, have d well. 1 way can think of adding variable d in class x, , make getresult keep appending d. getresult(id, d) { foreach id { x x = databasecall(id); x.d = d; result.add(x); } return result; } the drawback approach class x no longer has values based on columns in db. there better way? just add @transient annotation on field should not been persisted.

makefile - C++ make specific target -

i want make specific executable file designate target. create sample project below ./main_a.cpp ./main_b.cpp ./include ./include/fun.h ./src ./src/fun.cpp ./makefile main_a.cpp #include "fun.h" #include <stdio.h> int main(int argc, char **argv) { fun(); printf("aaa\n"); } main_b.cpp #include "fun.h" #include <stdio.h> int main(int argc, char **argv) { fun(); printf("bbb\n"); } fun.h #include <stdio.h> extern void fun(); fun.cpp #include "fun.h" void fun() { printf("test "); } the content of makefile listed blow objdir := obj/ srcdir := obj/src cxx_include = -i. -i ./include cxx_srcs := $(shell find src/ -name "*.cpp") cxx_objs = $(addprefix $(objdir), ${cxx_srcs:.cpp=.o}) exe_aa = main_a exe_bb = main_b aa: $(objdir) aa: $(srcdir) aa: cxx_srcs += main_a.cpp # take main_a.cpp main aa: $(exe_aa) bb: $(objdir) bb: $(srcdir) bb: cxx_srcs += main

CSV File in Python -

i want read , fetch data 2 csv files in python program parallel. 1 csv file has 1 column , other csv file has 5 columns. getting error while reading 1 column csv file "stopiterator" error. i not sure whether both csv file has same number of row or not. so can't use single loop , want match data row row , note down output. so please guide me in this. i using python2 version not 3.

Submit button not working using html form and php with EasyPHP version 14.1 as pc web server emulation environment -

i using easyphp devserver version 14.1. program, if not familar, emulates webserver on pc. supposed able support php scripts. have created sample html file has radio buttons , submit button. have php script. when load html file in local projects section of easyphp(where html , php files go loaded in php environment) fill in radio buttons , hit submit , nothing happens. can see either there error in html, in php file, or strange going on easyphp. here html(grade1.html): <html> <form> <form action="nn.php" method="post"> why don't play poker in jungle?<br> <input type="radio" name="jungle" value="treefrog"> many tree frogs<br> <input type="radio" name="jungle" value="cheetah"> many cheetahs.<br> <input type="radio" name="jungle" value="river"> many rivers.<br>< color sun??<br&g

mysql - YII2 - Handle NULL value in gridView- Display a column of foreign keys where some may be NULL -

in brief, have table machines, has fk pointing subcategory.id relation correctly setup gii. however, fk column in machine can set null action field not compulsory. [ 'attribute'=>'machine sub-category', 'value' => function ($model) { return $model->subcategory->subcat_name; }, ], above code displays subcategory name when fk not null. if fk null, php error: trying property of non-object i understand error because of null value. ( because don't error if add value instead of null) so query - fk column may have null values, how them display in gridview or detailview? you can check if subcategory null [ 'attribute'=>'machine sub-category', 'value' => function ($model) { if (isset($model->subcategory)){ return $model->subcategory->subcat_name; } else { return ''; } }, ],

css - My <a href> won't work -

this first class in web developing , can't <a href> links separate chapters work. below code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>alice's adventure in wonderland</title> <img src="alice_1" alt="" > <link rel="stylesheet" href="main1.css"> </head> <body> <div id="container"> <section id="header"> <img src="alice_1.jpg" alt="alice_1" height="100"> <h2>alice's adventures in wonderland</h2> <h1>lewis carroll</h1> </section> <nav id="nav_bar"> <ul> <li><a href="index1.html" ></a>chapter i</li> <li><a href="index2.html"&

css - HTML: Div is not in align? -

Image
hello used bootstrap , 2 div col-md-6 , col-md-6 not in align in height. use css first div. div.col-md-6 { display: inline-block; vertical-align:middle; }

java 8 - How to express the code with lambda? -

i want convert list map public map<integer, a> tomap(list<a> list) { map<integer, a> map = new hashmap<>(); int sum = 0; (int = 0; < list.size(); i++) { if (list.get(i).getkey() != 0) { sum += math.abs(list.get(i).getkey()); map.put(sum, list.get(i)); } } return map; } how express lambda? maybe using foreach more effectively. not have convert stream when violate kiss , for , foreach , while loop not dead. giving stream code later bit more big. foreach public map<integer, a> tomap(list<a> list) { map<integer, a> map = new hashmap<>(); int prevkey = 0; (a item : list) { int key = item.getkey(); if (key != 0) { map.put(prevkey += math.abs(key), item); } } return map; } combine foreach & stream or maybe need combine foreach & stream describe doing 2 things filtering & mapping . p

javascript - How to run Angular 2 app on docker machine? -

Image
i have deployed simple angular 2 app created using angular-cli,after building docker image i'm running on virtual box container app running on container , exposed port if tried access url,getting site can't reached. below dockerfile from node:boron # create app directory run mkdir -p /usr/src/app workdir /usr/src/app # install app dependencies copy package.json /usr/src/app/ run npm install # bundle app source copy . /usr/src/app expose 5655 cmd [ "npm","start" ] package.json { "name": "baconv1", "scripts": { "ng": "ng", "start": "ng serve -h 0.0.0.0" .... .... } even in package.json tried 2 ways setting start "ng serve" , "ng serve -h 0.0.0.0" i checked twice app running on container machine console kinematic even after expose default angular port 4200 not worked!!! please me correcting need change config in docke

java - JComboBox to display multiple lines of text -

i'm writing small tool sending sql queries database , recieving according data. now problem: want allow user enter new search query or select "latest" list, last few queries saved. that, planned on using editable jcombobox, i'm having trouble diplaying multiple lines of text in box itself. the reason want that, because sql queries can quite long , since want make box editable , @ same time keep frame clean. i've found ways display multiple lines in dropdown menu, nothing box itself. thank in advance , please forgive me if overlooked simple ;) greetings zeus extended editing functionality supplied comboboxeditor , allows define actual component used combobox's editor based on requirements, you're going need (at least) jtextarea , provide (optionally) word wrapping , multiple lines a rough , ready example might this... public class textareacomboboxeditor implements comboboxeditor { private jtextarea ta = new jtextarea(4, 20)

dictionary - How to check if a map contains a key in go? -

i know can iterate on map m by, for k, v := range m { ... } and key there more efficient way of testing key's existence in map? thanks. couldn't find answer in language spec . one line answer: if val, ok := dict["foo"]; ok { //do here } explanation: if statements in go can include both condition , initialization statement. example above uses both: initializes 2 variables - val receive either value of "foo" map or "zero value" (in case empty string) , ok receive bool set true if "foo" present in map evaluates ok , true if "foo" in map if "foo" indeed present in map, body of if statement executed , val local scope.

typescript - Dynamic ion-tabs in ionic 2 using ngFor -

i using ionic 2 application, want dynamic tabs in application, not able that html <ion-tabs #maintabs [selectedindex]="myselectedindex"> <ion-tab *ngfor="let circle of circles" [tabroot]="gotomemberlistpage(circle)" title="{{circle.name}}"></ion-tab>\ </ion-tabs> typescript gotomemberlistpage(circle) { this.navctrl.push(memberlistpage, circle); } i don't know whether full or not following below snippet can pass dynamic tabs using ionic 2 , typescript tabs.html <ion-tabs> <ion-tab *ngfor="let tab of tabs" [root]="tab.root" [tabtitle]="tab.title" [tabicon]="tab.icon"></ion-tab> </ion-tabs> tabs.ts import { component } '@angular/core'; import { navcontroller } 'ionic-angular'; import { aboutpage } '../about/about'; import { contactpage } '../contact/contact'; import { homepage } '../hom

vba - Dynamically Sorting Lists Alphabetically in Excel -

i having difficulties macros in excel. have built call logger in workbook containing 2 macros: macro moves data worksheet worksheet b; macro b automatically sorts data 1 column in descending alphabetical order. however, can't both macros work @ same time. both work individually when try implement 1 macro workbook containing other seem cancel each other out. going wrong? there way of possibly combining 2 macros, example? macros below. macro a: sub macro6() ' macro6 macro application.screenupdating = false sheets("logger").select range("b4:i4").select selection.copy sheets("data").select range("b4").select lmaxrows = cells(rows.count, "b").end(xlup).row range("b" & lmaxrows + 1).select activesheet.paste application.cutcopymode = false sheets("logger").select range("b4:i4").select selection.clearcontents end sub macro b: p

swift - Change UIImage color without using Uiimageview in swift3 -

i want draw image pattern star, 1 can change color that. can change color of image without using image view? saw many answer changing tint color of uiimageview, effect not applied uiimage tintcolor not property of uiimageview , property of uiview , long image in uiview, can use uiview.tintcolor .

azureservicebus - Azure Service Bus topic: how enable concurrent readers? -

background i'm using azure service bus. inside namespace, have topic active subscription. have producer pushing messages topic, , have n numbers of services subscribing the same subscription (for scalability reasons). these services using peeklock() fetch messages, performing work on them , releasing message lock through complete() once work has finished. problem whenever service has message locked, no new services seem able fetch messages same topic/subscription. seems if whole topic locked, not message has lock on itself. the actual problem have services sitting around doing nothing waiting service active peeklock() finished. questions is there way enable concurrent readers (or concurrent locks) in topic (and subscription) or queue? the (for me unwanted) scenario explain above - consequence of sort of guarantee deliver messages in order recieved? code snippet: csharp public static void main(...) { // configure options onmessageoptions messageoptions

algorithm - Finding out the reason of delay between request and response time using apache spark mllib -

i have different log files app logs, system log files, database log files etc. when user request data user gets response late. calculating difference between request , response time , need predict on parameter these log files(app log, system log files, database log files) delay depends. which spark machine learning algorithm give best result predict variable causes delay between request , response time?? it may 1 or more variables. before getting stuck ml algrorithms, quick scatter plot of variables vs delay - might find answer quickly. failing that, need use kind of regression approach. without knowing of details, tricky suggest how construct solution.

linux - Bash: How to build a recursive cowsay -

Image
here's linux command (you might need cowsay application. cowsay 'moo' here's command: cowsay 'moo' | cowsay -n the result pretty entertaining: ______________________________ / _____ \ | < moo > | | ----- | | \ ^__^ | | \ (oo)\_______ | | (__)\ )\/\ | | ||----w | | \ || || / ------------------------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || now, of course, it's pretty fun repeat piped command n times. looks little this: cowsay 'moo' | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n | cowsay -n but i'm thinking there must neater way of achieving this. let's want 500 cows saying each other, or 1,000,

osx - iOS app as a remote to macOS app -

i'm looking way of remotely controlling macos app ios app. write both applications , want way of direct communication between them, wouldn't have rely on external. for example, apple's keynote app has - can use ios device remote macos presentation switch between slides etc. i wonder can used sort of communication. want ios app thin , send notifications macos app should perform. , want work if don't have internet connection. one possibility bonjour , idk if can work described, have no previous experience technology.

How to fill number of remaining character in string using SQL Server -

currently have following query add remaining leading character in string print replace(str('9009',8),' ','x') output xxxx9009 i need output 9009xxxx please there builtin function available in sql server 2008 you can use substring: declare @s varchar(30) set @s = 'xxxx9009'; select substring (@s ,5 , 4) + substring (@s ,1 , 4) result: 9009xxxx

Spark on Mesos RpcEndpointNotFoundException -

i cannot launch spark job on mesos, when starts automatically gives error: "caused by: org.apache.spark.rpc.rpcendpointnotfoundexception: cannot find endpoint: spark://coarsegrainedscheduler@10.32.8.178:59737" could because of mismatch between versions? if launch example brought distribution works perfectly. thanks works now. application fault did not put correctly data input path. in mesos have 2 options deploy, cluster mode or client mode. chose cluster mode , have spark daemon (mesosclusterdispatcher) listening spark jobs, why use mesos://spark-mesos-dispatcher.marathon.mesos:7077 thanks jacek!

angular - TSLINT config : exclude external modules -

i'm using angular2 webpack starter tslint configured on it. i use ngx-datables (directory @swimlane directly in node_modules). i have plenty of warnings : @ ./~/@swimlane/ngx-datatable/src/utils/index.ts 14:0-32 @ ./~/@swimlane/ngx-datatable/src/components/datatable.component.ts @ ./~/@swimlane/ngx-datatable/src/components/index.ts @ ./~/@swimlane/ngx-datatable/src/index.ts @ ./src/app/adherent/list/adherent-list.component.ts @ ./src/app/adherent/list/index.ts @ ./src/app/adherent/index.ts @ ./src/app/app.module.ts @ ./src/app/index.ts @ ./src/main.browser.ts @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts however, configs supposed done : tsconfig.json : ... "exclude": [ "node_modules", "dist" ], ... tsconfig.webpack.json : ... "exclude": [ "node_modules", "dist", "src/**/*.spec.ts", "src/**/*.e2e.ts" ], ... tsl

java - Long column size in JPA/Hibernate -

Image
@id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) @column(name = company_id , length = 10) private long id; in sql gets converted bigint(20),what if want int(11) or how give specific size long field?? you can use columndefinition inside @column() @column(columndefinition="bigint(20)")

inheritance - Avoid using child method in parent class in python -

suppose have 2 classes in python below: class parent(object): def __init__(self): self.num = 0 def fun1(self): print 'p.fun1' def fun2(self): self.fun1() print 'p.fun2' and from parent import parent class child(parent): def __init__(self): super(child,self).__init__() def fun1(self): print 'c.fun1' def fun2(self): super(child, self).fun2() print 'c.fun2' and if call fun2 of child from child import child test = child() test.fun2() i output: c.fun1 p.fun2 c.fun2 which means call of child.fun2() leads parent.fun2() . inside parent.fun2() , use self.fun1() in case interpreted child.fun1() in test. but want class parent individual , call of parent.fun2() uses parent.fun1() inside it. how can avoid this? i know can make parent.fun1() private parent.__fun1() . have instances of parent need use parent.fun1() outside class. means need

php - Woocommerce: display sale price with tax -

i want display sales price of product taxes. actually have following code show regular price taxes: <?php echo woocommerce_price($product->get_price_including_tax()); ?> but how must code sale price taxes?

react native - Is AsyncStorage permanent? -

i storing app's auth token in asyncstorage. appears both on android , ios (less sure one), after long periods of inactivity (~2 weeks), users logged out. i sure doesn't have server. is asyncstorage permanent? edit: well, that's embarrassing. problem on server, , wasn't asyncstorage's fault. from rn docs https://facebook.github.io/react-native/docs/asyncstorage.html on ios, asyncstorage backed native code stores small values in serialized dictionary , larger values in separate files. on android, asyncstorage use either rocksdb or sqlite based on available. both databases , files sound permanent me. maybe users clearing app's cache or local files somehow?

android - Refresh fragment in Tab layout on any button click -

Image
in 1 of app, using tab layout , viewpager 3 fragments. in each fragment fetching data server using java rest api. server data depend upon fragment button click. e.g. in process fragment when click on play button, card view goes completed fragment, doesn't. when refresh activity time goes, mean when activity close , start. should refresh fragment? you can try refresh fragment this: fragmenttransaction ft = getfragmentmanager().begintransaction(); ft.detach(yourfragment.this).attach(yourfragment.this).commit();

python - uuid with different languages -

on our system there's different routines different languages (mainly c++ , python) interacting on same database tables. in python, uuid1 implementation (mac+time in ns) favorite since reduce (low still present) collision risk. mac address disclosing not problem in our context. afaik, c++ implementation, boost lib instance, uuid4 equivalent (pseudo-random). given implementation between uuid4 in python , c++ (or java if introduce in future) might different, suspect increase collision risks. would mix python's uuid1 , c++/boost uuid4 ? or go uuid4 on both language ? or go uuid1 on both lib boost... p.s. proposed "duplicate question" not address question since newid , guid.comb not uuid1 nor uuid4 compliant (they mix time-based , pseudo-random bytes)

android - Recycler View Scrolling do not collapse tablayout, toolbar and ImageView -

my recycler view has 4 items , when scroll toolbar, image , tablayout should collapse. dont. when touch tablayout or imageview , scroll collapse. recyclerview collapse above mentioned view , dont. when fling dont. when scroll recyclerview collapse views. have checked many blogs , tried different scroll_flags , combination. tried setnestedscroll(true) recyclerview. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" andro

c - Seg fault occurs when copying char pointer into array of char pointers -

i reading in line of text file, , trying split on spaces strtok() , storing each token in array of char pointers using strcpy() , within function called tokenize . code: /** ** tokenizes contents of buffer words ** delimiter space character */ void tokenize(char *buffer, char *tokens[]){ char *token = null; int = 0; token = strtok(buffer, " "); while(token != null){ strcpy(tokens[i], token);//seg fault line token = strtok(null, " "); i++; } } i assumed, based on function description in k&r, call work because passed char pointer, tokens[i] should dereference to, , char pointer containing memory address of string copied, token should be. however, seg fault when try strcpy . this function called in main after line retrieved using call fgets() . buffer declared char buffer[maxline_len - 1] gives size of 100. tokens declared char *tokens[maxline_len - 1] . call tokenize in main : while(fgets(buffer, m

windows - Port is not open asap -

i re-run web application , have wait 7 seconds port being opened. i have rest service "sub-service1" & "sub-service2" working on local machine. i have service "main" uses service "sub-service1" , "sub-service2" sometimes have switch between service "sub-service1" service "sub-service2" , backwards (they're web applications , can see pid, processes) sometimes have kill "sub-service1" , run again. "sub-service1" after restart available after 7 seconds cannot accept. is there can service available run? maybe should close services in other way can close port when exiting or something? some code: private process startbigserviceprocess() { if (!processhandler.isprocessopen(processname)) { return processhandler.start(exepathofservice, filenameofservice); } else { processhandler.getprocess(processname).kil

javascript - Body does not scroll on overflow -

when add div height bigger page size, body not scroll though have added overflow:scroll . tried on overflow:auto; jsfiddle here. add height 100% #first { position: fixed; left: 0; right: 0; z-index: 0; margin-left: 20px; margin-right: 20px; overflow: auto; height:100%;/* add this*/ } https://fiddle.jshell.net/se65eqm8/3/

c++ - creating 3D histogram using 2D data (OpenCV?) -

i have data set 1 , 2. have 2d data. example, data1 : (x1, y1), (x2, y2), (x3, y3) .... (xn, yn) data2 : (x1', y1'), (x2', y2'), .... (xm', ym') i'd compare them using histogram , earth mover's distance(emd) if possible. because have 2d data, data should placed on 2d map, , height of histogram on 2d map has frequency of data, should 3d histogram guess. though success create example draw histogram , compare them using 1d data, failed try change 2d data. how works? for example, calchist(&greyimg, 1, channel_numbers, mat(), histogram1, 1, &number_bins, &channel_ranges); this code makes tha image's grayscale intensity(1d data) histogram. not change 2d data. my idea : create cv::mat data1mat, data2mat; (mat size set maximum value of x , y) then, push data1's x values mat1's first channel, push y values second channel. (same data2 , data2mat) example, (x1, y1), set data1mat.at(x1,y1)[0] = x1, data1mat.at(x1, y1)

angularjs - Setting default value in options angular -

i'm trying set default selected value in select statement: <p ng-repeat="something in somethings"> <select data-ng-options="key value (key , value) in values[$index]" ></select> </p> my values this: [{1:2,2:3},{1:2,2:3},{1:2,2:3}] note $index outside iteration loop's index. now imagine want select option 1 in 1st iteration of $index , 2 in second iteration etc. how achieve same? you need ng-model angular attribute on select control set default item. exmaple: <p ng-repeat="something in somethings"> <select ng-model="something.defaultvalue" data-ng-options="key value (key , value) in values[$index]" ></select> </p>

asp.net - Using windows authentication but getting access denied -

i created db via app-data folder, migrated on server explorer , tried connect , get cannot open database "abc" requested login. login failed. login failed user 'xyz'. came across this: [cannot open database “test” requested login. login failed. login failed user 'xyz\aspnet' i have 2 questions concerning best answer. whenever connect ssms windows authentication selected. windows authentication still matter if db created using visual studio? second concerning this: update: ok, you're using integrated windows authentication --> need create sql server login "xyz\aspnet" on sql server" what mean create sql login user "xyz"? i thought purpose of win authentication didnt have type login , pass connect. you're automatically connected through windows. right?

actionscript 3 - AS3 MOVING OBJECT ON SPECIFIC FRAME -

so i've been working on game week , dont have coding background @ im trying find tutorial here , there.. come problem ... so wanna move object (chara) right when hit frame 80 inside (chara,which nested movieclip 99 frames btw ) move original position when hit frame 99... problem doesn't make object move @ (movieclip still played btw) did wrong here? did put code @ wrong position ?? (char moved if put code x= directly inside frame 80 try using class here) here code,sorry know messy first code try best here package { public class main extends movieclip { public var chara:char = new char;//my main char public var rasen:rasen_button = new rasen_button;//the skill button public var npcs:npc = new npc;// npc public function main() { var ally:array = [265,296];//where me , ally should var jutsu:array = [330,180];// buttons should var enemy:array = [450,294];//where enemies should addchild

Why cant I see the Content-Encoding: gzip response in my c# HttpClient response header? -

i'm making simple c# program establish if server side compression available/enabled on various servers. request code below. using (var client = new httpclient()) { client.timeout = new timespan(0, 0, 5); client.defaultrequestheaders.add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); client.defaultrequestheaders.add("user-agent", "mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/48.0.2564.97 safari/537.36"); client.defaultrequestheaders.add("accept-encoding", "gzip, deflate, sdch, br"); var httpclientresponse = client.getasync(websiteurl).result; string header = httpclientresponse.headers.getvalues("content-encoding").first(); } i can see watching request in fiddler compression enabled request can't seem extract information response headers in code. these full headers request , response. get https://www.do

Getting access_token for plaid for sandbox environment running -

i trying sample public_token or access_token plaid in sandbox mode. need access_token api's auth , institutions . ran demo here , choosing bank , entering credentials user_good , pass_good . when inspected page did public_token in response. unable exchange access_token , client_id , secret got singing in dashboard . keep getting error invalid_token . how access_token ? the public_token inspecting page of demo app, client_id , secret of demo app. wont work client_id , secret. you need run demo app locally, client_id , secret. @ - https://github.com/plaid/quickstart/tree/master/node follow readme file run demo locally, client_id , secret , inspect page did above. public_token time work client_id , secret :)

mysql - Validation of password and confirm password in PHP Error shows all the time -

so trying create login form , @ part when want validate password , confirm password. code used (you can find below) shows me everytime submit register button "the password , confirm password not match" thought enter same password. idea should changed in code remove error? <?php session_start(); include('includes/config.php'); include('includes/db.php'); function isunique($email){ $query="select * users email ='$email'"; global $db; $result = $db->query($query); if($result->num_rows>0){ return false; } else return true; } if(isset($_post['register'])) { $_session['name']=$_post ['name']; $_session['email']=$_post ['email']; $_session['password']=$_post ['password']; $_session['confirm_password']=$_post ['confirm_password']; if(strlen($_post['name'])<3){ header("location:register.php?err=".urlencode ("the name must @ least

Spring MVC, Hibernate, MySQL output tables,charts -

i have project includes spring mvc, hibernate, mysql. i need: display data tables in mysql. output statistics in charts mysql. what use these tasks? if want display data db,kindly follow these steps controller.java @requestmapping(value = "/getdata", method = requestmethod.get) @responsebody public list<user> getdata(httpsession session) { list<user> userlist = userservice.getdata(); return userlist; } service.java public list<user> getdata() { return this.userdao.getdata(); } userdao.java public list<user> getdata() { session session = getsession(); list<user> userlist = session.createquery(" query fetch db").list(); system.out.println(userlist); return userlist; } this sample code.which might you. if struck anywhere can let know happy coding...!!!

delphi - How do I get encoding = "utf-8"?> in a txmldocument.xml? -

this doesn't work me in delphi xe2. var xmldoc : ixmldocument; begin xmldoc := newxmldocument; xmldoc.active := true; xmldoc.version := '1.0'; xmldoc.encoding := 'utf-8'; xmldoc.options := [donodeautoindent]; memo1.text := xmldoc.xml.text; i still not encoding="utf-8"?> in resulting doc. if xmldoc.encoding := 'utf-16'; then encoding="utf-16"?> in resulting doc. any ideas? anyone? utf-8 xml's default encoding when no encoding attribute or bom present indicate different encoding being used. underlying xml engine knows that, omit generating encoding attribute utf-8 when knows safe so. afaik, there no way force ixmldocument.xml.text or ixmldocument.savetoxml(var xml: domstring) or ixmldocument.savetoxml(var xml: widestring) generate encoding attribute utf-8. however, ixmldocument.savetoxml(var xml: utf8string) , ixmldocument.savetostream() generate encoding attribute utf-8.

Rails RSpec controller test changes second attribute -

i have controller called "crosslayerparamterscontroller". if 1 specified attribute (donor_layer) updated. want attribute (donor_material) set "0". in controller update method i'm checking if donor_layer params present , if donor_material set 0: controller file: cross_layer_parameter_controller.rb def update @stack = stack.find(params[:stack_id]) @cross_layer_parameter = crosslayerparameter.find(params[:id]) if params[:cross_layer_parameter][:donor_layer] @cross_layer_parameter.donor_material = 0 end respond_to |format| if @cross_layer_parameter.update(cross_layer_parameter_params) new_rows = render_to_string('stacks/_cross_layer_parameters.html.erb', layout: false, locals: { stack: @stack} ) id = @cross_layer_parameter.id format.html { redirect_to(@stack) } format.json { render json: { new_rows: new_rows, id: id, status: 200 } } else format.html { redirect_to edit_

4 Centered Images HTML/ CSS BOOTSTRAP -

Image
--first image desire output--- i got work on screen when put on bigger monitor doesn't seem scale right. recommendations ? <div style="margin-left: 100px;margin-right: 100px;"> <div class="container-fluid"> <div class="row"> <div class="col-sm-3"> <img src="img/nuestros eventos -1.png"> </div> <div class="col-sm-3"> <img s src="img/nuestros eventos -2.png"> </div> <div class="col-sm-3"> <img src="img/nuestros eventos -3.png"> </div> <div class="col-sm-3"> <img src="img/nuestros eventos -5.png"> </div> </div> </div> other code, centers can't rid spaces. ---this get--- <di