[web2py] Re: need teaching advice (JS+jQuery)

2013-04-06 Thread Chris May


On Wednesday, April 3, 2013 3:10:23 PM UTC-4, Derek wrote:

 Flickr, Panaramio, RSS to JSON (http://ejohn.org/projects/rss2json/) 
 Yahoo YQL (http://developer.yahoo.com/yql/guide/response.html), Twitter, 
 Salesforce.com...

 One thing that bugs me is that jQuery returns jQuery objects not dom 
 objects, so certain things you want to do just don't work if you treat it 
 like regular JS.


You can access the DOM object very easily by appending '[0]' to the jQuery 
object.

For instance, $('#element')[0] will return the DOM element with the id of 
element, or jQuery('a[href=#]')[0] will return the first anchor tag 
with a href of #.

-- 

--- 
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: need teaching advice (JS+jQuery)

2013-04-06 Thread Chris May
Your date has passed, so I don't know how useful this will be, but when I 
introduce people to jQuery, I usually start with fun, gimmicky things, like 
changing all the images in a web page to photos of cats:

jQuery('img').each(function() {var my = jQuery(this); 
my.attr('src','http://www.placekitten.com/'+my.width()+'/'+my.height())})

And then move on to show how jQuery enables you to interact with things on 
the page, like fading things in and out, resizing things, recoloring 
things, and then using mouseovers or clicks to trigger these things on 
other objects.

You could also show jQuery getting twitter updates.

On Wednesday, April 3, 2013 1:47:15 PM UTC-4, Massimo Di Pierro wrote:

 Tomorrow I am starting teach a new class. I did not create the class, it 
 was assigned to me. The class is for undergraduate students who have little 
 or no programming experience but know HTML+CSS. No server-side programming 
 experience. The class should cover JS+jQuery but no server-side programming.

 What are some cool uses of JS/jQuery that do not involve server-side 
 programming? 
 I am thinking of hooking to some JSONP services. Is there any you would 
 suggest?

 Massimo


-- 

--- 
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: Server-Sent Events

2013-04-06 Thread Chris May
Wow. It's cool that web2py ships with a websockets implementation. I was 
also thinking like Arnon about how to implement server-sent events with 
web2py.

As such I do want to add, maybe for posterity sake, that websockets serve a 
different use case than server-sent events, and are more complicated.
http://stackoverflow.com/questions/5195452/websockets-vs-server-sent-events-eventsource

But, with so much figured out already maybe it is better to use websockets.



-- 

--- 
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] Welcome app / AddToAny integration question

2012-05-30 Thread Chris May
More of a curiosity on my part, but why does web2py promote AddToAny (by 
automatically including it with every new application)?

Sure, it's easy enough to remove, but why is it in there in the first place?


[web2py] web2py book references: return invalid functions

2012-05-15 Thread Chris May
It looks like the reference links in the web2py book aren't working.

For example, the [pythonsecurity] link in the introduction (
http://web2py.com/books/default/reference/29/pythonsecurity) returns an 
error: invalid function (default/reference).

I hope that may be an easy fix for someone.


However, I think I stumbled apon a bug that might take longer to fix: There 
are other links return an invalid requests. For example, in the views 
chapter in the HTML section, there are what may be accidental links 
pointing to invalid requests (
http://web2py.com/books/default/reference/29/xml%3Aw). The text that points 
to that link is:

can be used to build complex expressions that can then be serialized to XML[
xml:w http://web2py.com/books/default/reference/29/xml%3Aw] 
[xml:ohttp://web2py.com/books/default/reference/29/xml%3Ao
].  

I get the feeling that the square brackets signify a link in markmin, and 
is triggering the creating of these invalid links.

Is someone available to help?

Chris May


[web2py] Re: How to get pound sign in url or work around it?

2012-03-22 Thread Chris May
I might have missed something. Are you trying to move the viewport to the 
element with the id after the hash?

If so, would you be able to use:
   document.location.hash = tabs=2;

Does that work?

On Wednesday, March 21, 2012 5:39:08 PM UTC-4, Cliff wrote:

 Thanks, Jonathan.  I appreciate the hint. 

 For anyone interested, there are a few more things you have to do. 
 If you just add anchor='tabs-2' to URL(), it renders /bla/edit/ 
 5#tabs-2. 

 Not an invalid request, but it doesn't get you to the anchor, either. 

 So do something like URL(bla, args=[request.args(0), ''], 
 anchor='tabs-2'). 
 That renders bla/edit/5//#tabs-2.  Note the two slashes.  This works 
 but 
 only one time, even if you create an observer by using live(). 

 A call to location.reload() fixes that problem. 

 Here is the complete function.  It is kind of slow. 
 $('#clickme').live('click', function(){ 
 alert('hi');  // make sure we are firing on click 
window.location.href = {{=URL('edit', 
 anchor='tabs-2',args=[str(request.args(0))])}}; 
location.reload; 
 }); 

 On Mar 21, 4:04 pm, Jonathan Lundell jlund...@pobox.com wrote: 
  On Mar 21, 2012, at 12:49 PM, Cliff wrote: 
  
  
  
   Here is a snippet of javascript code: 
   window.location.href = {{=URL('edit', args=[request.args(0), 
   '#tabs-2'])}}; 
  
   Notice the '#' in the args list. 
  
   URL persists in rendering the '#' as %23, which causes Web2py to throw 
   an 'Invalid Request' page. 
  
   I have tried using XML to preserve the pound sign, but to no avail. 
  
   How can I work around this? 
  
  Try adding the argument anchor='tabs-2' to URL().



[web2py] Re: web2py site and disabling browser right clicks

2012-03-09 Thread Chris May
I agree with Wikus. Just by having a web site out in the public means just 
that. Don't publish anything that you wouldn't want printed in newspapers 
or announced to your grandmother. :) 

You may be different, but every one who has asked me to prevent users to 
view source code did not care about user experience, and were trying to 
hide things that were not at all important to the end user or to their 
company. In each case, the result ended up turning users away from their 
sites because they were so heavily restricted from achieving their goals.

Not to mention, the most talented web developers openly share their ideas 
and code to make the industry better... like this group. if you're trying 
to hide, the Internet isn't a great place to be.


[web2py] Re: web2py site and disabling browser right clicks

2012-03-09 Thread Chris May
I'm sorry, Rahul. I may have misunderstood the reason behind your post, as I 
have heard similar requests in my time as a front-end developer. 

However, seeing that the site in your signature does potentially show sensitive 
information, the best thing I can recommend is to not send any more sensitive 
information to the browser than what is absolutely needed. Make sure you have 
good security on the pages this information is on. 

I don't know if that helps, but I only thought of it as I was walkin to my car. 


[web2py] Re: I would like to learn Web2py but where do I start?

2012-02-23 Thread Chris May
One caveat:

While I agree that w3schools is a helpful resource (as I use it as a 
regular reference), their examples do not promote best practices, most 
notably absent is unobtrusive JavaScript. I had to *unlearn much *of what I 
read on there.

For more information and better resources, include http://w3fools.com/ in 
your list.


[web2py] [OT] e-mail delivery strategies

2012-01-31 Thread Chris May
This is off-topic, but since a fair number of web2py users send e-mail from 
their applications, I thought this post from 37Signals might prove helpful 
to some.

There were nearly 16 million e-mails sent from 37Signals' eight web 
applications in the last seven days. About 99.3% of them were accepted by 
the remote mail server. The link explains how they achieve such a high rate 
of acceptance.

http://37signals.com/svn/posts/3096-behind-the-scenes-giving-away-the-secrets-of-email-delivery
 


[web2py] Re: (OT) Choosing a javascript mvc framework

2012-01-23 Thread Chris May
This might be too late for your application, but I just saw this review of 
12 MVC frameworks.

http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/ 

Quoted from the page:

 Specifically, the following four features are very important to me:
 UI Bindings - I’m not just talking about templates, I’m talking about a 
 declarative approach to automatically updating the view layer when the 
 underlying model changes. Once you have used a framework (such as Flex) 
 that supports UI bindings, you can never go back.
 Composed Views - Like all software developers, I enjoy creating modular 
 reusable code. For this reason, when programming UI, I would like to be 
 able to compose views (preferably at the template layer). This should also 
 entail the potential for a rich view component hierarchy. An example of 
 this would be a reusable pagination widget.
 Web Presentation Layer - We are programming for the web here people, the 
 last thing I want are native-style widgets. There is also no reason for a 
 web framework to create it’s own layout manager. HTML and CSS are already 
 the richest way to do style and layout in existence, and should be used as 
 such. The framework should be centered around this concept.
 Plays Nicely With Others - Let’s face it, jQuery is pretty amazing. I 
 don’t want a framework which comes bundled with a sub-par jQuery clone, I 
 want a framework which recommends using jQuery itself.



[web2py] Re: Need help with drag-n-drop using jQuery

2012-01-20 Thread Chris May
Hello, Frank, Welcome to web2py! I am also relatively new to web 
application development.

I threw your code into a new application, and I get very fast responses, 
usually in a fraction of a second. I don't know exactly why I have a 
dramatic difference in speed, but I do notice one thing that might aid in 
the development of the application.

They way you implemented your drag-and-drop, the application sends a 
request to the server on every 'focus' and 'mouseup' event. It would be 
better to have the JavaScript handle the drag-and-drop in the browser and 
send only the changes to the server.


[web2py] Re: Python / web2py or.... the learning path?

2012-01-17 Thread Chris May
There are indeed a *lot* of PHP tutorials and articles out there. Most of 
them are of little value in general, or even misleading readers into bad 
practices (as referenced by Christian Heilmann in a recent post on Smashing 
Magazinehttp://www.smashingmagazine.com/2011/12/27/hitting-the-ground-running-along-with-faceplant/).
 However, 
most of the *best *PHP sources will teach you web-development techniques 
that you can do in Python (or more precisely, are already easy for you to 
implement in web2py).

As a developer who is also growing in my understanding of the best 
practices, I recommend you look around as much as you can for great 
articles on best practices. I have learned a lot from the following places:

   - A List Apart http://www.alistapart.com/ - I would *start off here*. 
   In general, their articles do a great job of establishing practices you 
   want to emulate.
   - Smashing Magazine http://www.smashingmagazine.com/ - They post one 
   article a day, and the quality varies significantly, so be vigilant. Most 
   articles focus on front-end and trending topics in web design.
   - Smashing Network http://network.smashingmagazine.com/ - This is a 
   list of recent web-related blog posts curated by the Smashing team. The 
   quality varies even more, but there is enough there to scan through for 
   value.
   - This Google Group - You will learn *so much* from the talented people 
   here.
   - Paul Irish http://paulirish.com/ and his Google+ 
pagehttps://plus.google.com/113127438179392830442/posts- Paul is a young 
developer with a passion for making the web better by 
   sharing information. Most of what he shares is front-end specific, but makes 
   
   
http://paulirish.com/2011/web-browser-frontend-and-standards-feeds-to-follow/life
 
   
http://html5boilerplate.com/easierhttp://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
   .
   - Christian Heilmann http://christianheilmann.com/ - archives just 
   about every talk he gives on various web topics.

This list isn't as exhaustive. But I would also like to put out a request 
for other places to look for web development. Being relatively new to 
Python and the server-side myself, I don't have a go-to list for that side.

Anyone else have ideas?


[web2py] Re: haml and sass

2011-12-19 Thread Chris May
Curious. I've surprisingly not heard of haml. What would you say are the 
benefits over web2py's built-in HTML helpers?

SASS could be quite helpful for us front-end guys, and I notice there are a 
couple of python modules out there.

My opinion is that I don't know if it would need to be included in the core 
of web2py, but I wonder how hard a plug-in would be...


[web2py] Re: Backbonejs in web2py

2011-12-14 Thread Chris May
Nice example!

I love how snappy the site navigation is. That is one benefit I expected 
from using backbone, with the potential for so much less data being 
transferred for view changes over normal page refreshes.


[web2py] Re: Massimo

2011-12-08 Thread Chris May
I second that! 

We are truly blessed to have so many great, patient and 
available contributors to the code and the community!


Anthony, do you have the book memorized yet? :D


Re: [web2py] Re: Google Groups problem

2011-12-06 Thread Chris May
Thanks for the reminder for feedback! There were several times that Google 
Groups was telling me that x number of posts were updated, but showed all 
as read.

I noticed that just before I read this post, they just pushed out an update 
to the Groups software. Hopefully that'll fix it.


[web2py] Re: ttf and fonts

2011-12-02 Thread Chris May
It looks like you're going about it fairly well, but I also had issues with 
particular truetype fonts. Those issues went away after I changed which 
truetype font I used.

This is the code that works for me:

@font-face {
font-family: myFont; 
src: url('../static/Qarmic_sans_Abridged.ttf') format('truetype');
}
h3 {
font-family: myFont;
color: #777;
}

Maybe try another font.


[web2py] Re: DISCUSSION: Dual Desktop/Mobile Functionality

2011-07-26 Thread Chris May
I agree. It's very important to not annoy the site visitor by forcing
him into one view / solution / experience.

Judging by the parallel discussion in the developer group (http://
groups.google.com/group/web2py-developers/browse_thread/thread/
2056602a6c30af27#) and the corresponding issue request (http://
code.google.com/p/web2py/issues/detail?id=346), I believe a future
update will give site developers the ability to serve specific code to
specific devices.

Which means it will be up to us to give our users these options.


So all we will need are better educated web developers.

Is there a way to get web2py to do that for us? :)


On Jul 26, 6:39 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jul 26, 2011, at 3:12 PM, Rufus rufusvsm...@gmail.com wrote:
  (to tell the truth, the mobile-enabled websites really tick me off
  when there is no way for
  me to force it back to the standard page.)

 I've seen sites that allow overriding the choice and getting the normal 
 view.


[web2py] Re: DISCUSSION: Dual Desktop/Mobile Functionality

2011-07-22 Thread Chris May
Hey Ross, thanks for starting this discussion. And what a timely
discussion, considering today's Smashing Magazine article is a roundup
of Responsive Design (RD) patterns. (www.smashingmagazine.com)

(For those unfamiliar with RD, also check out A List Apart for a great
intro: http://www.alistapart.com/articles/responsive-web-design/)

I agree that it would be valuable to make it easier to address mobile
and desktop environments, and I've been wondering how to work with
web2py on this front as well. I notice that in the bottom of base.css
for web2py, there is space for RD, which is a good starting point to
have one bass CSS file that can work for desktop and mobile
environments. I feel this can work well for pages that would serve the
same content to desktop and mobile browsers. But I don't know how
common that is.

One major issue I find is getting a reliable way to detect a mobile
environment.

I have worked with some people who are attempting to keep a database
of browser agents to determine it that way. I would think it's a
nightmare to keep that list up to date.

I know the folks at http://yiibu.com/ have come up with a possible
solution, following the mobile first pattern. But I haven't been
able to dive into their code yet.

Thus far in sites I've recently developed, I've limited my mobile
environment detection to finding out the browser width and using CSS
to change the layouts and images.

How do you think we can reliably detect a mobile environment?



[web2py] Re: jQuery .focus()

2011-07-18 Thread Chris May
To select an element by ID in jQuery, you can use the CSS-like syntax
#id.

jQuery(#key1).focus();


Your jQuery(input.key1).focus(); statement told jQuery to look for
an input with the class property of key1.

On Jul 18, 3:54 am, annet annet.verm...@gmail.com wrote:
 In web2py_ajax.html I have the following line of code to set focus on
 the first visible field in forms:

 jQuery(input:text:not(.date):first:visible).focus();

 In a view with three forms, named form1, form2, form3, the focus is
 set on the first field of form2 whereas I want the focus to be set on
 the first field of form1. I tried:

 jQuery(input:text:not(.date):first:visible).focus();
 jQuery(input.key1).focus();

 ... but that doesn't work. How do I set focus on the field with id
 key1?

 Kind regards,

 Annet.


[web2py] Re: estore

2011-07-05 Thread Chris May
I sure hope so... The only thing I have been looking to is Massimo's
brief tutorial on credit card payments 
http://groups.google.com/group/web2py/msg/00df672fe3d67aab

On Jul 5, 4:48 am, apple simo...@gmail.com wrote:
 Is this no longer maintained? It does not seem to be available to
 dowload.

 Are there any other examples of web2py ecommerce sites?


[web2py] Re: proper way to mobile and desktop 'skins'

2011-06-28 Thread Chris May
Are you sending different content to either desktop or mobile devices?

If you aren't, you could use the responsive web design approach
(http://www.alistapart.com/articles/responsive-web-design/ or
http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/)
or the mobile first approach (http://www.lukew.com/ff/entry.asp?933
or http://yiibu.com/).

Using either of these approaches, you can use CSS media queries to
style elements based on attributes like device width. You can even
have all your styles in one CSS file that render differently for
different devices.

/* Inside your .css file */
/* Smartphones (portrait and landscape) --- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) --- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) --- */
@media only screen
and (max-width : 320px) {
/* Styles */
}



[web2py] Re: Speed of rendering html data (10,000+ rows)

2011-06-21 Thread Chris May
Have you tried pasring the data using your 0.078 second method into a
json format and using jQuery to parse it?


[web2py] Wiki example in the book

2011-05-26 Thread Chris May
I am using the book to learn more about web2py, and I was checking out
the wiki example in chapter 3 (http://web2py.com/book/default/chapter/
03#A-Wiki ), I noticed that the links inside the RSS feed come out
slightly wrong. The links have .rss in between the app name and the
row.id argument, as shown below.

http://127.0.0.1:8000/mywiki/default/show.rss/2;

That link sends me to either an RSS error page or a 401
UNAUTHORIZED page. I would expect the link to be:

http://127.0.0.1:8000/mywiki/default/show/2;

The code to create it, from the book is:
link = URL('show', args=row.id),

Am I missing something?


[web2py] Re: Wiki example in the book

2011-05-26 Thread Chris May
I don't think I'm running trunk code... I'm running version 1.95.1
(2011-04-25 15:04:14).

I copied views/generic.rss into views/default/news.rss (which seems
more in line with the book example, since the show function shows the
wiki page), and it still inserted .rss in after show

So... if you're saying that this might be preventing a security
vulnerability, maybe I should add .html to the show function name.
Though, then the link would be http://127.0.0.1:8000/mywiki/default/
show.html/2, which looks a little wonky but probably works, right?

link = 'http://' + str(request.env.http_host) + URL('show.html',
args=row.id),


[web2py] Re: Ajax page update

2011-05-19 Thread Chris May
I thought I read of a way of using jQuery for something like this
using its deferred object. (http://api.jquery.com/category/deferred-
object/)

Sorry I can't be more specific, but I hope it helps.

On May 19, 10:25 am, VP vtp2...@gmail.com wrote:
 Is there a guide for a clean and sweet way to implement these types of
 polling?  Like using jquery?

 Thanks.

 On May 19, 9:05 am, Anthony abasta...@gmail.com wrote:



  The simplest approach would probably be ajax short polling (i.e., an ajax
  request every n seconds). If the orders page is just an administrative page
  with a small number of simultaneous users, that's probably fine. If that's
  not adequate, you could look into comet type solutions. web2py includes a
  WebSockets implementation in /gluon/contrib/comet_messaging.py 
  (http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes...).
  That doesn't work in all browsers, but it can be adapted to fall back to
  other methods using Socket.IO -- 
  seehttp://greg.thehellings.com/2011/04/web2py-websockets-and-socket-io-p...
  .

  Anthony

  On Thursday, May 19, 2011 9:29:30 AM UTC-4, David J wrote:
   I was wondering how can I PUSH updates to a page using Ajax.

   On our orders page as orders come in I want the page to automatically be
   updated;

   Currently I just refresh the page every N seconds; but I thought it
   could be made more efficient.

   Like some sort of event notification system.

   Thanks in advance for any advice on this.


[web2py] Re: py-appscript

2011-05-04 Thread Chris May
I love the thought that Web2Py can do this. I find it fascinating that
this power / opportunity exists, but I could use someone's perspective
on practical uses for this. I have my head a little too far in the sky
to harness this functionality.

On May 4, 1:25 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://appscript.sourceforge.net/py-appscript/index.html