Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, April 17, 2010

Ubuntu 9.04 pdf中文显示乱码

Ubuntu 9.04中看有些中文pdf的时候,会出现乱码,或是直接显示不出,或是方框。
sudo apt-get install poppler-data
这个方法对我适用,不知道其他情况下是否适用。

Monday, March 1, 2010

Tips and Tricks(1)

Foramt the C source code in vim.
Sometimes, your may copy and paste  code form others' code, and the format may be mess. You can use the vim to format it using some simple and useful command. gg=G.You just need input these keystrokes, vim would help you indent the code. If you know some ways to make the code more beautiful, tell me.
The order of the #inlcude
The lower layer one should be included first.

Wednesday, February 24, 2010

Set Up Chinese input in Ubuntu 9.10

Ubuntu 9.10中设置中文输入(SCIM)
Two days ago, I installed the Ubuntu 9.04 on my laptop and configure the chinese input. I writed a post about it. Then I upgraded it to 9.10, the SCIM does not work now. I tried to use the method that I have done before in Ubuntu 9.04. Unfortunately, it does not work at this time. How terrible it is!
After google it, I found there is a solution:
Add these lines to the /etc/enviroment
LANGUAGE="en_ZA:en"
LANG="en_ZA.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
  
The reason for it is that after you set the environment language as english, you can not use the chinese input any more.
Restart your PC. It works for me. Good luck for you! 

Saturday, February 20, 2010

Add Chinese Input support in Ubuntu 9.04

After installing the Ubuntu 9.04, I want to make it support Chinese support using the SCIM.
Make sure you have already installed the SCIM, you can check it by System--> Administartion --> SCIM input Method Steup. You can configure it first.
Use these command from your termial:
sudo apt-get install scim-qtimm im-switch scim-pinyin
im-switch -z en_US -s scim
Then it works for me.Good luck.

Friday, February 5, 2010

Connect to Ubuntu in VM from Windows using Putty

I have a VMWare workstation with a Ubuntu 9.04 on it. I want to use a terminal to connect it from the host PC whose system is Vista. Putty is my choice.You can choose the SSH or Telnet to connect. I choose the SSH.But it does not work at first giving a error message "connect refused". Ok, there must be something wrong or something we missed.
First, add All:All to the end of /etc/hosts.allow. Because it's your virtual machine hosted on your PC, I think you need concern the security.
First, you need install the ssh first. sudo apt-get install ssh
Then, I go to /etc/init.d, ssh localhost
After finishing these steps, it works now.

Saturday, November 7, 2009

LAMP and WordPress Installation and Configuration

Linux and Apache and MySQL and PHP and WordPress

  • sudo apt-get install apache2
  • sudo apt-get install php
  • sudo apt-get install libapache2-mod-php5
  • sudo /etc/init.d/apache2 restart (The previous four steps is for installing the Apache and PHP)
  • sudo apt-get install mysql-server
  • sudo apt-get install libapache2-mod-auth-mysql
  • sudo apt-get install php5-mysql
  • sudo /etc/init.d/apache2 restart(These four steps are for installing the MySQL)
  • sudo ls /etc/apache2/mods-enabled (make sure that there are files php5.conf and php5.load, if not, sudo a2enmod php5)
  • Now you can install the wordpress now, but we can inatll the phpMyAdmin which would make your admin work more easier.
  • Download the phpMyAdmin package from its site, and unpackage it under the /var/www as /var/www/phpMyAdmin
  • sudo cp /var/www/phpmyadmin/config.sample.inc.php /var/www/phpmyadmin/config.inc.php
  • Edit this file ./var/www/phpmyadmin/config.inc.php
  • Find the "blowfish_sercet" and fill any charater after it.
  • Edit the file /etc/php5/apache2/php.ini
    • Add extension=php5-mcrypt.so
  • sudo chmod -R 777 /var/www/
  • Install the wordpress, Upackage under the /var/www as /var/www/wordpress
  • mysql -u youraccount -p in the shell
  • create database yourdatabasename ;
  • GRANT ALL PRIVILEGES ON wordpress.* TO hello@localhost IDENTIFIED BY ‘666666′
  • FLUSH PRIVILEGES
  • exit
  • Now you can access the http://localhost/wordpress, then you would be guided to config.

Monday, October 19, 2009

Select a faster mirror server for Ubuntu

