Posts

r - Unable to save files from shinyapps.io to app directory on local machine -

i have shiny app gathers data facebook , displays in tables . there option save data in csv files , place in app directory.when run locally works when deploy app shinyapps.io account , use cannot see csv files being saved in app directory. not errors or warnings when using app. reason behaviour , how can resolve it? want app save files in app directory can access next time , display data without having need gather data again facebook.my app can read files directory not write files it. appreciated. regards, abhinav bais

sql - Neither percentile_cont nor percentile_disc are calculating the desired 75th percentile in PostgreSQL 9.6.3 -

working percentile functions, not getting desired output. "incorrect", functions working intended, , not understanding them properly. these numbers working with: n = 32 160000 202800 240000 250000 265000 280000 285000 300000 300000 300000 300000 300000 309000 325000 350000 358625 364999.92 393750 400000 420000 425000 450000 450000 463500 475000 475000 505808 525000 550000 567300 665000 900000 my understanding of percentile_cont aggregate 2 numbers if count in add them , divide two. understanding of percentile_disc select lowest number if count even. this understanding of calculating percentile using 50th (median) example: if number of numbers (n) odd, pick number in middle; if number even, average 2 numbers in middle. in case, there 32 numbers, median = (358625 + 364999.92) / 2 = 361812.46 . percentile_cont returns correct value since averages 2 values; percentile_disc returns incorrect value since picks lowest of two. regarding other percentiles, 10th ex...

Python - KeyError in Pandas DataFrame -

when import dataset: dataset = pd.read_csv('lyrics.csv', delimiter = '\t', quoting = 2) it prints so: lyrics,classification 0 should have known better girl yo... 1 can shake apple off apple tree\nshak... 2 it's been hard day's night\nand i've been wo... 3 michelle, ma belle\nthese words go to... 4 can't buy me love, love\ncan't buy me love\ni'... 5 love you\ncause tell me things want to... 6 dig pygmy charles hawtrey , deaf ... 7 song robin sings,\nthrough years of endl... 8 love me tender, love me sweet,\nnever let me g... 9 well, it's 1 money,\ntwo sho... 10 words let know\nstill could... and if print (dataset.columns) , get: index([u'lyrics,classification'], dtype='object') but if try prints lyrics, so: for in range(0, len(dataset)): lyrics=dataset['lyrics'][i] print lyrics i following error: keyerror: 'lyrics' w...

html - PHP Error - All Files or Directories created are 0 -

i coding registration script , wanted create folder inside folder called "users". somehow, folder created in root path (where php script located) , files, supposed written inside folder in file called 0. here's code: if (!isset($_post["method"])){ die("error"); } if (!isset($_post["usernamefld"])){ die("error"); } if (!isset($_post["passwordfld"])){ die("error"); } if ($_post["method"] == "register"){ if (!isset($_post["emailfld"])){ die("error"); } if(is_dir("./users/"+$_post["usernamefld"])){ die("taken"); } mkdir("/users/"+$_post["usernamefld"]); echo "test...

javascript - Creating a path from a PNG in fabricjs -

i have png image transparent area. i have photo. i using fabricjs i need create new image cropped transparent area of png. i understand can use clipto(path) function create new image. however, problem creating path in first place. how can create path transparent area of png? thanks in advance. as strange may seem, wasn't able find correct duplicate this... you don't need calculate path bitmap. canvasrenderingcontext2d api offers compositing , blending options , allow work directly bitmaps. fabricjs offers option: http://fabricjs.com/docs/fabric.object.html#globalcompositeoperation var c = new fabric.canvas('c', { imagesmoothingenabled: false }); fabric.image.fromurl( 'https://dl.dropboxusercontent.com/s/4e90e48s5vtmfbd/aaa.png', function(image1) { fabric.image.fromurl( 'https://upload.wikimedia.org/wikipedia/commons/5/55/john_william_waterhouse_a_mermaid.jpg', function(image2) { // 1 clipped...

MySQL Select and LEFT JOIN multiple with AS statement -

i'm encountered couple errors contains multiple with statement. (for example, abc_table, def_table, qrs_table ones populated, containing similar column names have different metrics within each table. ) with abc as( select region,temporature,id abc_table) , def as( select region,temporature,id def_table) , xyz as(select region,temporature,id abc left join def on def.region=abc.region ) /*this 1 uses value previous with*/ select region,temporature,id,region_id qrs_table qrs /*this key table*/ left join xyz on xyz.id = qrs.id region_id=3 would appreciate thoughts/input thank you!

javascript - console.log always printing same thing when code is different in Angular 1 app -

