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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12,760,993 |
2012-10-06T15:13:00.000
| -3 | 0 | 1 | 0 |
python,class,dictionary
| 12,761,061 | 4 | false | 0 | 0 |
I would stick to KISS (Keep it simple stupid). If you only want to store values you are better off with a dictionary, because you can dynamically add values at runtime. WRONG:(But you can not add new filds to a class at runtime.)
So classes are useful if they provide state and behaviour.
EDIT: You can add fields to classes in python.
| 1 | 6 | 0 |
I enjoy all the python libraries for scraping websites and I am experimenting with BeautifulSoup and IMDB just for fun.
As I come from Java, I have some Java-practices incorporated into my programming styles. I am trying to get the info of a certain movie, I can either create a Movie class or just use a dictionary with keys for the attributes.
My question is, should I just use dictionaries when a class will only contain data and perhaps almost no behaviour? In other languages creating a type will help you enforce certain restrictions and because of type checks the IDE will help you program, this is not always the case in python, so what should I do?
Should I resort to creating a class only when there's both, behaviour and data? Or create a movie class even though it'll probably be just a data container?
This all depends on your model, in this particular case either one is fine but I'm wondering about what's a good practice.
|
Python: Data Object or class
| -0.148885 | 0 | 0 | 9,206 |
12,761,517 |
2012-10-06T16:24:00.000
| 0 | 0 | 0 | 0 |
python,rsa,hex
| 12,761,645 | 1 | true | 0 | 0 |
Python's representation of your result as 0x1L indicates the number's type and value - however, it doesn't truncate the number at all. While it is stored as a long internally, its value is still just 1 in this case.
| 1 | 0 | 0 |
I've writing a RSA implementation in Python and have now successfully encrypted it however when it prints out the cipher, every time it comes out '0x1L.' I believe this is a long number, however I do not know how to show the full number. If my code is required, I will post in the comments section( It is quite long).
Thanks
|
Full Hexadecimal Representation in Python?
| 1.2 | 0 | 0 | 399 |
12,763,015 |
2012-10-06T19:16:00.000
| 1 | 1 | 0 | 1 |
linux,jar,python-2.7
| 12,763,086 | 2 | false | 0 | 0 |
If you only want it to run on a Linux machine, using Python eggs is the simplest way.
python snake.egg will try to execute the main.py inside the egg.
Python eggs are meant to be packages, and basically is a zip file with metadata files included.
| 1 | 1 | 0 |
Sorry if my title is not correct. Below is the explanation of what i'm looking for.
I've coded a small GUI game (let say a snake game) in python, and I want it to be run on Linux machine. I can run this program by just run command "python snake.py" in the terminal.
However, I want to combine all my .py files into one file, and when I click on this file, it just run my game. I don't want to go to shell and type "python snake.py". I means something like manifest .jar in java.
Could any one help me please? If my explanation is not good enough, please let me know. I'll give some more explanation.
|
How to make an executable for a python project
| 0.099668 | 0 | 0 | 172 |
12,763,440 |
2012-10-06T20:13:00.000
| 4 | 0 | 1 | 0 |
python,heroku
| 38,451,714 | 3 | false | 1 | 0 |
You can run heroku run bash and backup the file then deploy your app run heroku run bash again and remove the new file and replace it with the old one you backed up. Hope it helps
| 1 | 9 | 0 |
I have a project on Heroku. This project allows me to update a JSON file. If update something on Heroku via the project's web interface I see the update. I can close the browser, open it again and the update persists.
Now, I want to push something to this project. If I do, the JSON file will be overwritten. So, I pulled first to get the current project state from heroku. Heroku's prompt says that everything is up to date, which is not true since I changed the JSON file.
Using heroku run ls static/json/ shows the changed file. I need to get this file before pushing to heroku to avoid destroying updates done via the web interface.
|
How to Access files on Heroku?
| 0.26052 | 0 | 0 | 9,743 |
12,763,608 |
2012-10-06T20:31:00.000
| 0 | 0 | 0 | 0 |
python,machine-learning,recommendation-engine,latent-semantic-indexing,topic-modeling
| 14,583,682 | 2 | false | 0 | 0 |
"represent a user as the aggregation of all the documents viewed" : that might work indeed, given that you are in linear spaces. You can easily add all the documents vectors in one big vector.
If you want to add the ratings, you could simply put a coefficient in the sum.
Say you group all documents rated 2 in a vector D2, rated 3 in D3 etc... you then simply define a user vector as U=c2*D2+c3*D3+...
You can play with various forms for c2, c3, but the easiest approach would be to simply multiply by the rating, and divide by the max rating for normalisation reasons.
If your max rating is 5, you could define for instance c2=2/5, c3=3/5 ...
| 2 | 2 | 1 |
I'm trying to come up with a topic-based recommender system to suggest relevant text documents to users.
I trained a latent semantic indexing model, using gensim, on the wikipedia corpus. This lets me easily transform documents into the LSI topic distributions. My idea now is to represent users the same way. However, of course, users have a history of viewed articles, as well as ratings of articles.
So my question is: how to represent the users?
An idea I had is the following: represent a user as the aggregation of all the documents viewed. But how to take into account the rating?
Any ideas?
Thanks
|
User profiling for topic-based recommender system
| 0 | 0 | 0 | 602 |
12,763,608 |
2012-10-06T20:31:00.000
| 1 | 0 | 0 | 0 |
python,machine-learning,recommendation-engine,latent-semantic-indexing,topic-modeling
| 12,764,041 | 2 | false | 0 | 0 |
I don't think that's working with lsa.
But you maybe could do some sort of k-NN classification, where each user's coordinates are the documents viewed. Each object (=user) sends out radiation (intensity is inversely proportional to the square of the distance). The intensity is calculated from the ratings on the single documents.
Then you can place a object (user) in in this hyperdimensional space, and see what other users give the most 'light'.
But: Can't Apache Lucene do that whole stuff for you?
| 2 | 2 | 1 |
I'm trying to come up with a topic-based recommender system to suggest relevant text documents to users.
I trained a latent semantic indexing model, using gensim, on the wikipedia corpus. This lets me easily transform documents into the LSI topic distributions. My idea now is to represent users the same way. However, of course, users have a history of viewed articles, as well as ratings of articles.
So my question is: how to represent the users?
An idea I had is the following: represent a user as the aggregation of all the documents viewed. But how to take into account the rating?
Any ideas?
Thanks
|
User profiling for topic-based recommender system
| 0.099668 | 0 | 0 | 602 |
12,763,814 |
2012-10-06T20:56:00.000
| 0 | 0 | 0 | 0 |
python,web2py
| 21,023,517 | 1 | false | 1 | 0 |
I think you should attack one thing at the time and, for each one, try paste some code that helps a lot. I try to answer the last question: I think you won't be able to do that with crud interface without change the inner code (DO NOT DO THAT!). With SQLFORM, you can, altering CSS on Fields. But, the best and more controllable, although more hard work, is creating custom forms.
| 1 | 1 | 0 |
I'm creating a custom file upload form in Web2Py, and was hoping some more experienced users could help me solve a few issues. Basically, the database ("t_file") is defined in "db_wizard.py", and in the controller, I'm calling crud.create(db.t_file, next=URL('upload')); a form is added in the html file with {{form}}.
There are about a dozen fields created, two of which are selectors, one is a file upload/browse field, and the rest are input boxes. I would like to make the following changes:
-Currently, the selectors default to an empty option. They are defined in the DB file like this:
Field('f_data_real_or_fabricated_bool', 'list:string', requires=IS_IN_SET(['T','F']),
label=T('Real or Fabricated')),
However. when displayed, the first option is empty, and the two other options are below the empty option. Is there a way to get rid of the empty option?
-The regular text input boxes, the selector boxes, and the filename input box are different widths. What is the best way to make them the same width? I've been trying all sorts of things with the CSS, but can't seem to get it.
-Is there a way to use expandable text boxes for some of text input areas?
-I would like the first several input fields to be required, and the rest to be optional. The mandatory fields should appear on the upload page by default, and the rest optional fields should only appear when an "advanced fields" (something along those lines) checkbox is checked. What is the best way to do this?
Can the above changes be made by sticking with the crud.create or crud.* methods, without designing custom forms?
|
Web2Py - Custom File Upload Form with Crud
| 0 | 0 | 0 | 764 |
12,764,463 |
2012-10-06T22:30:00.000
| 0 | 0 | 0 | 0 |
python,open-source,polygon,polyline
| 12,885,734 | 1 | false | 0 | 0 |
I think you can iterate through the points,
And at each point compare to all points examined so far.
If there's a match, close-off a polygon.
Not sure if you're going to get much better than O(n^2).
| 1 | 0 | 0 |
I have a road network shapefile as a polyline and I want to convert this to a polygon layer wherever the network forms a 'hole' or closes in on itself. The problem is a hole could be made from more than one road feature. (i.e. three connecting roads form a hole). This means that I cant just say "if the first feature vertext is equal to the last vertex form a polygon."
I only have access to open source modules (PySAL, shapely etc NOT ArcPy)
Any ideas? Been stuck on this one for way too long!
|
Creating polygon from polyline
| 0 | 0 | 0 | 1,029 |
12,765,039 |
2012-10-07T00:20:00.000
| 2 | 0 | 0 | 0 |
python,search,graph,nodes,breadth-first-search
| 12,765,116 | 1 | true | 0 | 0 |
Not a lot of information to go on, but I suspect the following is your problem. You have to add the nodes to the visited dictionary as soon as they are added to the fringe queue. If you wait until you visit them (i.e. when they reach the head of the fringe queue) then you might have the same node in the fringe queue twice.
Also don't forget to add the start node to the visited dictionary.
| 1 | 0 | 0 |
I am solving a problem for an AI course and I have to implement a graph search with the BFS algorithm in Python. My implementation actually finds the solution, but it expands too many nodes. The answer says that 269 nodes should be expanded, but I got 275.
To keep track of the visited nodes I use a dictionary. The keys are the expanded states and the values are 1. Once I get a node's successors, I check if they are present in the dictionary. If yes, I just ignore this successor. If not, I push it into the fringe (queue).
I thought that this process would prevent expanding already visited nodes, but it doesn't seem to be the case.
Anyone could give me a hint about this? No code should be needed, as all I want is some idea of what might be going wrong.
Thanks in advance.
|
Too many nodes expanded in BFS graph search
| 1.2 | 0 | 0 | 2,278 |
12,765,264 |
2012-10-07T01:05:00.000
| 0 | 0 | 1 | 0 |
python,algorithm,search
| 12,765,338 | 2 | false | 0 | 0 |
Check out Xapian for storing searchable information and retrieving it (results = results!) as well as Levenshtein distance algorithms for which there are several modules for out there.
| 1 | 0 | 0 |
I have a list of phrases. I need to check if part of these phrases appear in a big block of text.
e.g.
Marshmallows are delicious and warm
Giant unicorns sign wonderful melodies of the imminent apocalypse
The wizards assaulted the fort, but forgot their spell books at home!
Block of text is:
Marshmallows are delicious. I've been snacking on them while the wizards assaulted the fort. The unicorns sign wonderful melodies of those who forgot their spell books at home. [...]
Extra note:
I can't rely on splitting by stop words e.g. "and", "or" and punctuation.
Any ideas regarding libraries and/or strategies?
Thanks :)
|
Python - Search for occurances within text
| 0 | 0 | 0 | 92 |
12,766,124 |
2012-10-07T04:28:00.000
| 2 | 0 | 1 | 1 |
python,python-idle,python-2.3
| 12,766,135 | 2 | false | 0 | 0 |
I'm guessing that you're running python hello.py within the Python REPL. This won't work; python hello.py is something that starts Python that you'll need to run in your system shell.
| 2 | 0 | 0 |
I am very very new to Python. I am trying to get a python program to run by writing 'python hello.py' but every time I do that I get a Syntax Error. Why is that?
However when I open the file and click on run module, it works. Why won't it work if I type 'python hello.py'
Is there anyway I can navigate to the directory where the file is stored and then run it? I tried placing my file in directly in the Python23 folder :P didnt work anyway
Please help me. I have Python 2.3.5
|
Python Shell - Syntax Error
| 0.197375 | 0 | 0 | 923 |
12,766,124 |
2012-10-07T04:28:00.000
| 0 | 0 | 1 | 1 |
python,python-idle,python-2.3
| 12,766,384 | 2 | true | 0 | 0 |
What is the error?
Place python's filepath to the python.exe in your system's PATH, then you can run a python file from anywhere.
| 2 | 0 | 0 |
I am very very new to Python. I am trying to get a python program to run by writing 'python hello.py' but every time I do that I get a Syntax Error. Why is that?
However when I open the file and click on run module, it works. Why won't it work if I type 'python hello.py'
Is there anyway I can navigate to the directory where the file is stored and then run it? I tried placing my file in directly in the Python23 folder :P didnt work anyway
Please help me. I have Python 2.3.5
|
Python Shell - Syntax Error
| 1.2 | 0 | 0 | 923 |
12,767,315 |
2012-10-07T08:39:00.000
| 0 | 0 | 0 | 0 |
python,optimization,graphics,pygame
| 12,767,902 | 1 | true | 0 | 1 |
Well for starters, one huge bitmap is not really good, since it eats away resources.
What I do, is divide the map into size of camera, and end up with having 9 tiles displayed at a time, moving the camera shifts the map, and draws only the ones that are seen.
There isn't a huge improvement though.
You can always try the easier approach, and if you feel that the game is too slow, you can try another.
There is no point of optimizing if you can't see the difference.
| 1 | 2 | 0 |
I'm writing a 2D Elite-style game in Python+Pygame, and I need to move the starmap about so the player can look at the whole thing.
The way I've done this sort of thing before is to just add the coordinates of the 'camera' to the coordinates of everything else when drawing. However, I notice Pygame has a function to move the entirety of a surface some amount. Would this be a quicker, easier way to implement this functionality?
The starmap is about 100,000 pixels square, if it depends on the size of the image.
|
Is Surface.scroll() the right way to implement a movable 2D viewpoint in Pygame?
| 1.2 | 0 | 0 | 676 |
12,768,765 |
2012-10-07T12:20:00.000
| 1 | 0 | 1 | 0 |
python
| 12,768,846 | 1 | true | 0 | 0 |
One safe thing, OS independent, and reliable is certainly to close the file, and open it again on writting.
If the performance hindrance due to that is unacceptable, you could try to use "seek" to move to the end of file before writing. I just did some naive testing in the interactive console, and indeed, using file.seek(0, os.SEEK_END) before writing worked.
Not that I think having two processes writing to the same file could be safe under most circumstances -- you will end up in race conditions of some sort doing this. One way around is to implement file-locks, so that one process just write to the file after acquiring the lock. Having this done in the right wya may be thought. So, ceck if your application wpould not be in better place using something to written data carefully built and hardened along the years to allow simultanous update by various processes, like an SQL engine (MySQL or Postgresql).
| 1 | 0 | 0 |
I have noticed that python always remembers where it finished writing in a file and continues from that point.
Is there a way to reset that so that if the files is edited by another program that removes certain text and ads another python will not fill the gaps with NULL when it does next write?
I have the file open in the parent and the threading children are writing to it. I used flush to ensure after write the data is physically written to the file, but that is only good to do that.
Is there another function I seem to miss that will make python append properly?
|
python and another program writing to the same file
| 1.2 | 0 | 0 | 51 |
12,769,933 |
2012-10-07T15:04:00.000
| 12 | 1 | 0 | 0 |
python,compression,twisted
| 12,770,967 | 3 | true | 0 | 0 |
Just 10K from the middle of the file will do the trick. You don't want the beginning or the end, since they may contain header or trailer information that is not representative of the rest of the file. 10K is enough to get some amount of compression with any typical algorithm. That will predict a relative amount of compression for the whole file, to the extent that that middle 10K is representative. The absolute ratio you get will not be the same as for the whole file, but the amount that it differs from no compression will allow you to set a threshold. Just experiment with many files to see where to set the threshold.
As noted, you can save time by doing nothing for files that are obviously already compressed, e.g. .png. .jpg., .mov, .pdf, .zip, etc.
Measuring entropy is not necessarily a good indicator, since it only gives the zeroth-order estimate of compressibility. If the entropy indicates that it is compressible enough, then it is right. If the entropy indicates that it is not compressible enough, then it may or may not be right. Your actual compressor is a much better estimator of compressibility. Running it on 10K won't take long.
| 2 | 9 | 0 |
I'm using an event loop based server in twisted python that stores files, and I'd like to be able to classify the files according to their compressibility.
If the probability that they'd benefit from compression is high, they would go to a directory with btrfs compression switched on, otherwise they'd go elsewhere.
I do not need to be sure - 80% accuracy would be plenty, and would save a lot of diskspace. But since there is the CPU and fs performance issue too, I can not just save everything compressed.
The files are in the low megabytes. I can not test-compress them without using a huge chunk of CPU and unduly delaying the event loop or refactoring a compression algorithm to fit into the event loop.
Is there any best practice to give a quick estimate for compressibility? What I came up with is taking a small chunk (few kB) of data from the beginning of the file, test-compress it (with a presumably tolerable delay) and base my decision on that.
Any suggestions? Hints? Flaws in my reasoning and/or problem?
|
How can I estimate the compressibility of a file without compressing it?
| 1.2 | 0 | 0 | 3,128 |
12,769,933 |
2012-10-07T15:04:00.000
| 5 | 1 | 0 | 0 |
python,compression,twisted
| 12,770,116 | 3 | false | 0 | 0 |
Compressed files usually don't compress well. This means that just about any media file is not going to compress very well, since most media formats already include compression. Clearly there are exceptions to this, such as BMP and TIFF images, but you can probably build a whitelist of well-compressed filetypes (PNGs, MPEGs, and venturing away from visual media - gzip, bzip2, etc) to skip and then assume the rest of the files you encounter will compress well.
If you feel like getting fancy, you could build feedback into the system (observe the results of any compression you do and associate the resulting ratio with the filetype). If you come across a filetype that has consistently poor compression, you could add it to the whitelist.
These ideas depend on being able to identify a file's type, but there are standard utilities which do a pretty good job of this (generally much better than 80%) - file(1), /etc/mime.types, etc.
| 2 | 9 | 0 |
I'm using an event loop based server in twisted python that stores files, and I'd like to be able to classify the files according to their compressibility.
If the probability that they'd benefit from compression is high, they would go to a directory with btrfs compression switched on, otherwise they'd go elsewhere.
I do not need to be sure - 80% accuracy would be plenty, and would save a lot of diskspace. But since there is the CPU and fs performance issue too, I can not just save everything compressed.
The files are in the low megabytes. I can not test-compress them without using a huge chunk of CPU and unduly delaying the event loop or refactoring a compression algorithm to fit into the event loop.
Is there any best practice to give a quick estimate for compressibility? What I came up with is taking a small chunk (few kB) of data from the beginning of the file, test-compress it (with a presumably tolerable delay) and base my decision on that.
Any suggestions? Hints? Flaws in my reasoning and/or problem?
|
How can I estimate the compressibility of a file without compressing it?
| 0.321513 | 0 | 0 | 3,128 |
12,770,077 |
2012-10-07T15:21:00.000
| 0 | 0 | 1 | 0 |
python,dll,wrapper,ctypes
| 12,996,919 | 2 | false | 0 | 1 |
Maintaining a Python library with a ctypes backend isn't an unmanageable approach. Obviously the initial investment is larger than using automated tools, but the API you are left with should be much better.
If you do take that route, aim to separate the Python API entirely from the C library though. Supporting multiple ctypes backends with one Python front end api isn't too bad - just query at runtime and dynamically load the correct ctypes wrapper module. I've done that to wrap different dll files and .so files for windows and linux but it would work for versions of a library as well.
| 1 | 7 | 0 |
I have a poorly designed and big (> 300 public functions, >200 numeric constants defined with #define in the header file) that I have to wrap in Python. I have the dll and the h file. The library is updated yearly, till now in a backwards compatible way (i.e. just functions were added, a constant keep their numerical values, etc). But I have no guarantees as I do not control the library.
Using ctypes, I see two ways of wrapping this in Python:
Mapping every constant and function to python, 1 to 1
Redefining the API in Python and making calls to the library.
The first can be done in a (roughly) automatic way from the header file and therefore is easier to maintain and upgrade, the second requires a lot of python code but it will be easier to use.
I would appreciate some opinions based on your experience with this type of problem and some examples.
|
Maintainability of a python wrapping of a C library
| 0 | 0 | 0 | 249 |
12,770,950 |
2012-10-07T17:09:00.000
| 4 | 0 | 0 | 0 |
python,flask,webfaction
| 12,770,986 | 5 | false | 1 | 0 |
The problem is there's probably some kind of proxy in front of Flask. In this case the "real" IP address can often be found in request.headers['X-Forwarded-For'].
| 1 | 33 | 0 |
I just deployed a Flask app on Webfaction and I've noticed that request.remote_addr is always 127.0.0.1. which is of course isn't of much use.
How can I get the real IP address of the user in Flask on Webfaction?
Thanks!
|
Flask request.remote_addr is wrong on webfaction and not showing real user IP
| 0.158649 | 0 | 1 | 42,164 |
12,773,856 |
2012-10-07T23:53:00.000
| 0 | 0 | 1 | 0 |
python,abstract-data-type
| 12,773,918 | 2 | false | 0 | 0 |
The second design you describe would basically mean an item can only ever be in one collection at the same time. This would be rather awkward to use. Generally, collections (which stacks and queues are) should be able to store any kind of object without affecting the object's state.
So, yes, with any sane implementation of queues and / or stacks, adding an item to one won't remove it from the latter.
| 1 | 0 | 0 |
If I want to move a value from a queue to a stack (value should no longer be in the queue, just in the stack), do I need to dequeue it before pushing it to the stack, or will pushing it to the stack automatically dequeue it?
|
Moving a value from a queue to a stack
| 0 | 0 | 0 | 329 |
12,774,029 |
2012-10-08T00:27:00.000
| 1 | 0 | 0 | 0 |
python,api,sockets,twisted,beanstalkd
| 12,780,748 | 1 | true | 0 | 0 |
The currently available beanstalkc v0.3.0 uses blocking socket I/O operations.
| 1 | 1 | 0 |
I'm writing a socket API using twisted framework which needs to write to beanstalkd in a deferred, is the current Python Beanstalkc client implementation non-blocking?
I've searched extensively on Stackoverflow for answers about this matter without luck, any help would be greatly appreciated. Thanks in advance
|
Is the current Python Beanstalkc client implementation non-blocking?
| 1.2 | 0 | 0 | 152 |
12,775,710 |
2012-10-08T05:19:00.000
| 1 | 0 | 1 | 0 |
python,file,download
| 12,775,799 | 2 | false | 0 | 0 |
Actually you get text file in response to a POST request with several base64-encoded request parameters. Feel free to play with it
use Firebug or any other debug tool to see the POST content and parameters
| 1 | 0 | 0 |
I need to write a function that downloads and stores the today's list of pre-release domains .txt file from
http://www.namejet.com/pages/downloads.aspx.
So as today is 8th of October you want to get the file "Monday, October 08, 2012".
Tried with requests but didn't work.
I'm having trouble because the file is not stored on a fixed URL but is hidden behind some Javascript.
|
How to download text file from website using Python?
| 0.099668 | 0 | 0 | 1,469 |
12,775,844 |
2012-10-08T05:34:00.000
| 14 | 0 | 0 | 0 |
python,django,postgresql,sql-order-by
| 12,775,949 | 3 | true | 1 | 0 |
order_by can have multiple params, I think order_by('score', '-create_time') will always return the same queryset.
| 1 | 8 | 0 |
I'd like to know how Django's order_by works if the given order_by field's values are same for a set of records. Consider I have a score field in DB and I'm filtering the queryset using order_by('score'). How will records having the same values for score arrange themselves?
Every time, they're ordered randomly within the subset of records having equal score and this breaks the pagination at client side. Is there a way to override this and return the records in a consistent order?
I'm Using Django 1.4 and PostgreSQL.
|
Django - How does order_by work?
| 1.2 | 0 | 0 | 16,934 |
12,778,033 |
2012-10-08T08:38:00.000
| 0 | 0 | 0 | 0 |
python,django,dhtmlx
| 12,778,355 | 1 | true | 1 | 0 |
Turns out you can't do this with templates, and so you have to move over to HttpResponces and building up your return manually, which may not be worth it for a lot of people.
| 1 | 1 | 0 |
I have a page, which returns 10,000+ records as XML, which takes 7 seconds to return which i'm happy with, as most of it isn't displayed until the user scrolls down.
But my front end has to wait 7 seconds for django to return anything so it can start showing the output, DHTMLX is able to render as data is being received so i was wondering if django can do this and how would I go about it?
tl:dr; I want Django to respond as it renders output, can it? if so How?
|
Is it possible to return (stream) a response (xml) from django as the output is rendering?
| 1.2 | 0 | 0 | 445 |
12,778,380 |
2012-10-08T08:59:00.000
| 0 | 0 | 1 | 0 |
python,memory,memcached,shared
| 12,781,903 | 1 | true | 0 | 0 |
Yes, it does. Note that the memcached folks do not recommend storing anything larger than 1 megabyte, so you're well above that recommendation.
| 1 | 0 | 0 |
The situation - I have 2 computers, the first one has python and second one has memcache. There is some key in memcache, which references to the object in memory which size is 1 GB approximately. If I access that object from python and want to run through, does it mean that python process will copy the whole object to the local memory ?
|
Python process memory and Memcache memory. Is python using the memory address or it copies data?
| 1.2 | 0 | 0 | 108 |
12,780,635 |
2012-10-08T11:17:00.000
| 2 | 0 | 0 | 0 |
python,webpage,pywinauto
| 13,868,001 | 2 | false | 0 | 0 |
I think for interacting with webserver better is to use cUrl. All webservers function are responses for GET or POST request (or both). in order to call them, just call the urls that buttons are linked to and/or send POST data attaching that data to appropiate request obj before calling send method. cUrl is able to retrieve and do some processing on webserver responce (web site code) without displaying it, what delivers knowledge about url adresses contained in the web site, which are called when clicking certain buttons. Also possible to know html fields which carry POST data to get their names.
Python has curl lib, which I hope is so powerful as PHP curl, tool what I used and presented.
Hope you are on the track now.
BR
Marek
| 1 | 0 | 0 |
I want to be able to access the elements of a webpage with python. I use Python 2.5 with Windows XP. Currently, I am using pywinauto to try to control IE, but I could switch to a different browser or module if it is needed. I need to be able to click the buttons the page has and type in text boxes. So far the best I've gotten is I was able to bring IE to the page I wanted. If it is possible without actually clicking the coords of the buttons and text boxes on the page, please tell me. Thanks!
|
How to control and interact with elements on a webpage displayed with IE or a different browser with pywinauto
| 0.197375 | 0 | 1 | 694 |
12,781,929 |
2012-10-08T12:38:00.000
| 4 | 0 | 1 | 0 |
python,windows,upgrade
| 12,782,236 | 1 | true | 0 | 0 |
The problem is chiefly with packages written in C: they will be linked with the 3.2 Python code. It might just be a question of re-linking them, but I have had issues with popular packages like numpy (I currenty can't get that to compile on 3.3).
The pure Python packages would probably be OK in theory, but honestly, is it worth taking the risk?
It is safer to load the 3.3 versions of the packages, every time. Stick with 3.2 until you can upgrade everything. You can have more than one version of Python loaded on Windows, I have 2.6, 2.7, 3.2 and 3.3 co-existing. You just have to be careful with %PATH%, assoc, and ftype.
| 1 | 2 | 0 |
What are the possibilities to upgrade my existing Python installation (in my case from version 3.2.2 to 3.3.0) on my Windows 7 x64 system and not having to re-install all my packages? Is there a convenient/automated solution to do this?
I'd like to end up with only one Python version on my system.
|
How to upgrade my Python version on Windows 7 without having to re-install all packages?
| 1.2 | 0 | 0 | 8,862 |
12,782,181 |
2012-10-08T12:53:00.000
| 0 | 0 | 1 | 0 |
python,windows,dll,import
| 12,805,887 | 2 | false | 0 | 0 |
Finally found it.
The .pyd file for arcgisscripting (basically a .dll specific to python) is at C:\Program Files (x86)\ArcGIS\Desktop10.1\bin\arcgisscripting.pyd
If I point DependencyWalker at that file it indicates that several dependencies for that are not found.
So it seems the solution is to:
1) find the last file the ImportError flagged
2) look for its .pyd file on the filesystem
3) run DependencyWalker on that .pyd to find out what is missing
| 1 | 0 | 0 |
I'm trying to get a python program to run on a windows box.
I have it running on my development windows box but when I transfer it to another windows box I keep getting:
ImportError: DLL load failed: %1 is not a vaild Win32 aplication
The trace suggests it is having trouble with imports, it basically goes through several in-house python programs (that import each other) and then into the ArcPy realm. Ultimately the last one it seems to have tried is arcgisscripting.
When I am on that box if enter the interpreter and type "import arcgisscripting" I get no errors (just a new >>> cursor), so I started to think this error was a bit misleading. I'd read this error typically crops up if (for instance) the python code was compiled 64bit and you're trying to run on 32bit python.
A colleague suggested that the error sometimes happens if python can't find some of the necessary code. So I checked and did SET statements and now the PATH and PYTHONPATH variables seem to be equivalent. Still I get this error, not sure what to do. I'd prefer not to have to do things like uninstalling stuff on the problem box and reinstalling it. That box is a shared resource.
|
ImportError DLL load failed, but import at command line works
| 0 | 0 | 0 | 3,182 |
12,785,963 |
2012-10-08T16:48:00.000
| 4 | 1 | 1 | 0 |
python,m2crypto
| 12,786,065 | 1 | false | 0 | 0 |
usually just doing import m2crypto is sufficient
you may need to easy_install m2crypto first or maybe even pip install m2crypto
If you are on windows you may need the Visual Studio DLL to compile it
| 1 | 2 | 0 |
I need to work with m2crypto library. How can I import it to my .py file? I use Eclipse.
|
How to import m2crypto library into python
| 0.664037 | 0 | 0 | 17,398 |
12,786,680 |
2012-10-08T17:35:00.000
| 2 | 0 | 0 | 0 |
python,routes,flask,tornado
| 12,786,744 | 2 | false | 1 | 0 |
Tornado templates uses syntax similar to Jinja, but the rendering engine is not Jinja. You might be able to get away with it, but then you would have to keep track of which templates are Jinja and which are Tornado.
For the sake of sanity, just keep them separate.
| 2 | 0 | 0 |
Is possible to combine Tornado and Flask web templates together?
For example: Use Index.html as "base" template setting up block for extensions:
Then ,extend index with "block" from Flask for Flask Routes
Then, extend index with "block" from Tornado for Tornado Routes..
|
Combining Tornado and Flask templates
| 0.197375 | 0 | 0 | 394 |
12,786,680 |
2012-10-08T17:35:00.000
| 1 | 0 | 0 | 0 |
python,routes,flask,tornado
| 12,859,244 | 2 | false | 1 | 0 |
You are not bound to the default template engine in Flask. Maybe you could somehow use Tornado's template engine in Flask, then it'd be possible to use the templates in both.
| 2 | 0 | 0 |
Is possible to combine Tornado and Flask web templates together?
For example: Use Index.html as "base" template setting up block for extensions:
Then ,extend index with "block" from Flask for Flask Routes
Then, extend index with "block" from Tornado for Tornado Routes..
|
Combining Tornado and Flask templates
| 0.099668 | 0 | 0 | 394 |
12,787,317 |
2012-10-08T18:23:00.000
| 0 | 0 | 0 | 0 |
python,web2py
| 12,809,067 | 2 | false | 1 | 0 |
In your table that contains the upload information, add a new string field called 'validation_key'. When a file is uploaded, insert a GUID or reasonably long alpha-numeric string in it. Send this key as part of the link in the email. When the user clicks the link, search for the key and if found, set the matched 'validation_key' in the database to null. A null validation_key indicates a validated upload and you can allow downloads of that file.
| 1 | 0 | 0 |
web2py experts. The task I'm trying to accomplish is the following:
-permit a person browsing my site to upload a file to my site through a form (implemented through crud.create())
-the visitor is not required to establish an account or log in to upload a file
-the user is required to provide an email address in order for the file to be uploaded
-basically, after the user uploads a file, the file is held in escrow/limbo, and a validation/verification email is sent to the user
-once the user clicks on the link in the validation email, the file is posted to the page, and is made publicly available for download
What's the best way to go about doing this? Thanks!
|
Web2Py - Validate uploaded file by email
| 0 | 0 | 0 | 262 |
12,788,394 |
2012-10-08T19:44:00.000
| 1 | 0 | 0 | 0 |
python,wxpython
| 12,788,472 | 2 | true | 0 | 1 |
wx has to be compiled for each target plattform. Binaries are always OS dependent, so no, there cannot be a portable wx version.
| 1 | 1 | 0 |
I recently discovered how easy and convenient using wxPython is for writing GUI applications. Unfortunately installing wxPython is a giant throbbing pain in the neck. I consider myself pretty tech-savvy but it took me almost an hour to get a working setup of wxPython on a Pythonbrew install on an Ubuntu machine. On my OSX machine at home I still haven't figured it out.
So my question is; is it possible, somehow, to install a portable version of wxPython and place it in my project directory where it will work on all platforms, saving users the pain of having to manually install it to run my application? If yes, how would I go about it?
|
Can I embed wxPython in my project, saving users the trouble of installing it?
| 1.2 | 0 | 0 | 298 |
12,789,138 |
2012-10-08T20:40:00.000
| 2 | 0 | 0 | 0 |
python,attributes
| 12,789,190 | 2 | false | 0 | 0 |
Not all operating systems have the concept of "hidden" for files, and most (even with all the different versions of Windows 7 etc. there are still more forms of *nix out there than Windows) indicate it by having the first character of the filename be a period (.). On the OSes that do support it you must use some external API or tool in order to set it on the file.
| 1 | 2 | 0 |
In Python, how do you make a particular file hidden? Or how do you set the file attribute as 'hidden' without using external API's/modules such as WIN32API, etc.
Surely there is something in the standard libraries? As the os module does allow to set the "read" and 'write' attributes, it is very strange that there is no mention in the os docs of 'hidden'...
|
Hidden file attributes
| 0.197375 | 0 | 0 | 3,767 |
12,791,275 |
2012-10-09T00:27:00.000
| 2 | 1 | 1 | 0 |
python,pypi
| 12,792,669 | 2 | true | 0 | 0 |
You could include the defaults as part of your script and then allow the user to change the defaults with either command line arguments or a config file in the user's home directory.
I don't think the Django approach would work unless you have the concept of a project.
If this is on Unix I would either put the config file in /etc if the script will be run by more than one user or in the user's home folder as a dotfile. This way the user does not have to specify the config file each time, though you could also have a command line argument that lets the user specify a different config file to use.
| 2 | 3 | 0 |
I have a command-line python script that uses a configuration file. I'm planning to put this on pypi soon.
What is the best general approach for including a default version of the configuration file in the package, so that it is obvious to the end-user where to find it?
One example of a pypi project which includes user-editable config files is Django. In Django, the user has to run a script to initialize a new project. This generates a directory with a bunch of stuff, including the project configuration file. However, this seems like a heavy approach for a simple command line utility like mine.
Another option is requiring the user to specify the location of the config file as a command line arg. I guess this is okay, but it puts the onus on the user to go to the documentation and create the entire config file from scratch.
Is there any better option? Is there any standard practice for this?
Thanks!
-Travis
|
Best way to include a user-editable config file in a pypi package?
| 1.2 | 0 | 0 | 426 |
12,791,275 |
2012-10-09T00:27:00.000
| 0 | 1 | 1 | 0 |
python,pypi
| 14,864,557 | 2 | false | 0 | 0 |
I like Nathan's answer. But in this specific case I wound up adding a command-line option to the script that would dump an example config file to standard out.
| 2 | 3 | 0 |
I have a command-line python script that uses a configuration file. I'm planning to put this on pypi soon.
What is the best general approach for including a default version of the configuration file in the package, so that it is obvious to the end-user where to find it?
One example of a pypi project which includes user-editable config files is Django. In Django, the user has to run a script to initialize a new project. This generates a directory with a bunch of stuff, including the project configuration file. However, this seems like a heavy approach for a simple command line utility like mine.
Another option is requiring the user to specify the location of the config file as a command line arg. I guess this is okay, but it puts the onus on the user to go to the documentation and create the entire config file from scratch.
Is there any better option? Is there any standard practice for this?
Thanks!
-Travis
|
Best way to include a user-editable config file in a pypi package?
| 0 | 0 | 0 | 426 |
12,791,769 |
2012-10-09T01:42:00.000
| 1 | 0 | 0 | 0 |
python,pdf,reportlab
| 13,022,662 | 1 | true | 1 | 0 |
If you use Platypus with ReportLab you can get a table of contents "for free": just see the ReportLab manual for details but you basically just add a TableOfContents to the list of Flowables for the document and you're done. Otherwise you'll have to figure out all the logic for building a table of contents yourself.
| 1 | 0 | 0 |
I want to add contents on first page. But the data is uncertain, contents must draw depend on the data.
I try to fix this problem by drawing twice, calculating and recording the contents, and it works well.
But it wastes time and ungainly.
Can I insert first page after completing drawing? Or other ways to fix this problem?
Sorry, I'm poor of English..
|
Reportlab: How to add uncertain contents using BaseDocTemplate?
| 1.2 | 0 | 0 | 384 |
12,794,631 |
2012-10-09T07:09:00.000
| 1 | 1 | 1 | 0 |
python,nose,nosetests
| 12,794,692 | 3 | false | 0 | 0 |
Using --with-doctests implies that you're running doctests. Anything outside of a doctest can be considered a unit test. AFAIK, they're not mutually exclusive, so you can't strictly tell which you're running if you've enabled --with-doctests.
Having said that, doctests generally are a form of unit test, so I'm not quite sure what end you're trying to achieve with this.
| 1 | 0 | 0 |
I am using Python Nose and would like to print the type of the test ran, like whether it is a Doctest or unittest or so? How can this be done?
Thanks.
|
Print the test type in Python Nose
| 0.066568 | 0 | 0 | 502 |
12,796,443 |
2012-10-09T09:05:00.000
| 0 | 0 | 0 | 0 |
python,active-directory
| 14,350,855 | 1 | true | 0 | 0 |
It seems that active_directory is using default Win32 API, which doesn't support user/pass binding to a different DC.
You may have to use ldap module and find a workaround
| 1 | 0 | 0 |
I'm using Python to write a simple client to Move users, Reset password, Extend user account using Tim Golden's active_directory module.
Currently I'm using the module with the default domain that I logged in with, and it works perfectly. But now I can't find any way to connect to another domain using the same module, when I use active_directory.AD("DC_name") it simply returns "pywintypes.com_error: (-2147463168, 'OLE error 0x80005000', None, None)"
I guess this have to do with authentication, because we have to do it when we access our AD (using ADExplorer). Can I do this with active_directory module, or with win32com API in general.
I know another python-ldap module that did it beautifully, but it can't move user from one OU to another. Any submission to use another module that does the job are welcome :)
Thanks
|
Connect to AD domain with authentication using Python
| 1.2 | 0 | 1 | 913 |
12,797,999 |
2012-10-09T10:26:00.000
| 48 | 0 | 0 | 0 |
python,django
| 12,798,019 | 3 | true | 1 | 0 |
No. It's not for making websites. Your sample just sounds like you want plain old HTML.
Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making this kind of software.
| 1 | 64 | 0 |
I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used.
After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to create a very simple website. (Website should have few pages like Home, Favorites, About, Contact linked to each other and will be providing static content).
Can Django be used for creation of such website? I searched a lot on internet but couldn't find any relevant examples, I only encountered with the examples for creation of blog, forum sites etc. If Django can be used for creation of this website, what should be the approach.
Can someone please explain this basic term "Framework" and its significance?
|
For what purpose Django is used for?
| 1.2 | 0 | 0 | 66,634 |
12,799,772 |
2012-10-09T12:12:00.000
| 4 | 0 | 0 | 0 |
python,django,facebook,facebook-graph-api,django-socialauth
| 12,824,092 | 1 | true | 1 | 0 |
The API does not let you access the user's contact number. You will have to request the user's contact details manually using a form.
| 1 | 4 | 0 |
I am using django-social_auth to make users register and login via facebook. I want to access the phone number of the user.
Tried searching on google and stackoverflow , but didn't find any answer. Searched the facebook docs as well. There I found that there used to be permission for 'user_mobile_phone' but it has been removed.
It was also written than now it will be provided with basic permissions but it wasn't available(what I found).
I tried using Graph API, but was unsuccessful.
So, Someone please tell me the way ,if there is any, to get user data.
EDIT:17 June 2014 -
Is this possible now to get User's Mobile number via the Graph API ?
|
How to fetch user's mobile number from facebook?
| 1.2 | 0 | 0 | 2,059 |
12,803,495 |
2012-10-09T15:31:00.000
| 1 | 0 | 0 | 0 |
python,data-mining,graph-algorithm,recommendation-engine,apriori
| 12,807,402 | 2 | false | 0 | 0 |
For Apriori, you do not need to have tuples or vectors. It can be implemented with very different data types. The common data type is a sorted item list, which could as well look like 1 13 712 1928 123945 191823476 stored as 6 integers. This is essentially equivalent to a sparse binary vector and often very memory efficient. Plus, APRIORI is actually designed to run on data sets too large for your main memory!
Scalability of APRIORI is a mixture of the number of transactions and the number of items. Depending of how they are, you might prefer different data structures and algorithms.
| 1 | 1 | 1 |
I read that Apriori algorithm is used to fetch association rules from the dataset like a set of tuples. It helps us to find the most frequent 1-itemsets, 2-itemsets and so-on. My problem is bit different. I have a dataset, which is a set of tuples, each of varying size - as follows :
(1, 234, 56, 32)
(25, 4575, 575, 464, 234, 32)
. . . different size tuples
The domain for entries is huge, which means that I cannot have a binary vector for each tuple, that tells me if item 'x' is present in tuple. Hence, I do not see Apriori algorithm fitting here.
My target is to answer questions like :
Give me the ranked list of 5 numbers, that occur with 234 most of the time
Give me the top 5 subsets of size 'k' that occur most frequently together
Requirements : Exact representation of numbers in output (not approximate), Domain of numbers can be thought of as 1 to 1 billion.
I have planned to use the simple counting methods, if no standard algorithm fits here. But, if you guys know about some algorithm that can help me, please let me know
|
Algorithms for Mining Tuples of Data on huge sample space
| 0.099668 | 0 | 0 | 631 |
12,805,732 |
2012-10-09T17:59:00.000
| 2 | 1 | 0 | 0 |
python,security,flask,spam-prevention
| 12,806,423 | 3 | false | 1 | 0 |
You should sit down and decide what exactly your "core" problems in the scenario of your app are, and who your likely users will be. That will help you guide the right solution.
In my experience, there are a lot of different problems and solutions in this subject - and none are a "one size fits all"
If you have a problem with Anonymous users , you can try to migrate as much of the functionality behind an 'account wall' as possible.
If you can't use an account wall, then you'll be better off with some IP
based tracking, along with some other headers/javascript stuff. Going by IP alone can be a disaster because of corporate proxies , home routers, etc. You'll run the risk of too many false positives. If you add in browser info, unsavory users can still fake it - but you'll penalize fewer real users.
You might want an account wall to only serve as a way to enforce a cookie , or it might plug into the idea of having a site identity where experience earns privilege
You might want an account that can map to another trusted site's account. For example, I generally trust a 3rd party account binding against Facebook - who are pretty decent at dealing with fake accounts. I don't trust a 3rd party account binding against Twitter - which is largely spam.
You might only require site "registration" to need solving a captcha , or something else mildly inconvenient to weed out most unsavory visits. If the reward for bad behavior is high enough though, you won't solve anything.
I could talk about this all day. From my perspective, you have to solve the business logic and ux concepts first - and then a tech solution is much easier.
| 3 | 4 | 0 |
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long.
I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for.
I prefer a cookie-based solution unless something like redis can prove it's worth.
What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
|
Leanest way to prevent scripted abuse of a web app?
| 0.132549 | 0 | 0 | 1,007 |
12,805,732 |
2012-10-09T17:59:00.000
| 0 | 1 | 0 | 0 |
python,security,flask,spam-prevention
| 14,003,551 | 3 | false | 1 | 0 |
An extremely simple method that I have used before is to have an additional input in the registration form that is hidden using CSS (i.e. has display:none). Most form bots will fill this field in whereas humans will not (because it is not visible). In your server-side code you can then just reject any POST with the input populated.
| 3 | 4 | 0 |
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long.
I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for.
I prefer a cookie-based solution unless something like redis can prove it's worth.
What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
|
Leanest way to prevent scripted abuse of a web app?
| 0 | 0 | 0 | 1,007 |
12,805,732 |
2012-10-09T17:59:00.000
| 4 | 1 | 0 | 0 |
python,security,flask,spam-prevention
| 12,806,126 | 3 | false | 1 | 0 |
There is no way to achieve this with cookies, since a malicious script can just silently drop your cookie. Since you have to support the case where a user first visits (meaning without any cookies set), there is no way to distinguish between a genuine new user and a malicious script by only considering state stored on the client.
You will need to keep track of your users on the server-side to achieve your goals. This can be as simple as an IP-based filter that prevents fast posting by the same IP.
| 3 | 4 | 0 |
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long.
I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for.
I prefer a cookie-based solution unless something like redis can prove it's worth.
What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
|
Leanest way to prevent scripted abuse of a web app?
| 0.26052 | 0 | 0 | 1,007 |
12,806,542 |
2012-10-09T18:53:00.000
| 1 | 0 | 0 | 0 |
python,listview,wxpython
| 12,807,804 | 3 | false | 0 | 1 |
As I recall, you have to bind to EVT_LIST_BEGIN_LABEL_EDIT. Then in your event handler you just check what column you're in and if you're in a column that you want to be editable, then you do "event.Allow()", otherwise you veto.
| 2 | 7 | 0 |
Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?
I guess there's some way that Vetos the editing event, however I can't find it.
|
wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells
| 0.066568 | 0 | 0 | 2,303 |
12,806,542 |
2012-10-09T18:53:00.000
| 2 | 0 | 0 | 0 |
python,listview,wxpython
| 45,455,459 | 3 | false | 0 | 1 |
In wxPython version 4.0.0 the line:
if event.m_col == 1
does not work. Use
if event.GetColumn() == 1
instead.
| 2 | 7 | 0 |
Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?
I guess there's some way that Vetos the editing event, however I can't find it.
|
wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells
| 0.132549 | 0 | 0 | 2,303 |
12,807,069 |
2012-10-09T19:29:00.000
| 12 | 0 | 1 | 0 |
python,scope
| 12,807,083 | 4 | true | 0 | 0 |
There is nothing special about if __name__ == '__main__' block whatsoever. That is to say, its scope is determined by the place it occurs. Since such blocks typically occur at top-level, their scope is global.
If this block were to occur in a function, which is perfectly legal, its scope would be local—except that __name__ would still resolve to the global value defined in the module.
| 3 | 8 | 0 |
What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ?
|
The scope of if __name__ == __main__
| 1.2 | 0 | 0 | 5,139 |
12,807,069 |
2012-10-09T19:29:00.000
| 3 | 0 | 1 | 0 |
python,scope
| 12,807,114 | 4 | false | 0 | 0 |
Python doesn't have block-local scope, so any variables you use inside an if block will be added to the closest enclosing "real" scope. (For an if..main block, they'll usually be attributes of the module.)
| 3 | 8 | 0 |
What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ?
|
The scope of if __name__ == __main__
| 0.148885 | 0 | 0 | 5,139 |
12,807,069 |
2012-10-09T19:29:00.000
| 2 | 0 | 1 | 0 |
python,scope
| 12,807,435 | 4 | false | 0 | 0 |
It is in the global scope as long as:
it is called in the global scope, i.e. not from within a function
it is in the code file that is being executed.
To illustrate (2):
Suppose you're code is in foo.py, and in bar.py, you have the statement from foo import *. In this case, the if __name__ == "__main__": block in foo.py is not executed. This block is only executed when foo.py is run
| 3 | 8 | 0 |
What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ?
|
The scope of if __name__ == __main__
| 0.099668 | 0 | 0 | 5,139 |
12,808,050 |
2012-10-09T20:39:00.000
| 0 | 0 | 0 | 0 |
python,scipy,cluster-analysis
| 12,810,026 | 2 | false | 0 | 0 |
The second is what clustering is: group objects that are somewhat similar (and that could be images). Clustering is not a pure imaging technique.
When processing a single image, it can for example be applied to colors. This is a quite good approach for reducing the number of colors in an image. If you cluster by colors and pixel coordinates, you can also use it for image segmentation, as it will group pixels that have a similar color and are close to each other. But this is an application domain of clustering, not pure clustering.
| 1 | 1 | 1 |
I am having a hard time understanding what scipy.cluster.vq really does!!
On Wikipedia it says Clustering can be used to divide a digital image into distinct regions for border detection or object recognition.
on other sites and books it says we can use clustering methods for clustering images for finding groups of similar images.
AS i am interested in image processing ,I really need to fully understand what clustering is .
So
Can anyone show me simple examples about using scipy.cluster.vq with images??
|
Can anyone provide me with some clustering examples?
| 0 | 0 | 0 | 1,663 |
12,808,978 |
2012-10-09T21:52:00.000
| 7 | 0 | 0 | 0 |
python,selenium,multiprocessing,nosetests,parallel-testing
| 14,650,568 | 1 | false | 0 | 0 |
Try running nosetests with the --process-timeout value set to something higher than your tests would reasonably take:
nosetests --processes=2 --process-timeout=120
| 1 | 4 | 0 |
I am trying to run the functional tests in parallel with multiprocess plugin which gives me random TimeoutException sometimes
my tests are really simple, each of them just goes to a webpage and check if certain element exists.
does anybody know what might be the cause?
thanks
|
parallel testing with selenium + nose
| 1 | 0 | 1 | 1,972 |
12,810,499 |
2012-10-10T00:56:00.000
| 1 | 0 | 0 | 0 |
python,numpy,statistics
| 12,810,655 | 3 | false | 0 | 0 |
Here's a simple algorithm in python that does what you are expecting.
Let's take for example a single dimension array P equal to [0.1,0.3,0.4,0.2]. The logic can be extended to any number of dimensions.
Now we set each element to the sum of all the elements that precede it:
P => [0, 0.1, 0.4, 0.8, 1]
Using a random generator, we generate numbers that are between 0 and 1. Let's say x = 0.2.
Using a simple binary search, we can determine that x is between the first element and the second element. We just pick the first element for this value of x.
If you look closely, the chance that 0 =< X < 0.1 is 0.1. The chance that 0.1 =< x < 0.4 is 0.3 and so on.
For the 2D array, it is better to convert it to a 1D array, even though, you should be able to implement a 2D array binary search algorithm.
| 1 | 2 | 1 |
I have numpy two dimension array P such that P[i, j] >= 0 and all P[i, j] sums to one. How to choose pair of indexes (i, j) with probability P[i, j] ?
EDIT: I am interested in numpy build function. Is there something for this problem? May be for one dimensional array?
|
randomly choose pair (i, j) with probability P[i, j] given stochastic matrix P
| 0.066568 | 0 | 0 | 1,166 |
12,814,973 |
2012-10-10T08:20:00.000
| 7 | 1 | 0 | 1 |
python,django,centos,bitnami
| 12,898,508 | 1 | false | 1 | 0 |
Can you execute the following and see if it solves your issue?
. /opt/bitnami/scripts/setenv.sh
(notice the space between the dot and the path to the script)
Also what are you executing that gives you that error?
| 1 | 4 | 0 |
I getting the below issue when firing up django or ipython notebook
/opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5
However libreadline.so.5 exists in my system after locating it as shown below
root@linux:/opt/bitnami/scripts# locate libreadline.so.5
/opt/bitnami/common/lib/libreadline.so.5
/opt/bitnami/common/lib/libreadline.so.5.2
I have also exported the path in the environment variable (where the libreadlive.so.5 is located) but still does'nt seems to be resolving my issue (see below)
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HOME/opt/bitnami/common/lib
Also there is a script which is being provided by bitnami which is located in /opt/bitnami/scripts/setenv.sh. But even after executing it still i am stuck.
Anyone can help me with this
|
Bitnami - /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5
| 1 | 0 | 0 | 1,566 |
12,815,874 |
2012-10-10T09:15:00.000
| 2 | 0 | 1 | 0 |
python,design-patterns,operators,duck-typing
| 12,815,935 | 4 | false | 0 | 0 |
I'm thinking of, e.g., a case where someone uses someone elses implementation of xmlparser.get() which always returns a string, even if the property is basically a number.
You might want to coerce the value to a number by calling int or float on it, as appropriate.
| 2 | 2 | 0 |
Is there a way to obtain an exception when the == (equal) operator is used to compare different types? Python 3 throws an exception when attempting to order objects of different types. But == still returns False.
Or is there some other way to avoid hard to detect bugs caused by wrong type assumptions? Are there any design-patterns that could help?
I'm thinking of, e.g., a case where someone uses someone elses implementation of xmlparser.get() which always returns a string, even if the property is basically a number.
|
Python equal operator, avoid bugs of type: ( == ) -> False
| 0.099668 | 0 | 0 | 489 |
12,815,874 |
2012-10-10T09:15:00.000
| 2 | 0 | 1 | 0 |
python,design-patterns,operators,duck-typing
| 12,815,948 | 4 | true | 0 | 0 |
No. Because for ==, the reasoning is that equality implies comparibility. If two objects aren't even comparable they are not equal, therefore it will return false and never throw an exception.
| 2 | 2 | 0 |
Is there a way to obtain an exception when the == (equal) operator is used to compare different types? Python 3 throws an exception when attempting to order objects of different types. But == still returns False.
Or is there some other way to avoid hard to detect bugs caused by wrong type assumptions? Are there any design-patterns that could help?
I'm thinking of, e.g., a case where someone uses someone elses implementation of xmlparser.get() which always returns a string, even if the property is basically a number.
|
Python equal operator, avoid bugs of type: ( == ) -> False
| 1.2 | 0 | 0 | 489 |
12,816,482 |
2012-10-10T09:50:00.000
| 1 | 0 | 1 | 1 |
python,macos,python-imaging-library,homebrew
| 12,818,253 | 1 | true | 0 | 0 |
I think you would see this issue if you were using the python binary that was not installed by homebrew along with a package that you did install via homebrew. Could you verify that the python binary you are using is not the one that was included in OS X by default?
| 1 | 1 | 0 |
I have installed PIL with homebrew. It then says that there was a symlink error, and that is can be easily fixed by doing it again, but with a sudo. I did so. Now, when I go into python, and import Image, it doesn't work! I've tried import PIL, import image, import pil, and none of them work. When I try to install it again, it says Error: pil-1.1.7 already installed. Please help!
|
I have installed PIL with Homebrew, but when I try to import it, it says no module exists
| 1.2 | 0 | 0 | 344 |
12,818,397 |
2012-10-10T11:35:00.000
| 1 | 0 | 0 | 0 |
python,gtk
| 12,827,853 | 2 | false | 0 | 1 |
I have currently ended up doing this:
Instead of GtkMenuToolButton I have GtkToolItem with custom content
In custom content I have GtkMenuButton
Inside that one, I delete the default GtkArrow and replace it with 1x2 GtkGrid which has a Label + GtkArrow
As a whole it does what I want =)
| 1 | 1 | 0 |
I am using GtkMenuToolButton and it has a button and a menu. When you click on the arrow the menu is opened. I'd like to make the button open that same menu as well. Simply emitting "show-menu" in the "clicked" callback did not work. Please help how to make this work.
|
How to make GtkMenuToolButton open the same menu when 'clicked' signal is emitted?
| 0.099668 | 0 | 0 | 213 |
12,819,489 |
2012-10-10T12:35:00.000
| 2 | 1 | 0 | 0 |
python,nose,nosetests
| 12,820,015 | 2 | true | 0 | 0 |
You can achieve that effect ignoring all regular test files.
This can be done easily using the -I or --ignore-files options and a regex like .*\.py.
An other way could be to save the doctests in a separate directory and launch nose on that.
In newer versions of nose this doesn't seem to work anymore.
| 1 | 4 | 0 |
Is there a way to run only doctests using Python Nose (nosetests)? . I do not want to run any unittests but only and only the doctests.
Thanks.
|
run only doctests from python nose
| 1.2 | 0 | 0 | 604 |
12,821,201 |
2012-10-10T14:01:00.000
| -1 | 0 | 1 | 0 |
python,nlp,nltk
| 12,821,336 | 4 | false | 0 | 0 |
I don't think there is a specific method in nltk to help with this. This isn't tough though. If you have a sentence of n words (assuming you're using word level), get all ngrams of length 1-n, iterate through each of those ngrams and make them keys in an associative array, with the value being the count. Shouldn't be more than 30 lines of code, you could build your own package for this and import it where needed.
| 1 | 14 | 1 |
I've read a paper that uses ngram counts as feature for a classifier, and I was wondering what this exactly means.
Example text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam"
I can create unigrams, bigrams, trigrams, etc. out of this text, where I have to define on which "level" to create these unigrams. The "level" can be character, syllable, word, ...
So creating unigrams out of the sentence above would simply create a list of all words?
Creating bigrams would result in word pairs bringing together words that follow each other?
So if the paper talks about ngram counts, it simply creates unigrams, bigrams, trigrams, etc. out of the text, and counts how often which ngram occurs?
Is there an existing method in python's nltk package? Or do I have to implement a version of my own?
|
What are ngram counts and how to implement using nltk?
| -0.049958 | 0 | 0 | 21,407 |
12,824,745 |
2012-10-10T17:09:00.000
| 1 | 0 | 1 | 0 |
python,timer,schedule
| 12,826,242 | 4 | false | 0 | 0 |
You could:
Use cron (on *nix) or Windows task scheduler to run your script at a desired time.
It will make your solution both simpler and more robust.
Or
Run your script as a daemon and subscribe to file system events to monitor your files.
You could use pyinotify and the like depending on your OS. It provides the best reaction to changes time
Solutions based on time, threading, sched modules are more complex, harder to implement and less reliable.
| 1 | 0 | 0 |
Since I'm new to Python, I need some advice from experienced people. What is the best way to run a Python method from time A to time B every T minutes using only core Python libraries?
To be more specific:
I need single threaded app which will start monitor timestamps of pair of files to make sure that the difference in file creation is always greater than 0. I need to run this monitor only from 9 to 6 every 2 minutes. I will take a look at schedule and time library...
|
how to run a method from time a to time b every t minutes
| 0.049958 | 0 | 0 | 206 |
12,825,900 |
2012-10-10T18:25:00.000
| 0 | 0 | 1 | 0 |
python-3.x,pydev,pylint
| 12,835,241 | 1 | true | 0 | 0 |
There are some changes in the formatting of the messages in pylint 0.26 (http://www.logilab.org/ticket/104572) which likely need a pydev update to be properly handled. You should contact the Pydev author and request support for this.
If you can easily configure the command line for pylint in pydev, try adding --include_ids=y and see if this helps.
| 1 | 1 | 0 |
I have installed the latest pylint and it works fine from Windows command line. I have added Pydev-PYTHONPATH with source directory that I want to lint. Also from PyDev->PyLint I've selected 'Use pylint' and updated 'Location of pylint (lint.py):' with the correct lint.py. I don't see any lint output on either the Console or Problem view. My Eclipse is version 3.7.2.
What did I do wrong?
|
Pylint doesn't show anything on Eclipse
| 1.2 | 0 | 0 | 923 |
12,826,756 |
2012-10-10T19:21:00.000
| 7 | 0 | 0 | 0 |
python,django,csv,fixture
| 12,827,105 | 2 | true | 1 | 0 |
Django's built-in fixtures functionality doesn't support CSV. You'd need to process the file automatically using the csv module, probably in the test's setUp method.
| 1 | 4 | 0 |
For a Django test I'd like to load a fixture, which is in a csv file. What is the best way to do that?
|
Django fixture in csv
| 1.2 | 0 | 0 | 2,175 |
12,827,116 |
2012-10-10T19:41:00.000
| 3 | 0 | 1 | 0 |
python,python-2.7
| 12,828,126 | 2 | true | 0 | 0 |
What was happening is that I needed to use "import node" but I was using "from node import *" from main.py. This was preventing the main.py from linking to the updated node module!
(Sorry for accepting my own answer, but may be someone would also face the same problem later and hence I am uploading the solution)
| 1 | 3 | 0 |
I am using IDLE to write a few small sized Python programs. There are two class files - node.py (Node Class) and position.py (Position class). I have my main module code in main.py from which I instantiate Node and Position objects.
What I have noticed is that - when I make a change in node.py or position.py, check the modules and then run them using F5 the changes are not reflected back when I run main.py as long as all the files are open in IDLE. I noticed that I have to manually close all the three .py files and then close IDLE, start over again and run main.py to see the changes made in node.py and position.py.
What is the issue here? Are my environment variables not being set correctly? I have searched SO and online but have not found a satisfactory answer.
[Details: I am using IDLE version 2.7.3 in Ubuntu. All the three .py files and the corresponding .pyc byte code files are in the same directory. This directory is also seen in sys.path]
|
IDLE Python not detecting changes
| 1.2 | 0 | 0 | 1,518 |
12,829,395 |
2012-10-10T22:26:00.000
| 3 | 0 | 1 | 0 |
python,math,derivative
| 12,829,418 | 5 | false | 0 | 0 |
This is called symbolic differentation.
You need to parse the equation into tree of expressions and operations, then apply the normal rules of differentation (from Calculus I) to the tree.
| 3 | 0 | 0 |
Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possible.
|
Deriving a mathematical function in python
| 0.119427 | 0 | 0 | 7,240 |
12,829,395 |
2012-10-10T22:26:00.000
| 0 | 0 | 1 | 0 |
python,math,derivative
| 12,829,425 | 5 | false | 0 | 0 |
It's absolutely possible. You'll first need to parse the user's input string to get a representation of the function that you can work with. You'll then need to process the various terms in the function according the the differentiation rules you want to support.
| 3 | 0 | 0 |
Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possible.
|
Deriving a mathematical function in python
| 0 | 0 | 0 | 7,240 |
12,829,395 |
2012-10-10T22:26:00.000
| 4 | 0 | 1 | 0 |
python,math,derivative
| 12,829,442 | 5 | false | 0 | 0 |
It's obviously possible, as there are plenty of programs out there that do symbolic differentiation. That being said, it's non trivial. For your simple example above, you'd need to write a parser that would:
split up each of the terms of polynomial
parse the term and break it down to coefficient, variable, and exponent
Apply the power rule
String together the outputs
That would only handle this very basic type of derivative - no chain rule, product rule, etc, and you'd have to implement each of those separately.
So yes, definitely doable, but also non-trivial.
| 3 | 0 | 0 |
Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possible.
|
Deriving a mathematical function in python
| 0.158649 | 0 | 0 | 7,240 |
12,829,528 |
2012-10-10T22:38:00.000
| 1 | 0 | 0 | 0 |
python,mysql
| 12,829,637 | 2 | false | 0 | 0 |
what about print "%s %s" % (row[1], row[2]) (not sure if explicit casting is needed for the rows)
EDIT: or print "{0} {1}".format(s, s2) (the notation with % is a bit old-fashioned)
| 1 | 0 | 0 |
I have nearly successfully made a query for MySQL via Python that shows the most frequent datasets given the brand. The problem I am having is when I try to run the print row[1], row[2] command, it returns productnum instead of the space I want like product num. I tried doing print row[1], " ", row[2] but it doesn't satisfy the test cases. Is there another way to get around this problem. I know this may not sound like an important question but it has been bugging me and it is this problem that is not passing the tests. The full code is below.
|
A weird space issue Python
| 0.099668 | 0 | 0 | 236 |
12,830,437 |
2012-10-11T00:25:00.000
| 0 | 0 | 0 | 0 |
c#,python,sql,database,sml
| 19,391,151 | 1 | false | 0 | 0 |
Have you looked in using something like FileViewerPro? Its free download tool in order to open files. Also, what windows programs have you tried so far, like notepad, excel?
| 1 | 3 | 1 |
I have Toronto Stock Exchange stock data in a maxtor hard drive. The data is a TBF file with .dat and .pos components. The .dat file contains all the Stamp format transmission information in binary format.
I can read .pos file using R. It has 3 column with numbers, which make no sense to me. The data is information on stock and I think it is the result of Streambase.
I need to get 2007 price, value, and etc. information on some stocks that I am interested in.
Could you please suggest any way to read the data? Should I use some particular software to make sense of this data?
|
How to read tbf file with STAMP encryption
| 0 | 0 | 0 | 188 |
12,830,829 |
2012-10-11T01:17:00.000
| 3 | 0 | 1 | 0 |
python,regex
| 12,830,891 | 1 | false | 0 | 0 |
You can't expect to get more than a single pair from the regular expression, because there's now way for a set of parentheses to return multiple matches. Even if you do something like (([^:]+):([^ ]+) ?)* (which will match your string), the inner set of parentheses will return only one match (the last one).
If you want to get more pairs, you don't do it by changing the regular expression, you do it by taking a function that applies your regular expression multiple times to find all of the matches, like scan in Ruby.
| 1 | 3 | 0 |
Been working at this a bit, trying to figure it out for myself. Basically I'm taking user input, that can have a keyword/value structure like so:
Blah abc:def lah:123!dfj blah:22:34
which should end up being
('abc', 'def', 'lah':'123!dfj', 'blah':'22:34')
Currently I have (.[^: ]+):(.[^ ]+), but that's only getting the first value. Am I missing something obvious here?
|
Regex for "a:b"
| 0.53705 | 0 | 0 | 246 |
12,835,176 |
2012-10-11T08:20:00.000
| 2 | 0 | 1 | 0 |
python
| 12,835,628 | 2 | false | 0 | 0 |
A potential use case could be a "factory class" which returns instances of various classes depending on the implementation.
| 1 | 12 | 0 |
I understand what __new__ does (and how it's different from __init__) so I'm not interested in definitions, I'm interested in when and how to use __new__.
The documentation says:
In general, you shouldn't need to override __new__ unless you're subclassing an immutable type like str, int, unicode or tuple
But I can't think of other cases to use __new__ or how to use it correctly (for example when subclassing an immutable type or why it's needed in this case).
So, when, why and how do you need to use __new__?
I'm interested in the use cases, not what it does (I know what it does).
|
What are the use cases for Python's __new__?
| 0.197375 | 0 | 0 | 1,383 |
12,835,329 |
2012-10-11T08:30:00.000
| 1 | 0 | 0 | 1 |
python,hadoop,hadoop-streaming
| 12,843,376 | 1 | false | 0 | 0 |
You can use S3InputFormat (https://github.com/ATLANTBH/emr-s3-io) to read data directly to you mappers. But beware, in case of job failure you will redownload all data.
So, I suggest to download all data before process it. If you don't need to process whole data at once, you can start you mapreduce after distcp start. But you should write you own extension of FileInputFormat which will record somewhere (in input directory, i suppose) which files was processed, and on each invocation filter out processed files (in method getSplits()) and process only uprocessed files.
| 1 | 1 | 0 |
I'll broadly divide the work to be done in two parts:
I have huge data (amounting to approx 1 TB, divided into hundreds of files), which I'm copying from S3 to HDFS via distcp
This data will be acted upon by a hadoop streaming job (a simple mapper and reducer, written in python)
Now, I'll have to wait till all the data is copied to HDFS and only after that I can start my actual job. Here's the question: Considering that DISTCP in itself is a map-reduce job, is there a way I can "stream line" these two jobs, namely, can the second job start working on the data that has already been copied (e.g. distcp has already copied a few files, on which the second job can technically already start)?
I hope I've made myself clear.
|
Distcp with Hadoop streaming job
| 0.197375 | 0 | 0 | 906 |
12,837,793 |
2012-10-11T10:44:00.000
| 2 | 1 | 1 | 0 |
python,postscript
| 12,837,843 | 2 | false | 0 | 0 |
Actually, in most cases just parsing the Postscript will suffice, since a Postscript document is a normal text file.
As a clarification: yes, I am aware that what a Postscript document displays is a result of a program written in the beautifully reversed or reversely beautiful language called Postscript. In most of the cases, however, it is sufficient to grep the program source. In some other cases text may be encoded as a curve or bitmap and there will be no way of extracting it short of OCR'ing the rendered output.
Bottom line: it depends of the type of information you would like to extract, and on the type of the postscript file. In my view, ps2ascii is a fine tool, and one way of solving the problem, but one that (i) will not guarantee a success (maybe slightly more than greping the source) (ii) to a large extent just strips operators and (iii) might, in some cases, lead to a loss of text.
| 1 | 0 | 0 |
I am trying to extract an address automatically from a postscript document that has been intercepted by redmon and piped to a python program. I have gotten to the point where I can capture the postscript output (and write it to a file), but I am stuck at the extraction part.
Is there a good/reliable way of doing this in python, or do I need to run the postscript file through ps2ascii and hope for the best?
If there are tools in other languages that could do this I would be happy to evaluate them.
|
Extracting text from postscript and/or creating overlays using python
| 0.197375 | 0 | 0 | 2,171 |
12,839,509 |
2012-10-11T12:26:00.000
| 0 | 0 | 0 | 0 |
python,django,webpage
| 12,840,259 | 2 | false | 1 | 0 |
In your view, you can get the form data using request object. You can pass the form values to your script and send output to your response object.
It seems you didn't completely understand how django works. Please go through the tutorial again.
| 1 | 0 | 0 |
Am new to Django but want to learn it and have covered pretty much the basics on the Django website.
Here is my problem:
I have written a python script which presently works in the python shell, but I want to make use of the script on my web. So that when a user goes to my website and provides the neccesary input, clicks submit, the webpage links the input to the python script(which already has input fields like those on the webpage), and the python script runs according to the input given by the user, evaluates it and prints the result of the script on the webpage.
Please help me out guys, counting on you all.
But feel free to suggest other frameworks that could best serve my problem.
|
How to use a python script on a django website
| 0 | 0 | 0 | 1,101 |
12,840,696 |
2012-10-11T13:29:00.000
| 2 | 0 | 0 | 0 |
python,youtube-api
| 12,842,420 | 1 | false | 0 | 0 |
That's not something that's supported as part of the public YouTube Data API.
| 1 | 7 | 0 |
I am uploading videos to YouTube by using YouTube Data API (Python client library). Is it possible to set monetizing for that video from API rather than going to my account on the YouTube website and manually setting monetization for that uploaded video? If yes, then how can I do it from API? I am unable to find it in the API documentation, and Googling doesn't help either.
|
Enable Monetization on YouTube video using YouTube API
| 0.379949 | 0 | 1 | 1,037 |
12,842,693 |
2012-10-11T15:03:00.000
| 5 | 0 | 1 | 0 |
python,xml
| 12,842,752 | 2 | false | 0 | 0 |
Set up a simple web service that returns the current version number of the xml file and the executable. Have your program dial home to this web service on startup, and if the web service returns a newer version number then what the program has in its local copy then display a message to the user saying they could update (or start an automated update process).
| 1 | 5 | 0 |
I have developed my own program, but I would like to be able to dynamically tell the user that there is an update available for the program. This program is designed to be cross-platform, and is written in python. There will be two types of updates:
1) data updates (an xml file that includes the information required to run the program was updates) - This type of update will occur much more often
2) System updates (the actual executable [a python program compiled] is updated - This type of update will not occur as often
I need to be able to connect to an online database and compare the version posted there to the current program version to see if there is any update. If there is an update from the server, the program needs to be able to download and install that update with minimal user input. My question is how would I tell my program to systematically check for the update and then download and install it without crashing the program or asking the user to manually download and install it?
|
python - Check for updates for a program
| 0.462117 | 0 | 1 | 7,942 |
12,845,400 |
2012-10-11T17:40:00.000
| 0 | 0 | 0 | 1 |
python,google-app-engine,go
| 12,847,050 | 1 | true | 1 | 0 |
If you change the files that comprise your application, the application will need to restart in order to serve the new files.
If this is a real sticking point for you, I would suggest hosting the files elsewhere, like a CDN. Your application and the static resources that it employs do not need to be all in the same place.
| 1 | 0 | 0 |
Is there a way to avoid GAE server restart when the file within the root of my application changes. I use Go (GAE server is python based) runtime.
The intention is not to reload the server when some of my files (html, css, js files; which are under /static folder) changes. This is to avoid startup time during development. Any way to exclude them from file watch.
thanks.
|
Exclude files from causing GAE server restart
| 1.2 | 0 | 0 | 94 |
12,847,485 |
2012-10-11T19:57:00.000
| 0 | 0 | 1 | 0 |
python,verbosity
| 12,847,552 | 4 | false | 0 | 0 |
Parse your options with argparser and either pass them around or put them in a global
Note that you only have to use the global keyword when you want to assign to some name in the global scope, not when you just want yo read the value.
| 1 | 0 | 0 |
I want to add a verbose option to my python script but I'm not sure the best way to go about this. My main() function calls a parse_cmdline() function then a process() function. I want to create a function for my verbose option. I'm not sure where I should define my verbose function. Will I have to pass the verbose option from my parse_cmdline() to my process() function? I am looking for the best way to go about this.
|
Using --verbose in multi function python script
| 0 | 0 | 0 | 1,450 |
12,848,684 |
2012-10-11T21:19:00.000
| 4 | 0 | 0 | 0 |
python,oop,structure
| 12,849,650 | 3 | true | 0 | 1 |
Engine is an object that contains data like images and rendering code
This sounds like a God class: they're common in GUI code, and the problem you're having is a common effect of that.
What is the conceptual relationship between different stuff in Engine? Does it need to be tightly coupled, or could the Engine just coordinate between the State, a Renderer and some other stuff?
However that bit breaks down, passing the Engine (or Renderer, or whatever) down through the state machine is the only way to avoid a global (or singleton) with your current architecture.
The usual way to break this dependency is to use something like an MVC (Model/View/Controller) pattern. Specifically, it sounds like the Engine is already roughly a Controller, and the State and Elements have the Model part covered. However, the Engine, State and Elements are also handling the rendering/presentation part: this introduces the coupling.
If you can find a way to publish the State changes to some observer (deliberately leaving that vague, because we don't want the State logic to depend too much on the details of the observer), you can make a Renderer listen to State (model) updates and draw them. Now, the observer can be anything you want, so it's easy to mock, and it's also decoupled from the Engine.
| 1 | 3 | 0 |
I am having some issues making 'bigger than simple scripts and stuff' applications in Python. I have a class called WinMain, a class called Engine, one called State and another called Element. It's laid out like this:
WinMain is the main class of the program, it has a mainLoop function and various other things.
Engine is an object that contains data like images and rendering code.
State is an object held by Engine that has its update method called each time Engine's step function is called.
Elements are objects held by State that are things like gui buttons and pictures to render.
Since my rendering functions are in Engine, how will I get my Elements (held by state) to render things? I suppose I could give each Element the instance of Engine, but that seems to be kind of hacky, because I'd have to do stuff like this:
picture = Element(engine, (0, 0), 'gui_image') (not good)
I'd rather do picture = Element((0, 0), 'gui_image') and still some how let the Element render things using Engine.
This seems to be a major structural problem I have with most projects I start, and I can't seem to find a way around it (other than passing a honkload of variables through the arguments of classes and functions). How might I do this?
|
Python structural issue: Giving an 'engine' class to everything
| 1.2 | 0 | 0 | 467 |
12,849,846 |
2012-10-11T22:58:00.000
| 0 | 0 | 0 | 0 |
javascript,python,database,web-applications,web-frameworks
| 12,849,885 | 3 | false | 1 | 0 |
There are many, many, many ways to do what you seem to want to do.
I've been working on a home project that uses tornado.web (easy REST api), mongodb (storage, works espectially well with JSON documents), and nginx (load balancing for surges in requests).
For the front-end, I'm using nginx to serve static web content... which is comprised of a Backbone.js application for various CRUD operations.
But that's just how I did it.
| 1 | 0 | 0 |
I am working on building a webapp. I have been learning Python on my own for a few months but I need help figuring out HOW to proceed with building the app, specifically which web framework/database to use.
As I'm fairly new to this, I may not be using the correct terms, and
I'm sure many of these things may be obvious, but this is a basic list
of what I need the framework to be able to do:
I need to have a database, I'm not sure how large, the data is coming from an API that API returns JSON which I parse in python using Simple JSON, so I think it's just string dictionaries. For the API data I'd prefer to have one large database with with every key/value from the dictionary being a column/value in the database, as this seems like it would be the easiest to query - please let me know if this is an incorrect assumption.
In the front end of the webapp, which I've been told will need to
be written in Javascript, users will query the datastore using various
different parameters (e.g.show me the last 10 posts from blogs
X,Y, and Z, show me topics that were posted to by blog A and blog B.)
The framework should track user activity and save the data to use
it for future recommendations. Multiple users will be making queries at the
same time, and the framework should be saving their activity while
returning the data they requested.
The webapp should be scalable, so it can handle the requests in the
event that the app gets a surge in traffic/users etc. for any reason. This is currently a small project but in the case that more people want to use it I'd like to have that be an option without having to re-program it from scratch.
Lastly, as I'm fairly new to programming, all things equal, or
nearly equal I would much prefer a framework that is easy to use.
|
What Python Framework/database should I use for my webapp
| 0 | 0 | 0 | 457 |
12,850,504 |
2012-10-12T00:14:00.000
| 0 | 0 | 1 | 1 |
python-3.x,cygwin
| 12,863,615 | 1 | false | 0 | 0 |
Probably in /usr/bin, or in windows as {Cygwin Install directory}\bin. For example: D:\Cygwin\bin\
Ensure that you run python3.2.exe within the Cygwin emulation layer.
| 1 | 0 | 0 |
I've seen new cygwin for window contains python3.2 files.
Where is the python3.2.exe file under cygwin on window? I need it to configure interpreter for Eclipse in window, but I don't see it.
|
How to configure python32 interpreter under cygwin for eclipse in window ?
| 0 | 0 | 0 | 544 |
12,850,550 |
2012-10-12T00:21:00.000
| 5 | 0 | 0 | 0 |
python,django,postgresql,amazon-elastic-beanstalk
| 21,391,684 | 2 | false | 1 | 0 |
Postgre is now selectable from the AWS RDS configurations. Validated through Elastic Beanstalk application setup 2014-01-27.
| 1 | 5 | 0 |
I'm reading conflicting reports about using PostgreSQL on Amazon's Elastic Beanstalk for python (Django).
Some sources say it isn't possible: (http://www.forbes.com/sites/netapp/2012/08/20/amazon-cloud-elastic-beanstalk-paas-python/). I've been through a dummy app setup, and it does seem that MySQL is the only option (amongst other ones that aren't Postgres).
However, I've found fragments around the place mentioning that it is possible - even if they're very light on detail.
I need to know the following:
Is it possible to run a PostgreSQL database with a Django app on Elastic Beanstalk?
If it's possible, is it worth the trouble?
If it's possible, how would you set it up?
|
PostgreSQL for Django on Elastic Beanstalk
| 0.462117 | 1 | 0 | 2,422 |
12,851,374 |
2012-10-12T02:26:00.000
| 2 | 1 | 1 | 0 |
python,multithreading,nxt-python
| 12,852,400 | 1 | true | 1 | 0 |
You used the daemon thread instead of normal thread. because this is different to normal thread. I hope so daemon thread resolve your problem.
| 1 | 0 | 0 |
How do I create a thread that continuously checks for obstacles using the ultrasonic class in nxt-python 2.2.2? I want to implement it in a way that while my robot is moving it also detects obstacles in a background process and once it detects an object it will brake and do something else
|
Ultrasonic thread that runs in the background in python
| 1.2 | 0 | 0 | 235 |
12,851,527 |
2012-10-12T02:49:00.000
| 2 | 0 | 1 | 0 |
python,math,installation,createfile
| 12,851,575 | 1 | true | 0 | 0 |
Instead of writing a script that creates another script, a better way to solve the problem would be to write functions.
For example, the first function would read the names of variables, etc. and return these data as a dictionary.
Next, you would pass this dictionary into the second function, which, depending on the information stored in the dictionary, would read the remaining inputs and return another dictionary with the inputs.
Then, you could use the data from the returned dictionary to solve the equation.
| 1 | 0 | 0 |
I have looked around for a while now and am still unable to find an answer to a method of doing this. I have made a few scripts to solve equations and now am looking for a way to write a script that will allow input of steps into an equation,number and name of variables etc. My idea is to make a script that will take all of these inputs and then write another script that will ask for the numbers in an equation and solve the equation. Any ideas of how to write the first script so that it can create a second?
Also I forgot to mention that I want the newer script to be saved for later use/execution.
|
Python Script to Make Another Script
| 1.2 | 0 | 0 | 113 |
12,851,791 |
2012-10-12T03:27:00.000
| 1 | 0 | 1 | 0 |
python,string
| 12,851,838 | 8 | false | 0 | 0 |
If i understand your question right, one way to do is break down the string in chars and then check each char in that string using a loop whether it's a string or a number and then if string save it in a variable and then once the loop is finished, display that to the user
| 1 | 171 | 0 |
How can I remove digits from a string?
|
Removing numbers from string
| 0.024995 | 0 | 0 | 381,228 |
12,851,898 |
2012-10-12T03:43:00.000
| 0 | 1 | 0 | 0 |
django,python-sphinx,tastypie,documentation-generation
| 12,867,026 | 3 | false | 1 | 0 |
Perhaps I'm completely missing the point of your question but if you are just trying to build the docs that come with the source distribution there is a Makefile in the docs directory that performs the necessary actions. You are required to specify a target output type such as html, json, latex, etc. I keep a local copy of the docs for django, tastypie, and slumber as I use all three in conjunction with each other and I use the option make html frequently.
If I am mistaken about what you are trying to accomplish perhaps we can come to some clarification.
| 1 | 14 | 0 |
I'm trying to use auto-doc tool to generate API doc for Tastypie REST API. I tried Tastytool, but it seems not showing the API's result parameters but the model's columns. Then I tried Sphinx seems more promising since Tastypie supports Sphinx, but I can't find an example to show where & how to put comment for the API inside the code, and generate them into the document.
Anyone can share some info or example about correctly write comment and generate Sphinx doc for Tastypie based API? thanks.
|
Tastypie documentation generation
| 0 | 0 | 0 | 2,869 |
12,851,908 |
2012-10-12T03:44:00.000
| 0 | 0 | 0 | 0 |
python,sockets,input,udp,port
| 12,851,967 | 2 | false | 0 | 0 |
Consider using threads. Python threading is restricted; only one thread runs at a time within the interpreter, but if a thread is waiting for I/O (or a 'sleep') then other threads can run.
You still need to use queues and semaphores and so forth. See the 'threading' module in the library.
| 1 | 0 | 0 |
How can a client both react to user input and data received from the server?
I created a UDP server, which can handle multiple clients and can react to the data received from each clients. So far the clients only react to user input.
Is it possible, that the clients check for both user input and data on a specific port simultaneously?
|
Socketprogramming python
| 0 | 0 | 1 | 90 |
12,852,084 |
2012-10-12T04:06:00.000
| 0 | 0 | 0 | 0 |
python-2.7,ctypes,windows-7-x64,setupapi,pywinusb
| 12,862,740 | 1 | false | 0 | 1 |
There is a SetupDiGetClassDevsA and SetupDiGetClassDevsW. The Ex versions allow connecting to a remote machine. The A version takes a byte string for the second parameter, while the W version takes a Unicode string. The return value is a handle to a device information set.
The device information set has to be iterated with either SetupDiEnumDeviceInfo or SetupDiEnumDeviceInterfaces. The second function only works if you pass DIGCF_DEVICEINTERFACE as a flag to SetupDiGetClassDevs and pass an interface GUID for the ClassGuid parameter; otherwise, you pass a device class GUID and only SetupDiEnumDeviceInfo will return anything.
| 1 | 0 | 0 |
I'm trying to create a simple read/write application for a fairly simple USB device, but it's turning out to be not so simple at all.
I'm using WinUSB and SetupAPI DLLs and working from scratch since I can't seem to find anything that actually works for what I need. PyWinUSB and PyUSB and so on and so forth came close, but when I tried actually writing to the device with them they failed.
Anyway, right now I'm still at about ground zero. Following the instructions, I'm calling the SetupDiGetClassDevsExW function from the SetupAPI.dll. The function executes correctly as indicated by a call to the kernel32.lasterror function returning zero, but the only thing I'm getting back from the call is an integer value. Is that correct? Is this even the correct function? (There are 4 that are similar, and there is no just plain SetupDiGetClassDevs function. The 4 functions are SetupGetClassDevsExW, SetupGetCLassDevsExA, SetupGetClassDevsA, and SetupGetClassDevsW.) Do I need to create a class to work with this? I ask because calling the next function, SetupDiEnumDeviceInterfaces, has only been returning a fail with code 259, which means ERROR_NO_MORE_ITEMS according to a quick google search.
I've made some headway in that someone has showed me the correct class structure method for creating a structure for holding some information, but being that I've never actually worked with programming for a USB device before, let alone in Python, I'm still kind of stuck. I'll provide any more information that is needed for an answer, but right now I don't want to bog this Q/A down with needless information.
Thanks.
|
Calling SetupDiGetClassDevs from Python only returns an integer value
| 0 | 0 | 0 | 1,154 |
12,853,267 |
2012-10-12T06:13:00.000
| 1 | 0 | 0 | 0 |
python,user-interface,3d
| 12,854,078 | 1 | false | 0 | 1 |
In our company we have been working with the combination, Python, PyQt and OpenGL. It has not been super easy to integrate, but it was the best solution we found around 4 years ago.
| 1 | 0 | 0 |
I'm looking for a framework to write a GUI in python, the GUI will also include 3D graphics. I would like the development time to be really short, and the framework easy to get started with.
What do you recommend?
I'm considering PyQt but it doesn't seems to have good 3D support.
Another alternative would be a browser GUI, with WebGL, and have python on the backend. I think this will be really slow because I'm working with a lot of big photos.
|
3D & GUI for python
| 0.197375 | 0 | 0 | 1,682 |
12,857,063 |
2012-10-12T10:26:00.000
| 1 | 0 | 1 | 1 |
python,multithreading,directory
| 12,857,136 | 1 | true | 0 | 0 |
"Busy" polling is a waste of resources. There are a number of different, operating-system dependant APIs that allow this kind of monitoring.
Some of your choices (for Linux that is) include:
python-inotifyx - simple Python binding to the Linux inotify
python-pyinotify - simple Linux inotify Python bindings
python-gamin - Python binding for the gamin client library
| 1 | 0 | 0 |
I need to write a program which continuously checks a directory for new files and does some processing whenever there a new file is added. Obviously I will probably need to use some threads but is there any convenient way or pointers that anyone can suggest for achieving this in python ? (FOr both linux and windows)
|
Checking a directory continuously for new files
| 1.2 | 0 | 0 | 384 |
12,858,167 |
2012-10-12T11:32:00.000
| 0 | 0 | 1 | 0 |
python,archive,tarfile
| 12,858,290 | 2 | false | 0 | 0 |
Did you try extractall() method? As I remeber one of the this method arguments contains information where archive should be extracted.
| 1 | 2 | 0 |
I am writing a program in python and using tarfile to extract tarfiles. Some of these tarfiles contain folders which start with a / or (Alternatively for windows \) which cause problems (files are extracted to wrong place). How can I get around this issue and make sure that the extraction ends up in correct place ?
|
Extracting a tar file with folders starting with /
| 0 | 0 | 0 | 159 |
12,861,495 |
2012-10-12T14:43:00.000
| 1 | 0 | 1 | 0 |
python,tkinter
| 12,863,076 | 1 | true | 0 | 1 |
It is my understanding that tk needs to be run in the main thread.
| 1 | 0 | 0 |
I am writing a Tkinter App which does some long running operation. In order to prevent Tkinter window from hanging, i am introducing threading :- one thread for performing long running operation, second thread will be for updating GUI based on the QUEUE which will be filled by long running operation. Now I am thinking of running Tkinter mainloop in a separate thread instead of main thread, reason being is I want to update the state of GUI (Configure some buttons), only once the long running thread is complete. If I run the Tkinter mainloop in main thread, it won't wait for long running thread to complete and will update the GUI before it. So is it safe if i run Tkinter main loop in separate thread and in main loop wait for long running thread to complete before other updates? Any other ideas for this problem?
|
Python Tkinter in thread or in main app?
| 1.2 | 0 | 0 | 688 |
12,861,946 |
2012-10-12T15:05:00.000
| 2 | 0 | 1 | 0 |
python,uninstallation,pip,setup.py
| 12,871,055 | 2 | true | 0 | 0 |
I've solved it. Two steps:
Step 1: I install my project 'zeus'
python setup.py install
Setp 2: uninstall it:
pip uninstall zeus
Done
| 2 | 1 | 0 |
pip freeze result show:
-e [email protected]:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg=zeus-dev
It fails:
pip uninstall [email protected]:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg
|
How to uninstall Python site-package which was installed using "python setup.py develop"?
| 1.2 | 0 | 0 | 3,804 |
12,861,946 |
2012-10-12T15:05:00.000
| 0 | 0 | 1 | 0 |
python,uninstallation,pip,setup.py
| 70,636,526 | 2 | false | 0 | 0 |
install again with --record to store installing files.
python setup.py install --record install.log
manually remove those files from the record file
xargs rm -rf < install.log
| 2 | 1 | 0 |
pip freeze result show:
-e [email protected]:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg=zeus-dev
It fails:
pip uninstall [email protected]:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg
|
How to uninstall Python site-package which was installed using "python setup.py develop"?
| 0 | 0 | 0 | 3,804 |
12,862,260 |
2012-10-12T15:22:00.000
| 0 | 1 | 1 | 0 |
python
| 12,863,073 | 1 | false | 0 | 0 |
Most likely the problem is that TestLib.py isn't in your working directory. Make sure your Dailyscript.py sets its directory to wherever you ran it from (over SSH) before executing python sample.py.
Also, if you have SSH access, why aren't you just using SSH?
| 1 | 0 | 0 |
I am trying to run a python file from the telnet session
Steps:
Dailyscript.py
Telnetting in to montavista
from the telnet session I am trying to run another python file "python sample.py"
sample.py
Importing TestLib (in this file)
But, when I run directly form my linux box, it is running fine.
Is there any thing I need?
|
Import Error: No Module found named TestLIb
| 0 | 0 | 1 | 581 |
12,862,344 |
2012-10-12T15:27:00.000
| 0 | 0 | 0 | 0 |
python,signals,ipc
| 12,863,718 | 1 | true | 0 | 0 |
Signals are not designed to be general inter-process communication mechanisms that allow for passing data. They can't do much more than provide a notification. What the target process does in response can be fairly general (generating output to a particular file that the sender then knows to go look at, for example), but passing data directly back to the sender would require a different mechanism like a pipe, shared memory, message queue, etc. Also note that, in general, a process receiving a signal can't really determine who sent the signal, so it wouldn't know where to send a response anyway.
| 1 | 2 | 0 |
I have a python script that can run for long time in the background, and am trying to find a way of getting a status update from it. Basically we're considering to send it a SIGUSR1 signal, and then have it report back a status update.
Catching the signal in Python is not the issue, lots of information about that.
But how to get back information to the process initiating the signal? It seems that there is no way to figure out the pid of the initiating process by the receiving process, which could provide a way to send information back. A single reply message is enough here (in the tune of 'busy uploading; at 55% now; will finish at such a time'); a continuing update would be fantastic but not necessary.
What I've come up with is to write this data to a temporary file with predetermined name - has the issue of leaving stale files behind, and need some kind of clean-up routine then. But that sounds like a hack. Is there anything better available?
The way the running process is signalled doesn't matter, it doesn't have to be kill -SIGUSR1 pid. Any way to communicate with it would do. As long as the communication can be initiated from a new process that's started after the main process runs, possibly running under as different user.
|
Have python process talk back on SIGUSR1 call
| 1.2 | 0 | 0 | 882 |
12,864,616 |
2012-10-12T17:58:00.000
| 3 | 0 | 0 | 0 |
python,django
| 12,864,644 | 3 | false | 1 | 0 |
you could pass request.META['QUERY_STRING'] to the template.
You can grab the get params before you render the template and pass them to the template and render them on the correct link.
You could also build a query string from request.GET
| 1 | 10 | 0 |
I have a certain link to a url in a Django template. I would like to grab all the GET parameters of the current page url and add them to the url of the template's link. The current page might have zero GET parameters.
|
Generating a url with the same GET parameters as the current page in a Django template
| 0.197375 | 0 | 0 | 1,843 |
12,867,465 |
2012-10-12T21:38:00.000
| 1 | 0 | 1 | 0 |
python,recursion
| 12,869,565 | 2 | false | 0 | 1 |
I find it helps a LOT to express recursions in words. What the algorithm says is basically "what's visible at radius N is what's visible from radius N-1". Like, uh, the edge gets bigger.
| 1 | 0 | 0 |
I am attempting to teach myself python and have hit a rough spot once it has come to recursion. I have done the classic recursive functions (factorial, fibonacci numbers...) but I am going back over old code and trying to convert most of my iterative functions to recursive functions for practice.
This is the wall that I have hit:
I made a dungeon crawler a while back and I am trying to replace a for loop I used to reveal the squares near my sprite. So when the sprite is placed, he/she sees the tile he/she is on as well as the adjacent and diagonal squares (9 in total including the one the avatar is on).The other tiles making up the room are hidden. This I deemed view radius 1. For view radius 2, I wanted the char to see radius 1 squares plus all the tiles adjacent to those tiles. At the time I could not figure out how to do it with a for loop so I just implemented a simpler scheme.
I feel this visibility function could be written recursively but I am having a hard time coming up with a base case and what my recursive step would be. My for loop just took avatar pos and iterated over a range to avatar pos + radius and I did that for the x,y coordinates.
As far as translating this over to a recursive function I am really confused. I have done many searches trying to get a lead but only come up with complicated subjects such as: FOV using recursive shadowcasting which is way beyond me.
Any help would be greatly appreciated.
|
Recursive Function To Help Clear Tiles (Field Of View)
| 0.099668 | 0 | 0 | 241 |
12,868,135 |
2012-10-12T22:48:00.000
| 0 | 0 | 0 | 0 |
eclipse,python-2.7
| 12,868,194 | 2 | true | 1 | 0 |
Have you installed java runtime? If not, you need to install it first. If you have it already, you might need to adjust your path.
| 1 | 0 | 0 |
I installed Python 2.7 recently and with it Django--as part of the installation I had to add a PATH environment variable with the path to my Python installation.
After I did that, when I launch Eclipse, I get an error saying "javaw.exe" was not found. I need both Python and Eclipse on my machine, is there something I can do to fix this issue?
|
Eclipse error: "javaw.exe not found"
| 1.2 | 0 | 0 | 556 |
12,869,051 |
2012-10-13T01:10:00.000
| 1 | 0 | 0 | 0 |
python,html,rss,widget,feedparser
| 12,869,309 | 2 | true | 1 | 0 |
One of several options: i'm thinking this might be quickest/easiest...
Upload the python script to the server. Have it create/update a publicly readable file under the webroot. Write some javascript to load that page into your html page.
If you want to get fancy schedule the script to run periodically via cron.
| 2 | 0 | 0 |
This seems like a very simple question, so I will remove if it's a repeat. I just can't seem to find the answer.
I'm using the feedparser module to parse an RSS feed. I want to post the output to a widget on a site. I don't want the python script to write the whole page. I just want to be able to get the output to the web page. Can anyone just point me in the right direction?
Details:
I have a blog that is run separately from the page that I would like to post the RSS Feed on. I have the script to parse the blog and generate the info I want. I want to get the generated output into an iframe or table or the like on a static HTML page. The static page is entirely separate from the blog.
|
Place Python Output in HTML Widget
| 1.2 | 0 | 0 | 221 |
12,869,051 |
2012-10-13T01:10:00.000
| 1 | 0 | 0 | 0 |
python,html,rss,widget,feedparser
| 12,869,418 | 2 | false | 1 | 0 |
I'll paste my comment into the answer here as well.
There are a lot of ways to go about it, but I'll focus on the design decision question first.
To make things simple, create two pages. First page for displaying the generated info without the generated info, just the styling and all other icing on the cake. Include an which point to the second page, which is the generated content.
John's answer has a good method of solving the problem of manually running the script: by using cron.
| 2 | 0 | 0 |
This seems like a very simple question, so I will remove if it's a repeat. I just can't seem to find the answer.
I'm using the feedparser module to parse an RSS feed. I want to post the output to a widget on a site. I don't want the python script to write the whole page. I just want to be able to get the output to the web page. Can anyone just point me in the right direction?
Details:
I have a blog that is run separately from the page that I would like to post the RSS Feed on. I have the script to parse the blog and generate the info I want. I want to get the generated output into an iframe or table or the like on a static HTML page. The static page is entirely separate from the blog.
|
Place Python Output in HTML Widget
| 0.099668 | 0 | 0 | 221 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.