Posts

matplotlib - Overwriting Existing Python Plots with New Function Call -

i overwrite existing plot made in python new function call. produce plot, @ it, call same function again different arguments produce plot. second plot replace first plot. is, don't want 2 figure windows open; original window overwritten. i have tried using interactive mode when plotting (ion()), placing plot() , show() calls in different places, , clearing figures. problems have that: 1. can never overwrite , existing window, open more 2. show() blocks code continuing , unable perform 2nd function call 3. use interactive mode , window appears second before going away what i'm trying seems simple enough, i'm having great difficulty. appreciated. write plotting function like def my_plotter(ax, data, style): ax.cla() # ax.whatever rest of plotting return artists_added and call like data = some_function() arts = my_plotter(plt.gca(), data, ...) or do fig, ax = plt.subplots() and call plotting function like arts = my_plotter(ax, data, ....

javascript - My simple routing is not working and I can't figure out why -

i'm working through basic node tutorial , having difficulty getting routes.js file work. it working earlier today. server node reading file. reason, though not utilizing it. code looks tutorial -- though teacher on pc , on mac (though can't see why matter). before issue started occur, hooked database (file below) -- again, can't see why screw routes. when put code in server.js, can proper routing. help me stackoverflow, you're hope! see "cannot /" my routes.js file var user = require('../models/user'); module.exports = function(app){ app.get('/', function(req, res){ res.send("hello world"); }); // app.get('/:username/:password', function(req, res){ // var newuser = new user(); // newuser.local.username = req.params.username; // newuser.local.password = req.params.password; // console.log(newuser.local.username + " " + newuser.local.password); // newuser.save(function(err...

design - Abstract Factory method practice or usage of abstract factory pattern in an API -

first of sorry may sound quite stupid while asking this. i want understand practical usage of abstract design pattern. apis have implemented pattern , under use case. one of use case strikes me di of objects need created using run time information. i have understanding pattern used create object of various product families. every new product family have change existing factories. if there addition implementation of product family have provide new factory new implementation. for example i have products frame , textbox 2 types of os ( windows , mac). have 2 factories 1 each window , mac windowfactory returns textbox , frame windows , macfactory return same objects mac. want add os solar in case need write new factory returns corresponding objects solar. how api use patterns in real world? if using java can check entitymanagerfactory, has method create entitymanager, entity manager has different configuration depend on type of entitymanager (hibernate, openjpa, et...

html - Align text to image in auto-width container that stretches to image width -

here fiddle https://jsfiddle.net/qyljxwrv/1/ . as can see left , right titles aligned screen corners, while align them image corners. trying 2hours without success... .wrapper { position: absolute; left: 0px; right: 0px; top: 0px; background-color: rgba(213,213,213,.5); text-align: center; } .info { text-align: left; } .right-title { float: right; } <div class="wrapper"> <div class="inner"> <div class="info"> <span class="left-title">left</span> <span class="right-title">right</span> </div> <img src="http://i.imgur.com/crcopps.jpg" /> </div> </div> note don't want titles appear inside image, above , aligned left , right corner of image. it seems can simply, , see comments inline. updated demo .wrapper { display: table;...

How to allow input from terminal to contain spaces in perl -

i trying create program allows name entered user , prints name , whether or not found in column of file , how many times found. have far allows user enter name since names have spaces returns name not found because can't detect exact string. here's have: #!/usr/bin/perl use warnings; use strict; %author; $input; $firstauthor; open ($input, "<", 'gwas_catalog_v1.0-downloaded_2015-07-21.tsv') || die(); while (<$input>) { @r = split (/\t/); $firstauthor = $r[2]; $author{"$firstauthor"}++; } print "\nenter name: "; $usrin = <stdin>; chomp $usrin; if (exists $author{"$usrin"}) { print "$usrin seen $author{"$usrin"} time(s).\n\n"; } if (!exists $author{"$usrin"}) { print "$usrin isn't author of contained in file.\n\n"; } the problem solved adding quotation marks surround $usrin inside $author{"$usrin"} .

javascript - WordPress AJAX call not executing PHP -

i'm trying custom ajax action on wordpress isn't working. have following form: <form method='post' name='form-bid-<?php echo get_the_id() ?>' class="bid-form"> <input type='submit' name='<?php echo get_the_id()?>' value='licitar' class='bidvalue'> <?php wp_nonce_field('ajax-bid-nonce', $post->id); ?> </form> the form way because it's generated inside loop, 1 every post on site, therefore use post id unique name input. then, capture form submit on custom javascript file: jquery(document).ready(function($) { // perform ajax bid on form submit $('form.bid-form').on('submit', function(e) { var action = 'ajaxbid'; var auction_id = e.target.name.substring('form-bid-'.length); var security_container = "#".concat(auction_id); var security = $(security_container).val(); $.ajax({ type: ...

linux - How to pass encrypted password for execution of a script from Command Task to call pmrep -

scenario i working on code execute pmrep command. cannot execute unix box code pages different ( unix server executing pmrep command , power centre installed), , dont have other option exceute unix box, because dont have sudo login , connecting citrix , informatica not installed locally. so have come option of putting pmrep commands in .sh script , passing username, password,environment , path variables env file. executing above script command task in workflow. i able execute pmrep commands (connect, deploy dg etc) using above process. now comes problem. i saving username , password in .env file. remove this. for pmrep connect command, passing -x $password, pass encrypted password in place of original password. have used pmpasswd utility encrypted password , stored in variable (encrypted_password) used variable in place of orginal. -x $encrytped_password used variable -x $encrypted_password. where -x used general password , -x used environmental password both ...