Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2009-11-08 10:29:19.143
Does WordNet have "levels"? (NLP)
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
WordNet's hypernym tree ends with a single root synset for the word "entity". If you are using WordNet's C library, then you can get a while recursive structure for a synset's ancestors using traceptrs_ds, and you can get the whole synset tree by recursively following nextss and ptrlst pointers until you hit null point...
0
false
4
324
2009-11-08 10:29:19.143
Does WordNet have "levels"? (NLP)
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
[Please credit Pete Kirkham, he first came with the reference to SUMO which may well answer the question asked by Alex, the OP] (I'm just providing a complement of information here; I started in a comment field but soon ran out of space and layout capabilites...) Alex: Most of SUMO is science or engineering? It does no...
0.454054
false
4
324
2009-11-08 10:29:19.143
Does WordNet have "levels"? (NLP)
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
In order to get levels, you need to predefine the content of each level. An ontology often defines these as the immediate IS_A children of a specific concept, but if that is absent, you need to develop a method of that yourself. The next step is to put a priority on each concept, in case you want to present only one ca...
0.16183
false
4
324
2009-11-08 16:24:29.113
Django/SQL: keeping track of who who read what in a forum
I'm working on a not-so-big project in django that will among other things incorporate a forum system. I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts. The thing is I can't really think of a way to properly stor...
You might also simply store the last time a user was reading a particular forum. Any posts that have been updated since that date are new. You'll only be storing one additional piece of information per user as opposed to a piece of information per post per user.
1.2
true
2
325
2009-11-08 16:24:29.113
Django/SQL: keeping track of who who read what in a forum
I'm working on a not-so-big project in django that will among other things incorporate a forum system. I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts. The thing is I can't really think of a way to properly stor...
You're much better off storing the "read" bit, not the "unread" bit. And you can store them not as relational data, but in a giant bit-blob. Then you don't have to modify the read data at all when new posts are added, only when a user reads posts.
0.386912
false
2
325
2009-11-08 17:01:35.417
Which database should I use to store records, and how should I use it?
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
Ok, so you say just storing the data..? You really only need a DB for retrieval, lookup, summarising, etc. So, for storing, just use simple text files and append lines. Compress the data if you need to, use delims between fields - just about any language will be able to read such files. If you do want to retrieve, then...
0
false
3
326
2009-11-08 17:01:35.417
Which database should I use to store records, and how should I use it?
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
BerkeleyDB is good, also look at the *DBM incarnations (e.g. GDBM). The big question though is: for what do you need to search? Do you need to search by that URL, by a range of URLs or the dates you list? It is also quite possible to keep groups of records as simple files in the local filesystem, grouped by dates ...
0.135221
false
3
326
2009-11-08 17:01:35.417
Which database should I use to store records, and how should I use it?
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
Personally I would use sqlite anyway. It has always just worked for me (and for others I work with). When your app grows and you suddenly do want to do something a little more sophisticated, you won't have to rewrite. On the other hand, I've seen various comments on the Python dev list about Berkely DB that suggest i...
0.135221
false
3
326
2009-11-09 11:24:40.500
Environment on google Appengine
does someone have an idea how to get the environment variables on Google-AppEngine ? I'm trying to write a simple Script that shall use the Client-IP (for Authentication) and a parameter (geturl or so) from the URL (for e.g. http://thingy.appspot.dom/index?geturl=www.google.at) I red that i should be able to get the C...
To answer the actual question from the title of your post, assuming you're still wondering: to get environment variables, simple import os and the environment is available in os.environ.
0.386912
false
1
327
2009-11-09 16:11:39.963
How do I profile `paster serve`'s startup time?
Python's paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I would like it to not fork a thread pool and quit as soon as it is ready to serve so the time after it's ready doesn't show ...
I almost always use paster serve --reload ... during development. That command executes itself as a subprocess (it executes its own script using the subprocess module, not fork()). The subprocess polls for source code changes, quits when it detects a change, and gets restarted by the parent paster serve --reload. That'...
1.2
true
1
328
2009-11-10 09:29:13.153
Client Digest Authentication Python with URLLIB2 will not remember Authorization Header Information
I am trying to use Python to write a client that connects to a custom http server that uses digest authentication. I can connect and pull the first request without problem. Using TCPDUMP (I am on MAC OS X--I am both a MAC and a Python noob) I can see the first request is actually two http requests, as you would expec...
Although it's not available out of the box, urllib2 is flexible enough to add it yourself. Subclass HTTPDigestAuthHandler, hack it (retry_http_digest_auth method I think) to remember authentication information and define an http_request(self, request) method to use it for all subsequent requests (add WWW-Authenticate h...
0.386912
false
1
329
2009-11-10 12:57:59.100
Call Python function from MATLAB
I need to call a Python function from MATLAB. how can I do this?
Like Daniel said you can run python commands directly from Matlab using the py. command. To run any of the libraries you just have to make sure Malab is running the python environment where you installed the libraries: On a Mac: Open a new terminal window; type: which python (to find out where the default version of ...
0.093914
false
1
330
2009-11-11 06:20:24.523
What if one of my programs runs in python 2.4, but IMPORTS something that requires python 2.5?
Then how do I import that? I run everything in python 2.4, but one of my scripts import xml.etree.ElementTree...which is only Python 2.5
Then it fails. You can't import a python 2.5 library while you're running python 2.4. It won't work. Why can't you run python 2.5+?
1.2
true
1
331
2009-11-12 22:07:34.947
time.sleep and suspend (ie. standby and hibernate)
For example, if I do time.sleep(100) and immediately hibernate my computer for 99 seconds, will the next statement be executed in 1 second or 100 seconds after waking up? If the answer is 1 second, how do you "sleep" 100 seconds, regardless of the length of hibernate/standby?
Clearly, you must sleep according to real, elapsed time. The alternative (sleeping according to some other clock that "somehow" started and stopped) would be unmanageable. How would your application (which is sleeping) be notified of all this starting and stopping activity? Right, it would have to be woken up to be t...
0
false
1
332
2009-11-13 10:13:58.413
How to get process's grandparent id
How can i get process id of the current process's parent? In general given a process id how can I get its parent process id? e.g. os.getpid() can be used to get the proccess id, and os.getppid() for the parent, how do I get grandparent, My target is linux(ubuntu) so platform specific answers are ok.
I do not think you can do this portably in the general case. You need to get this information from the process list (e.g. through the ps command), which is obtained in a system-specific way.
0
false
1
333
2009-11-14 00:30:09.483
Reading Alpha of a PNG Pixel. Fast way via pure Python?
I am having an issue with an embedded 64bit Python instance not liking PIL. Before i start exhausting more methods to get a compiled image editor to read the pixels for me (such as ImageMagick) i am hoping perhaps anyone here can think of a purely Python solution that will be comparable in speeds to the compiled counte...
Getting data out of a PNG requires unpacking data and decompressing it. These are likely going to be too slow in Python for your application. One possibility is to start with PyPNG and get rid of anything in it that you don't need. For example, it is probably storing all of the data it reads from the PNG, and some o...
1.2
true
1
334
2009-11-14 05:23:14.230
ubuntu9.10 : how to use python's lib-dynload and site-packages directories?
In ubuntu 9.10, in usr/lib/ there are the directories python2.4, python2.5, python2.6 and python3.0 Only python 2.6 is actually working. python2.4 has only a lib-dynload directory, python2.5 has only lib-dynload and site-packages, python3.0 has only a dist-packages directory. Now i'm wondering what is the idea behin...
Sounds like they're an accident from some package(s) you have installed. The Python version in use determines the locations searched to find installed Python packages/modules, and the "system version" of Python in Ubuntu 9.10 is 2.6, so that's what practically everything should be using. If you were to install the pyt...
0.101688
false
1
335
2009-11-16 00:55:28.293
Compress data before storage on Google App Engine
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest ...
You can store up to 10Mb with a list of Blobs. Search for google file service. It's much more versatile than BlobStore in my opinion, since I just started using BlobStore Api yesterday and I'm still figuring out if it is possible to access the data bytewise.. as in changing doc to pdf, jpeg to gif.. You can storage Bl...
0
false
2
336
2009-11-16 00:55:28.293
Compress data before storage on Google App Engine
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest ...
"Compressing before upload" implies doing it in the user's browser -- but no text in your question addresses that! It seems to be about compression in your GAE app, where of course the data will only be after the upload. You could do it with a Firefox extension (or other browsers' equivalents), if you can develop tho...
1.2
true
2
336
2009-11-16 09:23:41.317
How to make PowerBuilder UI testing application?
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to re...
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO. If you like, feel free to send me an email (see my profile for my email address), I'd be int...
0.201295
false
2
337
2009-11-16 09:23:41.317
How to make PowerBuilder UI testing application?
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to re...
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
0.101688
false
2
337
2009-11-17 12:19:04.847
Python: Connect blender with WinTracker 2
I am trying to develop a project that uses a control model in Blender by using WinTracker machine, but I don't know how to connect it with Blender Game Engine. How can I connect it with Blender Game Engine?
You must write the plug-in for blender and used the wintracker driver. It is ready for c Lagrange. but you have "wintracker2"? I wanted to buy it but the company said "it's not ready to seal".
0
false
1
338
2009-11-17 18:01:16.637
Django development server CPU intensive - how to analyse?
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
FWIW, you should do the profiling, but when you do I'll bet you find that the answer is "polling for changes to your files so it can auto-reload." You might do a quick test with "python manage.py runserver --noreload" and see how that affects the CPU usage.
1.2
true
2
339
2009-11-17 18:01:16.637
Django development server CPU intensive - how to analyse?
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
Hit Control-C and crash the process. It will probably crash somewhere that it's spending a lot of time. Or you could use a profiler.
0.386912
false
2
339
2009-11-20 17:41:19.937
pysvn with svn+ssh
I'm working with pysvn, and I'm trying to find a decent way to handle repositories that are only accessible via svn+ssh. Obviously SSH keys make this all incredibly easy, but I can't guarantee the end user will be using an SSH key. This also has to be able to run without user interaction, because it's going to be doing...
Check out ssh configuration option PasswordAuthentication. I'm not sure how pysvn interacts with ssh, but if you set this to no in your ~/.ssh/config (or maybe global config?) then it shouldn't prompt for a password.
1.2
true
1
340
2009-11-20 21:02:50.160
Linking Tcl/Tk to Python 2.5
I have an existing Python 2.4 and it is working properly with tkinter as I tested it using python import _tkinter import Tkinter Tkinter._test() Now, I have installed python 2.5.2 but when I try the same tests (with the newer version), it returns (but the same tests are working for the previous version) I...
The files you found are for linking directly to tcl/tk. Python depends on another library as well: _tkinter.so. It should be in /usr/lib/python2.5/lib-dynload/_tkinter.so. How did you install python2.5? If you are using Debian or Ubuntu you need to install the python-tk package to get Tkinter support. If the _tkinter.s...
0.995055
false
1
341
2009-11-21 18:24:26.190
replacing Matlab with python
i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. i have done some research and many have said that pyth...
I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way: If you can satisfy the following conditions: 1. You primarily use matrices and matrix operations 2. You have the money for a Matlab license 3. You work on a platform that mathworks supports T...
0.580532
false
1
342
2009-11-22 18:10:35.207
Django: request.META['REMOTE_ADDR'] is always '127.0.0.1'
I have an application running with debug=True on a remote host somewhere. Now somehow every time I access REMOTE_ADDR it returns 127.0.0.1 no matter where the request is from. I'm not sure where to start and why this is happening.
Do you have any kind of proxy, gateway, or load balancer running on that remote host? That's the sort of thing that would cause connections to appear to be from 127.0.0.1 (because that's where the immediate connection is from, as far as the web server is concerned).
1.2
true
1
343
2009-11-23 06:28:45.727
Python for web scripting
I'm just starting out with Python and have practiced so far in the IDLE interface. Now I'd like to configure Python with MAMP so I can start creating really basic webapps — using Python inside HTML, or well, vice-versa. (I'm assuming HTML is allowed in Python, just like PHP? If not, are there any modules/template engin...
You asked whether HTML is allowed within Python, which indicates that you still think too much in PHP terms about it. Contrary to PHP, Python was not designed to create dynamic web-pages. Instead, it was designed as a stand-alone, general-purpose programming language. Therefore you will not be able to put HTML into Pyt...
0.265586
false
1
344
2009-11-25 07:59:24.200
converting basic HTML to RML (Reportlab Markup Language)
Is there any Python library or some sample code which demonstrates how to convert basic HTML into RML (Reportlab Markup Language www.reportlab.org)? I can think of using a regular HTML parser and adding some home grown code to generate the RML, but I guess there will be a lot of cases to handle in such a conversion.
You shouldn't have much trouble doing this. Aside from some differences in element names, it's pretty straightforward: just ignore any HTML elements that can't be easily converted/you don't care about converting to RML and do the rest. I'm sure the ReportLab folks would be glad if you contributed even a basic HTML t...
1.2
true
1
345
2009-11-26 13:43:32.063
Error codes returned by urllib/urllib2 and the actual page
the normal behavior of urllib/urllib2 is if an error code is sent in the header of the response (i.e 404) an Exception is raised. How do you look for specific errors i.e (40x, or 50x) based on the different errors, do different things. Also, how do you read the actual data being returned HTML/JSON etc (The data usuall...
In urllib2 HTTPError exception is also a valid HTTP response, so you can treat an HTTP error as an exceptional event or valid response. But in urllib you have to subclass URLopener and define http_error_<code> method[s] or redefine http_error_default to handle them all.
0.201295
false
1
346
2009-11-28 01:24:12.507
How can I run redemo.py (or equivalent) on a Mac?
In the Python installation on my PC there is a sweet script in C:\python26\tools\scripts called redemo.py. It's a simple tk application for testing regular expressions. I wish I could get it--or something like it--running on my Mac, but I don't know how. The script doesn't appear to be part of the Python installation o...
Install Python on your Mac, then copy the script over? It should work fine on any Python installation.
0
false
1
347
2009-11-28 08:04:14.477
I want to develop a framework in Python for desktop based applications. How should I go about it?
I want to develop a desktop application framework in Python, much like QT, but how to go about it? Any tutorials or links related to it would be helpful!
Well the best way to start is to look at the source code of the framework the other answers are talking about. First, try to use them all to build the same application with the functionalities you expect from a framework. Them, look at how it works under the hood. Secondly, build your framework, starting by writing you...
1.2
true
1
348
2009-11-28 09:46:38.660
How to safely write to a file?
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe w...
If you see Python's documentation, it clearly mentions that os.rename() is an atomic operation. So in your case, writing data to a temporary file and then renaming it to the original file would be quite safe. Another way could work like this: let original file be abc.xml create abc.xml.tmp and write new data to it re...
1.2
true
2
349
2009-11-28 09:46:38.660
How to safely write to a file?
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe w...
The standard solution is this. Write a new file with a similar name. X.ext# for example. When that file has been closed (and perhaps even read and checksummed), then you two two renames. X.ext (the original) to X.ext~ X.ext# (the new one) to X.ext (Only for the crazy paranoids) call the OS sync function to force d...
0.201295
false
2
349
2009-11-29 02:20:09.160
Allow only one concurrent login per user in django app
is it possible to allow only one concurrent login per user in django application? if yes, how do you approach?
I'm going to assume that you mean logged in at once, and not one "login" at the same time. I've never written a Django application before. But one method I've used in other languages, is to store the session ID of the logged in user in their user row in the database. For example, if you have a users table in your datab...
0
false
1
350
2009-11-30 10:20:03.557
Close and open a new browser in Selenium
I'm writing a script which needs the browser that selenium is operating close and re-open, without losing its cookies. Any idea on how to go about it? Basically, it's a check to see that if the user opens and closes his browser, his cookies stay intact.
You should be able to use the stop and start commands. You will need to ensure that you are not clearing cookies between sessions, and depending on the browser you're launching you may also need to use the -browserSessionReuse command line option.
0.545705
false
2
351
2009-11-30 10:20:03.557
Close and open a new browser in Selenium
I'm writing a script which needs the browser that selenium is operating close and re-open, without losing its cookies. Any idea on how to go about it? Basically, it's a check to see that if the user opens and closes his browser, his cookies stay intact.
This is a feature of the browser and not your concern: If there is a bug in the browser, then there is little you can do. If you need to know whether a certain version of the browser works correctly, then define a manual test (write a document that explains the steps), do it once and record the result somewhere (like "...
0
false
2
351
2009-11-30 13:42:54.487
Javascript communication with Selenium (RC)
My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to how this calculation is going on, and so we can easily spot any NaNs creeping in. We are planning to integrate Selenium (...
If you are purely testing that the JavaScript functions are performing the correct calculations with the given inputs, I would suggest separating your JavaScript from your page and use a JavaScript testing framework to test the functionality. Testing low level code using Selenium is a lot of unnecessary overhead. If ...
0.201295
false
1
352
2009-12-01 18:38:46.943
Python syntax highlighting / Intellisense?
I've started messing around with Google App Engine, writing Python. I love Visual Studio for many reasons, but currently my .py files just look like text. I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up nothing. There are o...
Thanks for all the responses. I did scan through some Python IDEs (and their screenshots) and decided to check out IronPythonStudio. My .py files now get colour coded nicely, and there's some intellisense :) Unfortunately Ctrl+K,D doesn't work, but it's much nicer to code than the plain yellow text I had earlier. For a...
1.2
true
1
353
2009-12-03 04:43:05.963
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
"this would simply leave an extra 0 on the binary string--11011001 might get mapped to 01000001 rather than 1000001, and I won't actually save space." Correct. Your plan will do nothing.
0
false
3
354
2009-12-03 04:43:05.963
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
What you need is UTF-7. Edit: UTF-7 has the advantage of bloating "only" special characters, so if special characters are rare in the input, you get far less bytes than by just converting UTF-8 to 7 bit. That's what UTF-7 is for.
-0.135221
false
3
354
2009-12-03 04:43:05.963
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
Just use gzip compression, and save 60-70% with 0% effort!
0.995055
false
3
354
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
A mistake people coming from C# or Java make a lot is recreate a large class hierarchy like is common in those languages. With Python this is almost never useful. Instead, learn about duck typing. And don't worry too much about the lack of static typing: in practice, it's almost never an issue.
0.025505
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
I suggest going cold turkey - languages like Python shine with great text editors. Choose one you want to become amazing at (vim, emacs, etc.) and never look back.
0
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
Same way you do anything else that doesn't have IntelliStuff. I'm betting you wrote that question without the aid of an IntelliEnglish computer program that showed you a list of verbs you could use and automatically added punctuation at the end of your sentences, for example. :-)
0.025505
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
<rant> This is sort of the reason that I think being a good visual studio user makes you a bad developer. Instead of learning an API, you look in the object browser until you find something that sounds more or less like what you are looking for, instantiate it, then hit . and start looking for what sounds like the righ...
0.101688
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
Don't worry about intellisense. Python is really simple and there really isn't that much to know, so after a few projects you'll be conceiving of python code while driving, eating, etc., without really even trying. Plus, python's built in text editor (IDLE) has a wimpy version of intellisense that has always been more ...
0.025505
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
You could always start with IronPython and continue to develop in Visual Studio.
0.050976
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
I'm not too familiar with Python so I'll give some general advice. Make sure to print out some reference pages of common functions. Keep them by you(or pinned to a wall or desk) at all times when your programming.. I'm traditionally a "stone age" developer and after developing in VS for a few months I'm finding my hobb...
0
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
The python ide from wingware is pretty nice. Thats what I ended up using going from visual studio C++/.net to doing python.
0.050976
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
I've only ever used IDLE for python development and it is not fun in the least. I would recommend getting your favorite text editor, mine is notepad++, and praying for a decent plugin for it. I only ever had to go from Eclipse to Visual Studio so my opinions are generally invalid in these contexts.
0
false
10
355
2009-12-03 21:57:03.280
how to transition from C# to python?
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
One step at a time? Start off with simple programs (things you can write with your eyes closed in C#), and keep going... You will end up knowing the API by heart.
0.126864
false
10
355
2009-12-04 14:02:47.403
Best XMPP Library for Python Web Application
I want to learn how to use XMPP and to create a simple web application with real collaboration features. I am writing the application with Python(WSGI), and the application will require javascript enabled because I am going to use jQuery or Dojo. I have downloaded Openfire for the server and which lib to choose? SleekX...
I have found a lot of issues with Openfire and TLS are not with the xmpp lib :( -- SleekXMPP in the trunk has been converted to Python 3.0 and the branch is maintained for Python 2.5 Unlike Julien, I would only go with Twisted Words if you really need the power of Twisted or if you are already using Twisted. IMO Sleek...
0
false
1
356
2009-12-07 10:38:17.450
problem with pyglet playing video
I'm new to pyglet and i have a problem with video.. I'm trying to play a video using pyglet .. but instead of playing the video in the window it just exits immediately and terminates .. do you guys have any solution for this problem how can i hold the window to play vedio?? i use windows vista 64x with python 2.5 ple...
I think calling "pyglet.app.run()" is missing.
1.2
true
1
357
2009-12-07 16:52:25.453
Writing my own django-cms plugin. Any recommendations?
I don't see any possibility for creating a table in django-cms. I need this functionnality so I am evaluating the possibility to write my own plugin. I am getting started with this product. I've read the documentation carefully and I see more or less how to do that. However, I would be happy to hear some tips and trick...
This all depends on your model. Plugins use standard django admin features. This also depends on the source data for the table. If you have a CSV or Exel sheet as source i only would make a file field and render the file in the render function with some optional caching. If you want to enter data by hand: A Table mode...
1.2
true
1
358
2009-12-08 21:59:17.270
Render in infinity loop
Question for Python 2.6 I would like to create an simple web application which in specified time interval will run a script that modifies the data (in database). My problem is code for infinity loop or some other method to achieve this goal. The script should be run only once by the user. Next iterations should run aut...
Can you use cron to schedule the job to run at certain intervals? It's usually considered better than infinite loops, and was designed to help solve this sort of problem.
0
false
1
359
2009-12-10 09:42:32.627
DJANGO : Update div with AJAX
I am building a chat application. So far I am adding chat messages with jquery $.post() and this works fine. Now I need to retrieve the latest chat message from the table and append the list on the chat page. I am new to Django, so please go slow. So how do I get data from the chat table back to the chat page? Thanks i...
Since you're already using an AJAX post, why don't you return the data from that and insert it into the div? The view that accepts the post can return a rendered template or JSON, and your javascript can insert it in the callback.
0.265586
false
1
360
2009-12-10 15:41:09.420
How to unpickle from C code
I have a python code computing a matrix, and I would like to use this matrix (or array, or list) from C code. I wanted to pickle the matrix from the python code, and unpickle it from c code, but I could not find documentation or example on how to do this. I found something about marshalling data, but nothing about unpi...
take a look at module struct ?
0
false
1
361
2009-12-13 14:46:44.253
How to return a float point number with a defined number of decimal places?
So I know how to print a floating point number with a certain decimal places. My question is how to return it with a specified number of decimal places? Thanks.
In order to get two decimal places, multiply the number by 100, floor it, then divide by 100. And note that the number you will return will not really have only two decimal places because division by 100 cannot be represented exactly in IEEE-754 floating-point arithmetic most of the time. It will only be the closest re...
0.386912
false
2
362
2009-12-13 14:46:44.253
How to return a float point number with a defined number of decimal places?
So I know how to print a floating point number with a certain decimal places. My question is how to return it with a specified number of decimal places? Thanks.
Floating point numbers have infinite number of decimal places. The physical representation on the computer is dependent on the representation of float, or double, or whatever and is dependent on a) language b) construct, e.g. float, double, etc. c) compiler implementation d) hardware. Now, given that you have a represe...
0.201295
false
2
362
2009-12-13 21:07:43.213
Executing server-side Unix scripts asynchronously
We have a collection of Unix scripts (and/or Python modules) that each perform a long running task. I would like to provide a web interface for them that does the following: Asks for relevant data to pass into scripts. Allows for starting/stopping/killing them. Allows for monitoring the progress and/or other informati...
Django is great for writing web applications, and the subprocess module (subprocess.Popen en .communicate()) is great for executing shell scripts. You can give it a stdin,stdout and stderr stream for communication if you want.
0.135221
false
1
363
2009-12-14 17:38:08.390
How to implement time event scheduler in python?
In python how to implement a thread which runs in the background (may be when the module loads) and calls the function every minute Monday to Friday 10 AM to 3 PM. For example the function should be called at: 10:01 AM 10:02 AM 10:03 AM . . 2:59 PM Any pointers? Environment: Django Thanks
Django is a server application, which only reacts to external events. You should use a scheduler like cron to create events that call your django application, either calling a management subcommand or doing an HTTP request on some special page.
1.2
true
1
364
2009-12-15 14:21:15.453
Integrate Python app into PHP site
This might sound really crazy, but still... For our revamped project site, we want to integrate Trac (as code browser, developer wiki and issue tracker) into the site design. That is, of course, difficult, since Trac is written in Python and our site in PHP. Does anybody here know a way how to integrate a header and fo...
The best option probably is to (re)write the header and footer using python. If the header and footer are relatively static you can also generate them once using php (or once every x minutes) and include them from the filesystem. (You probably already thought about this and dismissed the idea because your sites are too...
0.135221
false
2
365
2009-12-15 14:21:15.453
Integrate Python app into PHP site
This might sound really crazy, but still... For our revamped project site, we want to integrate Trac (as code browser, developer wiki and issue tracker) into the site design. That is, of course, difficult, since Trac is written in Python and our site in PHP. Does anybody here know a way how to integrate a header and fo...
Your Python code will have access to your users' cookies. A template would be best, but if you don't have one available (or the header/footer are trivially small, or whatever), you can simply port the PHP header and footer code to Python, using the cookies that are already there to query the database or whatever you ne...
0
false
2
365
2009-12-15 17:26:21.320
Import error with virtualenv
I have a problem with virtualenv. I use it regulary, I use it on my development machine and on several servers. But on this last server I tried to use i got a problem. I created a virtualenv with the --no-site-packages argument, and then I installed some python modules inside the virtualenv. I can confirm that the modu...
Is there a bash alias active on this machine for "python", by any chance? That will take priority over the PATH-modifications made by activate, and could cause the wrong python binary to be used. Try running virtualenv/bin/python directly (no need to activate) and see if you can import your module. If this fixes it, yo...
1.2
true
1
366
2009-12-15 18:03:17.750
How to clean up my Python Installation for a fresh start
I'm developing on Snow Leopard and going through the various "how tos" to get the MySQLdb package installed and working (uphill battle). Things are a mess and I'd like to regain confidence with a fresh, clean, as close to factory install of Python 2.6. What folders should I clean out? What should I run? What symboli...
when doing an "port selfupdate", rsync timesout with rsync.macports.org. There are mirror sites available to use.
0
false
2
367
2009-12-15 18:03:17.750
How to clean up my Python Installation for a fresh start
I'm developing on Snow Leopard and going through the various "how tos" to get the MySQLdb package installed and working (uphill battle). Things are a mess and I'd like to regain confidence with a fresh, clean, as close to factory install of Python 2.6. What folders should I clean out? What should I run? What symboli...
My experience doing development on MacOSX is that the directories for libraries and installation tools are just different enough to cause a lot of problems that you end up having to fix by hand. Eventually, your computer becomes a sketchy wasteland of files and folders duplicated all over the place in an effort to solv...
0.101688
false
2
367
2009-12-16 01:04:08.380
Python: How do I find why IDLE restarts?
I am using python 2.5 on windows. All I am doing is unpickling a large file (18MB - a list of dictionaries) and modifiying some of its values. Now this works fine. But when I add a couple of prints, IDLE restarts. And weirdly enough it seems to be happening where I added the print. I figured this out commenting and unc...
Enable the debugger and see if it tells you anything.
0
false
1
368
2009-12-16 04:11:41.030
deleter decorator using Property in Python
I'm playing around with property in Python and I was wondering how this @propertyName.deleter decorator works. I'm probably missing something, I could not find clear answers by Google. What I would like to achieve is when this deleter behavior is called, I can trigger other actions (e.g: using my 3d application SDK). ...
In Python 3 you WOULD see the print's result -- and then an AttributeError for the last print (because _m has disappeared). You may be using Python 2.6, in which case you need to change the class clause to class M(object): to make M new-style, and then you'll get the same behavior as in Python 3.
0.999753
false
1
369
2009-12-16 04:44:50.613
Django: Where to put helper functions?
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
If they are related to a specific app, I usually just put them in the related app folder and name the file, 'functions.py'. If they're not specific to an app, I make a commons app for components (tests, models, functions, etc) that are shared across apps.
0.996998
false
3
370
2009-12-16 04:44:50.613
Django: Where to put helper functions?
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
I am using new python file service.py in app folder. The file contains mostly helper queries for specific app. Also I used to create a folder inside Django application that contains global helper functions and constants.
0.201295
false
3
370
2009-12-16 04:44:50.613
Django: Where to put helper functions?
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
create a reusable app that include your generic functions so you can share between projects. use for example a git repo to store this app and manage deployments and evolution (submodule) use a public git repo so you can share with the community :)
0.999753
false
3
370
2009-12-16 23:00:08.263
split a pdf based on outline
i would like to use pyPdf to split a pdf file based on the outline where each destination in the outline refers to a different page within the pdf. example outline: main --> points to page 1 sect1 --> points to page 1 sect2 --> points to page 15 sect3 --> points to page 22 it is easy within pyPd...
Darrell's class can be modified slightly to produce a multi-level table of contents for a pdf (in the manner of pdftoc in the pdftk toolkit.) My modification adds one more parameter to _setup_page_id_to_num, an integer "level" which defaults to 1. Each invocation increments the level. Instead of storing just the page ...
0
false
1
371
2009-12-18 02:49:46.067
How to get the LAN IP that a socket is sending (linux)
I need some code to get the address of the socket i just created (to filter out packets originating from localhost on a multicast network) this: socket.gethostbyname(socket.gethostname()) works on mac but it returns only the localhost IP in linux... is there anyway to get the LAN address thanks --edit-- is it possible ...
quick answer - socket.getpeername() (provided that socket is a socket object, not a module) (playing around in python/ipython/idle/... interactive shell is very helpful) .. or if I read you question carefully, maybe socket.getsockname() :)
0
false
1
372
2009-12-18 15:55:10.657
Python GUI (glade) to display output of shell process
I'm writing a python application that runs several subprocesses using subprocess.Popen objects. I have a glade GUI and want to display the output of these commands (running in subprocess.Popen) in the gui in real time. Can anyone suggest a way to do this? What glade object do I need to use and how to redirect the outpu...
glade is only a program to build gui with gtk so when you ask for a glade object maybe you should ask for gtk widget and in this case textbuffer and textview chould be a solution or maybe treeview and liststore. subprocess.Popen has stdout and stderr arguments that can accept a file-like object. you can create an adapt...
0.135221
false
1
373
2009-12-19 20:46:21.423
Rotating Proxies for web scraping
I've got a python web crawler and I want to distribute the download requests among many different proxy servers, probably running squid (though I'm open to alternatives). For example, it could work in a round-robin fashion, where request1 goes to proxy1, request2 to proxy2, and eventually looping back around. Any idea ...
Make your crawler have a list of proxies and with each HTTP request let it use the next proxy from the list in a round robin fashion. However, this will prevent you from using HTTP/1.1 persistent connections. Modifying the proxy list will eventually result in using a new or not using a proxy. Or have several connection...
1.2
true
1
374
2009-12-20 08:52:40.370
how do I add a python module on MacOS X?
I'm trying to use pywn, a python library for using WordNet. I've played about with python a little under Windows, but am completely new at MacOS X stuff. I'm running under MacOS 10.5.8, so my default Python interpreter is 2.5.1 The pywn instructions say: "Put each of the .py files somewhere in your python search path."...
I think by default /Library/Python/2.5/site-packages/ is part of your search path. This directory is usually used for third party libraries.
1.2
true
1
375
2009-12-25 00:25:16.753
Start a "throwaway" MySQL session for testing code?
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
You can try the Blackhole and Memory table types in MySQL.
0
false
2
376
2009-12-25 00:25:16.753
Start a "throwaway" MySQL session for testing code?
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
--datadir for just the data or --basedir
1.2
true
2
376
2009-12-26 02:05:47.180
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
Go to project browser Create a model Right-click model > Add > Add View > Class Right-click class > Code Engineering > Import Source Directory... Check "one package per folder" The last one ensures you'll have an interesting diagram full of classes.
0.101688
false
2
377
2009-12-26 02:05:47.180
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
File / New Project / enter your project name. In the Project Browser, create a package named "source" Right-click the source package, "Code Engineering", "Import Source Directory". Pick the directory containing your module(s) as the "Root Directory" Set "Source Type" to Python Enable "Recursively Process Subdirectories...
0.386912
false
2
377
2009-12-26 04:02:57.850
How do I make a simple file browser in wxPython?
I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance! EDIT: a sort of side question, how much of wxPy...
You can take a look at the wxPython examples, they also include code samples for almost all of the widgets supported by wxPython. If you use Windows they can be found in the Start Menu folder of WxPython.
0.135221
false
1
378
2009-12-29 23:15:55.703
Play Subset of audio file using Pyglet
How can I use the pyglet API for sound to play subsets of a sound file e.g. from 1 second in to 3.5seconds of a 6 second sound clip? I can load a sound file and play it, and can seek to the start of the interval desired, but am wondering how to stop playback at the point indicated?
It doesn't appear that pyglet has support for setting a stop time. Your options are: Poll the current time and stop playback when you've reached your desired endpoint. This may not be precise enough for you. Or, use a sound file library to extract the portion you want into a temporary sound file, then use pyglet to ...
1.2
true
1
379
2010-01-02 03:19:49.930
Django: signal when user logs in?
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
Rough idea - you could use middleware for this. This middleware could process requests and fire signal when relevant URL is requested. It could also process responses and fire signal when given action actually succeded.
0
false
2
380
2010-01-02 03:19:49.930
Django: signal when user logs in?
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
The only reliable way (that also detects when the user has closed the browser) is to update some last_request field every time the user loads a page. You could also have a periodic AJAX request that pings the server every x minutes if the user has a page open. Then have a single background job that gets a list of recen...
0.058243
false
2
380
2010-01-02 22:14:33.183
Upload file to a website via Python script
I want to upload a file from my computer to a file hoster like hotfile.com via a Python script. Because Hotfile is only offering a web-based upload service (no ftp). I need Python first to login with my username and password and after that to upload the file. When the file transfer is over, I need the Download and Dele...
You mention they do not offer FTP, but I went to their site and found the following: How to upload with FTP? ftp.hotfile.com user: your hotfile username pass: your hotfile password You can upload and make folders, but cant rename,move files Try it. If it works, using FTP from within Python will be a very simp...
0
false
1
381
2010-01-03 10:14:58.217
how to start a thread when django runserver?
I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?
Why would you want to do that? runserver is for development only, it should never be used in production. And if you're running via Apache, it should manage threads/processes for you anyway.
0.998178
false
2
382
2010-01-03 10:14:58.217
how to start a thread when django runserver?
I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?
Agree with the above answer, you probably don't want to do this. Runserver should be used for development only. Once you deploy, you'll want to move to Apache/WSGI. On my dev machine (where I do use runserver), I usually throw it in a screen session, so it doesn't get in the way, but I can pull it back up if I need to ...
0
false
2
382
2010-01-05 17:36:48.483
How to use C# client to consume Django/Python web service (all methods are returning null)?
I have a C# command-line client that I'm testing the consumption of SOAP/WSDL via Django/Python/soaplib created WSDL. I've managed to successfully connect to the web service by adding a service reference. I then call one of service's methods, and the service processes the data I send, but it returns null instead of the...
We faced the similar problem while consuming a web service it was the type of data returned we were getting data in UTF-16 format. Please check if you have proper data type in use.
0
false
2
383
2010-01-05 17:36:48.483
How to use C# client to consume Django/Python web service (all methods are returning null)?
I have a C# command-line client that I'm testing the consumption of SOAP/WSDL via Django/Python/soaplib created WSDL. I've managed to successfully connect to the web service by adding a service reference. I then call one of service's methods, and the service processes the data I send, but it returns null instead of the...
One thing you can do is start by building a manual proxy using WebClient, or WebRequest/WebResponse. Construct your manual proxy to send the desired data to the WS for testing. Couple of things to check on the WSDL implementation: The WSDL definition needs to match exactly, including case, for the C# proxy to recogniz...
0
false
2
383
2010-01-06 00:47:29.197
Speeding up the python "import" loader
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
Something's missing from your premise--I've never seen some "more-or-less" basic modules take over a second to import, and I'm not running Python on what I would call cutting-edge hardware. Either you're running on some seriously old hardware, or you're running on an overloaded machine, or either your OS or Python ins...
0.081452
false
3
384
2010-01-06 00:47:29.197
Speeding up the python "import" loader
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
zipping up as many pyc files as feasible (with proper directory structure for packages), and putting that zipfile as the very first entry in sys.path (on the best available local disk, ideally) can speed up startup times a lot.
0.715303
false
3
384
2010-01-06 00:47:29.197
Speeding up the python "import" loader
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
The first things that come to mind are: Try a smaller path Make sure your modules are pyc's so they'll load faster Make sure you don't double import, or import too much Other than that, are you sure that the disk operations are what's bogging you down? Is your disk/operating system really busy or old and slow? Mayb...
0.3154
false
3
384
2010-01-06 15:09:00.097
Django: How should I store a money value?
I'm running into a paradigm problem here. I don't know whether I should store money as a Decimal(), or if I should store it as a string and convert it to a decimal myself. My reasoning is this: PayPal requires 2 decimal places, so if I have a product that is 49 dollars even, PayPal wants to see 49.00 come across the wi...
You store it as a DecimalField and manually add the decimals if you need to, as Valya said, using basic formatting techniques. You can even add a Model Method to you product or transaction model that will spit out the DecimalField as an appropriately formatted string.
0.040794
false
2
385
2010-01-06 15:09:00.097
Django: How should I store a money value?
I'm running into a paradigm problem here. I don't know whether I should store money as a Decimal(), or if I should store it as a string and convert it to a decimal myself. My reasoning is this: PayPal requires 2 decimal places, so if I have a product that is 49 dollars even, PayPal wants to see 49.00 come across the wi...
I suggest to avoid mixing representation with storage. Store the data as a decimal value with 2 places. In the UI layer, display it in a form which is suitable for the user (so maybe omit the ".00"). When you send the data to PayPal, format it as the interface requires.
0.386912
false
2
385
2010-01-06 17:57:47.400
How does one do async ajax calls using cherrypy?
I'm using cherrypy's standalone server (cherrypy.quickstart()) and sqlite3 for a database. I was wondering how one would do ajax/jquery asynchronous calls to the database while using cherrypy?
The same way you would do them using any other webserver - by getting your javascript to call a URL which is handled by the server-side application.
1.2
true
1
386
2010-01-07 12:45:37.600
how do i get the byte count of a variable in python just like wc -c gives in unix
i am facing some problem with files with huge data. i need to skip doing some execution on those files. i get the data of the file into a variable. now i need to get the byte of the variable and if it is greater than 102400 , then print a message. update : i cannot open the files , since it is present in a tar file. ...
This answer seems irrelevant, since I seem to have misunderstood the question, which has now been clarified. However, should someone find this question, while searching with pretty much the same terms, this answer may still be relevant: Just open the file in binary mode f = open(filename, 'rb') read/skip a bunch and pr...
0
false
2
387
2010-01-07 12:45:37.600
how do i get the byte count of a variable in python just like wc -c gives in unix
i am facing some problem with files with huge data. i need to skip doing some execution on those files. i get the data of the file into a variable. now i need to get the byte of the variable and if it is greater than 102400 , then print a message. update : i cannot open the files , since it is present in a tar file. ...
len(data) gives you the size in bytes if it's binary data. With strings the size depends on the encoding used.
0.081452
false
2
387
2010-01-07 16:14:40.953
how to make fillable forms with reportlab in python
can anyone please help me with creating forms in python using the reportlab lib. i am totally new to this and i would appreciate sample code thanks
Apparently reportlab does not support creating fillable pdf forms. The only thing I found about it being present in the API dates from 2003, afterwards all statements clearly say no. I'm answering this so late because this is one of the highest hits when you enter 'reportlab forms' in google. I do agree with Travis you...
0.999998
false
1
388