Posts

Showing posts from September, 2012

tableau - Super Sample Superstore Tutorial -

hi new tableau , trying create similar version of visualization super sample superstore on website. https://www.tableau.com/solutions/gallery/super-sample-superstore wondering there training materials or tutorials regarding sample. if not, specific question on how 3 navigating buttons on top right created , how perimeters created link different dashboards. descriptive/prescriptive/annotations you can learn tableau https://www.tableau.com/learn/training hear can find information videos.

security - BLE Restricted Access -

i have designed ble peripheral product. there app developed (android, windows) writing firmware support app in blind. we cannot have access peripheral not authorized. handle have password stored in firmware. there 7 custom characteristics, 3 of disabled upon initial connection. password characteristic write of course, once correct password sent other characteristics enabled. i have no experience ble until have no idea if scheme reasonable or not. is there bettor way limit access? thanks rich the bluetooth standard defines pairing/bonding concept corresponding encryption. based on specification doesn't seem fits needs. you therefore have come on own. how secure make you. proposal simplest , unsecure way of doing it. secure thing can use protocol created these purposes ( https://en.wikipedia.org/wiki/password-authenticated_key_agreement ) create cryptographic key use authenticated encryption when later communicate device. decide way want go based on sec

python - Draw text inside pylab figure window -

i want add more details calculations used create plot (histogram). how can add text can position anywhere want in figure window? lots of ways this: text figtext annotate

spring - Cannot find the controller class -

i'm starting learning spring mvc . simple helloworld project when i'm trying use controller methotds @requestmapping , there http status [404] – [not found] problem. i'm using sts. http://localhost:8080/firsttest/ working i'm trying 'greeting' part , it's not working. (project name :firsttest) ( tried <url-pattern>/*</url-pattern> still not working) thanks helps. hellocontroller.java @controller public class hellocontroller { @requestmapping(value ="/greeting") public string sayhello (model model) { model.addattribute("greeting", "hello world"); return "hello"; } } hello.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <

.net - Is there any benefit on declaring a local constant of string over a local variable C# -

