在Linux上安装QT4

编程语言 无评论 »
比起在Windows上安装QT,在Linux上安装QT要容易多了,这都得意于Linux系统的autoconf和automake工具。
1. 将QT的源码包放至到一个目录下,笔者的目录是:/home/kevdmx/work/using,将其解压:
如果 .tar.gz 文件: tar zxvf QT源码名的名字
如果 .tar.bz2 文件: tar jxvf QT源码名的名字
2.配编译环境:
cd QT源码目录

阅读全文 »

Tags »|

几种常用的操作系统下iSCSI Initiator的使用

Storage Server 无评论 »

WindowxXP、 Windows2000、 Windows2003

  • 安装
    可用于windows2000、windowsXP、windows2003的较新版本iscsi-initiator程序是Initiator-2.04-build3273,下载该程序后安装。
  • 用法
    安装成功后产生程序组Microsoft iSCSI Initiator, 桌面也有相应图标。基本操作如下:
    点击 Microsoft iSCSI Initiator—>Discovery—>Add—>输入target的IP地址和端口号
    点击 Microsoft iSCSI Initiator—>Targets—>Refresh, 发现当前可用的Target
    点击 Microsoft iSCSI Initiator—>Targets—>选中target—>Logon—>OK, 建立连接
    点击 控制面板—>管理工具—>计算机管理—>磁盘管理,可以看见映射到本机的逻辑磁盘。然后可以与本地磁盘一样进行分区格式化操作。
    点击 Microsoft iSCSI Initiator—>Targets—>选中已经连接的target—>Details—>勾选相应的任务项目—>Logoff, 断开连接。

RedHat Enterpris Linux 5

  • 编译安装软件
    以root身份登录系统,下载initiator软件包Open-iscsi-2.0.865.tar.gz到/root目录。
    解压缩软件
    [root@RedHat5 ~]# tar xvzf Open-iscsi-2.0.865.tar.gz
    在/root下生成目录Open-iscsi-2.0.86,进入该目录进行编译和安装
    [root@RedHat5 ~]# cd Open-iscsi-2.0.86
    [root@RedHat5 Open-iscsi-2.0.86]# make
    [root@RedHat5 Open-iscsi-2.0.86]# make install
    [root@RedHat5 Open-iscsi-2.0.86]# cd ~
    编译安装完成后生成必要的驱动程序模块、守护进程和管理程序iscsiadm
  • 用法
    启动Open-iscsi
    [root@RedHat5 ~]# service open-iscsi start
    如果希望在启动机器时自动加载,执行下面命令
    [root@RedHat5 ~]# chkconfig –level 3 open-iscsi on
    这里的参数3是运行级别,如果是图形界面要改为5。
    发现target,询问target名称
    [root@RedHat5 ~]# iscsiadm -m discovery -t sendtargets -p targetIP地址:端口号
    该命令将报告出target名称
    建立连接
    得到了target名称后,使用下面命令建立连接
    [root@RedHat5 ~]# iscsiadm -m node -T target名称 -p targetIP地址:端口号 –login
    这时应该看到映射到的逻辑磁盘名号,使用fdisk -l 可以看到有关逻辑磁盘的详细内容,可以象使用本地硬盘一样对其进行分区、创建文件系统、挂载、卸载等操作。
    断开连接
    如果逻辑磁盘已经挂载,断开连接前应先卸载,然后使用下面命令
    [root@RedHat5 ~]# iscsiadm -m node -T target名称 -p targetIP地址:端口号 –logout
    关机之前应该正确的卸载和断开逻辑磁盘,否则会在target服务器上留下僵死的进程,造成服务器资源的浪费。

