Posts

Showing posts from July, 2010

typescript - Why so many [not cacheable] files with webpack recompile? -

Image
i have small project. around 800 modules. when change 1 of files, , webpack-watch recompiles everything, takes longer like. , think main reason when done, lists hundreds of files [not cacheable] . there hundreds of these files each time save single-char change. any ideas on causing these files not cacheable? ideas on can start looking figure out? have poked around , been unsuccessful far. loader .js files ts-loader . other that, don't use other loaders. i need ideas on start. this github issue has been around years, no answer on it. people need figuring out how know why file isn't cacheable. ideas here appreciated. can show samples webpack.config.js . on webpack 1 now. don't think issue. let me know. i don't have answer solve everyone. but, case, using loader made stuff not-cacheable. once fixed that, go. loader using mark-loader . once took out, files cacheable again.

SWI-Prolog (SWISH): No permission to modify static procedure `(=)/2' -

this question has answer here: no permission modify static procedure 1 answer during playing around different list predicates in swi-prolog (swish), trying check if atom a part of list list1 defined in program list1 = [a,b,c,d] . i formulated query member(a, list1). , expecting along lines of simple 'yes' (just shows in youtube video @ 59:25), instead got warning singleton variables: [list1] and error no permission modify static procedure `(=)/2' from understand looking online, warning not important here. not understand, however, why error message while a member of list1 . i tried in 2 different ways: 1) adding list1 = [a,b,c,d]. program , querying member(a,list1). (which resulted in error above); 2) passing list1 = [a,b,c,d] directly interpreter , using same query ( member(a,list1). ), resulted in endless amount of results

php - OpenCart: Upload image to download -

when customer purchases product, success.php script runs , generates qr code each product. qr code saved in folder. i want customer able download/view these images on download tab. i've been messing around on download.php script, can't find better solution displaying image. can me out?

apache spark - PYSPARK: how to get weights from CrossValidatorModel? -

i have trained logistic regression model using cross validation using following code https://spark.apache.org/docs/2.1.0/ml-tuning.html now want weights , intercept, error: attributeerror: 'crossvalidatormodel' object has no attribute 'weights' how can these attributes? *the same problem (trainingsummary = cvmodel.summary) from pyspark.ml import pipeline pyspark.ml.classification import logisticregression pyspark.ml.evaluation import binaryclassificationevaluator pyspark.ml.feature import hashingtf, tokenizer pyspark.ml.tuning import crossvalidator, paramgridbuilder # prepare training documents, labeled. training = spark.createdataframe([ (0, "a b c d e spark", 1.0), (1, "b d", 0.0), (2, "spark f g h", 1.0), (3, "hadoop mapreduce", 0.0), (4, "b spark who", 1.0), (5, "g d y", 0.0), (6, "spark fly", 1.0), (7, "was mapreduce", 0.0),

swift - Accessing information from another viewController -

