Posts

ssh session as python subprocess takes input but does not print it to stdout -

i'm trying use python's cmd library create shell limited commands. 1 requirement have able run command executes existing shell script opens ssh session on remote machine , there allows user interact remote shell if regular ssh session. simply using subprocess.popen('[/path/to/connect.sh]') works @ least starting point except 1 issue. can interact remote shell input type not shown on stdout...so example see prompt on stdout when type 'ls' don't see being typed when hit return works expected. i'm trying wrap head around how print input stdout , still send along remote ssh session. edit: actual code without using cmd 1 line: ssh_session = subprocess.popen(['connect.sh']) it fired do_* method in class extended cmd.cmd. think may end using paramiko still interested in anyone's input on this. assuming using unix system, ssh detects if on terminal or not. when detects not on terminal, when using subprocess, not echo charac...

java - I can't call the repaint() method in my main method -

everytime try call repaint() method says non static method cannot reference static method. btw, it's in same class paintcomponent method. tried create object out of class first, reference object name didn't work. please help. public class p extends jpanel { p g = new p(); boolean change = true; static int x = 0; static int y = 0; static color circlec = new color(0, 0, 0); static string position = ""; p p = new p(); public void paintcomponent(graphics g) { g.setcolor(circlec); g.filloval(x, y, 50, 50); g.setcolor(color.white); g.drawstring(position, x, y + 25); } public static void main(string[] args) throws interruptedexception { p.repaint(); } } the main method static. p object not: instance field of p class. try this: public static void main(string[] args) throw interruptedexception { eventqueue.invokelater( new runnable() { public void run() { p p = new p(); p.repaint(); } } );...

jQuery UI Remove Dropped Object -

i'm working on simple jquery ui project. i'm dragging image inside "blue" div empty "red" div. i can insert image code "red" div, well. want is, after dragging completed, remove first item. in summary, drag picture div. stick top-left no matter user drops. <script> var imgcode = '<img src="42.jpg" id="dragpic" alt="42" width="100" height="100">'; //this image code $(function() { $( "#dragpic" ).draggable(); //image draggable $( "#red" ).droppable({ //image has dragged "red" div drop: function( event, ui ) { $( ) .addclass( "reddrop" ) //custom css .html(imgcode); //insert image inside div /* need remove image user dragged. */ } }); }); </script> you can access item that's b...

javascript - jquery Cannot read property 'getAttribute' of undefined -

the javascript i'm using works fine in firefox , ie has error when run on chrome , safari. i'm not entirely sure why it's failing. var response = asyncresult.value; if (window.domparser) { var parser = new domparser(); xmldoc = parser.parsefromstring(response, "text/xml"); } else { xmldoc = new activexobject("microsoft.xmldom"); xmldoc.async = false; xmldoc.loadxml(response); } console.log(xmldoc); var changekey = xmldoc.getelementsbyid("t:itemid")[0].getattribute("changekey"); the console shows message outputs xmldoc fine when have set console.log() uncaught typeerror: cannot read property 'getattribute' of undefined r.js soaptogetitemdatacallback r.js r.onreadystatechange outlookwebapp-15.js:21 $h.ewsrequest.$1x_1 outlookwebapp-15.js:21 (anonymous function) outlookwe...

How to move text output of php in html -

i have php code block related account login logout etc. however, when log in without valid password echos "please enter valid username/password" however, when text appear, covered html scripts, dont know if can position it? or have convert html scripts, please enligten me thanx x this output coming <!d0ctype html> <html> <head> <style> #lions { position:absolute; top:15px; left:1200px; z-index:9; } </style> </head> </html> <?php if (isset($_post['username'])&&isset($_post['password'])){ $username = $_post['username']; $password = $_post['password']; $password_hash = md5($password); if(!empty($username)&&!empty($password)){ $query = "select `id` `users` `username`='".mysql_real_escape_string($user...

angularjs - Enabling CORS in an API gateway -

i making cordova application. need make simple request angular. i keep getting message: "cross-origin request blocked: same origin policy disallows reading remote resource @ http://myserver/authenticateme . can fixed moving resource same domain or enabling cors." i thought added necessary headers response. here full header: "access-control-allow-headers: origin, x-requested-with, content-type, accept access-control-allow-origin: * content-encoding: gzip content-length: 76 content-type: application/json;charset=utf-8 date: mon, 16 mar 2015 21:37:56 gmt server: apache-coyote/1.1" i tried in firefox , chrome. this extremely annoying because never had problem server when doing native ios , android requests. am missing here??? did try jsonp? something like: $http.jsonp(api_url + "/?callback=json_callback") .success(function(data) { // blah blah }) .error(function() { console.log("couldn't fetch."); }) .fi...

restangular - capturing full URL of a GET request in AngularJS including query params -

i'm using http interceptor. see values when make restangular request. here code request interceptor. request: function (config) { // see link below see value of config console.log('config', config); // below returns full url except query string console.log('location', $location.absurl()); // $rootscope.cachedata $cachefactory console.log('$rootscope', $rootscope.cachedata); // returns {id: "http", size: 3} console.log('cache info', $rootscope.cachedata.info()); // below returns undefined console.log('cache get', $rootscope.cachedata.get('http')); // other codes removed since it's not related // ........ // ........ // return config or wrap in promise if blank. return config || $q.when(config); }, config value : http://i.imgur.com/l0isxbj.png unfortunately, preparing params captured manually not 100% guaranteed match has been cached. noticed cachef...