Posts

Showing posts from February, 2015

python - Prevent input() from being anything but alphabet characters -

i attempting make program sake of self-knowledge. want ask user name is, , want user able use letters alphabet answer, or strings. not want them able answer numbers, symbols, etc. def cc(): name = (input("""hello, happens first name? > """)) if type(name) str: print("you have entered name correctly.") elif type(name) int: print("your name cannot integer. try again.") cc() cc() you can enforce requirement using str.isalpha . documentation: return true if characters in string alphabetic , there @ least 1 character, false otherwise . alphabetic characters characters defined in unicode character database “letter”, i.e., general category property being 1 of “lm”, “lt”, “lu”, “ll”, or “lo”. note different “alphabetic” property defined in unicode standard. here example program: while true: name = input('enter name using alphabetic characters: ') if name.isalpha():

Android Studio - ImagesViews go wild on diferent screens -

i i'm learning how use android studio first time , i'm having problems images. i used android studio design interface position imageviews on correct positions , used resize them. problem when run on emulator, though i'm using same "canvas" on android studio design interface screen on emulator, images appear in different positions. , if try different emulators different screen sizes can go more wild , change positions intarelly. i made research , of people android studio needs different images , create different drawable folders each screen type. i've done , fixed problem of images still change position bit. suspect problem resize images android design tool, i'm not sure. can theorize why happening? (if using design interface change images width , height creating problem) what best way (practices, methods, tools,...) put images without them changing positions in different screens? shall change images sizes on photoshops example instead of on

Ruby 2.3.1 is not compiling under Arch Linux -

Image
i've got project using following specification @ gemfile : ruby '2.3.1', :engine => 'jruby', :engine_version => 'jruby-9.1.7.0' and working fine under old debian 8.1 installation. decided test arch linux , i'm getting error when run $ rvm install 2.3.1 the error: segmentation fault (core file generated) i've never faced error , got no ideas how solve it. suggestions? edit => required, posted make.log file github gist. link it.

performance - Request Highlighting only for the final set of rows -

in multi-node solr installation (without solrcloud), during paging scenario (e.g., start=1000 , rows=200 ), primary node asks 1200 rows each shard. if highlighting on, primary node asking highlighting 1200 results each shard, doesn't scale well. there way break shard query in 2 steps e.g. ask 1200 rows , after sorting 1200 responses each shard , finding final rows return (1001 1200) , issue query shards asking highlighted response relevant docs? so, turns out solr behavior has changed between old version , 6.6. although, seems bug me after initial investigation. i found if have specified fl=* in query doing right thing (a 2 pass process used in solr 4.5). however, queries have fl=id+score , in case, shards asked highlighting results on first request (and there no second request). the fl=* query (in sample case) finishing in 100 msec while same query fl=id+score finishes in 1200 msec.

php - Prevent duplicate in inputting in MySQL db -

<?php session_start(); require('../connection.php'); //if session isn't valid, returns login screen protection if(empty($_session['admin_id'])){ header("location:access-denied.php"); } //retrive positions tbpositions table $result=mysql_query("select * tbpositions") or die("there no records display ... \n" . mysql_error()); if (mysql_num_rows($result)<1){ $result = null; } ?> <?php // inserting sql query if (isset($_post['submit'])) { $newposition = addslashes( $_post['position'] ); //prevents types of sql injection $sql = mysql_query( "insert tbpositions(position_name) values ('$newposition')" ) or die("could not insert position @ moment". mysql_error() ); // redirect positions header("location: positions.php"); } ?> <?php // deleting sql query // check if 'id' variable set in url if (isset($_get['id'])) { // id value $i

javascript - ESLint Error: prefer-arrow-callback on the reduce method? -

i'm getting "prefer-arrow-method" eslint error thrown reduce function below. know it's because function anonymous how rewrite reduce method resolve error? const namebrand = names.brand().reduce(function (sum, name) { sum[name] = name; return sum; }, {}); const namebrand = names.brand().reduce((sum, name) => { sum[name] = name; return sum; }, {});

nginx - uwsgi in docker in vagrant in vmware - socket not being created -

