Posts

Showing posts from March, 2015

matplotlib - I am trying to plot a 5*2 plot in python -

i trying plot set of graphs in python using code below. fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(521) fig = sm.graphics.tsa.plot_acf(s0, lags=40, ax=ax1) ax2 = fig.add_subplot(522) fig = sm.graphics.tsa.plot_pacf(s0, lags=40, ax=ax2) fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(523) fig = sm.graphics.tsa.plot_acf(s1, lags=40, ax=ax1) ax2 = fig.add_subplot(524) fig = sm.graphics.tsa.plot_pacf(s1, lags=40, ax=ax2) fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(525) fig = sm.graphics.tsa.plot_acf(s2, lags=40, ax=ax1) ax2 = fig.add_subplot(526) fig = sm.graphics.tsa.plot_pacf(s2, lags=40, ax=ax2) fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(527) fig = sm.graphics.tsa.plot_acf(s3, lags=40, ax=ax1) ax2 = fig.add_subplot(528) fig = sm.graphics.tsa.plot_pacf(s3, lags=40, ax=ax2) fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(529) fig = sm.graphics.tsa.plot_acf(s4, lags=40, ax=ax1) ax2 = fig.add_subplot(5210) fig = sm.graphics.tsa.plot

Spring Control Bus to stop receiving emails -

