Posts

Showing posts from April, 2014

javascript - AngularJS Nginx Routing issue on Refresh -

i building angularjs app , have routing working first layer of routes: ie: /blah /blah2 /blah3 however, when more complex route such as: /blah/thing /blah2/things /blah3/things these not routing correctly when refreshing page. work fine when clicking link them spa. i running nginx following conf: server { listen 80; root /home/app/public; index index.html; server_name dev-app.com; location / { try_files $uri $uri/ $uri.html /index.html; } } and here example routes: .when('/instances/running', { templateurl : 'pages/instances-running.html', controller : 'instancescontroller', currentpage : 'running instances', }) .when('/instances/stopped', { templateurl : 'pages/instances-stopped.html', controller : 'instancescontroller', currentpage : 'stopped instances', }) .when('/tickets/open', { templateurl : 'pages/tickets-open.html',...

Julia DataFrame filtering based on string length -

is there vectorized way filter julia dataframe based on length of string within column? is following sufficient: df = dataframe(fielda=[1,2],fieldb=["good","morning"]) df[bool[length(x)<5 x in df[:fieldb]],:]

How do you allow only inputs from a list? (python vending machine) -

i need code vending machine, accepts coins "it allow input 1p, 2p, 5p, 10p, 20p, 50p , £1.00 reject £2.00 coin" i have list, float values inside: coins = ["0.01","0.02","0.05","0.10","0.20","0.50","1"] these coins, wanting user enter coin = float(input()) and after have def balance(): coin = float(input("please enter coins.")) if coin not in coins: print("incorrect coin amount! please remember don't accept 2 pound coins!") else: print("correct coin amount. coins have been added balance") fb = fb + coin i couldn't work, print "incorrect coin amount! please remember don't accept 2 pound coins!". after this, tried solution on here: python coding - vending machine - how user enter coins? thought meant needed change float(input()) , float int, changing 0.01 (1p) 1. but, when did, stil got ...

javascript - JSON file not loading into variable properly -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i'm trying load json file javascript file. i did lot of research on trying understand should doing , how should work, can't load variable. this contents of json file: [ { "id": 0, "name": "valley of trials", "desc": "hello world", "choices": [] }, { "id": 1, "name": "valley of trials", "desc": "", "choices": [] } ] i'm loading , calling this: var jsonlocations; $.getjson("../html/data.json", callbackfuncwithdata); function callbackfuncwithdata(data) { jsonlocations = data; } console.log(jsonlocations[0].name); i read in question on site needed lo...

Selenium Assert questions - Java -

how you? i'm starting selenium, , i'm trying hard deal "asserttrue (boolean condition)" , there's wrong. i need junit gets green(ok) if access 1 page, , want red(nok) if it's not possible access. but got green, every single time! for example: if access payment page it's ok (i assert there's buy button sure payment page) if try access without being logged system displays error message (if not find buy button won't in payment page) so here's i'm trying in end of public boolean method: if(buybutton.isdisplayed()){ return true; } else { return false; } so in test class i'm trying assert: shoes i'm buying, , shoeslink.com can find it. put 2 variables there because there's if - if user wants buy shoes selenium expect elements, if shirt selenium expect others. guess doesn't matter, because assert defined code put above, right? , below assertcode i'm talking about: asserttrue(buy.accessproduct(...

java - How to display a 10-by-10square matrix with JavaFX? -

javafx basics write program displays 10-by-10 square matrix. each element in matrix 0 or 1, randomly generated. display each number centered in text field. use textfield settext method set value 0 or 1 string. of can print 1 random number. how can make display 10-by-10 matrix? import javafx.application.application; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.gridpane; import javafx.stage.stage; import java.util.random; public class matrix extends application { public class matrix extends application { button[][] matrix; //names grid of buttons @override public void start(stage primarystage) { int size = 10; int length = size; int width = size; gridpane root = new gridpane(); matrix = new button[width][length]; for(int y = 0; y < length; y++) { for(int x = 0; x < width; x++) { ...

angularjs - Android apps stopped working with newest versions of PhoneGap Build -

i use phonegap convert angularjs app android , ios. need upgrade latest version of phonegap ios 9, breaks android app. specifically, stops ngresource working, can't authentication token server. android works fine config.xml preference set <preference name="phonegap-version" value="3.7.0" /> android fails send request server either of these <preference name="phonegap-version" value="cli-5.1.1" /> <preference name="phonegap-version" value="cli-5.2.0" /> here angularjs login function , ngresource factory. $scope.login = function () { authenticationservice.get({ 'clientid':$rootscope.clientid, 'clientsecret':$rootscope.clientsecret, 'username':$scope.logindata.username, 'password':$scope.logindata.password }, function(data){}, function(error){ toastr.error('authenticati...

How can I store bunch of jQuery code lines in a variable to use it later on the document..? -

i have , have use in several palaces in jquery code. can't use function, because '.payment-items input' appended after document loaded. want way reduce code lines , increase performance , use example variable instead of lots of these bunch of code lines. $('.payment-items input').each(function(index){ var value = $('.payment-items input').eq(index).val(); var price = $('.payment-items input').eq(index).parent().find('p span').html(); final += (value * price); });

php - EasyPHP & Virtual Host Manager (Windows 10) -

Image
i've installed easyphp , virtual host manager - got , running, created virtual host, pointed directory have website stored. it's on d drive when click on virtual host i've created points directory inside installation took place easyphp shown below; browsing localhost development url shows this; so way got working dump site folder inside projects folder , worked. strange. know how can load virtual host url , directory?

java - How do I improve the runtime complexity of this algorithm? -

public static boolean pp(int[] a){ int n = a.length; for(int = 0; < (n-1); i++){ //finds 1 value in array for(int j = (i+1); j < n; j++){ //compares other values 1 value if (a[i] * a[j] == 225){ return true; } } } return false; //returns false if goes through entire loop without returning true } this code takes array , tries find 2 numbers multiply 225. if finds 2 numbers returns true. running time o(n^2) want faster running time o(nlogn) or o(n). how decrease running time of this? here's o(n) solution. can use hashmap<integer, integer> . insert (accumulatively) elements a count in hashmap<integer, integer> c and: for (int e : a) { if (225 % e == 0) { int t = 225/e; if (c.containskey(t)) { if (t == e) { if c.get(t) >= 2) return true; } ...

regex - R grep to match dot -

so have 2 strings mylist<-c('claim', 'cl.bi') , when grep('^cl\\.*', mylist) it returns both 1 , 2. if do grep('^cl\\.', mylist) it return 2. why first match 'claim' ? happened period matching? "^cl\\.*" matches "claim" because * quantifier defined thusly (here quoting ?regex): '*' preceding item matched 0 or more times. "claim" contains beginning of line, followed c , followed l , followed 0 (in case) or more dots, fulfilling requirements successful match. if want match strings beginning cl. , use one or more times quantifier, + , this: grep('^cl\\.+', mylist, value=true) # [1] "cl.bi"

jquery - Javascript and mobile fuctionality. Intermitant issues -

i have small javascript setup mobile menu. on width media query, menu moves side position. behavior on mobile devices, doenst occur in mobile emulation websites on computer. the issue when click same menu item twice in row, menu disappears. have lip phone horizontal , reload page, work again. heres site: my site var jpanelmenu = {}; $(function() { $('pre').each(function(i, e) { hljs.highlightblock(e) }); jpanelmenu = $.jpanelmenu({ menu: 'ul.sf-menu', animated: false, keyboardshortcuts: true }); jpanelmenu.on(); $(document).on('click', jpanelmenu.menu + ' li a', function(e) { if (jpanelmenu.isopen() && $(e.target).attr('href').substring(0, 1) == '#') { jpanelmenu.close(); } }); $(document).on('touchend', '.menu-trigger', function(e) { jpanelmenu.triggermenu(); e.preventdefault()...

Java - Using iterators with arrays -

i new whole "iterator" concept in java , need implementing in code. here code: class iteratorexample { int tstarray []; iteratorexample(){ } public void addnum(int num){ tstarray[0] = num; //and yes, can add 1 number @ moment, not want focus on right now. } public iterator<integer> inneriterator(){ return new methoditerator(); } class methoditerator implements iterator<integer> { public int index; private methoditerator(){ index = 0; } public boolean hasnext(){ return index < tstarray.length; } public integer next(){ return; } } public static void main(string[] args){ iteratorexample sample = new iteratorexample(); test(sample); } public static void test(iteratorexample arr){ arr.addnum(1); system.out.print(arr); } } this code written far. want make can add number array using addnum() method , display main using system.print (and yes, aware nee...

objective c - tableview, change font color of focus tvos -

how change font color of "focused" uitableview cell? have this.... - (void)didupdatefocusincontext:(uifocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { if (context.nextfocusedview) { categorycell *cell = [self.categorytableview dequeuereusablecellwithidentifier:@"categorycell"]; [cell.categorylbl settextcolor:[uicolor orangecolor]]; } } i know if want change background of focused uitableviewcell be: - (void)didupdatefocusincontext:(uifocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { [context.nextfocusedview setbackgroundcolor:[uicolor clearcolor]]; [context.previouslyfocusedview setbackgroundcolor:[uicolor orangecolor]]; } in tvos uitableviewdelegate have new method tableview:didupdatefocusincontext:withanimationcoordinator: called when focus change, can previous indexpath , nextfocusindexpath , can use tableview methods cell...

javascript - nunjucks function arguments arrive undefined -

i have been using nunjucks several months, , have found great templating engine. however, morning ran issue seems simple, cannot figure out. hoping set of eyes can point solution. the problem: if pass function template, arguments passed function undefined inside function body. values , objects can passed templates without problem, , if pass function can log console within function (so know function there), arguments undefined. this seemed solved closure, 1) dont see closures in examples can find, , 2) when tried closure found receive undefined arguments. through course of day have pared code simplest possible case , still cant figure out: the template: <div> <p>{{ value }}</p> <p>{{ object|pretty }}</p> <p>{{ func(4) }}</p> <p>{{ args(4)|pretty }}</p> <p>{{ local(4) }}</p> </div> the code renders template (this inside of requirejs define, not shown): var nunjucks = require('lib/nun...

vim - Move the cursor to the start of text inside string -

how go (move cursor) start of contents of string or wrapper ([], {}. (). "". ..etc). 'some text here' i want cursor here: '|some text here' % commmand jump matching ({[]}). depending on version of matchit.vim, string delimiters supported. :help 'matchpairs'

ofstream not writing to end of existing text file in c++ -

its not appending end of created text file (which has contents in it) specify cin , when have out2.open(tablename2, std::ofstream::out | std::ofstream::app); , out2 << v2[i]; in there. full code: #include "stdafx.h" #include <iostream> #include <string> #include <fstream> #include <vector> #include <iomanip> #include <stdio.h> using namespace std; using std::vector; using std::string; void insertit(std::vector<std::string>& v, std::vector<std::string>& v2, std::string insertedstr) { std::string tablename2; cout << "enter file name extension " << endl; std::getline(std::cin, tablename2); (int w = 0; w < v.size(); w++) { cout << v[w] << ": "; cin.ignore(); std::getline(std::cin, insertedstr); v2.push_back(insertedstr + " "); insertedstr.clear(); } ...

c++ - Converting char dynamic array atoi to int -

i had text file having 15 numbers , last number 15 . and, wanted read in, steps did: first, tried count how many numbers in txt file. accordingly, created dynamic size array. tried save numbers dynamic array corresponding indices. now, my question is, since, i'm reading numbers txt file in form of character strings . therefore, how convert char int dynamic array. and, algorithm i've used, producing garbage values on terminal while converting int. couldn't figure out wrong it. my code: #include <iostream> #include <fstream> using namespace std; int main(int argc, char* argv[]) { char *nptr = argv[1]; char *buffer = new char[5]; int index = 0; ifstream fin(nptr); //open file if (argc > 1) { // allocate memory if (!fin) { cout << "can't read file!!" << endl; return -1; } if (fin) { cout << "...

sails.js req.file.upload with bluebird promise -

i'm using sails.js backend bluebird promise, tried upload file using req.file.upload, callback way works fine , file gets uploaded: req.file('file').upload({ maxbytes: 2000000, dirname: 'uploadfolder' }, function (err, files) { if (err) { return res.servererror(err); } return res.ok(); } but promise way not: var promise = require('bluebird'); var fileuploader = promise.promisify(req.file('file').upload); fileuploader({ maxbytes: 2000000, dirname: currentuploadfolder }).then(function(files) { console.log(files); return promise.resolve(files); }).catch(function(err) { console.log(err); return promise.reject(err); }); file doesn't uploaded , console keeps complaining: data: app.js:1800 - [typeerror: cannot read property 'length' of undefined] any thoughts please? this case unique , can't use promisify here. need create new promise , return it. return new p...

Android CoordinatorLayout : ToolBar scroll only when list starts scrolling -

i using toolbar in application , using link hiding tool bar,it works perfect expected.but when list has 1 /two items, there no need scroll tool bar there enough space @ bottom. the idea behind hiding tool bar make use of tool bar space when list items beyond screen height.but when list items few i.e less device screen height not want scroll tool bar.how achieve it. tia. code : <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.v7.widget.recyclerview android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior=...

ios - Compare UIVIewController with Class -

i use below code active viewcontroller appdelegate *appdelegate = (appdelegate*)[[uiapplication sharedapplication] delegate]; uiviewcontroller *controller = appdelegate.window.rootviewcontroller; i want find viewcontroller (controller) of class,for use below code doesn't work my classes: first.m , first.h , first.xib second.m , second.h , second.xib third.m , third.h , third.xib if([controller iskindofclass:[first class]]) .... if app's root view controller uinavigationcontroller can this: uiviewcontroller *controller = ((uinavigationcontroller*)appdelegate.window.rootviewcontroller).visibleviewcontroller; similarly, if it's uitabbarcontroller can this: uiviewcontroller *controller = ((uitabbarcontroller*)appdelegate.window.rootviewcontroller).selectedviewcontroller; finally, if ([controller iskindofclass:[first class]]) { }

How to remove colon within array string in php -

y foreach loop like foreach($set $messaccesstoken => $mertid){ the loop gives me array array ([1] => m_mid.1423282844838:1d2ec85ca015107784[2] => m_mid.1390680182411:d4ca154850b82d1931 [3] => m_id.199186660280356 ) the third element different foreach loop stop want skip third element , jump element continue loop i have many array element except when find m_id.199186660280356 foreach loop stop execution because array string m_mid.1423282844838:1d2ec85ca015107784 when find structure m_id.199186660280356 loop stop want use if loop when find colon in array element loop continue how can done in php. can me? thanks well, unable see foreach loop in brain since not in post, can find string in string using strpos (among other ways). since have no code try , modify, can see logic on how strpos works , inherit in code (that can't see because it's secret, shhh) :: foreach( $array &$value ) { if( strpos($value, ':' ) ) { ret...

Dot Matrix BOLD Printing in Java -

i have written program send raw (text only) data printer dot matrix printer have print provided texts instead of interpreting input image(which makes huge time finish). dot matrix printer installed generic text printer in control panel. printer - wep 800 dx http://www.wepindia.com/support/support.aspx?itemcode=mfd-0380 printservice service = //my dot matrix print service string input = "esc e bold esc f printing\n"; inputstream stream = new bytearrayinputstream((input.getbytes(charset.defaultcharset())); doc doc = new simpledoc(stream, docflavor.input_stream.autosense, null); docprintjob job = service.createprintjob(); try { job.print(doc, null); } catch (printexception e) { e.printstacktrace(); } // codes // esc e - turn bold printing on // esc f - turn bold printing off i list of codes from http://www.lprng.com/distrib/resources/ppd/epson.htm http://webpages.charter.net/dperr/links/esc_p83.htm the reason why codes epson because somewhere read thes...

php - Fatal error Call to a member function insert() on a non-object -

i trying insert data using ajax in wordpress.but getting error below code in file have called using ajax: global $wpdb; $wpdb->insert('design_information', array( 'layout' => $_session['layout'], 'language' => $_session['briefform_language'], 'logo_name' => $_session['briefform_businessname_validation'] , 'org_description' => $_session['briefform_businesspurpose'], 'bussiness_industry' => $_session['briefform_businessindustry'] , 'slogan_logo' => $_session['briefform_slogan'], 'payment' => $_session['price'], 'others' => $_session['briefform_comments'], 'fullname' =...

python - Django - how to make requests with proxies? -

i following guide: https://ultimatedjango.com/blog/how-to-consume-rest-apis-with-django-python-reques/ i wondering how make these requests using proxies? thinking part should modified: def save_embed(request): if request.method == "post": form = submitembed(request.post) if form.is_valid(): url = form.cleaned_data['url'] r = requests.get('http://api.embed.ly/1/oembed?key=' + settings.embedly_key + '&url=' + url) is there easier way ? use same proxy every time same api key. (2-3 api keys) cheers you can pass "proxies" argument request.get method containing dictionary of proxy servers use different protocols, code becomes. def save_embed(request): if request.method == "post": form = submitembed(request.post) if form.is_valid(): url = form.cleaned_data['url'] proxies = { "http": "http...

android - Show a view when keyboard hides and vice versa -

Image
below app looks like. messaging app. there 2 fragments in 1 screen fragment1 (beige color) , fragment2 (dark grey color). edittext , "+" button inside fragment2. fragment1, edittext , + button visible. when click on edittext, keyboard comes up, , edittext , + button comes above keyboard. when click on + button layout2 of fragment2 visible , keyboard hides if visible. if click on edittext , layout2 visible layout2 hides , keyboard comes up. now problem switching keyboard layout2 , vice versa not smooth. screen kinda flickers. want is: if keyboard visible , click + button, edittext , + button should stay there, keyboard should go down , layout2 should come up. if layout2 visible , click on edittext, there 2 possibilities. a. either edittext , + button should stay there, layout2 should go down , keyboard should come smoothly. b. or edittext, + button should stay there, keyboard should come , layout should go down after. my user experience kinda bad the...

r - How to find all the matches in a table? -

this question has answer here: find indices of non 0 elements in matrix 2 answers i know function match(x, dataset) but shows first position of match found , need specify column in table in order result. if there's table this x1 x2 ... 1 3 1 ... 2 4 2 ... 3 1 1 ... 4 2 4 ... how can find position of number 1s? want row , column number separately. result of above example should 1,3(row) , x1,x2(column). dat == 1 give matrix positions equal 1 true otherwise false . additionally, can find row , column positions of elements meet condition (in case, equal 1 is true ), using which , arr.ind argument. your data dat <- read.table(header=true, text= "x1 x2 1 3 1 2 4 2 3 1 1 4 2 4 ") extract positions data equals one which(dat==1, arr.ind=true) # row col # 3 3 1...

ios - How to work with NSOperationQueue and NSBlockOperation with dispatch gcd? -

here code @interface viewcontroller () @property (nonatomic, strong) nsoperationqueue *queue; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; _queue = [[nsoperationqueue alloc] init]; nsblockoperation *ablockoperation = [[nsblockoperation alloc] init]; __weak nsblockoperation* aweakblockoperation = ablockoperation; [ablockoperation addexecutionblock:^{ nslog(@"queue should still have operation. , does. yay!: %@", [_queue operations]); // should print correctly. show nsblock operation correctly residing inside nsoperationqueue dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(3.0 * nsec_per_sec)), dispatch_get_main_queue(), ^{ nslog(@"now queue empty??: %@", [_queue operations]); // should print being empty nslog(@"and weak block nil???: %@", aweakblockoperation); // should print out **nil** if (![aweakblockoperation iscancelled]) { ...

java - Is it useful to provide a type-safe method? -

i'm designing interface follows: public interface parameters { public <t> t getvalue(parametername pn, class<t> valuetype) throws classcastexception; } an implementation obligated throw classcastexception if class instance of value returned not assignableform of class passed parameter. does make sesnse? provides compile-time type-safety, can same explicit cast. or it's better declare public object getvalue(parametername pn) leaving class-cast issues client. i have used form of api add ability convert type 1 desired. e.g. if it's string need integer attempt parse it. otherwise, suggest not adding method doesn't provide. public <t> t getvalue(parametername pn); this avoid needing explicit cast.

html5 - strange behaviour from *ngIf -

i busy angular4 app i'm trying conditionally hide/show 2 div elements using *ngif strange results. want show project form when newitem false or null , show item form when newitem true. div containing item form gets displayed should when newitem true project form doesn't removed dom reason... feel quite comfortable angular , have been using while never came accross issue? idea i'm doing wrong? missing simple? html : <div class="container-fluid"> <div class="row"> <div class="col-md-4 col-md-push-4 page-header"> <h1>quote generator</h1> </div> </div> <div class="row"> <div class="col-md-4 col-md-push-4" *ngif="!newitem"> <button class="btn btn-primary pull-right" (click)="additem()">add item</button> <form [formgroup]="projectform" role="form...

Java static instance -

so started fist big project in java , i'm following tutorial there code dont understand @ all. package com.legolando.runa; import net.minecraftforge.fml.common.mod; @mod(modid = reference.modid, name = reference.modname, version = reference.version) public class runa { @mod.instance public static runa instance = new runa(); // dont why instance of class has static } as see create instance of class inside class (already cosmos me) , instance static. can explain static instance? same static variable or method? this code reminds me of singleton class in java. public class runa { private static runa singleton = new runa( ); /* private constructor prevents other * class instantiating. */ private runa() { } /* static 'instance' method */ public static runa getinstance( ) { return singleton; } /* other methods protected singleton-ness */ protected static void demomethod( ) { system.out.println("demometho...

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 what's solution basic problem? well, problem variable i , within each of anonymous functions, bound same variable outside of function. what want bind variable within each function separate, unchanging value outside of function: var funcs = []; function createfunc(i) { return function() { console.log("my value: " + i); }; } (var = 0; < 3; i++) { funcs[i] = createfunc(i); } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } ...

php - how to send a post parameter in JsonArrayRequest -

im trying send post parameter php file <?php $sid = $_post['sid']; ini_set( 'error_reporting', e_all ); ini_set( 'display_errors', true ); include 'dbconfig.php'; //include 'sql.php'; //include 'pass.php'; ob_start(); include 'pass.php'; ob_end_clean() ; /* if($_server['request_method']=='post'){*/ // create connection $conn = new mysqli($servername, $username, $password, $dbname); mysqli_set_charset($conn,'utf8'); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select * lime_questions sid=$sid"; $result = $conn->query($sql); if ($result->num_rows >0) { // output data of each row while($row[] = $result->fetch_assoc()) { $tem = $row; $json = json_encode($tem, json_unescaped_u...

jmeter - Read rows in CSV differently by various threads in a single Thread Group -

i have test plan single thread group 2 http requests. i want run scenario 10 users. have csv file 10 values in 4 columns , want execute test plan in following way: first 3 rows, columns csv file should used first 3 users immediately remaining 7 users should take remaining 7 rows same csv file use of "single unique value of 4th column of csv file". should run 1 hour duration. how can run scenario?

c# - How to override default logging information in ASP.NET Core -

when start default asp.net core application got following lines in console: hosting environment: production listening on: http://localhost:5000 application started. press ctrl+c shut down. where can change logs? those lines not logged, instead printed console. causing output webhost.run() default way start application. or in particular, internal runasync() sets up. you cannot change output without writing code yourself.

How to debug keybinds in Visual Studio Code -

Image
i trying keybind adding new cursors work in visual studio code ( ctrl + alt + downarrow / uparrow ). pressing combination of keys has no obvious effect, listed in command palette creating new cursors (and selecting option command palette works expected). therefore wondering if there easy way work out why isn't working, example output of key combinations editor receives , commands carries out on receiving key combination? here command referring (note selecting palette works shown), i fixed original issue bringing dev tools in vscode (help > toggle developer tools) , noticing warning: "ctrl+alt+ keybindings should not used default under windows." this being thrown package unrelated multi-cursor highlighted issue. seems cannot use keybinds of type under windows, though not find documentation on reserved windows keybindings. for debugging keybinds ended pulling down vscode source , there promising looking interface ikeybindingservice . imagine brea...

c++ - OpenGL fast rendering 2d image -

my current drawing pipeline of existing examples on internet when rendering several videos @ same time, rendering 2d texture pipeline can slow. there ways improve ? can provide examples? thanks. // when initializing gluint texture; glgentextures(1, &texture); glbindtexture(gl_texture_2d, texture); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_nearest); glteximage2d(gl_texture_2d, 0, gl_rgb, image.cols, image.rows, 0, gl_rgb, gl_unsigned_byte, null); glbindtexture(gl_texture_2d, 0); glfinish(); // thread load image cv::mat image = loadimage(); //initializegl() glviewport(0, 0, width, height); glmatrixmode(gl_projection); glloadidentity(); glortho(0, width, 0, height, 0, 1); glmatrixmode(gl_modelview); glloadidentity(); //paintgl() glclear(gl_color_buffer_bit|gl_depth_buffer_bit); glclearcolor(0.0, 0.0, 0.0, 1.0); glloadidentity(); glenable(gl_texture_2d); glbindtexture(gl_tex...

javascript - How do I auto-insert a leading zero in Time notation -

the following code checks if user inserted correct time notation in textbox. if notation not correct alert box shown. it shows alert if leading 0 forgotten (i.e. 7:45 iso 07:45) function validatethis(e){ //input validation var regexp = /([01][0-9]|[02][0-3]):[0-5][0-9]/; //correct time format var correct = (e.value.search(regexp) >= 0) ? true : alert('enter time hh:mm (13:25)'); } my question how can auto-insert leading 0 if forgotten rather notifying user you may try following approach: function verify() { var str=$("#time").val(); var patt = new regexp("^(0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$"); if(patt.test(str)) { if(str.length==4) $("#time").val("0"+str); console.log("true"); } else console.log("false"); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <in...

c# - return a sorted list of int -

i know there multiple other threads on can't wrap head around why it public int[] practice_5(list<int> items) { if (items == null) { return null; } else { list<int> items_sorted = items.orderby(p => p).tolist(); return items_sorted; } } so have sorted list of items correctly. i'm assuming no matter workaround try, won't return because can't convert type list<int> int[] ? do have convert variable items_sorted before returning? try this public int[] practice_5(list<int> items) { if (items == null) { return null; } else { return items.orderby(p => p).toarray(); } } or if want full refactor, , assuming c# 6.0 or higher. public int[] practice_5(list<int> items) { return items?.orderby(p => p).toarray(); }

ios - iPhone and Apple Watch not sharing App Group -

i've been pulling hair out on problem 2 days now. generate small movie file in iphone app want send iphone play on apple watch. proof of concept, put similar .mov in bundle of apple watch app , able play no problems. figured, easy peasy, when want send new little clip watch, put in app group shared container , access there instead of bundle. nope! i have been through tons of s.o. posts, tried many different approaches , nothing works expected. before ask, have re-done app group several times, deleted old ones itunes connect, re-generated provisioning profiles, cleaned targets numerous times, deleted deriveddata several times, deleted apps , started on several times , tried virtually every little tweak , fix find on s.o. nothing helps. i think know problem is, have no idea how conquer it. here code use in both iphone app , watch app path shared container (this snippet if watch side): let filemanager = filemanager.default let sharedcontainer = filemanager ...

android - SIGSEGV error with QtThread on deleting QSGNode -

i working on qt app runs on android & ios. scenario: calling delete on pointer causes app crash gives me following error on android. fatal signal 11 (sigsegv), code 1, fault addr 0x3c in tid 7134 (qtthread) this caused due delete call in updatepaintnode of qquickitem derived class. // updatepaintnode logic relevant question qsgnode * myqquickitem::updatepaintnode(qsgnode * oldnode, updatepaintnodedata * updatepaintnodedata) { q_unused(oldnode) q_unused(updatepaintnodedata) if(class_mem_node != q_nullptr) { delete class_mem_node; // crash occurs } class_mem_node = new qsgnode; // execute drawing logic return class_mem_node; } problem: window of application dependent on myqquickitem::updatepaintnode execute on android call delete class_mem_node causes crash fatal signal error. interestingly, issue only happens on android , not on ios or osx. question: wrong in logic in updatepaintnode ? thread synchronisation issue? is there way ca...

tensorflow how to create queue in nested way -

in fact, want build 2 queue in nested way below training , validing, report: cancellederror (see above traceback): fifoqueue '_3_valid_queue/input_producer' closed. [[node: valid_queue/input_producer/input_producer_enqueuemany = queueenqueuemanyv2[tcomponents=[dt_string], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](valid_queue/input_producer, valid_queue/input_producer/limit_epochs)]] how can use correctly? try: itr += 1 while not coord1.should_stop(): xxxx if itr == 2: try: while not coord2.should_stop(): yyy except tf.errors.outofrangeerror: yyy finally: coord2.request_stop() coord2.join(threads2) except tf.errors.outofrangeerror: xxxx finally: coord1.request_stop() coord1.join(threads1)

tkinter - How to run python script on atom? -

i'm new using atom , wondering how run python script on it. have code written @ moment works fine in normal python shell, using tkinter, when run through command line, says: import tkinter tk importerror: no module named tkinter how fix this? in environment variables have added python.exe, file directory actual script i'm running , python download itself. how fix this? the best way load jupyter plugin. it's called hydrogen. under packages menu, can select hydrogen/run , run python code. there keyboard shortcut doing speeds process. can check code write using hydrogen option run line , go next line. as tkinter problem have loaded tkinter? can using pip install tkinter. after try running code again.

qt - Virtual keyboard and File Dialog QML -

i have integrated virtual keyboard in application , whenever textfiled clicked, automatically virtual keyboard pops when open filedialog , click on textinput field inside virtual keyboard not coming up. is there way open qml virtual keyboard filedialog ? better check declaring inputpanel qml type in qml. , need link textinput of qml.

javascript - Why toBe () does not work in the test - protractor e2e -

i'm running test, following message. can me how solve this? , how can write text eg password incorrect? alert , console.log not work me. my code: app.e2e-spec.ts import { fobosfrontendbackofficepage } './app.po'; import { browser, by, element, promise, elementfinder, key, protractor } 'protractor'; import {actionsequence, by, capabilities, command wdcommand, filedetector, icommandname, options, session, targetlocator, touchsequence, until, webdriver, webelement, webelementpromise} 'selenium-webdriver'; import {extend extendwd, extendedwebdriver} 'webdriver-js-extender'; import {promise wdpromise} 'selenium-webdriver'; import {error wderror} 'selenium-webdriver'; import {response} '@angular/http'; describe('frontend backoffice app', () => { let page: fobosfrontendbackofficepage; beforeeach(() => { page = new fobosfrontendbackofficepage(); }); it('should navigate browser', () => { page.navig...

javascript - Puppeteer: interact with dom in waitForSelector handler -

when use puppeteer js web crawler, in waitforselector handler can use console.log without trouble: page .waitforselector('input[value=update]') .then(() => { console.log('this is'); console.log('it'); }); but have error when want interact dom: page .waitforselector('input[value=update]') .then(() => { const inputvalidate = await page.$('input[value=update]'); }); this code triggers error: const inputvalidate = await page.$('input[value=update]'); ^^^^ syntaxerror: unexpected identifier @ createscript (vm.js:74:10) @ object.runinthiscontext (vm.js:116:10) @ module._compile (module.js:537:28) @ object.module._extensions..js (module.js:584:10) @ module.load (module.js:507:32) @ trymoduleload (module.js:470:12) @ function.module._load (module.js:462:3) @ function.module.runmain (module.js:609:10) @ ...

storage - Google File System of detecting stale chunk replica? -

the gfs paper said use "lease , version" mechanism detect stale chunk replicas.it update replicas' version when lease granted,however,what if chunksvr failure happened before lease expired,it means lease won't been granted data modification won't change it's version.

Puppeteer get page.content with recursive iteration to get all result of paginate list -

i want results of paginate list of data puppeteer. if make cycle give error: (node:54961) unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 1): error: protocol error (runtime.evaluate): cannot find context specified id undefined (node:54961) deprecationwarning: unhandled promise rejections deprecated. in future, promise rejections not handled terminate node.js process non-zero exit code. this code: const puppeteer = require('puppeteer'); var sleep = require('sleep'); function getrandomint(min, max) { return math.floor(math.random() * (max - min + 1)) + min; } (async () => { const browser = await puppeteer.launch({headless: false}); const page = await browser.newpage(); console.log('start'); page.on('console', (...args) => console.log('page log:', ...args)); await page.goto('pageurl'); var num = 0; for(var i=0; i< 10; i++){ var content = await page.content(); console.log(...

reactjs - React native changing state -

im learning react native, building simple weather application in index.ios.js have: const iconnames = { clear: 'md-sunny', rain: 'md-rainy', thunderstorm: 'md-thunderstorm', clouds: 'md-cloudy', snow: 'md-snow', drizzle: 'md-umbrella' } class app extends component { componentwillmount() { //loads before component loaded this.state = { temp: 0, weather: 'clear' } } componentdidmount(){ //loads after component loads first time this.getlocation() } getlocation() { navigator.geolocation.getcurrentposition( (posdata) => fetchweather(posdata.coords.latitude,posdata.coords.longitude) .then(res => this.setstate({ temp:res.temp, weather:res.weather })), (error) => alert(error), {timeout:10000} ) } render() { return( <view style={styles.container}> <statusbar hidden={true}/...

Reading Cnc data with C# What to do? -

i want import cnc data c#. first number of parts produced.second want know if machine working or not. performing on ethernet. discovered library called focas this. can not find focas library's dll , not know how use it

scala - update dataframe if not equal spark dataframe -

i have 2 dataframes , in want know whether different based on column key other wisei update 1 different become equal val tmp_site = spark.load("jdbc", map("url" -> "jdbc:oracle:thin:system/maher@//localhost:1521/xe", "dbtable" -> "iptech.tmp_site")) .withcolumn("site",'site.cast(longtype)) val local_pos = spark.load("jdbc", map("url" -> url, "dbtable" -> "pos")).select("id","name") tmp_site.printschema() local_pos.printschema() val join = tmp_site.join(local_pos, 'site === 'id, "inner") root |-- site: long (nullable = true) |-- libelle: string (nullable = false) root |-- id: long (nullable = false) |-- name: string (nullable = true) the result of joining |id |name |site|libelle | +---+----------------------+----+----------------------+ |51 |ezzahra ...