Posts

Showing posts from March, 2015

php - Adding parameters to the relation in laravel -

i have query uses many ->with() in laravel so: $campaign = $this->campaign ->with('tracks.flights.asset')->take(4) ->with('tracks.group') ->with('tracks.media') ->with('tracks.flights.comments') ->orderby('created_at', 'desc')->find($id); and in track model have method: public function flights() { return $this->hasmany('flight\flight')->orderby('start_date'); } what want achieve having same result want put date constrains on flight level, example this: public function flights($start_date, $end_date) //dynamic dates { return $this->hasmany('flight\flight')->whereraw('start_date > $start_date , end_date < $end_date')->orderby('start_date'); } how can achieve kind of result? new laravel. thanks in advance. chain wherehas onto query. $campaign = $this->campaign ->with

How to only show tableau column subtotals -

i trying show column subtotals in tableau. when select analysis>"show subtotals", row subtotals show well. can please advise on way hide row subtotal column? click on caret @ right side of field on row or column shelf corresponding subtotals wish turn off. when see list of menu commands, uncheck subtotals field

sass - How to remove gutter for first and last element of row in Susy grid -

how can remove gutters first , last elements of row while using susy grid? this mockup markup. http://codepen.io/anon/pen/mvbmly $susy:( columns: 12, gutters:2, gutter-position:split, ); ul{ @include container(800px); } li{ @include span(4); } it uses "gutter-position:split". can see on codepen, first , last element in row still have outside margins. i can work around setting gutter-position "after" , using "last" keyword on last element in row. http://codepen.io/anon/pen/ejgwke $susy:( columns: 12, gutters:2, gutter-position:after, ); ul{ @include container(800px); } li{ @include span(4); } li:nth-of-type(3n+3){ @include span(last 4); } is there other way? using nht-of-type selector kinda defies point of using grid me. after bit of experimenting, managed create mixin provides such functionality: @mixin new_span($elements){ @include span($elements); $n: map-get($susy, columns)/$element

Python 3.3 Encoding Issue -

i have sql database has encoding issues, it's returning me result similar this: "cuvée" from can tell because encoded latin-1 when should have been encoded utf-8 (please correct me if i'm wrong). i'm processing these results in python script , have been getting few encoding problems , have been unable convert it's supposed be: "cuvée" i'm using python 3.3 using codecs.decode make change latin1 utf-8 i'm getting: 'str' not support buffer interface i think i've tried found no avail. i'm not keen on going python 2.7 because i've written rest of script on 3.3 , quite pain rewrite. there way unaware of? yes, have called mojibake ; latin-1, or windows codepage 1252 or closely related codec. you could try encode latin-1, decode again: faulty_text.encode('latin1').decode('utf8') however, sometimes, cp1252 mojibakes, faulty encoding results in text cannot legally encoded bytes, bec

javascript - window.matchMedia('print') failing in Firefox and IE -

i have print button launches print functionality on webpage. button hides user clicks on , shows if user done printing or presses close in print window. works fine in chrome failing in firefox , ie. <input type="button" onclick="launchprint()" value= "print me" /> function launchprint(){ $(".print-box").hide(); window.print(); } (function() { if (window.matchmedia) { var mediaquerylist = window.matchmedia('print'); mediaquerylist.addlistener(function(mql) { if (!mql.matches) { $(".print-box").show(); } }); } }()); any suggestions may missing? unfortunately, on same problem , did research. seems bug exists on recents version of ff , ie still , hasn't been fixed. you can check out bug firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=774398 i found person having same issue , hasn't satisfying answer: https://social.tec

hibernate - Storing date, time, and timezone in PostgreSQL with Grails and GORM -

i have grails 2.5.3 application connecting postgresql, , want store java date or calendar object in database, , include time zone. based on postgresql documentation , default timestamp type not include time zone, need use timestamptz type include time zone. unfortunately when try set in mapping closure of domain class, fails. i'm trying use this: createddate type: 'timestamptz' and error receive is: nested exception org.hibernate.mappingexception: not determine type for: timestamptz unfortunately list of hibernate types not seem include map value. ones related dates are: date , time , timestamp , calendar , calendar-date . have tested each of these, , none of them create desired timestamp time zone in postgres. there articles talk creating custom hibernate usertype this, seems common use case, , can't think there should let me working out of box. you can create own dialect , map java type sql type. can see how it's done in grails-p

