在公司里面,网络访问都是通过ISA Server的(Microsoft® Internet Security and Acceleration Server),在使用Windows的时候不会出现任何问题,可是前两天装了Ubuntu Linux,遇到了些问题。
我使用firefox访问网络没有问题,只需要设好代理服务器地址,浏览网站时输入相应的用户名和密码即可,但在console下面使用apt-get更新系统时有问题。
开始我觉得应该这样设置代理:
export http_proxy=http://domaindomainuser:password@proxy.corpnet.com:8080
可是总会出现这个错误:
407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )
后来在网上搜索了一下,找到方法解决这个问题了:
Download ntlmaps-0.9.9.0.1 from here
$ tar -zxvf ntlmaps-0.9.9.0.1
$ vim ntlmaps-0.9.9.0.1/server.cfg
Edit PARENT_PROXY,PARENT_PROXY_PORT,USER,PASSWORD to match your preferences, then run main.py
$ ./ntlmaps-0.9.9.0.1/main.py &
$ export http_proxy=”http://127.0.0.1:5865“
$ sudo apt-get update
Now, everything is OK.
reference: http://www.lupaworld.com/912/viewspace_2210.html
webflier i.t.
原文链接已经被墙:http://lightyror.thegiive.net/2007/03/rails-activerecord_15.html
今天要写一个cron script 要用到数据库,因为已经被Active Record 惯坏了,懒得用SQL。所以就花点时间Survey 怎么再Rails 之外使用Active Record。
简单版
1. require 相关的lib
require “rubygems”
require “active_record”
2. 建立DB Connection
ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:username => “root”,
:host => “localhost”,
:password => “secret”,
:database => “plants_db”
)
3. 宣告ActiveRecord Class
class MyClass < ActiveRecord::Base
end
如此就可以开始使用啦。不过如果遇到你必须一次操作多个DB 的情况时,你可以用比较Rails 一点的Config 来写作
加入Config 的用法
1. require 相关的lib
require “rubygems”
require “active_record”
2. 撰写DB 配置文件,我们仿Rails 写一个database.yml
development:
__adapter: mysql
__host: localhost
__username: root
__password:
__database: lala
3. 将配置文件读进来,读到一个$config 变数
$config = YAML.load_file(File.join(File.dirname(__FILE__), ‘database.yml’))
4. 宣告ActiveRecord 对象,记得加上establish_connection
class MyClass < ActiveRecord::Base
establish_connection $config[''development"]
end
5. 开始快快乐乐使用ActiveRecord 吧
webflier i.t.
You could chown the directory /var/run/postgresql/ to the user postgres is
running as. You might need root access for that as well, in case you dont
have it you could ask your sysadmin to do it.
Regards,
Patrick Lindeman
> I’m trying to start my postgres server and it gives me the following
> errror
>
> FATAL: could not create lock file
> “/var/run/postgresql/.s.PGSQL.5432.lock”:
> Permission denied
>
> Now obviously to touch the file that the error message is talking about,
> one
> needs root permission that the user account under which my postmaster is
> runnnig doesn’t have.
>
> Can anyone tell me the fix.
>
> Thanks
>
Powered by ScribeFire.
webflier i.t.
1。下载字体
下载地址:http://www.box.net/shared/lvh50qodvn
2。将字体cp到~/.fonts 或者 /usr/local/share/fonts/ 或者 /usr/share/fonts/
其实放在~/.fonts是最简单的方法。
然后终端执行:
sudo fc-cache -f
3。下载配置文件,将下面的文件下载并解压,将其中的文件都复制到/etc/fonts/下
下载地址:http://www.zflier.com/upload/ubuntu-font-optimize.zip
4。调整字体选项。
系统–》首选项–》字体:
除了等宽字体外全部选择Lucida Grande
字体渲染选择次像素平滑!(这一步是设置应文字体)
5。按ctrl+alt+backspace重启x server,并登录。
此方法在ubuntu 7.10/8.04试用通过,见下图

webflier i.t.
目的: 讓 Windows 成為 sshd server, 作為 ssh tunnel 運用
- 在 Cygwin 設置 sshd service
- 變更 sshd 埠號
- 建立 ssh 認證金鑰免密碼登入
- 在 Cygwin 設置 squid proxy server
- 修正 Too many open files 問題
- 以系統服務方式啟動 squid
- 讓 Cygwin 顯示中文
安裝 Cygwin
至 http://www.cygwin.com/ 下載並安裝 Cygwin 於 c:\cygwin
- 建立 c:\cygwin 目錄
- 將 setup.exe 置入 c:\cygwin
- 執行 setup.exe
- Choose A Download Source → Install from Internet
- Select Root Install Directory → c:\cygwin
Install For → All Users
Default Text File Type → Unix / binary
- Select Local Package Directory → Local Package Directory: c:\cygwin
- Select Your Internet Connection → Direct Connection
- Choose A Download Site → ftp://ftp.nctu.edu.tw 或 ftp://ftp.ntu.edu.tw
本篇所使用的 Package:
- Admin → cygrunsrv
- Net → openssh
- Web → squid
設置 sshd service
啟用 sshd
ssh-host-config
Should privilege separation be used? (yes/no) no
Do you want to install sshd as service? (yes/no) yes
CYGWIN= (直接按 Enter 鍵接受預設值 "ntsec")
cygrunsrv –start sshd 啟動 sshd 服務
將 sshd 預設 tcp 22 port 變更成其他埠號的方法
cd /etc
notepad sshd_config → 將 Port 22 改成 Port 80
cygrunsrv –stop sshd && cygrunsrv –start sshd 重新啟動 sshd service
若 /etc/sshd_config 的 owner 是 system, 須先變更 owner: chown $USER sshd_config 才能編輯 sshd_config. 修改完後記得將 owner 回復為 system: chown system sshd_config, 最後再重新啟動 sshd service 即可
調整 Windows 防火牆設定
控制台 → Windows 防火牆 → 例外 → 新增連接埠
名稱: cygwin-sshd (或其他自己喜歡的名稱), 連接埠編號: 22 (TCP) (若已改成 80 port, 就填入 80)
如要限制連入 sshd 的來源 IP, 可另外加裝 tcp_wrappers package (在 Net 類別裡)
以 ssh 認證金鑰進行連線
適用情況:
- 連線時不想輸入密碼
- 安裝 Cygwin 的那台電腦, Windows 帳號沒有密碼
ssh-keygen -t rsa 過程皆按 Enter (ssh-user-config 亦可建立金鑰)
cd ~/.ssh
mv id_rsa.pub authorized_keys 將 public key 更名為 authorized_key
將 id_rsa (private key) 複製到想以 ssh 連入 Cygwin 的電腦 (client), 使用 puttygen.exe 將 id_rsa 轉成 PuTTY Private Key File:
- 執行 puttygen.exe
- 點選 File → Load private key (剛剛的 id_rsa 檔案)
- 載入後點選 Save private key, 另存成副檔名為 .ppk 的檔案
Client 使用 PuTTY, 以 ssh protocol 連入 Cygwin sshd 時, 點選 Connection → SSH → Auth → Private key file for authentication: Browser 載入剛剛存好的 .ppk 檔, 再進行 ssh 連線, 輸入帳號後即可登入.
也就是說, Cygwin + sshd 這台電腦 (server), 保留 public key 在 $HOME/.ssh/authorized_key
其他想使用 PuTTY 以 ssh 連入 Cygwin + sshd 的電腦 (client), 連線時載入 .ppk (private key) 檔案
為 Cygwin 帳號設置密碼
passwd
- 效用等同在控制台設定 Windows 使用者密碼
- 密碼設置後, 下次開機進入 Windows 時, 系統會詢問密碼
- 若想開機直接登入桌面, 請參考: 關於 Windows XP 的三個備忘
- 若已完成直接登入的設置, 但又變更密碼時的處理:
- 密碼變更後, 立即執行 control userpasswords2 (Win 2000 沒有最後的 "2")
- 先勾選「必須輸入使用者名稱和密碼,才能使用這台電腦」
- 再點選預設登入帳號
- 最後再取消勾選「必須輸入使用者名稱和密碼,才能使用這台電腦」
- 按「確定」後, 系統就會再詢問一次密碼, 此時輸入剛剛變更的密碼即可
转载自http://cha.homeip.net/blog/archives/2006/04/_winxp_cygwin_s.html
webflier i.t.
Recent Comments