Archive for the ‘software & hardware’ Category

免费软件套装

Monday, January 8th, 2007

在 CB 上看到的……

办公

OpenOffice - office suite
PC Suite 602 - office suite
AbiWord - text editor
Atlantis Nova - text editor
Microsoft PowerPoint Viewer - power point files viewer
Adobe Reader - pdf reader
Foxit PDF Reader - pdf reader
PDFCreator - create pdf documents
Doc Convertor - document convertor
Convert - unit convertor
Converber - unit convertor
Sunbird - calendar/organizer
EssentialPIM Free - calendar/organizer
PhraseExpress - speed up your writing
ATnotes - create notes on the desktop

解压缩

7-Zip - compression program
IZArc - compression program
TugZIP - compression program
CabPack - compression program
Universal Extractor - extract files from any type of archive

互联网

Firefox - browser
Internet Explorer- browser
Maxthon - browser
Opera - browser
Avant Browser - browser
Thunderbird - email client
PopTray - check for emails
Free Download Manager - download manager
FlashGet - download manager
WellGet - download manager
Download Master - download manager
WGET - commandline download manager
HTTrack - offline browser
WebReaper - offline browser
Yeah Reader - RSS reader
GreatNews - RSS reader
RSSOwl - RSS reader

P2P

µTorrent - torrent client
Azureus - torrent client
BitComet - torrent client
ABC - torrent client
BitTornado - torrent client
eMule - p2p client
SoulSeek - p2p client
Shareaza - p2p client
DC++ - Direct Connect network client
PeerGuardian - IP blocker

聊天

Miranda - chat client
MSN Messenger - chat client
Yahoo Messenger - chat client
QIP - chat client
Gaim - chat client
JAJC - chat client
HydraIRC - IRC client
Talkative IRC - IRC client
IceChat - IRC client
Skype - VOIP client
Google Talk - VOIP client
VoipStunt - VOIP client
Gizmo - VOIP client
Wengo - VOIP client

安全

AVG Free - antivirus
Avast Home Free - antivirus
AntiVir PersonalEdition - antivirus
BitDefender Free - antivirus
ClamWin - antivirus
CyberDifender - Internet Security Suite
Ad-aware - anti-spyware
Spybot: Search & Destroy - anti-spyware
Windows Defender - anti-spyware
SpywareBlaster - anti-spyware
Spyware Terminator - anti-spyware
Tootkit Reveaker - rootkit detection utility
Winpooch - system protection
HiJack Free - system protection
HighJackThis - hijackers detector and remover
Kerio Personal Firewall - firewall
Sygate Personal Firewall - firewall
ZoneAlarm - firewall
AxCrypt - file encryption
Simple File Shredder - securely delete files
PuTTy - SSH client
KeePass - password manager
LockNote - password manager
nPassword - password manager
Microsoft Baseline Security Analyzer - identify security misconfigurations

网络

Hamachi - VPN client
RealVNC - remote control
UltraVNC - remote control
Ethereal - local area network administration
The Dude - network administration
Wireshark - network administration
Angry IP Scanner - IP scanner
IP-Tools - IP scanner
Free Port Scanner - IP scanner
NetMeter - network bandwidth monitoring

服务器

FileZilla - FTP client
FileZilla Server - FTP
EFTP - FTP client/
XAMPP - integrated package of Apache, mySQL, and Perl
WAMP - Apache, PHP5 and MySQL

音频

Foobar2000 - audio player
WinAmp - audio player
1by1 - audio player
JetAudio - audio player
XMPlay - audio player
Xion - audio player
Apollo - audio player
MediaMonkey - music organizer
The GodFather - music organizer
dBpowerAMP - audio converter
Audacity - audio converter
WavePad - audio converter
Kristal Audio Engine - audio editor
Exact Audio Copy - CD ripper
Audiograbber - CD ripper
CDex - CD ripper
Mp3 Tag Tools - tag editor
Mp3tag - tag editor
Taggin’ MP3 - tag editor
Monkey’s Audio - APE compressor/decompressor
mpTrim - mp3 editor
WavTrim - wave editor
EncSpot Basic - analyse mp3 files

视频

Windows Media Player - audio/video player
VLC - video player
Media Player Classic - video player
MV2Player - video player
CrystalPlayer 1.95 - video player
Zoom Player - video player
GOM Player - video player
viPlay - video player
DSPlayer - video player
VirtualDub - video editor
CamStudio - video screen recording
AviSplit - Avi splitter
Video mp3 Extractor - rip audio from video files
Free iPod Converter - convert all popular video formats to iPod video
MediaPortal - turning your PCinto a Media Center
The FilmMachine

图像

Gimp - image editor
PhotoFiltre - image editor
Paint.net - image editor
ArtRage - image editor
Artweaver - image editor
IrfanView - image viewer
Picasa - image viewer
XnView - image viewer
FastStone Image Viewer - image viewer
FuturixImager - image viewer
Easy Thumbnails - create thumbnails from images
JoJoThumb - create thumbnails from images
iWebAlbum - create photo albums
JAlbum - create photo albums
3D Box Shot Maker - design quality box shot
FastStone Capture - screen capture
WinSnap - screen capture

3D

Blender3D - 3D renderer
3Delight Free - 3D renderer
SketchUp - 3D modeling
Maya Learning Edition - 3D modeling

开发

