Posts

Showing posts from September, 2011

java - Checking collision between Rectangle and Shape -

in game player uses rectangle bounding box, can because need rotate player image , not acctual rectangle eletric beam 1 of bosses have need use shape because need rotate acctual bounding box , not image. problem because have 1 rectangle , 1 shape can't use rectangle.intersect(shape) nor rectangle.intersect((rectangle)shape) how able check collision between rectangle , shape? or there way can rotate rectangle on instead of shape (i use createtransformedshape instance of affinetransform rotate shape )?

c# - Settings.settings save Pattern type -

i trying define patterns on e-mail saved, in code have been quite succesfull doing this: string pattern0 = safefilename(currmail.sendername); string pattern1 = string.join(" ", currmail.subject.split(' ').take(3).toarray()); string pattern2 = (convert.todatetime(currmail.creationtime).tostring(" dd-mmm-yyyy hh-mm")); and tried save patterns on properties.setting, chose string, makes string, opposed making them useful above. know use, save settings above in settings.settings file. lot in advance

jquery - Javascript declaration issue -

//problem solved// turned out jquery ajax call couldn't reach url in browsers. thanks anyway guys, quick responses, definitly helped work out. sorry non-specific title, don't think should problem. there jquery plugin ( http://keith-wood.name/countdown.html ) counts down specific date or time. the end time counter should start can defined in 2 ways: either setting date either setting number of seconds left. my project needs second 1 , based on documentation option has declared like: $('#digital_hour').countdown({until: +300}); notice "+" sign before number. it works nice on os , device, until replace number 300 variable stores seconds left until end of day on server. version: $('#digital_hour').countdown({until: +seconds_left_on_server}); works on specific browsers, on others don't. strangly enought works under vista/mozilla20.0 combo, doesn't on vista/ie6, nor on friends ubuntu/mozilla combo. i'm not huge javascrip

wpf - Trigger an EventTrigger by an AttachedEvent -

