Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, July 04, 2008

9.2.2. 识别符大小写敏感性[转自mysql5 中文手册]

在MySQL中,数据库对应数据目录中的目录。数据库中的每个表至少对应数据库目录中的一个文件(也可能是多个,取决于存储引擎)。因此,所使用操作系统的大小写敏感性决定了数据库名和表名的大小写敏感性。这说明在大多数Unix中数据库名和表名对大小写敏感,而在Windows中对大小写不敏感。一个显著的例外情况是Mac OS X,它基于Unix但使用默认文件系统类型(HFS+),对大小写不敏感。然而,Mac OS X也支持UFS卷,该卷对大小写敏感,就像Unix一样。

注释:尽管在某些平台中数据库名和表名对大小写不敏感,不应在同一查询中使用不同的大小写来引用给定的数据库或表。下面的查询不会工作,因为它同时引用了表my_tables和as MY_tables:

mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;
列、索引、存储子程序和触发器名在任何平台上对大小写不敏感,列的别名也不敏感。

默认情况,表别名在Unix中对大小写敏感,但在Windows或Mac OS X中对大小写不敏感。下面的查询在Unix中不会工作,因为它同时引用了别名a和A:

mysql> SELECT col_name FROM tbl_name AS a
-> WHERE a.col_name = 1 OR A.col_name = 2;
然而,该查询在Windows中是可以的。要想避免出现差别,最好采用一致的转换,例如总是用小写创建并引用数据库名和表名。在大多数移植和使用中建议使用该转换。

在MySQL中如何在硬盘上保存和使用表名和数据库名由lower-case-table-names系统变量确定,可以在启动mysqld时设置。lower-case-table-names可以采用下面的任一值:

0:
使用CREATE TABLE或CREATE DATABASE语句指定的大写和小写在硬盘上保存表名和数据库名。名称比较对大小写敏感。在Unix系统中的默认设置即如此。请注意如果在大小写不敏感的文件系统上用--lower-case-table-names=0强制设为0,并且使用不同的大小写访问MyISAM表名,会导致索引破坏。

1:
表名在硬盘上以小写保存,名称比较对大小写敏感。MySQL将所有表名转换为小写以便存储和查找。该行为也适合数据库名和表的别名。该值为Windows和Mac OS X系统中的默认值。

2:
表名和数据库名在硬盘上使用CREATE TABLE或CREATE DATABASE语句指定的大小写进行保存,但MySQL将它们转换为小写以便查找。名称比较对大小写敏感。注释:只在对大小写不敏感的文件系统上适用! InnoDB表名以小写保存,例如lower-case-table-names=1。

在Windows和Mac OS X中,lower-case-table-names的 默认值是1。

提示,手册中lower-case-table-names拼写有误,以此文为准。

Friday, January 18, 2008

基于prototype javascript library的几个常用扩展

个人用到比较多并觉得效果不错的几个基于prototype library的扩展(插件):
1.prototype.windows
2.prototype.tooltip
3.prototype.jester
4.prototype.tablekit
5.prototype.lightbox2
6.prototype.datepicker[这个跟http://www.dynarch.com/projects/calendar上的这个日期插件还是有差距,不过那个calendar文件有点大]

Thursday, December 20, 2007

为gvim/vim增加tail -f功能

1.从http://code.google.com/p/vim-scripts/wiki/TailBundle上面Subversion导出文件
tail_options.vim
autoload/tail.vim
doc/tail.txt
macros/vim-tail.zsh
plugin/tail.vim
2.放到Gvim/vim对应目录下即可
3.使用方法
:Tail
:STail
:TabTail
4.可参考tail_options.vim设置~/_vimrc(~/.vimrc),也可不设置按默认的使用.

Thursday, December 13, 2007

让gvim启动时窗口最大化

在用户目录下的~/_vimrc文件里加上此行(只是Windows生效)
au GUIEnter * simalt ~x "maximum the initial window

Tuesday, November 20, 2007

windows xp 下免安装版php5 gd2库设置

phpinfo()里的一段信息如下,PHP加载的配置文件默认放到C:\WINDOWS\php.ini下。


Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\WINDOWS\php.ini

打开其中php_gd2.dll模块,注释前面的";"即可,将ext目录下的的php_gd2.dll复制到C:\WINDOWS\system32,重启WEB server,检查phpinfo(),应该有如下类似内容:

gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

Friday, October 26, 2007

在桌面上显示回收站图标

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\RecycleBinOnDesktop]
"RegPath"="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel"
"Text"="在桌面上显示回收站图标"
"Type"="checkbox"
"valueName"="{645FF040-5081-101B-9F08-00AA002F954E}"
"Checkedvalue"=dword:00000000
"Uncheckedvalue"=dword:00000001
"Defaultvalue"=dword:00000001
"HKeyRoot"=dword:80000001

然后打开“资源管理器-工具-选项-查看”,先将“在桌面上显示回收站图标”这项选上“应用”再去掉勾“应用”即可控制桌面显示与不显示垃圾桶回收站。

Saturday, June 09, 2007

Windows XP and DOS[Unix Style Tail Command]

