Thursday, 22 November 2007

Wine Review: DirectX 9.0c on Linux with Wine

Microsoft DirectX is a collection of application programming interfaces for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with Direct, such as Direct3D, DirectDraw, DirectMusic, DirectPlay, DirectSound, and so forth. DirectX, then, was the generic term for all of these Direct-something APIs, and that term became the name of the collection. Over the intervening years, some of these APIs have been deprecated and replaced, so that this naming convention is no longer absolute. In fact, the X has caught on to the point that it has replaced Direct as the common part in the names of new DirectX technologies, including XAct, XInput, and so forth.

Direct3D (the 3D graphics API within DirectX) is widely used in the development of computer games for Microsoft Windows, Microsoft Xbox, and Microsoft Xbox 360. Direct3D is also used by other software applications for visualization and graphics tasks, most notably among the engineering sector for CAD/CAM, because of its ability to quickly render high-quality 3D graphics using DirectX-compatible graphics hardware. As Direct3D is the most widely recognized API in DirectX, it is not uncommon to see the name DirectX used in place of Direct3D.

Wine configuration

This is with a clean configuration directory and running in a 1024x768 virtual desktop.

$ winecfg

Once the .wine directory is built the configuration tool will start and you can set a virtual desktop in the graphics tab if you wish. This is a good time to also set your Audio driver in the Audio tab.

next up is to install a native mscoree.dll and streamci.dll into /system32 from a windows install and set then to native Windows.

Go to ~/.wine/drive_c/windows/system32 and rename d3d8, d3d9, ddraw, dsound, dsound.vxd, quartz dlls to *.bak

You will need to set a large number of dlls to native for the install to work properly. Here is the full list of dlls that need to be set.

"d3d8"="native"
"d3d9"="native"
"d3dim"="native"
"d3drm"="native"
"d3dx8"="native"
"d3dxof"="native"
"dciman32"="native"
"ddrawex"="native"
"devenum"="native"
"dinput"="native"
"dinput8"="native"
"dmband"="native"
"dmcompos"="native"
"dmime"="native"
"dmloader"="native"
"dmscript"="native"
"dmstyle"="native"
"dmsynth"="native"
"dmusic"="native"
"dplay"="native"
"dplayx"="native"
"dpnaddr"="native"
"dpnet"="native"
"dpnhpast"="native"
"dswave"="native"
"dxdiagn"="native"
"mscoree"="native"
"quartz"="native"
"streamci"="native"


Installing Directx

Download DirectX 9.0c November release from here.

The directx_nov2007_redist.exe executable will extract the installer files to a directory of your choice.

tom@tuxonfire ~ $ wine directx_nov2007_redist.exe
fixme:advapi:DecryptFileA "z:\\home\\tom\\directx-9\\" 00000000
fixme:midi:OSS_MidiInit Synthesizer supports MIDI in. Not yet supported.
tom@tuxonfire ~ $






Now cd to the directory where you choose to extract the DirectX installer and run DXSETUP.EXE.

tom@tuxonfire ~ $ cd /home/tom/directx-9
tom@tuxonfire ~/directx-9 $ wine DXSETUP.EXE
fixme:midi:OSS_MidiInit Synthesizer supports MIDI in. Not yet supported.








Run winecfg again and set d3d8, d3d9, ddrawex, dinut, dinput8 to builtin wine.

Now lets run dxdiag.exe

tom@tuxonfire ~/directx-9 $ cd /home/tom/.wine/drive_c/windows/system32
tom@tuxonfire ~/.wine/drive_c/windows/system32 $ wine dxdiag.exe
fixme:ole:CoInitializeSecurity ((nil),-1,(nil),(nil),1,3,(nil),0,(nil)) - stub!








We can now test ddraw, ddraw 3D, D3D8, and D3D9















Direct Sound test:



Now we need to install gm.dls to test Direct Music, this driver file goes into ~/.wine/drive_c/windows/system32/drivers



Direct Play test:



You will notice in system32 d3dx9_24.dll up to d3dx9_36.dll is now installed, this really helps when you run into a game that needs these additional DirectX dlls.

Now you have the option to run most DirectX dlls in native or builtin mode, for example if you have a game that's crashing on the builtin Wine quartz.dll you can test the game with the native Windows dll to see if this will improve the situation.

Keep in mind d3d8, d3d9, ddraw will only work as builtin, and in most cases you should try to use builtin dsound and dinput. I have had limited success with (dsound and dinput) in native Windows mode btw... The reason why these dlls have to be used in builtin mode is there need for direct access to your hardware. direct music and direct play can be used in native windows mode in most circumstances.

Feel free to comment about this post at the wine-forum.

Blogged with Flock

Wednesday, 21 November 2007

flash animation in Flash IDE


To download the full version visit vuze.com

养宠物的要小心啊

http://v.blog.sohu.com/u/vw/393604

Mozilla Labs Blog » Blog Archive » Prism

Personal computing is currently in a state of transition. While traditionally users have interacted mostly with desktop applications, more and more of them are using web applications. But the latter often fit awkwardly into the document-centric interface of web browsers. And they are surrounded with controls–like back and forward buttons and a location bar–that have nothing to do with interacting with the application itself.

Transition550

Mozilla Labs is launching a series of experiments to bridge the divide in the user experience between web applications and desktop apps and to explore new usability models as the line between traditional desktop and new web applications continues to blur.

Unlike Adobe AIR and Microsoft Silverlight, we’re not building a proprietary platform to replace the web. We think the web is a powerful and open platform for this sort of innovation, so our goal is to identify and facilitate the development of enhancements that bring the advantages of desktop apps to the web platform.

The first of these experiments is based on Webrunner, which we’ve moved into the Mozilla Labs code repository and renamed to Prism.

Prism

Prismlogo400

Prism is an application that lets users split web applications out of their browser and run them directly on their desktop.

Refracting550

Prism lets users add their favorite web apps to their desktop environment:

Startmenu550

When invoked, these applications run in their own window:

Googlecalendar550

They are accessible with Control-Tab, Command-Tab, and Exposé, just like desktop apps. And users can still access these same applications from any web browser when they are away from their own computers.

The Best of Both Worlds

Prism isn’t a new platform, it’s simply the web platform integrated into the desktop experience. Web developers don’t have to target it separately, because any application that can run in a modern standards-compliant web browser can run in Prism. Prism is built on Firefox, so it supports rich internet technologies like HTML, JavaScript, CSS, and <canvas> and runs on Windows, Mac OS X, and Linux.

And while Prism focuses on how web apps can integrate into the desktop experience, we’re also working to increase the capabilities of those apps by adding functionality to the Web itself, such as providing support for offline data storage and access to 3D graphics hardware.

Comparison550

The User Experience

We’re also thinking about how to better integrate Prism with Firefox, enabling one-click “make this a desktop app” functionality that preserves a user’s preferences, saved passwords, cookies, add-ons, and customizations. Ideally you shouldn’t even have to download Prism, it should just be built into your browser.

Prismui

We’re working on an extension for Firefox that provides some of this functionality. For more information about the user experience we hope to achieve in Prism, see Alex Faaborg’s blog post. For some of the technical details and new features found in Prism, see Mark Finkle’s blog post.

Getting Started with Prism

We have an early prototype for this working today on Windows, with work continuing on Mac and Linux (for which we should have builds available soon).

To try out the prototype, download and install it: Download Prism for Windows.

Then start Prism. It will display an Install Web Application dialog.

