Re: [Tutor] Exercise suggestions

2011-01-22 Thread ian douglas
For me, the quickest way to jump into a programming language was seeing a current open source project and say "I wish it did this too, or that instead ..." and implement it myself. Not only do you learn about the project itself, and pick up some tips and tricks along the way, you then also have

Re: [Tutor] ideas for a simple program

2011-01-25 Thread ian douglas
With an Email address like "hacker0100", your best bet might be to do what we told another user just a few days ago: Find an open-source project, and try to add a new feature to it, or fix a bug in it. That way you learn about the language, the project, and could get your name out there as a c

[Tutor] Having a problem with markdown

2011-01-25 Thread ian douglas
Hey all, I followed a tutorial on creating a very simple wiki in Python, which worked fine until the example where the instructor wanted to render the output through markdown.markdown() Here's the view code: from agwiki.wiki.models import Page from django.shortcuts import render_to_response

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread ian douglas
Thanks Tino, It's certainly not homework, I'm learning Python after being in the Perl/PHP world for well over a decade. Trying to teach this old dog some new tricks. On Jan 26, 2011 6:47 AM, "Tino Dai" wrote: > On Wed, Jan 26, 2011 at 2:46 AM, ian douglas wrote: > >

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread ian douglas
Thanks, Benjamin, I figured it was a version issue, I'm just so new to Python that I didn't know where to look. Sorry for polluting the list with Django questions, I thought it was an underlying Python issue, not the framework. -id On 01/26/2011 10:10 AM, Benjamin Kircher wrote: Hi Ian. W

Re: [Tutor] Accessing a secured webpage

2011-01-28 Thread ian douglas
If it's HTTP basic_auth, you could try this method too: http://username:passw...@domain.com/page.html On 01/28/2011 01:54 PM, Karim wrote: Hello, I want to create a client to access a webpage. But when I access it interactively there is a dialog box which ask for login and password. I wan

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread ian douglas
It bugs me that so many people are quick to jump on the "we wont' do your homework" bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many years but learning Python in my spare time... I sent this reply to Sean pri

Re: [Tutor] remote code execution

2011-02-15 Thread ian douglas
Sounds like it should be possible via SSH, but I have no idea how you'd set that up within Eclipse. On 02/15/2011 10:50 AM, S de Haan wrote: For instance, Im working on my local machine with Eclipse, but using the Interpreter that is on one of my Linux Servers. _

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread ian douglas
I'm new to the language as well, but I think you're missing your indentation after each of your 'if' conditions? On 03/09/2011 10:34 AM, nookasree ponamala wrote: if t< max: maxyr = max< should be indented if t> min:

[Tutor] un-buffered web output

2011-03-25 Thread ian douglas
Hey List, In Perl, I can manipulate a special variable called $| to control buffered output, even on web pages, so I can watch something run (like CGI processes reading files or running system commands) as Perl processes it (pseudo real-time), as opposed to languages like PHP which buffers al

[Tutor] short url processor

2011-05-13 Thread ian douglas
Hey folks, I'm rewriting a short url processor for my job. I had originally written it as a multi-threaded Perl script, which works, but has socket problems causing memory leaks. Since I'm rebuilding it to use memcache, and since I was learning Python outside of work anyway, figured I'd rewrit

Re: [Tutor] short url processor

2011-05-13 Thread ian douglas
On 05/13/2011 05:03 PM, Alan Gauld wrote: How do you know they are going to stdout? Are you sure they aren't going to stderr and stderrr is not mapped to stdout (usually the default). Have you tried redirecting stderr to a file for example? As I say, just some thoughts, Thanks for your though

Re: [Tutor] short url processor

2011-05-13 Thread ian douglas
On 05/13/2011 05:03 PM, Alan Gauld wrote: As I say, just some thoughts, I *am* curious, Alan, whether you or anyone else on the list are able to help me make this a little more efficient: cur.execute("SELECT short_url,long_url FROM short_urls") giant_list = c

[Tutor] BaseHTTPServer, how do catch/trap "broken pipe" errors?

2011-05-19 Thread ian douglas
Hey all, I released my short URL engine last night and it works great. The only problem I'm having now is that it's throwing LOTS of 'broken pipe' errors, which as I understand from looking at raw socket docs in Python, should throw a trappable exception. This might be a little more 'advance

Re: [Tutor] Making a script part of the terminal

2011-05-20 Thread ian douglas
To expand further, some distributions of Linux set a 'bin' path under your home folder as part of your native PATH, even if it doesn't exist. So if your Linux username is, say, "mscott", see if "echo $PATH" already includes something like "/home/mscott/bin" in the path already. If so, simply c

Re: [Tutor] Python Interview Questions..

2011-05-24 Thread ian douglas
To expand on Martin's questions, when I've interviewed in the past, I've asked (or been asked as an interviewee) questions that investigate critical thinking, like those silly-sounding questions of "how many golf balls would fit in a bus" or "how many windows are there in Seattle". Those kinds

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread ian douglas
If I were interviewing for a Perl or PHP position, then yes. However, if I just wanted to see if they knew the algorithm, I'd let them use whatever language they were most comfortable in, provided those of us interviewing also knew the language. I think C++ is more common now for data structur