php - Apache Htaccess - Rewrite Rules Conflicts and/or Order -

i don't use .htaccess often, had setup local webserver , ended following rewrite rules: # settings: general options +followsymlinks rewriteengine on rewritebase / # settings: protocol rewriterule ^ - [env=proto] rewritecond %{https} on rewriterule ^ - [env=proto:s] # remove www (https://www.example.com/ -> https://example.com/) rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^ http%{env:proto}://%1%{request_uri} [r=301,l] # versioning (main.20150826.css -> main.css) rewritecond %{request_filename} !-f rewriterule ^(.+)\.(\d+)\.(?:bmp|css|cur|gif|ico|jp(?:eg?|g)|js|png|svgz?|tiff?|webp)$ $1.$3 [l] # forbidden/missing resources (403 if directory/file starts '.') rewriterule (?:^|/)\. - [f] # missing resources (403 if file/directory not found) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ - [f,l] # hotlinking prevention rewritecond %{http_referer} !^$ rewritecond %{request_filename} -f rewritecond %{request_filena

dart - How to get ngForm variable reference in the component class -

given following... .html <form (ngsubmit) = "onsubmit()" #heroform = "ngform"> {{diagnostic}} <div class = "form-group"> <label = "name">name</label> <input type = "text" class = "form-control" required [(ngmodel)] = "model.name" ngcontrol = "name" #name = "ngform" #spy> <p *ngif = "name.dirty" class = "alert alert-danger"> name required </p> <!--<p [hidden] = "name.dirty"--> <!--class = "alert alert-danger">--> <!--name required--> <!--</p>--> </div> .. ..is possible #name = "ngform" (ngform) reference in .dart component allow manipulation? suggest

operator overloading - Define += for custom classes in Java -

this question has answer here: operator overloading in java 9 answers i making simple 2d physics engine first attempt @ making kind of physics engine. unfortunately who's fan of teaching physics, not physics related question. wanted know if there way define simple addition custom class. example, have created class named vector2d. if have velocity vector, , acceleration vector, easiest have following code: vector2d velocity = new vector2d(xaxisvelocity, yaxisvelocity); vector2d acceleration = new vector2d(xaxisacceleration, yaxisacceleration); void update() { velocity += acceleration; } however, since velocity , acceleration not primitive types, cannot add them together. know right now, have add components so: velocity.x += acceleration.x ..and on.. what know is: there way define addition classes, similar how tostring() can overridden? just c

multithreading - Thread doesn't run like I say it should with GPIOs in Python on RPi -

i creating script on raspberry pi if press button led on button need flashing till press button again. code: #!/usr/bin/python import rpi.gpio gpio import threading time import sleep gpio.setmode(gpio.bcm) pushbutton = 2 led = 3 gpio.setup(pushbutton, gpio.in) gpio.setup(led, gpio.out) class rpithread(threading.thread): def __init__(self): self.running = false super(rpithread, self).__init__() def start(self): self.running = true super(rpithread, self).start() def run(self): self.running = true while (self.running == true): gpio.output(led, gpio.high) print "high" sleep(0.05) gpio.output(led,gpio.low) print "low" sleep(0.05) def stop(self): self.running = false

android - Handheld multi flavor app with single wear project -