Prism08500

Enter the URL of the application you want to use in Prism (e.g. mail.google.com), a name for the application (e.g. Gmail), and pick where you’d like to create shortcuts to the application.

Then press the OK button. Prism will create shortcuts to the application in the locations you specified and then start the application.

How to Get Involved

Prism is just the first of many experiments we hope to conduct around improving the usability of web applications. It’s open source, like everything we do, and we’re interested in hearing from and working with anyone interested in further developing this concept.

  • Discuss, debate and add to the design in the forum. Report bugs in Bugzilla.
  • Get the source code, extend it, fix bugs and/or submit patches.

    The project lead for Prism is Mark Finkle and contributors include Cesar Oliveira, Wladimir Palant, Sylvain Pasche, Alex Faaborg, and Myk Melez.

Blogged with Flock

关于Linux操作系统下C语言编程的注意事项



关于Linux操作系统下C语言编程的注意事项 — IT技术 - 赛迪网
一、工具的使用

  
1、学会使用vim/emacs,vim/emacs是linux下最常用的源码编辑具,不光要学会用它们编辑源码,还要学会用它们进行查找、定位、替换等。新手的话推荐使用vim,这也是我目前使用的文本编辑器。

  
2、学会makefile文件的编写规则,并结合使用工具aclocal、autoconf和automake生成makefile文件。

  
3、掌握gcc和gdb的基本用法。掌握gcc的用法对于构建一个软件包很有益处,当软件包包含的文件比较多的时候,你还能用gcc把它手动编译出来,你就会对软件包中各个文件间的依赖关系有一个清晰的了解。

  
4、掌握svn/cvs的基本用法。这是linux,也是开源社区最常用的版本管理系统。可以去试着参加sourceforge上的一些开源项目。

  

二、linux/unix系统调用与标准C库

  系统调用应用软件与操作系统的接口,其重要性自然不用说,一定要掌握。推荐学习资料为steven先生的UNIX环境高级编程(简称APUE)。

  

三、库的学习

  无论是在哪个平台做软件开发,对于库的学习都很重要,linux下的开发库很多,我主要介绍一下我常常用到的一些库。

  
1、glib库

  glib 库是gtk+和gnome的基础库,并具是跨平台的,在linux、unix和windows下都可以用。glib库对于linux平台开发的影响就像 MFC对windows平台开发的影响一样,很多开源项目都大量的使用了glib库,包括gimp、gnome、gaim、evolution和 linux下的集群软件heartbeat。因为glib库自带有基本的数据结构实现,所以在学习glib库的时候可以顺便学习一下基本的数据结构(包括链表、树、队列和hash表)。

  
2、libxml库

  libxml是linux平台下解析XML文件的一个基础库,现在很多实用软件都用XML格式的配置文件,所以也有必要学习一下。

  
3、readline库

  readline 库是bash shell用的库,如果要开发命令行程序,那么使用readline库可以减少很多工作量,比如bash里的命令行自动补全,在readline里就已经有实现,当然你也可以用自己的实现替代库的行为。readline库有很多网站介绍的,只要google一下readline就可以找到一堆了。

  
4、curses库

  curses 库以前是vi程序的一部分,后来从vi里提取出来成为一个独立的库。curses库对于编写终端相关的程序特别有用,比如要在终端某一行某一列定位输出,改变终端字体的颜色和终端模式。linux下的curses库用的是GNU实现的ncurses(new curses的意思)。  
5、gtk+和KDE库

  这两个库是开发GUI应用程序的基础库,现在linux下的大部份GUI程序都是基于这两个库开发的,对于它们 的学习也是很有必要的。

  

四、网络的学习

  网络这个东西太宽了,推荐学习资料steven先生的UNIX网络编程(简称UNP)和TCP/IP协议详解,更进一步的话可以学习使用libnet编写网络程序


Powered by ScribeFire.

Monday, 19 November 2007

Windows Network Trafic Management (to be contiuned and commented)

In windows to show the network trafic:
netsh interface ipv4 show subinterfaces


Blogged with Flock

gMOVE series

Google has recently updated the migration tools from Google Apps to "move email from anywhere – not just IMAP systems – to the Premier, Education or Partner Editions of Google Apps." An example of solution that uses the API is gMOVE from LimitNone, a tool that migrates your email, contacts and calendars from Outlook to Google Apps. gMOVE also migrates the tasks from Outlook to an iGoogle gadget.

The tool costs $19 and it works with any Google Apps account. If you post an insightful comment that explains why do you want to migrate from Outlook to Google Apps, you could get gMOVE for free. Don't forget to include your email address so I can contact you.

LimitNone also has a free tool that lets you move from a Gmail account to another Gmail account or to Google Apps: it transfers your messages, filters, contacts and calendar events.


Blogged with Flock

Sunday, 18 November 2007

用移动硬盘代替DVD光盘安装Vista

没有DVD刻录机的朋友,又想安装单系统的Vista,就可以将安装文件放在移动硬盘上,,从移动硬盘启动计算机来安装Vista了!这样安装的效果和从光盘引导安装是一样的。

  1.在XP下将一个空间足够的移动硬盘分区激活(在计算机治理的"磁盘治理"中,右键单击需要的分区,选择"将磁盘分区标为活动的");

  2.用DaemonToolsT将光盘中所有文件复制到移动硬盘;

  3.在XP的命令提示符状态下运行 X:\boot\bootsect /nt60 x: (X即移动硬盘分区盘符)这一步是让移动硬盘成为可引导分区

  4.重启电脑,在CMOS设置里将第一引导设置为USB引导;

  5.用移动硬盘顺利引导,开始安装Vista。这个过程与光盘安装是一样的,可以格式化您的C盘,安装为单系统。

Blogged with Flock

Welcome to Firebug 1.0

Blogged with Flock

Maintainable JavaScript


Blogged with Flock

JavaScript Video Tutorial III 3

Blogged with Flock

JavaScript Video Tutorial III 2

Blogged with Flock

JavaScript Video Tutorial III 1

Blogged with Flock

UntitledJavaScript Video Tutorial II 3

Blogged with Flock

JavaScript Video Tutorial II 2

Blogged with Flock

JavaScript Video Tutorial II 1

Blogged with Flock

JavaScript Video Tutorial 4

Blogged with Flock

JavaScript Video Tutorial 3

Blogged with Flock

JavaScript Video Tutorial 2

Blogged with Flock

JavaScript Video Tutorial 1

Blogged with Flock

Saturday, 17 November 2007

ati graphical driver 8.42 fglrx for Ubuntu linux

If anything wrong, run this command to recover your graphics configuration:
sudo dpkg-reconfigure xserver-xorg
####################################################
Hello everyone, I have a little guide I cooked up, which is basically a modified version of Forlongs guide. I had some trouble getting this all to work, so I decided I would try to help others who may have had some of the problems I was encountering, like a white screen, low graphics, exct. This guide was intended for a fresh install of Gutsy on a 32 bit system, and will work, Ill post the pix to verify my properly working installation. I gotta say that Ive had great success using this driver, glxgears = 5000fps, compiz fusion = 300+fps, nice and smooth 3d & 2d, some video playback trouble, but I found temporarily disabling compiz fusion fixed that problem. So anyways, I hope this helps some of you out.




1. Remove the old driver (if present)

Go to System → Administration → Restricted Drivers Manager and choose disable.

Or remove it yourself:

sudo apt-get remove xorg-driver-fglrx




2. Blacklist old fglrx module:

sudo gedit /etc/default/linux-restricted-modules-common

And insert fglrx - it should look like this then:

DISABLED_MODULES="fglrx"





3. Reboot now.




4. Download the driver installer to your home folder

http://www2.ati.com/drivers/linux/at...x86.x86_64.run




5. Install necessary packages (to make Debian packages out of the driver, you will need you gutsy installation disc for this.)

sudo apt-get install module-assistant build-essential fakeroot dh-make debhelper debconf libstdc++5 linux-headers-generic




6. Create .deb packages

bash ./ati-driver-installer-8.42.3-x86.x86_64.run --buildpkg Ubuntu/gutsy




7. Install .deb packages

sudo dpkg -i fglrx-kernel-source_8.42.3-1_i386.deb xorg-driver-fglrx_8.42.3-1_i386.deb



8. Compile kernel module

sudo m-a prepare,update

sudo m-a build,install fglrx-kernel

sudo depmod




9. Time for the initial configuration of fglrx.

sudo aticonfig --initial --force

sudo aticonfig --overlay-type=Xv




10. Configure the driver (If needed, which it wont be on a fresh install)

sudo gedit /etc/X11/xorg.conf


Make sure "fglrx" is set for the Driver in the Section "Device".

And if present, remove:

Section "Extensions"

Option "Composite" "0" # or "Disable"

EndSection

As well as

Section "ServerFlags"

Option "AIGLX" "off"

EndSection



11. Now you need to modify your Whitelist for Compiz Fusion

sudo gedit /etc/xdg/compiz/compiz-manager


Once that opens up add this under the last line:

WHITELIST="nvidia intel ati radeon i810 fglrx"



12. CONGRATZ!! You should be gold now, lol, as a recomended option though I would go into Synaptic Package Manager and install:
"compizconfig-settings-manager"
which will give you all the compiz fusion options we all thirst for!!!










Thursday, 15 November 2007

Howto Setup SMB Server using NTFS partitions on Ubuntu

In GNOME, there is no configure tools like "kdenetwork-filesharing" in KDE, which will automatically add an option 'msdfs proxy = no', this made your folders can not be accessed properly within your workgroup. Maybe this is a bug or a carelessness, but just like KDE, too many bugs, it's ok, I am used to it. Each time I install Linux distro with KDE, I must install some Gnome programs to make the programs installation job done without keep facing KDE's crash.
Actually in Gnome such a tool is not necessary, Gnome is simple and seamlessly works together with (almost) all the service. SYSTEM-ADMINISTRATION-SHARED FOLDERS is the right place to configure you samba server simply. Although too few stuff there, but these are the essential part. If you prefer expert mode, why not use vi to modify /etc/samba/smb.conf, gui tools is just for beginners and lazy peoples like me.

Why I select Ubuntu. At beginning, I tried Opensuse, the default setting doesn't show Chinese characters properly, and the essential problem is that the default setting for mount NTFS partitions is not writeable. So I gave it up. Forgiving me don't want to spend time on to learn how to change fonts and mount options. I prefer more human being friendly default setting, like Ubuntu.

  1. To share files (here what I want to shared is the folders from NTFS partitions)
    For security reason, I prefer add some password for my server, the samba default setting doesn't allow guest access as well.
    In this case, you should use 'sudo smbpasswd -a user' to add user and password. Here the user added must exist in the server system users database, otherwise, error message of "Failed to modify password entry for user" will come out.

    • Folders from NTFS partitions are shared

      1. the partition is automatically mounted from /etc/fstabs
      Although when you shared folders from nautilus, there are some error messages telling you access denied stuff, but it doesn't matter, the Windows will access it properly. But Linux client can not do this.
      Because the access permission is just for the root, while not you. Linux box do the permission check more than the Windows boxes.
      2. the partition is mounted by you after boot from MY COMPUTER
      In this case, there will not any error messages when you share the folders from Nautilus. And Windows, Linux clients can access it very well. Because this time the access permission is for the current user,you. But this is not suitable for files-sharing server.

      The solution is 1). For Windows clients it works well. For Linux clients this job can be done by 'mount -t smbfs -o username=yourusername,password=youruserpassword //server/dir /mnt/folder'. Here smbfs is need to be installed.

    • Whole NTFS partition is shared
      Just share it. It works well for Windows and Linux clients. But the flexibility is limited, you can not specify folders to share.

  2. Printer Server

    In Gnome, the samba configure tool is still not necessary. Normally the printers in the SYSTEM-ADMINISTRATION-PRINTING will be added to smb server, except bugs exist.
    my HP LaserJet 2200 with usb cable can be founded by Ubuntu automatically and works locally. But from the client machines, the printer is invisible. While the HP Deskjet 1220C can work well both local and client machines.
    The reason is the Gnome auto founded driver is not so correct, although it's ok for local. Here I use 'kcontrol' to add the printer, in kcontrol this is one driver select option "usb port", with this option everything works well.

    Maybe this is a bug for Gnome system-config-printer, where is no option for the usb port, just list some printers the ubuntu founded, and some specific port. Just no usb port, but just the auto founded usb printer is not correct.

Wednesday, 14 November 2007

Japanese Human Art

Blogged with Flock

Fedora 8 vs OpenSuSE 10.3 vs Ubuntu 7.10

Fedora 8, OpenSuSE 10.3, Ubuntu 7.10 之对比

对于linux的了解和关注一直都是围绕着这三个distro的。这次做了一个print server,也借机做了一番对比。

打印机:HP LaserJet 2200黑白打印机(USB),HP DeskJet 1220C彩色打印机(parallel port)。
电脑:我用了实验室里很烂的一台电脑,本打算扔掉,我就废物利用一下,跑windows慢,那就跑linux的text mode总可以的。这台古董有两块显卡,一个nvida,一个ati的,这两个都不是linux下比较容易驱动上的。256M内存,PII的cpu,16M显存...

1.fedora 8(KDE)。我先用的这个。
安装过程:live CD就不行,说是找不到显卡,于是用fedora设置显卡的命令system-config-display,它自己折腾一会,跳出一个graphyical的窗口,让我选显卡驱动,选了vesa,便进入了live CD的KDE环境,于是正常安装。copy files之类的活过后,本应该重启然后进行一些简单的设置,但是因为显卡的原因,又是重新system-config-display后进入KDE,没有提示进行设置,于是从user到网络,还有hostname之类都是自己一个个设置。以后貌似一切正常。
问题所在:还没来到装打印机的步骤,发现这个f8居然要user登录后才能连接网络和smb,ssh的service启动。这可真是为了desktop准备的,这样的话根本没办法run server啊。调试init.d里的service和rcN.d里的启动选项好久,也无法使其正常工作。害我浪费很多时间,我女朋友陪我在实验室到半夜11点多,为此差点吵架。nnd,以后再也不当red hat的小白鼠了。