i new swift , trying repopulate pickerview using array of names class. have class notes creates notes , each note has name/title, trying access names/title , put them in pickerview, can me. import uikit var allnotes: [note] = [] var currentnoteindex: int = -1 var notetable: uitableview? let kallnotes:string = "notes" class note: nsobject { var date:string var note:string var name:string override init() { date = nsdate().description name = "" note = "" } func dictionary() -> nsdictionary { return ["note": note, "date": date, "name": name] } i have 2 different pickerview , 1 works it's 1 names doesn't work. override func viewdidload() { super.viewdidload() filenamepicker.datasource = self filenamepicker.delegate = self gradepicker.datasource = self gradepicker.delegate = self } func pickerview(_ pickerview: uipick

c# - Best way to have multiple user inputs for each item in a list box? -

i feel may phrasing question incorrectly seems should relatively trivial task, i'm looking mechanism accept multiple user inputs each item in list. in practice intend list contents of directory (list of files) have them check permutation of multiple box's option 1, option 2, option 3,... option n+1. different things depending on user selected. i.e. option 1 may move file directory , option 2 may send file email attachment, if both checked both when user clicks button. listoffiles option 1 option 2 file1.txt x x file2.csv x file3.py x i should able iterate on list of files , things file 1 based on option 1 , 2 being selected, file 2 based on option 1 being selected... , on. can point me c# control or other mechanism accomplish this? i'm open other languages / frameworks well, starting winform or asp.net application seems there'd trivial way in frameworks... in winform can use datagridview add 3 columns type o

swift - Too Many Items for Nav Bar Layout in iOS -

Image
i need figuring out how fix layout of navigation bar in ios app. when adding navigation 'child' views of given screen, approach far has been add buttons 'leftbarbuttonitems' collection of uinavigation item. long number of buttons doesn't exceed 3 or 4 works great. unfortunately, have screen requires additional buttons. seemed build fine, when run application end jumbled mess this: is there better way layout ui nav , toolbar buttons this? if putting buttons in nav bar correct way, need make layout handle cases content can't fit? i wouldn't bother adding any buttons. users expect apps behave in similar ways, , (while technically possible) it's unusual thing do. apple's hig states: avoid crowding navigation bar many controls. in general, navigation bar should contain no more view’s current title, button, , 1 control manages view’s contents. and, if choose ignore apple's hig, won't accessibility. users can (and w

C# Regex to replace entire function's contents -

i'm having bit of trouble getting expression work replace entire contents of function. example void function1 (void) { junk here(); other junk here { blah blah blah } } i'd replace contents of function predefined value ie void function1 (void) { else here } this have doesn't seem work. trying capture first part of function , ending curly brace on new line itself. i'm pretty new regular expressions forgive me if makes no sense text = regex.replace(text, @"(function1)*?(^}$))", replace, regexoptions.multiline); any ideas doing wrong or how should go differently? this seems work: /function1(?:.|\n)*?^}/m see http://regexr.com/3geoq . i think major issue regular expression (function1)* , matches string "function1" 0 or more times. example matching strings "" , "function1function1function1" . meant (function1).* , unless things work differently in .net's regular exp

sql server - Closest Date in SQL -

i trying find nearest date or actual date between table_a , table_b in sql server 2012 table_a date ------- 2017-07-15 00:00:00 2017-07-27 00:00:00 2017-07-23 00:00:00 table_b dt ------ 2017-07-17 00:00:00 2017-07-19 00:00:00 2017-07-23 00:00:00 2017-07-28 00:00:00 conditions: if table_a.date = table_b.dt table_a.date if table_a.date <> table_b.dt whichever next higher date in table_b desired output: date ----- 2017-07-17 00:00:00 2017-07-23 00:00:00 2017-07-28 00:00:00 any or guidance? use cross apply , top : select date = x.dt table_a cross apply( select top(1) dt table_b b b.dt >= a.date order b.dt ) x order x.dt

dataframe - Merge Two df with different number of columns with R -

this question has answer here: how join (merge) data frames (inner, outer, left, right)? 12 answers i have 2 dataframes, have overlapping set of columns unique columns too. they contain of same observations. to give concrete example: df1 <- data.frame(name = c("a", "b", "c", "d"), age = c(1:4), party = c(3:6) ) df2 <- data.frame(name = c("a", "e", "c", "f"), other = c(10:13), party = c(3:6) ) both dfs contain observations a , c how merge dfs create new df contains columns, not repeat observations? you can use merge() base r. merge(df1, df2, all=t) # name party age other # 1 3 1 10 # 2 b 4 2 na # 3 c 5 3 12 # 4 d 6 4 na # 5 e 4 na 11 #

simulation - How to process with ABM -

in bachalar work supossed build model of terrorist attack in tokyo in 1995 (sarin gas). have never done heard abm until month ago. able simple models. however welcome ideas how start model. need model 1 train of 5 attack. should start environment, defining agents...? , there provide me kind of support if need know something? also should model statecharts, or possible model train trail library using flowcharts , passengers statecharts? best idea check out example models come anylogic (menu/help/example models). get feeling number , start pulling techniques , items used achieve similar things. otherwise, questions far broad stackoverflow, afraid. best modelling advise in nutshell: start (super)simple , add features go along (and skills increase)

android - Firebase Jobdispatcher interval unreliable -

google forces me stop using alarmmanager because of excessive wakeups . should use jobscheduler , app should support older devices api <21. have use firebase jobdispatcher :-( however, in opinion, jobdispatcher unreliable, unlike alarmmanager . i set interval every 60 secs (1 min). gaps between jobservice.onstartjob() are: 1, 10, 6, 1, 16, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 4, 0, 1, 8 mins. if set interval 10 mins, gaps are: 11, 10, 10, 10, 10, 10, 21, 12, 10, 10, 10, 10, 10, 15, 10, 41, 10, 13, 14, 14, 22, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 19, 10, 10, 34, 14, 10, 10, 10, 12, 10 mins. my smartphone (samsung galaxy alpha, android 5.0.1) connected power , not in standby, power safe option deactivated. what doing wrong? firebasejobdispatcher dispatcher = new firebasejobdispatcher(new googleplaydriver(context)); job jobwifi = dispatcher.newjobbuilder() .setservice(connectionjobservice.class) .settag("tag") .setrecur

javascript - How to invalidate Relay's cache after mutation -

i'm rebuilding small, internal web app react/relay/graphql familiar stack. basically, monitors analytics of list of "active" videos. mutation replace list of active video ids new list. the problem after replacing ids, relay continues deliver old list of ids instead of new. i haven't been able figure out how manipulate store that's passed commitmutation() 's updater , optimisticupdater callbacks. need either clear out stored list of active videos knows call fresh 1 or have re-run graphql query refresh cache. specifically, need clear results query: const activevideosquery = graphql` query app_activevideos_query { activevideos { ...setactivevideospage_activevideos ...videolist_activevideos } } ` the mutation (typescript): const { commitmutation, graphql } = require('react-relay') const mutation = graphql` mutation setactivevideosmutation($input: setactivevideosinput!) { setactiv

javascript - Vue.js parent component event handler method can't access it's own data normally -

bare me, difficult explain. what's happening in brief in parent component, passing array child component, , when user selects 1 of elements of array, child component emits event, passing selected item, handled in parent. want take selected element (in event handler of parent), , push onto different array in parent . able access/console.log object being passed during emission in parent's event-handling method, this.currentlyselectedadvertisements (<--- empty array want start filling up) somehow no longer array! when console.log(this.currentlyselectedadvertisements) (as shown below) console tells me it's __ob__: observer <--- that? why it, property defined array, unusable when need mutate in event handler , alter how children rendered? oddly enough, in template, if put {{currentlyselectedadvertisements}} shows empty array [] . also, in event handling method of parent, if use [].push.call(this.currentlyselectedadvertsiements, payload.chosen) , able not e

javascript - Combo box filled from json response does not behave normally -

i have javascript code: (function() { var app = angular.module("fhu", []); app.controller("fhucontroller", function(){ this.carlist = cars; }); $(document).ready(function(){ var car = {}; $.getjson("fillingapi.php?action=get_cars",function(data){ var i=0; for(i=0;i<data.length;i++){ cars.push( {license: data[i].license, descr: data[i].descr}); } }); }); var cars=[]; })(); it seems work. array correctly filled json response. problem showing combo box. in html file have this: <select ng-model="selectedcar" ng-options="x.license x in fhu.carlist"> </select> <h1>you selected: {{selectedcar.license}}</h1> <p>it is: {{selectedcar.descr}}</p> this works... after random clicking outside combo box. combo not contain , narrow. after clicking outside combo, enlargen

php - Laravel - Creating an object from a JSON array to save it in a SQL database -

what trying send json array (that gotten guzzle) sql database. have gotten point able response , display gotten json array on webpage. array defined $data variable. $data variable gets decoded using this: $data = json_decode($response->getbody()->getcontents()); this able json , decode no problem. part stuck on taking $data variable, processing , sending database. understand required convert json array , send database. the json format this: [{ "intldes": "2017-042z", "norad_cat_id": "42848", "object_type": "tba", "satname": "object z", "country": "tbd", "launch": "2017-07-14", "site": "ttmtr", "decay": null, "period": "96.52", "inclination": "97.61", "apogee": "597", "perigee": "586", "comment": null,

java - Spring AsyncResttemplate HTTPs (SSL) service call -

i using spring asyncresttempate call multiple services simultaneously. services exposed via ssl. please let me know how use ssl certificate , asyncresttemplate call services asynchronously? can use resttemplate httpconnectionfactory, how same asyncresttemplate. i using spring 4.3, jdk 8. you can use asyncclienthttprequestfactory: closeablehttpasyncclient httpclient = httpasyncclients.custom() .setsslhostnameverifier(sslconnectionsocketfactory.allow_all_hostname_verifier) .setsslcontext(getsslcontext(keystore)).build(); asyncclienthttprequestfactory reqfactory = new httpcomponentsasyncclienthttprequestfactory(httpclient); asyncresttemplate resttemplate = new asyncresttemplate(reqfactory);

visual studio - Save Variables from a .txt File on C# -

sorry i´m new c# , working visual studio. i´m trying make .txt variables later when need change example number o path can change on .txt file , don´t need open code , update. for example have archive.txt joe;rodriguez;c:\example\hello.txt;398663 and code: class program { static void main(string[] args) { string[] split; streamreader sr = file.opentext(@"c:\folder\archive.txt"); string line; while ((line = sr.readline()) != null) { split = line.split(new char[] { ';' }); string name = split[0]; string lastname = split[1]; string path = split[2]; string num = split[3]; console.writeline("split 0 is: " + name); console.writeline("split 2 is: " + lastname); console.writeline("split 3 is: " + path); console.writeline("split 4 is: " + num); } } } what

javascript - Assigning Array Values to Table Cells -

i'm trying create simple memory game javascript , i've created array of letters match game however, i'm having trouble figuring out how assign single letter each cell of table functions board. <html> <head> <style> td { background-color: red; width:100px; height:100px; border:1px solid black } </style> <table> <tr> <td id = "tile" onclick = "revealletter()"></td> <td id = "tile" onclick = "revealletter()"></td> <td id = "tile" onclick = "revealletter()"></td> <td id = "tile" onclick = "revealletter()"></td> </tr> <tr> <td id = "tile" onclick = "revealletter()"></td> <td id = "tile" onclick = "revealle

razor - Nested foreach loop in ASP.NET MVC Core NullReferenceException -

i'm trying add navigation sidebar in simple web app has 2 primary models, , i'm running peculiar error when try use nested loop render data in sidebar. my app has 2 models category , thing in example below: public class category { public int id { get; set; } public string name { get; set; } public virtual icollection<thing> things { get; set; } } public class thing { public int id { get; set; } public string title { get; set; } public string description { get; set; } public int categoryid { get; set; } public virtual category category { get; set; } } i want add sidebar contains list of categories. created viewcomponent i'm referencing in _layout.cshtml so: // sidebarviewcomponent.cs public class sidebarviewcomponent : viewcomponent { private readonly mycontext db; public sidebarviewcomponent(mycontext context) { db = context; } public async task<iviewcomponentresult> invokeasync() {

swift - What are some ways I can optimize this special cased closure? -

i want use sorted method on array. public func sorted(by areinincreasingorder: (self.iterator.element, self.iterator.element) -> bool) -> [self.iterator.element] and can see takes function (which takes 2 elements , returns bool), , returns an array of element (sorted) where getting stuck, trying pass anonymous function (closure), using $0 , $1 arguments i want add special case, specific key ("module") and want access property on $0 , $1 but means, ostensibly, have cast arguments, can access properties on arguments and make things worse, because arguments either string or node , have repeated code (the switch statement) so anyways, of swift veterans see things make better? return self.sorted(by: { descriptor in sortdescriptors { if descriptor.key == "module" { if let firstnode = $0 as? node { if let secondnode = $1 as? node { let firs

Angular 2 prevent x-xsrf-token to be added on single http request -

i have web app need make request webservice outside of page. this request made within restricted page, , because of this, have x-xsrf-token set, autenticate user on webpage. working. but need make request webservice outside of page, not accept x-xsrf-token , given me error: xmlhttprequest cannot load " https://webservice-here ..." request header field x-xsrf-token not allowed access-control-allow-headers in preflight response. but since i'm inside restricted area, don't know how solve issue... http service: apicustom(url: string) { let headers = new headers(); headers.delete('x-xsrf-token'); return this._http.get(url, { headers: headers }).map(response => response.json()).do(data => { return data; }).catch(this.handleerrors); } i tried delete x-xsrf-token (also tried xsrf-token ) manually, didn't worked. is there way solve this?

python - Modifying a class instance variable in an external function using a multiprocessing.Pool of workers -

i trying populate dictionary, class instance variable called self.diags , using pool of workers, reason dictionary empty after pool.map line executes. have 3 lists: dt , idx1 , , ivals . looping through entries of dt , , adding each entry key self.diags dictionary, value of [idx1[i], ivals[i], none] , i index of current entry in dt . here relevant code: class eventcloudextractor: def __init__(self, dl, dw): # other stuff self.diags = defaultdict(list) self.idx1 = [] self.ivals = [] def p_triplet_to_diags(self, dt, idx1, ivals, dl = none, dt_min = 0, dt_max = none, ivals_thresh = 0, min_eventid = 0): # other stuff self.idx1 = idx1 self.ivals = ivals num_cores = min(multiprocessing.cpu_count(), 24) pool = multiprocessing.pool(num_cores) pool.map(populate_diags, [(i, dtval, self) i, dtval in izip(count(), dt)]) i'm passing in 3 values (i, dtval, self) in tuple 1 argument. instead of pa

groovy - UnsupportedOperationException when using Method Pointer Operator and MockFor -

i had test. using mockfor , working , happy. until changed , forced use method pointer operator, , happiness memory. here constricted example of problem import groovy.mock.interceptor.* // testing againts interface, not actual class // not negociable. interface person { void sayhello(name); } // setup (can whatever need) def personmock = new mockfor(person) personmock.demand.sayhello { name -> println "hello $name" } def person = personmock.proxyinstance() // end setup // exercise (can not change) def closuremethod = person.&sayhello.curry("groovy!") closuremethod() // end exercise personmock.verify(person) which safest , simplest way fix test? currently, test fails java.lang.unsupportedoperationexception even when testing against interface, nothing prevents me creating mock class implements interface , poor-men verify demands. import groovy.mock.interceptor.* // testing against interface, not actual class // not negociable. inte

r - How to populate variables after clicking an action button? -

i'm trying build simple roller 1 can click button , populate series of variables. i'm sure easy solution, i'm having hard time getting work. this i've got. have interface set want it, want new value strength row. library(shiny) ui = fluidpage( titlepanel(""), sidebarlayout( sidebarpanel( textinput("char_name","name"), textinput("char_sex","sex"), actionbutton("rollbutton", "roll!", width = "100%"), hr(), helptext("please consult _ if need assitance.") ), mainpanel( htmloutput("name"), htmloutput("sex"), htmloutput("natl"), htmloutput("strength") ) ) ) server = function(input, output) { observe({ if(input$rollbutton > 0) { strength <- sum(sample(1:6,3,replace=true)) } }) output$name <- rendertext({ input$rollbutton

php - How to exactly specify the id of td? jquery javascript -

i have many tds ,each td has id.when id variables,it failed.when id confirm(like a12),content display.then tried '#a'+i+j,but result #a921.the code is: <script> $(document).ready(function(){ for(var i=1;i<9;i++) for(var j=1;j<21;j++) { $('#a'+i+j).click(function (){ alert('#a'+i+j); $('#content').css('display','block'); $('#selectid').val('#a'+i+j); }); } }); </script> who can me? a+i+j should a11 a12........a820.my php code: <?php function output($a,$b,$color) { if($b) { echo '<td style="background-color:'.$color.'" id="'.$a.'">'.$b.'</td>'; } else { echo '<td>'."n".'</td>'; } } function cabinetcolor($a) { if($a=="g") { $color=green; } else if($a=="gr") { $color=gray; } else if($a=="p")

xml - How to iterate over time interval in a two-level dict in Python? -

i'm creating program read set of xml files in directory , prints summary report of content, so: timestamp tick12 tick13 tick14 ------------ ------ ------ ------ 06-26 09:00 1 0 0 06-26 09:01 0 33 0 06-26 09:02 0 0 32 06-26 09:03 0 19 0 06-26 09:04 0 12 0 each column has timestamp (by minute) followed 1 column per print zone found, , each line shows timestamp , number of requests each print zone during time period. each minute should accounted for, if 0 requests made, , program should accept zone names cl zones reported. now, i'm having difficulty traversing timestamps inside dict() such output includes not timestamps pulled dir of xml files, timestamps in between (minute-by-minute) . timestamps in xml files formatted so: 2017-06-22t06:34:21 any advice on design welcome, i'm new python! #!/usr/bin/python import os, sys xml.dom.minidom imp

javascript - Typescript Filter Array of Objects with an Array of Strings by Multiple Keywords -

i understand how filter single attribute in array of objects 1 keyword. have filter service filters out array of objects single attribute using single keyword, cannot figure out how multiple keywords on array of objects. have far: i have interface restaurant array of objects is: export interface restaurant { id: number; name: string; tags: string[]; } right have filters name attribute, want filter restaurants array of tags attribute array of preferences in service class. @injectable() export class preferencesfilterservice { getfilteredrestaurants(list: restaurant[]): restaurant[] { return list.filter(function(restaurant){ restaurant.name === "mexican"; }); } } and need perform pseudocode: @injectable() export class preferencesfilterservice { preferenceslist: string[]; getfilteredrestaurants(list: restaurant[]): restaurant[] { return list.filter(function(restaurant){ //loop through each restaurants "tags" attribute

node.js - How to clone all code and install all dependent software for a web application on new developers computer -

i current have web application divided 3 aspects. front end - html, css , javascript web browser code. server - express.js web server. database - mysql database. i store source code in git repository , can clone developers computer. works fine. my problem encountered when clone repository new developers computer not have correct supporting applications installed. e.g. node, mysql, 7-zip, etc. have go through laborious process of manually installing these applications before web application able run locally on machine. so question is.... is there someway can automate installation of supporting software when or after cloning repository git server don't have go through manual process each time? configuration management systems intended provisioning servers, many developers use them development, particularly in conjunction vagrant . if needed use them install software on host. i use ansible this, there many other options puppet , chef.

linux - Undertale Joy2Key Script -

i decided playthrough of undertale , while have played game keyboard before, want try gamepad. windows version of game has native controller support linux version not. joy2key works , i've got game run little thread on steam discussion forums: https://steamcommunity.com/app/391540/discussions/0/360670708784222242/ however, solution requires manually start joy2key through terminal every time start undertale through steam. while it's minor annoyance, wondering if there way streamline process joy2key automatically launch whenever launched undertale. i've tried scripting, far, haven't had luck. latest script i've tried: #!/bin/bash cd /home/user/.steam/steam/steamapps/common/undertale/ ./runner joy2key -config ut "undertale"

c# - In Entity Framework 6 how can I create a one to many mapping with a navigation property on the other side? -

my domain model trade can have many tradeleg s. trying use following mappings. trade mapping haskey(t => t.tradeid); property(t => t.tradeid).hasdatabasegeneratedoption(databasegeneratedoption.identity) .hascolumnname("tradeid"); property(t => t.description).hascolumnname("description"); property(t => t.counterpartyid).hascolumnname("counterpartyid"); property(t => t.quantity).hascolumnname("quantity"); property(t => t.isactive).hascolumnname("isactive"); hasmany(t => t.tradelegs); totable("trade"); trade leg mapping haskey(t => t.tradelegid); property(t => t.tradelegid).hasdatabasegeneratedoption(databasegeneratedoption.identity) .hascolumnname("tradelegid"); property(t => t.trdid).hascolumnname("trdid"); // fk trade property(t => t.ordinal).hascolumnname("ordinal"

arraylist - How to create a read-only list in java without using unmodifiablelist method from collections API? -

an interviewer asked me question create read-only list in java without using collections api method.any thoughts on how can achieve ? just extend abstractlist , , docs mention: to implement unmodifiable list, programmer needs extend class , provide implementations get(int) , size() methods.

python - Sklearn classifier and flask issues -

i have been trying self host apache sklearn classifier put together, , ended using joblib serialize saved model, load in flask app. now, app worked when running flask's built in development server, when set debian 9 apache server, 500 error. delving apache's error.log , get: attributeerror: module '__main__' has no attribute 'tokenize' now, funny me because while did write own tokenizer, web app gave me no problems when running locally. furthermore, saved model used trained on webserver, different library versions should not problem. my code web app is: import re import sys flask import flask, request, render_template nltk import word_tokenize nltk.stem.wordnet import wordnetlemmatizer sklearn.externals import joblib app = flask(__name__) def tokenize(text): # text = text.translate(str.maketrans('','',string.punctuation)) text = re.sub(r'\w+', ' ', text) tokens = word_tokenize(text) lemas = []

Show different image on same Gridview Android -

i want show different image in grid layout mainactivity.java b1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(isreadstorageallowed()){ intent intent = new intent(mainactivity.this, gridactivity.class); intent.putextra("firstkeyname","firstkeyvalue"); intent.putextra("secondkeyname","secondkeyvalue"); mainactivity.this.startactivity(intent); } }); i want show images in gridlayout gridactivity.java code follows intent intent; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent = getintent(); // view new_activity.xml setcontentview(r.layout.activity_grid); gridview gridview = (gridview) findviewbyid(r.id.gridview); gridview.setadapter(new imageadapter(this)); gridview.setonitemclicklistener(new adapterview.oni

threadpool - Node.js thread pool and core usage -

i've read tons of articles , stackoverflow questions, , saw lot of information thread pool, no 1 talks physical cpu core usage. believe question not duplicated. given have quad-core computer , libuv thread pool size of 4, node.js utilize 4 cores when processing lots of i/o requests(maybe more thousands)? i'm curious i/o request uses thread pool . no 1 gives clear , full list of request. know node.js event loop single threaded uses thread pool handle i/o such accessing disk , db. i'm curious i/o request uses thread pool. disk i/o uses thread pool. network i/o async beginning , not use threads. with disk i/o, individual disk i/o calls still present javascript non-blocking , asynchronous though use threads in native code implementation. when exceed more disk i/o calls in process size of thread pool, disk i/o calls queued , when 1 of threads frees up, next disk i/o call in queue run using available thread. since javascript disk i/o non-blocking ,

android - using design library requires using theme.appcompat -

Image
after trying possibilites online came here help i trying textinputlayout(android.support.design.widget.textinputlayout) floating edittext got error message <android.support.design.widget.textinputlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="1" /> </android.support.design.widget.textinputlayout> <resources> <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <!-- customize theme here. --> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">@color/coloraccent</item> </style> manifest file link ma

sql server 2008 - SQL - Return results of row data -

Image
so have following table (see below) , i'd write query return me game numbers have following in 3 ticket columns. e.g. give me game numbers have 1,2 , 3 in them. the numbers don't have in columns (like 1 in ticket1 etc...). have in game's row. i'd post have of query far it's useless , need fresh pair of eyes see if possible , if so, how? cross apply conditional count union of tickets. select * mytable cross apply ( select count(case when ticket in (1,2,3) ticket end) cnt ( select ticket1 ticket union select ticket2 ticket union select ticket3 ticket ) t ) t t.cnt = 3

sql - Can i read interval value from another column in database -

i have table (custid,purchase_timestamp (dd-mm-yyyy), warranty_period) in days. need sum of purchase_time , warranty_period.how can write sql this. i tried select date_sub(purchase_timestamp, interval warranty_period day); but not work. please suggest |custid | warranty_period | purchase_timestamp |1 | 365 | 03-01-2017 |2 | 30 | 03-04-2017 |3 | 10 | 25-05-2017 |4 | 30 | 20-05-2017 |5 | 365 | 04-06-2017 |6 | 100 | 18-06-2017 |7 | 90 | 30-06-2017 |8 | 10 | 05-07-2017 |9 | 30 | 09-07-2017 |10 | 365 | 17-07-2017 let's assume table: create table t ( custid integer, warranty_period integer, purchase_timestamp date /* timestamp ? */ ); with data: ins

node.js - ubuntu nodejs syntax error Syntax Error: Unexpected token ` -

i went through process of installing volumioui on ubuntu explained in this link. and get: /volumio2-ui$ gulp serve --theme="volumio" /home/yossi/elia/volumio2-ui/gulp/build.js:127 fs.readfilesync(`${conf.paths.src}/app/themes/${themeselected}/assets/va ^ syntaxerror: unexpected token illegal @ module._compile (module.js:439:25) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ module.require (module.js:364:17) @ require (module.js:380:17) @ /home/yossi/elia/volumio2-ui/gulpfile.js:19:3 @ array.map (native) @ object.<anonymous> (/home/yossi/elia/volumio2-ui/gulpfile.js:18:4) @ module._compile (module.js:456:26) i did same process on mac no problems. this strange since complains syntax error. if change ' works fine, problem code full of error. can config nodejs treat ` ' ? note: able solve search

performance - How to debug an unexpected Android layout? -

Image
my constraintlayout showing strange plotting of items on app. showing elements correct positions on preview screen of android studio while running app on phone positions of elements strange. here screen shot of app: my layout is: <?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" > <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="34dp" android:layout_height="56dp" a

arrays - Can You assign a value A to a value B given two sets of data in matlab? -

i new matlab , have following problem: have 2 arrays lot of integers, , able assign given data point 1 array another. example: array1 = [1, 2, 3] array2 = [2, 4, 6] so if have data array1, in case, able array1*2 = array2 . there different ways solve this, , have 2 arrays 100k elements each. need divide data smaller segments , create average each, may able derive array1*x ~ array2. need estimation, example above doesnt justice. help from understand want estimate x in formula: array1*x = array2 if devide estimate each value, take mean have estimator of x mean(double(array2)./double(array1)) you worry 100k values, 200k values in total. not big matlab. concider each value takes 8 bytes. 1600kb not computer. you fit simple linear regression model sum(array1.*array2) / sum(array1.^2)