Re: [Tutor] Clunky Password maker

2011-05-26 Thread ian douglas
On 05/26/2011 02:45 PM, Wolf Halton wrote: Now I am looking at how to make it have an admin function to set the valid characters, and have a way to output the password into main() Simple, just learn to use the 'return' statement: [code] def new_pass(p): pp = int(raw_input("Enter the len

Re: [Tutor] Strategy to read a redirecting html page

2011-05-31 Thread ian douglas
On 05/31/2011 04:34 PM, Hugo Arts wrote: On Wed, Jun 1, 2011 at 1:00 AM, Karim wrote: Hello, I am having issue in reading a html page which is redirected to a new page. I get the first warning/error message page and not the redirection one. Should I request a second time the same url page or

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread ian douglas
Yes, Cloud9 supports running/debugging/testing. They've also got github support for pulling in your projects. It's a pretty clever tool. On 07/21/2011 01:24 PM, Tahir Hafiz wrote: Cloud9 seems interesting as a browser based IDE. Do you know if there is a way to run Python code as well create/e

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread ian douglas
On 07/21/2011 01:46 PM, Corey Richardson wrote: Excerpts from ian douglas's message of Thu Jul 21 16:44:17 -0400 2011: Yes, Cloud9 supports running/debugging/testing. They've also got github support for pulling in your projects. It's a pretty clever tool. Could you share your secret? I didn't

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-30 Thread ian douglas
Try a double backslash replace('\\','/') On Jul 30, 2011 10:30 PM, "Richard D. Moores" wrote: > 64-bit Vista > Python 3.2.1 > > I would like to write a function that would take a path such as > 'C:\Users\Dick\Desktop\Documents\Notes\College Notes.rtf' > and return 'C:/Users/Dick/Desktop/Documents

[Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread ian douglas
I'm using the Bono library for talking to EC2, and I'm getting a list of EC2 instances back in a list called "reservations". Each element in the list is a dictionary of information. One of those dictionary elements is a list called 'instances', and I only ever care about the first entry. That i

[Tutor] time zone conversion

2011-08-01 Thread ian douglas
Hi all, Been trying to wrap my head around some datetime vs time stuff with regards to parsing a string as a date plus time with a timezone offset. This is the string I'm given: 2010-01-22T00:14:33.000Z And I can use time.strptime to parse out its individual elements, but then I need to adj

Re: [Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread ian douglas
On 08/01/2011 01:03 PM, Peter Otten wrote: ian douglas wrote: I'm using the Bono library for talking to EC2, and I'm getting a list of I cannot help you with the django or boto part. Well, I suppose that using django/bono wasn't really relevant to the question. I apprecia

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread ian douglas
On 08/01/2011 03:05 PM, Mike Nickey wrote: Hi all, I'm trying to access and use specific items within a dictionary that is returned but am having issues in doing so. [{'city': 'Sunnyvale', 'region_name': 'CA', 'area_code': 408, 'metro_code': 'Santa Clara, CA', 'country_name': 'United States'}]

Re: [Tutor] Setting Network settings from Python/Djang

2012-01-22 Thread ian douglas
Well DNS would be easy, just modify /etc/resolve.conf ... the other files you need to modify would depend on your distro because they all do something slightly different it seems. On Jan 22, 2012 3:25 AM, "Ganesh Kumar" wrote: > I'm working on a simple web interface for an embedded computer. The

Re: [Tutor] Why do you have to close files?

2012-01-26 Thread ian douglas
On 1/26/12 3:20 PM, amt wrote: Exercise 17, extra credit 6 Learn python the hard way: Find out why you had to do output.close() in the code. Code: output.close() input.close() I don't get it. If you don't close input and output it works exactly the same as if you would close them, so why do

Re: [Tutor] Python with HTML

2012-01-29 Thread ian douglas
If you're hoping for something like PHP that can be parsed inline with html, you're out of luck. It's also bad design to mix business logic with your presentation layer. You might want to look into some frameworks like django to help you along. On Jan 28, 2012 2:04 AM, "t4 techno" wrote: > hi ev

Re: [Tutor] Finding a specific line in a body of text

2012-03-11 Thread ian douglas
Erik Rise gave a good talk today at PyCon about a parsing library he's working on called Parsimonious. You could maybe look into what he's doing there, and see if that helps you any... Follow him on Twitter at @erikrose to see when his session's video is up. His session was named "Parsing Horrible

Re: [Tutor] How to run a small python client-server on Google App Engine

2012-04-19 Thread ian douglas
I suppose you could run something persistent on a reserved instance at Google App Engine, but typically they kill any process running longer than 30 seconds. And the persistent servers aren't free. On Apr 19, 2012 7:36 AM, "Surya K" wrote: > I wrote a small python Client-Server program.. (I use