on mac running windows server 2016 in vmware. in there running ubuntu in vagrant/virtual box. in there trying run django app in docker container nginx/uwsgi. uwsgi failing start with: [uwsgi] getting ini configuration /opt/django/capgraph/uwsgi.ini *** starting uwsgi 2.0.15 (64bit) on [thu aug 17 20:01:23 2017] *** compiled version: 6.4.0 20170805 on 17 august 2017 06:10:50 os: linux-3.13.0-128-generic #177-ubuntu smp tue aug 8 11:40:23 utc 2017 nodename: 37db4344b5ae machine: x86_64 clock source: unix pcre jit disabled detected number of cpu cores: 1 current working directory: / detected binary path: /usr/local/bin/uwsgi uwsgi running root, can use --uid/--gid/--chroot options *** warning: running uwsgi root !!! (use --uid flag) *** chdir() /opt/django/capgraph/ memory page size 4096 bytes detected max file descriptor number: 524288 lock engine: pthread robust mutexes thunder lock: disabled (you can enable --thunder-lock) bind(): operation not permitted [core/socket.c line 230

windows - Laravel queues in Azure server -

i'm struggling issue, little frustrating me because seems simple in linux server. have windows azure web app , want run "php artisan queue:listen" on server continuously take care of dispatched jobs. read documentation, in linux use supervisor run command , revive it, in case dies. found online, azure has similar functionality called webjobs can serve them script ran , decide whether should run on schedule or continuously (kinda scheduler in laravel). have 2 questions. 1 - right solution? place script run command on webjob , have webjob run continuously? 2 - i'm not experienced in writing php scripts run command lines, can this: echo shell_exec('php artisan queue:work'); problem not give me output of command (i don't see "processed" result see when run command hand on command console , job processed). important me able read output of command, because want able check logs errors in case happens when job isn't able processed. d

Groovy String return type with instantiation -

this class reading properties file there 2 files config.groovy have method , call.groovy calling method config , expecting return. config.groovy class config { public methodparse { properties properties = new properties() file propertiesfile = new file('src/main/resources/application.properties') propertiesfile.withinputstream { properties.load(it) } string value = properties."$name" return value } } load.groovy def config = new config () config.methodparse "environments.local.logfile" println (config.methodparse()); how have load.groovy pass parameter , print received? ignoring syntax errors try like class config { public string methodparse (string name) { properties properties = new properties() file propertiesfile = new file('src/main/resources/application.properties') propertiesfile.withinputstrea

osx - Can I use Expo's XDE without having to log in via the internet? -

i don't have internet access live. prefer programming research @ library coding @ home without internet distract me. but i'm interested in react native , seems can't use xde if haven't logged in internet? or missing something? i'm using macos sierra on macbook air connected via usb new android phone. you can use usb connect pc , run command react-native run-android if can't run or can't find android. need eject before react-native eject actually follow offical website https://facebook.github.io/react-native/docs/getting-started.html#installing-dependencies

python 2.7 - Access class functions inside a classmethod -

def __init__(self,asset,face,rate,term): if isinstance(asset,asset): print 'it asset! program run!' else: print 'object input not class,bye!' exit(1) @classmethod def equity(cls,loan,asset,period): return loan.pmi(period)*0.6-loan.balance(period) i want access function(self._balance()) of loan class inside equity classmethod. how do that?

get a color name from hex in .Net core (without using System.Drawing.Color) C# -

i trying fetch color name hex application system.drawing.color not available in .netcore can suggest alternative solution api? i tried magickimage lib , rturns hex code string not vice versa i want : string colorname = getcolorname("#8090a6"); you need update .net core 2.0 (it came out general release week). includes system.drawing.color in it .

php - splitting up my results in my SQL call -

i have hit wall code. select works fine. when either ($_post['art'] == '*') or ($_post['art'] == '*') need parse results in table always. but possible put in 2 lines every different "art" returns. of "art" same needs in same table. <?php // include 'teams.php'; include 'species.php'; include 'con.php'; function resultat($conn) { if ($_post['art'] == '*') { $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` order `art`, `vaegt` desc"; } elseif ($_post['art'] == '') { $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` order `art`, `vaegt` desc"; } else { $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` `art`=:art order `art`, `vaegt` desc limit 10"

algorithm - Guidance for DIY Implementation of Parallel Merge Sort (parallel merge) on CUDA 8 -

for past few days i've been working on scratch parallel merge sort algorithm, have been stewing on lot , while easy run sequential sort in parallel. see no reason why can't merge in parallel ground up. following link: http://www.mcs.anl.gov/~itf/dbpp/text/node127.html i doing parallel merge. i've been working on how recursion , loops , i'd rather recursion think have working model loop. i've scratched out work , i'll describe how want set algorithm first i'll describe merge kernel __global__ void merge(int* data, int depth) { sequential merge (data, left = threadidx.x, right = left + 2 ^ depth - 1); } right left offset 2 ^ depth - 1 because that's relationship noticed in working algorithm out hand sort 3 1 7 4 9 0 2 6 8 5 \ / \ / \ / \ / \ / merge(left, left + 2 - 1) 1 3 4 7 0 9 2 6 5 8 \ / \ / / merge(left, left + 4 - 1) 1 3 4 7 0 2 6 9 5 8 \

ruby on rails - Accepts nested attributes safe params with jsonb and variable keys -

i attempting allow parameters go through controller data attribute of type jsonb , hash looks so: data: { "en" => { "activities_text" => "activities", "playlists_text" => "playlists", "additional_playlists_text" => "additional playlists" }, "es" => { "activities_text" => "actividades", "playlists_text" => "lista de actividades", "additional_playlists_text" => "listas de actividades adicionales" } } i got form work , i can save data 1 of language keys . issue happening because in safe params array have following: text_customization_attributes: [:id, data: [es: [:activities_text, :playlists_text, :additional_playlists_text]]] i need able allow through both en: es: , potentially other language keys may add in future. naively thought maybe adding both l

html - How do I make my list horizontal -

i need make list appear horizontal @ center of web page. this code: .list-group { clear: both; display: inline-block; content: ""; padding-right: 50px; padding-left: 50px; } <div> <ul class="list-group"> <li class="list-group-item">home</li> <li class="list-group-item">about us</li> <li class="list-group-item">gallery</li> <li class="list-group-item">contact us</li> <li class="list-group-item">students eportal</li> </ul> </div> i tried above code not working. its display: table; gets job done. #menu-outer { height: 84px; } .table { display: table; /* allow centering work */ margin: 0 auto; } ul#list-group { min-width: 696px; list-style: none; padding-top: 20px; } ul#list-group li { display: inline; } <div i

database - syntax error at or near "=" -

the error syntax error @ or near "=",namely if trans1.trans_type = '2' pkg_util_bd_logistics_convertopcode(trans1.trans_type,trans1.remark, trans1.std_id).the function pkg_util_bd_logistics_convertopcode there.the code migrated ora2pg.can help? create or replace function bz_data_processer_bindsftransdatatoso () returns void $body$ declare v_soid bigint; v_shopid bigint; v_socode varchar(50); v_outerordercode varchar(200); v_ordercategory t_so_distinect_trans_head.order_category%type := 0; v_headcount bigint := 0; v_detailcount bigint := 0; v_distincttransheadcount bigint := 0; v_distincttransdetailcount bigint := 0; v_acceptimecount bigint := 0; v_distincttransheadid bigint; v_sltheadid bigint; v_createtimebefore timestamp := clock_timestamp() - interval

apache pig - Pig - Convert rows into multiple columns -

Image
can convert input rows multiple columns terminated three.* here 1 naive solution. grouping every 3 rows using rank , group , , filter each of 3 conditions. my pig script a = load '/path_to_data/data' (c1 : chararray); b = rank a; c = foreach b generate (rank_a+2)/3 id, c1; d = foreach (group c id) { 1 = filter c c1 matches 'one:.*'; 2 = filter c c1 matches 'two:.*'; 3 = filter c c1 matches 'three:.*'; generate group id , flatten(one.c1) c1_one , flatten(two.c1) c1_two , flatten(three.c1) c1_three ; }; dump d; my result (1,one:"a",two:"2",three:"last") (2,one:"b",two:"1",three:"first")

bash - Unable to create git alias? -

i want create git alias can run multiple commands @ once. i typed following terminal: git config alias.cleanpull "!git reset --hard head; git clean -f; git pull" i assumed correct syntax following output after entering command (i.e. defining command, not running it): git config alias.cleanpull "git config cleanpull.q "git push --all origin reset --hard head; git clean -f; git pull" reset --hard head; git clean -f; git pull" usage: git config [<options>] config file location --global use global config file --system use system config file --local use repository config file -f, --file <file> use given config file --blob <blob-id> read config given blob object action --get value: name [value-regex] --get-all values: key [value-regex] --get-regexp values regexp: name-regex [value-regex] --get-urlmatch

greatest n per group - MySql Left Outer Join limit -

this question has answer here: get top n records each group of grouped results 8 answers using limit within group n results per group? 13 answers table1: id value 1 2 b 3 c table2: xid value 1 1 b 1 c 1 d 1 e 2 f 2 g 2 h 2 2 j 3 k 3 l 3 m 3 n 3 o select t1.id id, t1.value v1, t2.value v2 (select id table1) t1 left outer join (select xid, value table2) t2 on t1.id = t2.xid result is: id v1 v2 1 1 b 1 c 1 d 1 e 2 b f 2 b g 2 b h 2 b 2 b j 3 c k 3 c l 3 c m 3 c n 3 c o i want limit table2 , 2 rows every matched table1 , below: 1 1 b 2 b f 2 b g 3 c k 3 c l so, how write sql q

php - Fire jobs using phpjobscheduler -

i using phpjobscheduler run php script once daily. i have added phpjobscheduler folder server. says add <?php include( dirname(__file__) . "/phpjobscheduler/firepjs.php"); ?> in order fire job. have added index.php file of application folder, it's not working. the script run is: <?php include("dbconfig/db_connection.php"); include('libs/phpmailer-master/phpmailerautoload.php'); $mail = new phpmailer; $mail->smtpdebug = 3; // enable verbose debug output $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.gmail.com'; // specify main , backup smtp servers //$mail->host = 'smtp.mailgun.org'; $mail->smtpauth = true; // enable smtp authentication $mail->username = 'ex@gmail.com'; // smtp username

php - Traversing Hierarchy Tree Adjacency List Model in Yii2 -

i stuck in 1 logic can't understand how done , traverse list. actually creating category list further used in creating products. wanted category list should in form of parent , sub nodes adjacency list model. database: id categoryname parent [id foreign key parent] 1 1 2 b 2 3 c 2 4 e 2 5 f 3 6 g 4 fetching details activequerry in yii2 $rows = category::find() ->asarray() ->all(); $rows array contains data form array ( [0] => array ( [id] => 1 [categoryname] => [parent] => 1 ) [1] => array ( [id] => 2 [categoryname] => b [parent] =>2 ) [2] => array ( [id] => 3 [categoryname] => c [parent] => 2 ) ) , on... i

while submitting large files using jquery ajax all input fields get empty on server site php -

i trying send large files server using jquery ajax , formdata. data received if send 7 files 1 mb each, if try send 10 files @ time input field received on server site empty, though input send server. following code file upload. //php code public function multipleupload() { $title = $_post["title"]; $property_id = $_post["propertyid"]; $userid = $_post["userid"]; $albumid = $_post["albumid"]; $profileid = $_post["profile_id"]; if($albumid == "") { $album = new album; $album->title = $title; $album->property_id = $property_id; $album->user_id = $userid; $album->profile_id = $profileid; $album->save(); $albumid = $album->id; $userid = $album->user_id; $folder = str_replace(" ","-",$title. '-' . date("y-m-d_hi

c++ - Add raw string macro using target_compile_definitions -

i want add cmakelists.txt raw string macro equivalent of: #if defined(q_os_win) #define commport_name r"(\\.\com1)" #elif defined(q_os_unix) #define commport_name "/dev/ttys0" #else #error "platform not supported" #endif i tried following: if(win32) target_compile_definitions(${project_name} private -dcommport_name="r"(\\.\com1)"") elseif(unix) target_compile_definitions(${project_name} private -dcommport_name="/dev/ttys0") else() message(fatal_error "platform not supported") endif() but error: cmake warning (dev) @ path/to/project/cmakelists.txt:68: syntax warning in cmake code @ column 85 argument not separated preceding token whitespace. warning project developers. use -wno-dev suppress it. is possible use kind of quotes, '' in bash prevent occurrence of above error?

android - Exporting LD_LIBRARY_PATH via Jenkins EnvInject plugin not working -

we use centos 6.9 our build machine types of projects (android, windows, ios). machine has glibc version 2.12 installed. due reasons can't use glibc version 2.14 projects. need use in 1 android project have upgraded our build tools version 25.0.3 , fail without glibc 2.14. by looking @ of solutions, decided export ld_library_path through envinject plugin in jenkins. export variable, gradle build not work @ all. gets stuck @ beginning. anyone else faced issue? how use glibc version 2.14 1 project , continue using glibc version 2.12 in other projects?

c++ - Two threads modifying same object at same time -

in simple server-client mechanism i'm writing, server stores set of key-value mappings in stl map. talking multiple clients, separate thread created each, , i've passed map threads using std::ref (i need common keystore). while works, possible that: 1) if 2 clients communicate @ same time, 2 threads try modify map @ same time? 2) in case, happen? 3) possibly avoid bad? 1) if 2 clients communicate @ same time, 2 threads try modify map @ same time? yes, try modify @ same time 2) in case, happen? you have undefined behavior. can happen. 3) possibly avoid bad? use std::lock_guard avoid problem. can refer link more details: http://en.cppreference.com/w/cpp/thread/lock_guard

