顯示具有 debian 標籤的文章。 顯示所有文章
顯示具有 debian 標籤的文章。 顯示所有文章

星期五, 5月 22, 2009

[tips] benq FP222WH + nvidia 達到原生解析度1680x1050的方法

最近辦公室的電腦換了一張nvidia 9400的顯示卡,
可是搭配上benq FP222WH ,
解析度怎麼調最大都只有640x480, (各種方法都試過了)
後來總算讓我查出是EDID的問題,
原本舊版的nvidia driver有一招是在xorg.conf設定
"IgnoreEDID" "true",
不過我新版的180.51 driver根本不適用這個方法,
後來我研究了快一天,
不過最後研究出來的解決方法倒是很簡單,
放在這提供有需要的人參考,
首先我先去抄ATI顯卡列出的EDID,
然後將它做成一個128 byte 的EDID
HEX file, 我已經做好了所以直接抓這個檔案擺在/etc/x11就可以

http://kalug.linux.org.tw/~tim/benq/benq-c.bin

然後在你的xorg.conf裡加上幾行,
(請自行比對xorg.conf的相異處)

Section "Monitor"

Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 30.0 - 86.0
VertRefresh 60.0

# 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz
Modeline "1680x1050_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync

EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"

Option "ConnectedMonitor" "DFP"
Option "CustomEDID" "DFP-0:/etc/X11/benq-c.bin"
Option "UseDisplayDevice" "DFP" # DVI out

SubSection "Display"
Viewport 0 0
EndSubSection
EndSection

我的是DVI接頭,
另外一個同事用的是DSUB(VGA) 的,
他說只要DFP改成CRT也可以用,
我們一個是用debian一個是用gentoo,
在預設情形下解析度都是錯誤的,
但是透過這個方法就可以達到原生解析度1680x1050. :)

星期四, 9月 04, 2008

Django 1.0 released !!

http://www.djangoproject.com/weblog/2008/sep/03/1/

Django 1.0 released!

1.0是Django project一個很重要的里程碑,因為一直以來官方對於Django 1.0有個很重要的承諾,就是在1.0之後的所有版本都將維持向前相容性,就是不論是到1.x多少版,都將維持對1.0版本程式的相容性而不會再作任何會打破相容性的重大變動。這也是為什麼1.0版本會遲遲不推出的原因。

不過1.0 release的這一天終於來了,
根據Django官方網頁的說法,自從上一個穩定版Django 0.96.2以來,到這次的1.0版本發佈,已經有超過三十五萬行的Django程式碼被修正或改變,足見改變之大。(改動350000行的python, orz)

這次總算是讓我可以使用Django的新版本了,畢竟用了0.95.x跟0.96.x實在是很久了,而Django的SVN trunk對於真的要上線的系統畢竟還是個比較危險的使用方式。不過美中不足的是debian lenny似乎還是會來不及將Django 1.0包進debian linux系統,看來以後安裝上線系統又要多費一番功夫。

想知道更詳細的改變內容跟新增功能請看Django 1.0 release notes

星期一, 7月 14, 2008

[tips] rewrite debian/ubuntu 's lighttpd conf script from perl to python

Today I want to port lighttpd on another platform which basically a debian sarge system but without perl and dpkg package system on it. Since it's a debian based platform so I start from porting debian's binary lighttpd package, however I've found there're some perl script lays in /usr/share/lighttpd which are used when lighttpd startup.

While I can easily dump the result of perl script into a textfile,
and then startup my lighttpd correctly, I thought "maybe port it to python is not a bad idea." (since my target platform has python!), so here is the effort:
create-mime.assign.py

#!/usr/bin/python
#
# This script directly translate from debian's lighttpd perl script:
# create-mime.assign.pl
#
# Author: timchen119.at.nospam.gmail.com
# License: Public Domain
#
import sys

try:
f = open("/etc/mime.types",'r')
extensions = {}
print "mimetype.assign = ("
for line in f:
line = line.strip()
if line.startswith('#'): continue
if line != "":
splitlist = line.split()
if len(splitlist) < 2: continue
mime = splitlist[0]
for ext in splitlist[1:]:
if ext in extensions.keys(): continue
extensions[ext] = 1
print '".%s" => "%s",' % (ext,mime)
f.close()
print ")"
except Exception,e:
print e
sys.exit(1)


include-conf-enabled.py
#!/usr/bin/python
#
# This script directly translate from debian's lighttpd perl script:
# include-conf-enabled.pl
#
# Author: timchen119.at.nospam.gmail.com
# License: Public Domain
#

import os,glob

