Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
481,692
2009-01-26T22:42:00.000
-3
0
1
0
python,recursion,lambda,y-combinator
481,793
15
false
0
0
If you were truly masochistic, you might be able to do it using C extensions, but this exceeds the capability of a lambda (unnamed, anonymous) functon. No. (for most values of no).
1
80
0
A regular function can contain a call to itself in its definition, no problem. I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no name to refer back to. Is there a way to do it? How?
Can a lambda function call itself recursively in Python?
-0.039979
0
0
54,314
482,612
2009-01-27T08:10:00.000
0
0
0
0
c#,c++,python,orm
496,166
3
false
0
0
We have an O/RM that has C++ and C# (actually COM) bindings (in FOST.3) and we're putting together the Python bindings which are new in version 4 together with Linux and Mac support.
2
7
0
Is there a good ORM (object relational manager) solution that can use the same database from C++, C#, Python? It could also be multiple solutions, e.g. one per language, as long as they can can access the same database and use the same schema. Multi platform support is also needed. Clarification: The idea is to have one database and access this from software written in several different programming languages. Ideally this would be provided by one ORM having APIs (or bindings) in all of these languages. One other solution is to have a different ORM in each language, that use compatible schemas. However I believe that schema migration will be very hard in this setting.
ORM (object relational manager) solution with multiple programming language support
0
1
0
1,697
482,612
2009-01-27T08:10:00.000
1
0
0
0
c#,c++,python,orm
482,653
3
false
0
0
With SQLAlchemy, you can use reflection to get the schema, so it should work with any of the supported engines. I've used this to migrate data from an old SQLite to Postgres.
2
7
0
Is there a good ORM (object relational manager) solution that can use the same database from C++, C#, Python? It could also be multiple solutions, e.g. one per language, as long as they can can access the same database and use the same schema. Multi platform support is also needed. Clarification: The idea is to have one database and access this from software written in several different programming languages. Ideally this would be provided by one ORM having APIs (or bindings) in all of these languages. One other solution is to have a different ORM in each language, that use compatible schemas. However I believe that schema migration will be very hard in this setting.
ORM (object relational manager) solution with multiple programming language support
0.066568
1
0
1,697
487,642
2009-01-28T13:39:00.000
1
0
0
0
python,tracking,inventory
487,660
3
true
1
0
One possibility would be to expose a web service interface on your inventory management system that allows the transactions used by the web shopfront to be accessed remotely. With a reasonably secure VPN link or ssh tunnel type arrangement, the web shopfront could get stock levels, place orders or execute searches against the inventory system. Notes: You would still have to add a reasonable security layer to the inventory service in case the web shopfront was compromised. You would have to make sure your inventory management application and server was big enough to handle the load, or could be reasonably easily scaled so it could do so. Your SLA for the inventory application would need to be good enough to support the web shopfront. This probably means some sort of hot failover arrangement.
3
0
0
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
Inventory Control Across Multiple Servers .. Ideas?
1.2
0
0
1,492
487,642
2009-01-28T13:39:00.000
0
0
0
0
python,tracking,inventory
487,674
3
false
1
0
I don't see the problem... You have an application running on one server that manages your database locally. There's no reason a remote server can't also talk to that database. Of course, if you don't have a database and are instead using a homegrown app to act as some sort of faux-database, I recommend that you refactor to use something sort of actual DB sooner rather than later.
3
0
0
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
Inventory Control Across Multiple Servers .. Ideas?
0
0
0
1,492
487,642
2009-01-28T13:39:00.000
0
0
0
0
python,tracking,inventory
706,707
3
false
1
0
I'm not sure if there is any one really good solution for your problem. I think the way you are doing it now works fine, but if you don't agree then I don't know what to tell you.
3
0
0
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
Inventory Control Across Multiple Servers .. Ideas?
0
0
0
1,492
489,720
2009-01-28T22:35:00.000
12
0
1
0
python,decorator
489,735
13
false
0
0
I use them mainly for debugging (wrapper around a function that prints its arguments and result) and verification (e.g. to check if an argument is of correct type or, in the case of web application, if the user has sufficient privileges to call a particular method).
2
358
0
While I like to think of myself as a reasonably competent Python coder, one aspect of the language I've never been able to grok is decorators. I know what they are (superficially), I've read tutorials, examples, questions on Stack Overflow, and I understand the syntax, can write my own, occasionally use @classmethod and @staticmethod, but it never occurs to me to use a decorator to solve a problem in my own Python code. I never encounter a problem where I think, "Hmm...this looks like a job for a decorator!" So, I'm wondering if you guys might offer some examples of where you've used decorators in your own programs, and hopefully I'll have an "A-ha!" moment and get them.
What are some common uses for Python decorators?
1
0
0
80,115
489,720
2009-01-28T22:35:00.000
6
0
1
0
python,decorator
490,745
13
false
0
0
I used them recently, while working on social networking web application. For Community/Groups, I was supposed to give membership authorization to create new discussion and reply to a message you have to be the member of that particular group. So, I wrote a decorator @membership_required and put that where I required in my view.
2
358
0
While I like to think of myself as a reasonably competent Python coder, one aspect of the language I've never been able to grok is decorators. I know what they are (superficially), I've read tutorials, examples, questions on Stack Overflow, and I understand the syntax, can write my own, occasionally use @classmethod and @staticmethod, but it never occurs to me to use a decorator to solve a problem in my own Python code. I never encounter a problem where I think, "Hmm...this looks like a job for a decorator!" So, I'm wondering if you guys might offer some examples of where you've used decorators in your own programs, and hopefully I'll have an "A-ha!" moment and get them.
What are some common uses for Python decorators?
1
0
0
80,115
489,861
2009-01-28T23:20:00.000
8
0
1
1
python,file-locking
490,032
14
false
0
0
Coordinating access to a single file at the OS level is fraught with all kinds of issues that you probably don't want to solve. Your best bet is have a separate process that coordinates read/write access to that file.
2
193
0
I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.
Locking a file in Python
1
0
0
216,892
489,861
2009-01-28T23:20:00.000
14
0
1
1
python,file-locking
490,919
14
false
0
0
Locking is platform and device specific, but generally, you have a few options: Use flock(), or equivalent (if your os supports it). This is advisory locking, unless you check for the lock, it's ignored. Use a lock-copy-move-unlock methodology, where you copy the file, write the new data, then move it (move, not copy - move is an atomic operation in Linux -- check your OS), and you check for the existence of the lock file. Use a directory as a "lock". This is necessary if you're writing to NFS, since NFS doesn't support flock(). There's also the possibility of using shared memory between the processes, but I've never tried that; it's very OS-specific. For all these methods, you'll have to use a spin-lock (retry-after-failure) technique for acquiring and testing the lock. This does leave a small window for mis-synchronization, but its generally small enough to not be a major issue. If you're looking for a solution that is cross platform, then you're better off logging to another system via some other mechanism (the next best thing is the NFS technique above). Note that sqlite is subject to the same constraints over NFS that normal files are, so you can't write to an sqlite database on a network share and get synchronization for free.
2
193
0
I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.
Locking a file in Python
1
0
0
216,892
491,053
2009-01-29T09:50:00.000
0
1
0
0
python,ide
495,362
11
false
0
1
Between komodo and wingide i would go for wing. The license is not that expensive and the fact that it is commercial gives you a bigger probability of more updates and bug fixes. If you, like me, prefer a free solution, then stick with pydev. At least until aptana closes the free door :)
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0
0
0
31,316
491,053
2009-01-29T09:50:00.000
2
1
0
0
python,ide
1,399,741
11
false
0
1
Check to see if the 'P' icon is appearing for your items and in the top of your editor after opening it. If it's not appearing, it may be that there's a problem with the file association, so, go to window > preferences > general > editors > file associations and make sure that the .py files are associated with the Python Editor (note that because of an eclipse bug, if it seems correct, you may have to remove the association and add it again)
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0.036348
0
0
31,316
491,053
2009-01-29T09:50:00.000
1
1
0
0
python,ide
4,665,424
11
false
0
1
It sounds like you have to specify the location of the Python interpreter. Do this under Preferences > Pydev > Interpreter - Python. Create a new interpreter and point it to the Python interpreter executable.
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0.01818
0
0
31,316
491,053
2009-01-29T09:50:00.000
5
1
0
0
python,ide
17,847,161
11
false
0
1
Make sure you use 'Open With' as 'Python Editor' by right clicking on the file - It worked for me
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0.090659
0
0
31,316
491,053
2009-01-29T09:50:00.000
0
1
0
0
python,ide
18,933,901
11
false
0
1
Check your Theme configuration. Python highlighting uses Theme Colors
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0
0
0
31,316
491,053
2009-01-29T09:50:00.000
0
1
0
0
python,ide
19,301,447
11
false
0
1
In case anyone else makes the embarrassing mistake that I did: be sure your source code file actually ends with ".py". Even if its in a Python project, PyDev won't guess without the extension.
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0
0
0
31,316
491,053
2009-01-29T09:50:00.000
0
1
0
0
python,ide
35,208,736
11
false
0
1
When syntax highlighting was not working for me using PyDev, I discovered that there were somehow two 'Python Editor' associations defined for .py files in my installation of Eclipse/PyDev. From the Eclipse Main Menu, go to Window > Preferences > General > Editors > FileAssociations to see the file extension <-> editor mapping. I set a different one as default for .py files at the bottom of the dialog, and got syntax highlighting working again.
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0
0
0
31,316
491,053
2009-01-29T09:50:00.000
0
1
0
0
python,ide
495,297
11
false
0
1
Well, I tried the Wing Professional and I think its really the best Py IDE out there.
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
0
0
0
31,316
491,053
2009-01-29T09:50:00.000
13
1
0
0
python,ide
1,836,524
11
false
0
1
The typical reason that code completion doesn't work under PyDev is that the libraries aren't in the PYTHONPATH. If you go into the Project Properties, and setup PyDev PYTHONPATH preferences to include the places where the code you are trying to complete lives, it will work just fine... Project > Properties > PyDev-PYTHONPAH > click 'Add source folder'
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
1
0
0
31,316
491,053
2009-01-29T09:50:00.000
23
1
0
0
python,ide
492,073
11
true
0
1
To enable code completion, go to Window > Preferences > Pydev > Editor > Code Completion, and check the 'Use Code Completion?' box, as well as the other boxes for what you want to complete on. It seems to take a second to load, the first time it has to complete something. Syntax coloring should just work by default. Right-click on the file in the package explorer, go to 'Open With', and make sure you're opening it with the Python Editor, and not the regular Text Editor. I don't know exactly what you mean by importing external modules. I have my source in a separate directory structure on disk; my PyDev projects contain folders linked to those. Code completion works for that, as well as other modules like 'os'. If you're having troubles, are the modules added to the PyDev's Python search path (not necessarily the same as the regular one)? I took a brief look at Komodo and Wingware a while back, so I can't answer the second part of your question. But ended up going with PyDev. I'm not a big fan of Eclipse, but PyDev works reasonably well for me.
10
18
0
I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it? Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program. I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please. If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion
No code completion and syntax highlighting in Pydev
1.2
0
0
31,316
491,380
2009-01-29T12:22:00.000
1
1
0
0
python,perl,networking,scripting-language
4,275,651
9
false
0
0
Right now I've experimented the approach of creating some simple unit test for network services using various TAP libraries (mainly bash+netcat+curl and perl). The advantage is that you wrote a single script that you can use for both unit and network testing. The display is dove via TAP::Harness::HTML.
3
3
0
I want to have some work done on the Network front, pinging numerous computers on a LAN and retrieving data about the response time. Which would be the most useful and productive to work with: Perl or Python?
Should I use Perl or Python for network monitoring?
0.022219
0
0
7,896
491,380
2009-01-29T12:22:00.000
1
1
0
0
python,perl,networking,scripting-language
492,708
9
false
0
0
Whichever you know better or are more comfortable using. They both can do the job and do it well, so it is your preference.
3
3
0
I want to have some work done on the Network front, pinging numerous computers on a LAN and retrieving data about the response time. Which would be the most useful and productive to work with: Perl or Python?
Should I use Perl or Python for network monitoring?
0.022219
0
0
7,896
491,380
2009-01-29T12:22:00.000
-1
1
0
0
python,perl,networking,scripting-language
491,625
9
false
0
0
I'd say that if you need something quick and dirty that's up and running by this afternoon, then perl is probably the better language. However for developing solid application that's easy to maintain and extend and that you can build on over time, I'd go with python. This is of course assuming you know both languages more or less equally well.
3
3
0
I want to have some work done on the Network front, pinging numerous computers on a LAN and retrieving data about the response time. Which would be the most useful and productive to work with: Perl or Python?
Should I use Perl or Python for network monitoring?
-0.022219
0
0
7,896
492,223
2009-01-29T16:01:00.000
1
0
0
0
python,sqlalchemy
1,227,979
2
false
1
0
I had the same question as the parent when using the ORM, and GHZ's link contained the answer on how it's possible. In sqlalchemy, assuming BlogPost.comments is a mapped relation to the Comments table, you can't do: session.query(BlogPost).order_by(BlogPost.comments.creationDate.desc()) , but you can do: session.query(BlogPost).join(Comments).order_by(Comments.creationDate.desc())
1
3
0
Here is the situation: I have a parent model say BlogPost. It has many Comments. What I want is the list of BlogPosts ordered by the creation date of its' Comments. I.e. the blog post which has the most newest comment should be on top of the list. Is this possible with SQLAlchemy?
How can I order objects according to some attribute of the child in sqlalchemy?
0.099668
1
0
595
492,365
2009-01-29T16:30:00.000
0
0
0
0
wxpython,wxwidgets
826,451
2
false
0
1
Since tooltips normally disappear when the user moves the mouse you could also bind to EVT_MOTION instead of EVT_LEAVE_WINDOW and hide the tooltip when the user moves the mouse.
2
1
0
I have a frame with a textctrl. When the mouse enters the textctrl (EVT_ENTER_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT_LEAVE_WINDOW) I hide it again. Everything works fine, except when inside the PopupWindow there's a ScrolledWindow with shown scrollbars. The EVT_LEAVE_WINDOW gets fired when I move the mouse on top of a scrollbar, so it looks like wxPython thinks the scrollbars are not part of the scrolledwindow.. :/ I tried binding the event to the popup or the scrollwindow itself, but nothing changes.. Is there a way I could get around this? Many thanks! (wxPython 2.8.8.0 on Xubuntu 8.10)
ScrolledWindow and wx.EVT_LEAVE_WINDOW
0
0
0
628
492,365
2009-01-29T16:30:00.000
0
0
0
0
wxpython,wxwidgets
11,717,036
2
true
0
1
Robin Dunn told me: "the same thing would happen with any other widgets that are on the scrolled window, just as the frame will get a EVT_LEAVE_WINDOW when the mouse moves into the scrolled window (assuming some portion of the frame was visible so it could have received an enter window event too)"
2
1
0
I have a frame with a textctrl. When the mouse enters the textctrl (EVT_ENTER_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT_LEAVE_WINDOW) I hide it again. Everything works fine, except when inside the PopupWindow there's a ScrolledWindow with shown scrollbars. The EVT_LEAVE_WINDOW gets fired when I move the mouse on top of a scrollbar, so it looks like wxPython thinks the scrollbars are not part of the scrolledwindow.. :/ I tried binding the event to the popup or the scrollwindow itself, but nothing changes.. Is there a way I could get around this? Many thanks! (wxPython 2.8.8.0 on Xubuntu 8.10)
ScrolledWindow and wx.EVT_LEAVE_WINDOW
1.2
0
0
628
492,519
2009-01-29T17:08:00.000
19
0
1
0
python,multithreading,timeout,python-multithreading
55,816,988
21
false
0
0
I am the author of wrapt_timeout_decorator Most of the solutions presented here work wunderfully under Linux on the first glance - because we have fork() and signals() - but on windows the things look a bit different. And when it comes to subthreads on Linux, You cant use Signals anymore. In order to spawn a process under Windows, it needs to be picklable - and many decorated functions or Class methods are not. So You need to use a better pickler like dill and multiprocess (not pickle and multiprocessing) - thats why You cant use ProcessPoolExecutor (or only with limited functionality). For the timeout itself - You need to define what timeout means - because on Windows it will take considerable (and not determinable) time to spawn the process. This can be tricky on short timeouts. Lets assume, spawning the process takes about 0.5 seconds (easily !!!). If You give a timeout of 0.2 seconds what should happen ? Should the function time out after 0.5 + 0.2 seconds (so let the method run for 0.2 seconds)? Or should the called process time out after 0.2 seconds (in that case, the decorated function will ALWAYS timeout, because in that time it is not even spawned) ? Also nested decorators can be nasty and You cant use Signals in a subthread. If You want to create a truly universal, cross-platform decorator, all this needs to be taken into consideration (and tested). Other issues are passing exceptions back to the caller, as well as logging issues (if used in the decorated function - logging to files in another process is NOT supported) I tried to cover all edge cases, You might look into the package wrapt_timeout_decorator, or at least test Your own solutions inspired by the unittests used there. @Alexis Eggermont - unfortunately I dont have enough points to comment - maybe someone else can notify You - I think I solved Your import issue.
1
427
0
I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script cancels it and does something else?
Timeout on a function call
1
0
0
498,691
492,716
2009-01-29T18:05:00.000
5
0
1
0
python,regex
492,728
8
false
0
0
Unless your regex is extremely simple (i.e. no stars or pluses), there will be infinitely many strings which match it. If your regex only involves concatenation and alternation, then you can expand each alternation into all of its possibilities, e.g. (foo|bar)(baz|quux) can be expanded into the list ['foobaz', 'fooquux', 'barbaz', 'barquux'].
1
45
0
I want to reverse a regular expression. I.e. given a regular expression, I want to produce any string that will match that regex. I know how to do this from a theoretical computer science background using a finite state machine, but I just want to know if someone has already written a library to do this. :) I'm using Python, so I'd like a Python library. To reiterate, I only want one string that will match the regex. Things like "." or ".*" would make an infinite amount of strings match the regex, but I don't care about all options. I'm willing for this library to only work on a certain subset of regex.
Reversing a regular expression in Python
0.124353
0
0
14,829
493,853
2009-01-29T22:54:00.000
2
0
1
0
python,module
495,247
4
false
0
0
You don't need a separate library or module to do this. Python has list comprehensions built into the language, which lets you manipulate lists and perform caculations. You could use the numpy module to do the same thing if you want to do lots of scientific calculations, or if you want to do lots of heavy number crunching.
1
3
0
I have a sequence of x, y and z -coordinates, which I need to manipulate. They are in one list of three tuples, like {(x1, y1, z1), (x2, y2, z2), ...}. I need addition, multiplication and logarithm to manipulate my data. I would like to study a module, which is as powerful as Awk -language.
Which Python module is suitable for data manipulation in a list?
0.099668
0
0
4,046
493,973
2009-01-29T23:42:00.000
0
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
494,118
13
false
0
0
I find dynamic languages like Perl and to a lesser extent Python allow me to write quick and dirty scripts for things I need to do. The run cycle is much shorter in dynamic languages and often less code needs to be written then in a statically typed language which increases my productivity. This unfortunately comes at the cost of maintainability but that is a fault of the way I write programs in dynamic languages not in the languages them selves.
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
0
0
0
1,456
493,973
2009-01-29T23:42:00.000
1
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
495,293
13
false
0
0
The point is that in a dynamic language you can implement the same functionality much quicker than in a statically typed one. Therefore the productivity is typically much higher. Things like templates or polymorphism in principle give you lots of flexibility, but you have to write a large amount of code to make it work. In a dynamic language this flexibility almost comes for free. So I think you look at the difference in the wrong way, productivity really is the main point here (just like garbage collection improves productivity, but otherwise does not really allow you to do new things).
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
0.015383
0
0
1,456
493,973
2009-01-29T23:42:00.000
1
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
494,423
13
false
0
0
One big advantage of dynamic typing when using objects is that you don't need to use class hierarchies anymore when you want several classes to have the same interface - that's more or less what is called duck typing. Bad inheritance is very difficult to fix afterwards - this makes refactoring often harder than it is in a language like python.
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
0.015383
0
0
1,456
493,973
2009-01-29T23:42:00.000
-2
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
494,121
13
false
0
0
Compiled languages tend to be used when efficiency and type safety are the priorities. Otherwise I can't think of any reason why anyone wouldn't be using ruby :)
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
-0.03076
0
0
1,456
493,973
2009-01-29T23:42:00.000
1
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
494,009
13
false
0
0
In dynamic languages you can use values in ways that you know are correct. In a statically typed language you can only use values in ways the compiler knows are correct. You need all of the things you mentioned to regain flexibility that's taken away by the type system (I'm not bashing static type systems, the flexibility is often taken away for good reasons). This is a lot of complexity that you don't have to deal with in a dynamic language if you want to use values in ways the language designer didn't anticipate (for example, putting values of different types in a hash table). So it's not that you can't do these things in a statically typed language (if you have runtime reflection), it's just more complicated.
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
0.015383
0
0
1,456
493,973
2009-01-29T23:42:00.000
0
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
493,993
13
false
0
0
With a dynamic language it's much easier to have a command line interpreter so you can test things on the command line and don't have to worry about a compile step to see if they work.
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
0
0
0
1,456
493,973
2009-01-29T23:42:00.000
15
1
1
0
python,programming-languages,language-design,dynamic-languages,duck-typing
494,055
13
true
0
0
In theory, there's nothing that dynamic languages can do and static languages can't. Smart people put a lot of work into making very good dynamic languages, leading to a perception at the moment that dynamic languages are ahead while static ones need to catch up. In time, this will swing the other way. Already various static languages have: Generics, which make static types less stupid by letting it select the right type when objects are passed around, saving the programmer from having to cast it themselves Type inference, which saves having to waste time on writing the stuff that should be obvious Closures, which among many other things help to separate mechanism from intention, letting you pull together complicated algorithms from mostly existing ingredients. Implicit conversions, which lets you simulate "monkey patching" without the risks it usually involves. Code loading and easy programmatic access to the compiler, so users and third parties can script your program. Use with caution! Syntaxes that are more conducive to the creation of Domain Specific Languages within them. ...and no doubt more to come. The dynamic movement has spawned some interesting developments in static language design, and we all benefit from the competition. I only hope more of these features make it to the mainstream. There's one place where I don't see the dominant dynamic language being replaced, and that's Javascript in the browser. There's just too much of an existing market to replace, so the emphasis seems to be towards making Javascript itself better instead.
7
8
0
My primary language right now is D, and I'm in the process of learning Python because it's required for a course I'm taking. While I understand why dynamic languages would be a breath of fresh air for people programming in static languages without type inference or templates (IMHO templates are to a large extent compile-time duck typing), I'm curious what the benefits are of dynamic languages even when you have those. The bottom line is that, if I'm going to learn Python, I want to learn it in a way that really changes my thinking about programming, rather than just writing D in Python. I have not used dynamic languages since I was a fairly novice programmer and unable to appreciate the flexibility they supposedly offer, and want to learn to take full advantage of them now. What can be done easily/elegantly in a dynamically typed, interpreted language that's awkward or impossible in a static language, even with templates, polymorphism, static type inference, and maybe runtime reflection?
Uses for Dynamic Languages
1.2
0
0
1,456
495,579
2009-01-30T14:03:00.000
0
0
0
1
python,google-app-engine,ide
498,183
10
false
1
0
For my recent GAE project I tried both eclipse with pydev and intellij with its python plugin. I use intellij for my "real" work and so I found it to be the most natural and easy to use, personally. It is not open source, but if you already have a license it is no extra cost. I found the eclipse plugin to be very good as well. You don't get as much intellisense as you would with java, but I was very impressed with what you do get from a dynamically typed language.
5
15
0
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
0
0
0
11,377
495,579
2009-01-30T14:03:00.000
0
0
0
1
python,google-app-engine,ide
497,470
10
false
1
0
I've been using gedit and am pretty happy with it, there is a couple of good plugins that make life easier (e.g. Class Browser). I tried eclipse but its just not the same experience you get with Java.
5
15
0
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
0
0
0
11,377
495,579
2009-01-30T14:03:00.000
6
0
0
1
python,google-app-engine,ide
495,783
10
false
1
0
Netbeans has some very nice tools for Python development
5
15
0
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
1
0
0
11,377
495,579
2009-01-30T14:03:00.000
6
0
0
1
python,google-app-engine,ide
498,484
10
false
1
0
I use pydev on eclipse, and works well for django too!
5
15
0
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
1
0
0
11,377
495,579
2009-01-30T14:03:00.000
2
0
0
1
python,google-app-engine,ide
496,385
10
false
1
0
VIM(there's enough plug-ins to make it IDE -like) Komodo IDE($$) Eclipse w/Pydev Net Beans with Python support WingIDE($$) SPE(Stani's Python Editor)
5
15
0
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
0.039979
0
0
11,377
495,879
2009-01-30T15:22:00.000
17
0
0
0
python,django,django-admin
496,123
7
true
1
0
It really depends on the project I guess. While you can do everything in the admin, when your app gets more complex using the admin gets more complex too. And if you want to make your app really easy to manage you want control over every little detail, which is not really possible with the admin app. I guess you should see it like this: Using django admin: save time writing it, lose time using it. Rolling your own admin: lose time writing it, save time using it.
5
21
0
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
1.2
0
0
11,322
495,879
2009-01-30T15:22:00.000
1
0
0
0
python,django,django-admin
500,093
7
false
1
0
I'd recommend enabling the admin site on just about every type of project. The cost of setting it up is pretty low, and it gives you a reasonably convenient mechanism for inspecting and modifying your site. If your site has mostly a one way flow of information, from webmaster to visitors, then the admin site is probably all you need. If, however, your site has a richer interaction among its users, you will need to compose django views that can enable that interaction while also limiting access to what users can really do.
5
21
0
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
0.028564
0
0
11,322
495,879
2009-01-30T15:22:00.000
1
0
0
0
python,django,django-admin
3,842,185
7
false
1
0
I'd go with the Django admin functionality, over writing your own. You can customize the Django admin by adding your own templates for the admin, your own widgets, etc. I'm working on a project with a very customized Django admin. If we had decided to write it by hand, it would have taken 4 times as long to get done. I just can't see a scenario where you would want to write your own.
5
21
0
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
0.028564
0
0
11,322
495,879
2009-01-30T15:22:00.000
3
0
0
0
python,django,django-admin
498,068
7
false
1
0
I found sadly, that the while the django admin app saves a lot of time at first, it becomes a hinderence later on, as your costumer demands more features that are not easily integrated with the default admin interface. You might endup with two kinds of admin tools: the django admin (for apps that require simple data entry), and your custom rolled admin interface for other applications that require a richer interface.
5
21
0
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
0.085505
0
0
11,322
495,879
2009-01-30T15:22:00.000
17
0
0
0
python,django,django-admin
498,061
7
false
1
0
I would use Django's admin app, for a number of reasons. First, writing an administration app may be quite tricky and take some time if you want to do it right, and django.contrib.admin is for free and works out of the box. Second, it is really well designed and very nice to work with (even for non-technical users). Third, it covers a lot of the common cases and it doesn't seem wise to waste time on rewriting it until you are really sure you cannot do otherwise. Fourth, it isn't really so difficult to customize. For example, adding akismet mark-as-spam and mark-as-ham buttons was really a piece of cake.
5
21
0
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
1
0
0
11,322
496,009
2009-01-30T15:58:00.000
-4
0
1
0
python,magic-methods
496,019
5
false
0
0
According to Mark Pilgrim, it looks like no. len(someObj) is the same as someObj.__len__(); Cheers!
2
14
0
Is there any case where len(someObj) does not call someObj's __len__ function? I recently replaced the former with the latter in a (sucessful) effort to speed up some code. I want to make sure there's not some edge case somewhere where len(someObj) is not the same as someObj.__len__().
Is there any case where len(someObj) does not call someObj's __len__ function?
-1
0
0
1,713
496,009
2009-01-30T15:58:00.000
17
0
1
0
python,magic-methods
497,096
5
true
0
0
If __len__ returns a length over sys.maxsize, len() will raise an exception. This isn't true of calling __len__ directly. (In fact you could return any object from __len__ which won't be caught unless it goes through len().)
2
14
0
Is there any case where len(someObj) does not call someObj's __len__ function? I recently replaced the former with the latter in a (sucessful) effort to speed up some code. I want to make sure there's not some edge case somewhere where len(someObj) is not the same as someObj.__len__().
Is there any case where len(someObj) does not call someObj's __len__ function?
1.2
0
0
1,713
496,582
2009-01-30T18:21:00.000
8
0
1
0
python,variables
496,656
10
true
0
0
First of all: class attributes, or instance attributes? Or both? =) Usually you just add instance attributes in __init__, and class attributes in the class definition, often before method definitions... which should probably cover 90% of use cases. If code adds attributes on the fly, it probably (hopefully :-) has good reasons for doing so... leveraging dynamic features, introspection, etc. Other than that, adding attributes this way is probably less common than you think.
5
11
0
I'm a C++ programmer just starting to learn Python. I'd like to know how you keep track of instance variables in large Python classes. I'm used to having a .h file that gives me a neat list (complete with comments) of all the class' members. But since Python allows you to add new instance variables on the fly, how do you keep track of them all? I'm picturing a scenario where I mistakenly add a new instance variable when I already had one - but it was 1000 lines away from where I was working. Are there standard practices for avoiding this? Edit: It appears I created some confusion with the term "member variable." I really mean instance variable, and I've edited my question accordingly.
What's a good way to keep track of class instance variables in Python?
1.2
0
0
3,466
496,582
2009-01-30T18:21:00.000
10
0
1
0
python,variables
498,284
10
false
0
0
I would say, the standard practice to avoid this is to not write classes where you can be 1000 lines away from anything! Seriously, that's way too much for just about any useful class, especially in a language that is as expressive as Python. Using more of what the Standard Library offers and abstracting away code into separate modules should help keeping your LOC count down. The largest classes in the standard library have well below 100 lines!
5
11
0
I'm a C++ programmer just starting to learn Python. I'd like to know how you keep track of instance variables in large Python classes. I'm used to having a .h file that gives me a neat list (complete with comments) of all the class' members. But since Python allows you to add new instance variables on the fly, how do you keep track of them all? I'm picturing a scenario where I mistakenly add a new instance variable when I already had one - but it was 1000 lines away from where I was working. Are there standard practices for avoiding this? Edit: It appears I created some confusion with the term "member variable." I really mean instance variable, and I've edited my question accordingly.
What's a good way to keep track of class instance variables in Python?
1
0
0
3,466
496,582
2009-01-30T18:21:00.000
2
0
1
0
python,variables
498,421
10
false
0
0
This is a common concern I hear from many programmers who come from a C, C++, or other statically typed language where variables are pre-declared. In fact it was one of the biggest concerns we heard when we were persuading programmers at our organization to abandon C for high-level programs and use Python instead. In theory, yes you can add instance variables to an object at any time. Yes it can happen from typos, etc. In practice, it rarely results in a bug. When it does, the bugs are generally not hard to find. As long as your classes are not bloated (1000 lines is pretty huge!) and you have ample unit tests, you should rarely run in to a real problem. In case you do, it's easy to drop to a Python console at almost any time and inspect things as much as you wish.
5
11
0
I'm a C++ programmer just starting to learn Python. I'd like to know how you keep track of instance variables in large Python classes. I'm used to having a .h file that gives me a neat list (complete with comments) of all the class' members. But since Python allows you to add new instance variables on the fly, how do you keep track of them all? I'm picturing a scenario where I mistakenly add a new instance variable when I already had one - but it was 1000 lines away from where I was working. Are there standard practices for avoiding this? Edit: It appears I created some confusion with the term "member variable." I really mean instance variable, and I've edited my question accordingly.
What's a good way to keep track of class instance variables in Python?
0.039979
0
0
3,466
496,582
2009-01-30T18:21:00.000
4
0
1
0
python,variables
496,820
10
false
0
0
Instance variables should be initialized in the class's __init__() method. (In general) If that's not possible. You can use __dict__ to get a dictionary of all instance variables of an object during runtime. If you really need to track this in documentation add a list of instance variables you are using into the docstring of the class.
5
11
0
I'm a C++ programmer just starting to learn Python. I'd like to know how you keep track of instance variables in large Python classes. I'm used to having a .h file that gives me a neat list (complete with comments) of all the class' members. But since Python allows you to add new instance variables on the fly, how do you keep track of them all? I'm picturing a scenario where I mistakenly add a new instance variable when I already had one - but it was 1000 lines away from where I was working. Are there standard practices for avoiding this? Edit: It appears I created some confusion with the term "member variable." I really mean instance variable, and I've edited my question accordingly.
What's a good way to keep track of class instance variables in Python?
0.07983
0
0
3,466
496,582
2009-01-30T18:21:00.000
0
0
1
0
python,variables
496,641
10
false
0
0
The easiest is to use an IDE. PyDev is a plugin for eclipse. I'm not a full on expert in all ways pythonic, but in general I define my class members right under the class definition in python, so if I add members, they're all relative. My personal opinion is that class members should be declared in one section, for this specific reason. Local scoped variables, otoh, should be defined closest to when they are used (except in C--which I believe still requires variables to be declared at the beginning of a method).
5
11
0
I'm a C++ programmer just starting to learn Python. I'd like to know how you keep track of instance variables in large Python classes. I'm used to having a .h file that gives me a neat list (complete with comments) of all the class' members. But since Python allows you to add new instance variables on the fly, how do you keep track of them all? I'm picturing a scenario where I mistakenly add a new instance variable when I already had one - but it was 1000 lines away from where I was working. Are there standard practices for avoiding this? Edit: It appears I created some confusion with the term "member variable." I really mean instance variable, and I've edited my question accordingly.
What's a good way to keep track of class instance variables in Python?
0
0
0
3,466
496,814
2009-01-30T19:17:00.000
1
0
0
0
python,user-interface,gtk,progress-bar,pygtk
496,995
5
false
0
1
More than likely the issue is that in your progress callback, which is where I presume you're updating the progress bar, you're not making a call to manually update the display i.e. run through the GUI's event loop. This is just speculation though, if you can provide more code, it might be easier to narrow it down further. The reason you need to manually update the display is because your main thread is also performing the upload, which is where it's blocking.
1
9
0
in my python program to upload a file to the internet, im using a GTK progress bar to show the upload progress. But the problems that im facing is that the progress bar does not show any activity until the upload is complete, and then it abruptly indicates upload complete. im using pycurl to make the http requests...my question is - do i need to have a multi-threaded application to upload the file and simultaneously update the gui? or is there some other mistake that im making? Thanks in advance!
Progress bar not updating during operation
0.039979
0
0
6,986
497,426
2009-01-30T21:59:00.000
1
0
1
0
python,list
497,467
32
false
0
0
I can actually think of two ways to do it: slice the list like (this deletes the 1st,3rd and 8th elements) somelist = somelist[1:2]+somelist[3:7]+somelist[8:] do that in place, but one at a time: somelist.pop(2) somelist.pop(0)
1
191
0
Is it possible to delete multiple elements from a list at the same time? If I want to delete elements at index 0 and 2, and try something like del somelist[0], followed by del somelist[2], the second statement will actually delete somelist[3]. I suppose I could always delete the higher numbered elements first but I'm hoping there is a better way.
Deleting multiple elements from a list
0.00625
0
0
286,990
497,952
2009-01-31T01:22:00.000
2
0
1
0
python
498,046
5
false
0
0
all possible errors The other answers pretty much cover how to make your program gracefully fail, but I'd like to mention one thing -- You don't want to gracefully fail all errors. If you hide all your errors, you won't be shown those which signify that the logic of the program is wrong - namely errors you want to see. So while it's important to catch your exceptions, make sure you know exactly which exceptions are actually being caught.
1
15
0
I was just wondering how do you make python fail in a user defined way in all possible errors. For example, I'm writing a program that processes a (large) list of items, and some of the items may not be in the format I defined. If python detects an error, it currently just spits out an ugly error message and stop the whole process. However, I want it to just outputs the error to somewhere together with some context and then move on to the next item. If anyone can help me with this it would be greatly appreciated! Thanks a lot! Jason
How to make python gracefully fail?
0.07983
0
0
17,154
498,630
2009-01-31T10:46:00.000
1
0
0
0
python,django,security
499,505
7
false
1
0
You should not rely the security of the application on the framework. even though Django does come in with a pretty good number of measures against classical security issues, it can not guarantee that your application will be secure, you need much more than a programming Framework to get a security critical application. I'd say yes, Django is a good choice as long as you know its powers and limitations and are aware of the security flaws of every application.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
0.028564
0
0
8,593
498,630
2009-01-31T10:46:00.000
17
0
0
0
python,django,security
498,707
7
false
1
0
Probably the reason behind Java is not in the in the security. I think Java is more used in large development companies and banks usually resort to them for their development needs (which probably are not only related to the web site but creep deeper in the backend). So, I see no security reasons, mostly cultural ones.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
1
0
0
8,593
498,630
2009-01-31T10:46:00.000
30
0
0
0
python,django,security
498,798
7
true
1
0
Actually, the security in Java and Python is the same. Digest-only password handling, cookies that timeout rapidly, careful deletion of sessions, multi-factor authentication. None of this is unique to a Java framework or a Python framework like Django. Django, indeed, has a security backend architecture that allows you to add your own LDAP (or AD) connection, possibly changing the digest technique used. Django has a Profile model where you can keep additional authentication factors. Django offers a few standard decorators for view function authorization checking. Since Python is so flexible, you can trivially write your own decorator functions to layer in different or additional authentication checking. Security is a number of first-class features in Django.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
1.2
0
0
8,593
498,630
2009-01-31T10:46:00.000
8
0
0
0
python,django,security
499,599
7
false
1
0
The reasons for building banking apps in Java are not related to security, at least IMHO. They are related to: Java is the COBOL of the 21st century, so there is a lot of legacy code that would have to be rewritten and that takes time. Basically banking apps are old apps, they were built in java some ten years ago and nobody wants to throw all the old code away (which BTW is almost always a bad decision), some people believe that a static typed language is somewhat "safer" than the dynamic typed language. This is, IMHO, not true (take for instance collections prior to Java 5).
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
1
0
0
8,593
498,630
2009-01-31T10:46:00.000
4
0
0
0
python,django,security
499,670
7
false
1
0
I find your connection between Java and banking wrong ended. Most Banking Software has terrible security. And much banking software is written in Java. Does ths mean Java makes it more difficult to write secure software than other languages? Probably it's not Java's fault that there is so little quality security (and safety) wise in Banking software. Actually, like the other posters mention, the choice of your Language usually has very little consequences for your security - unless you select one of the few languages where only hotshot coders can write secure code in (C and PHP come to mind). Many huge E-Commerce sites are written in Python, Ruby and Perl using various frameworks. And I would argue that the security requirements for merchants are much higher than the requirements of the banking industry. That is because merchants have to provide security and good user experience, while banking customers are willing to put up with unusable interfaces SecureID tokens and whatever. So yes: Django is up to the task.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
0.113791
0
0
8,593
498,630
2009-01-31T10:46:00.000
0
0
0
0
python,django,security
499,065
7
false
1
0
Are you referring to the fact that the complete application is built in Java, or just the part you see in your browser? If the latter, the reason is probably because in the context of webpages, Java applets can be downloaded and run.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
0
0
0
8,593
498,630
2009-01-31T10:46:00.000
1
0
0
0
python,django,security
2,654,928
7
false
1
0
You can build a secure application with Django just as you can with any popular Java framework. One part where Java does shine is its extensive cryptographic library. For the minimal encryption tasks that are required by Django, Python’s cryptographic services are sufficient, however its lack of strong block ciphers make the encryption mechanism in Django insecure for data at rest. Python does natively support secure hashing algorithms to include SHA1, SHA224, SHA256, SHA384, and SHA512, however Django’s authentication mechanism has yet to be updated to use anything other than SHA1, making it potentially vulnerable to cryptographic analysis.
7
22
0
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
0.028564
0
0
8,593
500,134
2009-02-01T03:37:00.000
0
0
0
0
python,authentication,web-applications,windows-authentication
500,260
3
false
1
0
To the best of my knowledge the only browser that automatically passes your login credentials is Internet Explorer. To enable this feature select "Enable Integrated Windows Authentication" in the advanced Internet options dialog under the security section. This is usually enabled by default. The web server will have to have the Anonymous user permission removed from the web application and enable windows authentication option checked. Simply add the users you want to have access to the web application to the file/folder permissions. I have only tried this with IIS so I'm not sure if it will work on other web servers.
1
3
0
On the intranet at my part time job (not IT related) there are various web applications that we use that do not require logging in explicitly. We are required to login to Windows obviously, and that then authenticates us some how. I'm wondering how this is done? Without worrying about security TOO much, how would I go about authenticating a user to a web application, utilizing the windows login information? I'd be using Python (and Django). Are there limitations on how this can be achieved? For instance, would a specific browser be required? Would the application and intranet backend have to be hosted at the same location or at least have to communicate? Or is it simply getting the users Windows credentials, and passing that to the authentication software of the web application?
Can I log into a web application automatically using a users windows logon?
0
0
0
4,695
500,168
2009-02-01T03:59:00.000
5
0
1
0
python,datetime,timedelta
500,204
4
false
0
0
It would be perfect if I could just get the entire difference in seconds. Then plain-old-unix-timestamp as provided by the 'time' module may be more to your taste. I personally have yet to be convinced by a lot of what's in 'datetime'.
1
14
0
I am trying to have some clever dates since a post has been made on my site ("seconds since, hours since, weeks since, etc..") and I'm using datetime.timedelta difference between utcnow and utc dated stored in the database for a post. Looks like, according to the docs, I have to use the days attribute AND the seconds attribute, to get the fancy date strings I want. Can't I just get in whatever time unit I want the value of the entire difference? Am I missing something? It would be perfect if I could just get the entire difference in seconds.
Python's timedelta: can't I just get in whatever time unit I want the value of the entire difference?
0.244919
0
0
12,165
500,477
2009-02-01T09:20:00.000
2
0
0
1
python
500,483
2
false
0
0
You can redirect output into temp file and delete it afterward. But there's also a method called popen that redirects output directly to your program so it won't go on screen.
1
12
0
Is there a built-in method in Python to execute a system command without displaying the output? I only want to grab the return value. It is important that it be cross-platform, so just redirecting the output to /dev/null won't work on Windows, and the other way around. I know I can just check os.platform and build the redirection myself, but I'm hoping for a built-in solution.
In Python - how to execute system command with no output
0.197375
0
0
6,820
500,935
2009-02-01T14:47:00.000
1
0
0
0
python,multithreading,web-services,web.py
501,570
4
false
1
0
Wouldn't is be simpler to re-write your main-loop code to be a function that you call over and over again, and then call that from the function that you pass to runsimple... It's guaranteed not to fully satisfy your requirements, but if you're in a rush, it might be easiest.
1
17
0
while learning some basic programming with python, i found web.py. i got stuck with a stupid problem: i wrote a simple console app with a main loop that proccesses items from a queue in seperate threads. my goal is to use web.py to add items to my queue and report status of the queue via web request. i got this running as a module but can´t integrate it into my main app. my problem is when i start the http server with app.run() it blocks my main loop. also tried to start it with thread.start_new_thread but it still blocks. is there an easy way to run web.py´s integrated http server in the background within my app. in the likely event that i am a victim of a fundamental missunderstanding, any attempt to clarify my error in reasoning would help ;.) ( please bear with me, i am a beginner :-)
Using web.py as non blocking http-server
0.049958
0
1
7,054
501,585
2009-02-01T21:10:00.000
0
1
1
0
python,vim
501,812
12
false
0
0
If I want to print 'Hello' to lines 4,5, 6 and 7, what is wrong: If you want to do something in randomly chosen places throughout your file, you're better of recording keystrokes and replaying them. Go to the first line you want to change, and hit qz to starting recording into register z. Do whatever edits you want for that line and hit q again when you're finished. Go to the next line you want to change and press @z to replay the macro.
1
52
0
I waste a lot of time between Vim and Python. I find it too slow to manually copy-paste from Python to Vim and vice versa. A good broken example is: %!python for i in xrange(25); print 6*i \n How can you do such tweaks direcly in Vim? [Solved] [Clarification] I need things to Vim, like printing sequences, arithmetics... - things I cannot do in Vim. [?] Can someone elaborate this point: "your script can read from stdin to operate directly on the lines given (., %, ...)." [Further Clarification] If I want to print 'Hello' to lines 4,5, 6 and 7, what is wrong: :4-7!python -c "print 'hello'" The dot . modifies the current line. Can I print on multiple lines 7, 32 and 99: :7,32,99!python -c "print 'hello'" Clearly not working. How?
How can you use Python in Vim?
0
0
0
20,950
501,597
2009-02-01T21:18:00.000
1
0
1
1
python,packaging,setuptools,gnome,distutils2
501,624
4
false
0
0
In general, yes - everything is better than autotools when building Python projects. I have good experiences with setuptools so far. However, installing files into fixed locations is not a strength of setuptools - after all, it's not something to build installaters for Python apps, but distribute Python libraries. For the installation of files which are not application data files (like images, UI files etc) but provide integration into the operating system, you are better off with using a real packaging format (like RPM or deb). That said, nothing stops you from having the build process based on setuptools and a small make file for installing everything into its rightful place.
1
10
0
Currently I'm using the auto-tools to build/install and package a project of mine, but I would really like to move to something that feels more "pythonic". My project consists of two scripts, one module, two glade GUI descriptions, and two .desktop files. It's currently a pure python project, though that's likely to change soon-ish. Looking at setuptools I can easily see how to deal with everything except the .desktop files; they have to end up in a specific directory so that Gnome can find them. Is using distuils/setuptools a good idea to begin with?
How to distribute `.desktop` files and icons for a Python package in Gnome (with distutils or setuptools)?
0.049958
0
0
3,003
501,945
2009-02-02T00:59:00.000
4
1
1
0
python
501,958
5
false
0
0
You can set the PYTHONPATH environment variable to the directory where your library files are located. This adds that path to the library search path and you can use a normal import to import them.
2
6
0
I've got a number of scripts that use common definitions. How do I split them in multiple files? Furthermore, the application can not be installed in any way in my scenario; it must be possible to have an arbitrary number of versions concurrently running and it must work without superuser rights. Solutions I've come up with are: Duplicate code in every script. Messy, and probably the worst scheme. Put all scripts and common code in a single directory, and use from . import to load them. The downside of this approach is that I'd like to put my libraries in other directory than the applications. Put common code in its own directory, write a __init__.py that imports all submodules and finally use from . import to load them. Keeps code organized, but it's a little bit of overhead to maintain __init__.py and qualify names. Add the library directory to sys.path and import. I tend to this, but I'm not sure whether fiddling with sys.path is nice code. Load using execfile (exec in Python 3). Combines the advantages of the previous two approaches: Only one line per module needed, and I can use a dedicated. On the other hand, this evades the python module concept and polutes the global namespace. Write and install a module using distutils. This installs the library for all python scripts and needs superuser rights and impacts other applications and is hence not applicable in my case. What is the best method?
How to modularize a Python application
0.158649
0
0
3,665
501,945
2009-02-02T00:59:00.000
1
1
1
0
python
501,966
5
false
0
0
I've used the third approach (add the directories to sys.path) for more than one project, and I think it's a valid approach.
2
6
0
I've got a number of scripts that use common definitions. How do I split them in multiple files? Furthermore, the application can not be installed in any way in my scenario; it must be possible to have an arbitrary number of versions concurrently running and it must work without superuser rights. Solutions I've come up with are: Duplicate code in every script. Messy, and probably the worst scheme. Put all scripts and common code in a single directory, and use from . import to load them. The downside of this approach is that I'd like to put my libraries in other directory than the applications. Put common code in its own directory, write a __init__.py that imports all submodules and finally use from . import to load them. Keeps code organized, but it's a little bit of overhead to maintain __init__.py and qualify names. Add the library directory to sys.path and import. I tend to this, but I'm not sure whether fiddling with sys.path is nice code. Load using execfile (exec in Python 3). Combines the advantages of the previous two approaches: Only one line per module needed, and I can use a dedicated. On the other hand, this evades the python module concept and polutes the global namespace. Write and install a module using distutils. This installs the library for all python scripts and needs superuser rights and impacts other applications and is hence not applicable in my case. What is the best method?
How to modularize a Python application
0.039979
0
0
3,665
502,173
2009-02-02T04:21:00.000
1
0
1
0
visual-studio,ironpython,ironpython-studio
502,292
6
false
0
0
Right now, there is no extension to run IronPython v2.0 on Visual Studio.
1
12
0
I've tried using the IronPython integration extension provided by Microsoft. But it does not work with Visual Studio 2008. Is there a proper VS 2008 IDE extension for IronPython?
How to use IronPython with Visual Studio 2008
0.033321
0
0
11,619
505,230
2009-02-02T22:28:00.000
0
0
1
0
python,python-3.x,py2exe
35,556,519
5
false
0
0
If you have easy setup installed, type pip install py2exe in a shell to install.
1
31
0
I am looking for a Python3.0 version of "py2exe". I tried running 2to3 on the source for py2exe but the code remained broken. Any ideas?
Py2exe for Python 3.0
0
0
0
58,941
506,594
2009-02-03T10:12:00.000
1
0
0
0
python,twisted,activemq,stomp
511,246
3
false
0
0
Twisted Stomp adapter would be way too cool. Would you consider sharing it and keep us up to date with the development? Cheers
1
2
0
I checked out stomper and it didn't look complete. (I'm very new to Python) Is anybody out there using stomper in a production environment? If not, I guess I'll have to roll out my own Twisted Stomp adapter. Thanks in advance!
Is there a widely used STOMP adapter for Twisted?
0.066568
0
0
1,772
506,748
2009-02-03T11:21:00.000
7
0
1
0
python,algorithm,math,symbolic-math
506,828
7
false
0
0
Symbolic math is a fun project. Whether or not anyone uses it doesn't appear to matter in your question, so dive in. I've written two of these over the years. The coolest was one for SQL where clauses -- it did some trivial symbolic manipulations on the SQL to fold in some additional AND conditions. Not a complete "solver" or "optimizer" or anything, just a few symbolic manipulations of any SQL where clause possible. The less cool one was for a debugger; it did complex math to work out (symbolically) stack offsets for variables. You start by defining classes for elements of a mathematical expression -- operands, operators, functions, etc. You have to decide what manipulations these objects have to participate in. Getting a concrete value for an expression is an easy and obvious one. Start with the case where all variables have a binding. Then handle the case where some variables remain unbound, and you can only evaluate parts of the expression. Then handle rearranging an expression into a canonical form. I.e., you've done a partial evaluation and have Add( Variable(x), Add( Variable(x), Lit(3) ) ). You need to write rules to transform this into Add( Multiply( Lit(2), Variable(x) ), Lit(3) ). One very cool exercise is optimizing the parenthesis so that the printed output has the fewest parenthesis necessary to capture the meaning. There are many, many other "expression transformation" rules that we all learn in school for doing algebraic manipulations. Lots of them. In particular, rearranging an equation to isolate a variable can be really hard in some cases. Doing the derivative transformation is easy, but symbolic integration is really, really hard with a ton of special cases. The basics are fun. Depending on how far you want to go, it gets progressively harder.
2
21
0
I am extreamly interested in math and programming and planning to start symbolic math project from scratch. Is this good project idea? Where to start? How should one approach this project? Any good resources? Thanks in advance.
Symbolic Mathematics Python?
1
0
0
7,818
506,748
2009-02-03T11:21:00.000
10
0
1
0
python,algorithm,math,symbolic-math
506,838
7
false
0
0
1.Is this good project idea? Yes; I would expect it to provide an endless source of interesting work which will, quite quickly, test and extend your programming powers. 2.Where to start? I second the other suggestions that you should look at existing work. SAGE is very impressive and if you had asked for my advice I would suggest that you firstly write a basic system for doing arithmetic with numbers and symbols; then have a look at SAGE and write a module to extend the system, in other words become a contributor to something larger rather than trying to do it all on your own. Look also at Mathematica and Maple, Macsyma and Axiom. The latter 2 are free (I think) but they are all well documented on-line and a great source of ideas and challenges. 3.How should one approach this project? As one would approach eating an elephant. One bite at a time. More seriously, I think there are some core issues, such as representation of expressions, and some basic functionality (arithmetic on polynomials) which you could cut your teeth on. 4.Any good resources? Lots and lots. google for 'computer algebra', 'term rewriting'. Have a look at what's available on Amazon. And, if you have access, check out the ACM digital library Good luck.
2
21
0
I am extreamly interested in math and programming and planning to start symbolic math project from scratch. Is this good project idea? Where to start? How should one approach this project? Any good resources? Thanks in advance.
Symbolic Mathematics Python?
1
0
0
7,818
507,376
2009-02-03T14:54:00.000
-1
1
0
0
python,email,smtp,postfix-mta,mailing
507,398
2
true
0
0
Procmail is the solution for mail filtering. You can call python scripts from your .procmailrc if you need more scripting.
1
0
0
I am using postfix in my production server which will receive all the emails related to mydomain.com In this context, I want to forward only emails related to few users to different email addresses. By which I mean, lets say I am a super user([email protected]). I want to forward all my emails(all mails with to:[email protected]) to my personal email id: [email protected]. So I think I would some programming logic is needed here. So I want to write a custom python script which should read the postfix email inbox and forward all new emails depending on the said criteria. Can I do this? I heard about .forward file in the postfix arena. Can I use that to achieve the same(by totally bypassing pythonic solution)?
How do I read/retrieve emails received by local postfix, through python
1.2
0
0
2,899
508,277
2009-02-03T18:18:00.000
1
0
1
0
python,dependencies
508,975
4
false
0
0
I don't know what is the best dependency analysis tool. You could look into modulefinder – it's a module in the standard library that determines the set of modules imported by a script. Of course, with python you have problems of conditional imports, and even potentially scripts calling __import__ directly, so it may not find everything. This is why tools like py2exe need special help to cope with packages like PIL.
1
31
0
Dependency analysis programs help us organize code by controlling the dependencies between modules in our code. When one module is a circular dependency of another module, it is a clue to find a way to turn that into a unidirectional dependency or merge two modules into one module. What is the best dependency analysis tool for Python code?
Is there a good dependency analysis tool for Python?
0.049958
0
0
18,686
509,742
2009-02-04T01:24:00.000
14
0
1
1
python,scripting,directory
23,595,382
4
false
0
0
os.chdir(os.path.dirname(os.path.abspath(__file__))) should do it. os.chdir(os.path.dirname(__file__)) would not work if the script is run from the directory in which it is present.
2
15
0
How do i change directory to the directory with my python script in? So far I figured out I should use os.chdir and sys.argv[0]. I'm sure there is a better way then to write my own function to parse argv[0].
Change directory to the directory of a Python script
1
0
0
17,931
509,742
2009-02-04T01:24:00.000
7
0
1
1
python,scripting,directory
509,987
4
false
0
0
Sometimes __file__ is not defined, in this case you can try sys.path[0]
2
15
0
How do i change directory to the directory with my python script in? So far I figured out I should use os.chdir and sys.argv[0]. I'm sure there is a better way then to write my own function to parse argv[0].
Change directory to the directory of a Python script
1
0
0
17,931
511,412
2009-02-04T13:42:00.000
5
1
0
0
python,ruby,setuptools,newgem
511,871
2
true
0
1
One way to solve it is to create three different projects: The library itself, independent on python & ruby Python bindings Ruby bindings That's probably the cleanest solution, albeit it requires a bit more work when doing releases, but it has the advantage that you can release a new version of the Ruby bindings without having to ship a new library/python bindings version.
1
8
0
I have a C extension module for Python and I want to make it available to Rubyists. The source has a number of C modules, with only one being Python-dependent. The rest depend only on each other and the standard library. I can build it with python setup.py build in the usual way. I've been experimenting with adding Ruby support using newgem and I can build a version of the extension with rake gem. However, the combined source has an ugly directory layout (mixing Gem-style and Setuptools-style structures) and the build process is a kludge. I can't just keep all the sources in the same directory because mkmf automatically picks up the Python-dependent module and tries to build that, and users shouldn't have to install Python to compile a module that won't be used. My current hack is for extconf.rb to copy the Python-independent source-files into the same directory as the Ruby-dependent extension module. Is there a saner way to make the code available to both languages? Should I just duplicate the Python-independent code in a separate Gem? Should I release the independent code as a separate lib built with autotools? Is there a version of mkmf that can skip the unwanted module?
Combined Python & Ruby extension module
1.2
0
0
734
512,173
2009-02-04T16:41:00.000
0
0
1
0
python,operating-system,filesystems,copy
512,232
4
false
0
0
Why not implement it on your own using os.walk?
1
33
0
I'm trying to copy a directory and all its contents to a path that already exists. The problem is, between the os module and the shutil module, there doesn't seem to be a way to do this. the shutil.copytree() function expects that the destination path not exist beforehand. The exact result I'm looking for is to copy an entire folder structure on top of another, overwriting silently on any duplicates found. Before I jump in and start writing my own function to do this I thought I'd ask if anyone knows of an existing recipe or snippet that does this.
How to copy a directory and its contents to an existing location using Python?
0
0
0
29,399
513,173
2009-02-04T20:34:00.000
0
1
0
0
php,python,version-control,web-applications
513,899
8
false
1
0
Why dont you want a client..? A simple client that you can run on your production machine which then syncs to your repository running on another server somewhere. SVN is available over HTTP so writing a client that is able to sync your code is really easy in python or php.
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
0
0
0
1,960
513,173
2009-02-04T20:34:00.000
1
1
0
0
php,python,version-control,web-applications
513,366
8
false
1
0
I think it's actually a pretty good idea, but don't believe such a versioning system exists (yet) so hopefully you'll go ahead and make one. I don't think adapting an existing solution is going to be easy, but it's probably worth looking into because if you use an existing solution you'll have all the client support done, and most of the versioning difficulties taken care of. Starting from scratch is not going to be trivial. -Adam
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
0.024995
0
0
1,960
513,173
2009-02-04T20:34:00.000
7
1
0
0
php,python,version-control,web-applications
513,231
8
false
1
0
Get a better hosting service. Seriously. Even if you found something that worked in PHP/Ruby/Perl/Whatever, it would still be a sub-par solution. It most likely wouldn't integrate with any IDE you have, and wouldn't have a good tool set available for working with it. It would be really clunky to do correctly. The other option is to get a free SVN host, or host SVN on your own machine, and then just push updates from your SVN host to your web site via ftp.
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
1
0
0
1,960
513,173
2009-02-04T20:34:00.000
0
1
0
0
php,python,version-control,web-applications
513,253
8
false
1
0
you could try the reverse way use e.g. a free online svn/git Service to version control the sources on your dev machine use usual ways to update the "production" machine aka site, like FTP
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
0
0
0
1,960
513,173
2009-02-04T20:34:00.000
1
1
0
0
php,python,version-control,web-applications
515,956
8
false
1
0
Use Bazaar: Lightweight. No dedicated server with Bazaar installed is needed, just FTP access to a web server. A smart server is available for those requiring additional performance or security but it is not required in many cases - Bazaar 1.x over plain http performs well.
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
0.024995
0
0
1,960
513,173
2009-02-04T20:34:00.000
2
1
0
0
php,python,version-control,web-applications
513,322
8
false
1
0
Don't host your repository on your web server. Deploy from your server to the ftp/sftp - whatever.
6
2
0
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server. I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control. Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course) Does anyone know if such a system exists? ==Edit== Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...
pure web based versioning system
0.049958
0
0
1,960
513,806
2009-02-04T23:06:00.000
0
0
1
0
python,gdata-api
513,838
2
false
0
0
If we assume that you want clients to use their own keys I'd recommend putting them in a configuration file which defaults to an (invalid) sentinel value. If on the other hand you want the script to use your key the best you can do is obfuscate it. After all, if your program can read it then an attacker (with a debugger) can read it too.
1
3
0
I've written several scripts that make use of the gdata API, and they all (obviously) have my API key and client ID in plain-text. How am I supposed to distribute these?
How to distribute script using gdata-python-client?
0
0
1
306
514,029
2009-02-05T00:37:00.000
0
0
1
0
python,string
2,739,117
9
false
0
0
I'm new to python and this is an old question, but maybe this? str.split('[')[1].strip(']')
1
2
0
So from this string: "name[id]" I need this: "id" I used str.split ('[]'), but it didn't work. Does it only take a single delimiter?
How to split a string by using [] in Python
0
0
0
14,012
514,617
2009-02-05T04:51:00.000
1
0
0
0
python,mysql,random,web.py
514,643
2
false
0
0
I agree with your intuition that using a stored procedure is the right way to go, but then, I almost always try to implement database stuff in the database. In your proc, I would introduce some kind of logic like say, there's only a 30% chance that returning the result will actually increment the counter. Just to increase the variability.
1
4
0
I have a small project I am doing in Python using web.py. It's a name generator, using 4 "parts" of a name (firstname, middlename, anothername, surname). Each part of the name is a collection of entites in a MySQL databse (name_part (id, part, type_id), and name_part_type (id, description)). Basic stuff, I guess. My generator picks a random entry of each "type", and assembles a comical name. Right now, I am using select * from name_part where type_id=[something] order by rand() limit 1 to select a random entry of each type (so I also have 4 queries that run per pageview, I figured this was better than one fat query returning potentially hundreds of rows; if you have a suggestion for how to pull this off in one query w/o a sproc I'll listen). Obviously I want to make this more random. Actually, I want to give it better coverage, not necessarily randomness. I want to make sure it's using as many possibilities as possible. That's what I am asking in this question, what sorts of strategies can I use to give coverage over a large random sample? My idea, is to implement a counter column on each name_part, and increment it each time I use it. I would need some logic to then say like: "get a name_part that is less than the highest "counter" for this "name_part_type", unless there are none then pick a random one". I am not very good at SQL, is this kind of logic even possible? The only way I can think to do this would require up to 3 or 4 queries for each part of the name (so up to 12 queries per pageview). Can I get some input on my logic here? Am I overthinking it? This actually sounds ideal for a stored procedure... but can you guys at least help me solve how to do it without a sproc? (I don't know if I can even use a sproc with the built-in database stuff of web.py). I hope this isn't terribly dumb but thanks ahead of time. edit: Aside from my specific problem I am still curious if there are any alternate strategies I can use that may be better.
Random name generator strategy - help me improve it
0.099668
1
0
1,758
516,798
2009-02-05T16:57:00.000
2
1
1
0
java,python,sql,directory
518,493
2
false
1
0
I think the best thing to do would be to ensure that your various modules don't depend upon being in the same directory (i.e. separate by component). A lot of people seem to be deathly afraid of this idea, but a good set of build scripts should be able to automate away any pain. The end goal would be to make it easy to install the infrastructure, and then really easy to work on a single component once the environment is setup. (It's important to note that I come from the Perl and CL worlds, where we install "modules" into some global location, like ~/perl or ~/.sbcl, rather than including each module with each project, like Java people do. You'd think this would be a maintenance problem, but it ends up not being one. With a script that updates each module from your git repository (or CPAN) on a regular basis, it is really the best way.) Edit: one more thing: Projects always have external dependencies. My projects need Postgres and a working Linux install. It would be insane to bundle this with the app code in version control -- but a script to get everything setup on a fresh workstation is very helpful. I guess what I'm trying to say, in a roundabout way perhaps, is that I don't think you should treat your internal modules differently from external modules.
1
5
0
We are running a large project with several different languages: Java, Python, PHP, SQL and Perl. Until now people have been working in their own private repositories, but now we want to merge the entire project in a single repository. The question now is: how should the directory structure look? Should we have separate directories for each language, or should we separate it by component/project? How well does python/perl/java cope with a common directory layout?
Mixed language source directory layout
0.197375
0
0
1,166
516,946
2009-02-05T17:32:00.000
0
0
1
0
python,windows,excel,com
516,983
3
false
0
0
If you application uses a single excel file which contains macros which you call, I fear the answer is probably no since aside from COM Excel does not allow the same file to be opened with the same name (even if in different directories). You may be able to get around this by dynamically copying the file to another name before opening. My python knowledge isn't huge, but in most languages there is a way of specifying when you create a COM object whether you wish it to be a new object or connect to a preexisting instance by default. Check the python docs for something along these lines. Can you list the kind of specific problems you are having and exactly what you are hoping to do?
1
6
0
I've got a legacy application which is implemented in a number of Excel workbooks. It's not something that I have the authority to re-implement, however another application that I do maintain does need to be able to call functions in the Excel workbook. It's been given a python interface using the Win32Com library. Other processes can call functions in my python package which in turn invokes the functions I need via Win32Com. Unfortunately COM does not allow me to specify a particular COM process, so at the moment no matter how powerful my server I can only control one instance of Excel at a time on the computer. If I were to try to run more than one instance of excel there would be no way of ensuring that the python layer is bound to a specific Excel instance. I'd like to be able to run more than 1 of my excel applications on my Windows server concurrently. Is there a way to do this? For example, could I compartmentalize my environment so that I could run as many Excel _ Python combinations as my application will support?
Control 2 separate Excel instances by COM independently... can it be done?
0
1
0
4,391
517,237
2009-02-05T18:29:00.000
2
0
1
0
python,web-services,api,rest
518,161
5
false
0
0
My favorite combination is httplib2 (or pycurl for performance) and simplejson. As REST is more "a way of design" then a real "protocol" there is not really a reusable thing (that I know of). On Ruby you have something like ActiveResource. And to be honest, even that would just expose some tables as a webservice, whereas the power of xml/json is that they are more like "views" that can contain multiple objects optimized for your application. I hope this makes sense :-)
2
21
0
I'd like to write a python library to wrap a REST-style API offered by a particular Web service. Does anyone know of any good learning resources for such work, preferably aimed at intermediate Python programmers? I'd like a good article on the subject, but I'd settle for nice, clear code examples. CLARIFICATION: What I'm looking to do is write a Python client to interact with a Web service -- something to construct HTTP requests and parse XML/JSON responses, all wrapped up in Python objects.
HOWTO: Write Python API wrapper?
0.07983
0
1
15,114
517,237
2009-02-05T18:29:00.000
0
0
1
0
python,web-services,api,rest
981,474
5
false
0
0
You should take a look at PyFacebook. This is a python wrapper for the Facebook API, and it's one of the most nicely done API's I have ever used.
2
21
0
I'd like to write a python library to wrap a REST-style API offered by a particular Web service. Does anyone know of any good learning resources for such work, preferably aimed at intermediate Python programmers? I'd like a good article on the subject, but I'd settle for nice, clear code examples. CLARIFICATION: What I'm looking to do is write a Python client to interact with a Web service -- something to construct HTTP requests and parse XML/JSON responses, all wrapped up in Python objects.
HOWTO: Write Python API wrapper?
0
0
1
15,114
517,970
2009-02-05T21:19:00.000
25
0
1
1
python,windows,console
32,280,047
30
false
0
0
Quickest and easiest way without a doubt is Ctrl+L. This is the same for OS X on the terminal.
7
437
0
Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I'm wondering if, and how, to clear the Python interpreter console. I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do. Note: I'm running on Windows, so Ctrl+L doesn't work.
How to clear the interpreter console?
1
0
0
824,944
517,970
2009-02-05T21:19:00.000
2
0
1
1
python,windows,console
23,730,811
30
false
0
0
just use this.. print '\n'*1000
7
437
0
Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I'm wondering if, and how, to clear the Python interpreter console. I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do. Note: I'm running on Windows, so Ctrl+L doesn't work.
How to clear the interpreter console?
0.013333
0
0
824,944
517,970
2009-02-05T21:19:00.000
4
0
1
1
python,windows,console
518,401
30
false
0
0
Use idle. It has many handy features. Ctrl+F6, for example, resets the console. Closing and opening the console are good ways to clear it.
7
437
0
Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I'm wondering if, and how, to clear the Python interpreter console. I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do. Note: I'm running on Windows, so Ctrl+L doesn't work.
How to clear the interpreter console?
0.02666
0
0
824,944
517,970
2009-02-05T21:19:00.000
1
0
1
1
python,windows,console
17,536,224
30
false
0
0
OK, so this is a much less technical answer, but I'm using the Python plugin for Notepad++ and it turns out you can just clear the console manually by right-clicking on it and clicking "clear". Hope this helps someone out there!
7
437
0
Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I'm wondering if, and how, to clear the Python interpreter console. I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do. Note: I'm running on Windows, so Ctrl+L doesn't work.
How to clear the interpreter console?
0.006667
0
0
824,944
517,970
2009-02-05T21:19:00.000
2
0
1
1
python,windows,console
31,640,548
30
false
0
0
If it is on mac, then a simple cmd + k should do the trick.
7
437
0
Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I'm wondering if, and how, to clear the Python interpreter console. I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do. Note: I'm running on Windows, so Ctrl+L doesn't work.
How to clear the interpreter console?
0.013333
0
0
824,944