Same set of Tasks are repeated in multiple stages in a Spark Job -

a group of tasks consists of filters & maps appears in dag visualization of multiple stages. mean same transformations recomputed in stages? if how resolve this? for every action performed on dataframe, transformations recomputed. due transformations not being computed until action performed. if have single action there nothing can do, however, in case of multiple actions after each other, cache() can used after last transformation. using method spark save dataframe ram after first computation, making subsequent actions faster.

ios - How can I change the alpha of selected and unselected carbonSegmentedControl items -

i'm trying change alpha of selected , unselected carbonsegmentedcontrol items didn't able achieve instead of whole carbonsegmentedcontrol alpha's changes. sample code follow: uibutton *firstbutton = [[uibutton alloc]initwithframe:cgrectmake(0, 0, screen_width/items.count-10, 43)]; firstbutton.backgroundcolor = [uicolor colorwithred:0.0/255.0 green:75.0/255.0 blue:155.0/255.0 alpha:1.0]; firstbutton.layer.borderwidth = 3.0; firstbutton.layer.bordercolor = [uicolor whitecolor].cgcolor; [firstbutton settitle:buttontitles[0] forstate:uicontrolstatenormal]; firstbutton.titlelabel.font = [uifont proximanova_regular:16]; uiimage * firstbuttonimage = [self imageofbutton:firstbutton]; // uibutton *secondbutton = [[uibutton alloc]initwithframe:cgrectmake(0, 0, screen_width/items.count-10, 43)]; secondbutton.backgroundcolor = [uicolor colorwithred:18.0/255.0 green:209.0/255.0 blue:193.0/255.0 alpha:1.0]; secondbutton.layer.borderwidth = 3.0; secondbutton.layer.bordercolor =

