Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe

On Nov 21, 2005, at 8:17 PM, could ildg wrote:

> Wordpress.com blog will eat up the spaces before a line,
> just as it will trim every line of my article. So I can't paste  
> python code indentedly.
> Does any one use wordpress blog here?
> Please tell me how to leave the sapces as they are when publishing  
> ariticles on the blog,

You can enclose the code in a PRE block, like this:


def foobar():
 print "abc"
 if x == 3:
 print "def"
 print "ghi"


If you don't care for how it renders in a browser, hack your CSS to  
make PRE render in a way you like.

  -dan

-- 
Well sure the government lies, and the press lies, but in a democracy
they aren't the same lies.-Alexis A. Gilliland


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


Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe

On Nov 22, 2005, at 12:30 AM, could ildg wrote:

> Thank you~
> It works!
> but how can paste "<" and ">", please?
> these 2 symbols will also confuse wordpress and I can't publish  
> what I want.

Replace < with <

Replace > with >

(where those abbreviations stand for "less than" and "greater than")

Before: if x < 5:

After: if x < 5:

Another common character in code that you "should" do similarly is  
the double quote ("). For that, use "

Before: if x == "foo":

After: if x == "foo":

  -dan

-- 
Any society that needs disclaimers has too many lawyers.  -Erik Pepke


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


Re: PYTHONDOCS on OSX

2005-11-28 Thread Dan Lowe

On Nov 28, 2005, at 5:27 PM, Robert Hicks wrote:

> I have that...and it isn't working with the OSX version of IDLE in the
> MacPython folder. If I start Python from the Terminal it works.
>
> Any idea why it doesn't work that way?

Unless a program is launched in a Terminal window, your .profile (and  
other similar files) aren't read. OSX doesn't work like Linux or  
Solaris; it doesn't launch the GUI from a shell environment. There  
are ways to get environment variables into the GUI, such as described  
here:

http://tinyurl.com/8yvk9

  -dan

-- 
logic (n.): the art of being wrong with confidence.



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


Re: Filename case-insensitivity on OS X

2006-01-05 Thread Dan Lowe

On Jan 4, 2006, at 4:32 AM, Michael Anthony Maibaum wrote:

> You can choose if HFS+ behaves in a case-preserving, case-insensitive
> or case-sensitive manner. See man newfs_hfs. Case sensitive is not
> supported on the 'System' volume, but I have several external disks
> using it without a problem for do general unix-like development
> projects.

For people without an external disk sitting around, note that you can  
also do this via a mountable disk image. Here's an example to create  
a case-sensitive HFS+ image:

hdiutil create -size 10m -fs "Case-sensitive HFS+" -volname MyVolume  
MyVolume.dmg

For more information, try "hdiutil create" or "man hdiutil".

  -dan

-- 
There is nothing new in the world except the history you do not know.
 -Harry Truman


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


Re: Filename case-insensitivity on OS X

2006-01-06 Thread Dan Lowe

On Jan 3, 2006, at 9:50 PM, Tom Anderson wrote:

> On Tue, 3 Jan 2006, Dan Sommers wrote:
>
>> On Tue, 03 Jan 2006 15:21:19 GMT,
>> Doug Schwarz <[EMAIL PROTECTED]> wrote:
>>
>>> Strictly speaking, it's not OS X, but the HFS file system that is  
>>> case
>>> insensitive.
>
> Aaah, of course. Why on earth didn't Apple move to UFS/FFS/whatever  
> with
> the switch to OS X?
>
>>> You can use other file systems, such as "UNIX File System".  Use  
>>> Disk
>>> Utility to create a disk image and then erase it (again, using Disk
>>> Utility) and put UFS on it.  You'll find that "touch foo FOO" will
>>> create two files.
>>
>> You may also find some native Mac OS X applications failing in  
>> strange
>> ways.
>
> Oh, that's why. :(

That's one reason, but here are two more:

1. It would have broken the expected behavior from the previous 15  
years of Mac OS releases. Given Mac users' obsessive attention to  
detail regarding the consistency of their environment, this would  
*not* have gone over well at all.

2. Mac OS is designed primarily for non-technical users. A case- 
sensitive filesystem would just be confusing for the main audience.  
If I tried to explain to my mother that Dan.doc is not the same as  
DAN.DOC, she would probably tell me I was out of my mind.

Think about it - how many things used by average people are case  
sensitive? Passwords? That's about it. (And judging by most user  
passwords I have seen, they're almost all lowercase anyway.) Email  
addresses, URLs, the search box in Google, your AOL or Jabber buddy  
list: all case-insensitive.

Aside from that, what is "right" is a matter of opinion. I prefer  
case-insensitive filesystems, and I'm a system administrator who  
works on Solaris systems all day. Others I work with refuse to  
consider case-insensitive filesystems as anything but a "bug". Who's  
right? I don't think there's one true answer...

I'm not trying to get into one of these case sensitivity religious  
wars here, just offering an opinion.

  -dan

-- 
For a list of all the ways technology has failed to improve the quality
of life, please press three.   -Alice Kahn



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


Re: Filename case-insensitivity on OS X

2006-01-06 Thread Dan Lowe

On Jan 6, 2006, at 1:13 PM, Mark Jackson wrote:

> Dan Lowe <[EMAIL PROTECTED]> writes:
>
>> Think about it - how many things used by average people are case
>> sensitive? Passwords? That's about it. (And judging by most user
>> passwords I have seen, they're almost all lowercase anyway.) Email
>> addresses, URLs, the search box in Google, your AOL or Jabber buddy
>> list: all case-insensitive.
>
> Not all URLs.  Compare, for example:
>
> http://www.python.org/doc/Summary.html
> http://www.python.org/doc/summary.html

You are correct, of course. I was thinking of cases like this:

http://www.python.org
HTTP://WWW.PYTHON.ORG
hTtP://www.PyThOn.ORG

So I should have said "hostnames" instead of "URLs". In my  
experience, most URLs that are actually typed in are like this...

http://yahoo.com
http://google.com
http://ebay.com
http://apple.com
http://amazon.com

And in that form, they are not case sensitive. They only become that  
way when you start putting more on the end. But I'd guess that 90%+  
of the time, URLs of that form are clicked on, not typed into the  
browser.

  -dan

-- 
You know you've achieved perfection in design, not when you have  
nothing more
to add, but when you have nothing more to take away.
 -Antoine de Saint-Exupery


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


Re: Python vs C for a mail server

2006-01-28 Thread Dan Lowe

On Jan 28, 2006, at 8:39 PM, Dennis Lee Bieber wrote:

> On Sat, 28 Jan 2006 18:03:56 +1100, Steven D'Aprano said:
>>
>> Google is your friend. The first four mail servers listed are, in  
>> order:
>>
>> sendmail
>> postfix
>> Microsoft Exchange
>> qmail
>>
>   Dig a bit deeper, and exim might be a candidate for the list. I'm
> pretty sure O'Reilly has books for sendmail, postfix, and exim; don't
> know about qmail.

O'Reilly does have an Exim book, but it is out of date. It covers the  
3.x family, while 4.x has been out for quite a while now. The 4.x  
family is very different from 3.x, so the book isn't worth a whole  
lot these days.

I'm on my second major mail system deployment built around Exim, and  
would recommend it to anybody needing a robust, flexible mail server.

  -dan

-- 
Well sure the government lies, and the press lies, but in a democracy
they aren't the same lies.-Alexis A. Gilliland


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


Re: simple perl program in python gives errors

2006-01-31 Thread Dan Lowe

On Jan 31, 2006, at 8:28 AM, morris carre wrote:

> [EMAIL PROTECTED] a écrit :
>>
>> $a += 20 * 14;
>> print $a;
>
> a = 20 * 14
> print a
>
> where's the problem ?

Not sure if you typo'd that, but that should read:

a += 20 * 14
print a

  -dan

-- 
I am not a vegetarian because I love animals; I am a vegetarian because
I hate plants.-A. Whitney Brown


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


Re: simple perl program in python gives errors

2006-02-01 Thread Dan Lowe

On Feb 1, 2006, at 7:59 AM, Tim Roberts wrote:

> Dan Lowe <[EMAIL PROTECTED]> wrote:
>>
>> Not sure if you typo'd that, but that should read:
>>
>> a += 20 * 14
>> print a
>
> Did you try to run that?

Well, I did, but I had given 'a' a value first. And now I'm thinking  
that I may have forgotten some of the earlier thread... where I  
suppose the point was that this doesn't work when 'a' hasn't already  
been set. I was focusing on = vs += ...

So in that case, please ignore me :-)

  -dan

-- 
Black holes are where God divided by zero.  -Steven Wright


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