Stuart ONE

我有一头小毛驴,我从来也不骑……

 

How to mount a folder from other samba server

$ mkdir t
$ mount -t smbfs //192.168.0.152/share t

here the //192.168.0.152/share is the folder path of the samba server.

posted @ 2006-02-07 13:25 Stuart 阅读(217) | 评论 (0)编辑 收藏

How to connect to a postgresql server from client in Debian

Im using the postgresql 8.0 here:

1. Modifiy the file: /etc/postgresql/8.0/main/pg_hba.conf
    add a line below the "# IPv4 local connections:"
host    all         all         192.168.0.0/24        md5

2. Modify the file: /etc/postgresql/8.0/main/postgresql.conf
    set the Connection Settings like below:
- Connection Settings -

listen_addresses 
= '*'  # what IP interface(s) to listen on;
                                # defaults 
to localhost, '*' = any
port 
= 5432
max_connections 
= 100

3. Restart the postgresql 8.0

4. Now we can connect to postgresql server using clients.
    for eg.
    psql -d DBNAME -U USERNAME -h HOST

posted @ 2006-01-19 14:47 Stuart 阅读(317) | 评论 (0)编辑 收藏

How to highlight all the search result in vim

Add the "set hlsearch" in the .vimrc

posted @ 2005-12-30 13:31 Stuart 阅读(298) | 评论 (0)编辑 收藏

放弃了csdn的blog,把一些以前记录东西一起搬过来

  • reinstall grub

    用启动盘进入LINUX,chroot ur linux partition, and then:
    #grub
    root (hd0,0)
    setup (hd0)
    quit


    注意root 、setup后面有空格(grub里的分区硬盘号码都要相应-1)

    其实本来可以直接用grub-install来安装的。。。但是不知道为什么我的机器这样装不上,只能用上面的方法恢复GRUB
  • Connect the printer in Debian OS using cupsys

    1.sudo apt-get install cupsys cupsys-bsd cupsys-client cupsys-driver-gimpprint cupsomatic-ppd

    2.sudo /etc/init.d/cupsys start

    3.http://localhost:631 -set ur printer
  • About Disk mount

    来由:ext3 的分区被系统挂载 30 次后,操作系统在启动的时候将自动对分区进行磁盘检查。那么,怎么查看被挂载了多少次,怎么调整分区的自动检查间隔次数?

    dumpe2fs -h 分区名
    -可以看到 Mount count: 计数选项。可以看到分区被挂载的次数。

    用 tune2fs -l 分区名
    -也可以看到。


    这两个命令都可以跟很多参数,可以多看看。调整这里就不提了。

posted @ 2005-11-08 13:30 Stuart 阅读(188) | 评论 (0)编辑 收藏

Postgresql 8.0

记录一下昨天配置postgresql8.0的经过:
1. Add an apt soucelist :
deb http://sebastien.lardiere.free.fr/ ./postgresql8-i386/
2. Install the postgres 8.0
$apt-get update
$apt-get install postgresql-8.0
3. Now u can connect to postgres using:(template1 is the database name, postgres is the username)
sudo su postgres psql template1
4. Add a user of ur own:(-W means prompt for password to connect)
$sudo su postgres
$createuser username -W
(decide whether this user can add new user and create database by input y/n to the questions)
$exit
5. Now u can login with ur newly created username and password using:
$psql -U username -h localhost -d dbname
(then u should input the password that u set when u created this user)
6. Configuration File:
/etc/postgresql/8.0/main/pg_hba.conf
7. Postgres commands:
\h --help with SQL commands
\? --help with psql commands
\q --quit
\c dbname --connect to new database
\d{t|i|s|v|S} --list tables/indexes/sequences/views/system tables (add "+" for more detail)
\du --list users
\l --list all databases(add "+" for more detail)

posted @ 2005-11-08 13:27 Stuart 阅读(196) | 评论 (0)编辑 收藏

Compile Kernel 2.6.14 on Debian