AutoIt - task automation
SciTE4AutoIt3 - text editor for AutoIt
AutoHotkey - task automation
PHP Designer - editor
Notepad++ - text editor
ConTEXT Editor - text editor
PSPad - text editor
FoxEditor - text editor
Crimson Editor - source code editor
Elfima Notepad - text editor
Notepad2 - text editor
Nvu - editor
Alleycode - editor
BlockNote - page editor
Weaverslave - page editor

CD/DVD

DeepBurner - CD/DVD burner
CDBurner XP Pro - CD/DVD burner
BurnAtOnce - CD/DVD burner
Express Burn - CD/DVD burner
Zilla CD-DVD Rip’n’Burn - CD/DVD
刻录
ImgBurn - ISO, BIN burner
Daemon tools - virtual CD/DVD
DVD Decrypter - DVD ripper
DVD Shrink - DVD ripper
Nero CD-DVD Speed - CD/DVD info and quality test
解码

GSpot - codec information
AC3Filter - audio codec
Xvid - video codec
QuickTime Alternative - video codec
Real Alternative - video codec
K-Lite Codec Pack - all codecs

系统工具

CCleaner - system cleaner
xp-AntiSpy - OS setup
jv16 Powertools - system utilities
XP SysPad - system monitoring utility
What’s Running - process guard
Registrar Lite - registry editor
WinIPConfig - replacement for “ipconfig.exe” and “route.exe”
Unlocker - file eraser
Eraser - secure file eraser
Undelete Plus - file recovery
freeCommander - file manager
ExplorerXP - file manager
Duplicate File Finder - find all duplicate files
Ant Renamer - file renaming
ReNamer - file renaming
Icons From File - icos extractor
Chaos MD5 - MD5 generator
HashTab - MD5, SHA1 and CRC-32 file hashes
Rainlendar Lite - desktop calendar
Weather Watcher - weather firecast
Subtitle Workshop - subtitles editor
Ant Movie Catalog - movie organizer
Disclib - CD organizer
Dexpot - virtual desktops
DriveImage XML - create partition images
MozBackup - backup and restore bookmarks, etc.
SyncBack - system backup
Atomic Cock Sync - syncronize your clock
Citrus Alarm Clock - alarm clock
TaskSwitchXP - Alt-Tab replacement
Launchy - application launcher
allSnap - make all snap
Sysinternals Tools - various system tools
StrokeIt - mouse gestures
Net Profiles - create profiles of your network settings
ResourceHacker - view, modify, rename, add, delete
Java Runtime Environment - for

UI设计

RocketDock - application launcher
AveDesk - desktop enhancer
IconPhile - customize ’s system icons
CursorXP Free - change mouse cursors
MacSound - volume control
LClock - Longhorn clock
Y’z Dock - application launcher
Y’z Shadow - shadow effect to the 
Y’z Toolbar - change the toolbar icons in Explorer and Internet Explorer
Taskbar Shuffle - rearrange the programs on the taskbar by dragging
Visual Task Tips - thumbnail preview image for each task in the taskbar
Badges - put badges on any folder or file
Folderico - change icons of the folders
Folder Marker - mark your folders
Folder2MyPC - add favourite locations to My Computer
Microsoft TweakUI - system settings
BricoPacks - packs
ShellPacks - packs
Tango Shell Patcher - patcher
XPize - GUI enhancer
Vista Transformation Pack - complete visual style
Vista Sound Scheme - Vista sound scheme
Royale Theme - visual style

硬件检测

CPU-Z - cpu information
CrystalCPUID - cpu information
Central Brain Identifier - cpu information
Everest - system information
SiSoft Sandra - system information
SpeedFan - hardware monitor
Memtest86 - memory test
PowerMax - HDD test
3Dmark 06 - 3D game performance benchmark
Aquamark - performance benchmark
rthdribl - 3D benchmark
Fraps - 3D benchmark, fps viewer and screen recorder
Prime 95 - cpu benchmarking
SuperPI - cpu benchmarking
CPU Rightmark - cpu overclock
Core Temp - cpu temperature
ATiTool - video overclock
ATI Tray Tools - Radeon tweaker
aTuner - GeForce and Radeontweaker
RivaTuner - video overclock
Nokia Monitor Test - monitor adjustmets
UDPixel - fix dead pixels

游戏

123 Free Solitaire - solitaire games collection
Arcade Pack - classic arcade games
Live For Speed - online racing simulator
Enigma - puzzle game
Freeciv - multiplayer strategy game
Tux Racer - race down steep, snow-covered mountains

教育

SpeQ Mathematics - mathematics program
Dia - diagram creation program
Google Earth - explore the world
NASA World Wind - 3D virtual globe
Celestia - explore the space
Stellarium - planetarium

杂类

nLite - Build your own custom disk.
VirtualPC - create virtual machines
grabMotion - webcam capture
iDailyDiary - simple page-for-a-day diary
Pivot Stickfigure Animator - create stick-figure animations
Wink - create presentations
Scribus - professional page layout
FreeMind - midn mapping software
Windows Live Writer - WYSIWYG authoring

墙纸

Michael Swanson - 1920 x 1200; 1600 x 1200; amazing wallpapers
Mikhail Arkhipov - 1920 x 1200; 1600 x 1200; amazing wallpapers

Intype alpha 0.2.x 提供下载

Monday, January 8th, 2007

有些人可能没有听过这个名字,不过说起他的兄弟 TextMate 或许有 Apple 经验的人就不陌生了吧。这个 Intype 就是他的 版本的实现。

