[web2py] Why do I get a never ending 'working' on trying to update my pic in the form in default/screen.html
in model: db.define_table('info', Field('info_id', default=auth.user_id, writable=False, readable=False), Field('dp','upload',label='Update your profile pic'), Field('first_name',requires=IS_NOT_EMPTY(error_message="Please fill it")), Field('last_name',requires=IS_NOT_EMPTY(error_message="Please fill it")), Field('dob','date', default=request.now,requires=IS_NOT_EMPTY(error_message="Please fill it"), label='Date of Birth'), Field('sex',requires=IS_IN_SET(['Male','Female','Other'],error_message="Please fill it")), Field('hometown',requires=IS_NOT_EMPTY(error_message="Please fill it")), Field('highschool', label='High School'), Field('university'), Field('oneself', 'text', label='Write about yourself'), ) in controller: @auth.requires_login() def screen(): row=db(db.info.info_id==auth.user_id).select().first() return locals() def delformforscreen(): row=db(db.info.info_id==auth.user_id).select().first() form=SQLFORM(db.info,row.id).process() submit=form.element("input",_type="submit") submit["_onclick"]="return confirm('Are you sure');" return locals() My views: in default/screen.html: {{extend 'layout.html'}} Hi {{=row.first_name}}! {{=LOAD('default', 'delformforscreen.load', ajax=True)}} in delformforscreen.load: jQuery(document).ready(function(){ jQuery('#info_id__row').hide(); }); {{=form}} -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Why do I get a never ending 'working' on trying to update my pic in the form in default/screen.html
So any another idea, how to do it? On Wednesday, March 30, 2016 at 1:16:43 AM UTC+5:30, Leonel Câmara wrote: > > You're trying to upload an image using ajax which is a little bit more > complicated and requires you to use something to help you like > jquery.form.js otherwise it won't work. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How did you implement chat system in your app? How's my idea?
any other idea besides websocket? On Tuesday, March 29, 2016 at 12:07:00 AM UTC+5:30, Ron Chatterjee wrote: > > > https://www.toptal.com/tornado/simple-python-websocket-server?utm_campaign=blog_post_simple_python_websocket_server&utm_medium=email&utm_source=blog_subscribers > > Interesting article. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How did you implement chat system in your app? How's my idea?
But websocket is not supported by Android, right? Most of my users will use android , which will be best in that case? On Tuesday, March 29, 2016 at 12:07:00 AM UTC+5:30, Ron Chatterjee wrote: > > > https://www.toptal.com/tornado/simple-python-websocket-server?utm_campaign=blog_post_simple_python_websocket_server&utm_medium=email&utm_source=blog_subscribers > > Interesting article. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to install some module, say unirest into my web2py app?
I need to use apis for which I need unirest for a must. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to use sms services in web2py?
Please dont redirect me to the book because it isn't mentioned nicely there. Please let me know the stepwise procedure. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] What's this and how do I correct this?
Yesterday my app was working fine. I didnt even insert anything to it. What is this error? What do I do now? Not even appadmin is opening! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: What's this and how do I correct this?
I can't even open the appadmin now. They show eror tokens. Even edit option wasn;t there but managed to open it by editing the url of another app. On Sunday, April 3, 2016 at 3:54:24 PM UTC+5:30, Leonel Câmara wrote: > > Erase your .table files in the databases folder and then do a fake > migration to generate them again. > > See > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Fixing-broken-migrations > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Being from India, where should I host my web2py app as pythonanywhere is costly?
Also can you tell me how much will it cost me. My site wont have much traffic. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Can someone help me in changing the background image every 5 sec using jquery in web2py?
supposing that I have my images in db, how do I change the background image every 5 secs? Please help me with a clean code. Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do you change the color of the label of the sqlforms display in the view?
exact syntax? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] what does this syntax mean?
< a href="{{=URL('default','caller',args=row.id), [kk, joe])}}">Call us what is difference between performance of row.id and kk, joe. what is the exact difference between request.args and request.vars as here? when do we use each of that? they look interchangeable to me. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: what does this syntax mean?
yeah i put the bracket wrongly. so whats the difference between the args and the vars and when do we use each of them? On Sunday, April 17, 2016 at 9:32:20 PM UTC+5:30, villas wrote: > > I do not see how this line is valid... > > URL('default','caller',args=row.id), [kk, joe]) > > The brackets do not match? > > Vars are normally expressed as a dict. Something like this in your > template might make more sense. > > {{ myvars = {'var1':'kk', 'var2':'joe'} }} > {{=A('Call Us', _href= URL('default','caller',args=row.id, vars=myvars)) > }} > > Note the result would be this (assuming row.id is 1): > Call Us > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Is the following code thread safe?
#get the path to the currunt file.Assuming python code and C code to be #executed are in same Folder base=os.path.dirname(os.path.dirname(__file__)) path=os.path.join(base,"python") #we have to get drive: base=base.split(':') base=base[0]; I am trying to write a code to compile c files. Will this be threadsafe? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do I make form field have atleast 10 char long input by the user?
Field('longname') #what to write in requires=? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do I avoid this error?
adding the field: Field('username', requires=IS_NOT_EMPTY(), unique=True) gives me the following error: Cannot add a UNIQUE column How to avoid this error? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do I send same mail to a list of email ids?
mail.send('m...@some.com' , #here i want to attach a list of mail ids. 'Subject', 'Body' ) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to append (not erase and write) something to my div with id target called by ajax?
ajax('{{=URL('default', 'ignite')}}', 'q', 'target'); So taeget is the id of div which shoes something as per requested by the user. But I want the old results too. How do I simply append and not get rewritten stuffs? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Not web2py related but want an advice.
So my college is offering me to do a parallel programming and CUDA course. I am inclined towards making a career in web development. Should i go for this course? Does it have any good scope in web development too or should I invest time learning web development itself nicely. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How do I send same mail to a list of email ids?
No that's what I asked. supposing i have a predefined list say L having many email ids. Can I simply send to a mail to everyone like this: mail.send(to=L, On Wednesday, April 20, 2016 at 2:18:48 AM UTC+5:30, Dave S wrote: > > > > On Tuesday, April 19, 2016 at 1:24:34 PM UTC-7, Emmanuel Dsouza wrote: >> >> mail.send('ma...@some.com' , #here i want to attach a list of mail ids. >> 'Subject', >> 'Body' >> ) > > > I think you just put a list in the 'to' argument. > > mail.send(['firs...@there.com ', 'secon...@elsewhere.net > ', 'thir...@nowhere.org ']), > > > > /dps > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How do I send same mail to a list of email ids?
No that's not what I asked. supposing i have a predefined list say L having many email ids. Can I simply send to a mail to everyone like this: mail.send(to=L, On Wednesday, April 20, 2016 at 2:17:11 AM UTC+5:30, Niphlod wrote: > > mail.send has to,cc and ccn that take either a list or a string. to send > to two email addresses in the "to", use > > mail.send(to=['ma...@example.com ', 'ma...@example.com > '], ) > > On Tuesday, April 19, 2016 at 10:24:34 PM UTC+2, Emmanuel Dsouza wrote: >> >> mail.send('ma...@some.com' , #here i want to attach a list of mail ids. >> 'Subject', >> 'Body' >> ) > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do I add extra buttons to a SQLFORM which will one to a different view?
form=SQLFORM(db.person).process() -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] I am looking for internship in a firm that uses web2py but I don't find anyone in India?
Can someone help me in getting link for one? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to add payment integration in web2py?
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Not a web2py question though.
This group has helped me a lot in learning web2py. I also want to learn phonegap. Is any group as good as this which helps the users learn phonegap efficiently by answering their questions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Any script for compiling c++ codes from web2py?
or any link? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Why is this code for getting variables from view to controller not working?
in view: *{{extend 'layout.html'}}* ** ** *function myFunction(){* *var value = 22;* *ajax('{{=URL('default', 'my_action', vars=dict(value=str(value)))}}', [], 'target');* *}* ** ** *here* ** ** it says: name 'value' is not defined -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Any script for compiling c++ codes from web2py?
yeah exactly. thanks On Monday, May 9, 2016 at 11:54:47 PM UTC+5:30, Leonel Câmara wrote: > > Well you could run the compiler command like you would for any other > command (for instance using subprocess), is this what you want? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] What is the difference between these two in relation with working of script?
{{extend 'layout.html'}} If you see this for more than 10 seconds it means that your browser is unable to search for your location. You can do the following to avoid this: 1).Try switching on Location in the settings. 2).Check and fix your internet connection problem. var c=1; var x = document.getElementById("location"); window.setInterval(function() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } }, 5000); function showPosition(position) { c=c+1; x.innerHTML =c+" " + "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude+ "
"; ajax('{{=URL("default","getaddress")}}' + '?latitude=' + position.coords.latitude + '&longitude=' + position.coords.longitude ,[],'target'); } and {{extend 'layout.html'}} var c=1; var x = document.getElementById("location"); window.setInterval(function() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } }, 5000); function showPosition(position) { c=c+1; x.innerHTML =c+" " + "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude+ "
"; ajax('{{=URL("default","getaddress")}}' + '?latitude=' + position.coords.latitude + '&longitude=' + position.coords.longitude ,[],'target'); } If you see this for more than 10 seconds it means that your browser is unable to search for your location. You can do the following to avoid this: 1).Try switching on Location in the settings. 2).Check and fix your internet connection problem. the first one doesn't show any location at all! Why? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] What's wrong with this script?
[web2py] It seems that this ajax request is made only when we are seeing it on present tab? How to avoid this
I double checked that this ajax request from my view works only when I am looking at the tab on which the view is displayed. If I minimize the browser or say, I work on other browser it doesn't work. Again when I switch over to this tab it tries to make up for the sleep mode it had gone to and makes all past ajax request at one go! How to avoid this and make it work even if I'm not on the same tab? *ajax('{{=URL("default","getaddress")}}' + '?latitude=' + position.coords.latitude + '&longitude=' + position.coords.longitude ,[],'target');* here latitude, longitude are variables that I am getting from HTML5 geolocation. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: It seems that this ajax request is made only when we are seeing it on present tab? How to avoid this
no Niphlod, there is a difference between the two: *window.setInterval(function() {* *//some code for html5 geolocation* *ajax('{{=URL("default","getaddress")}}' + '?latitude=' + position.coords.latitude + '&longitude=' + position.coords.longitude ,[],'target');* *}, 5000);* and *window.setInterval(function() {* *ajax('{{=URL("default","checkme")}}' ,[],'target');* *}, 5000);* the second one works always. I have double checked it. But first one goes inactive when not on present tab. How to tackle this? On Wednesday, May 11, 2016 at 1:42:38 PM UTC+5:30, Niphlod wrote: > > this is quite a default behaviour in all modern browsers: the inactive tab > is --- inactive. > > On Wednesday, May 11, 2016 at 9:09:10 AM UTC+2, Emmanuel Dsouza wrote: >> >> I double checked that this ajax request from my view works only when I am >> looking at the tab on which the view is displayed. If I minimize the >> browser or say, I work on other browser it doesn't work. Again when I >> switch over to this tab it tries to make up for the sleep mode it had gone >> to and makes all past ajax request at one go! How to avoid this and make it >> work even if I'm not on the same tab? >> >> *ajax('{{=URL("default","getaddress")}}' + '?latitude=' + >> position.coords.latitude + '&longitude=' + position.coords.longitude >> ,[],'target');* >> >> here latitude, longitude are variables that I am getting from HTML5 >> geolocation. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: What's wrong with this script?
Thanks a lot Dave. I checked it out on Microsoft Udge, UC Mobile Browser, Firefox as well Chrome. It doesn't work on Chrome otherwise it does work flawlessly on the others. What may be the possible reasons why this doesn't worked on Chrome? On Thursday, May 12, 2016 at 12:50:55 AM UTC+5:30, Dave S wrote: > > On Tuesday, May 10, 2016 at 9:45:36 PM UTC-7, Emmanuel Dsouza wrote: >> >> [subject: What's wrong with this script?] >> > [snip code] >> > so as you can see I am printing in target and location. The one with id >> location also prints autoincremented c and the one with ajax call prints >> auto incremented session.count in target However I see that ajax one will >> work only when that particular tab is open. I want this to work even if i >> am working on another tab. >> > > You've got a series of related threads, which seem to revolve around the > same core issue. But you haven't said which browser(s) you are > experiencing the issues in. > > This may be browser-specific behavior; it is certainly javascript-specific > behavior. > > BTW, if you need to do testing of your website in a lot of browsers, but > don't have that many in your own lab, > https://www.browserling.com/> > might be helpful. They have an array of target machines with different > OS/browser combinations and give you a virtual window to them. > > To access all the combinations requires subscribing, but the prices aren't > too bad. Certainly less than buying 10 used laptops. For free access, the > choices are limited and you only get a 3 minute session each try, but even > that might be helpful. Additional features include their Bug Hunter tool, > but maybe you've already been testing with Selenium or another tool. There > are also tools for recording and sharing and screenshots. > > /dps > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
CONTROLLER: def retimage(): k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] from random import randint i=randint(0,2) return k[i] def index(): return locals() VIEW: {{extend 'layout.html'}} window.setInterval(function(){ {{getimage=retimage()}} document.body.background = url("{{=getimage}}"); }, 5000); http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
I am getting: name 'retimage' is not defined On Monday, June 13, 2016 at 3:17:15 PM UTC+5:30, Massimiliano wrote: > > In *k* you have strings like “URL(‘static’,’images/1.jpg’)” not the URL > func result. > > Try something like that: > > def retimage(): > from random import randint > i=randint(0,2) > return URL(‘static’,’images/%d.jpg’ % (i)) > > > > On Mon, Jun 13, 2016 at 11:30 AM, Emmanuel Dsouza > wrote: > >> CONTROLLER: >> >> def retimage(): >> >> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] >> from random import randint >> i=randint(0,2) >> return k[i] >> def index(): >> return locals() >> >> VIEW: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{getimage=retimage()}} >> document.body.background = url("{{=getimage}}"); >> }, 5000); >> >> > >> >> How should I correct this? >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Massimiliano > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
My update code: def retimage(): from random import randint i=randint(0,2) return URL('static','images/%d.jpg' %(i)) def index(): return dict(retimage=retimage) {{extend 'layout.html'}} window.setInterval(function(){ {{getimage=retimage()}} document.body.background = url("{{=getimage}}"); }, 500); Still doesn't work! On Monday, June 13, 2016 at 3:17:15 PM UTC+5:30, Massimiliano wrote: > > In *k* you have strings like “URL(‘static’,’images/1.jpg’)” not the URL > func result. > > Try something like that: > > def retimage(): > from random import randint > i=randint(0,2) > return URL(‘static’,’images/%d.jpg’ % (i)) > > > > On Mon, Jun 13, 2016 at 11:30 AM, Emmanuel Dsouza > wrote: > >> CONTROLLER: >> >> def retimage(): >> >> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] >> from random import randint >> i=randint(0,2) >> return k[i] >> def index(): >> return locals() >> >> VIEW: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{getimage=retimage()}} >> document.body.background = url("{{=getimage}}"); >> }, 5000); >> >> > >> >> How should I correct this? >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Massimiliano > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
I was obviously waiting for your reply only. Ok Anthony I got what you said. But how do I get a variable through an ajax call? Ajax only updates a tag id, right? How do I edit this to make it work? in controller: def index(): return locals() in model: def retimage(): from random import randint i=randint(0,2) return URL('static','images/%d.jpg' %(i)) in view: {{extend 'layout.html'}} window.setInterval(function(){ {{getimage=retimage()}} document.body.style.background-image = url("{{=getimage}}"); }, 500); I am confused on how to get a variable value though ajax calls. Please help me on this. On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote: > > You cannot call Python functions on the server from Javascript code > running in the browser. The following line: > > {{getimage=retimage()}} > > will be called exactly once on the server *before *the HTML page is ever > sent to the browser, and it will not result in anything being written into > the Javascript code (if you look at the page source in the browser, you > will see nothing there). > > If you need to retrieve images from the server without reloading the page, > you must use Ajax. > > Anthony > > > On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote: >> >> CONTROLLER: >> >> def retimage(): >> >> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] >> from random import randint >> i=randint(0,2) >> return k[i] >> def index(): >> return locals() >> >> VIEW: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{getimage=retimage()}} >> document.body.background = url("{{=getimage}}"); >> }, 5000); >> >> >> >> >> How should I correct this? >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
Thank you Anthony but still it is not going through! Could you check why: {{extend 'layout.html'}} window.setInterval(function(){ {{i=URL('static','images/%d.jpg' %(randint(0,2)))}} document.body.style.background = url("{{=i}}"); }, 5000); Even this one doesn't work: {{extend 'layout.html'}} window.setInterval(function(){ {{f=["lightblue","pink","green"]}} {{z=f[randint(0,2)]}} document.body.style.background = {{=z}}; }, 5000); On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote: > > Actually, in this case, you don't really need to bother with Ajax. > Instead, just implement the random integer generation in Javascript and use > the random integer to generate the URL in Javascript. > > For future reference, though, the third argument to the ajax() function > can be ":eval" (which tells it to evaluate the returned value as JS code) > or a JS function (which will be passed the returned value). See the > documentation. > > Anthony > > On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote: >> >> I was obviously waiting for your reply only. >> Ok Anthony I got what you said. But how do I get a variable through an >> ajax call? Ajax only updates a tag id, right? >> How do I edit this to make it work? >> >> in controller: >> >> def index(): >> return locals() >> >> in model: >> >> def retimage(): >> from random import randint >> i=randint(0,2) >> return URL('static','images/%d.jpg' %(i)) >> >> in view: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{getimage=retimage()}} >> document.body.style.background-image = url("{{=getimage}}"); >> }, 500); >> >> >> >> I am confused on how to get a variable value though ajax calls. Please >> help me on this. >> >> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote: >>> >>> You cannot call Python functions on the server from Javascript code >>> running in the browser. The following line: >>> >>> {{getimage=retimage()}} >>> >>> will be called exactly once on the server *before *the HTML page is >>> ever sent to the browser, and it will not result in anything being written >>> into the Javascript code (if you look at the page source in the browser, >>> you will see nothing there). >>> >>> If you need to retrieve images from the server without reloading the >>> page, you must use Ajax. >>> >>> Anthony >>> >>> >>> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote: >>>> >>>> CONTROLLER: >>>> >>>> def retimage(): >>>> >>>> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] >>>> from random import randint >>>> i=randint(0,2) >>>> return k[i] >>>> def index(): >>>> return locals() >>>> >>>> VIEW: >>>> >>>> {{extend 'layout.html'}} >>>> >>>> window.setInterval(function(){ >>>> {{getimage=retimage()}} >>>> document.body.background = url("{{=getimage}}"); >>>> }, 5000); >>>> >>>> >>>> >>>> >>>> How should I correct this? >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?
But how do I opened a random d.jpg through Javascript to a URL that is in Python? On Tuesday, June 14, 2016 at 5:14:13 PM UTC+5:30, Anthony wrote: > > No, you're still attempting to run Python code in Javascript. You must > write actual Javascript code -- no Python. You should only be using Python > to create the base URL -- for example: > > var baseUrl = '{{=URL('static', 'images')}}'; > [everything else is Javascript] > > Anthony > > On Tuesday, June 14, 2016 at 7:38:15 AM UTC-4, Emmanuel Dsouza wrote: >> >> Thank you Anthony but still it is not going through! >> Could you check why: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{i=URL('static','images/%d.jpg' %(randint(0,2)))}} >> document.body.style.background = url("{{=i}}"); >> }, 5000); >> >> >> >> Even this one doesn't work: >> >> {{extend 'layout.html'}} >> >> window.setInterval(function(){ >> {{f=["lightblue","pink","green"]}} >> {{z=f[randint(0,2)]}} >> document.body.style.background = {{=z}}; >> }, 5000); >> >> >> >> On Tuesday, June 14, 2016 at 12:29:52 PM UTC+5:30, Anthony wrote: >>> >>> Actually, in this case, you don't really need to bother with Ajax. >>> Instead, just implement the random integer generation in Javascript and use >>> the random integer to generate the URL in Javascript. >>> >>> For future reference, though, the third argument to the ajax() function >>> can be ":eval" (which tells it to evaluate the returned value as JS code) >>> or a JS function (which will be passed the returned value). See the >>> documentation. >>> >>> Anthony >>> >>> On Tuesday, June 14, 2016 at 1:58:32 AM UTC-4, Emmanuel Dsouza wrote: >>>> >>>> I was obviously waiting for your reply only. >>>> Ok Anthony I got what you said. But how do I get a variable through an >>>> ajax call? Ajax only updates a tag id, right? >>>> How do I edit this to make it work? >>>> >>>> in controller: >>>> >>>> def index(): >>>> return locals() >>>> >>>> in model: >>>> >>>> def retimage(): >>>> from random import randint >>>> i=randint(0,2) >>>> return URL('static','images/%d.jpg' %(i)) >>>> >>>> in view: >>>> >>>> {{extend 'layout.html'}} >>>> >>>> window.setInterval(function(){ >>>> {{getimage=retimage()}} >>>> document.body.style.background-image = url("{{=getimage}}"); >>>> }, 500); >>>> >>>> >>>> >>>> I am confused on how to get a variable value though ajax calls. Please >>>> help me on this. >>>> >>>> On Monday, June 13, 2016 at 8:46:28 PM UTC+5:30, Anthony wrote: >>>>> >>>>> You cannot call Python functions on the server from Javascript code >>>>> running in the browser. The following line: >>>>> >>>>> {{getimage=retimage()}} >>>>> >>>>> will be called exactly once on the server *before *the HTML page is >>>>> ever sent to the browser, and it will not result in anything being >>>>> written >>>>> into the Javascript code (if you look at the page source in the browser, >>>>> you will see nothing there). >>>>> >>>>> If you need to retrieve images from the server without reloading the >>>>> page, you must use Ajax. >>>>> >>>>> Anthony >>>>> >>>>> >>>>> On Monday, June 13, 2016 at 5:30:47 AM UTC-4, Emmanuel Dsouza wrote: >>>>>> >>>>>> CONTROLLER: >>>>>> >>>>>> def retimage(): >>>>>> >>>>>> k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] >>>>>> from random import randint >>>>>> i=randint(0,2) >>>>>> return k[i] >>>>>> def index(): >>>>>> return locals() >>>>>> >>>>>> VIEW: >>>>>> >>>>>> {{extend 'layout.html'}} >>>>>> >>>>>> window.setInterval(function(){ >>>>>> {{getimage=retimage()}} >>>>>> document.body.background = url("{{=getimage}}"); >>>>>> }, 5000); >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> How should I correct this? >>>>>> >>>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.