comp.lang.python - 8 new messages in 3 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* No more Python support in NetBeans 7.0 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/25041624201187d5?hl=en
* passing Python data to a javascript function - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/8d37aca7cee9e691?hl=en
* webapp development in pure python - 5 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/cbe1874d91861626?hl=en
==============================================================================
TOPIC: No more Python support in NetBeans 7.0
http://groups.google.com/group/comp.lang.python/t/25041624201187d5?hl=en
==============================================================================
== 1 of 1 ==
Date: Wed, Oct 26 2011 7:06 pm
From: web@naveed.net
Sorry to comment on an old topic, but I wanted to clarify for others like me who might get the wrong idea.
It looks like this is no longer true. Netbeans 7 might be supporting python after all.
http://wiki.netbeans.org/Python70Roadmap
==============================================================================
TOPIC: passing Python data to a javascript function
http://groups.google.com/group/comp.lang.python/t/8d37aca7cee9e691?hl=en
==============================================================================
== 1 of 2 ==
Date: Wed, Oct 26 2011 7:42 pm
From: Chris Rebert
On Wed, Oct 26, 2011 at 7:25 PM, Bill Allen <wallenpb@gmail.com> wrote:
>
> Benjamin,
>
> I was afraid I was doing that. I have simplified it quite a bit, still not
> getting the output I am looking for. I am down to that I am not passing
> the value in the onload=showPID() call correctly. I know this is getting a
> bit far from a Python issue now, but if you have more insight on this, I
> would appreciate it. Is there another way of passing the data from the
> Python script to the javascript than what I am doing in this CGI?
The problem is that you're not passing the data at all. You never
interpolate the pid_data value into the string(s) constituting your
embedded JavaScript (though you did do it just fine in the pure HTML).
The Python variable `pid_data` is not somehow magically accessible to
JavaScript; you must explicitly insert its value somewhere.
<snip>
> pid_data = str(os.getpid())
<snip>
> print """
<snip>
> <body onload="showPID(pid_data)">
Change that line to:
<body onload="showPID("""+pid_data+""")">
As an example, if the PID happens to be 42, then the outputted
fragment will end up being:
<body onload="showPID(42)">
As a sidenote, I would recommend using something higher-level than the
`cgi` module. Python has an abundance of web frameworks and templating
languages; take your pick.
Cheers,
Chris
--
http://rebertia.com
== 2 of 2 ==
Date: Wed, Oct 26 2011 8:55 pm
From: Chris Angelico
On Thu, Oct 27, 2011 at 2:51 PM, Bill Allen <wallenpb@gmail.com> wrote:
> Chris,
>
> Wow, that seems so simple now that I see it. I was dancing around that all
> day, but just not landing on it. Thanks so very much for the assist.
>
> --Bill
>
> Final code that works perfectly, passes the value from the Python script to
> the javascript correctly:
>
> <body onload="showPID("""+pid_data+""")">
Congratulations! You've just written code that writes code. It takes a
bit to get your head around it (especially when you start worrying
about literal strings that might contain quotes, for instance), but
it's really cool and seriously powerful stuff. Your server-side Python
code can generate client-side Javascript code any way it likes...
unlimited possibilities.
ChrisA
==============================================================================
TOPIC: webapp development in pure python
http://groups.google.com/group/comp.lang.python/t/cbe1874d91861626?hl=en
==============================================================================
== 1 of 5 ==
Date: Wed, Oct 26 2011 8:05 pm
From: Chris Angelico
On Thu, Oct 27, 2011 at 8:47 AM, Prasad, Ramit
<ramit.prasad@jpmorgan.com> wrote:
> You technically can connect to databases from JavaScript. It is a terrible idea, but achievable. Not really sure how it would get "compiled" into JavaScript, so it is possible that is the stumbling block.
> http://stackoverflow.com/questions/857670/how-to-connect-to-sql-server-database-from-javascript
>
Strongly recommend against this. I haven't confirmed, but by the look
of it the code there is IE-only and MS SQL Server only. Also, remote
database access is a major security concern. I would recommend keeping
it all on the server (more efficient that way, too).
ChrisA
== 2 of 5 ==
Date: Wed, Oct 26 2011 10:04 pm
From: 88888 Dihedral
I am thinking one has to distinguish between programs for database servers of the commercial applications in banks or insurance companies that cant be hacked in low costs, and experiments to chunk out database servers for games and videos all over the world!
== 3 of 5 ==
Date: Wed, Oct 26 2011 10:04 pm
From: 88888 Dihedral
I am thinking one has to distinguish between programs for database servers of the commercial applications in banks or insurance companies that cant be hacked in low costs, and experiments to chunk out database servers for games and videos all over the world!
== 4 of 5 ==
Date: Wed, Oct 26 2011 10:18 pm
From: Chris Angelico
On Thu, Oct 27, 2011 at 4:04 PM, 88888 Dihedral
<dihedral88888@googlemail.com> wrote:
> I am thinking one has to distinguish between programs for database servers of the commercial applications in banks or insurance companies that cant be hacked in low costs, and experiments to chunk out database servers for games and videos all over the world!
I don't know about that. Best practices are often best for everyone;
it's more critical for a bank than for a game server, but that doesn't
mean the game server can afford to use swiss cheese as armor plate.
Particularly if it's the livelihood of the game designer; in fact,
that might even make it _more_ important than for a bank.
ChrisA
== 5 of 5 ==
Date: Wed, Oct 26 2011 11:37 pm
From: 88888 Dihedral
OK, lets start a framework in using python in the server side and the client side.
(1). requirements of the server side first:
1. sending HTML, XML documents to be displayed in the browsers of the clients and receiving for user inputs are easy in modpython, django, and etc.
2. Data received in the server side has to be stored and verified for later accesses performed from client's requests
3. data and traffic amounts to be estimated for the server in order to process requests in terms of numbers of clients and costs per defined operation period, well, a slow database engine that consumes a lot CPU time in the server really sucks!
(2). Lets check the client side, too!
In scenario 1 the client side has the browser operating only via port 80.
In scenario 2 the client side has an AP. that could be invoked in the browser, e.g. Adobe PDF reader or Apple's quick time engine
In scenario 3 AP. can invoke the browser to a cyber page in the client side with multiple sockets via TCPIP/UDP of various ports in the AP., e.g. skype, msn, and etc..
Assuming that programmers can use a customized python package installed in the AP. of the client side with other tools is allowed.
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en
To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home