2.opensuse 10.3
安装过程:opensuse 10.3刚刚发布时没有放出liveCD,我第一次安装它的时候用的就是Gnome的安装CD,显卡可以自己驱上,但是没有自带repositories,要去其wiki自己找,一个个加上,否则装个gcc都不行。后来又装了一次Opensuse 10.3的KDE liveCD版的,因为之前那个Gnome被我做过其他测试,更改过一些系统设置,liveCD时可以进入桌面环境,但是基本的安装过程过后,该重启进行一些设置的时候,无法找到显卡设置,只能在text mode下;Opensuse比Fedora好在其强大的yast系统可以在text mode下工作,于是系统设置还是会自动显示出来,设置过后samba server没有问题,可以正常工作,但是作为打印机server仍燃有问题。
问题所在:在这个Gnome的的samba打印机server上的USB打印机2200可以正常工作,但是parallel的1220C只能打测试页,而且这两个打印机在其他linux上搜索不到。
在Opensuse 10.3的KDE liveCD版上,结果问题依旧,这次在windows端连parallel的1220C打印机都找不到了。

3.Ubuntu 7.10(Gnome)
安装过程:Ubuntu不愧为最人性话和对硬件兼容性最好的distro,对于user来说不存在找不到显卡设置的问题,安装到使用没有任何问题。samba server也没有问题(文件共享功能只是针对linux的分区,对于windows分区,请参见Howto Setup SMB Server using NTFS partitions on Ubuntu(http://crossonline.blogspot.com/2007/11/howto-setup-smb-server-on-ubuntu.html)。但是打印机server的设置上还是有些问题。
问题所在:传统意义上说,Ubuntu的SYSTEM-ADMINISTRATION-PRINTING只是为cups的打印机使用的,但是不知从哪个版本开始,Gnome已经把它和samba server整合到一起了,这么说来,就应该这里出现的打印机就该被samba server找到并且默认被设置为共享。但是这次parallel的1220C没有问题,无论是在windows客户端还是linux端,但是USB打印机2200却在无论在什么系统上都不能被搜索到,只能在server上使用。后来经过一番尝试,发现原来是SYSTEM-ADMINISTRATION-PRINTING搜索到的这个usb打印机驱动不正确,如果利用Kcontrol(KDE下的Control Centre)printing就会多出一个选项让你选连接在usb端口上的打印机,这样找到的打印机就没问题了。

总结:1)无论是哪个发行版的linux还是多少存在着一定的问题,其实都应该可以解决,但是就要花一些时间去解决,本人习惯了Ubuntu,所以虽然Ubunt也存在问题,但是很快就能找出问题所在,对于Fedora和Opensuse,没有做太多研究。而且综合以上default setting的对比,可以看出Ubuntu还是更人性话一些。无怪Dell会选择他们,对于一般的用户,麻烦会少些。
2)对于各个发行版,Gnome和KDE的选择就要看这个厂家喜欢哪个版本了。要想用Fedora就要用Gnome版的,毕竟Gnome开发初期,Redhat大力支持,并且派出专门的程序员参与这个项目,Suse呢,自始至终(当然还没终呢)则一直是KDE的大力支持者,毕竟都是欧洲领国的产品。Ubuntu则倾向于Gnome,否则也不会把KDE的版本另起一个名字叫Kubuntu了。开发力度决定了其产品品质。
3)针对SuSE和Ubuntu,如果你会德语,那自然SuSE会好一些,毕竟其发源地是德国,至今大多数开发者和资深使用者都是来自德国,很多相关的wili和论坛都是德语的,这对非德国用户是一个很大弊端。而且SuSE把其产品做的太过于自我了,很多功能都是自己开发,虽然系统的核心是linux,可是使用上像是另外一个操作系统,偏离Gnome和KDE的默认环境很多,还有那庞大的yast,用惯了SuSE恐怕很难再转到其他linux的发行版上了,如果是想学linux最好不用这个,但是对于企业,习惯傻瓜式的操作,SuSE应该是最好的发行版本了。

以上所有内容都是本人的一点意见,由于本人能力有限,没有做更多的研究,只是用了默认设置,还是在很烂的机器上,很烂的打印机,不能完全代表各个发行版本的真正表现。

#####################
打印机的驱动如果选postscript,打印文字没问题,但是打印图片或者图片为主的pdf,其缓存不够.这个时候试试其他驱动例如footmatic.

Tuesday, 13 November 2007

Hide Removable Drive Icons from Your Ubuntu Desktop

I prefer a clean desktop with no icons cluttering it up, but by default Ubuntu adds icons to the desktop for every single removable drive that you attach to your system.

Having recently transitioned to using Ubuntu full-time at home (instead of just part-time), this was one of the first things I wanted to disable. Sadly there's no option in the default configuration screens, so we'll have to use the "registry editor" for Ubuntu, called gconf-editor.

Just type in gconf-editor into the Alt+F2 run dialog to open the app.

Now browse down to the following key:

apps \ nautilus \ desktop

You should see a key in the right-hand pane called volumes_visible. Remove the checkbox from it, and the icons will instantly disappear from the desktop. Remember that you can always access the drives from the "Computer" icon, or easily in the file browser.

I'm much happier now with my beautiful desktop.

Sunday, 11 November 2007

SMB:Configuring your computer as a server

A fairly comprehensive graphical Samba configuration tool is available for KDE, by installing the "kdenetwork-filesharing" package. Once install, you can find it by launching the KDE Control Center. (Alt-F2 and then type kcontrol). Browse to Internet & Network > Samba. It is fairly easy to use.

A less friendly but also graphical tool is Swat, a web-based interface.

The following tips show how to do some basic things without installing additional software, using the command line. It is not difficult, just be careful with typos.

First open a terminal: Applications > System Tools > Terminal and open the file smb.conf

sudo nano -w /etc/samba/smb.conf

How to Save: To save in nano use "ctrl/o" than "ctrl/x".

Tip: Replacing nano with gedit gives you a nice graphical editor.

The file *smb.conf* is divided in several sections:

Global Settings
Debugging/Accounting
Authentication
Printing
File sharing
Misc
Share Definitions

Let's start with Global Settings. Here you will see several lines, which you can also see in the graphical networktool like workgroup and wins server. If you changed everything to your liking already then you can skip this section, if not change to what you need. If you do not know what items mean, leave them be and read the [WWW] relevant part in the real Samba-howto instead of randomly changing them. It will save you trouble-shooting later.

The important part for us is File sharing. We need to change:

[homes]
comment = Home Directories
browseable = no

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable = no

This describes your /home folder. Usually you want to share this folder in a home-environment, because these are the files you want to share. To do so, make the following changes:

[homes]
comment = Home Directories
browseable = yes

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable = yes

This finishes sharing your /home folder. The last thing we need to do is fixing a user.

Add users who can access your shares with the 'smbpasswd' command.

sudo  smbpasswd -a username

New SMB password:
Retype new SMB password:
Added user username.

NOTE: the username used here should be a real user setup on your PC/Server. Reload Samba for every change to users/passwords or 'smb.conf'

sudo /etc/init.d/samba reload

That's the basis of Samba file-sharing. Please leave your comments about what else is needed here.

Back to top

Complicating things a little

We started with the base of Samba file-sharing. The above-mentioned items should be enough to get you started. Next we will add details that you might or might not need.

Back to top

If you have more the one networkcard

If you have more the one networkcard (or interface) then you have to define where you want Samba to run. In smb.conf under the [global] section, add:

"interfaces = 127.0.0.1, 192.168.0.31/24"
"bind interfaces only = yes"

