Posts

Showing posts from February, 2015

jquery - jQueryUI - custom handle not working -

i know there's few questions on this, can see doing correctly. alas, no joy. //create , append custom resize (se) handle asset.append($('<button />', {text: 'l'}).addclass('ui-resizable-handle ui-resizable-se')); //give asset resizability asset.resizable({handles: {se: '.ui-resizable-se'}, aspectratio: true}); there no errors, , handle correctly appears, 2 classes. it's drag doesn't happen... i have had drag working, when allow jqueryui generate handle me, not custom handle. this question mentioned bug custom handles fixed, i'm on latest version (1.10.3) not sure what's up. what's not like? if nothing obvious, i'll set fiddle demo. thanks in advance

sublimetext2 - how to create snippet in sublime text 2 -

<snippet> <content> <!doctype html> <html> <head> <style type = "text/css"> </style> </head> <body> <script type = "text/javascript"> </script> </body> </html> </content> <tabtrigger>html_t</tabtrigger> <description>html_css_javascript</description> <scope>html</scope> </snippet> when save h.sublime-snippet, error "no content snippet packages /user/h.sublime-snippet" <snippet> <content><![cdata[ hello, ${1:this} ${2:snippet}. ]]></content> <!-- optional: set tabtrigger define how trigger snippet --> <!-- <tabtrigger>hello</tabtrigger> --> <!-- optional: set scope limit snippet trigger --> <!-- <scope>source.python</scope> --> </snippet> if compare yours co

linux - Apache Server Slots, Memory, KeepAlive, PHP and SSL - how to speed up -

on debian web server (vps) cpu, 6 gb ram, , fast backbone internet connection, run php application. php runs in "prefork" mode (incl. apc opcache), because whenever search php , mpm worker, there abundant warning regarding thread safety. php application quite large, each server process requires 20 30 mb ram. there sensible data processed application, therefore, connections apache server ssl encrypted. typically, application shows no or few images (about 1-3 files incl css , js per request) , users send new request each 1 minute (30 sec. 4 minutes, depeding on user). recently, application faced big storm of user requests (that planned, no dos, 2.500 concurrent users). while cpu did fine (<50% use), server ran out of slots. point - in prefork mode - each slot requires memory , 6 gb enough "maxclients" 200 slots). problem 1: according apache server-status, slots occupied "..reading..". reading 10 seconds , more, while php processing takes 0.1 2 s

jquery - How to do an entry in javascript map from ajax call -

