Re: Getting started with python

2007-04-15 Thread Dorai
On Apr 15, 3:35 am, James Stroud <[EMAIL PROTECTED]> wrote:
> Eric wrote:
> > Hello, after reading some of the book Programming Python it seems that
> > python is something I would like to delve deeper into. The only thing
> > is, I have no idea what I should try and write. So I was hoping that
> > someone here could help point me to a group/project that would be a
> > good starting place for a person with limited python knowledge, but
> > that is willing to learn whatever is necessary. I'm hoping that with a
> > goal I can start to learn python instead of just playing around with
> > it. Thanks.
>
> Here is a protocol I have used in the past:
>
> 1. Realize there is a program you really wish you had.
> 2. Find out that, upon relentless googling, no
>such program exists that meets your needs exactly.
> 3. If 2 fails and a program exist s, go back to 1.
> 4. Proceed to write this program no matter what it takes--you
>may even face some "sitdowns" with your friends, family,
>and/or employers.
> 5. (Very important)
>A. Refer to this list periodically for help but making
>   sure to properly phrase you questions.
>B. Try not to rewrite any libraries by first ascertaining
>   whether a library doesn't already exist for the
>   sub-task you are programming.
> 6. Enjoy the new program you have written and the new
>knowledge you have gained.
>
> James

Start out with something simple and go deeper. For example, here is
one progression:

1. A simple program that counts words (wc) - read from a file,
tokenize, count
2. A variation of wc that does word frequency count (counts how many
times each word occurs) - wfc - In addition to 1, this allows you to
use a data structure to store words and search for them to update the
count. You may also sort the output.
3. A variation of wfc that reads from a file a set of noise words and
stores them in memory. As you are tokenizing, drop the noise words
from counting (or count noise words)

You could do similar things with database programming (start with
something simple and gradually increase the level of complexity or any
other area.

You can also access Python cookbook, use the examples as a starting
point and build variations. This not only allows you to read some well
written code but also understand various techniques.

Another suggestion is to get hold of a book "Software Tools" and try
to code all the examples in Python.

I found the best way to learn a language is to read some code, write
some code and keep improving it. Many improvements will suggest
themselves as you keep coding.

Hope this helps.

Dorai
www.thodla.com

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


Re: WebBased Vector 2D Graphics

2007-10-06 Thread Dorai
On Oct 5, 4:28 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>  [EMAIL PROTECTED] wrote:
> > Hi there
>
> > I currently have a Python program outputing to the command line,
> > durations of 'completed Steps' and 'data items' in relation to time
> > i.e.
>
> > --jfh
> >   -kl//kl started after jfh finished
> > % Ds  //new data arrived at this point in time
> > ---pl (1)  //Details error with finsihed Step
> >*kl  // This step is now outputed but
> > due to error with pl is cancelled (no duration)
>
> > I am new to doing any web based development and don't have a clue
> > where to start! I just wondered what is the best way to output this
> > program to a web page graphically.
>
> > I want to be able to represent these durations "-" as rectangles
> > and as the program runs the page will refresh every 10 seconds, thus
> > the boxes will expand with time until they have finished. New data
> > will also be represented in boxes with a different colour. I believe
> > some kind of script will have to be run which constantly updates the
> > html page after x seconds which then causes the web page to refresh
> > with the updated data.
>
> > Is there any way this web programming can be done in python. Or
> > perhaps I can use soemthing such as ajax?
>
> > As mentioned previously, I have never done any web based development
> > so don't really know what I'm talking about when trying to understand
> > how I can go from this Python program output to producing some
> > graphical output on a web page.
>
> You certainly need to get on speed with webdevelopment. Otherwise you will
> fail miserably.
>
> There are several options here:
>
>  - rendering a server-side image, deliver that embedded in a html-page
>
>  - render using html tags like DIV and the like, which allow for positioned
> colored rectangles and text, in pixel coordinates
>
>  - canvas tag, to render 2D-drawing-commands
>
>  - embedded SVG
>
> All that can be enriched with AJAX to have that fancy
> realtime-update-thingy.
>
> Diez

Great ideas.

Another approach would be to generate some simple metadata (simple
text, json or xml) on the server and use a javascript libraries (like
http://www.openjacob.org/draw2d.html). SVG is a more generic version
of this approach.

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