I have been compiling the 2.6.14 kernel these days with help of Anthony. Here are the main steps:
1. cp /boot/config* kernel-source-dir/.config
follow the step of /usr/share/doc/kernel-pakage/readme.gz

2. make menuconfig(now u have to set it according to ur machine)

3. fakeroot make-kpkg --append-to-version "-x10plus" --revision="1" kernel_image
(u can make-kpkg clean first if u have already compiled once before, and the "x10plus" is my laptop)

4. then a deb file will generated in the ../ directory
dpkg -i *.deb
That's all.

posted @ 2005-11-08 13:26 Stuart 阅读(237) | 评论 (0)编辑 收藏

Netbeans IDE 5.0 beta

公司最近在开发一个JAVA Swing的c/s系统,用JAVA做c/s系统的比较少,在此记录我的点滴收获。
(现在只是完成了UI的大体设计。事件没写,数据库也没有连。)

一.Introducing netbeans 5.0 beta
采用的IDE是SUN的Netbeans 5.0 beta。完全免费:)

-matisse
我想最重要的一个新特征应该是新加入的free design,这是一个完全可以自定义的layout,使用起来非常方便。但是,这个Layout也非常不稳定,经常会出错,这点在下面会详细说明。
-Internationalization
这个在以前的版本里也有,我认为这是一个非常方便的I18N工具。后面也会详细说明。

更多的特征可以查看netbeans的网站上关于5.0新特征的说明。


二.Compare to the Eclipse platform, i think netbeans is easier for u to create a UI program
跟Eclipse相比,我认为Netbeans更易于编写UI程序,他的UI设计更方便。(不过我不喜欢Netbeans的界面,还是觉得Eclipse更清新)
当然,在Eclipse里也有很多插件可以设计UI,但是很多好的插件是要钱的,公司可不能用:),比如我觉得Jigloo就不错。

三.步步精简
首先,在开发的最开始我们狂用Free Design,当时觉得真是方便阿,跟以前用4.1的时候用GridBagLayout慢慢调不可同日而语,开发速度大大提升。
接 下来发现问题了,用Free Design生成的代码非常多,而且很乱,更要命的是有的时候在编辑UI的时候,拖拽控件会发生错误,很是烦人。(其实我觉得有的时候虽然会发生错误,但 是只要耐心的多调整一下,也是可以实现的)。另外一个问题是,是用Free Design需要单独另外引入一个jar包,没有包含在jdk5.0里。于是领导同志发话了,为了避免各方面麻烦,我们不用Free Design了,还是改成用GridBagLayout。(我想sun在以后的版本里可得好好调整一下这个Free Desing了,这可是一个非常方便的layout阿,以后如果能做到象vb一样那么方便,那可是有革命性滴,hehe)
我其实特别没耐心,非常 不愿意用GridBagLayout,但是没办法阿,于是乖乖地用了。不过慢慢的发现GridBagLayout也非常方便,而且 当你运行后,拖拽窗口不会影响里面控件的位置。另外生成的代码很整齐,也精简了不少。不错!(他的缺点就是可设置的参数太多了,如果不用IDE要一次次的 自己运行程序来看效果慢慢调)
接下来问题又来了,我们程序的主窗口左边是一个Jtree,通过点击右边显示相应的内容。所以我们要将做好的 Dialog放到一个主窗口的右 边的Panel里,而且里面的控件(比如说表格)要随着主窗口的拖放变化大小,可是在gridbaglayout里我们都把大小钉死了。领导同志又想出好 主意了:简化layout,尽量用简单的layout,比如borderlayout, flowlayout等,然后将一个Panel分为好几个Panel,将主panel设为borderlayout或者其他,依情况而定。这些 layout虽然可调控性不强,但是代码很简单;另外便于以后调整。例如我们的一堆button本来是在页面下方的,想要调整到上方去,那么如果是以前的 gridbaglayout,那么要调好久。现在,只用简单的设置borderlayout就可以了,可以将下方的panel位置设为north,然后把 上方的panel设为south就可以了,这样其实根本不用IDE,直接改代码就可以。
进行这次调整后,当托放主窗口时,表格的大小也随之改变了。就我看来,borderlayout好像只有中间位置,即center位置的panel才能随 着窗口拖放变化,所以我们把表格都是放在center位置的Panel里的,不知道是不是这样设计的。

