Posts

Showing posts from February, 2011

javascript - Circle Icon Overflowing Toolbar in React Native -

Image
i trying circled icon in toolbar positioned (see star icon below): does know how using react native's toolbarandroid, or whether possible? thank

javascript - RxJS: Debounce with regular sampling -

i have observable emits stream of values user input (offset values of slider). i want debounce stream, while user busy sliding, emit value if nothing has come through for, 100ms, avoid being flooded values. want emit value every 1 second if endlessly debouncing (user sliding , forth continuously). once user stops sliding though, want final value debounced stream. so want combine debounce regular "sampling" of stream. right setup this: const debounce$ = slider$.debouncetime(100), sampler$ = slider$.audittime(1000); debounce$ .merge(sampler$) .subscribe((value) => console.log(value)); assuming user moves slider 2.4 seconds, emits values follows: start end (x)---------|---------|---(x)|----| | | | | 1.0 2.0 2.5 3.0 <-- unwanted value @ end ^ ^ ^ sample sample debounce <-- these i don't want value emitted @ 3 secon...

linux - Bash script entrypoint (PID=1) kills `tail` sub process ONLY if a fake trap (which does NOTHING) was there -

i facing strange behavior in bash script, have bash script running pid 1 (it entrypoint docker container, if not familier docker, assume can ignore info). when run following script, sigterm terminates quickly, , seems fine (please keep in mind sshd service not exist! whole system starts script runs tail nothing more, till not problem). #!/bin/bash trap "pkill sshd" sigterm export path=/usr/local/samba/bin/:/usr/local/samba/sbin/:$path if [ -f /usr/local/samba/etc/smb.conf ]; exec /usr/local/samba/sbin/samba -i else tail -f /dev/null & wait ${!} fi the problem comes when delete trap . system hangs, , seems because tail till running , not end reason. (if familier docker, docker waits 10 seconds, , kill container, because didn't respond sigterm , again if not familier docker, ignore info). #!/bin/bash export path=/usr/local/samba/bin/:/usr/local/samba/sbin/:$path if [ -f /usr/local/samba/etc/smb.conf ]; exec /usr/local/sam...

How do I sort a list of dictionaries by last name of the dictionary in Python? -

