Tuesday, February 16, 2010

Tex/Latex to Word doc

As latex is not always acceptable or not preferred by some user, particularly people you can not refuse their requirement. A Latex to doc is needed. There are commercial code available, like GrnidEQ and Tex2Word, they are nice, but around $100 each. For user with not so much feature is needed like the editable equations, it is not worthy to buy it. Additionally, LaTex user always prefer to use open source. So an alternative method with reasonable conversion is needed.

The easiest way is convert Latex to HTML at first, and import html to word afterwards. I just want to convert the equations to simple pictures, so latex2html and tex2page are the two available script based applications. During the testing of tex2page, I find a problem that all the equations can not get correct equation numbers, it alwasy restart from 1, and the cross-reference can not be built correctly. And latex2html works fine on the cross-reference, but another problem by latex2html is, it always split the equation to several parts, and sometime, underline is added to the equations, I still can not figure it out how to make the whole equation to be a single picture. Anyway, latex2html is current conversion tool for me.

Friday, February 12, 2010

CTeX-2.4.5-8 Full中tex2page的安装方法 [转]

系统:
Windows XP SP2, Vista, FC5
CTeX-2.4.5-8 Full

1、安装tex2page:
(1)、从tex2page官主主页http://www.ccs.neu.edu/home/dorai/tex2page/tex2page-doc.html上下载tex2page.tar.tar
(2)、解压tex2page.tar.tar到当前文件夹得到文件夹tex2page
(3)、把文件夹tex2page复制到C:\CTeX\localtexmf\tex\latex下,最后的目录是:C:\CTeX\localtexmf\tex\latex\tex2page\

2、安装MzScheme:
(1)、从MzScheme官方主页:http://www.plt-scheme.org/software/mzscheme/下载mz-301-bin-i386-win32.exe
(2)、双击mz-301-bin-i386-win32.exe,把它安装在C:\CTeX\localtexmf下(也可安装在其它目录中,如D:\MzScheme\),最后的目录是:C:\CTeX\localtexmf\MzScheme\
(3)、添加C:\CTeX\localtexmf\MzScheme到path环境变量中

3、测试:
(1)、用winEdt打开C:\CTeX\localtexmf\tex\latex\tex2page\t2p-example\scshdoc.tex
(2)、打开winEdt工具栏上的DOS窗口按钮,输入命令tex2page scshdoc 进行编译
(3)、用winEdt工具栏上的HTML Preview按钮(浏览器图标)进行浏览
(4)、提示:[Bibliography not generated; rerun TeX2page],点击这一行后,显示:
This is TeX2page, Version 20050501 (MzScheme 301, windows)
(scshdoc.tex) [0]
Running: bibtex scshdoc-Z-B
Document title not determined
Bibliography not included
Rerun: tex2page scshdoc.tex
If problem persists, check for missing \label's and \bibitem's
Output written on scshdoc.html (1 page).

说明未生成参考文献,按提示继续进行

(5)、在上述的DOS窗口中输入命令bibtex scshdoc-Z-B,回车,再次输入命令tex2page scshdoc 进行编译
(6)、用winEdt工具栏上的HTML Preview按钮(浏览器图标)进行浏览。OK

如果你在 XP 上安装 tex2page,那么要补充几点:

1,别忘了安装 NetPBM,具体安装方法请参考楼主写的 LaTeX2html安装及在winEdt界面中的配置 中的第二步

2,不要下载最新版的 MzScheme(v301),要下载 mz-209-bin-i386-win32.exe 。因为从 v300 版开始, MzScheme 开始将标准输入输出都改成 utf-8,处理中文文档会乱码。

3,MzScheme 的发行版本中也会带有一个已经编译好的 tex2page.exe,这个版本比较旧,可以把它删掉,就在 MzScheme 的安装目录中。

4,不知道为什么,最新版的 tex2page(Version 20060523) 已经不包含王垠的 chinese.t2p 了,如果你想继续使用它,就要到 这里 下载,并将解压后得到的两个文件覆盖到 tex2page 最新版的目录中。

5,使用 tex2page 之前要先修改一下 tex2page.bat 文件,将下面代码覆盖到 tex2page.bat 中。

CODE

@echo off
set MZSCHEME="D:\Program Files\MzScheme\MzScheme"
set TEX2PAGE="D:\CTeX\localtexmf\tex\latex\tex2page\tex2page"
%MZSCHEME% -qvm -f %TEX2PAGE% -C %TEX2PAGE% %1