my project working fine when had simple handheld app 1 wear app. now, i've introduced 3 flavors handheld app , kept same single flavor wear app. the problem release builds not being pushed wearable. my project looks this: smartphone's build.gradle: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { minsdkversion 14 targetsdkversion 23 versioncode 8 versionname "3.1.0" applicationid "br.com.test" } signingconfigs { ... } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig = android.signingconfigs.release } debug { applicationidsuffix ".debug"

javascript - Laravel and Angular js file upload -

how can save images laravel , angular js ? more inputs , work me , of type text my index: <div class="container" ng-app="todoapp" ng-controller="todocontroller"> <h1>profile</h1> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <h4>foto de perfil: </h4> <div class="input-group"> <span class="input-group-btn"> <span class="btn btn-primary btn-file"> browse&hellip; <input type='file' name="photo" ng-model="todo.photo" class="image-upload"required/> </span> </span> <input type="text" class="form-control" readonly> </div> </div> <div class=&q

What's an efficient way to have a Javascript table of functions? -

in code follows draw dots on die having table of functions know how draw dots given die. i'm worried, however, these tables recreated each , every time. if in c++ i'd make them static, that's of course not possible. i'd know how each time call drawdie doesn't recreate function tables. or compiler/parser/interpreter of modern browser smart enough don't have worry it? // drawdie // // draws die 'dots' count of dots @ given location , size. dot size based on die size. function drawdie(x, y, cx, cy, dots) { game.context.drawimage(game.getimage('images/reddie.png'), x, y, cx, cy); var dotradius = cx / 10; var dotspacing = cx / 8 + dotradius; var centerx = x + cx / 2; var centery = y + cy / 2; function center() { drawcircle(centerx, centery, dotradius); }; function topleft() { drawcircle(centerx - dotspacing, centery - dotspacing, dotradius); }; function topcenter() { drawcircle(centerx,

java - JavaFX - Control Item best suited for my needs? -

Image
i want have box keeps list of string objects. not choicebox , combobox , etc because needs displayed without having click open box. user can add new entries entering them in textfield below , pressing enter . control item can't textfield either because you're not able click on individual lines of textfield . in application, i'd able double click on item delete it. if that's easy, maybe double click allow me edit entry? can here suggest something? of control types know of, cannot think of single thing. you can use listview textfield . it's rather easy make cells editable, since there way create cell factory using textfieldlistcell.forlistview listview<string> lv = new listview<>(); // make cells editable lv.seteditable(true); lv.setcellfactory(textfieldlistcell.forlistview()); // print selected item console lv.getselectionmodel().selecteditemproperty().addlistener((observable, oldvalue, newvalue) -> { system.out.println(&qu

android - Meteor production app fail to use Facebook's user_friends permission -

Image
i have mobile meteor app uses facebook api , manage users authentication , sign-ups accounts-facebook package. as long tested app on meteor.com server , on local builds, following code provided made app use facebook's user_friends permission: (that's under client/accounts.js) accounts.ui.config({ requestpermissions: { facebook: ['user_friends'] } }); however, since deployed production mup, seems user_friends permission doesn't take effect on facebook anymore. going through mongodb can see in db.meteor_accounts_loginserviceconfiguration collection document facebook is: { _id: "gcmytcntxq3rtpmwm", service: "facebook", appid: "*********", // censored loginstyle: "redirect", secret: "***************************", // censored requestpermissions: [ "user_friends" ] } so meteor app knows should ask new users permission. looking @ facebook account application priv

php - Use example.com/param instead of example.com/def_controller/index/param -

i need acess default contrillers index function without need write controllers name , index in url, pass parameter value right after domain name. in jsfiddle when after domain name pass identifier of fiddle. how can achive in codeigniter site? i guess should made in htaccess file. could me that? there nothing .htaccess. don't think so. you can customize url in routes.php placed on application/config . $route['(:num)'] = 'def_controller/index/$1'; uri routing wildcards

mongodb - Why is the database empty, even after a successful import? -

i attempted import json file today on macbook, got error: davids-macbook-pro:server droberts$ node import.js /filepath/a_to_b.json development mongodb://localhost/somefoldername { db: { safe: true } } b /users/droberts/desktop/foldera/folderb/node_modules/mongoose/node_modules/mongodb/lib/server.js:236 process.nexttick(function() { throw err; }) ^ error: connect econnrefused @ exports._errnoexception (util.js:746:11) @ tcpconnectwrap.afterconnect [as oncomplete] (net.js:1010:19) however, after running mongod in new tab, able rerun command successfully: davids-macbook-pro:server droberts$ node import.js /filepath/a_to_b.json development mongodb://localhost/somefoldername { db: { safe: true } } b adding data mongodb finished import however, startling thing is, database remains empty!: davids-macbook-pro:server droberts$ mongo mongodb shell version: 3.2.1 connecting to: test server has startup warnings: 2016-01-15t17:50:09

html - How can I make a button link to another page? -

this html far <button type="button" formaction="contact.html">get in touch!</button> for reason when click on button in browser doesn't take me contact.html page. pages came in google helped me learn new button attributes, couldn't figure out how make page redirect on click. if using bootstrap, can use you: <a href="#" class="btn btn-info" role="button">link button</a> see http://www.w3schools.com/bootstrap/bootstrap_buttons.asp

excel - Using the following code it populates all cells in the table that are blank -

