Posts

Showing posts from May, 2015

css - Trying to edit a php file to put it's content within a div -

Image
so have php script on wordpress woo commerce site make top of page this: , when click link, this: i want put whole content in div can add background , border , add h1 tag, edit css this: , this: here php controls section: <div class="login_section"> <?php /** * checkout login form * * @author woothemes * @package woocommerce/templates * @version 2.0.0 */ if ( ! defined( 'abspath' ) ) { exit; // exit if accessed directly } if ( is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) { return; } $info_message = apply_filters( 'woocommerce_checkout_login_message', __( 'returning customer?', 'woocommerce' ) ); $info_message .= ' <a href="#" class="showlogin">' . __( 'click here login', 'woocommerce' ) . '</a>'; wc_print_notice( $info_message, 'notice' );</div> ?> &

python - Catching exceptions on fabric -

i trying create script using fabric api (not fab files) , can't exceptions work. idea is, once host has failed, perhaps run rollback() function , write log file failed host. thing system exits. code: class fabricexception(exception): pass class main(object): def __init__(self): env.password = 'password' env.user = 'whatever' command = 'sudo ls -la' failed = [] env.warn_only = true env.abort_exeption = fabricexception def runcommand(command): try: result = run(command) except fabricexeption: print env.host + "failed" failed.append = env.host execute(runcommand, command=command, hosts=hosts) disconnect_all() if __name__ =="__main__": main = main() if you're doing logging failure, why not use context manager, , have block of code warn. using either/both of these settings: env.warn_only , env.skip_bad_hosts . refs:

jquery - Forcing javascript text selection to end when mouse leaves window -

we're running web-app in awesomium frame, same(ish) thing happens in stock chrome well: a user can select amount of text on page, if mouseup when cursor outside window, 'selection' event never 'ends'. when type or move mouse window, acts mouseup never happened, , changes selection. i've tried forcing mouseup event on given input element when window observes mouseleave , doesn't seem have worked, thing cancels selection event physically clicking mouse (unfortunately .click() doesn't work either)! am missing particular event needs firing on specific element, or particular method can call end selection? any massively appreciated! edit : 1 of issues because selection never finishes, typing overwrites itself. with text input, type in click @ end , drag (selecting text) don't release mouse button, if type you'll see 1 of issues we're encountering. how can stop selection event happening (in instance, when mouse leaves window

regex - Sed substitution for text -