database - having count in multiple condition but in same table mysql -

can make having count on query syntax in multiple condition? query select * absen keterangan = 'sakit' having count('keterangan') >= 1 , keterangan = 'alpa' having count('keterangan') > 5 but in single condition work perferctly helped yup can have multiple condition doesn't need write clause every time use , apply both conditions

eclipse - ODE BPEL process with Webservice reference not getting deployed -

i'm trying invoke remote web service using invoke action of eclipse bpel designer. followed steps mentioned in following link: http://www-inf.int-evry.fr/cours/webservices/tp_bpel/ws_invocation.html when try deploy new process referring deployed process, shows synchronized in eclipse server view, unavailable in ode console. can see folder process in web-inf folder. dont know i'm missing.

issue in extracting apache-tomcat-8.5.5.tar.gz file when installing tomcat8 in ubuntu 16.04 server -

i have tried install tomcat8 on ubuntu(16.04) virtual server entering following command ( in this ). sudo apt-get update sudo apt-get install default-jdk cd /tmp curl -o http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5.tar.gz the last command gives error below. gzip: stdin: not in gzip format tar: child returned status 1 tar:error not recoverable: exiting i have tried rename tar.gz file .tar file , extract it.but did not work. how can overcome error? try : sudo apt-get update sudo apt-get install default-jdk sudo apt-get install unzip cd /opt curl -o http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.15/bin/apache-tomcat-8.5.15.zip sudo unzip apache-tomcat-8.5.15.zip sudo mv apache-tomcat-8.5.15 tomcat