然后修改一下 MZSCHEME 和 TEX2PAGE 使之指向你的具体安装路径。

6,更新一下 MiKTeX 的文件名数据库,把 D:\CTeX\localtexmf\tex\latex\tex2page 加入到 PATH 环境变量中。


最后检查一下,楼主说的和我这里说的所有这些步骤都做齐了,就可以试试王垠提供的测试例子:我的第一个 tex2page 文档

QUOTE(kenxu @ 2006-05-24, 08:09 PM)
如果你在 XP 上安装 tex2page,那么要补充几点:

1,别忘了安装 NetPBM,具体安装方法请参考楼主写的 LaTeX2html安装及在winEdt界面中的配置 中的第二步

2,不要下载最新版的 MzScheme(v301),要下载 mz-209-bin-i386-win32.exe 。因为从 v300 版开始, MzScheme 开始将标准输入输出都改成 utf-8,处理中文文档会乱码。

3,MzScheme 的发行版本中也会带有一个已经编译好的 tex2page.exe,这个版本比较旧,可以把它删掉,就在 MzScheme 的安装目录中。

4,不知道为什么,最新版的 tex2page(Version 20060523) 已经不包含王垠的 chinese.t2p 了,如果你想继续使用它,就要到 这里 下载,并将解压后得到的两个文件覆盖到 tex2page 最新版的目录中。

5,使用 tex2page 之前要先修改一下 tex2page.bat 文件,将下面代码覆盖到 tex2page.bat 中。

CODE

@echo off
set MZSCHEME="D:\rogram Files\MzScheme\MzScheme"
set TEX2PAGE="D:\CTeX\localtexmf\tex\latex\tex2page\tex2page"
%MZSCHEME% -qvm -f %TEX2PAGE% -C %TEX2PAGE% %1


然后修改一下 MZSCHEME 和 TEX2PAGE 使之指向你的具体安装路径。

6,更新一下 MiKTeX 的文件名数据库,把 D:\CTeX\localtexmf\tex\latex\tex2page 加入到 PATH 环境变量中。
最后检查一下,楼主说的和我这里说的所有这些步骤都做齐了,就可以试试王垠提供的测试例子:我的第一个 tex2page 文档
[right][snapback]262499[/snapback][/right]

谢谢kenxu兄,从你的回贴中我学到了很多有用的东西!

Thursday, February 11, 2010

Search and replace in vim, (Another reminder)

Vim command Action
/pattern Search the file for pattern.
n Scan for next search match in the same direction.
N Scan for next search match but opposite direction.
Replace
Vim command Action
:rs/foo/bar/a Substitute foo with bar. r determines the range and a determines the arguments.
The range (r) can be
nothing Work on current line only.
number Work on the line whose number you give.
% The whole file.
Arguments (a) can be
g Replace all occurrences in the line. Without this, Vim replaces only the first occurrences in each line.
i Ignore case for the search pattern.
I Don't ignore case.
c Confirm each substitution. You can type y to substitute this match, n to skip this match, a to substitute this and all the remaining matches ("Yes to all"), and q to quit substitution.
Examples
:452s/foo/bar/ Replace the first occurrence of the word foo with bar on line number 452.
:s/foo/bar/g Replace every occurrence of the word foo with bar on current line.
:%s/foo/bar/g Replace every occurrence of the word foo with bar in the whole file.
:%s/foo/bar/gi The same as above, but ignore the case of the pattern you want to substitute. This replaces foo, FOO, Foo, and so on.
:%s/foo/bar/gc Confirm every substitution.
:%s/foo/bar/c For each line on the file, replace the first occurrence of foo with bar and confirm every substitution.

Thursday, October 22, 2009

Tuesday, September 22, 2009

Dankfest 2009




Inline Images with inserting images Labs

0,1020,1442424,00.jpg

Badminton terminology

Glossary of Badminton Terms
Alley - Extension of the court by l 1/2 feet on both sides for doubles play.

Back Alley - Area between the back boundary line and the long service line for doubles.

Backcourt - Back third of the court, in the area of the back boundary lines.

Balk - Any deceptive movement that disconcerts an opponent before or during the service; often called a "feint."

Baseline - Back boundary line at each end of the court, parallel to the net.

Carry - An illegal tactic, also called a sling or throw, in which the shuttle is caught and held on the racquet and then slung during the execution of a stroke.

Center or Base Position - Location in the center of the court to which a singles player tries to return after each shot.

