Available Count
int64 1
31
| AnswerCount
int64 1
35
| GUI and Desktop Applications
int64 0
1
| Users Score
int64 -17
588
| Q_Score
int64 0
6.79k
| Python Basics and Environment
int64 0
1
| Score
float64 -1
1.2
| Networking and APIs
int64 0
1
| Question
stringlengths 15
7.24k
| Database and SQL
int64 0
1
| Tags
stringlengths 6
76
| CreationDate
stringlengths 23
23
| System Administration and DevOps
int64 0
1
| Q_Id
int64 469
38.2M
| Answer
stringlengths 15
7k
| Data Science and Machine Learning
int64 0
1
| ViewCount
int64 13
1.88M
| is_accepted
bool 2
classes | Web Development
int64 0
1
| Other
int64 1
1
| Title
stringlengths 15
142
| A_Id
int64 518
72.2M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9 | 11 | 0 | 1 | 6 | 0 | 0.01818 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | If you are programming in Python or in Java, the interpreter and the virtual machine respectively abstract this layer of the architecture. You then need not to worry if it's running on a 32 or 64 bits architecture.
The same cannot be said for C++, in which you'll have to ask yourself sometimes if you are running on a 32 or 64 bits machine | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,141 |
9 | 11 | 0 | 0 | 6 | 0 | 0 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | In C++, you have to be very careful if you want to write code that works indifferently on 32 or 64 bits.
Many people wrongly assume that int can store a pointer, for example. | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,113 |
9 | 11 | 0 | 0 | 6 | 0 | 0 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | A 32 bit machine will allow you to have a maximum of 4 GB of addressable virtual memory. (In practice, it's even less than that, usually 2 GB or 3 GB depending on the OS and various linker options.) On a 64 bit machine, you can have a HUGE virtual address space (in any practical sense, limited only by disk) and a pretty damn big RAM.
So if you are expecting 6GB data sets for some computation (let's say something that needs incoherent access and can't just be streamed a bit at a time), on a 64 bit architecture you could just read it into RAM and do your stuff, whereas on a 32 bit architecture you need a fundamentally different way to approach it, since you simply do not have the option of keeping the entire data set resident. | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,737 |
9 | 11 | 0 | 2 | 6 | 0 | 0.036348 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | As long as you do things correctly, you almost never need to know for most languages. On many, you never need to know, as the language behavior doesn't vary (Java, for example, specifies the runtime behavior precisely).
In C++ and C, doing things correctly includes not making assumptions about int. Don't put pointers in int, and when you're doing anything with memory sizes or addresses use size_t and ptrdiff_t. Don't count on the size of data types: int must be at least 16 bits, almost always is 32, and may be 64 on some architectures. Don't assume that floating-point arithmetic will be done in exactly the same way on different machines (the IEEE standards have some leeway in them).
Pretty much all OSes that support networking will give you some way to deal with possible endianness problems. Use them. Use language facilities like isalpha() to classify characters, rather than arithmetic operations on characters (which might be something weird like EBCDIC). (Of course, it's now more usual to use wchar_t as character type, and use Unicode internally.) | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,182 |
9 | 11 | 0 | 0 | 6 | 0 | 0 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | With java and .net you don't really have to bother with it unless you are doing very low level stuff like twiddling bits. If you are using c, c++, fortran you might get by but I would actually recommend using things like "stdint.h" where you use definitive declares like uint64_t and uint32_t so as to be explicit. Also, you will need to build with particularly libraries depending on how you are linking, for example a 64 bit system might use gcc in a default 64 bit compile mode. | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,298 |
9 | 11 | 0 | 0 | 6 | 0 | 0 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | You will need to care about "endian-ness" only if you send and receive raw C structs
over the wire like
ret = send(socket, &myStruct, sizeof(myStruct));
However this is not a recommended practice.
It's recommended that you define a protocol between the parties such it doesn't matter
the parties' machine architectures. | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,100 |
9 | 11 | 0 | 16 | 6 | 0 | 1.2 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | correct for most circumstances
The runtime/language/compiler will abstract those details unless you are dealing directly with word sizes or binary at a low level.
Even byteorder is abstracted by the NIC/Network stack in the kernel. It is translated for you. When programming sockets in C, you do sometimes have to deal with byte ordering for the network when sending data ... but that doesn't concern 32 or 64 bit differences.
When dealing with blobs of binary data, mapping them from one architecture to another (as an overlay to a C struct for example) can cause problems as others have mentioned, but this is why we develop architecture independent protocols based on characters and so on.
In-fact things like Java run in a virtual machine that abstracts the machine another step!
Knowing a bit about the instruction set of the architecture, and how the syntax is compiled to that can help you understand the platform and write cleaner, tighter code. I know I grimace at some old C code after studying compilers! | 0 | 1,267 | true | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,099 |
9 | 11 | 0 | 16 | 6 | 0 | 1 | 0 | Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit?
IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct??? | 0 | java,c++,python,64-bit,32-bit | 2009-06-25T20:30:00.000 | 0 | 1,046,068 | Knowing how things work, be it how the virtual machine works, and how it works on your platform, or how certain C++ constructs are transformed into assembly will always make you a better programmer, because you will understand why things should be done the way they are.
You need to understand things like memory to know what cache-misses are and why those might affect your program. You should know how certain things are implemented, even though you might only use an interface or high-level way to get to it, knowing how it works will make sure you're doing it in the best way.
For packet work, you need to understand how data is stored on platforms and how sending that across the network to a different platform might change how the data is read (endian-ness).
Your compiler will make best use of the platform you're compiling on, so as long as you stick to standards and code well, you can ignore most things and assume the compiler will whip out what's best.
So in short, no. You don't need to know the low level stuff, but it never hurts to know. | 0 | 1,267 | false | 0 | 1 | Would one have to know the machine architecture to write code? | 1,046,128 |
2 | 2 | 0 | 4 | 1 | 0 | 0.379949 | 0 | I'm storing a value in memcached using PHP's Memcache extension and trying to retrieve it in a daemon written in Python sitting behind my webapp. But, it keeps returning None or throwing "local variable 'val' referenced before assignment".
I'm sure I'm looking for the same key, and there's only one mc server available to either app (localhost). If I try setting the key on a Python terminal, it returns False and unsets it (i.e., I can no longer retrieve it through PHP). Any ideas? | 0 | php,python,memcached | 2009-06-26T00:28:00.000 | 0 | 1,046,847 | By default, the PHP client stores keys in PHP's serialized format (which Python won't understand by default). If the Python client does something similar (using its own serialization format), that'd be your problem.
You can always use telnet/netcat to see what exactly is getting stored. | 0 | 1,069 | false | 0 | 1 | Accessing a PHP-set memcache key from Python | 1,046,859 |
2 | 2 | 0 | 1 | 1 | 0 | 0.099668 | 0 | I'm storing a value in memcached using PHP's Memcache extension and trying to retrieve it in a daemon written in Python sitting behind my webapp. But, it keeps returning None or throwing "local variable 'val' referenced before assignment".
I'm sure I'm looking for the same key, and there's only one mc server available to either app (localhost). If I try setting the key on a Python terminal, it returns False and unsets it (i.e., I can no longer retrieve it through PHP). Any ideas? | 0 | php,python,memcached | 2009-06-26T00:28:00.000 | 0 | 1,046,847 | You could serialise the "data" into json, which I've done once. | 0 | 1,069 | false | 0 | 1 | Accessing a PHP-set memcache key from Python | 4,357,288 |
1 | 4 | 0 | 1 | 2 | 0 | 0.049958 | 0 | I've been having to do some basic feed processing. So, get a file via ftp, process it (i.e. get the fields I care about), and then update the local database. And similarly the other direction: get data from db, create file, and upload by ftp. The scripts will be called by cron.
I think the idea would be for each type of feed, define the ftp connection/file information. Then there should be a translation of how data fields in the file relate to data fields that the application can work with (and of course process this translation). Additionally write separate scripts that do the common inserting functions for the different objects that may be used in different feeds.
As an e-commerce example, lets say I work with different suppliers who provide feeds to me. The feeds can be different (object) types: product, category, or order information. For each type of feed I obviously work with different fields and call different update or insert scripts.
What is the best language to implement this in? I can work with PHP but am looking for a project to start learning Perl or Python so this could be good for me as well.
If Perl or Python, can you briefly give high level implementation. So how to separate the different scripts, object oriented approach?, how to make it easy to implement new feeds or processing functions in the future, etc.
[full disclosure: There were already classes written in PHP which I used to create a new feed recently. I already did my job, but it was super messy and difficult to do. So this question is not 'Please help me do my job' but rather a 'best approach' type of question for my own development.]
Thanks! | 0 | php,python,perl,parsing,feed | 2009-06-26T16:39:00.000 | 0 | 1,050,089 | Most modern languages scripting languages allow you to do all of these things. Because of that, I think your choice of language should be based on what you and the people who read your code know.
In Perl I'd make use of the following modules:
Net::FTP to access the ftp sites.
DBI to insert data into your database.
Modules like that are nice reusable pieces of code that you don't have to write, and interaction with ftp sites and databases are so common that every modern scripting language should have similar modules.
I don't think that PHP is a great language so I'd avoid it if possible, but it might make sense for you if you have a lot of experience in it. | 0 | 1,025 | false | 0 | 1 | Get remote text file, process, and update database - approach and scripting language to use? | 1,050,136 |
3 | 9 | 1 | 1 | 52 | 0 | 0.022219 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | 0 | python,c,interop,cross-domain | 2009-06-28T23:37:00.000 | 0 | 1,056,051 | I haven't used an IPC approach for Python<->C communication but it should work pretty well. I would have the C program do a standard fork-exec and use redirected stdin and stdout in the child process for the communication. A nice text-based communication will make it very easy to develop and test the Python program. | 0 | 79,185 | false | 0 | 1 | How do you call Python code from C code? | 1,056,105 |
3 | 9 | 1 | 0 | 52 | 0 | 0 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | 0 | python,c,interop,cross-domain | 2009-06-28T23:37:00.000 | 0 | 1,056,051 | apparently Python need to be able to compile to win32 dll, it will solve the problem
In such a way that converting c# code to win32 dlls will make it usable by any development tool | 0 | 79,185 | false | 0 | 1 | How do you call Python code from C code? | 1,621,442 |
3 | 9 | 1 | 7 | 52 | 0 | 1 | 0 | I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind having multiple processes); that is, having my pure-Python component run in a separate process (on the same machine) and having my C project communicate with it by writing/reading from a socket (or unix pipe). my python component can read/write to socket to communicate. Is that a reasonable approach? Is there something better? Like some special RPC mechanism?
Thanks for the answer so far - however, i'd like to focus on IPC-based approaches since I want to have my Python program in a separate process as my C program. I don't want to embed a Python interpreter. Thanks! | 0 | python,c,interop,cross-domain | 2009-06-28T23:37:00.000 | 0 | 1,056,051 | Have you considered just wrapping your python application in a shell script and invoking it from within your C application?
Not the most elegant solution, but it is very simple. | 0 | 79,185 | false | 0 | 1 | How do you call Python code from C code? | 1,056,087 |
2 | 8 | 0 | 3 | 22 | 1 | 0.07486 | 0 | I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack.
I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use.
There are some legacy Python applications that I have been asked to support going forward, I have no exposure to python and dynamic languages in general(although I've done a fair bit of JavaScript).
I was hoping to get some guidance/advise to aid in how to go about learning a language like python for the statically typed mind.
EDIT: Using IronPython is not an option! | 0 | c#,.net,python,dynamic-languages | 2009-07-02T04:42:00.000 | 0 | 1,072,530 | You're going to experience quite a bit of culture-shock going from C# to the wild duck-typed outback of Python. Lack of types and intellisense can be pretty daunting. Good thing that you're experienced in JavaScript. Also know that indent-sensitive block rules of Python can be very confusing for the inexperience (usually you either love it or hate it :-)
Apart from that the biggest challenge moving from one language to another is usually the framework. Getting to know all the classes and functions Just Takes Time unfortunately. | 0 | 14,771 | false | 0 | 1 | Learning Python for a .NET developer | 1,073,426 |
2 | 8 | 0 | 4 | 22 | 1 | 0.099668 | 0 | I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack.
I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use.
There are some legacy Python applications that I have been asked to support going forward, I have no exposure to python and dynamic languages in general(although I've done a fair bit of JavaScript).
I was hoping to get some guidance/advise to aid in how to go about learning a language like python for the statically typed mind.
EDIT: Using IronPython is not an option! | 0 | c#,.net,python,dynamic-languages | 2009-07-02T04:42:00.000 | 0 | 1,072,530 | There is a big initial hurdle of getting comfortable with dynamic typing. The first step is when you look at Python-code and realize that variables aren't defined anywhere, you just create them out of thin air, which feels like jumping over a cliff. There is a brief moment before your hang glider catches the air properly.
And then it's going to take time before you trust your newfound dynamic wings, and you probably only can get their by doing aerobatics with them. Learn how python handles references, have fun with monkey-patching methods, duck type various animals. Try to learn some ugly tricks.
And although you can't use IronPython for this, there is no reason you can't use it to learn Python. | 0 | 14,771 | false | 0 | 1 | Learning Python for a .NET developer | 1,072,788 |
5 | 6 | 0 | 3 | 4 | 0 | 1.2 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | 0 | python,eclipse,pydev,scons | 2009-07-02T16:16:00.000 | 1 | 1,075,304 | I'm not an Eclipse expert, but since you didn't get any other answer...
If you make the SCons source a part of the Eclipse project, and run the whole command from within Eclipse it should work like any Eclipse debugging. SCons is written in Python, there is no reason it shouldn't be debuggable in Eclipse just like anything else. | 0 | 2,414 | true | 1 | 1 | How to debug SCons scripts using eclipse and pydev? | 1,075,694 |
5 | 6 | 0 | 0 | 4 | 0 | 0 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | 0 | python,eclipse,pydev,scons | 2009-07-02T16:16:00.000 | 1 | 1,075,304 | As an addendum: on Windows, I had to copy the scons-installed files to reside under C:\Python27\Lib\site-packages\scons in order for this to work. Adding the original installed location, qualified with the version number, to the PYTHONPATH, did not work. | 0 | 2,414 | false | 1 | 1 | How to debug SCons scripts using eclipse and pydev? | 45,216,082 |
5 | 6 | 0 | 1 | 4 | 0 | 0.033321 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | 0 | python,eclipse,pydev,scons | 2009-07-02T16:16:00.000 | 1 | 1,075,304 | On MAC to debug scons through pydev follow Lennart's answer but with one simply addition.
Using Finder (or terminal) browse to where scons is installed. You can find this with the "which" command.
e.g. which scons
-> /usr/local/bin/scons
Make a copy of the scons file and call it scons.py.
Now when you create the Debug Configuration in Eclipse use scons.py as the "Main Module".
PS: To add a scons project to Eclipse I found it easier to use a "Linked Folder" pointing at /usr/local/bin/. i.e. Because I was getting a read-only error when trying to add the directory itself. | 0 | 2,414 | false | 1 | 1 | How to debug SCons scripts using eclipse and pydev? | 15,386,322 |
5 | 6 | 0 | 6 | 4 | 0 | 1 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | 0 | python,eclipse,pydev,scons | 2009-07-02T16:16:00.000 | 1 | 1,075,304 | You are right. Since the SCons is python based, the SCons scripts are debuggable via EClipse PyDev. For this, you need to do the following in the debug configuration...
1. Under the main tab, set the main module to the SCons file which will be available under the python/scripts directory if you have installed SCons. If you have not run the install of SCons you can point to this file under the SCons directory.
2. Under the arguments tab, set the working directory to the root of your project.
Now set the breakpoint either on SConstruct or SConcript and run in debug mode. That's all!!
With this approach you can not only debug your product code but also the build scripts that builds your product :-) Happy Debugging!!!! | 0 | 2,414 | false | 1 | 1 | How to debug SCons scripts using eclipse and pydev? | 1,077,102 |
5 | 6 | 0 | 0 | 4 | 0 | 0 | 0 | I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python? | 0 | python,eclipse,pydev,scons | 2009-07-02T16:16:00.000 | 1 | 1,075,304 | I've since gain more experience with SCons / Python and I'd recommend using python's pdb module. To use it simply add the following code to your SCons/Python files.
import pdb; pdb.set_trace()
When the file is run from the command line a breakpoint will be hit at this line. I also moved away from Eclipse. A lightweight editor will be just as good for Python development. I use Sublime. | 0 | 2,414 | false | 1 | 1 | How to debug SCons scripts using eclipse and pydev? | 32,887,089 |
1 | 2 | 0 | 7 | 4 | 0 | 1.2 | 0 | We have several cron jobs that ftp proxy logs to a centralized server. These files can be rather large and take some time to transfer. Part of the requirement of this project is to provide a logging mechanism in which we log the success or failure of these transfers. This is simple enough.
My question is, is there a way to check if a file is currently being written to? My first solution was to just check the file size twice within a given timeframe and check the file size. But a co-worker said that there may be able to hook into the EXT3 file system via python and check the attributes to see if the file is currently being appended to. My Google-Fu came up empty.
Is there a module for EXT3 or something else that would allow me to check the state of a file? The server is running Fedora Core 9 with EXT3 file system. | 0 | python,linux,ext3 | 2009-07-02T16:32:00.000 | 1 | 1,075,391 | no need for ext3-specific hooks; just check lsof, or more exactly, /proc/<pid>/fd/* and /proc/<pid>/fdinfo/* (that's where lsof gets it's info, AFAICT). There you can check if the file is open, if it's writeable, and the 'cursor' position.
That's not the whole picture; but any more is done in processpace by stdlib on the writing process, as most writes are buffered and the kernel only sees bigger chunks of data, so any 'ext3-aware' monitor wouldn't get that either. | 0 | 640 | true | 0 | 1 | Does python have hooks into EXT3 | 1,075,459 |
3 | 4 | 0 | 0 | 3 | 0 | 0 | 0 | I have a problem of upgrading python from 2.4 to 2.6:
I have CentOS 5 (Full). It has python 2.4 living in /usr/lib/python2.4/ . Additional modules are living in /usr/lib/python2.4/site-packages/ . I've built python 2.6 from sources at /usr/local/lib/python2.6/ . I've set default python to python2.6 . Now old modules for 2.4 are out of pythonpath and are "lost". In particular, yum is broken ("no module named yum").
So what is the right way to migrate/install modules to python2.6? | 0 | python,linux,upgrade,centos,python-2.6 | 2009-07-04T06:59:00.000 | 1 | 1,081,698 | easy_install is good one but there are low level way for installing module, just:
unpack module source to some directory
type "python setup.py install"
Of course you should do this with required installed python interpreter version; for checking it type:
python -V | 0 | 6,767 | false | 0 | 1 | Transition from Python2.4 to Python2.6 on CentOS, module migration problem | 1,085,044 |
3 | 4 | 0 | 0 | 3 | 0 | 0 | 0 | I have a problem of upgrading python from 2.4 to 2.6:
I have CentOS 5 (Full). It has python 2.4 living in /usr/lib/python2.4/ . Additional modules are living in /usr/lib/python2.4/site-packages/ . I've built python 2.6 from sources at /usr/local/lib/python2.6/ . I've set default python to python2.6 . Now old modules for 2.4 are out of pythonpath and are "lost". In particular, yum is broken ("no module named yum").
So what is the right way to migrate/install modules to python2.6? | 0 | python,linux,upgrade,centos,python-2.6 | 2009-07-04T06:59:00.000 | 1 | 1,081,698 | There are a couple of options...
If the modules will run under Python 2.6, you can simply create symbolic links to them from the 2.6 site-packages directory to the 2.4 site-packages directory.
If they will not run under 2.6, then you may need to re-compile them against 2.6, or install up-to-date versions of them. Just make sure you are using 2.6 when calling "python setup.py"
...
You may want to post this on serverfault.com, if you run into additional challenges. | 0 | 6,767 | false | 0 | 1 | Transition from Python2.4 to Python2.6 on CentOS, module migration problem | 1,081,705 |
3 | 4 | 0 | 0 | 3 | 0 | 0 | 0 | I have a problem of upgrading python from 2.4 to 2.6:
I have CentOS 5 (Full). It has python 2.4 living in /usr/lib/python2.4/ . Additional modules are living in /usr/lib/python2.4/site-packages/ . I've built python 2.6 from sources at /usr/local/lib/python2.6/ . I've set default python to python2.6 . Now old modules for 2.4 are out of pythonpath and are "lost". In particular, yum is broken ("no module named yum").
So what is the right way to migrate/install modules to python2.6? | 0 | python,linux,upgrade,centos,python-2.6 | 2009-07-04T06:59:00.000 | 1 | 1,081,698 | Some Python libs may be still not accessible as with Python 2.6 site-packages is changed to dist-packages.
The only way in that case is to do move all stuff generated in site-packages (e.g. by make install) to dist-packages and create a sym-link. | 0 | 6,767 | false | 0 | 1 | Transition from Python2.4 to Python2.6 on CentOS, module migration problem | 1,082,045 |
1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | When i tried recording using QTP, every thing goes well till the application sign in. i.e it gets upto the user Id and password entry, But QTP fails to recognise afterthat. Is there any way to handle this?
Application is to be invoked using Citirx, in VPN. | 0 | c#,python,ruby | 2009-07-06T12:40:00.000 | 0 | 1,086,758 | QTP performs GUI recognition and interaction through Windows Handle.
So it has to be running under Citrix (i.e. installed on the same virtual machine as your Application Under Test).
If you have the above, make sure Screen Resolution, Windows Theme, Font size, and other global GUI settings are the same. | 0 | 697 | false | 0 | 1 | How to use QTP to test the application which operates in citrix of Remote Machine? | 1,121,154 |
1 | 3 | 0 | 2 | 4 | 0 | 0.132549 | 0 | I am using Pylons to develop an application and I want my controller actions to send emails to certain addresses. Is there a built in Pylons feature for sending email? | 0 | python,pylons | 2009-07-06T22:55:00.000 | 0 | 1,089,576 | Can't you just use standard Python library modules, email to prepare the mail and smtp to send it? What extra value beyond that are you looking for from the "built-in feature"? | 0 | 1,532 | false | 0 | 1 | Sending an email from Pylons | 1,089,588 |
2 | 7 | 0 | 4 | 51 | 0 | 0.113791 | 0 | I'm working with Python and MATLAB right now and I have a 2D array in Python that I need to write to a file and then be able to read it into MATLAB as a matrix. Any ideas on how to do this?
Thanks! | 0 | python,matlab,file-io,import,matrix | 2009-07-07T22:55:00.000 | 0 | 1,095,265 | You could write the matrix in Python to a CSV file and read it in MATLAB using csvread. | 1 | 69,405 | false | 0 | 1 | Matrix from Python to MATLAB | 1,095,296 |
2 | 7 | 0 | 5 | 51 | 0 | 0.141893 | 0 | I'm working with Python and MATLAB right now and I have a 2D array in Python that I need to write to a file and then be able to read it into MATLAB as a matrix. Any ideas on how to do this?
Thanks! | 0 | python,matlab,file-io,import,matrix | 2009-07-07T22:55:00.000 | 0 | 1,095,265 | I would probably use numpy.savetxt('yourfile.mat',yourarray) in Python
and then yourarray = load('yourfile.mat') in MATLAB. | 1 | 69,405 | false | 0 | 1 | Matrix from Python to MATLAB | 7,737,622 |
2 | 3 | 0 | 3 | 1 | 1 | 1.2 | 0 | I need to upload a potentially huge plain-text file to a very simple wsgi-app without eating up all available memory on the server. How do I accomplish that? I want to use standard python modules and avoid third-party modules if possible. | 0 | python,file,upload,wsgi | 2009-07-09T13:36:00.000 | 0 | 1,103,940 | wsgi.input should be a file like stream object. You can read from that in blocks, and write those blocks directly to disk. That shouldn't use up any significant memory.
Or maybe I misunderstood the question? | 0 | 1,494 | true | 0 | 1 | Upload a potentially huge textfile to a plain WSGI-server in Python | 1,104,012 |
2 | 3 | 0 | 2 | 1 | 1 | 0.132549 | 0 | I need to upload a potentially huge plain-text file to a very simple wsgi-app without eating up all available memory on the server. How do I accomplish that? I want to use standard python modules and avoid third-party modules if possible. | 0 | python,file,upload,wsgi | 2009-07-09T13:36:00.000 | 0 | 1,103,940 | If you use the cgi module to parse the input (which most frameworks use, e.g., Pylons, WebOb, CherryPy) then it will automatically save the uploaded file to a temporary file, and not load it into memory. | 0 | 1,494 | false | 0 | 1 | Upload a potentially huge textfile to a plain WSGI-server in Python | 1,209,507 |
1 | 5 | 0 | 0 | 1 | 0 | 0 | 0 | I have the 'luck' of develop and enhance a legacy python web application for almost 2 years. The major contribution I consider I made is the introduction of the use of unit test, nosestest, pychecker and CI server. Yes, that's right, there are still project out there that has no single unit test (To be fair, it has a few doctest, but are broken).
Nonetheless, progress is slow, because literally the coverage is limited by how many unit tests you can afford to write.
From time to time embarrassing mistakes still occur, and it does not look good on management reports. (e.g. even pychecker cannot catch certain "missing attribute" situation, and the program just blows up in run time)
I just want to know if anyone has any suggestion about what additional thing I can do to improve the QA. The application uses WebWare 0.8.1, but I have expermentially ported it to cherrypy, so I can potentially take advantage of WSGI to conduct integration tests.
Mixed language development and/or hiring an additional tester are also options I am thinking.
Nothing is too wild, as long as it works. | 0 | python,testing,integration-testing | 2009-07-10T05:29:00.000 | 0 | 1,107,858 | Few things help as much as testing.
These two quotes are really important.
"how many unit tests you can afford to write."
"From time to time embarrassing mistakes still occur,"
If mistakes occur, you haven't written enough tests. If you're still having mistakes, then you can afford to write more unit tests. It's that simple.
Each embarrassing mistake is a direct result of not writing enough unit tests.
Each management report that describes an embarrassing mistake should also describe what testing is required to prevent that mistake from ever happening again.
A unit test is a permanent prevention of further problems. | 0 | 664 | false | 1 | 1 | Looking for testing/QA idea for Python Web Application Project | 1,108,750 |
1 | 5 | 0 | 1 | 5 | 0 | 0.039979 | 0 | I'm trying to programatically get a list of installed fonts in C or Python. I need to be able to do this on OS X, does anyone know how? | 0 | python,c,macos,fonts | 2009-07-11T05:45:00.000 | 1 | 1,113,040 | Do you want to write a program to do it, or do you want to use a program to do it? There are many programs that list fonts, xlsfonts comes to mind. | 0 | 5,834 | false | 0 | 1 | List of installed fonts OS X / C | 1,113,055 |
1 | 3 | 0 | 3 | 3 | 1 | 1.2 | 0 | I have a small Python program, which uses a Google Maps API secret key. I'm getting ready to check-in my code, and I don't want to include the secret key in SVN.
In the canonical PHP app you put secret keys, database passwords, and other app specific config in LocalSettings.php. Is there a similar file/location which Python programmers expect to find and modify? | 0 | python,configuration,google-maps | 2009-07-11T10:57:00.000 | 0 | 1,113,479 | No, there's no standard location - on Windows, it's usually in the directory os.path.join(os.environ['APPDATA'], 'appname') and on Unix it's usually os.path.join(os.environ['HOME'], '.appname'). | 0 | 3,025 | true | 0 | 1 | Where to store secret keys and password in Python | 1,113,496 |
5 | 6 | 0 | 4 | 20 | 1 | 0.132549 | 0 | Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are Unicode these days (i.e. .NET String, '_UNICODE' turned on by default on a new c++ project, etc ). Therefore, I tend to think that the case where non-Unicode string objects are used is a sort of rare case. Anyway, I'm curious about what Python practitioners do in real-world projects. | 0 | python,unicode | 2009-07-12T17:13:00.000 | 0 | 1,116,449 | Additional to Mihails comment I would say: Use Unicode, since it is the future. In Python 3.0, Non-Unicode will be gone, and as much I know, all the "U"-Prefixes will make trouble, since they are also gone. | 0 | 3,614 | false | 0 | 1 | Should I use Unicode string by default? | 1,116,549 |
5 | 6 | 0 | 19 | 20 | 1 | 1.2 | 0 | Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are Unicode these days (i.e. .NET String, '_UNICODE' turned on by default on a new c++ project, etc ). Therefore, I tend to think that the case where non-Unicode string objects are used is a sort of rare case. Anyway, I'm curious about what Python practitioners do in real-world projects. | 0 | python,unicode | 2009-07-12T17:13:00.000 | 0 | 1,116,449 | From my practice -- use unicode.
At beginning of one project we used usuall strings, however our project was growing, we were implementing new features and using new third-party libraries. In that mess with non-unicode/unicode string some functions started failing. We started spending time localizing this problems and fixing them. However, some third-party modules doesn't supported unicode and started failing after we switched to it (but this is rather exclusion than a rule).
Also I have some experience when we needed to rewrite some third party modules(e.g. SendKeys) cause they were not supporting unicode. If it was done in unicode from beginning it will be better :)
So I think today we should use unicode.
P.S. All that mess upwards is only my hamble opinion :) | 0 | 3,614 | true | 0 | 1 | Should I use Unicode string by default? | 1,116,476 |
5 | 6 | 0 | 2 | 20 | 1 | 0.066568 | 0 | Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are Unicode these days (i.e. .NET String, '_UNICODE' turned on by default on a new c++ project, etc ). Therefore, I tend to think that the case where non-Unicode string objects are used is a sort of rare case. Anyway, I'm curious about what Python practitioners do in real-world projects. | 0 | python,unicode | 2009-07-12T17:13:00.000 | 0 | 1,116,449 | If you are dealing with severely constrained memory or disk space, use ASCII strings. In this case, you should additionally write your software in C or something even more compact :) | 0 | 3,614 | false | 0 | 1 | Should I use Unicode string by default? | 1,116,487 |
5 | 6 | 0 | 13 | 20 | 1 | 1 | 0 | Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are Unicode these days (i.e. .NET String, '_UNICODE' turned on by default on a new c++ project, etc ). Therefore, I tend to think that the case where non-Unicode string objects are used is a sort of rare case. Anyway, I'm curious about what Python practitioners do in real-world projects. | 0 | python,unicode | 2009-07-12T17:13:00.000 | 0 | 1,116,449 | Yes, use unicode.
Some hints:
When doing input output in any sort of binary format, decode directly after reading and encode directly before writing, so that you never need to mix strings and unicode. Because mixing that tends to lead to UnicodeEncodeDecodeErrors sooner or later.
[Forget about this one, my explanations just made it even more confusing. It's only an issue when porting to Python 3, you can care about it then.]
Common Python newbie errors with Unicode (not saying you are a newbie, but this may be read by newbies): Don't confuse encode and decode. Remember, UTF-8 is an ENcoding, so you ENcode Unicode to UTF-8 and DEcode from it.
Do not fall into the temptation of setting the default encoding in Python (by setdefaultencoding in sitecustomize.py or similar) to whatever you use most. That is just going to give you problems if you reinstall or move to another computer or suddenly need to use another encoding. Be explicit.
Remember, not all of Python 2s standard library accepts unicode. If you feed a method unicode and it doesn't work, but it should, try feeding it ascii and see. Examples: urllib.urlopen(), which fails with unhelpful errors if you give it a unicode object instead of a string.
Hm. That's all I can think of now! | 0 | 3,614 | false | 0 | 1 | Should I use Unicode string by default? | 1,116,660 |
5 | 6 | 0 | 6 | 20 | 1 | 1 | 0 | Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are Unicode these days (i.e. .NET String, '_UNICODE' turned on by default on a new c++ project, etc ). Therefore, I tend to think that the case where non-Unicode string objects are used is a sort of rare case. Anyway, I'm curious about what Python practitioners do in real-world projects. | 0 | python,unicode | 2009-07-12T17:13:00.000 | 0 | 1,116,449 | It can be tricky to consistently use unicode strings in Python 2.x - be it because somebody inadvertently uses the more natural str(blah) where they meant unicode(blah), forgetting the u prefix on string literals, third-party module incompatibilities - whatever. So in Python 2.x, use unicode only if you have to, and are prepared to provide good unit test coverage.
If you have the option of using Python 3.x however, you don't need to care - strings will be unicode with no extra effort. | 0 | 3,614 | false | 0 | 1 | Should I use Unicode string by default? | 1,116,581 |
1 | 22 | 0 | 3 | 103 | 1 | 0.027266 | 0 | How would you convert an integer to base 62 (like hexadecimal, but with these digits: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ').
I have been trying to find a good Python library for it, but they all seems to be occupied with converting strings. The Python base64 module only accepts strings and turns a single digit into four characters. I was looking for something akin to what URL shorteners use. | 0 | python,math,base62 | 2009-07-13T14:19:00.000 | 0 | 1,119,722 | You probably want base64, not base62. There's an URL-compatible version of it floating around, so the extra two filler characters shouldn't be a problem.
The process is fairly simple; consider that base64 represents 6 bits and a regular byte represents 8. Assign a value from 000000 to 111111 to each of the 64 characters chosen, and put the 4 values together to match a set of 3 base256 bytes. Repeat for each set of 3 bytes, padding at the end with your choice of padding character (0 is generally useful). | 0 | 83,868 | false | 0 | 1 | Base 62 conversion | 1,119,762 |
1 | 7 | 0 | 0 | 17 | 1 | 0 | 0 | I'm working with a Python development team who is experienced with programming in Python, but is just now trying to pick up TDD. Since I have some experience working with TDD myself, I've been asked to give a presentation on it. Mainly, I'm just wanting to see articles on this so that I can see how other people are teaching TDD and get some ideas for material to put in my presentation.
Preferably, I'd like the intro to be for Python, but any language will do as long as the examples are easy to read and the concepts transfer to Python easily. | 0 | python,unit-testing,testing,tdd | 2009-07-14T15:28:00.000 | 0 | 1,126,173 | I started unit testing a handful of years ago, and I've read quite a few on it since my initial book.
However, my initial was "Test Driven" by Lasse.
For me, the author made it simple to understand.
Perhaps you could pull some info from it for your teaching.
And btw, I've taught TDD as well.
I have found that ensuring the audience understands how to use unit tests before going into TDD to be quite handy.
Good luck! :-) | 0 | 6,164 | false | 0 | 1 | Are there any good online tutorials to TDD for an experienced programmer who is new to testing? | 8,462,601 |
3 | 5 | 0 | 1 | 4 | 0 | 0.039979 | 0 | It's a high level conceptual question. I have two separate code bases that serve the same purpose, one built in Python and the other in Ruby. I need to develop something that will run on JVM. So I have two choices: convert the Python code to Jython or convert the Ruby to JRuby. Since I don't know any of them, I was wondering if anyone can give me some guidance. Like which one runs faster, or more importantly which one has tools available for easy code migration(.pyc to .jar files)? | 0 | python,ruby,jruby,jython | 2009-07-15T10:50:00.000 | 0 | 1,130,697 | The compatibility in either case is at the source-code level; with necessary changes where the Python or Ruby code invokes packages that involve native code (especially, standard Python packages like ctypes are not present in Jython). | 0 | 5,421 | false | 1 | 1 | Jython or JRuby? | 1,130,727 |
3 | 5 | 0 | 1 | 4 | 0 | 0.039979 | 0 | It's a high level conceptual question. I have two separate code bases that serve the same purpose, one built in Python and the other in Ruby. I need to develop something that will run on JVM. So I have two choices: convert the Python code to Jython or convert the Ruby to JRuby. Since I don't know any of them, I was wondering if anyone can give me some guidance. Like which one runs faster, or more importantly which one has tools available for easy code migration(.pyc to .jar files)? | 0 | python,ruby,jruby,jython | 2009-07-15T10:50:00.000 | 0 | 1,130,697 | Anything you can do in one, you can do in the other.
Learn enough of both to realise which one appeals to your coding sensibilities. There is no right or wrong answer here. | 0 | 5,421 | false | 1 | 1 | Jython or JRuby? | 1,140,847 |
3 | 5 | 0 | 5 | 4 | 0 | 0.197375 | 0 | It's a high level conceptual question. I have two separate code bases that serve the same purpose, one built in Python and the other in Ruby. I need to develop something that will run on JVM. So I have two choices: convert the Python code to Jython or convert the Ruby to JRuby. Since I don't know any of them, I was wondering if anyone can give me some guidance. Like which one runs faster, or more importantly which one has tools available for easy code migration(.pyc to .jar files)? | 0 | python,ruby,jruby,jython | 2009-07-15T10:50:00.000 | 0 | 1,130,697 | In both cases, most of the code should Just Work™. I don't know of a really compelling reason to choose Jython over JRuby or vice versa if you'll be learning either from scratch. Python places a heavy emphasis on readability and not using "magic", but Ruby tends to give you a little more rope to do fancy things, e.g., define your own DSL. The main difference is in the community, and largely revolves around the different focus mentioned above. | 0 | 5,421 | false | 1 | 1 | Jython or JRuby? | 1,130,722 |
1 | 4 | 0 | -1 | 6 | 1 | -0.049958 | 0 | I'm writing an application that needs to read a list of strings from a file, save them in a data structure, and then look up those strings by prefixes. The list of strings is simply a list of words in a given language. For example, if the search function gets "stup" as a parameter, it should return ["stupid", "stupidity", "stupor"...]. It should do so in O(log(n)*m) time, where n is the size of the data structure and m is the number of results and should be as fast as possible. Memory consumption is not a big issue right now. I'm writing this in python, so it would be great if you could point me to a suitable data structure (preferably) implemented in c with python wrappers. | 0 | python,data-structures,dictionary,lookup | 2009-07-15T12:04:00.000 | 0 | 1,130,992 | string array.
then binary search through it to search the first match
then step one by one through it for all subsequent matches
(i originally had linked list here too... but of course this doesn't have random access so this was 'bs' (which probably explains why I was downvoted). My binary search algorithm still is the fastest way to go though | 0 | 3,095 | false | 0 | 1 | most efficient data structure for a read-only list of strings (about 100,000) with fast prefix search | 1,131,017 |
1 | 2 | 0 | 5 | 1 | 1 | 1.2 | 0 | I'm programming a pet project in Python, and it involves users A & B interacting over network, attempting to insure that each has a local copy of the same file from user C.
The idea is that C gives each a file that has been digitally signed. A & B trade the digital signatures they have, and check it out on their own copy. If the signature fails, then one of them has an incorrect/corrupt/modified version of the file.
The question is, therefore, can C distribute a single file that somehow includes it's own signature? Or does C need to supply the file and signature separately? | 0 | python,file,cryptography,digital-signature | 2009-07-15T17:25:00.000 | 0 | 1,132,766 | The digital signature from C alone should be enough for both A and B to confirm that their file is not corrupted, without ever communicating with eachother. If A and B did not receive a signature from C, they could each create a cryptographic hash of the file and compare the hash, but that does not require any digital signing on C's part.
If you want C to sign the file, either send the signature and the file seperately, or wrap them both in some sort of container, such as a zip file or home grown solution (e.g., the first line in the file represents the signature, the rest is the payload).
To answer your question literally, the signature doesn't have to be outside the file per se, but the part that is being signed cannot include the signature itself. | 0 | 187 | true | 0 | 1 | Must a secure cryptographic signature reside outside of the file it refers to? | 1,132,796 |
1 | 3 | 0 | 1 | 5 | 0 | 0.066568 | 0 | When using mpirun, is it possible to catch signals (for example, the SIGINT generated by ^C) in the code being run?
For example, I'm running a parallelized python code. I can except KeyboardInterrupt to catch those errors when running python blah.py by itself, but I can't when doing mpirun -np 1 python blah.py.
Does anyone have a suggestion? Even finding how to catch signals in a C or C++ compiled program would be a helpful start.
If I send a signal to the spawned Python processes, they can handle the signals properly; however, signals sent to the parent orterun process (i.e. from exceeding wall time on a cluster, or pressing control-C in a terminal) will kill everything immediately. | 0 | python,signals,mpi | 2009-07-17T21:18:00.000 | 1 | 1,145,741 | If you use mpirun --nw, then mpirun itself should terminate as soon as it's started the subprocesses, instead of waiting for their termination; if that's acceptable then I believe your processes would be able to catch their own signals. | 0 | 2,988 | false | 0 | 1 | MPI signal handling | 1,149,142 |
2 | 5 | 0 | 1 | 8 | 1 | 0.039979 | 0 | I'm thinking about learning ruby and python a little bit, and it occurred to me, for what ruby/python is good for? When to use ruby and when python, or for what ruby/python is not for? :)
What should I do in these languages?
thanks | 0 | python,ruby | 2009-07-19T09:56:00.000 | 0 | 1,149,581 | To avoid the holy war and maybe give another perspective I say (without requesting more information of what fun part of programming the question-ere thinks is cool to do):
Learn python first!
If you haven't done any scripting language yet I would recommend python.
The core of python is somewhat cleaner than the core of ruby and if you learn the basic core of scripting with python first you will more or less as a bonus learn ruby.
You will (because you use python) write code that looks very clean and has good indentation
right from the beginning.
The difficulties about what to learn is what you actually will you try to solve!
If you are looking for a new production language to solve X the answer get more complicated.
Is X part of the language core? Was the language in fact invented to solve X?
If the question was: What single programming language should I Master and eventually reach Nirva with? My answer is, I don't have a clue!
(CLisp, Scheme48, Erlang or Haskell should probably have been on my final list though)
PS.
I know that this isn't the spot on answer to the very simplified question in the post.
what can ruby do that python can't or what can python do that ruby can't.
The point is that when you set out to learn something one usually have a hidden agenda so you try to solve your favorite problem in any language again and again.
If your really are out to learn without have an agenda I think that python in it's most basic form is a clean and crisp way and you should be able to use the same style when using ruby.
DISCLAIMER: I prefer ruby in a production (commercial setup) over python. I prefer ruby over python on windows. I prefer ruby over python on the things I do at home. I do that because the things I really like to solve is more fun to solve in ruby than in python. My programming style/habit tends to fit better in ruby. | 0 | 15,641 | false | 0 | 1 | python and ruby - for what to use it? | 1,149,723 |
2 | 5 | 0 | 11 | 8 | 1 | 1.2 | 0 | I'm thinking about learning ruby and python a little bit, and it occurred to me, for what ruby/python is good for? When to use ruby and when python, or for what ruby/python is not for? :)
What should I do in these languages?
thanks | 0 | python,ruby | 2009-07-19T09:56:00.000 | 0 | 1,149,581 | They are good for mostly for rapid prototyping, quick development, dynamic programs, web applications and scripts. They're general purpose languages, so you can use them for pretty much everything you want. You'll have smaller development times (compared to, say, Java or C++), but worse performance and less static error-checking.
You can also develop desktop apps on them, but there may be some minor complications on shipping (since you'll usually have to ship the interpreter too).
You shouldn't do critical code or heavy computations on them - if you need these things, make them on a faster language (like C) and make a binding for the code. I believe Python is better for this than Ruby, but I could be wrong. (OTOH, Ruby has a stronger metaprogramming) | 0 | 15,641 | true | 0 | 1 | python and ruby - for what to use it? | 1,149,595 |
1 | 7 | 0 | 0 | 10 | 0 | 0 | 0 | I would like to be able to perform a ping and traceroute from within Python without having to execute the corresponding shell commands so I'd prefer a native python solution. | 0 | python,ping,traceroute | 2009-07-20T05:01:00.000 | 1 | 1,151,771 | ICMP Ping is standard as part of the ICMP protocol.
Traceroute uses features of ICMP and IP to determine a path via Time To Live values. Using TTL values, you can do traceroutes in a variety of protocols as long as IP/ICMP work because it is the ICMP TTL EXceeded messages that tell you about the hop in the path.
If you attempt to access a port where no listener is available, by ICMP protocol rules, the host is supposed to send an ICMP Port Unreachable message. | 0 | 34,815 | false | 0 | 1 | How can I perform a ping or traceroute using native python? | 2,974,474 |
1 | 12 | 0 | 3 | 74 | 1 | 0.049958 | 0 | I'm learning C++ because it's a very flexible language. But for internet things like Twitter, Facebook, Delicious and others, Python seems a much better solution.
Is it possible to integrate C++ and Python in the same project? | 0 | c++,python,integration | 2009-07-20T13:28:00.000 | 0 | 1,153,577 | I'd recommend looking at how PyTorch does their integration. | 0 | 112,300 | false | 0 | 1 | Integrate Python And C++ | 46,593,807 |
2 | 3 | 0 | 4 | 7 | 0 | 0.26052 | 0 | I guess this question has been asked a lot around. I know Rails can scale because I have worked on it and it's awesome. And there is not much doubt about that as far as PHP frameworks are concerned.
I don't want to know which frameworks are better.
How much is difference in cost of scaling Rails vs other frameworks (PHP, Python) assuming a large app with 1 million visits per month?
This is something I get asked a lot. I can explain to people that "Rails does scale pretty well" but in the long run, what are the economics?
If somebody can provide some metrics, that'd be great. | 0 | php,python,ruby-on-rails,scaling | 2009-07-22T04:07:00.000 | 0 | 1,163,012 | IMHO I don't think the cost of scaling is going to be any different between those three because none of them have "scalability batteries" included. I just don't see any huge architectural differences between those three choices that would cause a significant difference in scaling.
In other words, your application architecture is going to dominate how the application scales regardless of which of the three languages.
If you need memory caching you're going to at least use memcached (or something similar which will interface with all three languages). Maybe you help your scalability using nginx to serve directly from memcache, but that's obviously not going to change the performance of php/perl/python/ruby.
If you use MySQL or Postgresql you're still going to have to design your database correctly for scaling regardless of your app language, and any tool you use to start clustering / mirroring is going to be outside of your app.
I think in terms of memory usage Python (with mod_wsgi daemon mode) and Ruby (enterprise ruby with passenger/mod_rack) have pretty decent footprints at least comparable to PHP under fcgi and probably better than PHP under mod_php (i.e. apache MPM prefork + php in all the apache processes sucks a lot of memory).
Where this question might be interesting is trying to compare those 3 languages vs. something like Erlang where you (supposedly) have cheap built-in scalability automatically in all Erlang processes, but even then you'll have a RDBMS database bottleneck unless your app nicely fits into one of the Erlang database ways of doing things, e.g. couchdb. | 0 | 2,847 | false | 1 | 1 | Cost of scaling Rails vs cost of scaling PHP vs Python frameworks | 1,163,341 |
2 | 3 | 0 | 5 | 7 | 0 | 1.2 | 0 | I guess this question has been asked a lot around. I know Rails can scale because I have worked on it and it's awesome. And there is not much doubt about that as far as PHP frameworks are concerned.
I don't want to know which frameworks are better.
How much is difference in cost of scaling Rails vs other frameworks (PHP, Python) assuming a large app with 1 million visits per month?
This is something I get asked a lot. I can explain to people that "Rails does scale pretty well" but in the long run, what are the economics?
If somebody can provide some metrics, that'd be great. | 0 | php,python,ruby-on-rails,scaling | 2009-07-22T04:07:00.000 | 0 | 1,163,012 | One major factor in this is that isn't affected by choice of framework is database access. No matter what approach you take, you likely put data in a relational database. Then the question is how efficiently you can get the data out of the database. This primarily depends on the RDBMS (Oracle vs. Postgres vs. MySQL), and not on the framework - except that some data mapping library may make inefficient use of SQL.
For the pure "number of visits" parameter, the question really is how fast your HTML templating system works. So the question is: how many pages can you render per second? I would make this the primary metrics to determine how good a system would scale.
Of course, different pages may have different costs; for some, you can use caching, but not for others. So in measuring scalability, split your 1 million visits into cheap and expensive pages, and measure them separately. Together, they should give a good estimate of the load your system can take (or the number of systems you need to satisfy demand).
There is also the issue of memory usage. If you have the data in SQL, this shouldn't matter - but with caching, you may also need to consider scalability wrt. main memory usage. | 0 | 2,847 | true | 1 | 1 | Cost of scaling Rails vs cost of scaling PHP vs Python frameworks | 1,163,208 |
1 | 4 | 0 | 1 | 2 | 1 | 1.2 | 0 | I am tasked with writing unit tests for a suite of networked software written in python. Writing units for message builders and other static methods is very simple, but I've hit a wall when it comes to writing a tests for network looped threads.
For example: The server it connects to could be on any port, and I want to be able to test the ability to connect to numerous ports (in sequence, not parallel) without actually having to run numerous servers. What is a good way to approach this? Perhaps make server construction and destruction part of the test? Something tells me there must a simpler answer that evades me.
I have to imagine there are methods for unit testing networked threads, but I can't seem to find any. | 0 | python,unit-testing,networking,python-unittest | 2009-07-23T18:52:00.000 | 0 | 1,173,767 | I would try to introduce a factory into your existing code that purports to create socket objects. Then in a test pass in a mock factory which creates mock sockets which just pretend they've connected to a server (or not for error cases, which you also want to test, don't you?) and log the message traffic to prove that your code has used the right ports to connect to the right types of servers.
Try not to use threads just yet, to simplify testing. | 0 | 655 | true | 0 | 1 | using pyunit on a network thread | 1,174,498 |
1 | 1 | 0 | 6 | 2 | 0 | 1.2 | 0 | Is there an advantage? What is it? | 0 | python,import,module-search-path | 2009-07-24T13:06:00.000 | 0 | 1,177,513 | So that everyone doesn't need to have exactly the same file structure on their hard drive? import C:\Python\lib\module\ probably wouldn't work too well on my Mac...
Edit: Also, what the heck are you talking about with the working directory? You can certainly use modules outside the working directory, as long as they're on the PYTHONPATH. | 0 | 104 | true | 0 | 1 | Why is there module search path instead of typing the directory name + typing the file name? | 1,177,526 |
6 | 7 | 1 | 3 | 4 | 0 | 0.085505 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | Here's two possibilities:
Perhaps the C++ code is already written & available for use.
It's likely the C++ code is faster/smaller than equivalent Python | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,181,468 |
6 | 7 | 1 | 2 | 4 | 0 | 0.057081 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | Here's a real-life example: I've written a DLL in C to interface with some custom hardware for work. Then for the very first stage of testing, I was writing short programs in C to verify that the different commands were working properly. The process of write, compile, run took probably 3-5 times as long as when I finally wrote a Python interface to the DLL using ctypes.
Now, I can write testing scripts much more rapidly with much less regards to proper variable initialization and memory management that I would have to worry about in C. In fact, I've even been able to use unit testing libraries in Python to create much more robust tests than before. Would that have been possible in C? Absolutely, but it would have taken me much longer, and it would have been many more lines of code.
Fewer lines of code in Python means (in general) that there are fewer things with my main logic that can go wrong.
Moreover, since the hardware communication is almost completely IO bound, there's no need to write any supporting code in C. I may as well program in whatever is fastest to develop.
So there you go, real-life example. | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,182,301 |
6 | 7 | 1 | 0 | 4 | 0 | 0 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | One nice thing about using a scripting language is that you can reload new code into the application without quitting the app, then making changes, recompile, and then relaunching the app. When people talk about quicker development times, some of that refers to this capability.
A downside of using a scripting languages is that their debuggers are usually not as fully featured as what you would have in C++. I haven't done any Python programming so I don't know what the features are of its debugger, if it has one at all.
This answer doesn't exactly answer what you asked but I thought it was relevant. The answer is more the pro/cons of using a scripting language. Please don't flame me. :) | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,182,051 |
6 | 7 | 1 | 3 | 4 | 0 | 0.085505 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | Because C++ provides a direct way of calling OS services, and (if used in a careful way) can produce code that is more efficient in memory and time, whereas Python is a high-level language, and is less painful to use in those situations where utter efficiency isn't a concern and where you already have libraries giving you access to the services you need.
If you're a C++ user, you may wonder why this is necessary, but the expressiveness and safety of a high-level language has such a massive relative effect on your productivity, it has to be experienced to be understood or believed.
I can't speak for Python specifically, but I've heard people talk in terms of "tripling" their productivity by doing most of their development in it and using C++ only where shown to be necessary by profiling, or to create extra libraries.
If you're a Python user, you may not have encountered a situation where you need anything beyond the libraries already available, and you may not have a problem with the performance you get from pure Python (this is quite likely). In which case - lucky you! You can forget about all this. | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,181,481 |
6 | 7 | 1 | 5 | 4 | 0 | 0.141893 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | Generally, you'd call C++ from python in order to use an existing library or other functionality. Often someone else has written a set of functions that make your life easier, and calling compiled C code is easier than re-writing the library in python.
The other reason is for performance purposes. Often, specific functions of an otherwise completely scripted program are written in a pre-compiled language like C because they take a long time to run and can be more efficiently done in a lower-level language.
A third reason is for interfacing with devices. Python doesn't natively include a lot of code for dealing with sound cards, serial ports, and so on. If your device needs a device driver, python will talk to it via pre-compiled code you include in your app. | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,181,476 |
6 | 7 | 1 | 0 | 4 | 0 | 0 | 0 | I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?
I'd appreciate a simple example - Boost::Python will do | 0 | c++,python | 2009-07-25T07:14:00.000 | 0 | 1,181,462 | Performance :
From my limited experience, Python is about 10 times slower than using C.
Using Psyco will dramatically improve it, but still about 5 times slower than C.
BUT, calling c module from python is only a little faster than Psyco.
When you have some libraries in C.
For example, I am working heavily on SIP. It's a very complicated protocol stacks and there is no complete Python implementation. So my only choice is calling SIP libraries written in C.
There are also this kind of cases, like video/audio decoding. | 0 | 522 | false | 0 | 1 | Practical point of view: Why would I want to use Python with C++? | 1,181,567 |
3 | 7 | 0 | 1 | 0 | 1 | 0.028564 | 0 | I require to do a project as a part of my final year of engineering graduation studies.Can you suggest some projects pertaining to distributed systems and artificial intelligence together and which require python,c or c++ for programming?
Note:-Please suggest a project that is attainable for a group of 2 students. | 0 | c++,python,artificial-intelligence,system,distributed | 2009-07-26T08:06:00.000 | 0 | 1,184,018 | I need some kind of tool which observes the behaviour of a automation system (for instance a process control system), and is able to figure out on which inputs which actions follow, and then derives some kind of model from it which would then be usable as a simulation of the real system. It's not exactly distributed, but its engineering :-)
On the other hand, our code is written in java (although you could use jython instead).
If you are interested, drop me a mail (juergen DOT rose AT inavare DOT net). | 0 | 1,483 | false | 0 | 1 | Graduation Project | 1,184,303 |
3 | 7 | 0 | 0 | 0 | 1 | 0 | 0 | I require to do a project as a part of my final year of engineering graduation studies.Can you suggest some projects pertaining to distributed systems and artificial intelligence together and which require python,c or c++ for programming?
Note:-Please suggest a project that is attainable for a group of 2 students. | 0 | c++,python,artificial-intelligence,system,distributed | 2009-07-26T08:06:00.000 | 0 | 1,184,018 | How about hacking a P2P protocol and implementing something useful? I worked on a proxy cache implementation for P2P traffic. Basically, design and implement a proxy cache for P2P traffic. It will be different from web documents/objects in that:
1- P2P objects are immutable. You might request a web-page more than once, but you really download a P2P object (e.g., movie) once and read it from your desk multiple times.
2- P2P objects are huge compared to web objects (up to few Gigabytes) so you'll need to cache some objects partially, and implement some kind of smart admission/eviction policy.
3- P2P objects have different popularity. Just because something is in the cache does not mean it should stay in the cache forever, because its popularity will degrade (i.e., once a movie is released it is very popular, downloaded a lot, then it drops and everybody forgets about it), so you can't rely on recency or frequency alone as the only replacement policy. | 0 | 1,483 | false | 0 | 1 | Graduation Project | 1,184,275 |
3 | 7 | 0 | 1 | 0 | 1 | 0.028564 | 0 | I require to do a project as a part of my final year of engineering graduation studies.Can you suggest some projects pertaining to distributed systems and artificial intelligence together and which require python,c or c++ for programming?
Note:-Please suggest a project that is attainable for a group of 2 students. | 0 | c++,python,artificial-intelligence,system,distributed | 2009-07-26T08:06:00.000 | 0 | 1,184,018 | How about a decision process that uses mapreduce, and gets more efficient at choosing the answer each time? | 0 | 1,483 | false | 0 | 1 | Graduation Project | 1,184,030 |
1 | 3 | 0 | 0 | 0 | 1 | 0 | 0 | I'm basically trying to setup my own private pastebin where I can save html files on my private server to test and fool around - have some sort of textarea for the initial input, save the file, and after saving I'd like to be able to view all the files I saved.
I'm trying to write this in python, just wondering what the most practical way would be of storing the file(s) or the code? SQLite? Straight up flat files?
One other thing I'm worried about is the uniqueness of the files, obviously I don't want conflicting filenames ( maybe save using 'title' and timestamp? ) - how should I structure it? | 0 | python,web-applications | 2009-07-26T09:23:00.000 | 0 | 1,184,116 | Plain files are definitely more effective. Save your database for more complex queries.
If you need some formatting to be done on files, such as highlighting the code properly, it is better to do it before you save the file with that code. That way you don't need to apply formatting every time the file is shown.
You definitely would need somehow ensure all file names are unique, but this task is trivial, since you can just check, if the file already exists on the disk and if it does, add some number to its name and check again and so on.
Don't store them all in one directory either, since filesystem can perform much worse if there are A LOT (~ 1 million) files in the single directory, so you can structure your storage like this:
FILE_DIR/YEAR/MONTH/FileID.html and store the "YEAR/MONTH/FileID" Part in the database as a unique ID for the file.
Of course, if you don't worry about performance (not many users, for example) you can just go with storing everything in the database, which is much easier to manage. | 0 | 578 | false | 1 | 1 | Storing files for testbin/pastebin in Python | 1,184,170 |
4 | 6 | 0 | 1 | 3 | 0 | 0.033321 | 1 | I wonder what is the best way to handle parallel SSH connections in python.
I need to open several SSH connections to keep in background and to feed commands in interactive or timed batch way.
Is this possible to do it with the paramiko libraries? It would be nice not to spawn a different SSH process for each connection.
Thanks. | 0 | python,ssh,parallel-processing | 2009-07-26T23:19:00.000 | 1 | 1,185,855 | You can simply use subprocess.Popen for that purpose, without any problems.
However, you might want to simply install cronjobs on the remote machines. :-) | 0 | 7,048 | false | 0 | 1 | Parallel SSH in Python | 1,185,871 |
4 | 6 | 0 | 1 | 3 | 0 | 0.033321 | 1 | I wonder what is the best way to handle parallel SSH connections in python.
I need to open several SSH connections to keep in background and to feed commands in interactive or timed batch way.
Is this possible to do it with the paramiko libraries? It would be nice not to spawn a different SSH process for each connection.
Thanks. | 0 | python,ssh,parallel-processing | 2009-07-26T23:19:00.000 | 1 | 1,185,855 | Reading the paramiko API docs, it looks like it is possible to open one ssh connection, and multiplex as many ssh tunnels on top of that as are wished. Common ssh clients (openssh) often do things like this automatically behind the scene if there is already a connection open. | 0 | 7,048 | false | 0 | 1 | Parallel SSH in Python | 1,185,880 |
4 | 6 | 0 | 3 | 3 | 0 | 0.099668 | 1 | I wonder what is the best way to handle parallel SSH connections in python.
I need to open several SSH connections to keep in background and to feed commands in interactive or timed batch way.
Is this possible to do it with the paramiko libraries? It would be nice not to spawn a different SSH process for each connection.
Thanks. | 0 | python,ssh,parallel-processing | 2009-07-26T23:19:00.000 | 1 | 1,185,855 | Yes, you can do this with paramiko.
If you're connecting to one server, you can run multiple channels through a single connection. If you're connecting to multiple servers, you can start multiple connections in separate threads. No need to manage multiple processes, although you could substitute the multiprocessing module for the threading module and have the same effect.
I haven't looked into twisted conch in a while, but it looks like it getting updates again, which is nice. I couldn't give you a good feature comparison between the two, but I find paramiko is easier to get going. It takes a little more effort to get into twisted, but it could be well worth it if you're doing other network programming. | 0 | 7,048 | false | 0 | 1 | Parallel SSH in Python | 1,188,586 |
4 | 6 | 0 | -1 | 3 | 0 | -0.033321 | 1 | I wonder what is the best way to handle parallel SSH connections in python.
I need to open several SSH connections to keep in background and to feed commands in interactive or timed batch way.
Is this possible to do it with the paramiko libraries? It would be nice not to spawn a different SSH process for each connection.
Thanks. | 0 | python,ssh,parallel-processing | 2009-07-26T23:19:00.000 | 1 | 1,185,855 | This might not be relevant to your question. But there are tools like pssh, clusterssh etc. that can parallely spawn connections. You can couple Expect with pssh to control them too. | 0 | 7,048 | false | 0 | 1 | Parallel SSH in Python | 1,516,547 |
1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | I'm trying to make a web app that will manage my Mercurial repositories for me.
I want it so that when I tell it to load repository X:
Connect to a MySQL server and make sure X exists.
Check if the user is allowed to access the repository.
If above is true, get the location of X from a mysql server.
Run a hgweb cgi script (python) containing the path of the repository.
Here is the problem, I want to: take the hgweb script, modify it, and run it.
But I do not want to: take the hgweb script, modify it, write it to a file and redirect there.
I am using Apache to run the httpd process. | 1 | php,python,mercurial,cgi | 2009-07-26T23:24:00.000 | 0 | 1,185,867 | As far as you question, no, you're not likely to get php to execute a modified script without writing it somewhere, whether that's a file on the disk, a virtual file mapped to ram, or something similar.
It sounds like you might be trying to pound a railroad spike with a twig. If you're to the point where you're filtering access based on user permissions stored in MySQL, have you looked at existing HG solutions to make sure there isn't something more applicable than hgweb? It's really built for doing exactly one thing well, and this is a fair bit beyond it's normal realm.
I might suggest looking into apache's native authentication as a more convenient method for controlling access to repositories, then just serve the repo without modifying the script. | 0 | 940 | false | 0 | 1 | How can I execute CGI files from PHP? | 1,185,909 |
2 | 4 | 1 | 3 | 6 | 1 | 0.148885 | 0 | The Python manual says that you can create modules for Python in both C and C++. Can you take advantage of things like classes and templates when using C++? Wouldn't it create incompatibilities with the rest of the libraries and with the interpreter? | 0 | c++,python,c,python-c-api,python-c-extension | 2009-07-26T23:30:00.000 | 0 | 1,185,878 | The boost folks have a nice automated way to do the wrapping of C++ code for use by python.
It is called: Boost.Python
It deals with some of the constructs of C++ better than SWIG, particularly template metaprogramming. | 0 | 567 | false | 0 | 1 | Can I use C++ features while extending Python? | 1,185,954 |
2 | 4 | 1 | 9 | 6 | 1 | 1.2 | 0 | The Python manual says that you can create modules for Python in both C and C++. Can you take advantage of things like classes and templates when using C++? Wouldn't it create incompatibilities with the rest of the libraries and with the interpreter? | 0 | c++,python,c,python-c-api,python-c-extension | 2009-07-26T23:30:00.000 | 0 | 1,185,878 | It doesn't matter whether your implementation of the hook functions is implemented in C or in C++. In fact, I've already seen some Python extensions which make active use of C++ templates and even the Boost library. No problem. :-) | 0 | 567 | true | 0 | 1 | Can I use C++ features while extending Python? | 1,185,907 |
2 | 7 | 0 | 6 | 7 | 1 | 1.2 | 0 | I'm looking for a way to read specific files from a rar archive into memory. Specifically they are a collection of numbered image files (I'm writing a comic reader). While I can simply unrar these files and load them as needed (deleting them when done), I'd prefer to avoid that if possible.
That all said, I'd prefer a solution that's cross platform (Windows/Linux) if possible, but Linux is a must. Just as importantly, if you're going to point out a library to handle this for me, please understand that it must be free (as in beer) or OSS. | 0 | python,linux,stream,rar | 2009-07-27T00:25:00.000 | 0 | 1,185,959 | The real answer is that there isn't a library, and you can't make one. You can use rarfile, or you can use 7zip unRAR (which is less free than 7zip, but still free as in beer), but both approaches require an external executable. The license for RAR basically requires this, as while you can get source code for unRAR, you cannot modify it in any way, and turning it into a library would constitute illegal modification.
Also, solid RAR archives (the best compressed) can't be randomly accessed, so you have to unarchive the entire thing anyhow. WinRAR presents a UI that seems to avoid this, but really it's just unpacking and repacking the archive in the background. | 0 | 8,947 | true | 0 | 1 | Read content of RAR file into memory in Python | 1,186,041 |
2 | 7 | 0 | 2 | 7 | 1 | 0.057081 | 0 | I'm looking for a way to read specific files from a rar archive into memory. Specifically they are a collection of numbered image files (I'm writing a comic reader). While I can simply unrar these files and load them as needed (deleting them when done), I'd prefer to avoid that if possible.
That all said, I'd prefer a solution that's cross platform (Windows/Linux) if possible, but Linux is a must. Just as importantly, if you're going to point out a library to handle this for me, please understand that it must be free (as in beer) or OSS. | 0 | python,linux,stream,rar | 2009-07-27T00:25:00.000 | 0 | 1,185,959 | It seems like the limitation that rarsoft imposes on derivative works is that you may not use the unrar source code to create a variation of the RAR COMPRESSION algorithm. From the context, it would appear that it's specifically allowing folks to use his code (modified or not) to decompress files, but you cannot use them if you intend to write your own compression code. Here is a direct quote from the license.txt file I just downloaded:
The UnRAR sources may be used in any software to handle RAR
archives without limitations free of charge, but cannot be used
to re-create the RAR compression algorithm, which is proprietary.
Distribution of modified UnRAR sources in separate form or as a
part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
Seeing as everyone seemed to just want something that would allow them to write a comic viewer capable of handling reading images from CBR (rar) files, I don't see why people think there's anything keeping them from using the provided source code. | 0 | 8,947 | false | 0 | 1 | Read content of RAR file into memory in Python | 4,436,131 |
1 | 3 | 0 | 1 | 0 | 0 | 0.066568 | 1 | I've only used XML RPC and I haven't really delved into SOAP but I'm trying to find a good comprehensive guide, with real world examples or even a walkthrough of some minimal REST application.
I'm most comfortable with Python/PHP. | 0 | php,python,xml,rest,soap | 2009-07-27T07:11:00.000 | 0 | 1,186,839 | I like the examples in the Richardson & Ruby book, "RESTful Web Services" from O'Reilly. | 0 | 499 | false | 0 | 1 | Real world guide on using and/or setting up REST web services? | 1,186,876 |
3 | 7 | 0 | 2 | 12 | 0 | 0.057081 | 0 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out there, and/or a worked-out example in the associated language? | 0 | python,r,statistics | 2009-07-28T02:43:00.000 | 0 | 1,191,689 | I apply hierarchical Bayes models in R in combination with JAGS (Linux) or sometimes WinBUGS (Windows, or Wine). Check out the book of Andrew Gelman, as referred to above. | 1 | 8,690 | false | 0 | 1 | Hierarchical Bayes for R or Python | 1,832,314 |
3 | 7 | 0 | 0 | 12 | 0 | 0 | 0 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out there, and/or a worked-out example in the associated language? | 0 | python,r,statistics | 2009-07-28T02:43:00.000 | 0 | 1,191,689 | This answer comes almost ten years late, but it will hopefully help someone in the future.
The brms package in R is a very good option for Bayesian hierarchical/multilevel models, using a syntax very similar to the lme4 package.
The brms package uses the probabilistic programming language Stan in the back to do the inferences. Stan uses more advanced sampling methods than JAGS and BUGS, such as Hamiltonian Monte Carlo, which provides more efficient and reliable samples from the posterior distribution.
If you wish to model more complicated phenomena, then you can use the rstanpackage to compile Stan models from R. There is also the Python alternative PyStan. However, in order to do this, you must learn how to use Stan. | 1 | 8,690 | false | 0 | 1 | Hierarchical Bayes for R or Python | 55,978,470 |
3 | 7 | 0 | 0 | 12 | 0 | 0 | 0 | Hierarchical Bayes models are commonly used in Marketing, Political Science, and Econometrics. Yet, the only package I know of is bayesm, which is really a companion to a book (Bayesian Statistics and Marketing, by Rossi, et al.) Am I missing something? Is there a software package for R or Python doing the job out there, and/or a worked-out example in the associated language? | 0 | python,r,statistics | 2009-07-28T02:43:00.000 | 0 | 1,191,689 | The lme4 package, which estimates hierarchical models using frequentist methods, has a function called mcmcsamp that allows you to sample from the posterior distribution of the model using MCMC. This currently works only for linear models, quite unfortunately. | 1 | 8,690 | false | 0 | 1 | Hierarchical Bayes for R or Python | 1,197,766 |
1 | 4 | 0 | 2 | 4 | 0 | 1.2 | 0 | I need to convert any html entity into its ASCII equivalent using Python. My use case is that I am cleaning up some HTML used to build emails to create plaintext emails from the HTML.
Right now, I only really know how to create unicode from these entities when I need ASCII (I think) so that the plaintext email reads correctly with things like accented characters. I think a basic example is the html entity "& aacute;" or á being encoded into ASCII.
Furthermore, I'm not even 100% sure that ASCII is what I need for a plaintext email. As you can tell, I'm completely lost on this encoding stuff. | 0 | python,ascii | 2009-07-29T04:00:00.000 | 0 | 1,197,981 | ASCII is the American Standard Code for Information Interchange and does not include any accented letters. Your best bet is to get Unicode (as you say you can) and encode it as UTF-8 (maybe ISO-8859-1 or some weird codepage if you're dealing with seriously badly coded user-agents/clients, sigh) -- the content type header of that part together with text/plain can express what encoding you've chosen to use (I do recommend trying UTF-8 unless you have positively demonstrated it cannot work -- it's almost universally supported these days and MUCH more flexible than any ISO-8859 or "codepage" hack!). | 0 | 8,608 | true | 0 | 1 | Convert html entities to ascii in Python | 1,198,002 |
1 | 3 | 0 | 0 | 5 | 0 | 1.2 | 0 | We have a python project that we want to start testing using buildbot. Its unit tests include tests that should only work on some platforms. So, we've got tests that should pass on all platforms, tests that should only run on 1 specific platform, tests that should pass on platforms A, B, C and tests that pass on B and D.
What is the best way of doing this? Simple suites would be a hassle, since, as described, each test can have a different list of target platforms. I thought about adding "@run_on" and "@ignore_on" decorators that would match platforms to test methods. Is there anything better? | 0 | python,unit-testing,buildbot | 2009-07-29T11:13:00.000 | 0 | 1,199,493 | We've decided to go with decorators that, using platform module and others, check whether the tests should be executed, and if not simply let it pass (though, we saw that python2.7 already has in its trunk a SkipTest exception that could be raised in such cases, to ignore the test). | 0 | 709 | true | 0 | 1 | How to distribute and execute platform-specific unit tests? | 1,371,766 |
1 | 4 | 0 | 2 | 3 | 0 | 1.2 | 0 | I've been told by my hosting company that Python is installed on their servers. How would I go about using it to output a simple HTML page? This is just as a learning exercise at the moment, but one day I'd like to use Python in the same way as I currently use PHP. | 0 | python,server-side | 2009-07-29T11:49:00.000 | 0 | 1,199,703 | If your server is running Apache HTTP server, then you need something like mod_wsgi or mod_python installed and running as a module (your server signature may tell you this).
Once running, you may need to add a handler to your apache config, or a default may be setup.
After that, look at the documentation for the middleware of the module you are running, then maybe go on and use something like Django. | 0 | 2,969 | true | 1 | 1 | How do I use Python serverside with shared hosting? | 1,199,744 |
1 | 2 | 0 | 1 | 6 | 0 | 0.099668 | 1 | I need to port some code that relies heavily on lxml from a CPython application to IronPython.
lxml is very Pythonic and I would like to keep using it under IronPython, but it depends on libxslt and libxml2, which are C extensions.
Does anyone know of a workaround to allow lxml under IronPython or a version of lxml that doesn't have those C-extension dependencies? | 0 | .net,xml,ironpython,python,lxml | 2009-07-29T14:36:00.000 | 0 | 1,200,726 | Something which you might have already considered:
An alternative is to first port the lxml library to IPy and then your code (depending on the code size). You might have to write some C# wrappers for the native C calls to the C extensions -- I'm not sure what issues, if any, are involved in this with regards to IPy.
Or if the code which you are porting is small, as compared to lxml, then maybe you can just remove the lxml dependency and use the .NET XML libraries. | 0 | 2,349 | false | 0 | 1 | How to get lxml working under IronPython? | 1,211,395 |
1 | 2 | 0 | 1 | 0 | 0 | 0.099668 | 1 | I'm trying to raise an exception on the Server Side of an SimpleXMLRPCServer; however, all attempts get a "Fault 1" exception on the client side.
RPC_Server.AbortTest()
File "C:\Python25\lib\xmlrpclib.py", line 1147, in call
return self.__send(self.__name, args)
File "C:\Python25\lib\xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "C:\Python25\lib\xmlrpclib.py", line 1201, in request
return self._parse_response(h.getfile(), sock)
File "C:\Python25\lib\xmlrpclib.py", line 1340, in _parse_response
return u.close()
File "C:\Python25\lib\xmlrpclib.py", line 787, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: :Test Aborted by a RPC
request"> | 0 | python,exception,simplexmlrpcserver | 2009-07-29T16:34:00.000 | 0 | 1,201,507 | Yes, this is what happens when you raise an exception on the server side. Are you expecting the SimpleXMLRPCServer to return the exception to the client?
You can only use objects that can be marshalled through XML. This includes
boolean : The True and False constants
integers : Pass in directly
floating-point numbers : Pass in directly
strings : Pass in directly
arrays : Any Python sequence type containing conformable elements. Arrays are returned as lists
structures : A Python dictionary. Keys must be strings, values may be any conformable type. Objects of user-defined classes can be passed in; only their __dict__ attribute is transmitted.
dates : in seconds since the epoch (pass in an instance of the DateTime class) or a datetime.datetime instance.
binary data : pass in an instance of the Binary wrapper class | 0 | 746 | false | 0 | 1 | Sending an exception on the SimpleXMLRPCServer | 1,202,742 |
1 | 5 | 0 | 4 | 4 | 0 | 1.2 | 0 | I have to deploy some Web Services on a server that only supports the Java ones, but some of them will be done using perl or python. I want to know if is possible to develop a Java wrapper to call a specific code written in perl or python. So, I want to have all the Web Services in Java, but some of them will call some code using other languages.
Thanks in advance.
Regards,
Ukrania | 0 | java,python,perl,web-services,wrapper | 2009-07-29T16:53:00.000 | 1 | 1,201,628 | This depends heavily upon your needs. If Jython is an option for the Python code (it isn't always 100% compatible), then it is probably the best option there. Otherwise, you will need to use Java's Process Builder to call the interpretters directly and return the results on their output stream. This will not be fast (but then again, Jython isn't that fast either, relative to regular Java code), but it is an extremely flexible solution. | 0 | 2,709 | true | 1 | 1 | Java Wrapper to Perl/Python code | 1,201,722 |
1 | 2 | 0 | 1 | 1 | 0 | 0.099668 | 0 | I have an older version of python on the server i'm using and cannot upgrade it. is there a way to get the uuid module? | 0 | python | 2009-07-31T15:49:00.000 | 0 | 1,213,328 | To continue where Alex left off..
Download the uuid-1.30.tar.gz from Alex's pypi link.
unzip and untar.
place the uuid.py to your application's python path (e.g., same dir with your own .py files) | 0 | 3,485 | false | 0 | 1 | how can I get the uuid module for python 2.4.3 | 1,400,264 |
3 | 13 | 0 | 2 | 127 | 0 | 0.03076 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding that most of the python modules I install with it are not being seen by python. I've spent some time playing around with PATH settings and using python_select . Nothing has really worked and at this point I'm not really understanding, instead I'm just poking around.
I get the impression that Macports isn't universally loved for managing python modules. I'd like to start fresh using a more "accepted" (if that's the right word) approach.
So, I was wondering, what is the method that Mac python developers use to manage their modules?
Bonus questions:
Do you use Apple's python, or some other version?
Do you compile everything from source or is there a package manger that works well (Fink?). | 0 | python,macos,module,packages,macports | 2009-07-31T16:58:00.000 | 1 | 1,213,690 | You may already have pip3 pre-installed, so just try it! | 0 | 168,159 | false | 0 | 1 | What is the most compatible way to install python modules on a Mac? | 49,869,959 |
3 | 13 | 0 | 7 | 127 | 0 | 1 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding that most of the python modules I install with it are not being seen by python. I've spent some time playing around with PATH settings and using python_select . Nothing has really worked and at this point I'm not really understanding, instead I'm just poking around.
I get the impression that Macports isn't universally loved for managing python modules. I'd like to start fresh using a more "accepted" (if that's the right word) approach.
So, I was wondering, what is the method that Mac python developers use to manage their modules?
Bonus questions:
Do you use Apple's python, or some other version?
Do you compile everything from source or is there a package manger that works well (Fink?). | 0 | python,macos,module,packages,macports | 2009-07-31T16:58:00.000 | 1 | 1,213,690 | I use MacPorts to install Python and any third-party modules tracked by MacPorts into /opt/local, and I install any manually installed modules (those not in the MacPorts repository) into /usr/local, and this has never caused any problems. I think you may be confused as to the use of certain MacPorts scripts and environment variables.
MacPorts python_select is used to select the "current" version of Python, but it has nothing to do with modules. This allows you to, e.g., install both Python 2.5 and Python 2.6 using MacPorts, and switch between installs.
The $PATH environment variables does not affect what Python modules are loaded. $PYTHONPATH is what you are looking for. $PYTHONPATH should point to directories containing Python modules you want to load. In my case, my $PYTHONPATH variable contains /usr/local/lib/python26/site-packages. If you use MacPorts' Python, it sets up the other proper directories for you, so you only need to add additional paths to $PYTHONPATH. But again, $PATH isn't used at all when Python searches for modules you have installed.
$PATH is used to find executables, so if you install MacPorts' Python, make sure /opt/local/bin is in your $PATH. | 0 | 168,159 | false | 0 | 1 | What is the most compatible way to install python modules on a Mac? | 1,214,123 |
3 | 13 | 0 | 6 | 127 | 0 | 1 | 0 | I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I'm used to using Macports to install all the Unixy stuff. However, I'm finding that most of the python modules I install with it are not being seen by python. I've spent some time playing around with PATH settings and using python_select . Nothing has really worked and at this point I'm not really understanding, instead I'm just poking around.
I get the impression that Macports isn't universally loved for managing python modules. I'd like to start fresh using a more "accepted" (if that's the right word) approach.
So, I was wondering, what is the method that Mac python developers use to manage their modules?
Bonus questions:
Do you use Apple's python, or some other version?
Do you compile everything from source or is there a package manger that works well (Fink?). | 0 | python,macos,module,packages,macports | 2009-07-31T16:58:00.000 | 1 | 1,213,690 | If you use Python from MacPorts, it has it's own easy_install located at: /opt/local/bin/easy_install-2.6 (for py26, that is). It's not the same one as simply calling easy_install directly, even if you used python_select to change your default python command. | 0 | 168,159 | false | 0 | 1 | What is the most compatible way to install python modules on a Mac? | 2,380,159 |
1 | 5 | 0 | 0 | 3 | 1 | 0 | 0 | I'm working on a statistical project that involves iterating over every possible way to partition a collection of strings and running a simple calculation on each. Specifically, each possible substring has a probability associated with it, and I'm trying to get the sum across all partitions of the product of the substring probability in the partition.
For example, if the string is 'abc', then there would be probabilities for 'a', 'b', 'c', 'ab, 'bc' and 'abc'. There are four possible partitionings of the string: 'abc', 'ab|c', 'a|bc' and 'a|b|c'. The algorithm needs to find the product of the component probabilities for each partitioning, then sum the four resultant numbers.
Currently, I've written a python iterator that uses binary representations of integers for the partitions (eg 00, 01, 10, 11 for the example above) and simply runs through the integers. Unfortunately, this is immensely slow for strings longer than 20 or so characters.
Can anybody think of a clever way to perform this operation without simply running through every partition one at a time? I've been stuck on this for days now.
In response to some comments here is some more information:
The string can be just about anything, eg "foobar(foo2)" -- our alphabet is lowercase alphanumeric plus all three type of braces ("(","[","{"), hyphens and spaces.
The goal is to get the likelihood of the string given individual 'word' likelihoods. So L(S='abc')=P('abc') + P('ab')P('c') + P('a')P('bc') + P('a')P('b')P('c') (Here "P('abc')" indicates the probability of the 'word' 'abc', while "L(S='abc')" is the statistical likelihood of observing the string 'abc'). | 0 | python,string,partitioning | 2009-08-03T15:33:00.000 | 0 | 1,223,007 | You should look into the itertools module. It can create a generator for you that is very fast. Given your input string, it will provide you with all possible permutations. Depending on what you need, there is also a combinations() generator. I'm not quite sure if you're looking at "b|ca" when you're looking at "abc," but either way, this module may prove useful to you. | 0 | 323 | false | 0 | 1 | Are there any cleverly efficient algorithms to perform a calculation over the space of partitionings of a string? | 1,223,236 |
1 | 4 | 0 | 0 | 5 | 0 | 0 | 0 | I am looking for a good config file library for c that is not xml. Optimally I would really like one that also has python bindings. The best option I have come up with is to use a JSON library in both c and python. What would you recommend, or what method of reading/writing configuration settings do you prefer? | 0 | python,c,configuration-management | 2009-08-04T11:48:00.000 | 0 | 1,227,031 | Despite being hated by techies and disowned by Microsoft, INI files are actually quite popular with users, as they are easy to understand and edit. They are also very simple to write parsers for, should your libraries not already support them. | 0 | 1,054 | false | 0 | 1 | What is a good configuration file library for c thats not xml (preferably has python bindings)? | 1,227,256 |
1 | 3 | 0 | 8 | 5 | 1 | 1 | 0 | Taking speed as an issue it may be better to choose another language, but what is your library/module/implementation of choice for doing a 1D fast Fourier transform (FFT) in Python? | 0 | python,benchmarking,fft | 2009-08-06T22:07:00.000 | 0 | 1,241,797 | I would recommend numpy library, I not sure if it's the fastest implementation that exist but but surely it's one of best scientific module on the "market". | 0 | 2,655 | false | 0 | 1 | What is the recommended Python module for fast Fourier transforms (FFT)? | 1,241,961 |
1 | 4 | 0 | 3 | 2 | 0 | 0.148885 | 0 | I have a python script which I can run from pythonwin on which I give the arguments.
Is it possible to automate this so that when I just click on the *.py file, I don't see the script and it asks for the path in a dos window? | 0 | python | 2009-08-07T16:48:00.000 | 1 | 1,245,818 | Rename it to *.pyw to hide the console on execution in Windows. | 0 | 6,240 | false | 0 | 1 | Run Python script without opening Pythonwin | 1,245,828 |
3 | 16 | 0 | -1 | 10 | 0 | -0.012499 | 0 | Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language.
What are other libraries that you have found been ported to different languages and as good as the original?
Please make it one library per answer so others can vote.
Format:
Original-Library-Name, Original-Programming-Language
Ported-Library-Name, Ported-Programming-Language
If possible with the links to the website of the libraries. | 0 | java,python,.net,ruby,perl | 2009-08-10T05:29:00.000 | 0 | 1,253,232 | GTK, originally in C.
Ported to Java, Python, Ruby, C++, and most every other common language you can think of. | 0 | 1,282 | false | 0 | 1 | Which libraries have been ported to different programming languages? | 2,274,406 |
3 | 16 | 0 | 3 | 10 | 0 | 0.037482 | 0 | Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language.
What are other libraries that you have found been ported to different languages and as good as the original?
Please make it one library per answer so others can vote.
Format:
Original-Library-Name, Original-Programming-Language
Ported-Library-Name, Ported-Programming-Language
If possible with the links to the website of the libraries. | 0 | java,python,.net,ruby,perl | 2009-08-10T05:29:00.000 | 0 | 1,253,232 | Java,Java
C#, .NET
Ohh com'on, just kidding, ok, down vote me now! | 0 | 1,282 | false | 0 | 1 | Which libraries have been ported to different programming languages? | 1,269,650 |
3 | 16 | 0 | 2 | 10 | 0 | 0.024995 | 0 | Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language.
What are other libraries that you have found been ported to different languages and as good as the original?
Please make it one library per answer so others can vote.
Format:
Original-Library-Name, Original-Programming-Language
Ported-Library-Name, Ported-Programming-Language
If possible with the links to the website of the libraries. | 0 | java,python,.net,ruby,perl | 2009-08-10T05:29:00.000 | 0 | 1,253,232 | Hibernate, Java
NHibernate, .NET | 0 | 1,282 | false | 0 | 1 | Which libraries have been ported to different programming languages? | 1,253,957 |
1 | 3 | 0 | 0 | 2 | 0 | 0 | 0 | I'm trying to integrate an old PHP ad management system into a (Django) Python-based web application. The PHP and the Python code are both installed on the same hosts, PHP is executed by mod_php5 and Python through mod_wsgi, usually.
Now I wonder what's the best way to call this PHP ad management code from within my Python code in a most efficient manner (the ad management code has to be called multiple times for each page)?
The solutions I came up with so far, are the following:
Write SOAP interface in PHP for the ad management code and write a SOAP client in Python which then calls the appropriate functions.
The problem I see is, that will slow down the execution of the Python code considerably, since for each page served, multiple SOAP client requests are necessary in the background.
Call the PHP code through os.execvp() or subprocess.Popen() using PHP command line interface.
The problem here is that the PHP code makes use of the Apache environment ($_SERVER vars and other superglobals). I'm not sure if this can be simulated correctly.
Rewrite the ad management code in Python.
This will probably be the last resort. This ad management code just runs and runs, and there is no one remaining who wrote a piece of code for this :) I'd be quite afraid to do this ;)
Any other ideas or hints how this can be done?
Thanks. | 0 | php,python | 2009-08-10T13:13:00.000 | 0 | 1,254,802 | I've done this in the past by serving the PHP portions directly via Apache. You could either put them in with your media files, (/site_media/php/) or if you prefer to use something more lightweight for your media server (like lighttpd), you can set up another portion of the site that goes through apache with PHP enabled.
From there, you can either take the ajax route in your templates, or you can load the PHP from your views using urllib(2) or httplib(2). Better yet, wrap the urllib2 call in a templatetag, and call that in your templates. | 0 | 3,234 | false | 1 | 1 | Call PHP code from Python | 1,256,684 |
3 | 5 | 0 | 10 | 10 | 1 | 1 | 0 | I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it.
Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ? | 0 | python,smalltalk | 2009-08-12T23:17:00.000 | 0 | 1,269,242 | As someone new to smalltalk, the two things that really strike me are the image-based system, and that reflection is everywhere. These two simple facts appear to give rise to everything else cool in the system:
The image means that you do everything by manipulating objects, including writing and compiling code
Reflection allows you to inspect the state of any object. Since classes are objects and their sources are objects, you can inspect and manipulate code
You have access to the current execution context, so you can have a look at the stack, and from there, compiled code and the source of that code and so on
The stack is an object, so you can save it away and then resume later. Bingo, continuations!
All of the above starts to come together in cool ways:
The browser lets you explore the source of literally everything, including the VM in Squeak
You can make changes that affect your live program, so there's no need to restart and navigate your way through to whatever you're working on
Even better, when your program throws an exception you can debug the live code. You fix the bug, update the state if it's become inconsistent and then have your program continue.
The browser will tell you if it thinks you've made a typo
It's absurdly easy to browse up and down the class hierarchy, or find out what messages a object responds to, or which code sends a given message, or which objects can receive a given message
You can inspect and manipulate the state of any object in the system
You can make any two objects literally switch places with become:, which lets you do crazy stuff like stub out any object and then lazily pull it in from elsewhere if it's sent a message.
The image system and reflection has made all of these perfectly natural and normal things for a smalltalker for about thirty years. | 0 | 5,971 | false | 0 | 1 | Differences between Smalltalk and python? | 1,271,000 |
3 | 5 | 0 | 7 | 10 | 1 | 1 | 0 | I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it.
Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ? | 0 | python,smalltalk | 2009-08-12T23:17:00.000 | 0 | 1,269,242 | Smalltalk historically has had an amazing IDE built in. I have missed this IDE on many languages.
Smalltalk also has the lovely property that it is typically in a living system. You start up clean and start modifying things. This is basically an object persistent storage system. That being said, this is both good and bad. What you run is part of your system and part of what you ship. The system can be setup quite nicely before being distributed. The down side, is that the system has everything you run as part of what you ship. You need to be very careful packaging for redistribution.
Now, that being said, it has been a while since I have worked with Smalltalk (about 20 years). Yes, I know, fun times for those who do the math. Smalltalk is a nice language, fun to program in, fun to learn, but I have found it a little hard to ship things in.
Enjoy playing with it if you do. I have been playing with Python and loving it.
Jacob | 0 | 5,971 | false | 0 | 1 | Differences between Smalltalk and python? | 1,269,259 |
3 | 5 | 0 | 2 | 10 | 1 | 0.07983 | 0 | I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it.
Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ? | 0 | python,smalltalk | 2009-08-12T23:17:00.000 | 0 | 1,269,242 | The language aspect often isn't that important, and many languages are quite samey,
From what I see, Python and Smalltalk share OOP ideals ... but are very different in their implementation and the power in the presented language interface.
the real value comes in what the subtle differences in the syntax allows in terms of implementation. Take a look at Self and other meta-heavy languages.
Look past the syntax and immediate semantics to what the subtle differences allow the implementation to do.
For example:
Everything in Smalltalk-80 is available for modification from within a running program
What differences between Python and Smalltalk allow deeper maniplation if any? How does the language enable the implementation of the compiler/runtime? | 0 | 5,971 | false | 0 | 1 | Differences between Smalltalk and python? | 1,269,266 |
1 | 1 | 0 | 2 | 2 | 0 | 1.2 | 0 | I'm looking for the simplest way of using python and SQLAlchemy to produce some XML for a jQuery based HTTP client. Right now I'm using mod_python's CGI handler but I'm unhappy with the fact that I can't persist stuff like the SQLAlchemy session.
The mod_python publisher handler that is apparently capable of persisting stuff does not allow requests with XML content type (as used by jQuery's ajax stuff) so I can't use it.
What other options are there? | 1 | python,cgi,mod-python | 2009-08-13T14:29:00.000 | 0 | 1,272,325 | You could always write your own handler, which is the way mod_python is normally intended to be used. You would have to set some HTTP headers (and you could have a look at the publisher handler's source code for inspiration on that), but otherwise I don't think it's much more complicated than what you've been trying to do.
Though as long as you're at it, I would suggest trying mod_wsgi instead of mod_python, which is probably eventually going to supersede mod_python. WSGI is a Python standard for writing web applications. | 0 | 1,222 | true | 1 | 1 | Alternatives to mod_python's CGI handler | 1,272,579 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.