i using spring integration filter incoming emails. i'd able stop , restart filtering on demand. i have tried using control bus so, when stopping mail inbound channel, mail receiver keeps listening, , generating issues when emails received while inbound channel stopped. i have tried stop service activator well, doesn't help. i have configuration: <int:channel id="receivechannel" datatype="javax.mail.internet.mimemessage"/> <int-mail:imap-idle-channel-adapter id="incomingemailsadapter" channel="receivechannel" <int:service-activator id="serviceactivator" input-channel="receivechannel" ref="mailservice" method="handlemail"/> messagechannel controlchannel = ac.getbean("controlchannel", messagechannel.class); controlchannel.send(new genericmessage<string>("@incomingemailsadapter.stop()")); controlchannel.send(new genericmessage<string>(&

symfony - Editing form on Symfony2 without AJAX or passing ID -

i want edit entry in database, don't know how without passing id or ajax. isn't there way choose entry edit in dropdown/select box , then, when user selects it, textbox appear beneath dropdown/select box him enter new name of entry ? any appreciated ! thanks.

powershell - Export AD users with list of specific groups -

i've been trying extract of ad users , select mail , name , memberof . need list specific groups memberof output end list each user contains name, email address , specific groups match name , not of groups member of. get-aduser username -properties memberof | select-object memberof i can't seem find way of doing end either noteproperty above or empty pipeline. there way achieve trying do? the memberof attribute contains list of distinguishedname (dn) values, each corresponding group. retrieve groups interested in, before run get-aduser , way can compare group dn entry in memberof : $groupdns = get-adgroup -filter {name -like "*finance*" -or name -like "*creditcontrol*"} | select-object -expandproperty distinguishedname now, can use dn's filter group memberships calculated property, so: $userinfo = foreach($username in @("bob","alice","joe")){ $user = get-aduser -identity $username -propertie

sql - Comparing records from different tables with slightly different data -

i have 2 tables. each table has product information , price. able results show product name , both prices. however, product name in each table written differently. e.g. table 1 name price pack size aciclovir 200 mg tablets 3.50 25 aciclovir 400 mg tablets 4.20 56 aciclovir 800 mg tablets 5.40 35 aciclovir cream 2.40 gm table 2 aciclovir 200mg tabs 1 25 aciclovir 200mg tabs 1 25 aciclovir 400mg tabs 2 56 aciclovir 5% cream 2gm 2.30 na i've tried like , i'm not getting results need. in case (and in sql server), can suggest use this: replace(a.name, ' ', '') replace(replace(b.name, ' ' ,''), 'tabs', 'tab%s') or replace(b.name, ' ' ,'') replace(replace(a.name, ' ', ''), 'cream', &

php - mysql update query is not working -

i want update email field php sql doesn't seems working. $email2 = "'testing@example.com'"; $id = "'1'"; $query = "update `users` set `email` = $email2 `id` = $id"; echo $query; if ($stmt = mysqli_prepare($connection, $query)) { /* execute statement */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { } /* close statement */ mysqli_stmt_close($stmt); } mysqli_close($connection); i'm new programming. hope guys can me find mistake. use mamp on mac. php version: 5.6.7. since providing in query

r - function to format dates not doing anything -

i've written function should take dataset , format chosen column date format : auto_date<-function(data,date){ try(if (is.date(data$date)==true )stop("date col recognised date") ) ifelse( is.na (as.date (paste (data$date),format="%d/%m/%y")),data$date, data$date<-as.date(paste (data$date),format="%d/%m/%y") ) ifelse( is.na( as.date (paste (data$date),format="%d-%m-%y")),data$date, data$date<-as.date(paste (data$date),format="%d-%m-%y") ) ifelse( is.na(as.date (paste (data$date),format="%y-%m-%d")),data$date, data$date<-as.date(paste (data$date),format="%y-%m-%d") ) return(data) } so function checks if format specified in first as.date returns na, , acts accordingly. if call function this: test<-auto_date(data,"date") it runs without returning error, not change chosen date column date class. am using ifelse incorrectly? a dput of data: structure(list(

Android shared elements transition - wait for animation to finish -

i have list of elements , when click one, replace fragment , use addsharedelement fragmenttransaction animate item in list become header in detail view. now want populate details in detail view, after header animation has finished. because now, header animation appears on content , not good. how can achieve that? i hope i'm not late. can retrieve shared elements transition getwindow() hook listener it. getwindow().getsharedelemententertransition().addlistener(new transition.transitionlistener() { @override public void ontransitionstart(transition transition) { // put code here } ... });

regex - Apache redirect if string contains anything other than letters and numbers -

so have rewrite condition, takes %1 previous line, , should redirect if string contains other letters , numbers. but, reason, works if string begins , ends letters or numbers (allowing middle anything) heres condition: rewritecond %1 !^[a-z0-9]+ [nc] rewriterule ^ http://www.example.com/nomatch so, in case, wont redirect if %1 hdsuf38//*&hdsfghj73 anyone know i'm missing? two changes add small letters character sequence. add anchor $ matching continued till end of string regex can be ^[a-za-z0-9]+$ regex demo rule as rewritecond %1 !^[a-za-z0-9]+$ [nc] rewriterule ^ http://www.example.com/nomatch

drawable - cart with custom icon with number text android -

Image
i have cart icon looks customized, want show number in white space of icon alignment attribute should use ? i tried padding double digit number looks ugly <textview android:id="@+id/btn_cart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:background="@drawable/shopp_cart" android:textcolor="@android:color/black" android:gravity="right|bottom" android:paddingright="5dp" android:paddingtop="20dp" android:layout_centervertical="true" android:layout_alignparentright="true" android:layout_marginright="5dp"/> this custom icon use this. you. use 1 image view , 1 text view show icon , text here code <relativelayout android:layout_width="match_parent"

shell - How can store sqlplus query in a file in formatted manner and display it to console up vote -

i trying write script connect database , store query output in file in formatted manner my expected file below: last monthly name salary commission ------------------------- ---------- ---------- russell 14000 .4 partners 13500 .3 errazuriz 12000 .3 cambrault 11000 .3 zlotkey 10500 .2 so far have tried this. sqlplus user/password@(tns entry) << eof set head off; set feed off; set trimspool on; set linesize 32767; set pagesize 32767; set echo off; set termout off; set verify off; set newpage none; set verify off; spool file_name.csv select * customer; spool off exit; eof i trying display csv file console. but, not in formatted style. how can achieve ? you need add in , seperator e.g. sqlplus user/password@(tns entry) << eof set head off; set feed off

excel - Range not working across sheets -

i have below code in vba. issue below code range referring data sheet , in other sheet fails. monthname = range("d5", range("d5").end(xltoright)).cells.count - 1 can please provide me solution wherein no matter in workbook range should pick data sheet? use monthname = sheets("data").range("d5", sheets("data").range("d5").end(xltoright)).cells.count - 1 btw small search on forum or google have got answer.

javascript - Download image from data base to canvas -

i have problem. first add image computer canvas document.getelementbyid('imgloader').onchange = function handleimage(e) { var reader = new filereader(); reader.onload = function (event) { console.log('fdsf'); var imgobj = new image(); imgobj.src = event.target.result; imgobj.onload = function () { // start fabricjs stuff var newsize = scalesize(300, 300, imgobj.width, imgobj.height); imgobj.width = newsize[0]; imgobj.height = newsize[1]; var image = new fabric.image(imgobj); image.set({ left: 0, top: 0, angle: 20, padding: 10, cornersize: 10 }); //image.scale(getrandomnum(0.1, 0.25)).setcoords(); canvas.add(image); // end fabricjs stuff } } reader.readasdataurl(e.target.files[0]); } next save data base string json.stringify(canvas.tojson()) in data base see it: {"objects":[{"type"

python - distinct contiguous blocks in pandas dataframe -

i have pandas dataframe looking this: x1=[np.nan, 'a','a','a', np.nan,np.nan,'b','b','c',np.nan,'b','b', np.nan] ty1 = pd.dataframe({'name':x1}) do know how can list of tuples containing start , end indices of distinct contiguous blocks? example dataframe above, [(1,3), (6,7), (8,8), (10,11)]. you can use shift , cumsum create 'id's each contiguous block: in [5]: blocks = (ty1 != ty1.shift()).cumsum() in [6]: blocks out[6]: name 0 1 1 2 2 2 3 2 4 3 5 4 6 5 7 5 8 6 9 7 10 8 11 8 12 9 you interested in blocks not nan, filter that: in [7]: blocks = blocks[ty1['name'].notnull()] in [8]: blocks out[8]: name 1 2 2 2 3 2 6 5 7 5 8 6 10 8 11 8 and then, can first , last index each 'id': in [10]: blocks.groupby('name').apply(lambda x: (x.index[0], x.i

windows - How to upgrade GLib version in a GTK+ bundle? -

i'm trying build program requires gtk+ on windows. however, make process didn't terminate because apparently program uses glib codes available in versions 2.38 , above (and 1 came bundle version of gtk+ have installed v2.0). i have tried integrate v2.38 codes in current program since there technically 1 function needed , didn't want waste time upgrading glib, failed. have tried replace whole glib directory newer version (maybe not idea), made more harm good. maybe upgrading glib less complicated after all. have no idea on how that. what can do?

PHP string presented as array to array -

$var = "['test', 'test2', 'test3']"; how create workable array in php? i've tried explode($var, ","); didn't seem work, unless went wrong attempt. explode($var, ","); wrong. explode needs first argument delimiter , second string. replace [] , explode - $var = "['test', 'test2', 'test3']"; $var = str_replace(array('[', ']'), '', $var); $arr = explode(',', $var);

c# - async ForEach for a big collection -

this collection contains 500 or 1000 elements. in cases there several collections. in ui thread works slowly. i'm making silverlight app async way make app fast. took easy approach(withuot using async operation or task.run() method). example of first approach: foreach (specialsongs.songjson futuresongs in pop) { specialsongs.songjson sooong = new specialsongs.songjson(); sooong.artist = futuresongs.artist; sooong.duration = futuresongs.duration; sooong.uri = futuresongs.uri; sooong.title = futuresongs.title; sooong.ownerid = futuresongs.ownerid; sooong.id = futuresongs.id; specialsongs.songjson songstocoll = new specialsongs.songjson(); songstocoll.artist = futuresongs.artist; songstocoll.duration = futuresongs.duration; songstocoll.genreid = futuresongs.genreid; songstocoll.id = futuresongs.id; songstocoll.lyricsid = futuresongs.lyricsid; songstocoll.ownerid = futuresongs.ownerid; songstocoll.title = futuresongs.tit

objective c - IOS keyboard on hide button -

Image
i want monitor keyboard hide button on ios , fire event on that. i'm talking about: i want monitor actual button pressed user. don't want event when keyboard hides. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhide:) name:uikeyboardwillhidenotification object:nil]; -(void)keyboardwillhide:(nsnotification *)notif { //keyboard hide } uikeyboarddidhidenotification can used. if don't have other triggers hide keyboard (such tap outside or hide on return) can ensure event triggered ' keyboard hide ' button

64bit integer in JavaScript, from Mysql request -

i have number 76561197993482001 (64bit int) stored bigint(20) in database. but when try fetch using : //node.js query('select * table',function(err,rows){ console.log(rows[0]["id"]);// 76561197993482000 }); i wrong number. guess because js can't handle 64bit variables. i know there libraries bigint in js number directly stored in rows variable. how can do? is there way convert text when send request? depending on middleware you're using, of them have setting enables support big numbers, common middleware uses supportbignumbers option this var mysql = require('mysql'); var connection = mysql.createconnection({ host : 'example.org', user : 'bob', password : 'secret', supportbignumbers : true });

android - What is executed in the NOT UI THREAD in a IntentService? -

i'm not sure parts of intentservice not executed on ui thread. can 1 explain bit? onhandleintent(android.content.intent) called on worker thread. other callbacks executed on ui thread

node.js - express single route, multiple functions -

is there way have multiple functions against single route. app.get('/r1', function(req, res) { res.send('hello world 1'); }); app.get('/r1', function(req, res) { res.send('hello world 2'); }); reason: content negotiation, https://en.wikipedia.org/wiki/content_negotiation i've different modules based on accept header in different scopes, can't reach out 1 other in router. please advise. while can't have multiple functions per routes first described, can content negotiation inside route, look @ req.is(type) http://expressjs.com/api.html something along lines of app.get('/r1', function(req, res) { if(req.is('html')) { //do html stuff return res.send('it html') } if(req.is('json')) { //do json stuff return res.send('it json') } //wasn't html or json, send 406 res.status(406); res.send('content type not acceptable'); }); alte

Exit Spring Integration when no more messages -

i'm using spring integration (4.1) config retrieve message db batch more service. know i'll have dozen of messages process daily, , therefore need run batch once day. my jdbc:inbound-channel-adapter configured retrieve max-rows-per-poll="1". i'd notified in way when there no more messages, can exit batch, have issues finding "plug". tried interceptor remembers when last message went through + scheduled task retrieves timestamp , checks if it's more configured timeout, felt cumbersome , tried aop instead, feels better solution. i'd intercept call abstractpollingendpoint.dopoll() returns false when there's no message i'm not able find way : tried subclassing abstractrequesthandleradvice doesn't work when applied on poller (it tells me in logs). i'm trying implement methodinterceptor , configure below, , see can intercept call "call" method, i'm not sure it's right way <int:poller default="true&qu

php - NeoClientPHP Issue when retrieving data from Neo4J -

currently, still learning neo4j graph database , plan migrate current rdbms graph database. searching methodology of how connect neo4j in php/codeigniter until found out neoxygen-neoclient answer. after installed using composer planning test it. created new page called connection.php , placed in root folder. unfortunately right i'm having problem when data neo4j in localhost , and below contains of connection.php <?php require_once 'vendor/autoload.php'; use neoxygen\neoclient\clientbuilder; $client = clientbuilder::create() ->addconnection('default', 'http', 'myserver.dev', 7474, true, 'username', 'password') ->build(); $q = 'match (n:actor) return n.name'; $client->sendcypherquery($q); $result = $client->getrows(); echo $result; ?> so result query not shown , ask how display return query neo4j in php ? updated i trying testing example of running application in here https://github.com/ikwatt

angularjs - Angular ui grid - specific class for unselectable row -

i use angular ui-grid display data. i enabled option select row in gridoptions: enablerowselection: true, but specific rows disable selection code: $scope.mygrid.isrowselectable = function (row) { if (row.entity.id == 2) { return false; } else { return true; } }; this work, cant select row id =2, but want add class row notify unselectable. any idea? to highlight actual row: you can write own rowtemplate , assign class row based on entity id this, var rowtemplate = '<div>' + ' <div ng-class="{ \'red\': row.entity.company==\'enersol\' }" ng-repeat="(colrenderindex, col) in colcontainer.renderedcolumns track col.coldef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isrowheader }" ui-grid-cell></div>' + '</div>'; $scope.gridoptions = { rowtemplate:rowtem

jquery - How to display image from image browser in telerik editor -

Image
i have customized telerik editor shown in image. want display clicked image in div showing in black box. so how can display clicked image in black box. this li tag <li data-type="f" data-uid="7ac480cd-8d8c-4a34-80b3-58b3b48467c9" class="k-tile k-state-selected" role="option" aria-selected="true"> <div class="k-thumb"> <img alt="1.jpg" style="" src="imagebrowser/thumbnail?path=1.jpg" class="k-image"> </div> <strong>1.jpg</strong> <span class="k-filesize">206.97 kb</span> </li> and have applied jquery image source li element. $(document).ready(function () { $('li.k-state-selected').live("click", function () { var src = $(this).find("img").attr("src"); alert(src); }); });"

coldfusion - Dynamic bootstrap active tab -

is there way can rid of hard coded active tab , corresponding panel when outputting dynamic content? somehow make first iteration of dynamic content active tab + panel. code below works fine, active tab/panel pretty pointless in scenario. <div role="tabpanel"> <!-- nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">home</a></li> <cfoutput query="lessons" group="lesson_date"> <li role="presentation"><a href="###dateformat(lesson_date, 'ddddd')#" aria-controls="#dateformat(lesson_date, 'ddddd')#" role="tab" data-toggle="tab">#dateformat(lesson_date, 'ddddd')#, #dateformat(lesson_date, 'd')# #dateformat(lesson_d

Any idea about inserting html to SharePoint? -

i'm trying insert piece of html code(which working in local html file) in sharepoint. not accepting tags there in code, eg: 'style' tag. appreciated. :) open page edit. "media , content" group choose "script editor" web part. , click edit snipper , paste html code there. can use content editor web part , provide link html code. if want change style whole sharepoint can modify master page or providing alternate css exiting 1 (this possible in central administration).

java - Adding ".foreach" capability to a custom container class -

i wrote own container class game, similar of arraylist different in quite few ways, anyhow want write foreach method iterate on backing array. i know use arrays.stream i'm curious how write custom lambda implementation of #foreach method iteration on array. anybody have clue? thanks example: class container<t> { t[] array = new t[200]; } now instance lets wanted this: container<fish> fishies = new container(); fishies.foreach(fish->system::out); you need implement foreach method similar of stream interface in container class : void foreach(consumer<? super t> action) { (int = 0; < array.length; i++) action.accept(array[i]); } this foreach implementation serial, it's simpler stream implementations, can parallel. i'm ignoring fact t[] array = new t[200]; doesn't pass compilation, that's different issue.

c++ - GNU Radio io_signature -

i'm getting gnu radio , after created new block, in main class have peace of code : square_ff_impl::square_ff_impl() : gr::block("square_ff", gr::io_signature::make(<+imin+>, <+imax+>, sizeof (<+itype+>)), // input signature gr::io_signature::make(<+omin+>, <+omax+>, sizeof (<+otype+>))) // output signature { // empty constructor } i don't know put in min , max (even after reading doc). can give me examples please ? imin - minimum number of acceptable input ports imax - maximum number of acceptable input ports omin - minimum number of acceptable output ports omax - maximum number of acceptable output ports the documentation talks bit in iosignatures portion of blockscodingguide : the first 2 parameters min , max number of ports, allows blocks have selectable number of ports @ runtime. a value of -1 means "unlimited". as example of source block, take @

Google play Android crash - Native crash at /system/lib/libcutils.so -

i getting crash reports google play. , error occur on android v4.4.2. i don't known causing crash , how fix it. hope can me. log: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** build fingerprint: 'samsung/ja3gxx/ja3g:4.4.2/kot49h/i9500xxufni2:user/release-keys' revision: '10' pid: 28579, tid: 28587, name: finalizerdaemon >>> com.iam.nearer.app <<< signal 6 (sigabrt), code -6 (si_tkill), fault addr -------- abort message: 'heap corruption detected dlfree' r0 00000000 r1 00006fab r2 00000006 r3 00000000 r4 00000006 r5 00000000 r6 00006fab r7 0000010c r8 00000000 r9 72822f48 sl 7282c108 fp 72a90b24 ip 00000016 sp 72a909b8 lr 401090e1 pc 401182d0 cpsr 000f0010 d0 65746564206e6f64 d1 207962206465746c d2 6dba675800000066 d3 0000010000000072 d4 8000000000000000 d5 0000000000000000 d6 4b83075000000000 d7 42c8000000000003 d8 0000000000000000 d9 0000000000000000 d10 0000000000000000 d11 0000000000000000 d12 00000000000000

c# - My pivot point does not follow my gameobject -

so im making unity game have gameobject im moving , rotation during game, thing pivot point doesnt stick object. rotates fine on spot when game begins when has been moved the pivotpoint didnt follow , still rotation around start location. im using "extra" gameobject pivotpoint in right spot in first place, object attached first object tho should follow around. any ideas cause/solution this? im pulling out hair here been moving stuff around night >.< here basic code rotating, doubt thats though. public float speed = 1f; // use initialization void start () { } // update called once per frame void update () { if (input.getkey(keycode.w)) // gå fremad { transform.position -= new vector3 (speed * time.deltatime, 0.0f, 0.0f); } if (input.getkey(keycode.s)) // gå baglæns { transform.position += new vector3 (speed * ti

windows - Python on Notepad++ : How to pass command line arguments? -

"valueerror: need more 1 value unpack - learn python hard way ex: 13" this problem has been discussed lot of times on forum. there way pass on arguments in notepad++ editor itself? writing code in notepad++ editor , executing on python's default environment after providing arguments should make work - can directly pass arguments notepad++? p.s - started python - no prior knowledge. passing command line arguments can done on command line itself. or can call via python program using os.system execute command line arguments. os.system : execute command (a string) in subshell. implemented calling standard c function system(), , has same limitations import os os.system("program_name.py variable_number_of_arguements" you use call subprocess: from subprocess import call call(["program.py", "arg1", "arg2"])

html - How to use the same form for creating and editing in ruby on rails -

i new ruby. have same form need perform creation/updation , when required. problem have whenever call edit instead of editing details of existing user, getting new user edited details. put simply, think whenever perform edit, create method being called. so there way use single form both new , edit instead of using separate forms. the following code editing user details: <%= link_to 'home', root_path %> <h2>edit user</h2> <%= form_for :user, url: user_index_path |f| %> <p> <%= f.label :name %><br> <%= f.text_field :name %> </p> <p> <%= f.label :address %><br> <%= f.text_area :address %> </p> <p> <%= f.label :email %><br> <%= f.text_field :email %> </p> <p> <%= f.label :pho

linux - How to mount an rsync-copied partition combined from two source partitions -

my pc running archlinux. pc has 2 hard disks, /dev/sda , /dev/sdb. sda source disk , contains files. sdb destination disk , empty. purpose make copy of sda sdb, , make sdb bootable archlinux installation. sda has 3 partitions: sda1 /boot, sda2 /, sda3 /home. here /etc/fstab: /dev/sda2 / ext4 rw,relatime,data=ordered 0 1 /dev/sda1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2 /dev/sda3 /home ext4 rw,relatime,data=ordered 0 2 i formatted sdb 2 partitions only: sdb1 /boot , sdb2 /. used rsync copy sda1 sdb1, sda2 , sda3 sdb2. , updated uefi bootloader , /etc/fstab: /dev/sdb2 / ext4 rw,relatime,data=ordered 0 1 /dev/sdb1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2 the problem is, when booted sdb, both sdb1 , sdb2 automatically mounted, /hom

hex - Trying to make total color of image, not good at programming -

i'm working on spectroscopy project though taking way long. haven't found program online can need , don't know how myself. need program takes image(from hard drive) , adds rgb values in dec out of 255 of every pixel, returned individually in red, green, , blue. additionally, although can part on own, values need multiplied 255 divided greatest value , converted hex retrieve kinda total color of entire image. (note: not want average color of image, tried , returns neutral colors) by googling 2 minutes found this: https://itg.beckman.illinois.edu/technology_development/software_development/get_rgb/ no idea if works looks want.

hadoop - how do retrieve specific row in Hive? -

i have dataset looks this: --------------------------- cust | cost | cat | name --------------------------- 1 | 2.5 | apple | pklady --------------------------- 1 | 3.5 | apple | greengr --------------------------- 1 | 1.2 | pear | yellopear ---------------------------- 1 | 4.5 | pear | greenpear ------------------------------- my hive query should compare cheapest price of each item customer bought. want 2.5 , 1.2 1 row difference. since new hive don't how ignore else until reach next category of item while still kept cheapest price in previous category. you create subquery containing minimum cost each customer, , join original table: select mytable.*, mincost.mincost, cost - mincost costdifference mytable inner join (select cust, min(cost) mincost mytable group cust) mincost on mytable.cust = mincost.cust i created interactive sqlfiddle example using mysql, should work fine in hive.

go - mux.Vars is empty when using httputil.ReverseProxy -

i trying use gorilla mux , httputil.reverseproxy together, when trying mux.vars empty. according https://golang.org/src/net/http/httputil/reverseproxy.go?s=2744:2819#l93 seems http.request pointer shallow copy of original request, should still work. any ideas? https://play.golang.org/p/jpjnvemifb package main import ( "github.com/gorilla/mux" "log" "net/http" "net/http/httputil" "net/url" ) type route struct { match string base string } var routes = []route{ // proxy http://localhost:3000/api/foo/bar => https://api.bar.com/5/foo/bar route{match: "/api/{path}", base: "https://api.bar.com/5"}, route{match: "/sales/{path}", base: "https://sales.bar.com/3"}, } func newproxy(r *route) http.handler { director := func(req *http.request) { out, _ := url.parse(r.base) req.url.scheme = out.scheme req.url.host = out.host

Ruby date today? - unexpected behavior -

i'm new ruby , trying figure out why following doesn't work expected: 2.2.1 :010 > user_date = date.today => sun, 31 may 2015 2.2.1 :011 > user_date.today? => false i'm using rails console , commands executed 1 after other (with maybe second between executions). i'm sure there nuance i'm not understanding, shouldn't second command return true instead of false? if not, why? in advance! edit #1 - additional information requested arup 2.2.1 :013 > puts user_date.method(:today?).owner dateandtime::calculations => nil edit #2 - had hunch. i'm on eastern time , coming midnight when ran original issue. waited turn of midnight, , following works. 2.2.1 :004 > user_date = date.today => mon, 01 jun 2015 2.2.1 :005 > user_date.today? => true date.today belongs core ruby while today? belongs rails. under hood , today? calls date.current (rails well) instead of date.today . going bit further , find

javascript - Svg horizontal line does not appear in chrome with particular zoom level -

Image
i have created bar graph using svg. there few horiztonal rulers svg line black stroke. issue below the horizontal rulers disappear when zoom 75% or 25%. the horizontal rulers dont disappear in other browsers the horizontal rulers dont disappear when rotated , made vertical. observations: if initial zoom 75% , zoom out or zoom in lines appear but when zoom again equal or 75% or 25% lines disappear jsbin link images reference: , 1 issue: what's reason apply external schema? if replace horizontal line declaration following code survives zoom out <line x1="0" y1="0" x2="100%" y2="0" class="black-line"></line> <line x1="0" y1="20%" x2="100%" y2="20%" class="black-line"></line> <line x1="0" y1="40%" x2="100%" y2="40%" class="black-line"></line>

python - HappyBase and Atomic Batch Inserts for HBase -

with happybase api hbase in python, batch insert can performed following: import happybase connection = happybase.connection() table = connection.table('table-name') batch = table.batch() # put several rows batch via batch.put() batch.send() what happen in event batch failed half way through? rows had been saved remain saved , didn't not saved? i noted in happybase github table.batch() method takes transaction , wal parameters. these configured in such way rollback saved rows in event batch fails halfway through? will happybase throw exception here, permit me take note of row keys , perform batch delete? did follow tutorial batch mutations in happybase docs? looks you're mixing few things here. https://happybase.readthedocs.org/en/latest/user.html#performing-batch-mutations batches purely performance optimization: avoid round-tripping thrift server each row stored/deleted, may result in significant speedup. the context manager behaviour (the

C# ReadProcessMemory alternative -

i'm trying readprocessmemory on process uses obregistercallbacks prevent process create handle on ( openprocess ). have heard of people creating own memory reading utilites in c# without readprocessmemory or openprocess . if show me how go creating such library amazing (or if linked existing one). this strictly reading memory, not need write memory process readprocessmemory , openprocess part of official windows api. these call other os functions, such zwreadvirtualmemory / ntreadvirtualmemory , zwopenprocess / ntopenprocess . issue these functions can accessed drivers. can create software driver (by creating kernel mode driver (kmdf) or windows driver model (wdm) in visual studio). down side c++ , difficult. you may want open source c# library called whitemagic. injects dll process, , allows reading/writing of memory inside application itself. uses openprocess inject dll, may possible replace injection method alternative, such this: https://github.com/dwend

ios - VFl recover by breaking constraint , layout buttons' label -

i trying use vfl move label, subview of button, down below: -------------- button1 button.label -------------- the code like: [dic_bind_views setobject:btn.titlelabel forkey:[nsstring stringwithformat:@"%@",@"title"]]; [btn.titlelabel settranslatesautoresizingmaskintoconstraints:no]; nsstring *format_container_title = [nsstring stringwithformat:@"v:|-[title]-(%d)-|", item_title_offset]; [btn addconstraints:[nslayoutconstraint constraintswithvisualformat:format_container_title options: 0 metrics:nil views:dic_bind_views]]; the layout shows wish for, no warning, got such result in console: (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints) ( "<nslayoutconstraint:0x7ff79b63c8e0 uibuttonlabel:0x7ff79b632860'\u97f3\u6548'.top == uibutton:0x7ff79b

Python Pandas add rows based on missing sequential values in a timeseries -

i'm new python , struggling manipulate data in pandas library. have pandas database this: year value 0 91 1 1 93 4 2 94 7 3 95 10 4 98 13 and want complete missing years creating rows empty values, this: year value 0 91 1 1 92 0 2 93 4 3 94 7 4 95 10 5 96 0 6 97 0 7 98 13 how do in python? (i wanna can plot values without skipping years) i create new dataframe has year index , includes entire date range need cover. can set values across 2 dataframes, , index make sure correct rows matched (i've had use fillna set missing years zero, default set nan ): df = pd.dataframe({'year':[91,93,94,95,98],'value':[1,4,7,10,13]}) df.index = df.year df2 = pd.dataframe({'year':range(91,99), 'value':0}) df2.index = df2.year df2.value = df.value df2= df2.fillna(0) df2 value year year 91 1 91 92 0 92 93

How to simulate simultaneous button touch in ios Simulator -

i have 2 buttons on screen , 1 on left , 1 on right , wanted know if there way in ios simulator me simulate both buttons being pressed @ same time.i tried pressing alt on simulator result 2 circles appear. can position 1 circle first button on left not sure how position next circle on right button. once have 2 circles (using alt key), move circles together, hold shift key: allow move 2 circles anywhere on simulator screen. then let go key , click. i tried code: -(void)taptwo:(uitapgesturerecognizer*)recognizer { cgpoint p1 = [recognizer locationoftouch:0 inview:self.view]; cgpoint p2 = [recognizer locationoftouch:1 inview:self.view]; nslog(@"points: %@ , %@",nsstringfromcgpoint(p1),nsstringfromcgpoint(p2)); } - (void)viewdidload { [super viewdidload]; uitapgesturerecognizer* r = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(taptwo:)]; r.numberoftouchesrequired = 2; [self.view addgesturerecognizer:r]; } an

ios - I'm trying to populate a tableview with a list of users, but the tableview will not load anything -

for reason keep getting blank tableview. showing query being loaded parse, isn't displaying results. in advance help. class userviewcontroller: pfquerytableviewcontroller { override init(style: uitableviewstyle, classname: string!) { super.init(style: style, classname: classname) } required init(coder adecoder: nscoder) { super.init(coder: adecoder) self.pulltorefreshenabled = true } override func queryfortable() -> pfquery { var query: pfquery = pfuser.query()! println(query) return query } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject!) -> pftableviewcell { var usercell = tableview.dequeuereusablecellwithidentifier("cell2") as! pftableviewcell! if usercell == nil { usercell = pftableviewcell(style: uitableviewcellstyle.default, reuseidentifier: "cell2") }

javascript - JSZip Read Zip File and Execute from an Existing Zip File -

i've been using jszip read , write zip files in javascript. what i'm trying load web app (index.html, style.css, image files, , whatever else user requires web app) compressed in zip file input[type=file] element (i'm using filereader read contents of zip file , display files/folders on page) // show contents var $result = $(".result"); $("#file").on("change", function(evt) { // remove content $result.html(""); // sure show results $(".result_block").removeclass("hide"); // see http://www.html5rocks.com/en/tutorials/file/dndfiles/ var files = evt.target.files; (var = 0, f; f = files[i]; i++) { var reader = new filereader(); // closure capture file information. reader.onload = (function(thefile) { return function(e) { var $title = $("<h4>", { text : thefile.name }); $result.append($title); var $filecontent = $(&qu