Fedora core 6 、Fedora 7

  • 安装
    这两个操作系统都有适用的rpm包,适用于Fedora core 6的是iscsi-initiator-utils-6.20.695-0.5.i386.rpm,适用于Fedora 7的是iscsi-initiator-utils-6.20.754-0.0.fc7.i386.rpm,下载对应的文件后用rpm命令安装。
    [Federa]# rpm -ivh iscsi-initiator-utils-6.20.754-0.0.fc7.i386.rpm
  • 用法
    这两个rpm包其实就是上面说的Open-iscsi软件,其管理程序也是iscsiadm,用法与上面所说完全一样。但因安装方法不同产生的启动脚本文件有所差异。这里需要如下的方法启动:
    加载内核模块
    [Federa]# modprobe -q iscsi_tcp
    启动守护进程
    [Federa]# iscsid
    而后就可以用iscsiadm程序来管理,发现的target信息会保存在数据库中,下次启动时自动加载模块和启动守护进程。如果要从数据库中删除某个target的信息,使用下面命令:
    查询数据库中内容
    [Federa]# iscsiadm -m node
    删除指定的target
    [Federa]# iscsiadm -m node -o delete -T target名称 -p targetIP地址:端口号

FreeBSD5.4、FreeBSD6.2、FreeBSD7.0

  • 安装软件(5.4版和6.2版需要)
    以root身份登录系统,下载initiator软件iscsi-12.tar.bz2到/root。
    解压缩软件
    # tar xvzf iscsi-12.tar.bz
    将得到两个目录sys和iscontrol
    分别进入这两个目录进行编译:
    # cd sys/modules/iscsi_initiator
    # ln -s ../.. @
    # make
    编译成功后在该目录下生成内核模块文件iscsi_initiator.ko,把该文件复制到/boot/kernel目录下。
    # cd iscontrol
    # make
    编译成功后在该目录下生成管理程序 iscontrol, 把该文件复制到/sbin目录下。
  • 用法
    首先装载内核模块
    # kldload iscsi_initiator.ko
    如果不想看到很多的输出信息
    # sysctl debug.iscsi=0
    发现target,询问target名称
    # iscontrol -d targetaddress=targetIP地址
    该命令将报告出target名称。
    连接target
    # iscontrol targetaddress=target的IP地址 TargetName=target名称
    这里的target名称是发现target命令报告出的名称。
    连接成功后,将报告出映射到本机的scsi设备名号,如da0或da1等。
    内核模块装载命令和连接命令应该写入启动脚本文件/etc/rc.local, 这样机器启动时可自动建立连接。
    应用下面命令可以看到连接到的设备
    # camcontrol devlist
    然后可以象使用本地硬盘一样对其进行分区、创建文件系统、挂载、卸载等操作。
    如要结束连接,首先要卸载相应的设备,然后向iscontrol进程发-HUP信号,或用top找到iscontrol的进程号,直接kill掉。
    该软件在target端服务中断后再恢复时(例如重新启动机器)不能自动再建立连接,必须手动重新建立连接。该软件不支持身份验证,target端不能设置密码。
  • FreeBSD7.0版已经内置了连接器,用法同上


Open Solaris

Open Solaris操作系统内置了iSCSI Initiator, 其管理程序名称也是iscsiadm, 但与Linux下的iscsiadm不是同一程序,使用语法也不相同。

  • 用法:
    以root身份登录,启动一个终端窗口,在窗口中执行命令:
    发现target, 询问target名称
    # iscsiadm add discovery-address targetIP地址:端口号
    建立连接
    # iscsiadm modify discovery -t enable
    查看逻辑磁盘名号
    # format
    然后根据逻辑盘的名号(例如c1t0d0)进行格式化、创建文件系统、挂载。
    断开连接
    # iscsiadm modify discovery -t disable
    删除一个target
    # iscsiadm remove discovery-address targetIP地址:端口号
Tags »|

与存储相关的基础知识

Storage Server 无评论 »