node.js - I am getting `getAddrInfo ENOTFOUND localhost` on running simple node server even though localhost is present in /etc/hosts (MacOS El Capitan) -

i have weird thing happening while setting , running normal node js server. when run node server.js , following error: server running @ http://localhost:1337/ events.js:160 throw er; // unhandled 'error' event ^ error: getaddrinfo enotfound localhost @ errnoexception (dns.js:28:10) @ getaddrinforeqwrap.onlookup [as oncomplete] (dns.js:76:26) when open http://localhost:1337/ in browser, says page not exist . when run sudo node server.js , runs fine without error , can access site @ https://localhost:1337 here /etc/hosts file: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost my server.js: // require need var http = require("http"); // build server var app = http.createserver(function(request, response { response.writehead(200, { "content-type": "text/plain" }); response.end("hello world!\n"); }); // start server, baby app.listen(1337, "localhost

Django Cookiecutter: How to import AUTH_USER_MODEL in config/settings/base.py? -

as know, django-cookiecutter has different setup settings files. regular from django.conf import settings doesn't work here. i want reference custom user model defined in base.py file in settings directory. ideas? below project layout: repository/ config/ settings/ __init__.py base.py # auth_user_model variable defined local.py production.py test.py app_dir/ users/ __init__.py models.py # custom user model stored i tried import custom user model directly users/models.py below: from users.models import user but got following error: runtimeerror: model class users.models.user doesn't declare explicit app_label , isn't in application in installed_apps. tried following, , seems work far: from config.settings.base import auth_user_model

