I can believe fly.

Tuesday, October 12, 2010

mysql编码设置

问题现象:

mysql administrator工具连接数据库,打开tools->mysql command line client执行sql脚本,发现带有中文的sql脚本在执行后,数据表里查看时,全变为乱码了.

问题解答:

检查了sql脚本的存储格式,全都是存为utf-8了.那就是mysql administrator工具编码的问题了.找了tools->options的信息,也没见设置编码的配置.

突然想,执行脚本用的是mysql命令,那应该跟mysql工具的环境有关系才对.因此找到设置编码的方式了:mysql安装后,默认的编码是Latin1,这是不支持中文的.打开my.ini文件,分别将mysql和mysqld下的default-character-set值改为utf8,然后
重启mysql,这就可以正常显示中文了(呃,乱码的数据表需要重新执行脚本,不然好像还是乱码).

[转]mysql安装


Install and Configure MySQL 5.1.30 on Windows Server 2008

Feb
26
« »

In this article I will perform an installation of MySQL 5.1.30 on Windows Server 2008, I will take you step-by-step through the whole installation. MySQL is the world's most popular open source database engine, it's fast, stable and reliable for most situations.

Configuration Information

Platform: Hyper V Host OS: Windows Server 2008 Installation Media: MySQL 5.1.30 was downloaded from http://dev.mysql.com/downloads/ CPU: 2 dedicated 2.0Ghz RAM: 1024mb Disk: 40GB

Installation

Run Setup.exe – This version of

Click "Next" on the Setup Wizard window

I am going to select "Custom" installation so I can see all available options, Press "Next" to continue

I want to change the location of my installation to C:MySQL, press "Change"

I changed "C:Program FilesMySQLMySQL Server 5.1″ to "C:MySQL", I am only changing this location for personal preference, and you can make it whatever directory you wish. Press "OK" to continue

I also want to change the location of the data the MySQL will store. Select "MySQL Server Datafiles. Press "Change" to continue

I changed "C:Program FilesMySQLMySQL Server 5.1″ to "C:MySQL", I am only changing this location for personal preference, and you can make it whatever directory you wish. Press "OK" to continue

Press "Next" to continue

Setup is ready to begin the installation. I verified that the destination folder and data folder is set to C:MySQL. Press "Install" to continue

Installation will begin to copy the files

After installation MySQL includes shameless plugs for their enterprise subscription. Press "Next" to continue

Here is one more shameless plug from MySQL. Press "Next" to continue

Select "Configure the MySQL Server now". Press Finish to continue

Configuration

Press "Next" at the Welcome screen to continue

Because I am a techie I am going to select "Detailed Conifugration". Press "Next" to continue

I am going to use this to run blog applications so I am going to select "Server Machine", you can select what is best for your suited for your goal. Press "Next" to continue

I am going to choose "Multifunction Database" because it allows me the flexibility of Transactional and Non-Transactional Database's to coexist, again you can select what is best for your suited for your goal. Press "Next" to continue

Choose "Installation Path" so it will store the InnoDB Tablespace Settings under the Installation directory. I like to keep everything in the same place, the default location puts this elsewhere. Press "Next" to continue

Because this is for a blog I am going to select "Online Transaction Processing (OLTP)", you can select what is best for your suited for your goal. Press "Next" to continue

I left the defaults for TCP/IP and I unchecked "Enable Strict Mode", some blog applications associated with WordPress have an issue if this is enabled. Press "Next" to continue

Keep the default "Standard Character Set". Press "Next" to continue

I checked off "Install As Windows Service", set the "Service Name" to "MySQL" and checked off "Launch the MySQL Server automatically". I checked off "Include Bin Directory in Windows PATH" so I can run the client tools from any location in the command prompt and not have to go to the C:MySQLBin directory. Press "Next" to continue

Enter a new password for the root account, retype the password. Press "Next" to continue

Press "Execute" to initiate the configuration changes to MySQL

The configuration wizard will make the requested changes

Make sure all changes were successful. Press "Finish" to continue

Verification

Go to C:MySQL. Bin is where the system files for MySQL are located. Data is the directory where the databases will be stored, and my.ini is where most of the configuration is kept.

From the command prompt run the following command, if you get the error "'mysql' is not recognized as an internal or external command" then you will need to navigate to the "Bin" directory under your MySQL Installation and run it from there. This is used to test connectivity to the MySQL Server.

mysql –u root –p

Tuesday, May 18, 2010

bat简易解决你的需求

bat简易解决你的需求

最近写了两个bat,觉得挺受用的,再次感觉bat的强大
¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥
GetData.bat 本地工作目录 文件列表
用途: 根据文件列表copy共享数据到本地
正文:

@echo on

