Posts

Showing posts from August, 2013

spring - Possible causes of org.springframework.mail.MailSendException / java.net.ConnectException? -

i have spring boot application once day should send emails users needs informed specific events day. i'm using spring-boot-starter-mail dependency , javamailsender provided it. my application.proiperties config mails looks (with proper host, user , password data ofcourse): spring.mail.host = myhost.com spring.mail.username = user@myhost.com spring.mail.password = mypassword spring.mail.port = 25 spring.mail.properties.mail.smtp.auth = true and code responsible sending mails is: private void sendmessage(string email, string text, string subject) { try { mimemessage message = javamailsender.createmimemessage(); mimemessagehelper helper = new mimemessagehelper(message, true); helper.setfrom(sender); helper.setsubject(subject); helper.setto(email); helper.settext(text, true); javamailsender.send(message); } catch (messagingexception e) { e.printstacktrace(); } catch (mailexception e) { ...

r - Applying logistic regression in titanic dataset -

i have famous titanic data set kaggle's website. want predict survival of passengers using logistic regression. using glm() function in r. first divide data frame(total rows = 891) 2 data frames i.e. train(from row 1 800) , test(from row 801 891). code follows ` >> data <- read.csv("train.csv", stringsasfactors = false) >> names(data) `[1] "passengerid" "survived" "pclass" "name" "sex" "age" "sibsp" [8] "parch" "ticket" "fare" "cabin" "embarked" ` #replacing na values in age column mean value of non na values of age. >> data$age[is.na(data$age)] <- mean(data$age, na.rm = true) #converting sex binary values. 1 males , 0 females. >> sexcode <- ifelse(data$sex == "male",1,0) #dividing data train , test data frames >> train <- da...

android - Add module to React Native - error: cannot find symbol -