SUMMARY: Display the most recent results of a log file with the tail command for Windows XP

The tail command, on most Unix-style operating systems, lets you display the last 10 or so lines of a text file. It also supports a feature allowing you to keep a file lock on a particular file, displaying new lines as they appear. This is most commonly used for displaying the results of log or debug files, letting you see only the most recent activity of a particular process.

While Windows XP does not normally come with a 'tail' tool, it is available in the Windows 2003 Resource Kit. It is a large download, but besides the 'tail' command, the Windows 2003 Resource Kit also provides tools to remap keys, query the Active Directory, and more. To download and install the Resource Kit:

1. Go to the Microsoft Windows Server 2003 download section at http://www.microsoft.com/windowsserver2003/
downloads/tools/default.mspx. Or, if that link does not work, visit http://www.microsoft.com/ and search for "Windows 2003". Once there, choose the "Downloads -> Tools" link.

2. Select the link "Windows Server 2003 Resource Kit Tools".

3. Click the "Download" link. Choose to register or not, depending on your choice, and follow the on-screen instructions to download and install the product. The default install directory is "C:\Program Files\Windows Resource Kits\Tools\".

Once the Windows 2003 Resource Kit is installed, you may need to reboot your machine for the directory "C:\Program Files\Windows Resource Kits\Tools\" to be added to your path.

Now that the tail command is available, to see the online help, enter the following DOS command:

tail /?

Here is a command summary:

C:\>tail FILENAME

Display the last ten lines from file FILENAME. For example, to see the last ten activities made by the Windows Update tool, issue these commands:

C:\>c:
C:\>cd \windows
C:\>tail "Windows Update.log"

C:\>tail -n FILENAME

Display the last 'n' lines from file FILENAME. For example, view the last 20 lines in the Windows Setup log:

C:\>c:
C:\>cd \windows
C:\>tail -20 setuplog.txt

C:\>tail -f FILENAME

Keep accesing FILENAME, displaying new lines as necessary.

To see this feature in action, open up a new file in Notepad, write the word 'hello, world', and save it as c:\test.log. Keep the file open in Notepad. Now, issue the following DOS commands:

C:\>c:
C:\>cd \
C:\>tail -f test.log

You should see the word 'hello, world' in your DOS prompt. Now, go back to Notepad and write the text "Process executed." Save the file. The DOS prompt should now say "Process executed." Whatever you add to the file in Notepad should then appear in your DOS prompt until you terminate the command.

Friday, May 25, 2007

[转mysql 5.1 manual 2.3.16] Windows版MySQL同Unix版MySQL对比

已经证明,Windows版MySQL很稳定。Windows版MySQL的功能与相应的Unix版相同,只有以下例外:

· Windows 95和线程

Windows 95创建一个线程时大约需要200字节的主内存。MySQL的每个连接都会创建一个新线程,因此如果你的服务器正处理许多连接,你不应当在Windows 95中运行mysqld。

· 有限的端口数目

Windows系统有大约4,000个端口供客户端连接,某个端口的连接关闭后,在能够重新利用该端口前,需要2至4分钟。在客户端频繁连接并从服务器上断开时,在可以重新使用关闭的端口前,有可能用完了所有可用的端口。如果发生这种情况,MySQL服务器不会响应,即使它仍在运行。请注意机器上运行的其它应用程序也可以使用端口,此时可供MySQL使用的端口数要少。

详细信息参见http://support.microsoft.com/default.aspx?scid=kb;en-us;196271 。

· 并行读

MySQL依靠pread()和pwrite()系统调用来同时使用INSERT和SELECT。目前我们使用互斥来竞争pread()和pwrite()。我们将来想用虚拟接口替换文件级接口,因此要想更快,我们可以在NT、2000和XP上使用readfile()/writefile()接口。目前MySQL 5.1可以打开的文件的限制数目为2,048,意味着在Windows NT,2000,XP和2003上可以运行的并行线程不如Unix上多。

· 阻塞读

MySQL为每个连接使用阻塞读取,如果启用了命名管道连接,其含义如下:

o 连接不会在8小时后自动断开,而在Unix版MySQL中会发生。

o 如果连接被挂起,不杀掉MySQL则不会将其中断。

o mysqladmin kill不会杀掉睡眠中的连接。

o 只要有睡眠连接,mysqladmin shutdown不会中断。

我们计划在将来修复该问题。

· ALTER TABLE

执行ALTER TABLE语句时,将该表锁定不让其它线程使用。在Windows中,你不能删除正被另一个线程使用的文件。在将来,我们会找出办法解决该问题。

· DROP TABLE

在Windows中对一个被MERGE表应用的表执行DROP TABLE不会实现,因为MERGE处理器将表从MySQL上层映射隐藏起来。由于Windows不允许删除打开的文件,必须在删除表之前首先清空所有MERGE表(使用FLUSH TABLES)或删掉MERGE表。

· DATA DIRECTORY and INDEX DIRECTORY

在Windows中将忽略DATA DIRECTORY和INDEX DIRECTORY选项,因为Windows不支持符号连接。在具有非功能realpath()调用的系统中,这些选项也被忽略。

