9/10/2013

python datetime timedelta



import datetime

tmp1 = date1 + date2
tmp2_bool = date1 > date2 # return True
today = datetime.date.today()
five_days_after = today + datetime.timedelta(days=5)
seven_days_before = today - datetime.timedelta(days=7)
seven_days_five_hours_before = today - datetime.timedelta(days=7, hours=5)
date1 = datetime.timedelta(hours=5) # 5 hours later from now
date2 = datetime.timedelta(days=-5) # 5 days earlyer from today


.

9/09/2013

correction of mem leak of django + apache


The code below consume large memory and don't return.
Apache process memory will keep increasing with the code below.


aaa = data.objects.all().order_by('-id')
count_of_aaa = len(aaa)

The problem is "len(aaa)". (dunno why)
It should be replace by ...

count_of_aaa = aaa.count()

Then no mem leak occur.

3/25/2013

adobe reader font fix

ref: http://ubuntuforums.org/showthread.php?t=1006831



  1. #1
    MrFSL's Avatar
    MrFSL is offlineDipped in Ubuntu
    Join Date
    Mar 2006
    Location
    Somewhere outside Ubuntu
    Beans
    602

    [SOLVED] Adobe Reader Font Fixed



32bit Hardy Install

I searched the forum and could not find an answer to this problem so I am posting it here. Hopefully it helps some people.

I use the adobe reader 8.1.3 package for pdf files:
Located Here

I have noticed that often I get errors saying that a certain font cannot be displayed. This happens frequently with Microsoft fonts like Arial,Bold or Arial,Narrow. In the reader these fonts come out as little black dots instead.

I simply could not find a fix here nor on the Adobe forums. After some hacking though I have a solution:

First install the msttcorefonts package (if you haven't already)
Code:
sudo apt-get install msttcorefonts
Next edit the the reader's startup file:
Code:
sudo gedit /opt/Adobe/Reader8/bin/acroread
And uncomment these two lines:
Code:
ACRO_ENABLE_FONT_CONFIG=1
export ACRO_ENABLE_FONT_CONFIG
Now reader acts as should be expected.

12/13/2012

AR8161 on-board lan to work (ASUS P8H77-V board)


sudo apt-get install linux-headers-generic build-essential
wget http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.5/compat-wireless-3.5.1-1-snpc.tar.bz2
tar -xf compat-wireless-3.5.1-1-snpc.tar.bz2
cd compat-wireless-3.5.1-1-snpc
./scripts/driver-select alx
make
sudo make install
sudo modprobe alx


http://ubuntuforums.org/showthread.php?t=2050126&highlight=p8h77-v

10/08/2012

Edit mime type

Install file type editor ( command name : assogiate )

(some file types are unable to edit.)

or

cd [path]
 where, path = /usr/local/share/mime  or ~/.local/share/mime or /usr/share/mime
cd packages
gedit [file_type_you_want]

sudo update-mime-database [path]

** Don't forget BACKUP !