Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
1,921,771
2009-12-17T13:26:00.000
1
0
1
0
python,django
1,923,475
10
false
1
0
I split almost all views in my apps into a views folder (with an init.py of course). I do not, however, import all of the subviews in the init.py like some of the answers have suggested. It seems to work just fine.
4
172
0
My views.py has become too big and it's hard to find the right view. How do I split it in several files and then import it? Does it involve any speed loss? Can I do the same with models.py?
Split views.py in several files
0.019997
0
0
42,864
1,921,771
2009-12-17T13:26:00.000
1
0
1
0
python,django
32,090,920
10
false
1
0
Suppose if you have a file named: password_generator.py then inside views.py add: from password_generator import * Then you can call that module's function from views.py.
4
172
0
My views.py has become too big and it's hard to find the right view. How do I split it in several files and then import it? Does it involve any speed loss? Can I do the same with models.py?
Split views.py in several files
0.019997
0
0
42,864
1,922,254
2009-12-17T14:47:00.000
2
0
0
1
python,linux,fork,kill,pty
11,804,899
3
false
0
0
Pseudotermials are necessary for some applications that really expect a terminal. An interactive shell is one of these examples but there are many other. The pty.fork option is not there as another os.fork but as a specific API to use a pseudoterminal.
2
14
0
I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines) I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal. What are the ups and downs between the two forks?
Python: when to use pty.fork() versus os.fork()
0.132549
0
0
5,805
1,922,254
2009-12-17T14:47:00.000
11
0
0
1
python,linux,fork,kill,pty
1,923,358
3
true
0
0
The child process created with os.fork() inherits stdin/stdout/stderr from parent process, while the child created with pty.fork() is connected to new pseudo terminal. You need the later when you write a program like xterm: pty.fork() in parent process returns a descriptor to control terminal of child process, so you ...
2
14
0
I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines) I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal. What are the ups and downs between the two forks?
Python: when to use pty.fork() versus os.fork()
1.2
0
0
5,805
1,922,623
2009-12-17T15:42:00.000
0
0
0
0
python,mysql
1,922,710
3
false
0
0
With no code, I can only make a guess: try not closing the cursor until you are done with that connection. I think that calling cursor() again after calling cursor.close() will just give you a reference to the same cursor, which can no longer be used for queries. I am not 100% sure if that is the intended behavior, b...
2
0
0
I am using MySQLdb module of python on FC11 machine. Here, i have an issue. I have the following implementation for one of our requirement: connect to mysqldb and get DB handle,open a cursor, execute a delete statement,commit and then close the cursor. Again using the DB handle above, iam performing a "select" stateme...
MYSQLDB python module
0
1
0
626
1,922,623
2009-12-17T15:42:00.000
0
0
0
0
python,mysql
1,924,766
3
false
0
0
It sounds as though the first cursor is being returned back to the second step.
2
0
0
I am using MySQLdb module of python on FC11 machine. Here, i have an issue. I have the following implementation for one of our requirement: connect to mysqldb and get DB handle,open a cursor, execute a delete statement,commit and then close the cursor. Again using the DB handle above, iam performing a "select" stateme...
MYSQLDB python module
0
1
0
626
1,923,054
2009-12-17T16:46:00.000
15
0
1
0
python,string,integer
1,923,085
8
false
0
0
This sounds a lot like homework, so I'll give you a couple of pieces and let you fill in the rest. To access a single character of string s, its s[x] where x is an integer index. Indices start at 0. To get the integer value of a character it is ord(c) where c is the character. To cast an integer back to a character i...
2
16
0
I want to convert a single character of a string into an integer, add 2 to it, and then convert it back to a string. Hence, A becomes C, K becomes M, etc.
Convert string / character to integer in python
1
0
0
75,600
1,923,054
2009-12-17T16:46:00.000
1
0
1
0
python,string,integer
1,923,074
8
false
0
0
Try ord(), should do the trick :)
2
16
0
I want to convert a single character of a string into an integer, add 2 to it, and then convert it back to a string. Hence, A becomes C, K becomes M, etc.
Convert string / character to integer in python
0.024995
0
0
75,600
1,924,646
2009-12-17T21:14:00.000
0
0
0
1
python,linux,usb,dbus
1,924,715
3
false
0
0
what about using dmesg output to find out the device name (sdc1 etc...) use it right after dbus tells you something is was inserted in USB. you could do tail dmesg for example
1
2
0
I'm working on a utility that will auto mount an inserted USB stick on linux. I have tied into D-Bus to receive notification of when a device is inserted, and that works great. However, I need to determine which device in /dev is mapped to the inserted USB stick. I am getting the D-Bus notification and then scanning th...
Linux USB Mapping Question
0
0
0
2,055
1,925,246
2009-12-17T23:09:00.000
7
0
1
0
python,variables
1,925,252
3
false
0
0
In Python, you don't declare variables as having any type. You just assign to them. A single variable can be assigned objects of different types in succession, if you wanted to do so. "self" is not the type but a naming convention used to refer to the current object, like "this" in Java / C++ (except in Python you co...
1
10
0
i am trying to read a tree structure file in python. I created a class to hold the tree objects. One of the members should hold the parent object. Since the parentObject member is of the same type as the class itself, I need to declare this as an empty variable of type "self". How do I do that in python? Thank you v...
declaring empty class member in python
1
0
0
27,575
1,925,360
2009-12-17T23:39:00.000
-1
0
0
0
java,python,c,rule-engine
1,925,588
10
false
0
0
In effect, Python is a rules engine. "The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc." You need sensors and controllers. You write your "rules" as ordinary Python objects. Your main "program" collects events from your sensors and sends events to your cont...
3
6
0
I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it. The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel o...
Rules Engine in C or Python
-0.019997
0
0
12,216
1,925,360
2009-12-17T23:39:00.000
0
0
0
0
java,python,c,rule-engine
1,936,813
10
false
0
0
Rulecore is indeed written partly in Python. But it does not really matter. You as an user would not see any of these implementation details anyway. The rules are purely declarative and defined using XML. The XML is sent into ruleCore CEP Server as events using a web services or JMS or other protocols.
3
6
0
I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it. The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel o...
Rules Engine in C or Python
0
0
0
12,216
1,925,360
2009-12-17T23:39:00.000
0
0
0
0
java,python,c,rule-engine
2,138,573
10
false
0
0
I know ruleCore has some parts written in Python. But the API uses XML and ActiveMQ or WebServices so it is on a higher abstraction level.
3
6
0
I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it. The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel o...
Rules Engine in C or Python
0
0
0
12,216
1,925,487
2009-12-18T00:12:00.000
1
1
0
0
python,django
1,925,617
3
false
0
0
It's always going to be converted to a string anyway, so why do you care what's being passed in? If you use "%s" % number or even just str(number), then it doesn't matter whether number is a string or an int.
1
2
0
I have built an XML-RPC interface in Python and I need to enforce some stricter typing. For example, passing string '10' instead of int 10. I can clean this up with some type casting and a little exception handling, but I am wondering if there is any other way of forcing type integrity such as something XML-RPC speci...
XML-RPC method parameter data typing in Python
0.066568
0
1
220
1,925,552
2009-12-18T00:29:00.000
0
0
1
1
python,windows,registry,cygwin
2,568,441
3
false
0
0
You can use the HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup\rootdir value for Cygwin 1.7
1
3
0
I'm writing a cross-platform python script that needs to know if and where Cygwin is installed if the platform is NT. Right now I'm just using a naive check for the existence of the default install path 'C:\Cygwin'. I would like to be able to determine the installation path programmatically. The Windows registry doesn'...
Get Cygwin installation path in a Python script
0
0
0
1,626
1,925,718
2009-12-18T01:19:00.000
2
0
1
0
python,multiprocessing
1,926,926
3
true
0
0
I have not used multiprocessing itself, but the problems presented are similar to experience I've had in two other domains: distributed systems, and object databases. Python object identity can be a blessing and a curse! As for general gotchas, it helps if the application you are refactoring can acknowledge that tasks...
1
7
0
We're considering re-factoring a large application with a complex GUI which is isolated in a decoupled fashion from the back-end, to use the new (Python 2.6) multiprocessing module. The GUI/backend interface uses Queues with Message objects exchanged in both directions. One thing I've just concluded (tentatively, but ...
What problems will one see in using Python multiprocessing naively?
1.2
0
0
1,382
1,925,750
2009-12-18T01:30:00.000
2
0
1
1
python,eclipse,ide,pydev
1,925,758
3
false
0
0
Open a new text file and start writing code?
2
0
0
I need major help getting started! I managed to create a new project, and add python.exe as the interpreter. But when the project is created it's blank. How do I start programming? Ugh.
Python programming on Eclipse with Pydev
0.132549
0
0
2,673
1,925,750
2009-12-18T01:30:00.000
4
0
1
1
python,eclipse,ide,pydev
1,925,760
3
true
0
0
Create PyDev project Add "Source Folder" under the project Add "Modules" to the "Source Folder" Get coding :-)
2
0
0
I need major help getting started! I managed to create a new project, and add python.exe as the interpreter. But when the project is created it's blank. How do I start programming? Ugh.
Python programming on Eclipse with Pydev
1.2
0
0
2,673
1,925,852
2009-12-18T02:07:00.000
1
0
1
0
python,eclipse,syntax,pydev
1,925,861
3
false
0
0
In Python, indentation is really important... Have you check your indentation? Also, lose the ; (don't need it). correct: print("hello") or print "hello" (for < 3.0) not correct: ...print("hello") or print "hello" (for < 3.0) where . denotes spaces.
2
13
0
My code: print "Hello World!" I even tried adding a semicolon behind, but everytime I save and run (as Python run) it says: File "E:\Software\Eclipse\Workspace\Python1\src\main.py", line 1 print "Hello World!"; SyntaxError: invalid syntax I have no idea why.
Eclipse (with Pydev) keeps throwing SyntaxError
0.066568
0
0
6,290
1,925,852
2009-12-18T02:07:00.000
35
0
1
0
python,eclipse,syntax,pydev
1,925,868
3
true
0
0
What version of Python are you using? Python 2.X has print as a keyword, but Python 3.X only has print() as a function - you'd need to use print("Hello, World!") instead.
2
13
0
My code: print "Hello World!" I even tried adding a semicolon behind, but everytime I save and run (as Python run) it says: File "E:\Software\Eclipse\Workspace\Python1\src\main.py", line 1 print "Hello World!"; SyntaxError: invalid syntax I have no idea why.
Eclipse (with Pydev) keeps throwing SyntaxError
1.2
0
0
6,290
1,925,974
2009-12-18T02:49:00.000
0
0
0
1
python,sockets,ip-address
1,926,048
2
false
0
0
quick answer - socket.getpeername() (provided that socket is a socket object, not a module) (playing around in python/ipython/idle/... interactive shell is very helpful) .. or if I read you question carefully, maybe socket.getsockname() :)
1
0
0
I need some code to get the address of the socket i just created (to filter out packets originating from localhost on a multicast network) this: socket.gethostbyname(socket.gethostname()) works on mac but it returns only the localhost IP in linux... is there anyway to get the LAN address thanks --edit-- is it possible ...
How to get the LAN IP that a socket is sending (linux)
0
0
1
626
1,926,019
2009-12-18T03:02:00.000
2
0
1
0
python
1,926,050
8
false
0
0
The best way to learn how to do something useful is come up with something useful you want to do. Make sure it's not way out of your league, then do research to accomplish it. That's how a lot of programmers learn languages.
4
0
0
I heard that Python is easy and powerful, but I don't know if I'm on the right track to learn it. I learn from online tutorials, I know basic maths calculation and printing strings, but how long will it take to develop something useful? I don't really know the exact uses of Python, though.
Python programming general questions
0.049958
0
0
624
1,926,019
2009-12-18T03:02:00.000
1
0
1
0
python
1,926,040
8
false
0
0
What other programming background do you have? What programming interests do you have -- web apps, numerical / scientific computations, games, ...? Python is good at many different things, for both beginners and experienced programmers, but the most fruitful approach(es) to it do depend on what you already know, and ...
4
0
0
I heard that Python is easy and powerful, but I don't know if I'm on the right track to learn it. I learn from online tutorials, I know basic maths calculation and printing strings, but how long will it take to develop something useful? I don't really know the exact uses of Python, though.
Python programming general questions
0.024995
0
0
624
1,926,019
2009-12-18T03:02:00.000
0
0
1
0
python
1,926,110
8
false
0
0
Bram who invented bittorrent with python says python is good for writing protocols in addition to aforementioned webapps, games and general purpose. Compared to Java python solves same problem in less code and less ways in longer development and VM time where Java has more ways solve same problem in more code and faste...
4
0
0
I heard that Python is easy and powerful, but I don't know if I'm on the right track to learn it. I learn from online tutorials, I know basic maths calculation and printing strings, but how long will it take to develop something useful? I don't really know the exact uses of Python, though.
Python programming general questions
0
0
0
624
1,926,019
2009-12-18T03:02:00.000
0
0
1
0
python
1,926,200
8
false
0
0
Making a comparison between Python, and other languages would not help, as there is always somebody who would find a reason to prefer one language instead of another. If you want a scripting language that is powerful, but that it is easier to read than perl, that doesn't have a curly bracket syntax, and that allows you...
4
0
0
I heard that Python is easy and powerful, but I don't know if I'm on the right track to learn it. I learn from online tutorials, I know basic maths calculation and printing strings, but how long will it take to develop something useful? I don't really know the exact uses of Python, though.
Python programming general questions
0
0
0
624
1,927,475
2009-12-18T10:44:00.000
0
0
0
0
python,user-interface,tkinter
1,927,946
2
true
0
1
No, there isn't an option. You need to adjust your padding so that the scrollbar doesn't extend all the way to the bottom of the window. Perhaps the easiest way is to add a statusbar that extends across the bottom of the window.
2
1
0
I have a scrollbar widget that ALWAYS hides the last 15 px under the resize button, is there an option to stop this happening on mac or a padding "under" the widget option?\ thanks!
Python - Tkinter - Padding woes
1.2
0
0
204
1,927,475
2009-12-18T10:44:00.000
0
0
0
0
python,user-interface,tkinter
1,927,968
2
false
0
1
Or, you could also try switching to the place() layout manager.
2
1
0
I have a scrollbar widget that ALWAYS hides the last 15 px under the resize button, is there an option to stop this happening on mac or a padding "under" the widget option?\ thanks!
Python - Tkinter - Padding woes
0
0
0
204
1,928,087
2009-12-18T13:04:00.000
0
0
0
0
python,django,unicode
1,931,067
3
false
1
0
As Dominic has said, the generated HTML source code is correct (these are your Japanese characters translated into HTML entities), but we're not sure, if you see the same code rendered in the page (in this case, you have probably set content-type to "text/plain" instead of "text/html" - do you use render_to_response() ...
1
0
0
I have both, django and mysql set to work with UTF-8. My base.html set utf-8 in head. row on my db : +----+--------+------------------------------------------------------------------+-----------------------------+-----------------------------+---------------------+ | id | psn_id | name ...
django + mysql + UTF-8 - Chars are not displayed
0
1
0
312
1,929,018
2009-12-18T15:55:00.000
1
0
0
1
python,user-interface,glade
1,929,138
3
false
0
0
glade is only a program to build gui with gtk so when you ask for a glade object maybe you should ask for gtk widget and in this case textbuffer and textview chould be a solution or maybe treeview and liststore. subprocess.Popen has stdout and stderr arguments that can accept a file-like object. you can create an adapt...
1
2
0
I'm writing a python application that runs several subprocesses using subprocess.Popen objects. I have a glade GUI and want to display the output of these commands (running in subprocess.Popen) in the gui in real time. Can anyone suggest a way to do this? What glade object do I need to use and how to redirect the outpu...
Python GUI (glade) to display output of shell process
0.066568
0
0
3,524
1,929,681
2009-12-18T17:39:00.000
1
1
0
1
python,http,mod-wsgi,tornado
1,929,711
5
false
1
0
You might consider a queuing system with AJAX notification methods. Whenever there is a request for your expensive resource, and that resource needs to be generated, add that request to the queue (if it's not already there). That queuing operation should return an ID of an object that you can query to get its status. N...
3
5
0
We have a web service which serves small, arbitrary segments of a fixed inventory of larger MP3 files. The MP3 files are generated on-the-fly by a python application. The model is, make a GET request to a URL specifying which segments you want, get an audio/mpeg stream in response. This is an expensive process. We're...
Is there a better way to serve the results of an expensive, blocking python process over HTTP?
0.039979
0
0
495
1,929,681
2009-12-18T17:39:00.000
0
1
0
1
python,http,mod-wsgi,tornado
1,929,738
5
false
1
0
It looks like you are doing things right -- just lacking CPU power: can you determine what is the CPU loading in the process of generating these MP3? I think the next thing you have to do there is to add more hardware to render the MP3's on other machines. Or that or find a way to deliver pre-rendered MP3 (maybe you c...
3
5
0
We have a web service which serves small, arbitrary segments of a fixed inventory of larger MP3 files. The MP3 files are generated on-the-fly by a python application. The model is, make a GET request to a URL specifying which segments you want, get an audio/mpeg stream in response. This is an expensive process. We're...
Is there a better way to serve the results of an expensive, blocking python process over HTTP?
0
0
0
495
1,929,681
2009-12-18T17:39:00.000
1
1
0
1
python,http,mod-wsgi,tornado
1,937,378
5
false
1
0
Please define "cascading load", as it has no common meaning. Your most likely problem is going to be if you're running too many Apache processes. For a load like this, make sure you're using the prefork mpm, and make sure you're limiting yourself to an appropriate number of processes (no less than one per CPU, no more ...
3
5
0
We have a web service which serves small, arbitrary segments of a fixed inventory of larger MP3 files. The MP3 files are generated on-the-fly by a python application. The model is, make a GET request to a URL specifying which segments you want, get an audio/mpeg stream in response. This is an expensive process. We're...
Is there a better way to serve the results of an expensive, blocking python process over HTTP?
0.039979
0
0
495
1,930,896
2009-12-18T21:55:00.000
1
0
1
0
python,class
1,931,003
4
false
0
0
I cannot use the following datatypes in defining my class: set, frozenset and dictionaries. It looks like you are going to use list. You can use list's remove method and handle exceptions in appropriate way.
1
0
0
I am defining a class where only a set of integers is used. I cannot use the following datatypes in defining my class: set, frozenset and dictionaries. i need help defining: remove(self,i): Integer i is removed from the set. An exception is raised if i is not in self. discard(self, i): integer i is removed from the s...
Python: Defining a class with only Integers Defined
0.049958
0
0
219
1,930,900
2009-12-18T21:56:00.000
0
0
1
1
python,setuptools,distutils
1,940,353
4
false
0
0
I would subclass distutils.core.Distribution and pass it with distutils.core.setup(distclass=CustomDistribution) - this gives you access to the command-line parameters in the same way that the normal setup has them, and you can do things like adjusting the extensions list in the CustomDistribution.__init__ method. But ...
4
6
0
I have a Python project with mutiple extension modules written in C, which talk to a third-party library. However, depending on the user's environment and options some modules should not be built, and some compiler flags should be enabled/disabled. The problem is that I have to build the list of extension modules bef...
Configuring extension modules with distutils/setuptools
0
0
0
2,010
1,930,900
2009-12-18T21:56:00.000
0
0
1
1
python,setuptools,distutils
6,883,355
4
false
0
0
The config command is designed to be subclassed and used by projects with requirements like yours.
4
6
0
I have a Python project with mutiple extension modules written in C, which talk to a third-party library. However, depending on the user's environment and options some modules should not be built, and some compiler flags should be enabled/disabled. The problem is that I have to build the list of extension modules bef...
Configuring extension modules with distutils/setuptools
0
0
0
2,010
1,930,900
2009-12-18T21:56:00.000
1
0
1
1
python,setuptools,distutils
2,376,647
4
false
0
0
Is there a preferred way to do this? From my experience working with other people's modules, I can say there is certainly not consensus on the right way to do this. I have tried and rejected subclassing bits of distutils -- I found it fragile and difficult to get working across different Python versions and different ...
4
6
0
I have a Python project with mutiple extension modules written in C, which talk to a third-party library. However, depending on the user's environment and options some modules should not be built, and some compiler flags should be enabled/disabled. The problem is that I have to build the list of extension modules bef...
Configuring extension modules with distutils/setuptools
0.049958
0
0
2,010
1,930,900
2009-12-18T21:56:00.000
0
0
1
1
python,setuptools,distutils
1,931,958
4
false
0
0
My own experience with changing distutils has been weak and shaky, so all I can offer are pointers. Take a look at numpy. That has an entire submodule (numpy.distutils) with ways to work with (or work around) distutils. Otherwise, ask the distutils mailing list.
4
6
0
I have a Python project with mutiple extension modules written in C, which talk to a third-party library. However, depending on the user's environment and options some modules should not be built, and some compiler flags should be enabled/disabled. The problem is that I have to build the list of extension modules bef...
Configuring extension modules with distutils/setuptools
0
0
0
2,010
1,931,781
2009-12-19T02:53:00.000
2
0
1
0
python
1,931,795
2
false
0
0
Its define tab size 4 spaces to text editors like vi
2
2
0
Here are the top few lines (all comments) from a python application. What do the first two comment lines indicate? Are they special markers for another app? # -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 # # Istanbul - A desktop recorder # Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) # Po...
What is the use of strings like "-*- Mode: Python -*-" found at the top of some python files?
0.197375
0
0
700
1,931,781
2009-12-19T02:53:00.000
4
0
1
0
python
1,931,807
2
true
0
0
The first line is an emacs thing (although it may also be a vi thing). It basically tells it that it should use python-mode to read the file. You'll usually see this if the file ends in an extension other than .py. As mentioned, the second line deals with spacings.
2
2
0
Here are the top few lines (all comments) from a python application. What do the first two comment lines indicate? Are they special markers for another app? # -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 # # Istanbul - A desktop recorder # Copyright (C) 2005 Zaheer Abbas Merali (zaheerabbas at merali dot org) # Po...
What is the use of strings like "-*- Mode: Python -*-" found at the top of some python files?
1.2
0
0
700
1,932,200
2009-12-19T06:43:00.000
0
0
0
0
python,cryptography,aes,itar
1,932,436
2
false
0
0
i have often seen people rely on an external package for the cryptographic part: you can package your software without the cryptographic package, and tell your user that they have to download and install the cryptographic part from the original publisher. this is effectively moving the responsibility for the cryptogra...
1
1
0
I'm developing a python GUI application and plan on calling external program packaged with my program to do some encryption. I noticed from sites like OpenSSL that talk about export laws regarding cryptography software. If I can't package binary forms of the cryptography software with my application, how can I work aro...
packaging cryptography software and distributing
0
0
0
421
1,933,000
2009-12-19T14:10:00.000
5
0
0
1
python,weblogic,jython,wlst
2,258,690
2
true
1
0
I eventually found the answer. I am posting here for reference. Out of the 5 mentioned tasks, all can be performed with an offline wlst script. All of them have to be performed on the node where AdminServer is supposed to live. Now, for updating the domain information on the second node, there is an nmEnroll command in...
2
3
0
I want to create a cluster with 2 managed servers on 2 different physical machines. I have following tasks to be performed (please correct me if I miss something) Domain creation. Set admin server properties and create AdminServer under SSL Create logical machines for the physical ones Create managed servers create c...
Weblogic domain and cluster creation with WLST
1.2
0
0
3,100
1,933,000
2009-12-19T14:10:00.000
0
0
0
1
python,weblogic,jython,wlst
32,569,619
2
false
1
0
There are two steps missed after the step 1, you need to copy the configuration from the machine where the AdminServer is running run to the other machine in the cluster using the command pack content in Weblogic installation: 1.1 On the machine where the AdminServer is running run ./pack.shdomain=/home/oracle/config/d...
2
3
0
I want to create a cluster with 2 managed servers on 2 different physical machines. I have following tasks to be performed (please correct me if I miss something) Domain creation. Set admin server properties and create AdminServer under SSL Create logical machines for the physical ones Create managed servers create c...
Weblogic domain and cluster creation with WLST
0
0
0
3,100
1,933,451
2009-12-19T16:58:00.000
5
0
1
0
python,python-exec
1,933,462
11
false
0
0
Allowing these function in a context where they might run user input is a security issue, and sanitizers that actually work are hard to write.
5
40
0
I've seen this multiple times in multiple places, but never have found a satisfying explanation as to why this should be the case. So, hopefully, one will be presented here. Why should we (at least, generally) not use exec() and eval()? EDIT: I see that people are assuming that this question pertains to web servers – ...
Why should exec() and eval() be avoided?
0.090659
0
0
16,115
1,933,451
2009-12-19T16:58:00.000
3
0
1
0
python,python-exec
1,933,473
11
false
0
0
Reason #1: One security flaw (ie. programming errors... and we can't claim those can be avoided) and you've just given the user access to the shell of the server.
5
40
0
I've seen this multiple times in multiple places, but never have found a satisfying explanation as to why this should be the case. So, hopefully, one will be presented here. Why should we (at least, generally) not use exec() and eval()? EDIT: I see that people are assuming that this question pertains to web servers – ...
Why should exec() and eval() be avoided?
0.054491
0
0
16,115
1,933,451
2009-12-19T16:58:00.000
5
0
1
0
python,python-exec
1,933,468
11
false
0
0
Same reason you shouldn't login as root: it's too easy to shoot yourself in the foot.
5
40
0
I've seen this multiple times in multiple places, but never have found a satisfying explanation as to why this should be the case. So, hopefully, one will be presented here. Why should we (at least, generally) not use exec() and eval()? EDIT: I see that people are assuming that this question pertains to web servers – ...
Why should exec() and eval() be avoided?
0.090659
0
0
16,115
1,933,451
2009-12-19T16:58:00.000
13
0
1
0
python,python-exec
1,933,555
11
false
0
0
eval() and exec() can promote lazy programming. More importantly it indicates the code being executed may not have been written at design time therefore not tested. In other words, how do you test dynamically generated code? Especially across browsers.
5
40
0
I've seen this multiple times in multiple places, but never have found a satisfying explanation as to why this should be the case. So, hopefully, one will be presented here. Why should we (at least, generally) not use exec() and eval()? EDIT: I see that people are assuming that this question pertains to web servers – ...
Why should exec() and eval() be avoided?
1
0
0
16,115
1,933,451
2009-12-19T16:58:00.000
17
0
1
0
python,python-exec
1,933,723
11
false
0
0
When you need exec and eval, yeah, you really do need them. But, the majority of the in-the-wild usage of these functions (and the similar constructs in other scripting languages) is totally inappropriate and could be replaced with other simpler constructs that are faster, more secure and have fewer bugs. You can, with...
5
40
0
I've seen this multiple times in multiple places, but never have found a satisfying explanation as to why this should be the case. So, hopefully, one will be presented here. Why should we (at least, generally) not use exec() and eval()? EDIT: I see that people are assuming that this question pertains to web servers – ...
Why should exec() and eval() be avoided?
1
0
0
16,115
1,933,621
2009-12-19T17:44:00.000
4
1
1
0
python,deep-copy
1,933,642
1
false
0
0
You basically need to override the existing __deepcopy__ method, which means temporarily setting the object's class to something different -- whether that's acceptable essentially depends on whether the "__deepcopy__ override" needs to affect only one, "top-level" object (in which case the kludge's probably OK), or if...
1
1
0
I have an object which defines a __deepcopy__ method. I would like a function that will deepcopy it not by the method given by it, but in the default way that objects of the class object are copied. How could I do that? I think I could try to code it but there are probably many "gotchas" I won't be thinking of. The rea...
Deepcopy a simple Python object
0.664037
0
0
807
1,933,784
2009-12-19T18:45:00.000
-1
0
1
0
python
1,933,816
4
false
0
0
You can clone the class via inheritance. Otherwise you are just passing around a reference to the class itself (rather than a reference to an instance of the class). Why would you want to duplicate the class anyway? It's obvious why you would want to create multiple instances of the class, but I can't fathom why you...
1
7
0
I have a class A and i want a class B with exactly the same capabilities. I cannot or do not want to inherit from B, such as doing class B(A):pass Still i want B to be identical to A, yet have a different i: id(A) != id(B) Watch out, i am not talking about instances but classes to be cloned.
How do you clone a class in Python?
-0.049958
0
0
5,551
1,934,088
2009-12-19T20:46:00.000
6
0
0
0
python,proxy,screen-scraping,web-crawler,squid
1,934,198
3
true
0
0
Make your crawler have a list of proxies and with each HTTP request let it use the next proxy from the list in a round robin fashion. However, this will prevent you from using HTTP/1.1 persistent connections. Modifying the proxy list will eventually result in using a new or not using a proxy. Or have several connection...
1
10
0
I've got a python web crawler and I want to distribute the download requests among many different proxy servers, probably running squid (though I'm open to alternatives). For example, it could work in a round-robin fashion, where request1 goes to proxy1, request2 to proxy2, and eventually looping back around. Any idea ...
Rotating Proxies for web scraping
1.2
0
1
16,640
1,934,914
2009-12-20T05:03:00.000
0
0
0
1
python,django,google-app-engine
2,988,728
8
false
1
0
I am still very new to Google App engine development, but the interfaces Django provides do appear much nicer than the default. The benefits will depend on what you are using to run Django on the app engine. The Google App Engine Helper for Django allows you to use the full power of the Google App Engine with some Djan...
5
89
0
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Djan...
Why use Django on Google App Engine?
0
0
0
25,088
1,934,914
2009-12-20T05:03:00.000
3
0
0
1
python,django,google-app-engine
1,934,918
8
false
1
0
I have experience using Django and not GAE. From my experiences with Django it was a very simplistic setup and the deployment process was incredibly easy in terms of web projects. Granted I had to learn Python to really get a good hold on things, but at the end of the day I would use it again on a project. This was ...
5
89
0
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Djan...
Why use Django on Google App Engine?
0.07486
0
0
25,088
1,934,914
2009-12-20T05:03:00.000
0
0
0
1
python,django,google-app-engine
1,942,826
8
false
1
0
If you decide to run you app outside of GAE, you can still use Django. You won't really have that much luck with the GAE webapp
5
89
0
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Djan...
Why use Django on Google App Engine?
0
0
0
25,088
1,934,914
2009-12-20T05:03:00.000
51
0
0
1
python,django,google-app-engine
1,934,925
8
false
1
0
Django probably isn't the right choice for you, if you're sure that GAE is right for you. The strengths of the two technologies don't align very well - you completely lose a lot of Django's wonderful orm on GAE, and if you do use it, you write code that isn't really directly suitable to bigtable and the way GAE works. ...
5
89
0
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Djan...
Why use Django on Google App Engine?
1
0
0
25,088
1,934,914
2009-12-20T05:03:00.000
0
0
0
1
python,django,google-app-engine
1,935,061
8
false
1
0
I cannot answer the question but you may want to look into web2py. It is similar to Django in many respects but its database abstraction layer works on GAE and supports most of the GAE functionality (not all but we try to catch up). In this way if GAE works for you great, if it does not, you can move your code to a dif...
5
89
0
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Djan...
Why use Django on Google App Engine?
0
0
0
25,088
1,935,290
2009-12-20T08:52:00.000
3
0
1
1
python,macos,module-search-path
1,935,323
4
true
0
0
I think by default /Library/Python/2.5/site-packages/ is part of your search path. This directory is usually used for third party libraries.
1
1
0
I'm trying to use pywn, a python library for using WordNet. I've played about with python a little under Windows, but am completely new at MacOS X stuff. I'm running under MacOS 10.5.8, so my default Python interpreter is 2.5.1 The pywn instructions say: "Put each of the .py files somewhere in your python search path."...
how do I add a python module on MacOS X?
1.2
0
0
28,430
1,935,636
2009-12-20T12:04:00.000
1
0
0
0
javascript,python
1,935,664
1
true
1
0
You can't pass a variable directly, as JavaScript is running on the client (browser), and Python is running on the server. You could make a XHR (AJAX) request from JavaScript to the server which would then return your values back to JS (JSON could be used here). Or you could put a hidden field to your markup that would...
1
0
0
I'm using pyfacebook on the backend and javascript on the client side. Now if I want to pass a variable to the javascript from pyfacebook. how would I go about doing that, any ideas?
pyfacebook and javascript query
1.2
0
0
66
1,936,080
2009-12-20T15:06:00.000
2
0
0
0
python,django
1,936,102
4
false
1
0
I think Eclipse+Pydev Plugin is a good choice!!
1
3
0
I'm not sure but I believe that Python is -next to Objective-C- somewhat natural to Mac OSX and the Xcode IDE. I might be wrong. So is it a good idea to use Xcode for Django / Python web development when I'm already a bit familiar with Xcode? Actually I only do iPhone dev with it, but now I need a website and I stumble...
Can I do Django & Python web development using Xcode 3.2?
0.099668
0
0
6,512
1,936,085
2009-12-20T15:07:00.000
1
1
1
0
php,python
1,936,148
3
false
0
0
One main difference is, that code formatting (indentation) influences your codes behaviour in Python. PHP is not interested in how you format your code. Furthermore PHP may be able to produce applications outside of webservers and CLIs but is definitely aimed at those two environments while Python is more "all purpose"...
2
4
0
I know PHP a little. But Python is totally new for me. I only know it's something "similar", right? Or wrong? What are the differences I should know?
What are the major differences between Python and PHP?
0.066568
0
0
26,274
1,936,085
2009-12-20T15:07:00.000
16
1
1
0
php,python
1,936,138
3
false
0
0
PHP is a language that's made for the web. You can make GTK and CLI applications with PHP, but it's mainly used for websites. Python is used for a lot of stuff like websites, webservers, game frameworks, desktop and CLI application, IDEs and a lot more. There's also a huge difference in the syntax. PHP has a syntax tha...
2
4
0
I know PHP a little. But Python is totally new for me. I only know it's something "similar", right? Or wrong? What are the differences I should know?
What are the major differences between Python and PHP?
1
0
0
26,274
1,936,190
2009-12-20T15:57:00.000
3
0
1
0
python
1,936,380
15
false
0
0
As others have mentioned, you are correct, no curly braces in Python. Also, you do not have no end or endif or endfor or anything like that (as in pascal or ruby). All code blocks are indentation based.
4
61
0
I was reading that Python does all it's "code blocks" by indentation, rather than with curly braces. Is that right? So functions, if's and stuff like that all appear without surrounding their block with curly braces?
Is it true that I can't use curly braces in Python?
0.039979
0
0
75,574
1,936,190
2009-12-20T15:57:00.000
2
0
1
0
python
15,169,048
15
false
0
0
Yes, code blocks in Python are defined by their indentation. The creators of Python were very interested in self-documenting code. They included indentation in the syntax as a way of innately enforcing good formatting practice. I programmed in Python for a few years and became quite fond of its code structure because...
4
61
0
I was reading that Python does all it's "code blocks" by indentation, rather than with curly braces. Is that right? So functions, if's and stuff like that all appear without surrounding their block with curly braces?
Is it true that I can't use curly braces in Python?
0.02666
0
0
75,574
1,936,190
2009-12-20T15:57:00.000
1
0
1
0
python
55,368,706
15
false
0
0
I will give some thoughts about this question. Admittedly at first I also thought it is strange to write code without curly braces. But after using Python for many years, I think it is a good design. First, do we really need curly braces? I mean, as a human. If you are allowed to use curly braces in Python, won't you ...
4
61
0
I was reading that Python does all it's "code blocks" by indentation, rather than with curly braces. Is that right? So functions, if's and stuff like that all appear without surrounding their block with curly braces?
Is it true that I can't use curly braces in Python?
0.013333
0
0
75,574
1,936,190
2009-12-20T15:57:00.000
12
0
1
0
python
1,936,195
15
false
0
0
Yup :) And there's (usually) a difference between 4 spaces and a tab, so make sure you standardize the usage ..
4
61
0
I was reading that Python does all it's "code blocks" by indentation, rather than with curly braces. Is that right? So functions, if's and stuff like that all appear without surrounding their block with curly braces?
Is it true that I can't use curly braces in Python?
1
0
0
75,574
1,937,286
2009-12-20T22:18:00.000
2
0
0
0
python
1,937,342
5
false
0
0
Is it worth starting with Python 3, or is it still too poorly supported with ports of modules from previous versions? depends on which modules do you want to use. twisted is a "swiss knife" for the network programming and could be a choice for your project but unfortunately it does not support python3 yet. Are there ...
2
2
0
I'd like to get busy with a winter programming project and am contemplating writing an online word game (with a server load of up to, say, 500 users simultaneously). I would prefer it to be platform independent. I intend to use Python, which I have some experience with. For user data storage, after previous experience ...
Word game server in Python, design pros and cons?
0.07983
1
0
1,430
1,937,286
2009-12-20T22:18:00.000
1
0
0
0
python
1,937,370
5
false
0
0
Related to your database choice, I'd seriously look at using Postgres instead of MySQL. In my experiance with the two Postgres has shown to be faster on most write operations while MySQL is slightly faster on the reads. However, MySQL also has many issues some of which are: Live backups are difficult at best, and i...
2
2
0
I'd like to get busy with a winter programming project and am contemplating writing an online word game (with a server load of up to, say, 500 users simultaneously). I would prefer it to be platform independent. I intend to use Python, which I have some experience with. For user data storage, after previous experience ...
Word game server in Python, design pros and cons?
0.039979
1
0
1,430
1,937,622
2009-12-21T00:26:00.000
-11
0
1
0
python,datetime,date
4,472,626
12
false
0
0
If you need something quick, datetime_object.date() gives you a date of a datetime object.
1
848
0
Is there a built-in method for converting a date to a datetime in Python, for example getting the datetime for the midnight of the given date? The opposite conversion is easy: datetime has a .date() method. Do I really have to manually call datetime(d.year, d.month, d.day)?
Convert date to datetime in Python
-1
0
0
523,081
1,938,609
2009-12-21T06:57:00.000
0
0
0
0
python,django,dreamhost
1,939,248
5
false
1
0
Do you have an SMTP server set up anywhere? As people have suggested here, you can easily use gmail, but you are by no means limited to using only Gmails SMTP server. You can create your own on your own hardware if you like, or you can use a number of free SMTP servers out there. I'd say the most fun would be to set up...
2
7
0
Greetings, Does anyone know what are the required fields to have Django send emails when a "500 Internal Server Error" happend? I am hosting my project on Dreamhost and for the life of me I can't get Django to send emails. What are the required fields when hosting on Dreamhost?
Does anyone had success getting Django to send emails when hosting on Dreamhost?
0
0
0
4,627
1,938,609
2009-12-21T06:57:00.000
0
0
0
0
python,django,dreamhost
3,738,431
5
false
1
0
One issue we seem to have found with this gmail work around, is that if you try testing by sending from a gmail account to a dreamhost email that forwards back to the same gmail, the message is dropped. This may be some weird security 'feature' that dreamhost has going.
2
7
0
Greetings, Does anyone know what are the required fields to have Django send emails when a "500 Internal Server Error" happend? I am hosting my project on Dreamhost and for the life of me I can't get Django to send emails. What are the required fields when hosting on Dreamhost?
Does anyone had success getting Django to send emails when hosting on Dreamhost?
0
0
0
4,627
1,938,831
2009-12-21T08:16:00.000
0
0
1
0
python,opengl,merge,pyopengl,line-segment
1,938,889
3
false
0
0
20K segments isn't that much. Also, you'll be lucky when you can merge 10-100 lines per frame, so the speedup by this optimization will be neglectable. The rendering process is probably slow because you create the model again and again. Use glNewList() to save all the rendering commands in an GL render list on the card...
2
1
0
My program uses PyOpenGL (so it's Python) with psyco. I have around 21,000 line segments which I need to render in each frame of my render (unless the user zooms in, in which case line segments are culled and not sent to the card at all). This is currently taking around 1.5 seconds each frame to complete. That's just n...
Merging multiple line segments
0
0
0
2,174
1,938,831
2009-12-21T08:16:00.000
0
0
1
0
python,opengl,merge,pyopengl,line-segment
1,938,914
3
false
0
0
You can define an error metric for merging two line segments into one and then testing all pairs of segments and then merging them if the error is below a certain threshold. One example is this algorithm: Construct a new line segment X from the two points farthest away from each other in the two line segments A and B....
2
1
0
My program uses PyOpenGL (so it's Python) with psyco. I have around 21,000 line segments which I need to render in each frame of my render (unless the user zooms in, in which case line segments are culled and not sent to the card at all). This is currently taking around 1.5 seconds each frame to complete. That's just n...
Merging multiple line segments
0
0
0
2,174
1,938,929
2009-12-21T08:45:00.000
0
0
0
1
python,eclipse,pydev
2,967,350
2
false
0
0
My pydev broke entirely with 1.5.3. I had to downgrade yum downgrade eclipse-pydev and keep yum from updating it ever since.
2
1
0
I installed Pydev 1.5.3 (so that I could get the merged version of Pydev Extensions in core PyDev) in an EasyEclipse 1.3.1 installation. After this, Compare with > Base revision etc. comparison operations stopped working. I had to disable the PyDev 1.5.3 and revert back to the pre-installed Pydev 1.3.13 (part of EasyEc...
pydev 1.5.3 not working fine with Easy Eclipse 1.3.1
0
0
0
228
1,938,929
2009-12-21T08:45:00.000
0
0
0
1
python,eclipse,pydev
2,973,340
2
true
0
0
I am now using PyDev 1.5.6 and its working fine with EasyEclipse (along with SubClipse). The issues in comparison seem to have been resolved. In fact, the file diff in 1.5.6 is looking much more beautiful than before.
2
1
0
I installed Pydev 1.5.3 (so that I could get the merged version of Pydev Extensions in core PyDev) in an EasyEclipse 1.3.1 installation. After this, Compare with > Base revision etc. comparison operations stopped working. I had to disable the PyDev 1.5.3 and revert back to the pre-installed Pydev 1.3.13 (part of EasyEc...
pydev 1.5.3 not working fine with Easy Eclipse 1.3.1
1.2
0
0
228
1,938,945
2009-12-21T08:50:00.000
2
1
0
0
python,api
1,939,043
3
false
0
0
There is Windows Live Contact API for Hotmail/Live mail. Yahoo Contact API for Yahoo also exists, but to this date, no AOL contact api. I would suggest you try openinviter (openinviter.com) to import contacts. Unfortunately, you will not have OAuth capabilities, but it is the best class out there and works with 90+ di...
1
0
0
I've import contacts from gmail by using gdata api, and is there any apis like that for hotmail/live/Aol ?
Is there any libraries could import contacts from hotmail/live/aol account?
0.132549
0
1
637
1,940,150
2009-12-21T13:40:00.000
1
1
0
0
.net,python,xbmc
1,940,200
1
true
0
0
I believe the plugin system is based on Python. You may be able to use IronPython to run some of the plugins in XBMC, although it may not be 100% compatible. You could also take the Python code and create a COM server object in which you could use .NET interop to interface with it.
1
2
0
Is there any way to use xbmc plugins in .net? im thinking about those plugins that provide access to media content like GameTrailers and stuff like that..
Run XBMC plugins in a .net application
1.2
0
0
318
1,940,528
2009-12-21T14:51:00.000
3
0
0
0
python,django,indexing
1,940,751
2
false
1
0
I tend to create a views.py in the root of the project where I keep the index view.
1
21
0
I am working on a site currently (first one solo) and went to go make an index page. I have been attempting to follow django best practices as I go, so naturally I go search for this but couldn't a real standard in regards to this. I have seen folks creating apps to serve this purpose named various things (main, home, ...
Django index page best/most common practice
0.291313
0
0
12,324
1,940,957
2009-12-21T16:03:00.000
0
0
0
1
python,pygtk,subprocess,glade
1,941,109
3
false
0
1
look at gtk.ScrolledWindow.set_placement. (never tried)
1
3
0
I'm writing a python application that has a glade gui. Using subprocess to execute some shell commands in the background. Using a glade GUI which has a scrolledwindow widget and a textview widget inside the scrolledwindow widget. The textview gets populated as the subprocess.Popen object run and display their stdout an...
howto scroll a gtk.scrolledwindow object from python code
0
0
0
2,933
1,943,747
2009-12-22T01:46:00.000
6
0
1
0
python,logging
12,549,515
7
false
0
0
Here's the one piece of the puzzle that the above answers didn't mention... and then it will all make sense: the "root" logger -- which is used if you call, say, logging.info() before logging.basicConfig(level=logging.DEBUG) -- has a default logging level of WARNING. That's why logging.info() and logging.debug() don't...
2
52
0
It appears that if you invoke logging.info() BEFORE you run logging.basicConfig, the logging.basicConfig call doesn't have any effect. In fact, no logging occurs. Where is this behavior documented? I don't really understand.
Python logging before you run logging.basicConfig?
1
0
0
21,028
1,943,747
2009-12-22T01:46:00.000
12
0
1
0
python,logging
1,943,809
7
false
0
0
Yes. You've asked to log something. Logging must, therefore, fabricate a default configuration. Once logging is configured... well... it's configured. "With the logger object configured, the following methods create log messages:" Further, you can read about creating handlers to prevent spurious logging. But t...
2
52
0
It appears that if you invoke logging.info() BEFORE you run logging.basicConfig, the logging.basicConfig call doesn't have any effect. In fact, no logging occurs. Where is this behavior documented? I don't really understand.
Python logging before you run logging.basicConfig?
1
0
0
21,028
1,945,634
2009-12-22T10:57:00.000
11
0
1
0
python,haskell,functional-programming
1,948,986
6
false
0
0
This question highlights one of my pet peeves about the common understanding of functional programming. Having language features like closures and first-class functions do not make a language a functional programming language. Functional programming is as much about a specific style of programming as it is about specif...
3
5
0
Had learned Haskell during a Functional Programming course in school. Had found Haskell a bit difficult to work with. Have now worked a lot on Python. Python is quite easy to work with. Python does support some functional programming constructs. Was thinking of revisiting Functional Programming. What would be a better ...
Which is a more functional programming language, Haskell or Python?
1
0
0
4,113
1,945,634
2009-12-22T10:57:00.000
7
0
1
0
python,haskell,functional-programming
1,945,742
6
false
0
0
While Python does indeed support some functional constructs, Haskell is a functional language. What you also need to consider, is that Haskell is also purely functional and lazy, two concepts that may be the cause of the difficulty you find in Haskell. If this is the case, read on. What you may want to consider, if, of...
3
5
0
Had learned Haskell during a Functional Programming course in school. Had found Haskell a bit difficult to work with. Have now worked a lot on Python. Python is quite easy to work with. Python does support some functional programming constructs. Was thinking of revisiting Functional Programming. What would be a better ...
Which is a more functional programming language, Haskell or Python?
1
0
0
4,113
1,945,634
2009-12-22T10:57:00.000
0
0
1
0
python,haskell,functional-programming
1,945,669
6
false
0
0
What Boldewyn said. Haskell is one of the most "hardcore" functional languages there is, insofar as there simply isn't any way to maintain mutable state. That said, Haskell is (unsurprisingly) wildly different from all the imperative and mixed-model languages most people come in contact with, so there would be a learni...
3
5
0
Had learned Haskell during a Functional Programming course in school. Had found Haskell a bit difficult to work with. Have now worked a lot on Python. Python is quite easy to work with. Python does support some functional programming constructs. Was thinking of revisiting Functional Programming. What would be a better ...
Which is a more functional programming language, Haskell or Python?
0
0
0
4,113
1,947,344
2009-12-22T16:09:00.000
0
1
0
0
python,fastcgi,lighttpd,cherrypy
1,947,457
2
false
1
0
From a system-software-writer's pointer of view: This all depends on how the meta-data about the server process is organized within your daemon (lighttpd or fcgi). Some programs are designed for one time only initialization -- MOSTLY this allows a much simpler and better performing internal programming model. Often it ...
1
5
0
So I'm trying to do more web development in python, and I've picked cherrypy, hosted by lighttpd w/ fastcgi. But my question is a very basic one: why do I need to restart lighttpd (or apache) every time I change my application code, or the code for an underlying library? I realize this question extends from a basic mis...
fastcgi, cherrypy, and python
0
0
0
2,035
1,947,750
2009-12-22T17:06:00.000
5
0
0
0
python,mysql,prepared-statement
2,539,467
7
false
0
0
Using the SQL Interface as suggested by Amit can work if you're only concerned about performance. However, you then lose the protection against SQL injection that a native Python support for prepared statements could bring. Python 3 has modules that provide prepared statement support for PostgreSQL. For MySQL, "ours...
1
51
0
I worked on a PHP project earlier where prepared statements made the SELECT queries 20% faster. I'm wondering if it works on Python? I can't seem to find anything that specifically says it does or does NOT.
Does Python support MySQL prepared statements?
0.141893
1
0
52,874
1,947,904
2009-12-22T17:25:00.000
0
0
1
0
python,class,nested,pickle
69,507,753
7
false
0
0
This seems to work fine in newer versions of Python. I tried it in v3.8 and it was able to pickle and unpickle the nested class.
3
41
0
I have a nested class: class WidgetType(object): class FloatType(object): pass class TextType(object): pass .. and an object that refers the nested class type (not an instance of it) like this class ObjectToPickle(object): def __init__(self): self.type = WidgetType.Tex...
How can I pickle a dynamically created nested class in python?
0
0
0
24,124
1,947,904
2009-12-22T17:25:00.000
1
0
1
0
python,class,nested,pickle
1,949,236
7
false
0
0
Nadia's answer is pretty complete - it is practically not something you want to be doing; are you sure you can't use inheritance in WidgetTypes instead of nested classes? The only reason to use nested classes is to encapsulate classes working together closely, your specific example looks like an immediate inheritance ...
3
41
0
I have a nested class: class WidgetType(object): class FloatType(object): pass class TextType(object): pass .. and an object that refers the nested class type (not an instance of it) like this class ObjectToPickle(object): def __init__(self): self.type = WidgetType.Tex...
How can I pickle a dynamically created nested class in python?
0.028564
0
0
24,124
1,947,904
2009-12-22T17:25:00.000
2
0
1
0
python,class,nested,pickle
1,947,965
7
false
0
0
Pickle only works with classes defined in module scope (top level). In this case, it looks like you could define the nested classes in module scope and then set them as properties on WidgetType, assuming there's a reason not to just reference TextType and FloatType in your code. Or, import the module they're in and use...
3
41
0
I have a nested class: class WidgetType(object): class FloatType(object): pass class TextType(object): pass .. and an object that refers the nested class type (not an instance of it) like this class ObjectToPickle(object): def __init__(self): self.type = WidgetType.Tex...
How can I pickle a dynamically created nested class in python?
0.057081
0
0
24,124
1,948,224
2009-12-22T18:21:00.000
2
0
0
0
python,excel,xlwt,pyexcelerator
20,838,509
3
false
0
0
I have the same issue, running a linux server. i'm going to check creating an ODS or XLSX file with auto-filter by other means, and then convert them with a libreoffice command line to "xls".
1
6
0
I am using Python 2.6 + xlwt module to generate excel files. Is it possible to include an autofilter in the first row with xlwt or pyExcelerator or anything else besides COM? Thanks
How to create an excel file with an autofilter in the first row with xlwt?
0.132549
1
0
6,820
1,948,396
2009-12-22T18:52:00.000
2
0
0
0
python,gtk,pygtk
1,948,993
2
true
0
1
Use gtk.Widget.modify_text and gtk.Widget.modify_base instead of fg and bg.
1
0
0
I want to make the background of a textview widget black and the foreground white. Been trying the .modify_bg and .modify_fg methods, but none affect the way this thing looks. Can anyone suggest anything or is this just not possible?
pygtk: howto change background of a gtk.TextView widget
1.2
0
0
1,612
1,950,218
2009-12-23T01:28:00.000
3
0
1
0
python
1,950,924
6
false
0
0
You have the options presented thus far: Portable Python and Py2Exe. Either can be pretty good. My suggestion: encourage your friends to install Python! As you know, it's free, and simple to install and download. If they want your application bad enough, installing Python will be a no-brainer.
1
12
0
How do I let my friends use my Python programs? They don't have python installed, but they can use command line programs. I don't have the skill to write GUI. Let, say I am writing some calculus calculator, with a lot of custom modules and files. How do I share it?
Distributing Python programs
0.099668
0
0
8,045
1,950,539
2009-12-23T03:30:00.000
0
0
1
0
python
1,950,575
5
false
0
0
The main shortcoming of software-based methods of generating lottery numbers is the fact that all random numbers generated by software are pseudo-random. This may not be a problem for your simple application, but you did ask about a 'specific mathematical philosophy'. You will have noticed that all commercial lottery s...
1
0
1
I know python offers random module to do some simple lottery. Let say random.shuffle() is a good one. However, I want to build my own simple one. What should I look into? Is there any specific mathematical philosophies behind lottery? Let say, the simplest situation. 100 names and generate 20 names randomly. I don't wa...
python lottery suggestion
0
0
0
1,639
1,953,666
2009-12-23T16:06:00.000
3
0
1
0
python,caching,weak-references
1,953,752
1
true
0
0
Maybe I'm not understanding your question, but making a dictionary of weakly referenced values available to your code isn't really any different from making a dictionary of anything else available to your code. I would store a reference to the WeakValueDictionary on: each instance (referenced via self) a class (also ...
1
0
0
I'm currently coding a project in python where I need a sort of cache of generic objects, I have settled on using WeakValueDictionaries for this. These generic objects are often referenced by many other non-generic objects. My main problem though is that I can't seem to wrap my head around a way of making these WeakVal...
Building a weakref cache in python
1.2
0
0
1,227
1,953,989
2009-12-23T16:56:00.000
10
1
1
0
python,testing,ironpython,jython,boost-python
1,954,037
1
true
0
0
The short answer is: Sometimes. Some projects built on top of IronPython may not work with CPython, and some CPython modules that are written in C (e.g. NumPy) will not work with IronPython. On a similar note, while Jython implements the language specification, it has several incompatibilities with CPython (for instanc...
1
7
0
I am pretty sure that python scripts will work in all three, but I want to make sure. I have read here and there about editors that can write CPython, Jython, IronPython and I am hoping that I am looking to much into the distinction. My situation is I have 3 different api's that I want to test. Each api performs the ...
Are CPython, IronPython, Jython scripts compatible with each other?
1.2
0
0
1,142
1,954,840
2009-12-23T19:27:00.000
2
0
1
0
python
1,954,861
2
false
0
0
To access the method, getattr(test, test.method); this way you can bind it to a variable, return it as a function result, pass it as an argument, and so forth. To call it as well, append parenthesized arguments (just parentheses if there are no arguments), for example getattr(test, test.method)().
1
6
0
Say I have a class object named test. test has various methods, one of them is whatever() . I have a variable named method = "whatever" How can I access the method using the variable with test? Thanks!
How do I access a object's method when the method's name is in a variable?
0.197375
0
0
187
1,957,054
2009-12-24T06:36:00.000
26
1
1
0
python,compilation
1,957,814
7
false
0
0
Python, as a dynamic language, cannot be "compiled" into machine code statically, like C or COBOL can. You'll always need an interpreter to execute the code, which, by definition in the language, is a dynamic operation. You can "translate" source code in bytecode, which is just an intermediate process that the interpre...
2
72
0
I am new to the Python programming language. I was wondering if it is possible to compile a program to written in Python. Is it possible to convert Python scripts to some lower level programming languages which then can be compiled to binary code? A developer who is considering to code in Python might want to keep the ...
Is it possible to compile a program written in Python?
1
0
0
159,831
1,957,054
2009-12-24T06:36:00.000
-3
1
1
0
python,compilation
1,957,072
7
false
0
0
python compile on the fly when you run it. Run a .py file by(linux): python abc.py
2
72
0
I am new to the Python programming language. I was wondering if it is possible to compile a program to written in Python. Is it possible to convert Python scripts to some lower level programming languages which then can be compiled to binary code? A developer who is considering to code in Python might want to keep the ...
Is it possible to compile a program written in Python?
-0.085505
0
0
159,831
1,957,237
2009-12-24T07:35:00.000
0
0
0
0
python
1,966,537
3
false
0
0
i found it again. There is a rate()-function in the visual-module. you can use it in the while-loop.
2
0
0
I want to limit the calculation-speed. There was a command for rate per second. Could anybody help me? doesn't rate() work in the newer version of Python? Thanks
frames per seconds
0
0
0
1,903
1,957,237
2009-12-24T07:35:00.000
0
0
0
0
python
1,957,270
3
false
0
0
Using an event loop framework such as Twisted will allow you to schedule your next calculation in the future once you have completed the current calculation, and to sleep until that time.
2
0
0
I want to limit the calculation-speed. There was a command for rate per second. Could anybody help me? doesn't rate() work in the newer version of Python? Thanks
frames per seconds
0
0
0
1,903
1,957,255
2009-12-24T07:43:00.000
5
0
0
0
python,xmpp,twisted,google-talk
2,590,641
2
false
1
0
In this particular case, the better answer to the non-question is that you should not set the from address at all. Every server will happily fill in the blank for you, saving you from figuring out what JID your client has.
1
1
0
Okay, this isn't a question. All the examples of wokkel and twisted I have seen do not properly observe generated resources in the JID. Google talk clients built using wokkel/twisted generally break because they do not set the full JID on responses, resulting in (very hidden, low level) errors like: <message to="exampl...
Why do all twisted/wokkel xmpp examples ignore the proper usage of JID in the xmpp protocol?
0.462117
0
0
1,213
1,957,396
2009-12-24T08:34:00.000
44
0
1
0
python,dictionary
1,957,403
5
true
0
0
Short answer: because they are mutable containers. If a dict was hashed, its hash would change as you changed its contents.
1
29
0
I mean why cant we put key of dict as dict? that means we can't have dictionary having key as another dictionary...
why dict objects are unhashable in python?
1.2
0
0
31,172