Posts

Showing posts from August, 2012

javascript - How to make object move in js? -

i'm trying learn object oriented programming in javascript try make simple game. make character moves. there code in js: function move(event) { var k=event.keycode; var chr = { updown : function (){ var y=0; if (k==38) {--y; }else if (k==40) {++y;} return y; }, leftright : function (){ var x=0; if (k==37) {--x; }else if (k==39) {++x;} return x; } }; chrid.style.top = (chr.updown())+"px"; chrid.style.left = (chr.leftright())+"px"; } html: <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="jumpopp.css"> <script src="jumpopp.js"></script> </head> <body onkeydown="move(event)"> <img id="chrid" src="trackingdot.png"

python - Cast types on the fly while creating dataframe -

i have kind of partial json object, dict: { u'20140816 00': {u'var': u'40.78'}, u'20140816 01': {u'var': u'53.24'}, u'20140816 02': {u'var': u'50.23'}, ... } and want put in pandas dataframe. however, change keys string datetime (datetime.strptime(key, '%y%m%d %h') , cast var value string float. is possible while creating pandas dataframe, or if not easiest way recast types json object pandas dataframe. you can use convert_objects method convert strings desired dtypes. normally read_ methods have date handling param , these can handle formats. in case, seeing convert_objects doesn't quite want can call pandas method to_datetime convert column so: df['time_col'] = pd.to_datetime(df['time_col'])

java - Using Jackson annotations with inherited class -

i'm developing android app i'm deserializing json jackson annotation api. it worked until tried include androidactive orm, required pojo inherit model class ( https://github.com/pardom/activeandroid/blob/master/src/com/activeandroid/model.java ). my json deserialized in asynctask such : reader reader = new inputstreamreader(url.openstream()); try { objectmapper mapper = new objectmapper(); mapper.configure(deserializationfeature.fail_on_unknown_properties, false); rootjsonobj = mapper.readvalue(reader, mypojo.class); } catch (jsongenerationexception e) { e.printstacktrace(); } a quick @ pogo : @table(name = "rootrecipes") //androidactive annotation public class rootrecipes extends model { @jsonproperty("deleted") //jackson annotation @column(name = "deleted") //androidactive annotation public arraylist<number> deleted; @jsonproperty("meta") @column(name = "meta") pu

How can I query a joints sao (secondary axis world orientation)? Maya Python -

i want query sao of 1 joint can assign another. in case have managed oj of lowarm via .jot , , i'm trying similar sao . mc.joint ('l_hand_jnt', e=1, oj=mc.getattr ('l_lowarm_jnt.jot'), sao='yup', zso=1) any or advice awesome, thanks! i don't think joints have 'sao' attribute: flag there allow specify secondary axis when aligning joint because single orientation not provide enough information maya lay out joint: aim constraint need tell maya how solve given target since there infinite number of valid solutions. you can, however, each 'axis' of joint parsing it's world space matrix or using locators. if extract world matrix of joint using worldmat = cmds.xform(q=true, m=true, ws=true) then joint' x axis pointing along world vector worldmat[0:3] , local y worldmat[4:7] , local z worldmat[8:11] . if want graphically, create locator, parent joint 1 unit along axis checking, , world position - world posi

c - Assigning stdout to a FILE* -

as code global scope in small c program have: file *outfile = stdout; this because want have stdout default destination output allow users specify different 1 on command line (though know redirect wanted belt , braces). this fails compile: xmlheap.c:15:17: error: initializer element not compile-time constant file *outfile = stdout; ^~~~~~ /usr/include/stdio.h:215:16: note: expanded macro 'stdout' #define stdout __stdoutp is not possible? static initializers in c have compile-time constants. since stdout not required such, have initialize global variable in dynamic program execution: #include <stdio.h> file * outfile; int main(void) { outfile = stdout; /* ... */ } (specifically (cf. c11 7.21.1/3), stdout mereley specified macro expands "expressions of type "pointer file "".)

SQL Server: error with Transaction and Update statement -

i trying update 2 tables in row part of else statement. therefore wrapped update statements in transaction thought correct approach getting following error when trying execute this. variables declared @ beginning of stored procedure. can tell me missing or doing wrong here ? msg 156, level 15, state 1, line 1 incorrect syntax near keyword 'else'. msg 137, level 15, state 2, line 4 must declare scalar variable "@parentid". msg 137, level 15, state 2, line 11 must declare scalar variable "@lastupdate". my sql (update: posting full query): alter procedure [dbo].[moc_updatenav] @itemid int, @parentid int, @itemname nvarchar(100), @linkref nvarchar(2000), @sortid int, @lastupdate nvarchar(50), @modby varchar(50) begin set nocount on; if not exists ( select * moc_links itemid = @itemid ) insert moc_links ( parentid,

javascript - Importing multiple AngularJS module's factories -

i wondering if there way import factories i've defined in angularjs module controller without having list them all. have file named foo.js containing: angular.module("foo", []) .factory("bar1", function() {...}) .factory("bar2", function() {...}) .factory("bar3", function() {...}) .factory("bar4", function() {...}); now, in controller.js file have: angular.module("myapp.controllers", ["foo"]). controller("mainctrl", ["bar1", "bar2", "bar3", "bar4", function(bar1, bar2, bar3, bar4) { //do stuff various bars }]); i wondering if there's elegant way controller, since imports module foo , see factories (or providers, or services, or directives matter of fact). yes, possible. you can dynamically load module examine _invokequeue field (see https://stackoverflow.com/a/19412176/646543 ) in order retrieve names of factories/controllers/etc

node.js - Response returns a 302 instead of a 401 http status -

i'm building rest api using express , want add authetication app. on client side have angularjs application. i have code authentication request app.get('/auth/google', passport.authenticate('google')); but code returns 302 http status, isn't helpful in rest api application. guess 401 status code more helpful. i have installed passport-google 0.3 am missing here ? i doubt passport-google has been intended used rest api. 302 redirect status code. passport-google expects /auth/google page has been opened in browser, it's redirecting user google.com authentication dialog. try opening in browser , happen. update: i have feeling picked wrong tool. @ passport-localapikey module , or search other rest authentication solution. i don't think you'll able use passport-google pure rest api without hacking (e.g. monkey-patching internal parts).

centos - How to identify with Powershell if Hyper-v VM has reached login screen -

i have created centos 7 minimal vm running under hyper-v. have installed transmission , set start service on boot using systemctl enable transmission-daemon.service i want write powershell script start server, wait until active , open url see transmission web interface. i have used get-vmintegrationservice returns value of ok heartbeat partway through boot. i've therefore had resort start-sleep wait 15 seconds when script opens browser doesn't timeout. is there way establish login screen has been reached? or more elegant way of doing this? this current startup powershell script: $vmtostart="centos_7_minimal" $url="http://"+$vmtostart+":9091/" if ((get-vmintegrationservice $vmtostart | ?{$_.name -eq "heartbeat"}).primarystatusdescription -ne "ok") { write-host "starting transmission server..." -foregroundcolor "blue" start-vm $vmtostart {start-sleep -milliseconds 100}

google admin sdk - Where is Manage third party OAuth Client access -

trying access google admin sdk directory , getting error:   accesstokenrefresherror: access_denied has been asked before here on stackoverflow , answer points document: https://developers.google.com/drive/web/delegation#delegate_domain-wide_authority_to_your_service_account however, if follow instructions , go security/advanced setting on google domain control panel, don't have manage third party oauth client access option, , can see these: manage oauth domain key federated login using openid manage oauth client access is there new document? restricted non-free google apps accounts? manage third party oauth client has been renamed manage oauth client access seems. go manage oauth client access in security setting, , input client id in 'client name' field , scope want grant (put in entire url. ex: https://www.googleapis.com/auth/drive ) in "one or more api scope" field. once click 'authorize', scope granted. updated september 24

java - Reformatting a String with Particular Pattern -

i'm working on silly calendar widget work, , 1 of things i'm trying reformat how rooms/locations show up. each conference room appears in 1 of following ways: dfw-d04-alpha (10) conf dfw alpha d04 something totally different (like "meet @ desks") the ideal format conference rooms representation this: alpha (dfw d4) in "totally different" case, preserve it in example, dfw city (always 3 character abbreviation). d04 building/floor (d building, 4th floor). alpha actual "name" of conference room. , (10) capacity. i've got implemented substrings , find replace determine format (if either) , rebuild in new format. , right now, it's extremely hard coded. i feel should able in few lines of code. recommendations? picking groups apart in scala (which uses java regex): scala> val r = """(\w{3})-(\p{alpha})(\d+)-(\w+) \(\d+\)|conf (\w{3}) (\w+) (\p{alpha})(\d+)|(.+)""".r scala> de

boost - Extract substring defined by start and end strings (C++) -

given std::wstring text , std::wstring start , std::wstring end , goal extract std::wstring text_out - containing text in between start , end - if exist in text . note: if multiple matches start exist - consider first one, end - consider last match. this works, there more elegant solution? boost::iterator_range<wstring::iterator> it_start = boost::find_first( text, start); boost::iterator_range<wstring::iterator> it_end = boost::find_last( text, end); if (it_start.empty() == false && it_end.empty() == false) { text_out.assign( it_start.begin(), it_end.end() ); } else if ( it_start.empty() == false && it_end.empty() == true ) { text_out.assign( it_start.begin(), text.end() ); } else if ( it_start.empty() == true && it_end.empty() == false ) { text_out.assign( text.begin(), it_end.end() ); } i not see need use boost. same task can done using standard functions. example #include <iostream> #include <string

Python's time.sleep() method waits incorrect amount of time -

i've run problem few times; restarting python seems work (or ipython). but, instance, here's 1 possible output of running following code: startt = time.time() in range(4): time.sleep(1) print '%.3f'%(time.time()-startt) i obtain: 9.989 10.989 11.990 12.991 why wait long before begins working? occasionally, start @ 10 or 11 seconds after run command. i'm using mac os x (mavericks), ipython 1.2.1 (with pylab), python 2.7.5 i'm importing: os, cv2, time, random, quartz, launchservies, pdb, sys, appscript, , numpy. as per time.sleep docs : suspend execution given number of seconds. argument may floating point number indicate more precise sleep time. actual suspension time may less requested because caught signal terminate sleep() following execution of signal’s catching routine. also, suspension time may longer requested arbitrary amount because of scheduling of other activity in system. the actual wait time of time.sleep n

php - No input file specified in Homestead -

i'm creating laravel project vagrant , homestead. whenever create project mapped ' laravel ' directory/project name, works. however, encounter problems whenever remove ' laravel ' want use different project name. i'm mapping correctly still receive 'no input file' message. here specs: php -v php 5.5.15rc1 (cli) (built: jul 15 2014 11:14:55) copyright (c) 1997-2014 php group zend engine v2.5.0, copyright (c) 1998-2014 zend technologies zend opcache v7.0.4-dev, copyright (c) 1999-2014, zend technologies xdebug v2.2.5, copyright (c) 2002-2014, derick rethans homestead.yaml (the working verison) --- ip: "192.168.10.10" memory: 2048 cpus: 1 authorize: /users/name/.ssh/id_rsa.pub keys: - /users/name/.ssh/id_rsa folders: - map: /users/name/homestead/code to: /home/vagrant/code sites: - map: homestead.app to: /home/vagrant/code/laravel/public variables: - key: app_env value: local to drag ou

ios - Font color for UILabel not changing -

Image
i trying display numbers on uilabel bold black font , size 50. after failed attempts realized no matter color set font to, gets set lightgray. there else need other below? [displaylabel setfont:[uifont fontwithname:[nsstring stringwithutf8string:"helveticaneue-bold"] size:50]]; displaylabel.textcolor = [uicolor browncolor]; displaylabel.textalignment = nstextalignmentcenter; i adding label using storyboard view. make sure label's behavior that.

java - 0.00 should not be the answer -

package companyemployees; public class doemployeepayroll { public static void main(string args[]) { fulltimeemployee ftemployee = new fulltimeemployee(); ftemployee.setname("barry burd"); ftemployee.setjobtitle("ceo"); ftemployee.setweeklysalary(5000.00); ftemployee.setbenefitdeduction(500.00); ftemployee.cutcheck(ftemployee.findpaymentamount()); system.out.println(); parttimeemployee ptemployee = new parttimeemployee(); ptemployee.setname("steve surace"); ptemployee.setjobtitle("driver"); ptemployee.sethourlyrate(7.53); ptemployee.cutcheck(ptemployee.findpaymentamount(10)); } } package companyemployees; import static java.lang.system.out; public class employee { private string name; private string jobtitle; public void setname(string namein) { name = namein; } public string getname() { return

android - intel XDK camera view is not working -

i creating augmented reality application using intel xdk.when load app in "intel app preview" app, see red background , no camera view when hold device in vertical position. else seems work.why dont see camera view ? this codes <!doctype html> <html> <head> <title>nearby</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="copyright" content="&copy; 2013, intel corporation. rights reserved." /> <meta name="author" content="nadeesha" /> <!-- * copyright (c) 2013, intel corporation. rights reserved. * please see http://software.intel.com/html5/license/samples * , included readme.md file license terms , conditions. --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="apple-mobile-web-app-capable" co

parse.com - Detect Facebook login failure -

i'm using pfloginviewcontroller subclass in app allow users login facebook works great, if user changes mind , denies app access facebook account, login stops working(as expected) loading indicator spins. never receive error telling me couldn't login, it's infinite loop. any idea how detect failure , stop ui displaying loading indicator? code below, straight subclassing visual tweaks. - (void)viewdidload { [super viewdidload]; // customize default parse login view [self setupui]; } - (void)setupui { [self.loginview setbackgroundcolor:[uicolor colorwithpatternimage:[uiimage imagenamed:@"bg"]]]; [self.loginview setlogo:[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"fdbk_logo"]]]; // set buttons appearance [self.loginview.facebookbutton setimage:nil forstate:uicontrolstatenormal]; [self.loginview.facebookbutton setimage:nil forstate:uicontrolstatehighlighted]; [self.loginview.facebookbutton setbac

terminal - ANSI escape code ESC[0E doesn't work as expected -

i trying out example code this answer . #include <iostream> #include <thread> #include <chrono> void drawprogressbar(int, double); int main() { drawprogressbar(30, .25); std::this_thread::sleep_for(std::chrono::seconds(1)); drawprogressbar(30, .50); std::this_thread::sleep_for(std::chrono::seconds(1)); drawprogressbar(30, .75); std::this_thread::sleep_for(std::chrono::seconds(1)); drawprogressbar(30, 1); return 0; } void drawprogressbar(int len, double percent) { std::cout << "\x1b[2k"; // erase entire current line. std::cout << "\x1b[0e"; // move beginning of current line. std::string progress; (int = 0; < len; ++i) { if (i < static_cast<int>(len * percent)) { progress += "="; } else { progress += " "; } } std::cout << "[" << progress << "] " << (s

travis ci - Different configs in each git branch -

i have 2 git branches: dev , master i'm using travis ci builds , testing , need have different .travis.yml , config.yml.enc (encrypted config file) each branch/environment. how merge changes dev->master without merging .travis.yml , config.yml.enc files? you have multiple options here (on master branch): you can either run: git merge --no-commit dev git checkout .travis.yml git checkout config.yml.end git commit -m "merge dev master" this merge files revert 2 files last master commit. or can run (if commit history setup way): git cherry-pick commit_hash adding commits files not modified.

javascript - XML update and Insert -

(xml) <leapdeck> <user> <id_user>1</id_user> <name>adam</name> <notif>200</notif> </user> <user> <id_user>2</id_user> <name>budi</name> <notif>100</notif> </user> </leapdeck> my question is.. i need update user's its like, update adam's notif 200. the last questions is... how insert new user xml <user> <id_user>3</id_user> <name>brian</name> <notif>3</notif> </user>

What's the difference between the Protocol Buffers and the Flatbuffers? -

both serialization library , developed google developers. there big difference between them? hard work transferring code protocol buffers flatbuffers? i wrote detailed comparison of few serialization systems, including protobufs , flatbuffers, here: https://kentonv.github.io/capnproto/news/2014-06-17-capnproto-flatbuffers-sbe.html however, comparison focuses more on comparing 3 new "zero-copy" serialization systems, , includes protobufs reference point. also, i'm author of cap'n proto, , author of protobufs v2 (i responsible open sourcing protobufs @ google), comparison may biased. note protobufs used throughout google's own services, whereas flatbuffers more of experimental project understand has not been adopted internally.

asp.net mvc - By clicking submit button when form fields are not validated ReturnUrl from browser vanished -

Image
by clicking submit button when form fields not validated returnurl browser vanished. before clicking submit button browser seems like. after clicking submit button(while form fields not validated till) browser seems like. how maintain same browsing address after clicking submit button after login should redirect page.? here action code [httppost] [allowanonymous] [validateantiforgerytoken] public actionresult login(loginmodel model, string returnurl) { if (modelstate.isvalid) { if (membership.validateuser(model.username, model.password)) { formsauthenticationticket authticket = new formsauthenticationticket(1, model.username, datetime.now, datetime.now.addminutes(30), // value of time out property false, // value of ispersistent property string.empty, formsauthentication.formscookiepath); string encticket = formsauthentication.encrypt(authticket);

c# - Clipboard doesn't work when I load my main executable assembly manually -

i have c# project running vc++ project. i've used clipboard in c# project; when i'm running c# project vc++ doesn't work properly. my c# code: idataobject dataobject = clipboard.getdataobject(); if (dataobject.getdatapresent("mytype",true)) //this returns true in both of cases console.writeline("here"); object obj = dataobject.getdata("mytype"); //obj null mytype data = obj mytype; // when copy data normal program called program (from vc++) null apparently can not use clipboard in projects not stathread . entry point of c# project stathread don't know how can make vc++ project stathread ? edit: application.olerequired() == apartmentstate.sta returns true , thread stathread . just add above main [system::stathread]

what is the meaning of percent symbol(%) and sharp symbol(#) in c++ template -

here code ms vc stl: template<typename _fun_t, typename _arg_t> inline binder1st<_fun_t> bind1st(_fun_t% _func, _arg_t _left) { // return binder1st functor adapter typename _fun_t::first_argument_type _val = _left; return (binder1st<_fun_t>(_func, _val)); } and qt: #define q_arg(type, data) qargument<type >(#type, data) neither of these specific templates. the '%' microsoft extension c++, part of c++/cli. defines tracking reference. normal lvalue reference variable of type t& reference variable; t% except refers managed object might moved garbage collector; gc knows when moves objects has patch tracking references object. '#' stringify operator of c preprocessor. means value of following macro argument, surrounded double quote marks. this: q_arg(mytype, 12345) will expand this: qargument<mytype >("mytype", 12345);

android - How to set the white color to google+ log in button? -

i using google+ login app. want change color of button red white .here xml code. <com.google.android.gms.common.signinbutton android:id="@+id/btn_sign_in" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/logo" android:layout_centerhorizontal="true" android:layout_margintop="30dp" > try way signinbutton = (signinbutton) findviewbyid(r.id.signinbutton); signinbutton.setsize(signinbutton.size_standard); signinbutton.setcolorscheme(signinbutton.color_light);

sending an email with attachment using python script -

i'm using code given in tutorialspoint.com sending email attatchment. code works fine , i'm recieving emails problem when upload text file looks this: |checks| |status| |remarks| echconnect checked model connected echpenetra checked echpenet: 2436 elements penetrate/touch each other echcharlen not_checked echcoincid checked no coincident elements echedgelen checked shortest edge length = 1. emsamenorm checked no elements have reoriented eebeam checked 34 elements modified according window settings outline checked free edges displayed in green the text file recieve pretty messed indentation. want similar this. how can that? code used follows: #!/usr/bin/python import smtplib import base64 filename = "/home/hamanda/desktop/transfer/new_result.txt" # read file ,

node.js - why latency varies in web socket when it's a static connection? -

as http creates connection again , again each data transferred on network, web sockets static , connection made once , stay until transmission done...but if web sockets static why latency differs each data packet..??? the latency test app have created shows me different time lag.. advantage of web socket being static connection or if common issue in web sockets ?? do need create buffer control flow of data because data transmission in continous..? latecy increases when data transmission continous? there no overhead establish new connection statically open web socket (as connection open , established), when you're making request half way around world, networking takes time there's latency when you're talking server half way around world. that's how networking works. you near immediate response server on own lan , further away server gets (in terms of network topology) more routers each packet transit through, more total delay there is. witnes

java - How to get RGBA color value of an image pixel in python -

i'm trying convert java code python: bufferedimage image; fileinputstream fstream1 = new fileinputstream("image.png") image = imageio.read(fstream1); int max = -40000000; //java rgb returns negative values (int = 0; < 128; i++) { (int j = 0; j < 255; j++) { color = image.getrgb(j, i); //returns integer ..... i tried in python: from pil import image image = image.open("image.png").convert("rgba") pixels = image.load() in range(128): j in range(255): color = pixels[j, i] #returns (r, g, b, a); the problem i'm getting different values in python. why java returns negative integer values , how same result in python? this function should convert colour python format java format: def convertpixel(c): x = c[0] << 16 | c[1] << 8 | c[2] | c[3] << 24 if x >= 1<<31: x -= 1<<32 return x note python's format sane - gives exact r, g, b , values

How to select multiple columns using sum projection with group by in Hibernate -

my mysql query is: select c.first_name, c.middle_name, c.last_name, s.ticker, count(s.ticker), sum(t.cumulative_qty), sum(cumulative_balance) client_master c, security s, transaction_master t c.id = t. client_master_id , s.id = t.security_id , t.client_master_id = 4 group t.security_id; this query returns exact result. want write hibernate criteria has matching result. tried: criteria criteria = createentitycriteria(transactiondetails.class, "tr") .createalias("tr.client", "cl") .createalias("tr.security", "se") .add(restrictions.eq("cl.id", clientid)) .setprojection(projections.sum("tr.cumulativeqty")) .setprojection(projections.groupproperty("tr.securityid")); return criteria.list(); but criteria returning list of tr.securityid . want rows. going wrong? you can not s

javascript - my ajax and php don't fully work on godaddy -

i have troubled getting info php file insert godaddy's database , found don't $_post because works fine in localhost . this connection anyway: <?php $test = mysql_connect("xx.xx.xxx.xx:xxxx","travelxxxxx","xxxxxhotel2014"); mysql_select_db("hotelxxxx"); ?> and after submit infos, javascript must prompt me message either data inserted or not it's not. after clicking submit button inserts few data on database don't prompt me. here's image of database: http://i58.tinypic.com/71h20z.png and here's website: site hope me :) i think must read how turn off magic_quotes_gpc on godaddy because think using mysql_real_escape_string if i'm not mistaken. your table fill blank when mysql_real_escape_string data. , if choose not mysql_real_escape_string it, data not inserted table.

unity3d - unity 3d rotate the gameobject according to accelerometer -

i want make game temple run. need rotate platform of player according how tilt device. trying accelerometer not game object tilted. please guide me. thanks this code using code in comments im trying use code out of comments public class tilt : monobehaviour { vector3 dir; float movespeed; bool istilt; // use initialization void start () { dir=vector3.zero; movespeed=10.0f; istilt=true; } // update called once per frame void fixedupdate() { //dir.x=-input.acceleration.y; //transform.translate(dir.x,0,0); //transform.translate(input.acceleration.x, 0, -input.acceleration.z); //vector3 vec = physics.gravity; /*vec.x = -physics.gravity.z; vec.z = physics.gravity.x; vec.y = 0; transform.rotation = quaternion.euler(vec);*/ /*movespeed=-input.acceleration.y; transform.rotate(vector3.up*movespeed*5.0f); */float zmovment = input.getaxis("horizontal");//-input.acceleration.y; float xmovment = input.getaxis("vertic

c# - Mapping SignalR Users to Connections in Groups -

how can add/remove user group using userid groups.add(userid,"groupname") that use in database instead of using connectionid groups.add(connectionid,"groupname") i created mapping here ! using user id provider method , able this clients.users(userid).sendmessage("asa") but groups.add(userid,"groupname") it not working. how can make groups.add(userid,"groupname") work? there special mapping don't know or using 1 wrong? it not possible add userid group. should use connectionid . depending of needs can use 1 of approaches described in the link provided . for example, can add each connection group named userid : groups.add(context.connectionid, userid); and can send messages specified user: clients.group(userid).sendmessage("asa"); another use case may include determining userid in onconnected method , adding user needed group connectionid : var groupname = getgroupnamebyuserid(user

javascript - OnChange event not triggered -

i trying achieve convert uppercase while user type attaching following function on key up. function changecharcase(evt,obj,upper) { if(obj.value != obj.value.touppercase()) obj.value = obj.value.touppercase(); return true; } that seems working fine until attach on change event input text, , figured out , on change event not triggered @ on ie 11 , chrome . on firefox, seems okay. you can check case here. http://jsfiddle.net/zt8oqaw5/4/ you see , onchange event never triggered on first input text on browsers mentioned above. does know why? how can achieve character case conversion ? can't set css here because want value changed actually, not display. personally use onkeyup or onblur instead of onchange text boxes. maybe can give try.

c# - Prevent unwanted access to my web service -

i have coded c# mvc5 internet application , have web api 2 web service returns json data. retrieving json data in android application. how can add feature web service such android application can retrieve json data? wanting other web users cannot hammer url , web service not send data unwanted applications and/or users. is possible? if so, how should this? thanks in advance. you have various ways achieve in fact. for example, can store key in android application , use send key request webapi. webapi check if key valid , if is, return json. however, there's no way ensure nobody else can request , data. example reverse engineering android application , extracting key, or monitoring network traffic , find key in there. you need understand there isn't anthing guarantuees 100% security. see following: you have open door right now, can close little little, closing , locking down not possible. there gap. house can't made burglar proof, can make hard bu

How to tell PostgreSQL to use other Perl-Version? -

im working on ubuntu 14.04 64bit machine. need use perl 5.14 work modules wont install newest version of perl (5.18). postgresql-9.3 server needs install perl 5.18 while installing postgres-plperl. therefore want tell postgres use 5.14 version havent found way that. there way that? you must recompile plperl extension against 5.14 if need this. postgresql links against perl library, , perl libraries aren't abi-compatible across releases, can't substitute 5.14 5.18 @ runtime. you can change perl version used performing install of postgresql source , specifying correct perl install path configure using --with-perl or path env var. or can apt-get source postgresql-9.3 , edit debian/rules use desired perl, edit debian/control specify correct perl dependency, , rebuild package. it makes lot more sense instead fix modules.

vba - Search sheet and copy cell values -

i have sheet called names has information on multiple individuals. want go through entire column searching name of person, name of person value input textbox1 . once name found go on 2 columns there address stored , put value variable. once done want go sheet called summary , paste value cell l2 . know how loop through values getting stuck rest. below shows have far: set rng = range("c1:c1000") each cell in rng if cell.value <> textbox1.value end if next cell you try: if cell.value = textbox1.value var = cell.offset(0,2) sheets("summary").range("l2") = var end if

configuration - mod_proxy: how to proxy requests begin with app* to single balencer -

my requirement proxy request request starts app single balencer proxypass /app balancer://ajpcluster1/app stickysession=jsessionid proxypassreverse /app balancer://ajpcluster1/app stickysession=jsessionid proxypass /app1 balancer://ajpcluster1/app1 stickysession=jsessionid proxypassreverse /app1 balancer://ajpcluster1/app1 stickysession=jsessionid proxypass /app2 balancer://ajpcluster1/app2 stickysession=jsessionid proxypassreverse /app2 balancer://ajpcluster1/app2 stickysession=jsessionid i want replace above single proxypass below proxypass /app* balancer://ajpcluster1/app* stickysession=jsessionid proxypassreverse /app* balancer://ajpcluster1/app* stickysession=jsessionid

python - Filter on many to many table django -

i have following show table in django. want have filter on showinfo gives me 4 result. want related shows of 4 shows without loop. because loop gives me duplicated values. want related shows of filtered show distinct without loop. class showinfo(models.model): name = models.charfield(max_length=250) related_shows = models.manytomanyfield('self', blank=true, related_name='all_related_shows', symmetrical=true) when working specific show, can this: s = showinfo.objects.get(pk=id) #assuming id id of specific show s.related_shows.all() #this return shows without duplicates. now, if want 4 results: s.related_shows.all()[:4] to iterate on related_show can: for r in s.related_shows.all(): r.related_shows.all() it not give duplicated results. but, if want results not duplicated in whole set, can use set: all_results = [] r in s.related_shows.all(): all_results.append(show r.related_shows.all()) set(all_results) #this show set all_s

Main report and sub report parameter in crystal report -

i’m going use main report , sub report showing details. main report has invoiceheader part , sub report has invoice detail part. invoice header , invoice detail has 2 sps. sp_invoiceheader (use main report) alter procedure [dbo].[testsp1] @invnoh varchar(20) begin select * inv_header invno=@invnoh end sp_invoicedetail (use sub report) alter procedure [dbo].[testsp2] @invno varchar(20) begin select * inv_detail invno=@invno end i create main report , using insert --> subreport add sub report. both reports used above sps seperatly. i can pass parameter sub report using main report. auto genetrated paramenter in sub report. (pm-?@invnoh). showing parameter in sub report named @invno auto generated parameter field based on sp. cannot assign @invno passing parameter. simply equation not working. @invno = pm-?@invnoh how pass main report parameter stored procedure of sub report? (up can show passed parameter in sub report) i'm using crystal report

android - Unable to decrypt AES encrypted string from Objective C -

i want encrypt , decrypt in android , ios , php. in android , in php using encryption type: aes encryption mode: cbc padding : pkcs7padding hash algorithm: sha-256 when encrypt , decrypt on android works perfectly. when try decrypt ios or php encrypted string in base64 or hex2binary. on android decrypt string first 16 character ios case , 19 character php code doest not decrypt showing other characters. pasting android code // ignore line encoding //string input = "congratulation, you've sucessfully decoded!"; final byte[] iv = new byte[16]; arrays.fill(iv, (byte) 0x00); ivparameterspec ivparameterspec = new ivparameterspec(iv); // when tried gives "pad block corrupted" exception else work above told /*byte[] key = commonutilities.encryptionkey.getbytes("utf-8"); system.out.println(key.length); messagedigest sha = messagediges

python - Recursively list all files in directory (Unix) -

i trying list files directory recursively using python. saw many solutions using os.walk . don't want use os.walk . instead want implement recursion myself. import os fi = [] def files(a): f = [i in os.listdir(a) if os.path.isfile(i)] if len(os.listdir(a)) == 0: return if len(f) > 0: fi.extend(f) j in [i in os.listdir(a) if os.path.isdir(i)]: files(j) files('.') print fi i trying learn recursion. saw following q?a, not able implement correctly in code. python recursive directory reading without os.walk os.listdir return filename (without full path) think calling files(j) not work correctly. try using files(os.path.join(dirname,j)) or this: def files(a): entries = [os.path.join(a,i) in os.listdir(a)] f = [i in entries if os.path.isfile(i)] if len(os.listdir(a)) == 0: return if len(f) > 0: fi.extend(f) j in [i in e

debugging - How do I get rid of the control characters in emacs --debug init -

when running emacs --debug-init, garbled output in debug information. looks me emacs isnn't processing color control information, that's guess. copy paste doesn't accurately reflect output. looks this: load("~.emacs" t t) #[0 "^h\205\262^@ \306=\203^q^@\307^h\310q\202;^@ (etc)

php - semi-colon breaking mysql_query -

this question has answer here: how can prevent sql injection in php? 28 answers i'm adding html code database through mysql_query. so, basic query looks $qry = "update pages set ".$column."='$value' id='$id'"; if called, actual query might this: $qry = "update pages set content_en='<h1>this title</h1>' id='12'"; however, if html code looks this: <h1 style='color:red;'>this title</h1> , it'll break query because of semi-colon. there way solve this? use mysql escaping function on content, : $value = mysqli_real_escape_string($value);

excel - Keep textformatting with vlookup -

is there way use vlookup excel , keep formatting of text? in case rows want copy vlookup sheet formatted different colors. want keep these colors. as rory pointed in comment, not possible achieve vlookup. can use .find , .copy method , receive effect need. below posted sample code. can use copy/paste depending on needs. sub paste_formats() dim find string on error goto blad: find = range("c3:c19").find(range("a1").value).address range(find).copy destination:=range("b2") exit sub blad: if err.number = 91 then: msgbox ("value not found.") 'if value not found pop message. end sub if want copy rows need change code bit: find = range("c3:c19").find(range("a1").value).row rows(find & ":" & find).copy destination:=rows(23) in case want copy formatting should use copy / pastespecial xlpasteformats.

dotted navigation using Adobe Flex 3 or 4 -

i have requirement of showing pie chart different data using 'dotted navigation'. below sample need implement using flex < * * * * * > if user clicks left or right arrows, need show pie chart different data accordingly. have component in adobe flex? have suggestion how can implement using adobe flex 3 or 4? many pavan you can use standard list or repeater. make right size , set scrollposition accordingly.

php - validate my form and header to another success page -

i trying validate form fields , redirect user success page so php code <?php error_reporting(e_all); ini_set('display_errors', 1); $experiences = $courses = $careerobjective = $availability = $typeofjob = $rank = $jtitle = $otherjobtitle = $salaryrange = $currency = $workin = ""; $experienceserr = $courseserr = $careerobjectiveerr = $availabilityerr = $typeofjoberr = $rankerr = $jtitleerr = $otherjobtitleerr = $salaryrangeerr = $currencyerr = $workinerr = ""; $id = ""; $uid = ""; if ($_server['request_method'] == "post") { $error = array( "courseserr"=>"", "careerobjectiveerr"=>"", "otherjobtitleerr"=>"", "experienceserr"=>"", "availabilityerr"=>"", "typeofjoberr"=>"", "rankerr"=>"&qu