The first address (127.0.0.1), is a loopback network connection (it's your own machine). The second address (192.168.0.31), is the address of the card you want Samba to run on, the second number (24) is the subnet default for a CLASS-C network. It may vary depending on your network.

With "bind interfaces only" you limit which interfaces on a machine will serve SMB requests.

You can limit which IP address can connect to your Samba server adding these lines:

"hosts allow = 127.0.0.1, 192.168.0.31, 192.168.0.32"
"hosts deny = 0.0.0.0/0"

The loopback address must be present in the first line. The second line deny access from all IP address not in the first line.

Back to top

Sharing CUPS Printers

If You would like to share Your printers make the following changes to Samba:

If not already done create the Samba-user You want the share to be used by.

In smb.conf uncomment and change the lines ending up with the following configuration:

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = yes

# [...] // Some BSD printing stuff, do not edit if You do not need to

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
printing = cups
printcap name = cups

and in the Share Definitions section append and/or modify the [printers] part ending up like this:

# ======================= Share Definitions =======================
# [...] // File and Folder sharing, do not edit if You do not need to

[printers]
comment = All Printers
browseable = no
path = /tmp
printable = yes
public = yes
writable = no
create mode = 0700
printcap name = /etc/printcap
print command = /usr/bin/lpr -P%p -r %s
printing = cups

Some explanation what is done:

the [printers] part defines the default-behavior for all the printers that are mentioned in "printcap name". A sort of template how to create shares for these printers. This template is applied if "load printers" is set to true. For more detailed explanation refer to the Samba documentation.

And do not forget to reload Samba:

sudo /etc/init.d/samba reload

Back to top

SMB vs NFS

SMB是Server Messege Block的缩写,其实就是实现Windows文件和打印共享的基础协议,后来在*nix下通过samba实现了smb协议,所以可以达成不同系统之间的文件和打印共享互通。
而NFS是在内核级别实现的Network File System。通过NFS协议import的分区,可以当成本机的磁盘来使用。所有读写都是内核负责,所以效率上比SMB要好,但是仅仅能实现文件读写,没有打印服务。

smb service

为了实现windows 和 Linux以及其他操作系统之间的资源共享,软件商推出nfs
和samba两种解决方式。由于市场上缺乏象pc-nfs那样的客户端工具,使得Linux和windows的资源共享变得复杂。Samba的出现解决了
这一问题,它以其简洁、实用、灵活配置的特点受到越来越多人们的广泛关注。

  Windows利用SMB协议来实现操作系统间文件和打印机共享,而Samba本身具备SMB协议,它实现局域网内和Windows系列计算机的资源共享。

  本文就Samba在Linux系统下的配置为重点,讨论局域网内windows 与 Linux 的资源共享。

  一、Samba 介绍

  1、SMB协议

 
 SMB (Server Message Block,服务信息块)
协议,是局域网上的共享文件/打印机的一种协议,它可以为网络内部的其他windows和linux
机器提供文件系统、打印服务。SMB的工作原理是让NetBIOS和SMB运行在TCP/IP之上,且使用NetBIOS的nameserver让
linux机器可以在windows 网络邻居里被浏览。

  2、Samba

  Samba是用来实现SMB的一种软件,由澳大利亚的Andew Tridgell开发,是一种在Linux 环境里运行的自由软件。它可以完成如下功能:

  文件服务和打印服务,实现Windows和Linux的资源共享。

  登录服务器,可以作为局域网的服务器。

  作为主域控制器。

  WINS服务器。

  支持SSL。

  支持SWAT。

  二、 Samba服务

  1、 核心进程

  Samba 有两个守护进程:smbd 和nmbd,它们是Samba的核心进程。nmbd进程使其他计算机浏览Linux服务器,Smbd进程在SMB服务请求到达时对它们进行处理,并且为使用或共享的资源进行协调。

smbd 是提供数据传输服务,也就是我们说的Samba服务的主要功能
nmbd 是提供名称解析服务的,就是说开启此服务我们可以通过主机名来访问共享目录

  2、 启动服务

  Samba 有两种启动方式:Daemon形式和Inetd形式。

  (1)Daemon形式 建立启动脚本:rc.samba

  smbd -D -d1

  nmbd -D -d1

  -D 表示以Daemon形式执行;-d1 表示除错记录级别

  执行脚本文件rc.samba

  (2)Inetd形式

  设置文件:/etc/services

  netbios -ssn 139/ tcp

  netbios -ns 137/ udp

  设置文件:/etc/inetd.conf

  netbios -ssn stream tcp nowait root /usr/sbin/smbd smbd

  netbios -ns dgram udp wait root /usr/sbin/nmbd nmbd

  重启动Inetd daemon

  # kill -HUP 1

  3、 客户工具 smbclient

  Smbclient命令用来存取远程Samba服务器上的资源。其命令形式与ftp相似。

  命令语法是:#smbclient [password] [option]

  (1) 解释:servicename是要连接的资源名称,资源名称的形式如下:

  //server/service server 是远程服务器的NetBIOS名字,对于windows服务器而言,就是出现在网上邻居中的名字。

  Service是各server所提供的资源的名字。

  pssword 是存取该资源所需的口令

  option 各种命令选项,其中 -L 用于列出远程服务器提供的所有资源

  -I 指定远程服务器的IP地址。此时,servicesname 中的NetBIOS名部分将被忽略。

  (2)多种smbclient命令:

  执行smbclient命令成功后,进入smbclient环境,出现提示符: smb:\&gt;

  这里有许多命令和ftp命令相似,如cd 、lcd、get、megt、put、mput等。通过这些命令,我们可以访问远程主机的共享资源。

  4、 Samba系统装载与卸载

  (1) 装载其他主机的资源

  我们可以利用Samba提供的smbmount命令,装载其他主机的共享资源。

  Smbmount的命令语法:# smbmount

  其中 servicename 是资源名,mount-point是安装点。

  例如: # smbmount "\\server\tmp" -c ' mount /mnt'

  表示:把名字为“server”的计算机上的共享资源“tmp”的内容装载到本地的 /mnt

  目录下。

  (2) 卸载资源

  卸载一个已经装载的SMB文件系统,使用smbunmount命令,同时指定要卸载的装载点。 例如: # smbunmount / mnt

  三、Samba配置

  Samba组件的配置文件是 /etc/smb.conf ,该文件几乎包含了Samba系统程序运行时所需的所有配置信息。

  1、 配置选项

  配置文件中有比较重要的几个节:[gloabal]、[homes]、[printers],下面分别给与说明。

  (1)[gloabal]节 在全局参数中,参数的设置直接影响samba系统。

  NetBIOS name:设置主机名称

  Workgroup:用来指定主机所在网络上所属的NT域名或者工作组名称。格式是

  Workgroup= Nt Domain-Name or workgroup-name

  Server string:用来设置本机描述,缺省是 Samba Server

  Host Allow:它允许设置哪些领域的机器可以访问它的Samba服务器

  Load printers:允许自动加载打印机列表,而不需要单独设置每一台打印机。

  Interface:配置Samba使用多个网络界面。

  Domain controller: 仅当网络中有一台在安装时设置为主域控制器时使用此选项。

  Security: 设置安全参数,定义安全模式。Samba 的安全模式有四种

  Share、 user、 server 、domain

  encrypt passwords 、smb passwd file:用于适用加密口令。

  下面是一段参数配置例子:

  [global]

  smb passwd file = /etc/smbpasswd

  remote announce = 172.18.158.234 172.18.153.55 172.18.153.255

  dns proxy = no

  security = user

  encrypt passwords = yes

  server string = Ftp Server

  workgroup = turing

  socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

  log file = /var/log/samba/log.%m

  load printers = yes

  guest account = dscan

  remote browse sync = 172.18.158.234 172.18.153.55 172.18.153.255

  printcap name = /etc/printcap

  max log size = 50

  hosts allow = 172.18.158. 172.18.153. 127.

  ... ...

  (2)[homes]节 所有使用者的home目录

  当任何一个客户访问Samba服务器时,在网络资源中都能出现自己的home目录共享。其配置如下:

  [homes]

  comment = Hnnw Directories

  browseable = no

  writable = yes

  (3)用户共享目录

  用来指定某一特定用户组或者用户拥有访问权限的目录配置,下列参数配置仅有hnnw组的用户有权访问目录/home/samba。

  [public]

  comment = Public Hnnw

  path = /home/samba

  public = yes

  writable = yes

  printable = no

  write list = @hnnw

  2、 用户映射

  全局参数“username map”用来控制用户映射,它允许管理员指定一个映射文件,该文件包含了在客户机和服务器之间进行用户映射的信息。

  如:username map= /etc/smbuser

  用户映射经常在windows 和linux 主机间进行。 两个系统拥有不同的用户账号,用户映射的目的是将不同的用户映射成为一个用户,便于共享文件。

  下面是一个映射文件的例子:

  # Map Windows admin to root

  root=admin administrator

  ;Map the member of developer to studio

  studio = @developer

  等号左边是单独的Linux账号,等号右边是要映射的账号列表。

  服务器逐行分析映射文件,如果提供的账号和某行有右侧列表中的账号匹配,就把它

  替换为等号左边的账号。

  3、 使用加密口令

 
 新版本的windows
95以及windows98、winnt(sp3以上版本),在网络传输中仅传递加密口令作为用户认证的信息。这类客户机和不支持加密口令并且以user
安全级运行的Samba服务器通讯时,会出现故障。为了正常的通讯,samba服务器使用加密口令。下面讨论如何在samba中使用加密口令。

  (1) 口令文件 /etc/smbpasswd

  为了使用加密口令,samba 需要一份口令文件(/etc/smbpasswd),并且该文件应该和Linux的口令文件(/etc/passwd)保持同步。下面是生成文件命令:

  # cat /etc/password | mksmbpasswd &gt;/etc/smbpasswd

  smbpasswd 是需要的口令文件,其权限是0600,所有者是root

  smbpasswd和passwd文件的记录对应,密码部分不同。密码有两部分组成,每部分

  是32个"X",前部分用于和Lanman通讯,后部分和Windows NT通讯。

  Root用户可以使用smbpasswd命令为每个用户设定samba口令。

  (2) 修改配置文件 /etc/smb.conf

  要使Samba使用加密口令,需要在配置文件smb.conf中加入如下参数。

  Encrypt passwords=yes

  Smb passwd file= /etc/smbpasswd

  第一行通知samba使用加密口令,第二行给出口令文件的位置。

  (3) 重启动samba 服务。

  修改完配置文件后,需要重新启动samba服务,可用如下命令:

  # /usr/sbin/samba restart

  4、windows系统中的明码口令使用

 
 Samba系统中使用明码口令作为连接SMB的默认设置。当SMB服务器对协商协议做出响应时,响应信息包含了一位,以说明服务器是否支持询问或者响应

密。随着win95的网络重定向更新程序的发布,Microsoft修改了默认值,这样,windows客户就不会向不支持加密的服务器发送明码口令了。

  在这种情况下,有两种解决办法:

  (1)设置Samba服务器使用加密口令

  (2)让windows客户使用明码口令

  这里选用第2种解决办法,通过修改注册表来实现。下面对win95/win98、winnt用户分别给与说明。

  (1)win98/win95系统用户

  在注册表中加入下列注册字,并重新启动机器:

  [HKLM\System\CurrentCntrolSet\Services\VxD\VNETSUP]

  “EnablePlainTextPAssword”= dword:00000001

  (2)Winnt系统用户

  修改注册表,加入下列注册表项,并重新启动机器:

  [HKLM\System\CurrentCntrolSet\Services\Rdr\Parameters]

  “EnablePlainTextPAssword”= dword:00000001

  四、Samba应用

  1、 windows资源共享与使用

  (1)windows资源共享

  a. 使用TCP/IP协议作为网络默认通讯协议

  b. 修改网络配置,设置文件和打印机共享。

  c. 设置好计算机名和所属工作组

  d.共享系统资源

  (2)在windows系统中使用Linux共享资源

  a. 登录进入windows网络

  b. 通过网上邻居查看、使用共享资源。

  c. 命令行下工具使用共享资源

  使用命令行下的net.txt工具来查看、使用共享资源:

  net use 命令的语法: c:&gt;net use X:\\servername\sharename

  在这里,X:是共享的驱动器盘符,\\servername\sharename是到共享的UNC的网络路径。

  例如: c:\&gt;net use h:\\hey\myfile

  表示:将hey机器上的myfile共享资源映射为本地的h盘

  2、Linux资源共享与使用

  (1)将Linux 的资源共享

  通过编辑Samba配置文件,添加需要共享的Linux资源。同时可以设定访问此资源的用户群及其访问权限。下面是一段例子,将本机的 /public/data 目录共享,所有人都有读写权限。

  [data]

  comment = Public Data

  path = /public/data

  public = yes

  writable = yes

  printable = no

  (2)在Linux中使用共享资源

  可以使用smbclient命令,访问所有的Samba资源。具体使用方法见前述。

  五、Samba应用程序

  smbclient :访问所有共享资源

  smbstatus: 列出当前所有的samba连接状态

  smbpasswd:修改samba用户口令、增加samba用户。

  Nmblookup:用于查询主机的NetBIOS名,并将其映射为IP地址

  Testparam: 用于检查配置文件中的参数设置是否正确

  Linux 系统中的Samba配置

Powered by ScribeFire.

NFS service


Linux服务配置文档—NFS - wds
NFS为network file system 的简称,最早由sun公司开发,一般NFS广泛应用在集群服务器上,他的最大特点是可以通过网络让不同的机器,不同的操作系统可以彼此的共享文件,所以它可以看作一个简单的文件服务器。NFS其实可以被视为一个RPC服务程序,在启动RPC程序前我们先要做好端口的映射工作这就是portmap,portmap的意思是当Client要连接服务器时必须知道服务器的一个空闲端口这时Client会向服务器的portmap请求一个端口然,然后Server告诉Client这端口后才可以建立连接,所以在启动NFS前要先启动portmap





[wds@localhost ~]# rpm –qa |grep nfs && rpm –qa | grep portmap #查找这两个是否安装

[wds@localhost ~]# vi /etc/exports # 这文件是NFS的主要配置文件

[wds@localhost ~]# /usr/sbin/exportfs #这个文件是nfs共享资源命令

[wds@localhost ~]# /usr/sbin/showmount #可以查看远程服务器的共享目录

[wds@localhost ~]# /var/lib/nfs/xtab #nfs 的日志文件





[wds@localhost ~]# vi /etc/exports

[你想要的共享的目录] + ip 地址(参数一,参数二) [主机名二](参数三,参数四)

参数列表

rw: 可以写入权限

ro: 只读权限

no_root_squash: 登陆NFS主机共享目录的如果是root用户那么那的权限也为root但是这样并不安全

root_squash: 登陆的用户如果为root它的权限将变成nobody

all_squash: 不论登陆的用户是什么用户都以匿名用户的权限

sync: 数据同步写入硬盘和内存中

async: 数据先暂时存放在内存中,而不写入硬盘

anounid: 这个可以自己设定uid,但是必须与/etc/passwd目录中用户uid一样

anongid: 同anonuid,但是变的是group id



服务器端配置

[wds@localhost ~]# service portmap start #首先打开portmap

[wds@localhost ~]# service nfs start # 在打开 nfs

[wds@localhost ~]#i iptables –F #清空防火墙命令

[wds@localhost ~]#

比如说我要共享/var/www/html 目录 但是只是让和我一个网段的机器访问192.168.0.0/24这个网段读或写,其他的就只能读,然后在发布一个私人目录/home/wds/只开放给192.168.0.8

这个IP

[wds@localhost ~]# vi /etc/exports

/var/www/html 192.168.0.0/24 (rw) *(ro)

/home/wds 192.168.0.8(rw)



现在想要*.chinaunix.com网段的机器登陆我的NFS,并且访问我的/home/wds/ 但是它们存储时我希望它们的uid和gid都变成40这个用户身份

[wds@localhost ~]# vi /etc/exports

/var/www/html 192.168.0.0/24 (rw) *(ro)

/home/wds 192.168.0.8(rw)

/home/wds *.chinaunix.com(rw,all)squash,anounid=40,anongid=40)