i need write sort_contacts function takes dictionary of contacts parameter , returns sorted list of contacts, each contact tuple. the contacts dictionary passed function has contact name key, , value tuple containing phone number , email contact. contacts = {name: (phone, email), name: (phone, email), etc.} the sort_contacts function should create new, sorted (by last name) list of tuples representing of contact info (one tuple each contact) in dictionary. should return list calling function. for example, given dictionary argument of: {("horney, karen": ("1-541-656-3010", "karen@psychoanalysis.com"), "welles, orson": ("1-312-720-8888", "orson@notlive.com"), "freud, anna": ("1-541-754-3010", "anna@psychoanalysis.com")} sort_contacts should return this: [('freud, anna', '1-541-754-3010', 'anna@psychoanalysis.com'), ('horney, karen...

css - Use Dot Before Var in SCSS -

this scss works if remove dot before #{$i}s . @for $i 1 through 9 { #a#{$i} { animation-duration: .#{$i}s; } } however, when include dot, gulp gives me error: error: invalid css after "...ation-duration:": expected expression (e.g. 1px, bold), ".#{$i}s;" on line 3 of app/sass/_common.scss >> animation-duration: .#{$i}s; -------------------------^ i need dot because want .1s , .2s , .3s , on. how make work? i way: animation-duration: $i * 0.1s;

osx - How can I implement Java/Swing controls that are disabled until after the window is activated? -

i implementing java/swing application macos, common mouse button related behavior disabled until window activated. in other words, when mouse button pressed on inactive window, window activated nothing else happens. (there exceptions. buttons when clicked activate window , run normal action.) there way this? basic problem time application gets mouse pressed event, window active. thought far correlate window activated event , mouse pressed event time, might not reliable. you can make button's contains() depends on frame's active or not: final jframe frame = new jframe(); jbutton button = new jbutton() { @override public boolean contains(int x, int y) { return super.contains(x, y) && frame.isactive(); } }; when frame deactive , region of button clicked, button won't accept mouse event since contains() returns false, button's parent tested contains() instead (and parent's parent until returns tru...

mysql - Sql query count duplicates while grouping them -

i have issue when grouping values in sql.i want count duplicate values each product.also sum qty , cost separately per quarter.i have posted photos below understand better want achieve. i have applied query based on experience , web: select products,quarter,count(quarter) table-name group products,quarter; but output incorrect. check sample in link below http://sqlfiddle.com/#!9/b24863/1 giving few hints: - sum: aggregation function can used summation - count: used counting in order sum qty, cost per quarter, query can be: select quarter, sum(qty), sum(cost) tablename group quarter to stats per product , quarter, query can be: select products, quarter, sum(qty), sum(cost) tablename group products, quarter

iis 7 - How to config Vue 2 application on IIS server? -

i need config iis server , vue 2 application, installed vue 2 application production build on windows iis 7 server , , work fine, 1 thing not working: when try open page link " example mysite.com/somepage " written in vue-router see 404 error , if click on menu link work fine, if type main url mysite.com open, routes not working! i think need setting httpredirect or this! from information i'm assuming you're using history mode, here's 1 i've been using, , can reference on here : <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="handle history mode , custom 404/500" stopprocessing="true"> <match url="(.*)" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" nega...

Providing input to php script when launched through java application -

i need run php script through java application , give input based on questions. i found stream_get_line or fgets hangs every time send input. this not happen other applications (for example if execute xcopy). i have tried lot of approaches (most of them visible in code below), main suspicion might encoding (or stream_get_line , fgets in php has bug). help? since actual php script third party, cannot change it. php code <?php $tty = os_windows ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r'); $myfile = fopen("c:\\temp\\tty_try.php.txt", "w") or die("unable open file!"); echo "internal encoding:", mb_internal_encoding(), "\r\n"; //<=== gives utf-8 print "enter something: "; fwrite($myfile, "going wait input..."); $tmp = stream_get_line($tty, 10, php_eol); //fgets($tty); //, 1024); //when launched through java application following statements never executed echo ...

passwords - how to animate the entry of a new character in passcode textview android? -

currently implementing custom textview passcode entry. i'm using custom transformation show last number entered so: public class pincodepasswordtransformationmethod extends passwordtransformationmethod { char passwordbullet = '\u26aa'; @override public charsequence gettransformation(charsequence source, view view) { return new passwordcharsequence(source); } private class passwordcharsequence implements charsequence { private charsequence msource; public passwordcharsequence(charsequence source) { msource = source; // store char sequence } public char charat(int index) { if(index != msource.length()-1) return passwordbullet; else return msource.charat(index); } public int length() { return msource.length(); // return default } public charsequence subsequence(int start, int end) { return msource.subsequence(start, end); // return default } } } and apply on tex...

ODATA - how to generate odata service from Edmx file -

there odata lib can use edmx file generate odata service? providing edmx file create service can answer metadata calls... i've found library https://github.com/htammen/n-odata-server but requires json not edmx/metadata.xml file... i see olingo lib didn't find functionality can ... https://olingo.apache.org any direction if possible? i prefer use nodejs lib if there combination work, not mandatory i've find lib https://github.com/jaystack/jaysvcutil if happy use .net, try restier. follow instructions here: http://odata.github.io/restier/ , except don't generate new ef data model class. instead add edmx model project. then go section 'configure odata endpoint', , rather entering: await config.maprestierroute<entityframeworkapi<adventureworkslt>>( "adventureworkslt", "api/adventureworkslt", new restierbatchhandler(globalconfiguration.defaultserver)); use...

javascript - display error when no option is selected from select box -

Image
i facing 1 problem, want show error when user has not selected service selectbox. have 2 checkboxes of nails , hair, when user selects nails checkbox then, user must have select service selectbox. if user not select hair checkbox then, selectbox not mandatory below hair. if both checked , both below service must selected span serror message. here html:- enter code here <div class="one-row"> <div class="div_img_part-2"> <span class="img_part_class-2"><img src="http://localhost:8000/images/serviceimages/48031.png"> </span> <span class="text_part_class-2"> <p class="custom-checkbox firstpart"> <input class="firstdisable" type="checkbox" id="0" name="services[]" value="1"> <label for="0">nails</label> </p> </span> <select id="ch...

javascript - Optimal solution to balancing out a set of numbers -

so i'm writing side project , trying optimise: given set of n numbers (e.g. [4, 10, 15, 25, 3]), want make each number same within given tolerance (i.e. if wanted exact, should 11.4 in above example). we can add/remove 1 , add another. example, can -5 [3] , +5 [1] give [9, 10, 10, 25, 3]. the constraint have want minimal number of "transfers" between each number (e.g. if -3.6 [3], counts 1 "transfer"). not fussed performance (most can see going set of 50 numbers max) want keep transfers minimum. we can assume tolerance +/- 1 start can dynamically change. the goal of algorithm make sure each of numbers in list same within given tolerance. thus, if tolerance zero, numbers must equal average of values in list (which remain constant throughout algorithm). taking in account tolerance, numbers in list must belong inclusive interval [average - 0.5*tolerance, average + 0.5*tolerance] . the main iteration of algorithm involves retrieving maximum ...

javascript - es6 class pass this to a static class functions -

i have class import { objectutilities } '~/utils/'; class object{ constructor(object) { object.assign(this, { ...object }); } utils = objectutilities; } and class statis method (class contains many static methods) class objectutilities { static getkey(object){ return object.key; } } and want know if possible share "this" object class static method "getkey(object)" want as: let x = new object(object); x.utils.getkey(this); (objectutilities many static funcs dont want each of them) thanks helping me out... you can add constructor objectutilities class bind given context getkey function: class objectutilities { constructor(_this) { this.getkey = this.getkey.bind(_this); } getkey() { return this.key; } } class myobject { constructor(object) { object.assign(this, { ...object }); this.utils = new objectutilities(this); } } const obje...

angular - Ionic 3 - Side menu , change side dynamically -

i want change direction of side menu automatically when change language (rtl , ltr) tried code in page app.html <ion-menu [side]="isrtl?'right':'left'" [content]="content"> how can change value of 'isrtl' page or example "home.ts" ? 'isrtl' declared in 'app.component.ts' guys ? use event emitor cross component transfer data between components //home component.ts import { events } 'ionic-angular'; constructor(public events: events) {} directiochange(user) {this.events.publish('directiochanged', 'true');} //app.component.ts constructor(public events: events) { events.subscribe('directiochanged', (direction) => { this.isrtl = direction;console.log(direction);});} not home component, can set anywhere in project

c++ - How to print out the private key in ECDSA by using crypto++? -

i trying use elliptic curve dsa. in part of "generate private key" in following code using crypto++ library, private exponent printed out in console. how can print out private key itself? int main( int, char** ) { autoseededrandompool prng; bytequeue privatekey, publickey, testkey; string message = "do or not. there no try."; ////////////////////////////////////////////////////// // generate private key ecdsa<ecp, sha1>::privatekey privkey; privkey.initialize( prng, secp256r1() ); privkey.save( privatekey ); cout<<"the size : "<<sizeof(privatekey)<<endl; cout<<"output 1 : "<< privkey.getprivateexponent() <<endl; cout<<"output 2 : "<< std::hex << privkey.getprivateexponent() <<endl; cout<<"output 3 : "<< std::hex << &privatekey <<endl; cout<<"output 4 : ...

java - Confusion about HotSpot JVM JIT -

for example,a loop 10000 times in method.when runs 1000 times, backedge_counter triggers jit compilation. , interpreter continue executing. when loops 4000 times, jit compilation completes. my question is, how remainder 6000 times executed, interpreter, or execute native code?or native code not executed until method invoked next time? , happens when method invoked next time? assuming asking hotspot jvm, answer remaining interations executed in compiled code. hotspot jvm has technique known 'on-stack replacement' switch interpreter compiled code while method running. http://openjdk.java.net/groups/hotspot/docs/hotspotglossary.html on-stack replacement known 'osr'. process of converting interpreted (or less optimized) stack frame compiled (or more optimized) stack frame. happens when interpreter discovers method looping, requests compiler generate special nmethod entry point somewhere in loop (specifically, @ backward branch), , t...

latex - Language-specific setting about colorTheme in VSCode -

i want set colortheme each language. for example, latex --> "quiet light", others --> "dark+". we can set each settings language-specifically. added language-specific setting this, "[latex]":{ "workbench.colortheme": "quiet light" } but, code doesn't work. not of vs code 1.15. editor.* settings supported in language specific settings currently we tracking feature here: https://github.com/microsoft/vscode/issues/20652

php - laravel Illegal offset type error -

i have page shows detail of single testcase reason can't pass error send id heres controller public function show($id) { $data =db::table('testcase')->where('testcaseid', $id); return view('managements.testcase-details')->with($data); } heres rest of error in view.php line 180 @ handleexceptions->handleerror('2', 'illegal offset type', 'c:\xampp\htdocs\terkwazmng\vendor\laravel\framework\src\illuminate\view\view.php', '180', array('key' => object(builder), 'value' => null)) you forgot little bit. get , set data variable name. error means, pass query builder rather results. second error passing null value (second param in with ). $data =db::table('testcase')->where('testcaseid', $id)->get(); return view('managements.testcase-details')->with('data', $data); in view use data use array: foreach($data ...) .

android - Let view flow on toolbar's hamburger image -

i creating fragment got navigation drawer , tool bar. toolbar's part: <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@color/mainbackground" android:contentinsetend="0dp" android:contentinsetleft="0dp" android:contentinsetright="0dp" android:contentinsetstart="0dp" app:contentinsetend="0dp" app:contentinsetleft="0dp" app:contentinsetright="0dp" app:contentinsetstart="0dp"> <relativelayout android:id="@+id/relativelayouttitlebar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/mainbackground" android:orientation="vertical" > ...

javascript - Prototype objects, and object arrays -

if title made no sense, let me elaborate. i have 2 objects 1 called area , 1 called enemy . each area has it's own enemies made enemy prototypes each area. next did array.push(); function on each area prototype if user clicks button they'll shown list of "area's" can explore. the main part gives me error if try function alert(areas[0].enemies[0].name); how can use button display specific enemy name? no jquery please function area(name, enemies) { this.name = name; this.enemies = enemies; } function enemy(name, type) { this.name = name; this.type = type; } var cave = new area("cave", { bat: new enemy("bat", "flying"), snake: new enemy("snake", "ground"), }); var forest = new area("forest", { bear: new enemy("bear", "animal"), coyote: new enemy("coyote", "wolf"), }); areas = []; areas.push(cave, forest); var thatbtn = document....

javascript - Why does this function return true? -

const res = (n => { const = x => { if (x === 0) return true else { const odd = y => !even(y) return odd(x - 1) } } return even(n) })(42) console.log(res) //=> true since 42 used in paramtersbut says return true if x 0 strictly equaling type , value, i'm not sure why true returned. thought value 0 should return false. can please explain me, new javascript , programming. if strip unnecessary parts local functions , iife, test zero, it's value or recursive call of not reduced value one. const = x => x === 0 || !even(x - 1); console.log(even(42)) // true console.log(even(43)) // false whats happens recursive call of even n result of calling simplified -- ----------------- ---------- 8 !even(7) !even(7) 7 !!even(6) even(6) 6 !!!even(5) !even(5) 5 !!!!even(4) even(4) 4 !!!!!even(3) !even(3) 3 !!!!!!even(2) even(2) 2 !!!!!!!even(1) ...

embedding mysql cursors in php -

i fetching table database contains hundreds of rows,and want iterate on result row row in order perform task on data. have written whole code in php , want use mysql cursors job. going through web searches , tutorial videos came know how write cursor code in mysql,but none of them made clear how embed code in php in order make final code working. beginner sort of highly appreciated.

javascript - How do I create multiline text and page split in jspdf? -

i trying output text content of collection of text area inputs pdf file using jspdf. can't work out how put in line breaks or use pagesplit:true option doesn't take argument in doc.text. see similar question asked 25 days ago don't understand how implement answer , not sure work multiple text areas. appreciate advice. <html> <title>multi-line/pagesplit</title> <body> <form action="#" method="post" id="myform"> <table id="mytable"> <tr> <td>please enter text</td> </tr> <tr> <td><textarea rows="4" cols="50" id="mytext" wrap="soft" placeholder="your text..."></textarea></td> </tr> </table> </form> <input type="button" value="download pdf" onclick="downloadpdf()"/></button>...

plot - Matlab: Plotting / Simplifying parametrized functions with fixed Parameters -

i have function in case cost function categorisation in machine learning hat 3 variables: y, x, theta j = y*log(1/(exp(-theta*x) + 1)) - log(1 - 1/(exp(-theta*x) + 1))*(y - 1) the questions matlab: how can set e.g. y=0 , plot j j(y=0, theta, x) surface plot fsurf(j)? i tried equating y=0 , fsurf(j): error i tried assume (y=0): error same plot simplify function. of course, no. 2 can in mind or on paper. that's more kinda how-to question matlab later, more complicated uses. thanks. you can use subs first, , plot function substituting theta y ,as needed variables x , y : fsurf(subs(subs(j, 'y', 0), 'theta', 'y'))

python - Pyspark error handling with file name having spaces -

i using pyspark 2.1 problem statement: need validate hdfs path , file if exist need copy file name variable below code used far after referring few websites , stackoverflow import os import subprocess import pandas pd import times def run_cmd(args_list): print('running system command: {0}'.format(' '.join(args_list))) proc = subprocess.popen(args_list, stdout=subprocess.pipe, stderr=subprocess.pipe) proc.communicate() return proc.returncode today = datetime.now().date().strftime('%d%b%y') source_dir = '/user/dev/input/'+ today hdfs_file_path=source_dir+'\'student marks details.csv\'' cmd = ['hdfs', 'dfs', '-find','{}','-name', hdfs_file_path] code=run_cmd(cmd) if code<>1: print 'file doesnot exist' system.exit(1) else: print 'file exist' with above code getting error "file doesn't exist" file present in f...

How to use "hierarchical path" of chisel/scala? -

in verilog there such way access other module's stuff, know called "hierarchical path", here verilog rtl module a; reg a; endmodule module tb; u_a(); wire b; assign b = u_a.a; // hierarchical path endmodule could enlight me how access reg/wire of other modules in chisel/scala? afaik, not possible in chisel3. if try error an exception or error caused run abort: connection between sink (chisel3.core.uint@b) , source (chisel3.core.uint@1b) failed @: source unreadable current module. chisel3.internal.chiselexception: connection between sink (chisel3.core.uint@b) , source (chisel3.core.uint@1b) failed @: source unreadable current module if want expose outside modules should through io mechanism. being said possible create syntactic appearance of direct access module using experimental feature multiiomodule import chisel3._ import chisel3.experimental._ class extends multiiomodule { val reg = reg(uint(16.w)) val r = io(output(reg)) r := ...

javascript - JS function not sending a request -

this code should work i'm missing something, how can debug js code know where's problem? i'm sending user input (string) third party api, should expect json results in <p class="score"> nothing happens! var myurl = 'https://apiv2.indico.io/sentiment'; var api_key = 'xxxxxxxxxxxxxxxxxxxxxxx'; function apirequest() { var mydata = document.getelementbyid('userinput').value; $.post( myurl, json.stringify({ 'api_key': api_key, 'data': mydata, }).then(function(sent) { var s = sent var obj = json.parse(s) $('.score').append(obj.results) }); html <input placeholder="i love writing code!" id="userinput"> <button onclick="apirequest" id="submit">try it</button> <p class="score">score : </p> the userinput not passed javascript it's accessible ...

c++ - Error 'zif_test_addme': undeclared identifier - php extension development -

i new php extension development in windows , following article series learn it:- https://jojokahanding.wordpress.com/2014/05/26/writing-php-extensions-for-windowswriting-the-extension/ i've built compile environment extension development following this article . building successfully. when wrote function in add 2 numeric values , tried build it. throws me error @ line 11 in phptestmodule.php:- 'zif_test_addme': undeclared identifier line 11 code :- php_fe(test_addme,null) why getting error? i have googled , found this php website , tried replace php_fe zend_fe , end zend_fe_end . didn't work , end getting same error. plz help. ps :- using visual studio 2017 , php 7.0.22 build extension , system 64 bit. code snippets:- phptestmodule.cpp // phptestmodule.cpp : defines exported functions dll application. // #include "stdafx.h" #define php_test_extname "test" #define php_test_version "1.0.30" zend_function...

multithreading - Passing information between EDT and other threads Java with a Handler -

i have gui (on edt thread) , thread called "recorder" created gui's eventlistener if button pressed: if(actionevent.getsource().equals(ui.record)) { if(recorderthread == null) { recorder = new recorder(); recorderthread = new thread(recorder); recorderthread.start(); } } in same event listener, implemented mouselistener. public void mousereleased(mouseevent mevent) { int x, y; x = mevent.getxonscreen(); y = mevent.getyonscreen(); } i want pass these x , y variables recorder object in recorder thread when mouse clicked. think can bodge solution volatile variables, read somewhere handlers can used pass information or invoke methods between 2 threads, , interested in learning it. found this previous post faced similar problem mine. the solution post, however, quite confused me. think person passes thread objects handler, way thread can call objects inside handler? example: handler(someobj); then in thread hand...

Flow / flowtype - how to extend a declared module -

in react native app assigning custom method console e.g. console.foo = () => {} . console module type defined here . error: property not found in object type . how can extend & declare console module custom method type?

asp.net mvc - What is the NUnit framework lifecycle execution order? -

recently, added test project in asp.net mvc project based on nunit framework (version 3.7.1.0). know there attributes in nunit other frameworks can add them our class , methods in order write better tests cases. here attributes introduced nunit documentation: setup teardown testfixturesetup testfixtureteardown i'd know execution order , performance consideration behind scenes implementing that. i'd know execution order setup/teardown methods related testfixture executed once testfixture. setup/teardown methods related test executed for each test. here order loop in middle: testfixturesetup // executed once before first test setup setup // excuted before *each* test teardown // executed after *each* test testfixtureteardown // executed once after last test teardown i use setup method move there code repeated in arrange part of test. intialize sut in setup method creating , providing required mocked dependencies....

c# - Can I avoid casting an enum value when I try to use or return it? -

if have following enum: public enum returnvalue{ success = 0, failreason1 = 1, failreason2 = 2 //etc... } can avoid casting when return, this: public static int main(string[] args){ return (int)returnvalue.success; } if not, why isn't enum value treated int default? enums supposed type safe. think didn't make them implicitly castable discourage other uses. although framework allows assign constant value them, should reconsider intent. if use enum storing constant values, consider using static class: public static class returnvalue { public const int success = 0; public const int failreason1 = 1; public const int failreason2 = 2; //etc... } that lets this. public static int main(string[] args){ return returnvalue.success; } edit when do want provide values enum when want combine them. see below example: [flags] // indicates bitwise operations occur on enum public enum daysofweek : byte // byte type lim...

How to parse custom string to DateTime C#? -

i need parse following date aug 20 11:38:43 2017 gmt i'm trying use datetime.tryparseexact can't find correct format. my latest format mmm dd hh:mm:ss yyyy my code : string nextupdate; //next update: aug 20 11:38:43 2017 gmt string datetimeformat = "mmm dd hh:mm:ss yyyy"; datetime crldt; datetime.tryparseexact(nextupdate.split(':')[1].trim(), datetimeformat, system.globalization.cultureinfo.invariantculture, system.globalization.datetimestyles.none, out crldt); when run code crldt ~ date = {1/1/01 12:00:00 am} my question : format should use or alternative way can use parse string datetime update using suggestions : @sergey berezovskiy i've updated code : string nextupdate; // next update: oct 7 06:16:18 2017 gmt string datetimeformat = @"mmm dd hh:mm:ss yyyy \g\m\t"; regex r =new regex(".*next update:.*"); nextupdate = r.match(crltext).value; datetime crldt; dateti...

aurelia ui framework - Is there a root path you need to set for glyph svg icons to work in controls? -

Image
i have toolbar copied example site working none of glyph icons showing up. can confirm same svg icons working in non controls. toolbar code glyphs not working. <template> <ui-page page-title="toolbars" animate> <style> .example-container { position: relative; height: 450px; border: 1px solid #f0f0f0; } </style> <ui-content padded scroll> <ui-container> <ui-toolbar primary> <ui-input-group> <ui-input width="12em"> <ui-input-addon glyph="icon-fill-search"></ui-input-addon> </ui-input> <ui-dropdown value="0"> <ui-list-item value="0">site</ui-list-item> <ui-list-item value="1">posts</ui-list-item> <ui-list-item value="2">docs</ui-list-ite...

javascript - How to close Modal the React way? -

i have modal button , when press modal shows up. want closed if click - outside - modal-box , regardless if click outside or inside modal-box modal closes down. how make modal box close when pressed outside modal-box react way? https://codepen.io/anon/pen/mvvjor class app extends react.component { constructor(){ super() this.state = { show: false } } openmodal() { this.setstate( prevstate => ( {show: !prevstate.show})) } closemodal() { this.setstate({show: false}) } render() { return ( <div> <button id='button' onclick={() => this.openmodal()}>the modal button</button> {this.state.show && <div id='modal' onclick={() => this.closemodal()}> <div classname="modal-box"> <h1> i'm awesome modal! </h1> </div> </div>} </div> ) } } react...

python - Flask-login threading error -

i'm trying set basic authentication process using flask-login , have following code: @app.route('/login', methods = ['get', 'post']) def login(): login_form = forms.loginform() if login_form.validate_on_submit(): if database.validate_user(login_form.username.data, login_form.password.data): user = user(database.get_id(login_form.username.data), login_form.username.data) flask_login.login_user(user) return render_template('login.html', login_form = login_form ) return render_template('login.html', login_form = login_form ) inclusion of login_user function causes me following error , i'm having trouble working out why: file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/threading.py", line 884, in _bootstrap self._bootstrap_inner() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/threading.py", line 916, in _bootstr...

jQuery: How can I trigger an event when a div comes into view? -

is there way can fire event jquery when page scrolls far enough div come view? i think have hook scroll event , manually check. here similar question: check if element visible after scrolling hope helps. bob

popup - Fancybox 3 For opening Vimeo clips -

i'm trying use fancybox 3 opening vimeo embedded clips. i've tried replace online image herf vimeo url doesn't work, how can fix it? <a class="fancybox" href="https://player.vimeo.com/video/179809192" data-fancybox > <img src="video_preview/berlin_preview.png" class="berlin_preview"></a> thanks lot ;)

Google App script - email quota -

i using google form spreadsheet. have script in spreadsheet: sends notification form submitted. google daily quota set 100 @ every submission quota decreased 2 , not 1. checked method "mailapp.getremainingdailyquota()". sure have 1 recipient. know reason ? thank michele

angularjs - Angucomplete: console log input value -

i trying console log angucomplete input value. if write "w," should console log "w". if add letter "o" new console log "wo". usually console ng-model, here can't. <angucomplete-alt id="ex1" placeholder="customer name" pause="100" selected-object="selected" local-data="tickets" search-fields="title" title-field="title" minlength="0" ng-click="search()" input-class="form-control" style="margin-top: 15px"> ...

beagleboneblack - beaglebone GPIO3_13 (aka GPIO109) not exposed on P8 or P9? -

i have run problem controlling usb1' power. investigated " https://e2e.ti.com/support/arm/sitara_arm/f/791/t/270060 " tells me gpio3_13 controls usb1_drvvbus pin, controls usb power. i understand there software method change voltage of pin. question gpio3_13 located on p8 or p9 expansion bays? cannot find on diagrams. purposefully not exposed anywhere?

php - yii2 .htaccess subdirectory route is not working -

my htaccess configuration in root directory looks like <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritecond %{request_uri} ^/(assets|css|js|images|blog) rewriterule ^assets/(.*)$ frontend/web/assets/$1 [l] rewriterule ^css/(.*)$ frontend/web/css/$1 [l] rewriterule ^js/(.*)$ frontend/web/js/$1 [l] rewriterule ^images/(.*)$ frontend/web/images/$1 [l] rewriterule ^blog/(.*)$ frontend/web/blog/$1 [l] rewriterule ^(.*)$ frontend/web/$1 [l] rewritecond %{request_uri} !^/(frontend|backend)/web/(assets|css|js|blog)/ rewritecond %{request_uri} !index.php rewritecond %{request_filename} !-f [or] rewritecond %{request_filename} !-d rewriterule ^.*$ frontend/web/index.php in frontend/web looks rewriteengine on redirectmatch 404 /\.git redirectmatch 404 /composer\. redirectmatch 404 /.bowerrc rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php everything works fine images,css,js (for example, path sit...

c# - LiveCharts - plotting x&y from lists -

i have 4 lists (x1list, y1list, x2list, y2list) hold 1000 values each, want plot these lists x & y values using livecharts. i understand how plot y values using; new lineseries { title = "series1", values = y1list.aschartvalues(), pointgeometry = null }, new lineseries { title = "series2", values = y2list.aschartvalues(), pointgeometry = null }, i don't understand how apply x values respective series. i'm new c# apologies if simple overlooking. you can use obserablepoint object store x , y value. can create chartvalues<observablepoint> plot i'm thinking want see. make sure include statement livecharts.defualts namespace; using livecharts.defaults; chartvalues<observablepoint> list1points = new chartvalues<observablepoint>(); for(int = x1lis...

mysql - Add user if not exists in another table -

i need add usernames users_waiting table if not added users table before. var usernamesarray = ['test', 'test2']; connection.query('replace users_waiting (username) values ?', [usernamesarray]); i'm using node.js mysql client , have no idea how that. you have many options of doing it. 1 of not exists() : insert <table2> (...) select .... <source> t not exists(select 1 <table1> s t.id = s.id); i don't think it's need. can figure out rest this.

How to show HTML 5 video with play button without showing only play button in iOS -

Image
i know there way show video , play button together. shows big play button after click video appear. want when page loaded show video , play button desktop browser shows. html code: <div class="embed-responsive embed-responsive-16by9"> <video controls="true" src="link" controlslist="nodownload" preload="metadata" playsinline webkit-playsinline></video> </div>

relationships - MYSQL Getting Main Categories -

i have following query lists categories , parent category related to. t.term_id category id tx.parent id of category depend from. main categories have parent id= 0 and problem since query not displaying main categories sub-category. showing records parent>0 need parent =>0. put in condition doesn't work. select t.term_id, t.name, tx.parent, tm.name mg_terms t join mg_term_taxonomy tx on tx.term_id = t.term_id join mg_terms tm on tm.term_id = tx.parent tx.taxonomy='product_cat' order `tx`.`parent` desc any main categories (parent=0) well? you can either make use of union select , join 2 results: select t.term_id, t.name, tx.parent, tm.name mg_terms t join mg_term_taxonomy tx on tx.term_id = t.term_id join mg_terms tm on tm.term_id = tx.parent tx.taxonomy='product_cat' union select t2.term_id, t2.name, tx2.parent, null mg_terms t2 join mg_term_taxonomy tx2 on tx2.term_id = t2.term_id tx2.taxonomy='product_cat' , t2.parent...

https - How to bulk identify mixed content errors in blogger -

i'm looking way check 1000's of blog posts in blogger mixed content errors. i've found crawling tools, limited number of posts or blocked blogger crawling fast. i've got export can search. looking "http:" going enough? thanks time.

Python cannot find module h2o -

i have python 2 , 3 on debian (via apt ) , installed h2o following official instructions (thereby using pip3 instead of pip when executing install commands). afterwards, python seems fine: $ python python 3.6.1 |anaconda 4.4.0 (64-bit)| (default, may 11 2017, 13:09:58) [gcc 4.4.7 20120313 (red hat 4.4.7-1)] on linux but when try use h2o, fails: >>> import h2o traceback (most recent call last): file "<stdin>", line 1, in <module> modulenotfounderror: no module named 'h2o' what i've tried far – without solving issue: conda install h2o -> install ok (verified "conda list") conda install h2o-py: error: unsatisfiableerror: following specifications found in conflict: - h2o-py -> python 2.7* -> openssl 1.0.1* - python 3.6* following "second" official install instructions h2o found -> install without errors, problem not resolved. seems have many python envs installed - not sure if ca...

curve fitting - Why does the function lsqcurvefit not seem to work in Matlab 2015b? -

i using matlab 2015b , function lsqcurvefit not seem work. in fact, following error message diagnostic information: feature: optimization_toolbox license path: /home/username/.matlab/r2015b_licenses:/.netmount/app/matlab/r2015b/licenses/license.dat:/.netmount/app/matlab/r2015b/licenses/license.lic:/.netmount/app/matlab/r2015b/licenses/network.lic licensing error: -18,147. error in test (line 7) x = lsqcurvefit(fun,x0,xdata,ydata) for script below. note no error message appears when comment out last line lsqcurvefit. interestingly, script works nicely in machine matlab 2017a. xdata = [0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6 81.3]; ydata = [455.2 428.6 124.1 67.3 43.2 28.1 13.1 -0.4 -1.3 -1.5]; fun = @(x,xdata)x(1)*exp(x(2)*xdata); x0 = [100,-1]; x = lsqcurvefit(fun,x0,xdata,ydata) any thoughts please? thanks the command lsqcurvefit not part of matlab, it's part of add-on product optimization toolbox. looks 17b installation has product, 15b installation n...

raytracing - Java raytracer increase CPU usage -

i tried implement raytracer in java , works fine. once, rendering scene , checked cpu-usage of program. every virtual core being used overall cpu-usage around 22-23% i know when rendering cinema4d every virtual core being used 100%. how archive this? make raytracer run 4 times faster? (23% -> 100%) you should able 100% cpu usage, , else being equal, doing should result in faster rendering speed. you're apparently not @ 100% indicates me you're either not creating enough threads, or threads blocking on something. i've found sweet spot 1 rendering thread per virtual core. can use api detect number of cores available @ runtime, , spawn many rendering threads. example of this, see my java ray tracer . every virtual core being used overall cpu-usage around 22-23% i'm not sure mean this, may want dig using performance profiler better understand how threads using cpu. ideally want each of threads working time. use visualvm visualize process thre...

ios - Unable to download firebase database to my app -

i new programming in swift. trying make app downloads student data firebase database. unable app running. json file: {"classa":[ { "name": "student1", "usn": "1ds16cs095" }, { "name": "student2", "usn": "1ds16cs065" }, { "name":"student3", "usn":"1ds16cs047" } ] } this code download above json file , put in tableview. modelstudent class have variables name , usn stored. , marksstudentlisttableviewcell class using manipulate labels of prototype cell. import uikit import firebase import firebasedatabase struct studentdata { let studentname : string let studentusn : string } class marksstudentlist: uiviewcontroller, uitableviewdelegate, uitableviewdatasource{ var fetchedstudentids = [studentdata]() @iboutlet weak var tableview: uitableview! var ref: databasereference! var _selectedsub: int! var selectedsub: int { { return _selectedsub ...