Re: split long string in two code lines

2011-06-13 Thread Redcat
On Mon, 13 Jun 2011 23:31:29 +0200, Tracubik wrote:

> 1 def foo():
> 2for index in ...
> 3for plsdoit in ...
> 4print "this is a very long string that i'm going to/ 5 
> write here, it'll be for sure longer than 80 columns"

If you're going to use the \ anyway, how about:
> 1 def foo():
> 2for index in ...
> 3for plsdoit in ...
> 4print "this is a very long string that i'm going to "
> 5+ "write here, it'll be for sure longer than 80 
columns"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Redcat
> The chief geek has given his nod of approval to publish Miranda through
> how-to geek, and I can pitch any of your software to him, and write an
> article about it - provided that the chief geek approve the software.

I wouldn't mind contributing some time to this project.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread Redcat
On Wed, 03 Aug 2011 03:28:14 +0800, smith jack wrote:

> There are so many choice to do the same thing, so is there any special
> advantage Django brings to user?

The ability to code in Python instead of Java is the biggest one to me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows No-Install Distribution?

2011-08-23 Thread Redcat
I haven't tried it myself yet, but might http://www.portablepython.com/ 
be what you're looking for?


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


Re: checking if a list is empty

2011-05-11 Thread Redcat
On Wed, 11 May 2011 10:33:51 -0400, D'Arcy J.M. Cain wrote:

> Non-programmers should be able to program?

Wasn't that sort of the premise behind Visual Basic? I don't know if that 
was the intention, but it sure was the result in a lot of cases.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How best to convert a string "list" to a python list

2011-05-13 Thread Redcat
On Fri, 13 May 2011 10:15:29 -0700, noydb wrote:

> I want some code to take the items in a semi-colon-delimted string
> "list" and places each in a python list.  I came up with below.  In the
> name of learning how to do things properly, do you experts have a better
> way of doing it?

How about the below?

dan@dan:~/development$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = "cyan;magenta;yellow;black"
>>> xList = x.split(';')
>>> xList
['cyan', 'magenta', 'yellow', 'black']
>>>

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


Re: To start a simple server

2011-10-03 Thread Redcat
Are you running web.py on your computer, or is it running for example on 
a hosting company's computer? If it's not on your computer you have your 
port 8080 traffic blocked the hosting company's firewall.

On Sun, 02 Oct 2011 20:59:40 -0700, sillyou su wrote:

> i am learning webpy and I am following the tutorial (http://webpy.org/
> docs/0.3/tutorial) .
> 
>  But when i installed mysql , i found  problem.
> 
> Here is the code:
> #===# import web
> 
> urls=("/.","index")
> 
> app=web.application(urls,globals())
> 
> class index:
> def GET(self):
> return 'hello world'
> 
> if __name__=='__main__':
> app.run()
> #===#
> 
> And here is error information:
> #===# http://0.0.0.0:8080/
> 
> Traceback (most recent call last):
> File "C:\Users\su\Desktop\code.py", line 18, in  app.run()
> File "C:\Python27\lib\site-packages\web\application.py", line 311, in
> run
> return wsgi.runwsgi(self.wsgifunc(*middleware)) File
> "C:\Python27\lib\site-packages\web\wsgi.py", line 54, in runwsgi return
> httpserver.runsimple(func, validip(listget(sys.argv, 1, ''))) File
> "C:\Python27\lib\site-packages\web\httpserver.py", line 148, in
> runsimple
> server.start()
> File "C:\Python27\lib\site-packages\web\wsgiserver\__init__.py", line
> 1753, in start
> raise socket.error(msg)
> error: No socket could be created
> #===#
>  A service occupy  port 8080. So i stop the service.
> The program did run, but another problem came out.
> #===#
> 
> the program is not running. In the browser:
>  This webpage is not
> available
> The webpage at http://0.0.0.0:8080/ might be temporarily down or it may
> have moved permanently to a new web address. Error 108
> (net::ERR_ADDRESS_INVALID): Unknown error.
> 
> 
> 
> now the program is running. In the browser:
>  This webpage is not
> available
> The webpage at http://0.0.0.0:8080/ might be temporarily down or it may
> have moved permanently to a new web address. Error 108
> (net::ERR_ADDRESS_INVALID): Unknown error.
>  Nothing difference .
> 
> I can't describe the problem very well in English. So I post all
> information here .
> 
> Thank you for any tips.

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


Re: To start a simple server

2011-10-03 Thread Redcat
On Mon, 03 Oct 2011 10:05:15 -0700, sillyou su wrote:

> I am running web.py on my computer