r - How to create a "gap" in a barplot? -

Image
how achieve "gap" in barplot, this: i tried create empty column in contingency table, couldn't. sample data: groups = c("a", "b") choices = c("orange", "apple", "beer") dat <- data.frame( group = rep(groups, c(93, 94)), choice = factor(c( rep(choices, c(51, 30, 12)), rep(choices, c(47, 29, 18)) ), levels = choices ) ) barplot(table(dat), beside = true) you can achieve with: barplot(table(dat), beside = true, space = c(0, 0, 1.5, 0, 3, 0)) the logic space values fiddly: you don't need space before first bar- first value 0 you don't need space between first , second bars (the 2 "orange" bars) you need standard amount of space before first bar of "apple" you need space before first "beer" bar result:

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -

i trying sort both outermost dictionary , "middle" dictionary value of "cal" (highest first) in innermost dictionary. accomplish using ordereddict. given example below, trying accomplish: for foods, order food subtypes highest calorie content (i.e - pizza, pesto should appear first because has higher calories when compared cheese. order foods highest calorie content (i.e - pizza should appear first has subtype more calories other food) i have following data: foods = { "apple": { "red": { "cal": "1", "taste": "4" }, "green": { "cal": "2", "taste": "6" } }, "pizza": { "pesto": { "cal": "200", "taste": "9" }, "cheese": {

c++ - QT : Removing gap from top of QLabel -

Image
i showing image on qlabel. right having gap between top of window , top of qlabel(image) : i don't want gap, ui current ui : where label_image object name qlabel containing image. my constructor code : mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { this->setfixedsize(700,700); ui->setupui(this); ui->centralwidget->layout()->setmargin(0); ui->centralwidget->layout()->setspacing(0); } void mainwindow :: paintevent(qpaintevent * e) { qmainwindow::paintevent(e); if(1) { qimage image("/users/arqam/desktop/imagetocartoon/input/elonmusk.jpeg"); //some redundant code ui->label_image->setpixmap(qpixmap::fromimage(image)); } } using changes in centralwidget shown able image start left part, not able image start top. edit : need image start top left , left part done, top part left. my xml part of ui : https://

javascript - Slider for touchscreens -

i have here such slider: https://jsfiddle.net/args91l4/ how work on touch screens, more precisely ways without third-party plugins on vanilla js or pure jquery? thought track mouse events like: .mousedown(); //start moving .mousemove (); //track coordinates .mouseup(); //end moving how implement it? or there ways easier? you're not looking mouse events, touch events , e.g. touchstart it's not easy, though, need decide after every touch user wanted achieve. if scrolls down left, did want slide left or did want scroll down , wasn't precise? or did want click , mistakenly moved little bit right? requires quite lot of calculations , assumptions , may quite hard. therefore i'd recommend use lib hammerjs this, simplifies configuration , comes pretty solid defaults. in hammerjs use swipe recognizer detecting user wanting slide left or right this var hammerinstance = new hammer(element, options); hammerinstance.on('swipeleft', function(ev)

PickerView within a table cell in swift3 -

i have table cells containing user information. dropdown has appear when user clicks on city , state. tried pickerview , able display list i'm not able select options list. instead next cell selected. please help? (i'm using swift3) thanks

c# - Tri State Chech box for ToolStripDropDownButton -

Image
i have statusbar strip toolstripmenuitems. need gruop toolstrip menu items , implement tristatecheckbox functionality, is possible create checkbox toolstripmenitems? if not possible point 1, how add treeview statusstrip. to have three-state menu item, can set checkstate of each toolstripmenuitem indeterminate , checked or unchecked . also if want use tree-view control (which doesn't have builtin support three-state check boxes) or this control , should know, can host control in drop-down using toolstripcontrolhost . example, here toolstriptreeview control: using system.componentmodel; using system.windows.forms; using system.windows.forms.design; [toolstripitemdesigneravailability(toolstripitemdesigneravailability.contextmenustrip)] public class toolstriptreeview : toolstripcontrolhost { [designerserializationvisibility( designerserializationvisibility.content)] public treeview treeviewcontrol { { return (treeview)control; } } public toolstri

Gradle sonarqube plugin - how to set memory for findbugs? -

i have project module 30k classes. after migrating sonar analysis ant script gradle plugin have oom error output this: 13:10:36 out of memory 13:10:36 total memory: 954m 13:10:36 free memory: 119m 13:10:52 caused by: java.util.concurrent.executionexception: java.lang.outofmemoryerror: gc overhead limit exceeded 13:10:52 @ org.sonar.plugins.findbugs.findbugsexecutor.execute(findbugsexecutor.java:163) 13:10:52 ... 109 more 13:10:52 caused by: java.lang.outofmemoryerror: gc overhead limit exceeded 13:10:52 @ we've run ant script following parameters "-xmx3800m -xx:reservedcodecachesize=128m" how can set same parameters sonarqube gradle plugin? i've tried setting following env variable before calling gradle gradle_opts=-xmx3800m -xx:reservedcodecachesize=128m it's applied correctly, findbugs still failing , prints "total memory: 954m" also i've tried adding following properties reduce memory consumpt

Efficiently Follow Pinterest Users through follow API, within given time period in PHP Codeigniter -

Image
pinterest api follow: limit 1000 hits per hour per user access token https://api.pinterest.com/v1/me/following/users/?access_token=xxxxxxxx&user=xxxxxxx +-------------+---------------------+------------------+ | userid | usertofollowperhour | maxuseravailable | +-------------+---------------------+------------------+ | 1 | 100 | 1000| | 2 | 200 | 9000| | 3 | 210 | 100| | 4 | 300 | 1100| | 5 | 300 | 900| | . | | | | . | | | | . | | | | n | n| n| +-------------+---------------------+------------------+ now have follow users particular userid that: can follow users within limit , pinteres

Creating an image format with an unknown type is an error while capturing image from gallery Swift -

im trying image gallery in swift. func showpicker(type : uiimagepickercontrollersourcetype) { let imagepicker = uiimagepickercontroller() imagepicker.delegate = self imagepicker.sourcetype = type imagepicker.allowsediting = false self.present(imagepicker, animated: true, completion: nil) } then: self.showpicker(type: .savedphotosalbum) however, when enter gallery on device , pick photo nothing happen, instead in log says : [generic] creating image format unknown type error how dismiss gallery , save image? uiimagepickerview set delegate uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate let imagepicker = uiimagepickercontroller() //in did load imagepicker.delegate = self // mark: - uiimagepickercontrollerdelegate methods func imagepickercontroller(_ picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : any]) { if let image = info[uiimagepickercontrollero

vb6 - Write all record met criteria line by line in Visual Basic 6 -

please me how list records meets criteria in text box (line line) below code retrieve first record . note : tried enable multi lines in text box error appeared"can't assign read property" any please amending beloe code dim ifile integer dim sline string, snewtext string ifile = freefile open app.path & "\text1.txt" input #ifile while not eof(ifile) line input #ifile, sline if sline "*total interchange*" text5.text = sline end if loop close to find out if line containing string "total interchange" can use instr (don't worries, like works fine). if instr(1, sline, "total interchange") > 0 text5.text = text5.text & sline & vbcrlf end if here reference , can test online:: vbscript instr function (it vbscript, not vb6 doesn't matter, identical) regarding multiline property, should set in vb6 ide, not code. to point: please note shouldn't replace whole content of t

javafx - Slider above the x axis in a chart? -

i trying implement slider has xychart below , supposed slider along values of x-axis. new values y-axis dynamilcally added, chart may grow vertically. that's why decided, has inside scrollpane . question is: how can reliably position slider above , same length of x-axis? have tried bind properties concerning width , position of slider , numberaxis in fxml , java. see minimal (not) working (as desired) example below: mainview.fxml <?xml version="1.0" encoding="utf-8"?> <?import java.lang.*?> <?import javafx.scene.chart.*?> <?import javafx.scene.layout.vbox?> <?import javafx.scene.layout.hbox?> <?import javafx.scene.layout.*?> <?import javafx.scene.control.*?> <?import javafx.scene.control.slider?> <vbox fx:id="timebox" prefheight="600" prefwidth="800" maxheight="600" maxwidth="800" xmlns="http://javafx.com/javafx/8" xmlns:fx="h

ios - How to set title for row in PickerView in Swift 3? -

i need give title rows according array don't know how this. i'm new ios. class viewcontroller: uiviewcontroller , uipickerviewdelegate, uipickerviewdatasource{ @iboutlet weak var pickerview: uipickerview! @iboutlet weak var label: uilabel! var names: array<string>? var department: array<string>? override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. names = ["vineeta", "shubham" ,"anand", "vivek", "akshay", "harshit", "vikas", "prasoon", "sunil"] department = ["ios","angular", ".net", "ios","ios", ".net", "android","android", "angular"] } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. }

Android:can you detect which way the finger is facing when a touch happens? -

i'm developing application phone used playmat of sorts. one player standing on top of phone other on bottom. is there way detect if touch happened came finger of player on top or bottom? maybe library can use proximity sensor? i know impossible , haven't found while searching, thought i'd ask in case knows of library haven't found. thanks in advance can provide

javascript - return Object.keys in a map got undefined -

what's wrong loop below? want calculate total_count , return [total, total] after manipulation within map, got undefined. my raw data const raw = [{ "device_info": { "name": "cam1", }, "age_range": { "0-10": { "age_range": "0-10", "total_count": 15, "male_count": 6, "female_count": 9 }, "11-20": { "age_range": "11-20", "total_count": 11, "male_count": 7, "female_count": 4 }, "21-30": { "age_range": "21-30", "total_count": 922, "male_count": 452, "female_count": 470 } } }, { "device_info": { "name": "cam2", }, "age_range": { "0-10": { "age_range": "0-10", &q

mysql - Unicode binded Special Auxiliaries character output error in report -

i inserted string mysql utf-8 database අධ්‍යාපන . output in report displays : අධ් ්‍ය පන . this happens other binding characters too. solution can use fix this? (i don't have "answer", further info. maybe or else can take here. know nothing sinhala.) hex first should be e0b685 e0b6b0 e0b78a e2808d e0b6ba e0b78f e0b6b4 e0b6b1 is select hex(...) shows? other is e0b685 e0b6b0 e0b78a 20 e0b78a e2808d e0b6ba 20 e0b6b4 e0b6b1 notice spaces ( 20 ) in it. wonder added spaces. can explain these 2 characters? 1 duplicated, other removed?? utf=8 unicode meaning e0b78a 3530=x0dca [්] nsm sinhala sign al-lakuna e0b78f 3535=x0dcf [ා] l sinhala vowel sign aela-pilla

architecture - component diagram advice framework -

Image
i've been tasked documenting our high-level software architecture uses in-house developed framework robotics (similar ros.) i'll try , keep simple. in component diagram, how represent component instantiated class loader (based on type specified in xml file) in base framework application provided , ran in separate thread? component implements , instantiates services provided framework (i.e network communications.) you can use <<instantiate>> relation in example taken uml 2.5 specs on p. 39: in figure 7.19, carfactory class has dependency on car class. in case, dependency usage standard stereotype «instantiate» applied, indicating instance of carfactory class creates instances of car class. note omg uses "artistic" arrow end (they not consistent in documentation should be). simple open triangle used more commonly. on p. 39: a dependency shown dashed arrow between 2 model elements. model element @ tail of arrow (the client) dep

Export pictures from excel file into jpg using VBA Ask -

for case, code working slides not particular shape. this 1 working - with newpowerpoint.activepresentation.slides(1) .export "c:\users\esuptiw\documents\new role data\pgm\macros trial\dashboard\dashboard files\overall_performance.jpg", "jpg" however - giving error argument not optional with newpowerpoint.activepresentation.slides(1).shapes(3) .export "userprofile\documents\new role data\pgm\macros trial\dashboard\dashboard files\overall_performance.jpg", "jpg" the problem first code saving entire slide white space picture, not intend. want picture exported.

mysql - One to one relationship with foreign key to mutiple tables -

please let me start saying, know has been asked many times before , i've studied other questions (and answers) after 2 days of reading questions , amending database can't work want. at moment have various tables, example customer , supplier , product , banner , etc. i have table called custom_field allows custom fields created , used against various other tables. at moment of tables this: general tables ============== customer +-------------+---------------+ | customer_id | customer_name | +-------------+---------------+ | 1 | peter | | 2 | sally | +-------------+---------------+ banner +-----------+-------------+--------------+ | banner_id | banner_name | banner_width | +-----------+-------------+--------------+ | 1 | easter | 100px | | 2 | xmas | 250px | +-----------+-------------+--------------+ tables managing custom fields ================================= custom_field +---------

android - CameraSource(vision api) not detecting when phone is in landscape mode -

i have created app track eyes using vision api , working fine when phone portrait mode when tilde phone landscape position app pauses camera , went onmissing() method. please give me suggestion app can work in both layouts or can sense eyes phone rotations (0,90,180,270) code: private void createcameraresources() { context context = getapplicationcontext(); // create , setup face detector mfacedetector = new facedetector.builder(context) .setprominentfaceonly(true) .settrackingenabled(true) .setclassificationtype(facedetector.all_classifications) .setmode(facedetector.fast_mode) .build(); mfacedetector.setprocessor(new largestfacefocusingprocessor(mfacedetector, new facetracker())); if (!mfacedetector.isoperational()) { log.w(tag, "createcameraresources: detector not operational"); } else { log.d(tag, "createcameraresources: detector operational");