i modifying previous question since feel problem closely related putting entry in map ajax call. there nothing wrong map. edit :- i populating map of feeds in following ways key represent url , value represent feeds; channelmap.each(function(key,url,n){ loadfeedfor(url,10); console.debug(feedmap); }); : function loadfeedfor(url,maxposts){ var gurl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url; if(maxposts != null) gurl += "&num="+maxposts; $.getjson(gurl, function(){}) .done(function(data){ feeds = data.responsedata.feed; feedmap.put(url,feeds); }); } but not working. guess have use deffered problem have no idea how. i using map answer . i tried doing same thing in way not using map. calling following function different 3 rss feeds url; function rssfeedsetup(feedid,feedurl,feedlimit){ var feedpointer=new google.feeds.feed(feedurl); //google feed

Intercept URL before unload with javascript or jquery -

i'm writing simple chrome plugin intercept new url before page unload , if contains specific string want actions , invalidate redirect! have no idea how do.. can me? you can use onbeforerequest event of webrequest api chrome extensions: chrome.webrequest.onbeforerequest.addlistener( function(details) { // actions // ... return {cancel: true}; }, // block requests matching url {urls: ["*://www.evil.com/*"]}, ["blocking"] ); just make sure have right permissions in manifest.json file: you must declare "webrequest" permission in extension manifest use web request api, along host permissions hosts network requests want access. "permissions": [ "webrequest", "webrequestblocking", "*://*.google.com" ],

asp.net - Is it possible to combine these 2 statements using linq? -

using asp.net 4.0/c# i have list of items. list contains duplicates. this item class: public class pingtreenode { public int tierid { get; set; } public int lenderid { get; set; } public int weight { get; set; } public int seq { get; set; } public pingtreenode(int tierid, int lenderid, int weight, int seq) { tierid = tierid; lenderid = lenderid; weight = weight; seq = seq; } } in first instance want select first item each lenderid. using linq: var tiernodes = new list<pingtreenode>(); tiernodes = tiernodes.groupby(x => x.lenderid).select(x => x.first()).tolist(); however, want add sequence list, starting 1,2,3 etc. separately looping through this: int seq = 1; foreach (var t in tiernodes) { t.seq = seq; seq++; } is possible both group , sequence @ same time using single linq statement? int seq = 1; var

android - ListView items don't load on screen -

the use case following: want load listview inside viewpager , @ same time set onitemclicklistener on list. can tell why listview doesn't load, i.e. screen stays black. not strip pager works. layout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:padding="4dip" > <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="0px" > <android.support.v4.view.pagertitlestrip android:id="@+id/pager_title_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_weight="1"

How I can use a class name here in jQuery -

i want use labels contains myclass if ($(field).val() != ""){ var fieldid = $(field).attr("id"); $("label[for='"+fieldid+"']").hide(); } the above code useful put id, how can use classes? var myclass = "yourclass"; $("label." + myclass).hide(); the jquery selector $() takes strings equivalent css1-3 selectors ( plus few others ). if can select via css can select via jquery.

php - Why won't this exit out the while loop? -

i'm trying exit outside while look, script can post wordpress.com blogs. however, when try use break; inside if statement, loop continues. this function starts script , handles posting: function getflogarticle($url, $mail) { list($id, $title, $content, $tags) = getnewarticle(); while ($id != 0) { $start = gettime(); doesarticleexist($url, $id); if ($exist = 0) { wordpress($title, $content, $mail, $tags, $url, $id); break; $end = gettime(); echo '<strong>exist while</strong>: '.round($end - $start,4).' seconds<br />'; } list($id, $title, $content, $tags) = getnewarticle(); echo 'i cant stop'; } } this function grabs article database every time doesarticleexist() returns 1: function getnewarticle() { $start = gettime(); global $db; $count = $db->query("select * flog_articles"); $count = $count-&

c - Correct sscanf() prototype, "int sscanf ( const char * s,const char * format, ...);" or int sscanf (char * s,const char * format, ...);? -

here prototype sscanf() function described in cplusplusreference ( link ) : int sscanf ( const char * s, const char * format, ...); but find fishy it.not type of first argument differ many other string library functions strcpy() ( 1 ) , strcat() ( 2 ) ( const char* vs char* ),but seems odd how can make array pointed first argument constant when purpose of function write it(alter contents of array) using pointer!! i mean, in int sscanf (const char * s,const char * format, ...); aren't telling through const qualifier can't change array pointed s using s ? typo on site, or fail understand something?please explain. const char * s sscanf not write s string, s input string.

java - Statement.execute(sql) vs executeUpdate(sql) and executeQuery(sql) -

i have question related method: st.execute(sql); st statement object. directly this oracle java tutorial: execute: returns true if first object query returns resultset object. use method if query return 1 or more resultset objects. retrieve resultset objects returned query repeatedly calling statement.getresutset. what meant " one or more resultset objects "? how possible manage them once got array of resultset ? whereas st.executequery(sql) , st.executeupdate(sql) clear. it's not (at least me) aim of st.execute(sql) can return int if updated table. thanks in advance what mean "one or more resultset objects"? the javadoc execute method says this: " executes given sql statement, may return multiple results. in (uncommon) situations, single sql statement may return multiple result sets and/or update counts. can ignore unless (1) executing stored procedure know may return multiple results or (2) dynamically execut

c++ - How to emulate a variable template as a class member? -

i'd have opinion on how emulate variable template class member. having data member in class dependent on template, not on class template. conceptually, written : class m { private: template<typename t> somethingthatcoulddependont<t> m_datamember; }; my first thought make : #include <iostream> class { public : template<typename t> void mymethod() { static int = 0; std::cout << "my method : " << << " calls" << std::endl; a++; } }; int main() { a, b; a.mymethod<int>(); a.mymethod<int>(); a.mymethod<double>(); b.mymethod<double>(); return 0; } but doesn't work because static member in mymethod isn't per instance per method generated. actually, makes sense mymethod can seen global function taking first parameter object of type (without taking account visibility concerns). came other idea : #include

c++ - invalid initialization of non-const reference of type in gcc but not Visual Studio -

i have code iinterface abstract class. i writing iinterface &q = interfaceimpl(); and compiled in visual studio 2008 , worked fine. ported gcc project , got error: error: invalid initialization of non-const reference of type 'iinterface&' temporary of type 'interfaceimpl' when trying find out wrong found thread error: invalid initialization of non-const reference of type ‘int&’ rvalue of type ‘int’ , @ least understand wrong. changing this: interfaceimpl = interfaceimpl(); iinterface &q = i; made compile: however, lifetime of these 2 objects same, don't understand why gcc can not create temporary object apparently ms did. assume defined standard? when @ link above, can understand why makes no sense base type, why need error in case of object? i tried this, error iinterface abstract class , can not instantiated. iinterface = interfaceimpl(); i should initialized, not instantiated. mean need copy constructor or assignment o

grep - Why does this regex not work for matching C integer declarations? -

i'm using following regular expression match c integer declarations without initialization. integer might unsigned: ^(unsigned[[:space:]]+|^$)int[[:space:]]+[a-za-z0-9_]+;$ the first part matches unsigned followed number of spaces, or nothing. second part matches int followed spaces, plus variable name , semicolon. unfortunately, seems not match integer declaration doesn't have unsigned in it. doing wrong? ^$ in (...|...) pattern expect (match empty string)? google , regex manual isn't helping. try this: ^[[:space:]]*(unsigned[[:space:]]+)?int[[:space:]]+[a-za-z0-9_]+;[[:space:]]*$ to make group optional, put ? after it. ^$ doesn't match empty string in middle of match, matches entirely empty string -- ^ matches beginning of string, , $ matches end of string.

c# - EF 4.1 Code First: Many to Many -

i have 2 entities, let's , b. relation between them many-to-many have entity, let's c. columns table a: -id (pk) -> type int generated database -propertya1 -propertya2 -propertya3 columns table b: -id (pk) -> type int generated database -description columns table c (for table not sure if better add column id generated database previous tables): -ida (pk , foreign key entity a) -idb (pk , foreign key entity b) table b has fixed values inserted on seed method (overrided). entries below: id description 1 "some description 1" 2 "some description 2" 3 "some description 3" from form, user introduces information related table (propertya1,...,propeprtya3) , click on button save data database. once user clicks on button's form save data database, first following: a = new a(){ propertya1=something_1, propertya2=something_2, propertya3=something_3 }; context.a.add(a)

c# - asp.net razor fresh project failing to do membership with mysql -

simple project, fresh mvc4 razor web page, new empty mysql database. getting exception: system.reflection.targetinvocationexception unhandled user code message=exception has been thrown target of invocation. source=mscorlib stacktrace: @ system.runtimetypehandle.createinstance(runtimetype type, boolean publiconly, boolean nocheck, boolean& canbecached, runtimemethodhandleinternal& ctor, boolean& bneedsecuritycheck) @ system.runtimetype.createinstanceslow(boolean publiconly, boolean skipcheckthis, boolean fillcache) @ system.runtimetype.createinstancedefaultctor(boolean publiconly, boolean skipvisibilitychecks, boolean skipcheckthis, boolean fillcache) @ system.activator.createinstance(type type, boolean nonpublic) @ system.threading.lazyinitializer.lazyhelpers`1.activatorfactoryselector() @ system.threading.lazyinitializer.ensureinitializedcore[t](t& target, boolean& initialized, object& synclock, func`1 valuefactory) @ system.threadi