set workdir=%1
set listfile=%2
@set user=ysl
@set pwd=ysl123
FOR /F "tokens=1,2* delims=," %%i in (%listfile%) do (
if "%%i"=="" goto exit
if "%%j"=="" goto exit
@echo %%i %%j
@if not exist "%workdir%\%%j\." mkdir %workdir%\%%j
@net use %%i /d /y
@net use %%i /user:%user% %pwd%
@xcopy /Y/E %%i\*.* %workdir%\%%j)
:exit

经典说明:
1. 该篇的经典之处在于FOR /F的用法,此文中用到FOR的意思是
从文件%listfile%中读取每行数据,并以逗号作为分隔符将获取的数据传给变量%%i,%%j,
假如名中的%%i 你用%%a,那后就可以按顺序%%a,%%b,%%c捕捉到对应的值
另外,记住此处变量获取值使用的是两个百分号%%在前面。
关于for的使用详细可参考 hi.baidu.com/cjiabing/blog/item/76bc51b5fe79bec937d3ca46.html

¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥

GetLog.bat 日志文件
用途: 从日志文件里获取相关的错误数据
正文:

set logfile=%1
@echo ----------------error count-----------
@type %logfile% | find "error(s),"
@findstr /i "solution_file 个错误 已用时间" "%logfile%"
@echo ----------------error info-----------
@type %logfile% | find ": error "
@echo ----------------make setup info-----------
@type %logfile% | find "Error in script"

@echo ----------------get log end-----------


说明:
该篇的经典在于findstr的用法,@findstr /i "solution_file 个错误 已用时间" "%logfile%"
其含义指的是从%logfile%文件中读取每行数据中含有solution_file 个错误 已用时间任一个字符串的数据的信息
如:
[echo] solution_file=E:\tools\Src\MergeLib\MergeLib.vcproj
[exec] 0 个错误
[exec] 已用时间 00:00:02.91

ps; 查找多字符串的信息,碰到中文则放后面且加有引号
¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥

Thursday, May 6, 2010

关于NANT集成获取cc.net,hudson的构建号

关于NANT集成获取cc.net,hudson的构建号

1. nant获取cc.net的构建号
<if test="${property::exists('CCNetLabel')}">
<property name="build_ver" value="${CCNetLabel}"/>
</if>

2. nant获取hudson的构建号
<if test="${environment::variable-exists('BUILD_NUMBER')}">
<property name="build_ver" value="${environment::get-variable('BUILD_NUMBER')}"/>
</if>
备注:其中environment::variable-exists用于检查环境变量是否存在;
environment::get-variable用于获取环境变量值,此两个函数需要基于NANT的0.91.3774.0版本上方可使用







Wednesday, April 28, 2010

mput使用手记

mput使用手记

说明:以下是win下使用wput工具的情况
工具下载地址:http://sourceforge.net/projects/wput/files/wput/pre0.6/wput-pre0.6.zip/download
使用手记:
1. 目标ftp路径未尾要带有/号
错误: wput E:\WorkDir\temp\123 ftp://user:pwd@10.20.1.1/Public/yusulian
正确: wput E:\WorkDir\temp\123 ftp://user:pwd@10.20.1.1/Public/yusulian/

2. 数据上传的目录结构
执行: wput E:\WorkDir\temp\123 ftp://user:pwd@10.20.1.1/Public/yusulian/
结果: ftp的存放路径为Public/yusulian/E:/WorkDir/temp/123
为了保持干净的目标目录,则可以
执行:E:\WorkDir\ftp\wput .\2008 ftp://user:pwd@10.20.1.1/Public/yusulian/
结果: ftp的存放路径为Public/yusulian/2008

3. 上传一半数据提示信息错误,skipping file:...........
答;不明真相

4. 换种执行方式(3问题还是存在)
## 将要上传的文件写入list.txt 
find . -type f >> list.txt 
## 将要上传的文件写入list.txt 
for /F %%f in (list.txt) do  E:\WorkDir\ftp\wput "%%f"  ftp://user:pwd@10.20.1.1/Public/yusulian/


Thursday, April 15, 2010

NET USE 命令用法

NET USE命令使用指南

NET USE 命令说明

    将计算机连接到某个共享资源或与其断开连接,或者显示有关计算机连接的信息.

该命令还控制永久性网络连接.在没有参数的情况下使用,net use 可以检索网络连接列表.

NET USE 命令用法

net use

## 列出本机网络连接

net use \\IP\ipc$ /user:"帐号" "密码"  

## 建立与指定IP的IPC$(空连接)

net use z:\\IP\c$ /user:"帐号" "密码"

## 将对方的c盘映射为自己的z盘

net use \\IP\ipc$ /d

## 删除与指定IP的IPC$连接

net use z: /d

## 删除本机映射的z盘

net use * /d

## 删除本机所有映射和IPC$连接

NET USE语法

[devicename | *] [\\computername\sharename[\volume] [password | *]]

        [/USER:[domainname\]username]

        [/USER:[dotted domain name\]username]

        [/USER:[username@dotted domain name]

        [/SMARTCARD]

        [/SAVECRED]

        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]

NET USE参数说明

1.       DeviceName:指派名称以便连接到资源或指定断开的设备.有两种类型的设备名: 磁盘驱动器号(即 D: 到 Z:} 和打印机(即 LPT1:到 LPT3:}.如果键入星号而不是特定设备名,则系统会指派下一个可用的设备名.这个名称以后可以作为访问共享资源的名称进行引用.

2.       \\computername:指控制共享资源的计算机的名字.如果计算机名中包含有空字符,就要将双反斜线 (\\) 和计算机名一起用引号 (" ")括起来.计算机名可以有1 到 15 个 字符.\volume :指定一个服务器上的NetWare卷.用户必须安装 Netware 的客户服务 (Windows 工作站) 或者 Netware 的网关服务(Windows 服务器) 并使之与 NetWare 服务器相连. Password:指定访问共享资源所需的密码.输入星号 (*) 产生一个密码提示在密码提示行处键入密码时不显示密码.

3.       /user:在其后指定建立连接时使用的不同于目前登录用户的用户名.DomainName:指定不同于目前登录域的其他域.如果省略则net use使用当前登录的域.注意,/user:后的登录用户和域可以有三种不同的表示形式,分别为domainname\username,dotted domain name\username和username@dotted domain name,其中dotted domain name提指域名的全称,如office.yesky.com,也即域名加域后缀的完全形式.

4.       /SAVECRED:指定保留用户名和密码.除非命令提示输入用户名和密码.否则此开关被忽略

5.       /SMARTCARD:指定连接使用在智能卡上的凭据.

6.       /delete:取消指定的网络连接.如果使用星号 (*) 指定连接,则所有网络连接均将取消.

7.       /persistent:{yes | no}:控制持久网络连接的使用.默认值为最后一次使用的设置.非设备连接不会持久.Yes 将按其建立时的原样保存所有连接,并在下次登录时还原它们.No 则不保存已建立的连接或后续连接.现存的连接在下一次登录时还原.使用 /delete 删除持久连接.

Net use命令还有另两种使用格式,分别如下:

  NET USE {devicename | *} [password | *] /HOME

  NET USE [/PERSISTENT:{YES | NO}]

  其中第一种命令格式将用户连到其域的主目录并将主目录映射为设备名DeviceName.后一种格式用来修改持久连接的使用.

NET USE断开例子

C:\Documents and Settings\admin>net use \\192.168.1.10\IPC$ /delete

有打开的文件和/或没有结束的目录搜索.[exec] 是否继续断开连接并强行关闭? (Y/N) [N]:

要去掉“是否继续断开连接并强行关闭? (Y/N)”,加参数"/yes"即可,如下:

C:\Documents and Settings\admin>net use \\192.168.1.10\IPC$ /delete /yes

\\192.168.1.10\IPC$ 已经删除


Monday, April 5, 2010

关于Fatal Error C1902的错误

关于Fatal Error C1902的错误


需求: 有个开发人员有个需求要在构建服务器调试程序,说是本地编译出来的文件会崩溃服务器上不会.

为了不跟构建环境混肴,另外开通了一个账号给他使用且要求要用开始->所有程序->附件->通讯->远程桌面工具登录
开发人员在使用vs2005编译程序时,出现如下错误:
 Error 1 fatal error C1902: Program database manager mismatch; please check your installation
奈闷了,换个账号也不行.在网上查了一下 fatal error C1902获取如下资讯
Fatal Error C1902

Error Message

program database manager mismatch; please check your installation

A program database file (.pdb) was created using a newer version of mspdb80.dll than the one found while compiling.

This error usually indicates that mspdbsrv.exe or mspdbcore.dll are missing or have different versions from mspdb80.dll. Ensure matching versions of mspdbsrv.exe, mspdbcore.dll, and mspdb80.dll are installed on your system.

解决方案参考:
Here are steps how I got it and solve:1. 
I like to compile some sources from the command prompt, so I added to the PATH environment variable - "C:\Program Files\Microsoft Visual Studio 8\VC\bin\".
 After that I had to copy some files from "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\" to get cl.exe working (one of files was mspdb80.dll).
2. Some time later I tryed to compile a project from MSDev and got C1902 error.
3. With MSDN search I got to this place to see Jonathan Caves's helpful message about mspdbsrv.exe.
4. I just copied that EXE to \VC\bin\ and everithing becomes Ok.5. Now I can compile anything from both MSDev and C:\ :)
本人直接解决方式:
1. 将C:\Program Files\Microsoft Visual Studio 8\Common7\IDE下的三个文件mspdb80.dll、mspdbsrv.exe、mspdbcore.dllcopy到C:\Program Files\Microsoft Visual Studio 8\VC\bin\
2. 重启系统