一般ubuntu server在安装的时候,都会在ui中让你输入vip地址和网关dns等信息。

一般搬迁服务器的时候,都会重新配置服务器的ip信息。那么,在shell下怎么修改呢。今天,正好给宠物导航搬迁服务器,顺便整理记录一下。

打开/etc/network/interfaces,如果没有配置过ip,比如安装过程中跳过,则会看到

auth lo
iface lo inet loopback

如果,已经配置过,会看到类似如下的eth0 或 eth1配置

#from iu1u.com
auth eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-nameservers 202.106.0.20

修改其中的信息为自己的,修改dns还要同时修改/etc/resolv.conf文件里面的dns地址。

然后重启机器,或者执行命令sudo /etc/init.d/networking restart,刷新网络接口信息即可。

Posted in 未分类 at 04月 27th, 2009. 1 Comment.

url编码:$str =~ s/([^A-Za-z0-9])/sprintf(”%%%02X”, ord($1))/seg;

这样编码以后,就可以放到网址中了,如:<a ref=”page_given_string.php?str=$str”>LINK</a>

对应的url解码:$str =~ s/\%([A-Fa-f0-9]{2})/pack(’C', hex($1))/seg;

看到perl正则的强大威力了吧

Posted in 未分类 at 04月 19th, 2009. 1 Comment.

注:www.iu1u.com 原创,转载请保留出处,谢谢!

心血来潮,玩起Perl。为了方便,先试试windows版的,activePerl。

尝试连接mysql时遇到麻烦,mysql接口竟然没有默认安装。照了些资料,大部分资料的方法已经过期了,所以重新整理一下。

1. %perl%/bin/perl ppm-shell 出来ppm命令行,ppm是perl下的程序包管理器,应该是perl packages manager。windows下直接运行ppm,或者perl ppm,都会调出GUI的ppm,不如command line 好用。

2. perl ppm-shell install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd 找个好用的源不容易,DBI一般默认安装了,所以直接安装DBD-mysql即可。

3. 再试一下,可以连接mysql了。

 

Posted in 开发手记 at 04月 18th, 2009. No Comments.

1. 新建一个view based的项目

2. 在info.plist中增加一项:

<key>UIInterfaceOrientation</key>

<string>UIInterfaceOrientationLandscapeRight</string>

3. View- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    // Return YES for supported orientations

    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

}

4. 在interface builder中,点选窗口右上角的旋转图标,把窗口视图转成水平的。

做完第二步,预览程序状态栏已经是横屏的了,不过,坐标还不是。第三步的代码加上就好了。

Posted in iphone开发 at 04月 14th, 2009. No Comments.