以下为邮件原文:
Hello,

 we are proud to announce our first Intype Alpha release.
 
 Download link is available at:
  http://intype.info/home/
 
 Support forums are available at:
  http://intype.info/forums/
 
 Your e-mail address has been deleted from our database and
 no further e-mails will be sent to you.
 
 Next releases will be announced via Intype and
 Intype Forums.
 
Thank you for your interest,
Intype Team

活学活用Windows Server 2003分区增容功能

Sunday, January 7th, 2007

分区增容就是当一个分区的空间不能满足使用需求时,为其额外加大空间的方法。很多朋友遇到这种情况时,一般都使用PartitionMagic完成的。但实际上,使用 XP/ 2003的用户完全可以使用系统内置的磁盘管理功能来完成分区的空间“增容”。下面我们以实例的方式来探讨一下。

  一、划出自由空间

假设现在需要对D盘增容50MB的空间,这个空间需要从E盘上提取。那么首先要就从E盘上划分出这50MB的空间才行。这个操作的过程如下:

  首先将E盘所有数据转移到其它分区,然后单击“开始→运行”,输入“Diskmgmt.msc”后回车,打开“磁盘管理”窗口。选中E盘并点击右键,在弹出的快捷菜单中选择“删除此逻辑驱动器”项。在弹出的提示框中点击“是”按钮继续。操作完毕后,将会在“磁盘0”列中出现与删除分区相同大小的可用空间。

  二、给分区增容

  此时请注意D盘当前空间为855MB,现在我们来进行为其增加50MB的操作。单击“开始→程序→附件→命令提示符”,在打开的窗口中依次输入“Diskpart”、“List volume”、“Select volume 2”、“Extend Size=50”四条命令。

  其中,“Diskpart”命令用来调用DOS磁盘管理程序,“Diskpart/?”命令可以看到该命令的DOS下中文帮助信息。“List Volume”用于显示系统上所有磁盘的详细信息,从而得知所需扩充分区的卷号。这里可以看出D盘的卷号为“2”;“Select Volume 2”命令用于选择卷,这里根据上一步得出的提示选择卷2;“Extend Size=50”用于将D盘空间增容,这个增容的来源空间当然是划分出的自由空间了。从命令执行的结果“DiskPart成功地扩展了卷”来看,我们对D盘的空间增容已经成功了。

  最后在“磁盘管理窗口”中选择剩余的可用空间,依次点击“操作→所有任务→新建逻辑驱动器”命令,根据提示为该空间分配驱动器号和进行格式化操作即可。

深入Native应用程序

Wednesday, January 3rd, 2007

版权所有 1998 Mark Russinovich

 

翻译:MJ0011

最后更新:1998年2月8日

导言

如果你对WindowsNt结构有一定的了解,你可能会知道,Win32应用程序所使用的API,并非是"真正"的NT API

。POSIX,OS/2和Win32,这些WindowsNT操作系统环境,使用他们自己的API同他们的客户应用程序进行交流,

但却使用NT "native" API同 WindowsNT进行交流.这些native API大部分都是未公开的(undocumented)。大

约只有25个API(包含250种功能)在WindowsNT设备驱动开发工具包(Device Driver Kit)里有所描述。

尽管绝大多数人都不知道,但"native"应用程序的确存在与WindowsNT上,他们在操作环境上没有任何客户程

序. 这些程序交流着native nt API并且不能使用任何操作环境API比如 Win32. 为什么这样一种程序是必须

的呢?因为在Win32子系统启动之前(大约在登陆对话框出现时)只可以运行native应用程序.最常见的native

应用程序的例子是"autochk"程序,他在初始化兰色登陆屏幕前运行 chkdsk(程序在屏幕上打印一串".")。

当然,Win32应用程序环境服务程序:CSRSS.exe(客户-服务运行时间子系统),也是一个native应用程序

在这篇文章里,我将会讲述如何构造一个native应用程序以及它们是如何工作的,同时我也会提供一个

native应用程序的示例源代码。这个示例很容易安装,它会在启动时的兰色屏幕打印一段你指定的字符串

Autochk是如何被执行的

Autochk在当内存分页被打开,启动和系统开始驱动被载入之间的时间内运行。在这个时间点 启动顺

序会话管理器(smss.exe)进入windowsNT用户模式,并且没有任何程序被启动
注册表中:HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute
一个MULTI_SZ类型的键值
这里存放着将被会话管理器所执行的程序名称和参数
通常Autochk后加*号作为其参数"

Autocheck Autochk *
;名称 程序名 参数

会话管理器在<winnt>\system32目录下查找该值列出的可执行程序.当Autochk运行时,没有任何文件被打开

,所以Autochk可以用raw模式打开任何一个驱动器卷(包括根驱动器),并操作其磁盘数据结构.之后的任何

时间点都无法进行类似这样的操作

编译Native应用程序
微软没有提供相应的文档,但是NT DDK构建器知道如何去生成一个native应用程序,而且它可以被用来编译

autochk程序.和编写设备驱动程序一样,你必须指定SOURCE文件中的信息来定义应用程序。然而和编写驱动

不同的时,你在SOURCE文件中要求生成一个native应用程序需要这样定义:

TARGETTYPE=PROGRAM

构建器使用一个标准的makefile来进行向导:\ddk\inc\makefile.def 在编译native应用程序时会查找名为