Asp.net jquery ajax call -

i practicing jquery ajax call. happens when run project gives internal server error 500. error means , how encounter error? i created sample project in added code: namespace sample { public partial class jqajaxcall : system.web.ui.page { protected void page_load(object sender, eventargs e) { if (!ispostback) getdatetime(); } [webmethod] private static string getdatetime() { return datetime.now.tostring(); } } } my aspx code file: <script type="text/javascript" src="library/js/jquery-1.9.1-min.js"></script> <script type="text/javascript"> $(document).ready(function () { // add page method call onclick handler div. $("#result").click(function () { $.ajax({ type: "post", url: "jqajaxcall.aspx/getdateti

performance - Javascript code freezes page for a while -- how do I prevent this? -

i have cpu-intensive script which, when run, freezes whole page while, can't scrolled or clicked, etc. gladly sacrifice performance more smooth experience. also, in case, script part of google chrome extension. is possible make script freezes page run in background, without interrupting user interaction page? maybe web workers of interest. it best put cpu-intensive task worker, job in background. solution cut code pieces, load them asynchronously , execute them 1 after another. http://blog.typekit.com/2011/05/25/loading-typekit-fonts-asynchronously/

Neo4j / Cypher : order by and where, know the position of the result in the sort -

does possible have order "property" clause , "index/position" of result? i mean, when using order sorting need able know position of result in sort. imagine scoreboard 1 million user node, order on user node.score "name = user_name" , wan't know current rank of user. not find how using order ... start game=node(1) match game-[:has_child_user]->user user order user.score user user.name = "my_user" return user , "the position in sort"; the expected result : node_user | rank (i don't want fetch 1 million entries @ client side know current rank/position of node in order by!) this functionality not exist today in cypher. have example of in sql? below fits bill? (just sketch, not working!) (your code) start game=node(1) match game-[:has_child_user]->user user order user.score (+ code) with user, index() rank return user.name, rank; if have more thoughts or want star

ruby - How does module_eval / class_eval / instance_eval counts the line numbers -

i have found line_number passed class_eval , module_eval , instance_eval doesn't match line numbers reported error. behaviour not explained ruby-doc says: (use instance_eval example) the optional second , third parameters supply filename , starting line number used when reporting compilation errors. all these 3 methods class_eval , module_eval , instance_eval accepts 2 additional params specify filename , lineno parameters set text error messages. this question has practical demo behavior. however, have found calculation of line numbers more complex explanation. here demo class thing def add_method = %{ non_exist } instance_eval(a, 'dummy', 12) end end # error raise 15 instead of 12 specified puts thing.new.add_method the code above proves line_no param passed instance_eval not line numbers reported error related line_no . i wondering exact behavior of params? as snippet of documentation states, lineno spec

AngularJS: how to preventDefault() of an event after promise completes? -

i have code this: $scope.$on("$locationchangestart", function(event, newpath, oldpath) { // sync checks if (!$scope.ispageallowed($location.path())) { // prevent default reason event.preventdefault(); } }); when trying resolve promises this: $scope.$on("$locationchangestart", function(event, newpath, oldpath) { // async checks $scope.foopromises().then(function (data) { // prevent default reason when promises resolved (only if resolved) event.preventdefault(); }); }); i got successfull event (because of async execution) , after while prevented event when promises resolved. is there way link event promises , prevented after promises being resolved , not streight after function end? sorry, won't work :-). events purely synchronous. you're looking $route.resolve. asynchronous resolution/rejection of routes, give controller data or check something. http://www.egghe

ruby on rails - "Gemfile syntax error" after editing Gemfile, running bundle install or bundle update -

i rails newbie , trying follow http://railstutorial.org guide. using: gem 2.0.3 bundler 1.3.5 rails 3.2.13 ruby 2.0.0-p195 when perform bundle update or bundle install after editing gemfile, following errors: roberts-imac-6:first_app bobbaird001$ bundle update **gemfile syntax error:** roberts-imac-6:first_app bobbaird001$ bundle install **gemfile syntax error:** here gemfile (i have removed rows commented out) source 'https://rubygems.org' gem 'rails', '3.2.13' gem 'sqlite3', '1.3.5' end group :assets gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.2' # see https://github.com/sstephenson/execjs#readme more supported runtimes # gem 'therubyracer', :platforms => :ruby gem 'uglifier', '>= 1.2.3'cdacd end gem 'jquery-rails', '2.0.2' end remove end below sqlite , jquery-rails , remove cdacd @ end of uglifie

jquery - Efficient way to hide rows from table -

i have html table 1000 rows. want sort/search rows on client. data comes webservice. now, thinking adding paging 100 rows per page, client side performance bad. (i thinking doing like: display:none; hidden rows. now, i've started looking around implementations of approach, , found out datatables allow sorting/search client side without adding rows dom first. http://datatables.net/ looked @ generated dom in developers console , still cannot figure out how hide rows. ideas? i looked @ generated dom in developers console , still cannot figure out how hide rows. ideas? the js code reads table javascript variables, variable osettings.aodata. from there, load table elements need seen, not hiding , unhiding rows (i.e. dispaly:none) - table rows removed dom, stored javascript objects, , loaded or removed dom needed.

android - LinearGradient and transperent colors in TextView -

Image
i used lineat gradient set gradient color in textview , found interesting situation: set textview gredient used next code: int c1 = getresources().getcolor(r.color.test1); int c2 = getresources().getcolor(r.color.test2); shader shader = new lineargradient(0, 0, 0, status.gettextsize(), new int[]{c1, c2}, new float[]{0, 1}, shader.tilemode.clamp); status.getpaint().setshader(shader); i play litle bit color set c1=green , c2-transperent <color name="test1">#ff00ff00</color> <color name="test2">#000000ff</color> set c2=blue , c1-transperent <color name="test1">#0000ff00</color> <color name="test2">#ff0000ff</color> so don't see transperent in second case. can explaine nature of gradient builder? update: @romain guy answer. play more dradient , want: shader shader = new lineargradient(0, 0,

drupal - How to set default selected QuickTabs tab depending on operating system? -

i've d6 website i'm using quicktabs display block content. a download page has 'windows' tab , 'mac os x' tab - how can pre-select tab appropriate visitors os on page load (or default windows if no match)? ps i'm drupal novice @ best! one option use javascript detect user's operating system , hide/display correct tabs based on information. os detection: jquery/javascript detect os without plugin? jquery howto examples: http://visualjquery.com/ good luck.

django - Generating a single queryset with filtered summary data across a foreign key? -

i have small django project learn (it's web ui rancid backup software) , i've run problem. the model app defines devices, , devicegroups. each device member of group , has couple of state flags - enabled, successful - indicate if operating correctly. here's relevant bits. class devicegroup(models.model): group_name = models.charfield(max_length=60,unique=true) class device(models.model): hostname = models.charfield(max_length=60,unique=true) enabled = models.booleanfield(default=true) device_group = models.foreignkey(devicegroup) last_was_success = models.booleanfield(default=false,editable=false) i have summary table on front 'dashboard' page, shows list of groups, , each group, how many devices in it. i'd show number of active devices, , number of failing (i.e. not last_was_success) devices per-group. plain device count available through foreignkey field. this seems kind of thing annotate for, not quite. , actually, i'm

gtk3 - Gtk Widget for Suggestion -

Image
which gtk widget should use achieving functionality: gtkentrycompletion . run gtk-demo see how behaves.

php - Using Substr in a While loop for multiple products -

i trying show part of items details , have implemented substr while loop. works first product, second product shows '...' , not first 7 characters while($row = mysqli_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $details = $row["details"]; if (strlen($details) > 10){ $details1 = substr($details, 0, 7) . '...'; } else { $details1 = $details; } $date_added = strftime("%b %d, %y", strtotime($row["date_added"])); $dynamiclist .= '<div class="contentimage"><a href="product.php?id=' . $id .'"><img src="images/stock_images/' . $id . '.png" alt="' . $product_name .'" width="136" height="97"></a></div> <div class="contentdes"><strong>' . $product

Fetching Data from Database Issue in Android -

i have 3 layout: main layout(with button "profile") profile layout(with textview show data database , 2 button named "edit" , "back main") edit layout(with textview , edittext edit profile of user , 2 button again says "save" , "back profile") methods related buttons: (button 1 star,related methods 2 stars) *profile: **editm(view w) *edit: **calledit(view w) *back main: **backmain(view w) * save: *savemethj(view w) *back profile: **pbackmeth(view w) public class mainactivity extends activity { textview t1; edittext e1,e2; databasehelper helper; //profile variables string ptrm; pdatabasehelper phelper; edittext ed1; edittext ed2; edittext ed3; edittext ed4; edittext ed5; edittext ed6; textview ptn; textview kt0; textview kt1; textview kt2; textview kt3;textview kt4;textview kt5;textview kt6; @override protected void oncreate(bundle savedinstancestate) { requestwindowfeature(wi

Database design for international suppliers and their support language -

i new database world , want design database contains many service providers. provide services on world, few states. also, need store language in can support customers. i want query efficiently: 1) suppliers servicing state. 2) suppliers support language. i thought of following design: country_table {countryid : pk ...} state_table {stateid: pk, countryid : fk ...} language_table {languageid: pk, ....} supplier_table {supplierid : pk, suppliername, supplier address...} supplier_language_table {supplierid : pk,fk , languageid : pk, fk} supplier_state_table { supplierid : pk, fk , stateid: pk, fk} i have few problems design: what in case of country has no states (for instance: egypt)? thought of using countryid=0 these cases. in country_table, texas state , usa country. however, egypt state countryid 0 . valid solution? for each language supplier supports need insert row. efficient later querying suppliers language or there better solution? in supplier_state_ta

c - How is exit status passed between pthread_exit and pthread_join? Is a correction needed in man page? -

question: how exit status passed between pthread_exit , pthread_join? from pthread_join man page int pthread_join(pthread_t thread, void **retval); if retval not null, pthread_join() copies exit status of target thread (i.e., value target thread supplied pthread_exit(3)) location pointed *retval. if target thread canceled, pthread_canceled placed in *retval. i think wording in man page incorrect. it should "if retval not null, pthread_join() copies address of variable holding exit status of target thread (i.e., value target thread supplied pthread_exit(3)) location pointed retval." i wrote code shows this, see code comments: #include<stdio.h> #include<stdlib.h> #include<pthread.h> void * function(void*); int main() { pthread_t thread; int arg = 991; int * status; // notice did not intialize status, status *retval pthread_create(&thread, null, function, (void*)(&a

objective c - Overlay View using Frameworks in iOS -

i have created framework (static library) presents overlay view on top of calling delegate. following code: [[[self delegate] view] addsubview:overlay.view]; i created basic skeleton app test it, i.e., user taps button , framework called. works fine in case. however, trying implement in popular open source ios game built on cocos-2d, tweejump. click here source code of game. i want overlay presented highscore view shown user. however, setting highscore class delegate framework causes error reason: '-[highscores view]: unrecognized selector sent instance 0x13d43c70' i understand the highscore class not subclass of uiview, causes error. question how suggest implement framework in tweejump. either framework presents overlay should in different way, or should call differently in tweejump. thanks the cocos2d uiview accessible via [ccdirector shareddirector].view; in earlier versions it's either glview or openglview . you'll have add overlay vie

file io - nextLine ignored in Java when asking for input -

below see code having trouble with. basic idea simple copy of 1 existing text file new one, if new 1 exists, given 3 options. other switch cases work flawlessly, third , final case not work want @ all! basically choice lets pick new file name if chosen 1 existed, when pick 3 option first print out line "type new name:" , skips filenotfoundexception catch, bypassing code should allow user enter new name, have no idea why. suggestions? system.out.println("type new name:"); string retryname = keyboard.nextline(); try { outputstream = new printwriter(retryname); } catch (filenotfoundexception e) { system.out.println("error creating file " + retryname + "!"); system.out.println("the program close."); system.exit(0); }

.htaccess - redirect to different URL with .htacess or PHP -

i have form @ index.php takes in user input, includes , sends user input php file processing. here code of index.php: <?php if(isset($_get['q'])){ include_once "form.php"; exit(0); } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>search</title> </head> <body> <form method="get"> <input type="text" name="q" /> </form> </body> </html> when 1 submits form, hitting enter when text-input focused, goes to http://mysite.com/?q=textuserentered (if domain visited before) or http://mysite.com/index.php?q=textuserentered (if index.php visited before) how can go http://mysite.com/form?q=textuserentered or http://mysite.com/index.php/form?q=textuserentered while still passing form data form.php i prefer solution php, if way .htacess, please

How to implement Kobold2D KKInput gestureSwipeDirection to if else statements? -

i'm finding hard learn documentation on how can use kobold2d kkinput gestureswipedirection detect swipes left/right/up/down , have them carry out if else statements. can providing me sample code. thanks kkinput* input = [kkinput sharedinput]; kkswipegesturedirection dir = input.gestureswipedirection; switch (dir) { case kkswipegesturedirectionright: // direction-specific code here break; case kkswipegesturedirectionleft: // direction-specific code here break; case kkswipegesturedirectionup: // direction-specific code here break; case kkswipegesturedirectiondown: // direction-specific code here break; } i think you're making mistake, you're placing code in single method, should use 2 hands, 1 determine kkinput, , 1 check status, plus forgot gestureswipeenabled try this: -(id) init { if ((self=[super init])) { input = [kkinput sharedinput]; input.gestureswi

undefined method for nil:NilClass in my Rails app -

i'm getting a: undefined method `lat' nil:nilclass error , want solve it. exact message is: nomethoderror in static_pages#faq showing /home/christophecompaq/pop/app/views/layouts/_signed_in_header.html.erb line #101 raised: undefined method `lat' nil:nilclass extracted source (around line #101): 98: <div id="javascript_tags lat , lang"> 99: <%= javascript_tag %> 100: user_latitude = "<%=raw @user.lat %>"; 101: user_longitude = "<%=raw @user.lng %>"; 102: 103: <% end %> 104: </div> i have 2 other pages in static pages folder error - 'contact us' , 'about us'. but when take code below out of _signed_in_header.html.erb , paste in file called show.html.erb, errors stop. <div id="javascript_tags lat , lang"> <%= javascript_tag %> user_latitude = "<%=raw @user.lat %>"; user_longitude = "<%=raw @user.lng %>"; &l

Node.js - Express.io: Different session saving in different browsers -

how , if sessions correct saved differs in node.js' express.io (all in latest version) different browsers. how fix misbehavior? code: app.get('/home', function(req, res) { req.session.variable = 'value'; req.session.save(function() { console.log(req.session); }); res.send('<script src="/socket.io/socket.io.js"></script>\ <script>var socket = io.connect();</script>\ home content'); }); app.io.route('disconnect', function(req) { console.log('-------------------------------'); console.log(req.session); req.session.variable = ''; req.session.save(function() { console.log(req.session); console.log('-------------------------------'); }); }); situation: i'm on /home page , reload page. output of console in every(?) browser except chrome after reload: { cookie: { path: '/', _expire

excel - Calculate hours needed to balance account? -

i have accounts excel sheet input expenses, incomes (gst inclusive), , calculates how placed (e.g. -$717.75 month). i gives gst content pay $taxableincome*3)/23 , rough guide how income tax should put away $taxableincome*0.17 . you tell program hourly rate is. i wanting add program allow tell you need work x more hours month balance. this wouldn't soo hard, $deficit/$hourlyrate = hours needed work except each additional hour worked need add ($hourlyrate*3)/23 gst expense, , add $hourlyrate*0.17 income tax expense. this part don't quite how work out. so given hourly rate of $21.00+gst = $24.15/h , deficit of $717.75 how can work out how many more hours need work? basically wondering how can formula of     0 <= [( x1+x2+x3 ...)-( y1+y2+y3 ...)] / z1 x1 must increase until entire formula equals 0, x1 increases, must y1 , y2 x. = income source y. = expense z. = hourly rate (gst inclusive) note while excel formula useful not ex

async task in python gtk3 -

my app has gtk.grid , children loaded dynamically for item in self.read_items_from_file(): # ... self.my_grid.attach(self.build_widget(item), col, row, 1, 1) for each item built widget , widget image generated. this process takes time , wanna convert previous code in asynctask. how can achieve this? i'm using python3 , gtk+3.0 , ubuntu update using futures i'm trying use futures nothing happens windows shown items not attached grid, code def attach(item): # ... self.my_grid.attach(self.build_widget(item), col, row, 1, 1) futures.processpollexecutor() executor: executor.map(attach, self.read_items_from_file())

android - Maximum size of .apk to upload on amazon app store -

what can maximum size of .apk upload on amazon app store. .apk file having images more 50mb .so it's going approx 60 mb size of android app. possible upload 60mb file on amazon app store. is there other solution apk expansion on google play.can implement apk expanson upload more 50 mb apk file on amazon app store.. while amazon doesn't enforce strict size limit on uploaded .apk files, allow direct control panel uploads files under 100 mb. on 100 mb directed use ftp server. in general, amazon advises keep .apk files below 100 mb. source: the amazon android developer faq

xna - How do I remove some of the bones from the World of Warcraft model? -

the wow model viewer exports model 150 bones, , xna skinnedeffect supports maximum of 72 bones. can me solve problem? the xna reach profile (which why skinnedeffect has limitations) isn't meant hi-def games. have use xna full profile , write own vertex , fragment shaders support 150 bones. platform targeting, btw?

how to use multiple url variables in php echo statement -

i trying execute code 1 below , try figure out have missed do, seems bit complicated, tips or guidance easy way use comma, quotes pls. echo "<td><a href='update.php?jobrequestnumber$counterforlist=\".$row['jobrequestnumber'].\"&requestingcompany$counterforlist=$row['requestingcompany'].\"&dateforservice$counterforlist=$row['dateforservice']."'>update</a></td>"; many due method of variable parsing in php, when $ encountered within double quotes parser attempt retrieve variable characters following $. result, not need escape string in order have variable parsed properly. parsing method referred simple syntax. alternative simple syntax complex syntax uses {...} encase variables. in case recommend using complex syntax allow easier code maintenance/maintainability. echo "<td><a href=\"update.php?jobrequestnumber{$counterforlist}={$row['jobrequestnumbe

android - FileUpload Without Servlet -

i have small web server in android app want post file in multipart post request. believe fileupload makes possibly requires servlet not have. is there similar method can use httprequest? i have found library provides entirely java implementation of websockets ended being both faster, , easier use using http multi-part post requests. java-websockets via github. if example of how being used question, here code ended writing , using. please don't mind mess, hackathon. server (receiving files) client (sending files)