Sometimes at night, I like to watch movies in bed, or TV shows online. This is convenient since my computer is right beside my desk, so I just spin one of my monitors around, disable my other screen and pull my mouse over. My keyboard doesn't quite reach without re-routing the cable in a way that doesn't work when I move back to my desk ...
I have a fucntion that calculates the number of images that can be displayed on the screen, if there are more images than the ones that can be put on screen, I resize the images till they all can happear.
Then, I want to display them with one vertical box sizer and several horizontal box sizers!
The horizontal number of box sizers are...
Is there any way in django to store cookies which is independent to browser ?
is there any technique just like what flash SharedObject does ..?
...
I want to learn about compilers and some optimization techniques, and I thought it would be helpful to do some quick implementations of the algorithms.
Is there a library/framework for Python that can make things easier (like the Natural Language Toolkit) - generating the parse tree, manipulating loops, methods?
I saw that Microsoft...
Hello. I've been making a game and the python library I was used is terrible (Pyglet). I want to try using Cocoa for the OSX version.
I'll be able to figure out using the objects from classes like NSWindow and NSOpenGLView and then put these objects in my own class for the game loop.
I have no idea how I can use PyObjC to load a dynami...
I have a Python script and a JS on my server. In the python script, I want to set the value of a variable to be the output of one of the functions in my .js file.
Is this possible, and if so how wold one go about doing this?
Thanks!
...
As the title says, how do you remember the order of super's arguments? Is there a mnemonic somewhere I've missed?
After years of Python programming, I still have to look it up :(
(for the record, it's super(Type, self))
...
I am looking for a fast and efficient way to calculate the frequency of list items in python:
list = ['a','b','a','b', ......]
I want a frequency counter which would give me an output like this:
[ ('a', 10),('b', 8) ...]
The items should be arranged in descending order of frequency as shown above.
...
I am writing a piece of code which will extract words from running text. This text can contain delimiters like \r,\n etc. which might be there in text.
I want to discard all these delimiters and only extract full words. How can I do this with Python? any library available for crunching text in python?
...
Is there a way to declare static methods in cheetah? IE
snippets.tmpl
#def address($address, $title)
<div class="address">
<b>$title</h1></b>
#if $address.title
$address.title <br/>
#end if
$address.line1 <br/>
#if $address.line2
$address.line2 <br/>
#end if
$address.town, $address.state $address.zipcode
</div>
#end def
....
other sn...
Hi All,
I have to develop an application where I need to send sms to the users on a particular action by the users.
I have heard of kannel with PHP, is there some help for the same in Python as well or is there any other better open source sms gateway which I can use with my application?
Please suggest.
Thanks in advance.
...
I know about utils like html2text, BeautifulSoup etc. but the issue is that they also extract javascript and add it to the text making it tough to separate them.
htmlDom = BeautifulSoup(webPage)
htmlDom.findAll(text=True)
Alternately,
from stripogram import html2text
extract = html2text(webPage)
Both of these extract all the java...
I'm working on a small web application using the Python Flask framework. For a few happy weeks SQLAlchemy was a perfect fit for my needs. In the meantime I found out more about MongoDB, played with it locally and started thinking of using it instead of MySql along with SQLAlchemy.
Is this a good idea in terms of:
Suitability. The pro...
this is my code :
#coding:utf-8
import cgi,os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from whoosh import store
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT
from whoosh.index import getdatastoreindex,create_in
from ...
I am trying to use the scipy stats package in Python and am getting the following error (on Mac OS X):
$ python
Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> from scipy import stats
I then get t...
Hey guys!
I am calling different processes with the subprocess module. However, I have a question.
In the following codes:
callProcess = subprocess.Popen(['ls', '-l'], shell=True)
and
callProcess = subprocess.Popen(['ls', '-l']) # without shell
Both work. After reading the docs, I came to know that shell=True means executing the c...
I'm trying to convert a string array of categorical variables to an integer array of categorical variables.
Ex.
import numpy as np
a = np.array( ['a', 'b', 'c', 'a', 'b', 'c'])
print a.dtype
>>> |S1
b = np.unique(a)
print b
>>> ['a' 'b' 'c']
c = a.desired_function(b)
print c, c.dtype
>>> [1,2,3,1,2,3] int32
I realize this can be d...
I am trying to install pygsl using latest version of GCC, i.e.:
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659)
I get the error:
$ sudo python setup.py build
numpy
Building testing ufuncs!
running build
running build_py
running build_ext
building 'errno' extension
C compiler: gcc-4.0 -arch ppc -arch...
Suppose you know the three vertices for a spherical triangle.
Then how do you draw the sides on a sphere in 3D?
I need some python code to use in Blender 3d modelisation software.
I already have the sphere done in 3D in Blender.
Thanks & happy blendering.
note 1:
i have the 3 points / vertices (p1,p2,p3 ) on the sphere for a spher...
So I have some code:
signature = hmac.new(
key=AWS_SECRET_ACCESS_KEY,
msg=string_to_sign,
digestmod=hashlib.sha256).digest()
That runs perfectly on my own computer (has python 2.6.1). However, when I run this code on my server (Python 2.4.3) I get the following:
/home/MYUSERNAME/public_html/Foo.com/cgi-bin/foo.py
66 ...