Re: Bounds checking

2011-03-18 Thread Katie T
What sort of checks are you making ?  - in general greater than/less than
tend to be fairly optimal, although you might be able to do a faster is
negative test

Katie

On Fri, Mar 18, 2011 at 2:24 PM, Martin De Kauwe mdeka...@gmail.com wrote:

 Hi,

 if one has a set of values which should never step outside certain
 bounds (for example if the values were negative then they wouldn't be
 physically meaningful) is there a nice way to bounds check? I
 potentially have 10 or so values I would like to check at the end of
 each iteration. However as the loop is over many years I figured I
 probably want to be as optimal as possible with my check. Any
 thoughts?

 e.g. this is my solution

 # module contain data
 # e.g. print state.something might produce 4.0
 import state as state

 def main():
for i in xrange(num_days):
# do stuff

# bounds check at end of iteration
bounds_check(state)


 def bounds_check(state):
 check state values are  0 
for attr in dir(state):
if not attr.startswith('__') and getattr(state, attr)  0.0:
print Error state values  0: %s % (attr)
sys.exit()

 if __name__ == __main__:
sys.exit(main())

 thanks

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




-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Katie T
On Fri, Mar 18, 2011 at 3:01 PM, Jean-Michel Pichavant 
jeanmic...@sequans.com wrote:

 Don't check for bounds, fix any bug in the code that would set your values
 out of bounds and use asserts while debugging.

 Otherwise if you really need dynamic checks, it will cost you cpu, for
 sure. Howeverver you could for instance override the __setatttr__ of state
 object, and call the attribute's associated function.


If the codes something critical (i.e. it's used for financial calculations,
hardware control, etc.) it's probably safer to test it dynamically, unless
you only have a finite number of inputs/outputs it's often hard to ensure
you've fixed all the bugs.

Katie
-- 
CoderStack
h http://www.coderstack.co.ukttp://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: possible to run a python script without installing python?

2011-03-15 Thread Katie T
On Tue, Mar 15, 2011 at 8:58 PM, davidj411 davidj...@gmail.com wrote:

 it seems that if I copy the python.exe binary and the folders
 associated with it to a server without python, i can run python.
 does anyone know which files are important to copy and which can be
 omitted?

 i know about py2exe and have had no luck with it.


What's the reason for wanting to avoid installing Python? - are you just
trying to save disk space?

If it's a case of not having admin rights, you can just copy the Python
directory, I don't believe it has any dependencies anywhere else.

Katie
-- 
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numerical representation

2011-03-07 Thread Katie T
The main choices for arbitrary point precision seem to be mpmath (which is
pure python) and GMP (C++ but with python wrapper; GMP is heavily used in
academia)

Links:

http://code.google.com/p/mpmath/

http://gmpy.sourceforge.net/

Katie
-- 
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to gain root privileges

2011-02-17 Thread Katie T
On Wed, Feb 16, 2011 at 9:26 PM, GSO gso...@yahoo.co.uk wrote:
 I'm sure this question is as old as time, but what is the best way to
 gain root privileges?  (Am using Python 2.6.5, pygtk2 v2.16, Gtk
 v2.18.9, on RHEL6.)


Running any kind of script sudo'd is a bad idea, it's very very hard
(in many cases impossible) to do securely. Root permissions in general
should only be used for what they're needed for and nothing else (that
means getting the permission, doing the stuff that needs to be done as
root, and then returning back to normal privs), anything else is just
asking for trouble.

Katine
-- 
CoderStack
http://www.coderstack.co.uk/php-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Developing a program to make a family tree.

2011-01-15 Thread Katie T
On Fri, Jan 14, 2011 at 7:57 PM, Jon Clements jon...@googlemail.com wrote:
 Otherwise, you're in for a struggle, as you need to choose a storage
 back-end, a GUI (wxWindows/GTK/Qt4 etc...), how to handle GEDCOM
 format (unless it's not going to be compatible with other software),
 does it need to produce web pages/reports (and in what formats).

There are a couple of Python gedcom parsers around:

http://ilab.cs.byu.edu/cs460/code/gedcom/gedcom.py

https://github.com/dijxtra/simplepyged


Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fitness data program

2011-01-15 Thread Katie T
On Sat, Jan 15, 2011 at 5:47 PM, Antonio Cardenes
antonio.carde...@gmail.com wrote:
 Hello folks, I'm trying to improve my Phyton skills with a project: A
 fitness program that can correlate measurements (weight and size of various
 body parts), date taken and it has to be able to print a nice graph showing
 improvements (a la Wii Fit)

Scipy + Matplotlib should give you the tools to do correlation stats
and graphing.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python use growing fast

2011-01-10 Thread Katie T
On Mon, Jan 10, 2011 at 10:29 PM, John Nagle na...@animats.com wrote:
 On 1/10/2011 1:02 PM, MRAB wrote:

 On 10/01/2011 20:29, Dan Stromberg wrote:

 I invite folks to check out Tiobe's Language Popularity Rankings:

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

   That's somehow derived from web searches, not from any real data
 source.  Look how far down JavaScript is.

Any measure is arbitrary and subject to biases, what methodology would
you prefer ?


Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CPython on the Web

2011-01-02 Thread Katie T
On Sun, Jan 2, 2011 at 7:26 AM, azakai alonmozi...@gmail.com wrote:
 The idea is that by compiling CPython itself, all the features of the
 language are immediately present, and at the latest version, unlike
 writing a new implementation which takes time and tends to lag behind.
 As to why run it on the web, there could be various uses, for example
 it could allow a simple learning environment for Python, which since
 it's on the web can be entered immediately without any download (and
 would run even in places where Python normally can't, like say an
 iPad).

It looks pretty neat ! - most solutions I've seen involve running
Python in a sandbox environment on the server as opposed to on the
client desktop.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2010-12-30 Thread Katie T
On Thu, Dec 30, 2010 at 12:15 AM, rantingrick rantingr...@gmail.com wrote:

 However i need to stress that my intention is towards a 100% Python
 GUI. Not a binding, not a wrapping (except for OS calls!) but a *real*
 Python GUI. The only thing that i know of at this point is pyGUI
 although there are probably others. Allowing the average Python
 programmer the ability to read OS specific calls written in Python
 would not only benefit their GUI knowledge, but also there knowledge
 of OS's in general.

It's very hard to write a good gui framework, very very few people
have managed to do it well. Microsoft, Sun and Google have all had the
resources to hire very good developers and designers to dedicate to
the task and still haven't managed to do it well.

There's not the expertise or the investment in the Python community to
build a strong Python GUI solution. From an educational viewpoint I
see that there could be value in having a pure Python solution, but in
terms of having a GUI solution that people will actually want to use
in their apps, I'm dubious that it's achievable.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2010-12-29 Thread Katie T
On Wed, Dec 29, 2010 at 11:58 PM, rantingrick rantingr...@gmail.com wrote:

 Then and only then will Python be truly what GvR intended. I want
 everyone here to consider what i am proposing and offer some opinions
 because it is time for change.

What's your opinion of the other gui toolkits with Python bindings
like PyQt and PyGtk?

Katie
-- 
CoderStack
http://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Detection Library/Code

2010-12-28 Thread Katie T
On Tue, Dec 28, 2010 at 12:42 AM, Shashwat Anand
anand.shash...@gmail.com wrote:
 Regarding dictionary lookup+n-gram approach I didn't quite understand what
 you wanted to say.

Run through trigram analysis first, if it identified multiple
languages as being matches within the error margin then split the text
into words, and look up each word in the respective dictionaries to
get a second opinion.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Detection Library/Code

2010-12-27 Thread Katie T
On Mon, Dec 27, 2010 at 7:10 PM, Shashwat Anand
anand.shash...@gmail.com wrote:
 Can anyone suggest a language detection library in python which works on a
 phrase of say 2-5 words.

Generally such libraries work by bi/trigram frequency analysis, which
means you're going to have a fairly high error rate with such small
phrases. If you're only dealing with a handful of languages it may
make more sense to combine an existing library with a simple
dictionary lookup model to improve accuracy.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/perl-jobs-in-london
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-25 Thread Katie T
On Wed, Dec 22, 2010 at 9:43 PM, Sean secr...@gmail.com wrote:
 Anybody know where I can find a Python Development Environment in the
 form of a web app for use with Chrome OS. I have been looking for a
 few days and all i have been able to find is some old discussions with
 python developers talking about they will want one for the OS to be a
 success with them.

Your best bet is probably just to SSH to a *nix box and use something
like vim or emacs. None of the web solutions are anywhere near acceptable.

Katie
--
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Average Salary Report

2010-12-25 Thread Katie T
On Sat, Dec 25, 2010 at 11:38 AM, czarina08 rina...@gmail.com wrote:
 I'm doing a market research report on the average hourly rates for
 Python/Django developers. Any input on this? I do understand that it
 does depend on the location, amount of experience and skills. I'd like
 to hear what are the hourly rates within your area :-) Thanks!

Sector and location have a much bigger impact than language/platform
on salary  (although obviously demand for different languages varies
by sector and location as well).

Katie
--
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help regarding pattern matching

2010-12-15 Thread Katie T
On Wed, Dec 15, 2010 at 9:21 PM, jupiter anil.jupit...@gmail.com wrote:
 Hi People,


 I need some ideas on how to find pattern in random data series like stock 
 chart.


 What I want is to be able to find Head  Shoulder pattern in chart.

Have a look at the references in:

http://www.dpem.tuc.gr/fel/fm2009/Papers/Tsinaslanidis.pdf

They cover a variety of algorithms for detecting such patterns.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help regarding pattern matching

2010-12-15 Thread Katie T
On Thu, Dec 16, 2010 at 2:34 AM, Chris Rebert c...@rebertia.com wrote:
 On Wed, Dec 15, 2010 at 6:22 PM, Katie T ka...@coderstack.co.uk wrote:
 On Wed, Dec 15, 2010 at 9:21 PM, jupiter anil.jupit...@gmail.com wrote:
 Hi People,

 I need some ideas on how to find pattern in random data series like stock 
 chart.

 What I want is to be able to find Head  Shoulder pattern in chart.

 Have a look at the references in:

 http://www.dpem.tuc.gr/fel/fm2009/Papers/Tsinaslanidis.pdf


http://uom-gr.academia.edu/ProdromosTsinaslanidis/Papers/281823/An_Examination_of_the_Head_and_Shoulders_Technical_Pattern_A_Support_of_the_Technical_Analysiss_Subjective_Nature

Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python distribution recommendation?

2010-12-11 Thread Katie T
On Sat, Dec 11, 2010 at 12:43 PM, Octavian Rasnita orasn...@gmail.com wrote:
 Hi,

 Is there a recommended Python distribution for Windows XP?

Either will work, although the python.org one is the more popular and
is likely the one used by most tutorials and beginners guides. The
ActiveState one bundles PyQT if  you want to build apps with GUIs
using QT (although it's fairly trivial to install with the regular
Python as well).

Katie
--
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling FORTAN dll functions from Python

2010-12-08 Thread Katie T
On Tue, Dec 7, 2010 at 11:11 AM, Alex van der Spek zd...@xs4all.nl wrote:

 Does anyone know how to call functions from FORTRAN dlls in Python? Is it
 even possible? I browsed the documentation for Python 2.6.1 and the Python/C
 API comes close to what I would like to do but it is strictly limited to C.

 Unfortunately the passing of arguments in C and FORTRAN is very different,
 not to mention the differences with strings where FORTRAN expects a hidden
 length argument. It could call the FORTRAN dll from C and call the C
 functions from Python but is that my only option?

 For reference: I am using Python 2.6.1 FORTRAN powerstation 4.0. It is not
 an option to translate the FORTRAN code to C (using f2c) as the source code
 is the official ASME version of calculating steam tables.


I've done it before by creating C wrapper function and it was relatively
painless, using C wrappers means that it's much easier to integrate into
other languages as well if you need to do more integration down the line.

Katie
-- 
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list