I am installing a VM on my Vista. And I install an Ubuntu 9.04 on this VM too. Choosing a fast mirror server is very import for our work. Recentlly, I read a blog from http://www.ubuntugeek.com/how-to-select-fastest-mirror-in-ubuntu.html . This is a very great artical. Works very well for me. At first, I use the default mirror server in China. The network is bad, the downloading speed for package is about 10KB/s. Now, the speed became 50KB/s ,even more.






This simple procedure works very well for me. I suggest that you should have a try.

Thursday, October 8, 2009

Emacs Learn(2)

File Management in Emacs(Reference to http://xahlee.org/ )



General Info



The keyboard shortcut “Ctrl+x d” calls the command “dired”. “dired” is abbreviation for Directory Edit.


Here's a list of the most commonly used keystrokes within dired:


keystroke

purpose



+

create a dir



R

rename file

C

copy file

D

delete file

Z

compress/decompress the file



m

mark a file

u

unmark a file

U

unmark all

%m

mark by regex



g

update dir listing


“dired” is often used in combination with “Alt+!” (shell-command). For example, suppose you downloaded a program and is going thru the install process of unzip, untar, configure, make, sudo make install. You can either run these command inside a emacs shell with “Alt+x shell”, or you can just execute them one at a time with “Alt+!”. (which method to use is a matter of preference)

Tuesday, October 6, 2009

Emacs Learn(1)


C-f     向右移动一个字符


C-b     向左移动一个字符







M-f     向右移动一个词【对中文是移动到下一个标点符号】


M-b     向左移动一个词【对中文是移动到上一个标点符号】







C-n     移动到下一行


C-p     移动到上一行







C-a     移动到行首


C-e     移动到行尾







M-a     移动到句首


M-e     移动到句尾






M-< (META 小于号)可以将光标移动到所有文字的最开头;M-> (META 大于号)可以将光标移动到所有文字的最末尾。


大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的作用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方法是:先输入 C-u,然后输入数字作为参数,最后再输入命令。如果你有META (或EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然后输入数字。不过我们还是建议你用 C-u,因为它在任何终端机上都能用.
<Delback>    删除光标前的一个字符
C-d          删除光标后的一个字符

M-<Delback>  移除光标前的一个词
M-d          移除光标后的一个词

C-k          移除从光标到“行尾”间的字符
M-k          移除从光标到“句尾”间的字符

C-x C-f         寻找文件。
C-x C-s         保存文件。
C-x C-b         列出缓冲区。
C-x C-c         离开 Emacs。
C-x 1           关掉其它所有窗格,只保留一个。
C-x u           撤销。

The part below is copying from http://xahlee.org

Basic Keyboard Shortcuts

Open, Save, Close

Ctrl+x Ctrl+f
Open a new file
Ctrl+x Ctrl+s
Save file
Ctrl+x k
Close the current file

Moving Cursor

Use the arrow keys ↑ ↓ ← →, and Home, End,Page Up Page Down keys.
Ctrl+←
Move cursor left by word.
Ctrl+→
Move cursor right by word.
Ctrl+Home
Beginning of document.
Ctrl+End
End of document.

Deleting Text

Alt+d
Delete the next word
Alt+Backspace
Delete the previous word
Ctrl+k
Delete all characters from cursor to end of line

Copy Paste Undo

First pull the menu “Options‣C-x/C-c/C-v Cut and Paste (CUA)”, then pull the menu “Options‣Save Options”.
Ctrl+Space
Mark the starting point for copy/cut a text
Ctrl+c
Copy
Ctrl+x
Cut
Ctrl+v
Paste
Ctrl+x h
Select All
Ctrl+/
Undo. (To redo, type any character then do undo twice.)

Split Window

Ctrl+x 2
Split window into 2 panes
Ctrl+x 1
Make the cursor pane fill window
Ctrl+x o
Move cursor to the other pane

Searching Text

To search a word, press “Ctrl+s”, then type your search word, emacs will move the cursor to the location of the matched text as you type. Press “Ctrl+s” again to jump to the next occurrence, press “Ctrl+r” to jump to the previous occurrence.
Once you found what you are looking for, press the arrow key to cancel the search and leave your cursor there. To exit search and leave the cursor at its original place, press “Ctrl+g”.

Find and Replace Text

See advanced emacs tips.

Basic Principles of Emacs

General commands

Shortcut
Command Name
Description
Ctrl+g
keyboard-quit
Cancel a command or unfinished keyboard shortcut sequence
Alt+x
execute-extended-command
execute a command by name