Posts

Showing posts from April, 2015

Filter by id in array and return only item with id, Elasticsearch 1.7 -

how filter offers array id field , return in results object searched id? current search correctly find data id in offers array returns objects it: get activities/activity/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "offers.id": "12" } } ] } } } } } current results, filter offers , "id": 12 : "hits": [ { "_index": "activities", "_type": "activity", "_id": "avtr4-uv81wmr8kfd246", "_score": null, "_source": { "offers": [ { "title": "merge", "id": 11

ASP.NET Core trace logging on Azure with Application Insights -

i have asp.net core web project deployed azure application insights configured. insights receiving data fine requests etc. unable display logs. i using vanilla microsoft.extensions.logging framework , have test error being logged on controller action as logger.logerror("test application insights message"); in startup.cs configure method have set loggerfactory.addazurewebappdiagnostics(); ... , can see error message appear in azure logs streaming: 2017-04-14 11:06:00.313 +00:00 [error] test application insights message however, want message appear in application insights trace found. think need configure iloggerfactory not sure how , can't find docs on subject. thanks in advance help case else trying resolve this, got results wanted following: loggerfactory.addapplicationinsights(app.applicationservices);

PostgreSQL searching value in inside JSON array -

i want search element inside jsonb in postgresql here json create table test select jsondata::jsonb ( values ( '{"key1": 1, "keyset": [10, 20, 30]}' ), ( '{"key1": 1, "keyset": [10, 20]}' ), ( '{"key1": 1, "keyset": [30]}' ), ( '{"key1": 1 }' ), ( '{"key1": 1, "key2": 1}' ) ) t(jsondata); in above table keyset not exist in rows , query select * test jsondata->>'keyset' = 10; above query giving empty result, , expected output is jsondata ------------------------------------ {"key1": 1, "keyset": [10, 20, 30]} {"key1": 1, "keyset": [10, 20]} what want this select jsondata @> '{"keyset": [10]}' foo; so looks this select jsondata, jsondata @> '{"keyset": [10]}' foo; jsondata | ?colum

java - I'm working on datasync service, with web api -

i working on datasync service, i'm getting json response webserver. question how pass response activity i'm calling service. you can use eventbus , send data desired activity subscribing event. for eg: compile 'org.greenrobot:eventbus:3.0.0' eventbus class public class datasyn { public final list<yourmodel> yourmodel; public datasyn(list<yourmodel> yourmodel) { this.yourmodel = yourmodel; } } send data response : eventbus.getdefault().post(new datasyn(yourdatalist)); subscribe , receive data wherever need: @override public void onstart() { super.onstart(); eventbus.getdefault().register(this); } @override public void onstop() { eventbus.getdefault().unregister(this); super.onstop(); } @subscribe(threadmode = threadmode.main) public void ondatarecevied(datasyn event) { if (event.yourmodel != null) { populatedata(event.yourmodel); } } above easiest way share data

c++11 - C++ Create objects in a try bloc then store them in a std::array -

i have player object can throw exception inside constructor, in main function i'm creating 2 player objects inside try block. want store these 2 player s in std::array that: try { player p1(10, 10, ikazuchi); player p2(70, 10, hibiki); std::array<player, 2> players = {p1, p2}; } the problem wouldn't able use array outside of try block, , heard placing main code inside try block bad idea. i can't declare std::array after try block because p1 , p2 no longer exist there. i can solve problem std::vector , have read better use std::array when know size of array during compilation. i create default constructor create objects fill them inside try block, seems more proper create in constructor. what best practice that? you can around issues using dynamic allocation or boost::optional<std::array<player, 2>> , real question is: should you? is, assume 1 of player objects fails construct , throws exception. players array after t

python - Combining excel spreadsheets using dictionaries -

i've made simple example trying merge 2 spreadsheets. aim create spreadsheet 'name of city', 'state' , 'population' 3 columns. think way use dictionaries. i've had go @ myself , have far. code data do know pandas package? you can read data excel file dataframe pandas.read_excel , merge 2 dataframes on name of city column. here's short example shows how easy merging 2 dataframes using pandas: in [1]: import pandas pd in [3]: df1 = pd.dataframe({'name of city': ['sydney', 'melbourne'], ...: 'state': ['nsw', 'vic']}) in [4]: df2 = pd.dataframe({'name of city': ['sydney', 'melbourne'], ...: 'population': [1000000, 200000]}) in [5]: result = pd.merge(df1, df2, on='name of city') in [6]: result out[6]: name of city state population 0 sydney nsw 1000000 1 melbourne vic 2

serialization - Django REST Framework, PUT/POST serializer data disappearing -

i having trouble part of data disappearing when try update or post new instance. with data this data = { 'item': 'product', 'station': 'workbench', 'ingredients':[ {'item': 'ing1', 'amount': 2}, {'item': 'ing2', 'amount':1} ] } i have serializer nested serializer get_or_creates ingredients needed. class ingredientserializer(serializers.modelserializer): class meta: model = ingredient fields = ('item', 'amount') class writeablerecipeserializer(serializers.modelserializer): item = serializers.primarykeyrelatedfield(queryset=item.objects.all()) ingredients = ingredientserializer(many=true) station = serializers.primarykeyrelatedfield(queryset=item.objects.all()) def create(self, validated_data): logger.info(validated_data) ingredient_data = validated_dat

c++ - Metaprogramming - Failed to specialize alias template -

third edit: today received email vs support stating it's know issue, has been fixed in vs2017. so, stick workaround time being. i'm working on event system , wanted use metaprogramming save on typing. here's code: struct foo { using type = int; }; struct bar { using type = char; }; template<typename... types> struct typelist {}; //this , getscript simplified, in reality involve messier templates... template<typename returntype> struct reqbuilder { using proxy = returntype(*)(void*, bool); // ... }; template<typename scripttype> using getscript = reqbuilder<scripttype>; template<typename list, template<typename> typename wrap> struct wraptypelist_impl {}; template<typename...ts, template<typename> typename wrap> struct wraptypelist_impl<typelist<ts...>, wrap> { using type = typelist<wrap< ts>...>; }; template<typename list, template<typename> typename wrap> using wrapty

c++ - I am not able store the input string from Excel into 2-dimensional string -

i not able store string excel 2-d string. #include <iostream> #include <string.h> #include <fstream> #include <sstream> using namespace std; int main() { ifstream file("input.csv"); string line,cell; string name[5][20]; string period[5][8]; string tname; int pos, = 0; while(getline(file, line)) { stringstream linestream(line); int j = 0; while(getline(linestream, cell, ',')) { if(j == 0) name[i][j] = cell; else period[i][j - 1] = cell; j++; } i++; } if want store comma-separate file string ifstream think not that. why? say have file: one,two,three four,five,six 7 , eight, 9 ten, ten, ten if use , delimiter ifstream ( getline ) function first reads one two , three\nfour together; because delimiter , , not newline if comfortable using std::regex can solve easil

java - Passing one type of data to different places (retrofit) -

i'm new retrofit , have question. want create 1 call server , use downloaded data in different places in app. i'm using viewpager few fragments , each fragment need same data dataresponse class create different views. best way , how like? how retrofit class like. in advance! public class apiclientfactory { public static final string baseurl = "https://earthquake.usgs.gov/fdsnws/event/1/"; public apiclient createapiclient(){ retrofit retrofit = new retrofit.builder() .baseurl(baseurl) .addconverterfactory(gsonconverterfactory.create()) .build(); return retrofit.create(apiclient.class); } } public interface apiclient { @get("query") call<dataresponse> getdata(@querymap map<string, string> options); } i assume have activity contains viewpager. in activity's oncreate() method can make request. when receive response can build adapter (fragmentpa

node.js - How to install package from github repo in Yarn -

when use npm install fancyapps/fancybox#v2.6.1 --save , fancybox pkg @ v2.6.1 tag installed. behavior described in docs i want ask, how yarn ? is command right alternative? in yarn docs isn't format. yarn add fancyapps/fancybox#v2.6.1 yarn add <git remote url> installs package remote git repository. yarn add <git remote url>#<branch/commit/tag> installs package remote git repository @ specific git branch, git commit or git tag. yarn add https://my-project.org/package.tgz installs package remote gzipped tarball. 2.6.1 not avaliable in fancybox git version yarn add https://github.com/fancyapps/fancybox [remote url] yarn add https://github.com/fancyapps/fancybox#3.0 [branch] yarn add https://github.com/fancyapps/fancybox#5cda5b529ce3fb6c167a55d42ee5a316e921d95f [commit]

javascript - Uncaught Error: Firebase.update failed: First argument contains NaN in property 'products.quantity' -

uncaught error: firebase.update failed: first argument contains nan in property 'products.quantity' when tried code gives error "uncaught error: firebase.update failed: first argument contains nan in property 'products.quantity'" import actions './actiontypes' import * db '../../firebase/database' export function saleaction(storedata){ console.log('222222222222',storedata) return dispatch =>{ dispatch(saleaction()); return db.database.ref('/sale').push(storedata).then((data)=>{ return db.database.ref('/products/').once('value',(snap)=>{ var oldqty = parseint(snap.val().quantity); console.log('quantityyyyyyyyyyy',oldqty) var newqty = parseint(oldqty - parseint(storedata.quantity)); return db.database.ref('/products').set(newqty,(done)=>{ alert('s

linux - Interprocess communication via Pipes -

it known during interprocess communication in linux, processes communicate each other through special file named "pipe" . it known the operations performed on file write 1 process , read 1 process in order communicate each other. now, question : do these write , read operations performed in parallel during communication (operations executed parallely) ? , if not than, what happens when 1 of process enters sleep state during communication? performs write operation first second process read or goes directly sleep without performing of write , read operation? the sending process can write until pipe buffer full (64k on linux since 2.6.11). after that, write(2) block. the receiving process block until data available read(2) . for more detailed pipe buffering, @ https://unix.stackexchange.com/a/11954 . for example, program #include <sys/types.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <

ios - CAEmitterCell color property not working -

i have strange behaviour of caemittercell color property or don't understand right. i have cell let cell = caemittercell() with content of simple .png file drawn black cell.contents = uiimage(named: "particle")?.cgimage and try change green cell.color = uicolor.green.cgcolor but still rendered black. tried change "render as" property of image "template imagr" in media asset has no effect. can me understand i'm doing wrong? ok, case color of initial image: darker image - less color variation have. better use white images particle emitters %)

router - GNS3 - Telnet issue -

i have created following network in gns3 gns3 simple network diagram . let me explain setup: the internet cloud cloud 1 connected lan , not loopback . r1 routers' f0/0 getting ip dhcp, can telnet , ping remote host in lan. r1 configured snmp access (public community string) the ip r1 routers' f0/1 interface manually configured. interface can ping remote host on lan telnet fails. r2 routers' f0/0 ip manully configured. situation same here, able ping telnet failing. configuration same between r1 , r2. just mentioning again, interfaces ping-able remote host in same lan, r1's f0/0 telnet-able (hope word) is there configuration change can telnet access interfaces?

regex - Oracle regexp cant seem to get it right -

i have values like cr-123456 ecr-12345 bcy-499494 134-abc ecw-ecr1233 cr-123344 i want match lines not start ecr , regex doing ^((?!ecr)\w+) seems want. want replace matched values not begin ecr , replace them ecr , blanked because following doesn't seem work select regexp_replace('cr-123344','^((?!ecr)\w+)','ecr') dual any ideas have gone wrong ? want result be ecr-123456 ecr-12345 ecr-499494 ecr-abc ecr-ecr1233 ecr-123344 i use substring , instr replace before dash, here answer using regexp: aset (select 'cr-123456' dual union select 'bcy-12345' dual union select 'ecr-499494' dual union select '134-abc' dual union select 'ecw-ecr1233' dual union select 'cr-123344' dual) select a, regexp_replace(a, '^([^-]*)',&#

lepozepo:s3 meteor package can not find my aws key -

i getting followin error message: (stderr) error: aws "key" required i have settings.json file on root , have amazons3.js file on server folder following content: s3.config = { key: meteor.settings.s3_key, secret: meteor.settings.s3_secret, bucket: meteor.settings.public.s3_bucket } can tell me wrong?

angular - In Angular2 cli I get a 404 when refreshing a route -

in angular2 cli 404 when refreshing route. i'm using seed app: https://github.com/2sic/app-tutorial-angular4-hello-dnn when a: ng serve jit app works fine. when a: https://github.com/2sic/app-tutorial-angular4-hello-dnn works fine. until refresh. tech i'm using: webpack, http-server (to run aot app), typescript, jit , aot builds angular version 4 example: navigate pricing, pricing loads fine, click refresh , 404. have path called '**' redirect home route if route not exist. pricing route exist , doesnt redirect home route either. some type of setting im missing aot routing here? i'm using http-server ./dist run aot app these routes (non lazy loaded routes): import { routes } '@angular/router'; import { homeroutes } './components/home/home.routes'; import { forgotpasswordroutes } './components/forgotpassword/forgotpassword.routes'; import { faqroutes } './components/faq/faq.routes'; import { dbsroutes } '

ios - fcm-node tells that certificate is expired, but ist not true -

i trying send push notification ios device through phonegap/firebase, using fcm-node , message: {"results":[{"error":{"code":"messaging/invalid-apns-credentials","message":"**a message targeted ios device not sent because required apns ssl certificate not uploaded or has expired. check validity of development , production certificates**."}}. the big problem certificate not expired, , tryied creating new ones , same message. does knows possibly doing wrong ? another point dont have mac computer, developing app on ubuntu. makes diference ?

postgresql - Kerberos for Schemacrawler PostgresDB -

i trying access postgres database using kerberos credentials not have use password schemacrawler ask password , providing following error. schemacrawler 14.15.04 error: not connect jdbc:postgresql://nhc-contracts-db-dev.nicc.noblis.org:5432/networx?applicationname=schemacrawler;loggerlevel=debug, user 'phayes', properties {} re-run schemacrawler -? option or, re-run schemacrawler additional -loglevel=config option details on error apr 14, 2017 10:43:29 us.fatehi.commandlineparser.commandlineutility logsafearguments info: schemacrawler, v14.15.04 apr 14, 2017 10:43:29 us.fatehi.commandlineparser.commandlineutility logsafearguments info: command line: -server=postgresql -host=nhc-contracts-db-dev.nicc.noblis.org -port=5432 -database=networx -schemas=public -user=phayes -password=***** -infolevel=standard -command=schema -loglevel=config apr 14, 2017 10:43:29 us.fatehi.commandlineparser.commandlineutility logfullstacktrace severe: not connect jdbc:postgresql://nhc-contrac

perl - Using one grep operation instead of two? -

is there efficient way use grep in following command running, since want use perl's grep ? @found = grep { !/$ip/ } `$ssh $ips[0] netstat -aan | /bin/grep 1010`; basically, connecting fileserver, executing netstat command , grep ip addresses containing 1010. on output need use grep find specific ip address. can done somehow using 1 perl command? sure, can this: @found = grep { /1010/ && !/$ip/ } `$ssh $ips[0] netstat -aan`; the condition use in grep can not arbitrary expression, full block of code if need be.

c# - How can I use XInput in Python ()WITHOUT PYGAME) to sniff button presses on the controller? -

i've been scouring forums days trying find way sniff xinput xinput controller. haven't found way detect if button pressed down , forum posts analog sticks. want achieve goal without pygame or bulky, external modules. need able detect when a, b, rb (right bumper) , d-pad buttons pressed on controller , when pressed, run code. able distinguish between button pressed, not fact button has been pressed because need convert these inputs vk codes add controller support game (i know there applications out there want make 1 in single script , less bulky.) also, if easier in language python, please explain anyway. said in python because know language more others. also, have quite little coding experience, keep in mind. take @ github repo: https://github.com/r4dian/xbox-360-controller-for-python it seems contain want. think using lib simplest way make controller work python.

drools - Editing Package name of a guided rule in RED HAT BRMS -

i trying edit package of guided rule in red hat brms,is there way can through ui. reason me ask is, want restructure package structure of project. when rename packages, rules inside package still reflect old package name instead of new package structure. on cog icon, select repository view. displays icons next each folder/package segment. rename operation exists 1 of icons.

sql server - Insert multiple rows, count based on another table columns -

i have 3 tables. item , stockdetail , branch i want insert 2 of them @ once. item , stockdetail table. item has 3 columns = itemid , title , price . stockdetail has 3 columns = itemid , branchid , stock . branch has 1 column = branchid . in code below, insert item works fine, not stockdetail table, doesn't insert anything! now stockdetail if works, want insert condition below: if add item, it'll add item existed branchid. that mean, every branches have item. e.g: you add item, while branch has 3 rows of branchid = br000 , br001 , br002 . it insert stockdetail 3 rows well, @ once (single query) complete result of stockdetail (single query): itemid | branchid | stock ______________________________ im000 | br000 | 0 im000 | br001 | 0 im000 | br002 | 0 the code: 'add function' 'insert stockdetail' dim thecommand new sqlcommand dim thedataadapter new sqldataadapter dim thedatatable ne

Group a Scala list by custom logic -

i have custom logic group list of names first letter , can achieve following: val names = list("adam", "barbara", "bob", "charlie", "damien", "elaine", "florence", "gwen") names.map{ case x if x.startswith("a") => (1, x) case x if x.startswith("b") => (1, x) case x if x.startswith("c") => (2, x) case x if x.startswith("d") => (2, x) case x if x.startswith("e") => (3, x) case x if x.startswith("f") => (3, x) case default => (0, default) }.groupby(_._1) the logic may change. example, next time may want group names starting a, f , g group 1 or may add letters z. more advanced logic take first 2 letters , group names starting ad , ba group 1, in case adam , barbara in same group. i'd know if there more idiomatic approach, can write startswith lesser number of times. from tanjin's answer , further

android - Vectordrawable blurry bitmap on ImageView -

i created custom view extends imageview. when set vector drawable viewport smaller, noticing image blurry. if use imageview, seeing vector image sharp suppose be. in custom view override "setimagedrawable", call super , bitmap drawable paint later in ondraw . here how converting bitmap public bitmap getbitmapfromdrawable(drawable drawable) { bitmap bitmap = bitmap.createbitmap(drawable.getintrinsicwidth(), drawable.getintrinsicheight(), bitmap.config.argb_8888); canvas canvas = new canvas(bitmap); drawable.setbounds(0, 0, canvas.getwidth(), canvas.getheight()); drawable.draw(canvas); return bitmap; } you need view width , height, not drawable, , use these drawable bounds. assume view dimension might change on time not 1 time task. store drawable in member field: private drawable drawable; @override public void setimagedrawable(drawable drawable) { this.draw

regex - Extract before and after lines based on keyword in Pdf using R programming -

i want extract information related keyword "cancer" list of pdf using r. i want extract before , after lines or paragraph containing word cancer in text file. abstracts <- lapply(mytxtfiles, function(i) { j <- paste0(scan(i, = character()), collapse = " ") regmatches(j, gregexpr("(?m)(^[^\\r\\n]*\\r+){4}[cancer][^\\r\\n]*\\r+(^[^\\r\\n]*\\r+){4}", j, perl=true))}) above regex not working here's 1 approach: library(textreadr) library(tidyverse) loc <- function(var, regex, n = 1, ignore.case = true){ locs <- grep(regex, var, ignore.case = ignore.case) out <- sort(unique(c(locs - 1, locs, locs + 1))) out <- out[out > 0] out[out <= length(var)] } doc <- 'https://www.in.kpmg.com/pdf/indian%20pharma%20outlook.pdf' %>% read_pdf() %>% slice(loc(text, 'cancer')) doc ## page_id element_id

statistics - Conditional Probability in R -

i using prob package in r calculate conditional probability. my data set q1 q2 q3 q4 1 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 i want calculate prob(q2 =1 given q4=1), per knowledge should 1. when use following command in r prob(a,q2==1,q4==1) return 0.5 how come return 0.5? 0.5, right? doubting answer. the second question if change data set q1 q2 q3 q4 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 1 when use above data , calculate above probability returns 1. how come probability changes when not changing q2 , q4. thinking should same 1 in both cases. how come changes change in other parameter q1 , q3. think should change p(q2=1 / q4=1) independent of q1 , q3. the problem prob uses intersect excludes duplicates. calculation sum(intersect(a, b)$probs)/sum(b$probs) 0.25/0.5=0.5. if want correct calculation, have use exclusive probabilities (the 3rd line has probability of 50%): a <-read.table(text="q1 q2

First key of php associative array returns undefined index when parsed from CSV -

i having trouble accessing first index of associative array when parsing csv. csv: id,color 1,red 2,green 3,blue php: function associative_array_from_csv($csv) { $rows = array_map('str_getcsv', file($csv)); $header = array_shift($rows); $array = array(); foreach($rows $data) { $array[] = array_combine($header, $data); } return $array; } $colors = associative_array_from_csv($csv); now $colors returns: [ [ "id" => "1", "color" => "red", ], [ "id" => "2", "color" => "green ", ], [ "id" => "3", "color" => "blue", ], ]; but if try access id of color: $colors[0]["id"] // returns undefined index: id $colors[0]["color"] // returns "red" if loop on colors can access id so: f

arrays - Why aren’t my functions printing when I try to access them in the main function? -

#include "stdafx.h" #include <iostream> #include <cstdlib> #include <string> using namespace std; class matrix{ int m, n, i, j, first[10][10], second[10][10], sum[10][10]; public: void initmatrix(); void printmatrix(); }; void matrix::initmatrix() { cout << "enter number of rows of matrices"; cin >> m; cout << "enter number of columns of matrices"; cin >> n; cout << "enter elements of first matrix\n"; (i=0; i<m; ++i) { (j=0; j<n; ++j) { cin >> first[i][j]; } } cout << "enter elements of second matrix\n"; (i=0; i<m; ++i) { (j=0; j<n; ++j) { cin >> second[i][j]; } } } void matrix::printmatrix() { for(i=0;

javascript - Basic example of how to use ImmutableJS Records with Flow -

in following example, i'd expect every .get() , .set() call have flow error, couple do: const abrecord = record({ a: 1, b: 2 }); const myrecord = abrecord({ b: 3 }); const c = myrecord.get("c"); // error const d: string = myrecord.get("a"); // no error myrecord.set("c", 4); // error myrecord.set("a", "a string"); // no error am missing annotations solve this?

html - Programmatically referencing a javascript file at runtime -

i having problem programatically referencing javascript file javascript file. reference in html page can't in case directory location of file available @ runtime. have checked out several posts on topic of yet have been unable find works. below code snippets 4 files: index.html assigns id header tag , references first of 2 javascript files called scriptfile.js. scriptfile.js, global data file new users. a second file, called scriptfile.js, user specific data file created each user @ runtime. second javascript file contains data specific single user, located in different directory index.html scriptfile.js, otherwise structurally identical first scriptfile.js. in both cases files consist of function returning array object. the last file index.js. purpose programmatically reference second scriptfile.js file identified above. when index.js runs, value scripts.length = 2 supposed be. scripts[0].getattribute('id') , scripts[0].getattribute('src') both output

google spreadsheet - Get array of matching cells -

i have document sheet contains company names , has column same names , row different locations each company. looks similar to: company | location company1 | location1 company1 | location2 company2 | location1 etc. need formula return array of row numbers match specific company name, [0, 1] company1 , [2] company2. there formula can this? you can use match formula return row number, =match(a1,sheet2!a:a,0) where a1 company names in current sheet, a:a company names present in sheet2 (with location). formula returns row number. a point have in mind - row number starts a1 1 , on.

Visual C++ using parameters with MySqlDataAdapter -

i trying make simple login screen without encryption part (i have make research on later). college project , still starting learn. , having troubles code or whatever think exception catching error , printing me. here's code: string^ user = usertxt->text; string^ pass = pwtxt->text; try{ cn->connectionstring = cninfo; cn->open(); string^ loginquery = "select * acceso user_id = @auser , user_pass = @apass;"; logincmd = gcnew mysqlcommand(loginquery, cn); cmdadp->selectcommand = logincmd; logincmd->commandtype = commandtype::text; logincmd->parameters->addwithvalue("@auser", user); logincmd->parameters->addwithvalue("@apass", pass); cmdadp->fill(table); if (table->rows->count > 0) { messagebox::show("login success");

Automation testing configuration -

i have installed appium , eclipse trying run simple test on android real device, message: failed configuration: @beforetest setup org.openqa.selenium.sessionnotcreatedexception: unable create new remote session. desired capabilities = capabilities [{apppackage=com.android.calculator2, appactivity=com.android.calculator2.calculator, browsername=android, platformname=android, devicename=zx1b32ffxf, version=4.4.2}], required capabilities = capabilities [{}]

Matlab doesn't display table completely -

i have table exchanged structure , want display when write t1 = struct2table(structure(1)) disp(t1) i display: [1x13 double] [1x13 double] [1x13 double] which want see completely. how can that? ps: want display structure table the issue you're using row-vectors instead of column-vector. have tryed t1 = struct2table(structure(1)') also, there's no need use command disp , show table automatically.

Copy entire row if the column contains any value of another column in VBA -

i'm new in vba. have 3 sheets: 'sunday', 'coords' , 'filtered'. want check if 'a' column of sheet 'sunday' equal of values in column 'j' of 'coords' sheet. if true - copy row in 'filtered' sheet. so far have tried following code: sub copyrow() dim lastrow long dim sheetname1 string dim sheetname2 string dim sheetname3 string sheetname1 = "sunday" 'insert sheet name here sheetname2 = "coords" sheetname3 = "filtered" lastrow = sheets(sheetname1).range("a" & rows.count).end(xlup).row lrow = 2 lastrow 'loop through rows if sheets(sheetname1).cells(lrow, "a") = sheets(sheetname2).cells(lrow, "j") c.entirerow.copy worksheets(sheetname3).range("a" & rows.count).end(xlup).offset(1) end if next lrow end sub any appreciated if want check existence o

Android data binding error -- java.lang.RuntimeException: view tag isn't correct on view:null -

me , teammate working on same project and both using android studio 2.3 , gradle 3.3 have used databinding in code , works correctly: gradle: ... android { ... databinding { enabled = true } } ... my_view.xml: <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <relativelayout> .... </relativelayout> </layout> myclass.java: public class myclass extends toolbar { private myviewbinding binding; ... @override protected void onfinishinflate() { super.onfinishinflate(); initializeview(); } private void initializeview() { this.binding = databindingutil.inflate(layoutinflater.from(getcontext()), r.layout.my_view,this, true); ... } } as said works correctly me teammate android studio shows error: android studio java.lang.runtimeexception: view tag isn't cor

c++ - Should a function return a "new" object -

should function return pointer memory allocated on heap? in other words, of following methods more "correct"? // method #1 object* getobject1() { return new object(); } // method #2 std::shared_ptr<object> getobject2() { return std::make_shared<object>(); } int main() { // usage of method #1 object* o1 = getobject1(); o1->dosomething(); delete o1; // object has deleted user // usage of method #2 std::shared_ptr<object>& o2 getobject2(); // has kept in shared_ptr o2.get()->dosomething(); // object deleted when o2 destructs } i imagine first method faster, second method not require user delete object. of two, second preferred. naked pointers should last choice. ideally, return object value. failing that, unique_ptr better shared_ptr unless need shared ownership. i imagine first method faster. that's true shared_ptr . unique_ptr , compiler can optimize. there's no benefit

C# Unity3D - Get stuck with an sticky situation -

im making game inside unity3d im stuck try find solution on it. its part of stock system can store things in "items or materials". the following variables / classes follows : [serializable] public class itemstorage { public extendedlist.items item; public list<materialstorage> material; } [serializable] public class materialstorage { public extendedlist.ingots material; public int materialcount; } above classes. public list<itemstorage> itemstorage; public list<materialstorage> materialstorage; above variables. and under enums bassicly use : public enum items : int { [description("helmet")] helmet = 0, [description("chestplate")] chestplate = 4, [description("platelegs")] platelegs = 8, [description("gaunlets")] gaunlets = 12, [description("boots")] boots = 16, [descriptio

JQuery Mobile Navbar is bugging -

Image
when want make navbar jqm, system adding unnecessary &nbsp grid, makes navbar weird. i using jqm 1.4.5 , jquery 1.11.2. code: <div id="home" data-role="page"> <h1>content</h1> <div data-role="footer"> <div data-role="navbar"> <ul> <li><a href="#" class="ui-btn-active">one</a></li> <li><a href="#">two</a></li> </ul> </div><!-- /navbar --> </div> </div> browser: for people seeing , having same problem: if copy code widgets jquery mobile demos, there spaces between tags see in browser. delete them , should normal again.

android - Launch Homescreen on Notification Click -

here notification builder : public void customnotification() { // using remoteviews bind custom layouts notification remoteviews remoteviews = new remoteviews(getpackagename(), r.layout.customnotification); // set notification title string strtitle = getstring(r.string.customnotificationtitle); // set notification text string strtext = getstring(r.string.customnotificationtext); intent intent = new intent(this, main2activity.class); // send data notificationview class intent.putextra("title", strtitle); intent.putextra("text", strtext); pendingintent pintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notificationcompat.builder builder = new notificationcompat.builder(this) // set icon .setsmallicon(r.mipmap.ic_launcher) // set ticker message .setticker(getstring(r.string.customnotificationticker))

typescript - wrapping a click event into a *ngIf in Angular 2 -

what best way use (click) when screen size less 768 px in width using angular 2. have (click)="isclassvisible = !isclassvisible;" want put in *ngif="screenwidth < 769 {(click)="isclassvisible = !isclassvisible;"}". not sure how accomplish in angular 2. know isn't valid. nav item has secondary drop down should expand on hover on desktop, , contract when mouse leaves. on mobile want them click nav item open, close if click again. can it, can't figure out how make click event visible in responsive mode. you have 2 approaches: 1) create 2 separate elements, 1 click event , 1 without. add specific media query enabled classes each element, 1 of them hidden when screen < 768px , other hidden when screen > 768px 2) on onclick event call function in controller instead of directly setting values in ng-click expression. in function in controller can check screen size window object using (window.innerwidth). can tricky som

How to define and execute GraphQL query with filter -

so thing try is, retrieve filtered data database (mongodb in situation) using graphql. speaking in "mysql language" how implement where clause in graphql? i followed tutorial : https://learngraphql.com/basics/using-a-real-data-source/5 query filter defined : const query = new graphqlobjecttype({ name: "queries", fields: { authors: { type: new graphqllist(author), resolve: function(rootvalue, args, info) { let fields = {}; let fieldasts = info.fieldasts; fieldasts[0].selectionset.selections.map(function(selection) { fields[selection.name.value] = 1; }); return db.authors.find({}, fields).toarray(); } } } }); the tricky part here info parameter in resolve function. explanations i've found here : http://pcarion.com/2015/09/26/graphql-resolve/ so ast (abstract syntax tree) can please provide basic real-life example code show how define , execute following query

java - How to XOR n same numbers? -

i want xor number k n time. easiest way xor n time in loop. there better way? int t = k; for(int = 0; < n; i++) k = k ^ t; xoring n copies of k produces k if n odd , 0 if n even. k ^ k == 0, 0 ^ k == k, , alternates between results every additional k. (your code xoring n+1 copies of k together, i'm guessing mistake.) int result = (n % 2 == 1) ? k : 0;

php - Displaying JSON data posts for blog using just the post id -

i have page named 'posts_list.php' containing list of blog posts retrieved form json api have id, title, image etc . have link on page goes page called 'post.php' below: <a href="post.php?id=<?php echo $post->id ?> "> using method can retrieve 'id' of post clicked user using: <?php $postid = $_get['id']; ?> what want display json post on post.php corresponds id retrieved link on posts_list.php i know sql use clause, being new json im not sure if possible. need achieve php , json it has info /v1/blogs/@blog/@id @blog - blog identifier @id - blog post id

uilocalnotification - Appcelerator Titanium Urban Airship intercepts local notifications -

i using ti.app.ios.schedulelocalnotification() send local notification whenever device crosses geofence. i send this: var iosnotification = ti.app.ios.schedulelocalnotification({ alertaction : "open", alertbody : 'you have crossed fence!', badge : notificationcount, userinfo : {app_name: 'myapp', message_id: message_id}, date : new date() }); that show local notification on device. however, when register 'notification' event, don't receive anything: ti.app.ios.addeventlistener('notification', function(e) { ti.api.info("**** received: " + json.stringify(e)); }); instead, urban airship 'urbanairship.event_push_received' event catches it: urbanairship.addeventlistener(urbanairship.event_push_received, function(e) { ti.api.info('urbanairship.event_push_received(e): ' + json.stringify(e)); }); this wouldn't bother me, except none of data included in creation of l

ajax - Improve Loading Performance when you have multiple iframes (MicroStrategy and D3) in JSP -

i've been trying hard figuring out how improve performance when loading page if have 6 iframes in 1 jsp page. have implement technique called dynamic asynch iframe got site: http://www.aaronpeters.nl/blog/iframe-loading-techniques-performance?%3e hoping technique improve performance during loading improves slightly. the content of iframes d3 charts , microstrategy made performance slow. have tried using ajax during loading doesnt support cross-domain calls not work when loading iframes. have tried using plugins allow cross domain calls in ajax but, in case, i'm not allow use 3rd party api's requires take our url's , use in system (like google api, yahoo api, etc.). is there way improve performance when loading jsp page 6 iframes(d3 , microstrategy)? currently, page loads slow causing browser freeze , unfreeze. there way make content in iframes load in background while user can scroll , down no browser freeze? used jsp loops grab url db , create iframes using te

javascript - C#. User login-display alert message and provide the location of the u Window.location -

i have different pages, have set them on variable. user can access page have clicked on. so, trying display alert message when user click on sign-in. string selectedpage = (string)session["selectedpage"] if (selectedpage != null) { response.write("<script>alert('welcome'); window.location = ????? </script>"); } where have set session["selectedpage"]="page-one.aspx"; session["selectedpage"]="page-two.aspx"; in pages. how can set string/variable in window.loaction? can display alert message , redirect user page.

node.js - Sequelize Association Columns not generated -

i'm trying associate products model user model while making sure force sync in order ensure newest changes present. error columns userid , productmanagerid not created. why columns not auto-generated? product.js 'use strict'; /* model depuy products */ module.exports = function(sequelize, datatypes) { var product = sequelize.define('product', { name: { type: datatypes.string, allownull : false }, sku: { type:datatypes.string, allownull: false, primarykey: true, }, }, { classmethods: { associate: function(models) { product.belongsto(models.user,{ : 'productmanager'}); // associations can defined here } } }); product.sync({force: true}).then(() => { console.log('sequelize forced'); }) return product; }; user.js module.exports = (sequelize, datatypes) => { const user = sequelize.define('user', { id: { typ

jquery - datetimepicker dissappears upon selection -

Image
i have datetimepicker. <input id="all-day-event-date" type="text"> it input textbox. trigger focus when document loads: $('#all-day-event-date').trigger("focus"); and happens have input field , calendar/picker appear, expected. $("#all-day-event-date").datetimepicker({ timepicker: false, onchangedatetime: function(dp, $input) { var datetime = $input.val(); var date = datetime.split(" ")[0]; $input.val(date); } }); it looks this: however, select date, calendar dissapears: how make stay? this question different 1 asked previously. when attempt inline solution: <div style="overflow:hidden;"> <div class="form-group"> <div class="row"> <div class="col-md-8"> <div id="datetimepicker12"></div> </div> </div>

speech recognition - How can I display the rule that has been used in my grammar file in sphinx4 java code? -

my code display rules found in grammar file : configuration configuration = new configuration(); configuration .setacousticmodelpath("src/en-us"); configuration .setdictionarypath("src/9256.dic"); configuration .setgrammarpath("src/dialog/"); configuration .setusegrammar(true); configuration .setgrammarname("dialog"); //grammar.loadjsgf(gram_name); //string gram_name = configuration.getgrammarname(); dictionary dictionary=new textdictionary("src/9256.dic","src/en-us/noisedict",null,false, null,new unitmanager()); jsgfgrammar grammar = new jsgfgrammar("src/dialog/", "dialog", false, false, false, false, dictionary); grammar.allocate(); livespeechrecognizer recognizer = new livespeechrecognizer(configuration); recognizer.startrecognition(true); speechresult result; while ((result

r - How to model fixed effects in lme? -

i have longitudinal measurements , basic demographic variables age , gender , ı'd model measurements lme. what things must take account of when modeling fixed effects part in lme? i've read many questions , answers on topic, i'm not quite sure 1 apply. for analysis, model fixed effects part, first of used graphics examine relationship betweeen response , explanatory variables(one one). used possible options modeling fixed effects , utilized information criterias (aic, bic) decide model use among these options. utilized both graphics , information cirtria values , tried univariate analyses (such t-test, chi squared tests) variable selection find potential risk factors response, i'm not sure true apply univariate analyses. after applying these methods, decided use main effects in fixed effects part because model gave smallest aic , bic did not find trend in graphics shows interaction between candidate variables. possible include main effects or not logic? not k

View disappears when padding is added in constraint layout android -

Image
i'm trying create vertical chain of 4 circles using constraintlayout. renders until add padding constraintlayout @ point, entire view goes missing. i've been trying debug past couple of hours , tried searching in , there no question addressing problem. appreciated. contents of layout file follows <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_input_spot_from_to_cl" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:padding="10dp" > <imageview android:id="@+id/circle1_iv" android:layout_width="10dp" android:layout_height="10dp" app:layout_constraintbottom_totopof="@+id/circle2_iv&