如果我们修改/etc/exports这个文件后,是否要从新启动nfs呢?答案是不不需要,只要使用exportfs来从新扫描一次/etc/exports文件,并且从新设置文件加载即可



语法为:

[wds@localhost ~]# exportfs [-aruv]

参数说明:

-a: 全部挂载(或者卸载)/etc/exports 文件的设置

-r: 从新挂载/etc/exports 里设置,此外,同步更新/etc/exports 及/var/lib/nfs/xtab的内容

-u: 卸载某一目录

-v: 在导出时,将共享目录显示在屏幕上

例如:

[wds@localhost ~]# exportfs –rv 全部从新导出一次

[wds@localhost ~]# exportfs –au 全部卸载掉



Showmount 的是显示是否有挂载



语法为:

[wds@localhost ~]# showmount [-ae] hostname

参数说明:

-a: 在屏幕上显示与当前的client连接后使用目录的状态

-e: 显示Hostname这台机器的/etc/exports中的共享信息

[wds@localhost log]# showmount -e localhost

Export list for localhost:

/var/www/html (everyone)



Rpcinfo [-p]hostname[or ip]

-p 显示端口与程序的信息



[wds@localhost log]# rpcinfo -p localhost

program vers proto port

100000 2 tcp 111 portmapper

100000 2 udp 111 portmapper

