Posts

Showing posts from January, 2011

ios - Consumable InApp purchase for different amount of product -

i have game user can buy consumable product (i.e.: energy). now, want start sale sell more energy same amount of money (and different amount of energy, depending on user stats). need create new product ids every possible amount of energy sell, or can use same product? there rules against practice? ps: technicly don't care either way - user's data saved on server , app purchases processed server-side. it's matter of time apple approve new products , flexibility lost. it seems possible. reading overview of in-app purchase : although non-consumable products may recovered using built-in capabilities of store kit, non-renewing subscriptions must restored server. responsible recording information non-renewing subscriptions , restoring them users. optionally, consumable products tracked server. example, if consumable product service provided server, may want user retrieve results of request on multiple devices. so seems should long save info purchase future

javascript - use different parameter for a success callback -

i'm working on else's code. have simple ajax call in jquery: function getwsdata (which, data, idvr) { if(which == 'vercandall') { funcsuccess = vercandsuccess; data = {'name' : 'val'}; } else { funcsuccess = verelsesuccess; data = {'name2' : 'val2'}; } $.ajax({ type: 'post', url: wsurl, data: data, success: funcsuccess, error:function () { $("#msg").ajaxerror(function() { popwaiting(false); alert(vergenericcallerror); }); }, datatype: 'xml' }); } function vercandsuccess(xml){ ... } function verelsesuccess(xml){ ... } it's simple. problem have success callback. in case of verelsesuccess send second parameter function, more precisely handle idvr (an input parameter of getwsdata ). how can accomplish this? to achieve this, can do:

ios - Sending NSNotifications to all objects of a class -

i have object can selected user click. current requirements of app, @ time, there no more 1 of these items selected @ point during app execution. i implemented mechanism enforce this, follows: each of these objects has unique identifier property. when each object created, subscribes nsnotificationcenter listening my_object_selected notification. when each object selected, posts my_object_selected notification, unique id part of userinfo dictionary. then, when each object receives notification, checks see if id same 1 in userinfo. if is, nothing, if isn't, sets unselected. is decent approach problem? if not, how it? it decent way of doing it, although not efficient. more objects have, more time spend comparing ids. easiest way store object pointers , ids in map table (or similar) , remember last selected object. whenever select new object, clear selection flag of last selected object, new object , set selection flag. requires keep collection of objects, t

If condition not work regular in bash -

code if [ $setup==="y" ] echo "kurulum:"$setup exit full_dir=$full_dir"/public" else echo "sub-public folder exist? [public,web]" read folder_extend if [ $folder_extend ] full_dir=$full_dir"/"$folder_extend fi fi setup param $setup view "n" after run sh still condition firts part run. wrong code ? thanks. change to: if [ "$setup" = "y" ] echo "kurulum:"$setup exit full_dir=$full_dir"/public" else echo "sub-public folder exist? [public,web]" read folder_extend if [ "$folder_extend" ] full_dir=$full_dir"/"$folder_extend fi fi it should single = , , need spaces around it. should quote variables in contexts, in case contain spaces.

C++ std::set custom comparator -

well, problem i'm using std::set custom comparator, like: class { public: a(int x, int y): _x(x), _y(y) { } int hashcode(){ return (_y << 16) | _x; } private: short int _y; short int _x; }; struct comp { bool operator() (a* g1, a* g2) const { return g1->hashcode() < g2->hashcode(); } }; so, use like std::set<a*, comp> myset; // insert data a* = new a(2,1); a* b = new a(1,3); myset.insert(a); myset.insert(b); now problem this: myset.find( (2 << 16) | 1 ); but, of course, excepts a* not short int. so, know use std::find_if, won't render useless custom comparator? iterate whole list, wouldn't it? there way use find hashcode rather object itself? thank you! set::find takes argument of type key_type (see discussion why set::find not template? ). using std::set have construct temporary object use find . myset.find(a(2, 1)); if not cheap construct might want use st

java - AndEngine Update -

i'm trying learn andengine , have been messing around examples. 1 modifying physicsjumpexample what run every x seconds. have done searching , have found people suggesting: this.scene.registerupdatehandler(new iupdatehandler() { @override public void onupdate(float psecondselapsed) { // todo auto-generated method stub //your code run here! } but find cant because of: this.mscene.registerupdatehandler(this.mphysicsworld); how go running code every x seconds? thanks in advance you can register timer handler this: protected scene oncreatescene() { scene myscene = new scene(); // somewhere create scene float xseconds = 5.5f; // meaning 5 , half second boolean repeat = true; // true reset timer after time passed , execute again timerhandler mytimer = new timerhandler(xseconds, repeat, new itimercallback() { public void ontimepassed(timerhandler ptimerhandler) { methodwithstufftodo(); } }); my

.htaccess - How do I remove the trailing slash from the URL ? I have tried searching a lot -

