Re: [web2py] Re: Is there any way to calculate distance between two points(lat and long) inside of sqlite?

2012-03-14 Thread Kenny Chung
Thank you for reply Wikus. I know I can use mysql. But I am trying to stick
with Sqlite. hehe Does DAL queries support MySql just like Sqlite?

On Wed, Mar 14, 2012 at 4:18 AM, Wikus van de Merwe <
dupakrop...@googlemail.com> wrote:

> You can use mysql with web2py:
> http://web2py.com/books/default/chapter/29/6#Connection-strings
>
>


Re: [web2py] Re: Is there any way to calculate distance between two points(lat and long) inside of sqlite?

2012-03-14 Thread Kenny Chung
It's not suitable for doing calculation in the controller. I don't know how
bad it is going to be if I go with the path that Niphlod suggested. I have
about 1000 Points. You think your solution will work well?
On Mar 14, 2012 3:34 PM, "Alan Etkin"  wrote:

> Is it not suitable for your code to do calculations in the controller
> code before storing/updating data?
>
> On 14 mar, 05:19, Kenny  wrote:
> > I just started programming in web2py from php.
> >
> > I know how to do it on Mysql and GAE(geohash or I forgot but there's
> > another one)
> >
> > But it seems that SQLite doesn't support acos and asin. Is it true?
> >
> > Is there any other way around to calculate inside of Sqlite query?
> >
> > What would be the best way to do this? Should I just calculate
> > distance after fetching the db?
> >
> > I tried to search it on Google but no luck.


Re: [web2py] How do I add inside of in HTML format?

2012-03-19 Thread Kenny Chung
Never Mind. It was easier than I really thought of.
{{=A('Wish List',B('(3)'),_href=URL('index'))}}

Awesome :)


On Mon, Mar 19, 2012 at 12:22 PM, Kenny  wrote:

> I looked up the documentary and example, I wasn't able to find one.
> How can I convert this to Web2py format?
>
> Wish List (3)
>
> Thank you.


Re: [web2py] I am trying to make pizza order page with web2py. What's the best way to store toppings info?

2012-03-26 Thread Kenny Chung
thank you Bruno.
I have one more question about query.( I think I was happened to see your
github code as well)
 I have a form in HTML
