Re: "Dreaming in Code"

2008-04-23 Thread alexelder
On Apr 23, 6:12 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> Haven't seen anyone mention this book, it is a "Soul of a New Machine"-
> style record of the Chandler project.  Since Chandler uses Python and
> Twisted, and employed a few Python celebs, I thought folks on this
> list might have already read the hardcover version.  I just picked up
> the paperback at B&N yesterday, finished it this evening.  It's a
> decent read, describing a software project in laymen's terms (like
> there are laymen out there who care about that sort of thing!).
>
> The paperback version adds a chapter including events that transpired
> after the hardcover publication date, current up to about October,
> '07, so that's a nice touch.
>
> I'm going to ask my wife to read it so she might learn what I do for a
> living.
>
> -- Paul

Hi, Paul.

This book was actually the book which got me into Python! At the time
of reading I was in my second year of University, utterly snowed under
with Java and C related assignments/personal projects, however, I
found time to read this book; I'm /so/ glad I did. I actually heard of
the book from an article written by Joel 'Joel on Software', Spolsky.
(you can find it here: http://www.joelonsoftware.com/items/2007/01/02.html).
It's an interesting read and poses a nice insight into how software
projects evolve over time.

Alex.
--
http://mail.python.org/mailman/listinfo/python-list


Re: "Dreaming in Code"

2008-04-23 Thread alexelder
On Apr 23, 6:12 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> Haven't seen anyone mention this book, it is a "Soul of a New Machine"-
> style record of the Chandler project.  Since Chandler uses Python and
> Twisted, and employed a few Python celebs, I thought folks on this
> list might have already read the hardcover version.  I just picked up
> the paperback at B&N yesterday, finished it this evening.  It's a
> decent read, describing a software project in laymen's terms (like
> there are laymen out there who care about that sort of thing!).
>
> The paperback version adds a chapter including events that transpired
> after the hardcover publication date, current up to about October,
> '07, so that's a nice touch.
>
> I'm going to ask my wife to read it so she might learn what I do for a
> living.
>
> -- Paul

Hi, Paul.

This book was actually the book which got me into Python! At the time
of reading I was in my second year of University, utterly snowed under
with Java and C related assignments/personal projects, however, I
found time to read this book; I'm /so/ glad I did. I actually heard of
the book from an article written by Joel 'Joel on Software', Spolsky.
(you can find it here: http://www.joelonsoftware.com/items/2007/01/02.html).
It's an interesting read and poses a nice insight into how software
projects evolve over time.

Alex.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Calling Python code from inside php

2008-04-23 Thread alexelder
On Apr 23, 7:42 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> vijay schrieb:
>
> > Hi
> > I have a python code performing some computation for me.I have a
> > html page which passes certain argumnets to a php page.This php page
> > needs to pass on the value to the Python class and get the result
> > back.
> > How do I go about this??
>
> Write a commandline-app in python, that does the work for you. Invoke
> that using php.
>
> Or use something like pyphp - but I haven't used it, can't comment on
> its usability/support etc.
>
> Diez

A simple yet dangerous and rather rubbish solution (possibly more of a
hack than a real implementation) could be achieved by using a
technique described above:



I would look into pyphp though. This method has so many issues
attached to it it's hardly worth bothering with.
I'm with Nick when I say why on earth are you needing to call Python
from within PHP as opposed to using only Python or only PHP?

Alex.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Calling Python code from inside php

2008-04-25 Thread alexelder
On Apr 25, 4:02 pm, sturlamolden <[EMAIL PROTECTED]> wrote:
> On Apr 23, 9:13 pm, [EMAIL PROTECTED] wrote:
>
> > A simple yet dangerous and rather rubbish solution (possibly more of a
> > hack than a real implementation) could be achieved by using a
> > technique described above:
>
> >  > echo exec('python foo.py');
>
> This will spawn a Python interpreter, and not be particularly
> efficient. You could just as well have used CGI.

Thanks for pointing that out. I thought the warning before hand
could've suggested that this implementation wasn't the best. I'll be
more explicit in the future.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python to verify streaming tv/radio station links

2008-04-29 Thread alexelder
On Apr 29, 1:52 pm, [EMAIL PROTECTED] wrote:
> Hi guys. I've put together a website (http://worldwidemediaproject.com
> ) that is a database of internet streaming tv/radio stations from
> around the world. I have built the site with all users in mind. The
> site should be Linux, Unix, Mac, Win, etc friendly as I do not hide
> the actual stream link or force the user to use an embedded player to
> view/listen to the streams. In fact, you can even download the streams
> you like as a playlist that you can load into your player of choice
> (and even a few PVR software plugins).
>
> In building the site, I have enabled the user to report stations that
> are nonfunctional. In addition to this, I would like to automate the
> checking of the links in the database as well as any user submitted
> links. What I am wanting to do is to script this with a simple for
> loop which would loop through a file containing the station stream
> link as well as the station id. I'd like to pass each through some
> kind of verification function and if a connection is made then the
> stream is good and move on to the next. If the connection fails then
> the stream is bad, I would like to add the station id to a file
> containing all 'nonfunctional' streams that I can later automate to
> flag the stations.
>
> Is there an easy way to use python to verify a stream exists? I've
> done a little experimenting with sockets and was able to connect to my
> usenet server and talk to it, but I don't really know what's involved
> with connecting to streaming windows media, real media and winamp
> servers or what to expect as far as connection status messages.   I am
> not unfamiliar with python, but I am far from an expert. If anyone
> could give me a hand with this or give me a push in the right
> direction I would greatly appreciate it!
>
> Many thanks!

Hey!

With regards checking feeds, look into urllib (maybe) and the httplib
(definitely). They /could/ offer some sort of information regarding
the activity of your feeds. Without knowing anything about the
streaming protocols I wouldn't suggest my methods to necessarily be
the most helpful. You could, at least [maybe], establish whether a
feed is active if it can return a HTTP 200 response. If that's a
sufficient check I would suggest that httplib is the place to start.

Alex.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread alexelder
On May 5, 10:25 am, n00m <[EMAIL PROTECTED]> wrote:
> os:windows
> ml = 'line1 \n line2 \n line3 \n'
> exec('some.exe "' + ml + '"')
>
> and some.exe get only 'line1'...

I think your problem lies with your "\n", escape chars. Assuming these
are not arguments and are indeed separating statements, I suggest
replacing "\n", with "&". That way, the command shell probably wont
complain.

An example:
ml = 'line1 & line2 & line3'

Alex.
--
http://mail.python.org/mailman/listinfo/python-list