i trying complete angular 1.5 tutorial youtube series: angular 1.5 tutorial . angular 1 because work still uses , need become better it. the problem follows: created blog-list.component.js , blog-list.module.js file along app.module.js file. writing console.log() message in component file says console.log("hello sir"); , had console.log("hello"); . whenever try change console.log message console logs hello, not updated console message. not sure have done wrong, can't seem able find mistake. perhaps might able see it? here file contents: blog-list.component.js: 'use strict'; angular.module('bloglist'). controller('bloglistcontroller', function() { console.log("hello sir"); }); blog-list.module.js: 'use strict'; angular.module('bloglist', []); app.module.js: 'use strict'; angular.module('try', ['bloglist']); index.html file: <!doctype html> <html ng...

wordpress - ACF plugin relationship field, if no value in nav tab,want to hide the tab -

i using bootstrap nav tab , acf custom field in wp theme. want hide nav tab if there no value in relation. how that? below code-- want hide compatible tab, if relation dont return value <!-- nav tabs --> <ul class="nav nav-tabs nav-justified" role="tablist"> <li role="presentation" class="active"><a href="#home" aria-controls="overview" role="tab" data-toggle="tab">overview</a></li> <li role="presentation"><a href="#compatibility" aria-controls="compatibility" role="tab" data-toggle="tab"> compatibility </a></li> <li role="presentation"><a href="#datasheet" aria-controls="datasheet" role="tab" data-toggle="tab">datasheet</a></li> <li role="presentation"><a href="#order" ar...

SQL - MYSQL One query recieving set limit on different column values -

lets have table set of different columns (offcourse), example : table id col1 integer(1), // 0 || 1 col2 // --||-- col3 // --||-- col4 // --||-- is possible, in 1 query select 4 rows col1=1 , select 4 rows col2=1 , select 4 rows col3=1 etc etc. think understand mean. what have done far make 4 different queries or make 1 query , (col1 = 1 or col2=1 or... etc). this works if limit result lets 16, might 15 rows col1=1 , maybe 1 row col2=1 , col3,col4 - no result. so dear fellas; there way in 1 query (i think not) select * table col1=1 limit 4 union select * table col2=1 limit 4 union select * table col3=1 limit 4 union select * table col4=1 limit 4 this 1 result 16records max. if there less 4rows certin criteria, you'll less rows. duplicates removed, resulting in less 16 rows. not different rows. if single row col1=1 , col2=1 , might returned twice if use union all , union slower large datasets

html - Inline-Flex messes with vertical align -

having inline item next inline-flex nested flex box messes vertical alignment (it ignores top margin), 1 solution found put ::before in inline-flex item, i'm not sure why fixes it. the first 1 ignores top margin on label, top margin works on second one, because of ::before . label { margin: 20px 5px 0 0; } .input-container { display: inline-flex; } .with-before::before { content: ''; } .buttons { display: flex; flex-direction: column; } <div> <label>top margin ignored:</label> <div class="input-container"> <div class="buttons"> <button>&lt;</button> <button>&gt;</button> </div> <input type="text"/> </div> </div> <br/> <div> <label>top margin works:</label> <div class="input-container with-before"> <div class="button...

Can event delegation be implemented if the jQuery .on() receives only two parameters? -

i reading delegated events @ https://learn.jquery.com/events/event-delegation/ , http://api.jquery.com/on/ . examining following syntax: .on( events [, selector ] [, data ], handler ) in order implement event delegation, optional [, selector ] in syntax above must used, correct? example, not implementing event delegation (notice how .on() receiving 2 parameters): // attach directly bound event handler $( "#list a" ).on( "click", function( event ) { event.preventdefault(); console.log( $( ).text() ); }); this implementing event delegation (notice how .on() receiving more 2 parameters): // attach delegated event handler $( "#list" ).on( "click", "a", function( event ) { event.preventdefault(); console.log( $( ).text() ); }); can event delegation implemented if jquery .on() receives 2 parameters? impression is not possible have confirmation. thank you. technically can. optional selector parameter ...

html - Angular 2 anchors with routing -

i'm building angular 4 app , want use anchor-ing in it. it's one-page website, on have 4 containers, listed vertically. so: --------------- | | | | | | --------------- --------------- | | | | | | --------------- etc... say 2 of boxes 'about us' , 'location'. @ top of app there navbar , want on click @ <li> , angular scroll down transition , stop @ proper component (1 of these 4 containers). i'm new angular 4, i'm still studying , i'm asking advice. can achieve anchor effect ng's router, given i'll need attach scroll-down animation it, or should stick ? way better go with? , also, if should router there specific things have know kind of redirection or it's going again {path: 'about', aboutcomponent }; ? transition planning do, shall read @angular/animations or going plain typescript?

visual studio - How to break when entering own code? -