and I read all the form values by serializing it
code
var data = $('.info input[type=\'text\', )
alert(data) // it shows pid=8&topping=1&topping=3&... on and on
I have a problem on this  line
How can I send the serialized values by using ajax to the python method?
This is what I wrote
/
ajax('{{=URL('tester',vars=dict(data=data))}}',,box-content');

I have def tester , and box-content is a class name of DIV
Also I tried
ajax('tester',['data'],'box-content');
no luck.

I hope I am going right direction. Thank you

On Mon, Mar 26, 2012 at 12:17 PM, Bruno Rocha  wrote:

> a list of dictionaries.
>
> session.order = []
>
> pizza = {"id": 1234, "quantity": 2, "toppings": ["tomatoes", "pepper",
> "zuchini"]}
>
> session.order.append(dict(pizza))
>
>
> On Mon, Mar 26, 2012 at 4:02 PM, Kenny  wrote:
>
>> I am just trying to make pizza order page with web2py.
>> I usually store quantity of pizza and id number in session.
>>
>> But how can I store pizza topping info that user ordered in session?
>>
>> I am not too familiar with python, so I don't know what would be the
>> best way to store it.
>>
>> So session will have
>>
>> {pizza_id, quantity}
>>
>> and toppings under that pizza id.
>>
>> Thank you.
>
>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


Re: [web2py] I am trying to make pizza order page with web2py. What's the best way to store toppings info?

2012-03-26 Thread Kenny Chung
Thank you. the answer was very clear for me to solve it.
one another question is about Bruno's answer about storing data in session
using dictionary.
 I see that appending works for adding new orders but what if you place an
order that's already placed in session? I know how to compare one word at a
time, but with my knowledge, I don't know how to find if it's same order
and increase only the quantity if it finds one. any help? I will try my
best to figure it out by tonight though!

Thank you!

On Mon, Mar 26, 2012 at 9:12 PM, Anthony  wrote:

> var data = $('.info input[type=\'text\', )
>> alert(data) // it shows pid=8&topping=1&topping=3&... on and on
>> I have a problem on this  line
>> How can I send the serialized values by using ajax to the python method?
>> This is what I wrote
>> /
>> ajax('{{=URL('tester',vars=**dict(data=data))}}',,box-**content');
>>
>
> That won't work because dict(data=data) is Python code that is executed
> on the server, and "data" is a Javascript variable defined in the client
> (after the Python code has already been executed). Anyway, if the values
> are in form input elements, the ajax() function will handle the serializing
> for you -- you just have to list the names of the input elements as the
> second argument:
>
> ajax('{{=URL('tester')}}', ['pid', 'topping'], 'box-content')
>
> Anthony
>
>


Re: [web2py] Re: time field in DAL? when I retrieve it, it gives me as nontype instead of time type.

2012-03-29 Thread Kenny Chung
Wonderful! Thank you!

On Thu, Mar 29, 2012 at 9:05 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> default_time = datetime.time(12,00)
> (row.start_hour or default_time) > request.now.time()
>
>
> On Thursday, 29 March 2012 02:50:12 UTC-5, Kenny wrote:
>>
>> I tried to compare by doing
>>
>> {{=row.start_hour > request.now.time()}}
>>
>> start_hour is defined as 'time'
>>
>> error :
>>
>> TypeError: can't compare datetime.time to NoneType
>>
>>
>> How can I convert time field to be time type? so I can compare them.
>>
>>
>> Also, one last question is how can I show times in different timezone?
>> Do I need to use pypt?
>>
>> thank you.
>>
>>


Re: [web2py] adding an item in a list:reference :

2012-04-01 Thread Kenny Chung
Im curious on this as well. Also, is list:reference valid for mysql?
On Apr 1, 2012 2:23 PM, "bussiere adrien"  wrote:

> ok i see the example :
>
> >>> db.define_table('tag',Field('name'),format='%(name)s')
> >>> db.define_table('product',
> Field('name'),
> Field('tags','list:reference tag'))
>
> >>> a = db.tag.insert(name='red')
> >>> b = db.tag.insert(name='green')
> >>> c = db.tag.insert(name='blue')
> >>> db.product.insert(name='Toy Car',tags=[a, b, c])
>
> *but if after i make :*
>
> d = db.tag.insert(name='purple')
>
>
> how to add d to db.product ? with a,b,c who were already here ?
>
>
> Regards
>
> Bussiere
>
> *
> *
>
>


Re: [web2py] just deployed web2py on flux flex. I have errors on database. How can I delete DBs and migrate them?

2012-04-03 Thread Kenny Chung
okay I will do so.
Also,
 the error is

ProgrammingError: (1064, u"You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'option CHAR(1),\nsize CHAR(1),\nis_active
CHAR(1),\ncreated_on DATETIME' at line 16")


On Tue, Apr 3, 2012 at 1:34 PM, Richard Vézina
wrote:

> Change your db connection string to the mysql server then
>
> fake_migrate=True
>
> And
>
> get back with migrate=True.
>
> Search the book with fake_migrate for more explanation.
>
> Richard
>
>
> On Tue, Apr 3, 2012 at 4:26 PM, Kenny  wrote:
>
>> I inserted databases on Fluexflex's MySql. However, I had an error while
>> inserting them.
>>
>> The question is how can I delete SQL file in web2py application and
>> insert dbs all over again?
>>
>> I dropped all the tables in mysql server. However web2py application has
>> sql file that I cannot have an access in Fluexflex.
>>
>> So, I can't let DAL insert dbs automatically since DAL assumes that the
>> tables are already created.
>>
>> Any help would be appreciated.
>>
>> Thank you.
>>
>
>


[web2py] My website is running lil slow

2012-04-03 Thread Kenny Chung
I have some python fetching rows and calculating distances on views. Do u
guys think that it delays loading time? Thank you.


Re: [web2py] Re: My website is running lil slow

2012-04-04 Thread Kenny Chung
Thank you.
 On Apr 4, 2012 6:16 AM, "Massimo Di Pierro" 
wrote:

> Try this:
>
> - add the web2py toolbar and it will tell you the time of each query
> {{=response.toolbar()}}
> - turn on the profiler
> web2py.py -F profiler_filename.txt
> it will log useful info at each request
>
> On Tuesday, 3 April 2012 23:45:46 UTC-5, Kenny wrote:
>>
>> I have some python fetching rows and calculating distances on views. Do u
>> guys think that it delays loading time? Thank you.
>>
>


Re: [web2py] Is there anyone using Linode to host Web2py??

2012-04-05 Thread Kenny Chung
@Bruce,
I see. I will keep that in mind. Glad that I ran it on 10.04.


Re: [web2py] Is there anyone using Linode to host Web2py??

2012-04-06 Thread Kenny Chung
I just did it. :) thank you.

On Fri, Apr 6, 2012 at 12:10 AM, pbreit  wrote:

> I don't think so. Try: apt-get install python-imaging


Re: [web2py] [BUG in w2p book] Re: a web2py powered shop (solution)

2012-04-21 Thread Kenny Chung
Nice. Is this website urs? How can I open modal window like tos on this
website?
On Apr 21, 2012 6:20 PM, "Bruce Wade"  wrote:

> http://96.126.99.73/ register use sponsor id 12. Under products is a kind
> of shopping card that allows you to buy projects using paypal, alipay or
> ucash. You can also cancel orders
>
> On Sat, Apr 21, 2012 at 12:27 PM, Tim Michelsen <
> timmichel...@gmx-topmail.de> wrote:
>
>>  Is there such a snippet/plugin already existing?
>>>
>> BTW: the recipies on
>> http://web2py.com/books/**default/chapter/29/14?search=**
>> payment#Accepting-credit-card-**payments
>>
>> are not working.
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


Re: [web2py] My home made ide - Screenshots

2012-05-03 Thread Kenny Chung
beautiful. looking great!

On Thu, May 3, 2012 at 9:12 PM, José Ricardo Borba wrote:

> Very impressive. Very good job. I will be glad if you share with us.
>
> José Ricardo Borba
> Porto Alegre - RS
>
>
> 2012/5/3 Ricardo Pedroso 
>
>> As requested by Massimo, I've upload some screenshots:
>>
>> https://github.com/rpedroso/gweb2py/raw/master/screenshots/gweb2py00.png
>> https://github.com/rpedroso/gweb2py/raw/master/screenshots/gweb2py01.png
>> https://github.com/rpedroso/gweb2py/raw/master/screenshots/gweb2py02.png
>> https://github.com/rpedroso/gweb2py/raw/master/screenshots/gweb2py03.png
>>
>>
>> Massimo, in gweb2py00.png as you can see there is a HTTP 404 error
>> code regarding
>> a css/artwork.css missing when calling
>> http://localhost:8000/examples/default/download
>>
>> Ricardo
>>
>
>
>
> --
> José Ricardo Borba
>
> UFRGS - Instituto de Física
> L3FNano - 43173 room 101
> Lab:55-51-3308-6457 / Office: 55-51-3308-6530
> Mobile:55-51-8184-7649 / Fax:   55-51-3308-7286
>
>


Re: [web2py] Re: Integrating iPhone device tokens into web2py auth

2013-02-09 Thread Kenny Chung
Howesc,
Thanks for great info. So, does mobile app user have to register web2py via
access token provided by their hardware in mobile application? May you
explain how you built the login/registration module for mobile app users
along with web2py?
Do you code in html5 with native code for developing your mobile app?

Sorry for asking more than one question, this topic sounds so interesting!
:)

Thank you!
On Feb 9, 2013 11:45 AM, "howesc"  wrote:

> well what we are using is a hybrid model:
>  - the ios device uses a modified form of OAuth to get access tokens (and
> we have the confusing problem of users start anonymous but with an access
> token, and then may later create an "account" associating an email and
> other user data with the account)
>  - the website uses web2py's auth to login those same users
>  - the APNS token (Apple Push Notification Service) is provided optionally
> by the user if they opt-in to push notifications.  as such it's not a
> primary key for the user and can't be used for authentication.   if the
> user chooses to share it with us we store that in a field on our user
> table.  Note that the APNS token is device specific, so if the user has
> multiple devices then they might have multiple tokens.
>
> does that clarify at all?
>
> cfh
>
> On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro wrote:
>>
>> I do not know how this works. Can you give us more details?
>>
>> On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote:
>>>
>>> i have millions of APNS tokens! i'd share, but they are tied to an
>>> app
>>>
>>> i did not tie APNS tokesn to web2py auth, but i added fields to my end
>>> user table, and the device uses my REST JSON API to POST the APNS tokens to
>>> the server and update the user.  we don't use the APNS token as any sort of
>>> user identifier.
>>>
>>> does that help?  lemme know if you are interested in more details.
>>>
>>> christian
>>>
>>> On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote:

 I'm looking into supporting Apple push notifications in an iPhone app
 that connects to a web2py server.
 In order to know which devices to push details to, web2py's auth module
 would presumably need to maintain "Device Tokens".
 I'm curious if anyone has implemented a solution that takes care of
 this. I'd like to see how it was integrated with web2py's auth.

 Thanks,
 Chris

>>>  --
>
> ---
> 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] Re: Integrating iPhone device tokens into web2py auth

2013-02-11 Thread Kenny Chung
Thank you, guys. :) I think I should try to implement one, when I am free.

Do you know any opensource for  iphone oauth login as well as android?

I am actually passing login credentials to web2py from android app via
given web2py lib.
On Feb 11, 2013 11:29 AM, "howesc"  wrote:

> Thanks Alec, that will be a nice contribution.
>
> re my "special odd pain in the rear-end" login flow.well we (the
> engineers) failed to sell that to the business.  users can make purchases
> via apple without a proper logged in account, and we need to track those on
> the server.  hence the anonymous user.  it would be really nice if apple
> shared with us the itunes user ID on app launch, but they don't because
> they believe that violates the user's privacy (and i kinda agree on that
> point).  So i'm stuck with an overly complex login flow. :(
>
> cfh
>
> On Sunday, February 10, 2013 9:55:35 PM UTC-8, Alec Taylor wrote:
>>
>> Not to worry, I'm releasing a generalised open-source OAuth2 Library for
>> web2py.
>>
>> As for your current mechanism of anonymous tokens… how about just
>> storing a cookie (or some other client-side storage) and when the user
>> logs-in or registers all their customisations (e.g.: if e-commerce,
>> their cart) will be sent securely to the server on receipt of
>> successful authentication.
>>
>> That would be a much cleaner, more secure, streamlined and
>> self-contained model than your current one.
>>
>> On Sun, Feb 10, 2013 at 9:33 AM, howesc  wrote:
>> >  - Apple explicitly does not allow using the hardware identifier in
>> your
>> > app, and will reject app submission that do that.  because of this each
>> app
>> > install "logs in" first as an anonymous user.
>> >  - website users use standard web2py auth
>> >  - app connections to the server use our modified OAuth API
>> implementation.
>> > this forgoes web2py auth, but reads and writes to the same user table
>> that
>> > web2py auth uses.  this allows the 2 different systems to connect.
>> >  - the mobile apps are native code on their respective platforms, the
>> > website is html.
>> >
>> > unfortunately our modified OAuth implementation is pretty specific to
>> our
>> > needs and so i don't think it's a candidate for us to open source.
>>  i'll
>> > take a look into what we are doing though to see if any of it
>> can/should be
>> > open sourced.
>> >
>> > cfh
>> >
>> >
>> > On Saturday, February 9, 2013 11:40:50 AM UTC-8, Kenny wrote:
>> >>
>> >> Howesc,
>> >> Thanks for great info. So, does mobile app user have to register
>> web2py
>> >> via access token provided by their hardware in mobile application? May
>> you
>> >> explain how you built the login/registration module for mobile app
>> users
>> >> along with web2py?
>> >> Do you code in html5 with native code for developing your mobile app?
>> >>
>> >> Sorry for asking more than one question, this topic sounds so
>> interesting!
>> >> :)
>> >>
>> >> Thank you!
>> >>
>> >> On Feb 9, 2013 11:45 AM, "howesc"  wrote:
>> >>>
>> >>> well what we are using is a hybrid model:
>> >>>  - the ios device uses a modified form of OAuth to get access tokens
>> (and
>> >>> we have the confusing problem of users start anonymous but with an
>> access
>> >>> token, and then may later create an "account" associating an email
>> and other
>> >>> user data with the account)
>> >>>  - the website uses web2py's auth to login those same users
>> >>>  - the APNS token (Apple Push Notification Service) is provided
>> >>> optionally by the user if they opt-in to push notifications.  as such
>> it's
>> >>> not a primary key for the user and can't be used for authentication.
>>   if
>> >>> the user chooses to share it with us we store that in a field on our
>> user
>> >>> table.  Note that the APNS token is device specific, so if the user
>> has
>> >>> multiple devices then they might have multiple tokens.
>> >>>
>> >>> does that clarify at all?
>> >>>
>> >>> cfh
>> >>>
>> >>> On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro
>> wrote:
>> 
>>  I do not know how this works. Can you give us more details?
>> 
>>  On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote:
>> >
>> > i have millions of APNS tokens! i'd share, but they are tied to an
>> > app
>> >
>> > i did not tie APNS tokesn to web2py auth, but i added fields to my
>> end
>> > user table, and the device uses my REST JSON API to POST the APNS
>> tokens to
>> > the server and update the user.  we don't use the APNS token as any
>> sort of
>> > user identifier.
>> >
>> > does that help?  lemme know if you are interested in more details.
>> >
>> > christian
>> >
>> > On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote:
>> >>
>> >> I'm looking into supporting Apple push notifications in an iPhone
>> app
>> >> that connects to a web2py server.
>> >> In order to know which devices to push details to, web2py's auth
>> >> module would pres