i have following code , works great except 1 thing when used finds every blank field in table , inserts value of field above it. need fill fields above rows inserted code. sub ercacmpcleanup() 'cleans erca_cmp worksheet , creates records comma delimited dim x long, lastrow long, range, table range, data() string const delimiter string = ", " const delimitedcolumn string = "a" const tablecolumns string = "a:o" const startrow long = 2 application.screenupdating = false activeworkbook.worksheets("erca_cmp").visible = true activeworkbook.worksheets("erca_cmp").activate lastrow = columns(tablecolumns).find(what:="*", searchorder:=xlrows, _ searchdirection:=xlprevious, lookin:=xlformulas).row x = lastrow startrow step -1 data = split(cells(x, delimitedcolumn), delimiter) if ubound(data) > 0 intersect(rows(x + 1), columns(tablecolumns)).resize(ubound(data)).insert xlshift

javascript - How does callback work in AngularJS call to REST service? -

i studying angularjs , rest. code sample uses word callback repeatedly in authentication function. is callback keyword in javascript or angular? or callback custom variable created in code? how callback work in code below? googling callback , angularjs not producing usable results. the code angularjs module in question can read @ link , contains code sample app. here module code itself: angular.module('auth', []).factory( 'auth', function($rootscope, $http, $location) { enter = function() { if ($location.path() != auth.loginpath) { auth.path = $location.path(); if (!auth.authenticated) { $location.path(auth.loginpath); } } } var auth = { authenticated : false, loginpath : '/login', logoutpath : '/logout', homepath : '/', path

Mostly query, few updates in nosql databases -

in nosql databases there distinguishing characteristic called mostly query, few updates . can explain how happens , compare relational databases. in view, system queried lot updated few. this analytical processing system contains huge amount of data. user of system launches queries on data in order obtain business analytics. in heart of system can have either sql or nosql database. 1 more suitable workload.

javascript - Is it possible to set up a rolling average for only one series of the dygraph -

i have tried using rollperiod per-series property in order display 1 "raw" time series , rolling average separate series, no success. there way ? ! no, it's not. if want average 1 series not another, you'll need before send data dygraphs.

c# - DataSource (object) not bind to textbox -

Image
i new vb , visual studio. followed online tutorial binding. can not click text property of advanced binding page, following. not sure what information necessary debug . so, post creenshot here. questions. please let me know. code of class used datasource: public class miconfig public m_name string public m_primary integer public sub new(byval name string, byval primary integer) m_name = name m_primary = primary end sub end class 'textbox1 ' me.textbox1.location = new system.drawing.point(3, 193) me.textbox1.name = "textbox1" me.textbox1.size = new system.drawing.size(120, 26) me.textbox1.tabindex = 3 update why down-voted, please leave comment or solution or anything? otherwise, down-voting cannot improve society. mark class datasource advanced binding (window in screenshot) -> binding -> add project datasource -> object -> select class select property of class in binding want use data-bind

xamarin.android - Automatic Scroll when searching in mono for android or in c# -

i have list of name in listview, have search when search name display 1 search. want automatic scroll 1 search. how can in mono android or in c#. if have no idea of mono android click link : http://www.codeguru.com/csharp/sample_chapter/introduction-to-mono-for-android.htm if understood correctly can try with: listview.smoothscrolltoposition(position);

security - web site access control PHP -

i want protect large class.php files on site. site runs on iis (godaddy); use web.config files; question: if page users viewing require('class.php') , can class.php file restricted server scripting? or file need in folder accessible. same db.php file containing database password. edit if make page on desktop link index.php file , right click , save have php file. can open ans see requires clss.php. can repeat , class.php file. want prevent end of edit so php processor have access file not users try download them. if possible rule add in web.config file? thank you! a simple way define constant in first file, in class.php can exit if it's not defined. put first line, , ensure not called entry point. or, place class.php outside of web root.

Configuring spring controller properties partially with annotation in class and partially in config xml -

is possible define few properties of spring controller annotation in class , few other properties in spring-servlet.xml. can use both annotations , xml config file same controller or use either of two.i.e. example, @controller @command name annotation //some properties public class controller { } and in servlet.xml: <bean id="controller" class = "the classpath"> <property name="someotherproperty" value="somevalue1"></property> <property name="someotherproperty" value="somevalue2"></property> </bean> you don't want that, because mess up. code, have problem finding right configuration specific part of project.

java - TextIO.getln() does not get input? -

Image
i'm newbie in java. i'm reading book introduction programming using java v7 , found problem code this: public class createprofile { public static void main(string[] args) { // todo auto-generated method stub string name; string email; double salary; string favcolor; textio.putln("good afternoon! program create"); textio.putln("your profile file, if answer"); textio.putln("a few simple questions."); textio.putln(); /* gather responses users. */ textio.put("what name? "); name = textio.getln(); textio.put("what email address? "); email = textio.getln(); textio.put("what salary income? "); salary = textio.getdouble(); textio.putln(); textio.put("what favorite color? "); favcolor = textio.getln(); /* write user's informatio

java - How to store a space in a char array? -

i'm writing caesar cypher program can't figure out how store space in char array. here encrypt method public static string encrypt(string msg, int shift) { char[] list = msg.tochararray(); (int = 0; < list.length; i++) { // shift letter char letter = list[i]; letter = (char) (letter + shift); if (letter > 'z') { letter = (char) (letter - 26); } else if (letter < 'a') { letter = (char) (letter + 26); } else if (letter == ' ') { letter = '\0'; } list[i] = letter; } // return final string. return new string(list); } literally, answer question is: list[i] = ' '; however, code written looks rather broken. hint: think about: what happens characters aren't letters in range a z (lower case!), and what happens letter before test - if (letter == ' ') { ... .

How to autoscale y axis in matplotlib? -

Image
this question has answer here: add margin when plots run against edge of graph 1 answer i'm creating many plots , great while other need adjustment. below how can make hard see plot line easier see without having manually plot them? plot 50-100 of these @ time add them pdf report. i'd add space under line, example have ylim min limit set -0.1, automatically. this 1 hard see plot line: this 1 easy see plot line: here code plotting: def plot(chan_data): '''uses matplotlib plot channel ''' f, ax = plt.subplots(1, figsize=(8, 2.5)) x = dffinal['time'].keys() ax.plot(x, dffinal[chan_data].values, linewidth=0.4, color='blue') ax.xaxis.set_major_formatter(mdates.dateformatter('%m/%d/%y - %h:%m')) ax.xaxis.set_major_locator(mdates.autodatelocator(interval_multiples=true)) lgd1 = ax.legend(loc='center

Delphi - how read filestream byte by byte? -

i'm working stream files, "out of memory" error occurred. think must read stream, byte byte. load file method: fs := tfilestream.create("c:\a\a.avi", fmopenread or fmsharedenywrite) ; next reset stream position: fs.positon:=0; then i'm trying read first byte of stream: var onebyte:byte; begin fs.read(onebyte,2); but doesn't work properly. mistake? byte size 1 not 2 fs.read(onebyte, 1); such errors can prevented using sizeof() function fs.read(onebyte, sizeof(onebyte)); on note, read returns number of bytes read indicate whether or not entire read succeeded. expected check return value deal errors. the preferred idiom use readbuffer instead. call read , in case of error raise exception. as @david heffernan pointed out reading file stream byte byte not efficient way. take @ buffered files (for faster disk access)

c# - 2 threads increasing a static integer -

if increasing static 2 different tasks or threads need lock it? i have class used multiple threads @ same time, returns proxy used inside thread dont want use same proxy @ same time each thread, thought incrementing static integer best way, suggestions? class proxymanager { //static variabl gets increased every time getproxy() gets called private static int selectionindex; //list of proxies public static readonly string[] proxies = {}; //returns web proxy public static webproxy getproxy() { selectionindex = selectionindex < proxies.count()?selectionindex++:0; return new webproxy(proxies[selectionindex]) { credentials = new networkcredential("xxx", "xxx") }; } } based on selected answer if(interlocked.read(ref selectionindex) < proxies.count()) { interlocked.increment(ref selectionindex); } else { interlocked.exchange(ref selectionindex, 0); } selectionindex = interlocked.read(ref selectionindex);

debugging - Yii and bootstrap: How debug jQuery when I get a strange behavior? -

Image
i have problems developing yii application jquery. using firebug, when click in tab, can see navigator makes lot of calls: twice home page, 4 original destination, etc; can't see how happens. calls occurs , don't know where. however, if debug , see calls made, i'm pretty sure resolve it. my question: how debug jquery in case? edit: thank help. explain more problem. design of webpage. when click in "zones" tab, load webpage in contentarea_zone. have tabs (the tabs courtesy bootstrap extension yii, use jquery too) when click on tab "description", see calls in firebug console. but can't see come from. , if read right of firebug console, see "jquery.js" , line numbers, jquery library have 9405 lines. don't know why firebug reports calls in line 10079, 10692, etc. i'm lost. if problem remains unclear, me lot if recommend me suitable tool or method debugging case... edit 2: recommendations, started using firebug opti

ember.js - Socket.IO with Ember and Ember-Data -

i've been poking around , can't find date examples of ember (1.0.0-rc.1) , ember-data(revision 11) use socket.io. i've tried this. app.applicationroute = ember.route.extend({ setupcontroller: function(controller, data) { var socket = io.connect(), self = this; socket.on('apartment/new', function(apartment) { var apt = app.apartment.createrecord(apartment); self.controllerfor('apartments').pushobject(apt); }); } }); this create new model class, pushes object controller, , creates new li values not render. <ul class="list-view"> {{#each apartment in controller}} <li> {{#linkto 'apartment' apartment }} <span class="date">{{date apartment.date}}</span> {{apartment.title}} {{/linkto}} </li> {{/each}} </ul> does have run loop? how force values render? or there better approach this? there's simple solutio

mysql - I am having trouble with the logic in my code in android studio -

this code supposed serve on purpose, verify email address has been added database of "profiles" has not been entered before. after user enters relevant data, , attempts verify data legitimate entry, email address checked against other entries in database (because emails unique part of set of entries other nickname)and if email unique database, entry accepted , new column should created in database(which is). problem email accepted unique. this code shows how entries weeded out make sure fit convention of sign sheets public void registeraccount(view view) { loginentries entries = new loginentries( newemailaddressinput.gettext().tostring(), newpasswordinput.gettext().tostring(), newfirstnameinput.gettext().tostring(), newlastnameinput.gettext().tostring(), newnickname.gettext().tostring(),fullphonenumber); string istempemail = newemailaddressinput.gettext().tostring(); string istemppass = newpasswo

c# - Drag and Drop Row in a DataGridView -

i have windows form datagridview , need enable drag , drop rows in datagridview. it filled database. code not work because after first drag , drop cant drop row right position. this load forms datagridview filled database datatable bspeople; rectangle dragboxfrommousedown; int rowindexfrommousedown; int rowindexofitemundermousetodrop; private void form1_load(object sender, eventargs e) { datagridview1.allowdrop = true; bspeople= objpeople.returnpeople(); // fill data sql server datagridview1.datasource = bspeople; } this drag , drop events private void datagridview1_mousemove(object sender, mouseeventargs e) { if (((e.button ==mousebuttons.left))) { if (((dragboxfrommousedown != rectangle.empty) && !dragboxfrommousedown.contains(e.x, e.y))) { dragdropeffects dropeffect = datagridview1.dodragdrop(datagridview1.rows[rowindexfrommousedo

swift - Status bar not showing up on iOS app -

Image
i having problem getting status bar show in view on ios. have tried changing plist file of "status bar hidden" no still doesn't show up.this black bar , unsure why. edit: unsure why got down voted, did research , i've tried has not worked, maybe should more specific. ive tried both answers below, resulting in error. there missing delegation or similar. new swift , have issues delegations. one other thing can try click on name of project. click on name of project under targets . under says deployment info take @ says status bar style , change light . shift+cmd+k clean , run.

python 2.7 - Tight layout for matplotlib 3d surface plot -

Image
i trying create 3d surface plot in matplotlib. plot surface works fine using ax.plot_surface api. couldn't find way remove padding surrounding subplot. in fact, don't need outer axes go 0.0 1.0 @ all. how can remove padding? tried many suggestions stackoverflow "ax.autoscale_view('tight')" , "fig.tight_layout()". autoscale_view don't change , fig.tight_layout() not available in matplotlib version using. strict compatibility requirements have use old (version 0.99) version of matplotlib. ideas ? for completeness have added sample source code using: from mpl_toolkits.mplot3d import axes3d matplotlib import cm import matplotlib.pyplot plt import numpy np fig = plt.figure(figsize = (18,12)) rect = fig.add_subplot(2, 3, 2).get_position() ax = axes3d(fig, rect) x = np.arange(-5, 5, 0.025) y = np.arange(-5, 5, 0.025) x, y = np.meshgrid(x, y) r = np.sqrt(x**2 + y**2) z = np.sin(r) surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.jet

maven - mvn is not recognized as internal or external command -

i trying launch maven project command line when try using mvn --version or other maven command comes below error message mvn not recognized internal or external command maven not installed in os. please follow instructions following link http://maven.apache.org/download.cgi#installation

azure - Start service worker role using management rest api -

i trying stop / start azure worker role using windows scheduler. action url used follows: https://management.core.windows.net/<subscription-id>/services/hostedservices/<cloudservice-name>/deploymentslots/<deployment-slot>/ . secured using certificate. response following error. http action - response host 'management.core.windows.net': 'notfound' response headers: x-ms-servedbyregion: ussouth3 strict-transport-security: max-age=31536000; includesubdomains x-ms-request-id: e1f235c155cf6a00a904a527bc22c77f cache-control: no-cache date: fri, 15 jan 2016 19:55:02 gmt server: 1.0.6198.304 (rd_rdfe_stable.160106-1801) microsoft-httpapi/2.0 body: resourcenotfound the resource service name hostedservices not supported. i followed instructions here: https://msdn.microsoft.com/en-us/library/azure/ee460808.aspx raw post looks this: post https://management.core.windows.net/9974e512-xxxx-xxxx-xxxx-xxxxxxxxb846a/services/hostedservices/sblq

c++ - operator== container iterator const and non-const -

i'm trying have eventmanager impossibly fast c++ delegate discussed in article http://blog.coldflake.com/posts/c++-delegates-on-steroids/ ; template <typename t, typename r, typename... params> class delegate<r (t::*)(params...) const> { public: typedef r (t::*func_type)(params...) const; delegate(func_type func, const t& callee) : callee_(callee) , func_(func) {} r operator()(params... args) const { return (callee_.*func_)(args...); } bool operator==(const delegate& other) const { return (&callee_ == &other.callee_) && (func_ == other.func_); } bool operator!= (const delegate& other) const { return !(*this == other); } private: const t& callee_; func_type func_; }; and 1 of methods used; using eventlistenerdelegate = delegate<ieventdataptr>; using eventlistenerlist = std::list<eventlistenerdelegate>; bool eventmanager::addlistener(const eventlistenerdelegate&

.net - How to customize the controlbox of a winform in c# -

i want customize controlbox of winform different background , different button images. how can so? there way make custom controlbox usercontrol or , add winform? you can create own custom controls inheriting usercontrol so class mycontrol : system.windows.forms.button //this have been system.windows.forms.usercontrol or other existing control type template { protected override void onpaint(system.windows.forms.painteventargs e) { //paint whatever wish on buttons graphics using e.graphics } } there lot programming custom controls. answer here. reference is: http://msdn.microsoft.com/en-us/library/6hws6h2t.aspx you create own sort of forms control , hide parents controlbox. or maybe can inherit system.windows.form , createa custom form. have never tried myself. and using onpaint have keep rules in mind if care performance and/or flickering , such: what right way use onpaint in .net applications?

php - XAMPP: Phpmyadmin doesn't work with FastCGI -

i have local installation of xampp. reasons (java-php-bridge) have use fastcgi. set using guide: http://www3.umoncton.ca/dashboard/docs/use-php-fcgi.html this worked fine cannot access http://localhost/phpmyadmin/ error is: access forbidden! new xampp security concept: access requested directory available local network. this setting can configured in file "httpd-xampp.conf". here "httpd-xampp.conf" file: # # xampp settings # <ifmodule env_module> setenv mibdirs "c:/xampp/php/extras/mibs" setenv mysql_home "\\xampp\\mysql\\bin" setenv openssl_conf "c:/xampp/apache/bin/openssl.cnf" setenv php_pear_sysconf_dir "\\xampp\\php" setenv phprc "\\xampp\\php" setenv tmp "\\xampp\\tmp" </ifmodule> # # php-module setup # loadfile "c:/xampp/php/php5ts.dll" loadfile "c:/xampp/php/libpq.dll" #loadmodule php5_module "c:/x

android - arraylist is empty after adding values -

when execute program, shows blank screen , in logcat shows no adapter attached; skipping layout. when debug code arraylist not getting value (returning 0). public class mainactivity extends appcompatactivity implements constants, networkoperation, url { linearlayoutmanager manager; arraylist<offermodal> bestoffers; recyclerviewadapter adapter; recyclerview rv; fetchdata fetchdata; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); rv = (recyclerview) findviewbyid(r.id.recyclerview1); fetchdata = new fetchdata(this, this, cloud_section); fetchdata.fromserver(); manager = new linearlayoutmanager(getapplicationcontext(), linearlayoutmanager.vertical, false); rv.setlayoutmanager(new linearlayoutmanager(this)); } @override public void started() { } @override public void doingba