100024 1 udp 1024 status

100024 1 tcp 1024 status

100011 1 udp 837 rquotad

100011 2 udp 837 rquotad

100011 1 tcp 840 rquotad

100011 2 tcp 840 rquotad

100003 2 udp 2049 nfs

100003 3 udp 2049 nfs

100003 4 udp 2049 nfs

100003 2 tcp 2049 nfs

100003 3 tcp 2049 nfs

100003 4 tcp 2049 nfs

100021 1 udp 1026 nlockmgr

100021 3 udp 1026 nlockmgr

100021 4 udp 1026 nlockmgr

100021 1 tcp 1026 nlockmgr

100021 3 tcp 1026 nlockmgr

100021 4 tcp 1026 nlockmgr

100005 1 udp 858 mountd

100005 1 tcp 861 mountd

100005 2 udp 858 mountd

100005 2 tcp 861 mountd

100005 3 udp 858 mountd

100005 3 tcp 861 mountd







Client端的设置



Server端设置完毕,接下来就是让client端连接上server!连接server步骤如下:

1. 扫描可以使用的server目录:

2. 在client端建立装载点

3. 使用mount 命令远程挂载远程共享目录

4. 解决可能发生的问题(被防火墙过滤掉了)

Showmount是显示远程主机共享资源







[wds@localhost ~]# showmount -e 192.168.0.8

Export list for 192.168.0.8:

/var/www/html (everyone)

/home/wds *.chinaunix.com,192.168.0.6

[wds@localhost ~]# mount -t nfs 192.168.0.8:/var/www/html /mnt 把远程的/var/www/html 挂载到本地

[wds@localhost ~]# umount /mnt 卸载远程目录



如果你想要开机启动时自动加载NFS服务器导出目录,我们在NFS端/etc/fstab文件中加入以下一行

192.168.0.8:/var/www/html /mnt nfs rsize=8192,wsize=8192,timeo=14,intr


Powered by ScribeFire.

Friday, 9 November 2007

lyx+beamer for presentation

lyx, very powerful latex tool, whose author is the person who started KDE project.

However lyx is not so clever, for instance, when you installed 'latex-beamer', it can not find the relative document class and style files. You must go to TOOLS->RECONFIGURE to find the new installed stuff.


Latex is famous for the feature of no worries about layout while concentrating on the contents you are writing.
Beamer is a kinda plugin to enable you concentrate on the contents of your presentation. Here I attached the template of latex-beamer.


latexbeamer.pdf

fedora 8: no screen found

Fedora is not the OS which is compatible with most of hardware.

When I tried Fedora 8, the error message came out while not graphical interface:
(WW) ATI: No matching Device section for instance.

In Fedora, just run "system-config-display", this can solve most issues.

The art of using manuals

Detailed and proper documentation of source code and programs is the milestone of Unix culture, as we may read in “The art of Unix Programming” by Eric Steven Raymond. The first application on Unix was the platform to prepare documents. The platform was used by Bell Labs to prepare patent documents. Effective work with documentation and searching for needed information is the key feature when working on unix-like systems.

1. Local documentation

1.1. man

Usually the first and most basic information source about a given program are man pages. The name stands for the English word manual. Man pages are divided into eight parts:

  1. General Commands
  2. System Calls
  3. Subroutines
  4. Special Files
  5. File Formats
  6. Games
  7. Macros and Conventions
  8. Maintenence Commands

Each page is divided into the following sections:

  • head with command name and section’s number
  • command name and sometimes the names of other commands described on the same page
  • all the parameters used by the command
  • short program description
  • detailed information about each parameter

Depending on the command and operating system you can also meet the following sections:

  • environmental variables
  • diagnostics
  • bugs and restrictions
  • authors
  • copyrights
  • config files

To display the man page of a given command you should type man command_name. If the command is described in more than one section you should give the section’s number also. E.g. the first man section includes the open command description while the second section includes the description of the general command open. To see the documentation of the general command you should type man 2 open. When a man page is open you can navigate using your cursor. To get back to the console you should type :q; to find a phrase below you may use /the phrase; to find a phrase above, use ?the phrase; to repeat the last seach, use n. The man command has two interesting parameters that can be used to search the right man section. When you use the command with -a it displays all the pages for a given command, one after another. When you use the command with -w it displays only the number of the section where a given command is described.

$ man -w open

/usr/share/man/cat2/open.0

/usr/share/man/cat3p/open.0

All sections are divided into sub-catalogues and, as in the example above, the open command appears in the second and third section of man (the example is from OpenBSD 4.1).

To search through man pages you may use two commands: whatis and apropos.

Whatis is used to give a short explanation of programs and command tasks.

$ whatis ls mkdir cat man df

ls (1) - list directory contents

mkdir (1) - make directories

cat (1) - concatenate files and print on the standard output

man (1) - an interface to the on-line reference manuals

man (7) - macros to format man pages

df (1) - report file system disk space usage

The apropos command finds a given phrase in the man pages.

