Monday, April 27, 2009
DNS与IP之间的互查
本人很懒, 平时都是不喜欢去记录一些机器配置变化的. 就算是自己为机器申请的
这可好了, 搬迁机器都要变化IP, 域名需要申请变化!
一个个找email是不靠谱的.
就自己找了个程序去跑, (^_^) 一身轻松
import os, sys
import re
regx = r"PTR.*?\b(?P<dns>(\w*\.){4})"
pattern = re.compile(regx)
def LookUpDns(Ip):
ANSWER = os.popen("dig -x %s" % Ip).read()
#print regx
match = pattern.search(ANSWER)
if match:
print "%s => %s" % (Ip, match.group("dns"))
BTW::
关于dig的使用手册: http://www.madboa.com/geek/dig/
XGL与AIGLX
要在linux下使用3D的特效, 都是需要使用OpenGL的. 对于怎么使用OpenGL, 有两种方法:
There are two ways in which a windowing system can allow an OpenGL implementation to talk to the graphics card.
The first is to specify the OpenGL command stream in a portable network-neutral manner using a client/server implementation similar to the X11 drawing routines. This method, used by AIGLX, is indirect in that the drawing commands are sent to the X server and then the X server sends them along to the graphics card.
The second way, which is at the base of Xgl, is to open a window and then allow the OpenGL library to send commands directly to the graphics card.
从上面的文字中看出, 就是直接与间接的区别.
两种方式需要不同的图形服务程序去支持.
对于直接的方法, 是使用一个叫XGL的服务程序, Xgl is an X server architecture designed to take advantage of modern graphics cards via their OpenGL drivers
间接的方法就是使用现在广泛使用的xorg-server, 那么要xorg-server接受OpenGL指令, 还是需要一定的扩展的, 这就是GLX (initialism for "OpenGL Extension to the X Window System") provides the binding connecting OpenGL and the X Window System: it enables programs wishing to use OpenGL to do so within a window provided by the X Window System.
http://en.wikipedia.org/wiki/AIGLXhttp://www.gentoo-wiki.info/XGL
http://en.wikipedia.org/wiki/XGL
http://www.gentoo-wiki.info/AIGLX
对openoffice有点好感
虽然本人是CLI风格的家伙, 但是本人对外观的需求还是有的, 所谓: "人要脸, 树要皮"嘛. 本人的terminal的外观可是很好看的呀(^_^)
有了好感, 那么.....就会对它想入非非的了.......
首先出现在头脑中的是openoffice的表格与database结合了. 因为使用xlrd, pyExcelerator, xlwt有点不爽.
加上学习学习DB还是很好的. 人差的就是借口 (^_^), 有借口人就不会懒啦
在看OpenOffice与数据connect时, 首先出现在眼前的便是:
* ODBC
* unixODBC
* 具体的DB的ODBC, 比如:sqliteODBC, myODBC等等.
三者的关系:
1. ODBC
ODBC在wikipedia上的描述:
ODBC uses as its basis the various Call Level Interface (CLI) specifications from the SQL Access Group, The Call Level Interface (CLI) is a software standard defined in ISO/IEC 9075-3:2003.
应该这样理解:ODBC是一套ISO标准, 存在于描述文字中
2. unixODBC
unixODBC是在unix下的一套实现, 已经把标准使用代码实现出来.
3. 具体的DB的ODBC
这就是具体的DB使用unixODBC接口实现的应用接口
正在学习OpenOffice与DB的联系
Sunday, April 26, 2009
又是烧钱!
本想去买一个mp3的线控耳机的(可以next, back, suspend之类操作的线控), 后来想了想, 本人的GoGear应该是不支持这样的操作的, 专竟是外界发来的指令.
当时一头脑发热, 跑到了电脑城, 找了间耳机专买店就吹了起来.
加上不是很理性, 就买了如下的设备:
http://panasonic.cn/products/digital_av/accessories/earphone/RP-HX70
当时下决心买这种headphone, 不去买earphone, 主要是因为想到使用这个东西和电脑看电影应该比earphone爽.
所以........ 烧钱了.......
Saturday, April 25, 2009
ls与less的故事
ls -G /
但是当ls的输出被重定向到less命令后会怎么样呢?
呃..... 没有了颜色, 等于使用不使用-G都是一样的后果.
当然, 可以安装一个有颜色的less, 这就没有什么好说的, 再向下看也就没有意义了.
晚上, 无意中发现ls命令早已经很好的解决这个问题了, 如下:
ls -F / |less
关于-F的作用:
-F, --classify
append indicator (one of */=>@|) to entries
发现了这种用法后, 心中一顿惊讶呀, GNU的工具太无敌了! 考虑的情况可以说是一切变态需求
emerge学习
emerge是gentoo的用户级接口. 如下:
emerge [options] [action] [ebuild | tbz2file | file | set | atom] ...
optins和action就常见了, 是命令行的就会有一两个的. 重点在于后面的ebuild, tbz2file等等几个概念.
[ ... | ... | ...]这种结构表示多选一, 就是只为能其中的一种.
命令行最后的"..."表示还可以重复使用前的选项,这里指的是[...]结构
emerge对ebuild的定义为:
1. ebuild, 有几种情况: 包名, 分类/包名, 或者是直接是*.build的完整路径, 这种是最常使用的
2. tbz2file, 这种还不清楚, 不知道是不安装二进制的包.
3. set, 中文也叫集合. 还是比较好理解, 见: A set is a convenient shorthand for a large group of packages. Two sets are currently available: system and world. 这样的集合是早有的. 知道目前只有system和world这两个set就算了解了
4. atom, 什么叫atom? 在portage的man手册中这样描述:
DEPEND atom
A string which matches a package. It is of the form category/package. It may also
contain optional logical operators and versions.
More reading: ebuild(5)
atom重点是有逻辑操作与版本的, 更的信息应该参看ebuild中的DEPEND atom一节.
本人觉得atom这个概念很复杂.
不同的包使用不同的USE, 有如下文件:
/etc/make.profile/
package.use
package.use.force
package.use.mask
文件内的内容:
# force docs for GTK 2.x
=x11-libs/gtk+-2* doc
# unforce mysql support for QT
x11-libs/qt -mysql
还有一个概念: slot , 什么叫slot?
With Portage different versions of a single package can coexist on a system. While other distributions tend to name their package to those versions (like freetype and freetype2) Portage uses a technology called SLOTs. An ebuild declares a certain SLOT for its version. Ebuilds with different SLOTs can coexist on the same system. For instance, the freetype package has ebuilds with SLOT="1" and SLOT="2".
可见, slot是very powerful的东西
如下:
Atom Slots
Beginning with EAPI 1, any atom can be constrained to match a specific SLOT.
This is accomplished by appending a colon followed by a SLOT:
x11-libs/qt:3
~x11-libs/qt-3.3.8:3
>=x11-libs/qt-3.3.8:3
=x11-libs/qt-3.3*:3
升级firefox到最新版本
sudo autounmask www-client/mozilla-firefox-bin-3.0.9
sudo emerge -av www-client/mozilla-firefox-bin