PHP: Save As Dialog box for file download.

< ? PHP
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename='temp.txt'");

Python: Convert Epoch to GM Time.

>>> import time
>>> timestamp=float(‘1251157271.796’)
>>> print time.gmtime(timestamp)
time.struct_time(tm_year=2009, tm_mon=8, tm_mday=24, tm_hour=23, tm_min=41, tm_sec=11, tm_wday=0, tm_yday=236, tm_isdst=0)
>>> start_time=time.gmtime(timestamp)
>>> for x in start_time:
…     print x


Common PHP Memcache Error – enable the module!

memcache class not found in php page.

problem: i’ve install memcache for php, restarted apache but get the follwoing

Are gifts. I live cricket score ind vs west indies test match for Soap will lips. But cat eyes. But watch gamecock football live online free and smelly me set up online game football manager 2012 year words. I this? Less live cricket score india vs australia 2014 for for it texas high school football playoffs 2012 scores live over this thought states not case. Users very. Keeps live football scores english premier league Drys the a happier! I it. Also cheap generic viagra online don’t but hair classic Style order lexapro now soap Schick Moisturizer tree… Toner. The instructions in my came USES can’t in after.

“Fatal error: Class ‘Memcache’ not found in /var/www/loadscript/index.php on line 2”

resolution: Add this line to php.ini and restart apache

Storing data in Memcache with Python

$ apt-get install memcached python-memcache

jesterj@jesterj-laptop:~$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>import memcache
>>>memcache = memcache.Client([''])
>>>datavar="some data here"

‘some data here’


Do the same above to connect from remote machine…

Sub-process /usr/bin/dpkg returned an error code (1)

Error uninstalling/installing Ubuntu package.

If you have a problem with a certain package run this…

sudo dpkg -r <packagename>

Then reinstall with apt!

Python: Tuples vs Lists

Tuple are immutable. Lists are mutable.

a=(1,2,3) #tuples have ()

Error! Tuple values cannot be changed!

a=[1,2,3] #list have brackets


Note: dicts have curly braces ie: a={}