is there noticeable benefit regarding performance on using constant on string. suppose following case public void methodusingconstant() { const string searchedtext = "foo"; //some operations using searchedtext string } public void methodnousingconstant() { string searchedtext = "foo"; //some operations using searchedtext string } there option take class-struct constant field. or, should avoid overthink these micro optimizations? if think it, shouldn't different. because when computer sees variable, retrieves memory adress , value. have tried code , difference tiny (less 3ms: btw code ran in ~107 ms) down millions of other variables: //just changed non const const string s = "hello"; string full = ""; int k = 0; for(int = 0; < 10000; i++) { full += s; } in general, const vs non const comes down this: value stay same: set const , else le

Java/Spring/JDBC: changing database schema property at run-time -

i'm trying come solution following problem: i have number of spring beans various daos in application configured like: <bean id="productdao" class="com.myproject.productjdbcdao"> <property name="datasource" ref="datasource" /> <property name="getallproductssql" value="select * ${myschema}product_table" /> </bean> <bean id="customerdao" class="com.myproject.customerjdbcdao"> <property name="datasource" ref="datasource" /> </bean> where myschema set in our properties file like: myschema=testdbschema. i have spring bean post processor configured like: <bean class="com.project.schemaawarebeanpostprocessor"> <property name="myschema" value="${myschema}" /> <property name="differentschema" value="${differentschema}" /> </bean> where pos

java - Issue with JSON conversion -

below sample json data. giving below exception during conversion. there class has list of transactions. transactions public class transactions{ private string id; private thisaccount thisaccount; private otheraccount otheraccount; private details details; private metadata metadata; public string getid(){ return id; } public void setid(string input){ this.id = input; } public thisaccount getthisaccount(){ return thisaccount; } public void setthisaccount(thisaccount input){ this.thisaccount = input; } public otheraccount getotheraccount(){ return otheraccount; } public void setotheraccount(otheraccount input){ this.otheraccount = input; } public details getdetails(){ return details; } public void setdetails(details input){ this.details = input; } public metadata getmetadata

Default Pixel Format For FFMPEG For Encoding an Image Stack To Movie -

if 1 converting stack of images .mp4 ffmpeg using libx264 encode h.264 video , 1 didn't specify pixel format in call ffmpeg default pixel format yuvj420? i've been doing experiments , have been getting results identical if specified yuvj420 format versus if specify no format. output pixel format depends on input pixel format, encoder being used, , if performing filtering. according ffmpeg -h encoder=libx264 encoder supports following pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21. by default ffmpeg automatically perform pixel format conversion 1 of supported formats: whichever resembles source pixel format. can increase verbosity of console output see in more detail using -loglevel debug . example rgb24 input: [format @ 0x55657882d6e0] compat: called args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21] [format @ 0x55657882d6e0] setting 'pix_fmts' value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv44

c - increment in while loop doesn't work? -

i doing following while loop, , line number doesn't incremented (it's 0). why that? int main(int argc, const char* argv[]) { int line_number = 0; int f = 0; while (f == 0) { printf("line number %f\n", line_number); line_number++; } return exit_success; } (i realize infinite loop, interested here in why line_number isn't getting incremented.) with printf , matters letter put after % sign variable replacement. if @ the list of format specifiers , you’ll see %f floating-point numbers. means thinks line_number float; doesn’t proper conversion because doesn’t realize needs to, , instead reads same bits float. the way floating-point format works complicated , you’ll stay close 0 long time. depending on how fast computer , how patient are, might or might not see change if leave running longer. (technically it’s worse this, undefined behavior ; however, outcome.) most compilers have option warn if use wrong

php - HTTP ERROR when trying to upload images from the wordpress -

i getting http error when trying upload images wordpress backend. tried few suggestions of finding php.ini file unable via ssh. also tried adding below code function ms_image_editor_default_to_gd( $editors ) { $gd_editor = 'wp_image_editor_gd'; $editors = array_diff( $editors, array( $gd_editor ) ); array_unshift( $editors, $gd_editor ); return $editors; } add_filter( 'wp_image_editors', 'ms_image_editor_default_to_gd' ); which did not help. i using ubuntu instance on amazon lightsail, appreciated.

ghost blog - Trying to display 7 posts on first page and 9 on the following pages -

struggling layout in ghost , i'm starting think it's not possible, have tried helper well. i tried limiting posts ends knocking next page out of order. i had many attempts code , ended changing layout don't have paste. know if it's possible this? https://imgur.com/a/do1a9 asked on ghost slack channel , isn't possible.

LISP Cannot take CAR of T -

i trying evaluate each atom of list , see if it's equal number provided , remove if not running slight problem. i wrote following code: (defun equal1(v l) (cond((= (length l) 0)) (t (cond( (not(= v (car(equal1 v (cdr l))))) (cdr l) ))) ) ) (equal1 5 '(1 2 3 4 5)) i obtain following error error: cannot take car of t. if add (write "hello") action if true, following error obtained: error: cannot take car of "hello". i'm still quite new lisp , wondering going on , how fix evaluate each atom , remove if not, cdr l action. there couple of things improve function. firstly, let's indent (defun equal1 (v l) (cond ((= (length l) 0)) (t (cond ((not (= v (car (equal1 v (cdr l))))) (cdr l)))))) rather saying (= (length l) 0) , can use (zerop (length l)) . minor sylistic point. worse branch returns no value. if list l empty should return? the issue function in t branch of first cond .

html - Scrollable tbody inside grid layout -