i want add simple module react native app. have errors: :app:compiledebugjavawithjavace:\project\android\app\src\main\java\com\androiddepends\helloworld.java:23: error: cannot find symbol intent intent = new intent(intent.action_wifi_settings); ^ symbol: class intent location: class helloworld e:\project\android\app\src\main\java\com\androiddepends\helloworld.java:23: error: cannot find symbol intent intent = new intent(intent.action_wifi_settings); ^ symbol: class intent location: class helloworld e:\project\android\app\src\main\java\com\androiddepends\helloworld.java:23: error: cannot find symbol intent intent = new intent(intent.action_wifi_settings); ^ symbol: variable intent location: class helloworld e:\project\android\app\src\main\java\com\androiddepends\helloworld.java:24: error: cannot find symbol if (intent.resolveactivity(getpackagemanager()) != null) { ...

Security aspects of storing WCF binding in configuration file -

i'm curious whether there can security concern regarding storing wcf binding information in configuration file instead of configuring code? i'm thinking of cases when server hosting wcf service gets compromised, attacker can change service's configuration use less secure binding, hence gaining access otherwise forbidden data.

angularjs - md card content color change -

<md-card class="md-padding" animate-on-change="currentcard" class="col-md-8" > <md-card-content> </md-card-content> </md-card> how change color of md-card or md-card-content based on condition? i need change color if currentcard.redalert= true here's 1 way of doing - codepen markup <div ng-controller="appctrl" ng-cloak="" ng-app="myapp"> <md-card class="md-padding" animate-on-change="currentcard" class="col-md-8" style="background:{{currentcard.redalert?'red':'blue'}}" > <md-card-content> </md-card-content> </md-card> <md-button class="md-raised md-primary" ng-click="toggle()">toggle</md-button> </div> js angular.module('myapp',['ngmaterial', 'ngmessages']) .controller('appctrl', function($scope) { ...

ios - How to extract image from a live photo? -

i know how extract video live photo. explained here . use phassetresourcemanager video file phassetresource . phassetresourcemanager.defaultmanager().writedataforassetresource(assetres, tofile: fileurl, options: nil, completionhandler: { // video file has been written path specified via fileurl } but how extract image url phlivephoto. motivation behind both video , image url in order upload server. well assuming have access phasset can following: [asset requestcontenteditinginputwithoptions:nil completionhandler:^(phcontenteditinginput *contenteditinginput, nsdictionary *info) { nsurl *imageurl = contenteditinginput.fullsizeimageurl; }];

parsing - How to parse a file in bash according to another file -

this question has answer here: how find , print specific character in bash 4 answers i have parlous problem , i'll show try make solution on example bellow. prefer solve problem in awk. functional solution welcome. i have template file, tells me sequence of columns (in order): template: impact;distance;strand;flags;variant_class;symbol;symbol_source;hgnc_id;biotype;canonical;tsl;appris;ccds;ensp;swissprot;trembl;uniparc;refseq_match;gene_pheno;sift;polyphen;exon;intron;domains;hgvsc;hgvsp;hgvs_offset;gmaf;afr_maf;amr_maf;eas_maf;eur_maf;sas_maf;aa_maf;ea_maf;exac_maf;exac_adj_maf;exac_afr_maf;exac_amr_maf;exac_eas_maf;exac_fin_maf;exac_nfe_maf;exac_oth_maf;exac_sas_maf;clin_sig;somatic;pheno;pubmed;motif_name;motif_pos;high_inf_pos;motif_score_change all values semi-colon separated. and input file, can not parse, because values template missing. inp...

r - Google Analytics query for sessions -

i trying analyze visits purchase in google analytics through r. here code query.list<-init(start.date = "2016-07-01", end.date = "2016-08-01", dimensions = c("ga:daystotransaction","ga:sessionstotransaction"), metrics = c("ga:transaction"), sort = c("ga:date"), table.id = "ga:104454195") i have code shows error error in parsedatafeedjson(ga.data) : code : 400 reason : sort key ga:date not dimension or metric in query. can me desired output days transaction transaction %total 0 44 50% 1 11 20% 2-5 22 30% you trying sort results based on dimension, not included in result set. have ga:daystotransaction , ga:sessionstotransactions dimensions, , have tried apply sort based on ga:date . you'll need use sorting: sort = c("ga:da...

ios - Unable to fix signing issue Xcode 7.3.1 -

Image
i trying test unity game on different ios device using xcode 7.3.1. previously, connect iphone 6 on mac , test game free apple account(that has limited privilege). want test game on different device , later want upload app store. asked client apple id has role "agent". add apple id on xcode , try run project iphone 6 connected. got error message saying- "your account has valid ios distribution certificate" "you have valid ios distribution certificate in member center, not installed locally. if signing identity installed on mac, can export developer profile on mac , import on mac. can reset current certificate." then click on reset button reset current certificate. , try run project again. again got error message saying- unable fix signing issue. xcode failed resolve issue. check code signing settings; ensure have matching signing certificate , provisioning profile installed; , try again. i restarted xcode many times got same error. screensho...

python - Image loses quality with cv2.warpPerspective -

Image
i working opencv 3.1 , python. my problem comes when try deskew (fix tilt of) image text. using cv2.warpperspective make possible, image loses lot of quality. can see here original part of image: and then, here, "rotated" image: it smoothed . i using morphological transformation like: kernel = np.ones((2, 2), np.uint8) blur_image = cv2.erode(tresh, kernel, iterations=1) and white_mask2 = cv2.morphologyex(white_mask2, cv2.morph_open, kernel) to see if improves something, nothing. i saw this example here in so , guys had same problem: , so, don't have idea can do. maybe there way not losing quality of image, or, there's method rotate image without quality lost. know method: root_mat = cv2.getrotationmatrix2d(to_rotate_center, angle, 1.0) result = cv2.warpaffine(to_rotate, root_mat, to_rotate.shape, flags=cv2.inter_linear) but doesn't work me, have rotate every rectangle here: and not whole image. means, best way found it, warp...

python - How to change the distance between y axis points in matplotlib? -

sorry if stupid question, have done lot of searching cant find answer. using matplotlib generate plots data need space out distance between points on y axis. so how have matlibplot and want spaced out sampleplot ratioticks = (0.00001, 0.0001, 0.001, 0.01, 0.1, 1) line = plt.plot(x, ratioy, label='bcr:abl1 ratio(is)') line2 = plt.plot(x, sensy, label='sensitivity of detection (1/abl1)') line3 = plt.plot(x, sensx, label='target sensitivity') line4 = plt.plot(x, mrx, label='mmr') plt.setp(line, color='r', linewidth=2.0) plt.setp(line2, color='g', linewidth=2.0) plt.setp(line3, color='b', linewidth=2.0) plt.setp(line3, color='m', linewidth=2.0) plt.grid(which='both') plt.yticks(ratioticks) plt.ylabel('ratio on log scale') plt.xlabel('date') plt.title('level of bcr:abl1 normalised abl1 on international scale (is)') plt.show() thanks in advance :) you need call to: plt.yscal...

sonarqube - sonar c# rules removed from quality profile after upgrade 4.5.6 to 5.6 -

i've upgraded testing environment 4.5.6 c# 3.3 5.6 c# 5.3.2 noticed in upgrade process of sonar's c# rules have been omitted (e.g. "assignment should not used inside sub-expressions"), seems fxcop rules , common rules have migrated correctly. i noticed rule id have possibly changed. on 4.5.6 c# 3.3 rule id csharpsquid:assignmentinsidesubexpression, , on 5.6 c# 5.3.2 id csharpsquid:s1121 . reason? if so, why id changed? yes, that's reason. c# plugin 3.3 quite old. maybe 2 years, have dropped these legacy ids, , rules use sxxx format.

editor - ed - quoting control characters? -

how can search control characters in unix ed(1)? for example ed somefile.log <<eof 1,$s/.*\015// w q eof doesn't work. neither \r. sed(1), awk(1) , other editors can this, ed has useful line move (m) command need within bash script using. i able accomplish want within script entering control character directly (escaping c-v in vi, c-q in emacs example), means binary characters must present in otherwise printable text script. ed transport2svn-w0177.log <<eof g/^m/s/.*^m//p w q eof the ^m character 0x0d.

php - returning different results form 3 tables when the query is written the same way -

hello have form can select artist name or select song , choose date range , statistics all, trying achieve below, get number of played get number of songs problems both queries writing same, there way tackle in better way ? here db structure 3 tables plays : play_id | date songs : plid | aid artist : aid | artist_name sample variables $artist = sia $song = chandelier $start_date = 2016-09-06 $end_date = 2016-09-07 sample db data plays table a- play_id = 12 | date = 2016-09-06 b- play_id = 13 | date = 2016-09-07 c- play_id = 14 | date = 2016-09-07 songs table a- plid = 12 | aid = 34 b- plid = 12 | aid = 34 c- plid = 13 | aid = 34 d- plid = 14 | aid = 34 e- plid = 14 | aid = 34 artist table a- aid = 34 | artist_name = sia expected result a- number of plays per artist = 3 b- number of songs per artist = 5 query songs (this working correctly , counting songs correclty) $q2 = " select * songs s left join plays p ...

How to run javascript functions in sequence and waiting until each function finish -

basically, have 3 functions, , want run theses 3 functions in sequence (synchronous) , each function wait previous function finish. i've put timeout within functions simulate time execution, don't know if works. code is. //my 3 functions... function wait1() { settimeout(function(){ console.log('hello, function 1'); return 'ok'; },2000) } function wait2() { settimeout(function(){ console.log('hello, function 2'); return 'ok'; },2000) } function wait3() { settimeout(function(){ console.log('hello, function 3'); return 'ok'; },2000) } var tasks = [wait1,wait2,wait3]; var counter = 0; function iteratetasks(tasks) { runsequence(tasks[counter], function(){ counter++; if(counter < tasks.length) { iteratetasks(tasks); } }); } //@params func received function //@params cb received callback function function ...

ios - Quickblox webrtc video call not connected or not recieved -

i working quickblox webrtc video calling process. stuck on when 1 recive call , not getting response when user accept call method. this method not call , not getting pick call. -(void)session:(qbrtcsession *)session userdoesnotrespond:(nsnumber *)userid { if (session == self.session) { [self performupdateuserid:userid block:^(opponentcollectionviewcell *cell) { cell.connectionstate = [self.session connectionstateforuser:userid]; }]; } }

django - How get sum of total values in stackedBar ChartJs -

Image
i'm trying sum of values of stackedbar , include total in tooltip. note: datasets aren't static, example var barchartdata = { labels: ["january", "february", "march", "april", "may", "june", "july"], datasets: [{ label: 'corporation 1', backgroundcolor: "rgba(220,220,220,0.5)", data: [50, 40, 23, 45, 67, 78, 23] }, { label: 'corporation 2', backgroundcolor: "rgba(151,187,205,0.5)", data: [50, 40, 78, 23, 23, 45, 67] }, { label: 'corporation 3', backgroundcolor: "rgba(151,187,205,0.5)", data: [50, 67, 78, 23, 40, 23, 55] }] }; window.onload = function() { var ctx = document.getelementbyid("canvas").getcontext("2d"); window.mybar = new chart(ctx, { ...

Custom scrollspy jquery only works when handcoded -

i've been stuck while now. i'm trying make own scrollspy. thing works when handcoded, , if try through variables keeps giving me $(document).ready(function() { setinterval(check, 100); }); function isscrolledintoview() { var docviewtop = $(window).scrolltop(); var docviewbottom = docviewtop + $(window).height(); var year = $('.year').eq(2).attr("class"); var test = year.split(' '); test = test[1]; var elemtop = $(".item."+test).offset().top; var elembottom = elemtop + $(".item."+test).height(); return ((elembottom <= docviewbottom) && (elemtop >= docviewtop)); } var check = function(){ var itemslength = $('.year').length; (var = itemslength-1; >= 0; i--) { var year = $('.year').eq(i).attr("class"); var yearsplitted = year.split(' '); if(isscrolledintoview()) { $(".year.2016").a...

java - How can I run a runtime generated query with Pageable in Spring Data? -

i have runtime generated jpql string, , pageable object. want run jpql query pageable. how can that? e.g.: want solution runtime generated query string. @query("select u user u") page<user> findusers(pageable pageable); attempt 1 to use query generated @ runtime, repository method have declared as @query("?1") page<user> findusers(string query, pageable pageable) however, @query parsed @ time of initializing application context, approach fail because ?1 on own not valid jpql expression. attempt 2 if use @query("?1", nativequery = true) the context initialize , able pass generated query method, pageable parameter ignored because query passed method parameter used as-is. so, in short, no, looking cannot done pageable . attempt 3 if must generate query @ runtime, must perform pagination well. example query mysql underlying database: @query("select u user u order last_name, first_name off...

html - How to align images across different divs horizontally -

Image
can please me understand how align images horizontally across different divs in same row regardless of inner content of div? i've tried absolute positioning, i'm required interview test keep within inner div container. example: <div class="row"> <div class="col-md-3 product-box"> <div class="col-md-12 background-contain"> <p class="blue-title">product title 1</p> staring @ $500 <br> lorem ipsum dolor sit amet, consectetur adipiscing elit. <br> <div class="img-contain"> <img src="materials/images/cereal_b.jpg" class="img-responsive" alt="cereal" /> </div> <a class="bottom-link">learn more</a> </div> </div> <div class="col-md-3 product-box"> <div class="col-md-12 background-contain"> <p class=...

angular - alert message using ionic2 -

when click register button ,if enter fields going regsuccess page got message fill required feilds. but want show message alert using ionic2 , typescript. html: <button primary full (click)="register()" >register</button> <p>{{regmsg}}</p> .ts file: register(){ var _this= this; // this.submitattempt = true; if(!this.registrationform.valid){ _this.regmsg = "enter required feilds"; } else { console.log("success!") console.log(this.registrationform.value); _this.navctrl.setroot(regthankyoupage); } import { alertcontroller } 'ionic-angular'; // import alert controller export class mycomponent { regmsg: string; constructor(public alertcontroller: alertcontroller) {} showerrormsg(msg) { let alert = this.alertctrl.create({ title: msg, subtitle: '10% of battery remaining', buttons: ['dismiss'] })...

Trouble Creating An Array Of Objects in Java -

this sticking point: need create array of chair objects default woodtype. able declare array itself, values null. when try instantiate each chair object in array, errors. i'm not sure doing wrong when trying instantiate, please help. public class passign3 { public static void main(string[] args) { tableset set1 = new tableset(); tableset set2 = new tableset(5, 7, 4); // chair chr1 = new chair();//this works properly, setting wood oak // chair chr2 = new chair("pine");//works } } class tableset { table table = new table(); private int numofchairs = 2; //creates array can hold "numofchairs" references same num of //chair objects; not instantiate chair objects!!! chair[] chairarr = new chair[numofchairs]; //instantiate each chair object length of array //this loop not work; error: illegal start of type (int = 0; < numofchairs.length; i++) { chairarr[i] = new chair(); } ...

c++ - Printing a UTF-32 character to terminal -

i'm reading user input glfw using callbacks (set using glfwsetcharcallback) according page: http://www.glfw.org/docs/latest/input.html#input_char the callback function recieves pressed key 32-bit unsigned int. how can convert can print on screen? i've tried both codecvt c++11 , icu library, couldn't print readable characters terminal. this code of callback function: void inputmanager::charinputcallback(glfwwindow* window, unsigned int key) { uerrorcode errorstatus = u_zero_error; //initialize no error uconverter *utf32tounicode = ucnv_open("utf-32", &errorstatus); //create converter utf-32 <=> unicode if(u_failure(errorstatus)) std::cout << u_errorname(errorstatus) << std::endl; uchar unicode[10] = {0}; ucnv_touchars(utf32tounicode, unicode, 10, (char*)key, 4, &errorstatus); // fails u_illegal_argument_error if(u_failure(errorstatus)) std::cout << ...

sitecore8 - Sitecore WFFM validation not kicking in -

in sitecore 8.0 created new wffm validation test file upload size. did creating new class inherited formcustomvalidator , created matching sitecore validator , added new validator custom file upload field (duplicate of sitecore file upload field). unfortunately, validation not kicking in when place new field on form. did miss? public class filesizevalidator : formcustomvalidator { public int maxfilesize { { log.info("maxfilesize get", this); int maxsize; if (int.tryparse(classattributes["maxfilesize"], out maxsize)) { return maxsize; } return 0; } set { log.info("maxfilesize set", this); base.classattributes["maxfilesize"] = value.tostring(); } } public filesizevalidator() { ...

php sqlite - copy table to another database -

i want copy table db file fail , can't why. code: $db = new sqlite3($_server['document_root']."/db/098765.db"); $sql = "attach database 'admin.db' admin ; insert 'table-1' select * 'admin.table-1';"; $db->query($sql); i've read questions on topic on site, no answer helped me. giving full path attach database doesn't work. creating table before inserting data doesn't work. properly quote database object identifiers (table/column names etc) in insert statement. use use double quotes instead of single ones, string literals. better yet don't use dashes or other restricted characters in object names if possible (stick alphanumerics , underscore). use exec() instead of query() $dbpath = $_server['document_root']; $admindbpath = $dbpath; // or else $db = new sqlite3("$dbpath/db/098765.db"); $db->exec("attach database '$admindbpath/admin.db' admin...

iis 8 - ASP.NET Web API 2 compatibility -

i´m working web servicesrest, exist web api 2 question is, is possible install web api ii on windows server 2012 64bits, framework 4.5, iss v.8? yes, asp.net web api 2 supported on iis 8.

boost::python - how to invoke a python function in its own thread from C++? -

i have module written in python. module sort of interface many different functionalities implemented in python: embeddinginterface.py imports module , creates instance: import cppcontroller cppcontrollerinstance = cppcontroller() i use cppcontrollerinstance in c++. have done far: #include <python.h> #include <boost\python.hpp> using namespace boost; python::object createcontroller() { try { py_initialize(); python::object mainmodule = python::import("__main__"); python::object mainnamespace = mainmodule.attr("__dict__"); python::dict locals; python::exec( "print \"loading python implementetion:\"\n" "import sys\n" "sys.path.insert(0, \"c:\\projects\\python\\projectname\\panda\")\n" "import embeddinginterface\n" "controller = embeddinginterface.cppcontrollerinstance\n...

windows - Reading MS Access (.mdb, .accdb) into R; Mac to PC conversion -

i working on program pulls data out of .mdb , .accdb files , creates appropriate tables in r. my working program on mac looks this: library(hmisc) p <- '/users/josh/desktop/directory/' mdbfilename <- 'x.mdb' mdbconcat <- paste(p, mdbfilename, sep = "") mdb <- mdb.get(mdbconcat) mdbnames <- data.frame(mdb.get(mdbconcat, tables = true)) list2env(mdb, .globalenv) accdbfilename <- 'y.accdb' accdbconcat <- paste(p, accdbfilename, sep = '') accdb <- mdb.get(accdbconcat) accdbnames <- data.frame(mdb.get(accdbconcat, tables = true)) list2env(accdb, .globalenv) this works fine on mac, on pc i'm developing for, error message: error in system(paste("mdb-tables -1", file), intern = true) : 'mdb-tables' not found i've thought lot using rodbc , program allows me have tables arranged in way subsequent querying , dplyr functions work. there way these function work on windows machine? ...

image - montage command of ImageMagick does not read from file -

Image
i use ubuntu 14.0.4 . can use command label each image it's name: montage -label '%t' -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png i want label images list of strings, written in text file. docs say : -label name use option assign specific label image ... if first character of string @, image label read file titled remaining characters in string. labels in file literal, no embedded formatting characters recognized. but not use file provide label. use command this: montage -label @un.txt -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png above, un.txt name of text file in ./img/ path. sample result: in result, images labeled string @un.txt instead of content of un.txt . error in terminal : montage.im6: improper image header `./img/un.txt' @ error/txt.c/readtxtimage/429 if move un.txt current ( . ) directory , run above command again, image (there no label) , below error: ...

d3.js - Tool tip showing NaN error in D3 Multi Line Graph -

i have customized d3 multi series line graph according requirements. new d3 graphs , javascript. when added tooltip , ran code, showed me div 2 nan values. have been struggling quite long if 1 can me here, appreciated. <script> var svg = d3.select("svg"), margin = {top: 20, right: 80, bottom: 30, left: 140}, width = svg.attr("width") - margin.left - margin.right, height = svg.attr("height") - margin.top - margin.bottom, g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var parsetime = d3.timeparse("%y%m%d"); var x = d3.scaletime().range([0, width]), y = d3.scalelinear().range([height, 0]), z = d3.scaleordinal(d3.schemecategory10); var line = d3.line() .curve(d3.curvebasis) .x(function(d) { return x(d.date); }) .y(function(d) { return y(d.temperatu...

c - Use of malloc in Pthreads -

this actual c code pthreads: threadparms *parms = null; if ((parms = (threadparms *) malloc (sizeof (*parms))) == null) { goto fail0; } parms->tid = thread; parms->start = start; parms->arg = arg; why did choose malloc *parms instead of threadparms? looks allocating pointer (which error), apparently allocating size of whole structure. correct? this common trick in c - using dereference pointer expression in place of actual type. the rationale follows: if have some_type *some_var = malloc(sizeof(*some_var)); and change some_type some_other_type , code continue working fine 1 change. however, if start with some_type *some_var = malloc(sizeof(some_type)); then have change some_type in 2 places: some_other_type *some_var = malloc(sizeof(some_other_type)); or code have error. it looks allocating pointer (which error) the asterisk makes sizeof evaluate size of entire struct , code correct.

javascript - "minimumDate" feature of YUI 3 calendar is not working in Internet Explorer, is there any alternate hack available for the default calendar API? -

my code looks follows. <script> var yahoo_yui=yui(); yahoo_yui.use('calendar', 'datatype-date', 'cssbutton', function (g) { minimum_date="2016-10-7"; calendar = new g.calendar({ contentbox: "#yahoo-calendar", width:'340px', showprevmonth: false, shownextmonth: true, minimumdate: new date(minimum_date), date:new date(minimum_date.split(",").join("/")) }).render(); var dtdate = g.datatype.date; calendar.on("selectionchange", function (ev) { var newdate = ev.newselection[0]; g.one(".yahoo_date_selected").set('value',dtdate.format(newdate)); g.one("#yahoo-calendar").toggleview(); }); g.all("#togglecalendar,.yahoo_date_sele...

tensorflow - Error in 'ValidationMonitor' when passing 'metrics' parameter -

i'm using following code log accuracy validation measure (tensorflow 0.10): validation_metrics = {"accuracy": tf.contrib.metrics.streaming_accuracy} validation_monitor = tf.contrib.learn.monitors.validationmonitor( input_fn=input_fn_eval, every_n_steps=flags.eval_every, # metrics=validation_metrics, early_stopping_rounds=500, early_stopping_metric="loss", early_stopping_metric_minimize=true) after running, in 'every_n_steps', see following lines in output: info:tensorflow:validation (step 1000): loss = 1.04875, global_step = 900 the problem when 'metrics=validation_metrics' parameter uncomment in above code, following error in validation phase: info:tensorflow:error reported coordinator: <type 'exceptions.typeerror'>, input 'y' of 'equal' op has type int64 not mat...

javascript - How to make two arrays match by filling in zeroes? -

in javascript i'm grabbing results here, , putting them 2 variables: ticks , s1. var viewmodel = @html.raw(json.encode(model)); var items = viewmodel.date1; var items2 = viewmodel.date2; var newcount; var ticks = []; var s1 = []; var colors = []; (var = 0; < items.length; i++) { newcount = items[i].thecount / items2[i].thecount * 100; ticks.push(items[i].thecycle); s1.push(newcount); if (newcount < 98) colors.push("#ff2f2f"); else colors.push("#00749f"); } the results this: how many where b.active_serv != 0 - items cycle count 1 823 6 530 7 475 9 962 10 591 11 121 13 751 15 716 50 133 100 39 the total of them (without clause) -items2 cycle count 1 833 6 532 7 492 9 967 10 611 11 121 13 767 14 37 15 816 16 71 19 3 21 101 23 11 50 133 100 39 as see, there mor...

c++ - QML How to dynamically access ListView items -

i have listview has dynamically added items, , kinda want know how access items example index. specifically, want have color of item rectangle change when change color using color dialog. guessed should maybe possible first set variable current item before calling color dialog , in onaccepted method change color of item using variable, don't know how achieve of in qml, because rather new qml. maybe can offer cleaner way change color of item's rectangle when color dialog closed (onaccepted). thx help! :) import qtquick 2.0 import qtquick.window 2.2 import qtquick.controls 1.4 import qtquick.dialogs 1.2 import qtquick.controls.styles 1.4 rectangle { id: listviewcontainer width: parent.width/10*9; height: 50 behavior on height { numberanimation { duration: 100; } } gradient: gradient { gradientstop {position: 0.0; color: "white" } gradientstop {position: 1.0; color: "silver" } } ...

c# - What to do when AccessViolationException in .NET 4 app defies MSDN documented behavior? -

i have .net 4 application written windows service, includes unmanaged components, , printing accessviolationexception log4net logs, not crashing application. issue sounds impossible. below think happening, , wondering next steps developer should be? issue not happening in parallel replay environment same data feed production. the memory corruption issue manifests accessviolationexception, stack trace blaming ssis runtime “dts”. dataloaderwinsvc.exe .net 4 application, registered/running windows local service. microsoft changed clr in .net 4 accessviolationexception cause application crash default. dataloaderwinsvc.exe, however, not crash. led me investigate how possibly be? there 1 way let developers handle exception in .net 4, dataloaderwinsvc.exe code not using [handleprocesscorruptedstateexceptions] technique. https://msdn.microsoft.com/en-us/library/system.accessviolationexception(v=vs.110).aspx#anchor_6 : starting .net framework 4, accessviolationexception ...

javascript - Adding an index to an existing object store in IndexedDB -

how add index created object store, within upgrade needed event? doing on new object store documented: request.onupgradeneeded = function(event) { var db = event.target.result; var objectstore = db.createobjectstore("my-store", { keypath: "id" } ); objectstore.createindex("idx_name", "index_this", { unique: false }); }; but how can add index object store created? request.onupgradeneeded = function(event) { var db = event.target.result; if (!db.objectstorenames.contains("my-store")) { var objectstore = db.createobjectstore("my-store", { keypath: "id" } ); } var mystore = ?????????????; if (!mystore.indexnames.contains("idx_name")) { mystore.createindex("idx_name", "index_this", { unique: false }); } }; you want retrieve reference object store transaction implicitly provided within scope of onupgradeneeded function. function ...

ghc - Running and compiling 'Hello, World!' in Haskell -

i new haskell , having issue running following code: module main ( main ) main = putstrln "hello, world!" sublimehaskell tries compile , run above using runhaskell hello.hs which returns error hello.o: getmodificationtime: invalid argument (the system cannot find file specified.) i have tried run using ghc --make hello.hs with same error. when try manually compile code before running using command line ghc -c hello.hs i different error: createdirectory ".": invalid argument (cannot create file when file exists.) on other hand, can run program via repl without issue: ghci ghci, version 8.0.1: http://www.haskel.org/ghc/ :? prelude> putstrln "hello, world!" hello, world! if it's relevant, using windows 7, , installed ghc using haskell platform installer. ***edit running above commands -v flag gives following results: ghc -v hello.hs glasgow haskell compiler, version 8.0.1, stage 2 booted ghc version 7.10.2 u...

MySql Reblog/Retweet -

i've incorporated reblog system in app i'm building having hard time figuring out logic retrieve posts and reblogs in same stream. i have post_reblog pivot table store post_id , user_id - id of user reblogged post. the following query retrieves posts, not reblogged post - original. can't figure out how retrieve both original post and reblogged post , share them in same stream. select * posts status = 'published' or id in (select * (select post_id post_reblog ) subquery) my tables posts post_id (int) user_id (int) title (varchar) body (text) post_reblog post_id (int) user_id (int) the issue reblogged posts in query. when use or that, each row able appear once. 1 possible solution union: select post_id, user_id 'original poster', user_id 'current poster', title, body posts status = 'published' union select p.post_id, p.user_id 'original poster', pr.user_id 'current post...

How can I print to console after button press?(Python 3.5) -

this question has answer here: why button parameter “command” executed when declared? 4 answers when run code "15" printed console. how can print after press button? from tkinter import * def mult(n): print (n*3) top = tk() b1 = button(top, text = "enter number", command = mult(5)) b1.pack() top.mainloop() function arguments evaluated before calling function. make callable: from tkinter import * def mult(n): print (n*3) top = tk() b1 = button(top, text = "enter number", command = lambda: mult(5)) b1.pack() top.mainloop()

python - How can one replace missing values with median or mode in SFrame? -

i'm going through graphlab documentation , trying figure out how duplicate pandas functionality na values replaced median, mean, or mode, etc... in pandas by: df.dropna().median() or df.dropna().mean() etc.... but documentation on dropna , fillna functions sframe don't mention similar. possible @ in sframe? there one, mean available, not median. have at: graphlab.toolkits.feature_engineering.numericimputer ( doc ) impute missing values feature means. input columns numericimputer must of type int, float, dict, list, or array.array. each column in input, transformed output column input retained if: there no missing value. inputs not satisfy above set mean value of feature. if median want, achieve with: data.fillna('feature_name', np.median(data['feature_name']))