Posts

Is it possible to pass Facebook Graph API access token through request header? -

i testing facebook graph api v2.3 postman . while possible response putting access token in query string follow: https://graph.facebook.com/v2.3/me?access_token=my_access_token i wondering whether it's possible same thing http request headers, this: get /v2.3/me http/1.1 host: graph.facebook.com authorization: <my_access_token> cache-control: no-cache postman-token: <postman_token> based on similar question (i.e. how should client pass facebook access token server? ) on stackoverflow, seems should possible. any thoughts on this? edit: what raised interest that, when used api graph explorer provided facebook developers, seems there's no query string in sandbox either. how work? facebook api graph explorer use query string access token. @cbroe 's response. yes possible authorization: oauth accesstokenhere e.g. curl --header "authorization: oauth caac...zd" https://graph.facebook.com/me

c++ - Array of objects not working correctly -

i have class creates array of objects class(the array class friend) class vector_xxl { int i=0,n=0; xxl_nr *xxlvector; public: vector_xxl(int y) { n = y; xxlvector = new xxl_nr[y];} n size of array. xxl_nr class creates large numbers represented linked list(each digit has spot on list) i want product of each 2 numbers 2 array objects on same positions. so, example, v[i]*d[i] , = 0,n; this function should doesn't work correctly: void produs_scalar(vector_xxl a) { xxl_nr temp(2),temp1(2),temp2(2),result(2); vector_xxl vector_result(n); temp1 = this->xxlvector[0]; temp2 = a.xxlvector[0]; temp1.addition(temp2); for(i=0;i<n;i++) { temp = this->xxlvector[i].product(a.xxlvector[i]); vector_result.xxlvector[i] = temp; } for(i=0;i<n;i++) result= temp.product(vector_result.xxlvector[i]); result.print(); } i used temp1, , temp2 test if can use product method(defin...

Multiplying column values in Google Spreadsheet with ability to add/delete rows -

Image
i have invoice, there 2 columns: rate (column h) , quantity (column i). , there amount (column j). i need formula automatically multiply rate , quantity , show in amount . number of rows changing (added or deleted), formula should still work. the following arrayformula() spans row 5 ("books name") row 14 ("total price"), adding rows or deleting them should not problem: =arrayformula(if((c5:c14="books name")+(c5:c14="total price")=1,"",h5:h14*i5:i14)) however, since formula have reside in column j, following formula more useful: =arrayformula(if(c5:c14="books name","amount",if(c5:c14="total price","",h5:h14*i5:i14)))

cordova - localStorage not being persisted in hybrid app in Android M42 -

in latest release of ·android system webview (m42 42.0.2311.129)· there seems issues localstorage in hybrid apps. i've submitted bug report trying find workaround objects not being persisted in localstorage. this taken bug report: steps reproduce problem: 1. start hybrid app built phonegap 2. in app, call javascript localstorage.setitem("m42bug","test localstorage") 3. through developer tools debugging confirm object has been stored: localstorage.getitem("m42bug") 4. close app (swipe away, force close or restarting device cause same) 5. start app 6. in app, call javascript localstorage.getitem("m42bug") what expected behavior? localstorage.getitem("m42bug") should return value "test localstorage" what went wrong? localstorage.getitem("m42bug") returns null. object.keys(localstorage) indicate there no key m42bug faced exact same problem. workaround store localstorage data on phon...

c - count number of ones in a given integer using only << >> + | & ^ ~ ! = -

this question has answer here: how count number of set bits in 32-bit integer? 48 answers how write c program using << >> + | & ^ ~ ! = counts number of ones in given integer? have @ bit twiddling hacks stanford. here choices problem: the naïve approach unsigned int v; // count number of bits set in v unsigned int c; // c accumulates total bits set in v (c = 0; v; v >>= 1) { c += v & 1; } with lookup table static const unsigned char bitssettable256[256] = { # define b2(n) n, n+1, n+1, n+2 # define b4(n) b2(n), b2(n+1), b2(n+1), b2(n+2) # define b6(n) b4(n), b4(n+1), b4(n+1), b4(n+2) b6(0), b6(1), b6(1), b6(2) }; unsigned int v; // count number of bits set in 32-bit value v unsigned int c; // c total bits set in v // option 1: c = bitssettable256[v & 0xff] + bitssettable256[(v >> ...

pushdown automaton - Approach to finding the context free grammar of more complicated languages -

i'm having problems approaching following problem. give context free grammar following language: {x#y | x,y in {0,1}* , |x| != |y|} what best way approach question? @ moment i'm using intuition solve questions these there useful techniques? i.e. think of pda language , derive grammer that? there method finding grammer g = , b using grammars , b? i'm struggling see how solve appreciated. thanks. using intuition valuable technique. solve more such problems, intuitions sharpen, gets easier. there's no formal technique convert description of language cfg (unless description maps onto cfgs, of course, set of production rules). not, in general, decidable whether language context-free (although cfgs must conform lot of constraints, possible prove language not cfg, semi-mechanically using counting arguments.) , not case intersection of 2 context-free languages context-free, there no procedure can take 2 context-free languages , generate cfg conjunctio...

c++11 - c++ typedef/type substitution for enumeration class -

as far aware @ moment not possible typedef of c++11 enum class . know if there other way can reduce length of name of variable enum when referring outside of encapsulating class. here example: // along lines of: class segmentactivitystate; using segmentactivitytype = segmentactivitystate::activitystatetype; // ...however, results in compile time error: // 'segmentactivitystate' not name type. // enumeration class definition class segmentactivitystate { public: enum class activitystatetype : index { preexecution = 0, /**< pre-execution state. */ execution = 1, /**< execution state. */ postexecution = 2 /**< post-execution state. */ }; private: activitystatetype activitystate; /**< unique object identifier tag. */ public: // ... methods work on activitystate } the important issue length of name have refer enum outside of segmentactivitytype . example, in order type comparison need write segmentactivity....