i have kind of text: 0 4.496 4.496 plain text. 7.186 plain text 10.949 plain text 12.988 plain text 16.11 plain text 17.569 plain text esp: plain text i trying make sed substitution because need aligned after numbers, like: 0 4.496 4.496 plain text. 7.186 plain text 10.949 plain text 12.988 plain text 16.11 plain text 17.569 plain text esp:plain text but i'm trying different combinations of commands sed can't keep part of matching pattern sed -r 's/\([0-9]+\.[0-9]*\)\s*/\1/g' i trying remove \n after numbers , align text, not work. need align text text too. i tried well: sed -r 's/\n*//g' but without results. thank you this bit tricky. approach not work because sed operates in line-based manner (it reads line, runs code, reads line, runs code, , forth), doesn't see newlines unless special things. we'll have override sed's normal control flow. with gnu sed: sed ':a $!{ n; /\n[0-9]/ { p; s/.*\n//; }; s/\n/ /;

javascript - How to clear old values on click of country and state in the form? -

Image
i have problem in html form.now in stage of : need select country if select india states list of india or again if change dropdown switzerland text box type state. shown below. here in picture have selected india , state selected gujarat. here again have selected switzerland , state typed bern my problem if change country switzerland canada. state typed 'bern' remain same, in third image. need make field empty. while selecting different country need make state field empty please me out [i using html, js , php ]. script : function showhidestatedetails() { if(document.getelementbyid("ai_country").value == 'india') { document.getelementbyid("ai_other_state").style.display='none'; document.getelementbyid("ai_ind_state").style.display=''; } else { document.getelementbyid("ai_ind_state").style.display='none&

python - getting an error Unknown command: 'celery' with celery and supervisor -

i trying setup celery supervisord on aws instance. have project running on virtual environment , tested celery "python2.7 manage.py celery worker". getting error unknown command: 'celery' while running supervisor. my supervisor configuration below 1) [program:celery-eatio] environment = pythonpath="/home/ubuntu/eatio_env/lib/python2.7:/home/ubuntu/eatio-server:/home/ubuntu/eatio_env/lib/python2.7/site-packages:$pythonpath",django_settings_module="eatio_web.settings" command=/home/ubuntu/eatio-server/manage.py celery worker user=ubuntu numprocs=1 stdout_logfile=/home/ubuntu/celery_error.log stderr_logfile=/home/ubuntu/celery_out.log autostart=true autorestart=true 2) [program:celery-eatio] command=/home/ubuntu/eatio_env/bin/python2.7 /home/ubuntu/eatio-server/manage.py celery worker --loglevel=info -c 1 -e -b -q celery_periodic -n periodic_worker directory=/home/ubuntu/eatio-server user=ubuntu autostart=true autorestart=true stdout_lo

linux - RPM verification error what is mean by P -

i have created rpm , installs successfully. after installing, when tried verify rpm --verify command getting error on executable file x returns as ...p /location/to/file/x i don't know mean p. file has special capability listen ports set setcap. can please tell me mean p? have searched through google did't luck. in advance as explained (albeit briefly) in rpm man page : rpm {-v|--verify} [select-options] [verify-options] verifying package compares information installed files in package information files taken package metadata stored in rpm database. among other things, verifying compares size, digest, permissions, type, owner , group of each file. discrepancies displayed. files not installed package, example, documentation files excluded on installation using "--excludedocs" option, silently ignored. the format of output string of 8 characters, possible attribute marker: .... from package header, followed file name. each of 8

c# - Sending serialized objects through the internet -

i developing program our organization. program (c# desktop program on windows 7) consists of 2 sub programs: "server" program , "client" program. the "server" program installed in head office , receives info branches , in subject each employee trained in. has postgresql database end. the "client" program installed in branches of organization (currently 9 branches), have file based database (undecided yet) , responsible gathering info got training in particular branch , in subject. so, every day (give or take) every branch send training statistics main office's server program (? serialized objects), main office receive objects , store them in database , reply info, things "ok confirmed" or "yes, can that" or "no, refused". @ end of month head office computer process data , print statistics. real time communication between branches , server absolutely not necessary. the question : given computers on int

linux - Does vprintf thread safe in c language? -

i writing 1 application using on library using vprintf print information. same way using vprintf application. in scenario vprintf not working. you provide more information in regards mere in scenario vprintf not working anyways, vprintf() thread-safe function has limitation read following write or write following read there must flush work done. may flushing solve problem you. for vprintf() arg_ptr of type va_list points list of arguments, initialing arguments va_start() each call of vprintf() should resolve issue. also, can control increment of ar_ptr after each vprintf() call means of va_end()

no such file in JSch on android -

im trying upload file service. im doing this: jsch ssh = new jsch(); java.util.properties config = new java.util.properties(); config.put("stricthostkeychecking", "no"); session = ssh.getsession("****", "*myip*"); session.setpassword("*******"); session.setconfig(config); session.connect(); channel = session.openchannel("sftp"); channel.connect(); channelsftp sftp = (channelsftp) channel; sftp.put(f + "/" + file, " /var/www/webimages/client/88/"); } catch (jschexception e) { e.printstacktrace(); } catch (sftpexception e) { e.printstacktrace(); } { if (channel != null) { channel.disconnect(); } if (session != null) { session.disconnect(); } } this script im trying use. image file found this: final string pathtowatch = android.os.environment.getexternalstoragedirectory().tostring() + "/dcim/camera/"; toast.maketext(this, "my service started , t

java - Get the next sequence in an arithmetic or geometric progression -

i want make application takes sequence of 3 numbers per line produce , stops when reaches sequence of zeros , prints if it's arithmetic progression or geometric progression , next number in series. example input: 4 7 10 2 6 18 0 0 0 should output ap 13 gp 54 here code wanna know what's wrong , possibilities won't work code. import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; public class main { static string s=""; public static void main (string[] args) throws ioexception { string c; string a[]; bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); { c= br.readline(); = c.split(" "); if(c.charat(0)!='0'){ calc(a[1], a[2]); } }while((c.charat(0))!='0'); printer(s); } public static void calc(string a, string b){ int x

c# - Unity3d Local Forward -

i trying move rigidbody forward in local coordinates, mean, if rotate want move in local x axis. i have tried this, moves in global coordinates: rigidbody player = getcomponent<rigidbody>(); vector3 movement = new vector3 (1.0f, 0.0f, 0.0f); movement = movement.normalized * 2 * time.deltatime; player.moveposition(transform.position + movement); i don't know how make change local coordinates. moveposition works in world space, have this: rigidbody player = getcomponent<rigidbody>(); // hope you're not doing every frame, btw float speed = 2f; // magic numbers bad, move them variables, @ least vector3 movement = transform.forward * speed * time.deltatime; player.moveposition(transform.position + movement);

android - How to exit all the Async task on cancellation of activity? -

according post below: http://techtej.blogspot.com.es/2011/03/android-thread-constructspart-4.html . says that: in such cases, application not shutdown, foreground tasks have been closed or changed, background tasks need know of , try exit gracefully to achieve this, calling cancel function on asynctask instances. right way? in image lazy loading, don't keep track of asynctask s alive (and fetching images), how android os cancel them too? you can cancel asynctask checking thread(asynctask) object's status. private example ex = new example(); class example asynctask<object, void, void> { @override protected void doinbackground(object... params) { string result = null; if(!iscancelled()) result = gethttprestmanager().send(); if(!iscancelled()) { // codes } ... return null; } } public boolean cancel() { switch(ex.getstatus()) { case running: case pend

laravel 4 - How to set the maximum execution time using ajax (get) -

i error "500 internal server error" when retrieve lot of data. when choose country having 10 cities works, when choose country 100 thousands cities error occurs. solution this? my script $('#country_id').on('change',function(e){ console.log(e); var cat_id = e.target.value; var e = document.getelementbyid("country_id"); var str = e.options[e.selectedindex].value; document.getelementbyid('txt').value = str; $.get('/public/countrycity/ajax-sub?cat_id=' + cat_id, function(data){ $('#state').empty(); $.each(data, function(category, subcatobj){ $('#state').append('<option value="'+subcatobj.id+'">'+subcatobj.full_name_nd+'</option>'); }); }); }); $('#state').on('change',function(e){ console.log(e); var e = document.getelementbyid("state"); var strs = e.options[e.selectedindex].value;

python - matplotlib svg save - light borders around contourf levels -

Image
the following code taken in part contour demo of matplotlib documentation. using contourf instead of simple contour. contour plot shown want within matplotlib figure window. as comes saving not content result. png save looks perfect, not have levels, png si no vector format. when saving pdf of svg format have levels, there thin light borders around levels. @ first thought caused, because every level getting stroke around. when opening svg file inkscape drop strokes, found out, levels saved bit small or bit large respectively... hardly note them, when zoom in, zooming out quite prominent. suppose due fact, values of levels saved low precision!? possible rid of theese borders command? i aware these borders not make difference in applicative contexts. unfortunately using them not ugly, disturb quality of depicted results... import matplotlib import numpy np import matplotlib.cm cm import matplotlib.mlab mlab import matplotlib.pyplot plt matplotlib.rcparams['xtick.direction&

angularjs - Why do I need $parent to enable the function in ng-click when using ion-scroll? -

i using following versions: ionic, v1.0.0-beta.14 angularjs v1.3.6 route configuration: myapp.config(function ($stateprovider) { $stateprovider .state('manager_add', { url: '/managers/add', templateurl: 'app/components/mdl.role_members/views/add.html', controller: 'manageraddcontroller' }); }); controller configuration: myapp.controller('manageraddcontroller', function ($scope, $state, $ionicloading, $filter, contactservice, managersservice, rolerequest, rolerequestssentservice, toastrservice) { $scope.role_request = rolerequest.new(); $scope.showcontactsearch = false; $scope.managers = managersservice.collection(); $scope.$watchcollection("managers", function( newmanagers, oldmanagers ) { if(newmanagers === oldmanagers){ return; } $scope.managers = newmanagers; $scope.contactstobeinvited = getnotinvitedcontacts();

java - Spring-MVC : Scheduled job did not execute -

i working on spring-mvc application in using scheduling delete stuff not necessary. unfortunately, scheduled method did not fire. can tell me did wrong. here code : @repository @transactional @enablescheduling public class notificationdaoimpl implements notificationdao{ @override @scheduled(cron = "0 3 3 * * ?") public void deletenotificationsautomagically(){ session=this.sessionfactory.getcurrentsession(); long = system.currenttimemillis(); long nowminus1week = - (1000 * 60 * 60 * 24 * 3); timestamp nowminus1weekastimestamp = new timestamp(nowminus1week); query query = session.createquery("delete notelock nl nl.timestamp < :limit , nl.read=:true"); query.setparameter("limit", nowminus1weekastimestamp); query.executeupdate(); session.flush(); } } i know parameter name 1 week, deleting in 3 days. copied code .. :d nice. thanks. that cron expression looks r

javascript - Using a Dialog in Metro UI -

hi have question metro ui ( http://metroui.org.ua/dialog.html ) i'm using dialog this: <div id="testdialog" data-role="dialog" class="dialog"> <h1>simple dialog</h1> <p> dialog :: metro ui css - front-end framework developing projects on web in windows metro style. </p> </div> <script type="text/javascript"> var x_dialog = $("#" + dialogid).data("dialog"); x_dialog.options = { width: width, height: height, closebutton: true } x_dialog.open(); </script> but dialog isn't showing close button or desired width / height. are there useful examples metro ui dialogs? haven't found , api metro ui seems nice, if you're searching javascript dialogs wont find any... first of metro 3.0 till in beta still improved. contrast 2.0 relies heavily on html5 data attributes , hence can specified on html code can still m

c# - Resharper Active hotspot disabling intellisense -

Image
sometimes red box disables intellisense , have press esc few times back. not big deal gets annoying after while. know how disable whatever hotspot thing is? http://postimg.org/image/x61y97y3t/ you using resharper 'if statement' template seems. typed if , pressed tab probably. supposed enter value in red box , press tab. (other template require more steps complete)

javascript - Is there a specification of script execution order when using iframes? -

it's known , understood browsers execute <script> elements in order presented within source of page (barring defer , async etc). i've not been able establish if there specification guarantees order across <iframe> elements also. if main page contains: <html> <head> <script src="a.js"></script> </head> <body> <iframe src="inner.html" /> <!-- ... --> </body> </html> with inner.html being: <html> <head> <script src="b.js"></script> </head> <body> <!-- ... --> </body> </html> is defined in specification a.js execute before b.js ? what if main page looks this: <html> <head> <script src="a.js"></script> </head> <body> <iframe src="inner.html" /> <!-- ... --> <script src="c.j

ios - Cancel Post request in Afnetworking 2.0 -

hi making post request using afnetworking 2.0. request looks this. afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.responseserializer = [afxmlparserresponseserializer serializer]; [manager.requestserializer setvalue:@"some value" forhttpheaderfield:@"x"]; [manager post:url parameters:params success:^(afhttprequestoperation *operation, id responseobject) { //doing } failure:^(afhttprequestoperation *operation, nserror *error) { // error handling. }]; how can cancel request??? post method return afhttprequestoperation operation. can cancel calling cancel . afhttprequestoperation *post =[manager post:nil parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { //doing } failure:^(afhttprequestoperation *operation, nserror *error) { // error handling. }]; //cancel operation [post canc

about getting values from Tlist in delphi -

i storing pixel values file. file reading tlist getting following error: incompatible type : sortstring string and incompatible type : string pointer what cause this? code: segment_point, first_line_point, end_line_point: tpoint; x1, y1, x2, y2, px, py: integer; segment_point := templist.items[y]; first_line_point := mylist.items[y]; end_line_point := mylist.items[y + 1]; x1 := first_line_point.x; y1 := first_line_point.y; x2 := end_line_point.x; y2 := end_line_point.y; px := segment_point.x; py := segment_point.y; the answer simple mentioned before. "segment_point" defined tpoint. "templist.items" of type pointer (see delphi or hover mouse on code). different!!!. can't assign different types. missing code should show how deal "tlist". when expected can use cast access data like: tpoint(templist.items[y]). but please follow hints before , inform generic container!!

single user Facebook app need long life access token for Fan page same user, not working since April 29th 2015 -

i have facebook app administrator for, followed these steps in these 2 videos: https://www.youtube.com/watch?v=g1999fcmcmw https://www.youtube.com/watch?v=5tqqw3-stg4 to long life access token fan page, community fan page created same email app. app not have platform, used me single user, send updates own fan page, no log in page or website access authorise, had use graph api , tools page facebook provide access token , hard code c# console middleware program sends weather updates fan page. app appeared fine, after first attempt, pre april 29th update, app version 2.2 already. successful in getting long life token based on videos, altered steps in last 1 using 2 month access token instead of hour 1 never expire one, worked until changes made facebook on 29th april 2015, same steps produce never ending token , says success on post in graph api facebook page, when used in program says oauth exception #283 requires extended permission - mange_pages. have ticked , allowed , when ch

Jenkins Email sending fails -

i set jenkins editable email notification project trigger builds. the build runs emails not send. follwing result in console output. build successful total time: 43 seconds email triggered for: sending email trigger: sending email to: chauhanheena@gmail.com connection error sending email, retrying once more in 10 seconds... connection error sending email, retrying once more in 10 seconds... failed after second try sending email finished: success make sure smtp server configured under "manage jenkins" -> "configure system" -> "extended e-mail notification" note depending on plug-in set up, may have place configure smtp server. example under "manage jenkins" -> "configure system" -> "e-mail notification". that not needed particular plug-in may lead think have done, while not :)

wxpython - Running a packaged Python program in Ubuntu -

Image
i have written python program , cx_freeze can moved other linux machine execute, went fine, except following after freezing python code, dpkg build , marked /usr/bin/myprogram installation directory, went fine, can build , install program designated directory can change directory , ./myprogram start program, if not so, told error of missing settings.xml external file sitting beside main program resides in /usr/bin/myprogram . i want make desktop shortcut, , assume full path needed execute program without changing directory program's directory first, there can make happen? message shows missing setting.xml file when use full path run program, when first change directory , ./myprogram , works fine thanks help. a workaround create simple script cd directory , run executable ./myprogram , , call script full path desktop launcher. another way: there's path key available in desktop launcher. can set like: path=working_directory_path in .desktop f

javascript - angularjs directive to only allow alphabetic characters and numbers -

i've been trying implement directive restrict using of symbols such as @,#,$,%,^,:),:d etc. tried following directive. works first time enter can enter these symbols. there more efficient directive can use. this directive used. app.directive('onlyalphabets', function() { return { require: 'ngmodel', link: function (scope, element, attr, ngmodelctrl) { function fromuser(text) { var transformedinput = text.replace(/[^0-9a-z]/g, ''); console.log(transformedinput); if(transformedinput !== text) { ngmodelctrl.$setviewvalue(transformedinput); ngmodelctrl.$render(); } return transformedinput; } ngmodelctrl.$parsers.push(fromuser); } }; }); i think regex should be: /[^0-9a-z]+/g

sql - Find range of dates within same column -

i have data set, looks this: resourceid requirementid projectid startdate enddate billingpercentage -------------------- -------------------- -------------------- ----------------------- ----------------------- --------------------------------------- 1 5066 7505 2015-09-15 00:00:00.000 2015-09-30 00:00:00.000 50 2 4748 7499 2015-09-10 00:00:00.000 2015-09-20 00:00:00.000 50 i want calculate range , corresponding billing % particular month query is: insert @datetimeline select @monthstartdate ostartdate,@monthenddate oenddate,0 insert @datetimeline select startdate ostartdate,enddate oenddate,billingpercentage @resource_unbilled order startdate insert @datetimeline select enddate ostartdate,enddate oenddate,billingpercentage @resource_unbilled order startdate and data looks following:

openerp - Get post save event in Odoo -

i want execute function after record saved in database (something signals in django). i have tried using odoo connector no success. connector module not present in openerp.addons package default , not find resource understand how install it. how can execute function every time new record saved? i solved myself. i manually copied connector module github /usr/lib/python2.7/dist-packages/openerp/addons (to make sure it's in ide's libraries' path). installed connector settings -> local modules. used following code (can anywhere, in __init__.py of module) @on_record_create(model_names=['res.users', 'res.partner']) @on_record_write(model_names=['res.users', 'res.partner']) def delay_export(session, model_name, record_id, vals): """ real work here. """ import ipdb; ipdb.set_trace() the above code based on odoo-connector .

ruby on rails - why does git recommits all files even the ones that I did not change -

i contributing project , forked repository. i have spent few days on coding new features , when commit changes github every single fine gets recommited.... if have not changed file.. why happening, new vagrant , git. my workflow following: cd project: /rails_projects/my_project vagrant vagrant ssh cd /vagrant *****do changes here code git add . git commit -m "asdfsdf" git push is there missed vagrant or git? on windows running suggested ubuntu virtual box. maybe had create virtual box in parent directory instead of in directory of project? or deal? or supposed run git commands different directory? thanks so ended happening had cd .. to out of /vagrant file , also exit to out of vagrant ssh session. then committed github , fine. thanks!

scada - Force writing only-read register #Modbus -

i wondering, there anyway force writing on 'read-only' modbus register? defining register 'read-only' secure enough or can bypassed?? thanks answers! the correct way define "read-only" analog variable in modbus map input register. there no function code defined in modbus write input register. for historical reasons, several vendors maps variables holding registers, theoretically read/write, i.e, there's write multiple registers function. whenever map read variable holding register, must assert write functions fail. however, there's no standard exception code this, holding register should read/write. 1 of modbus' idiosyncrasies. getting question, if map variable input register, can sure protocol not allow master write it. if, interoperability issues map holding register, protocol allow master use write funcion change value, , block in device implementation.

angularjs - How can I display legend in two columns in pie chart -

i want display legend in 2 columns in pie chart. jsfiddle: http://jsfiddle.net/cp73s/2185/ itemstyle: { width:200, font: 'helvetica neue' }, try this legend: { borderradius: 0, bordercolor: 'silver', enabled: true, margin: 30, itemmargintop: 2, itemmarginbottom: 2, width:200, itemwidth:100, itemstyle: { width:100 } } fiddle link :)

javascript - How to design step progress bar using jquery,css -

i spent 3 days. tried design step step progress bar below. ====(discount 10 %)======(discount 20 %)=====(discount 30 %)======== fill dynamically how can searched on google every thing tried customize not success far. thanks i've made inspire (not sure if it's try do). $(document).ready(function() { $('#discount').on('change', function() { $('#discount-bar').css({'width' : $(this).val() + '%'}); }); }); select { margin-bottom: 12px; } .discount-bar-container { position: relative; width: 400px; height: 30px; border: 1px solid black; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .discount-bar-container .discount-bar { position: absolute; display: block; height: 100%; width: 0; background-color: red; transition: width 0.4s; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></scrip

What's the best protocol for live audio (radio) streaming for mobile and web? -

i trying build website , mobile app (ios, android) internet radio station. website users broadcast music or radio , mobile users listen radio stations , chat other listeners. i searched week , make prototype wowza engine (using hls , rtmp) , shoutcast server on amazon ec2. using hls has delay 5 seconds, rtmp , shoutcast has 2 second delay. result think should choose rtmp or shoutcast. but not sure rtmp , shoutcast best protocol. :( what protocol should choose? need provide various protocol cover platform? this broad question. let's start distribution protocol. streaming protocol hls has advantage of allowing users stream in bitrate best connection. clients can scale up/down seamlessly without stopping playback. particularly important video, audio mobile clients capable of playing 128kbit streams in areas. if intend have variety of bitrates available , want change quality mid-stream, hls protocol you. the downside of hls compatibility. ios supports it

javascript - Multiple Inheritance in Node js with constructor set in parent class -

how can set constructor in parent class , call object in class inherited parent class. parent class: var request = resuire('request'); var = function(options) { if(!(this instanceof a)) { return new a(options); } var self = this; self.id = math.random(); self.baseurl = 'http://example.com/'; self.options = options || {uri: self._baseurl}; } a.prototype._request = function reqest(options, callback){ var self = this; request(options, function(err, res, body){ self._determineresponse(err, res, body, function(){ return body; }, callback); } } child class: var util = require('util'); var = require('a'); var b = function(){ var self = this; } b.prototype.auth(username, password, callback) { // access parent method (private or public) here perform request a._request .... } util.inherits(b, a); query: how set parent constructor best way access parent method

php - In PDO is there a difference in performance if a int is quoted as a string? -

is there difference in performance if integer bound string in prepared pdo query? in mysql queries work either if value bound int or string, there difference in performance, or pitfalls when doing that? $pdo = new pdo( "mysql:host={$host};port={$port};dbname={$dbname};charset=utf8", $username, $password ); $statement = $pdo->prepare("select * `table` `id` = :param"); // there performance difference between 2 rows below $statement->bindvalue(":param", 5); $statement->bindvalue(":param", 5, pdo::param_int); $statement->execute(); is there difference between binding parameter , specifying type, or quoting string? if want take method specify type faster not specify type , default type pdo::param_str . if run 1 million time avarage followed: int type specified: 0.53 seconds ( $stmt->bindvalue(":param", 5, pdo::param_int); ) no type specified: 0.66 seconds ( $stmt->bindvalue(":para

iOS Send Push Notification to a device WITHOUT an application? -

is possible send push notification device, without installing specific app receving it? i know how send regular push notification, need install app receive them. wondering if there way sending notifications directly device. if so, need? have device token , other information, using mdm . if not apple not possible. for other developers, user needs allow send him notifications , need have app installed. also, if deletes app, apple interpret don't want have information app anymore - including notifications. the way sending emails or sms ;)

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

cordova - ios-sim launch Error=ExecutableTwiddleFailed, ErrorDescription=Failed to chmod file-No such file or directory -

i new using ios-sim command directly run ios app file in simulator. i have installed ios-sim following this link. when fire following command run app in simulator: ios-sim launch /users/path/desktop/myapp.es.app the simulator starts , following error , simulator stops: session not started: error domain=launchserviceserror code=0 "the operation couldn’t completed. (launchserviceserror error 0.)" userinfo=0x7fcd59506e90 {error=executabletwiddlefailed, errordescription=failed chmod file:///users/path/library/developer/coresimulator/devices/88d95c8e-de0e-4687-9fa5- 990a45e3bbb4/data/library/caches/com.apple.containermanagerd/temp/bundle/application/b025f33f-f9f3-4273-9d72- d824fcd2e508/myapp.es.app/myapp.es : no such file or directory} where getting wrong? how solve this? i ran problem. can check see if file there using finder: locate .app directory right-click > show package contents you should see unix executable file within directory s

javascript - Calling JSP Custom Tags tld through Ajax -

so trying implement ajax functionality webapp. have tag library, tag handlers, set properly, if call tags when page refreshing. these custom tags work. however, have never implemented ajax in life , stuck on how proceed call these tags dynamically based on changes in webpage. e.x: custom tag library under --> /web-inf/tld tag handlers --> classes/classhandlers/tag1...tagxxx with above calling following tag in jsp file works perfectly: <taglib:tagname attribute1="" attribute2=""> however, how can dynamically inserted ajax? please let me know if can provide more details. well, said impossible. ajax , jsp 2 incompatible technologies. jsp tags can used on server side (during generating html) while ajax client side technology (it runs in user browser). can read more client-server model here .

r - ggplot2 : Plot mean with geom_bar -

Image
i have following data frame: test2 <- data.frame(groups = c(rep("group1",4), rep("group2",4)), x2 = c(rnorm(4), rnorm(4)) , label = c(rep(1,2),rep(2,2),rep(1,2),rep(2,2))) and plotting bar graphs each label per group using: ggplot(test2, aes(label, x2, fill=as.factor(groups))) + geom_bar(position="dodge", stat="identity") however, cannot seem able find stat="mean" can plot means on each bar graph instead of identity. thanks help. simply use stat = "summary" , fun.y = "mean" ggplot(test2) + geom_bar(aes(label, x2, fill = as.factor(groups)), position = "dodge", stat = "summary", fun.y = "mean")

OneNote and c# code to execute a VBA macro -

my goal make free add-in onenote child have computer @ school. here ribbon i've done daughter in word: image http://pro.ellip6.com/sebastienforum/wordribbon.jpg actually i've modify onenote ribbon add buttons need add code execute simple function. select red pen underline selected text add border selected text modify style. once i've found how make 1 command , easy rest. i've found onenote page xml file possible inject text in page button. example : rouge => make rouge in red. thks

c++ - Do multiples of Pi to the thousandths have a value that may change how a loop executes? -

recently decided c++, , after going through basics decided build calculator using iostream (just challenge myself). after of complete, came across issue loop exponents. whenever multiple of pi used exponent, looped way many times. fixed in redundant way , i'm hoping might able tell me happened. unfixed code snippet below. ignore above , @ last bit of functioning code. wondering why values of pi throw off loop much. thanks. bool testfordecimal(double num) /* checks if number given whole or not */ { if (num > -int_max && num < int_max && num == (int)num) { return 0; } else { return 1; } } and heres goes wrong (denominator set value of 1) if (testfordecimal(power) == 1) /* checks if decimal or not */ { while (testfordecimal(power) == 1) { power = power * 10; denominator = denominator * 10; } } if give me explanation great! to clarify further, while loop kept looping after power became whole nu

c# - ComboBox SelectedItem Binding does not work -

i have datagrid 4 columns. <datagrid itemsource="{binding mydataset,mode=twoway}"> <datagrid.columns> <datagridtemplatecolumn> <datagridtemplatecolumn.celltemplate> <datatemplate> <textblock ...../> </datatemplate> </datagridcolumn.celltemplate> </datagridtemplatecolumn> <datagridtemplatecolumn> <datagridtemplatecolumn.celltemplate> <datatemplate> <textblock ...../> </datatemplate> </datagridcolumn.celltemplate> </datagridtemplatecolumn> <datagridtemplatecolumn> <datagridtemplatecolumn.headertemplate> <datatemplate> ............. </datatemplate> </datagridtemplatecolumn.headertem

sprite kit - How to present SKNode as SKTransition.fadeWithColor do? -

i want add skspritenode scene size equal skview.frame.size . , don't know timing function of sktransition.fadewidthcolor , can tell me? it's hard tell you're asking, believe you're asking timing of sktransition's animation. sktransition has linear timing.

Get active excel workbook object in javascript -

currently code running is: var excel = new activexobject("excel.application"); var excel_file = excel.workbooks.open("filepath"); var excelsheet = excel_file.activesheet; var noofsubs = excelsheet.cells(24,3).value; excel.workbboks.open commands opens excel file. how reference open excel file? maybe var excel_file = excel.activeworkbooks.activate("excelfilename"); typically you'd use getobject() if there's instance of excel running , want reference that. note though if there >1 instance running, 1 can't controlled script. https://msdn.microsoft.com/library/7tf9xwsc%28v=vs.94%29.aspx var xl; try { // existing instance running ? xl = getobject("", "excel.application"); } catch(e) { // excel wasn't running: start new instance xl = new activexobject("excel.application"); }

javascript - Element disappears after the re-appear animation completes -

can give me insight why element disappears (gets hidden) after re-appearing animation completes upon hitting toggle switch .project-list 3rd time. there flaw in if/else statement? here css animation classes slidedown (disappear) , slideup . http://www.justinaguilar.com/animations/css/animations.css var main = function() { var enabled = false; //$('#project-box').hide(); $('.project-list').click(function() { debugger; if (enabled == false) { $('#project-box').addclass("slideup"); $('#project-box').removeclass("slidedown"); enabled = true; $('#project-box').show(); } else { $('#project-box').removeclass("slideup"); $('#project-box').addclass("slidedown"); enabled = false; $("#project-box").on('webkitanimationend', function() { $('#project-box').hide();