从开发过程的三次调整中,我发现,其实用Java Swing编程,真正牛的还是直接用代码来编!精简的才是最好滴。

四. Problems we met and our solution:
1.我们要做中文和英文两个版本,how?
这 里我们就用到了前面提到的internationalization,首先在某个package里新建一个properties文件(在others那 个里面)。在这个properties文件里可以添加各种locale,我们在这里只添加zh_CN,另外的一个自动建立的 default.language。建立完成后,先在某个Dialog的编辑状态下,点击上面的tools-> internationalization->internationalize,在弹出的对话框里选择刚才建立的properties文件,系统 会自动搜索你的文本区域,并且命名好这个key,你在下面填入key值就可以了。这是填入的key值是default language的,接下来可以右键点击建立好的properties文件,选择open,这时可以看到你所建立的几种locale都列出来了,直接在这 里翻译吧,系统会自动将中文转成UTF-8码。这样做完后,启动程序时会根据不同的locale显示不同的文字,哈哈:)爽~
几点补充说明:
1) 选择tools->internationalization->internationalize自动搜索文本区域时,会经常找不到所 有的文本区域,可以关掉重新再找。往往这样还是不行,这时候就要手动改了,自己去看看生成的代码吧。还可以直接选择properties栏里text后面 的按钮,在下拉框选择resourcebundle,然后也可以填写。选择还是很多滴。
2)例如JTable里的文字,你可以选择 properties里的model后面的按钮,选择From Connection,选择user code自己写代码。“java.util.ResourceBundle.getBundle("YourPropertiesFileName"). getString("KeyNameInPropertiesFile"))”
2.日期选择
某些Dialog里面要选择日期,所以需要做一个日期选择框dateSelector。开源的好处体现出来了,从sourceforge上面找了一个叫JCalendar的项目,直接用上,呵呵。(不过要注意说明copyright哦!)
3.Jtable的Title双行显示(不是用html实现)
Jtable 的确不太好调整,自己写代码编仿彿又很麻烦。比如我就碰到了表格内容很多,这个时候就需要将有些Title双行显示,才能显得美观。虽然 jdk5.0支持html,但是领导建议不要用,那就不用把,在Java CodeGuru上找到了个类MultiLineHeaderRenderer,放在工具包里,直接调用就可以了,呵呵(同样注意标明出处)。另外,在 JavaGuru上还有跨行Title的类,不过我们没有用。(http: //www.codeguru.com/java/articles/126.shtml,另外还有RowHeader的类http: //www.codeguru.com/java/articles/127.shtml)

其实还有很多碰到的难点,通过上网查资料和自己摸索,都解决了,有问题就google吧:)

五.Some skills of netbeans
netbeans的技巧有很多,我就不在这多说了,说几个我觉得比较有用的:
Ctrl+Shift+F 自动引入需要的包
Ctrl+Space or Ctrl+\ 出提示输入
Ctrl+Shift+Space show javadoc dialog
进行重命名时,用Refector, 会自动修改所有相关的地方

六. Concluding
算起来从接触netbeans到现在UI的设计基本完成,还不到一个月的时间,还有很多不足之处,大家多多指教。

posted @ 2005-11-08 13:09 Stuart 阅读(1100) | 评论 (1)编辑 收藏

I created this blog today

Just a test

posted @ 2005-11-08 13:06 Stuart 阅读(109) | 评论 (0)编辑 收藏

仅列出标题
共2页: 上一页 1 2 

导航

统计

公告

常用链接

留言簿(3)

随笔分类

随笔档案

文章分类

相册

BlogRoll

Tech websites

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