i have a custom panel raises routedevent defined globally in static class : public class compressitemstofitstackpanel : stackpanel { protected override size arrangeoverride(size arrangesize) { // logic // raise attached event customeventmanager.raisearrangeevent(this); return base.arrangeoverride(arrangesize); } } my attached event : public static class customeventmanager { public static readonly routedevent arrangeevent = eventmanager.registerroutedevent("arrange", routingstrategy.bubble, typeof(routedeventhandler), typeof(customeventmanager)); internal static void raisearrangeevent(uielement target) { var args = new routedeventargs(arrangeevent); target.raiseevent(args); } } this panel items panel items control , items

jquery - Fancy Box Position Absolute Top Left -

i hoping solve little problem have had using jquery fancy box plugin. my issue trying use absolute position appears in top left of overlay reagardless of overlays size. http://www.csr500.co.uk/websites/v9/preview.html now jq , fw icons, in bottom left positioned in top left, in similar fashion non overlay mode. the way have done means text in title tag not show on hover, want can tell restricts me access fancybox-title-inside-wrap class rather fancy-box-outer class. any in sorting out issue reaqlly appreciated. thanking in adavnce cheers cameron just idea : why don't take icons out of title section , create new (hidden) div them <div class="iconsplaceholder" style="display: none"> <div class="overlay-technologies"> <div class="overlay-technology-1"> <div class="dev-icon"></div> </div> <div class="overlay-technology-2&

java - Singleton with context in Android -

i want create singleton class callable points in application. problem class need context operations. i don't want have recreate singleton in every activity because way looses sense, thought creating in mainactivity, init method pass context argument. point on, singleton useable, think bad design because way mainactivity reference held , might run memory leaks. am right here? you right not save main activity context singleton because of memory leaks. if need constant context inside singleton, use getapplicationcontext(). can safely saved. note though context not useable gui-related functions. in rare cases need activity level context inside singleton, pass calling activity context singleton's method without saving

python - Using Websocket in Pyramid using Python3 -

is there way use websockets in pyramid using python 3. want use live-updating tables when there data changes on server. i thought of using long-polling, don't think best way. any comments or ideas? https://github.com/housleyjk/aiopyramid works me. see documentation websocket http://aiopyramid.readthedocs.io/features.html#websockets upd: websocket server pyramid environment. import aiohttp import asyncio aiohttp import web webtest import testapp pyramid.config import configurator pyramid.response import response async def websocket_handler(request): ws = web.websocketresponse() await ws.prepare(request) while not ws.closed: msg = await ws.receive() if msg.tp == aiohttp.msgtype.text: if msg.data == 'close': await ws.close() else: hello = testapp(request.app.pyramid).get('/') ws.send_str(hello.text) elif msg.tp == aiohttp.msgtype.close

javascript converting strings from gbk to utf-8 -

i got text internet node.js , want convert gbk encoding utf-8. i tried node-iconv module, didn't work. var iconv = require('iconv').iconv; var gbk_to_utf8 = new iconv('gbk', 'utf-8'); var b = gbk_to_utf8.convert(new buffer(body.tostring())); console.log(b.tostring()); try code this link : gb2312utf8 = { dig2dec : function(s){ var retv = 0; if(s.length == 4){ for(var = 0; < 4; ++){ retv += eval(s.charat(i)) * math.pow(2, 3 - i); } return retv; } return -1; } , hex2utf8 : function(s){ var rets = ""; var temps = ""; var ss = ""; if(s.length == 16){ temps = "1110" + s.substring(0, 4); temps += "10" + s.substring(4, 10); temps += "10" + s.substring(10,16); var sss = "0123456789abcdef"; for(var = 0; < 3; ++){ rets += &q

ruby on rails - Implementing model subclasses - the correct way -

i have event model , want create 2 subclasses of it: fixedevent , tasksevent event model has these attributes: uid :string title :string starts_at :datetime ends_at :datetime fixedevent inherits event , has attribute: all_day :boolean tasksevent inherits event , has these attributes: task_id :integer occurrence :integer (occurrence attribute special way tasks say: task two/three/x times. occurrence represents occurrence of task (e.g. second time user performing task)) i spent whole day yesterday reading single table inheritance , polymorphic associations , i'm still not 100% sure what's correct way implement in rails. single table inheritance leaves me lot of null values in database i'll end having 1 table with: uid, title, starts_at, ends_at, all_day, task_id, occurence, type. behaviour make server response slower rails fetch more (null) data every event query? on other hand, polymorphic associations more i'm adding functionali

asp.net mvc 3 - custom membership provider and unity dependency injection -

i have found few questions similar 1 i'm posting i'm not getting them need. i'm still struggling implement custommembershipprovider using microsoft unity di . custom membership: public class custommembershipproviderservice : membershipprovider { private readonly iuserservice _userservice; public custommembershipproviderservice(iuserservice userservice) { this._userservice = userservice; } public override string applicationname { ... user service: public class userservice : iuserservice { private readonly iuserrepository _repository; private readonly iunitofwork _unitofwork; public userservice(iuserrepository repository, iunitofwork unitofwork) { this._repository = repository; this._unitofwork = unitofwork; } ... accountcontroller: public class accountcontroller : controller { // next line don't feel s

C# How to make Stack function like List? -

as part of requirements, i'm trying modify code can behave same way original code can't seem figure out. i've done modification , compiles fine can't stack class function list: list (original): private list<gem> gems = new list<gem>(); private list<enemy> enemies = new list<enemy>(); private void updategems(gametime gametime) { (int = 0; < gems.count; ++i) { gem gem = gems[i]; gem.update(gametime); if (gem.boundingcircle.intersects(player.boundingrectangle)) { gems.removeat(i--); ongemcollected(gem, player); } } } stack (my modified version): private stack<gem> gems = new stack<gem>(); private stack<enemy> enemies = new stack<enemy>(); /// <summary> /// animates each gem , checks allows player collect them. /// </summary> private void updategems(gametime gametime) { gem[] array = gems.toarray(); (int = 0; &l

actionbarsherlock - Android-Studio ActionBar sherlock error with gradle -

though have imported , added actionbar sherlock project, not able compile project. following error: gradle: no resource found matches given name (at 'theme' value '@style/theme.sherlock'). how solve this?? please help... there bug in android studio doesn't handle library dependencies while exporting gradle file. can manually edit library dependencies 1 of following method. 1) instance, given following structure: myproject/ app/ libraries/ lib1/ lib2/ we can identify 3 projects. gradle reference them following name: :app :libraries:lib1 :libraries:lib2 the :app project depend on libraries, , done declaring following dependencies: dependencies { compile project(':libraries:lib1') } 2) or do file -> project structure -> modules there find dependencies tab, click on , manually add libraries pressing on "+" button. for sherlock, may want delete test directory, or add junit.jar file cla

Java Web Start and License Management -

can java web start integrate licensing management mechanism grab update if specific user licensed upgrades @ time? so, let's user purchases software, downloads , runs it. authorized 1 year of upgrades. java web start automatically looks updates when start application, right? there way maintain user credentials during check after 1 year no longer allows them new version? an easy way custom url locked local license file, guess shared. on server can have main controller looks @ url, looks support level , lists new jars or not depending on validity of user/ license. another way use user name + authentication first identify user , license , app updates self downloading jars , have class launched, asks main app exit, copies jars , restarts main app. so 1 of jars updater, called main app on start (if default short cut), updater update jars , call main app -no-update flag.

android - TextView taking/consuming too much space above and below the text -

Image
the text view encircled has space above , below text. inside text view (not above , below of it). neither used margins nor paddings remained there. xml code there. <tablerow android:id="@+id/tbrow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/viewlineseparator" android:layout_gravity="top" android:layout_marginbottom="2dp" android:layout_margintop="1dp" android:gravity="top" android:weightsum="1.0" > <textview android:id="@+id/tvreportasadult" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="left|top" android:layout_weight="0.60" android:clickable="true" android:gr

javascript - Grunt-init template execute shell command -

is there way execute shell command when creating grunt-init scaffolding template? example execute "bower install" , "git init" after project created without having enter commands afterwards. api not seem include functionality. the template.js executed node, can use node has offer you. i've managed child_process.exec : var exec = require("child_process").exec; ... exec("bower install", function(error, stdout, stderr) { if (error !== null) { console.log("error: " + error); } done(); }); the "problem" see don't have logs bower, if installing many components, may take while before other visual feedback.

c# - Overload 2 methods with same name and same parameter types -

i got 2 methods same name , same parameter types. want overload those, not work because getting error: "<class-name> defines member called 'changeprofileinformation' same parameter types" i have this: public void changeprofileinformation(user user) { b } public void changeprofileinformation(user user) { c d } does know why doesn't work? thanks in advance! overloading means using same function name doing different things. 2 function should have different signature otherwise compiler cant differentiate. must have different signature.

floating point - Why is comparing floats inconsistent in Java? -

class test{ public static void main(string[] args){ float f1=3.2f; float f2=6.5f; if(f1==3.2){ system.out.println("same"); }else{ system.out.println("different"); } if(f2==6.5){ system.out.println("same"); }else{ system.out.println("different"); } } } output: different same why output that? expected same result in first case. the difference 6.5 can represented in both float , double - whereas 3.2 can't represented in either type... , 2 closest approximations different. equality comparison between float , double first converts float double , compares two. data loss. you shouldn't ever compare floats or doubles equality; because, can't guarantee number assign float or double exact. this rounding error characteristic feature of floating-point computation . squeezing in

c# - Does Guide.IsTrialMode work in MonoGame for a Windows 8 Store App? -

i've been using xna make games xbox , windows phone 7. want create metro windows 8 store app, using monogame. i've jumped through hoops , got working, having issue guide.istrialmode . i have separate logic depending on whether game in trial mode or not works on other platforms, when test app either on local machine, or in simulator thinks i've not purchased game. worry when it's on app store , people buy it, logic won't change. tl;dr: guide.istrialmode work in monogame windows 8 store app , how can test it? edit: in debug, can set guide.simulatetrialmode in order test 1 way or other, seems. so here information regarding trial mode in windows 8 store apps: create trial version of app licenseinformation class basically, utilizes bool flag licenseinformation.istrial . if dig monogame source code on github , can see how implement check: #if windows_storeapp var licenseinformation = currentapp.licenseinformation; ...

Missing library for glShaderModel in my native C++ Android program -

i not library need add error: ../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/physicslessons/physicslessons.o: in function engine_handle_cmd(android_app*, int):jni/physicslessons.cpp:104: error: undefined reference 'glshademodel' in android.mk have this: local_ldlibs := -lm -legl -lglesv2 -llog -landroid local_static_libraries := android_native_app_glue and in application.mk app_platform=android-10 i using ndk8e you linking against opengl es2.0 library, doesn't have fixed pipeline. glshademodel not in there. check gl2.h header . try linking against libglesv1_cm

c++ - Getting the colour that belongs to the given integer -

i learnt working mechanis of rgba, realised hexadecimal numbers belongs different colours can turned simple integers. means can store colours in integers, though of them quite big. my question how can colour belongs integer give program? edit: of course forgot mention use allegro i'm new in it...are there functions of whatever can it? it sounds using allegro 4 if storing colors integers. provides variety of functions use, check out manual. // int makecol(int r, int g, int b); int white = makecol(255, 255, 255); int green = makecol(0, 255, 0); or inverse: int r = getr(color); int g = getg(color); int b = getb(color); with allegro 4, ordering depends on graphics card. return value of makecol() can different same color depending if stored rgb or bgr. must use above functions proper color values, , after setting graphics mode. if using allegro 5 (which highly recommend on allegro 4), use allegro_color struct, hides underlying implementation details , none

python - Is there a good solution for space efficiently showing multiple images in pylab/matplotlib? -

i looking montage.m equivalent. takes images , displays them in nice , space-efficient manner. i looking more space-efficient subplots , can manage various colormaps. doesn't need comprehensive in link before start porting... you may want imagegrid . edit: made usable import matplotlib.pyplot plt mpl_toolkits.axes_grid1 import imagegrid import numpy np im = np.arange(100) im.shape = 10, 10 images = [im in range(20)] fig = plt.figure(1, (4., 4.)) grid = imagegrid(fig, 111, nrows_ncols=(2, 10), axes_pad=0, ) in range(20): grid[i].imshow(images[i], cmap=plt.get_cmap('greys_r')) # axesgrid object work list of axes. grid[i].axis('off') plt.show(block=true)

javascript - Express cookieParser() confused -

here's problem, searched everywhere , never found clear answer. in order this: app.use(express.cookieparser('secret')); <-- "secret" secret what do? i'm bit confused. should use secure it: https://github.com/jed/keygrip hopefully question clear. in advance! just make long string use there, , don't tell anyone. ;-)

java - Player can move off screen? -

so, i'm creating simple 2d video game. noticed player can move off screen, added code: if (newx <= size * tagscanvas.scale) { newx = size * tagscanvas.scale; } else if (newx >= tagscanvas.canvas_width - (size * tagscanvas.scale) - getaabb().getradx()) { newx = tagscanvas.canvas_width - (size * tagscanvas.scale) - getaabb().getradx(); } if (newy <= size * tagscanvas.scale) { newy = size * tagscanvas.scale; } else if (newy >= tagscanvas.canvas_height - (size * tagscanvas.scale) - getaabb().getrady()) { newy = tagscanvas.canvas_height - (size * tagscanvas.scale) - getaabb().getrady(); } tagscanvas.canvas_width width of canvas object. height height of canvas object. size size of player, , scale scale of game (at moment it's 2). getaabb().getradx() returns radius center of player edge (the 'player' square box). now, x works fine, y part doesn't. it'll

php - custom meta box with submit button in wordpress -

i'm making custom meta box wordpress plugin, , have 2 inputs , 1 submit button in form action inside meta box. want submit button form's action only, instead of updating post such publish button. here meta box form: add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add(){ add_meta_box( 'my-meta-box-id', 'meta box title', 'cd_meta_box_cb', 'post', 'normal', 'high' ); } function cd_meta_box_cb(){ ?> <form method="post" id="myform" action="<?php echo plugins_url( '/proses.php', __file__ ); ?>"> <ul class="sorter"> <li><label for="pdf">url image:</label><input class="txt" name="pdf" size="50" type="text" value="" /></li> <li><label for="title">title image:</label><

ios - Preparing a GET/POST request to fetch data on iPhone -

i trying fetch data in json format search word 'cancer'. but can't figure out how call websvice, tried few things not working, can me in this. below api should calling https://api.justgiving.com/docs/resources/v1/search/fundraisersearch clicking following url desired data in browser. https://api.justgiving.com/2be58f97/v1/fundraising/search?q=cancer apikey = 2be58f97 here code using: nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; nsurl *requesturl = [nsurl urlwithstring:@" https://api.justgiving.com/2be58f97/v1/fundraising/search "]; [request seturl:requesturl]; [request sethttpmethod:@"get"]; nsstring *boundary = @"---------------------------14737809831466499882746641449"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@",boundary]; [request addvalue:contenttype forhttpheaderfield: @"content-type"]; nsmutabled

html5 - Pulling variables/data out of a processing sketch in a canvas to javascript so I can trigger page functions with those variables -

i making simple app user logs in , sent screen must tap button fast can 30 seconds. using processing create sketch button in on regular html page using canvas element. have tried linking processing file , have tried putting code right . both produce valid results in terms of placing sketch onto page. i have spent hours searching , attempting solutions processing.js , javascript, none of searches explain how use data/variables inside sketch trigger/store them outside of sketch in javascript on same page. the goal when timer inside sketch hits "0" user sent scoreboard page , asked if want submit score , if want play again. since not know how access timer or score variables outside of sketch, cannot send user next page automatically or store scores. i have working web page sketch @ http://rwmillerdesigns.com/im215/final/game.html , have been able put app on iphone use of phonegap. here way have put sketch page: <canvas id="processing" data-processin

JavaScript object data extraction (JSON Stringify/Parse or without?) -

i trying figure out if json.stringify object this: {"m_id":"xxx","record": {"user":"yyy","pwd","zzz","_createdat": 11111."_updatedat":00000},"state":"valid"} and try json.parse out user , pwd, not have call object, go through stringify. how work? thanks. i'm not sure why you're talking stringifying object. you'd stringify if needed send data across network or something, not when need manipulate in js. ...how extract strings in {...user: "aaa", pwd: "zzz"...} ? assuming have variable referring object, following (with or without nice line breaks , indenting make readable, , or without quotes around property names): var obj = { "m_id": "xxx", "record": { "user": "yyy", "pwd" : "zzz", "_createdat": 11111,

mysql - SQL error say column from COUNT does not exisit -

this question has answer here: sql query left join issue 2 answers select c.review, m.category, u.username, i.item, i.item_id, m.cat_id, count(rv.review_id) totalcount reviews c left join review_vote rv on c.review_id = rv.review_id left join users u on u.user_id = c.user_id left join items on i.item_id = c.item_id left join master_cat m on m.cat_id = i.cat_id length(c.review) > 50 , m.category = 'movies' , totalcount > 2 group rv.review_id order rand() limit 1 i error: #1054 - unknown column 'totalcount' in 'where clause' i selecting column right away, how come doesn't exist? i trying random select review listed (or voted on 2 or more times) in in table rv . not sure if using group by correctly? with aggregate columns (like count() ), must use having clause place condition on them: select c.rev

php - Paginating over travel destinations in Freebase -

i trying fetch travel destinations freebase api. according documentation using cursor , limit parameters. start cursor @ 0 , limit 100, add 100 cursor in every iteration. problem getting 76 results way. there should cca 1500 travel destinations in freebase database. documentation: https://developers.google.com/freebase/v1/search here code: <?php require_once __dir__ . '/vendor/autoload.php'; $apikey = 'super_secret_api_key'; use guzzle\http\client; //// google freebase $client = new client('https://www.googleapis.com'); $cursor = 0; $limit = 100; $results = array(); { $request = $client->get('/freebase/v1/search'); $request->getquery()->set('key', $apikey); $request->getquery()->set('filter', '(all type:/travel/travel_destination)'); $request->getquery()->set('cursor', $cursor); $request->getquery()->set('limit', $limit); $request->getquery

mapping - How would I get a Google Maps style interactive map on my game's site? -

i run rpg campaign called yarona: darkness ascending. run site http://diebot.org/ , want incorporate what's found @ http://www.uesp.net/oblivion/map/obmap.shtml using own continents, start? ok, admit, frank has point, didn't consider external link go offline 3 months down road, question looses key information. apologies. what have campaign takes place on world known yarona. have large, world-atlas style map/graphic. want have google maps style interface players can zoom out continents, or zoom in tight city blocks, maybe include "special place pins". depa suggests try google first. did try that. thing found maps of earth, earth , more earth. depa suggested include code i've used far, , have done so. thing that, reiterate (and please forgive me if seem flippant): where start?

Paypal integration - GetExpressCheckout -

i'm working on paypal integration (express checkout) using soap api. after doexpresscheckout call call getexpresscheckoutdetails. in docs found checkout status can 1 of following paymentactionnotinitiated paymentactionfailed paymentactioninprogress paymentcompleted but docs not each of them mean. understand paymentactioninprogress - how handle it? mean i'll receive ipn call paypal when it's completed? also, can simulate response testing? hello alex buynyachenko, a value of paymentactionnotinitiated occurs when submit getexpresscheckoutdetails api call before buyer logs paypal account or when log account, return website have not completed payment yet. paymentactionfailed occurs when you've tried complete payment failed reason. error response information returned have details on failure. paymentactioninprogress returned when submit doexpresscheckoutpayment api call haven't received response yet - shouldn't encounter 1 often. paymentco

mysql - Joining Table with substring condition -

i have 2 tables : create table t1( id int unsigned not null auto_increment, group varchar(3) not null, number int unsigned zerofill, used enum('yes','no') default ); id group number used 1 '110' 00001 'yes' 2 '110' 00002 'yes' 3 '110' 00003 'yes' 4 '210' 00001 'yes' 5 '210' 00002 'yes' 6 '210' 00003 'yes' 7 '310' 00001 'yes' create table t2( id int unsigned not null auto_increment, number varchar(13) default null); id number 1 '110-00001' 2 '110-00002' 3 '210-00002' 4 '310-00001' my first goal find every record t1 not used in t2: query result : id group number used 3 '110' 00003 'yes' 4 '210' 00001 'yes' 6 '210' 00003 'yes' and 2nd goal set column used 'no': id

android - Adding View doesn't Appear -

i trying add checkboxs view have on layout. problem is not showing, know being added because of getchildcount() @ parent view returns new more item.. i doing inside handler, because method called inside thread. protected void adddevicetolist(final string name, final connectsend cs) { mhandler.post(new runnable() { @override public void run() { toast.maketext(connectsend.this, "a: " + listofpersons.getchildcount()+ " vou adicionar um!", toast.length_long).show(); checkbox checkbox = new checkbox(cs); linearlayout.layoutparams fieldparams = new linearlayout.layoutparams(linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content, 1.0f); checkbox.settextappearance(cs, android.r.attr.textappearancemedium); checkbox.settext(name); checkbox.setlayoutparams(fieldparams); listofpersons.addview(checkbox);

c++ - nginx / FastCGI application loads page multiple times per request -

i following this tutorial , , modified code , added counter it. page displays "hello world" , displays counter. now, weird thing is, code compiles fine, count goes 2 each time refresh page! i'm spawning process this: spawnfcgi.exe -a 127.0.0.1 -p 8000 -f myapp.exe everything loads ok, again, count jumps 0 2 4 etc. each time refresh page. if write line file, same line written multiple times, increasing each time load webpage. question is, intended effect of fastcgi application? or there kind of bug in code and/or fastcgi/nginx config? main.cpp (hello world) #include <iostream> #include "fcgio.h" using namespace std; int main(void) { int gcount = 0; // backup stdio streambufs streambuf * cin_streambuf = cin.rdbuf(); streambuf * cout_streambuf = cout.rdbuf(); streambuf * cerr_streambuf = cerr.rdbuf(); fcgx_request request; fcgx_init(); fcgx_initrequest(&request, 0, 0); while (fcgx_accept_r(&a

javascript - jQuery focusout not triggering on exit of input element -

i'd fire focusout event no matter click on document. i'm using sortable list each sortable item contains textarea, focusout event isn't fired when clicking on sortable items. same occurs draggable items. have created jsfiddle showcase issue: click on textarea , attempt click anywhere within blue rectangle: tested in google chrome http://jsfiddle.net/rwjhs/ are there known workarounds? javascript: $("textarea").focusout(function(){ alert("do something"); }); $("#draggable").draggable(); html: <div id="draggable"> <textarea></textarea> </div> you may try this $("textarea").focusout(function(){ alert("do something"); }).click(function(e){ e.stoppropagation(); return true; }); $("#draggable").draggable({ start: function( event, ui ) { if( $('textarea:focus', this).length ){ $('textarea', this).foc

javascript - jQuery: don't waiting till animation finish on multi clicks -

i need make on click event don't wait till current animation finish , execute last click. example code http://jsfiddle.net/djpnu/ ** try click 7 10 times fast , see animation going 1 after 1 slowly $("button").click(function(){ $("div").animate({ height:'+=20px', width:'+=20px' }); }); thank you you'll want use stop stops previous animation. $("button").click(function(){ $("div").stop(true).animate({ height:'+=20px', width:'+=20px' }); }); http://jsfiddle.net/djpnu/1/ http://api.jquery.com/stop/

css - 5px Bottom Margin Added Below Header Image -

summer-band.com i know can removed using line-height:0; on #navigation , throws entire nav out of whack. trying find other solutions remove hits 5px margin (only on firefox/ mobile... doesn't show in chrome/ safari.) it's navigation/sidebar causing this. suggest set navigation position: absolute . you'll need move header image left. preferably, include header , navigation inside container. edit: next thing this: #container { width: 560px; padding: 0 130px; margin: 0 auto; float: none; z-index: 5; height: auto; min-height: 600px; background-color: rgba(0, 0, 0, 0); filter: alpha(opacity=100); opacity: 1.0; position: relative; } i've added margin: 0 auto, float: none (but instead of that, remove float), padding , position: relative. last step move navigation , header inside container, navigation positioned relative container. finally, add navigation styles: left: 0;

How can I reset achievements from Google Game Services? -

i'm testing game using google's new games services, , i'd reset account's achievements testing. i've found can reset achievements using google's apis ( https://developers.google.com/games/services/management/api/#achievements ) , i'm using oauth 2.0 playground send post request, it's not working :( specifically, i'm sending post request " https://www.googleapis.com/games/v1management/achievements/reset " detailed in link. and, when go code.google com , check services, play services "on". here output. how can reset achievements testing? close? apparently "access not configured" how do that? point of whole first 2 steps of oauth2.0 playground if not grant access? http/1.1 403 forbidden content-length: 205 x-xss-protection: 1; mode=block x-content-type-options: nosniff x-google-cache-control: remote-fetch -content-encoding: gzip server: gse reason: forbidden via: http/1.1 gwa cache-control: private, max-age=0

@foreach loop in Laravel 4 -

anyone see reasons why wouldn't work in laravel 4? figured check here before posting on github. in controller: return view::make('home.index') ->with('bcrumbs', array("home.index" => "home","home.privacy" =>"privacy policy")) in template: @foreach ($bcrumbs $k => $elem} <li><a href='{{ url::route($k) }}'>{{ $elem }}</a></li> @endforeach even if remove processing within foreach , write "hi", total failure. chrome reports: error 324 (net::err_empty_response): server closed connection without sending data. i don't know if it's intentional, have mis-matched braces: @foreach ($bcrumbs $k => $elem} : you're opening ( , (not) closing } … maybe that's it!

Python - modifying items in a list -

i have list of instances of class a class a: def __init__(self,ox,oy): self.x=ox self.y=oy list1=[a(3,0),a(5,0),a(7,3),......] now need find out instance in list has y' non-zero - , apply value other members in list. given 1 unique member have y non-zero. usual for-loop need iterate list twice - or without comprehension. there way achieve better. have not used filter , map feel there may better option. appreciated. no, there isn't. @ least 2 loops required no matter how implemented.

unicode - utf-32 advantage explanation -

in online diveintopython3 book,it says advantage of utf-32 , utf-16 utf-32 straightforward encoding; takes each unicode character (a 4-byte number) , represents character same number. has advantages, important being can find nth character of string in constant time, because nth character starts @ 4×nth byte can explain this? if possible example..i not sure have quite understood it the usual encoding of unicode utf-8; utf-8 represents characters variable number of bytes. instance, “l” character encoded single byte (0x4c) while “é” encoded 2 bytes (0xc3, 0xa9). in utf-8 encoding, word “lézard” takes 7 bytes, , cannot nth character without decoding characters before (you don't know how many bytes each character needs). in utf-32, all characters use 4 bytes, nth character, need go byte 4×(n-1). first character @ position 0, second @ position 4, third @ position 8, etc.

how to use jquery plugin silviomoreto? -

i trying plugin http://silviomoreto.github.com/bootstrap-select/ it transforms select bootstrap dropdown button. keeps select keep form consistency, can submit selected value. however, no transformation occurs. <%@ master language="c#" autoeventwireup="true" codebehind="site1.master.cs" inherits="final_year_project_allocation_system.site1" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <!-- bootstrap --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" /> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> <script src="bootstrap/js/bootstrap.min.js" type="text/javas

c# - How to enable button in Form 1 from Form 2 using public get set? -

Image
i have 2 buttons in form 1, 1 "showform2" button , 1 "button1" button. button 1 disable default. , when click "showform2" button, form 2 show. so, want is, when click "button2" in form 2, enable "button1" in form 1. so, try code in form2 class: public partial class form2 : form { bool enable_form1_button1; public bool enable_form1_button1 { { return this.enable_form1_button1; } set { this.enable_form1_button1 = value; } } public form2() { initializecomponent(); } private void button2_click(object sender, eventargs e) { enable_form1_button1 = true; } } then in form1 class, expecting "enable_form1_button1 = true" pass form 1 , enable form 1 button1. how this? public partial class form1 : form { public form1() { initializecomponent(); } private void btb_showfrm2_click(object sender, eventargs e) { form

layout - Zooming in specific part of screen in WPF -

i implementing 1 small wpf application has multiple rows , multiple columns. 0th row , 0th column contains mediaelement , 1st row , 0th column contains full screen button. when user clicks on full screen button want switch gird has 2 rows , 1 column. 0th row , 0th column occupy of screen space having inside mediaelement , 1st row , 0th column show minimize button bring original ui back. in traditional windows used toggle visibility of full screen panel hosting windowsmedia player achieve behavior. how can achieve in wpf? adding xaml code. <window x:class="learnenglish.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <grid.rowdefinitions> <rowdefinition height="5*" /> <rowdefinition heig

java - validate username unique getting error -

Image
i want verify username exist or not, code shown below, put code in protected void oncreate(bundle savedinstancestate){//put code inside here, correct?} public boolean verification(string _username) { cursor c = db.rawquery( "select count(*) " + "login" + " " + "username" + " = ?", new string[] {_username}); boolean exists = c.movetofirst(); c.close(); return exists; } and want check when user click register button , put code shown below in public void onclick(view v) {//put code inside here, correct?} // check if user exists? if(verification(username) == true){ toast.maketext(getapplicationcontext(), "username exists", toast.length_long).show(); return; } when run application click register button , apps force close. logcat shown: any idea? or how make sure username unique? sorry i'm still newbie. edit

sql - MySQL how to find parent with exact set of children? -

mysql 5.5 parent table: id | facts child table: parent_id | foreign_key | facts now, want find parents have exact set of children, no more, no less. like: select t1.`id` `parent_table` t1 left join `child_table` t2 on t1.id=t2.parent_id t2.`fk` = 1 , t2.`fk` = 3 , t2.`fk` = 5 , t2.`fk` = 7 , t2.`fk` = 9 but parent record set of children: 1,2,3,5,7,9. , want parents have the exact set of children: 1,3,5,7,9. is there way? edit: child.parent_id , child.fk both not unique . child.fk foreign key linking table. ("many-to-many relationship") quite possible parent have children 1,2,3,5,7,9. whole reason doing query try avoid creating new parent 1,3,5,7,9 if such parent exists. assuming child.id unique every child.parent_id . select a.id, a.facts parent inner join child b on a.id = b.parent_id b.id in (1,3,5,7,9) , -- <<== list childid here exists -- <<== par

jquery - Display a Google chart in a popup window + pass parameters to the chart through a hyperlink/button -

can please suggest way pass parameters (data) following google chart hyperlink(id="inline").to have hard-coded data in function.plus want pop chart in j query fancybox (which done)..please!! looking suggestions <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.js"></script> <link rel="stylesheet" href="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> <script type="text/javascript"> google.load('visualization', '1

java - My application don't run properly when packaged as a Jar -

Image
i following file > export > runnable jar file create runnable jar file of eclipse java project. when run application eclipse, works fine. but when run exported jar file, this. in order , export tab inside build path, have checked externals jars needed. ant script got created. <?xml version="1.0" encoding="utf-8" standalone="no"?> <project default="create_run_jar" name="create runnable jar project server_side jar-in-jar loader"> <!--this file created eclipse runnable jar export wizard--> <!--ant 1.7 required --> <target name="create_run_jar"> <jar destfile="c:/users/nikitha/desktop/server.jar"> <manifest> <attribute name="main-class" value="org.eclipse.jdt.internal.jarinjarloader.jarrsrcloader"/> <attribute name="rsrc-m

Twitter- Obtaining a request token Response 401 - POST -

i'm trying create app twitter , i'm stuck in first step. i'm trying post https://api.twitter.com/oauth/request_token , everytime 401. i'm using varient of apache commns httpclient's post method, specific tool, i'll post highlevel picture. my header: 'oauth '+ 'oauth_callback="oob",'+ 'oauth_consumer_key="zhad2y6rrqaazqsz21rsha",'+// fake 'oauth_nonce="'+ <random string of 32characters> +'",'+ 'oauth_signature="'+ a.signature +'",'+ 'oauth_signature_method="hmac-sha1",'+ 'oauth_timestamp="'+ <time in seconds since unix epoc> +'"'; i'm generating signature in method: step1: percentage encoding key-value pairs, , appending them given in twitter's signature page. step2: appending post , url, after percentage enco