· DROP DATABASE

你不能删掉正被线程使用的数据库。

· 从Task Manager(任务管理器)杀掉MySQL

你不能从Task Manager(任务管理求)或使用Windows 95的shutdown工具来杀掉MySQL。你必须通过mysqladmin shutdown停止它。

· 大小写名

由于Windows对文件名大小写不敏感。因此在Windows中MySQL数据库名和表名对大小写也不敏感。唯一的限制是在同一个语句中,必须同时使用大写或小写指定数据库名和表名。请参见9.2.2节,“识别符大小写敏感性”。

· ‘\’路径名间隔符

Windows中的路径名用‘\’符间隔开,在MySQL中还是转义字符。如果你使用LOAD DATA INFILE或SELECT ... INTO OUTFILE,用‘/’符使用Unix-类文件名:

mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
你还可以使用双‘\’符:

mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
· 管道问题。

管道不能在Windows命令行提示符下可靠地工作。如果管道包括字符^Z/CHAR(24),Windows认为遇到了文件末尾并中断程序。

这主要是按照如下所示使用二进制日志的主要问题:

C:\>mysqlbinlog binary-log-name | mysql --user=root
如果使用日志时出现问题,怀疑是由于^Z / CHAR(24)字符,你可以使用下面的程序:

C:\> mysqlbinlog binary-log-file --result-file=/tmp/bin.sql
C:\> mysql --user=root --execute "source /tmp/bin.sql"
后面的命令还可以用来可靠读取任何包含二进制数据的SQL文件。

· Access denied for user错误

如果你试图运行MySQL客户端程序来连接同一机器上运行的服务器,但是遇到错误Access denied for user 'some-user'@'unknown' to database 'mysql',这意味着MySQL不能正确识别你的主机名。

要解决该问题,你应当创建一个名为\windows\hosts包含下面信息的文件:

127.0.0.1 localhost

Thursday, April 05, 2007

crontab on windows XP


http://www.kalab.com/freeware/cron/cron.htm

Cron / Cron Service

Instructions

Please also have a look at pycron. It's a more recent development with more features.

Cron scans the file CRONTAB every minute and checks every line if the specified time/date information matches the current time/date. If they are equal, the command line specified will be executed. A log file (cron.log) with the executed commands is written to the current directory.

Download

There are two versions of Cron:
Version: Download link:
Cron for Windows 9x/NT http://www.kalab.com/freeware/cron/cron.zip (22kb)
Cron NT service http://www.kalab.com/freeware/cron/crons.zip (53kb)

Setup for first version (Windows 9x/NT)

1. copy the files cron.exe and crontab to a folder of your choice
2. edit the file crontab (see the examples as a reference)
3. create a link to cron.exe and move it to the startup folder

Setup for NT service

1. create a crontab file in your SYSTEM32 folder
2. execute the included ntsetup.exe
3. call "crons.exe /?" in a command line to see the available options of crons

The Crontab file

Each line of CRONTAB has the following structure:



Position: Values:
Minute 0-59
Hour 0-23
Day 1-31
Month 1-12
Day of week 0-6 (0=Sunday, 1=Monday, ..., 6=Saturday)

Instead of minute, hour, day, month or day of week it's also possible to specify a *. A * represents all possible values for that position (e.g. a * on 2nd position is the same as specifying all the possible values for hour)

It's also possible to specify several values separated by commas: e.g. if you want a command to be executed every 10th minute so you can specify 0,10,20,30,40,50 for minute. A range of values can be specified with a -: e.g. value 0-12 for hour -> every hour a.m.

Comments

Every line not starting with a number is treated as a comment.

Examples

execute a command every minute

# This is a comment.
* * * * * c:\tools\CheckForNewFiles.exe

execute the program backup.bat every hour

# This is a comment.
0 * * * * c:\tests\backup.bat

do a backup every day at 0.30 p.m.

# This is a comment.
30 12 * * * c:\tests\backup.bat

start a backup every tuesday at midnight

# This is a comment.
0 0 * * 3 c:\tests\backup.bat

scan drive c for viruses on the 1st of every month at 2.45 p.m.

# scan for known viruses
45 14 1 * * c:\path_to_scanner\scan c:

copy some files every half hour

# This is a comment.
0,30 * * * * xcopy c:\docs\*.* y:\users /s

copy a file every hour (a.m.) only on weekdays

# System commands need the command interpreter specified:
0 0-12 * * 1-5 c:\...\cmd.exe /c "copy c:\... e:\"

Tuesday, March 20, 2007

winddows 2003 server 无法启动mongrel_rails service

mongrel_rails 在windows 2003 server上安装好service之后,不能正常启动,而在cmd下可以正常启动,后检查mongrel_service.log发现因为ruby,rails,mongrel_rails都是装在Program Files里,因为文件夹里空格造成service启动时找不到程序路径才启动失败,将ruby移到C盘根目录下,修改一下rails及mongrel_rails等文件里的路径,即将C:\Program Files\Ruby\bin\rails改为C:\Ruby\bin\rails,其他几个文件雷同处理即可。