[web2py] How can I receive oauth/access tokens with the Oauth library in Web2py?

2013-03-26 Thread Kenny Chung
Yesterday, I wanted to get the tokens from Facebook and Twitter for users
and using the Web2py normal login system at same time. I only wanted to use
their APIs not for implementing oauth login into my website.
I was able to get tokens from Facebook API by using Facebook JavaScript
SDK. I chose this route since I don't know how to separate the Web2py given
library(login_form) for getting only tokens instead of creating auth users
and signing in.
If I can separate the login_form, how should I do it? Or is there any other
way around?

Thank you!

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenny Chung
Thank you as always, Anthony. Working great. ;)


On Wed, May 1, 2013 at 2:29 PM, Anthony  wrote:

> What if you add exclusive_domain=True to the BASE dict? I believe that
> prevents creating outgoing URLs like that, but not sure if it affects
> incoming requests.
>
> Anthony
>
>
> On Wednesday, May 1, 2013 12:37:11 PM UTC-4, Loïc wrote:
>>
>> I would like to understand too...
>> Maybe somebody else has an idea ?
>
>  --
>
> ---
> 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/1hSkZ4o99h4/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.




Re: [web2py] Re: I just fresh installed web2py on ubuntu 12.04, cannot find modules?

2013-05-02 Thread Kenny Chung
Hi Anthony,