Does "netstat -nat | grep 8080" show anything listening on port 8080? 
(I'm assuming here that you're running on a Linux box)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help

2011-10-07 Thread Redcat
On Fri, 07 Oct 2011 15:59:55 +, X1 wrote:

> I have this program that fails:
> 
> $ vapt
> Traceback (most recent call last):
>   File "/usr/local/bin/vapt", line 3, in 
> from vapt import vapt
>   File "/usr/lib/python2.6/site-packages/vapt/__init__.py", line 11, in
> 
> __import__(name, glob, loc, [])
>   File "/usr/lib/python2.6/site-packages/vapt/cadview.py", line 13, in
> 
> import OpenGL.Tk as gltk
> ImportError: No module named Tk
> 
> 
> can you help me?
> This is on fedora

The OpenGL.Tk module is looking for the Tk module and not finding it. 
Install the Tk module.

Try "sudo easy_install Tk".
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help

2011-10-07 Thread Redcat
> Thanks,
> I have the Tk module installed, but the program still fails. Probably it
> is a problem of path?

That would be my guess - that the Tk module is installed somewhere other 
than where OpenGL.Tk is looking for it.

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


Re: [OT] Re: Benefit and belief

2011-10-20 Thread Redcat
On Wed, 19 Oct 2011 14:49:26 -0700, Westley Martínez wrote:

>> I am a poly-illiterate. I can't read or write hundreds of languages.
> 
> I think you need to speak German fluently to be a good programmer.

No, just Dutch :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: my new project, is this the right way?

2011-11-14 Thread Redcat
> since i'm mostly a new-bye for as regard databases, my idea is to use
> sqlite at the beginning.
> 
> Is that ok? any other db to start with? (pls don't say mysql or similar,
> they are too complex and i'll use this in a second step)

I know it's a lot of work to learn initially, but I would recommend 
taking the time to install and become familiar with a database engine 
such as MySQL or PostgresQL. While SQLite is easy to install and easy to 
use, it also cuts a lot of corners and allows you to do things that would 
die in a real database. For example, in SQLite column types are merely 
suggestions; there is nothing in SQLite to keep you from storing a string 
in an integer field or vice versa.

For example:

dan@dan:~/work$ sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table test (
   ...> id int,
   ...> name varchar(64),
   ...> comment varchar(256)
   ...> );
sqlite> .schema test
CREATE TABLE test (
id int,
name varchar(64),
comment varchar(256)
);
sqlite> insert into test values (1, 'Dan', 'Normal insert with valid 
types');
sqlite> insert into test values ('Bogosity', 2, 'Record with invalid 
types');
sqlite> insert into test values ('This field should be an int but is 
really a long string instead', 12.45, 'A really screwy record');
sqlite> select * from test;
1|Dan|Normal insert with valid types
Bogosity|2|Record with invalid types
This field should be an int but is really a long string instead|12.45|A 
really screwy record
sqlite> 


This is not to say that SQLite is useless. Far from it - I use it 
frequently myself. But I've been working with SQL databases for a bunch 
of years, and I am familiar with the tradeoffs involved in working with 
SQLite. 

A decent tutorial on working with SQL in general can be found at http://
www.w3schools.com/sql/sql_intro.asp

Installing MySQL or Postgres can be fairly simple, if you use the tools 
provided with your Linux distro (assuming you're running on Linux). "sudo 
apt-get install mysql mysql-server" or "yum install mysql mysql-server" 
should get you what you need to start using MySQL, "sudo apt-get install 
postgresql" or "yum install postgresql" should get you started with 
PostgresQL.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: platform issues?

2011-12-01 Thread Redcat
> Our servers have the same version of python and we're running the same
> OS (Fedora 14). Can anyone think of what might be causing this problem,
> or why it works on most (but not all) machines?
> 
> Thanks

Is the server able to resolve www.google.com properly? If so, are you 
POSITIVE that the "url = " line on the server has no typos?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: platform issues?

2011-12-01 Thread Redcat
On Thu, 01 Dec 2011 13:43:38 -0500, Adrian Powell wrote:

> Since I'm actually trying to write a twitter client, I was more focused
> on the results from twitter. Since google and twitter are so huge and so
> distributed, I'd bet neither are good tests for this, but they look
> approximately right.
> 
> Are there better ways to test if our network setup is good? At least
> that would be a relatively easy thing to fix.

I think I'd first try "dig www.google.com" to be sure that it is 
resolving, then I believe I'd try to fetch the URL from your code sample 
using cUrl. If both of those work then I'm not sure what I'd look at next.

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