Re: Python too complex ?!?!?!

2007-11-18 Thread Berco Beute
On Nov 17, 3:21 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > programmer, but he claims that the install, config, and
> > library models for C# have proved to be less
> > problematic than Python. So both his courses (intro,
> > data structs, algorithms) are taught in C#.
>
> A little anecdotal comparison from some of my experience with two
> web apps deployed at my current company:
>
> One web app, written in C#/ASP.net one written in Python.
>
> Moved each app to new servers (C#/ASP.net on a new Windows box,
> Python app on a shiny new Debian box).
>
> C#/ASP.net app:  had to find and install the right version of the
> .net libraries.  That's an afternoon of my life I won't get back.
>
> Python app:  copied my app
>
> C#/ASP.net app:  couldn't find VS2003 (in which the app had been
> written) any more so had to upgrade to VS2005.
>
> Python app:  Continued to use the same development environment.
>
> C#/ASP.net app:  (ASP specific) generally requires following a
> particular convention.  Writing a RESTful web app is next to
> impossible given the reliance on the postbacks; and the server
> environment doesn't make it easy to make clean URLs
>
> Python app:  Django makes web-app development easy and
> clean/RESTful (other frameworks may as well...I speak from Django
> experience) and push you to Do The Right Thing (tm)
>
> C#/ASP.net app:  had to re-partition my server containers so that
> it could deploy .Net 2.0 and .Net 3.0 apps side-by-side
>
> Python app:  I've had Python 2.3, 2.4 and 2.5 running on the same
> machine without a thought
>
> C#/ASP.net app:  libraries are often written to a particular
> framework version, so if any new functionality requires the new
> version the whole app needs to be migrated.
>
> Python app:  most of the libraries I use come built in, or they
> work with 2.3 or later.
>
> C#/ASP.net app:  Installing new libraries, same as upgrading
> currently-used libraries.  Usually requires paying for, then
> manually installing various libraries, clearing distribution
> rights, etc.
>
> Python app:  There are an abundance libraries that are just an
> apt-get away in terms of difficulty, and they are Free Software
> so I can install them and deploy them without additional costs.
>
> C#/ASP.net app:  3rd party libraries usually come as source-less
> DLLs that you can't peer into
>
> Python app:  3rd party libraries are usually pure python which
> you can modify or step into as needed
>
> C#/ASP.net app:  really only works well on Windows
>
> Python app:  works well on Windows, Linux, BSD, Mac OS X...
>
> C#/ASP.net app:  really requires Visual Studio
>
> Python app:  works well with Eclipse, Vim, Emacs, Wing IDE,
> Komodo, Idle, and piles of other development environments.  Heck,
> I've written the occasional python program using "ed" or "cat >
> x.py".
>
> C#/ASP.net app:  files are scattered all over.  You've got source
> apps, you've got templates, you've got resource files, you've got
> GUID files.  And VS hides the complexity so when (not "if")
> something breaks you get a crash course in what goes on under the
> covers.
>
> Python app:  I've got .py files (and sometimes templates for my
> Django code, and could have I18N files for translations).  Very
> easy to track down where everything is.
>
> C#/ASP.net app:  Code/syntax is horridly opaque, requires braces
> and lots of additional overhead code to get things done.  Compare
> the clutter of a basic C# script with a similarly function Python
> script.  How much is pure syntactic overhead?
>
> Python app:  Code/syntax is rather easy to read (once you
> understand list comprehensions and the __foo__ methods)
>
> Yeah, I'd take Python any day...for implementation *OR* for
> teaching someone how to program.
>
> -tkc

Thank you very much for this VERY useful summary. It gives me tons of
ammunition in case the latest .Net zealot walks into my office :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tuples !?!?

2007-12-11 Thread Berco Beute
> > Is the tuple comparison brooked in python ?!?!?
>
> No.
>
> > Thanks.
>
> You're welcome.


HHH! That just made my day. Too funny.

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


