Re: [Tutor] Really learn programming

2010-03-08 Thread Jeff Johnson

Wayne Werner wrote:
As I was reading my favorite webcomics, Abstruse Goose 
<http://abstrusegoose.com/249> had a link to this interesting site about 
programming in 21 days (or not).


http://norvig.com/21-days.html

I thought it was rather interesting
(and it also recommends Python ;)

enjoy,
-Wayne

I have been programming for at over 30 years in many languages.  When I 
 wanted to learn Python I saw such books.  The problem is that you 
can't learn a language "well" in 21 days; and it's even more difficult 
if you are not already a programmer in some language.  For the novice 
programmers on this list I (me) would expect to become proficient in 
Python in about one year.  Like I said, I have been programming for over 
30 years in RPG, COBOL, Basic, FoxPro mainly.  So keep at it and don't 
expect to be an expert in 21 days.  Having said that, the 21 day 
tutorials have great merit and can help you.


YMMV

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sorting algorithm

2010-03-11 Thread Jeff Johnson
er slow.  Since you're exchanging two items in the list, you can 
simply do that:

list[pos1], list[pos2] = list[pos2], list[pos1]

That also eliminates the need for the second try/except.

You mention being bothered by the while loop.  You could replace it 
with a simple for loop with xrange(len(list_)), since you know that 
N passes will always be enough.  But if the list is partially 
sorted, your present scheme will end sooner.  And if it's fully 
sorted, it'll only take one pass over the data.


There are many refinements you could do.  For example, you don't 
have to stop the inner loop after the first swap.  You could finish 
the buffer, swapping any other pairs that are out of order.  You'd 
then be saving a flag indicating if you did any swaps.  You could 
keep a index pointing to the last pair you swapped on the previous 
pass, and use that for a limit next time.  Then you just terminate 
the outer loop when that limit value is 1.  You could even keep two 
limit values, and bubble back and forth between them, as they 
gradually close into the median of the list.  You quit when they 
collide in the middle.


The resultant function should be much faster for medium-sized lists, 
but it still will slow down quadratically as the list size 
increases.  You still need to divide and conquer, and quicksort is 
just one way of doing that.


DaveA


Thanks a lot Dave,

Sorry the original thread is called 'Python and algorithms'.

Yes, I think it's best to use what python provides and build on top 
of that. I got to asking my original question based on trying to 
learn more about algorithms in general, through python. Of late many 
people have been asking me how well I can 'build' algorithms, and 
this prompted me to start the thread. This is for learning purposes 
(which the original thread will give you and indication where I'm 
coming from).


The refactored code looks like this. I have tackled a couple items. 
First the sub-listing (which I'll wait till I can get the full sort 
working), then the last couple of paragraphs about refinements. 
Starting with the first refinement, I'm not sure how *not* to stop 
the inner loop?


def s2(list_):
   for pos1 in xrange(len(list_)-1):
   item1 = list_[pos1]
   pos2 = pos1 + 1
   item2 = list_[pos2]
   if item1 >= item2:
   list_[pos1], list_[pos2] = list_[pos2], list_[pos1]
   return True

def mysorter(list_):
   # This is the outer loop?
   while s2(list_) is True:
   # Calling s2 kicks off the inner loop?
   s2(list_)

if __name__ == '__main__':
   from random import shuffle
   foo = range(10)
   shuffle(foo)
   mysorter(foo)


Thanks again.

As before, I'm not actually trying this code, so there may be typos.  
But assuming your code here works, the next refinement would be:


In s2() function, add a flag variable, initially False.  Then instead 
of the return True, just say flag=True

Then at the end of the function, return flag

About the while loop.  No need to say 'is True'  just use while 
s2(list_):  And no need to call s2() a second time.


while s2(list_):
pass

Okay up to here I follow. This all makes sense.

def s2(list_):
flag = False
for pos1 in xrange(len(list_)-1):
item1 = list_[pos1]
pos2 = pos1 + 1
item2 = list_[pos2]
if item1 >= item2:
list_[pos1], list_[pos2] = list_[pos2], list_[pos1]
flag = True   
return flag


def mysorter(list_):
while s2(list_):
pass


Before you can refine the upper limit, you need a way to preserve it 
between calls.  Simplest way to do that is to combine the two 
functions, as a nested loop.  Then, instead of flag, you can have a 
value "limit" which indicates what index was last swapped.  And the 
inner loop uses that as an upper limit on its xrange.
Where I start to get confused is refining the 'upper limit'. What is the 
upper limit defining? I'm guessing it is the last position processed.


T


DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



Take out the = in the following line
 if item1 >= item2:
and it will sort like items together, which I think is what you 
originally wanted.


Also change:
> return flag
to:
>return flag
So that False gets returned if you don't make a swap.

This worked for me.  Thank you for the interesting thread!

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sorting algorithm

2010-03-12 Thread Jeff Johnson

Steven D'Aprano wrote:


In future, could you please trim your quoting to be a little less 
excessive? There's no need to included the ENTIRE history of the thread 
in every post. That was about four pages of quoting to add five short 
sentences!



Thank you.


Will do.  I usually do just didn't on that thread.

Thanks,

--
Jeff

Jeff Johnson
j...@dcsoftware.com

http://www.VetsFindingVets.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] conventions for establishing and saving default values for variables

2010-06-15 Thread Jeff Johnson

Steven D'Aprano wrote:

On Tue, 15 Jun 2010 10:27:43 pm Pete O'Connell wrote:
  

Hi I was wondering if anyone could give me some insight as to the
best way to get and save variables from a user the first time a
script is opened. For example if the script prompts something like
"What is the path to the folder?" and the result is held in a
variable called thePath, what is the best way to have that variable
saved for all subsequent uses of the script by the same user.



Others have already mentioned ConfigParser. You should also check out 
plistlib, in the standard library since version 2.6.


Other alternatives include pickle, XML, JSON or YAML (although since 
YAML is not part of the standard library, you will need to download a 
package for it). On Windows you can write to the registry, although 
since I'm not a Windows user I don't know how. Or if your config is 
simple enough, you can just write your data to the file manually. But 
honestly, you can't get much simpler than ConfigParser or plistlib.




  
On Windows I create an ".ini" file in the user profile instead of the 
registry. Windows API has GetPrivateProfileString and 
WritePrivateProfileString. On Linux I use ConfigParser to read and write 
to an ".ini" file in the home directory.


I have avoided the Windows registry completely. Obviously you could use 
ConfigParser on Windows because of Python.


--
Jeff

---

Jeff Johnson
j...@dcsoftware.com



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] conventions for establishing and saving default values for variables

2010-06-16 Thread Jeff Johnson