So, should I just import "contrib.simplejson"? Is this recently changed?

Ken

On Thu, May 2, 2013 at 8:26 PM, Anthony  wrote:

> It's contrib.simplejson.
>
> On Thursday, May 2, 2013 9:08:31 PM UTC-4, Kenneth wrote:
>>
>> This seems odd to me.
>>
>> I just moved my server and ran the ubuntu script to install web2py
>>
>> I cannot import simplejson for some reason. (I ran it on python -S
>> web2py.py as well)
>>
>> anyone had this problem before? Let me know! Otherwise, I have to import
>> directly from gluon.
>>
>  --
>
> ---
> 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/qRO3Lzm9hWs/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.




Re: [web2py] Re: I just fresh installed web2py on ubuntu 12.04, cannot find modules?

2013-05-02 Thread Kenny Chung
Ouch. I must have used old version of web2py than.
I always imported simplejson as "import simplejson as json"
I totally forgot to replicate my setup before terminating my linode server.

Ken

On Thu, May 2, 2013 at 8:36 PM, Anthony  wrote:

> I think that's where it has always been.
>
>
> On Thursday, May 2, 2013 9:27:07 PM UTC-4, Kenneth wrote:
>
>> Hi Anthony,
>>
>> So, should I just import "contrib.simplejson"? Is this recently changed?
>>
>> Ken
>>
>> On Thu, May 2, 2013 at 8:26 PM, Anthony  wrote:
>>
>>> It's contrib.simplejson.
>>>
>>> On Thursday, May 2, 2013 9:08:31 PM UTC-4, Kenneth wrote:

 This seems odd to me.

 I just moved my server and ran the ubuntu script to install web2py

 I cannot import simplejson for some reason. (I ran it on python -S
 web2py.py as well)

 anyone had this problem before? Let me know! Otherwise, I have to
 import directly from gluon.

>>>  --
>>>
>>> ---
>>> 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/qRO3Lzm9hWs/**unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> 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/qRO3Lzm9hWs/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.




Re: [web2py] Re: I just fresh installed web2py on ubuntu 12.04, cannot find modules?

2013-05-03 Thread Kenny Chung
Great to know! Thank you

On Fri, May 3, 2013 at 1:31 PM, Niphlod  wrote:

> a little correction. serializers.py in trunk now "inverts" the order
> of imports
> it tries simplejson (cause newer versions of simplejson as an external
> module are always faster than the standard json shipped with python from
> 2.6 on)
> then uses json
> then uses contrib.simplejson
> However, if you want to be "uber-compatible" it's best to use always what
> Alan suggested (using serializers) so you can "lean" on the "smart-import"
> that it does by default.
>
>
> On Friday, May 3, 2013 3:46:32 AM UTC+2, Alan Etkin wrote:
>>
>> Ouch. I must have used old version of web2py than.
>>> I always imported simplejson as "import simplejson as json"
>>> I totally forgot to replicate my setup before terminating my linode
>>> server.
>>>
>>
>> Maybe you had simplejson installed in your old o.s., so you could simply
>> import it directly.
>>
>> You could do this instead:
>>
>> >>> from serializers import json_parser as json
>>
>> It tries json stdlib, then an installed simplejson, and as fallback the
>> module included in contrib.
>>
>>  --
>
> ---
> 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/qRO3Lzm9hWs/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.




Re: [web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)

2015-05-10 Thread Kenny Chung
Thank you! your customer search function example answers my question.

just curious, does SQL grid search function work same way as your search
function example?



On Sun, May 10, 2015 at 11:47 PM, Anthony  wrote:

> Basically I have 5 fields (last_name, middle_name, first_name,
>> mother_full_name, father_full_name) in a table called names,
>>
>> When I search a keyword "john", I would like to search it on a whole
>> table. For example, is there any way to just do
>> db(db.names.contains("%john%")) and it gives a list of rows with a searched
>> keyword stored in it instead of doing this ==>
>> db((db.names.last_name.contains("%john%")&(db.names.first_name.contains("%john%")&(db.names.mother_full_name.contains("%john%")))
>>
>
> db.names.contains(...) is not valid DAL code nor would it be able to
> produce valid SQL (i.e., you have to specify fields). So, you need
> something like your second example, but replace all the "&" operators with
> "|". Anyway, there is no need to do that, because the grid search already
> does exactly that, which is why all you have to do is disable the
> Javascript search widget (as described in the linked post) to get the
> behavior you want.
>
> Alternatively, you can code your own search function:
>
> def mysearch(sfields, keywords):
> keywords = keywords.strip()
> return reduce(lambda a, b: a | b, [field.contains(keywords) for field
> in db.names])
>
> Then pass that as the "searchable" argument to the grid.
>
> Anthony
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/MKKxc41Nq7w/unsubscribe.
> 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/d/optout.
>

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


Re: [web2py] Re: Working with custom form

2012-07-05 Thread Kenny Chung
When I used customform for login, it won't give me any errors to be shown
whenever the password was invalid or email is not existing. I put it on
jquery mobile website. Any idea?
On Jul 4, 2012 4:25 PM, "Anthony"  wrote:

> If you refuse to use web2py's css and js files, remember that
>> response.flash and session.flash wont work
>>
>
> Well, the flash message won't *display*, but it's easy to add some very
> minimal JS code to get it to display.
>
>
>> and also your validators also wont work. so you would have to handle form
>> validation yourself.
>>
>
> The validators will work fine without web2py's CSS and JS files. However,
> when displaying form errors, you won't get the nice slidedown effect
> without the JS (i.e., the errors will simply appear when the page is
> initially rendered rather than sliding down after page render).
>
> Anthony
>


Re: [web2py] Re: Postgres Heroku

2012-09-15 Thread Kenny Chung
Thank you, Bruno. Do they also offer Web2py hosting as well? I am not
familiar with their service. By the way, thanks for another reply for my
post couple days ago! ;)

On Sat, Sep 15, 2012 at 8:36 PM, Bruno Rocha  wrote:

>
> And data-clips are amazing feature!
>
> https://postgres.heroku.com/dataclips/icuwejkuecgtzhbdtcpeomdakcyg
>
> --
>
>
>
>

-- 





Re: [web2py] Is it possible to remove row from rows result created from DB?

2012-09-17 Thread Kenny Chung
Thank you. I tried executesql, I got an error saying it cannot be
serialized in JSON.
On Sep 17, 2012 2:58 PM, "Bruno Rocha"  wrote:

> In my experience working with this I fired out that it is better to use
> "haversine" directly on database, you can find haversine functions for
> MySQL, Postgres and even for SQlite.
>
> I dont know how one can write haversine with DAL api, but you can do it
> with executesql() as you are going to turn this in to json.
>
> BTW: you can use rows.exclude(lambda row: row.x == y) to remove items
> I guess you can combine rows with Rows += Rows/ or Rows &= Rows if they
> are scheme identically.
>
>  Take a look at row.exclude() on dal chapter of the book
>
>
> On Mon, Sep 17, 2012 at 4:51 PM, Kenny  wrote:
>
>> Basically, I get the place data with longitude and latitude, calculate it
>> if it's more than 3000 miles, remove that row from Rows.
>> I am sure that this is wrong. If I can remove the row from fetch rows,
>> how can I add extra columns to the rows for distance between two points?
>> P.S the result has to be Jsoned.
>>
>> Here's the code
>>
>> def tester():
>> items = db(db.dine_promotion.place_id==db.place.id).select()
>>
>> latitude =float(23.790457)
>> longitude =float(-47.602542)
>> for row in items:
>> if row.place.latitude:
>> a=float(row.place.latitude)
>> b=float(row.place.longitude)
>> dist="%.2f" % calc_distance(latitude,longitude,a,b)
>> if  dist > 3000:
>> items.remove(row)
>> return dict(restaurants = items)
>>
>>  --
>>
>>
>>
>>
>
>
>  --
>
>
>
>

-- 





Re: [web2py] Jquery Kit

2013-01-07 Thread Kenny Chung
Thank you for the link, Bruno!


On Mon, Jan 7, 2013 at 9:36 PM, Bruno Rocha  wrote:

> An interesting set of Jquery plugins..
>
> http://jquery-jkit.com/
>
> Bruno
>
> --
>
>
>
>

-- 





[web2py] Storing Python code in db?

2013-01-18 Thread Kenny Chung
I am testing out to store Python code and run it by extracting it from the
database.
It looks simple but it's giving me a weird error.

*//Code*
{{a=row.temp}} //question.temp is "def f(x):\nx = x + 1\ny = 10\n
 return x + y" same as below
{{b="def f(x):\nx = x + 1\ny = 10\nreturn x + y"}}
{{=a}} 
{{=b}}

*//Result*
def f(x):\n x = x + 1\n y = 10\n return x+y
def f(x): x = x + 1 y = 10 return x + y

As you can see, 'a' still has "\n" in it when 'b' doesn't. What is causing
this problem?

Also, what would be the best way to store something like that?


Thank you.

--