Re: Python for Java programmer

2007-12-14 Thread Berco Beute
Welcome to Python!

One way to get you up to speed fast (and fun) is take some java app
you've written and implement it in Jython. After you've done that, and
gotten over the pleasant surprise of how short and clean your code has
become, go over the source again and see where you can replace calls
to java libs with calls to Python libs. E.g. for xml & xpath use
ElementTree instead of JDom, for timing use Python's timeit module,
etcetera. Although I've been using Python for a while now I've done
the same thing recently and was surprised by how clearly that exercise
showed Python's strengths.

Just go ahead and start programming is the best way to learn about the
philosophies behind a language.

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


Re: Python for Java programmer

2007-12-14 Thread Berco Beute
> Having a decent knowledge of Python's object model

As explained clearly here:

http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html
http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html

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


Re: TIOBE declares Python as programming language of 2007!

2008-01-07 Thread Berco Beute
Cool! We knew it would happen one day :)
What could be the reason? Python 3? Jython 2.2? Java's loss of
sexiness?

What I would like to know is what it was that boosted Python's
popularity in 2004 (see http://www.tiobe.com/tiobe_index/Python.html).
Equally interesting is the question why it dropped shortly after.

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


Re: Web Development Project

2008-02-22 Thread Berco Beute
linux
lighttpd
fastcgi
django
sqlite3

...rocking combo :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for web...

2008-02-25 Thread Berco Beute
> Use mod_python if you can.

Although mod_python is fine, I had more success using fastcgi with
Django (you can run Django as a fastcgi process). It was less
troublesome to set up and the chances your hosting provider supports
it are bigger.

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


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Berco Beute
On Mar 22, 5:40 pm, jmDesktop <[EMAIL PROTECTED]> wrote:
> For students 9th - 12th grade, with at least Algebra I.  Do you think
> Python is a good first programming language for someone with zero
> programming experience?  Using Linux and Python for first exposure to
> programming languages and principles.
>
> Thank you.

Yes. The nice thing with Python is that you can start off with really
simple examples and slowly build up the complexity along with the
understanding of the students. There's no need to explain OO before
the students can write their first 'Hello, world'.

There's almost no limit to how 'shallow/deep' you can go with Python.

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


PIL on windows XP x64 (64-bit)?

2008-10-10 Thread Berco Beute
Has anybody here got PIL (the Image lib) working on Windows XP x64 (64-
bit)? There is no version available for that platform from
pythonware.com.

Thanks,
2B
--
http://mail.python.org/mailman/listinfo/python-list


Re: PIL on windows XP x64 (64-bit)?

2008-10-12 Thread Berco Beute
Investigated this a little more. Since I only needed to resize an
image I thought going through all the hoops of building PIL was too
much effort and took a look at PythonMagick. Turned out I had to build
that myself as well. Am I the first that wants to do image
manipulation on x64 using python? Are there alternatives?

Anyway, I guess that if I knew the hoops you have to jump to when
using windows xp 64-bit instead of 32-bit I would have stayed with the
latter.

2B

On Oct 11, 12:02 am, Berco Beute <[EMAIL PROTECTED]> wrote:
> Has anybody here got PIL (the Image lib) working on Windows XP x64 (64-
> bit)? There is no version available for that platform from
> pythonware.com.
>
> Thanks,
> 2B

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


create instance attributes for every method argument

2008-07-19 Thread Berco Beute
I remember reading somewhere how to create an instance attribute for
every method argument, but although Google is my friend, I can't seem
to find it. This could likely be done way more elegant:

=
class Test(object):

def __init__(self, a, b, c, d, e, f):
self.a = a
self.b = b
self.c = c
self.d = d
=

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


Re: simple question about dictionaries

2008-07-21 Thread Berco Beute
Sounds like a school assignment. Find the answer yourself here:
http://diveintopython.org/toc/index.html

You'll learn a lot more in the process.

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


Re: Google App Engine

2008-04-08 Thread Berco Beute
It's wonderful news for Python. It will definitely be a boost for
Python's (and Django's) popularity. Python finally seems to be on
every developers mind at the moment. Looks like it's showtime for
Python!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can C.L.P.handle the load?