1、关于HBA
HBA的全称为Host Bus Adapter,即主机总线适配器。
a、总线适配器是个什么东西呢?
我们首先要了解一下主机的结构,一台计算机内部多半由两条总线串在起来(当然实际情况会有不同,这里只讨论常见的,简单的情况),一条总线叫系统总线,一条叫I/O总线系统总线上接了CPU,MEmory,cache什么的,I/O总线上接的就是外围设备,现如今最常见的就是PCI总线了。这 两条总线之间用桥接的芯片或者说电路连接起来。举个形象的例子,就好比一个城市里,有两条主干道,一条属于行政区,一条属于商业区,中间有个环岛,将两条 主干道连接到了一起,系统总线就好比行政区里的主干道,而I/O总线就好比商业区的主干道。系统总线和I/O总线的带宽的单位都是以Gbyte来记,但是 显而易见的是,行政区的主干道和商业区的主干道相比的话,前者肯定更“核心”,更宽,更顺畅,设计的要求也高。
我们知道,在向公仆部门要求服务的时候,是要有一些接口的部门和程序的,而桥接芯片的作用就是连接和协调两条总线的工作的。
虽然I/O总线的速度和系统总线的带宽相比要低很多,但是好歹也是以G来计量的,而我们知道外围设备的速度,往往只有几百兆,甚至几十k而已,怎么协调工 作呢?好比卖煎饼果子摊子不能直接戳到城市主干道上,怎么办?好办,在主干道边上开个2000平米的小吃城,把摊子都收进去好了。那么主机总线适配器的作 用也就是这个,我们就是要把外设组织起来,连接到I/O总线上去!HBA就是指Host和I/O BUS直接的一个适配器,也好比一个水管工常说的“双通”。
b、常见的HBA有哪些呢?
比如显卡,网卡,scsi卡,1394卡等等。我要拿出来说的就是FCHBA和ATA&IDE。我们通常说的什么Emulex的LP9002,什 么 Qlogic的QLA2340都是FCHBA卡,就是将Fibre Channel的设备和IO总线连接起来的适配器。ATA也是一种适配器技术,我们PC主板上的ATA接口,就是一个磁盘适配器的对外接口,要强调的就 是,ATA说的是适配器技术,IDE是说得存储外设技术,比如我们可以说IDE硬盘,IDE光驱,说ATA接口,但是说IDE接口,ATA硬盘就不时那么 合适了,虽然很多情况下,大家都习惯把他们混在一起说。
阅读全文 »

Tags »

The Instantiator: A simple Flex utility class for more powerful skinning in custom components

Flex3 无评论 »

One thing that bugs me about the core Flex SDK components is that they use the Class datatype for just about everything. From time to time, you encounter the awesomely flexible mx.core.IFactory type for a renderer property, but when it comes to styles, Class is king. The problem is that sometimes I wish I could instantiate a Function object prototype-style. It’s a great way to create new “classes” at runtime.

There’s nothing I can do to fix this limitation in the core components without patching the source manually (I know, I’ve tried several crazy ideas), but when I create a custom component, I can make it much more flexible. The easiest solution, the one I’ve been using most often, is to simply type the style value as Object whenever I use getStyle() for a skin style:

var skinClass:Object = this.getStyle( “skin” );
var skin:DisplayObject = new skinClass();

This allows Function to be used with the new keyword like a Class, which is generally enough for my needs.

However, I also mentioned IFactory earlier. There’s something compelling to me, as a component developer, in the simplicity and power of allowing my developers to use a factory to customize skins. I usually find a decent enough substitute through styleName or the StyleProxy class, but I feel like I’m rewriting the same boring code over and over again whenever I make yet another skin or sub-component styleName style. Don’t get me started on chaining styleNames multiple levels deep. Every time I do it, it feels awesome because I know everything is super-customizable, but I also wonder how many developers understand how these work. Of course, the fact that you can’t create an IFactory in your stylesheets is a problem. One could argue the same thing about using a Function to instantiate a skin, though, but I find a function’s ability to create a runtime datatype through prototype too compelling to ignore. I’m not quite as sure about IFactory, but I feel the option is useful to have, even if I don’t need it too often.

I could always change my instantiation code to look like the following, but I’d hate to repeat these several lines over and over again when I want to build a skinnable component:

var skinBuilder:Object = this.getStyle( “skin” );
var skin:DisplayObject;
if( skinBuilder is IFactory )
{
skin = IFactory(skinBuilder).newInstance();
}
else
{
skin = new skinClass();
}

阅读全文 »

Tags »||