Pete O'Connell wrote:
Hi I was wondering if anyone could give me some insight as to the best 
way to get and save variables from a user the first time a script is 
opened. For example if the script prompts something like "What is the 
path to the folder?" and the result is held in a variable called 
thePath, what is the best way to have that variable saved for all 
subsequent uses of the script by the same user.

Pete


  


I will send you my python script that reads and writes to a windows 
style .ini file if you want me to.



--
Jeff

-------

Jeff Johnson
j...@dcsoftware.com



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-02 Thread Jeff Johnson
On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question 
because I want, for my own satisfaction, to rewrite one of my Access dbs 
(one that does our finances) into a stand-alone Python database program 
using SQLite.  I know I'll be learning as I go, but that'll work, I'm 
not in a big hurry and I'll work on it in my spare time.  Right now I'm 
trying to get organized and get a game plan, and that's where I need help.


I have been developing database applications for 20 years using FoxPro 
and VFP.  Now I am developing using Dabo.  Dabo is a framework wrapper 
for wxPython written totally in Python.  I use SQLite for small 
applications and PostgreSQL for larger ones.  Dabo was written by two of 
the top FoxPro developers and is supported by many others all over the 
world.


http://dabodev.com/

Please check it out.  And go to www.leafe.com and subscribe to the 
dabo-user email list.


--

Jeff

---

Jeff Johnson
j...@dcsoftware.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-02 Thread Jeff Johnson

On 07/02/2010 05:35 PM, Chris C. wrote:


Hi Jeff, thank for your reply!  I'm aware of Dabo and was pretty much 
sold on using it until the last couple of days.  I was trying to 
install it so I could start connecting to my tables when I ran into a 
problem with the instructions for installing ReportLab.  I wrote to 
the mailing list Wednesday but haven't heard from anyone.  Being such 
a  beginner and knowing I'll be needing help, it kind of has me wary 
of committing to Dabo when I'm having this trouble getting help before 
I even get started.  I saw your post to the Dabo mailing list with the 
title "Reference to bizjob control" has been getting responses.  Can 
you confirm whether my question went out to the list recipients?  Did 
you receive it?


Like I was saying, I wanted to use Dabo, but I submitted this question 
to this board because I was beginning to lose faith in being able to 
get help from the Dabo mailing list.


Thanks again,

Chris C.

*From:* Jeff Johnson [mailto:j...@dcsoftware.com]
*Sent:* Friday, July 02, 2010 2:09 PM
*To:* Chris C.
*Subject:* Re: [Tutor] Help with choices for new database program

On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question 
because I want, for my own satisfaction, to rewrite one of my Access 
dbs (one that does our finances) into a stand-alone Python database 
program using SQLite.  I know I'll be learning as I go, but that'll 
work, I'm not in a big hurry and I'll work on it in my spare time.  
Right now I'm trying to get organized and get a game plan, and that's 
where I need help.


I have been developing database applications for 20 years using FoxPro 
and VFP.  Now I am developing using Dabo.  Dabo is a framework wrapper 
for wxPython written totally in Python.  I use SQLite for small 
applications and PostgreSQL for larger ones.  Dabo was written by two 
of the top FoxPro developers and is supported by many others all over 
the world.


http://dabodev.com/

Please check it out.  And go to www.leafe.com <http://www.leafe.com> 
and subscribe to the dabo-user email list.


--

Jeff
  
---
  
Jeff Johnson

j...@dcsoftware.com  <mailto:j...@dcsoftware.com>
  


Chris:  The folks on the Dabo list are always available for answers.  Ed 
and Paul (Dabo's developers) are always quick to answer questions and I 
guarantee they respond quicker than most lists.  There are many others 
that develop commercial applications with Dabo that are always 
monitoring the list (just like me only more experienced with Dabo and 
Python).  If you are interested please subscribe to the list:


http://www.leafe.com/mailman/listinfo/dabo-users

I did not see your post on the list so no one else did either.  If you 
developed an app using Access than you are a perfect candidate for Dabo 
and you have at least enough understanding of what is going on to use it.


There are four things that need installing in order to use Dabo.  It may 
not go as smooth as a Windows Installshield application, but you can get 
plenty of help and once it is installed you can follow the great screen 
casts and tutorials.  The users of Dabo are developing applications for 
users.  Once you have your application developed there are ways to 
package it based on your platform.


You need Python, wxPython, Dabo, and Report Lab.  You can install PIL if 
you want to manipulate images.  If you need help, just ask!


Many of the people using Dabo are moving over from Visual FoxPro which 
is very similar to Access, so don't be afraid to ask any question.  If 
you ask a question the question and answer will be saved in the archives 
for others to learn.


Come on in, the water is fine!

--
Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com


--
Jeff

---

Jeff Johnson
j...@dcsoftware.com



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-02 Thread Jeff Johnson

On 07/02/2010 06:14 PM, David Hutto wrote:


Stick to the main python libraries(python with sqllite, and for the
standalone exe know it's somewhere, and I've seen it in the past few
days, but didn't pay attention because it wasn't important to what I
was doing at the time) going anywhere else is the beginning of an ADHD
nightmare. It's like being a hypochondriac with an unlimited
healthcare plan, you'll want to see any option except for the obvious
in front of you.

Try not to get distracted by the shiny things unless necessary.


I'm not sure how this helps with Chris's application.  I will agree that 
the number of choices is daunting!  The nice thing about Dabo is the 
group is focused on database applications.  Kind of like Django is 
focused on web devopment.


I mean this in a joking way:  If you find that Python and open source 
creates too many decisions then you can consider Microsoft .NET and 
Microsoft SQL Server on Windows 7.


I am a recovering Microsoft developer of over 20 years.  ;^)

BTW learning Python is awesome!

--
Jeff

---

Jeff Johnson
j...@dcsoftware.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-02 Thread Jeff Johnson

On 07/02/2010 06:51 PM, David Hutto wrote:

In the end, there might be so many packages, I might not be able to
handle it all(for my own uses). But, I would think, you would agree
that a simple account balance app, would be no more than tkinter with
a few functions to write and retrieve data from a sqlite db. To quote
Sherlock, 'Sometimes, after eliminating the impossible, what ever is
left, no matter how improbable, must be the solution.', or something
like that.



David:  I like your quote!  I am a huge Sherlock Holmes fan.  I like 
Dabo because I develop commercial applications.


--
Jeff

-------

Jeff Johnson
j...@dcsoftware.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-03 Thread Jeff Johnson

On 07/02/2010 05:35 PM, Chris C. wrote:


Hi Jeff, thank for your reply!  I'm aware of Dabo and was pretty much 
sold on using it until the last couple of days.  I was trying to 
install it so I could start connecting to my tables when I ran into a 
problem with the instructions for installing ReportLab.  I wrote to 
the mailing list Wednesday but haven't heard from anyone.  Being such 
a  beginner and knowing I'll be needing help, it kind of has me wary 
of committing to Dabo when I'm having this trouble getting help before 
I even get started.  I saw your post to the Dabo mailing list with the 
title "Reference to bizjob control" has been getting responses.  Can 
you confirm whether my question went out to the list recipients?  Did 
you receive it?


Like I was saying, I wanted to use Dabo, but I submitted this question 
to this board because I was beginning to lose faith in being able to 
get help from the Dabo mailing list.


Thanks again,

Chris C.

*From:* Jeff Johnson [mailto:j...@dcsoftware.com]
*Sent:* Friday, July 02, 2010 2:09 PM
*To:* Chris C.
*Subject:* Re: [Tutor] Help with choices for new database program

On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question 
because I want, for my own satisfaction, to rewrite one of my Access 
dbs (one that does our finances) into a stand-alone Python database 
program using SQLite.  I know I'll be learning as I go, but that'll 
work, I'm not in a big hurry and I'll work on it in my spare time.  
Right now I'm trying to get organized and get a game plan, and that's 
where I need help.


I have been developing database applications for 20 years using FoxPro 
and VFP.  Now I am developing using Dabo.  Dabo is a framework wrapper 
for wxPython written totally in Python.  I use SQLite for small 
applications and PostgreSQL for larger ones.  Dabo was written by two 
of the top FoxPro developers and is supported by many others all over 
the world.


http://dabodev.com/

Please check it out.  And go to www.leafe.com <http://www.leafe.com> 
and subscribe to the dabo-user email list.


--

Jeff
  
---
  
Jeff Johnson

j...@dcsoftware.com  <mailto:j...@dcsoftware.com>
  


Chris:  The folks on the Dabo list are always available for answers.  Ed 
and Paul (Dabo's developers) are always quick to answer questions and I 
guarantee they respond quicker than most lists.  There are many others 
that develop commercial applications with Dabo that are always 
monitoring the list (just like me only more experienced with Dabo and 
Python).  If you are interested please subscribe to the list:


http://www.leafe.com/mailman/listinfo/dabo-users

I did not see your post on the list so no one else did either.  If you 
developed an app using Access than you are a perfect candidate for Dabo 
and you have at least enough understanding of what is going on to use it.


There are four things that need installing in order to use Dabo.  It may 
not go as smooth as a Windows Installshield application, but you can get 
plenty of help and once it is installed you can follow the great screen 
casts and tutorials.  The users of Dabo are developing applications for 
users.  Once you have your application developed there are ways to 
package it based on your platform.


You need Python, wxPython, Dabo, and Report Lab.  You can install PIL if 
you want to manipulate images.  If you need help, just ask!


Many of the people using Dabo are moving over from Visual FoxPro which 
is very similar to Access, so don't be afraid to ask any question.  If 
you ask a question the question and answer will be saved in the archives 
for others to learn.


Come on in, the water is fine!

--
Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-03 Thread Jeff Johnson

On 07/02/2010 06:14 PM, David Hutto wrote:


Stick to the main python libraries(python with sqllite, and for the
standalone exe know it's somewhere, and I've seen it in the past few
days, but didn't pay attention because it wasn't important to what I
was doing at the time) going anywhere else is the beginning of an ADHD
nightmare. It's like being a hypochondriac with an unlimited
healthcare plan, you'll want to see any option except for the obvious
in front of you.

Try not to get distracted by the shiny things unless necessary.
   

I'm not sure how this helps with Chris's application.  I will agree that 
the number of choices is daunting!  The nice thing about Dabo is the 
group is focused on database applications.  Kind of like Django is 
focused on web devopment.


I mean this in a joking way:  If you find that Python and open source 
creates too many decisions then you can consider Microsoft .NET and 
Microsoft SQL Server on Windows 7.


I am a recovering Microsoft developer of over 20 years.  ;^)

BTW learning Python is awesome!

--

Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-03 Thread Jeff Johnson

On 07/02/2010 06:32 PM, David Hutto wrote:

On Fri, Jul 2, 2010 at 9:31 PM, David Hutto  wrote:
   


Well, it was mainly that he said he was a beginner and was only using
this for a single banking project, I do believe.

Not that learning a new package would

wouldn't


  be helpful, I like
   

experimenting, and failing/succeeding, but if this is all he needs to
accomplish, then not using more than is necessary would be beneficial.
A simple script, with simple sqlite fields to maintain.

 


David:  Experimenting, failing and succeeding is the life of a 
programmer.  I have been programming for many years in assemply, 
FORTRAN, COBOL, Basic, RPG, FoxPro, C, but I am now totally committed to 
Python.  It is the best of all worlds.  Coming from the Microsoft side, 
open source and Python creates a whole new set of problems.  Do I use 
Windows?  Do I use Linux?  Do I use my Mac Book Pro?  You do have to 
make some decisions before moving on.  The choices are endless.


I have found Dabo and Django to be beneficial for me because they target 
what I want to do.


Your mileage may vary.  ;^)

--
Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-03 Thread Jeff Johnson

On 07/02/2010 06:51 PM, David Hutto wrote:

In the end, there might be so many packages, I might not be able to
handle it all(for my own uses). But, I would think, you would agree
that a simple account balance app, would be no more than tkinter with
a few functions to write and retrieve data from a sqlite db. To quote
Sherlock, 'Sometimes, after eliminating the impossible, what ever is
left, no matter how improbable, must be the solution.', or something
like that.
   


David:  I like your quote!  I am a huge Sherlock Holmes fan.  I like 
Dabo because I develop commercial applications.


--
Jeff

-------

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-03 Thread Jeff Johnson

On 07/02/2010 08:19 PM, bob gailer wrote:

On 7/2/2010 5:56 PM, Jeff Johnson wrote:

[snip]



Visual FoxPro ... is very similar to Access

I differ. Access and FoxPro are very different. Yes they both use 
tables, relationships, indexes and SQL. Yes they both have visual 
designers for forms and reports. Yes they both are programmable.


But the differences are much more dramatic than the commonalities. I 
have developed in both. I find it painful to work in one while 
desiring a feature that exists only in the other.


--
Bob Gailer
919-636-4239
Chapel Hill NC

   

Dare you say which?   ;^)


--
Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with choices for new database program

2010-07-04 Thread Jeff Johnson

On 07/03/2010 08:25 AM, Jim Byrnes wrote:

Jeff Johnson wrote:

On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question
because I want, for my own satisfaction, to rewrite one of my Access dbs
(one that does our finances) into a stand-alone Python database program
using SQLite. I know I'll be learning as I go, but that'll work, I'm not
in a big hurry and I'll work on it in my spare time. Right now I'm
trying to get organized and get a game plan, and that's where I need 
help.


I have been developing database applications for 20 years using FoxPro
and VFP. Now I am developing using Dabo. Dabo is a framework wrapper for
wxPython written totally in Python. I use SQLite for small applications
and PostgreSQL for larger ones. Dabo was written by two of the top
FoxPro developers and is supported by many others all over the world.

http://dabodev.com/

Please check it out. And go to www.leafe.com and subscribe to the
dabo-user email list.



I would like to try out Dabo, but I don't see it in the Ubuntu 
repositories and I would like to avoid using svn if I can.  I didn't 
subscribe to the mailing list but I did read the archives and saw a 
thread about making a deb package.  It seems to have ended in April 
without a clear resolution.


So is there a package available so I can use the Ubuntu package 
manager to install it?


Thanks,  Jim

I use Ubuntu 10.04 and Windows XP.  The developers of Dabo use Mac and 
Ubuntu.  Dabo runs without modification on all three major platforms.  
It is a given that while Ubuntu is awesome at supplying packages, there 
might be some that you have to go get.


That's all I can say about that.

--
Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Django Read

2010-07-08 Thread Jeff Johnson

On 07/08/2010 06:06 AM, Nick Raptis wrote:
There actually aren't that many books on django around yet which is a 
pity.
You should definitely read "The django book": 
http://www.djangobook.com/en/2.0/
either on the online version on that link, or it's printed counterpart 
(yes, it's really the same book): 
http://www.amazon.com/Definitive-Guide-Django-Development-Second/dp/143021936X/ 



The printed one is a bit more updated (1.1) and pays off it's money 
because of it's great reference section :)


Nick

On 07/08/2010 03:48 PM, Dipo Elegbede wrote:

Hi all,

I have done a little basic on python and have to start working on a
major django platform.
I'm starting new and would like recommendations on books I can read.

Kindly help me out. I want to get my hands dirty as fast as I can so
that I can be part of the project.

Thanks and Best regards,



I have six books on my bookshelf for Django.  There are others I don't 
have.  Django 1.0 Template Development is my favorite.  Many of them 
walk you through building apps step by step.  Do a search on Amazon.  
That is where I got most of them.


--
Jeff

---

Jeff Johnson
j...@dcsoftware.com



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Paython as a career

2009-03-17 Thread Jeff Johnson

Lukes answer is an excellent one!  I would add that you can find
language popularity here:

http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

I am moving to Python from Visual FoxPro.  I have been programming all
of my adult career.  I have used Cobol, RPG, Basic, FoxPro and Python
all in production to make my living.  I have been using FoxPro for 16
years and really love it, but find Python the most complete language.
You don't need active X or third party libraries because they are all
there and written Python.

My success as a programmer has little to do with the language or even
how well I program.  It has more to do with my ability to understand the
problem and communicate with customers or my employer.

Good luck

Hussain Ali wrote:

Dear all

I want to start learning python but before going further I need answer 
to my
questions so that my path can be clear to me. I shall be grateful for 
your answers:


1) Where does python stand as compared to other programming languages?
2) What is the future for python?
3) Will it survive for long in this rapidly changing trends and new 
languages?
4) Should I start it to earn my bread and butter? I mean is that 
beneficial for income.
 
 
Sincerely
 
Hussain




--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Personal: Fwd: Re: Paython as a career

2009-03-17 Thread Jeff Johnson
Malcolm:  I have four sticky XML / flat files downloaded from a web site 
that is converted into four text files and then synchronized into one 
file.  Due to the web interface I moved it from VFP to Python.  It was 
easier, cleaner and very fast.  I run it from the VFP RUN command.


I have been using VFP / Foxpro since 1992.  I have an app that is 
running fine for a long time and then something seems to go wrong. 
Maybe it's an upgrade of the OS or a Microsoft update or who knows what. 
 I have to deal with it and rehash old code that was working fine.  I 
have noticed that Python "just works".  I have seen it already with this 
first project.


Oh, I download all of my bank accounts and credit cards as .csv files. 
I then use Python to convert them to Quickbooks IIF files and import 
them into Quickbooks.  No data entry because of Python!


I am now developing a dabo app that has a UI.  I should have it done 
soon and will let you know more about it on the dabo list.


For me, Python is a lot like VFP only you don't need to bring in active 
X or third party libraries.  I also have two Ubuntu machines that I can 
run it all on.


As far as Dabo goes, check it out.  The video of the report designer 
will get you hooked.  I just wish I had more time.


Malcolm Greene wrote:

Hi Jeff,


My success as a programmer has little to do with the language or even

how well I program.  It has more to do with my ability to understand the
problem and communicate with customers or my employer.

Great response!

I'm really enjoying my move to Python. Not only the language, but the
optimism that surrounds the language (vs. the gray cloud of depression
that has haunted FoxPro for so many years). I've focused all my Python
efforts on back room data processing (ETL) vs. GUI type applications. In
fact, I haven't moved any of our GUI based products to Python (or Dabo).

What are you doing with Python? Have you built any GUI apps yet and if
so, using wxPython (and Dabo?), pyQt, Tkinter, etc?

Do you have any Dabo based apps in production yet?

Curious to hear about your FoxPro migration journey when you have a
moment.

Regards,

Malcolm (from the Profox list)



--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python interpreter vs bat file

2009-07-18 Thread Jeff Johnson
Need more information.  Python works on Windows as good as anything 
else.  Maybe even better.


Dinesh B Vadhia wrote:
During recent program testing, I ran a few Python programs from a 
Windows XP batch file which causes a memory error for one of the 
programs.  If I run the same set of programs from the Python interpreter 
no memory error occurs.  Any idea why this might be?
 
Dinesh


Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vista UAC

2009-09-10 Thread Jeff Johnson

Dj Gilcrease wrote:

I have a python app that requires elevated privileges on Vista when
installed in "Program Files" since it has an auto updater. I was
wondering if there was a way with a standard install of python 2.6
that I can check if I have the correct privileges and if not relaunch
the app required privileges.


Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
I have an application that uses something that auto updates but it may 
not be the same process as yours.  I have a "stub" executable that 
checks a network location for a different copy of the "real" executable. 
 If one exists, it copies the exe to the application folder and 
executes it.  My solution for Vista - which works very well - is to put 
my application in a folder C:\users\public\applications\myapplication.


This way there is no need for raised privileges.

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vista UAC

2009-09-11 Thread Jeff Johnson

Lie Ryan wrote:

Jeff Johnson wrote:
I have an application that uses something that auto updates but it may 
not be the same process as yours.  I have a "stub" executable that 
checks a network location for a different copy of the "real" 
executable.  If one exists, it copies the exe to the application 
folder and executes it.  My solution for Vista - which works very well 
- is to put my application in a folder 
C:\users\public\applications\myapplication.


This way there is no need for raised privileges.



The only problem with installing in public folder that is it allows 
non-privileged (read: any) user to modify the program; which might be 
unwanted for some apps.


My programs are exe's and not editable.

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ODBC SQL Server Question

2009-09-18 Thread Jeff Johnson

Kristina:

I would format it as follows:

self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME = '%s'" % name)


Kristina Ambert wrote:

Hi,
Is anyone familiar with this error:
dbi.internal-error: [Microsoft][SQL Server Driver]Invalid cursor state 
in EXEC
This error is triggered by the first sql statement call in an accessor 
module which purpose is only to get data from a source module and feed 
it into a database:


self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME= ?", (name))
I can't figure out what's causing it. I searched for the invalid cursor 
state error online but most of it occurs on the fetchall statement not 
the execute statement.


Any ideas?
Thanks!


--
Cheers,
Krissy
---
Testing the waters is always fun...

--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ODBC SQL Server Question

2009-09-18 Thread Jeff Johnson

Kent:

How about this:
self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME = '%s'" % 
(name, ))


Question, does execute know to substitute the question mark with name?
self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME= ?", (name, ))

TIA

Kent Johnson wrote:

On Fri, Sep 18, 2009 at 11:49 AM, Jeff Johnson  wrote:

Kristina:

I would format it as follows:

self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME = '%s'" % name)


No, that is a recipe for SQL injection attacks such as this:
http://xkcd.com/327/


self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME= ?", (name))


I think that should have a comma to create a tuple:
self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME= ?", (name,))

I don't know if that could cause your problem.
Kent


--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ODBC SQL Server Question

2009-09-18 Thread Jeff Johnson

Thanks for the clarification Kent!

Kent Johnson wrote:

On Fri, Sep 18, 2009 at 2:14 PM, Jeff Johnson  wrote:

Kent:

How about this:
self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME = '%s'" % (name,
))


No, that has the same result as your original. For example,
In [3]: name = "Kent'; drop table Stories;--"

In [4]: "SELECT CUSTID FROM Stories WHERE NAME = '%s'" % (name, )
Out[4]: "SELECT CUSTID FROM Stories WHERE NAME = 'Kent'; drop table Stories;--'"

Oops.


Question, does execute know to substitute the question mark with name?
self.cursor.execute("SELECT CUSTID FROM Stories WHERE NAME= ?", (name, ))


Yes, and it will correctly quote name according to the conventions of
the database in use. (Note that not all DB-API implementations use ?
as the placeholder; check the docs for the db you are using.)

Kent


--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What language should I learn after Python?

2009-10-07 Thread Jeff Johnson

Marc Tompkins wrote:
On Tue, Oct 6, 2009 at 12:39 PM, Mark Young <mailto:marky1...@gmail.com>> wrote:


I'm now fairly familiar with Python, so I'm thinking about starting
to learn a second programming language. The problem is, I don't know
which to learn. I want a language that will be good for me to
learn, but is not so different from python that I will be totally
confused.


May I suggest (some dialect of) SQL?  It _is_ quite different from 
Python, but learning it will familiarise you with some concepts that 
will be very useful if you want to use your Python skillz in a 
data-driven application.  It's true that you can use Python modules to 
interface with databases, and maybe never write more than a line or two 
of real SQL - but those modules are a lot easier to understand if you 
know what they're doing under the hood.


--
www.fsrtechnologies.com <http://www.fsrtechnologies.com>


I like this suggestion.  A language is fairly useless without some work 
to do and for me personally, all of my applications access databases.  I 
have been programming since 1970 and I have used many languages in my 
work.  After you learn a few you notice the similarities and can pick up 
a new language quicker.  Most of the languages suggested use SQL in some 
form or fashion.  So I would recommend installing PostgreSQL and 
learning to work with it using the Python you already know.  I recommend 
PostgreSQL because of the cost (free), licensing, and ease of use.


One other thing that is important to me is packaging an application for 
distribution and updating existing applications.  That "language" would 
be Inno Setup.


HTH

FWIW, Python is my favorite language to use for too many reasons to list 
here!


--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Beginners question

2009-10-08 Thread Jeff Johnson

gary littwin wrote:


Hi all -

Just started on "Python Programming for Absolute Beginners" and I've got 
a question:


The program called 'Guess my Number' goes like this:
# Guess My Number
#
# The computer picks a random number between 1 and 100
# The player tries to guess it and the computer lets
# the player know if the guess is too high, too low
# or right on the money

#import random

print "\tWelcome to 'Guess My Number'!"
print "\nI'm thinking of a number between 1 and 15."
print "Try to guess it in as few attempts as possible.\n"

import random


# set the initial values
the_number = random.randrange(15) + 1
guess = int(raw_input("Take a guess: "))
tries = 1

# guessing loop
while (guess != the_number):
   if (guess > the_number):
   print "Lower..."
   else:
   print "Higher..."

guess = int(raw_input("Take a guess: "))
tries += 1

print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"

raw_input("\n\nPress the enter key to exit.")

So here's the question - the original code has parentheses around the 
lines of code with *(guess !=the_number)* and *(guess* *> the_number)* . 
 I tried to run the program without the parentheses and it runs just 
fine.  So what are the parentheses for??


Thanks a lot for your time - 


 Gary

The parentheses in this procedure are not required but don't do any 
harm.  I often use extra parentheses to clarify what I am doing so it is 
more readable when going back to look at it a couple of years later. 
Especially in long calculations or SQL with lots of ands and ors.


--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What books do you recommend?

2009-12-11 Thread Jeff Johnson

Becky Mcquilling wrote:
Thanks, Alan.  It is fun and on many levels I welcome the challenge.  

I won't continue to divert this thread from good books, but I will 
continue to look for more and more tutorials and will post it  The more 
the more merrier...


Becky 


I read through all the posts to make sure someone didn't already 
recommend this, but The Python Phrasebook is a great one.  It has 
working code for a whole bunch of things like sending emails and reading 
websites just to name two.  You can type them in and run them.  It 
allowed me to quickly learn and appreciate Python.


http://www.amazon.com/Python-Phrasebook-Brad-Dayley/dp/0672329107

I am not suggesting Amazon, it was just the first link I found.  I see 
it in bookstores like Borders.


--
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] 200 dollar questions!

2007-06-30 Thread Jeff Johnson

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Which GUI?

2007-08-02 Thread Jeff Johnson
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of scott
> Sent: Friday, July 27, 2007 2:29 PM
> To: tutor@python.org
> Subject: [Tutor] Which GUI?
> 
> Hi,
> 
>   now that I have a very basic understanding of Python I would like to
> take a look at programming in a GUI.  Which GUI is generally the easiest
> to learn?
> 
> --
> Your friend,
> Scott
> 

I am using Dabo.  -- http://dabodev.com and for a mailing list:
http://leafe.com/mailman/listinfo/dabo-users

It is basically a wxpython wrapper with a whole lot more.

Jeff

