[web2py] Re: nav bar in 2.16.1

2017-12-30 Thread Carlos Kitu
Thanks a lot Paolo. It worked fine.
Best regards.

El sábado, 23 de diciembre de 2017, 19:08:18 (UTC+1), Paolo Caruccio 
escribió:
>
> Regarding the collapsed navbar issue, in the web2py 2.16.1 welcome 
> layout.html page the id on the navbar-collapse  is missing
>
> 
>
>
> Il giorno sabato 23 dicembre 2017 14:12:46 UTC+1, lucas ha scritto:
>>
>> as I reported when the screen isn't wide enough, it will default to the 
>> pull down button, that doesn't work in safari or Firefox.  it also doesn't 
>> work on iOS.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: nav bar in 2.16.1

2017-12-22 Thread Carlos Kitu
Me too, with chromium and chrome as browsers. I just started with 2.16.1, and 
found that out. I thought that something was wrong with my browser.
Best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py with js framework

2017-08-16 Thread Carlos Kitu
@valk: wow, that looks great. One of the most annoying things of working with 
vue.js was the need to write html. 

After getting used to the helpful web2py's html helpers, writing pure html 
feels really verbose. With the code you showed, the view seems somewhat similar 
to working with html helpers, and also looks great to write the controller in 
python to have it translated to javascript, if you are used to python.
Thank you for sharing it.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py with js framework

2017-08-16 Thread Carlos Kitu
I agree with you, @limedrop, for a fully "reactive"(let's call it that way) 
application I would also go your way. The use case I described only makes sense 
if you only need a small part of your application truly reactive.
Best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py with js framework

2017-08-14 Thread Carlos Kitu
Hi stifan,
I just wanted to share my recent experience with vue.js and web2py.
At first I didn't want to give up things like sqlform.
Then I tried to tweak the form generated by web2py with el1=form.element(...) 
to get a reference to the html element I wanted to add certain vue.js 
directives like v-if, v-model, ...
It was so easy as:
el1["_v-if"]="something"

It works but later I realized that it was not practical because I the logic 
spread between the controller, with the form generation, and vue.js directives, 
then the html view where I had more vue.js directives and components, and the 
main js vue controller. 

As I didn't want to renounce to the look and feel of web2py, because I just 
needed a very dynamic function made in vue, and the rest of the application 
could be made the traditional way with web2py, I resorted to generating just 
once the form with web2py and copying manually the resulting html code to the 
html view, and that way I just have to work with the html view and the JS code 
as usual in vue.js apps.
With regard to passing data from the controller to vue.js, you can use 
{{=ASSIGNJS(key1=val1, key2=val2, ...)}} in your view and you will get those 
keys available as global vars in JavaScript with the needed translations to 
JSON in case you use complex values as lists, dicts, ...

If anybody found a better way to integrate the things, please let us know.

Hope this helps.
Best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: possible error in autocomplete code

2017-06-07 Thread Carlos Kitu
Anthony, being so helpful as you are, you need by no means to apologize.
Thank you so much.
Best regards.

El martes, 6 de junio de 2017, 21:15:29 (UTC+2), Anthony escribió:
>
> Sorry, I forgot about that -- you can in fact use a virtual field. 
> However, for it to work properly, you must specify the table name when 
> defining the virtual field:
>
> db.auth_user.full_name = Field.Virtual('full_name', 
>lambda row: '%s %s' %(row.auth_user
> .first_name,
>  row.auth_user
> .last_name),
>table_name='auth_user')
>
> Also, note that when you use a virtual field with autocomplete, it selects 
> all records (and all fields) in the table and does the filtering in Python, 
> so this could be quite slow for large tables.
>
> Anthony
>
> On Tuesday, June 6, 2017 at 9:51:33 AM UTC-4, Carlos Kitu wrote:
>>
>> Thanks a lot, Anthony.
>> I use to check the framework code before posting questions, and when I 
>> saw this in the callback method of the autocomplete widget:
>> def callback(self): 
>> if self.keyword in self.request.vars: 
>> field = self.fields[0] 
>> if type(field) is Field.Virtual: 
>> records = [] 
>> table_rows = self.db(self.db[field.tablename]).select(orderby
>> =self.orderby)
>>
>> I guessed wrongly that virtual fields were supported.
>> Thank you and best regards.
>>
>> El lunes, 5 de junio de 2017, 17:11:37 (UTC+2), Anthony escribió:
>>>
>>> You cannot use autocomplete to search a virtual field. It runs a 
>>> database query, so the field must exist in the database.
>>>
>>> Anthony
>>>
>>> On Monday, June 5, 2017 at 9:23:51 AM UTC-4, Carlos Kitu wrote:
>>>>
>>>> Good afternoon,
>>>> I'm trying to create an autocomplete field to search in the table 
>>>> db.auth_user, but the search must be done with the full name.
>>>> As db.auth_user has two separate fields (first_name, and last_name), I 
>>>> created a virtual field to compose both fields:
>>>>
>>>> db.auth_user.full_name = Field.Virtual('full_name', lambda row: '%s %s' 
>>>> %(row.auth_user.first_name, row.auth_user.last_name))
>>>>
>>>> Then, I used the autocomplete widget in a field:
>>>>
>>>> db.define_table('my_table',
>>>>  Field('my_user', 'reference auth_user', notnull=True, unique=False, 
>>>> label='User'),
>>>>  ...
>>>> )
>>>>
>>>>
>>>> db.my_table.my_user.widget = SQLFORM.widgets.autocomplete(
>>>> request, db.auth_user.full_name, id_field=db.auth_user.id, db=
>>>> db,
>>>> at_beginning=False, limitby=(0, 10), min_length=2)
>>>>
>>>>
>>>>
>>>> And I get this error when creating a new form:
>>>>
>>>>  'DAL' object has no attribute 'None'
>>>> Versión
>>>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Rastreo
>>>>
>>>> 1.
>>>> 2.
>>>> 3.
>>>> 4.
>>>> 5.
>>>> 6.
>>>> 7.
>>>> 8.
>>>> 9.
>>>> 10.
>>>> 11.
>>>> 12.
>>>> 13.
>>>> 14.
>>>> 15.
>>>> 16.
>>>> 17.
>>>> 18.
>>>> 19.
>>>> 20.
>>>> 21.
>>>> 22.
>>>>
>>>> Traceback (most recent call last):
>>>>   File 
>>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/restricted.py", line 
>>>> 227, in restricted
>>>> exec ccode in environment
>>>>   File 
>>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>>>  
>>>> <https://127.0.1.1:8000/admin/default/edit/VREscalas/controllers/default.py>,
>>>>  line 1119, in 
>>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/globals.py", 
>>>> line 417, in 
>>>> self._caller = lambda f: f()
>>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/tools.py", 
>>>> line 4241, in f
>>>> return action(*a, **b)
>>>>   File 
>>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>

[web2py] Re: possible error in autocomplete code

2017-06-06 Thread Carlos Kitu
Thanks a lot, Anthony.
I use to check the framework code before posting questions, and when I saw 
this in the callback method of the autocomplete widget:
def callback(self): 
if self.keyword in self.request.vars: 
field = self.fields[0] 
if type(field) is Field.Virtual: 
records = [] 
table_rows = self.db(self.db[field.tablename]).select(orderby=
self.orderby)

I guessed wrongly that virtual fields were supported.
Thank you and best regards.

El lunes, 5 de junio de 2017, 17:11:37 (UTC+2), Anthony escribió:
>
> You cannot use autocomplete to search a virtual field. It runs a database 
> query, so the field must exist in the database.
>
> Anthony
>
> On Monday, June 5, 2017 at 9:23:51 AM UTC-4, Carlos Kitu wrote:
>>
>> Good afternoon,
>> I'm trying to create an autocomplete field to search in the table 
>> db.auth_user, but the search must be done with the full name.
>> As db.auth_user has two separate fields (first_name, and last_name), I 
>> created a virtual field to compose both fields:
>>
>> db.auth_user.full_name = Field.Virtual('full_name', lambda row: '%s %s' 
>> %(row.auth_user.first_name, row.auth_user.last_name))
>>
>> Then, I used the autocomplete widget in a field:
>>
>> db.define_table('my_table',
>>  Field('my_user', 'reference auth_user', notnull=True, unique=False, 
>> label='User'),
>>  ...
>> )
>>
>>
>> db.my_table.my_user.widget = SQLFORM.widgets.autocomplete(
>> request, db.auth_user.full_name, id_field=db.auth_user.id, db=db,
>> at_beginning=False, limitby=(0, 10), min_length=2)
>>
>>
>>
>> And I get this error when creating a new form:
>>
>>  'DAL' object has no attribute 'None'
>> Versión
>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Rastreo
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>>
>> Traceback (most recent call last):
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/restricted.py", 
>> line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>  
>> <https://127.0.1.1:8000/admin/default/edit/VREscalas/controllers/default.py>,
>>  line 1119, in 
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/globals.py", 
>> line 417, in 
>> self._caller = lambda f: f()
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/tools.py", line 
>> 4241, in f
>> return action(*a, **b)
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>  
>> <https://127.0.1.1:8000/admin/default/edit/VREscalas/controllers/default.py>,
>>  line 140, in programas
>> lambda row: A('resumen', _href=URL(
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 2307, in grid
>> create_form = SQLFORM(table, **sqlformargs)
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 1288, in __init__
>> inp = field.widget(field, default)
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 748, in __call__
>> table_rows = 
>> self.db(self.db[self.fields[0].tablename]).select(orderby=self.orderby)
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>  line 914, in __getitem__
>> return self.__getattr__(str(key))
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>  line 921, in __getattr__
>> return BasicStorage.__getattribute__(self, key)
>> AttributeError: 'DAL' object has no attribute 'None':
>>
>>
>> I printed in console the self.fields[0]:
>> self.fields {'comment': None, 'represent':  at 
>> 0x7f6c907310c8>, 'widget': None, 'name': 'full_name', 'f': >  at 0x7f6c90731050>, 'requires': None, 'readable': True, 'label': 
>> 'Full 
>> name', 'writable': False, 'filter_out': None, 'tablename': None, 
>> 'formatter': , 'type': 'string'}
>>
>> It happens that the db.auth_user.full_name.tablename is None, i.e., the 
>> virtual field have no tablename attibute as the autocomplete code seems to 
>> expect.
>> Should I open a ticket?
>>
>> Thank you and best regards.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] possible error in autocomplete code

2017-06-05 Thread Carlos Kitu
Good afternoon,
I'm trying to create an autocomplete field to search in the table 
db.auth_user, but the search must be done with the full name.
As db.auth_user has two separate fields (first_name, and last_name), I 
created a virtual field to compose both fields:

db.auth_user.full_name = Field.Virtual('full_name', lambda row: '%s %s' %(
row.auth_user.first_name, row.auth_user.last_name))

Then, I used the autocomplete widget in a field:

db.define_table('my_table',
 Field('my_user', 'reference auth_user', notnull=True, unique=False, label=
'User'),
 ...
)


db.my_table.my_user.widget = SQLFORM.widgets.autocomplete(
request, db.auth_user.full_name, id_field=db.auth_user.id, db=db,
at_beginning=False, limitby=(0, 10), min_length=2)



And I get this error when creating a new form:

 'DAL' object has no attribute 'None'
Versión
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Rastreo

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/restricted.py", 
line 227, in restricted
exec ccode in environment
  File 
"/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
 , 
line 1119, in 
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/globals.py", line 
417, in 
self._caller = lambda f: f()
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/tools.py", line 
4241, in f
return action(*a, **b)
  File 
"/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
 , 
line 140, in programas
lambda row: A('resumen', _href=URL(
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", line 
2307, in grid
create_form = SQLFORM(table, **sqlformargs)
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", line 
1288, in __init__
inp = field.widget(field, default)
  File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", line 
748, in __call__
table_rows = 
self.db(self.db[self.fields[0].tablename]).select(orderby=self.orderby)
  File 
"/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
 line 914, in __getitem__
return self.__getattr__(str(key))
  File 
"/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
 line 921, in __getattr__
return BasicStorage.__getattribute__(self, key)
AttributeError: 'DAL' object has no attribute 'None':


I printed in console the self.fields[0]:
self.fields {'comment': None, 'represent':  at 
0x7f6c907310c8>, 'widget': None, 'name': 'full_name', 'f':  at 0x7f6c90731050>, 'requires': None, 'readable': True, 'label': 'Full 
name', 'writable': False, 'filter_out': None, 'tablename': None, 'formatter'
: , 'type': 'string'}

It happens that the db.auth_user.full_name.tablename is None, i.e., the 
virtual field have no tablename attibute as the autocomplete code seems to 
expect.
Should I open a ticket?

Thank you and best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Any ideas on how to prepare web2py apps for GDPR

2017-06-02 Thread Carlos Kitu
Hi Antonio,
I don't know the UK regulations about GDPR, but I know the spanish ones, 
and in this subject both countries apply the european regulation, thus i 
think that they must be quite similar.
The spanish data protection regulations defines three levels of security 
personal data, related to a degree of sensitivity. Each level requires 
different means of protection.
As far as I remember, at the highest level you are not required to encrypt 
the data stored at the server. You are requested to encrypt the data stored 
in removable media to be transported to another place(i.e. to send data, or 
to keep backup copies off-site), this is related to backup software, not 
the application or databases. Of course you are required to cipher your 
communication with the browser, with https. Another requirement is to track 
every change of the high security level data (previous value, updated 
valued, access date, who accessed), but you can do that easily with the 
framework with oncreation functions, for example.

Personal data protection involves formal measures (like getting explicit 
consent to record the information), and technical measures. Another 
difficult issue is the IT service providers(i.e. hosting). If you use a 
hosting service, you need specific contract clauses to address the Personal 
data issue. And you can't put the data anywhere. It must be in an european 
country, or a country with an equivalent regulation level(see this link: 
https://www.theguardian.com/technology/2015/oct/06/safe-harbour-european-court-declare-invalid-data-protection)

With regard to the article:
*In the UK, the Information Commissioner has provided guidance that, in the 
case of data loss where encryption software has not been used to protect 
the data, regulatory action may be pursued.  *
I think that they are speaking about losing removable unciphered media. If 
there is a data loss in your premises, there is no risk of disclosing 
personal data, just of losing personal information, which is also punished 
by that regulation.

*The study revealed that 34% of web pages of FT30 firms that collect PII 
are doing so insecurely, 29% are not using encryption, 3.5% are using 
vulnerable encryptions algorithms, and 1.5% have expired security 
certificates.*
This may be related with the communications. If you use https I think that 
you are safe.

I suggest you to have a look at the Personal data protection regulations, 
because the news papers is an incomplete source, at best.

And if you still need to cipher the data at the server, there is a long 
post here 

 
about this subjetc, with this example:
db.define_table('contact',
 Field('user_id', db.auth_user, default=auth.user_id, readable=False, 
writable=False),
 Field('email', label='Contact email'),
 Field('phone', label='Contact phone')
)


db.contact.email.requires = [IS_EMAIL(error_message="Wrong email address")]
db.contact.phone.requires= [IS_LENGTH(maxsize=30, error_message="Bit too 
long, right?")]
db.contact.email.filter_in = lambda value : w2p_encrypt(value)
db.contact.phone.filter_in = lambda value : w2p_encrypt(value)
db.contact.email.filter_out = lambda value : w2p_decrypt(value)
db.contact.phone.filter_out = lambda value : w2p_decrypt(value)

Good look and best regards.

El jueves, 1 de junio de 2017, 12:40:15 (UTC+2), Ramos escribió:
>
> I have 3 apps where i need to address this issue...
>
>
>
> http://www.computerweekly.com/news/450419960/Top-UK-firms-websites-violate-key-GDPR-principle?utm_medium=EM=EM_EDA_77932701_campaign=20170601_Top%20UK%20firms%E2%80%99%20websites%20violate%20key%20GDPR%20principle_source=EDA
>
> Regards
> António
>
>
> 
>  Sem 
> vírus. www.avast.com 
> 
>  
> <#CAEM0BxOt_yRJdomZkuFp9+x-r1QLR7cUmVB+t2ZjDDf6QpMt8w@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to speed up query processing in web2py's sqlite?

2017-06-02 Thread Carlos Kitu
As Leonel mentioned, index creation will be your best friend in this issue.

I have  been using web2py during the last two years, and till now, I had no 
concerns about database performance because I was working in intranet 
applications without a big volume of data.
In the latest project we had a bigger volumen and I needed to tune the 
things up. The process was:

   - Identify the slow queries: 
  - you can just print in the console the db(...)._select(..) (don't 
  miss the underscore) to get the sql translation of the DAL method.
  - another practical way is to include in your view 
  {{=response.toolbar}} where you can see de sql queries executed and their 
  timings.
   - Once you know where to focus, you can use the database command line 
   and get the query plan. In sqlite:
  - explain query plan SELECT ..   (here you put the query obtained 
  in the previous step)
  - I got something like this:
  - 0|0|0|SCAN TABLE articulo AS art_PO
  0|1|1|SEARCH TABLE familia USING AUTOMATIC COVERING INDEX (id_familia
  =? AND centro=?)
  0|2|2|SEARCH TABLE articulo AS art_NA USING AUTOMATIC COVERING INDEX (
  familia=?)
  0|3|3|SEARCH TABLE vinculo USING AUTOMATIC COVERING INDEX (vinculacion
  =? AND articulo_NA=? AND articulo_PO=?)
  0|4|4|SEARCH TABLE consulta USING AUTOMATIC COVERING INDEX (vinculo=? 
  AND masreciente=?)
  0|0|0|USE TEMP B-TREE FOR ORDER BY
  - Those AUTOMATIC COVERING INDEX means that sqlite analyzed the query 
  and decided it made sense to create a temporary index to get the data 
  faster, instead of scanning the full table. That temporary index is 
deleted 
  after the query is executed. In englisht it means: *please create an 
  index for this table with the columns in the parenthesis*, i.e., 
  create one index for familia with columns id_famiia and centro.
   - Implicit joins vs explicit joins: the sql-92 recommendation is to use 
   explicit joins. It should be the same, but the last days I learnt that in 
   DAL, the implicit joins translate sometimes to a query with CROSS JOIN 
   while explicit joins translate to INNER JOIN. The results are the same 
   records, but I'm under the impression that the CROSS JOIN make a cartesian 
   product of the records in the joined tables, and then filters out according 
   to the WHERE CLAUSE, while INNER JOIN makes a faster query. With a low 
   number of records you will see no timing difference, but when there is a 
   big number of records there can be a big difference. I said I'm under the 
   impression, because it should be the same, but I kept getting a slow query 
   after creating indexes, and the timing only got right when I converted an 
   implicit join into an explicit join.
   - Here you have an example of implicit versus explicit:
  - Implicit join: db(db.dogs.owner == db.owner.id).select()
  - This translates to: SELECT * from dogs, owner where dogs.owner = 
  owner.id , or maybe SELECT * from dogs CROSS JOIN owner where dogs.owner 
= 
  owner.id. I have seen both results with different more complex queries. I 
  didn't test this example.
  - Explicit join: 
  db(db.dogs.id>0).select(join=[db.owner.on(db.dogs.owner == db.owner.id), 
])
  - This translates to: SELECT * from dogs JOIN owner ON db.dogs.owner 
  == db.owner.id 
  - After this experience, I realized that explicit joins are easier to 
  read than implicit joins, and in one case it supposed a performance 
gain(in 
  that case there was a main table with a join with a secondary table with 
  two aliases: see this link 
  

  )
   
There is very skilled people in the database field in this group and it 
would be great if they could clarify any misunderstanding in this post.
Best regards.

El jueves, 1 de junio de 2017, 11:04:09 (UTC+2), Mike Stephenson escribió:
>
> I see that with a million of rows, the search takes almost 15-20 seconds. 
> How do I speed it up?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] [solved] unable to install application on Windows Server and IIS

2017-05-19 Thread Carlos Kitu
Just to share a finding,

I was getting crazy with a simple installation of a new application on 
Windows Server and Internet Information Server. Many applications in 
production with no issues, I could upload any other application, but was 
getting the "unable to install application" with an specific application. I 
could discard any permissions problem because there where no recent changes 
in the server.
I could upload that application without problems in my development 
environment, in Ubuntu.

This issue was difficult to debug because with IIS you have no console to 
see the traceback.

Finally I resorted to make a tar xvcf with the .w2p file just to see what 
was inside. Then I could see the offending file. It was a broken link. When 
uploading the  package with the broken link in ubuntu, it could deal with 
it without problems. Seems that Windows Server and IIS can't manage it and 
the installation fails. I just needed to remove the broken link in my 
source folder, pack again the application and everything worked fine 
uploading in Windows/IIS. 

It's improbable that this happens again to anybody, but maybe someone can 
save some time with this post.

Best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Communication between server and python script help

2017-05-01 Thread Carlos Kitu
Hi Esteve,
I use web2py, and also as a side project, I develop firmware for 
microcontrollers (with mbed OS, not arduino, but quite similiar). I didn't 
have the need of connecting both worlds, so take this as hints, not real 
tested experience.

First, let's check a couple of assumptions:
- I guess that you have a PC connected to your arduino though a serial port.
- That PC has a python script receiving data from the arduino

I would try with a REST API client for python, to connect the PC python's 
script with the server. After a quick search, I found this one: *Requests: 
HTTP for Humans* (http://docs.python-requests.org/en/latest/), that might 
be fine four your needs. Maybe *someone in this group could suggest a 
better option*
Just to be sure, I would implement some kind of buffering in the PC python 
script, i.e. some queue to store the received data from the arduino, until 
it is transmitted to the server. You could get some hints from this 
link: https://docs.python.org/2/library/io.html

At the server side, web2py, I would implement a REST API (see 
http://web2py.com/books/default/chapter/29/10/services#Restful-Web-Services) 
to receive the PC script's data and store it in a table.

Good luck and please report in this group your findings, just in case I 
need to do something like this sometime later, so that I can take advantage 
of your experience.
Best regards.

El domingo, 30 de abril de 2017, 16:19:53 (UTC+2), Esteve Martín escribió:
>
> Hi,
> I was recently introduced to web development so i'm stil quite a newbie 
> and i'm having difficulties to find the correct way the implement what i 
> want.
> At the moment i'm working in a project and I seem to have hit a wall. I 
> would appreciate some advice to get me on the right path.
>
> I have some arduinos that constantly send sensor data trough serial ports 
> to a python script and i would like this data to be uploaded to the server. 
> The server should then store it into the database and also plot it in 
> real-time. I would like the server to be capable to actuate on the arduino 
> as well, for example to change the value of some of its pins. 
>
> To implement this i thought of making a token based protocol over a 
> two-way communication channel between my python program and the web2py 
> application. The thing is that i have no idea how to do this. I have done 
> some research but i've been overflown with information. What would you 
> recomend? I've read websockets would do the trick but i would like some 
> council before getting into it.
>
> Thanks and sorry for my mediocre english,
>
> Esteve
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to change menu bar background and font colors

2017-04-27 Thread Carlos Kitu
 

What I use to do when I don't want to deal with css changes or creating new 
classes, just a *quick and dirty solution* is:

Right click on the element I want to change – Inspect

I get a pane with the html code.

For instance, if I try to change the style of navbar, I would right click 
on LOG IN and in the inspect pane I would get:










And at the right styles pane I have this:






























There you see the styles for the navbar  element.

You can click in the attribute you want to change, for instance the color, 
and select another one:



I changed the color from 98978b to f4f3ed using a convenient color picker, 
as you can see.

Now I would copy that code:

.navbar-default .navbar-nav>li>a{color: #f4f3ed;} 


In a  clause, directly in the html view, or using an html helper:

newstyle = STYLE(XML('.navbar-default .navbar-nav>li>a{color:#f4f3ed;} ))

and put it in the html view: {{=newstyle}}

Or, if you don't want to use an html helper, just copy this in the html 
view: