[web2py] Re: scheduler on webfaction
not tested, but did you try with nohup python web2py.py -K statecouncil ? On Wednesday, April 10, 2013 4:20:28 AM UTC+2, Jake Lowen wrote: Hi. I have web2py installed on webfaction as my production server. I followed the web2py documentation on it's scheduler function and built an app where everything works as anticipated. (very cool!) In order to run the scheduler though I need to SSH into the server and run this command: python ~/webapps/web2py/web2py/web2py.py -K statecouncil All is well as long as I maintain my SSH session, but (obviously) when I close that session, the above command no longer runs anymore. How can I keep that command running at all times? Is there a tutorial for installing the scheduler as a service on webfaction that is not depended on my personal computer being connected for it to run? Thanks! -- --- 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/groups/opt_out.
Re: [web2py] Re: Server-Sent Events
On Wednesday, April 10, 2013 12:53:01 AM UTC+2, Arnon Marcus wrote: Well, again, Redis IS required for inter-controller communication... (the notorious green arrows in my picture...) Which is, to me, a trivial requirement for most production use-cases... I use redis too in standard deployments, it was only for next eyes coming to this thread. So, to sum-up : - For inter-controller communications, you need an external message-broker (Redis/RabbitMQ). - To avoid polling the message-broker, you need concurrency (threads/processes/Eevntlets). Now we can move on to Socket.IO: http://www.youtube.com/watch?v=TH-ZCuOdrQE yeah! What integration for it (if any), already exists within web2py for a gevent'ed-deployment story ? Noone within web2py, but the library gevent-socketio is advertised as simple to inject. I don't know or care much for Tornado... From what I gather, it is similar to twisted in terms of asynchronous-coding requirements... well, tornado is a friendlier implementation of the twisted event-loop for webservers. Given though that the partnership between gevent and socketio is stronger, I'd go for gevent too. The way I understand it, unless there is some special-integration code, then using socket.io, would usually require running an independent gEvent'ed Socket.IO server - and routing /socket.io/* URI's in the web-server to it... It will then deal with all browser's client-socket.io interactions, and inter-operate with web2py via a message-broker (as noted above). Am I understanding this correcty? yes. Also if it was a single process (i.e. you successfully embed gevent-socketio within web2py) with your requirements a message broker would be needed anyway: it's up to you if you want to have a single process serving two masters (standard traffic and socket-io ones) or two separate processes handling their own business. -- --- 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/groups/opt_out.
[web2py] db.mytab.fieldname.represent = lambda x,row : row[fieldname] how to pass the fieldname to lambda
hi, I am trying to change the reprsentation of a field value dynamically for each fieldname, for this purpose I need to know the fieldname of the current value that has been passed to the function. Any idea how to achieve this?? I can manage to write a few lines of code in web2py source itself if you give me some directions on where to edit. this is the code. for fieldname in db.mytab.fields: db.mytab.fieldname.represent = lambda x,row:row[fieldname] thanks :) -- --- 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/groups/opt_out.
Re: [web2py] Re: How to implement PostgreSQL ts_rank function for full text search?
I am also using Postgresql's full text search. Any development in Web2py to accommodate that will we very much appreciated. Regards Johann On 9 April 2013 16:02, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is an interest example. Let me think if we can add an API like we did for PostGIS On Monday, 8 April 2013 17:59:31 UTC-5, Lisandro wrote: I've succesfully implemented postgresql fulltext search (or at least a basic implementation). In the model I have: from gluon.dal import SQLCustomType tsv = SQLCustomType(type='text', native='tsvector') db.define_table('anuncios', Field('titulo', 'string'), Field('tsv', tsv)) Then I manually created a before update trigger on the table to keep tsv field updated (when the row is updated, the new tsv value is calculated and stored). In the controller, this example of searching by a given query: resultados = db(tsv @@ plainto_tsquery('%s') %request.vars.q).select() where request.vars.q has a simple text query. This is working perfectly. Now, I want to order the results of the query by relevance, that is, I want to show first those results that are more relevant with the query.. For that, PostgreSQL full text search comes with everything I apparently need: http://www.postgresql.org/**docs/9.1/static/textsearch-** controls.html#TEXTSEARCH-**RANKINGhttp://www.postgresql.org/docs/9.1/static/textsearch-controls.html#TEXTSEARCH-RANKING But now I'm stucked in making the query via DAL sintax. The SQL sentence I want to execute is this: SELECT titulo, ts_rank_cd(tsv, query) AS rank FROM anuncios, plainto_tsquery('my search words') query WHERE query @@ tsv ORDER BY rank DESC; ¿Could somebody help me to translate this SQL sentence to DAL sintax? Thanks in advance! -- --- 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/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
[web2py] database query on nested tables
hi folks, i want to get the value of table row that have 3 nested values. my goal is to get the price value from table room_category from function check_out in my controller. how to do this in web2py efficient way? e.g. db.define_table('room_category', Field('category'), *Field('price', 'decimal(10,2)'),* format='%(category)s') db.define_table('room', Field('room_no'), Field('category', 'reference room_category'), Field('status'), Field('branch', 'reference branch'), format=lambda r: '%s-%s' % (r.branch.address, r.room_no)) db.define_table('check_in', Field('is_booking', 'boolean'), Field('booking', 'reference booking'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), format='%(description)s') db.define_table('check_out', Field('check_in', 'reference check_in'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), Field('duration'), format='%(guest)s %(room)s') thank you so much in advance -- --- 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/groups/opt_out.
[web2py] distinct keyword for SQLFORM.grid
Hi I have been struggling with how one could get just distinct records to show with SQLFORM.grid if the query passed to it involved more than one table? Doing an inner join tends to generate a lot of non-unique rows and hence it would be important to just filter out the unique ones. With select, there is support for the distinct keyword but this is not the case with SQLFORM.grid. Using the groupby keyword is one approach but this can get somewhat tedious having to specify the fields to group by in advance and hence, I would like to understand if the omission of support for distinct in SQLFORM.grid is by design? Many thanks Calvin -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
sorry the table for check out is db.define_table('check_out', Field('check_in', 'reference check_in'), Field('room'), Field('guest'), Field('description', 'text'), Field('duration'), format='%(guest)s %(room)s') i extract the room and guest value from check_in table and insert it into check_out in my controller. -- --- 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/groups/opt_out.
[web2py] Markmin: How to align text?
In Markdown I can do this (found on http://bywordapp.com/markdown/guide.html ): Alignment To align the data cells on the table, you need to introduce a special row right after the headers, that will determine how the following rows – the data rows – will be aligned. | Header One | Header Two | Header Three | Header Four | | -- | :- | :--: | --: | | Default| Left | Center | Right | Header One Header Two Header Three Header Four Default Left Center Right This is not working in markmin and I could not find in the markmin documentation to get the same. Can somebody point me to it please? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
[web2py] pass db,tablename,fields ... values to module or define table in module?
my db.tables are defined in model, i have 3 controllers, and i have some functions that are used in all 3, so i decided to create an module. now i'm a little confused, i saw some examples where tables are defined in module, and other posts where is talinkg about import wich is the best way? i would prefer to maintain tables in model and pass (db,tablename,field1,value1..) to my class and so on.(if my preference is not SF, can help me with it?) -- --- 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/groups/opt_out.
Re: [web2py] Re: .sum() and .count() in grid?
Johann, I developed an alternative to grid/smartgrid which has most of the features. I can put it on github if you like. Caution: not documented. But I'll put up a sample controller that uses it if you like. The main drawback is the search widget isn't nearly as slick as smartgrid's. And you do have to create your own query parser. But it does have a selector for the number of rows per page. On Monday, April 8, 2013 3:11:20 AM UTC-4, Johann Spies wrote: I can use SQLTABLE for this and then have to write some code for pagination and search options - all which are already in the SQLFORM.grid available. In this case addition, deletion and editing will be avoided. Regards Johann On 4 April 2013 15:17, Niphlod nip...@gmail.com javascript: wrote: I'm guessing it will be hard. You'll better code a view and access it as a fake table. PS: you show it in a grid then what record do you want to add/edit/delete ? I'm guessing that this time you want to use the grid just to search, orderby and paginate, but there's a LOT of logic inside it for more things that needs to be considered. On Thursday, April 4, 2013 12:23:58 PM UTC+2, Johann Spies wrote: How would I be able to use a query like this (or the DAL equivalent) to show the result in a grid? select so as Journal, SUM(aantal) as Articles from isi.nr_arts_per_journal group by Journal order by Journal Regars Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
[web2py] Re: performance issue time to first byte
https://lh4.googleusercontent.com/-I0kLdrEwQsY/UWVTmumUkSI/AAM/k5r4M6UFcwI/s1600/Waterfalldiagramm.png I played a little with mod_pagespeed which decreases everything but the ttfb. Here is my waterfall diagram: it doesn't look like a waterfall at all more like a drippling creek :( any suggestions how I can get rid of most of those green bars? -- --- 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/groups/opt_out.
[web2py] Re: db.mytab.fieldname.represent = lambda x,row : row[fieldname] how to pass the fieldname to lambda
Hi after trying for a long time I finally managed to do the below changes in SQLHTML.py, represent function. def represent(field, value, record): f = field.represent if not callable(f): return str(value) n = f.func_code.co_argcount - len(f.func_defaults or []) if getattr(f, 'im_self', None): n -= 1 if n == 1: return f(value) elif n == 2: return f(value, record) #My part of the code elif n == 3: return f(value, record,field) else: raise RuntimeError(field representation must take 1 or 2 args) The above addition to the represent function means we can now highlight some values in a grid by checking if they are equal to the first row's value of the same field. On Wednesday, 10 April 2013 14:12:07 UTC+5:30, Anil Nalamalapu wrote: hi, I am trying to change the reprsentation of a field value dynamically for each fieldname, for this purpose I need to know the fieldname of the current value that has been passed to the function. Any idea how to achieve this?? I can manage to write a few lines of code in web2py source itself if you give me some directions on where to edit. this is the code. for fieldname in db.mytab.fields: db.mytab.fieldname.represent = lambda x,row:row[fieldname] thanks :) -- --- 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/groups/opt_out.
[web2py] Re: Difference in headers upload/download vs static file, also in auth.wiki
Same results for 2.4.6 (please ignore the console output for download, not helpful) Nico On Sunday, April 7, 2013 9:49:26 PM UTC+2, Nico de Groot wrote: While debugging why the audio tag behaves differently (at least in Mac Chrome) depending on specifying (1) a static link to a soundfile or (2) using the auth.wiki syntax 2/sound.mp3 I notice quite a few differences in the headers. (1) static: audio controls=controlssource src=/bgo/static/media/test.mp3 //audio (2) download/auth.wiki() audio controls=controlssource src=/bgo/default/index/2/sound.mp3 //audio The two sets of settings can be shown by using curl, see below. Because essentially you ask a file to be served from the file system, you expect the same headers. But there not the same. It seems to me that extra headers and the cookie (and the session) in (2) are superfluous. And I discovered that the missing Last-Modified header causes the strange Chrome behavior. I fixed it by monkey-patching the gluon/tools.py media function inside auth.wiki. But I'm not sure if it's ok like this. Maybe the response.download function should be patched too? My patch is at the bottom. What do you think? Is this a good patch? I'm still on web2py version 2.2.1 ( will upgrade and test it on latest and trunk later, but I don't expect differences) Nico THE HEADERS (1) MacBook-Air-van-Nico:~ ncdegroot$ curl -I 127.0.0.1:8000/bgo/static/media/test.mp3 HTTP/1.1 200 OK Content-Length: 38660 X-Powered-By: web2py Last-Modified: Tue, 18 Dec 2012 11:20:41 GMT Pragma: cache Cache-Control: private Content-Type: audio/mpeg Date: Sun, 07 Apr 2013 19:19:57 GMT Server: Rocket 1.2.5 Python/2.7.3 Connection: keep-alive calling the download function() directly MacBook-Air-van-Nico:~ ncdegroot$ curl -I 127.0.0.1:8000/bgo/default/download/sound.mp3 HTTP/1.1 404 NOT FOUND Set-Cookie: session_id_bgo=127.0.0.1-8e6fd725-189d-41cd-bd6d-8c7408f66f98; Path=/ Content-Length: 536 Content-Type: text/html; charset=UTF-8 Date: Sun, 07 Apr 2013 15:44:30 GMT Server: Rocket 1.2.5 Python/2.7.3 Connection: keep-alive (2) MacBook-Air-van-Nico:~ ncdegroot$ curl -I 127.0.0.1:8000/bgo/default/index/2/sound.mp3 HTTP/1.1 200 OK Content-Length: 11310 Content-Disposition: attachment; filename=wh-aam.mp3 X-Powered-By: web2py Set-Cookie: session_id_bgo=127.0.0.1-93f3ed51-7469-4ad0-8f47-ac8d5c71b7b1; Path=/ Expires: Sun, 07 Apr 2013 11:19:33 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Content-Type: audio/mpeg Date: Sun, 07 Apr 2013 11:19:33 GMT Server: Rocket 1.2.5 Python/2.7.3 Connection: keep-alive THE PATCH (concept) The differences can be fixed by patching the media() function in the auth.wiki part gluon.tools.py: def media(self, id): request, db = current.request, self.auth.db media = db.wiki_media(id) if media: if self.manage_permissions: page = db.wiki_page(media.wiki_page) if not self.can_read(page): return self.not_authorized(page) request.args = [media.filename] return current.response.download(request, db) else: raise HTTP(404) patched def media(self, id): request, db = current.request, self.auth.db media = db.wiki_media(id) if media: if self.manage_permissions: page = db.wiki_page(media.wiki_page) if not self.can_read(page): return self.not_authorized(page) request.args = [media.filename] # patch ncdg m = current.response.download(request, db) current.session.forget() # get rid of the cookie current.response.headers['Last-Modified'] = (request.utcnow).strftime(%a, %d %b %Y %H:%M:%S GMT) del current.response.headers['Content-Disposition'] current.response.headers['Pragma'] = 'cache' current.response.headers['Cache-Control'] = 'private' return m # /patch ncdg print headers else: raise HTTP(404) -- --- 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/groups/opt_out.
[web2py] newbie question about digitally signed URLs using hmac
the book has an example to use hmac digitally signed URLs, where the KEY seems to be a global variable, ie always the same. Is this a good idea? -- --- 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/groups/opt_out.
[web2py] Re: db.mytab.fieldname.represent = lambda x,row : row[fieldname] how to pass the fieldname to lambda
for fieldname in db.mytab.fields: db.mytab.fieldname.represent = lambda x,row:row[fieldname] Two problems above. First, since fieldname is a variable, you cannot do db.mytab.fieldname -- instead it should be db.mytab[fieldname]. Second, in lambda x, row: row[fieldname] the fieldname variable is defined in the scope outside the lambda function. The last value held by fieldname will be the name of the last field in the loop. The lambda functions won't actually be called until after the loop has finished, so all of them will end up referring to the fieldname of the last field. To get around this, you can pass in the fieldname as a default argument to lambda: lambda x, row, f=fieldname: row[f] To make things even a bit simpler, you can take advantage of the fact that you can iterate over the fields directly rather than their names (and you can access each field's name via its name attribute): for field in db.mytab: field.represent = lambda x, row, f=field.name: row[f] Anthony -- --- 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/groups/opt_out.
[web2py] Re: Markmin: How to align text?
In Markdown I can do this (found on http://bywordapp.com/markdown/guide.html): markmin is documented in web2py/gluon/contrib/markmin/ There's a markmin.pdf file with a quick start guide and the complete help with examples is included in the markmin2html.py module docstrings. I don't think that text alignment is supported, only image alignment. -- --- 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/groups/opt_out.
[web2py] Re: adding jQuery effects to A helper
Ok, that makes sense. So how can you write it so the web2py component will not only fade out but will load into a specified id in the DIV as as well? The example you provided forces the link to fadeout but no longer loads the div (which makes sense). I want to do both. This is good information thank you! On Tuesday, April 9, 2013 11:11:13 PM UTC-4, Stephen McCamy wrote: Hello, I am trying to add a jQuery effect to my A helper below. I am not stuck on using the A helper but it works well so that is what I am doing. Below passes a parameter to a function and the results are loaded into the div when the function finishes. I want to indicate to the user that the link has been clicked because the function takes some time to process. I think the usage of fadeout() in this example: {{=DIV('click me!', _onclick=jQuery(this).fadeOut())}} from the documentation would be fine but it does not work when I add it to the A helper below. It just stays the same. I assume this is because the A helper overrides the jQuery somehow and treats the object as a hyperlink no matter what. I am really stuck on this. Any input would be useful. Thanks! {{=A(''Link', _href='http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div I tried: {{=A(''Link', _onclick=jQuery(this).fadeOut(), _href=' http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div with no luck. -- --- 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/groups/opt_out.
[web2py] Re: performance issue time to first byte
just a note http://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles -- --- 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/groups/opt_out.
[web2py] Rocket log colors
Is it possible to print in rocket console coloured text? how? -- --- 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/groups/opt_out.
[web2py] Re: adding jQuery effects to A helper
It works for me. Perhaps your URL isn't returning anything -- are you sure 'http://localhost/app/function1.html/?s=' + parameter generates the correct URL and returns the expected output? In particular, the parameter variable should be a previously defined Javascript variable -- does it exist? Or is it supposed to be a Python variable, in which case the code would be: A('Link', _href=# _onclick=jQuery(this).fadeOut(); \ web2py_component('http://localhost/app/function1.html/?s=%s'http://localhost/app/function1.html/?s=, 'myid'); \ return false; % parameter) Note, I also added a dummy _href above so the link will appear clickable on the page. Anthony On Wednesday, April 10, 2013 8:56:03 AM UTC-4, Stephen McCamy wrote: Ok, that makes sense. So how can you write it so the web2py component will not only fade out but will load into a specified id in the DIV as as well? The example you provided forces the link to fadeout but no longer loads the div (which makes sense). I want to do both. This is good information thank you! On Tuesday, April 9, 2013 11:11:13 PM UTC-4, Stephen McCamy wrote: Hello, I am trying to add a jQuery effect to my A helper below. I am not stuck on using the A helper but it works well so that is what I am doing. Below passes a parameter to a function and the results are loaded into the div when the function finishes. I want to indicate to the user that the link has been clicked because the function takes some time to process. I think the usage of fadeout() in this example: {{=DIV('click me!', _onclick=jQuery(this).fadeOut())}} from the documentation would be fine but it does not work when I add it to the A helper below. It just stays the same. I assume this is because the A helper overrides the jQuery somehow and treats the object as a hyperlink no matter what. I am really stuck on this. Any input would be useful. Thanks! {{=A(''Link', _href='http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div I tried: {{=A(''Link', _onclick=jQuery(this).fadeOut(), _href=' http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div with no luck. -- --- 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/groups/opt_out.
[web2py] Re: distinct keyword for SQLFORM.grid
Please open a ticket and we can add this. On Wednesday, 10 April 2013 04:46:14 UTC-5, Calvin wrote: Hi I have been struggling with how one could get just distinct records to show with SQLFORM.grid if the query passed to it involved more than one table? Doing an inner join tends to generate a lot of non-unique rows and hence it would be important to just filter out the unique ones. With select, there is support for the distinct keyword but this is not the case with SQLFORM.grid. Using the groupby keyword is one approach but this can get somewhat tedious having to specify the fields to group by in advance and hence, I would like to understand if the omission of support for distinct in SQLFORM.grid is by design? Many thanks Calvin -- --- 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/groups/opt_out.
[web2py] Re: Rocket log colors
a little bit of a streatch for a web framework http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output On Wednesday, April 10, 2013 3:07:50 PM UTC+2, Ramos wrote: Is it possible to print in rocket console coloured text? how? -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
check_in = db.check_in[id] print check_in.room.category.price On Wednesday, 10 April 2013 04:38:08 UTC-5, 黄祥 wrote: hi folks, i want to get the value of table row that have 3 nested values. my goal is to get the price value from table room_category from function check_out in my controller. how to do this in web2py efficient way? e.g. db.define_table('room_category', Field('category'), *Field('price', 'decimal(10,2)'),* format='%(category)s') db.define_table('room', Field('room_no'), Field('category', 'reference room_category'), Field('status'), Field('branch', 'reference branch'), format=lambda r: '%s-%s' % (r.branch.address, r.room_no)) db.define_table('check_in', Field('is_booking', 'boolean'), Field('booking', 'reference booking'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), format='%(description)s') db.define_table('check_out', Field('check_in', 'reference check_in'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), Field('duration'), format='%(guest)s %(room)s') thank you so much in advance -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
PS. Anyway, I would copy the price into check_in and check_out tables. I know this is redundant but in any hotel you will have to handle discounts for each individual client (to handle complaints, friends, etc.) This will give you flexibility and make it faster. On Wednesday, 10 April 2013 08:16:15 UTC-5, Massimo Di Pierro wrote: check_in = db.check_in[id] print check_in.room.category.price On Wednesday, 10 April 2013 04:38:08 UTC-5, 黄祥 wrote: hi folks, i want to get the value of table row that have 3 nested values. my goal is to get the price value from table room_category from function check_out in my controller. how to do this in web2py efficient way? e.g. db.define_table('room_category', Field('category'), *Field('price', 'decimal(10,2)'),* format='%(category)s') db.define_table('room', Field('room_no'), Field('category', 'reference room_category'), Field('status'), Field('branch', 'reference branch'), format=lambda r: '%s-%s' % (r.branch.address, r.room_no)) db.define_table('check_in', Field('is_booking', 'boolean'), Field('booking', 'reference booking'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), format='%(description)s') db.define_table('check_out', Field('check_in', 'reference check_in'), Field('room', 'reference room'), Field('guest', 'reference guest'), Field('description', 'text'), Field('duration'), format='%(guest)s %(room)s') thank you so much in advance -- --- 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/groups/opt_out.
Re: [web2py] Re: .sum() and .count() in grid?
Please! On Wednesday, 10 April 2013 06:36:45 UTC-5, Cliff Kachinske wrote: Johann, I developed an alternative to grid/smartgrid which has most of the features. I can put it on github if you like. Caution: not documented. But I'll put up a sample controller that uses it if you like. The main drawback is the search widget isn't nearly as slick as smartgrid's. And you do have to create your own query parser. But it does have a selector for the number of rows per page. On Monday, April 8, 2013 3:11:20 AM UTC-4, Johann Spies wrote: I can use SQLTABLE for this and then have to write some code for pagination and search options - all which are already in the SQLFORM.grid available. In this case addition, deletion and editing will be avoided. Regards Johann On 4 April 2013 15:17, Niphlod nip...@gmail.com wrote: I'm guessing it will be hard. You'll better code a view and access it as a fake table. PS: you show it in a grid then what record do you want to add/edit/delete ? I'm guessing that this time you want to use the grid just to search, orderby and paginate, but there's a LOT of logic inside it for more things that needs to be considered. On Thursday, April 4, 2013 12:23:58 PM UTC+2, Johann Spies wrote: How would I be able to use a query like this (or the DAL equivalent) to show the result in a grid? select so as Journal, SUM(aantal) as Articles from isi.nr_arts_per_journal group by Journal order by Journal Regars Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
[web2py] Re: newbie question about digitally signed URLs using hmac
No. If you chose to use the hmac key than you have to handle it. Normally you use URL(user_signature=True). In this case the key is per user and per session and managed for you. On Wednesday, 10 April 2013 07:36:14 UTC-5, Tim Richardson wrote: the book has an example to use hmac digitally signed URLs, where the KEY seems to be a global variable, ie always the same. Is this a good idea? -- --- 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/groups/opt_out.
[web2py] Re: Markmin: How to align text?
Also here: http://web2py.com/init/static/markmin.html On Wednesday, 10 April 2013 07:54:57 UTC-5, Alan Etkin wrote: In Markdown I can do this (found on http://bywordapp.com/markdown/guide.html): markmin is documented in web2py/gluon/contrib/markmin/ There's a markmin.pdf file with a quick start guide and the complete help with examples is included in the markmin2html.py module docstrings. I don't think that text alignment is supported, only image alignment. -- --- 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/groups/opt_out.
[web2py] Re: performance issue time to first byte
But in the articule, ttfb was trivial (particularly relative to download time). In the above waterfall, the ttfb values are large (in absolute magnitude as well as relative to the full request time). Anthony On Wednesday, April 10, 2013 8:56:39 AM UTC-4, Niphlod wrote: just a note http://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles -- --- 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/groups/opt_out.
[web2py] Re: Accessible_query with NoSQL adapters
- membership - permission - end table with the everybody_group_id logic, probably other 2 queries. Now I understand why there's no accessible_query for NoSQL, not even in the roadmap. No user would accept making 4 or 5 db queries for filtering rows in a single request. This may work in a prototype with a couple of records, but would take a lot of resources with thousands of records in production. I guess the only alternative is writing rbac data on each record with an optional field factory when creating auth (for an implementation in the Auth class), but It is a partial solution. It would not solve handling custom rights because, AFAIK, you would need one field for each permission type (read, update, custom, ...) and also it seems a lot stuff for implementing a single rbac feature. -- --- 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/groups/opt_out.
[web2py] Re: adding jQuery effects to A helper
That works perfect! Yes, I didn't include the actual URL and I was unclear that it is a python variable that I am passing. This works great! Thanks so much! On Wednesday, April 10, 2013 9:09:28 AM UTC-4, Anthony wrote: It works for me. Perhaps your URL isn't returning anything -- are you sure 'http://localhost/app/function1.html/?s=' + parameter generates the correct URL and returns the expected output? In particular, the parameter variable should be a previously defined Javascript variable -- does it exist? Or is it supposed to be a Python variable, in which case the code would be: A('Link', _href=# _onclick=jQuery(this).fadeOut(); \ web2py_component('http://localhost/app/function1.html/?s=%s'http://localhost/app/function1.html/?s=, 'myid'); \ return false; % parameter) Note, I also added a dummy _href above so the link will appear clickable on the page. Anthony On Wednesday, April 10, 2013 8:56:03 AM UTC-4, Stephen McCamy wrote: Ok, that makes sense. So how can you write it so the web2py component will not only fade out but will load into a specified id in the DIV as as well? The example you provided forces the link to fadeout but no longer loads the div (which makes sense). I want to do both. This is good information thank you! On Tuesday, April 9, 2013 11:11:13 PM UTC-4, Stephen McCamy wrote: Hello, I am trying to add a jQuery effect to my A helper below. I am not stuck on using the A helper but it works well so that is what I am doing. Below passes a parameter to a function and the results are loaded into the div when the function finishes. I want to indicate to the user that the link has been clicked because the function takes some time to process. I think the usage of fadeout() in this example: {{=DIV('click me!', _onclick=jQuery(this).fadeOut())}} from the documentation would be fine but it does not work when I add it to the A helper below. It just stays the same. I assume this is because the A helper overrides the jQuery somehow and treats the object as a hyperlink no matter what. I am really stuck on this. Any input would be useful. Thanks! {{=A(''Link', _href='http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div I tried: {{=A(''Link', _onclick=jQuery(this).fadeOut(), _href=' http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div with no luck. -- --- 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/groups/opt_out.
[web2py] Re: Accessible_query with NoSQL adapters
please do remember that most of the speedup between rdbms and nosql (yes, I'm over-generalizing, but I'm going to state a simple core-concept) is due to the lack of features like this. While a mongodb for storing incremental updates is probably a better tool for the job, it's not for complex relations handling (you have to code your own). On Wednesday, April 10, 2013 3:24:33 PM UTC+2, Alan Etkin wrote: - membership - permission - end table with the everybody_group_id logic, probably other 2 queries. Now I understand why there's no accessible_query for NoSQL, not even in the roadmap. No user would accept making 4 or 5 db queries for filtering rows in a single request. This may work in a prototype with a couple of records, but would take a lot of resources with thousands of records in production. I guess the only alternative is writing rbac data on each record with an optional field factory when creating auth (for an implementation in the Auth class), but It is a partial solution. It would not solve handling custom rights because, AFAIK, you would need one field for each permission type (read, update, custom, ...) and also it seems a lot stuff for implementing a single rbac feature. -- --- 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/groups/opt_out.
[web2py] db.count()
Hi, i have this line of code: number_of_records = db().count(db.countries.id) i am receiving an error: class 'sqlite3.OperationalError' near ;: syntax error (self=gluon.dal.SQLiteAdapter object, *a=('SELECT count(DISTINCT countries.id) FROM ;',), **b={}) What is wrong? -- --- 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/groups/opt_out.
[web2py] Re: performance issue time to first byte
I'm keen to think that TTFB in his case is due to buffering (or an inbetween proxy). Overexxagerating, either the user takes 4 seconds to download the full page (which is transmitted as soon as the webserver outputs something) or he takes 2 seconds waiting for the webserver to buffer (TTFB) and 2 seconds to download at full speed the content (cause it's buffered yet). User will have the page after 4 seconds, no matter what. -- --- 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/groups/opt_out.
Re: [web2py] Re: performance issue time to first byte
Thats exactly what i'm saying anthony. Those total times are enormous considering the whole page including images is now a little under 300kb. And i actually dont care if its called ttfb or something else i just want to have quick response times. Am 10.04.2013 15:23 schrieb Anthony abasta...@gmail.com: But in the articule, ttfb was trivial (particularly relative to download time). In the above waterfall, the ttfb values are large (in absolute magnitude as well as relative to the full request time). Anthony On Wednesday, April 10, 2013 8:56:39 AM UTC-4, Niphlod wrote: just a note http://blog.cloudflare.com/**ttfb-time-to-first-byte-** considered-meaningleshttp://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Suuc7DdjDn0/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] Re: pass db,tablename,fields ... values to module or define table in module?
Can you show some code? You might just be able to pass those objects to the class's methods when they are called. Otherwise, you could add the db object to the current object and import current in you modules, as described here: http://web2py.com/books/default/chapter/29/04#Accessing-the-API-from-Python-modules . Anthony On Wednesday, April 10, 2013 7:27:24 AM UTC-4, ctrlSoft wrote: my db.tables are defined in model, i have 3 controllers, and i have some functions that are used in all 3, so i decided to create an module. now i'm a little confused, i saw some examples where tables are defined in module, and other posts where is talinkg about import wich is the best way? i would like to maintain defining tables in model and pass (db,tablename,field1,value1..) to my class and so on.(if my preference is not SF, can help me with it?) -- --- 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/groups/opt_out.
[web2py] Re: performance issue time to first byte
edit: the real problem on that graph is that there's no concurrency: I don't know if it's a feature of webpagetest.org, but apparently there's no new connection until the previous one is finished. -- --- 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/groups/opt_out.
Re: [web2py] Re: performance issue time to first byte
There are 6 files which they start to load at the same time. Or what do you did you mean? Am 10.04.2013 15:34 schrieb Niphlod niph...@gmail.com: edit: the real problem on that graph is that there's no concurrency: I don't know if it's a feature of webpagetest.org, but apparently there's no new connection until the previous one is finished. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Suuc7DdjDn0/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
brilliant, very simple solution, it's work now. thank you so much for your solution and suggestion, massimo i've followed your hints and make it on my controller : def __onvalidation_check_out(form): if form.vars.check_in: rows = db(db.check_in.id==form.vars.check_in).select() for row in rows: form.vars.room = row.room form.vars.guest = row.guest form.vars.price = row.room.category.price delta = request.now - row.created_on form.vars.duration = delta form.vars.total_price = delta.days * row.room.category.price else: form.errors.check_in = 'enter a value' another question is it possible to make time delta more human readable? for example on my code above the time delta return : 9 days, 0:00:34.024219 is it possible to make it? 9 days, 0:00:34.024219 = 9 days, 34 seconds 9 days, 0:01:34.024219 = 9 days 1 minute 34 seconds 9 days, 0:02:34.024219 = 9 days 2 minutes 34 seconds 9 days, 1:01:34.024219 = 9 days 1 hour 1 minute 34 seconds 9 days, 2:01:34.024219 = 9 days 2 hours 1 minute 34 seconds thanks and best regards -- --- 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/groups/opt_out.
Re: [web2py] Re: performance issue time to first byte
probably nothing, just check that they are not sequential. probably is just how they draw their graphs. On the TTFB note: did you try timing it without gzip compression turned on, just to check ? -- --- 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/groups/opt_out.
Re: [web2py] Re: performance issue time to first byte
Before i had the mod-deflate i had times around 3.5 secs the ttfbs were about the same +- 50 ms Am 10.04.2013 15:49 schrieb Niphlod niph...@gmail.com: probably nothing, just check that they are not sequential. probably is just how they draw their graphs. On the TTFB note: did you try timing it without gzip compression turned on, just to check ? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Suuc7DdjDn0/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] Re: db.count()
db(db.countries.id 0).count() On Wednesday, April 10, 2013 9:29:36 AM UTC-4, Domagoj Kovač wrote: Hi, i have this line of code: number_of_records = db().count(db.countries.id) i am receiving an error: class 'sqlite3.OperationalError' near ;: syntax error (self=gluon.dal.SQLiteAdapter object, *a=('SELECT count(DISTINCT countries.id) FROM ;',), **b={}) What is wrong? -- --- 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/groups/opt_out.
Re: [web2py] db.count()
i think it should be: number_of_records = db(db.countries.id).select().count() haven't tried it, but you must have all the rows selected to count. Hi, i have this line of code: number_of_records = db().count(db.countries.id) i am receiving an error: class 'sqlite3.OperationalError' near ;: syntax error (self=gluon.dal.SQLiteAdapter object, *a=('SELECT count(DISTINCT countries.id) FROM ;',), **b={}) What is wrong? -- --- 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/groups/opt_out.
[web2py] Re: adding jQuery effects to A helper
Note, you should probably use the URL() helper instead of hard-coding the URL: A('Link', _href=# _onclick=jQuery(this).fadeOut(); \ web2py_component('%s' http://localhost/app/function1.html/?s=, 'myid'); return false; % URL('default', 'function1', vars=dict(s=parameter))) Anthony On Wednesday, April 10, 2013 9:27:56 AM UTC-4, Stephen McCamy wrote: That works perfect! Yes, I didn't include the actual URL and I was unclear that it is a python variable that I am passing. This works great! Thanks so much! On Wednesday, April 10, 2013 9:09:28 AM UTC-4, Anthony wrote: It works for me. Perhaps your URL isn't returning anything -- are you sure 'http://localhost/app/function1.html/?s=' + parameter generates the correct URL and returns the expected output? In particular, the parameter variable should be a previously defined Javascript variable -- does it exist? Or is it supposed to be a Python variable, in which case the code would be: A('Link', _href=# _onclick=jQuery(this).fadeOut(); \ web2py_component('http://localhost/app/function1.html/?s=%s'http://localhost/app/function1.html/?s=, 'myid'); \ return false; % parameter) Note, I also added a dummy _href above so the link will appear clickable on the page. Anthony On Wednesday, April 10, 2013 8:56:03 AM UTC-4, Stephen McCamy wrote: Ok, that makes sense. So how can you write it so the web2py component will not only fade out but will load into a specified id in the DIV as as well? The example you provided forces the link to fadeout but no longer loads the div (which makes sense). I want to do both. This is good information thank you! On Tuesday, April 9, 2013 11:11:13 PM UTC-4, Stephen McCamy wrote: Hello, I am trying to add a jQuery effect to my A helper below. I am not stuck on using the A helper but it works well so that is what I am doing. Below passes a parameter to a function and the results are loaded into the div when the function finishes. I want to indicate to the user that the link has been clicked because the function takes some time to process. I think the usage of fadeout() in this example: {{=DIV('click me!', _onclick=jQuery(this).fadeOut())}} from the documentation would be fine but it does not work when I add it to the A helper below. It just stays the same. I assume this is because the A helper overrides the jQuery somehow and treats the object as a hyperlink no matter what. I am really stuck on this. Any input would be useful. Thanks! {{=A(''Link', _href=' http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div I tried: {{=A(''Link', _onclick=jQuery(this).fadeOut(), _href=' http://localhost/app/function1.html/?s='+parameter, cid='myid')}} div id=myid URL/div with no luck. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
As always without knowing nothing about your application is hard to give more precise answers. But, first of all, I would do a test in localhost to have a reference unit. For now let's keep the network variable out. If you have a shell account in your server do: curl -o /dev/null -s -w Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n http://localhost/ be sure that curl is hitting you homepage and not some redirect. In the same host/web2py you can also create a minimal application with nothing but a controller/default.py that only as: def index(): return 'OK' and then time it with curl and webpagetest. Note: When timing with curl do it 3 or 4 time consecutively to the same url Know you have some measures to go on... check this thread if not already: https://groups.google.com/d/topic/web2py/JgkMaQ_VlXs/discussion Ricardo On Tue, Apr 9, 2013 at 10:04 PM, BlueShadow kevin.bet...@gmail.com wrote: Hi I'm trying to improve my pageloadtimes. And so far I'm doing pretty good. I decreased the number of quests by merging some css files and some javascript. I added expire headers to pretty much every file I serve. But the most time it takes to load a page is the time to first byte. I checked my site with webpagetest.org it takes 0.747s for the first byte. and quite a few requests take 500 ms or more before the first byte flows. Is there any way to find out why its taking so long? And a way to improve tose numbers. thanks -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
Re: [web2py] db.count()
I tried Antonies code and it works. Thanks. -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
check prettydate http://web2py.com/books/default/chapter/29/14?search=prettydate On Wednesday, April 10, 2013 3:45:19 PM UTC+2, 黄祥 wrote: brilliant, very simple solution, it's work now. thank you so much for your solution and suggestion, massimo i've followed your hints and make it on my controller : def __onvalidation_check_out(form): if form.vars.check_in: rows = db(db.check_in.id==form.vars.check_in).select() for row in rows: form.vars.room = row.room form.vars.guest = row.guest form.vars.price = row.room.category.price delta = request.now - row.created_on form.vars.duration = delta form.vars.total_price = delta.days * row.room.category.price else: form.errors.check_in = 'enter a value' another question is it possible to make time delta more human readable? for example on my code above the time delta return : 9 days, 0:00:34.024219 is it possible to make it? 9 days, 0:00:34.024219 = 9 days, 34 seconds 9 days, 0:01:34.024219 = 9 days 1 minute 34 seconds 9 days, 0:02:34.024219 = 9 days 2 minutes 34 seconds 9 days, 1:01:34.024219 = 9 days 1 hour 1 minute 34 seconds 9 days, 2:01:34.024219 = 9 days 2 hours 1 minute 34 seconds thanks and best regards -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
when i tried to using prettydate it return [invalid date] e.g. *from gluon.tools import prettydate* def __onvalidation_check_out(form): if form.vars.check_in: rows = db(db.check_in.id==form.vars.check_in).select() for row in rows: form.vars.room = row.room form.vars.guest = row.guest delta = request.now - row.created_on *form.vars.duration = prettydate(delta,T)* form.vars.price = row.room.category.price form.vars.total_price = delta.days * row.room.category.price else: form.errors.check_in = 'enter a value' any idea how to use prettydate output in sqlform.grid? thank you very much -- --- 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/groups/opt_out.
[web2py] Re: database query on nested tables
I did say see it prettydate as it is takes a date and calculates automatically the timedelta to now. You need to have your own prettydate to be able to pass a timedelta of your own. -- --- 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/groups/opt_out.
[web2py] Strange Plugin behaviour
Dear web2py users, I am novice web2py user and I've recently started developing my first real project. Unfortunately I'm having some issues: - The plugin-controller code is not update when modified, unless the server is restarted. Example: if there's an error at a certain line and I comment it, i keep getting the same error ticket (in the ticket, the line is not commented, the old version of the .py is displayed). - I have troubles importing gluon.globals in a plugin controller. Specifically import gluon; from gluon.globals import Response returns a ImportError No module named globals exception. However if I try executing the same two lines in the shell or in a normal controller, it works fine. Is anyone else experiencing the same problems? I am using 2.4.5 (.dmg) on OS X 10.8. Thank you in advance! ~Matteo -- --- 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/groups/opt_out.
[web2py] Re: pass db,tablename,fields ... values to module or define table in module?
in model dbtables.py #. #. db.define_table('wishlist', Field('user_id', db.auth_user, requires=IS_IN_DB(db,'auth_user.id','%(username)s')), Field('offer_id', db.offer, requires=IS_IN_DB(db,'offer.id','%(title)s')), Field('created_on', type='datetime', default=request.now, writable=False)) #. #. in modules wishlist.py (this is just the ideea how i want to pass objects, i dont know how to do this correctly) from gluon import* class WishList(): def add_to_wish_list(self,db,table,field1,value1,field2,value2): # or is better list of **fields,**values ? try: db.table.insert(field1=value1,field2=value2) #insert or validate_and_insert? return 'Successfuly added to wishlist' except: return 'Error. Try again latter' #remove_from_wish_list() #get_user_wish_list() # # in one of the controllers default.py #.. #.. @auth.requires_login() def add_to_wishlist(): wishlist_obj = WishList() status_wishlist_add = wishlist_obj.add_to_wish_list(db,wishlist,'user_id',auth.user_id,'offer_id',requested_offer_id) return status_wishlist_add #.. #.. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
Thanks Ricardo for that idea with curl. I did that 5 times the ttfb is almost the total time. the total time having 0 to 1 ms more than the ttfb. the average time is 201 ms which seems to me pretty big considering its a localhost request. when I did that test application(welcome app) I got an average about 80 ms which seems pretty slow too (localhost no db requests...). when I do the test with webpagetest I get around 300 ms for the TTFB, for each file the green bar(ttfb for that file is ~160 ms -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
migrations are false and lazy tables are true. I tried to do something with cache.ram (for another app) which had no effekt at all perfhaps I did it wrong. consider moving code to (imported) modules #I started on it when I realised I was using request.folder in my sitemap funktion which I currently have in a module (which isn't that smart I know thats one of the first things I will change) I don't know how to deal with those two points: 5. Add session.forget for methods which don't use the session object. #when I dont use session.something I can add the session.forget to the beginning of the controler? 6. Enable connection pooling depending on the database. #no idea what to do here haven't tried any of those: compile the app #haven't tried controller-specific models #I only use two controlers database indexes #don't know what it is On Wednesday, April 10, 2013 5:30:10 PM UTC+2, BlueShadow wrote: Thanks Ricardo for that idea with curl. I did that 5 times the ttfb is almost the total time. the total time having 0 to 1 ms more than the ttfb. the average time is 201 ms which seems to me pretty big considering its a localhost request. when I did that test application(welcome app) I got an average about 80 ms which seems pretty slow too (localhost no db requests...). when I do the test with webpagetest I get around 300 ms for the TTFB, for each file the green bar(ttfb for that file is ~160 ms -- --- 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/groups/opt_out.
Re: [web2py] Re: pass db,tablename,fields ... values to module or define table in module?
ctrlSoft, I'm working in an architecture similar to yours. See some suggestions here: https://gist.github.com/viniciusban/5355781 On Wed, Apr 10, 2013 at 12:06 PM, ctrlSoft zerooo...@gmail.com wrote: in model dbtables.py #. #. db.define_table('wishlist', Field('user_id', db.auth_user, requires=IS_IN_DB(db,'auth_user.id','%(username)s')), Field('offer_id', db.offer, requires=IS_IN_DB(db,'offer.id','%(title)s')), Field('created_on', type='datetime', default=request.now, writable=False)) #. #. in modules wishlist.py (this is just the ideea how i want to pass objects, i dont know how to do this correctly) from gluon import* class WishList(): def add_to_wish_list(self,db,table,field1,value1,field2,value2): # or is better list of **fields,**values ? try: db.table.insert(field1=value1,field2=value2) #insert or validate_and_insert? return 'Successfuly added to wishlist' except: return 'Error. Try again latter' #remove_from_wish_list() #get_user_wish_list() # # in one of the controllers default.py #.. #.. @auth.requires_login() def add_to_wishlist(): wishlist_obj = WishList() status_wishlist_add = wishlist_obj.add_to_wish_list(db,wishlist,'user_id',auth.user_id,'offer_id',requested_offer_id) return status_wishlist_add #.. #.. -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] Re: pass db,tablename,fields ... values to module or define table in module?
class WishList(): def add_to_wish_list(self,db,table,field1,value1,field2,value2): # or is better list of **fields,**values ? try: db.table.insert(field1=value1,field2=value2) #insert or validate_and_insert? Seems fine, but you can't do db.table if table is a variable -- it would have to be db[table]. Same problem with field1, field2, etc. -- you would have to do: db[table].insert(**{field1: value1, field2: value2}) To make it easier, you can do: def add_to_wish_list(self, db, table, **record): try: db[table].insert(**record) and then call it this way: wishlist_obj.add_to_wish_list(db, 'wishlist', field1=value1, field2=value2) Anthony -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
Your waterfall showed only static files, which are served before web2py hits any of your application code, so most of those optimizations shouldn't have an impact. Are the high TTFB values only for the static files? Is web2py even serving the static files, or is the web server (e.g., Apache) doing it directly? Anthony On Wednesday, April 10, 2013 11:41:00 AM UTC-4, BlueShadow wrote: migrations are false and lazy tables are true. I tried to do something with cache.ram (for another app) which had no effekt at all perfhaps I did it wrong. consider moving code to (imported) modules #I started on it when I realised I was using request.folder in my sitemap funktion which I currently have in a module (which isn't that smart I know thats one of the first things I will change) I don't know how to deal with those two points: 5. Add session.forget for methods which don't use the session object. #when I dont use session.something I can add the session.forget to the beginning of the controler? 6. Enable connection pooling depending on the database. #no idea what to do here haven't tried any of those: compile the app #haven't tried controller-specific models #I only use two controlers database indexes #don't know what it is On Wednesday, April 10, 2013 5:30:10 PM UTC+2, BlueShadow wrote: Thanks Ricardo for that idea with curl. I did that 5 times the ttfb is almost the total time. the total time having 0 to 1 ms more than the ttfb. the average time is 201 ms which seems to me pretty big considering its a localhost request. when I did that test application(welcome app) I got an average about 80 ms which seems pretty slow too (localhost no db requests...). when I do the test with webpagetest I get around 300 ms for the TTFB, for each file the green bar(ttfb for that file is ~160 ms -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
First thing I'd do in this case is compile the app, then test again. ;) Don't try other things before compiling. Next thing I'd do is look into caching, it's usually very much worth it. Depends on your app, though. What db are you using? How is the connection pooling set now? You can find out what db indexes are on google, that would be good thing to look into, if not for this one, then for your next project. -- --- 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/groups/opt_out.
[web2py] Re: impersonate any user
Is the reversion back to the initial user working properly? I can impersonate a user, entering a user id in the http://.../user/impersonate form, but when I go back to that form, and entering 0 , although it seems momentarily to change the user name greeting in the upper right of the app, if I go to the http://.../user/profile or anywhere else, still the impersonated user appears. Have anyone noticed this behaviour? On Tuesday, April 19, 2011 10:30:47 PM UTC+1, Massimo Di Pierro wrote: First at some point do gid = auth.add_group('impersonators') auth.add_permission(gid,'impersonate','auth_user') auth.add_membership(gid,your_authuser_id) then just visit http://.../user/impersonate and it prompt you a form about which user you want to impersonate. 0 for reverting back to yourself. -- --- 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/groups/opt_out.
[web2py] Re: pass db,tablename,fields ... values to module or define table in module?
thanks a lot for your sugetions and quick responses. -- --- 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/groups/opt_out.
[web2py] iOS + web2py
I've been working on a news-video iPad app (awards and everything! featured by Apple! brag!) that uses web2py for a back-end server, maintaining a database of videos c and serving them up to the app via JSONRPC. web2py also implements our internal curation UI to the database. web2py has been a great solution for us because it solves a bunch of different problems. 1. it automatically updates our video feeds from their native sources 2. it acts as our analytics collection point and does some first-stage analysis 3. it serves the app with auth services, video meta-data, etc 4. it hosts a dynamic page to share videos publicly on the web 5. it implements our internal curation UI ...all with a single framework, and surprisingly little code. web2py rules. I'd like to hear from other projects with a foot in both the iOS and web2py camps, with a general interest in comparing notes, exchanging tips gossip, whatever. (We're also building our development team. I'd appreciate referrals of experienced developers with those skills, preferably but not absolutely necessarily both, who might like to work on a project like that. Drop me a note and I'll tell you more off-list. We're in Silicon Valley, but are open to remote developers.) -- --- 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/groups/opt_out.
Re: [web2py] Re: Need help with impersonate
SOLVED (6 months later) I put this aside six months ago when I couldn't make it work. Today I really needed it so I dug out pdb and drilled down into auth.has_permission(). Finally, the light dawned on me. The table_name field is a string! Changing it to auth_user fixed the problem. May I suggest a couple of changes to keep others from stumbling where I did? The online book current has (emphasis mine): impersonate allows a user to impersonate another user. This is important for debugging and for support purposes. request.args[0] is the id of the user to be impersonated. This is only allowed if the logged in userhas_permission('impersonate', *db.auth_user*, user_id). That should be changed to has_permission('impersonate', *auth_user*, user_id) It would also help if auth.has_permission threw a ticket if given a bad table_name argument, maybe something like: if not hasattr(db, table_name) and isinstance(getattr(db, table_name), db.Table): raise ValueError(Table {} doesn't exist in db.format(table_name)) Thanks, Mike -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
On Wed, Apr 10, 2013 at 4:30 PM, BlueShadow kevin.bet...@gmail.com wrote: when I did that test application(welcome app) I got an average about 80 ms which seems pretty slow too (localhost no db requests...). Did you create empty application or you reuse the welcome application? Either way, your server seems to be slow, on my laptop with the minimal app I get 5/6ms and with the welcome app I get 40/45ms Ricardo -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
On Wed, Apr 10, 2013 at 4:41 PM, BlueShadow kevin.bet...@gmail.com wrote: migrations are false and lazy tables are true. I tried to do something with cache.ram (for another app) which had no effekt at all perfhaps I did it wrong. consider moving code to (imported) modules #I started on it when I realised I was using request.folder in my sitemap funktion which I currently have in a module (which isn't that smart I know thats one of the first things I will change) I dont see nothing wrong in using request.folder, in a module you will use from gluon import current current.request.folder I don't know how to deal with those two points: 5. Add session.forget for methods which don't use the session object. #when I dont use session.something I can add the session.forget to the beginning of the controler? In your homepage you are serving 10 images, at least, in fast_download controller, here it's safe to put session.forget() if not already. It will allow concurrent request from the same browser. 6. Enable connection pooling depending on the database. #no idea what to do here pool_size - it's an argument to DAL db = DAL(, pool_size=x) haven't tried any of those: compile the app #haven't tried As LightDot said, do it. Ricardo -- --- 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/groups/opt_out.
[web2py] integrating the stripe library into web2py
I'm recently learning about Stripe, and so far it seems like a great option for credit card processing. I noticed that there is a very simple add-on Massimo wrote to do Stripe charges and similar actions, but it does not seem to at all follow the pattern Stripe was intended to be used. Massimo's module requires actually entering the credit card number, but Stripe is built so that the web app doesn't need to ever see credit card numbers but instead use Stripe provided tokens that represent the credit card info that Stripe has saved. Stripe already has a server-side library that can be installed, which I intend to do (once I figure out how to do it successfully on pythonanywhere---for some reason it isn't working). But it would be nice, I think, to include Stripe's library in the out-of-the-box installation of web2py. What are people's thoughts on this subject? -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
In your homepage you are serving 10 images, at least, in fast_download controller, here it's safe to put session.forget() if not already. It will allow concurrent request from the same browser. Good point. If those images are being served dynamically from a controller because they were uploaded (as opposed to being static assets), then the session file locking will cause each request to be handled serially (only a problem if using file based sessions -- no locking for db or cookie based sessions). In that case, you can add session.forget(response) to the download function (be sure to pass in response, otherwise, it won't actually unlock the file and will be no help). This is not necessary with static files, as they are served before the session is connected or the app code is executed. Anthony -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
On 10 Apr 2013, at 12:34 PM, Anthony abasta...@gmail.com wrote: In your homepage you are serving 10 images, at least, in fast_download controller, here it's safe to put session.forget() if not already. It will allow concurrent request from the same browser. Good point. If those images are being served dynamically from a controller because they were uploaded (as opposed to being static assets), then the session file locking will cause each request to be handled serially (only a problem if using file based sessions -- no locking for db or cookie based sessions). In that case, you can add session.forget(response) to the download function (be sure to pass in response, otherwise, it won't actually unlock the file and will be no help). This is not necessary with static files, as they are served before the session is connected or the app code is executed. Also (with dynamically served images), if the images are cacheable by the browser, you probably need to set the appropriate cache headers on the response. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
the images are cached with Expire header (access + 1 month) which works quite well. On Wednesday, April 10, 2013 9:39:14 PM UTC+2, Jonathan Lundell wrote: On 10 Apr 2013, at 12:34 PM, Anthony abas...@gmail.com javascript: wrote: In your homepage you are serving 10 images, at least, in fast_download controller, here it's safe to put session.forget() if not already. It will allow concurrent request from the same browser. Good point. If those images are being served dynamically from a controller because they were uploaded (as opposed to being static assets), then the session file locking will cause each request to be handled serially (only a problem if using file based sessions -- no locking for db or cookie based sessions). In that case, you can add session.forget(response) to the download function (be sure to pass in response, otherwise, it won't actually unlock the file and will be no help). This is not necessary with static files, as they are served before the session is connected or the app code is executed. Also (with dynamically served images), if the images are cacheable by the browser, you probably need to set the appropriate cache headers on the response. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
On Wed, Apr 10, 2013 at 8:39 PM, BlueShadow kevin.bet...@gmail.com wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. Very weird... I never saw this happened. If you want I'm willing to try to give you a help on this, just send me an email off-list. Optimizations are a subject that I like. Ricardo -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
let us know what you find : I just tested my production site and (although it runs with uwsgi+nginx and is behind SSL) the max time of TTFB don't go over 150ms. On Wednesday, April 10, 2013 11:14:24 PM UTC+2, Ricardo Pedroso wrote: On Wed, Apr 10, 2013 at 8:39 PM, BlueShadow kevin@gmail.comjavascript: wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. Very weird... I never saw this happened. If you want I'm willing to try to give you a help on this, just send me an email off-list. Optimizations are a subject that I like. Ricardo -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
Well, this is completely unexpected. I really can't think of what would cause the compiled code to run slower than the uncompiled one. Intriguing!! Anyway, you probably used the admin to compile the app? There is a menu entry Remove Compiled there, same place as the Compile was. On Wednesday, April 10, 2013 9:39:55 PM UTC+2, BlueShadow wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. how do I undo the compile. or what did I do wrong? -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
yeah I found it. right now pretty much everything is strange to me. but I continue to work on it. On Wednesday, April 10, 2013 11:39:58 PM UTC+2, LightDot wrote: Well, this is completely unexpected. I really can't think of what would cause the compiled code to run slower than the uncompiled one. Intriguing!! Anyway, you probably used the admin to compile the app? There is a menu entry Remove Compiled there, same place as the Compile was. On Wednesday, April 10, 2013 9:39:55 PM UTC+2, BlueShadow wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. how do I undo the compile. or what did I do wrong? -- --- 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/groups/opt_out.
[web2py] Re: routes in windows service not working??
Did you ever find a solution to this? I am running web2py from source and have everything setup correctly with an options.py and a routes.py but I see the same thing you do. web2py tries to route to welcome but if you force it to reload the routes it defaults to my app On Monday, August 20, 2012 12:15:25 AM UTC-4, Dave wrote: I generally am not the person to be monkeying around with things on Windows. That said, one of my customers is about to take over management and ownership of a web2py application I have written for them. I seem to be having an issue testing the deployment for them. I created an options.py file and the service installs and starts properly. Unfortunately, for some reason it does not appear the routes.py file is being parsed on startup though. Even though the default app is set, a request to / still attempts to go to /welcome/... If I go in to the admin interface and choose reload routes, everything works... until the service is restarted that is. If I run web2py from the command line .. ie python web2py.py -p 80 -a 'password', the routes.py file gets parsed on startup. Any ideas? -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
I tested a couple of my sites, to get some feel as to what to expect. TTFB from the first run, tested across half of Europe: 1st site: 57ms to 74ms 2nd site: 57ms to 202ms First one is a corporate style web page, the second one has a lot of content, thumbnails, etc. Both using apache + mod_wsgi in daemon mode, postgresql, compiled, cache, etc. etc. On Wednesday, April 10, 2013 11:17:39 PM UTC+2, Niphlod wrote: let us know what you find : I just tested my production site and (although it runs with uwsgi+nginx and is behind SSL) the max time of TTFB don't go over 150ms. On Wednesday, April 10, 2013 11:14:24 PM UTC+2, Ricardo Pedroso wrote: On Wed, Apr 10, 2013 at 8:39 PM, BlueShadow kevin@gmail.com wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. Very weird... I never saw this happened. If you want I'm willing to try to give you a help on this, just send me an email off-list. Optimizations are a subject that I like. Ricardo -- --- 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/groups/opt_out.
[web2py] Re: newbie question about digitally signed URLs using hmac
Ah, thank you. I now understand much more about userSignature. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
about that time is my aim. On Wednesday, April 10, 2013 11:55:36 PM UTC+2, LightDot wrote: I tested a couple of my sites, to get some feel as to what to expect. TTFB from the first run, tested across half of Europe: 1st site: 57ms to 74ms 2nd site: 57ms to 202ms First one is a corporate style web page, the second one has a lot of content, thumbnails, etc. Both using apache + mod_wsgi in daemon mode, postgresql, compiled, cache, etc. etc. On Wednesday, April 10, 2013 11:17:39 PM UTC+2, Niphlod wrote: let us know what you find : I just tested my production site and (although it runs with uwsgi+nginx and is behind SSL) the max time of TTFB don't go over 150ms. On Wednesday, April 10, 2013 11:14:24 PM UTC+2, Ricardo Pedroso wrote: On Wed, Apr 10, 2013 at 8:39 PM, BlueShadow kevin@gmail.com wrote: thanks for all the suggestions I'm trying to work at one after the other: kompiling it made it a lot worse: http://www.webpagetest.org/result/130410_9P_14QQ/ the results now vary a lot from a total of 4 secs to over 11 secs. Very weird... I never saw this happened. If you want I'm willing to try to give you a help on this, just send me an email off-list. Optimizations are a subject that I like. Ricardo -- --- 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/groups/opt_out.
[web2py] ZeroMQ in web2py
I'l like to start a discussion about working-out an integration implementation for ZeroMQ in web2py. If not as a built-in, than at least as a contrib. If nothing else, than at the very least a recipe and/or examples, and added documentation about how to activate/deploy the integration. ZeroMQ is, to me, one of the coolest things that have happened to the software industry in recent decades... Gone are the days of monolithic systems - open-source has changed the software world entirely, and there is no going back - the days are the days of the integration,hybrid-system, modularity, and variety of components, and ZeroMQ is fast becoming the best candidate for filling the gaps and being the glue that can best bind all things together - beyond the concept of a static-centralized message broker. Fast, efficient, flexible, easy to use, decentralized, free, cross-platform, poliglot, and for not just for messagins, but also for rpc and REST (the concept, not the protocols), and not even just for networking, but also for itc and ipc. I think the more software will esit that has it buil-in, the more easy it will become to build dynamically changing modular software infrastructures. Now, the first thing that I am personally interested about, is to have a 0MQ-RPC service alongside the existing services. There are already existing python modules that do that, it is only a matter of picking one and integrating is as just another service. For example: https://github.com/dotcloud/zerorpc-python In addition, there are initiatives for having ZeroMQ-complaint sockets on the client-side. Here are a few examples: http://vimeo.com/41410528 http://www.zeromq.org/topics:0mq-over-http http://blog.fanout.io/2012/09/26/make-http-requests-over-zeromq-with-zurl/ Web2py can be another one of the frameworks that implement a ZeroMQ bridge between clients and the rest of the back-end software infrastructure. What do you say? -- --- 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/groups/opt_out.
[web2py] Server performance (cpu/memory)
Hi! I have the following environment: 1. Amazon EC2 instance running Ubuntu 12.10 2. Nginx 1.2.1 3. Web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 4. PostgreSQL (still 8.4, going to upgrade to 9.1 soon) 5. Installed using setup contained on /scripts directory. Everything is working fine, but I still feel that the overall response time / performance could be better. one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. So, right now what I'm thinking is if there's anything I could do to help improve performance or if I should start thinking on upgrading my EC2 instance. Any thoughs on that? Cheers, Marco Tulio -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
You got a problem with web2py? , What you report is a performance of their work environment and that you can mount a laboratory or hire a consulting firm. Now if you have problems with web2py this list will help you. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Hi! I have the following environment: 1. Amazon EC2 instance running Ubuntu 12.10 2. Nginx 1.2.1 3. Web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 4. PostgreSQL (still 8.4, going to upgrade to 9.1 soon) 5. Installed using setup contained on /scripts directory. Everything is working fine, but I still feel that the overall response time / performance could be better. one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. So, right now what I'm thinking is if there's anything I could do to help improve performance or if I should start thinking on upgrading my EC2 instance. Any thoughs on that? Cheers, Marco Tulio -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
On Wed, Apr 10, 2013 at 11:33 PM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). How much traffic do you have? Don't you have some wild bot crawling your site? This article is about bandwidth but you can be suffering from something similar... http://www.behind-the-enemy-lines.com/2012/04/google-attack-how-i-self-attacked.html Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. What aspects they sugest? Ricardo -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
Ovidio, if you don't want to help, it's ok. Just don't help. Just don't speak for the others, ok? Also, what I state is that I have a problem with performance, that might be related to web2py (or not). I'm bringing up the environment I'm working with because it may help others to understand and help if they want to. Also, Web2py is a framework. And on all of it's versions and during all of it's development, people building it have done a tremendous effort to make it so that this framework can be used on a huge variety of different environments. These enviroments go from the classic batteries included on web2py, to web2py running on windows, linux or mac, with apache or nginx, and even with a large amount of diferent databases. So, if I bring this problem to this list, it 2013/4/10 Ovidio Marinho ovidio...@gmail.com You got a problem with web2py? , What you report is a performance of their work environment and that you can mount a laboratory or hire a consulting firm. Now if you have problems with web2py this list will help you. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Hi! I have the following environment: 1. Amazon EC2 instance running Ubuntu 12.10 2. Nginx 1.2.1 3. Web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 4. PostgreSQL (still 8.4, going to upgrade to 9.1 soon) 5. Installed using setup contained on /scripts directory. Everything is working fine, but I still feel that the overall response time / performance could be better. one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. So, right now what I'm thinking is if there's anything I could do to help improve performance or if I should start thinking on upgrading my EC2 instance. Any thoughs on that? Cheers, Marco Tulio -- --- 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/groups/opt_out. -- --- 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/groups/opt_out. -- []'s Marco Tulio -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
(continuing - sent it while not concluded) So, if I bring this problem to this list, it's mainly because I believe this is the right place for it. And if you don't agree with that, ok. Just ruin it because you don't like me. Cheers, Marco Tulio 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Ovidio, if you don't want to help, it's ok. Just don't help. Just don't speak for the others, ok? Also, what I state is that I have a problem with performance, that might be related to web2py (or not). I'm bringing up the environment I'm working with because it may help others to understand and help if they want to. Also, Web2py is a framework. And on all of it's versions and during all of it's development, people building it have done a tremendous effort to make it so that this framework can be used on a huge variety of different environments. These enviroments go from the classic batteries included on web2py, to web2py running on windows, linux or mac, with apache or nginx, and even with a large amount of diferent databases. So, if I bring this problem to this list, it 2013/4/10 Ovidio Marinho ovidio...@gmail.com You got a problem with web2py? , What you report is a performance of their work environment and that you can mount a laboratory or hire a consulting firm. Now if you have problems with web2py this list will help you. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Hi! I have the following environment: 1. Amazon EC2 instance running Ubuntu 12.10 2. Nginx 1.2.1 3. Web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 4. PostgreSQL (still 8.4, going to upgrade to 9.1 soon) 5. Installed using setup contained on /scripts directory. Everything is working fine, but I still feel that the overall response time / performance could be better. one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. So, right now what I'm thinking is if there's anything I could do to help improve performance or if I should start thinking on upgrading my EC2 instance. Any thoughs on that? Cheers, Marco Tulio -- --- 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/groups/opt_out. -- --- 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/groups/opt_out. -- []'s Marco Tulio -- []'s Marco Tulio -- --- 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/groups/opt_out.
[web2py] Re: integrating the stripe library into web2py
You are right that what web2py does it server side. It does not store the credit card info (not by default) but this allows the server to know if a transaction went through or not. I would like to see a prototype of client-size integration and a server-side notifications of payments success/failure. massimo On Wednesday, 10 April 2013 14:02:20 UTC-5, David Ripplinger wrote: I'm recently learning about Stripe, and so far it seems like a great option for credit card processing. I noticed that there is a very simple add-on Massimo wrote to do Stripe charges and similar actions, but it does not seem to at all follow the pattern Stripe was intended to be used. Massimo's module requires actually entering the credit card number, but Stripe is built so that the web app doesn't need to ever see credit card numbers but instead use Stripe provided tokens that represent the credit card info that Stripe has saved. Stripe already has a server-side library that can be installed, which I intend to do (once I figure out how to do it successfully on pythonanywhere---for some reason it isn't working). But it would be nice, I think, to include Stripe's library in the out-of-the-box installation of web2py. What are people's thoughts on this subject? -- --- 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/groups/opt_out.
[web2py] Re: ZeroMQ in web2py
I really like 0MQ too but I would like to understand a typical test case of integration with web2py. Consider the scheduler for example. The bottle neck is not distribution of tasks (which 0MQ would handle great) but the fact that tasks and main app need to access the database. If the workers do not need to access to the database (for example tasks that send a simple email) then 0MQ would provide a benefit but the problem is no longer web2py specific. In which situation would use 0MQ with web2py? Massimo On Wednesday, 10 April 2013 17:06:59 UTC-5, Arnon Marcus wrote: I'l like to start a discussion about working-out an integration implementation for ZeroMQ in web2py. If not as a built-in, than at least as a contrib. If nothing else, than at the very least a recipe and/or examples, and added documentation about how to activate/deploy the integration. ZeroMQ is, to me, one of the coolest things that have happened to the software industry in recent decades... Gone are the days of monolithic systems - open-source has changed the software world entirely, and there is no going back - the days are the days of the integration,hybrid-system, modularity, and variety of components, and ZeroMQ is fast becoming the best candidate for filling the gaps and being the glue that can best bind all things together - beyond the concept of a static-centralized message broker. Fast, efficient, flexible, easy to use, decentralized, free, cross-platform, poliglot, and for not just for messagins, but also for rpc and REST (the concept, not the protocols), and not even just for networking, but also for itc and ipc. I think the more software will esit that has it buil-in, the more easy it will become to build dynamically changing modular software infrastructures. Now, the first thing that I am personally interested about, is to have a 0MQ-RPC service alongside the existing services. There are already existing python modules that do that, it is only a matter of picking one and integrating is as just another service. For example: https://github.com/dotcloud/zerorpc-python In addition, there are initiatives for having ZeroMQ-complaint sockets on the client-side. Here are a few examples: http://vimeo.com/41410528 http://www.zeromq.org/topics:0mq-over-http http://blog.fanout.io/2012/09/26/make-http-requests-over-zeromq-with-zurl/ Web2py can be another one of the frameworks that implement a ZeroMQ bridge between clients and the rest of the back-end software infrastructure. What do you say? -- --- 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/groups/opt_out.
[web2py] Re: integrating the stripe library into web2py
Would the fact that the server processes the actual credit card number (even though it doesn't store it) make it so I would have to deal with PCI compliance stuff? On Wednesday, April 10, 2013 7:24:08 PM UTC-4, Massimo Di Pierro wrote: You are right that what web2py does it server side. It does not store the credit card info (not by default) but this allows the server to know if a transaction went through or not. I would like to see a prototype of client-size integration and a server-side notifications of payments success/failure. massimo On Wednesday, 10 April 2013 14:02:20 UTC-5, David Ripplinger wrote: I'm recently learning about Stripe, and so far it seems like a great option for credit card processing. I noticed that there is a very simple add-on Massimo wrote to do Stripe charges and similar actions, but it does not seem to at all follow the pattern Stripe was intended to be used. Massimo's module requires actually entering the credit card number, but Stripe is built so that the web app doesn't need to ever see credit card numbers but instead use Stripe provided tokens that represent the credit card info that Stripe has saved. Stripe already has a server-side library that can be installed, which I intend to do (once I figure out how to do it successfully on pythonanywhere---for some reason it isn't working). But it would be nice, I think, to include Stripe's library in the out-of-the-box installation of web2py. What are people's thoughts on this subject? -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
2013/4/10 Ricardo Pedroso rmdpedr...@gmail.com On Wed, Apr 10, 2013 at 11:33 PM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). How much traffic do you have? Don't you have some wild bot crawling your site? Not much... although we've been running for around a year, we don't have more than 100 visits a day. Dunno about the crazy bots though... :) This article is about bandwidth but you can be suffering from something similar... http://www.behind-the-enemy-lines.com/2012/04/google-attack-how-i-self-attacked.html I'm going to read the article with care. Thanks for the assistance. Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. What aspects they sugest? Reduce Javascript, Postpone Javascript analysis, also to activate compression (although Nginx is already set to use gzip compression).These are high priority. There are few on medium and low priority, but nothing that would explain that. Ricardo -- --- 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/groups/opt_out. -- []'s Marco Tulio -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
And if you don't agree with that, ok. Just don't ruin it because you don't like me. (Correcting) 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com (continuing - sent it while not concluded) So, if I bring this problem to this list, it's mainly because I believe this is the right place for it. And if you don't agree with that, ok. Just ruin it because you don't like me. Cheers, Marco Tulio 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Ovidio, if you don't want to help, it's ok. Just don't help. Just don't speak for the others, ok? Also, what I state is that I have a problem with performance, that might be related to web2py (or not). I'm bringing up the environment I'm working with because it may help others to understand and help if they want to. Also, Web2py is a framework. And on all of it's versions and during all of it's development, people building it have done a tremendous effort to make it so that this framework can be used on a huge variety of different environments. These enviroments go from the classic batteries included on web2py, to web2py running on windows, linux or mac, with apache or nginx, and even with a large amount of diferent databases. So, if I bring this problem to this list, it 2013/4/10 Ovidio Marinho ovidio...@gmail.com You got a problem with web2py? , What you report is a performance of their work environment and that you can mount a laboratory or hire a consulting firm. Now if you have problems with web2py this list will help you. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/10 Marco Túlio Cícero de M. Porto mtcpo...@gmail.com Hi! I have the following environment: 1. Amazon EC2 instance running Ubuntu 12.10 2. Nginx 1.2.1 3. Web2py 2.4.6-stable+timestamp.2013.04.06.17.37.38 4. PostgreSQL (still 8.4, going to upgrade to 9.1 soon) 5. Installed using setup contained on /scripts directory. Everything is working fine, but I still feel that the overall response time / performance could be better. one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). Pagespeed Insight (from Google) is ranking the site from 54 to 71 (depending on the page) and it says I could do better on some aspects. So, right now what I'm thinking is if there's anything I could do to help improve performance or if I should start thinking on upgrading my EC2 instance. Any thoughs on that? Cheers, Marco Tulio -- --- 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/groups/opt_out. -- --- 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/groups/opt_out. -- []'s Marco Tulio -- []'s Marco Tulio -- []'s Marco Tulio -- --- 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/groups/opt_out.
[web2py] Re: integrating the stripe library into web2py
Yes. PCI has a self assessment though so you can check to be sure.. https://www.pcisecuritystandards.org/merchants/self_assessment_form.php On Wednesday, April 10, 2013 4:30:36 PM UTC-7, David Ripplinger wrote: Would the fact that the server processes the actual credit card number (even though it doesn't store it) make it so I would have to deal with PCI compliance stuff? On Wednesday, April 10, 2013 7:24:08 PM UTC-4, Massimo Di Pierro wrote: You are right that what web2py does it server side. It does not store the credit card info (not by default) but this allows the server to know if a transaction went through or not. I would like to see a prototype of client-size integration and a server-side notifications of payments success/failure. massimo On Wednesday, 10 April 2013 14:02:20 UTC-5, David Ripplinger wrote: I'm recently learning about Stripe, and so far it seems like a great option for credit card processing. I noticed that there is a very simple add-on Massimo wrote to do Stripe charges and similar actions, but it does not seem to at all follow the pattern Stripe was intended to be used. Massimo's module requires actually entering the credit card number, but Stripe is built so that the web app doesn't need to ever see credit card numbers but instead use Stripe provided tokens that represent the credit card info that Stripe has saved. Stripe already has a server-side library that can be installed, which I intend to do (once I figure out how to do it successfully on pythonanywhere---for some reason it isn't working). But it would be nice, I think, to include Stripe's library in the out-of-the-box installation of web2py. What are people's thoughts on this subject? -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
On Thu, Apr 11, 2013 at 12:32 AM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: 2013/4/10 Ricardo Pedroso rmdpedr...@gmail.com On Wed, Apr 10, 2013 at 11:33 PM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). How much traffic do you have? Don't you have some wild bot crawling your site? Not much... although we've been running for around a year, we don't have more than 100 visits a day. Dunno about the crazy bots though... :) you can use strace on uwsgi # strace -p pid_of_uwsgi_process -o output_file to have some clues of what uwsgi is doing. Ricardo -- --- 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/groups/opt_out.
[web2py] Re: ZeroMQ in web2py
I think the more software will esit that has it buil-in, the more easy it will become to build dynamically changing modular software infrastructures I have no idea what you are trying to say there. Anyway, yes, it's cool, you don't worry about message delivery because it's completely out of your control. That's the exact problem with it though, message delivery is out of your control. You have no idea if a message is delivered or not. You can 'queue' tons of messages, and ZeroMQ won't tell you that those messages didn't get delivered. It's cool, but it's not a silver bullet. Contrib may be a place for it though. On Wednesday, April 10, 2013 3:06:59 PM UTC-7, Arnon Marcus wrote: I'l like to start a discussion about working-out an integration implementation for ZeroMQ in web2py. If not as a built-in, than at least as a contrib. If nothing else, than at the very least a recipe and/or examples, and added documentation about how to activate/deploy the integration. ZeroMQ is, to me, one of the coolest things that have happened to the software industry in recent decades... Gone are the days of monolithic systems - open-source has changed the software world entirely, and there is no going back - the days are the days of the integration,hybrid-system, modularity, and variety of components, and ZeroMQ is fast becoming the best candidate for filling the gaps and being the glue that can best bind all things together - beyond the concept of a static-centralized message broker. Fast, efficient, flexible, easy to use, decentralized, free, cross-platform, poliglot, and for not just for messagins, but also for rpc and REST (the concept, not the protocols), and not even just for networking, but also for itc and ipc. I think the more software will esit that has it buil-in, the more easy it will become to build dynamically changing modular software infrastructures. Now, the first thing that I am personally interested about, is to have a 0MQ-RPC service alongside the existing services. There are already existing python modules that do that, it is only a matter of picking one and integrating is as just another service. For example: https://github.com/dotcloud/zerorpc-python In addition, there are initiatives for having ZeroMQ-complaint sockets on the client-side. Here are a few examples: http://vimeo.com/41410528 http://www.zeromq.org/topics:0mq-over-http http://blog.fanout.io/2012/09/26/make-http-requests-over-zeromq-with-zurl/ Web2py can be another one of the frameworks that implement a ZeroMQ bridge between clients and the rest of the back-end software infrastructure. What do you say? -- --- 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/groups/opt_out.
[web2py] Re: ZeroMQ in web2py
If you're talking about a webserver serving a database-backed website, I see no need to use it. Perhaps some esoteric uses could be found for it. On Wednesday, April 10, 2013 4:28:08 PM UTC-7, Massimo Di Pierro wrote: I really like 0MQ too but I would like to understand a typical test case of integration with web2py. Consider the scheduler for example. The bottle neck is not distribution of tasks (which 0MQ would handle great) but the fact that tasks and main app need to access the database. If the workers do not need to access to the database (for example tasks that send a simple email) then 0MQ would provide a benefit but the problem is no longer web2py specific. In which situation would use 0MQ with web2py? Massimo On Wednesday, 10 April 2013 17:06:59 UTC-5, Arnon Marcus wrote: I'l like to start a discussion about working-out an integration implementation for ZeroMQ in web2py. If not as a built-in, than at least as a contrib. If nothing else, than at the very least a recipe and/or examples, and added documentation about how to activate/deploy the integration. ZeroMQ is, to me, one of the coolest things that have happened to the software industry in recent decades... Gone are the days of monolithic systems - open-source has changed the software world entirely, and there is no going back - the days are the days of the integration,hybrid-system, modularity, and variety of components, and ZeroMQ is fast becoming the best candidate for filling the gaps and being the glue that can best bind all things together - beyond the concept of a static-centralized message broker. Fast, efficient, flexible, easy to use, decentralized, free, cross-platform, poliglot, and for not just for messagins, but also for rpc and REST (the concept, not the protocols), and not even just for networking, but also for itc and ipc. I think the more software will esit that has it buil-in, the more easy it will become to build dynamically changing modular software infrastructures. Now, the first thing that I am personally interested about, is to have a 0MQ-RPC service alongside the existing services. There are already existing python modules that do that, it is only a matter of picking one and integrating is as just another service. For example: https://github.com/dotcloud/zerorpc-python In addition, there are initiatives for having ZeroMQ-complaint sockets on the client-side. Here are a few examples: http://vimeo.com/41410528 http://www.zeromq.org/topics:0mq-over-http http://blog.fanout.io/2012/09/26/make-http-requests-over-zeromq-with-zurl/ Web2py can be another one of the frameworks that implement a ZeroMQ bridge between clients and the rest of the back-end software infrastructure. What do you say? -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
On Apr 10, 2013 9:13 PM, Ricardo Pedroso rmdpedr...@gmail.com wrote: On Thu, Apr 11, 2013 at 12:32 AM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: 2013/4/10 Ricardo Pedroso rmdpedr...@gmail.com On Wed, Apr 10, 2013 at 11:33 PM, Marco Túlio Cícero de M. Porto mtcpo...@gmail.com wrote: one thing that caught up my atention was that recently (after system/web2py upgrade) I have a higher use of memory and CPU. I was using Apache2 and it was going nuts (near 100% CPU/memory usage). Traded for Nginx and now what's getting some CPU/Memory is UWSGI (not 100% though). How much traffic do you have? Don't you have some wild bot crawling your site? Not much... although we've been running for around a year, we don't have more than 100 visits a day. Dunno about the crazy bots though... :) you can use strace on uwsgi # strace -p pid_of_uwsgi_process -o output_file to have some clues of what uwsgi is doing Good, I'll check that. Thanks. Ricardo -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
[web2py] How to create a doesn't belong query, is it possible?
Hi Folks, How can I negate: db(db.log.severity.belongs((1, 2))).select() I'd like to create a grid with records that does not belong to a specific list... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- 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/groups/opt_out.
[web2py] Re: How to create a doesn't belong query, is it possible?
Just figured out: ~db(db.log.severity.belongs((1, 2))).select() Thanks! On Wed, Apr 10, 2013 at 10:11 PM, Tito Garrido titogarr...@gmail.comwrote: Hi Folks, How can I negate: db(db.log.severity.belongs((1, 2))).select() I'd like to create a grid with records that does not belong to a specific list... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- 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/groups/opt_out.
Re: [web2py] Re: .sum() and .count() in grid?
Massimo, do you have a preference as far as licensing? I don't want to discourage people from using it, but if anyone makes a much-needed improvement I would like to get benefit of it. If the ideas are worthy of incorporation into grid or smartgrid, that would be great. I don't do works for hire, so I own the code completely. I'll post in this thread once I've cleaned up the code and uploaded it to github. I wrote it without referencing grid or smartgrid, so it does not take advantage of shortcuts in those two methods. But it does have selectable number of rows per page, and it keeps any query, orderby and rows per page parms in the session, so if you go off on an excursion to edit something, it retrieves the index just as you left it. Also things like the console maker are split off into separate functions. I thought this would provide a couple of advantages. If you wanted a console or paginator on some page, you could easily incorporate it. At the same time, if you wanted to substitute a different console building function, you could easily do so. Cliff Kachinske On Wednesday, April 10, 2013 9:18:17 AM UTC-4, Massimo Di Pierro wrote: Please! On Wednesday, 10 April 2013 06:36:45 UTC-5, Cliff Kachinske wrote: Johann, I developed an alternative to grid/smartgrid which has most of the features. I can put it on github if you like. Caution: not documented. But I'll put up a sample controller that uses it if you like. The main drawback is the search widget isn't nearly as slick as smartgrid's. And you do have to create your own query parser. But it does have a selector for the number of rows per page. On Monday, April 8, 2013 3:11:20 AM UTC-4, Johann Spies wrote: I can use SQLTABLE for this and then have to write some code for pagination and search options - all which are already in the SQLFORM.grid available. In this case addition, deletion and editing will be avoided. Regards Johann On 4 April 2013 15:17, Niphlod nip...@gmail.com wrote: I'm guessing it will be hard. You'll better code a view and access it as a fake table. PS: you show it in a grid then what record do you want to add/edit/delete ? I'm guessing that this time you want to use the grid just to search, orderby and paginate, but there's a LOT of logic inside it for more things that needs to be considered. On Thursday, April 4, 2013 12:23:58 PM UTC+2, Johann Spies wrote: How would I be able to use a query like this (or the DAL equivalent) to show the result in a grid? select so as Journal, SUM(aantal) as Articles from isi.nr_arts_per_journal group by Journal order by Journal Regars Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
Re: [web2py] Re: .sum() and .count() in grid?
For the code to be incorporated in web2py (grid/smartgrid/etc.) you should sign the web2py contributor agreement which means you can do what you want with the code but I can too. If you release it under BSD or MIT or Apache or LGPL license, it may be considered for the contrib folder. Massimo On Wednesday, 10 April 2013 21:29:45 UTC-5, Cliff Kachinske wrote: Massimo, do you have a preference as far as licensing? I don't want to discourage people from using it, but if anyone makes a much-needed improvement I would like to get benefit of it. If the ideas are worthy of incorporation into grid or smartgrid, that would be great. I don't do works for hire, so I own the code completely. I'll post in this thread once I've cleaned up the code and uploaded it to github. I wrote it without referencing grid or smartgrid, so it does not take advantage of shortcuts in those two methods. But it does have selectable number of rows per page, and it keeps any query, orderby and rows per page parms in the session, so if you go off on an excursion to edit something, it retrieves the index just as you left it. Also things like the console maker are split off into separate functions. I thought this would provide a couple of advantages. If you wanted a console or paginator on some page, you could easily incorporate it. At the same time, if you wanted to substitute a different console building function, you could easily do so. Cliff Kachinske On Wednesday, April 10, 2013 9:18:17 AM UTC-4, Massimo Di Pierro wrote: Please! On Wednesday, 10 April 2013 06:36:45 UTC-5, Cliff Kachinske wrote: Johann, I developed an alternative to grid/smartgrid which has most of the features. I can put it on github if you like. Caution: not documented. But I'll put up a sample controller that uses it if you like. The main drawback is the search widget isn't nearly as slick as smartgrid's. And you do have to create your own query parser. But it does have a selector for the number of rows per page. On Monday, April 8, 2013 3:11:20 AM UTC-4, Johann Spies wrote: I can use SQLTABLE for this and then have to write some code for pagination and search options - all which are already in the SQLFORM.grid available. In this case addition, deletion and editing will be avoided. Regards Johann On 4 April 2013 15:17, Niphlod nip...@gmail.com wrote: I'm guessing it will be hard. You'll better code a view and access it as a fake table. PS: you show it in a grid then what record do you want to add/edit/delete ? I'm guessing that this time you want to use the grid just to search, orderby and paginate, but there's a LOT of logic inside it for more things that needs to be considered. On Thursday, April 4, 2013 12:23:58 PM UTC+2, Johann Spies wrote: How would I be able to use a query like this (or the DAL equivalent) to show the result in a grid? select so as Journal, SUM(aantal) as Articles from isi.nr_arts_per_journal group by Journal order by Journal Regars Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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/groups/opt_out.
Re: [web2py] Server performance (cpu/memory)
and how much ram and CPU does a simple wsgi server use? -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
my performance fluctuates depending on the network. i have an Internal site that is a basic wsgi site, and i couldn't figure out why i was getting 200ms times. then one day i worked late, everyone else had gone home. all of a sudden i was getting 10ms. so it may have nothing to do with your configuration. try a basic wsgi app,see if that goes faster. -- --- 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/groups/opt_out.
Re: [web2py] performance issue time to first byte
my performance fluctuates depending on the network. i have an Internal site that is a basic wsgi site, and i couldn't figure out why i was getting 200ms times. then one day i worked late, everyone else had gone home. all of a sudden i was getting 10ms. so it may have nothing to do with your configuration. try a basic wsgi app,see if that goes faster. -- --- 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/groups/opt_out.
[web2py] course app case
hi folks, i want to create a course app that have table room, teacher, student, course and class. in table class have reference to table room, teacher, student, course and also have the field : * field duration that contain duration of the class for example : - 3 months - 1 months * field schedule that contain date and time and depend on the duration field above for example : for 2 months class - in wednesday 3-4-2013 20:00 - 21:00, 10-4-2013 20:00 - 21:00, 17-4-2013 20:00 - 21:00, 24-4-2013 20:00 - 21:00, 1-5-2013 20:00 - 21:00, 8-5-2013 20:00 - 21:00, 15-5-2013 20:00 - 21:00, 22-5-2013 20:00 - 21:00 - in friday 5-4-2013 20:00 - 21:00, 12-4-2013 20:00 - 21:00, 19-4-2013 20:00 - 21:00, 26-4-2013 20:00 - 21:00, 3-5-2013 20:00 - 21:00, 10-5-2013 20:00 - 21:00, 17-5-2013 20:00 - 21:00, 24-5-2013 20:00 - 21:00 what is the web2py efficient way to achieve it? especially in class table. thank you very much before -- --- 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/groups/opt_out.