文件(夹)隐藏 又一种实现方式,比较浪费性能的方式

IFS 无评论 »

在驱网上混了这么久,我也来点无厘头的隐藏文件或者文件夹的代码片段吧(自己写的啊不过有一个子函数是某个网友写的,很抱歉我忘了他的网名了)
这个函数是用了半个下午写出来的。肯定有bug,不过我明天早上才开始调试它,有喜欢熬夜的人,这个代码就送给你们了。
NTSTATUS
FsDirectoryControl(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
NTSTATUS                     status;
PIO_STACK_LOCATION             irpSp        = IoGetCurrentIrpStackLocation(Irp);    //当前Irp(IO_STACK_LOCATION)的参数
PDEVICE_EXTENSION             devExt        = DeviceObject->DeviceExtension;
PFILE_BOTH_DIR_INFORMATION     dirInfo    = NULL;

BOOLEAN            bSingle            = (irpSp->Flags &SL_RETURN_SINGLE_ENTRY);
PVOID            pUserBuffer        = Irp->UserBuffer;
PVOID            pPreUserBuffer  = NULL;
ULONG            UserBufferLen    = irpSp->Parameters.QueryDirectory.Length;
PVOID            pBuffer            = NULL;
ULONG            nCurrentIndex   = 0;
ULONG            nLenLeft        = 0;
PVOID            pTempBuffer        = NULL;
ULONG            nOffset            = 0;
IO_STATUS_BLOCK ioStatus;
KEVENT waitEvent;
//UNICODE_STRING path;
ASSERT(g_CDO != DeviceObject);
ASSERT(IS_MY_DEVICE_OBJECT(DeviceObject));
if (IRP_MN_QUERY_DIRECTORY != irpSp->MinorFunction)
{
goto PASSTHROUGH;
}
if (Irp->RequestorMode == KernelMode)
{
goto PASSTHROUGH;
}
if (FileBothDirectoryInformation != ((PQUERY_DIRECTORY)&irpSp->Parameters)->FileInformationClass)
{
goto PASSTHROUGH;
}
阅读全文 »

Tags »

实现文件的重定向访问

IFS 无评论 »

View products that this article applies to.
Article ID : 319447
Last Review : February 12, 2007
Revision : 2.3
This article was previously published under Q319447
On This Page

SUMMARY

MORE INFORMATION

Sample Code
SUMMARY
The IO manager offers a convenient way to reparse a file object. Typically, this method is used in file system filter drivers to redirect a file-open or file-creation operation to another file.
Back to the top

MORE INFORMATION
To redirect a file-open or file-creation operation to another file, a file system filter driver does the following: 1. In the handler of IRP_MJ_CREATE, obtains the file name (FileName field) from the FILE_OBJECT.
2. Replaces this name with the full name of the destination file.

This full name includes the name of the volume device object (for example, Device\HardDiskVolume0\Directory\MyFile.txt). You can substitute your own buffer to the existing FileName.Buffer present in the FILE_OBJECT. In this case, allocate your buffer from NonPaged pool memory, free the original FileName.Buffer by using ExFreePool, and then replace FileName.Buffer with your buffer.
3. Sets the status field of the IoStatus block to STATUS_REPARSE, and then sets the Information field to IO_REPARSE.
4. Completes the request.
5. Returns STATUS_REPARSE.
The IO Manager then triggers another file-open operation and sends an IRP_MJ_CREATE, taking into account the particular file name.

The destination file can be local or on a remote computer. To redirect the file-open operation to a remote file, use the following syntax for the file name: • “\??\UNC\HostName\Share\File”

-or-
• “\Device\Mup\HostName\Share\File”

-or-
• “\Device\LanmanagerRedirector\HostName\Share\File” (assuming you are targeting a file on CIFS/SMB/LanManager)
The fact that the first create-file operation is performed relative to another file object does not matter. Do not modify the RelatedFileObject field of the FILE_OBJECT. To perform the reparse operation, the IO Manager considers only the FileName field and not the RelatedFileObject. Additionally, the IO Manager frees the RelatedFileObject, as appropriate, when it handles the STATUS_REPARSE status returned by the filter. Therefore, it is not the responsibility of the filter to free that file object.

There is a fixed limit concerning the number of nested reparse operations that the IO Manager can perform. This limit has been introduced to avoid infinite loops. The maximum number of nested reparse operations the system can perform is 32.

This reparsing method performed by the IO Manager has to be disassociated from reparse points. Reparse points have been introduced in NTFS, starting with Microsoft Windows 2000. Reparse points permit you to store information together with a file.
Back to the top

阅读全文 »

Tags »|

kingmax 超棒双启动(适用于kingmax 256M-16G U盘) :

未分类 无评论 »

1.超棒的量产制作设置
2.USB-CDROM 启动盘的制作
3.USB-HDD启动盘的制作
3.USB-CDROM/USB-HDD双启动的还原成普通USB移动盘操作

第一步,超棒的量产制作设置
A.下载 U盘vid和pid号码查看工具

B.下载UT163-setup-v3.7.1.0量产工具
下载地址如下:
UT163-setup-v3.7.1.0.part1.rar

UT163-setup-v3.7.1.0.part2.rar
UT163-setup-v3.7.1.0.part3.rar
UT163-setup-v3.7.1.0.part4.rar
UT163-setup-v3.7.1.0.part5.rar
C.插入U盘
D.解压
CheckUDisk.rar 运行CheckUDisk.exe,在显示的窗口中记下vid和pid号码

E.安装UT163-setup-v3.7.1.0,并运行 “Inf Update”(开始–程序–MDPT–Inf Update)
F.将刚才CheckUDisk窗口中记下vid和pid号码输入到Inf Update中后update
阅读全文 »

Tags »

Apache安装完成后,添加mod_proxy模块

Apache 无评论 »

apxs是一个为Apache HTTP服务器编译和安装扩展模块的工具,用于编译一个或多个源程序或目标代码文件为动态共享对象,使之可以用LoadModule指令在运行时加载到Apache服务器中。

1. 进入apache源代码的modules目录

2. 运行如下命令自动编译、安装和修改httpd.conf文件,激活mod_proxy模块:

apache path/bin/apxs -c -i -a mod_proxy.c proxy_util.c

选项说明:
-c 执行编译操作
-i 安装操作,安装一个或多个动态共享对象到服务器的modules目录
-a 自动增加一个LoadModule行到httpd.conf文件,以激活此模块,若此行存在则启用之
-A 与-a类似,但是它增加的LoadModule行前有井号前缀(#)
-e 需要执行编辑操作,可与-a和-A选项配合使用,与-i操作类似,修改httpd.conf文件,但并不安装此模块

3. 重启apache。

参考:apxs-Apache扩展工具

Tags »|

Apache服务器目录访问控制

Apache 无评论 »

使用密码保护Apache服务器上的目录
1. 建立密码文件
为用户rbowen建立一个密码文件(放在网络访问不到的位置,以/path表示存放路径):
利用htpasswd的工具建立密码文件:

htpasswd -c /path/passwords rbowen  (-c为强制建立新密码文件)
# htpasswd -c /path/passwords rbowen
New password: mypassword
Re-type new password: mypassword
Adding password for user rbowen

阅读全文 »

Tags »||

Apache服务器实现防盗链

Apache 无评论 »

所谓盗链,是指其他网站直接链接我们网站上的文件,一般来说,盗链的对象大多为很耗带宽的大体积文件,如图片、视频等。这样造成的后果主要有:增加了服务器的流量负担,影响我们网站的访问速度。
如果你用的是Apache服务器,可通过如下两种方式防止其他站点的用户盗链我们站点文件:

1. 使用RewriteEngine模块
确保RewriteEngine被启用(httpd.conf):

LoadModule rewrite_module modules/mod_rewrite.so

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com/.*$ [NC]
RewriteRule \.(mp3|rar)$ http://www.domain.com/nolink.png [R=301,L]

功能:
不仅屏蔽/禁止非本网站的盗链访问,还将盗链请求转给自身的网站
阅读全文 »

Tags »|||

修改Firefox缓存的位置

网络资源 无评论 »
  1. 打开Firefox浏览器,在地址栏输入  about:config
  2. 查找  browser.cache.disk.parent_directory,如果没有找到  browser.cache.disk.parent_directory ,则通过右键新建这个”字符串
  3. 修改到你需要存放的位置,例如M:\Firefox
  4. 重启 Firefox 程序
  5. 最后验证一下是不是生效了
    在地址栏输入  about:cache ,可以发现Cache位置已经成功修改
    Cache Directory:    M:\Firefox\Cache
Tags »

Oracle Backup 方法

Oracle 无评论 »

备份数据库三个标准的方法: exports, offline backups(离线备份), online backups(在线备份), exports是逻辑备份, 另两方法为物理备份. 物理备份首选工具为RMAN.

备份策略应包含物理和逻辑备份, 生产库以物理备份为主, 逻辑备份为辅.

Logical Backups

Data Pump Export 与Data Pump Import , 使用XML文件.

注: Oracle Import和Export工具在11g中仍可以安装, 但鼓励使用Data Pump Export与Data Pump Import代替.

全库导出将导出数据库的所有对象, 包含表空间, 数据文件和用户, 可从导出数据中导入部分或者全部数据, 在做全库导入时这些对象都将被创建, 利用表空间和用户的重建有利于重新指定数据库对象的物理分布. 如果从导出文件中导入部分数据, 需要在导入前设置好表空间, 数据文件和数据的所有者.

Physical Backups

Offline Backups

在数据库正常关闭情况下, 即shutdown命令使用normal, immediate或transactional选项.当数据库脱机时, 备份下面文件:

阅读全文 »

Tags »|

下载rapidshare的文件方法

网络资源 无评论 »

下载rapidshare的文件方法

提升从rapidshare下载文件速度的方法, 记录一下.

1. 选Free user(付费的当然不用点此);
2. 等30~100秒;
3. 不要点“download”,展开“Advanced download settings”;
4. 选Deutsche Telekom;
5. 再点“download”,此时速度会达30~200kb/秒(2M带宽),速度可以了。

Tags »

linux下 vsftpd的配置

Linux, 网络资源 无评论 »

所需安装软件:

虚拟机:vmware6.0

linux:redhat enterprise 5

操作系统:windows xp

安装好vm+linux后,该linux系统默认已经安装了vsftpd 。

配置前的准备:

1.在windows中设置vm其中一块虚拟网卡的ip(192.168.59.1  255.255.255.0)

2.在linux设置ip:

#vi /etc/sysconfig/network-scripts/ifcfg-eth0

ifcfg-eth0文件内容如下:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.59.255
HWADDR=00:0C:29:23:27:8B
IPADDR=192.168.59.123
NETMASK=255.255.255.0
NETWORK=192.168.59.0
ONBOOT=yes

保存退出(:wq)

3.重起网卡

# service network restart

4.关闭防火墙

# service iptables stop

5.在windows下测试网络是否相通(ping 192.168.59.123)(能够相通说明前期准备成功)

阅读全文 »

Tags »

linux下 mysql 的卸载和安装及用户管理

MySQL 无评论 »

前面几篇写了如何安装jdk 和 tomcat,搞web开发还差个数据库吧,好了现在就介绍一下mysq的安装吧,

一、前期准备:

1.由于redhat Enterprise 5 中自带一个mysql的版本,如果在安装linux前未选择mysql的安装此步就可跳过,因为我当时安装了现在将其卸载 ,步骤如下:

a. 查找已安装的myslq 版本:

#rpm  -qa | grep  mysql (注意大小写,如果mysql 不行就换MySQL)

在屏幕上将显示已安装的mysql包名如:mysql-5.0.22-2.1.0.1 ;

b. 将搜索出的包名卸载:

#rpm -e  –nodeps mysql-5.0.22-2.1.0.1 (nodeps表示强制删除)

c. 再次查找该包名,如果没有结果输出则表明已将该版本的mysql卸载了 ;

阅读全文 »

Tags »