Posts

Showing posts from August, 2015

why does canvas object keep blinking during animation? -

i made animation in javascript house rising smoke. smoke 3 functions each part of smoke flow upwards chimney. controlled slider toggles speed @ smoke exists chimney. works except when slider toggled left right, smoke blinks while rising. tell me why is? thanks html: <!doctype html> <html> <head> <title>carrey, justin, myshkin, rost</title> <meta charset="utf-8"/> <link rel="stylesheet" href="style.css"/> </head> <body> <canvas id="canvas" width="500" height="500">get new browser!</canvas> <script src="script.js" ></script> <form> <input type="range" min="10" max="250" value="100" id="speedcont"/> <p> rostislav myshkin a00787633 rmyshkin@my.bcit.ca <br /> completed:3-d house, smoke, animation smoke, slider sp...

javascript - How do I duplicate the "pattern" attribute for Safari? -

i've got client online store that's having issues customers putting emojis , special characters text input field. want them able use spaces, numbers, letters, , letters accents , umlauts , such. when tried solution, worked. pattern="[ a-zÀ-ÿ0-9]" problem is, works every browser we've tested on except safari. i'm serious javascript n00b; i've written jquery , javascript functions myself have done i've needed them do, problems twofold: how go writing vanilla js or jquery function replicates pattern's functionality? more importantly (because possible solutions i've seen have omitted information), how link input works in first place? thank can give me! fixed! answer startlingly easy. polyfill, per site: http://www.useragentman.com/blog/2010/07/27/creating-cross-browser-html5-forms-now-using-modernizr-webforms2-and-html5widgets-2/ here's code used. turns out other dev had added entire modernizr.min.js script fix probl...

regex - Kibana Regular expression search -

i newbie elk. want search docs based on order of occurrence of words in field. example, in doc1, my_field: "my foo word bar example" in doc2, my_field: "my bar word foo example" i query in kibana docs "foo" followed "bar" , not opposite. so, doc1 return in case , not doc2. tried using below query in kibana search. but, not working. query doesn't produce search results. my_field.raw:/.*foo.*bar.*/ i tried analyzed field(just my_field ), though came know should not work. , of course, didn't produce results either. please me regex search. why not getting matching result query? i'm not sure offhand why regex query wouldn't working believe kibana using elasticsearch's query string query documented here instance phrase query (documented in link) putting search in double quotes , word "foo" followed "bar". perform better since on analyzed field (my_field) has tokenized each word perform fa...

html - Positioning the website correctly in the mobile version -

Image
i'm trying format mobile version of website layout not centered. how can it? code turn mobile version: [<meta name = "viewport" width = "device-width, initial-scale = 0.9, maximum-scale = 0.9, user-scalable = no">][1] my website #1, #2

python - Matplotlib plot only updates when windows is closed? -

i wrote following script display simple sine curve update ad infinitum: #!/usr/bin/env python import seaborn sns import matplotlib.pyplot plt import matplotlib.animation animation import numpy np math import sin n = 0 =[] ns = [] def animate(i): as.append(sin(n)) ns.append(n) ax1.plot(np.array(ns),np.array(as)) while true: fig1 = plt.figure() ax1 = fig1.add_subplot(1,1,1) ani1 = animation.funcanimation(fig1, animate, interval=1) n = n + 0.05 plt.show() however line updates (as in changes shape @ all) when try close window, can't find fix - how done? many in advance. you have change n inside animate add different point - add same point don't see difference. try print(ns) inside animate in code. import matplotlib.pyplot plt import matplotlib.animation animation math import sin n = 0 = [] ns = [] # ----- def animate(i): global n ns.append(n) as.append(sin(n)) ax1.plot(ns, as) n += 0.05 # ----- fig1 ...

fortran - Why mpifort wrapper is not found after installing mpich and openmpi? -

i need compile program uses mpifort wrapper create executables files multiporcessor usage. (opentelemac) i have tried install mpich , openmpi wrapper doesn't seem work. using gfotran perfom operations. could explain me how installed? i using ubuntu 14.0 lts.

server - (Python) How can I receive messages in real-time without refreshing? -

i have followed tutorial youtuber under name of drapstv. tutorial made in python 2.7 , makes networked chat using udp. converted python 3 , got work. however, way threading setup have send message(or press enter, blank message) refresh , receive messages other clients. here video incase may need it: https://www.youtube.com/watch?v=pkfwx6rjrai and here server code: from socket import * import time address = input("ip address: ") port = input("port: ") clients = [] serversock = socket(af_inet, sock_dgram) serversock.bind((address, int(port))) serversock.setblocking(0) quitting = false print("server , running far.") while not quitting: try: data, addr = serversock.recvfrom(1024) if "quit" in str(data): quitting = true if addr not in clients: clients.append(addr) print(time.ctime(time.time()) + str(addr) + ": :" + str(data.decode())) client in clients: ...

android - How to set text for each horizontal bar chart in MPAndroidChart? -

Image
i want set text each horizontal bar chart in mpandroidchart. please, me. much i have idea, hope helpful u chart.getxaxis().setposition(xaxis.xaxisposition.bottom_inside); chart.getxaxis().setxoffset(-100);

linux - Variables variables through pipes c# -

hi i'm trying use pipes redirect standard output , standard error process, far made possible send , receive data using console.readline() server client pipes i've been looking away send variables (like standard output/error) namedpipeclient: static void client(){ while (true){ var clientstream = new namedpipeclientstream("ouput"); clientstream.connect(60); string line = console.readline(); byte[] buffer = asciiencoding.ascii.getbytes(line); clientstream.write(buffer,0,buffer.length); if (line.tolower() == "cerrar") break; clientstream.close(); } } server pipe: static void server(){ while (true){ var namedpipeserverstream = new namedpipeserverstream("output"); namedpipeserverstream.waitforconnection(); byte[] buffer = new byte[255]; namedpipeserverstream.read(buffer, 0, 255); string request = asciiencoding.ascii.getstr...

Triggering mouse/touch events in Matter.js -

how 1 go adding programmatically triggered touch/mouse events in matter.js? have few collision events set engine, can not trigger mouseup event stops current dragging action. i've tried various combinations of targeting canvas element, mouse/mouseconstraint, , non-static body. it turns out had incorrectly configured matter.mouse module, , re-assigning mouse input had been set in mouseconstraint. following works in regards original question: matter.mouseconstraint.mouse.mouseup(event);

java - Error Input too large for RSA cipher on Android 5.0 -

i have problem "input large rsa cipher" adnroid 5.0 when use encrypt below: public string rsaencryptstring(string strinputstring, int dwkeysize, publickey p) { stringbuilder stringbuilder = null; try { int keysize = dwkeysize / 8; byte[] bytes = strinputstring.getbytes("utf-32le"); int maxlength = keysize - 42; int datalength = bytes.length; int iterations = datalength / maxlength; stringbuilder = new stringbuilder(); cipher cipher = cipher.getinstance("rsa/ecb/oaepwithsha1andmgf1padding");//4.4 cipher.init(cipher.encrypt_mode, p); //cipher.init(cipher.decrypt_mode, p, new oaepparameterspec("sha-256", "mgf1", mgf1parameterspec.sha256, psource.pspecified.default)); (int = 0; <= iterations; i++) { int index = (datalength - maxlength * > maxlength) ? maxlength : datalength - maxlength * i; int offset = maxlength * i; ...

c++ - How do you print a std::regex? -

how print string representation of std::regex ? say have collection of patterns, , i'd print first 1 matches: std::vector<std::regex>> patterns = get(); (auto pattern: patterns){ if (std::regex_match("file.txt",pattern)){ std::cout << "matched on pattern: " << /* ? pattern ? */ << '\n'; } } std::cout not work on std::regex . there doesn't seem methods string representation. are expected carry around string separately, or missing in docs? there doesn't seem methods string representation. correct. not specified std::regex saves expression in form gave it, might case if implementation decides use more optimized format.

javascript - Three.js rotate vector and screen edge detection -

i have vector i'm trying keep length rotate 90deg on colliding screen edge, gives me weird out effect… don't know can doing worn happens when try apply matrix , euler transform… screen detection, have okj detecting on , off screen, handy know if it's bottom, top, righ or left edge… clues? thanks! var direction = new three.vector3(-0.2, -0.2, 0); var = new three.euler( (math.pi/2), 0, 0, 'xyz' ); direction.applyeuler(a); for collision; i'm using following: camera.updatematrixworld(); // make sure camera matrix updated camera.matrixworldinverse.getinverse( camera.matrixworld ); cameraviewprojectionmatrix.multiplymatrices( camera.projectionmatrix, camera.matrixworldinverse ); frustum.setfrommatrix( cameraviewprojectionmatrix ); console.log(frustum.intersectsobject(textmesh)); i removed line reversed camera projection matrix. the screen edges became object "outside" view, whom objects can actively collide.

Comparing two bash variables -

i trying write simple bash script shows difference between 2 variables, assumption both variables contain identical parameters different values. @ $sam , $pish variables. identical, except parameter driver_mode 1 in $sam , , 2 in $pish . comparison, store each variable separate array, , compare each element 1 one. #!/bin/bash sam="driver_mode=2 firmware_path=/home/release/firmware/ onebox_zone_enabled=0x10001 ta_aggr=4 skip_fw_load=0 fw_load_mode=1 sdio_clock=40000 enable_antenna_diversity=0 coex_mode=1 obm_ant_sel_val=2 wlan_rf_power_mode=0 bt_rf_power_mode=0 zigb_rf_power_mode=0 country_code=840 bt_rf_tx_power_mode=1 bt_rf_rx_power_mode=0" pish="driver_mode=1 firmware_path=/home/release/firmware/ onebox_zone_enabled=0x10001 ta_aggr=4 skip_fw_load=0 fw_load_mode=1 sdio_clock=40000 enable_antenna_diversity=0 coex_mode=1 obm_ant_sel_val=2 wlan_rf_power_mode=0 bt_rf_power_mode=0 zigb_rf_power_mode=0 country_code=840 bt_rf_tx_power_mode=1 bt_rf_rx_power_mode=...

javascript - How can I generate a random number without a page refresh/mouseClicked -

so know because random number being generated in setup i'm getting 1 value when call random number in draw i'm getting many numbers. need when pitch leaves screen, new number generated , new pitch thrown based off of number. var pitch; var speed; var xmovement; var x = 300; var y = 200; var = 400; var b = 200; var num; function preload() { data = loadjson('pitcherdata.json'); } function setup() { createcanvas(600, 600); num = random(0,100); } function draw() { background(220); randompitch(); } function fastball(){ var famax = data.pitchers[0].pitches[0].maxvelo; var famin = data.pitchers[0].pitches[0].minvelo; var faxmov = data.pitchers[0].pitches[0].xmov; //mapping of maximum velocity var famapmax = map(famax, 50, 101.3, 0, 8); //mapping of minimum velocity var famapmin = map(famin, 50, 101.3, 0, 8); // mapped xmov of fastball var famapmov = map(faxmov, -9.0, 5.0, -7, 7); // pitch velo randomly vary between m...

javascript - Iterating over google places JSON response -

hi have been able json response google places , need extract photo reference element it. i have tried iterate on places results , each places results photo_reference error message. typeerror: cannot read property '0' or undefined. what have tried: response.on('end', function() { var places = json.parse(body); var locations = places.results; locations.foreach(function(loc) { var photoref = loc.photos[0].photo_reference; console.log('photo ref ==' + photoref); }); }); here sample of json response. { "html_attributions" : [], "results" : [ { "geometry" : { "location" : { "lat" : 46.7725141, "lng" : 23.62686099999999 }, "viewport" : { "northeast" : { ...

What characters are valid for JavaScript variable names? -

Image
can point me web page detailing characters can used naming javascript variable? i want create small "extension library" non-javascript users here @ work (who seem squeamish when comes language). love how jquery , prototype have both use $ dollar sign, , since use jquery, i'm looking nice single-character symbol use. i realize test out number of characters, i'm posing question many javascript sensei of world advice characters (even if valid) bad idea use (in consideration of future integration popular library, perhaps). to quote valid javascript variable names , write-up summarizing relevant spec sections: an identifier must start $ , _ , or character in unicode categories “uppercase letter (lu)” , “lowercase letter (ll)” , “titlecase letter (lt)” , “modifier letter (lm)” , “other letter (lo)” , or “letter number (nl)” . the rest of string can contain same characters, plus u+200c 0 width non-joiner characters, u+200d 0 width joiner cha...

powershell - Loop and join 2 functions to move files in folders by category & rename by original title -

for matching category filename use code gci *.pdf | foreach { (iwr "https://arxiv.org/abs/$($_.basename)")` -match 'primary-subject">(.*?)</span>'; $matches[1] } to have idea mean http://i.imgur.com/57kjjr6.png to rename indipendently: can use not useful because process folder folder , take long time (number of folders high number) #all pdfs | rename { query arxiv abstract filename, use page title + ".pdf"} get-childitem *.pdf | rename-item -newname { $title = (invoke-webrequest "https://arxiv.org/abs/$($_.basename)").parsedhtml.title $title = $title -replace '[\\/:\*\?"<>\|]', '-' # replace forbidden characters "$title.pdf" # in filenames - } i should make folders (without [folder] ) [folder] information theory (cs.it) [folder] number theory (math.nt) .... i try join 2 operations: moving subject [fold...

How to prevent repeatable output in PHP MySQL? -

i have create 3 rows of data in mysql database have 4 column dtfrom,dtto,timeout,timein and have 3 sets of row dtfrom dtto timeout timein 2016-11-11 2016-11-11 0830 1030 2016-11-12 2016-11-12 0830 1030 2016-11-13 2016-11-13 0830 1030 however, output of "time not passed !" display 3 times below time not passed ! time not passed ! time not passed ! what want error "time not passed!" display once query. because there's problem if have hundred of data rows. errors appear in hundred of time isn't ? and second issues cannot run error if input 0845 - 1730 or 0845 - 0945 . it run error if input in database 0830 - 1030 can ? code below <?php $connect = mysqli_connect("localhost", "root", "", "database"); global $connect; if(isset($_post['submit'])) { $user_id = $_post['user_id']; $dtfrom = $_po...

c++ - Recursive header expansion -

Image
i have following warning in sfml project in xcode: well, problem here may be? have code, so, can't post here. on 2nd image may may see of classes. lighteffect, background , other below them inherit loadingthespritetomain. playscreen contains of them (i mean, #include "lighteffect" , etc.)

Paperjs loading external Javascript file for Canvas -

error message loaded external script linking canvas i'm getting error. but when use python simplehttpserver module works fine. <script type="text/paperscript" src="js/welcome_canvas.js" canvas="welcome-canvas"></script> it cors(cross-origin resource sharing) error, not bug. method python simplehttpserver 1 of method bypass cors error. paper.js external file not load might you.

Concurrent requests Flask python -

i have flask application. works database, i'm using sqlalchemy this. have 1 question: flask handle requests one-by-one. so, example, have 2 users, modifying same record in table of database, example , b (they concurrent). how can user b user has changed record? must message user b. in development server version, when app.run() , single synchronous process, means @ 1 requests being processed @ time. cannot accept multiple users @ same time. however, gunicorn solid, easy-to-use wsgi server let spawn multiple workers (separate processes), , comes asynchronous workers when need deploy application. however, answer question, since, run on separate threads, data exists in database @ specific time when query run in thread used/returned. i hope answers query.

android - Create DialogFragment as anonymous class -

i got app code this: builalert = new dialogfragment() { @override public dialog oncreatedialog(final bundle savedinstancestate) { ... } the import of android.support.v4.app.dialogfragment this worked fine in past. when need old code, runtime error saying dialogfragment should public static class.. when wrote old code, used many class members , methods not static... is there way keep dialogfragment anonymous class , not make different static class?

r - How to position the plot legend outside the plot in the bottom-right -

Image
i'm using latest ggplot2 , p + theme(legend.position='right') . function theme documented , combining bottom , right doesn't seem possible. however, maybe there alternate way achieve this? you can use 2-element numeric vector position, like: p+theme(legend.position=c(0.85,0) the problem is , overlap plotting area. and if want force in 1 horizontal line, can add: p+guides(fill = guide_legend(nrow = 1)) edit i used plot.margin expand area @ bottom, can play parameters: p+ guides(fill = guide_legend(nrow = 1))+ theme(plot.margin=unit(c(1,1,4,0.5),"cm"))+ theme(legend.position=c(0.85,-0.7)) or p+ theme(plot.margin=unit(c(1,1,4,0.5),"cm"))+ theme(legend.position=c(0.85,-0.7) ) note using rstudio, when export image @ width*height don't legends, if drag , adjust view before exporting follows, works.

angular - Material design lite checkbox do not render properly -

Image
in index.html fie have: <!-- material design lite --> <link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.teal-red.min.css" /> <script src="/bower_components/material-design-lite/material.min.js"></script> <!-- material design icon font --> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=material+icons"> <link rel="stylesheet" href="styles.css"> <!-- polyfill(s) older browsers --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/reflect-metadata/reflect.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> and checkbox have fol...

file upload - PHP GD .ico handling -

users of php webapp permitted upload png , jpeg images. upload algorithm following: check extension file name parsing check extension getimagesize() recreate image imagecreatefrompng()/imagepng() (imagecreatefromjpeg()/imagejpeg()) rename image save filesystem image recreation used security. works fine. need algorithm handle .ico files. seems gd doesn't work .ico (there no function imagecreatefromico()), don`t know how implement step 3 of algorithm. thanks or advice. see https://github.com/lordelph/icofileloader composer-installable class can load .ico files gd image. for example: $loader = new elphin\icofileloader\icofileservice; $im = $loader->extracticon('/path/to/icon.ico', 32, 32); see documentation other methods of analysing , extracting images icon file.

list - How to create dotted pair with nil -

i have list of queue names in following form: '("foo" "bar") i trying store queues assoc list in following way: '(("foo" . nil) ("bar" . nil)) basically assoc list queues "foo" , "bar" empty. when bob , alice in "foo" queue should following. '(("foo" . ("alice" "bob")) ("bar" . nil)) how can create structure? tried achieve writing: (mapcar #'(lambda (x) (cons x ''nil)) '("foo" "bar")) which returned '(("foo" quote nil) ("bar" quote nil)) this not wanted because when tried push bob "foo" queue doesn't work wanted. * (setf *tmp* '(("foo" . 'nil) ("bar" . 'nil))) (("foo" quote nil) ("bar" quote nil)) * (push "bob" (caddr (assoc "foo" *tmp* :test #'string=))) * *tmp* (("foo" quote (...

javascript - How to make background images stretch and change every 3 seconds in asp.net -

i trying make slide show background image. code far: <script type = "text/javascript"> function displaynextimage() { x = (x === images.length - 1) ? 0 : x + 1; document.getelementbyid("img").src = images[x]; } function displaypreviousimage() { x = (x <= 0) ? images.length - 1 : x - 1; document.getelementbyid("img").src = images[x]; } function starttimer() { setinterval(displaynextimage, 3000); } var images = [], x = -1; images[0] = "assets/images/image1.jpg"; images[1] = "assets/images/image2.jpg"; images[2] = "assets/images/image3.jpg"; </script> </head> <body> <form id="form1" runat="server"> <div id="centercontents" onload = "changeimage()"> ...

Using webpack 2 from gulp (webpack-stream for webpack 2)? -

i trying update webpack 2. use webpack-stream run stuff gulp, appears webpack-stream using it's own dependency on webpack webpack 1. i have not been able find webpack-stream webpack 2. there possibility use webpack 2 gulp? you need have both webpack , webpack-stream installed: npm install --save-dev webpack-stream npm install --save-dev webpack@2.1.0-beta.25 then can pass webpack object second parameter webpack-stream : var gulp = require('gulp'); var webpackstream = require('webpack-stream'); var webpack2 = require('webpack'); gulp.task('default', function() { return gulp.src('src/entry.js') .pipe(webpackstream({/* options */}, webpack2)) .pipe(gulp.dest('dist/')); });

java - All possible permutations of 2D array -

yesterday asked question appeared duplicate, one, however, pretty sure not duplicate, 1 teeny bit more advanced. title not explain of it, carry on reading. let pretend have 2d array so: {{true, false}, {true, false}, {true, false}, ...} now, let loop through possible permutations of it: {{false, true}, {true, false}, {true, false}, ...} {{true, false}, {false, true}, {true, false}, ...} {{true, false}, {true, false}, {false, true}, ...} {{false, true}, {true, false}, {false, true}, ...} and forth... since adds level it, confuses mind. know length of inner arrays two, never change. is: boolean[][] b = new boolean[i][2]; what best way accheive possible permutations of 2d array, using java? thank you, this can apparently done in same way other permutation takes place, need loop on list permutation applied to, , go on possible combinations of different elements recursively. private void permute(list<list<boolean>> list, int t) { for(int = 0;...

format - MS Excel 2010 how to import custom formatted data as numbers or apply custom formatting during import -

i have data in csv milions, thousands, specified "m", resp "k" characters. example: abc;1.4m def;1.45m ghi;850k i want import them, how can force excel treat values in second column numbers (i want draw sparkline based on those) ? i've tried apply custom format on second column , import data without success. i can manage have input data either "m" or "k" (i.e. column 2 not have "m" , "k" mixed. 3rd row then: ghi;0.85m), solution treat millions , thousands separately helpful. if 1 time thing, may easier import 2 columns of text. select column numbers , letters in it, , find , replace. replace m e06. replace all. replace k e03. this takes advantage of scientific notation e tells excel multiple number 10 power of digits following e. e03 multiplying number 1000. the numbers show in scientific notation, it's easy reformat column accounting or whatever format like.

javascript - why isnt this setInveral function working? -

i cant figure out i'm doing wrong function countnum(){ let num=0; function inner(){ num++ console.log(num); } } setinterval(countnum,1000) you defining function not calling function countnum(){ let num=0; function inner(){ num++ console.log(num); } inner();///////////////////////////// } setinterval(countnum,1000)

php - Storing details in cookie -

how can store user information in cookie. have form: <form action="{{url('/profile/details')}}" method="post"> {!!csrf_field()!!} <input type="text" name="name" class="form-control"><br> <select name="rate" class="form-control"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="submit" class="form-control" value="vote"> </form> i don't want store these information in database, rather want store in cookie, can later retreive these values. i.e. name , rate . i've tried retreive using: $value = request::cookie('name'); echo $value; but displayed: non-static method illuminate\http\...

c# - List is changed when I update another list with same data type -

my code looks this. public class category { public string catid { get; set; } public string catname { get; set; } public string specid { get; set; } pubic string specname { get; set; } } list<category> lstcategory = new list<category>(); list<category> lstcatwithspec = new list<category>(); now, want add category first in lstcatwithspec . copy list in lstcategory , add specialties in lstcatwithspec . now, when update list specialties, list in copied categories changed. filled specialties. should not change right ? how possible when have 2 different objects , give specific object name when adding items ? as working on xamarin.forms , have tagged xamarin.forms because don't know if exists in c# or not. edit - i tried add list using foreach loop. foreach( var item in lstcatwithspec) { lstcategory.add(item); } and tried also. lstcategory = new list<category>(lstcatwithspec); thank you.

generics - Why can't a Java type parameter have a lower bound? -

i gather cannot bind java generics type parameter lower bound (i.e. using super keyword). reading angelika langer generics faq had on subject . comes down lower bound being useless ("not making sense"). i'm not convinced. can imagine use them more flexible callers of library method produces typed result. imagine method created array list of user-specified size , filled empty string. simple declaration be public static arraylist<string> createarraylistfullofemptystrings(int i); but that's unnecessarily restrictive clients. why can't invoke method this: //should compile list<object> l1 = createarraylistfullofemptystrings(5); list<charsequence> l2 = createarraylistfullofemptystrings(5); list<string> l3 = createarraylistfullofemptystrings(5); //shouldn't compile list<integer> l4 = createarraylistfullofemptystrings(5); at point tempted try following definition: public static <t super string> list<t>...

android - Keyboard repeats the last word from the previously typed string -

there's bug here it's marked obsolete , closed. so it's pretty title , linked post say: if i'm typing word , hit send [to clear edittext], next time bring keyboard, has last word previous time, still there. i paused in debug inside beforetextchanged() , found edittext empty. when jump ontextchanged() last word typed appended beginning of string. i tested on: meizu mx5 android 5.1.0 - no problem lg g4 android 6.0 (2 devices) - problem lg g4s android 5.1.1 - no problem i think problem in keyboard apk itself. note users reported happening in different applications (including whatsapp) i'm seeing in development app believe workaround exists. tried comparing length of text in beforetextchanged() , ontextchanged() , if difference > 1 crop text , take last character. produced other problems (e.g when copy text edittext apparently beforetextchanged() called once , not once each character workaround doesn't work. or if have setting inse...

java - Should the testing interface always be identical to the functional interface? -

tdd newb here. know "test interface not implementation", might there case having "testing interface" of class x, using subclass mock , protected methods, superset of functional interface defined public methods of class x? say have class this: class indexmanager { indexmanager( file file ){ ... } public void somefunctionalmethodusedbyotherclasses(){ ... } } in test class go this: @runwith(mockitojunitrunner.class) public class indexmanagertest { ... class subclassmockindexmanager extends indexmanager { subclassmockindexmanager( file file ){ super( file ); } @override protected indexwriterconfig createindexwriterconfig( analyzer analyser ){ return super.createindexwriterconfig( analyser ); } } @spy @injectmocks subclassmockindexmanager injectedspysm_indexmgr = new subclassmockindexmanager(tempfile); and make method in test ...

c# - My HttpWebRequest "POST" failed since I upgrade to v5.2.2 of Microsoft.NETCore.UniversalWindowsPlatform (before I used v5.1.0) -

i notice between v5.2 , 5.1 of microsoft.netcore.universalwindowsplatform i have app in v5.1 , "post" opperation whith httpwebrequest , parameter in body encode in utf8. (to simulate login on website) if upgrade v5.2, post stop working ! restore v5.1 , work again ! have got idea ? mycode httpwebrequest request = (httpwebrequest)webrequest.create(urlrest.absoluteuri); request.cookiecontainer = new cookiecontainer(); asciiencoding encoding = new asciiencoding(); //encoding.utf8.getbytes(poststring); byte[] postdata = encoding.utf8.getbytes(allparaminbody); //allparamin_body contain : user=myuser&password=mypassword request.contenttype = "post"; request.headers["user-agent"] = "apache-httpclient/4.1.1 (java 1.5)"; stream newstream = await request.getrequeststreamasync(); newstream.write(postdata, 0, postdata.length); newstream.dispose(); response = (httpwebresponse)await request.getresponseasync(); thanks httpwebrequest not...

How to use tree-shaking with webpack 2 and typescript and angular 2? -

i have set webpack 2 angular , seems work. not seem though tree-shaking , since have app nothing, , vendor.js still 800+ kb. it seems there little information available on how turn tree-shaking on, understood it's automatically turned on es6 modules, not work es5. so? and importantly: how can apply tree-shaking typescript/angular2 webpack2? i have found nice repository examples on how this. as mentioned in there , in comments question, there apparently bugs prevent tree-shaking happening. seems mean it's not possible "target": "es5" . we can use es2015 , we'll need additional steps (e.g. via babel) compile es5 until browsers support it.

javascript - Ease time between firing specific number of timeouts in a specific period of time -

it's kind of math problem. want fire specific number of settimeout (the number based on array length) in specific period of time (say, 5 seconds). the first settimeout should start @ 0 sec. , last @ 5 sec. . timeouts between should start ease-in effect, each timeout starts faster. there's example ilustrates want achieve exactly. i'm struggling around line: next += timeperiod/3.52/(i+1); which works perfect in demo example (for timeperiod ), doesn't work different letters.length have used static number 3.52 . how calculate next ? var letters = [ 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t' ]; var div = $('#container'); var timeperiod = 5000; // 5 seconds; var perletter = timeperiod/(letters.length-1); // gives equal time betwee...

Insert array of object with in an objects array at specified position javascript -

i have 2 array of objects var arr1 = [{a:12},{d:14}] , var arr2 = [{b:15},{c:10}] , want following result : arr3 = [{a:12},{b:15},{c:10},{d:14}] i want add objects in arr2 @ position 2 of arr1. note order of a,b,c,d in arr3. how insert array of objects within array of objects @ specified position array.split() thanks in advance you use array#splice function#apply it. this allows insert array given array @ position. var arr1 = [{ a: 12 }, { d: 14 }], arr2 = [{ b: 15 }, { c: 10 }]; array.prototype.splice.apply(arr1, [1, 0].concat(arr2)); console.log(arr1); .as-console-wrapper { max-height: 100% !important; top: 0; }