Center Line - Line perpendicular to the net that separates the left and right service courts.

Clear - A shot hit deep to the opponent?s back boundar>Nine. The high clear is a defensive shot, while the flatter attacking clear is used offensively.

Court - Area of play, as defined by the outer boundary lines.

Drive - A fast and low shot that makes a horizontal flight over the net.

Drop - A shot hit sohly and with finesse to fall rapidly and close to the net on the opponent?s side.

Fault - A violation of the playing rules, either in serving, receiving, or during play (see common faults listed below).

Flick - A quick wrist and forearm rotation that surprises an opponent by changing an apparently soft shot into a faster passing one; used primarily on the serve and at the net.

Forecourt - Front third of the court, between the net and the short service line.

Hairpin Net Shot - Shot made from below and very close to the net with the shuttle rising, just clearing the net, and then dropping sharply down the other side. The shuttle?s flight approximates the shape of a hairpin.

Halfcourt Shot - A shot hit low and to midcourt, used effectively in doubles against the up-and-back formation.

Kill - Fast, downward shot that cannot be returned; a "putaway." Let - A legitimate cessation of play to allow a rally to be replayed. Long Service Line - In singles, the back boundary line.1n doubles a line 2 l/2 feet inside the back boundary line. The serve may not go past this line.

Match - A series of games (at U.S. Olympic Festival-?93 it is three out of five), to determine a winner. Midcourt - The middle third of the court, halfway between the net and the back boundary line.

Net Shot - Shot hit from the forecourt that just clears the net and drops sharply.

Push Shot - Gentle shot played by pushing the shuttle with little wrist motion, usually from net or midcourt to the opponent?s midcourt.

Racquet - Instrument used by playerto hit shuttlecock Weight:About3 ounces. Length: 27 inches. Made of: Ceramic, graphite, or boron frame; beef-gut string. Cost: $60-$175 (unstrung).

Rally - Exchange of shots while the shuttle is in play.

Serve or Service - Stroke used to put shuttlecock into play at the start of each rally.

Service Court - Area into which the serve must be delivered. Different for singles and doubles play.

Short Service Line - The line 6 l/2 feet from the net which a serve must reach to be legal.

Shuttlecock - Official name for the object that players hit. Also known as "birdie." Weight: .17-.l9 ounces. Made of: 16 goose feathers attached to a corktip covered with goat skin. Cost: $1.50-$2.00. Usually lasts for no more than two games. The heavier the shuttlecock, the faster it flies. Flies faster in higher temperatures and at higher altitudes.

Smash - Hard-hit overhead shot that forces the shuttle sharply downward. Badminton?s primary attacking stroke.

Wood Shot - Shot that results when the base of the shuttle is hit by the frame of the racquet. Once illegal, this shot was ruled acceptable by the International Badminton Federation in 1963.

Badminton terminology

Another test of HTML Blogger

http://imgur.com/JTaRM.jpg
Testing of the HTML via email-to-blogger.

Testing of blog by email.

Whether the signature can be included in the blog post via email posting?

--
                         ,     ,
                         |\---/|
                        /  , , |
                   __.-'|  / \ /
          __ ___.-'        ._O|
       .-'  '        :      _/
      / ,    .        .     |
     :  ;    :        :   _/
     |  |   .'     __:   /
     |  :   /'----'| \  |
     \  |\  |      | /| |
      '.'| /       || \ |
      | /|.'       '.l \\_
wind  || ||             '-'
      '-''-'

Tuesday, July 28, 2009

Today (Flash Game)







Read more: http://www.blogdoctor.me/2007/02/flash-for-blogger.html#ixzz0MYPPBw5E

Monday, July 27, 2009

Monday, March 30, 2009

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux

The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We'll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

find /path/to/files* -mtime +5 -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation

  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

Thursday, March 19, 2009

Juice for Firefox vs 火狐魔镜



Juice is a Firefox extension by a chinese group in Beijing, which can show the video or picture in your right side bar of Firefox. At the same time, there is a special version of Firefox for China named 火狐魔镜, which offer the similar features. But, this version also have some other buildin extension, among which is the stocks market link, online music, online game. Some of the functions are not avilable outside of China.

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

These configuration changes are a trade-off between internet browsing speed and memory usage. They are most useful if you are multitasking and need Firefox to be less of a memory hog while using other applications.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

Monday, March 09, 2009

First picture by my new tablet.

Using my new tablet. Hanvon 0806