nt.lib的运行库。不幸的是,微软并没在DDK上装载这个文件(在  2003 DDK里包括了这个文

件,但是我怀疑你用这个版本来连接你的native应用程序是无法运行在WindowsXP或win2000上的)
不管怎样,你可以忽略这个错误,方法是加入一行不考虑nt.lib,而指定visual c++的运行库msvcrt.lib到

makefile.lib中

如果你在DDK的"Checked Build"环境下进行编译,将会在%BASEDIR%\lib\%CPU%\Checked(例如

c:\ddk\lib\i386\checked\native.exe)产生一个包含了全部调试信息的native应用程序。如果你在"Free 

Build"环境中编译,你会在%BASEDIR%\lib\%CPU%\Free得到一个释出版本的程序.这些和构造设备驱动程序

放置的位置是一样的。

Native应用程序有着".exe"的扩展名,但是你不能象 win32的.exe文件那样去运行它,如果你在WIN32环境

下运行下,将会得到如下提示:

"<应用程序名> 应用程序无法在Win32模式中运行。"

深入学习一个native应用程序

native应用程序的入口点是NtProcessStartup,类似winmain或main.不同于其他的 Win32入口点的是,

native应用程序提供一个数据结构来存放它的唯一的参数来定位命令行参数

大多数的native应用程序的运行环境是由WindowsNt的native API输出库—NTDLL.DLL提供的。native应用

程序必须使用RtlCreateHeap(一个ntdll函数)来创建他们自己的堆来分配存储,使用RtlAllocateHeap来分

配内存以及用RtlFreeHeap来释放内存。native应用程序需要使用NtDisplayString 函数才可以打印想要的

内容到屏幕上(将被输出到初始化时的兰色屏幕上)

Native应用程序不象win32程序那样简单地从他们的启动函数返回,你需要调用NtProcessTerminate函数来

结束它的进程

NTDLL运行包含了数百个函数允许native应用程序执行文件I/O,与设备驱动进行相连,并执行进程间通讯。

不幸的是,他们大部分都是未公开的。

一个native应用程序的例子
我创建一个“玩具”native 应用程序用来演示native应用程序是如何构建的以及他们是如何工作的。运行

install.bat来安装native程序。批处理程序复制native.exe到你的<winnt>\system32目录并在注册表中增

加一个BootExecute的入口点:

native Hello World!

当你重新启动时,会话管理器运行完autochk后就会执行native。native分配一些堆,定位它的命令行参数

并打印参数("Hello world!")到兰色屏幕上,它所使用的函数上面已说过了。如果你想要打印其他的简单内

容,可以编辑BootExecute值使用regedit或regedit32,修改"Hello world"为你想要的信息

运行uinstall.bat可以卸载这个native执行程序。它从<winnt>\system32目录删除native.exe,并修改

BootExecute值为通常的值

如果你想要构建native程序你必须要用设备驱动工具包(DDK),复制makefile.def到 \ddk\inc然后你

可以运行构建

 

=========================================================
Native.H

//======================================================================
//
// Native.h
//
// Mark Russinovich
// http://www.ntinternals.com
//
// This file includes the definitions required by the Native.exe sample
// NT native program to do what it does. 
//
//======================================================================

//
// Environment information, which includes command line and
// image file name
//
typedef struct {
       ULONG            Unknown[21];     
       UNICODE_STRING   CommandLine;
       UNICODE_STRING   ImageFile;
} ENVIRONMENT_INFORMATION, *PENVIRONMENT_INFORMATION;

//
// This structure is passed as NtProcessStartup’s parameter
//
typedef struct {
       ULONG                     Unknown[3];
       PENVIRONMENT_INFORMATION  Environment;
} STARTUP_ARGUMENT, *PSTARTUP_ARGUMENT;