Jeff Johnson
[EMAIL PROTECTED]
623-582-0323
Fax 623-869-0675


smime.p7s
Description: S/MIME cryptographic signature
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Ingenious script (IMO)

2007-08-11 Thread Jeff Johnson
I wish I had a better way to represent "pennies" vs. "penny" but it works.
This was a nice challenge to help me learn python.  Thanks and keep them
coming!

My contribution:

cents = 100

cost = int(round(cents * float(raw_input("Enter the cost: "
tendered = int(round(cents * float(raw_input("Enter the amount tendered:
"

change = tendered - cost

denominations = [2000, 1000, 500, 100, 50, 25, 10, 5, 1]
money = ['$20.00', '$10.00', '$5.00', '$1.00', 'Fifty Cent Piece',
'Quarter', 'Dime', 'Nickel', 'Penny']
moneys = ['$20.00', '$10.00', '$5.00', '$1.00', 'Fifty Cent Pieces',
'Quarters', 'Dimes', 'Nickels', 'Pennies']

givetocustomer = [0, 0, 0, 0, 0, 0, 0, 0, 0]

lnlen = len(denominations)

lni = 0
while lni <= lnlen - 1:
  # floor division yields no decimals and no rounding
  givetocustomer[lni] = change // denominations[lni]
  # modulus returns remainder
  change = change % denominations[lni]
  if givetocustomer[lni] > 0:
if givetocustomer[lni] > 1:
  print str(givetocustomer[lni]) + ' ' + moneys[lni]
else:
  print str(givetocustomer[lni]) + ' ' + money[lni]
  lni += 1

Jeff

Jeff Johnson
[EMAIL PROTECTED]
623-582-0323
Fax 623-869-0675

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Dick Moores
> Sent: Monday, August 06, 2007 6:12 AM
> To: Python Tutor List
> Subject: [Tutor] Ingenious script (IMO)
> 
> Google Answers folded, but Google has kept the archive accessible. I
> found this Python script at
> <http://answers.google.com/answers/threadview?id=756160>
> 
> and modified it for U.S. money denominations:
> 
> http://www.rcblue.com/Python/changeMaker_revised_for_US_denominations.py
> 
> I'm still working at Python--been at it a while--and thought the
> script was ingenious. Do the Tutors agree? Or is it just
> run-of-the-mill programming? Could it have been more simply written?
> 
> Thanks,
> 
> Dick Moores
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.476 / Virus Database: 269.11.6/938 - Release Date: 8/5/2007
> 4:16 PM
> 


smime.p7s
Description: S/MIME cryptographic signature
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [SPAM] A fun puzzle

2007-08-22 Thread Jeff Johnson
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of R. Alan Monroe
> Sent: Wednesday, August 22, 2007 5:41 PM
> To: Python Tutorlist
> Subject: [SPAM] [Tutor] A fun puzzle
> Importance: Low
> 
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
> 
> http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-
> _2D00_-What-numbers-under-one-million-are-divisible-by-their-
> reverse_3F00_.aspx
> 
> 
> Alan
> 

Here's mine and it does in fact yield the same six numbers!  Since I am
learning Python, these challenges are important to me.  I really appreciate
people posting "problems" that we can solve.  I enjoy the solutions even
more.  

def reverse(n):
rev = 0
while n > 0:
   rev = (rev * 10) + (n % 10)
   n = n / 10
return rev


def main():
   for i in range(1, 100):
   j = reverse(i)
   if (i <> j) and (i % 10 <> 0) and (i % j == 0):
   print str(i)

main()

Jeff Johnson
[EMAIL PROTECTED]
623-582-0323
Fax 623-869-0675

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.484 / Virus Database: 269.12.1/965 - Release Date: 8/21/2007
4:02 PM
 


smime.p7s
Description: S/MIME cryptographic signature
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Magazine

2007-10-05 Thread Jeff Johnson
I've just been told by the editors at Python Magazine that the first
issue is out. It's all-electronic so anyone can download and read it.
Let them know what you think:

 http://www.pythonmagazine.com/c/issue/2007/10

You can also subscribe for print + online.

-- 
Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-06 Thread Jeff Johnson
As far as I am concerned this may be a commercial advertisement, but is 
it a book on Python to help people learn Python.  I get all of my 
information from books and then turn to the lists (Tutor being one) to 
get my questions asked or what I have learned clarified.  I have a 
difficult time reading on line and prefer books.

So I for one appreciate the post.

Thank you,

Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675

Rikard Bosnjakovic wrote:
> On 06/11/2007, Michael H. Goldwasser <[EMAIL PROTECTED]> wrote:
> 
>>We are pleased to announce the release of a new Python book.
> 
> [...yadayada...]
> 
> I thought this list was supposed to be clean from commercial advertisements.
> 
> 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-06 Thread Jeff Johnson
I have been developing software for over 25 years in various languages. 
  I am new to Python because for me it is the very best fit for my 
business going forward.  People ask me how do I keep up with the 
industry - probably the fastest moving industry there is.  Books, email 
lists and conferences is how I keep up.  I make a good living writing 
software and books and conferences are my education.

I can certainly sympathize with you if you are new to the programming 
world or can't afford books or conferences.  I was in that situation for 
many years.  There are tons of affordable or free resources for Python.

I went to Amazon and ordered the book right away.

Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675

Eric Lake wrote:
> For that price the book better write my code for me.
> 
> Alex Ezell wrote:
>> On 11/6/07, Chris Calloway <[EMAIL PROTECTED]> wrote:
>>> Michael H. Goldwasser wrote:
>>>>We are pleased to announce the release of a new Python book.
>>> Why is this book $102?
>> Supply and demand aside, I suspect the market for this, based on both
>> the publisher and the author's employment, is mostly
>> educational/collegiate. Therefore, this book is likely to be assigned
>> as a textbook and can command a premium price from buyers who have
>> little to no choice but to buy it. Additionally, it may not be
>> marketed on the wider bookstore shelves, so must make the most of the
>> market which it does reach.
>>
>> That's all conjecture. What I do know is fact is that I can't afford it.
>>
>> /alex
>> ___
>> Tutor maillist  -  Tutor@python.org
>> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Condensed python2.5 cheat sheet

2007-12-19 Thread Jeff Johnson
There is an excellent book for programmers from other languages.  Dive
Into Python.  http://www.diveintopython.org/toc/index.html

Jeff

On Wed, 2007-12-19 at 10:08 +, Samm and Andy wrote:
> Hi people,
> 
> I've a competent programmer friend who I'm trying to convert to the ways 
> of python and I was wondering if people could recommend a decent cheat 
> sheet for python 2.5.
> He know how to program but just needs the syntax to become pythonic
> 
> Thanks
> 
> Andy
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Program review

2008-01-05 Thread Jeff Johnson
I would like to "butt" in here and mention that this is some of the most 
useful information I have seen!  I am a programmer of 25 years that is 
new to Python.  This type of back and forth dialog on actual production 
code is extremely useful to learning the language.  I have done this 
with Ed Leafe with Dabo and it has helped a lot.

Keep it up!

Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675

Ricardo Aráoz wrote:
> Kent Johnson wrote:
>> Ricardo Aráoz wrote:
>>> Ok, here is a corrected new version, I hope.
>>>
>>> Kent, the fact that Mensaje.__init__ reads the message configuration is
>>> by design (it's a feature, not a bug ;c) ).
>> You misunderstood my suggestion. I would add a method to Mensaje that 
>> creates the email.MIMEMultipart.MIMEMultipart() currently done by 
>> Correo.__init__().
>>
>> Almost every line of Correo.__init__() is reading data from attributes 
>> of mensaje. This is a code smell called Feature Envy and is a clear sign 
>> that the code is in the wrong place.
>>
>> In Mensaje you could have
>>  def createMessage(self):
>>  messg = email.MIMEMultipart.MIMEMultipart()
>>  messg['From'] = self.De
>>  messg['To'] = self.Para
>>  messg['Subject'] = self.Encabezado
>>  messg['Reply-To'] = self.ResponderA
>>  messg.preamble = 'This is a multi-part message in MIME format'
>>  messg.attach(email.MIMEText.MIMEText(self.html, 'html'))
>>
>> Then in Correo.__init__() you would have
>>  self.messg = mensaje.createMessage()
>>
>> It doesn't change the functionality but it is a better design.
>>
> 
> I see, yes it is better, I'll correct it. Thanks
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Hoping to benefit from someone's experience...

2008-04-16 Thread Jeff Johnson
I have done most major languages over the last thirty years of which 
FoxPro has been the last 16 years.  I thought FoxPro was the greatest 
until Python.  Now I code in FoxPro and Python and I wish I could just 
use Python.  It's fun to code, everything works and it is a complete 
package without needing to incorporate a bunch of api's or third party 
applications.

Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675

Kent Johnson wrote:
> Marc Tompkins wrote:
>> It's funny - years ago I used to use Visual Studio and _enjoy_ it.  I'm 
>> spoiled now, I guess.
> 
> Python does that to you. The only disadvantage I know to learning Python 
> is that you won't want to code in anything else ever again :-)
> 
> Kent
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-14 Thread Jeff Johnson
I use Dabo's Editor.py.  It has templates to provide code highlighting, 
etc. in many languages.  I also like the way it runs Python programs.


By the way, Dabo is a database/business object centric framework for 
Python which wraps WxPython.  But you can use just the Editor or other 
parts you like.  It is not intended to be a web framework.


http://dabodev.com/wiki/FrontPage


--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]

Jaggo wrote:

Hello.

I haven't much experience with programming.

I'd like to point this question to programmers who write in editors 
other than the default PyWin32:


Why do you use your editor rather than using Pywin? What feature has 
editor X got that PyWin hasn't?
(That is, other than "My editor runs on unix / linux"; while that does 
count for something it is rather irrelevant to my current situation.)


Thanks in advance,
Omer.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] study advice on javascript to python hand-off

2008-08-14 Thread Jeff Johnson
This is a three tier framework where you can use any back end you want. 
 They currently support the major ones: MySQL, SQLite, PostGreSQL, 
MSSql to name the ones I can think of.


http://dabodev.com/wiki/FrontPage

--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]

Serdar Tumgoren wrote:

Hi everyone,

I've been trying to tackle a certain data-entry and processing problem 
for quite some time, and I was wondering if someone could offer advice 
on the path I should take. Whatever the answer, I know I have a great 
deal of study ahead of me, but I was hoping to at least narrow the field.


My specific use-case involves an attempt to create a web-based phone 
contacts system that allows users to associate a single contact with one 
or more business entities (or phone numbers or relatives, etc.). On the 
backend database, I know this requires the use of a linking table and a 
many-to-many relationship between tables for "individuals" and "businesses."


The front end is where I'm running aground.

Ideally, I'd like to have a data entry/edit form that lets the 
client-side user associate multiple entities with a contact before 
submitting the form to the server.


So if the user enters "John Smith" as a contact, they can initially 
associate him with "ABC Company".
If John Smith also serves on the board of directors for XYZ Foundation, 
I'd like to let the user click an Add button to also associate John 
Smith with the foundation. All of this should take place before the form 
is submitted back to the server.


A simple javascript implementation of the add/remove functionality I'm 
speaking of can be found at 
http://www.dustindiaz.com/add-remove-elements-reprise.


The part I'm getting lost on is how to take those dynamic user-generated 
values and get at them on the server side using python, with the 
end-goal of parsing and adding the values to the appropriate database 
tables (I expect I'll also have to do plenty of validation and checking 
for possible duplicates, but I'm waving my hand at those issues for the 
moment).


So I was hoping someone could explain how to accomplish this seeming 
hand-off from client-side javascript to server-side python.


Should I be accessing the DOM? And if so, should I be parsing URLs or 
using xml (e.g. python's xml.dom API or Frederick Lundh's ElementTree 
module)?


I suspect that I may be misusing/confusing the terminology here, so 
please feel free to point out any mistakes. Or perhaps I'm 
over-complicating the issue and there's a simpler solution to what I'm 
trying to accomplish.


If someone could suggest a conceptual approach to the problem, and even 
point to some good readings that tie these elements together for the 
stated purpose, I'd be greatly indebted.


Regards,

Serdar T.


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-15 Thread Jeff Johnson

It has a Run command on the menu and copies your .py to a temp file and
executes it.  Output is displayed in the lower split window.  It works
very nice without ever having to leave the editor.

I will tell you that I am not a person that likes a lot of features.  It
does indenting and code coloring and I can make changes, save and run it
all in the editor.

YMMV

--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]

Dick Moores wrote:

At 06:36 AM 8/14/2008, Jeff Johnson wrote:
I use Dabo's Editor.py.  It has templates to provide code 
highlighting, etc. in many languages.  I also like the way it runs 
Python programs.


Could you tell us what you like about the way it runs Python programs?

Thanks,

Dick Moores




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-15 Thread Jeff Johnson

You can use just the Editor if you wish.  Editor.py is the program.

Dick Moores wrote:

Thanks for the info. I'll take a look at Dabo.

Dick


--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] experience/opinions with deploying python GUI app to Linux, Win32, and Mac OS X

2008-11-13 Thread Jeff Johnson

Check out Dabo.  It is a framework that wraps wxpython and is developed
on the mac and is deployed on mac, windows and linux.  It has great
features like an app builder to get you up and running quickly.

http://dabodev.com/

And for the email list:

http://leafe.com/mailman/listinfo/dabo-users

--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]



greg whittier wrote:

Hi gang,

I know this is probably like asking whether vi or emacs is better, but 
I'm looking for the best cross-platform (linux, windows, mac os x) user 
interface toolkit.  Since the users won't be programmers, I'd like it to 
feel as much like a native app as possible in terms of installation.  It 
should feel like installing any other mac/windows/linux application.


I'm writing a very simple app to retrieve data from a device or import 
it from a file and then upload that data to a website (and possibly keep 
a local backup of the data using sqlite or similar).The main widget 
will be what in gtk would is called listview with a checkbox column for 
selecting which data to upload possibly as a panel within a wizard that 
would also have panels for selecting the device and logging into the web 
site.


Deploying to the Mac seems to be the most difficult from what I've 
read.  pygtk/glade seems natural for linux and even window, but 've read 
about difficulties with gtk on the mac, which at one point required 
installing X11, I believe.  There's a "native" (no X11) port, but I'm 
not sure how mature that is.


Here's what I've thought about with some pros/cons:

- tkinter -- this is the obvious answer I suppose, but the widget set is 
limited and not pretty (out of the box at least)

- pygtk -- not easy to deploy on mac?  Non-native looking widgets
- wxpython - complete widget set and native looking, but not sure if 
it's easy to deploy
- jython/SWT -- I have no experience with this, but everybody has a JVM, 
so deploying should be easy
- web app running locally -- no experience with this, but everybody has 
a web browser and there are frameworks like django I could use

- curses -- probably not as pretty as mac/windows users would expect

Any success stories out there?

Thanks,
Greg




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] [Fwd: Python Course]

2008-12-02 Thread Jeff Johnson

This was forwarded to me from one of our user group members:

"Hi everyone!

I just signed up for an online course in "Web Development with Python"
through DePaul University, which I think you might find interesting:
http://ipd.cdm.depaul.edu/wdp/Prog_WDP.htm

I talked to the folks in the admissions department and they said they
needed 10 students enrolled in order to go through with the course.
So I told them I would mention this to the python programmers I knew
to try to drum up enough applicants.

Best regards,

John T."

If anyone has any objection to posting this type of information, please 
let me know.  I thought members might be interested in available Python 
courses.


--
Jeff

Jeff Johnson
[EMAIL PROTECTED]
Phoenix Python User Group - [EMAIL PROTECTED]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of Python

2010-12-28 Thread Jeff Johnson


On 12/28/2010 10:46 AM, Marc Tompkins wrote:
I love, love, love me some Python - it fits the way I think better 
than any other language I've used - but there is one consideration 
that occurs to me: Python is nearly ubiquitous on Linux/Mac, and easy 
to download and install on Windows - but most bargain-basement Web 
hosts don't support it (I'm looking at YOU, GoDaddy.)


If you're using a premium hosting company ("premium" doesn't 
necessarily mean "extremely expensive", but you do need to compare 
hosting plans), or if you plan on hosting your site yourself, then I 
would absolutely recommend Python (with or without Django or 
what-have-you) for Web development... but if you plan on using 
GoDaddy, stick with PHP.



I have been a software developer since the 70's.  I have used most of 
the major languages.  I used FoxPro for the last 20 years and have 
recently moved to Python.  I absolutely love working with Python!  
Everything works, deployment is easy, and with all of the libraries 
available; there isn't much you can't do.  I now develop on Ubuntu even 
though my customers (and deployment) are Windows.


Check out Webfaction for a hosting company.  They are probably the 
largest Django host, but using their control panel to do things is very 
easy!  I have been using them for over two years.


Jeff

---

Jeff Johnson
j...@dcsoftware.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of Python

2010-12-28 Thread Jeff Johnson


On 12/28/2010 12:48 PM, Marc Tompkins wrote:
On Tue, Dec 28, 2010 at 10:32 AM, <mailto:pyt...@bdurham.com>> wrote:


Most of the hosting companies I've investigated support older
versions of Python and only support CGI access.

Ah yes - that's what it was.  To use Django (or most other frameworks) 
you need some processes to be running more or less constantly, as 
opposed to in a CGI context.  Your typical shared Webhosting service 
is sharing a single machine or VM with lots of other customers; they 
can't allow long-running processes or the whole thing would grind to a 
halt.  I have no idea how Webfaction manages it, especially with a 
starting price of $5.50/month - it's very tempting...


For the time being I'm not looking to move any sites over - but if the 
need arises again, Webfaction will be the first place I check out.


Actually, my own website is a few years overdue for a facelift - maybe 
I'll dump Joomla for Django.  Perhaps then I'd actually be interested 
enough to maintain the damn thing.


--
www.fsrtechnologies.com <http://www.fsrtechnologies.com>




Webfaction supports long processes and that is why they are the largest 
Django hosting site.  They support a ton of software, too.  SVN, Trac 
are two I use.


I've been with them at least 3 years and I find their cost amazing for 
what I get!  Their documentation, support and forums are about the best 
I've seen.


Jeff

---

Jeff Johnson
j...@dcsoftware.com





___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Choice of Python

2010-12-28 Thread Jeff Johnson


On 12/28/2010 01:35 PM, Brett Ritter wrote:

On Tue, Dec 28, 2010 at 3:06 PM, Jeff Johnson  wrote:

Webfaction supports long processes and that is why they are the largest
Django hosting site.  They support a ton of software, too.  SVN, Trac are
two I use.

I didn't see git hosting among their software.  Is it available
without hoop-jumping?


I counted 20 what they call "applications" of which git is one.  So, yes 
it is there.



Jeff

-------

Jeff Johnson
j...@dcsoftware.com




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Lists

2011-06-11 Thread Jeff Johnson
Alan:  Thank you for all you do.  I always look for your posts!  You 
have helped me immensely with Python and I appreciate it!



Jeff

---

Jeff Johnson
j...@dcsoftware.com



Jeff

---

Jeff Johnson
j...@san-dc.com
(623) 582-0323

www.san-dc.com


On 06/11/2011 08:30 AM, Alan Gauld wrote:

"Piotr Kamiński"  wrote

 This is a *technical* list, as I understand it, solely dedicated 
to the

technical side of teaching the *Python* programming language and
*programming* in general. I would like to keep it this way ...


Since this seems to be something we can all agree on
can we consider this discussion closed and get back
to Python?

If you wish to continue the philosophical debate please
take it off list.

Alan g.
List moderator.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Speech

2011-08-24 Thread Jeff Johnson



On 08/24/2011 10:17 AM, Alan Gauld wrote:

On 24/08/11 18:09, Christopher King wrote:

  how do you unzip a gz on windows?



Pretty much any zip tool (Qzip, Winzip etc) will
handle gz files too.



7 zip works great on Windows for most formats.

http://www.7-zip.org/

Jeff

---

Jeff Johnson
j...@dcsoftware.com



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor