Q_CreationDate stringlengths 23 23 | Title stringlengths 11 149 | Question stringlengths 25 6.53k | Answer stringlengths 15 5.1k | Score float64 -1 1.2 | Is_accepted bool 2
classes | N_answers int64 1 17 | Q_Id int64 0 6.76k |
|---|---|---|---|---|---|---|---|
2011-06-28 08:44:33.150 | How to inject template code in Plone? | My goal is to inject some HTML-Code in front of every Plone article (between the page's header and the first paragraph)? I'm running Plone 4. Does anyone have a hint on how to realize that?
The other question is: is it possible to place some HTML code randomly in every Plone article? | Perhaps you could approach this from a Javascript way? A lot of applications have like a global js file, that's included in all pages. Starting from that you could modify the DOM easily. | -0.201295 | false | 1 | 1,309 |
2011-06-28 12:28:19.277 | Finding Only HTML Nodes Whose Attributes Match Exactly | I'm working through a Selenium test where I want to assert a particular HTML node is an exact match as far as what attributes are present and their values (order is unimportant) and also that no other attributes are present. For example given the following fragment:
<input name="test" value="something"/>
I am trying t... | There is no way to exclude unexpected attributes with XPath.
So you must find a safer way to locate elements you want. Things that you should consider:
In a form, each input should have a distinct name. The same is true for the form itself. So you can try //form[@name='...']/input[@name='...']
Add a class to the field... | 0 | false | 1 | 1,310 |
2011-06-29 02:30:19.763 | How do i create unittest in pyramid with mongodb? | I have a pyramid project that uses mongodb for storage. Now I'm trying to write a test but how do I specify connection to the mongodb?
More specifically, which database should I connect to (test?) and how do I use fixtures? In Django it creates a temporary database but how does it work in pyramid? | Just create a database in your TestCase.setUp and delete in TestCase.tearDown
You need mongodb running because there is no mongolite3 like sqlite3 for sql
I doubt that django is able to create a temporary file to store a mongodb database. It probably just use sqlite:/// which create a database with a memory storage. | 0.673066 | false | 1 | 1,311 |
2011-06-29 16:18:21.503 | How can one identify children of a child process? | I have a long-running Python program that starts and stops a Postgres server as part of its operation. I stop the server by using subprocess to spawn pg_ctl -m fast. As a fall-back, I check the return code and, if it failed, I then run pg_ctl -m immediate.
The problem is that sometimes both fail. I haven't been able... | The C++ standard does not know of multiprocess systems. There is, therefore, no API for interacting with processes. (After all, how would the standard mandate a multiprocess system on an 8 bit microcontroller?)
Moreover, some platforms (e.g. the Win32 Subsystem on Windows NT) do not keep track of process parent child r... | 0 | false | 1 | 1,312 |
2011-06-30 13:19:04.760 | Special JS operators in python | I'm 'hacking' my router, and I need to rewrite one JS function that takes date in hexdec format and convert it into Y m d
JS code looks like:
return [(((n >> 16) & 0xFF) + 1900), ((n >>> 8) & 0xFF), (n & 0xFF)];
where n is variable in format 0x123456 (e.g. 6 hexdec digits after 0x sign)
found that python has operator... | Use >>. You are removing the sign anyway with the & 0xFF. Note, that you cannot leave out the & part, i.e., (n >> 8) & 0xff, or you'll get the wrong result, as you have already noted. | 0.986614 | false | 1 | 1,313 |
2011-07-01 15:00:16.267 | how to kill process and child processes from python? | for example from bash:
kill -9 -PID
os.kill(pid, signal.SIGKILL) kill only parent process. | When you pass a negative PID to kill, it actually sends the signal to the process group by that (absolute) number. You do the equivalent with os.killpg() in Python. | 1.2 | true | 1 | 1,314 |
2011-07-01 18:51:28.707 | threading - how to get parent id/name? | I looking for the way to get parent ID or name from child thread.
In example, I have main thread as MainThread. In this thread i create a few new threads. Then I use threading.enumerate() to get references to all running thread, pick one of child threads and somehow get ID or name of MainThread. Is any way to do that? | You can have a reference to parent thread on child thread.. and then get it's ID | 0.135221 | false | 1 | 1,315 |
2011-07-02 18:57:02.630 | How to call a python function by name from the C-API? | From the c-api, I would like to call a python function by name. I would then be calling the function with a list of python objects as arguments.
It is not clear to me in the Python documentation how I would get a "Callable" object from the main python interpreter.
Any help appreciated in:
Getting the address from the... | Basically, you use the Python C API to get the module the function is contained in, then query the module dictionary for the function. That's more or less the same what the Python runtime does internally when your Python code invokes a function from somewhere.
Relevant functions from the API to look at are PyImport_Imp... | 1.2 | true | 1 | 1,316 |
2011-07-02 21:17:16.920 | Importing modules with variable paths? | I have dev and production systems.
My production system is different from my dev system in that that it adds one directory to the beginning path.
for eg. on dev system:
main->module1->module2
becomes on production:
project_name->main->module1->module2.
Because of that I have to change all my imports to accommodate for ... | Why not just modify sys.path to include the directory one level down? Then the same imports will work in both places. | 1.2 | true | 1 | 1,317 |
2011-07-04 11:33:43.510 | How to periodically check for the current date from within a program? | I would like to write a tiny calendar-like application for someone as a birthday present (to be run on Ubuntu). All it should do is display a separate picture each day, so whenever it's invoked it should check the date and select the appropriate picture from the collection I would provide, but also, in case it just kee... | Did you think about scheduling the invoke of your script?
For me, the best approach is this:
1.Have two options to run the script:
run_script
run_script --update
2.Schedule the update run in some task scheduler (for example Cron) to be executed daily.
3.When you would want to check the image for current day, simply r... | 0.201295 | false | 1 | 1,318 |
2011-07-04 18:04:47.947 | Math Intensive, Calculation Based Website - Which Language Should I Use? | I am very new to programming. I am familiar with HTML, C++ and learning PHP to start a database.
I want to make a website which tracks a stock price. I have written various algorithms in Matlab however, MATLAB only has a to-Java conversion.
I was wondering what language would be the best to do a lot of calculations. ... | I would do C++ and write them to a database, then using php you can grab them from the same database and show them online, otherwise then java can do all that but make sure all calculations aren't done on the fly since that will kill your server, especially with stocks that can turn into a lot of data. | 0 | false | 2 | 1,319 |
2011-07-04 18:04:47.947 | Math Intensive, Calculation Based Website - Which Language Should I Use? | I am very new to programming. I am familiar with HTML, C++ and learning PHP to start a database.
I want to make a website which tracks a stock price. I have written various algorithms in Matlab however, MATLAB only has a to-Java conversion.
I was wondering what language would be the best to do a lot of calculations. ... | I think you can use PHP or Java Web. | 0 | false | 2 | 1,319 |
2011-07-05 03:49:15.300 | matplotlib.pyplot how to add labels with .clabel? | How can I use pyplot.clabel to attach the file names to the lines being plotted?
plt.clabel(data) line gives the error | You may use plt.annotate or plt.text.
And, as an aside, 1) you probably want to use different variables for the file names and numpy arrays you're loading your data into (what is data in data=plb.loadtxt(data)),
2) you probably want to move the label positioning into the loop (in your code, what is data in the plt.cl... | 0 | false | 1 | 1,320 |
2011-07-05 05:59:58.130 | how to encrypt python source code? | we have a business-critical program implemented in Python. Our boss don't want others, especially our rivals to know how it is designed and implemented. So I have to find a way to encrypt it. I first thought of pyc and pyo, but soon I found that they are likely to be disassembled. I wanna encrypt our source codes, but ... | I would suggest you go back into thinking about this, considering:
Use the right tool for the job
Obfuscation is hard
Other means to achieve your goals
Firstly, Python was not designed to be obfuscated. Every aspect of the language is free and accessible to anybody who wants to inspect or modify it. Being a bytecode ... | 0.999656 | false | 3 | 1,321 |
2011-07-05 05:59:58.130 | how to encrypt python source code? | we have a business-critical program implemented in Python. Our boss don't want others, especially our rivals to know how it is designed and implemented. So I have to find a way to encrypt it. I first thought of pyc and pyo, but soon I found that they are likely to be disassembled. I wanna encrypt our source codes, but ... | separate confidential functionality in C functions and develop SWIG wrappers. If you are using C++, you can consider boost python. | 0.496174 | false | 3 | 1,321 |
2011-07-05 05:59:58.130 | how to encrypt python source code? | we have a business-critical program implemented in Python. Our boss don't want others, especially our rivals to know how it is designed and implemented. So I have to find a way to encrypt it. I first thought of pyc and pyo, but soon I found that they are likely to be disassembled. I wanna encrypt our source codes, but ... | Anything can be reverse engineered. It is not possible to give a user's machine information without the possibility for the user to examine that information. All you can do is make it take more effort.
Python is particularly bad if you have this requirement, because Python bytecode is much easier to read than fully ass... | 0.386912 | false | 3 | 1,321 |
2011-07-05 11:13:55.427 | how to update a wxlistbox from a different class? | i have a wxlistbox in a class and i want to update the data inside the listbox from a different class.Is i possible to reload the class while leave the control from another class?if yes ,how?
eg:
i have two classes,Class A and Class B.In class A there is a wxlistbox.while starting the program class A initilise the wxli... | I would use the SetItems() method, which according to the docs does the following: "Clear and set the strings in the control from a list".
Edit: myListCtrl.SetItems(ListOfStrings)
That will replace all the items in the control with whatever is in the list. | 1.2 | true | 1 | 1,322 |
2011-07-05 17:31:31.970 | Django: how to do get_or_create() in a threadsafe way? | In my Django app very often I need to do something similar to get_or_create(). E.g.,
User submits a tag. Need to see if
that tag already is in the database.
If not, create a new record for it. If
it is, just update the existing
record.
But looking into the doc for get_or_create() it looks like it's not thread... | This must be a very common situation. How do I handle it in a threadsafe way?
Yes.
The "standard" solution in SQL is to simply attempt to create the record. If it works, that's good. Keep going.
If an attempt to create a record gets a "duplicate" exception from the RDBMS, then do a SELECT and keep going.
Django, how... | 1.2 | true | 1 | 1,323 |
2011-07-05 18:22:08.597 | Haskell vs. Python threading model | Maybe there's someone out there with the right interests that will know how to answer this. Basically the question is: What are the differences between the multiprocessing module in Python, and the parallelism in Haskell. For instance: are threads created in Python mapped to OS threads? If so, what if there are more th... | The Python multiprocessing module has nothing to do with threads. It tries to provide an API similar to threading (which does expose threads) with processes underneath.
Python threads are mapped to OS threads, and if you create more threads than cores the exact same thing happens as if you'd do it in C (pthreads, Win A... | 0.995055 | false | 1 | 1,324 |
2011-07-05 19:46:44.530 | Writing UTF-8 friendly parsers in python | I wrote a simple file parser and writer, but then I came across an article talking about the importance of unicode and then it occurred to me that I'm assuming the input file is ascii encoded, which may not be the case all the time, though it would be rare in my situation.
In those rare cases, I would expect UTF-8 enco... | Python natively supports Unicode. If you directly read and write from the first file to the second, then no data is lost as it copies the bytes verbatim. However, if you decode the string and then re-encode it, you'll need to make sure you use the right encoding. | 1.2 | true | 2 | 1,325 |
2011-07-05 19:46:44.530 | Writing UTF-8 friendly parsers in python | I wrote a simple file parser and writer, but then I came across an article talking about the importance of unicode and then it occurred to me that I'm assuming the input file is ascii encoded, which may not be the case all the time, though it would be rare in my situation.
In those rare cases, I would expect UTF-8 enco... | If you are using Python 2.6 or later, you can use the io library and its io.open method to open the files you want. It has an encoding argument which should be set to 'utf-8' in your case. When you read or write the returned file objects, string are automatically en-/decoded.
Anyway, you don't need to do something spec... | 0.201295 | false | 2 | 1,325 |
2011-07-06 16:20:35.447 | Django In-Memory SQLite3 Database | I'm trying to have a purely in-memory SQLite database in Django, and I think I have it working, except for an annoying problem:
I need to run syncdb before using the database, which isn't too much of a problem. The problem is that it needs to create a superuser (in the auth_user table, I think) which requires interacti... | Disconnect django.contrib.auth.management.create_superuser from the post_syncdb signal, and instead connect your own function that creates and saves a new superuser User with the desired password. | 1.2 | true | 1 | 1,326 |
2011-07-06 20:12:27.147 | Calling python script from batch file opens second console | I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can... | Have you tried changing the extension of the python script to .pyw, or just invoke it with pythonw.exe? | 0 | false | 3 | 1,327 |
2011-07-06 20:12:27.147 | Calling python script from batch file opens second console | I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can... | It could be that the .py filetype is associated to pythonw.exe, therefore causing it to open in a new process. Find any .py file, right click it, select properties, and check to see under "Opens with:" what the default interpreter is. | 0 | false | 3 | 1,327 |
2011-07-06 20:12:27.147 | Calling python script from batch file opens second console | I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can... | Ok, so I decided to reinstall python. If I uninstall and reinstall (I was using the windows installer) in the default location, it seems to have no effect. I cleaned out the registry and reinstalled. Still no different. However, if I install python in a different location (other than the default) it seems to run fine. ... | 0 | false | 3 | 1,327 |
2011-07-07 08:34:52.020 | use .pyc files via Jython | I am working on building a web interface for a Python tool. It's being designed using J2EE (Spring).
In the process, I need to make calls to Python functions and hence I am using Jython for the same.
But for some modules I don't have the Python source files, I only have the .pyc files, and a document listing the method... | The 'compiled' python code '.pyc' files are implementation-specific. Even CPython (the standard Python implementation) is not able to import .pyc files generated by a different version of CPython. And is not supposed to. So, I would be surprised if Jython had an ability to run .pyc files created by any of CPython versi... | 0.545705 | false | 1 | 1,328 |
2011-07-07 17:12:41.913 | Python random seed not working with Genetic Programming example code | I am trying to get reproducible results with the genetic programming code in chapter 11 of "Programming Collective Intelligence" by Toby Segaran. However, simply setting seed "random.seed(55)" does not appear to work, changing the original code "from random import ...." to "import random" doesn't help, nor does changin... | I had the same problem just now with some completely unrelated code. I believe my solution was similar to that in eryksun's answer, though I didn't have any trees. What I did have were some sets, and I was doing random.choice(list(set)) to pick values from them. Sometimes my results (the items picked) were diverging ev... | 0.591696 | false | 1 | 1,329 |
2011-07-08 04:17:45.480 | how to disable the window close button in pygame? | In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button? | I don't think there is, because some window managers don't give you the ability to remove the close button. But you can write an event handler such that the close button does whatever you want, including nothing.
Why do you want to prevent the user from closing? If it's just a matter that you would rather provide an in... | 1.2 | true | 2 | 1,330 |
2011-07-08 04:17:45.480 | how to disable the window close button in pygame? | In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button? | Just for the record, another option would be to pass the following argument to the set_mode() method call:
pygame.display.set_mode(..., flags = pygame.NOFRAME)
This however makes the whole frame go away, including the top strip to move the window around and the other buttons, such as minimize, so it's rather overkill f... | 0 | false | 2 | 1,330 |
2011-07-08 18:05:39.537 | Running a Disco map-reduce job on data stored in Discodex | I have a large amount of static data that needs to offer random access. Since, I'm using Disco to digest it, I'm using the very impressive looking Discodex (key, value) store on top of the Disco Distributed File System. However, Disco's documentation is rather sparse, so I can't figure out how to use my Discodex indice... | Never mind, it appears that what I'm doing isn't really meant to be done. It might be possible, but it would be far better to merely use semantic DDFS tags to refer to blobs of data.
The correct use case for Discodex is to store indexes constructed by a Disco map-reduce program that does not need be the input of anothe... | 1.2 | true | 1 | 1,331 |
2011-07-08 21:46:18.087 | How to download python from command-line? | I'm on windows, but I'm using a putty shell to connect to a linux machine, and want to install python 2.7. Can't figure out how to do it. How can I download python from command line? | Well if you are getting into a linux machine you can use the package manager of that linux distro.
If you are using Ubuntu just use apt-get search python, check the list and do apt-get install python2.7 (not sure if python2.7 or python-2.7, check the list)
You could use yum in fedora and do the same.
if you want to ins... | 0 | false | 1 | 1,332 |
2011-07-10 04:52:28.137 | Live countdown clock with django and sql? | If I make a live countdown clock like ebay, how do I do this with django and sql? I'm assuming running a function in django or in sql over and over every second to check the time would be horribly inefficient.
Is this even a plausible strategy?
Or is this the way they do it:
When a page loads, it takes the end datet... | I have also encountered the same problem a while ago.
First of all your problem is not related neither django nor sql. It is a general concept and it is not very easy to implement because of overhead in server.
One solution come into my mind is keeping start time of the process in the database.
When someone request you... | 0 | false | 2 | 1,333 |
2011-07-10 04:52:28.137 | Live countdown clock with django and sql? | If I make a live countdown clock like ebay, how do I do this with django and sql? I'm assuming running a function in django or in sql over and over every second to check the time would be horribly inefficient.
Is this even a plausible strategy?
Or is this the way they do it:
When a page loads, it takes the end datet... | I don't think this question has anything to do with SQL, really--except that you might retrieve an expiration time from SQL. What you really care about is just how to display the timeout real-time in the browser, right?
Obviously the easiest way is just to send a "seconds remaining" counter to the page, either on the ... | 0.386912 | false | 2 | 1,333 |
2011-07-10 21:15:08.507 | Given a bunch of ranges of numbers, get all the numbers within those ranges? | In Python, you can get the numbers in a range by calling range(x,y). But given two ranges, say 5-15, and 10-20 how can you get all the numbers 5-20 without duplicates? The ranges may also be disjoint.
I could concat all the results and then uniquify the list, but is that the fastest solution? | Sort the ranges (x, y) by increasing x values. Now, for each range, if it overlaps the previous range, set your current "big range"'s y value to the current range's y value. If it doesn't, start a new "big range": this one won't overlap any of the previous ones. If the current range is completely included in the curren... | 0.101688 | false | 1 | 1,334 |
2011-07-11 21:22:00.500 | Simplest way to get initial text input in pygame | So, Iv'e got a pygame application. Right now, it takes a command line argument to specify which display to show the main screen on. However, I'm running it on windows, where it's hard to specify command line input to a graphical application.
So, I'd like to have a very very very simple dialog box which pops up, prompts... | Since tkinter is built into Python, it might be better. I prefer wx, but if you just want a few dialogues, tkinter is fine.
You could also just try raw_input('type "1" for low res, "2" for high res'). I think it brings up a dialog window in Windows. | 0.135221 | false | 1 | 1,335 |
2011-07-12 14:51:29.700 | ctypes lib in python | I want to use OpcDaNet.dll in python, I use for that ctypes, but to be able to use the functions I'm intersted in, I have to create an instance of OpcServer Object, how can I do that with Ctypes?
thanks for your answres | In fact,you can't create an instance of OpcServer Object if you use the moudle ctypes.Because C is not Object-Oriented language.If you use C++ to make a .dll file,you should make a C interface,in program such as extern "C",if you return an object in this .dll file,python' function can't recieve this object.If I'm not m... | 0.201295 | false | 1 | 1,336 |
2011-07-12 17:00:38.217 | How to use the option skip-name-resolve when using MySQLdb for Python? | I try to connect to database in a domain from my virtual machine.
It works on XP, but somehow does not work on Win7 and quitting with:
"OperationalError: (1042, "Can't get hostname for your address")"
Now I tried disable Firewall and stuff, but that doesn't matter anyway.
I don't need the DNS resolving, which will onl... | This is an option which needs to be set in the MySQL configuration file on the server. It can't be set by client APIs such as MySQLdb. This is because of the potential security implications.
That is, I may want to deny access from a particular hostname. With skip-name-resolve enabled, this won't work. (Admittedly, acce... | 0.201295 | false | 1 | 1,337 |
2011-07-13 14:39:39.537 | How can I record the number of times something happens over several files? | I'm looking to keep a summary of both the number of times a specific thing happens and when something very important arises. I'll give an example...
My code establishes a ssh connection and runs commands. An exception is raised and handled every time the script loses connection to the ssh server. Let's say this type of... | I assume by multiple files you mean you have multiple separate scripts running and you want to log some consolidated summary of events occurring in all those scripts.
If you have a single script it is easy to do by maintaining a dict and dumping it to a log file or may be overwrite a single summary file, for multiple s... | 1.2 | true | 1 | 1,338 |
2011-07-14 14:17:26.743 | How to allow only selected user login in gae+python application? | I want to upload my application on google app engine
and want to use this by only selected user
so want to know how it possible.
want to use users gmail account. | You basically need to do it in two steps:
Do what systempuntoout's answer said to only allow logged-in users to see your site.
On each of your routes (URL handlers), the first step should be to get their user object and check if they are on a list you're keeping of users allowed to see your app. For a first run, you c... | 1.2 | true | 1 | 1,339 |
2011-07-14 17:10:43.470 | Interactive matplotlib plot with two sliders | I used matplotlib to create some plot, which depends on 8 variables. I would like to study how the plot changes when I change some of them. I created some script that calls the matplotlib one and generates different snapshots that later I convert into a movie, it is not bad, but a bit clumsy.
I wonder if somehow I co... | Use waitforbuttonpress(timeout=0.001) then plot will see your mouse ticks. | 0.135221 | false | 1 | 1,340 |
2011-07-14 21:29:31.157 | Python zeromq -- Multiple Publishers To a Single Subscriber? | I'd like to write a python script (call it parent) that does the following:
(1) defines a multi-dimensional numpy array
(2) forks 10 different python scripts (call them children). Each of them must be able to read the contents of the numpy array from (1) at any single point in time (as long as they are alive).
(3) each... | In ZeroMQ there can only be one publisher per port. The only (ugly) workaround is to start each child PUB socket on a different port and have the parent listen on all those ports.
but the pipeline pattern describe on 0MQ, user guide is a much better way to do this. | -0.265586 | false | 1 | 1,341 |
2011-07-15 15:45:55.277 | Calculating the similarity of two lists | I have two lists:
eg.
a = [1,8,3,9,4,9,3,8,1,2,3]
and
b = [1,8,1,3,9,4,9,3,8,1,2,3]
Both contain ints. There is no meaning behind the ints (eg. 1 is not 'closer' to 3 than it is to 8).
I'm trying to devise an algorithm to calculate the similarity between two ORDERED lists. Ordered is keyword right here (so I can't jus... | Just use the same algorithm for calculating edit distance on strings if the values don't have any particular meaning. | 0.173164 | false | 1 | 1,342 |
2011-07-15 15:56:07.887 | Batch converting Corel Paradox 4.0 Tables to CSV/SQL -- via PHP or other scripts | Recently I've begun working on exploring ways to convert about 16k Corel Paradox 4.0 database tables (my client has been using a legacy platform over 20 years mainly due to massive logistical matters) to more modern formats (i.e.CSV, SQL, etc.) en mass and so far I've been looking at PHP since it has a library devoted ... | This is doubtless far too late to help you, but for posterity...
If one has a Corel Paradox working environment, one can just use it to ease the transition.
We moved the Corel Paradox 9 tables we had into an Oracle schema we built by connecting to the schema (using an alias such as SCHEMA001) then writing this Procedur... | 0.201295 | false | 2 | 1,343 |
2011-07-15 15:56:07.887 | Batch converting Corel Paradox 4.0 Tables to CSV/SQL -- via PHP or other scripts | Recently I've begun working on exploring ways to convert about 16k Corel Paradox 4.0 database tables (my client has been using a legacy platform over 20 years mainly due to massive logistical matters) to more modern formats (i.e.CSV, SQL, etc.) en mass and so far I've been looking at PHP since it has a library devoted ... | If you intend to just convert the data which I guess is a process you do only once you will run the script locally as a command script. For that you don't need a web site and thus XAMPP. What language you take is secondary except you say that PHP has a library. Does python or others have one?
About your concern of erro... | 1.2 | true | 2 | 1,343 |
2011-07-15 18:08:34.853 | how to copy python modules into python lib directory | I have some python modules to copy into my Linux computer.
I found out that I need to copy them into one of the directory that python searches or else show a new path for it.
1. when I tried to copy files into /usr/bin/..../python2.6 .. its not allowing me.
how do I make it.
2. Also do tell me how do I add a new sea... | Make it a proper Python package on top of setuptools and register your command-line frontends using the 'console_scripts' entry-point. | 0.673066 | false | 1 | 1,344 |
2011-07-15 19:16:41.070 | Accessing POST request data from CGIHTTPServer (python) | I have a very simple CGI webserver running using python CGIHTTPServer class.
This class spawns and executes a cgi-php script.
If the webpage sends POST request, how can I access the POST request data in the php script? | When you say your Python process "spawns and executes" a cgi-php script, I believe what you mean is "it calls my PHP script by executing the PHP CLI executable, passing it the name of my script."
Using the PHP CLI executable, HTTP-specific superglobals and environment values will not be set automatically. You would ha... | 1.2 | true | 1 | 1,345 |
2011-07-17 00:21:17.313 | How to use python to read an encrypted folder | I want to design an application that reads some a folder of text files and shows the user its contents. Three problems arise: I need the folder containing the text files to be encrypted which I don't know how to do, two, I need a way to read the encrypted files without revealing the key in the python code, so I guess C... | I think the best thing to do would be to encrypt the individual text files using GPG, one of the strongest encryption systems available(and for free!) You can get several python libraries to do this, and I recommend python-gnupg. Also, you can probably just reference the file where the key is located and distribute it ... | 1.2 | true | 1 | 1,346 |
2011-07-18 16:30:36.190 | How to INTERACT between a program on the server and the user via a web page REAL-TIME | Let me start with an example:
There is a c++ program which can be run on my server, the program is named "Guess the Number" which means every time it runs,
first it will generate an integer between 1 and 100 randomly.
then i need the user to guess a number and pass it to me though a web page, form or something.
now... | This sounds a lot like a homework question, but even with this list, you have a lot of work ahead of you for a dubious reward, so here we go.
Your C++ program should listen on a socket
Your python program needs to listen on a web socket, and also have a connection open to the C++ program through the C++ socket.
I'd s... | 0 | false | 1 | 1,347 |
2011-07-18 18:40:39.970 | How to I get Python 2.x and 3.x to co-exist? | I'm new to programming and thought Python would be a good language to learn. Most of the tutorials I found were 2.7 based so I started to learn using that version. I've recently found a tkinter tutorial that I'd like to try out but I'm having a problem. If I run a script it will use Python 2.7 which contains Tkinter an... | It depends on what you are trying to do. You can have them coexist because 3.2 is backwards-compatible. Now you can install both versions on your computer 3.2 and 2.7, but 3.2 unfortunately will have to be used in IDLE....ugh.... Just install both and then depending on which one you want to use. Run that IDLE for eithe... | 0 | false | 1 | 1,348 |
2011-07-19 10:05:28.330 | Inverse Cosine in Python | Apologies if this is straight forward, but I have not found any help in the python manual or google.
I am trying to find the inverse cosine for a value using python.
i.e. cos⁻¹(x)
Does anyone know how to do this?
Thanks | You're looking for the math.acos() function. | 0.173164 | false | 1 | 1,349 |
2011-07-19 16:28:11.523 | Library or tool to download multiple files in parallel | I'm looking for a python library or a command line tool for downloading multiple files in parallel. My current solution is to download the files sequentially which is slow. I know you can easily write a half-assed threaded solution in python, but I always run into annoying problem when using threading. It is for pollin... | I used the standard libs for that, urllib.urlretrieve to be precise. downloaded podcasts this way, via a simple thread pool, each using its own retrieve. I did about 10 simultanous connections, more should not be a problem. Continue a interrupted download, maybe not. Ctrl-C could be handled, I guess. Worked on Windows,... | 0 | false | 4 | 1,350 |
2011-07-19 16:28:11.523 | Library or tool to download multiple files in parallel | I'm looking for a python library or a command line tool for downloading multiple files in parallel. My current solution is to download the files sequentially which is slow. I know you can easily write a half-assed threaded solution in python, but I always run into annoying problem when using threading. It is for pollin... | You can try pycurl, though the interface is not easy at first, but once you look at examples, its not hard to understand. I have used it to fetch 1000s of web pages in parallel on meagre linux box.
You don't have to deal with threads, so it terminates gracefully, and there are no processes left behind
It provides opt... | 0.278185 | false | 4 | 1,350 |
2011-07-19 16:28:11.523 | Library or tool to download multiple files in parallel | I'm looking for a python library or a command line tool for downloading multiple files in parallel. My current solution is to download the files sequentially which is slow. I know you can easily write a half-assed threaded solution in python, but I always run into annoying problem when using threading. It is for pollin... | Threading isn't "half-assed" unless you're a bad programmer. The best general approach to this problem is the producer / consumer model. You have one dedicated URL producer, and N dedicated download threads (or even processes if you use the multiprocessing model).
As for all of your requirements, ALL of them CAN be don... | -0.040794 | false | 4 | 1,350 |
2011-07-19 16:28:11.523 | Library or tool to download multiple files in parallel | I'm looking for a python library or a command line tool for downloading multiple files in parallel. My current solution is to download the files sequentially which is slow. I know you can easily write a half-assed threaded solution in python, but I always run into annoying problem when using threading. It is for pollin... | There are lots of options but it will be hard to find one which fits all your needs.
In your case, try this approach:
Create a queue.
Put URLs to download into this queue (or "config objects" which contain the URL and other data like the user name, the destination file, etc).
Create a pool of threads
Each thread shoul... | 0.201295 | false | 4 | 1,350 |
2011-07-19 23:18:53.013 | Check the exit status of last command in ipython | Does anybody know how to check the status of the last executed command (exit code) in ipython? | It should be stored as _exit_code after you run the command (at least in the upcoming v0.11 release). | 0.999953 | false | 1 | 1,351 |
2011-07-20 15:21:05.050 | Optimizing your PyQt applications | For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger:
I have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a ... | I'm not sure if this is exactly the same thing you are doing, but it sounds similar to something I have in some apps, where there is some list of custom widget. And it does significantly slow down when you are creating and destroying tons of widgets.
If its an issue of lesser amounts of total widgets, but just being cr... | 1.2 | true | 2 | 1,352 |
2011-07-20 15:21:05.050 | Optimizing your PyQt applications | For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger:
I have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a ... | Are you using QNetworkAccessManager to load you images? It has cache support. Also it loads everything in background with finishing callbacks.
I don't really understand what your dashboard is doing. Have you think about using QWebkit? Maybe your dashboard content is easy to be implemented in HTML?
PS. I don't like thre... | 0.201295 | false | 2 | 1,352 |
2011-07-22 15:00:33.983 | put stream from tcpdump into an array - which python version should i use? | i want to use python in combination with tcpdump to put the generated stream from tcpdump into a more readable way. There are some fields in the streams with interesting values.
I found some stuff here at stackoverflow regarding python and tcpdump but in my mind the best way is to put it in an array.
After this is done... | You can try using Scapy sniffing function sniff, append the captured packets to a list and do your extraction process. | 0 | false | 1 | 1,353 |
2011-07-22 20:20:08.850 | Numpy: arr[...,0,:] works. But how do I store the data contained in the slice command (..., 0, :)? | In Numpy (and Python in general, I suppose), how does one store a slice-index, such as (...,0,:), in order to pass it around and apply it to various arrays? It would be nice to, say, be able to pass a slice-index to and from functions. | I think you want to just do myslice = slice(1,2) to for example define a slice that will return the 2nd element (i.e. myarray[myslice] == myarray[1:2]) | 0 | false | 1 | 1,354 |
2011-07-23 17:35:15.290 | Pylint - distinguish new errors from old ones | Does anybody know how to distinguish new errors (those that were found during latest Pylint execution) and old errors (those that were alredy found during previous executions) in the Pylint report?
I'm using Pylint in one of my projects, and the project is pretty big. Pylint reports pretty many errors (even though I di... | Two basic approaches. Fix errors as they appear so that there will be no old ones. Or, if you have no intention of fixing certain types of lint errors, tell lint to stop reporting them.
If you have a lot of files it would be a good idea to get a lint report for each file separately, commit the lint reports to revision ... | 1.2 | true | 2 | 1,355 |
2011-07-23 17:35:15.290 | Pylint - distinguish new errors from old ones | Does anybody know how to distinguish new errors (those that were found during latest Pylint execution) and old errors (those that were alredy found during previous executions) in the Pylint report?
I'm using Pylint in one of my projects, and the project is pretty big. Pylint reports pretty many errors (even though I di... | Run pylint on dev branch, get x errors
Run pylint on master branch, get y errors
If y > x, which means you have new errors
You can do above things in CI process, before code is merged to master | 0 | false | 2 | 1,355 |
2011-07-23 19:06:22.023 | Best way to do email scheduling on a python web application? | I have a Pyramid web application that needs to send emails such as confirmation emails after registration, newsletters and so forth. I know how to send emails using smtplib in python and I decided on an smtp service (I think sendgrid will do the trick).
The real problem is the scheduling and delay sending of the emails... | The existing solution to which you refer is to run your own SMTP server on the machine, bound only to localhost to prevent any other machines from connecting to it. Since you're the only one using it, submitting a message to it should be close to instantaneous, and the server will handle queuing, retries, etc. If you a... | 0 | false | 2 | 1,356 |
2011-07-23 19:06:22.023 | Best way to do email scheduling on a python web application? | I have a Pyramid web application that needs to send emails such as confirmation emails after registration, newsletters and so forth. I know how to send emails using smtplib in python and I decided on an smtp service (I think sendgrid will do the trick).
The real problem is the scheduling and delay sending of the emails... | In my app, I insert emails in DB table, and I have python script running under cron that checks this table and sends email updating record as sent. | 0 | false | 2 | 1,356 |
2011-07-24 10:30:37.580 | git-python get commit feed from a repository | am working on a code which I would like to retrieve the commits from a repository on github. Am not entirely sure how to do such a thing, I got git-python but most the api's are for opening a local git repository on the same file system.
Can someone advice?
regards, | I really advise using only the command line git, git-python its used for macros or complicated things, not just for pulling, pushing or cloning :) | 0.101688 | false | 1 | 1,357 |
2011-07-25 18:49:58.233 | python: executing "start /wait someprocess" | I've used Python's subprocess.call() before, but how do you get it to act like the Windows START /WAIT myprogram?
I've tried subprocess.call(['start', '/wait', 'myprogram.exe']) but it can't find start and neither can I. | If you want to wait for a spawned process, then use subprocess.Popen and then either wait or communicate. start is AFAIR a shell construct, not a real exec (so you'd have to use shell = True — but that still wouldn't do what you want). | 1.2 | true | 1 | 1,358 |
2011-07-25 22:47:55.380 | Python on IIS: how? | I've got a background in PHP, dotNet and am charmed by Python. I want to transpose functionality from PHP to Python step by step, running bits and pieces side-by-side. During this transition, which could take 2 years since the app is enormous, I am bound to IIS. I've got 15 years background of web-programming, includin... | just make sure the path to the directory holding the cgi scripts doesn't have spaces or &.
i tried lots of things for many days and nothing worked then i changed the path and it worked
UPDATE:
If it has spaces, put quotes around the path, but not the %s %s
like this:
"C:\Program Files\Python36\python.exe" %s %s | 0.296905 | false | 1 | 1,359 |
2011-07-27 00:44:43.027 | How can I load an NPAPI plugin in my own application? | The docs I've found on NPAPI plugins explain how to write plugins to be loaded by browsers, but how hard is it to write an application that loads existing NPAPI plugins?
(My ultimate goal here is to find a way to use SWF content inside an application written with Python and wxPython in Linux. I've accomplished this on ... | Your best bet (assuming basing your hosting code on open source software isn't an issue for you licensing-wise) is probably to look at the implementation of NPAPI host in WebKit, Chromium, and/or Gecko.
The Mozilla documentation for the browser side of NPAPI will help, but there are a lot of little corner cases where p... | 0 | false | 1 | 1,360 |
2011-07-29 07:51:12.170 | Resize Tkinter Window FROM THE RIGHT (python) | I'm not sure on how to articulate this...
I have a Tkinter window, and I need to hide half of this window when a button is pressed.
However, I need the left-most side to be hidden, so that the window is now half the size it originally was,
and shows the right half of the original window.
All of Tkinter's resize fu... | You can use right-anchored geometry specifications by using a minus sign in the right place:
123x467-78+9
However, I don't know if this will work on Windows (the above is an X11 trick, and I don't know if it is implemented in the platform-compatibility layer or not); you might have to just calculate the new position gi... | 0.265586 | false | 2 | 1,361 |
2011-07-29 07:51:12.170 | Resize Tkinter Window FROM THE RIGHT (python) | I'm not sure on how to articulate this...
I have a Tkinter window, and I need to hide half of this window when a button is pressed.
However, I need the left-most side to be hidden, so that the window is now half the size it originally was,
and shows the right half of the original window.
All of Tkinter's resize fu... | My IT teacher had a suggestion:
Add a Scrollbar out of sight,
and after resizing the root window,
force the scrollbar to scroll all the way to the right.
(So I guess I'd have to create a canvas,
pack all my widgets to the frame,
pack the frame to the canvas,
configure the canvas with the scrollbar?)
I'm not sure if... | 0 | false | 2 | 1,361 |
2011-07-29 13:52:54.413 | How to get pylint warnings to be marked in the Pydev Eclipse editor margin? | I have pylint installed (works fine on the command line) and set up within Pydev in Eclipse.
Pylint is being triggered OK when I edit files, and is outputting to the Eclipse console.
But, the pylint warnings don't appear as marks in the editor margin (in the same way as compiler warnings and errors)
Newly-generated war... | I had this exact problem today, on a brand new system. I tracked down the cause, and it seems that PyDev refuses to pick up the messages from pylint 0.24.0, which was released on July 20, 2011.
Reverting to the previous version (pylint 0.23.0) seems to have solved the problem. For me, that involved removing everything... | 1.2 | true | 4 | 1,362 |
2011-07-29 13:52:54.413 | How to get pylint warnings to be marked in the Pydev Eclipse editor margin? | I have pylint installed (works fine on the command line) and set up within Pydev in Eclipse.
Pylint is being triggered OK when I edit files, and is outputting to the Eclipse console.
But, the pylint warnings don't appear as marks in the editor margin (in the same way as compiler warnings and errors)
Newly-generated war... | I was having the same problem, and it turned out to be my pylint configuration file (~/.pylintrc by default). Be sure the output-format field is correct. It is under the [REPORTS] section, and the line should be:
output-format=text
If you've ever used pylint with another application (I do with emacs), it might say ou... | 0.16183 | false | 4 | 1,362 |
2011-07-29 13:52:54.413 | How to get pylint warnings to be marked in the Pydev Eclipse editor margin? | I have pylint installed (works fine on the command line) and set up within Pydev in Eclipse.
Pylint is being triggered OK when I edit files, and is outputting to the Eclipse console.
But, the pylint warnings don't appear as marks in the editor margin (in the same way as compiler warnings and errors)
Newly-generated war... | Only modules reachable through PYTHONPATH are passed to pylint, so you need to set your PYTHONPATH correctly in the project options. | -0.081452 | false | 4 | 1,362 |
2011-07-29 13:52:54.413 | How to get pylint warnings to be marked in the Pydev Eclipse editor margin? | I have pylint installed (works fine on the command line) and set up within Pydev in Eclipse.
Pylint is being triggered OK when I edit files, and is outputting to the Eclipse console.
But, the pylint warnings don't appear as marks in the editor margin (in the same way as compiler warnings and errors)
Newly-generated war... | have you tried rebuilding your project? | 0 | false | 4 | 1,362 |
2011-07-29 15:41:35.683 | With python socketserver how can I pass a variable to the constructor of the handler class | I would like to pass my database connection to the EchoHandler class, however I can't figure out how to do that or access the EchoHandler class at all.
class EchoHandler(SocketServer.StreamRequestHandler):
def handle(self):
print self.client_address, 'connected'
if __name__ == '__main__':
conn = MySQ... | It seems that you can't use ForkingServer to share variables because Copy-on-Write happens when a process tries to modify a shared variable.
Change it to ThreadingServer and you'll be able to share global variables. | 0.081452 | false | 1 | 1,363 |
2011-07-29 18:40:32.677 | DNSSEC Sign RRSET using DNSPython | I'm trying to DNSSEC Sign a RRSET, however I am not able finding any references to how to do so using DNSPython. Yes it has dns.dnssec.validate_rrsig(), but I want to DNSSEC sign a rrset, how can this be done?
I've been pooring over the RFC's however I'm obviously lacking something in order to make it work. | Do you really have to do it with DNSPython? Is this a custom name server?
The typical way you normally do it (with bind, for example) is by pre-signing the zone file. The DNSSEC RRSIG does not have any dependency on the connection parameters so we don't really have to do on-the-fly signing. Also, things like NSEC would... | 0 | false | 1 | 1,364 |
2011-07-29 22:51:56.800 | How is transaction managed in Django's admin commands? | I just wonder how is transaction managed in django's admin commands. Commit on save? Commit on success? I can't find related info from official documents. | I'm not too sure, but admin forms don't reach to the commit point unless they meet clean() requirements. After that I guess everything will be committed. This behavior should be sufficient for the default forms in admin. However, for more complex forms, you can create your custom admin form and I'm pretty sure you can ... | -0.201295 | false | 1 | 1,365 |
2011-07-30 09:17:26.167 | Passing parameters to a python script using SL4A on Android | I am trying to get a Python script which I normally run on my PC to run on my Android phone (HTC Hero). I have SL4A running on my phone and have made a few tweaks to the Python script so that this does now run. The problem that I am having is how to pass parameters to the script. I have tried creating a sh script in SL... | I used a round about method to circumvent the problem. First the python script needs to be modified to look for a text file containing the attributes. Now whenever I need to start the script, i have to push the txt file containing the attributes and then start the script. | 1.2 | true | 1 | 1,366 |
2011-07-31 21:22:49.560 | Data Migrations and AppEngine | I've done a lot of development in rails, and am looking into developing projects using python & app engine.
From the demo project and what I've seen so far, I've got a question/concern about app engine projects:
How is data migration handled in app-engine? For example, if I change the name of an entity/table (ex: Texts... | You can't change the name of an entity. It's not permitted.
If you change the name of an attribute in a model (please don't call them columns), AppEngine will ignore the old data in the old field, and return None for the new field. | 0.201295 | false | 1 | 1,367 |
2011-08-01 10:10:52.030 | Python + Django vs. ASP.NET + C#/VB vs PHP? | I know similar questions to this have been asked before, but I'm looking for a more specific answer so here it goes:
I'm a student and am looking to develop a web app. I have little experience with all mentioned and like different aspects of each. I like the Visual Web Dev that can be used to create ASP.NET sites, a a... | I would recomend looking at asp.net mvc and scaffolding. That way you can create good applications quick and effective. | 0 | false | 3 | 1,368 |
2011-08-01 10:10:52.030 | Python + Django vs. ASP.NET + C#/VB vs PHP? | I know similar questions to this have been asked before, but I'm looking for a more specific answer so here it goes:
I'm a student and am looking to develop a web app. I have little experience with all mentioned and like different aspects of each. I like the Visual Web Dev that can be used to create ASP.NET sites, a a... | This question is really too open ended. there is no one true language, otherwise we'd all be using it. As you've seen they all have merit. You didn't mention Java which still holds a lot of clout in enterprise computing.
The only answer is pick one you like and get good at it. You can spends years wishing you'd picked ... | 1.2 | true | 3 | 1,368 |
2011-08-01 10:10:52.030 | Python + Django vs. ASP.NET + C#/VB vs PHP? | I know similar questions to this have been asked before, but I'm looking for a more specific answer so here it goes:
I'm a student and am looking to develop a web app. I have little experience with all mentioned and like different aspects of each. I like the Visual Web Dev that can be used to create ASP.NET sites, a a... | python has a ui like vb, it's called pygtk (pygtk.org), i suggest you learn python, it's the easiest to learn, and you don't have to write as much as you would in .net
php is powerful, and you have to learn it, you just have to, but for big complicated web apps, I rather choose ruby on rails or even better django
which... | 0.135221 | false | 3 | 1,368 |
2011-08-01 20:28:58.750 | Copying files recursively with skipping some directories in Python? | I want to copy a directory to another directory recursively. I also want to ignore some files (eg. all hidden files; everything starting with ".") and then run a function on all the other files (after copying them). This is simple to do in the shell, but I need a Python script.
I tried using shutil.copytree, which has ... | If you're on Python 2.6 or higher, you can simply use shutil.copytree and its ignore argument. Since it gets passed all the files and directories, you can call your function from there, unless you want it to be called right after the file is copied.
If that is the case, the easiest thing is to copy and modify the copyt... | 0.673066 | false | 1 | 1,369 |
2011-08-02 07:52:00.260 | Fun with GAE: using key_name as PK? | I want to insert new entities programatically as well as manually. For this I was thinking about using key_name to uniquely identify an entity.
The problem is that I don't know how to get the model to generate a new unique key name when I create the entity.
On the other hand, I cannot create the ID (which is unique acr... | I don't really understand your question. If you want an automatically-generated key name, just leave out the key when you instantiate the object - one will be automatically assigned when you call put(). | 0.135221 | false | 1 | 1,370 |
2011-08-02 08:23:41.113 | Serve Media Files Via Apache on a Django Development Server? | For some reason i can't figure out, other than the 'stupid' errors that keep creeping up when I try to access media files (files uploaded by the user) in my Django app, why I just can't server media files!
In this particular case, all I want for example is to be able to serve up images to the front that have been uploa... | It is surely a pro since the django serves the requests faster without having to deal with the media.
A con is that, if and when you edit the media, you need to also restart the apache, for the media to refresh.
update based on your comment:
You can of-course easily do it. One simple way I practice this is, by using th... | 0 | false | 2 | 1,371 |
2011-08-02 08:23:41.113 | Serve Media Files Via Apache on a Django Development Server? | For some reason i can't figure out, other than the 'stupid' errors that keep creeping up when I try to access media files (files uploaded by the user) in my Django app, why I just can't server media files!
In this particular case, all I want for example is to be able to serve up images to the front that have been uploa... | First, mod_python is not recommended. In fact, it's specifically recommended against. Use mod_wsgi instead.
Secondly, we have no possible way of telling what you're doing wrong when serving static media via the dev server, because you have provided no code or details of your setup.
Finally, there is no reason why you c... | 0 | false | 2 | 1,371 |
2011-08-02 19:16:04.187 | How to generate checksum from hex byte using python | I am creating a Hex file using python and at the end I need to add a checksum that consists of sum of all hex values so that checksum = Byte 0x000000 + Byte 0x000001 +…+ Byte 0x27DAFF (not including this 4 bytes). This checksum shall then be written to buffer at position 0x27DB00-0x27DB03 as unsigned long.
Any good ide... | Thanks !!!
the following two solutions worked;
checksum = sum(map(ord, b))
or
checksum = sum(bytearray(b))
/ J | 0.999329 | false | 1 | 1,372 |
2011-08-03 14:28:36.350 | How may I override the compiler (GCC) flags that setup.py uses by default? | I understand that setup.py uses the same CFLAGS that were used to build Python. I have a single C extension of ours that is segfaulting. I need to build it without -O2 because -O2 is optimizing out some values and code so that the core files are not sufficient to pin down the problem.
I just need to modify setup.py so ... | I ran into this problem when I needed to fully remove a flag (-pipe) so I could compile SciPy on a low-memory system. I found that, as a hack, I could remove unwanted flags by editing /usr/lib/pythonN.N/_sysconfigdata.py to remove every instance of that flag, where N.N is your Python version. There are a lot of duplica... | 0.496174 | false | 1 | 1,373 |
2011-08-03 14:59:27.273 | how to get uuid of a device using udev | I want get the mount node of an usb mass-storage device, like /media/its-uuid
in pyudev, class Device has some general attributes, but not uuid or mount node.
how to do it
thanks help | With pyudev, each device object provides a dictionary-like interface for its attributes. You can list them all with device.keys(), e.g. UUID is for block devices is dev['ID_FS_UUID']. | 0.545705 | false | 1 | 1,374 |
2011-08-04 04:37:41.810 | Checking the status of a sent email in django | I have a simple mail sending application which runs in python using Django. After sending an email is there a way to see if the recipient has opened it or is it still un-opened?
if so how can i do it? | You have no other way than generate confirm url in your message like most sites registrations do. If person would be glad to register on your website, he will certainly click confirm at his email client of any sort. Otherwise it's a spam/scam email.
There is no way you can do it and know it's a live e-mail for sure...
... | 0.135221 | false | 2 | 1,375 |
2011-08-04 04:37:41.810 | Checking the status of a sent email in django | I have a simple mail sending application which runs in python using Django. After sending an email is there a way to see if the recipient has opened it or is it still un-opened?
if so how can i do it? | You can try setting require return receipt flag on the email you are sending. But, a lot of people (I know I do) ignore that return receipt so you will never find out in those cases.
If you are asking for a 100% certain method of finding out if the recipient read his/her email, then the straight answer is: NO, you can'... | 0.386912 | false | 2 | 1,375 |
2011-08-04 12:15:27.427 | how to split pdf file into multiple pdf files by specific word? | I have one pdf file. I want to split that file into multiple pdf files
by some specific word from that file. how can i do that in python ? | Have a look at pdftk. It is a toolbox for working with pdf files. You can integrate it into python with the subprocess module. | 0.386912 | false | 1 | 1,376 |
2011-08-06 13:22:56.023 | Python private class variables that aren't class variables | When trying to access __variables from a class, the parser assumes the 2 underscores are private relative to the current class. Notice how an unrelated function gets a "private" variable.
Is this a bug?
>>> def f(): pass
...
>>> class A:
... def g(self):
... f.__x = 1
... def h():
... ... | Here’s a way to declare private variables: overload the __setattr__ (and other many methods about attributes) method, in the method, you can check current executing method is in the own class. If it is true, let it pass. Otherwise, you can raise an exception, or you can use your own customize error handle logic. (Tips:... | 0 | false | 1 | 1,377 |
2011-08-07 21:46:04.987 | How to connect Python to VirtualBox using RDP or RFB? | Is there a way to access the screen of a stock version of a headless VirtualBox 4.x remotely using RDP with Python or access it using the VNC protocol?
I want to be able to access the boot screen (F12), too, so I cannot boot a VNC server in the Guest as the Guest is not yet booted.
Note that I already have an RFB versi... | Have you considered Jython, which ought to be able to integrate natively with the Java library you already have? | 0 | false | 1 | 1,378 |
2011-08-08 08:38:55.890 | Disable option to move FeinCMS contenttypes within a region | I'd like to disable the option to move FeinCMS contenttypes whithin a region.
Does anyone have any suggestions how to accomplish this? | No, that's not possible currently.
What's the reasoning behind this feature request? | 0.673066 | false | 1 | 1,379 |
2011-08-08 15:38:31.680 | django: admin site not formatted | I have a mostly entirely plain django project, with no adding of my own media or customization of the admin interface in any way. Running the server with python manage.py runserver results in a nicely-formatted admin interface. Running the server with gunicorn_django does not. Why is this the case, and how can I fix it... | If you use contrib.static, you have to execute a collectstatic command to get all the app-specific static files (including admin's own) into the public directory that is served by gunicorn. | 0.081452 | false | 1 | 1,380 |
2011-08-09 16:34:54.987 | how to use 'extent' in matplotlib.pyplot.imshow | I managed to plot my data and would like to add a background image (map) to it.
Data is plotted by the long/lat values and I have the long/lat values for the image's three corners (top left, top right and bottom left) too.
I am trying to figure out how to use 'extent' option with imshow. However, the examples I found d... | Specify, in the coordinates of your current axis, the corners of the rectangle that you want the image to be pasted over
Extent defines the left and right limits, and the bottom and top limits. It takes four values like so: extent=[horizontal_min,horizontal_max,vertical_min,vertical_max].
Assuming you have longitude a... | 1.2 | true | 1 | 1,381 |
2011-08-10 20:06:11.637 | Django-cms translatable objects | I am implementing payment plans on an multilingual eshop based on django-cms. I need internationalized support for payment plans.
User can enter abritrary number of payment plans (implies standard django models)
Every payment plan must have a description in every language site supports (3 at the moment). Implies basic... | Found the solution. Django-nani. | 0 | false | 1 | 1,382 |
2011-08-11 02:15:58.813 | Django 1.3, how to signal when a post has ended like on ebay? | I'm totally confused and have no idea how to do this, so please forgive me if my description/information is bad.
So I want say to do a notification via django-notification or simply send an e-mail to one of my user when a post of his had ended like on ebay. In my database I have a model which stores the datetime of wh... | As other have said, the best solution is django-celery (https://github.com/ask/django-celery) but it's a little heavyweight if you are low on resources.
In a similar need, I have a middleware that checks the conditions and executes the needed operations (which, in my case, are just changing a boolean in some records of... | 0 | false | 1 | 1,383 |
2011-08-11 14:37:30.293 | How to ensure there are no pdb calls out of debugging configuration? | What do you suggest to get rid of pdb calls on production software?
In my case, I'm developing a django website.
I don't know if I should:
Monkey patch pdb from settings.py (dependding on DEBUG boolean).
Make a pdb wrapper for our project which expose set_trace or print basic log if DEBUG = True
Dissalow comitting b... | The best option would be to have an extensive test suite, and to run the tests before pushing to production. Extraneous pdb breakpoints will prevent the tests from passing.
If you can't do that, then option 2 is the best: write a utility to break into the debugger, and make it sensitive to the state of the settings. ... | 0.135221 | false | 2 | 1,384 |
2011-08-11 14:37:30.293 | How to ensure there are no pdb calls out of debugging configuration? | What do you suggest to get rid of pdb calls on production software?
In my case, I'm developing a django website.
I don't know if I should:
Monkey patch pdb from settings.py (dependding on DEBUG boolean).
Make a pdb wrapper for our project which expose set_trace or print basic log if DEBUG = True
Dissalow comitting b... | The third one. You have to enforce some commit rules. For example, run a serie of tests before a commit, etc. This way, developpers have a simple way to check if a pdb break remain. If someone commit a set_trace, he has to bake a cake for the rest of the team.
This works fine in my company :-)
edit: you may present thi... | 1.2 | true | 2 | 1,384 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.