i have simple 3-part layout (header/sidebar/content) using css grid. inside content, have table. i want table fill remaining space in div.content , have tbody own scrollbar. every combination of overflow-y: scroll; , position: relative various widths/heights results in either div.content getting scrollbar, or <table> overflowing (see example - on jsbin ). how can make tables <tbody> receive scrollbar, , have table bounded content div without overflowing? html, body { margin: 0; height: 100%; } main { display: grid; grid-template-areas: 'header header' 'sidebar content'; grid-template-rows: 100px 1fr; grid-template-columns: 200px 1fr; width: 100%; height: 100%; } header { background-color: #ccc; grid-area: header; padding: 20px; } aside { background-color: #eee; grid-area: sidebar; padding: 10px; } aside img { width: 100%; mix-blend-mode: darken; } div.content { positio

Spring Integration DSL - Parallel processing -

i have integration flow(productholdingsflow) wherein http response split , routed 3 sub flows. sub flows output channel different integration flow(s). each of these integration flows make 3 different http calls, aggregate results , send response back. have splitter output channel executor channel , messages send independent thread sub flows. seems work fine. wanted sub flow - integration flows call 3 api's in parallel @ moment sequentially executed. here appreciated. below snippet of integration flow code. main integration flow @bean(name = pollermetadata.default_poller) public pollermetadata poller(){ return pollers.fixeddelay(1000).get(); } /** * <p> account list orchestration flow entry</p> * * @return */ @bean public integrationflow productholdingsflow() { return flow -> flow.publishsubscribechannel(s -> s // product holdings sapi .subscribe(f -> f.enrichheaders(h -> h.headerexpression("customerid

javascript - how to make google chart moving and update dynamically -

Image
i don't know how make google chart moving, , asking again out there .i need badly.. want make google chart moving database because database collecting data automatically.i want chart move automatic update without refreshing it. following javascript code: the output of following code <!doctype html> <html> <head> <!-- external libs--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://www.gstatic.com/charts/loader.js"></script> <script src="jquery.min.js"></script> <!-- example script --> <script> google.charts.load('current', { callback: drawchart, packages: ['corechart'] }); // onload callback function drawchart() { // jsonp request var jsondata = $.ajax({ url: 'livedata.php', datatype: 'jso

Passing contours from OpenCV's findContours from Python to C++ -

have bit of unique problem, wanting pass contours opencv's cv2.findcontours() in python, function written in c++, using boost python. i found out contours' type by: >>> type(contours) <type 'list'> >>> type(contours[0]) <type 'numpy.ndarray'> >>> type(contours[0][0]) <type 'numpy.ndarray'> >>> type(contours[0][0][0]) <type 'numpy.ndarray'> >>> type(contours[0][0][0][0]) <type 'numpy.int32'> this python code: import numpy np, cv2, py_wrapper img_file = 'an_image.png' img = cv2.imread(img_file); thresh = 100 canny_output = cv2.canny(img, thresh, thresh*2, 3) _, contours, hierarchy = cv2.findcontours(canny_output, cv2.retr_tree, cv2.chain_approx_simple) py_wrapper.ndarrays(contours) my thinking need pass data list, what's inside can converted numpy ndarray opencv mat using this: numpy ndarray ⇋ opencv mat conversion and c++: void ndarrays

livequery - When was .on() introduced to jQuery? -

i have legacy code uses live query plugin extensively. code uses jquery 1.3.1. need replace deprecated .livequery() modern .on() ( http://api.jquery.com/on/ ), not think .on() available jquery 1.3.1. in version of jquery was .on() incorporated first time? thank you. on top right side of webpage can see in version added. .on() function added in 1.7 version.

javascript - Google Chart using Control Wrapper for Multiple Choice Questions -

i have data multiple choice (checkboxes) question - data structured in such way person can select none, 1 or more 1 option , data saved in multiple columns. trying build google chart using control wrappers filterable @ same time want chart data using percentage instead of counts.. , thats tricky part, because base (or denominator) total number of people answering question , not total number of active rows in file.. in data, base / denominator 8 (as 8 people have answered question, 2 have left blank / not answered) , want counts of each yes in each column divided 8 in order calculate percentage of each option , chart options in 1 bar chart. data in spreadssheet: https://docs.google.com/spreadsheets/d/19vwnzkhg5geuycibdmtolkblkiowcx94wi9jyuhveuo/edit#gid=0 i have kept desired output chart in same sheet. @whitehat helped me aggregate data (and thankful him guiding me in right direction here!!!) in data view when created new data view has desired columns, chart doesnt draw - error me

reactjs - Control multiple charts with one legend react-chartjs2 -

i'm using react-chartjs2 , chart.js display datasets web application i'm building. user going have option of selecting how many charts view different items. each item have own chart, fields/labels datasets same each item. being case want user able hide lines different charts using 1 single legend. don't want display legend each chart gets generated, have 1 @ top. i have general idea on how this. issue each chart own react component. i'm trying access other charts in 1 of components , iterate through each instance of charts , modify data way. idea on how can done?

rest - Golang services response file -

how can return file service more efficiently in go? example, receive file this here example use receive file service: func (b *benefitlisthandler) uploadappend(w http.responsewriter, r *http.request) { r.parsemultipartform(32 << 20) file, handler, err := r.formfile("benefitlistuploadfile") if err != nil { libhttp.encodeerrorresponse(w, err, http.statusinternalservererror) return } defer file.close() f, err := os.openfile("./"+handler.filename, os.o_wronly|os.o_create, 0666) if err != nil { libhttp.encodeerrorresponse(w, err, http.statusinternalservererror) return } defer f.close() io.copy(f, file) go b.readfileappend("./" + handler.filename) libhttp.encodeokresponse(w, true)} after that, confused how can send file request binary, improve time , consumption. after information question solution to specify browser file put header response: w.header().set("content-disposition"

Google translate javascript -

i trying google translate via javascript. my thought load script <script> tag, , able access api via objects , methods provided said <script> i thought had figured out using google loader, using following code: <script src="https://www.google.com/jsapi?key=my-key"></script> google.load("language", 1); google.language.translate('hello, beautiful','en','es',function(result) { console.log(result.translation); }); but chrome throws error @ google.load() line breaks page. error a parser-blocking, cross site (i.e. different etld+1) script invoked using document.write() of course loader doing. so i'm kinda stuck. know there ways using npm i'm working on basic web page. any idea right way is? if helps, running angular on web page.

sql server - Query JSON data with unknown number of entries -

Image
we're using sql server 2016 import , analyze data json files. picture below displays sample of data we're working with. notice how resources[0].routelegs[0].itineraryitems[0] doesn't have "warnings" attribute yet resources[0].routelegs[0].itineraryitems[15] (highlighted in yellow). we're trying find way query of resources[0].routelegs[0].itineraryitems (no matter how many available) see if of them have "warnings" attribute. way know how hard code json_value query (please see second image below). there way query of resources[0].routelegs[0].itineraryitems @ once see if of them have "warnings" attribute?

Python BeautifulSoup HTML Scraping Issue -

so, i've been playing around python, , i've been trying learn bit of newer things mixing code find , making possibly end using in future. today, i've project, although when print out links, says https://v3rmillion.net/showthread.php instead of being prefer being: https://v3rmillion.net/showthread.php?tid=393794 import requests,os,urllib,sys, webbrowser, bs4 bs4 import beautifulsoup def startup(): os.system('cls') print('discord profile') user = raw_input('discord tag: ') r = requests.get('https://www.google.ca/search?source=hp&q=' + user + ' site:v3rmillion.net') soup = beautifulsoup(r.text, "html.parser") print soup.find('div',{'id':'resultstats'}).text content=r.content.decode('utf-8','replace') #attempting scrape links, although i'd full length instead of .php links=[] while '<h3 class="r">' in co

javascript - Enable swipe in Multi image Carousel for mobile -

i have multicarousel left , right arrow. want disable arrows on mobile screen , want enable swipe right or left on mobile. this part of js using it. $(document).ready(function () { var itemsmaindiv = ('.multicarousel'); var itemsdiv = ('.multicarousel-inner'); var itemwidth = ""; $('.leftlst, .rightlst').click(function () { var condition = $(this).hasclass("leftlst"); if (condition) click(0, this); else click(1, this) }); rescarouselsize(); $(window).resize(function () { rescarouselsize(); }); i have try enable swipe following function not working me. $(document).ready(function() { $(".multicarousel-inner").swiperight(function() { $(this).parent().multicarousel('prev'); }); $(".multicarousel-inner").swipeleft(function() { $(this).parent(

markdown - Fetching referrer URL from a Github-Issue embedded image -

Image
we want place embedded image github issue eg. https://github.com/org/repo/issues/101 ![a cool badge](http://ourserver.io/badge/) on /badge endpoint, our server wants render svg file specific issue special information attached (accepted/rejected/stale/etc), request object doesn't seem contain referrer url, in case https://github.com/org/repo/issues/101 (using node/express), can't distinguish 1 badge on server side without including additional information on query string. is there way catch referring url before creating badge? ps: aware of this limitation, though, since not interested in user-browser-specific data, url of issue badge needs rendered to, thought i'd ask. pps: our current solution generate embed code per issue on our landing page, we'd eliminate step , have universal embed code that's valid on every issue. all github images proxied https://github.com/atmos/camo security reasons (typically, avoid mixed-content warnings when u

python: how can i make turtle perform certain actions from a list? -

data_sets = [ ['o', ['sheet c', 'location 2', 'upright'], ['sheet b', 'location 3', 'upright'], ['sheet d', 'location 1', 'upright'], ['sheet a', 'location 4', 'upright']] ['x', ['sheet a', 'location 1', 'upright'], ['sheet b', 'location 2', 'upright'], ['sheet c', 'location 3', 'upright'], ['sheet d', 'location 4', 'upright']], ] i need able paste correct sheet correct location. current code able go right location can paste sheet_a_upright() , not sheet want example works list, pastes 1 sheet: data_sets = [ ['o', ['sheet a', 'location 1', 'upright']] ] the code can paste correct location doesn't paste right sheet. if make paste 1 of first 2 lists put @ start of que

What is the explanation for these bizarre JavaScript behaviours mentioned in the 'Wat' talk for CodeMash 2012? -

the 'wat' talk codemash 2012 points out few bizarre quirks ruby , javascript. i have made jsfiddle of results @ http://jsfiddle.net/fe479/9/ . the behaviours specific javascript (as don't know ruby) listed below. i found in jsfiddle of results didn't correspond in video, , not sure why. am, however, curious know how javascript handling working behind scenes in each case. empty array + empty array [] + [] result: <empty string> i quite curious + operator when used arrays in javascript. matches video's result. empty array + object [] + {} result: [object] this matches video's result. what's going on here? why object. + operator do? object + empty array {} + [] result [object] this doesn't match video. video suggests result 0, whereas [object]. object + object {} + {} result: [object][object] this doesn't match video either, , how outputting variable result in 2 objects? maybe jsfiddle wrong. array(16).join("wat

ios - How to download image from JSON using the Swift 3 and Alamofire? -

how download image json using alamofire , swift 3? getting dictionary of data. see following json response. able print data in labels can't download image. response getting api. userjson userjson userjson userjson ["status": 1, "student": { "admission_date" = "14/06/2017"; "admission_no" = 13538; "class_teacher" = "caroline forbes"; dob = "04/05/2001"; email = "ranisagar.sivadas@gmail.com"; "father_name" = "sagar sivadas"; gender = male; image = "/system/images/86/j1f9diji_medium.jpg?1504593436"; "mother_name" = "rani r s"; name = "abhijith sagar"; phone = 9066260799; religion = hindu; "school_email" = "13538.861@demo.in"; "student_id" = 86; }, "message": details fetched successfully.] this code. func setupuiprofiledata() { apimana

material design - How to clear all the md-input fields at once inside a md-form using an external button in Angular 2/2+/4 -

i want clear fields inside md-form @ once using external clear button in normal html forms. problem md-form contains md-input fields instead of regular input fields. simple reset function won't trigger that. i've set type of each field 'search' gives kind of control it's u have manually click , remove each value of filed. want erase them @ once. is there proper way to this? in advance. form code <form class="formwidth" (ngsubmit)="searchclass()" #myform="ngform"> <table class="fullwidth" cellspacing="0"> <tr> <td> </td> <td> <md-input-container div="addclassname" *ngif="classclicked === true"> <input [(ngmodel)]="message.classname" mdinput placeholder="class name" id="classname" name="classname" type="search" >

Run Apacha Airflow on hdfs -

i want run apache airflow on hdfs . know oozie running hive commands, sqoop commands(if set number of mappers) on multiple data nodes. want use apache airflow in project. should in airflow in order run codes on multiple data nodes? , how can understand nodes used while command executed? thanks

sql - I want to get Units Advancement (Latest Units - Previous Units linked to the last/previous date field) in MS ACCESS, how can I achieve this? -

i want units advancement (latest units - previous units) in ms access, how can achieve this? i've got 1 field in table called totalunits, want use expression builder uses data of row in field called totalunits , subtract data of previous row linked last date in same field called totalunits, example: id dateofchecking units mf totalunits: [units]*[mf] advancement: [totalunits]-[?????]previous record in same field linked previous date. it easy in ms excel how can in access?

data.table - Keep Words in an XTS object in R -

i have identical question topic: keeping character types/names in xts object in r however, question doesn't seem have been resolved, , whether or not original poster able solve issue unknown thought should ask again , obtain answer. i working data table , convert data table xts object. in code use function as.xts() convert data table object xts object, , when happens xts package drops non-numeric columns , turns data table xts object/matrix. now, there column in data table object filled names, , prevent xts dropping column when convert data table xts object. possible? i hate it, answer no. xts object matrix has been indexed dates. closest thing you'll have words column names.

java - correct way to call facebook page in android? -

i'm trying open facebook page using facebook app if user has facebook app installed, or use browser instead if not. tried following code: public static string facebook_url = "https://www.facebook.com/samsung"; public static string facebook_page_id = "samsung"; //method right url use in intent public string getfacebookpageurl(context context) { packagemanager packagemanager = context.getpackagemanager(); try { int versioncode = packagemanager.getpackageinfo("com.facebook.katana", 0).versioncode; if (versioncode >= 3002850) { //newer versions of fb app return "fb://facewebmodal/f?href=" + facebook_url; } else { //older versions of fb app return "fb://page/" + facebook_page_id; } } catch (packagemanager.namenotfoundexception e) { return facebook_url; //normal web url } } it kind of

Java: How to unescape HTML character entities in Java? -

basically decode given html document, , replace special chars, such "&nbsp" -> " " , "&gt;" -> ">" . in .net can make use of httputility.htmldecode . what's equivalent function in java? i have used apache commons stringescapeutils.unescapehtml4() this: unescapes string containing entity escapes string containing actual unicode characters corresponding escapes. supports html 4.0 entities.

php - How to only show 1 flash message - Laravel -

Image
hello im newbie in laravel need help. want create code 1 flash message show. in case when update user or store appear 2 flash message "user updated successfully" , "store updated successfully". want show 1 flash message. this code <div class="content"> @include('flash::message') @include('adminlte-templates::common.errors') <div class="box box-primary"> <div class="box-body"> <div class="row"> {!! form::model($users, ['route' => ['users.update', $store->user_id], 'method' => 'patch']) !!} @include('users.fields',['user'=>$users]) {!! form::close() !!} </div> </div> </div> <div class="content"> @include('flash::message') @include('adminlte-templates::common.errors')

mysql - How to Get all childrens Count in binary tree in php -

Image
i have h type table now want full binary tree , full left , right chides count select leg , count(user_id)as count table group leg this show count of left , right