Suppose I was given by some URL.
It might already have GET parameters (e.g. http://example.com/search?q=question) or not (e.g. http://example.com/).
And now I need to add some parameters to it like {'lang':'en','tag':'python'}. In first case I'm going to have http://example.com/search?q=question&lang=en&tag=python and in second ...
So far to execute a python program , I'm using
> python file.py
I want to run the python script simply using file name ,like
> file.py
similar to shell scripts like
> sh file.sh
> chmod +x file.sh
> ./file.sh
or move file.sh to bin
and then run
> file.sh
...
How to build exe files from py files (compatible with win32)?
please don't refer to py2exe. that is blocked service in IRI.
for Iranians only: do you know how to download something (like py2exe) from blocked sites? especially from sourceforge ande fontforge?
...
Alias /media/ /home/matt/repos/hello/media
<Directory /home/matt/repos/hello/media>
Options -Indexes
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /home/matt/repos/hello/wsgi/django.wsgi
/media is my directory. When I go to mydomain.com/media/, it says 403 Forbidden. And, the rest of my site doesn't work because all st...
I have been looking for the syntax to redirect a special url to a remote server to do some XSS testing. Any ideas?
import SimpleHTTPServer
import SocketServer
class myHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
print self.path
if self.path == '/analog':
-------------------->return "http://...
There are Python code available for existing algorithms for normal string searching e.g. Boyer-Moore Algorithm. I am looking to use this on Chinese characters and it doesn't seem like the same implementation would work. What would I go about doing in order to make the algorithm work on Chinese characters? I am referring to this:
http://...
Hi,
I need to implement REST web services using Python. I am using Apache web server with WSGI module. I found lot of frameworks to implement the REST like Django, bobo, etc..I am confused which one to use.
Can anyone suggest me a framework which i can use for this scenario?
Anandan
...
I have a minor problem while checking for elements in a list:
I have two files with contents something like this
file 1: file2:
47 358 47
48 450 49
49 56 50
I parsed both files into two lists and used the following code to check
for i in file_1:
for j in file_2:
j = j.split()
...
I am trying to scrape an ASP.NET website but am having trouble getting the results from a post. I have the following python code and am using httplib2 and BeautifulSoup:
conn = Http()
# do a get first to retrieve important values
page = conn.request(u"http://somepage.com/Search.aspx", "GET")
#event_validation and viewstate variables re...
All,
How Can we increment a value like the following in django templates,
{{ flag =0 }}
{% for op in options %}
{{op.choices}}<input type="radio" name="template" id="template" value="template{{flag++}}"/>
{% endfor %}
thanks..
...
I've got a document like this:
<p class="top">I don't want this</p>
<p>I want this</p>
<table>
<!-- ... -->
</table>
<img ... />
<p> and all that stuff too</p>
<p class="end>But not this and nothing after it</p>
I want to extract everything between the p[class=top] and p[class=end] paragraphs.
Is there a nice way I can do thi...
Recently I tried compiling program something like this with GCC:
int f(int i){
if(i<0){ return 0;}
return f(i-1);
f(100000);
and it ran just fine. When I inspected the stack frames the compiler optimized the program to use only one frame, by just jumping back to the beginning of the function and only replacing the arguments to...
Hi Guys,
I'm trying to figure out the best C++ library/package for array manipulations in a manner of python. Basically I need a simplicity like this:
values = numpy.array(inp.data)
idx1 = numpy.where(values > -2.14)
idx2 = numpy.where(values < 2.0)
res1 = (values[idx1] - diff1)/1000
res2 = (values[idx2] - diff2)*1000
In pyth...
A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all.
I'm looking for suggestions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java.
According to many sources...
Hello everybody,
I'm developing an application in PyQt4 that eventually has to open and show PDF files. For this task there is a python library: python-poppler (in various spelling flavours).
The problem is that it is terribly under documented and the only simple working example I found so far uses Python+Gtk+Cairo, while the example ...
I can output a locale sensitive time format using strftime('%X'), but this always includes seconds. How might I display this time format without seconds?
>>> import locale
>>> import datetime
>>> locale.setlocale(locale.LC_ALL, 'en_IE.utf-8')
'en_IE.utf-8'
>>> print datetime.datetime.now().strftime('%X')
12:22:43
>>> locale.setlocale(l...
I have some xml documents I need to run queries on. I've created some python scripts (using ElementTree) to do this, since I'm vaguely familiar with using it.
The way it works is I run the scripts several times with different arguments, depending on what I want to find out.
These files can be relatively large (10MB+) and so it takes r...
I have text file, how check whether it's empty or not?
...
Hi all,
I saw this post, http://stackoverflow.com/posts/1348076/revisions , only at step 3 i'm getting confused, he tells to put 3. Add "get_view_permission" to default model class
but what's the default model class? It doesn't seem to work to me, i get following error message:
AttributeError at /admin/
'Options' object has no attri...
I want to print the line immediately before the searched string. How can I do that?
Lets say my two lines are
AADRG
SDFJGKDFSDF
and I am searching for SDF. I have found SDFJGKDFSDF, but how can I obtain the previous line AADRG? Does file.readline()-1 work?
...