confdir = "/etc/lighttpd/"
enabled = "conf-enabled/*.conf"

os.chdir(confdir)

for file in sorted(glob.glob(enabled)):
print 'include "%s"' % file

use-ipv6.py
#!/usr/bin/python
#
# This script directly translate from ubuntu's lighttpd perl script:
# use-ipv6.pl
#
# Author: timchen119.at.nospam.gmail.com
# License: Public Domain
#

import socket

##this sometimes not accurate. (like in vserver mode)
#if socket.has_ipv6:
#

try:
if socket.socket(socket.AF_INET6,socket.SOCK_STREAM,0):
print 'server.use-ipv6 = "enable"'
except:
pass

All of these files can be found in http://kalug.linux.org.tw/~tim/lighttpd-debian-python-script/
Well something quite interesting happened when I port the debian's create-mime.assign.pl into python, It's that my python script's final result is not equivalent to perl one and has more mime types than its :
--- perlmime.txt    2008-07-14 15:29:23.000000000 +0800
+++ pymime.txt 2008-07-14 15:29:33.000000000 +0800
@@ -114,6 +114,11 @@
".dvi" => "application/x-dvi",
".rhtml" => "application/x-httpd-eruby",
".flac" => "application/x-flac",
+".pfa" => "application/x-font",
+".pfb" => "application/x-font",
+".gsf" => "application/x-font",
+".pcf" => "application/x-font",
+".pcf.Z" => "application/x-font",
".mm" => "application/x-freemind",
".gnumeric" => "application/x-gnumeric",
".sgf" => "application/x-go-sgf",
@@ -193,6 +198,11 @@
".pk" => "application/x-tex-pk",
".texinfo" => "application/x-texinfo",
".texi" => "application/x-texinfo",
+".~" => "application/x-trash",
+".%" => "application/x-trash",
+".bak" => "application/x-trash",
+".old" => "application/x-trash",
+".sik" => "application/x-trash",
".t" => "application/x-troff",
".tr" => "application/x-troff",
".roff" => "application/x-troff",
@@ -282,6 +292,7 @@
".tgf" => "chemical/x-mdl-tgf",
".mcif" => "chemical/x-mmcif",
".mol2" => "chemical/x-mol2",
+".b" => "chemical/x-molconn-Z",
".gpt" => "chemical/x-mopac-graph",
".mop" => "chemical/x-mopac-input",
".mopcrt" => "chemical/x-mopac-input",

So I start to dig why this happened, and I've found a strange perl regex filter all these mimetypes out, I believe it's a minor bug in original perl program. (or it does implicitly doing something meaningful? well I can't figure it out.)
--- create-mime.assign.pl    2008-07-14 15:35:58.000000000 +0800
+++ create-mime.assign.pl.new 2008-07-14 15:36:07.000000000 +0800
@@ -7,7 +7,7 @@
chomp;
s/\#.*//;
next if /^\w*$/;
- if(/^([a-z0-9\/+-.]+)\s+((?:[a-z0-9.+-]+[ ]?)+)$/) {
+ if(/^([A-Za-z0-9\/+-.~%]+)\s+((?:[A-Za-z0-9.+-~%]+[ ]?)+)$/) {
foreach(split / /, $2) {
# mime.types can have same extension for different
# mime types

replace this line and this will produce same results as mine.

usage:
just copy these py scripts to /usr/share/lighttpd
and change these lines if you're using debian based system
#### external configuration files
## mimetype mapping
#include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/create-mime.assign.py"

## load enabled configuration files,
## read /etc/lighttpd/conf-available/README first
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.py"

星期三, 2月 06, 2008

Am I getting old or ....The lenny is coming this year???

根據 http://lwn.net/Articles/267722/的說法,

下一個版本的 debian (lenny) 將在今年9月release.

這可真是出乎我預期的快... etch... 不是去年四月才出的嗎?

**<小孩勿看>** 大便 難道真的落屎了嗎? **< / 小孩勿看>**

然後話說 /bin/sh link to dash 有了ubuntu帶頭衝之後 還真的debian就跟進了.

我的預言(詛咒)成真?! 看來lloyd大又要怨恨了 :P

(話說 難道再下版inittab也是難逃upstart之手了嗎??? ...有待下回茅房分解...)

這一行果然是很難混的啊.... XD

還有python 2.5.X 啥時要給我進default啊... 時間也該到了吧...

星期一, 4月 09, 2007

Debian 4.0 released...

起床就看到好消息:

http://www.debian.org/News/2007/20070408

"etch" Debian 4.0 released.

(sarge...我終於可以擺脫你了 XD)

老天終於聽到我的呼喊了~~ XD