XNIU’s space

August 15, 2007

MySQL connection string

Filed under: Tech — xniu @ 12:16 pm

Some information about MySQL connection string for .NET driver (MsQL connector/NET):

For detail see: http://dev.mysql.com/doc/refman/5.0/en/connector-net-examples-mysqlconnection.html

Examples:

– Persist Security Info=False; Username=user; Password=pass; database=test1; server=localhost; Connect Timeout=30

– database=myDB; server=/var/lib/mysql/mysql.sock; user id=myUser; pwd=myPass

Some points:

– The ConnectionString property can be set only when the connection is closed. Many of the connection string values have corresponding read-only properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated.

– The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as ArgumentException, is generated. Other errors can be found only when an attempt is made to open the connection.

– If a specific keyword in a keyword=value pair occurs multiple times in a connection string, the last occurrence listed is used in the value set.

– Keywords are not case sensitive.

Frequently used keyword:

– Server/Host/Data Source/Address/Addr: The name or network address of the instance of MySQL to which to connect. Default: localhost.

– Connect Timeout: The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. Default: 15.

– Initial Catalog/Database: The name of the database to use intially. Default: mysql.

– User Id/Uid/User name/Username: The MySQL login account being used.

– Password/Pwd: The password for the MySQL account being used.

(P.S. Windows live writer really sucks!)

Advertisements

July 30, 2007

Struggle for Linux

Filed under: Tech — xniu @ 10:13 pm

Last weekend I spent all my time in installing Linux. Since it’s my first time playing with Linux, really a big challenge I faced.
The linux  distribution I choose is Zenwalk, which is recommended as a light-weight, fast, compact version. I downloaded the iso file from website and installed it from hard disk. The iso file is even less than 500M, truly very small, isn’t it? I  had referred to many articles which talk about others’ experience about the installation before I started off. Nevertheless, it still got me much trouble in the practical process; hence I think it’s worth taking down the whole process for future use, or for your convenience.
1. Download the iso file and extract it to root directory of one FAT32 partition. (I haven’t tried placing it on NTFS partition, maybe it works)
2. Download ‘Grub for DOS’, a awesome boot loader that substitutes traditional ‘LILO’. Also extract it at C:\, and copy the ‘grldr’ file to the root directory where the boot.ini is also located. Edit boot.ini to append following line: C:\grldr=”Grub”. Caution: C partition must be FAT32 formatted, otherwise the grub tool won’t work (see it’s document).
3. Reboot the computer. In the boot screen an option to start with Grub would be presented; select it to enter Grub.
4. In Grub, a menu with many entries will show up, ignore them and press “c” to start command line mode. Type following commands:
    kernel (hdx,y)/kernels/ata/bzImage-2.6.21.3
    initrd (hdx,y)/isolinux/initrd.img-2.6.21.3
    boot

5. Then the Zenwalk installation interface would be displayed,  with which you can start the installation. Remember to mount the installation source to a directory at first, for instance:
    mkdir /mnt/install
    mount -t vfat /dev/hda7 /mnt/install
then you can input this directory when you are asked to specify the installation source during the installation.
6. The installation may take about 10 more minutes, then, enjoy Zenwalk.

Powered by ScribeFire.

July 27, 2007

Learning UNIX commands – pipe

Filed under: Tech — xniu @ 10:53 am
[Preface] Since I started using VIM and experienced the impressive efficiency, I gradually agree that UNIX is more efficient than WIN and truly targeted for “solving problems”. So it’s not surprising that I intend to explore more UNIX utilities. Here in this post I’d take some notes for learning UNIX commands, hopefully this could be also helpful for you.

Actually “pipe” is not a explicit command, it’s a very powerful mechanism in UNIX. It enables different commands, programs to communicate with each other and collaborate to accomplish a big task.

Pipe is used to redirect input/output and channel streams of data to different places. It just behaves as implied by its literal meaning. Use “|” to send data stream which is outputed by a command to another command as input; use “>” to redirect the output to a file; use “<” to take data from a file and send it to a command as input. Pipes get to be extremely powerful when being used to enable a series of commands to work together.

For details see below:

http://www.caf?.ac.UK/psych/Culling/pipes.html.

July 24, 2007

VIM tips

Filed under: Tech — xniu @ 8:46 pm

It has not been short time since I began using VIM, or more precisely, studying VIM. Its high efficiency deeply impresses me so that I’m determined to become skilled in using it. I do believe that I’ll benefit a lot from it.

From now on, I would collect the tips which make VIM increasingly powerful, means I would frequently update this post to add new tricks. To not disappoint the readers who also have great interest on it when there are only a few tips available at first, I’d like to place some links I consider quite useful here:

http://www.vim.org/tips/index.php (Tips on official site, however, you would be recommended to go to its wiki site.)

http://rayninfo.co.uk/vimtips.html (Said to be “Best VIM tips”, by a guy “15 Years of Vi + 5 years of Vim and still learning” )

http://www.study-area.org/tips/vim/index.html (A light tutorial)

http://vimdoc.sourceforge.net/htmldoc/usr_toc.html (Official document in HTML format, well organized)

http://www.eandem.co.uk/mrw/vim/usr_doc/a4c_bm.zip (PDF format document, but not up-to-date, just for VIM 6.1)

Tips:

[Added on July 25th]

– use “J” to join current line and next line, namely deleting the line break
– use “O” to insert a new line above the current line, compared to using “o” to insert a new line under current line.
– use “:e!” to discard current changes and reload original file.
– use “:h index” to list all the commands for each mode.
– “w” and “b” can be used to move to the start of word forward and backward among lines; use “e” to move to the end of word.
– use “W” and “B” to move by white-space separated words.
– instead of using ‘G’, ‘gg’ to locate the line in the file, ‘H’, ‘M’ and ‘L’ can be used to move to the lines in the visible area.
– when searching, use ‘\>’ to limit the match at the end of a word, similarly use ‘\<‘ to match only at the beginning.

[Added on July 26th]

– “*” and “#” match exactly the whole word; “g*” and “g#” can be used to match partial word.
– there are unnamed marks which are created automatically when jumping among lines and named marks which can be created manually by “m{$}”.
– “‘”: last jump position; “””: last edit position; “[“: start of last change; “]”: end of last change
– “<C-I>” and “<C-O>” can be used to move up and down through the jump stack;
– use “‘” to jump to the beginning of the line where the mark is located while use “`” (above “Tab” key) to jump to the exact column of the mark in the line.
– “x” = “dl” “X” = “dh” “D” = “d$” “C” = “c$” “s” = “cl” “S” = “cc”.
– use “r” to replace a single character without switching to insert mode.
– use “.” to repeat any CHANGE command (except for undo, redo, and commands starting with “:”), very powerful.
– use “v” to switch to visual mode and move by character; use “V” to switch to visual mode for selecting lines.
– in visual mode, use “o” to switch sides for selection.
– use “p” to put a line below current cursor or put characters after cursor; while “P” behaves contrariwise.
– use “aw” to operate on a word with space; use “iw” to operate on a word without space.

Blog at WordPress.com.