$ apropos 'list directory'

dir (1) - list directory contents

ls (1) - list directory contents

vdir (1) - list directory contents

We can make queries more sophisticated:

$ apropos ext3 | grep create

mke2fs (8) - create an ext2/ext3 filesystem

mkfs.ext2 (8) - create an ext2/ext3 filesystem

mkfs.ext3 (8) - create an ext2/ext3 filesystem

In the example above I’ve searched through the man pages which might contain information about creating the file system ext3. Since the query apropos ext3 gave a lot of information on output I’ve filtered the output using the grep command. Of course, there’s no restriction on using regular expressions here. Man includes two commands that you may use instead of whatis and apropos. These are -f and -k. There’s a possibility of printing out the man pages that we are interested in — you may use the parameter -t for this.

$ man -t ls > ls.ps 

A PostScript file was created. With the parameter -T, a DeVice Independent (DVI) file would be created.

$ man -T ls > ls.dvi 

1.2. info

Info is a program to view GNU Texinfo format documentation. This kind of formatting is used by the Free Software Foundation. It enables hyper-textual navigation in documents. You may find more about this command in its man page (man info) or using the command info info. You may start viewing the documentation with the command info. The following keys are used to navigate:

n next page
p previous page
u page up
l last visited node

Texinfo documentation has a tree-like structure.

1.3. /usr/share/doc

The /usr/share/doc/ localisation is the place where you find the documentation in formats other than man and info. Ubuntu users for example may find the book “Dive into Python” there. In Debian Etch there’s a How To documents collection (unfortunately part of them is quite out of date) and in an OpenBSD system you may find “System Manager’s Manual“. The aforementioned books are available during the installation process, where you can choose the misc41.tgz installation set.

2. Documentation on the Internet

The Internet offers many sources of help and documentation. We may find Wikipedia pages (more or less official ones), forums, discussion groups, etc. It would be reasonable to start our search with the system’s description, available on the polishlinux.org web page. I’d like to present a couple of web pages about unix-like systems administration.

2.1 developerWorks

This page was created by the IT market giant IBM. There you may find many articles about unix-like systems administration (on different experience levels), for example articles about software creation. All the articles are free of charge and are available online and in a PDF version. In the case of some of the articles, free of charge registration is required.

2.2. Big Admin

Admin’s vortal. It is devoted mainly to Solaris. Articles are free of charge and registration is not required.

2.3. OnLamp, Linuxdevcenter

These pages are connected with O’Reilly and O’Reilly Network. On OnLamp you can find articles about Linux, BSD and programming languages like PHP, Python and Perl. The registration is required only if you want to add comments. You pay only for the access to e-books.

2.4. Linux Documentation Project

The Linux Documentation Project is an inititative to create documentation sets for Linux distributions. There you can find many manuals and HOWTO documents, etc. All the documents are distribution-unspecific, free of charge and available in different formats.

Blogged with Flock

Thursday, 8 November 2007

YouTube - Flight Patterns

Blogged with Flock

Wednesday, 7 November 2007

vista virtual directory

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

From here you can modify where the favorite directories are located.

Blogged with Flock

Tuesday, 6 November 2007

Google Rallies Allies in Open Linux Phone Initiative « Linux and Open Source Blog

Google and 33 other companies have announced an ambitious industry alliance that will maintain a completely open source mobile phone stack. The Open Handset Alliance (OHA) says phones based on its Linux-based “Android” stack will reach market in as soon as eight months.


The Android stack is based on “open Linux kernel,” the group says. It also includes a full set of mobile phone application software, in order to “significantly lower the cost of developing and distributing mobile devices and services,” OHA said.


The stack appears to have been created by Android, a mobile phone software house that Google acquired just over two years ago. The Android stack’s name is apparently a reflection of co-founder Andy Rubin’s fondness for robots. Rubin previously co-founded Danger, a software house that continues to provide software for the Sidekick “hiptop” marketed by T-Mobile.

Blogged with Flock

firefox ultimate optimizer

it really does an amazing job. save the memory resource almost 10 times. But not sure about the security. Waiting for other's comments.


firefoxultimateoptimizer.zip

Four ways to extract the current directory name

When you're programming a shell script, you often only need the current directory name, not the whole path that the pwd command returns. Here are four ways you can extract only the current directory.

Using basename

Using the basename command is the easiest and simplest way to extract the current directory:

basename /usr/local/bin
bin

However, it isn't useful in a shell script with changing directory variables. You can combine it with pwd inside backticks to make it more dynamic:

cd /usr/local/bin
basename `pwd`
bin

Using parameter substitution with echo

The bash scripting language is full of nice tricks, including parameter substitution, which allows you to manipulate or expand variables. You can use parameter substitution with the ${var##pattern} syntax, which removes from $var the longest part of $Pattern that matches the front end of $var. Take a look at an example:

cd /var/log/squid
echo ${PWD##*/}
squid

PWD is the environment variable that holds the current path, and ## is the instruction that tells the script to remove everything it finds up to */. In other words, it removes everything until the last /, leaving only the last string, which here is the current directory, squid. You can learn more about parameter substitution and other ways to manipulate variables in the Advanced Bash-Scripting Guide.

Using awk and rev

A more elaborate solution uses a combination of awk (a pattern-scanning utility) and rev (a utility that reverses lines from a file or from stdin):

cd /usr/share/cups/data
pwd | rev | awk –F \/ '{print $1}' | rev
data

It's a lot easier to understand this kind of script step by step:

pwd
/usr/share/cups/data
pwd | rev
atad/supc/erahs/rsu/
pwd | rev | awk –F \/ '{print $1}'
atad
pwd | rev | awk –F \/ '{print $1}' | rev
data

The -F option indicates that you should separate by fields, where the field delimiter is /, and that you should print field 1.

Using sed

Finally, you can parse pwd output in the stream editor sed using an elaborate regular expression. This approach may be educational, but it's not practical:

cd /home/smith/music
pwd | sed 's,^\(.*/\)\?\([^/]*\),\2,'
music

For a better understanding of how this works, remove the escape character (\), which is required for special characters such as "(":

sed 's,^(.*/)?([^/]*),\2,'

s substitutes one string for another. It looks for two patterns, which are indicated between the first comma and the second comma. The first pattern (^(.*/)?) searches from the beginning of the line (^) until the last occurrence that it finds of / (in the example, it matches /home/smith/). The second pattern (([^/]*)) searches everything from the last pattern except the / character , which is indicated by [^/]*, where ^ at the beginning of the square brackets means not. This results in both /home/smith/ and music. The second part of this regular expression is the substitution, indicated by \2. In sed, this is called a back reference. As its name implies, it goes back and recalls a previously used reference. There may be nine of these, named \1, \2, \3, and so on. In the example, \2 refers to the second pattern found, which is music -- the result expected.

As you can see, Linux gives you many ways to find a directory name. Having many choices for the same chore is one of its strengths.

Sergio Gonzalez Duran is a Linux administrator, systems developer, and network security counselor who also teaches Linux courses and publishes the Spanish-oriented Linux and open source Web site linuxtotal.com.mx.

Blogged with Flock

Monday, 5 November 2007

SourceForge.net: Wired


Wired aims to be a professional music production and creation software running on the Linux operating system. It brings musicians a complete studio environment to compose and record music without requiring expensive hardware.

Screenshot

http://sourceforge.net/projects/wired/

Blogged with Flock

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter