Re: How to convert a list of strings into a list of variables

2011-08-18 Thread AB
Hi,

If the «variables» are named attributes you can use getattr.


#
class colors:
red=1
green=2
blue=3

c=colors()

a=['red','green','blue']

for v in a:
print v,getattr(c,v)
#---

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


Re: solve_ivp problem (scipy 1.0.0)

2018-02-20 Thread AB

Hello

I don't know why but my answer got lost somehow, so I'm sending it once 
more, hopefully with better luck.


W dniu 2018-02-19 o 11:02, Thomas Jollans pisze:

On 2018-02-18 14:39, A.Brozi wrote:

Hello

In new "scipy" (1.0.0) I've found procedure "solve_ivp", which makes it
possible to use "events" in order to terminate the ode solution when
some condition is satisfied.
The precise moment of termination (the value of independent variable) is
to be found in "t_events", but I cannot find the dependent variable(s)
value(s) at the termination moment.
Am I missing something? Or it's simply not possible (hopefully 'not yet')?

Regards
Andrzej Brozi


Isn't the solution passed back as ‘y’?


Yes, it is. But the vector "y" contains only values corresponding to the 
time moments given in "t_eval". It doesn't contain the value 
corresponding to the time of event function passing zero.
In this situation a trajectory of a projectile hitting ground will 
terminate at a point above ground.
I've succeeded to find one walk-around for this problem: if the "t_eval" 
vector is not supplied, then the last element of the solution "y" will 
be the desired value.
Using this method it may be necessary to supply some reasonably small 
value of "max_step" (otherwise the solution may contain too few points). 
Unfortunately I don't see a simple way to guarantee the solution not to 
contain too many points (without "t_eval" it will contain all the points 
computed).


Regards
Andrzej Brozi
--
https://mail.python.org/mailman/listinfo/python-list


Interaction between TclTk editor with Python code

2005-05-16 Thread ab
Hi,

I have an editor(front end) that is written in Tcl/Tk.
It has a menu bar, menu buttons, edit boxes, listboxes & comboboxes.
I am invoking this editor from an application that is written in
Python.
all the necessary processing is done in Python and displaying is done
by the Tcl/Tk code.

Now if I make some changes in the GUI, say I change some value in the
editbox or set some value in the list box and click on save in the GUI,
how can I read the changed values from Python?
I mean, how can I get the value changed in the GUI into some Python
variable?

Thanks,
Ab.

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


Uploading files from IE

2006-03-22 Thread AB
All right... I already hated IE.  But, now I do even more.  My scripts 
upload function is working in Firefox, but not in IE.  If I upload a file 
from Internet Explorer I get a file on the system named for the full path 
from the users computer...

example...
They user uploads C:\mydocs\test.jpg
it ends up at /path/to/webdir/C:\mydocs\test.jpg
instead of /path/to/webdir/test.jpg

This only happens in IE.  Firefox, Safari, Opera... all work fine.

This code is to show how I am going about getting the name... not the actual 
code from my program.

upload_dir = "/path/to/webdir/"
myForm = cgi.FieldStorage
ulImage = myForm["ulImage"]
myName = ulImage.filename
newFile = file (os.path.join(upload_dir, myName), 'wb')
while 1:
chunk = ulImage.file.read(10)
if not chunk: break
newFile.write(chunk)
newFile.close()


Thanks for any help.
AG 


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


Re: Uploading files from IE

2006-03-22 Thread AB

"Irmen de Jong" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> AB wrote:
>> All right... I already hated IE.  But, now I do even more.  My scripts 
>> upload function is working in Firefox, but not in IE.  If I upload a file 
>> from Internet Explorer I get a file on the system named for the full path 
>> from the users computer...
>>
>> example...
>> They user uploads C:\mydocs\test.jpg
>> it ends up at /path/to/webdir/C:\mydocs\test.jpg
>> instead of /path/to/webdir/test.jpg
>
> try something like this:
> filename = os.path.basename(fullpathname)

I tried the following with the same result:
myName = ulImage.filename
newFile = file (os.path.join(upload_dir, os.path.basename(myName)), 'wb')

Any other ideas?  Seems like it shouldn't be a browser issue though... 


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


Ruby Programming

2008-01-19 Thread LinkExchange . AB
iTechArt has specialized in Ruby on Rails (ROR) development and
provides a complete software outsourcing services for web development
solutions based on Ruby. We suggest use Ruby framework for developing
database-backed web applications with Ajax on front-end because it's a
great fit for practically any type of web application: collaboration,
community, e-commerce, content management and statistics.

Ruby development environment and technologies:

* Ruby On Rails development framework
* MySQL, PostgreSQL, SQLite, Oracle, MS SQL Server, DB2
* RadRails IDE, ActionWebservice for Ruby
* Linux, Apache, lighttpd
* OOP and software development
* Search engines optimization



http://www.itechart.com/Pages/Subsections/RubyDevelopment.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list