i have X, Y, random logistic variables, how do I add them given the mean and scale for each?
Logistic distribution. i ran a simulation in python, but i cannot get it to be exact.
i ran a simulation on getting a random number X, Y, and keep score on the value of X + Y. then i did the same for getting a single random number with X + Y ...
For the "q" (quit) option in my program menu, I have the following code:
elif choice == "q":
print()
That worked all right until I put it in an infinite loop, which kept printing blank lines. Is there a method that can quit the program? Else, can you think of another solution?
...
I'm trying to create a multiline button with PyGTK. I have a label added to my subclass of gtk.Button, but I'm having trouble sizing the label to the button. If the label makes it's own size, there is no text wrapping even with label.set_line_wrap(True) because the label simply resizes beyond the bounds of the button. I would set the siz...
I am building music app, where user can do several tasks including but not limited to listening song, like song, recommend song to a friend and extra.
currently I have this model:
class Activity(models.Model):
activity = models.TextField()
user = models.ForeignKey(User)
date = models.DateTimeField(auto_now=True)
so far I t...
Hello,
I am looking for a graphics library for 3D reconstruction research to develop my specific viewer based on some library. OpenGL seems in a low level and I have to remake the wheel everywhere. And I also tried VTK(visualization toolkit). However, it seems too abstract that I need to master many conceptions before I start. Is the...
I'm using the ftplib module to upload files:
files = [ a.txt , b.txt , c.txt ]
s = ftplib.FTP(ftp_server , ftp_user , ftp_pw) # Connect to FTP
for i in range(len(files)):
f = open(files[i], 'rb')
stor = 'stor ' + files[i]
s.storbinary(stor, f)
f.close() # close file
s.quit...
How should I implement reverse AJAX when building a chat application in Django? I've looked at Django-Orbited, and from my understanding, this puts a comet server in front of the HTTP server. This seems fine if I'm just running the Django development server, but how does this work when I start running the application from mod_wsgi? How d...
I have a project idea, but unsure if using Python would be a good idea.
Firstly, I'm a C++ and C# developer with some SQL experience. My day job is C++. I have a project idea i'd like to create and was considering developing it in a language I don't know. Python seems to be popular and has piqued my interests. I definitely use OOP i...
I'm attempting to learn Tkinter with the goal of being able to create a 'real-time' scope to plot data. As a test, I'm trying to draw a polygon on the canvas every time the 'draw' button is pressed. The triangle position is randomized. I have two problems:
There is a triangle on the canvas as soon as the program starts, why and how do ...
I have a large sql dump file ... with multiple CREATE TABLE and INSERT INTO statements. Is there any way to load these all into a SQLAlchemy sqlite database at once. I plan to use the introspected ORM from sqlsoup after I've created the tables. However, when I use the engine.execute() method it complains: sqlite3.Warning: You can only...
Dear everyone, I am following the Many to many relationship described on http://www.sqlalchemy.org/docs/mappers.html#many-to-many
#This is actually a VIEW
tb_mapping_uGroups_uProducts = Table( 'mapping_uGroups_uProducts', metadata,
Column('upID', Integer, ForeignKey('uProductsInfo.upID')),
Column('ugID', Integer, ForeignKey('uGr...
Trying to write a code that searches hash values for specific string's (input by user) and returns the hash if searchquery is present in that line.
Doing this to kind of just learn python a bit more, but it could be a real world application used by an HR department to search a .csv resume database for specific words in each resume.
I'...
In c++ instance variables are private by default,in Python variables are public by default
i have two questions regarding the same:-
1: why Python have all the members are public by default?
2: People say you should your member data should be private
what if i make my data to be public?
what are the disadvantages of this appro...
Could you let me know how I can optimize the following code?
def f(y, list_or_elem):
if getattr(list_or_elem, '__iter__'):
y = max(y, *list_or_elem)
else:
y = max(y, list_or_elem)
...
I need to create a script that extracts some data from a complex Excel 2003 file (with multiple sheets and different tables inside a single sheet) and produces different XML files that need to be validated against a given XSD file.
My preferred language is Python;
to create and validate XML files i would go with lxml.
What do you sugges...
Hello.
My problem is that i want to do something like this in linux console
telnet 192.168.255.28 > process.py
i.e i would like to do some transformation with console telnet output using python script. I'm see Popen in python for this case, but i can't understand how can i get input from telnet if it do not stop all time..
Pleas any id...
Hi,
I'm trying to deploy a war to a Apache Tomcat server (Build 6.0.24) using python (2.4.2) as part of a build process.
I'm using the following code
import urllib2
import base64
war_file_contents = open('war_file.war','rb').read()
username='some_user'
password='some_pwd'
base64string = base64.encodestring('%s:%s' % (username, pas...
Python interpreter has a Global Interpreter Lock, and it is my understanding that extensions must acquire it in a multi-threaded environment. But Boost.Python HOWTO page says the extension function must release the GIL and reacquire it on exit.
I want to resist temptation to guess here, so I would like to know what should be GIL locking...
This question is built on top of many assumptions. If one assumption is wrong, then the whole thing falls over. I'm still relatively new to Python and have just entered the curious/exploratory phase.
It is my understanding that Python does not support the creating of classes that cannot be subclassed (final classes). However, it seems t...
Hello, I'm using django to create a application download site. I try to write a model, that the admin can add the different download content dynamically in the admin page. For example I have a software named foobar, it have 3 different version: 1.1, 1.2, 1.3. I would like the user can admin the model by using an add button to add the dow...