i have spent several hours within past few days trying find out how remove directory slash. i url this; domain.com/order not domain.com/order/ i have tried directoryslash off (or ever was) , have tried many other mod_rewrites , whatnot. please if me, great.

c# - ActiveX Component - Using external methods? -

i've written activex component included in ax2009 form. have managed include component in form , works fine, extend functionality. is possible call ax methods within control , send result control? i.e. there way write code calls method external activex control? alternatively, there way of passing variable between control , ax form? handy in order restrict queries made data tables using variable value. i've sorted out using .net business connector. managed pass call using callstaticrecordmethod table containing method, , name of method needed. callstaticclassmethod can called if method part of class (in ax). i'm storing return value in variable in .net component , making use of data. hope can other out too.

ios - Sort a NSArray of numbers in ascending order but send zeros at the end -

i have simple nsarray , containing nsnumber s. i sort array in ascending order way : nssortdescriptor *lowesttohighest = [nssortdescriptor sortdescriptorwithkey:@"self" ascending:yes]; [_scores sortusingdescriptors:[nsarray arraywithobject:lowesttohighest]]; my problem is, i'd nsnumber s containing 0 @ end rather @ beginning. here kind of array may have sort (containing empty nsnumber s example): 0 25 12 0 8 0 my code of course sorts array this: 0 0 0 8 12 25 what this: 8 12 25 0 0 0 of course re-order manually removing lines 0 , adding them @ end, i'm looking cleanest solution possible. sort array using comparator . nsarray *sortedarray = [array sortedarrayusingcomparator: ^(id obj1, id obj2) { if ([obj1 integervalue] == 0 && [obj2 integervalue] == 0) { return (nscomparisonresult)nsorderedsame; } if ([obj1 integervalue] == 0) { return (nscomparisonresult)nsordereddescending;

google api - No Authentication Header Found -

we using google contacts api past few years. seems working fine until today..suddenly contacts api started throwing error "no authentication header found" inspite of passing correct token header. here complete stack trace of error java.lang.nullpointerexception: no authentication header information| @ com.google.gdata.util.authenticationexception.initfromauthheader(authenticationexception.java:96)| @ com.google.gdata.util.authenticationexception.(authenticationexception.java:67)| @ com.google.gdata.client.http.httpgdatarequest.handleerrorresponse(httpgdatarequest.java:608)| @ com.google.gdata.client.http.googlegdatarequest.handleerrorresponse(googlegdatarequest.java:564)| @ com.google.gdata.client.http.httpgdatarequest.checkresponse(httpgdatarequest.java:560)| @ com.google.gdata.client.http.httpgdatarequest.execute(httpgdatarequest.java:538)| @ com.google.gdata.client.http.googlegdatarequest.execute(googlegdatarequest.java:536)| @ com.

android - cordova startup which plugins are required? -

when creating webapp cordova/phonegap, if dont use plugins,it seems i dont need cordova.js , i can remove <uses-permission manifest.xml (android) i can remove plugins config.xml (somebody correct me if i'm wrong). however, include cordova.js, seems plugins required unless hack cordova.js. of them use permissions. which plugins required cordova.js , permissions require, iow minimal set of plugins , permissions needed if include cordova.js without editing ? related question: phonegap startup - need files?

actionscript 3 - Dynamically calling array value by index number -

i'm having trouble calling values of array using index number dynamically. i'm trying name of movieclip dynamically each time loop calls. code: public var allitemsunlockedtc:array = new array("itemwrench", "itemsc", "itemvoltmeter", "itemgloves", "itemstirespray"); for(var tcitems:int = 0; tcitems < allitemsunlockedtc.length; tcitems++) { trace("tcitems length: " + tcitems); trace("values: " + allitemsunlockedtc.valueof([tcitems])); /*getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).x = par.toolcloset.kast_1.slottc1;//getchildbyname("slottc" + (tcitems + 1)).x + 400; getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).y = par.toolcloset.kast_1.slottc1;//getchildbyname("slottc" + (tcitems + 1)).y + 245; getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).go

python - How can I see the actual data Requests sends over the wire? -

(this follow-up question this one ) how can tell urllib3 log full request, including, not limited to: url query parameters headers body and else sent inside request (i not sure there else, if there else, want see it) i having trouble connecting linkedin oauth (a similar implementation works google , facebook), , see exactly requests being sent. suspect auth_token not being provided, need confirm this. that, need urllib3 show full requests, since on https , can not analyze network traffic see them (end-to-end encryption). you can access preparedrequest object sent after fact of request using request accessor, e.g. print dir(r.request) .

java - JComboBox, ActionListener, How do I really use them? -

im learning java , stuck onto jcombobox. have feel things trying out , hitting wall pass 4 hours. i trying let user select 1-10 combobox. how value of combobox? value of combo box equivalent quantity. so have value maybe $10. if user choose quantity 2. i want value of user choose, take value of $10 , times 2. the result $20 displayed on jtextfield. please :( public class panel extends jpanel { public panel(){ jpanel test = new jpanel(new gridbaglayout()); string[] quantities1 = {"0","1","2","3","4","5","6","7","8","9","10"}; jcombobox quantitiescb = new jcombobox(quantities1); quantitiescb.addactionlistener( new actionlistener(){ public void actionperformed(actionevent e){ jcombobox combo = (jcombobox)e.getsource(); string currentquantity = (

ruby on rails - EC2 - cannot deploy as "bitnami" user -

i using capistrano deploying rails app amazon ec2. in deploy files, have following credentials connecting amazon ec2: set :user, "bitnami" #set :user, "root" server "ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com", :app, :web, :db, :primary => true ssh_options[:keys] = ["/users/ada/my_amazon_ec2.pem"] when run cap deploy:setup , cap deploy:check , following: the following dependencies failed. please check them , try again: --> not have permissions write `/www/myapp'. (ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com) --> not have permissions write `/www/myapp/releases'. (ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com) how's possible? able connect via ssh ec2 user bitnami , when try user root , message should use bitnami user login , connection closed. if try change in deploy files change bitnami user root , whole deployment process ok, when log in through ssh (as bitnami user) ec2, don't see files should deployed, final

interface - Android: Implement inner class in outer class; callback from inner class and outer class -

i have multiple fragments in 1 activity should able pass data inbetween them. have used tutorials implement callbacks. mainactivity outer class in fragment classes are. furthermore have fragmentpageradapter handles fragment transitions. thing is, eclipse wont let me implement callback interface, included in 1 of fragments, mainactivity outer class. this structure of code: public class mainactivity extends fragmentactivity **implements connectionfragment.datacallback**{ //compiler error here:"connectionfragment cannot resolved type" //when leave out runtime error: "mainactivity java must //implement datacallback" ... public class sectionspageradapter extends fragmentpageradapter implements connectionfragment.datacallback{ @override public void updatelog(view v, string line) { datafragment datafrag = (datafragment)getsupportfragmentmanager().findfragmentbytag(datafragment.class.getname()); if (datafrag != n

why file can not be read in adobe flash , air or actionscript on server -

i used function load text file public function load_ways(zoom) { finish_working = false; _zoom = zoom; var data:urlloader = new urlloader(); data.addeventlistener(event.complete, onloaded_kv); data.load(new urlrequest("zoom\\" + _zoom + ".txt")); } that worked correctly when ran application on computer. when moved file server, file won't load. actually, onloaded_kv function called empty data. you can't have backslash in url change to: public function load_ways(zoom) { finish_working = false; _zoom = zoom; var data:urlloader = new urlloader(); data.addeventlistener(event.complete, onloaded_kv); data.load(new urlrequest("zoom/" + _zoom + ".txt")); }

Replace whole word with a symbol using C# Regex -

so trying replace word @theplace or @theplaces using regex pattern like: string pattern = string.format(@"\b{0}\b", placename); but when replacement, not finding pattern, guessing @ symbol problem. can show me need regex pattern work? your problem* \b (word boundary) before @ . there no word boundary between space , @ . you remove it, or replace non-boundary, capital b . string pattern = string.format(@"\b{0}\b", placename); * assuming placename begins @ .

xml - Difference between Default Namespace and targetnamespace? null namespace? -

i've read through several posts found on google , wiki article namespace , xml scheme, , dont know.. cant quite understand difference between default namespace , targetnamespace.. so default namespace namespace used default (if no other namespace defined elements) while targetnamespace seems of same use? also i've read, attributes default signed null namespace? nullnamespace? in example: <test xmlns="www.example.org" attribute1="1" attribute2="tbla" attribute3="helloworld"> <child1></child1> </test> so child1 in www.example.org namespace while attribute1 /attribute2 , attribute 3 in null namespace? i think benefit question: why need targetnamespace? my understanding targetnamespace developed match xml schema (.xsd) xml document using schema. above question , discussion answers in more depth.

Python script - log failed icmp/ping response - problems -

i'm attempting write python script ping/icmp ip address , tell me if it's alive. i'm doing because have intermittent issue. wanted ping, log outcome, sleep period , attempt ping again. tried while loop, still getting errors these: line 33, in (module) systemping('192.168.1.1') line 30, in systemping time.sleep(30) keyboardinterrupt i'm using python 2.6. ideally question how loop through method/function systemping , errors there in code? script seems work, these errors when hit ctrl-c. from subprocess import popen, pipe import datetime, time, re logfile = open("textlog.txt", "a") def getmytime(): = datetime.datetime.now() return now.strftime("%y-%m-%d %h:%m \n") starttime = "starting ..." + getmytime() logfile.write(starttime) logfile.write("\n") def systemping(x): cmd = popen("ping -n 1 " + x , stdout=pipe) #print getmytime() line in cmd.stdout: if 't

qt - Why the QFontMetrics::boundingRect() return a wrong size rect? -

i'm using qt4.7. when use qfontmetrics render text in situation, got wrong width. code this: qfontmetrics fm(qapplication::font()); qrect rc = fm.boundingrect(str); i found fm.boundingrect(str) return fixed rect while dpi changed.

version control - SVN build revision -

we working on java project , have automatic build everyday, , of times have checked in our code though not complete save it, many times build breaks due single person (not due error, code incomplete). to avoid there option in svn can assign build revision/tag takes files revision, i.e people have completed code have build revision latest revision , people have incomplete code checkin point build revision earlier revision not break build. branch-when-needed explained in subversion best practices doc best approach take. the branch-when-needed system users commit day-to-day work on /trunk. rule #1: /trunk must compile , pass regression tests @ times. committers violate rule publically humiliated. rule #2: single commit (changeset) must not large discourage peer-review. rule #3: if rules #1 , #2 come conflict (i.e. it's impossible make series of small commits without disrupting trunk), user should create branch , commit series of smaller changesets the

what happens to the client side port/socket after server has disconnected and reconnected? -

my application talks pinpad device. pinpad acts server waiting clients connect. fire application, connects pinpad send command ack , things good. now unplug ethernet cable pinpad, send command , after timeout application spits out error message saying 'device cannot reached/found'. ok fine, plug cable pinpad , every time try send command pinpad same 'device cannot reached/found' message. have restart application , things good. does mean original socket 2 parties using lost after unplug cable or port application talking on useless after unplugging cable? , need new port? the 2 applications talking on tcp/ip. you didn't transport protocol you're using. if using tcp (stream socket), depends. if there no data transmission during interval in connectivity interrupted (the connection idle) , tcp keepalives not configured, there no effect: data transmitted after connectivity restored go through if there connectivity along. if, on other hand, data

python - doctest for a function using a randomly generated variable -

i have function compares user input variable randomly generated number using random module. want write doctest require randomly generated number ignored or overwritten. in ignorance tried assign value random variable, random number still generated. use random.seed , if how apply this? as far can see, "sets" random generator function different starting point rather specifying number replace number have been generated. the python random number generator generates pseudo-random numbers using deterministic algorithm, based of of seed. this means if set seed fixed value, can predict numbers module generate: >>> import random >>> random.seed(1) >>> random.random() 0.13436424411240122 >>> random.random() 0.8474337369372327 >>> random.random() 0.763774618976614 >>> random.seed(1) >>> random.random() 0.13436424411240122 >>> random.random() 0.8474337369372327 >>> random.random() 0.7

javascript - How do I Convert NaN to a 0? -

when value not entered in 1 of forms, creates later result of nan in javascript. want declare anytime nan show instead show 0. thought adding <script> = || 0 </script> to beginning of scripts fine. is there anyway nan equal 0, no matter situation? nan global object cannot override. reference: https://developer.mozilla.org/en-us/docs/javascript/reference/global_objects/nan one alternative use isnan then a = isnan(a) ? 0 : a;

python - Gnomonic projection into 2-dim ndarray with healpy -

gnomview allows visualize gnomonic projection of spherical map. how can store projection in 2-dimensional numpy.ndarray? what's healpy's equivalent of map_out option of idl's gnomview? this not supported in healpy , implemented it, can check development version of healpy github repository, then: in [14]: hp.gnomview(np.arange(12), return_projected_map=true) out[14]: masked_array(data = [[ 4. 4. 4. ..., 4. 4. 4.] [ 4. 4. 4. ..., 4. 4. 4.] [ 4. 4. 4. ..., 4. 4. 4.] ..., [ 4. 4. 4. ..., 4. 4. 4.] [ 4. 4. 4. ..., 4. 4. 4.] [ 4. 4. 4. ..., 4. 4. 4.]], mask = false, fill_value = -1.6375e+30) the returned projected map 2d masked numpy array. available in next healpy version.

javascript - WinJS gestureRecognizer - how to trap multiple gestures -

i've been using this article (and others) try , implement gesture recognition in app, , work. however, want detect multiple gestures; example, swipe, , touch. don't seem able establish whether mouseup event caused end of gesture, or single touch. function processupevent(e) { lastelement = e.currenttarget; gesturerecognizer.processupevent(e.currentpoint); processtouchevent(e.currentpoint); } what happens processed both. how can detect whether user has 'let go' of screen swipe, or touch? edit: var recognizer = new windows.ui.input.gesturerecognizer(); recognizer.gesturesettings = windows.ui.input.gesturesettings.manipulationtranslatex recognizer.addeventlistener('manipulationcompleted', function (e) { var dx = e.cumulative.translation.x //do direction here }); var processup = function (args) { try { recognizer.processupevent(args.currentpoint); } catch (

php - jqGrid after Delete error -

here example delete options i'm using using in jqgrid. works fine , serverside scripts working perfectly. records deleted, there goes wrong after response server received. // del options { mtype: "post", modal: true, url: "/internal/backupmanagement/backupmanager/deletemysqldb", reloadaftersubmit: false, onclicksubmit: function () { var post = $("#grid_" + o.id).jqgrid("getgridparam", "postdata"); var server = post.serverid; $.opendialog("load", "deleting old database entry. please wait..."); var selrow = $("#grid_" + o.id).jqgrid("getgridparam", "selrow"); var row = $("#grid_" + o.id).jqgrid("getrowdata", selrow); console.log("about return", row, server); return { id: row.recid, database: row.database, server: server }; },

C enum as a type in a structure when using bit fields -

it understanding type bit field declarator should of int type. in fact, here line c99 standard "a bit-field shall have type qualified or unqualified version of _bool, signed >int, unsigned int, or other implementation-defined type." however, came across code today shows enum type, this. typedef enum { = 0, b = 1 }enum; typedef struct { enum id : 8; }struct; without comments or documentation, it's hard tell intent. provide insight? a , b both of int type, signed int . has length of 32 bit , meaning 4 byte. but enum enum not need much. 0000000000000000000000000000000 equals 0000000000000000000000000000001 equals b so creator thought making enum shorter int bitfield of length of 8 bit , minimum length 1 byte. 00000000 or 00000001 he have taken char type beginning length of 1 byte though. on compilers can activate feature ensure enum can smaller int. using option --short-enums of gcc, makes use smallest type still fitti

vb.net - Ordering columns in datatable -

so, have function takes in datatable , orders users 2 columns. (rank , ordercount) function determinebestuser(byval usertable datatable) dim bestchoice datarow() u = 0 usertable.rows.count - 1 if not doesprocessorneedorders(usertable.rows(u).item("username"), usertable.rows(u).item("amount")) usertable.rows(u).delete() end if next bestchoice = usertable.select("", "rank asc, ordercount desc") if isdbnull(usertable) console.writeline("no user qualified order @ moment") end if return bestchoice(0)(0).tostring end function the problem function works correctly , gives me user highest rank (1 or 2) , lowest ordercount (0 - 30+). however, not return correct person. thing i've seen fixes changing "ordercount desc" "ordercount asc"; however, change works specific order , it's returning wrong person. i have test runs show in more detail: r1

angularjs - Angular JS: scope not correct when calling a function dynamically? -

i'm new angular js. in plunkr, have typeahead works when have typeahead in html markup. however, when dynamically generate html inside directive, typeahead no longer works. code here: http://plnkr.co/edit/kdrxptyanptmka7zukkm?p=preview and take 1 step further, when pass in function, still not work: http://plnkr.co/edit/jqn913hjxuvsfazxaqt7?p=preview it not trivial problem trying solve here, i'm afraid. bumping scoping issue. typeahead directive evaluates expression ( city city in cities($viewvalue) here) in scope of dom element on placed. way written wrapper directive makes expression evaluated in directive's scope isolated , doesn't "see" controllers scope. the number of ways around simplest 1 link $compiled-ed element in scope $parent of directive scope: var linkedinput = $compile(inputhtml)(scope.$parent); here working plunk: http://plnkr.co/edit/flfwiknqirbnesmjzbgj?p=preview the other alternative loose isolated scope , "m

How to convert requirejs script to nomal javascript? -

how can convert script did based in requirejs normal javascript code? example: define("anything",['anything'], function(anything){ //code }); how in normal javascript code, without requirejs? have form convert simple? just include dependencies 's before using them in implementation , remove requirejs define()'s.

vb.net - Linked Structures in Visual Basic; is it possible to implement a double reference? -

when 1 traversing linked structure intent of acting upon structure (i.e.: inserting node simple linked list trivial example,) 1 obtains best algorithm pushing double pointer through structure; if single reference used, 1 must write 1 or more special cases null roots and/or tail insertions. node_type **dp = &root; while(*dp && /insertion point not reached/) dp=&(*dp)->next; when fall out of loop, *dp point of insertion list; i'm holding reference object's link. reference might root, null object @ end of structure, or other node. structure becomes more complex, need double-reference becomes more pronounced need special cases tends grow exponentially. how 1 implement double-reference in visual basic? note: linked list bit serves example... know: there lots of ways around simple issue. please excuse c#, vb.net rather rusty. way safely double references in c#/vb.net using ref parameter method. using system; namespace test { class pr

subquery - How to use NHibernate DtachedCriteria sub queries to filter by list of referenced entities properties? -

i want outcome single sql statement. have following structure: public class b { public virtual int id { get; set; } public virtual int bnumber { get; set; } } public class { public virtual int id { get; set; } public virtual ilist<b> bs { get; set; } public virtual int anumber { get; set; } } if have detached criteria filters a's numbers higher 6: detachedcriteria.for<a>().add(restrictions.gt("anumber", 6)) .add(subqueries.???).list<a>(); i want add filter return a's contains b's number lower 5. how do it? want generic possible can reuse in multiple places. detachedcriteria.for<a>() .add(restrictions.gt("anumber", 6)) .createcriteria("bs") .add(restrictions.lt("bnumber", 5)) .list<a>(); update: having or different subqueries detachedcriteria.for<a>() .add(restrictions.gt("anumber", 6)) .create

get HTML code of website from android app -

i developing first android application. i try html source website, use code: httpclient client = new defaulthttpclient(); httpget request = new httpget(urlweb); httpresponse response = client.execute(request); string html = ""; inputstream in = response.getentity().getcontent(); bufferedreader reader = new bufferedreader(new inputstreamreader(in)); stringbuilder str = new stringbuilder(); string line = null; while((line = reader.readline()) != null) { str.append(line); } in.close(); html = str.tostring(); also add permissions internet in manifest. but obtain error: 05-02 18:56:56.967: e/androidruntime(17659): fatal exception: main 05-02 18:56:56.967: e/androidruntime(17659): java.lang.illegalstateexception: not execute method of activity 05-02 18:56:56.967: e/androidruntime(17659): @ android.view.view$1.onclick(view.java:3597) 05-02 18:56:56.967: e/androidruntime(17659): @ android.view.view.perfo

lisp - how to return function in elisp -

this related question: elisp functions parameters , return value (defun avg-damp (n) '(lambda(x) (/ n 2.0))) either (funcall (avg-damp 6) 10) or ((avg-damp 6) 10) they gave errors of symbol's value variable void: n , eval: invalid function: (avg-damp 6) respectively. the reason first form not work n bound dynamically, not lexically: (defun avg-damp (n) (lexical-let ((n n)) (lambda(x) (/ x n)))) (funcall (avg-damp 3) 12) ==> 4 the reason second form not work emacs lisp is, common lisp, a "lisp-2", not "lisp-1"

jQuery Image Rotator Not Working -

i'm having problem first attempt @ jquery , image rotator. i've been trying hours/days check code, can't find problem. followed tutorial on lynda.com , have rechecked code 3 times. maybe has not downloading jquery or not noting file in html? or, problem else? here url html , javascript code: http://www.planetvisioncreation.com/culturalpublishingservice.html thanks in advance can give! vicki your marquee_includes/jquery-1.9.1.min.js file saved in incorrect character encoding, suggest download correct file jquery.com, not mess , upload on server is. if still doesn't help, file transfer program may transcoding files different encodings. an easier way include google-hosted jquery in page.

css - Style <select> element based on selected <option> -

is possible style select element based on option selected css only? aware of existing javascript solutions . i tried style option element itself, give style option element in list of options, not selected element. select[name="qa_contact"] option[value="3"] { background: orange; } http://jsfiddle.net/aprillion/xsbhq/ if not possible css 3, css 4 subject selector in future - or stay forbidden fruit css? unfortunately, yes - not possible css. mentioned in answers , comments this question , there no way make parent element receive styling based on children . in order you're wanting, have detect of children ( <option> ) selected, , style parent accordingly. you could, however, accomplish simple jquery call, follows: html <select> <option value="foo">foo!</option> <option value="bar">bar!</option> </select> jquery var $select = $('select'); $select.each

jsf 2 - Render ids generated by nested <f:ajax> inside <ui:repeat> do not match those generated by JSF -

my form contains dropdown list inside ui:repeat component. when list item selected, f:ajax call triggers refresh of both dropdown list , several other components inside ui:repeat . im struggling work out correct id format f:ajax render="???????" (see facelet view below). appreciated. ive supplied raw source view of rendered screen (actual jsf ids) , facelet view showing same components coded. browser source view <form id="generalmedicalhistory" name="generalmedicalhistory" method="post" action="..." <span id="generalmedicalhistory:generalmedicalhistory_p"> <span id="generalmedicalhistory:medhist"> <table border="0" class="table_form"> <select id="generalmedicalhistory:rptk:0:medicalcondition" name="generalmedicalhistory:rptk:0:medicalcondition" > ---> target id (ui:repeat) facelet view <h:form id ="generalmedic

NullPointer Exception in java code (getting Name of File:null output ) -

public class helloworld { public static int executelock; public static int val; public helloworld() { executelock = 0; val = 0; } public static void main(string[] args) throws exception { new helloworld(); new thread(new runnable() { public void run() { try{ webfsmanager wfm = new webfsmanager(); }catch(exception e) { e.printstacktrace(); } } }).start(); new thread(new runnable() { public void run() { try{ while(true){ thread.sleep(10); if(executelock>=2){ file f = new webfsfile("read.js"); system.out.println("name of file :"+f.tostring()); //fileinputstream f1 = new webfsfileinputstream(f); //f1.read(); //f.deleteonexit(); break; } }

version control - What is the difference between git push and git push origin -

i'm having trouble differentiating between 2 git statements, how 1 differ? or differ @ all? git push git push default remote git push origin push remote named origin when clone repository, default remote origin , automatically default upstream. that's why may not see difference. although, if init repo locally, origin won't automatically created, e.g.: git init git remote add origin ssh://url/to/origin git push -u origin --all # note there other way set upstream note default remote named anything. origin convention.

.net - json returned from asmx method can't be parsed in Javascript -

i trying return json object of array of arrays one: { 'data': [[45,43,103],[34,43,230]] } using asmx in .net 4.0 this: [webmethod] [scriptmethod(responseformat = responseformat.json)] public string getdata() { stringbuilder sb = new stringbuilder(); sb.append("'data':["); sb.append("[45,43,103],"); sb.append("[34,43,230]"); sb.append("]"); return sb.tostring(); using jquery ajax call : $.ajax({ type: "post", url: url, //defined elsewhere data: "{}", datatype: 'json', contenttype: "application/json; charset=utf-8", success: update, }); and function update(data) { console.log (data.d[1][1]); //looking @ second array second element } the problem response asmx call looks , update function doesn't work {"d":"\u0027data\u0027:[[45,43,50],[34,43,50]]"} things don't escaped or formatted properly. seems missing som

php - How to send request to https webservice in Android? -

i trying send request https webservice returns 404 not found ( request url not found on server ) works in browser.it returns response in xml format. please guys. here code try { schemeregistry schemeregistry = new schemeregistry(); schemeregistry.register(new scheme("https", sslsocketfactory .getsocketfactory(), 443)); httpparams param = new basichttpparams(); singleclientconnmanager mgr = new singleclientconnmanager(param, schemeregistry); httpclient client = new defaulthttpclient(mgr, param); httppost post = new httppost(global.card_api_url); list<namevaluepair> parameters = new arraylist<namevaluepair>(); parameters.add(new basicnamevaluepair("user", "xxx")); parameters.add(new basicnamevaluepair("pass", "xxxxxxxx")); parameters.add(new basicnamevaluepair("cardnumber",

css - aligning a checbox next to a <td> in html -

Image
i have basic css/html question using html/css. thought basic , obvious, not working intended. in basic image, want labels to right of expertise (creating registration page user selects his/her expertise) i believe basically <tr> <td>expertise</td> <input type="checkbox" style="vertical-align: left; margin: 12px;"> label </input><br> <input type="checkbox" style="vertical-align: left; margin: 12px;"> label 2 </input> </tr> however not working intended. first of markup invalid, table element can have elements meant table child elements i.e tbody, thead, th, tr, td etc, , no other elements, instead can place checkboxes inside td secondly input tag doesn't have explicit closing tag, need self close it, else leave without closing <br> third - use label tag instead of having stray text besides checkbox demo the right way <table&

Dart Web UI: How do I get a reference to an item within in a web component? -

if add number of web components app in myapp.html below: <head> <link rel="components" href="package:xclickcounter/xclickcounter.html"> </head> <body> <div id="container1"><x-click-counter></x-click-counter></div> <div id="container2"><x-click-counter></x-click-counter></div> <div id="container3"><x-click-counter></x-click-counter></div> <div id="container4"><x-click-counter></x-click-counter></div> ... </body> and have number of elements in web component in xclick-counter.html below: <html><body> <element name="x-click-counter" constructor="countercomponent" extends="div"> <template> <button id="button1" on-click="increment()">\\\increment me</button> <button id="bu

php - query string gets ignored after mod_rewrite -

i using following rewrite rule in .htaccess file send requests index.php file located @ root: rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*) index.php?q=$1 [l] as expected, urls example.com/users result in php receiving ["q"]=> string(5) "users" $_get variable. urls example.com/users?fu=bar on otherhand not result in php receiving ["q"]=> string(5) "users", ["fu"]=> string(3) "bar" what happening here, , how modify rule behave way? you need add original query string: rewriterule (.*) index.php?q=$1 [l,qsa] ^^^ here

html - CSS Menu children forcing parents to resize -

Image
i using following code: html <div id="wrap"> <ul class="navbar"> <li><a href="#">compare plans</a> </li> <li><a href="#">benefits</a> <ul> <li><a href="#">large corporates</a> </li> <li><a href="#">small & medium<br> businesses</a> </li> <li><a href="#">entrepreneurs &<br> start-ups</a> </li> <li><a href="#">education &<br> non-profit</a> </li> <li><a href="#">web developers &<br> agencies</a> </li> <li><a href="#">artists &<br> celebrities</a> </li> </ul> </li> <li><a href="#&

mongodb - Getting value map is not a member of Object when doing getOrElse with Future in my Play2 app -

i'm trying comprehension when calling mongo instance reactivemongo. method should check if result returned, if not return future(notfound). i'm getting error don't understand. [info] compiling 8 scala sources , 1 java source /users/projects/reco_play/parser/target/scala-2.10/classes... [error] /users/projects/reco_play/parser/app/controllers/application.scala:94: value map not member of object [error] }.getorelse(future(notfound)) [error] ^ [error] 1 error found [error] (compile:compile) compilation failed imports: import play.api.mvc._ import play.api.play.current import play.api.logger import play.modules.reactivemongo.{reactivemongoplugin, mongocontroller} import models.{company} import reactivemongo.api.collections.default.bsoncollection import reactivemongo.bson.{bsonobjectid, bsondocument} import org.joda.time.datetime import scala.concurrent.{future, executioncontext} method: def showeditform(id: string) = action { imp

c - Parsing a string separated by commas works only once? -

i have menu when press 'a' following code parses numbers separated commas. first time press 'a' results 100% accurate. second+ times press 'a' menu repeat same code, strange results. using mplab c18 compiler pic18 i using mplab c18 compiler pic18 first time output 0002 0100 0200 0100 second+ times output 0002 code char somestr[] ="2,0100,0200,0100"; char *pt; int a; pt = strtokpgmram (somestr,","); while (pt != null) { = atoi(pt); printf("%d\n", a); pt = strtokpgmram (null, ","); } how fix every time press 'a' menu same results first time output? thank you! this because, calling strtok() change original string itself. have make copy of original string before calling strtok(). i made sample program understanding. see, in tokenize function, everytime making copy , using copy. #include<stdio.h> #include<string.h> void tokenize

c# - Automatic conversion of winmd to DLL -

i'd create tool accepts . winmd file (windows runtime component) , generates c# dll out of (containing public types defined in component). as far i've learned, standard .net reflection apis cannot work on .winmd files, , 1 must used metadata unmanaged apis access information. the question -- possible construct c# assembly out of information retrieved metadata api? or better yet -- there tool (like tlbimp) job or similar? a windows metadata file doesn't contain code - it's set of type definitions. , winmd file ecma 335 assembly, is c# dll (just rename .winmd .dll).

Facebook FQL: Getting pages a user likes, which at least one of their friends also likes -

is possible? tried 1 thing not work: select name page page_id in ( select page_id page_fan uid = me() , page_id in ( select page_id page_fan uid in ( select uid2 friend uid1 = me() ) ) ) do need pages user likes , loop through them all, checking friend likes? this fql trick: select name page page_id in (select page_id page_fan uid in (select uid2 friend uid1 = me ())) , page_id in (select page_id page_fan uid = me()) hope work ,,,

Android problems binding started service -

i start service in oncreate() (if oncreate called first time) , call bindservice in onstart(). service probaply works, after calling bindservice local instance of service still null. furthermore, seems getservice() not called.? here code: @override protected void oncreate(bundle savedinstancestate) { ... if(savedinstancestate == null){ final intent = new intent(this, hostservice.class); startservice(i); } } protected void onstart(){ super.onstart(); bindservice(new intent(this, startgameactivity.class), connection, context.bind_auto_create); } private serviceconnection connection = new serviceconnection(){ @override public void onserviceconnected(componentname arg0, ibinder arg1) { hostbinder binder = (hostbinder) arg1; hostservice = binder.getservice(); isbound = true; } @override public void onservicedisconnected(componentname arg0) { isbound = false; } }; and in hostservice: ... private hostbinder

ios - Best practice to process big plists? -

i'm using plist file contains app data. file quite big , i'm loading stuff arrays , dictionaries @ first launch , save them userdefaults don't have touch plist again. takes 10 secs (ip4) wonder if there faster (better) way process plist. checked whole startup instruments , going through hundreds of entries fastest part. takes long save these processed stuff nsuserdefaults. you might benefit saving plist own file. way control reading/writing, don't have overhead associated nsuserdefaults, and, importantly, can ensure format. is, if reading/writing producing slow down, you'll have minimize plist file size. using plist format of nspropertylistbinaryformat_v1_0 that: see: + (nsinteger) writepropertylist: (id) plist tostream: (nsoutputstream *) stream format: (nspropertylistformat)format options: (nspropertylistwriteoptions) opt error: (nserror **) e

c# - Implement custom CopyToDataTable method while keeping the original one -

i followed link , created custom copytodatatable method no problem. copytodatatable called in other places , getting errors because point new 1 created. is there way keep both version , both referenced correctly?

php - Twitter Bootstrap Responsive not work -

Image
i'm doing testing twitter bootstrap , 1 of important things me is responsive. doing tests browser , when gets size changes size of input in layout. below picture of big screen , tail off when: this code i'm using layout zendframework 1:13: zend form: $login = new zend_form_element_text('ds_nick_usr'); $login->setlabel('login:') ->setrequired(true) ->addfilter('striptags') ->addfilter('stringtrim') ->setoptions(array( 'placeholder'=>'usuario', 'class'=>'span1' )); $login->removedecorator('label'); $login->removedecorator('htmltag'); $password = new zend_form_element_password('ds_password_usr'); $password->setlabel('senha:') ->setrequired(true) ->addfilter('striptags') ->addfilter('str