Posts

Showing posts from June, 2013

java - Runnable wont stop -

i making game if player intersects bear, stop runnable thread. somehow wont stop @ all. when player intersects bear, player should dead. dead loop called not stop runnable. made runnable loop below protected void movement() { final int delay = 5; speed = 20; r = new runnable() { @override public void run() { if (countscore % 300 == 0) { speed = speed + 5; } bear1.sety(bear1.gety() + speed); bear2.sety(bear2.gety() + speed); reframeroad(); if ((animimageview.getx() < bear1.getx() + 50 && animimageview.getx() > bear1.getx() - 50) || (animimageview.getx() > bear2.getx() && animimageview.getx() < bear2.getx())) { system.out.println("goes inside getx intersects x "); dead(); } if (rect.intersects(thiefrect, bear1rect) || rect.intersects(thiefrect,...

android - SQLite database problems, Really unsure -

im trying create simple database using sqlite , im coming error when running application. app runs fine, until press button save data database, error message im getting is.. 04-19 13:47:00.492 26807-26807/com.example.bash1.sqlitediss e/openglrenderer: getting max_texture_size gradiencache 04-19 13:47:00.500 26807-26807/com.example.bash1.sqlitediss e/openglrenderer: max_texture_size: 16384 04-19 13:47:00.520 26807-26807/com.example.bash1.sqlitediss e/openglrenderer: getting max_texture_size caches::initconstraints() 04-19 13:47:31.164 26807-26807/com.example.bash1.sqlitediss e/sqlitelog: (1) near "tablestock_table": syntax error 04-19 13:47:31.164 26807-26807/com.example.bash1.sqlitediss e/androidruntime: fatal exception: main process: com.example.bash1.sqlitediss, pid: 26807 android.database.sqlite.sqliteexception: near "tablestock_table": syntax error (code 1): , while compiling: create tablestock_table (idnamedatereceivedexpirydate) my code function follow...

Posting data from webpage using JavaScript PHP jQuery to Google Sheet -

before duplicate, hear me out. followed answer ( jquery ajax post example php ), trying send data google sheet. have got code working on google sheet, can add data running code directly sheet. however, getting work webpage apparently problem. though have followed answer question posted above, think there more @ play here has lack of experience working in area. the code below floating footer , contained within code of whole webpage (where jquery-1.11.0.min.js , jquery-migrate-1.2.1.min.js have been called). when click on submit button, page looks processes request, nothing ever appears on google sheet, sheet1 ( https://docs.google.com/spreadsheets/d/19l2kshdbkewtifx44fxlbdvcokjy7vqpf4iw6c1xazc/edit?usp=sharing ). #document <html> <body> <div class="floater-footer" id="the-floater-footer"> <span id="mytestspan"></span> <div class="row"> <div class="col-md-1 col-sm-2 col-xs-3"><p...

Git merge commits selectively -

i have question git i've never had do, learn! in project branched off master while back; rewrite of entire codebase, let's call rewrite . in time have been working on rewrite have made , deployed significant changes master . rewrite coming close, want bring speed changes made on master since started branch. usually git checkout rewrite && git rebase master , solve conflicts arise, time around can guarantee every commit have conflict since codebase entirely different. tl;dr wondering how go taking each commit on master , one-by-one merging them rewrite , @ own pace , possibly out of order if need be. you can use git cherry-pick command put specific commit branch. you can use gitk --all see commits , select commit want cherry-pick interactively branch.

amazon web services - AWS ECS running a task that requires many cores -

i conceptually trying understand how use aws ecs run " cluster " jobs. i have scientific software inside docker container, natively takes advantage of many cores underlying instance has offer. my question in case is , can use aws ecs "increase" number of "visible" cores task running inside docker container. instance, "cluster" limited single instance? or "cluster" expandable multiple instances? i haven't been able find answers looking through aws docs. i had similar situation moving python app used script spawn copies of based on number of cores. answer isn't ecs problem docker best practice... should strive use 1 process per container. (see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/ ) how ended implementing using dockerfile run each process , used essential ecs tasks reload if task died. your cluster collection of ec2 instances ecs service running. each instance has num...

android - How background changes at login in Instagram app? -

i have made app change background color every few milliseconds. not appealing user. if have seen instagram's login screen, changes color @ soft rate , blurry effect. i wanted type of background app. should have that using following code might start you: public class backgroundpainter { private static final int min = 800; private static final int max = 1500; private final random random; public backgroundpainter() { random = new random(); } public void animate(@nonnull final view target, @colorint final int color1, @colorint final int color2) { final valueanimator valueanimator = valueanimator.ofobject(new argbevaluator(), color1, color2); valueanimator.setduration(randint(min, max)); valueanimator.addupdatelistener(new valueanimator.animatorupdatelistener() { @override public void onanimationupdate(valueanimator animation) { target.setbackgroundcolor((int) animation.getanimatedvalue()); } }); value...

php - Grouping Results from database -

i trying display results in category's based on id information data base creates category header on again. for example: title category demo cat 1 topic 1 cat 1 title category demo cat 1 topic 2 cat 1 title category demo cat 2 topic 3 cat 2 when should display: title category demo cat 1 topic 1 cat 1 topic 2 cat 1 title category demo cat 2 topic 3 cat 2 <table class="table table-bordered table-hover"> <?php $sql = "select * forums, forum_categories forum_categories.cat_id = forums.cat_id order forum_categories.cat_id"; $result = query($sql); while (($row = mysqli_fetch_assoc($result)) != false) { $cat_id = $row['cat_id']; $cat_title = $row['cat_title']; echo "<thead>"; echo "<tr>"; echo "<th colspan='4'>$cat_title</th>"; "</tr>"; ...

javascript - immutablejs : find if map contains key value -

i trying determine whether or not part of immutable map contains key value, checked: true , , if so, set checked: true on upper level. object looking on looks so: const memo = { "topics": { "filters": { "psychological disorders": { "filters": { "anxiety disorders": { "filters": {}, "checked": true <-- check value @ level } } } }, "isopen": false } } note: data immutable. so after function ran change : const memo = { "topics": { "filters": { "psychological disorders": { "checked": true, <-- check true added "filters": { "anxiety disorders": { "filters": {}, "checked": true } } } }, ...

osx - Can't find catalina.out in OS X 10.11.3 inside apache-tomcat-8.0.33 -

i've installed apache-tomcat-8.0.33 , deploying application has errors can't see catalina.out inside /usr/local/apache-tomcat-8.0.33/logs i find file localhost_access_log.2016-04-19.txt content: 0:0:0:0:0:0:0:1 - - [19/apr/2016:20:10:31 +0200] "get /manager/ http/1.1" 302 - 0:0:0:0:0:0:0:1 - - [19/apr/2016:20:10:32 +0200] "get /manager/html http/1.1" 401 2473 0:0:0:0:0:0:0:1 - admin [19/apr/2016:20:10:33 +0200] "get /manager/html http/1.1" 200 17910 0:0:0:0:0:0:0:1 - - [19/apr/2016:20:10:33 +0200] "get /manager/images/asf-logo.gif http/1.1" 200 7279 0:0:0:0:0:0:0:1 - - [19/apr/2016:20:10:33 +0200] "get /manager/images/tomcat.gif http/1.1" 200 2066 0:0:0:0:0:0:0:1 - - [19/apr/2016:20:10:33 +0200] "get /favicon.ico http/1.1" 200 21630 0:0:0:0:0:0:0:1 - admin [19/apr/2016:20:11:07 +0200] "get /manager/html http/1.1" 200 16678 0:0:0:0:0:0:0:1 - admin [19/apr/2016:20:11:07 +0200] "get /manager/images...

Python: Loaded NLTK Classifier not working -

i'm trying train nltk classifier sentiment analysis , save classifier using pickle. freshly trained classifier works fine. however, if load saved classifier classifier either output 'positive', or 'negative' examples. i'm saving classifier using classifier = nltk.naivebayesclassifier.train(training_set) classifier.classify(words_in_tweet) f = open('classifier.pickle', 'wb') pickle.dump(classifier, f) f.close() and loading classifier using f = open('classifier.pickle', 'rb') classifier = pickle.load(f) f.close() classifier.classify(words_in_tweet) i'm not getting errors. idea problem be, or how debug correctly? the place pickled classifier can go wrong feature extraction function. must used generate feature vectors classifier works with. the naivebayesclassifier expects feature vectors both training , classification; code looks if passed raw words classifier instead (but presumably after unpickling, ot...

hadoop - Sqoop incremental export using hcatalog? -

is there way use sqoop incremental exports ? using hcatalog integration sqoop.i tried using --last-value, --check-column options used incremental import, sqoop gave me error options invalid. i have not seen incremental sqoop export arguments. other way try create contol_table in hive keep log of table name & timestamp when last exported every time. create table if not exists control_table ( table_name string, export_date timestamp ); insert control_table 'export_table1' table_name, from_unixtime(unix_timestamp()) export_date control_table; if export_table1 table want export incrementally , assuming if have executed above 2 statements. --execute below @ once --get timestamp when table last executed create temporary table control_table_now select table_name, max(export_date) last_export_date control_table group table_name; --get incremental rows create table new_export_table1 select field1, field2, field3, .... timestamp1 export_table1 e, control_ta...

Does db.session.commit() terminate a SQLAlchemy session? -

does db.session.commit() terminate sqlalchemy session? i suspect answer no, , have additionally call db.session.close() , wanted confirm. no, doesn't. commits current transaction. can still issue additional queries after commit. transaction started automatically if do. relevant documentation here .

ios - Face filter implementation like MSQRD/SnapChat -

i want develop live face filters msqrd/snapchat live filters did not able find out how should proceed should use augmented reality framework , detect face or use core image detect face , process accordingly. please let me know if has idea how implement same? i recommend going core image , cidetector . https://developer.apple.com/library/ios/documentation/graphicsimaging/conceptual/coreimaging/ci_detect_faces/ci_detect_faces.html has been available since ios 5 , has great documentation. creating face detector example: cicontext *context = [cicontext contextwithoptions:nil]; // 1 nsdictionary *opts = @{ cidetectoraccuracy : cidetectoraccuracyhigh }; // 2 cidetector *detector = [cidetector detectoroftype:cidetectortypeface context:context options:opts]; // 3 opts = @{ cidetectorimageorientation : [[myimage properties] valueforkey:kcgi...

vba - Combine Two Rows in Excel -

Image
i have 2 rows in excel sheet . columns identical except one.something how can achieve ? not familiar pivot concept. any ? regards. hope want: sub quickcombine() dim x() dim y() dim objdic object dim lngrow long dim lngcol long dim ws worksheet x = range([a1], cells(rows.count, "g").end(xlup)) y = x set objdic = createobject("scripting.dictionary") lngrow = 1 ubound(x, 1) if not objdic.exists(lcase$(x(lngrow, 1) & x(lngrow, 2))) objdic.add lcase$(x(lngrow, 1) & x(lngrow, 2)), lngrow else y(lngrow, 1) = vbnullstring y(objdic.item(lcase$(x(lngrow, 1) & x(lngrow, 2))), 3) = y(objdic.item(lcase$(x(lngrow, 1) & x(lngrow, 2))), 3) & "," & x(lngrow, 3) end if next set ws = sheets.add [a1].resize(ubound(x, 1), ubound(x, 2)) = y columns("a").specialcells(xlblanks).entirerow.delete end sub go...

php - How can an abstract class be executed if it cannot be instantiated -

i trying out oop programming in php , when instantiated class, generated error saying that class needs abstract. when class need abstract? , how can abstract classes called? thanks i can't think of situation error class needs abstract. more got error when trying instantiate abstract class. along lines of "cannot create instance of abstract class". abstract classes cannot not instantiated directly. instead extended child class (a concrete class) can instantiated. abstract class template provides common functionality other sub-classes. includes abstract methods child classes must implement.

node.js - Mongoose async queries -

i have site on nodejs-express , when user increment balance: user.update({steamid: user.steamid}, {$set: {wallet: user.wallet + 1)}}, function(err){ if(err) console.log(err); }); but when user increment "wallet" @ least twice in row mongoose add 1 point in "wallet". should do? maybe add queue array , call async? you should increment instead of set. user.update({steamid: user.steamid}, {$inc:{wallet:1}}, function(err){ if(err)console.log(err) }); i use when don't need information model quantity , need difference value operate on model itself.

jquery call the iframe document ready after parent load completed -

in parent window there few tabs shown. on parent window think there code of click unable access or view parent page. $(document).ready(function(){ $('.tab').click(function(){ // something. show/hide tab panel according tabs }); }) on frame window $(document).ready(function(){ // add new tab in parent window frame. $("#parenttab", parent.document).after('<a href="#" class=".tab" tabid="newtab">new tab</a>'); // add panel in parent window new tab $("#parenttabpanel", parent.document).after('<div tabid="newtab">some content</div>'); }) this code works fine , not showing js error. iframe content load , added tabs on parent window. when click on newtab doesn't show tabpanel. strange when ctrl+refresh browser works. i not work when first time load why? please me solve issue. copy parent tab click event new added tab. possible? how check. ...

Where i can learn about openstack and cloud computing -

where can learn openstack , cloud computing sites proper courses , video tutorials prefered , have no knowledge them. i way learn openstack getting hands dirty it. try install single node openstack devstack setup (which cake walk, google it). setup, learn can powerful openstack, install multinode openstack setup give understanding of basic working flow. go through this official openstack documentation multi-node setup in order understanding of networking involved follow link: https://blogs.oracle.com/ronen/entry/diving_into_openstack_network_architecture for anyother openstack related doubt post queries in https://ask.openstack.org hope helpful.

c# - Using $all and match patterns -

i have collection in mongodb, each document contains array called "tags" distinct, lowercase array of strings. have distinct array of strings(called t on). query finds every document have similar entry in it's "tags" array every element in t. this working query: { "tags" : { "$all" : [ /foo/, /bar/ ] } } how execute query c#? here query came with: return item in items.asqueryable() t.all(t => item.tags.contains(t)) select item; this want. problem uses equality operator, matching elements in item.tags , t must same: { "tags" : { "$all" : [ "foo", "bar" ] } } my other attempt looked this: return item in items.asqueryable() t.all(t => item.tags.all(tag => tag.contains(t)) select item; however resulted in unsupported operation exception, guess because $...

javascript - Typescript String Comparison Oddity with String.toLowerCase -

while curious (and no js background) i'm beginning dive typescript , face brick wall. want compare 2 strings , make life easy aligned lowercase first. code: let bool: boolean = false; let = 0; this.comparisons[++i] = " init bool " + " => " + bool; bool = false; if ("a" == "a") { bool = true }; this.comparisons[++i] = ' "a" == "a" ' + " => " + bool; bool = false; if ("a" == "b") { bool = true }; this.comparisons[++i] = ' "a" == "b" ' + " => " + bool; bool = false; if ("a" == "a") { bool = true }; this.comparisons[++i] = ' "a" == "a" ' + " => " + bool; bool = false; if ("a".tolowercase == "a".tolowercase) { bool = true }; this.comparisons[++i] = ' "a".tolowercase == "a".tolowercase ' + " => " + bool; bool = fal...

python - Why does installing IPython need sudo even when using --user? -

i'm trying install ipython so: pip install --user --src ~/pipsrc ipython and error: oserror: [errno 13] permission denied: '/usr/local/lib/python2.7/dist-packages/' why pip want install (some of?) ipython here? update: after installation sudo , there still nothing in "/usr/local/lib/python2.7/dist-packages/ipython" — maybe it's bug in ipython installer?

php - Setting up lighttpd to run Wallabag -

i trying set-up lighttpd have vhost pointing @ wallabag installation. have not made many changes default lighttpd.conf apart change server.document-root "/var/www/wallabag/web". settings when accessing server ip idex of files contained in /wallabag/web rather automatically loading app.php. if click app.php app load fine , work, wanting have load default. if change lighttpd.conf include app.php in index-file.names 404 - not found error. reason appears tries load myserver.example/login whereas other configuration goes myserver.example/app.php/login. i assuming there minor missing settings can't find answer when searching. for reference raspberry pi 2 jessie version of raspbian lighttpd installed on. thanks in advance or suggestions. managed work out solution: server.modules = ( "mod_fastcgi", "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", ) server.document-root = ...

Call WSDL/SOAP Services in Play Framework Scala -

i'm new play framework & scala want call wsdl/soap services in play , wonder how can call wsdl service like http://www.example.com/webservice?wsdl & send parameters : (1324643,"ali","khahli") method(action) name example : requestscore easy in ruby/php/elixir can't imagine in scala & play.

c# - MVC5 Custom Binding: List of Strings to List of Complex Type -

in asp.net mvc 5 application i'm writing, 1 material can have many names ( materialname s). have build web interface add, edit, , delete names material on edit , create pages of material. achieve have multiple text - input s on pages named material.materialnames . can added , deleted client-side javascript change number of names. not need indices in name s of input s because data user should see , edit flat list of strings. these relevant parts of models: public class materialvm { public material material { get; set; } // ... } public class material { public int id { get; set; } public list<materialname> materialnames { get; set; } // ... } public class materialname { public int id { get; set; } public string name { get; set; } public int materialid { get; set; } } now work great if material.materialnames of type list<string> . in case model binder can not create materialname s multiple string values passed form data. believ...

java - SimGrid. Receive only specified type of task -

this method receiving сertain type of task host : task = task.receive(string mailbox); if (task instanceof sometask): sometask sometesk = (sometask) task; // but there way receive directly sometask sometask = sometask.receive(string mailbox) ? filtering tasks want receive not developed in java in c version of msg (yet). use anther mailbox not mix tasks, avoid difficulty of sorting them out afterward. there no trivial example in simgrid examples, several applications use feature. example bittorrent example (that not trivial) use 1 mailbox regular communications intended current host, , mailbox receive messages tracker. way, cannot message random peer when expect message tracker.

android - Trying to implement button click sound with MediaPlayer crashes -

i have custom view (a button) , want have sound when pressed. private void playsound() { if (mediaplayer == null) initmediaplayer(); try { if (mediaplayer.isplaying()) mediaplayer.stop(); mediaplayer.prepare(); mediaplayer.start(); } catch (ioexception e) { e.printstacktrace(); } catch (illegalstateexception e) { e.printstacktrace(); } } private void initmediaplayer() { try { assetfiledescriptor afd = getcontext().getassets().openfd("music/number_tap.m4a"); mediaplayer = new mediaplayer(); mediaplayer.setdatasource(afd.getfiledescriptor(), afd.getstartoffset(), afd.getlength()); } catch (ioexception e) { e.printstacktrace(); } } i call playsound method every time button clicked. works long there 1 button on screen. no problem @ all. it crashes if have more buttons on screen , press first button couple of times (works) , other button 2 times ...

reading a .csv file into an array in java -

i have class called empquery trying create array of objects employee class hold data comes employeedatabase.csv file. database appears shown below. need use stream-processing-algorithm.. loop till eof{ read in 1 record deal record completly } ex. employee id,full name,department,start date,earnings emp001,adele m. fulton,engineering,10/28/2008,"$104,000.00" emp002,ali t. herman,engineering,2/27/2012,"$337,522.00" emp003,alika c. crawford,engineering,6/2/2009,"$144,000.00" so far have set public class employeedb { private static string[] empid = new string[300]; private static string[] empname = new string[300]; private static string[] department = new string[300]; private static string[] startdate = new string[300]; private static string [] earnings = new string[300]; private static string [] empdatabase = new string[300]; /** * @param args command line arguments * @throws java.io.filenotfoundexception ...

Analysing URL's using Google Cloud Vision - Python -

is there anyway can analyse url's using google cloud vision. know how analyse images store locally, can't seem analyse jpg's exist on internet: import argparse import base64 import httplib2 googleapiclient.discovery import build import collections import time import datetime import pyodbc time_start = datetime.datetime.now() def main(photo_file): '''run label request on single image''' api_discovery_file = 'https://vision.googleapis.com/$discovery/rest?version=v1' http = httplib2.http() service = build('vision', 'v1', http, discoveryserviceurl=api_discovery_file, developerkey=insert api key here) open(photo_file, 'rb') image: image_content = base64.b64encode(image.read()) service_request = service.images().annotate( body={ 'requests': [{ 'image': { 'content': image_content ...

python - tensorflow trace doesn't work -

i'm new tensorflow. have tensor x follows: >>> x.eval() array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=int32) i want calculate trace of tensor, use tf.trace , throws error: >>> tf.trace(x) traceback (most recent call last): file "<stdin>", line 1, in <module> attributeerror: 'module' object has no attribute 'trace' how can fix it? many thanks works me import tensorflow tf x = tf.constant([[1, 2, 3],[4, 5, 6],[7, 8, 9]], dtype=tf.int32) sess = tf.interactivesession() x.eval() tf.trace(x).eval() this prints [[1 2 3] [4 5 6] [7 8 9]] 15

r - dplyr - group_by and count if variable satisfies condition -

i've got problem seems quite simple conceptually yet i'm having hard time accomplishing in r (and examples i've found online many (using dplyr) yet not seem @ i'm looking for). here's example below: i've got 3 variables: response (factor), type (factor), , status (factor). basically, i'm trying figure out how many times (frequency) particular response appears each type if status equals 1. responses between 0-10. below example dataframe: response type status 5 0 5 1 2 0 0 0 6 1 1 1 9 0 3 1 4 1 0 1 9 0 1 0 0 1 7 0 5 b 1 4 b 1 4 b 1 8 b 0 7 b 1 8 b 0 2 b 0 0 b 1 10 b 0 3 b 0 1 b 0 9 b 0 4 b 1 1 b 1 the end-result i'm looking displayed below, responsescale shows full range of response options available (0-10), , count displays frequency particular response appear given responsescale. type responsescale count 0 2 1 ...

angularjs - Cannot access $rootScope property from controller? -

in angular's run block setting 1 property on $rootscope when controller executes property doesn't exists on $rootscope. when application starts, in debugger see "adal:loginsuccess" handler gets executed , $rootscope.isadmin sets "true", when controller start executing $rootscope.isadmin doesnt exists on $rootscope. why? below code app.js var main = angular.module('mymodule', [ 'nganimate','ngroute','mycontrollers','adalangular'... ]); main.config(['$httpprovider','adalauthenticationserviceprovider', function ($httpprovider,adalprovider) { adalprovider.init( { // config azure client id here }, $httpprovider ); }]); main.run(["$rootscope", "$state", "api", "usspinnerservice", function ($rootscope, $state, api, usspinnerservice,) { ...

css - Media Queries issue with Ipad and Android Tablet -

i facing issue ipad , android tablets media queries in landscape mode. i need regarding proper media queries. here media queries using: android landscape: @media screen , (min-device-width : 800px) , (max-device-width: 1280px) , (orientation : landscape) {} ipad landscape: @media screen , (min-device-width : 768px) , (max-device-width: 1024px) , (orientation : landscape) {} use @media (min-width : 800px) , (max-width: 1280px) {} @media (min-width : 768px) , (max-width: 1024px) {} for reference /* large desktop */ @media (min-width: 1200px) { ... } /* portrait tablet landscape , desktop */ @media (min-width: 768px) , (max-width: 979px) { ... } /* landscape phone portrait tablet */ @media (max-width: 767px) { ... } /* landscape phones , down */ @media (max-width: 480px) { ... }

Performance improvement for web services -

we have webservice, called provide delivery date of product, while purchasing in ecomm website. we using ibm sterling order management in backend, , oob webservice , oob service. this webservice (wsdl) taking more time, more 40 seconds, create timeoutexception in other integrated systems (middleware). so want improve performance of webservice. please me provide way improve performance ? improved if server's spec has been upgraded ? oob service, can't customize it. first of need figure out performance bottleneck. start put verbose trace on oob webservice. use logs , see if can zero-in on particular component or sql taking consuming majority of time. if it's sql, can tune/baseline oob query/tables using indexes. if have user exits implemented (for oob api), ensure lean , aren't making expensive api calls changeorder api.

Stepwise function in gnuplot -

Image
i want know how create plot of stepwise function in gnuplot. function want plot includes operations cost several distance range , multiple products. instance, if distance 0-300 km product 1 cost 1.05 $/km , product 2, 0.86 $/km. when distance increases, cost each product decrease. i have defined 1 function each product , plot them functions together: gnuplot> f(x)=x<=300 ? 1.05 : x<=650 ? 0.65 : x<=1300 ? 0.46 : x<=1950 ? 0.4 : x<=3250 ? 0.31 : 0.22 gnuplot> x<=300 ? 0.86 : x<=650 ? 0.53 : x<=1300 ? 0.38: x<=1950 ? 0.32 : x<=3250 ? 0.24 : 0.19 gnuplot> plot [0:5000][0:3] f(x), g(x) there 1 problem: can not remove vertical lines. idea? thanks help there 2 approaches can take. best approach use datafile, can use functions, although more difficult. datafile approach you going have trouble doing function, because going vertical lines. datafile gives little better control, , allows mark end points of pieces of piecewise ...

Change file name of toStream() in node.js html-pdf npm module -

i trying change file name of pdf generated npm module html-pdf. the issue do not want save copy of pdf, stream email service ( mailgun) , send off. have working when receive email file has default name want change. have experience trying this? thanks var pdf = require('html-pdf'); var mailgun = require('mailgun-js'); pdf.create(result).tostream(function(err, stream) { var self = this; if (err) return console.log(err); //set mailgun parameters var mail_data = { from: 'emailtosendto@email.com', to: 'sendingemail@email.com', subject: 'subject line', html: result, attachment: stream } //send email mailgun.messages().send(mail_data, function (err, body) { if (err) { res.render('error', { error : err}); console.log("got error: ", err); } else { console.log(body); res.send('ok...

php - random script don't run -

php random script running slowly here seems problem <?php function sortear($previtems, $number) { ($k=0; $k<sizeof($previtems); $k++) { if ($previtems[$k] == $number) return true; } return false; } ($i=0; $i<=9; $i++) { $num[$i] = rand($_get['inicial'],$_get['final']); while (sortear($previtems, $num[$i])) { $num[$i] = rand($_get['inicial'],$_get['final']); } $previtems[$i] = $num[$i]; } sort($num); ?> any sugestion random? rest of code here link you had infinite loop; while loop never terminating because never increasing size of $previtems array. try this: function sortear($previtems, $number) { ($k=0; $k<sizeof($previtems); $k++) { if ($previtems[$k] == $number) { return true; } } return false; } ($i=0; $i<=9; $i++) { $num[$i] = rand($...

uitableview - Search bar in core data project -

i use core data magical record , i'm try filter data search bar in table view. i write 2 methods number of rows , name of cells: -(int) damminumerocercati:(nsstring *)searchbar { nspredicate *predicate = [nspredicate predicatewithformat:@"nome contains [cd] %@", searchbar]; nsarray*arra = [ricetta mr_findallsortedby:@"nome" ascending:yes withpredicate:predicate]; return arra.count; } -(nsstring*) damminomericettacercata:(nsstring *)searchbar mostratanellacella: (int) cella { nspredicate *predicate = [nspredicate predicatewithformat:@"nome contains [cd] %@", searchbar]; nsarray *arra = [ricetta mr_findallsortedby:@"nome" ascending:yes withpredicate:predicate]; ricetta*ctn = arra[cella]; return [nsstring stringwithformat:@"%@", ctn.nome]; } then call method inside numberofrowsinsection: , cellforrowatindexpath: inside if cycle: if (self.mysearchbar.isfirstresponder){ // above methods ...

python - Matplotlib path contains_point -

i've discovered matplotlib path functionality , i'm using path.contains_point check whether points found within region defined 2 bezier curves. i'm getting unexpected behaviour contains_point returning true when have expected return false . specifically, if point tested left of region seems incorrect. on right ok. defining paths number of straight lines rather curves seems work expected. a failing test case follows: import matplotlib import matplotlib.path mplpath import matplotlib.patches patches import matplotlib.pyplot plt import pylab import pandas pd print "mpl version {}".format(matplotlib.__version__) #1.5.0 print "mpl np version {}".format(matplotlib.__version__numpy__) #1.6 path_data = [ (mplpath.path.moveto, (2, 10)), (mplpath.path.curve4, (0, 100)), (mplpath.path.curve4, (20, 100)), (mplpath.path.curve4, (40, 150)), (mplpath.path.moveto, (40, 150)), (mplpath.path.curve4, (42, 45)), (mplpath.path.c...

jenkins - Build Flow Plugin While Loop -

i'm trying setup build flow plugin run job forever until cancel build flow. while(true){} works, absolutely isn't safe, if mess parameters, it'll cause flow enter endless loop , become uncancellable without restart of jenkins. is there safe way this: while(true){ignore(failure){ build(project) build(anotherproject) }} so clicking x button cancel build flow properly? alternately, there better way build multiple projects forever single project, waiting each project complete before moving on next 1 in line , looping first? solution: if select workspace checkbox above build flow, call post build actions, can recall project. if don't select workspace button, post build actions not fire off.

cuda - what is the optimized cufft library for tesla k20m card -

in our application have fft part. port part onto gpu. have tesla k20m gpu. version of cufft optimized k20m card. there not specific version of cufft library optimized specific card. use standard cufft library ships cuda 5.0 (or cuda 5.5 rc , if like).

Use Julia to perform computations on a webpage -

i wondering if possible use julia perform computations on webpage in automated way. for example suppose have 3x3 html form in input numbers. these form square matrix a, , can find eigenvalues in julia pretty straightforward. use julia make computation , return results. in understanding (which limited in direction) guess process should like: collect data entered in form send data machine has julia installed run julia code given data , store result send result webpage , show it. do think possible? (i've seen stuff using httpserver allows computation browser, i'm not sure right thing use) if yes, things need into? have examples of such implementations of web calculations? if using or can use node.js, can use node-julia . has limitations, should work fine this. coincidentally, done putting example this. rough mockup available here , uses express serve pages , plotly display results (among other node modules). another option write server in julia ...

javascript - Pushing non existent items to array -

so have array: var period = [{"total":852, "date":"2016-03"}, {"total":963, "date":"2016-03"},{"total":789,"date":"2016-02"},{"total":456,"date":"2016-04"},{"total":123,"date":"2016-01"},{"total":723,"date":"2016-01"}]; i need display "total" data grouped month. means have sum "total" amount on months repeated on array (2016-03, 2016-01). find solution need understand why this for ( var = 0; < period.length; i++ ){ if (periodb.indexof(period[i].date) == -1){ periodb.push(period[i].date); } returns this: ["2016-03", "2016-02", "2016-04", "2016-01"] while this: for ( var = 0; < period.length; i++ ){ if (periodb.indexof(period[i].date) == -1){ periodb.push({"date": period[i].date, "total": perio...

python - Appending to List after Pandas if else statement -

i'm trying append time value plotlist wherever dup column value false . the df = lat time trip_id diff shifted segment dup -7.12040 2015-12-24 02:03:10 18060.0 0.00003 0.00000 1 false -7.12043 2015-12-24 02:03:12 18060.0 0.00000 0.00003 2 false -7.12043 2015-12-24 02:03:14 18060.0 0.00003 0.00003 2 true -7.12046 2015-12-24 02:03:16 18060.0 0.00003 0.00003 2 true -7.12049 2015-12-24 02:03:19 18060.0 0.00003 0.00000 3 false -7.12052 2015-12-24 02:03:22 18060.0 0.00000 -0.00473 4 false the code = plotlist=[] def pullline(row): if row['dup'] == false: plotlist.append(row['time']) pullline(df) i had thought might work error valueerror: truth value of series ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all() can explain a) going on here, , b) can avoid? don't understand how asking if false can ambiguous. many thanks. ...

ssl - Using setWebhook from Qt for a Telegram bot -

im developing telegram bot using qt c++, , i'm having problems trying set webhook. ssl server first of all, i've created ssl server using qtcpserver , qsslsocket. explanations can found in qsslsocket doc . also, generated self-signed certificate telegram doc explains here , using command: openssl req -newkey rsa:2048 -sha256 -nodes -keyout yourprivate.key -x509 -days 365 -out yourpublic.pem -subj "/c=us/st=new york/l=brooklyn/o=example brooklyn company/cn=yourdomain.example" the result pair of files, private.key file , public.pem file. so, used them in qsslsockets secure connection. the result of ssl server capable of listen , accept connections. when use browser connect ssl server, obtain warning using self-signed certificate (which think normal), can connect server. server, i'm able of read data browser sent. so, think server side good. request setwebhook in order perform request setwebhook api method , use qhttpmultipart class create mime mul...