//
// Data structure for heap definition. This includes various
// sizing parameters and callback routines, which, if left NULL,
// result in default behavior
//
typedef struct {
 ULONG     Length;
 ULONG     Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;

//
// Native NT api function to write something to the boot-time
// blue screen
//
NTSTATUS 
NTAPI 
NtDisplayString(
  PUNICODE_STRING String 
  );

//
// Native applications must kill themselves when done - the job
// of this native API
//
NTSTATUS 
NTAPI 
NtTerminateProcess(
     HANDLE ProcessHandle, 
     LONG ExitStatus 
     );

//
// Definition to represent current process
//
#define NtCurrentProcess() ( (HANDLE) -1 )

//
// Heap creation routine
//
HANDLE 
NTAPI 
RtlCreateHeap(
       ULONG Flags, 
       PVOID BaseAddress, 
       ULONG SizeToReserve, 
       ULONG SizeToCommit, 
       PVOID Unknown,
       PRTL_HEAP_DEFINITION Definition
       );

//
// Heap allocation function (ala "malloc")
//
PVOID 
NTAPI 
RtlAllocateHeap(
  HANDLE Heap, 
  ULONG Flags, 
  ULONG Size 
  );

//
// Heap free function (ala "free")
//
BOOLEAN 
NTAPI 
RtlFreeHeap(
     HANDLE Heap, 
     ULONG Flags, 
     PVOID Address 
     );

=========================================================================
Native.C

//======================================================================
//
// Native.c
//
// Mark Russinovich
// http://www.ntinternals.com
//
// This is a demonstration of a Native NT program. These programs
// run outside of the Win32 environment and must rely on the raw
// services provided by NTDLL.DLL. AUTOCHK (the program that executes
// a chkdsk activity during the system boot) is an example of a
// native NT application.
//
// This example is a native ’hello world’ program. When installed with
// the regedit file associated with it, you will see it print 
// "hello world" on the initialization blue screen during the system
// boot. This program cannot be run from inside the Win32 environment.
//
//======================================================================
#include "ntddk.h" // include this for its native functions and defn’s
#include "stdio.h"
#include "native.h"

//
// Our heap
//
HANDLE Heap;

//———————————————————————-
//
// NtProcessStartup
//
// Instead of a ’main’ or ’winmain’, NT applications are entered via
// this entry point.  
//
//———————————————————————-
void NtProcessStartup( PSTARTUP_ARGUMENT Argument )
{
    PUNICODE_STRING commandLine;
    PWCHAR stringBuffer, argPtr;
    UNICODE_STRING helloWorld;
    RTL_HEAP_DEFINITION  heapParams;

    //
    // Initialize some heap
    //
    memset( &heapParams, 0, sizeof( RTL_HEAP_DEFINITION ));
    heapParams.Length = sizeof( RTL_HEAP_DEFINITION );
    Heap = RtlCreateHeap( 2, 0, 0×100000, 0×1000, 0, &heapParams );

    //
    // Point at command line
    //
    commandLine = &Argument->Environment->CommandLine;

    //
    // Locate the argument
    //
    argPtr = commandLine->Buffer;
    while( *argPtr != L’ ’ ) argPtr++;
    argPtr++;

    //
    // Print out the argument
    //
    stringBuffer = RtlAllocateHeap( Heap, 0, 256 );
    swprintf( stringBuffer, L"\n%s", argPtr );
    helloWorld.Buffer = stringBuffer;
    helloWorld.Length = wcslen( stringBuffer ) * sizeof(WCHAR);
    helloWorld.MaximumLength = helloWorld.Length + sizeof(WCHAR);
    NtDisplayString( &helloWorld );

    //
    // Free heap
    //
    RtlFreeHeap( Heap, 0, stringBuffer );

    //
    // Terminate
    //
    NtTerminateProcess( NtCurrentProcess(), 0 );
}

===========================================================================

Install.bat

@echo off
copy native.exe %systemroot%\system32\.
regedit /s add.reg
echo Native Example Installed

=============================================================================
uinstall.bat

@echo off
del %systemroot%\system32\native.exe
regedit /s remove.reg
echo Native Example Uninstalled

转自:http://hi.baidu.com/mj0011/blog/item/85c0b50f80b1baedab6457de.html

办公小助手 DeskTask

Monday, January 1st, 2007

很好用的小软件,可以和 outlook 配合起来用,相当不错噢~!

Mysql 优化

Wednesday, December 27th, 2006

7.3 锁

7.3.1 锁机制

当前MySQL已经支持 ISAM, MyISAM, MEMORY (HEAP) 类型表的表级锁了,BDB 表支持页级锁,InnoDB 表支持行级锁。

很多时候,可以通过经验来猜测什么样的锁对应用程序更合适,不过通常很难说一个锁比别的更好,这全都要依据应用程序来决定,不同的地方可能需要不同的锁。

想要决定是否需要采用一个支持行级锁的存储引擎,就要看看应用程序都要做什么,其中的查询、更新语句是怎么用的。例如,很多的应用程序大量的做查询,很少删除,主要是基于索引的更新,只往特定的表中插入记录。采用基本的MySQL MyISAM 表就很合适了。

MySQL中对表级锁的存储引擎来说是释放死锁的。避免死锁可以这样做到:在任何查询之前先请求锁,并且按照请求的顺序锁表。

MySQL中用于 WRITE(写) 的表锁的实现机制如下:

 

如果表没有加锁,那么就加一个写锁。

否则的话,将请求放到写锁队列中。

MySQL中用于 READ(读) 的表锁的实现机制如下:

 

如果表没有加写锁,那么就加一个读锁。

否则的话,将请求放到读锁队列中。

当锁释放后,写锁队列中的线程可以用这个锁资源,然后才轮到读锁队列中的线程。

这就是说,如果表里有很多更新操作的话,那么 SELECT 必须等到所有的更新都完成了之后才能开始。

从 MySQL 3.23.33 开始,可以通过状态变量 Table_locks_waited 和 Table_locks_immediate 来分析系统中的锁表争夺情况:

 

mysql> SHOW STATUS LIKE ‘Table%’;

+———————–+———+

| Variable_name | Value |

+———————–+———+

| Table_locks_immediate | 1151552 |

| Table_locks_waited | 15324 |

+———————–+———+

在 MySQL 3.23.7(在上是3.23.25)以后,在 MyISAM 表中只要没有冲突的 INSERT 操作,就可以无需使用锁表自由地并行执行 INSERT 和 SELECT 语句。也就是说,可以在其它客户端正在读取 MyISAM 表记录的同时时插入新记录。如果数据文件的中间没有空余的磁盘块的话,就不会发生冲突了,因为这种情况下所有的新记录都会写在数据文件的末尾(当在表的中间做删除或者更新操作时,就可能导致空洞)。当空洞被新数据填充后,并行插入特性就会自动重新被启用了。

如果想要在一个表上做大量的 INSERT 和 SELECT 操作,但是并行的插入却不可能时,可以将记录插入到临时表中,然后定期将临时表中的数据更新到实际的表里。可以用以下命令实现:

 

mysql> LOCK TABLES real_table WRITE, insert_table WRITE;

mysql> INSERT INTO real_table SELECT * FROM insert_table;

mysql> TRUNCATE TABLE insert_table;

mysql> UNLOCK TABLES;

InnoDB 使用行级锁,BDB 使用页级锁。对于 InnoDB 和 BDB 存储引擎来说,是可能产生死锁的。这是因为 InnoDB 会自动捕获行锁,BDB 会在执行 SQL 语句时捕获页锁的,而不是在事务的开始就这么做。

行级锁的优点有:

 

在很多线程请求不同记录时减少冲突锁。

事务回滚时减少改变数据。

使长时间对单独的一行记录加锁成为可能。

行级锁的缺点有:

 

比页级锁和表级锁消耗更多的内存。

当在大量表中使用时,比页级锁和表级锁更慢,因为他需要请求更多的所资源。

当需要频繁对大部分数据做 GROUP BY 操作或者需要频繁扫描整个表时,就明显的比其它锁更糟糕。

使用更高层的锁的话,就能更方便的支持各种不同的类型应用程序,因为这种锁的开销比行级锁小多了。

表级锁在下列几种情况下比页级锁和行级锁更优越:

 

很多操作都是读表。

在严格条件的索引上读取和更新,当更新或者删除可以用单独的索引来读取得到时:

 

UPDATE tbl_name SET column=value WHERE unique_key_col=key_value;

DELETE FROM tbl_name WHERE unique_key_col=key_value;

SELECT 和 INSERT 语句并发的执行,但是只有很少的 UPDATE 和 DELETE 语句。

很多的扫描表和对全表的 GROUP BY 操作,但是没有任何写表。

表级锁和行级锁或页级锁之间的不同之处还在于:

将同时有一个写和多个读的地方做版本(例如在MySQL中的并发插入)。也就是说,数据库/表支持根据开始访问数据时间点的不同支持各种不同的试图。其它名有:时间行程,写复制,或者是按需复制。

原文: Versioning (such as we use in MySQL for concurrent inserts) where you can have one writer at the same time as many readers. This means that the database/table supports different views for the data depending on when you started to access it. Other names for this are time travel, copy on write, or copy on demand.

按需复制在很多情况下比页级锁或行级锁好多了。尽管如此,最坏情况时还是比其它正常锁使用了更多的内存。

可以用应用程序级锁来代替行级锁,例如MySQL中的 GET_LOCK() 和 RELEASE_LOCK()。但它们是劝告锁(原文:These are advisory locks),因此只能用于安全可信的应用程序中。

 

7.3.2 锁表

为了能有快速的锁,MySQL除了 InnoDB 和 BDB 这两种存储引擎外,所有的都是用表级锁(而非页、行、列级锁)。

对于 InnoDB 和 BDB 表,MySQL只有在指定用 LOCK TABLES 锁表时才使用表级锁。在这两种表中,建议最好不要使用 LOCK TABLES,因为 InnoDB 自动采用行级锁,BDB 用页级锁来保证事务的隔离。

如果数据表很大,那么在大多数应用中表级锁会比行级锁好多了,不过这有一些陷阱。

表级锁让很多线程可以同时从数据表中读取数据,但是如果另一个线程想要写数据的话,就必须要先取得排他访问。正在更新数据时,必须要等到更新完成了,其他线程才能访问这个表。

更新操作通常认为比读取更重要,因此它的优先级更高。不过最好要先确认,数据表是否有很高的 SELECT 操作,而更新操作并非很‘急需’。

表锁锁在一个线程在等待,因为磁盘空间满了,但是却需要有空余的磁盘空间,这个线程才能继续处理时就有问题了。这种情况下,所有要访问这个出问题的表的线程都会被置为等待状态,直到有剩余磁盘空间了。

表锁在以下设想情况中就不利了:

 

一个客户端提交了一个需要长时间运行的 SELECT 操作。

其他客户端对同一个表提交了 UPDATE 操作,这个客户端就要等到 SELECT 完成了才能开始执行。

其他客户端也对同一个表提交了 SELECT 请求。由于 UPDATE 的优先级高于 SELECT,所以 SELECT 就会先等到 UPDATE 完成了之后才开始执行,它也在等待第一个 SELECT 操作。

下列所述可以减少表锁带来的资源争夺:

 

让 SELECT 速度尽量快,这可能需要创建一些摘要表。

启动 mysqld 时使用参数 –low-priority-updates。这就会让更新操作的优先级低于 SELECT。这种情况下,在上面的假设中,第二个 SELECT 就会在 INSERT 之前执行了,而且也无需等待第一个SELECT 了。

可以执行 SET LOW_PRIORITY_UPDATES=1 命令,指定所有的更新操作都放到一个指定的链接中去完成。详情请看“14.5.3.1 SET Syntax”。

用 LOW_PRIORITY 属性来降低 INSERT,UPDATE,DELETE 的优先级。

用 HIGH_PRIORITY 来提高 SELECT 语句的优先级。详情请看“14.1.7 SELECT Syntax”。

从MySQL 3.23.7 开始,可以在启动 mysqld 时指定系统变量 max_write_lock_count 为一个比较低的值,它能强制临时地提高表的插入数达到一个特定值后的所有 SELECT 操作的优先级。它允许在 WRITE 锁达到一定数量后有 READ 锁。

当 INSERT 和 SELECT 一起使用出现问题时,可以转而采用 MyISAM 表,它支持并发的SELECT 和 INSERT 操作。

当在同一个表上同时有插入和删除操作时,INSERT DELAYED 可能会很有用。详情请看“14.1.4.2 INSERT DELAYED Syntax”。

当 SELECT 和 DELETE 一起使用出现问题时,DELETE 的 LIMIT 参数可能会很有用。详情请看“14.1.1 DELETE Syntax”

执行 SELECT 时使用 SQL_BUFFER_RESULT 有助于减短锁表的持续时间.详情请看“14.1.7 SELECT Syntax”。

可以修改源代码 `mysys/thr_lock.c’,只用一个所队列。这种情况下,写锁和读锁的优先级就一样了,这对一些应用可能有帮助。

以下是MySQL锁的一些建议:

 

只要对同一个表没有大量的更新和查询操作混在一起,目前的用户并不是问题。

执行 LOCK TABLES 来提高速度(很多更新操作放在一个锁之中比没有锁的很多更新快多了)。将数据拆分开到多个表中可能也有帮助。

当MySQL碰到由于锁表引起的速度问题时,将表类型转换成 InnoDB 或 BDB 可能有助于提高性能。详情请看“16 The InnoDB Storage Engine”和“15.4 The BDB (BerkeleyDB) Storage Engine”。

来源:网络

Nanoweb

Monday, November 27th, 2006

自是没想到, 还能再写出 HTTP 来……看来我们的思维被局限住了……只有想不到,没有做不到…..     :)

Nanoweb is an HTTP written in , designed to be small, secure, and extensible.

It is distributed under the terms of the GNU General Public License.

Nanoweb’s main features are :

- HTTP/1.1 compliance
- Powerful and easy configuration
- Modular architecture
- FastCGI, CGI and side includes support
- Name and port based virtual hosts
- Access control lists
- htpasswd, MySQL, PostgreSQL and LDAP authentication support
- Themes for generated content
- Apache compatible log format, MySQL logging
- Directory browsing
- inetd support and SSL via external helpers
- Denial of Service protection
- Proxy extension
- Filters and gzip support
- RBL support (mail-abuse.org)
- Extension Protocols (request methods) support
- … and a lot more

Why should you use it ?

It’s light, fast and robust.

Also being written in makes it very easily extensible with custom modules, and secure because - running inside the Zend scripting engine - it’s immune to a number of common security threats (format strings, buffer overflows, …).

Thanks to its very modular architecture, Nanoweb can also be used as a framework to develop your own standalone based applications.

Download, then extract it. Read INSTALL, run install-sh.

For more, read the manual or mail the author

Nanoweb 是一个用 编写的足够安全、精简、可扩展的 HTTP 服务器软件,他是基于 GNU 协议的.因为是用 语言编写的,所以他很容易通过自定义模块扩展,并且因为是运行在 Zend 脚本引擎内部所以他很安全.它避免了因为一些诸如字符串格式化、缓冲区溢出等普遍的安全问题而造成的系统假死.我们应该感谢这种模块化的结构,使 Nanoweb 也可以做为一个框架来开发你独立的 应用.

Nanoweb 的主要特性是:
- 兼容 HTTP/1.1 协议
- 简单、强大的配置方法
- 模块化结构
- 支持 FastCGI、CGI 和 SSI
- 支持虚拟主机
- 支持访问控制列表
- 支持 htpasswd、MySql、PostgreSQL 和 LDAP 认证
- 服务器端生成文件的主题
- 兼容 Apache 日志格式、MySQL 日志
- 支持目录浏览
- 支持 inetd 和 SSL
- 拒绝服务保护系统
- 代理服务器扩展
- 过滤和 gzip 压缩支持
- RBL 支持(mail-abuse.org)
- 支持扩展协议
- 等等

【越狱】20款 Prison Break 风格 WinXP登陆界面

Thursday, November 16th, 2006

 

windows Xp Prison Break登陆界面.rar  1027X768格式)

安装方法:

将logonui.exe文件解压到 X:\\system32下替换原文件
(X 指系统盘)

如显示保护提示

取消保护-点击-是!(取消保护.JPG)

替换前请先自行备份原logonui.exe文件!

替换后按注销系统或按WINKEY+L键 即可查看效果~!

也可以使用压缩包内工具替换

使用memcached进行内存缓存

Wednesday, November 15th, 2006

通常的网页缓存方式有动态缓存和静态缓存等几种,在ASP.NET中已经可以实现对页面局部进行缓存,而使用memcached的缓存比ASP.NET的局部缓存更加灵活,可以缓存任意的对象,不管是否在页面上输出。而memcached最大的优点是可以分布式的部署,这对于大规模应用来说也是必不可少的要求。
LiveJournal.com使用了memcached在前端进行缓存,取得了良好的效果,而像wikipedia,sourceforge等也采用了或即将采用memcached作为缓存工具。memcached可以大规模网站应用发挥巨大的作用。

Memcached是什么?
Memcached是高性能的,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度。
Memcached由Danga Interactive开发,用于提升LiveJournal.com访问速度的。LJ每秒动态页面访问量几千次,用户700万。Memcached将数据库负载大幅度降低,更好的分配资源,更快速访问。

如何使用memcached-端?
在服务端运行:
# ./memcached -d -m 2048 -l 10.0.0.40 -p 11211
这将会启动一个占用2G内存的进程,并打开11211端口用于接收请求。由于32位系统只能处理4G内存的寻址,所以在大于4G内存使用PAE的32位服务器上可以运行2-3个进程,并在不同端口进行监听。

如何使用memcached-Client端?
在应用端包含一个用于描述Client的后,就可以直接使用,非常简单。
Example:
$options["servers"] = array("192.168.1.41:11211", "192.168.1.42:11212");
$options[""] = false;
$memc = new MemCachedClient($options);
$myarr = array("one","two", 3);
$memc->set("key_one", $myarr);
$val = $memc->get("key_one");
print $val[0]."\n"; // prints ‘one‘
print $val[1]."\n"; // prints ‘two‘
print $val[2]."\n"; // prints 3

为什么不使用数据库做这些?

暂且不考虑使用什么样的数据库(MS-SQL, Oracle, Postgres, MysQL-InnoDB, etc..), 实现事务(ACID,Atomicity, Consistency, Isolation, and Durability )需要大量开销,特别当使用到硬盘的时候,这就意味着查询可能会阻塞。当使用不包含事务的数据库(例如Mysql-MyISAM),上面的开销不存在,但读线程又可能会被写线程阻塞。
Memcached从不阻塞,速度非常快。

为什么不使用共享内存?
最初的缓存做法是在线程内对对象进行缓存,但这样进程间就无法共享缓存,命中率非常低,导致缓存效率极低。后来出现了共享内存的缓存,多个进程或者线程共享同一块缓存,但毕竟还是只能局限在一台机器上,多台机器做相同的缓存同样是一种资源的浪费,而且命中率也比较低。
Memcached 和Clients共同工作,实现跨服务器分布式的全局的缓存。并且可以与 共同工作, 对CPU要求高,对内存要求低,Memcached 对CPU要求低,对内存要求高,所以可以搭配使用。

Mysql 4.x的缓存怎么样?
Mysql查询缓存不是很理想,因为以下几点:
当指定的表发生更新后,查询缓存会被清空。在一个大负载的系统上这样的事情发生的非常频繁,导致查询缓存效率非常低,有的情况下甚至还不如不开,因为它对的管理还是会有开销。
在32位机器上,Mysql对内存的操作还是被限制在4G以内,但memcached可以分布开,内存规模理论上不受限制。
Mysql上的是查询缓存,而不是对象缓存,如果在查询后还需要大量其它操作,查询缓存就帮不上忙了。
如果要缓存的数据不大,并且查询的不是非常频繁,这样的情况下可以用Mysql 查询缓存,不然的话memcached更好。

数据库同步怎么样?
这里的数据库同步是指的类似Mysql Master-Slave模式的靠日志同步实现数据库同步的机制。
你可以分布读操作,但无法分布写操作,但写操作的同步需要消耗大量的资源,而且这个开销是随着slave服务器的增长而不断增长的。
下一步是要对数据库进行水平切分,从而让不同的数据分布到不同的数据库服务器组上,从而实现分布的读写,这需要在应用中实现根据不同的数据连接不同的数据库。
当这一模式工作后(我们也推荐这样做),更多的数据库导致更多的让人头疼的硬件错误。
Memcached可以有效的降低对数据库的访问,让数据库用主要的精力来做不频繁的写操作,而这是数据库自己控制的,很少会自己阻塞 自己。

Memcached快吗?

非常快,它使用libevent,可以应付任意数量打开的连接(使用epoll,而非poll),使用非阻塞网络IO,分布式散列对象到不同的服务器,查询复杂度是O(1)。

参考资料:
Distributed Caching with Memcached | Linux Journal
http://www.danga.com/
http://www.linuxjournal.com/article/7451

转载自:http://www.example.net.cn/archives/2006/01/eoamemcachedoea.

利用rsync同步数据

Saturday, November 11th, 2006
主机A、B:A为备份服务器,B为重要数据需要做备份目标服务器

1. 在A上生成隐藏文件夹/root/.ssh ,在里面生成密钥对

]#cd /root/.ssh
]#ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase): <– 此处不打passphrase..下次才不会询问password
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
11:22:33:44:55:66:77:88:99:00:11:22:33:44:55:66 root@mondeo.adj.idv.tw

]#

2. 在/root/.ssh内已经生成id_dsa与id_dsa.pub(分别为私钥和公钥)
]#scp id_dsa.pub B的IP:/root/.ssh/authorized_keys
B服务器要求输入登录密码验证身份,成功后在B 的/root/.ssh目录里面生成authorized_keys(公钥)
测试:在A上输入 ssh B的IP A可以无需密码验证就登录进B

3. 配置B 来支持远程备份
]#chkconfig –list rsync (检查B上面是否支持远程sync备份)
]#rsync off (默认是关闭的)
]#chkconfig rsync on (开启rsync功能)

4. 在A的备份目录中
]#vi sync
rsync -avlR –delete -e ssh B的IP:/var/lib/mysql /backup/

参数意义如下﹕

-a, –archive
It is a quick way of saying you want recursion and want to preserve almost everything.
-v, –verbose
This option increases the amount of information you are given during the transfer.
-l, –links
When symlinks are encountered, recreate the symlink on the destination.
-R, –relative
Use relative paths. 保留相对路径…才不让子目录跟 parent 挤在同一层…
–delete
是指如果端刪除了一文件,那客戶端也相应把这一文件刪除,保持真正的一致。
-e ssh
建立起加密的连接。

可以用./sync来做测试

5. 在A上用crontab定制计划任务
]#crontab -e
0 0 * * * /backup/sync (表示分、时、日、月、年)