2008-04-09 Thread Berco Beute
On Apr 9, 7:54 am, Paddy <[EMAIL PROTECTED]> wrote:
> What else could we do to make c.l.p. of more use to the newbie whp may
> also be new to usenet whilst keeping c.l.p a usefull place for all?
>
> - Paddy.

Maybe create a usenet/google group for newbies? A place to ask
beginners questions. And post a sticky to c.l.p. redirecting newbies
(or experienced pythoneers with newbie questions :).

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


Re: Can C.L.P.handle the load?

2008-04-10 Thread Berco Beute
On Apr 9, 12:24 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Berco Beute <[EMAIL PROTECTED]> wrote:
> > On Apr 9, 7:54 am, Paddy <[EMAIL PROTECTED]> wrote:
> >> What else could we do to make c.l.p. of more use to the newbie whp may
> >> also be new to usenet whilst keeping c.l.p a usefull place for all?
>
> >> - Paddy.
>
> > Maybe create a usenet/google group for newbies? A place to ask
> > beginners questions. And post a sticky to c.l.p. redirecting newbies
> > (or experienced pythoneers with newbie questions :).
>
> Or just redirect them to the already existing 
> listhttp://mail.python.org/mailman/listinfo/tutor

I didn't know about that list. It would be nice to have that list
duplicated as a usenet/google group (just like c.l.p).

> What do you mean by 'post a sticky'? That sounds like a web forum thing.

It is. Using Google Groups some can post a post that stays on top. Not
sure if everybody would like that. :)

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


webcam (usb) access under Ubuntu

2008-04-15 Thread Berco Beute
I've been trying to access my webcam using Python, but I failed
miserably. The camera works fine under Ubuntu (using camora and
skype), but I am unable to get WebCamSpy or libfg to access my webcam.

