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
3
7
0
0
9
1
0
0
I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions: Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines Does python handle networking tasks fairly well? Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language. Thanks a ton for any help you can provide.
0
python,networking,programming-languages,robust
2010-03-19T00:14:00.000
0
2,474,224
Python is up to the task (and better) for 1, 2 and 4. The best solution for 3 from what you describe would probably be to make your programs really open-source with GPL or BSD like licence. This way people will edit your super-cool sources (but often experienced programmers, not just script kiddies) and build on then but leave your name in for posterity.
0
861
false
0
1
Python for a hobbyist programmer ( a few questions)
2,475,530
3
7
0
0
9
1
0
0
I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions: Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines Does python handle networking tasks fairly well? Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language. Thanks a ton for any help you can provide.
0
python,networking,programming-languages,robust
2010-03-19T00:14:00.000
0
2,474,224
Points 1 and 2: HELL YEAH. Point 4: kind of. Python is good at some network stuff. It's not Java or C++. Just use zlib (zip library) and pickle (serialization) for everything, and look at xmlrpclib if you need IPC. Point 3: No. However, you can write C modules (for the performance critical, and hard-to-copy) parts of your code, and that would make it non-trivial to reverse-engineer.
0
861
false
0
1
Python for a hobbyist programmer ( a few questions)
2,475,188
3
7
0
6
9
1
1
0
I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions: Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines Does python handle networking tasks fairly well? Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language. Thanks a ton for any help you can provide.
0
python,networking,programming-languages,robust
2010-03-19T00:14:00.000
0
2,474,224
I think that Python is very powerful to do a lot of things, but just like Java and C++, it often depends on good third-party libraries. I come from a Java background but use Python for a lot of things, and it's been a fun ride. I've done things like statistics, and automation, not sure about the UI though that often depends on the toolkit more than the language. Python networking works well. I don't know if I'd use it to build a fast algorithmic trading system or a VOIP application, but for most intents and purposes, especially at higher levels of abstraction, it's fine and easy to use. You would need external libraries for things like SSH or FTP. Python is quite popular and has very good online support, active community, and major corporations (likeGoogle) that use it. I found the official online tutorial and reference to be excellent. I have to say that I disagree with the "every idiot with a computer" line. There's a difference between knowing a language and using it right, and that's true about every language, even natural ones :) Python does have a lot of functional elements that are not as trivial to use for people coming from a procedural background, so there's always room for growth. The one problem with Python compared to languages like C and Java is that it is not statically typed. This makes it much faster to write code, but also makes it *much easier) to make mistakes that can be quite nasty to debug. For instance, the same variable can contain a String reference at some point, and a reference to a list of strings at some other point.
0
861
false
0
1
Python for a hobbyist programmer ( a few questions)
2,474,246
2
2
0
1
1
1
1.2
0
I'm a fan of clean code. I like my languages to be able to express what I'm trying to do, but I like the syntax to mirror that too. For example, I work on a lot of programs in Objective-C for jailbroken iPhones, which patch other code using the method_setImplementation() function of the runtime. Or, in PyObjC, I have to use the syntax UIView.initWithFrame_(), which is also pretty awful and unreadable with the way the method names are structured. In both cases, the language does not support this in syntax. I've found three basic ways that this is done: Insane macros. Take a look at this "CaptainHook", it does what I'm looking for in a usable way, but it isn't quite clean and is a major hack. There's also "Logos", which implements a very nice syntax, but is written in Perl parsing my code with a ton of regular expressions. This scares me. I like the idea of adding a %hook ClassName, but not by using regular expressions to parse C or Objective-C. Finally, there is Cycript. This is an extension to JavaScript which interfaces with the Objective-C runtime and allows you to use Objective-C style code in your JavaScript, and inject that into other processes. This is likely the cleanest as it actually uses a parser for the JavaScript, but I'm not a huge fan of that language in general. Should, and how should, I create an extension to Python and Objective-C to allow me to do this? Is it worth writing a parser for my language to transform the syntax into something nicer, if it is only in a very specialized niche like this? Should I just live with the horrible syntax of the default Objective-C hooking or PyObjC?
0
python,objective-c,pyobjc
2010-03-19T02:01:00.000
0
2,474,554
There are only two kinds of programming languages:, the truism goes, the ones every one complains about and the ones no one uses. People who want to make programs don't choose a language because it's beautiful or clean; they choose it because it is supported, available, and not so awful that you just can't use it. When you see something you think you can improve, it can be very tempting to say I can fix that! and run right in, but in this case the cost is probably higher than is worth it. Programming languages that don't fill any bigger goal than being somewhat cleaner or a little more consistent tend not to catch on, as incremental advances in those areas aren't the things that you really, really need to improve the process of making software. Projects in obscure pet languages tend to die and not catch on, as the cost of contributing (learning someone's pet language that is new to you and that doesn't have broad support and documentation) is too high. If you are interested in language design and tinkering, this could be interesting for you. It's harder than it may seem—the designers of all the major languages have had to deal with a lot of tradeoffs in designing them, often sacrificing beauty and purity for practicality and compatibility. If, on the other hand, you want to write software, deal with the imperfect tools you were dealt.
0
775
true
0
1
Extending Python and Objective-C
2,475,334
2
2
0
2
1
1
0.197375
0
I'm a fan of clean code. I like my languages to be able to express what I'm trying to do, but I like the syntax to mirror that too. For example, I work on a lot of programs in Objective-C for jailbroken iPhones, which patch other code using the method_setImplementation() function of the runtime. Or, in PyObjC, I have to use the syntax UIView.initWithFrame_(), which is also pretty awful and unreadable with the way the method names are structured. In both cases, the language does not support this in syntax. I've found three basic ways that this is done: Insane macros. Take a look at this "CaptainHook", it does what I'm looking for in a usable way, but it isn't quite clean and is a major hack. There's also "Logos", which implements a very nice syntax, but is written in Perl parsing my code with a ton of regular expressions. This scares me. I like the idea of adding a %hook ClassName, but not by using regular expressions to parse C or Objective-C. Finally, there is Cycript. This is an extension to JavaScript which interfaces with the Objective-C runtime and allows you to use Objective-C style code in your JavaScript, and inject that into other processes. This is likely the cleanest as it actually uses a parser for the JavaScript, but I'm not a huge fan of that language in general. Should, and how should, I create an extension to Python and Objective-C to allow me to do this? Is it worth writing a parser for my language to transform the syntax into something nicer, if it is only in a very specialized niche like this? Should I just live with the horrible syntax of the default Objective-C hooking or PyObjC?
0
python,objective-c,pyobjc
2010-03-19T02:01:00.000
0
2,474,554
If you don't have any experience in compiler or interpreter design my answer is an emphatic NO, it is one of the biggest challenges in computer science. If you do have experience my answer shifts to "that is a really dumb idea." Do you envision this becoming a large mature product that other people will want to use? If you do than go ahead, otherwise it will just distract you from writing great applications.
0
775
false
0
1
Extending Python and Objective-C
2,474,626
2
2
0
1
4
0
0.099668
1
Im trying to write some kind of multi protocol bot (jabber/irc) that would read messages from fifo file (one liners mostly) and then send them to irc channel and jabber contacts. So far, I managed to create two factories to connect to jabber and irc, and they seem to be working. However, I've problem with reading the fifo file - I have no idea how to read it in a loop (open file, read line, close file, jump to open file and so on) outside of reactor loop to get the data I need to send, and then get that data to reactor loop for sending in both protocols. I've been looking for information on how to do it in best way, but Im totally lost in the dark. Any suggestion/help would be highly appreciated. Thanks in advance!
0
python,twisted,xmpp,irc,fifo
2010-03-19T09:45:00.000
0
2,476,234
The fifo is the problem. Read from a socket instead. This will fit info the Twisted event-driven model much better. Trying to do things outside the control of the reactor is usually the wrong approach. ---- update based on feedback that the fifo is an external constraint, not avoidable ---- OK, the central issue is that you can not write code in the main (and only) thread of your Twisted app that makes blocking read calls to a fifo. That will cause the whole app to stall if there is nothing to read. So you're either looking at reading the fifo asynchronously, creating a separate thread to read it, or splitting the app in two. The last option is the simplest - modify the Twisted app so that it listens on a socket and write a separate little "forwarder" app that runs in a simple loop, reading the fifo and writing everything it hears to the socket.
0
1,766
false
0
1
Python (Twisted) - reading from fifo and sending read data to multiple protocols
2,476,445
2
2
0
3
4
0
0.291313
1
Im trying to write some kind of multi protocol bot (jabber/irc) that would read messages from fifo file (one liners mostly) and then send them to irc channel and jabber contacts. So far, I managed to create two factories to connect to jabber and irc, and they seem to be working. However, I've problem with reading the fifo file - I have no idea how to read it in a loop (open file, read line, close file, jump to open file and so on) outside of reactor loop to get the data I need to send, and then get that data to reactor loop for sending in both protocols. I've been looking for information on how to do it in best way, but Im totally lost in the dark. Any suggestion/help would be highly appreciated. Thanks in advance!
0
python,twisted,xmpp,irc,fifo
2010-03-19T09:45:00.000
0
2,476,234
You can read/write on a file descriptor without blocking the reactor as you do with sockets, by the way doesn't sockets use file descriptors? In your case create a class that implements twisted.internet.interfaces.IReadDescriptor and add to reactor using twisted.internet.interfaces.IReactorFDSet.addReader. For an example of IReadDescriptor implementation look at twisted.internet.tcp.Connection. I cannot be more specific because i never did by my self, but i hope this could be a start point.
0
1,766
false
0
1
Python (Twisted) - reading from fifo and sending read data to multiple protocols
2,478,970
3
7
0
0
11
0
0
0
How can I write 'one bit' into a file stream or file structure each time? Is it possible to write to a queue and then flush it? Is it possible with C# or Java? This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).
0
java,c#,python,c++,bit-manipulation
2010-03-19T11:18:00.000
0
2,476,748
I would recommend allocating a rather large buffer (4096 bytes at least) and flush that off to disk whenever it fills up. Using a one-byte buffer usually causes bad performance.
0
5,699
false
0
1
Writing 'bits' to C++ file streams
2,477,111
3
7
0
0
11
0
0
0
How can I write 'one bit' into a file stream or file structure each time? Is it possible to write to a queue and then flush it? Is it possible with C# or Java? This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).
0
java,c#,python,c++,bit-manipulation
2010-03-19T11:18:00.000
0
2,476,748
I did this once for huffman decoding and ended up writing the bits as chars and thus handling everything internally as a plain old C string. That way you don't have to worry about the trailing byte and it's human readable as well. Also checking bits is is easier since its just a matter of addressing the char array (binbuf[123] == '1') instead of having to fiddle with bits. Not the most optimized solution, but it solved my problem neatly. The obvious drawback is that this representation uses more memory.
0
5,699
false
0
1
Writing 'bits' to C++ file streams
2,477,157
3
7
0
0
11
0
0
0
How can I write 'one bit' into a file stream or file structure each time? Is it possible to write to a queue and then flush it? Is it possible with C# or Java? This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).
0
java,c#,python,c++,bit-manipulation
2010-03-19T11:18:00.000
0
2,476,748
The issue here is that many platforms do not have direct bit access. They group bits into a minimal package, often times the byte or word. Also, the protocol for stream devices does not facilitate transmission of individual bits. The common method to deal with individual bits is to pack them into the smallest portable and (addressable) accessible unit. The unused bits are usually set to zero. This can be accomplished with binary arithmetic operations (OR, AND, EXCLUSIVE-OR, NOT, etc.). With modern processors, bit twiddling slows down the machine and the performance. Memory is cheap and with large addressing spaces, justification for bit packing has become more difficult. Generally, bit packing is reserved for hardware oriented operations (and also transmission protocols). For example, if a processor's word capacity is 16 bits, the processor can probably handle 16 words faster than 16 bit manipulations in one word. Also, keep in mind that writing to and from memory is often faster than I/O from streams. Efficient systems buffer data in memory before transmitting the data. You may want to consider this technique in your designs. Reducing I/O operations will improve the performance of your program.
0
5,699
false
0
1
Writing 'bits' to C++ file streams
2,478,818
1
2
1
8
25
0
1.2
0
I've got a pile of C code that I'd like to unit test using Python's unittest library (in Windows), but I'm trying to work out the best way of interfacing the C code so that Python can execute it (and get the results back). Does anybody have any experience in the easiest way to do it? Some ideas include: Wrapping the code as a Python C extension using the Python API Wrap the C code using SWIG Add a DLL wrapper to the C code and load it into Python using ctypes Add a small XML-RPC server to the c-code and call it using xmlrpclib (yes, I know this seems a bit far-out!) Is there a canonical way of doing this? I'm going to be doing this quite a lot, with different C modules, so I'd like to find a way which is least effort.
0
python,c,unit-testing,swig
2010-03-20T07:12:00.000
0
2,482,270
I think that the exact solution depends on your code. Not all libraries are easily suitable for wrapping as a DLL. If your is, then ctypes is certainly the easiest way - just make a DLL out of your library and then test it with ctypes. An added bonus is that you now have your library conveniently wrapped as a standalone DLL which helps to decouple your application. Sometimes, however, a more thorough interaction will be required between your C code and the testing Python code. Then, it's probably best to hook it as an extension, for which SWIG is a pretty good tool that will automate away most things you'll find boring about the process.
0
12,704
true
0
1
Easiest way of unit testing C code with Python
2,489,948
1
2
0
0
1
0
0
0
How can I set default language for trac. There's nothing about i18n in trac.ini
0
python,internationalization,trac
2010-03-20T08:19:00.000
0
2,482,399
The stable release of trac, 0.11.X does not have support for localization. It is added in the upcoming 0.12 which is currently under development. Do you have 0.12 or did you download "latest stable" which is 0.11? In that case you will have to upgrade to get localization support. The trac site itself appears to be running 0.12 as it is localized.
0
2,028
false
0
1
Trac default language
2,482,486
4
7
0
0
1
1
0
0
Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought. To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module. In other words, which language "just works" with the most modules?
0
python,ruby,perl,module,dynamic-languages
2010-03-20T17:06:00.000
0
2,483,924
Most scripting languages can handle this kind of thing (by running external programs written in other languages,) but it seems as if your best bet might be shell scripting of some kind (Windows users call this "batch scripting," but the DOS syntax is horrible and not recommended.) UNIX programmers have been freely mixing languages in this way for a long time. On Windows, you can install Cygwin to get a fully functional BASH shell. The shell was originally intended as a user interface, used to launch other programs or combine them in interesting ways. However, many shells (notably the Bourne shell or its modern descendant, BASH) are also fully-fledged programming languages. Each of your "modules" can be created as separate, standalone programs which will be run by the shell script.
0
673
false
0
1
Which dynamic language can easily use libraries from other languages?
2,484,750
4
7
0
3
1
1
0.085505
0
Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought. To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module. In other words, which language "just works" with the most modules?
0
python,ruby,perl,module,dynamic-languages
2010-03-20T17:06:00.000
0
2,483,924
If you want to plug in a Perl module, the language which is best suited for this is Perl. Perl is able to represent the semantics and capabilities of code written in Perl correctly. This really shouldn't be a shock. If you have a self-contained program you want to call from another program in its own process, not constantly interacting, any of these languages can do that with programs written in whatever language. At that point, you aren't really using other languages inside a program but just calling other problems. There are several projects to combine various pairs and projects (like Parrot) that seek to provide a platform for a large range of languages for compatibility and projects (like .NET) that almost accidentally provide compatibility among previously-incompatible languages. However, I do not think most of these are as robust, mature, and suited for combining normal code as you would hope.
0
673
false
0
1
Which dynamic language can easily use libraries from other languages?
2,483,959
4
7
0
0
1
1
0
0
Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought. To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module. In other words, which language "just works" with the most modules?
0
python,ruby,perl,module,dynamic-languages
2010-03-20T17:06:00.000
0
2,483,924
The Dynamic Language Runtime was specifically designed to allow one dynamic language to use objects and functions defined in another dynamic language. Currently Python and Ruby have DLR implementations, but I haven't heard anything about Perl. To use the DLR you need either .NET or Mono.
0
673
false
0
1
Which dynamic language can easily use libraries from other languages?
2,483,997
4
7
0
0
1
1
0
0
Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought. To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module. In other words, which language "just works" with the most modules?
0
python,ruby,perl,module,dynamic-languages
2010-03-20T17:06:00.000
0
2,483,924
all 3 languages have very good, clear facilities for just calling any executable in a subprocess (including executables like python somethingelse.py or ruby somethingelse.rb). use what you know best.
0
673
false
0
1
Which dynamic language can easily use libraries from other languages?
2,483,932
7
10
0
1
10
1
0.019997
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
The JITer, and the fact that it can produce tighter code due to it supporting static typing. The JITer can be worked around by using one of the non-CPython implementations, or dropping to i386 and using psyco, but the static typing can't be worked around as trivially (nor do I believe that it should be).
0
7,557
false
0
1
what are the advantages of C# over Python
2,484,600
7
10
0
13
10
1
1
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
Visual Studio - the best IDE out there. Of the statically typed languages in circulation, C# is very productive.
0
7,557
false
0
1
what are the advantages of C# over Python
2,484,624
7
10
0
0
10
1
0
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
I've found it helpful to work with different languages, since they each have their strengths. Python is extremely powerful, but relies heavily on good coding conventions and practices to keep code maintainable. In particular, it does not enforce type safety or insulation, which means it is easy to abuse. C# is a modern object oriented language, with strong typing and other features to help enforce insulation and encapsulation. It's not as wildly flexible, but I've also found that larger C# programs are much easier to maintain (especially when you inherit them from other developers.)
0
7,557
false
0
1
what are the advantages of C# over Python
2,484,609
7
10
0
9
10
1
1.2
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
There are lots of differences, advantages as well as disadvantages. I guess the main advantages would be along the lines of Excellent Windows integration, including access to all standard GUI functions and other libraries. JIT compilation, resulting in better performance than Python, in some or most circumstances. As has been pointed out, this is now also possible in Python. On Windows, the IDE support is arguably better for C#. Visual Studio is a well established and advanced development environment and the "Express" editions are free for personal use. In a non-Windows environment, it's probably a draw between different editors. The rest is basically up to personal preference (statically typed versus dynamically, C-like syntax or not, etc.).
0
7,557
true
0
1
what are the advantages of C# over Python
2,484,595
7
10
0
3
10
1
0.059928
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
C# is supported by Microsoft ;) (expecting comments) C# is typesafe which comes with its advantages. Nothing is better when you are developing windows applications. Its syntax is also very well designed. Code looks pretty good. Its worth learning because lots of code is written and is being written in it. It feels so good when you code in C# in Visual Studio. I am still searching for such a nice IDE for Python. With C# you can explore lots of interesting things .NET,WPF,WCF,XNA,ASP.NET,Jon Skeet's Blog... etc.
0
7,557
false
0
1
what are the advantages of C# over Python
2,485,085
7
10
0
0
10
1
0
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
Well, the ease of coding is debatable. I find C# easier to code when you factor in the help you get from teh IDEs (e.g. the free Visual Web Developer). So, portability is less of an issue if you factor in Mono. Performance can be better in some scenarios. I find the online documentation to be generally better in .NET. Have you considered IronPython? If you guys are willing to use one of the .Net distros that have the DLR in them (4.0's your best bet there, but some of the DLR betas are alright), then you can write C# code and Python code and have them work together w/o any difficulties outside naming conventions being a bit different.
0
7,557
false
0
1
what are the advantages of C# over Python
2,484,612
7
10
0
0
10
1
0
0
I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python? The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is all written in C#. I'd love to do this, but I don't really have time to do multiple languages, and I was just after a few more reasons to justify taking C# over Python to myself. I'm doing this all self-taught as a hobby, btw
0
c#,python
2010-03-20T20:12:00.000
0
2,484,578
C# can directly access pointers via "unmanaged code", which can give it a performance advantage in some situations.
0
7,557
false
0
1
what are the advantages of C# over Python
2,484,650
3
8
0
1
2
1
1.2
0
i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any programming language implemented in pure python which i can see as a reference ( or use directly ? ) -- i need simple language ( simple statements and ifs can do ) edit: sorry if i did not make myself clear but what i want is "a language to customize the running of program" , even though pypi seems a great option, what i am looking for is more simple which i can study and extend myself if need arise. my google searches pointing towards xml based langagues. ( BMEL , XForms etc ).
0
python,programming-languages,interpreter
2010-03-21T07:46:00.000
0
2,486,348
Numerous template languages such as Cheetah, Django templates, Genshi, Mako, Mighty might serve as an example.
0
1,368
true
0
1
programming language implemented in pure python
2,487,912
3
8
0
0
2
1
0
0
i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any programming language implemented in pure python which i can see as a reference ( or use directly ? ) -- i need simple language ( simple statements and ifs can do ) edit: sorry if i did not make myself clear but what i want is "a language to customize the running of program" , even though pypi seems a great option, what i am looking for is more simple which i can study and extend myself if need arise. my google searches pointing towards xml based langagues. ( BMEL , XForms etc ).
0
python,programming-languages,interpreter
2010-03-21T07:46:00.000
0
2,486,348
Possibly Common Lisp (or any other Lisp) will be the best choice for that task. Because Lisp make it possible to easily extend host language with powerful macroses and construct DSL (domain specific language).
0
1,368
false
0
1
programming language implemented in pure python
2,486,375
3
8
0
1
2
1
0.024995
0
i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any programming language implemented in pure python which i can see as a reference ( or use directly ? ) -- i need simple language ( simple statements and ifs can do ) edit: sorry if i did not make myself clear but what i want is "a language to customize the running of program" , even though pypi seems a great option, what i am looking for is more simple which i can study and extend myself if need arise. my google searches pointing towards xml based langagues. ( BMEL , XForms etc ).
0
python,programming-languages,interpreter
2010-03-21T07:46:00.000
0
2,486,348
Why not Python itself? With some care you can use eval to run user code. One of the good thing about interpreted scripting languages is that you don't need another extra scripting language!
0
1,368
false
0
1
programming language implemented in pure python
2,486,403
1
3
0
3
0
1
0.197375
0
I wrote a number crunching python code. The calculations involved can take hours. Is it possible somehow to compile it to binary? Thanks
0
python
2010-03-21T10:41:00.000
0
2,486,737
First you can try psyco, that may give you a speed up as much as 10x, but 2x is more typical If you can post the code up somewhere, perhaps someone can point out how to leverage numpy. If your task doesn't map well only numpy then cython is a good choice to convert a intensive function or two into C code just by adding a few cdefs. If you can show us the code (even just the hot spots) we can probably give you better advice. Perhaps you can modify your algorithm
0
2,921
false
0
1
Convert python script to binary executable
2,486,751
3
5
0
0
23
1
0
0
I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3?
0
python,python-3.x
2010-03-21T23:54:00.000
0
2,489,299
More iterators (in things like dict.keys()) will be a big boost for web applications. The core team will put more work into the new version. New books might focus on python 3 (see Dive into Python), but the real work is still done in python 2. Sooner or later, the big libraries (numpy, wx, django) will be ported. Until those big three switch, I can't see many people using python 3. But those aren't impossible projects to port. Once the big libraries are ported, the community will face a real choice. That's when it will start to catch on.
0
5,413
false
0
1
Will Python 3 ever catch on?
2,490,394
3
5
0
32
23
1
1.2
0
I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3?
0
python,python-3.x
2010-03-21T23:54:00.000
0
2,489,299
On the whole, and even in most details, Python3 is better than Python2. The only area where Python 3 is lagging is with regards to 3rd party libraries. What makes Python great is not only its intrinsic characteristics as a language and its rather extensive standard library, but also the existence of a whole "eco-system" of libraries which support so many specific applications of the language. Several such libraries are, at the moment not fully ported to Python 3.x and this sometimes results in keeping people developing under Python 2.x. This situation may seem a bit like a chicken and egg problem: Application developers won't move to 3.x till the libraries "get there", libraries developers would rather only maintain one branch and are waiting in an attempt to time the porting to Py3k in a way that they can put the their Py2.x branches in maintenance shortly thereafter. This situation is somewhat of a testimony the satisfaction people have of Python 2.x (or phrased more negatively, to the lack of truly compelling incentives for a move to 3.x; while Py3k is better and poised for better things yet, as-is, it doesn't have any features that would prompt a move to 3.x "en masse".) This said, I believe the momentum is effectively in favor of Python 3. To back this up, I was about to mention the likelihood that Unladen Swallow be only ported to Py3k-only, providing some strong incentive for the move. But Alex Martelli has started answering this question, and is using this example. Obviously Alex speaks first-hand of these roadmap questions, please get it from the Master! A word of caution regarding Py3k versions: Be sure to use the most recent version (currently 3.1.2, soon 3.2.x will replace it as the most recent stable version). Beware that some folks (like me) occasionally use the expression "3.0" to reference the generic name for all Py3k (or even for the current version thereof). The short lived 3.0 version per-se is now "defunct" and of no interest but maybe forensic specialists ;-)
0
5,413
true
0
1
Will Python 3 ever catch on?
2,489,398
3
5
0
6
23
1
1
0
I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3?
0
python,python-3.x
2010-03-21T23:54:00.000
0
2,489,299
The main thing holding Python 3.x back right now is the lack of third-party libraries. I'll be converting my code as soon as SciPy gets ported.
0
5,413
false
0
1
Will Python 3 ever catch on?
2,489,395
2
24
0
1
103
1
0.008333
0
How could I check if a number is a perfect square? Speed is of no concern, for now, just working.
0
python,math,perfect-square
2010-03-22T00:48:00.000
0
2,489,435
You could binary-search for the rounded square root. Square the result to see if it matches the original value. You're probably better off with FogleBirds answer - though beware, as floating point arithmetic is approximate, which can throw this approach off. You could in principle get a false positive from a large integer which is one more than a perfect square, for instance, due to lost precision.
0
193,572
false
0
1
Check if a number is a perfect square
2,489,474
2
24
0
-1
103
1
-0.008333
0
How could I check if a number is a perfect square? Speed is of no concern, for now, just working.
0
python,math,perfect-square
2010-03-22T00:48:00.000
0
2,489,435
Decide how long the number will be. take a delta 0.000000000000.......000001 see if the (sqrt(x))^2 - x is greater / equal /smaller than delta and decide based on the delta error.
0
193,572
false
0
1
Check if a number is a perfect square
2,489,814
1
2
0
0
0
0
0
0
Just wondering whats the best way to test Python CGI while developing a site? (I'm used to PHP for web dev so bear with me :P)
0
python,cgi
2010-03-22T05:27:00.000
0
2,490,150
There are a number of Python web frameworks which make this easier for you. Django, for example, has a built-in web server designed for testing out your application. However, if you're already using CGI, the easiest way to test it would be to run Apache. Configuring CGI for Apache is straightforward and there is a lot of good documentation.
0
893
false
0
1
Best/Fastest Way to Test Python CGI locally?
2,490,241
1
1
0
0
1
0
1.2
0
I need to create daemon that will monitor certain directory and will process every file that's written to that particular path. My choice is either java or python. Did you guys have any experience using both technology? what is the best one? EDIT 1: files that will be processed is simple text file (one line with tab separated fields). I just need to move it to buffer and send to further to my php file. EDIT 2: It's for freebsd server
0
java,python,file-io
2010-03-22T06:07:00.000
1
2,490,291
Performance-wise, for an I/O - syscall bound task such as you're mentioning, it's going to be a wash, most likely, depending a bit on the platform. Java tends to have better CPU usage (partly because a JVM can effectively use multiple cores on a multicore CPU on different threads, with CPython having problems with that; partly because of strong JIT abilities), but typically pays for them with higher RAM footprints (no big deal if you have 64GB of RAM laying around and not much else to do on the machine, say, but often an issue in other circumstances). If you specify the platform (Linux vs Windows vs ...), we might be able to offer more help. Edit: with processing required as light as the OP's mentioned in the Q's edit, there's really nothing either way in the CPU-load part of the task. Unfortunately I don't know what freebsd offers for "directory watching" (like Linux's inotify, etc).
0
1,498
true
1
1
Performance Wise, Python VS JAVA For File Based Processing
2,490,299
1
4
0
5
4
1
0.244919
0
Hey - I'm new to python , and I'm having a hard time grasping the concept of Unit testing in python. I'm coming from Java - so unit testing makes sense because - well , there you actually have a unit - A Class. But a Python class is not necessarily the same as a Java class , and the way I use Python - as a scripting language - is more functional then OOP - So what do you "unit test" in Python ? A flow? Thanks!
0
python,unit-testing
2010-03-22T08:11:00.000
0
2,490,715
If you make functional programming then the unit is the function and I would recommend to unit test your functions
0
941
false
0
1
Unit testing in python?
2,490,736
1
6
1
0
11
1
0
0
Hello fellow software developers. I want to distribute a C program which is scriptable by embedding the Python interpreter. The C program uses Py_Initialize, PyImport_Import and so on to accomplish Python embedding. I'm looking for a solution where I distribute only the following components: my program executable and its libraries the Python library (dll/so) a ZIP-file containing all necessary Python modules and libraries. How can I accomplish this? Is there a step-by-step recipe for that? The solution should be suitable for both Windows and Linux. Thanks in advance.
0
python,c,dll,distribution
2010-03-22T17:43:00.000
0
2,494,468
There's a program called py2exe. I don't know if it's only available for Windows. Also, the latest version that I used does not wrap everything up into one .exe file. It creates a bunch of stuff that has to be distributed - a zip file, etc..
0
5,060
false
0
1
How to create an application which embeds and runs Python code without local Python installation?
2,540,638
2
5
0
7
4
0
1
0
A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environment), but using Google there seems to be a preliminary ProLog implementation for both. Any suggestions on modern (open source) web languages (like Python or Ruby) in combination with AI?
0
python,ruby-on-rails,artificial-intelligence,prolog
2010-03-22T20:09:00.000
0
2,495,350
The selection of language is completely irrelevant, all other things being equal. If you're trying to do X and there's a library for it in language Y and meshes well with your Web-based framework, then use it. Without knowing more about what specific areas of AI you're interested in, the question is far too vague to be answered with any more specificity.
0
3,942
false
1
1
Python or Ruby for webbased Artificial Intelligence?
2,497,026
2
5
0
0
4
0
0
0
A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environment), but using Google there seems to be a preliminary ProLog implementation for both. Any suggestions on modern (open source) web languages (like Python or Ruby) in combination with AI?
0
python,ruby-on-rails,artificial-intelligence,prolog
2010-03-22T20:09:00.000
0
2,495,350
You could also use Scala (which is a bit functional and runs on the JVW) and the existing Lift framework for web-stuff.
0
3,942
false
1
1
Python or Ruby for webbased Artificial Intelligence?
2,498,323
2
6
0
4
4
1
1.2
0
I need to programatically encrypt a directory of files, like in a .zip or whatever. Preferably password protected obviously. How can I accomplish this, and WHAT IS the BEST encryption way to do it, if applicable? Programming language doesn't matter. I am dictioned in all syntax.
0
java,.net,c++,python,encryption
2010-03-23T06:36:00.000
0
2,498,009
How can I accomplish this, and WHAT IS the BEST encryption way to do it, if applicable? tar and gzip the directory. Generate a random bit stream of equal size to the file Run bitwise XOR on the streams Only truly secure method is a truly random one time pad.
0
4,494
true
0
1
Best way to encrypt a directory of files?
2,498,054
2
6
0
3
4
1
0.099668
0
I need to programatically encrypt a directory of files, like in a .zip or whatever. Preferably password protected obviously. How can I accomplish this, and WHAT IS the BEST encryption way to do it, if applicable? Programming language doesn't matter. I am dictioned in all syntax.
0
java,.net,c++,python,encryption
2010-03-23T06:36:00.000
0
2,498,009
I still say 7-zip is the answer. It hasn't been "cracked".
0
4,494
false
0
1
Best way to encrypt a directory of files?
2,498,034
1
3
0
2
3
0
0.132549
0
I'm using Hudson CI with a Python project. I've installed the Violations plugin and configured it to run the code against pylint. This works, but I only see a list of violations without linking to the source code. Is it possible to setup Violations and pylint to load and highlight the violating source files (something similar to the Cobertura Coverage Reports)? Better yet, can Violations integrate with pep8.py?
0
python,hudson
2010-03-23T17:56:00.000
0
2,502,345
Well, after some more debugging, I realized that the pylint output file referenced the source code files relative to where pylint was being run, which wasn't the same path that Hudson needed. Basically, Violations needed the paths relative to the Hudson workspace.
0
600
false
0
1
Is it possible to see the source code of the violating files in Hudson with Violations and Pylint?
2,502,582
3
10
0
4
11
1
0.07983
0
I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc. Over time I got better predicting where these could pop up and adding explicit type checking, but because I'm only human I miss one occasionally and then some end-user finds it. So I'm interested in your strategy to avoid these. Do you use type-checking decorators? Maybe special object wrappers? Please share...
0
python
2010-03-23T20:40:00.000
0
2,503,444
If you write good unit tests for all of your code, you should find the errors very quickly when testing code.
0
2,459
false
0
1
What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)?
2,503,474
3
10
0
8
11
1
1.2
0
I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc. Over time I got better predicting where these could pop up and adding explicit type checking, but because I'm only human I miss one occasionally and then some end-user finds it. So I'm interested in your strategy to avoid these. Do you use type-checking decorators? Maybe special object wrappers? Please share...
0
python
2010-03-23T20:40:00.000
0
2,503,444
forgetting to check a type This doesn't make much sense. You so rarely need to "check" a type. You simply run unit tests and if you've provided the wrong type object, things fail. You never need to "check" much, in my experience. trying to call an attribute and getting the NoneType (or any other) has no attribute x error. Unexpected None is a plain-old bug. 80% of the time, I omitted the return. Unit tests always reveal these. Of those that remain, 80% of the time, they're plain old bugs due to an "early exit" which returns None because someone wrote an incomplete return statement. These if foo: return structures are easy to detect with unit tests. In some cases, they should have been if foo: return somethingMeaningful, and in still other cases, they should have been if foo: raise Exception("Foo"). The rest are dumb mistakes misreading the API's. Generally, mutator functions don't return anything. Sometimes I forget. Unit tests find these quickly, since basically, nothing works right. That covers the "unexpected None" cases pretty solidly. Easy to unit test for. Most of the mistakes involve fairly trivial-to-write tests for some pretty obvious species of mistakes: wrong return; failure to raise an exception. Other "has no attribute X" errors are really wild mistakes where a totally wrong type was used. That's either really wrong assignment statements or really wrong function (or method) calls. They always fail elaborately during unit testing, requiring very little effort to fix. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc. Um... Harmless? If it's a bug, I pray that it brings down my entire app as quickly as possible so I can find it. A bug that doesn't crash my app is the most horrible situation imaginable. "Harmless" isn't a word I'd use for a bug that fails to crash my app.
0
2,459
true
0
1
What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)?
2,503,704
3
10
0
0
11
1
0
0
I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc. Over time I got better predicting where these could pop up and adding explicit type checking, but because I'm only human I miss one occasionally and then some end-user finds it. So I'm interested in your strategy to avoid these. Do you use type-checking decorators? Maybe special object wrappers? Please share...
0
python
2010-03-23T20:40:00.000
0
2,503,444
I haven’t done a lot of Python programming, but I’ve done no programming at all in staticly typed languages, so I don’t tend to think about things in terms of variable types. That might explain why I haven’t come across this problem much. (Although the small amount of Python programming I’ve done might explain that too.) I do enjoy Python 3’s revised handling of strings (i.e. all strings are unicode, everything else is just a stream of bytes), because in Python 2 you might not notice TypeErrors until dealing with unusual real world string values.
0
2,459
false
0
1
What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)?
2,503,535
1
8
0
6
8
1
1
0
Suppose you take the strings 'a' and 'z' and list all the strings that come between them in alphabetical order: ['a','b','c' ... 'x','y','z']. Take the midpoint of this list and you find 'm'. So this is kind of like taking an average of those two strings. You could extend it to strings with more than one character, for example the midpoint between 'aa' and 'zz' would be found in the middle of the list ['aa', 'ab', 'ac' ... 'zx', 'zy', 'zz']. Might there be a Python method somewhere that does this? If not, even knowing the name of the algorithm would help. I began making my own routine that simply goes through both strings and finds midpoint of the first differing letter, which seemed to work great in that 'aa' and 'az' midpoint was 'am', but then it fails on 'cat', 'doggie' midpoint which it thinks is 'c'. I tried Googling for "binary search string midpoint" etc. but without knowing the name of what I am trying to do here I had little luck. I added my own solution as an answer
0
python,algorithm
2010-03-24T19:19:00.000
0
2,510,755
It sounds like what you want, is to treat alphabetical characters as a base-26 value between 0 and 1. When you have strings of different length (an example in base 10), say 305 and 4202, your coming out with a midpoint of 3, since you're looking at the characters one at a time. Instead, treat them as a floating point mantissa: 0.305 and 0.4202. From that, it's easy to come up with a midpoint of .3626 (you can round if you'd like). Do the same with base 26 (a=0...z=25, ba=26, bb=27, etc.) to do the calculations for letters: cat becomes 'a.cat' and doggie becomes 'a.doggie', doing the math gives cat a decimal value of 0.078004096, doggie a value of 0.136390697, with an average of 0.107197397 which in base 26 is roughly "cumcqo"
0
2,674
false
0
1
Average of two strings in alphabetical/lexicographical order
2,510,928
1
4
0
7
11
0
1
0
I was asked to write a code translator that would take a Python program and produce a C program. Do you have any ideas how could I approach this problem or is it even possible?
0
python,c,code-translation
2010-03-26T17:50:00.000
0
2,525,518
There's a fundamental question here: is the intent to basically create a Python compiler that uses C as a back-end, or to convert the program to C and maintain the C afterward? Writing a compiler that produces (really ugly) C as its output probably isn't trivial -- a compiler rarely is, and generating code for Python will be more difficult than for a lot of other languages (dynamic typing, in particular, is hard to compile, at least to very efficient output). OTOH, at least the parser will be a lot easier than for some languages. If by "translating", you mean converting Python to C that's readable and maintainable, that's a whole different question -- it's substantially more difficult, to put it mildly. Realistically, I doubt any machine translation will be worth much -- there are just too large of differences in how you normally approach problems in Python and C for there to be much hope of a decent machine translation.
0
11,985
false
0
1
Writing code translator from Python to C?
2,525,638
3
4
0
1
4
0
0.049958
0
First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet manipulation. Considering how small this game will be and the limited user base, I doubt we will have serious issues, but would like to try our best to limit problems. I am not sure where to start or what methods I should use, or what's worth it. For example, sending data to the server such as login name and password. I was told his information should be encrypted when sending, so in-case someone was viewing it (with whatever means), that they couldn't get into the account. However, if someone is able to capture the encrypted string, wouldn't this string always work since it's decrypted server side? In other words, someone could just capture the packet, reuse it, and still gain access to the account? The main goal I am really looking for is to make sure the players are logging into the game with the client we provide, and to make sure it's 'secure' (broad, I know). I have looked around at different methods such as Public and Private Key encryption, which I am sure any hex editor could eventually find. There are many other methods that seem way over my head at the moment and leave the impression of overkill. I realize nothing is 100% secure. I am just looking for any input or reading material (links) to accomplish the main goal stated above. Would appreciate any help, thanks.
0
python,security,authentication,login
2010-03-26T19:25:00.000
0
2,526,110
As for how to protect the client... The most realistic thing is to say that you don't. When you're writing the server code, never trust any data that the client sends you. Never give the client any information you don't want the player to have. In some games, like chess (or really anything turn-based), that actually works pretty well, because it's very easy for the server to verify that the move passed in by the client is a legal move. In other games, those restrictions aren't so practical, and then I don't know what you'd do, from a code perspective. I'd try to shift the problem to a social one at that point: Are the other players people you'd trust to bring their own dice to your gaming table? If not, can you play with someone else?
0
1,320
false
0
1
Game login authentication and security
2,526,606
3
4
0
1
4
0
0.049958
0
First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet manipulation. Considering how small this game will be and the limited user base, I doubt we will have serious issues, but would like to try our best to limit problems. I am not sure where to start or what methods I should use, or what's worth it. For example, sending data to the server such as login name and password. I was told his information should be encrypted when sending, so in-case someone was viewing it (with whatever means), that they couldn't get into the account. However, if someone is able to capture the encrypted string, wouldn't this string always work since it's decrypted server side? In other words, someone could just capture the packet, reuse it, and still gain access to the account? The main goal I am really looking for is to make sure the players are logging into the game with the client we provide, and to make sure it's 'secure' (broad, I know). I have looked around at different methods such as Public and Private Key encryption, which I am sure any hex editor could eventually find. There are many other methods that seem way over my head at the moment and leave the impression of overkill. I realize nothing is 100% secure. I am just looking for any input or reading material (links) to accomplish the main goal stated above. Would appreciate any help, thanks.
0
python,security,authentication,login
2010-03-26T19:25:00.000
0
2,526,110
The simple answer to how to protect the password going over the wire, replay attacks, and message tampering is: use SSL. Yes, there are other things you can do with challenge-response authentication schemes for the login part of it, but it sounds like you really want the whole channel protected anyway. Use SSL at the socket layer and then you don't have to do anything else complicated with how you send your credentials.
0
1,320
false
0
1
Game login authentication and security
2,526,532
3
4
0
1
4
0
0.049958
0
First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet manipulation. Considering how small this game will be and the limited user base, I doubt we will have serious issues, but would like to try our best to limit problems. I am not sure where to start or what methods I should use, or what's worth it. For example, sending data to the server such as login name and password. I was told his information should be encrypted when sending, so in-case someone was viewing it (with whatever means), that they couldn't get into the account. However, if someone is able to capture the encrypted string, wouldn't this string always work since it's decrypted server side? In other words, someone could just capture the packet, reuse it, and still gain access to the account? The main goal I am really looking for is to make sure the players are logging into the game with the client we provide, and to make sure it's 'secure' (broad, I know). I have looked around at different methods such as Public and Private Key encryption, which I am sure any hex editor could eventually find. There are many other methods that seem way over my head at the moment and leave the impression of overkill. I realize nothing is 100% secure. I am just looking for any input or reading material (links) to accomplish the main goal stated above. Would appreciate any help, thanks.
0
python,security,authentication,login
2010-03-26T19:25:00.000
0
2,526,110
This is a tough problem, because the code runs on the client. The replay problem can be solved by using a challenge by letting the server sending a random token which the client adds to the string to be encrypted. This way, the password string will be different each time, and replaying the encrypted string doesn't work (as the server checks if the encrypted password has the last sent token) The problem is that the encryption key has to be stored on the client, and it's possible to retrieve that key.
0
1,320
false
0
1
Game login authentication and security
2,526,148
1
1
0
0
0
0
0
0
I have a very large directory tree I am wanting pyInotify to watch. Is it better to have pyInotify watch the entire tree or is it better to have a number of watches reporting changes to specific files ? Thanks
0
python,pyinotify
2010-03-26T19:48:00.000
0
2,526,273
If you're going to watch only a few files in a huge tree, it makes sense to watch individual files. On the other hand, if you're going to watch almost all files in the tree, watching the entire tree instead makes sense. To know the point of turn exactly, you must benchmark both to see which one performs better.
0
522
false
0
1
pyInotify performance
2,526,820
2
4
0
-1
4
0
-0.049958
0
I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger apps (ex: customize workflows in Anthill), long-term utility scripts (package up a release for QA), or things like Perforce triggers (don't let people check into a specific branch unless their change description includes a bug number; authenticate against Active Directory instead of Perforce's internal passwords). That's about the scale of our problems, although we sometimes tackle something slightly more sizable. My boss, who is reasonably technical, has asked us to standardize on one or two languages so we can more easily substitute for each other. He's advocating bash scripts and Perl, due to their universality and simplicity. I can see his point--we mostly do "glue", so why not use "glue" languages rather than saddle ourselves with something designed for much larger projects? Since some of the tools we work with are Java-based, we do need to use something that speaks JVM sometimes. (The path of least resistance for these projects is BeanShell and Groovy.) I feel a tremendous itch toward language advocacy, but I'm trying to avoid saying "We should use Python 'cause I like it and Perl is gross." Instead, I'm trying to come up with a good approach to defining our problem set: what problems do we solve with scripts? Would we benefit from a library of common functions by our team, or are most of our projects more isolated? What is it reasonable to expect my co-workers to learn? What languages give us the most ease of development and ease of modification? Can you folks suggest some useful ways to approach this problem, both for my own thinking process and to help me facilitate some brainstorming among my coworkers?
0
python,perl,groovy
2010-03-27T02:10:00.000
0
2,527,867
First, it's important to note that it is very hard to convince someone they're wrong. He's advocating bash scripts and Perl, due to their universality and simplicity Bash scripts are not simple. The bash programming model is really complex and unfriendly. if statements and expressions, in particular are horrifying. Perl may or may not be simple. Bash is universal. Perl, however, is exactly as universal as Python. Python is pre-installed in almost all Linux distributions. So that argument is specious. The "universality" of bash, Perl and python is exactly the same. The "simplicity", however, is not the same. You won't find it easy to to "prove" or "convince" anyone of this once they've already pronounced Perl as simple. The Situation. If the boss is advocating Perl, and Perl is not the answer, you will find it is very hard to convince someone they're wrong, making this effort nearly impossible. If the boss was just throwing out ideas, then this is just difficult. Quick Hack. An easy thing you can do is to attempt head-to-head comparisons of Python and Perl for some randomly-chosen jobs. You can then have a code walkthrough to demonstrate the relative opacity of Perl compared with the relative clarity of Python. Even this is fraught with terrible dangers. Some folks really think code golf is important. Python loses at code golf. Perl wins. There's nothing worse than "Angry Co-worker with Perl Bias" who will kill you with code-golf solutions that -- because they're smaller -- can baffle management into thinking that they're clearer or "better" on some arbitrary scale. Some folks really think explicit is "wordy" and bad. Python often loses because the assumptions are stated as actual parameter values. Some folks can (and do) complain at having to actually write things down. Read Stack Overflow for all of the Python questions where someone wants to make the try: block go away in a puff of assumptions. If you choose random problems, you may -- accidentally -- chose something for which there's an existing piece of Perl or Python that can be downloaded and installed. A language can win just through an accident of the draw. Rather than a more in-depth comparison of language features. Best Bet The best you can do is the following. Identify what folks value. You can call these "non-functional" requirements. These are quality factors. What are the foundational, core principles? Open, Accessible, Transferrable Skills, Simplicity, Cleanliness, Honesty, Integrity, Thriftiness, Reverence, Patience, Hard Work, A Sense of Perspective, Reef the Main in Winds over 20 kn, etc. This is hard. No sympathy here. Identify the technical use cases. These are "functional" requirements. Which bits of glue and integration there are? This is hard, also. Requirements erupt of out of the woodwork when you do this. Also, when you have a Perl bigot on the team, numerous non-functional requirements will pile into this area. Your manager -- who proposed Perl -- may be the Perl bigot, and the use cases may be difficult to collect in the presence of a Perl bigot. Identify how (a) Perl + Bash vs. (b) Python vs. (c) Java fit this core values and the functional requirements. Note that using Python means you do not need to use Bash as much. My preference, BTW, is to pare Bash down to the rock-bottom minimum. This is a big, difficult job. It's hard to short-cut. If you find that Perl is not the answer and the Perl bigot you need to convince is the manager who proposed Perl in the first place, you may find that convincing someone that they're wrong is very hard. Edit. I am aware that I am forbidden from using the string "Perl Bigot" to describe the manager's potential level of bias toward Perl. I, however, insist on using "Perl Bigot" to describe the manager who proposed Perl. The question provides no information on which to change this. The worst case is that (a) the manager is the Perl Bigot and (b) Perl is not the answer.
0
196
false
1
1
Standardizing a Release/Tools group on a specific language
2,529,182
2
4
0
4
4
0
0.197375
0
I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger apps (ex: customize workflows in Anthill), long-term utility scripts (package up a release for QA), or things like Perforce triggers (don't let people check into a specific branch unless their change description includes a bug number; authenticate against Active Directory instead of Perforce's internal passwords). That's about the scale of our problems, although we sometimes tackle something slightly more sizable. My boss, who is reasonably technical, has asked us to standardize on one or two languages so we can more easily substitute for each other. He's advocating bash scripts and Perl, due to their universality and simplicity. I can see his point--we mostly do "glue", so why not use "glue" languages rather than saddle ourselves with something designed for much larger projects? Since some of the tools we work with are Java-based, we do need to use something that speaks JVM sometimes. (The path of least resistance for these projects is BeanShell and Groovy.) I feel a tremendous itch toward language advocacy, but I'm trying to avoid saying "We should use Python 'cause I like it and Perl is gross." Instead, I'm trying to come up with a good approach to defining our problem set: what problems do we solve with scripts? Would we benefit from a library of common functions by our team, or are most of our projects more isolated? What is it reasonable to expect my co-workers to learn? What languages give us the most ease of development and ease of modification? Can you folks suggest some useful ways to approach this problem, both for my own thinking process and to help me facilitate some brainstorming among my coworkers?
0
python,perl,groovy
2010-03-27T02:10:00.000
0
2,527,867
Google standardized on Python for such tasks (and many more) a bit before I joined the company; as far as I know, huge advantages such as Python's great implementations on the JVM and .NET didn't even play a role in the decision -- it was all about readability. At the time (and to some extent, even now) the theory at Google was that every engineer must be able, at need, to tweak every part of the codebase -- including of course build scripts, spiders (which were in Python at the time), and so forth. Demanding of engineers already proficient in C++ and Java to learn many more "scripting" languages (Python, Perl, Bash, Awk, Sed, and so forth) was simply unconsciounable: one had to be selected. Given that constraint, Python was the clear choice (under other constraints, Perl might also have been -- but I can't see the inevitable mix of Bash, Awk and Sed ever competing on such grounds!_) -- and that's how I ended up working there, a bit later;-). Given that the overall potential of Python vs Ruby vs Perl vs PHP vs Bash + Awk + Sed vs ... is roughly equal, picking one is clearly a winner -- and Python has clean readability, strong implementations on JVM and .NET as big vigorishes. Seriously, I can only think of Javascript (inevitable for client-side work, now rich with strong implementations such as V8) as a possible "competitor" (unfortunately, JS inevitably carries on a lot of baggage for backwards compatibility -- unless you can use a use strict;-like constraint to help on that, it must be an important downside).
0
196
false
1
1
Standardizing a Release/Tools group on a specific language
2,527,917
2
3
0
1
8
0
0.066568
0
I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if at all possible. My questions: Is there anyway I can access the session variables from within python? Where should I start to look? Are there any obvious security/performance issues I should be aware of when taking this approach?
0
php,python,session,wsgi
2010-03-28T20:55:00.000
0
2,534,525
Depends on the PHP app, if it's keeping session data in a database (MySQL maybe) you can just connect to the database and get the data, if it's using native PHP sessions you should look to the session.save_path config setting in php.ini, that's the place where the runtime saves files with the session data. Once you have the data you can parse it to get it unserialized, take a look at how serialize() and unserialize() work in PHP.
0
5,062
false
1
1
Accessing php $_SESSION from python (wsgi) - is it possible?
2,534,567
2
3
0
4
8
0
0.26052
0
I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if at all possible. My questions: Is there anyway I can access the session variables from within python? Where should I start to look? Are there any obvious security/performance issues I should be aware of when taking this approach?
0
php,python,session,wsgi
2010-03-28T20:55:00.000
0
2,534,525
yep. session (in default) is a regular file. so all what you need is look over session directory and find file with name of session cookie value. then - you have to implement php-like serialize/unserialize and do whatever you want. nope
0
5,062
false
1
1
Accessing php $_SESSION from python (wsgi) - is it possible?
2,534,558
3
7
0
1
10
0
0.028564
1
How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping. There is a possibility that the remote host might drop ping packets
0
python,network-programming,network-protocols
2010-03-28T23:40:00.000
0
2,535,055
Many firewalls are configured to drop ping packets without responding. In addition, some network adapters will respond to ICMP ping requests without input from the operating system network stack, which means the operating system might be down, but the host still responds to pings (usually you'll notice if you reboot the server, say, it'll start responding to pings some time before the OS actually comes up and other services start up). The only way to be certain that a host is up is to actually try to connect to it via some well-known port (e.g. web server port 80). Why do you need to know if the host is "up", maybe there's a better way to do it.
0
46,690
false
0
1
Check if remote host is up in Python
2,535,076
3
7
0
2
10
0
0.057081
1
How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping. There is a possibility that the remote host might drop ping packets
0
python,network-programming,network-protocols
2010-03-28T23:40:00.000
0
2,535,055
A protocol-level PING is best, i.e., connecting to the server and interacting with it in a way that doesn't do real work. That's because it is the only real way to be sure that the service is up. An ICMP ECHO (a.k.a. ping) would only tell you that the other end's network interface is up, and even then might be blocked; FWIW, I have seen machines where all user processes were bricked but which could still be pinged. In these days of application servers, even getting a network connection might not be enough; what if the hosted app is down or otherwise non-functional? As I said, talking sweet-nothings to the actual service that you are interested in is the best, surest approach.
0
46,690
false
0
1
Check if remote host is up in Python
2,535,139
3
7
0
1
10
0
0.028564
1
How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping. There is a possibility that the remote host might drop ping packets
0
python,network-programming,network-protocols
2010-03-28T23:40:00.000
0
2,535,055
What about trying something that requires a RPC like a 'tasklist' command in conjunction with a ping?
0
46,690
false
0
1
Check if remote host is up in Python
17,115,260
3
9
0
6
11
0
1
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
1
python
2010-03-30T14:07:00.000
0
2,545,820
ok, not entirely to the point, but before you go and start fixing it, make sure everyone understands the situation. it seems to me that they're putting some pressure on you to fix the "problem". well first of all, when you wrote the application, have they specified the performance requirements? did they tell you that they need operation X to take less than Y secs to complete? Did they specify how many concurrent users must be supported without penalty to the performance? If not, then tell them to back off and that it is iteration (phase, stage, whatever) one of the deployment, and the main goal was the functionality and testing. phase two is performance improvements. let them (with your help obviously) come up with some non functional requirements for the performance of your system. by doing all this, a) you'll remove the pressure applied by the finance team (and i know they can be a real pain in the bum) b) both you and your clients will have a clear idea of what you mean by "performance" c) you'll have a base that you can measure your progress and most importantly d) you'll have some agreed time to implement/fix the performance issues. PS. that aside, look at the indexing... :)
0
1,942
false
1
1
Optimization Techniques in Python
2,545,940
3
9
0
4
11
0
1.2
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
1
python
2010-03-30T14:07:00.000
0
2,545,820
A surprising feature of Python is that the pythonic code is quite efficient... So a few general hints: Use built-ins and standard functions whenever possible, they're already quite well optimized. Try to use lazy generators instead one-off temporary lists. Use numpy for vector arithmetic. Use psyco if running on x86 32bit. Write performance critical loops in a lower level language (C, Pyrex, Cython, etc.). When calling the same method of a collection of objects, get a reference to the class function and use it, it will save lookups in the objects dictionaries (this one is a micro-optimization, not sure it's worth) And of course, if scalability is what matters: Use O(n) (or better) algorithms! Otherwise your system cannot be linearly scalable. Write multiprocessor aware code. At some point you'll need to throw more computing power at it, and your software must be ready to use it!
0
1,942
true
1
1
Optimization Techniques in Python
2,546,955
3
9
0
2
11
0
0.044415
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
1
python
2010-03-30T14:07:00.000
0
2,545,820
before you can "fix" something you need to know what is "broken". In software development that means profiling, profiling, profiling. Did I mention profiling. Without profiling you don't know where CPU cycles and wall clock time is going. Like others have said to get any more useful information you need to post the details of your entire stack. Python version, what you are using to store the data in (mysql, postgres, flat files, etc), what web server interface cgi, fcgi, wsgi, passenger, etc. how you are generating the HTML, CSS and assuming Javascript. Then you can get more specific answers to those tiers.
0
1,942
false
1
1
Optimization Techniques in Python
2,546,996
2
2
0
1
2
0
0.099668
0
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
0
python,wsgi
2010-03-30T21:02:00.000
0
2,548,705
Psyco is dead -- its successor is called PyPy. You are unlikely to get any speed increase with an I/O bound application however.
0
186
false
1
1
Does anyone have any feedback on using Psyco in a wsgi application?
9,439,466
2
2
0
2
2
0
1.2
0
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
0
python,wsgi
2010-03-30T21:02:00.000
0
2,548,705
The question you should ask is not did you get measurable results, but does it make your site noticeably faster? Most web applications are not CPU bound, so even if JIT makes them faster, you probably weren't fully utilizing your processor to begin with. It has been a very long time since I played with psyco, but order to get measurable results I would have to simulate thousands of concurrent requests, an unrealistic situation for the average web site. Keep in mind that psyco is not compatible with 64-bit python. The average website doesn't need more than 4gb of ram, but think that ram is generally of more value than CPU cycles.
0
186
true
1
1
Does anyone have any feedback on using Psyco in a wsgi application?
2,553,516
2
6
0
4
8
0
1.2
0
In pylint I use this command --reports=n to disable the reports, but now I don't see the Global evaluation more. Is possible enable only the Global evaluation?
0
python,pylint
2010-03-31T11:53:00.000
0
2,552,605
No you can't, Global Evaluation is part of the reports and with --reports=n you disable all the reports .
0
2,700
true
0
1
Pylint only Global evaluation
2,552,989
2
6
0
0
8
0
0
0
In pylint I use this command --reports=n to disable the reports, but now I don't see the Global evaluation more. Is possible enable only the Global evaluation?
0
python,pylint
2010-03-31T11:53:00.000
0
2,552,605
As systempunttoout said, this is currently not possible. But you can ask for this on the [email protected] mailing list, and submitting a patch is a very good way of getting that feature soon. :-)
0
2,700
false
0
1
Pylint only Global evaluation
3,458,752
1
6
0
0
7
0
0
0
Assuming that I cannot run something like this with Fabric: run("svn update --password 'password' .") how's the proper way to pass to Fabric the password for the remote interactive command line? The problem is that the repo is checked out as svn+ssh and I don't have a http/https/svn option
0
python,svn,fabric
2010-04-01T15:20:00.000
0
2,561,472
You might need to supply the user as well? If not, you may have better luck exporting your repo and making a tar of it (locally) to upload+deploy on the server. If you run the svn commands locally, you'll be able to get prompted for your username and/or password.
0
3,015
false
0
1
fabric and svn password
2,561,630
1
1
0
1
1
0
1.2
0
I want to check whether or not a cookie is set with every page load in Pylons. Where's the best place to put this logic? Thanks!
0
python,pylons
2010-04-01T20:40:00.000
0
2,563,528
You can modify __call__ function in BaseController.
0
109
true
0
1
Pylons check for cookie on every page load
2,563,615
2
2
0
3
10
0
0.291313
0
I'm porting an C++ scientific application to python, and as I'm new to python, some problems come to my mind: 1) I'm defining a class that will contain the coordinates (x,y). These values will be accessed several times, but they only will be read after the class instantiation. Is it better to use an tuple or an numpy array, both in memory and access time wise? 2) In some cases, these coordinates will be used to build a complex number, evaluated on a complex function, and the real part of this function will be used. Assuming that there is no way to separate real and complex parts of this function, and the real part will have to be used on the end, maybe is better to use directly complex numbers to store (x,y)? How bad is the overhead with the transformation from complex to real in python? The code in c++ does a lot of these transformations, and this is a big slowdown in that code. 3) Also some coordinates transformations will have to be performed, and for the coordinates the x and y values will be accessed in separate, the transformation be done, and the result returned. The coordinate transformations are defined in the complex plane, so is still faster to use the components x and y directly than relying on the complex variables? Thank you
0
python,arrays,numpy,tuples,complex-numbers
2010-04-01T21:17:00.000
0
2,563,773
A numpy array with an extra dimension is tighter in memory use, and at least as fast!, as a numpy array of tuples; complex numbers are at least as good or even better, including for your third question. BTW, you may have noticed that -- while questions asked later than yours were getting answers aplenty -- your was laying fallow: part of the reason is no doubt that asking three questions within a question turns responders off. Why not just ask one question per question? It's not as if you get charged for questions or anything, you know...!-)
1
6,196
false
0
1
Better use a tuple or numpy array for storing coordinates
2,564,787
2
2
0
7
10
0
1.2
0
I'm porting an C++ scientific application to python, and as I'm new to python, some problems come to my mind: 1) I'm defining a class that will contain the coordinates (x,y). These values will be accessed several times, but they only will be read after the class instantiation. Is it better to use an tuple or an numpy array, both in memory and access time wise? 2) In some cases, these coordinates will be used to build a complex number, evaluated on a complex function, and the real part of this function will be used. Assuming that there is no way to separate real and complex parts of this function, and the real part will have to be used on the end, maybe is better to use directly complex numbers to store (x,y)? How bad is the overhead with the transformation from complex to real in python? The code in c++ does a lot of these transformations, and this is a big slowdown in that code. 3) Also some coordinates transformations will have to be performed, and for the coordinates the x and y values will be accessed in separate, the transformation be done, and the result returned. The coordinate transformations are defined in the complex plane, so is still faster to use the components x and y directly than relying on the complex variables? Thank you
0
python,arrays,numpy,tuples,complex-numbers
2010-04-01T21:17:00.000
0
2,563,773
In terms of memory consumption, numpy arrays are more compact than Python tuples. A numpy array uses a single contiguous block of memory. All elements of the numpy array must be of a declared type (e.g. 32-bit or 64-bit float.) A Python tuple does not necessarily use a contiguous block of memory, and the elements of the tuple can be arbitrary Python objects, which generally consume more memory than numpy numeric types. So this issue is a hands-down win for numpy, (assuming the elements of the array can be stored as a numpy numeric type). On the issue of speed, I think the choice boils down to the question, "Can you vectorize your code?" That is, can you express your calculations as operations done on entire arrays element-wise. If the code can be vectorized, then numpy will most likely be faster than Python tuples. (The only case I could imagine where it might not be, is if you had many very small tuples. In this case the overhead of forming the numpy arrays and one-time cost of importing numpy might drown-out the benefit of vectorization.) An example of code that could not be vectorized would be if your calculation involved looking at, say, the first complex number in an array z, doing a calculation which produces an integer index idx, then retrieving z[idx], doing a calculation on that number, which produces the next index idx2, then retrieving z[idx2], etc. This type of calculation might not be vectorizable. In this case, you might as well use Python tuples, since you won't be able to leverage numpy's strength. I wouldn't worry about the speed of accessing the real/imaginary parts of a complex number. My guess is the issue of vectorization will most likely determine which method is faster. (Though, by the way, numpy can transform an array of complex numbers to their real parts simply by striding over the complex array, skipping every other float, and viewing the result as floats. Moreover, the syntax is dead simple: If z is a complex numpy array, then z.real is the real parts as a float numpy array. This should be far faster than the pure Python approach of using a list comprehension of attribute lookups: [z.real for z in zlist].) Just out of curiosity, what is your reason for porting the C++ code to Python?
1
6,196
true
0
1
Better use a tuple or numpy array for storing coordinates
2,564,868
1
3
0
0
3
1
1.2
0
I am trying to get python to make noise when certain things happen. Preferably, i would like to play music of some kind, however some kind of distinctive beeping would be sufficient, like an electronic timer going off. I have thus far only been able to make the system speaker chime using pywin32's Beep, however this simply does not have the volume for my application. Any ideas on how I can do this? EDIT: I have been using PyAudiere for this, but unfortunately the package has been abandoned. Now I need an alternative.
0
python,windows,audio,pywin32
2010-04-01T21:22:00.000
0
2,563,788
PyAudiere turns out to be the most convenient. It allows me to simply play an MP3, rather than generate the sound on the fly.
0
1,463
true
0
1
Making Noise with Python
10,114,610
1
1
0
0
0
0
0
0
I'm having difficulty getting PyDev to work. I had an installation of Eclipse for PHP developers (1.2.1.20090918-0703). A month ago, I installed PyDev, and everything worked great. I go to fire it up this morning, and PyDev is gone. There is no option to create a Python project, the Python language editor is missing, etc. Eclipse for PHP does not say that PyDev is installed, so I grab it from the update URL. The version that comes down is 1.5.6. I restart after the installation, and everything works fine again. Sweet. Then, I grab Subclipse 1.0.7. Upon restarting after that installation, PyDev is now gone. It isn't recognizing Python projects or Python files, etc. So I uninstall Subclipse. PyDev is still gone. Uninstalling and reinstalling PyDev again doesn't bring it back. What am I doing wrong? Do I need a different version of Eclipse? UPDATE: I downloaded a fresh copy of Eclipse for Java, did all this over again, and had PyDev working fine. Then, when I downloaded JSEclipse, PyDev again disappeared. This is super frustrating. UPDATE 2: Another fresh copy of Eclipse. This time I downloaded Subclipse first. It worked fine. Then I downloaded JSEclipse, and Subclipse is gone.
0
python,eclipse,pydev
2010-04-02T16:48:00.000
1
2,567,895
there's an easy way to install plugin for eclipse, download the pydev package zip file (not install it via eclipse update), extract it, and put it into your eclipse/dropins/pydev folder. this is a hidden way to install plugin.
0
1,097
false
1
1
Eclipse: PyDev installation difficulties
15,892,577
1
4
0
0
3
0
0
1
I need to upload multiple files from directory to the server via FTP and SFTP. I've solved this task for SFTP with python, paramiko and threading. But I have problem with doing it for FTP. I tried to use ftplib for python, but it seems that it doesn't support threading and I upload all files one by one, which is very slow. I'm wondering is it even possible to do multithreading uploads with FTP protocol without creating separate connections/authorizations (it takes too long)? Solution can be on Python or PHP. Maybe CURL? Would be grateful for any ideas.
0
php,python,ftp,curl,multithreading
2010-04-03T08:07:00.000
0
2,570,621
You can run the script in multiple command prompts / shells (just make sure each file is only handled once by all the different scripts). I am not sure if this quick and dirty trick will improve transfer speed though..
0
4,789
false
0
1
Multithreaded FTP upload. Is it possible?
6,735,686
5
19
0
2
659
0
0.02105
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
0
python
2010-04-04T00:28:00.000
0
2,573,135
Not precisely what you're asking for, but I think it's good advice. Learn another language, doesn't matter too much which. Each language has it's own ideas and conventions that you can learn from. Learn about the differences in the languages and more importantly why they're different. Try a purely functional language like Haskell and see some of the benefits (and challenges) of functions free of side-effects. See how you can apply some of the things you learn from other languages to Python.
0
383,814
false
0
1
Python progression path - From apprentice to guru
2,573,225
5
19
0
24
659
0
1
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
0
python
2010-04-04T00:28:00.000
0
2,573,135
If you're in and using python for science (which it seems you are) part of that will be learning and understanding scientific libraries, for me these would be numpy scipy matplotlib mayavi/mlab chaco Cython knowing how to use the right libraries and vectorize your code is essential for scientific computing. I wanted to add that, handling large numeric datasets in common pythonic ways(object oriented approaches, lists, iterators) can be extremely inefficient. In scientific computing, it can be necessary to structure your code in ways that differ drastically from how most conventional python coders approach data.
0
383,814
false
0
1
Python progression path - From apprentice to guru
4,147,969
5
19
0
41
659
0
1
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
0
python
2010-04-04T00:28:00.000
0
2,573,135
I'll give you the simplest and most effective piece of advice I think anybody could give you: code. You can only be better at using a language (which implies understanding it) by coding. You have to actively enjoy coding, be inspired, ask questions, and find answers by yourself. Got a an hour to spare? Write code that will reverse a string, and find out the most optimum solution. A free evening? Why not try some web-scraping. Read other peoples code. See how they do things. Ask yourself what you would do. When I'm bored at my computer, I open my IDE and code-storm. I jot down ideas that sound interesting, and challenging. An URL shortener? Sure, I can do that. Oh, I learnt how to convert numbers from one base to another as a side effect! This is valid whatever your skill level. You never stop learning. By actively coding in your spare time you will, with little additional effort, come to understand the language, and ultimately, become a guru. You will build up knowledge and reusable code and memorise idioms.
0
383,814
false
0
1
Python progression path - From apprentice to guru
2,576,226
5
19
0
12
659
0
1
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
0
python
2010-04-04T00:28:00.000
0
2,573,135
Thoroughly Understand All Data Types and Structures For every type and structure, write a series of demo programs that exercise every aspect of the type or data structure. If you do this, it might be worthwhile to blog notes on each one... it might be useful to lots of people!
0
383,814
false
0
1
Python progression path - From apprentice to guru
2,573,531
5
19
0
3
659
0
0.031568
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
0
python
2010-04-04T00:28:00.000
0
2,573,135
Teaching to someone else who is starting to learn Python is always a great way to get your ideas clear and sometimes, I usually get a lot of neat questions from students that have me to re-think conceptual things about Python.
0
383,814
false
0
1
Python progression path - From apprentice to guru
4,169,614
1
5
0
4
6
0
0.158649
1
I really like how I can easily share files on a network using the SimpleHTTPServer, but I wish there was an option like "download entire directory". Is there an easy (one liner) way to implement this? Thanks
0
python,simplehttpserver
2010-04-04T05:30:00.000
0
2,573,670
There is no one liner which would do it, also what do you mean by "download whole dir" as tar or zip? Anyway you can follow these steps Derive a class from SimpleHTTPRequestHandler or may be just copy its code Change list_directory method to return a link to "download whole folder" Change copyfile method so that for your links you zip whole dir and return it You may cache zip so that you do not zip folder every time, instead see if any file is modified or not Would be a fun exercise to do :)
0
11,099
false
0
1
Download whole directories in Python SimpleHTTPServer
2,573,685
5
8
0
0
21
0
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
0
python,django,cakephp,web-frameworks,yii
2010-04-05T13:18:00.000
0
2,578,540
If for the PHP part I would choose CodeIgniter - it doesn't get too much into your way. But it doesn't have any code/view/model generators out of the box, you need to type a bit. But languages other than PHP appear to be more sexy.
0
30,143
false
1
1
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
2,844,890
5
8
0
4
21
0
0.099668
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
0
python,django,cakephp,web-frameworks,yii
2010-04-05T13:18:00.000
0
2,578,540
Codeigniter it's fast and very documented also has a large community to and finaly friendly with the programmer.
0
30,143
false
1
1
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
10,847,083
5
8
0
0
21
0
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
0
python,django,cakephp,web-frameworks,yii
2010-04-05T13:18:00.000
0
2,578,540
I am using CodeIgniter 1.7.2 and for complex websites it's very good and powerfull, but it definitely is missing some kind of code generator which will allow for example to build an IT application in one click. I had the impression (from watching a tutorial) that Django has it.
0
30,143
false
1
1
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
7,084,868
5
8
0
31
21
0
1
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
0
python,django,cakephp,web-frameworks,yii
2010-04-05T13:18:00.000
0
2,578,540
This is a very subjective question but personally I'd recommend Django. Python is a very nice language to use and the Django framework is small, easy to use, well documented and also has a pretty active community. This choice was made partly because of my dislike for PHP though, so take the recommendation with a pinch of salt.
0
30,143
false
1
1
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
2,578,635
5
8
0
29
21
0
1.2
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
0
python,django,cakephp,web-frameworks,yii
2010-04-05T13:18:00.000
0
2,578,540
Most of the frameworks out there nowadays are fast enough to serve whatever needs you will have. It really depends on in which environment you feel most comfortable. Though there are nuances here and there, MVC frameworks share a lot of the same principles, so whichever you choose to use is really a matter of which you most enjoy using. So, if you like Python more, there's your answer. Use a Python framework, and Django is the best. If you like PHP more (which I personally don't), you've got some more decisions to make. But any of the PHP frameworks are fine. They really are. Just pick one that looks nice with comprehensive documentation and get to work.
0
30,143
true
1
1
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
2,578,670
2
8
0
4
139
1
0.099668
0
Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just find it is the best tool for working through ssh. I am using Emacs on the command line(Ubuntu), not as a gui, if that makes any difference.
0
python,emacs,ssh
2010-04-06T13:24:00.000
0
2,585,091
indent-region mapped to C-M-\ should do the trick.
0
46,535
false
0
1
Emacs bulk indent for Python
2,585,123
2
8
0
10
139
1
1
0
Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just find it is the best tool for working through ssh. I am using Emacs on the command line(Ubuntu), not as a gui, if that makes any difference.
0
python,emacs,ssh
2010-04-06T13:24:00.000
0
2,585,091
In addition to indent-region, which is mapped to C-M-\ by default, the rectangle edit commands are very useful for Python. Mark a region as normal, then: C-x r t (string-rectangle): will prompt you for characters you'd like to insert into each line; great for inserting a certain number of spaces C-x r k (kill-rectangle): remove a rectangle region; great for removing indentation You can also C-x r y (yank-rectangle), but that's only rarely useful.
0
46,535
false
0
1
Emacs bulk indent for Python
2,585,268
1
1
0
0
1
1
0
0
I've got a Codebase of around 5,3k LOC with around 30 different classe. The code is already very well formatted and I want to improve it further by prefixing methods that are only called in the module that were defined in with a "_", in order to indicate that. Yes it would have been a good idea to do that from the beginning on but now it's too late :D Basically I'm searching for a tool that will tell me if a method is not called outside of the module it was defined in, I'm not looking for stuff that will automatically convert the whole thing to use underscores, just a "simple" thing that tells me where I have to look for prefixing stuff. I'd took a look at the AST module, but there's no easy way to get a list of method definitions and calls, also parsing the plain text yields just too many false positives. I don't insist in spending day(s) on reinventing the wheel when there might be an already existing solution to my problem.
0
python,methods,code-analysis
2010-04-06T17:34:00.000
0
2,586,959
For me, this sounds like special case of coverage. Thus I'd take a look at coverage.py or figleaf and modify it to ignore inter-module calls.
0
194
false
0
1
Python analyze method calls from other classes/modules
2,586,977
2
2
0
0
2
0
0
1
I recently installed twython, a really sleek and awesome twitter API wrapper for Python. I installed it and it works fine from the interpreter, but when I try to import it via Eclipse, it says that twython is an invalid import. How do I "tell" eclipse where twython is so that it will let me import and use it?
0
python,eclipse,pydev,twython
2010-04-07T06:29:00.000
0
2,590,435
Daniel is right. As long as twython went into site-packages then Pydev will find it.
0
941
false
0
1
Eclipse + PyDev: Eclipse telling me that this is an invalid import?
2,594,323
2
2
0
3
2
0
1.2
1
I recently installed twython, a really sleek and awesome twitter API wrapper for Python. I installed it and it works fine from the interpreter, but when I try to import it via Eclipse, it says that twython is an invalid import. How do I "tell" eclipse where twython is so that it will let me import and use it?
0
python,eclipse,pydev,twython
2010-04-07T06:29:00.000
0
2,590,435
I believe I have had this problem before - try going into the menu: Window_Preferences and then select Pydev and Interpreter-Python. Then try to click Auto-config - it should update its search paths to include everything installed in Python. If that doesn't work, you should at least be able to manually add the folder by clicking "New Folder" in the bottom part of that screen and navigating to the location where you have twython installed.
0
941
true
0
1
Eclipse + PyDev: Eclipse telling me that this is an invalid import?
2,590,469
2
3
0
0
6
0
0
0
I'm running Django on Linux using fcgi and Lighttpd. Every now and again (about once a day) the server just dies. I'm using the latest stable release of Django, Python and Lighttpd. The only thing I can think of is that my program is opening a lot of files and executing a lot of external processes, but I'm fairly sure that side of things is watertight. Looking at the error and access logs, there's nothing exceptional happening (i.e. load isn't above normal). On those occasions where I have had exceptions from Python, these have shown up in the error.log, but when this crash happens I get nothing. Is there any way of finding out why the process died? Short of putting logging statements on every single line? Obviously I can't reproduce this so I don't know exactly where to look. Edit It's the django process that's dying. I'm running the server with manage.py runfcgi daemonize=true method=threaded host=127.0.0.1 port=12345
0
python,django,logging,crash,lighttpd
2010-04-08T13:32:00.000
0
2,600,212
Have had the same problems. Not only do they die without warning or reason they leak like crazy too with threads being stuck without a master process. We solved this problem by having a cronjob run every 5 minutes that checks if the port number is up and running and if not restart. By the way, we've now (slowly migrating) given up on fcgi and moved over to uwsgi.
0
916
false
1
1
Why would Django fcgi just die? How can I find out?
2,664,142
2
3
0
0
6
0
0
0
I'm running Django on Linux using fcgi and Lighttpd. Every now and again (about once a day) the server just dies. I'm using the latest stable release of Django, Python and Lighttpd. The only thing I can think of is that my program is opening a lot of files and executing a lot of external processes, but I'm fairly sure that side of things is watertight. Looking at the error and access logs, there's nothing exceptional happening (i.e. load isn't above normal). On those occasions where I have had exceptions from Python, these have shown up in the error.log, but when this crash happens I get nothing. Is there any way of finding out why the process died? Short of putting logging statements on every single line? Obviously I can't reproduce this so I don't know exactly where to look. Edit It's the django process that's dying. I'm running the server with manage.py runfcgi daemonize=true method=threaded host=127.0.0.1 port=12345
0
python,django,logging,crash,lighttpd
2010-04-08T13:32:00.000
0
2,600,212
Is this on your server? (do you own the box?). I've had that problem on shared hosting, and the host was just killing long processes. Do you know if your fcgi is receiving a SIGTERM?
0
916
false
1
1
Why would Django fcgi just die? How can I find out?
2,653,742
1
2
0
5
19
1
0.462117
0
Looking in my /usr/local/lib/python.../dist-package directory, I have .egg directories and .egg files. Why does the installer choose to extra packages to the .egg directory, yet leave other files with .egg extensions?
0
python,egg
2010-04-09T01:45:00.000
1
2,604,600
I can't explain why some eggs are zipped (the files) and some are directories, but I can offer this: if you hate zipped eggs (like I do) put this in the [easy_install] section of your ~/.pydistutils.cfg: zip_ok = false
0
8,363
false
0
1
Why does easy_install extract some python eggs and not others?
2,604,612
1
5
1
0
1
1
0
0
Looking at Python modules and at code in the "lib-dnyload" directory in the Python framework, I noticed whenever code is creating some kind of GUI or graphic it imports a non-Python file with a .so extension. And there are tons .so files in "lib-dnyload". From googling things I found that these files are called shared objects and are written in C or C++. I have a Mac and I use GCC. How do I make shared object files that are accessible via Python? Mainly just how to make shared objects with GCC using Mac OS X.
0
python,macos,gcc,distutils,shared-objects
2010-04-09T19:44:00.000
0
2,610,421
You can write python extensions in many ways, including Cython, SWIG, boost.python ... You can also write a shared library and use the "ctypes" library to access it.
0
4,363
false
0
1
How to create make .so files from code written in C or C++ that are usable from Python
2,611,684
1
9
0
19
273
1
1
0
How can I get the parent class(es) of a Python class?
0
python,oop
2010-04-10T01:32:00.000
0
2,611,892
New-style classes have an mro method you can call which returns a list of parent classes in method resolution order.
0
137,219
false
0
1
How to get the parents of a Python class?
2,612,192
3
3
0
0
1
0
0
0
There is a problem when I used the pylibmc. When I "import pylibmc", then I'll get some error following: ImportError: /usr/local/python2.6/lib/python2.6/site-packages/_pylibmc.so: undefined symbol: memcached_server_list. My enviroment are Python 2.6.5, libmemcached 0.39, memcached 1.4.5 So, how can I solve it? Thanks very much. UPDATE 1: I read the pylibmc doc again, and found this: libmemcached 0.32 or later (last test with 0.38). Then I guest maybe my libmemcached is too newer to avaliable. UPDATE 2: I test the libmemcached 0.38, there is another error in _pylibmc.so: Undefined symbol: memcached_server_count.
0
python,memcached
2010-04-10T06:35:00.000
0
2,612,515
Sounds like linker issues. What system is this on? How is _pylibmc.so linked to libmemcached.so? Can you provide the commands run by your build phase, and perhaps the ldd output?
0
1,860
false
0
1
pylibmc: undefined symbol: memcached_server_list
2,614,485
3
3
0
0
1
0
0
0
There is a problem when I used the pylibmc. When I "import pylibmc", then I'll get some error following: ImportError: /usr/local/python2.6/lib/python2.6/site-packages/_pylibmc.so: undefined symbol: memcached_server_list. My enviroment are Python 2.6.5, libmemcached 0.39, memcached 1.4.5 So, how can I solve it? Thanks very much. UPDATE 1: I read the pylibmc doc again, and found this: libmemcached 0.32 or later (last test with 0.38). Then I guest maybe my libmemcached is too newer to avaliable. UPDATE 2: I test the libmemcached 0.38, there is another error in _pylibmc.so: Undefined symbol: memcached_server_count.
0
python,memcached
2010-04-10T06:35:00.000
0
2,612,515
I was having the same problem and I got it working by using libmemcached 0.34 and then setting the environment variable LD_LIBRARY_PATH to /usr/local/lib (where the libmemcache library was stored).
0
1,860
false
0
1
pylibmc: undefined symbol: memcached_server_list
2,620,050
3
3
0
1
1
0
0.066568
0
There is a problem when I used the pylibmc. When I "import pylibmc", then I'll get some error following: ImportError: /usr/local/python2.6/lib/python2.6/site-packages/_pylibmc.so: undefined symbol: memcached_server_list. My enviroment are Python 2.6.5, libmemcached 0.39, memcached 1.4.5 So, how can I solve it? Thanks very much. UPDATE 1: I read the pylibmc doc again, and found this: libmemcached 0.32 or later (last test with 0.38). Then I guest maybe my libmemcached is too newer to avaliable. UPDATE 2: I test the libmemcached 0.38, there is another error in _pylibmc.so: Undefined symbol: memcached_server_count.
0
python,memcached
2010-04-10T06:35:00.000
0
2,612,515
There appears to be some confusion about the symbol memcached_server_list: libmemcached 0.38 exposes it, but 0.39 does not. The symbol has even been removed from the documentation. pylibmc relies on memcached_server_list for its get_stats() method. I suspect pylibmc should be using memcached_server_cursor instead. So I think we can say that pylibmc 1.0 requires libmemcached <= 0.38.
0
1,860
false
0
1
pylibmc: undefined symbol: memcached_server_list
2,660,258
1
2
0
1
2
1
0.099668
0
e.g., how can I find out that the executable has been installed in "/usr/bin/python" and the library files in "/usr/lib/python2.6"?
0
python,installation,metadata
2010-04-11T06:01:00.000
1
2,616,190
You want the sys module: >>> print sys.executable /usr/bin/python >>> print sys.path ['', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
0
91
false
0
1
Python: what package contains the installation metadata?
2,616,194
1
3
0
0
5
0
0
1
How can I protect my web server, if I run custom users code on server. If any user can submit his python source on my server and run it. Maybe some modules or linux tools for close any network and hardware activity for this script. Thank's all for help!
0
python,system
2010-04-11T21:59:00.000
0
2,618,862
In general, python is not the best language choice if you want to allow the execution of untrusted code. The JVM and .NET have much better support for sandboxing, so Jython and IronPython would be better choices.
0
620
false
0
1
Safest python code running
2,619,276
1
6
0
0
7
0
0
0
We have a project that uses HP Quality Center and one of the regular issues we face is people not updating comments on the defect. So I was thinkingif we could come up with a small script or tool that could be used to periodically throw up a reminder and force the user to update the comments. I came across the Open Test Architecture API and was wondering if there are any good Python or java examples for the same that I could see. Thanks Hari
0
java,python,hp-quality-center
2010-04-13T06:29:00.000
0
2,627,419
You can use a new Test and select type (VPXP_API) which allow script to run. The good thing there is that you'd have the function definition ready to be dragged from within QC instead of having to heavily rely on doc. I've done an implementation in Python running some script from within QC still using its API but via a QC test which is handy to retrieve directly the result (Output) etc.. going through some shell command which can then call any script on any server etc...
0
32,717
false
0
1
Automating HP Quality Center with Python or Java
4,309,246
1
2
0
3
0
0
0.291313
0
is there a difference between using FAPWS3 and MOD_WSGI when dealing with Django? FAPWS3 seems alot faster when serving requests toward Python scripts. I would like to know if I'm missing out anything. :) Any ideas?
0
python,django,mod-wsgi,wsgi,fapws3
2010-04-13T11:26:00.000
0
2,629,070
The underlying web server is not the bottleneck, it is your application and database access. The differences between any underlying web server are going to very minimal or non existent in the context of an actual full application stack. You cannot base decisions on hello world type tests as they are pretty meaningless. Decisions should therefore be based on the quality and stability of the hosting solutions under load, as well as ease of configuration and support, including your own competence to manage a particular setup. If you have no idea how to configure and support a particular web server properly, eg., Apache, then why would you use it.
0
853
false
1
1
Mod_wsgi versus fapws3 - Django
2,633,716
1
1
0
0
2
0
1.2
0
I am working on am Android Scripting Environment (ASE) script in Python to replicate an iPhone app. I need a device UID of some sort. My thoughts where a salted MD5 hash of the MAC address or device phone number, but I can't figure out how to access either of those using the Python APIs within ASE. What can I do to create a UID in Python in ASE?
0
python,android,ase,android-scripting
2010-04-13T20:38:00.000
1
2,633,029
The newer versions of ASE now include a function call to create these identifiers.
0
234
true
1
1
How to get a Device Specific UID using Python in ASE on Android?
5,914,317