the "just code" feature permits limit debugging operations user code (unoptimized code available pdb). is possible break whenever program flow invokes "my code" in visual studio? potential application: when debugging issues in libraries used complex third-party application, anything called when issue occurs starting point. breaking when entering own code permit without excessive logging. it doesn't seem so. however, if own code within few namespaces, windbg can used workaround (the following unmanaged code; assume there's way managed code): > bm modulename!namespacename::* will set breakpoints entry point within given namespace. if access single-threaded, windbg can print list of actual entries performed in execution: > bm modulename!namespacename::* "bd *; ln; l+t; p \"dv; pt \\\"be *; r $retreg; g\\\"\"" will add breakpoints potential entry points automatically perform actions log , out aga...

php - SELECT query inside html code gets no results -

i'm trying install php code inside html file present club friends using select query mysql. can't see results inside page. need help. here's entire php code (and html) integrated inside html: <h2> club members</h2> <br/> <table dir="ltr" align="center" border="1"> <tr> <td><b>private name</b></td> <td><b>family name</b></td> <td><b>e-mail</b></td> </tr> <?php // create connection $conn = mysqli_connect('localhost','root',""); //check if connection opened, if not prompt error page. if (!$conn) { die('could not connect: ' . mysqli_error()); } //select data base. mysqli_select_db($conn, "club"); //set character set utf-8 allow hebrew. mysqli_query($conn, "set names 'utf8'"); //sql query - user details $sql = "select fname, lname, mail customers...

validation - Xampp and Sublime do recognize my php. I can't figure out why -

in sublime there no syntax coloring, xampp ouputs plain text, , php validator used comes $arr not variable.... can't see wrong it. ˂?php $arr = array( 'properties' => array( array( 'property' => 'email', 'value' => 'apitest@hubspot.com' ), array( 'property' => 'firstname', 'value' => 'hubspot' ), array( 'property' => 'lastname', 'value' => 'user' ), array( 'property' => 'phone', 'value' => '555-1212' ) ) ); $post_json = json_encode($arr); $hapikey = readline("/"); $endpoint = 'https://api.hubapi.com/contacts/v1/contact?hapikey=' . $hapikey; ...

php - org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject (Andriod Studio) -

i'm trying android app developed in android studio send data register user activity database. idea once user types in required information , clicks register button data should go database , login activity should re-appear. however, when click on register button on register user activity nothing happening, no redirection login activity or data being sent database. below register user activity code: package com.example.vi5h.split; import android.content.intent; import android.support.v7.app.alertdialog; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import com.android.volley.requestqueue; import com.android.volley.response; import com.android.volley.toolbox.volley; import org.json.jsonexception; import org.json.jsonobject; public class registeruseractivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super...

How do you get a custom element to load using Aurelia -

i have custom element nav-bar in skeleton-navigation except not using router part. can't seem fire events. code: nav-bar.html <template> <ul id="topmenu"></ul> </template> nav-bar.js attached() { alert('test') } containing page: <template> <require from="./nav-bar.html"></require> <div class="desktop" id="container"> <nav-bar></nav-bar> </div> </template> when load custom element using .html @ end of path, aurelia not load .js file. change require element following, , work expect: <require from="./nav-bar"></require>

linux - Getting all output from terminal in C -

i working on ssh program , want able have full control on terminal via networking. question is, if send command server run in terminal, how output terminal prints? have seen many posts saying use popen() command have tried can't change directories , other commands using this, simple things such ls . there other way output terminal besides sending file command > filetoholdcommand . in advance! i put comment, dont have enough rep i'm new. cd built in shell command want use system(). cd have no effect on process (you have use chdir(), that),so want start shell subprocess via fork/exec, connect pipes stdin , stdout,then pipe commands duration of user session or connection. following code give general idea. basic, , flawed - use select() not usleep() one. int argc2; printf( "server started - %d\n", getpid() ); char buf[1024] = {0}; int pid; int pipe_fd_1[2]; int pipe_fd_2[2]; pipe( pipe_fd_1 ); pipe( pipe_fd_2 ); switch ( pid = fork() ) { case -1: ...

javascript - React native bridge restarting when app goes to background? -

i using rctrootview inside view controller keep alive time in app , present modally time time. when app goes background (i press home button in iphone) , app, rctrootview flashes white screen moment, restarting bridge . how can avoid behaviour?

Tkinter in python 2.7 to 3.6 -

this code snippets trying out. in python-2.7 changed 1 line found needed changed: from tkinter import * to from tkinter import * well... very wrong on that. guess moduals got removed between python-2.7 , python-3 ??? causes modualnotfounderror whenever try run it. these moduals: tkfiledialog tkmessagebox note: update when find more tkinter libraries outdated those modules named filedialog , messagebox . you can check tkinter documentation on modules more information update: see example tkinter on python 3. from tkinter import * tkinter import messagebox, filedialog window_size = '200x100' top = tk() top.geometry(window_size) def msgbox_hello(): messagebox.showinfo('messagebox title', 'messagebox content') def filedialog_world(): file_name = filedialog.askopenfilename() # display file name if file_name: messagebox.showinfo( 'selected file name', 'you se...