First I tried webcamspy (http://webcamspy.sourceforge.net/). That
requires pySerial and pyParallel, and optionally pyI2C. Runing
WebCamSpy results in:

Exception exceptions.AttributeError: "Parallel instance has no
attribute '_fd'" in > ignored

This seems to come from importing I2C. The application window opens,
but there's an error message:

NO VIDEO SOURCE FOUND

Next I tried libfg (http://antonym.org/libfg). I built it, made the
Python bindings and installed it. Unfortunately the following:

>>>import fg
>>>grabber = fg.Grabber()

results in:

fg_open(): open video device failed: No such file or directory

Since the camera works fine in Ubuntu itself my guess is that the
problem is with the python libraries (or even likelier, my usage of
them). Is there anybody here that was successful in accessing their
webcam on linux using Python? Else I have to reside to Windows and
VideoCapture (which relies on the win32 api and thus is Windows-only),
something I'd rather not do.

Thanks for any help,
2B

===
I am uUsing:
WebCam: Logitech QuickCam Pro 400
Ubuntu
Python 2.5
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: webcam (usb) access under Ubuntu

2008-04-15 Thread Berco Beute
Thanks, that would be great.

While I'm at it I wondering how to display a video preview. Here's
someone using VideoCapture (the win32 lib) and PyGame, but I'd rather
use a GUI framework and preview/capture videos directly.

2B


> It has been *ages* since I did this - so take it with a grain of salt.
> However, back then I was able to access a video camera using gqcam. Looking
> into the source of that revealed that all it did were some simple
> ioctl-calls and reading from a /dev/video*-device.
>
> That did the trick for me...
>
> Additionally, you might consider using gstreamer + the python bindings for
> that. I was also successful using them - if I remember this conversation
> tonight or so, I'll send you the sources.
>
> Diez
>
> Diez

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


Re: webcam (usb) access under Ubuntu

2008-04-15 Thread Berco Beute
On Apr 15, 11:18 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Berco Beute schrieb:
>
> > Thanks, that would be great.
>
> Here you go.
>
> http://roggisch.de/vidio.tgz
>
> Diez

Wonderful! Thank you very much!
I'm running out of time, but after installing the necessary goodies
using the nice package from here:
http://aruiz.typepad.com/siliconisland/2006/12/allinone_win32_.html

In the meantime I've switched to windows. I'm running into the problem
that 'import gst' throws:

===
>>> import gst
Traceback (most recent call last):
  File "", line 1, in 
  File "H:\Python25\lib\site-packages\gst-0.10\gst\__init__.py", line
87, in 
from _gst import *
ImportError: DLL load failed: The specified module could not be found.

===

I've tried reinstalling gstreamer (for windows):

http://gstreamer.freedesktop.org/pkg/windows/releases/gstreamer/gstreamer-0.10.17.setup.zip
http://gstreamer.freedesktop.org/pkg/windows/releases/gstreamer/gstreamer-0.10.17.win32.zip

but that didn't help. I get some complaints about 'libgstinterfaces'
as well... I'm too unfamiliar with these libraries to have a clue
what's wrong here...

I'll look into it some more tomorrow.

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


Re: webcam (usb) access under Ubuntu

2008-04-16 Thread Berco Beute
On Apr 15, 11:45 pm, Berco Beute <[EMAIL PROTECTED]> wrote:
> I've tried reinstalling gstreamer (for windows):
>
> http://gstreamer.freedesktop.org/pkg/windows/releases/gstreamer/gstre...http://gstreamer.freedesktop.org/pkg/windows/releases/gstreamer/gstre...
>
> but that didn't help. I get some complaints about 'libgstinterfaces'
> as well...

To be more precise, when doing an 'import gst' Python shell pops up an
error dialog saying:

"This application has failed to start because
libgstinterfaces-0.10.dll was not found."

2B

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


Re: webcam (usb) access under Ubuntu

2008-04-16 Thread Berco Beute
On Apr 16, 12:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Maybe if you are now using windows, there are better options - but I'm a
> *nix-boy :)
>
> Diez

So am I :), but the application I'm writing has to run on *that other
operating system from the 90's*.
I'm trying hard not to implement the application in C#/.Net, but I'm
running out of open source alternatives. VideoCapture *almost* worked
and now I'm stranded at the gstreamer road as well...

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


Re: Image handling - stupid question

2008-04-16 Thread Berco Beute
On Apr 16, 12:21 pm, Jumping Arne <[EMAIL PROTECTED]> wrote:
> I'm going to try to write some imange manipulation code (scaling, reading
> EXIF and IPTC info) and just want to ask if PIL is *THE* library to use?

Depends on your requirements, but it's certainly the first library I
would check out. It offers lots of functionality, it is easy to use,
well documented and rock solid.

> I looked at  and noticed that the
> latest version is from Dec 2006.
>
> In my experience that means that either it's abandoned or that it's very good
> and stable.

The latter (what else would you expect from /F? :)

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


Re: webcam (usb) access under Ubuntu

2008-04-17 Thread Berco Beute
On Apr 16, 2:26 pm, yoz <[EMAIL PROTECTED]> wrote:
> Berco Beute wrote:
> > I've been trying to access my webcam using Python, but I failed
> > miserably. The camera works fine under Ubuntu (using camora and
> > skype), but I am unable to get WebCamSpy or libfg to access my webcam.
>
> > First I tried webcamspy (http://webcamspy.sourceforge.net/). That
> > requires pySerial and pyParallel, and optionally pyI2C. Runing
> > WebCamSpy results in:
>
> > Exception exceptions.AttributeError: "Parallel instance has no
> > attribute '_fd'" in  > > ignored
>
> > This seems to come from importing I2C. The application window opens,
> > but there's an error message:
>
> > NO VIDEO SOURCE FOUND
>
> > Next I tried libfg (http://antonym.org/libfg). I built it, made the
> > Python bindings and installed it. Unfortunately the following:
>
> >>>> import fg
> >>>> grabber = fg.Grabber()
>
> > results in:
>
> > fg_open(): open video device failed: No such file or directory
>
> > Since the camera works fine in Ubuntu itself my guess is that the
> > problem is with the python libraries (or even likelier, my usage of
> > them). Is there anybody here that was successful in accessing their
> > webcam on linux using Python? Else I have to reside to Windows and
> > VideoCapture (which relies on the win32 api and thus is Windows-only),
> > something I'd rather not do.
>
> > Thanks for any help,
> > 2B
>
> > ===
> > I am uUsing:
> > WebCam: Logitech QuickCam Pro 400
> > Ubuntu
> > Python 2.5
>
> Some time ago I was playing with writing a webcam server under Linux
> using V4L - I found this bit of code which may help (it works for me).
> Obviously it needs X running to work and the associated libs installed.
> Note this is not my code but it was a good starting point for me to work
> from. I can't find a link to the original article but credit to the author.
>
> import pygame
> import Image
> from pygame.locals import *
> import sys
>
> import opencv
> #this is important for capturing/displaying images
> from opencv import highgui
>
> camera = highgui.cvCreateCameraCapture(0)
> def get_image():
>  im = highgui.cvQueryFrame(camera)
>  #convert Ipl image to PIL image
>  return opencv.adaptors.Ipl2PIL(im)
>
> fps = 30.0
> pygame.init()
> window = pygame.display.set_mode((320,240))
> pygame.display.set_caption("WebCam Demo")
> screen = pygame.display.get_surface()
>
> while True:
>  events = pygame.event.get()
>  for event in events:
>  if event.type == QUIT or event.type == KEYDOWN:
>  sys.exit(0)
>  im = get_image()
>  pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
>  screen.blit(pg_img, (0,0))
>  pygame.display.flip()
>  pygame.time.delay(int(1000 * 1.0/fps))
>
> Best of Luck
> Bgeddy

Thank you! That seems to work under both Linux and windows. The opencv
library is the clue here. I've used the ctypes wrapper for opencv
provided by the first link below, but there are more options.

For future reference here are some relevant links:

http://wwwx.cs.unc.edu/~gb/wp/blog/2007/02/04/python-opencv-wrapper-using-ctypes/
http://opencvlibrary.sourceforge.net/
http://opencvlibrary.sourceforge.net/NoamLewis
http://opencvlibrary.sourceforge.net/PythonInterface

Windows specific:
http://www.instructables.com/id/Using-openCV-1.0-with-python-2.5-in-Windows-XP/
http://dip.sun.ac.za/3Dvision/talks/OpenCV_in_Python_on_Windows.pps
http://opencvlibrary.sourceforge.net/NoamLewis

Thanks for all the help.

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


Python on JavaScript VM's (such as V8)?

2008-09-03 Thread Berco Beute
I wonder what it would take to implement Python in JavaScript so it
can run on those fancy new JavaScript VM's such as Chrome's V8 or
Firefox' tracemonkey. Much the same as Python implementations in C#
(IronPython) and Java (Jython). It would certainly bring back the fun
in web application development. Is there anything done in that
direction?

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


Python on Windows XP 64-bit: python not found in registry

2008-09-12 Thread Berco Beute
After first trying to install the beta of Python 2.6 on my Windows XP
64-bit machine I finally succeeded installing 2.5.2. But I still have
a some problem: Installing iPython, PIL, easy_install etc fails saying
that python.exe cannot be found (although I can start the python
interpeter just fine). The problem is that python cannot be found in
the registry. I tried Effbot's solution of adding Python to the
registry, but that doesn't help:

http://effbot.org/zone/python-register.htm

Anybody here that had the same problem and solved it?

Thanks.

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