Floating Figure In Latex

\usepackage{floatflt}

\begin{floatingfigure}[lrp]{width}
\centering
\includegraphics{image.jpg}
\caption{fig:default}
\label{fig:figlabel}
\end{floatingfigure}

Captions and labels can be used in the same way as in the figure environment. Either of the optional arguments is used: l: left-hand sided figure r: right-hand sided figure p: left for even, right for odd page numbers. The width-argument indicates the space to be taken by the figure. Tip: Instead of an absolute width value, make it relative by ussin a fraction of the textwidth or columnwidth. E.g. 0.5\textwidth

http://texblog.wordpress.com/2008/04/14/floating-text-around-figuretable/

Tags:

* Comments(1)

Solution to corrupt Windows XP Profile

If you encountered “can not load locally stored profile….possible cause of …. insufficient security right or…” when you log into your account of Windows XP. Your profile seems to be corrupted.

Here is a solution you may have a try. I know two successful example with this solution.

Go to your registry editor (Win+R, type regedit, enter)

Follow this path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

You will find a key suffixed by “.bak”.

What you do is to remove the “.bak” (including the dot), and then reboot.

If you are prompted there is an existing name, just rename the existing one to another name. (actually you won’t need it anymore)

Hope it helps.

Tags:

Comments(0)

Windows 7 disabled script host??

自从装了windows 7, 就没有成功用过我写的windows script. 一些控制iTunes的js. 今天终于忍不住了, 网上搜了一番, 发现一个解决办法,

http://www.winhelponline.com/articles/230/1/Error-There-is-no-script-engine-for-file-extension-when-running-js-files.html

基本思想是, 由于js文件在注册表里缺失了相应的class, 于是windows不知道该如何处理js这个文件. 不知道是不是windows 7出于安全的考虑, 禁止了.

解决办法是,

1. 用管理员模式运行  regsvr32 %systemroot%\system32\jscript.dll
2. 下载这个注册表文件, 并运行.

即可.

Tags:

Comments(0)

two latex tips

1. how to use symbol (~) in latex?  simple, just use \textasciitilde.  Somebody use $\sim$, that’s not correct. if you  copy it in Acrobat Reader and paste it out, you will find that’s another char.

2. how to use right-alignment and top-alignment in a tabular. Here is how: http://texblog.wordpress.com/2008/05/07/fwd-equal-cell-width-right-and-centre-aligned-content/
to summarize, define:\newcolumntype{x}[1]{>{\raggedleft\hspace{0pt}}p{#1}}  and use it in tabular \begin{tabular}{|l|x{4.5cm}|x{4.5cm}|}. but you cannot use \\ to end lines. Instead, use \tabularnewline.

Tags:

Comments(0)

how to do photo matting in photoshop CS4

There used to be a plugin named Extract. but it is not by default installed. so download optional installation @ http://www.adobe.com/support/downloads/thankyou.jsp?ftpID=4047&fileID=3768

installation is simple , copy the plugin file to the plugin folder->filter of photoshop application.

after that,  open a photo and choose extract from manu under filter.  use highlight tool to draw the boundaries and the use fill tool to fill the foreground, thereafter click ‘Ok’..  job is done. Note: donot draw too wide boundary using highlight tool, the narrow it is, the better your matting is.

Although there is quite a lot research on photo matting and they have much better result. The photoshop one is still very easy to use and fast.

If you cannot get the matting properly, please read this instruction with figure: http://www.photoshopcafe.com/tutorials/cutout/cutout.htm

update 2/12/2010: new plugins download here (for cs5, this is extractplus for windows) http://www.adobe.com/support/downloads/detail.jsp?ftpID=4688

Tags:

Comments(0)

用rsync同步

rsync是功能强大的同步工具, 比synctoy之类的强多了. 但命令行的参数太麻烦, 每次用又忘记了, 所以这里整理一下, 方便日后使用

参数:  rsync -参数  [src dir] [dest dir]

1.拷贝文件, 如果用cp或者scp的话, 所有的文件都会重新覆盖一边, 大量拷贝的时候会太慢. 用rsync就可以先比较再拷贝, 速度快多了.比如我发布本地的网页到服务器上,就可以用
rsync -rlv ~/websites/sitename/ username@server:~/public_html/
-r 是recursive
-l copy symlinks as symlinks
-v increase verbosity
此外还可以用 -u update, 如果服务器上的文件新则跳过.

2.备份照片,视频等. 只需要一个-a 的参数即可

rsync -a --delete ~/Pictures/iPhoto\ Library/ /Volumes/Backup/iPhoto_backup/iPhoto\ Library/

或者

 rsync -a --delete ~/Pictures/iPhoto\ Library /Volumes/Backup/iPhoto_backup/

-a 是archive的意思, 存档, 等效于-rlptgoD, recursive, copy symlinks as symlinks, preserve permissions, 等等.
–delete delete extraneous files from destination dirs是删除备份处已有的多余文件. 这个根据个人需要添加

此外,一个有用的参数是 -u, dry-run, 只是看下都有哪些文件会同步. 但这个参数仍旧会删除多余文件, 所以一定要确保src dest和dest dir都正确的情况下再按下enter.

目前对于我来讲,这两个已经够用了. 用起来也很简单方面. 其他复杂的参数俺也不会. 以后要是有新的tips了俺慢慢加上.

update: 刚发现了个小tip, 在src dir后面如果带”/”,则同步的是这个dir里面的所有文件而不包含该src dir本身;若不带”/”,则同步的是src dir本身. 这个和cp的效果是一样的. 所以,非常重要的是, 如果src dir带”/”,并且用了–delete参数了的话, 则同步完成后dst dir里的内容将和src dir里的内容一模一样了. 若src dir不带”/”,则同步完成后dst dir将拥有一个目录和src dir一样. 千万别混用,而导致其他文件的丢失. 而dest sir加不加”/”是一样的效果.

Comments(0)

Install Visual Studio on Windows 7 x64

Failed thousands of times in the mounted ISO file. (tested vs2008, 2010b2)
Succeeded just after I copied all the files out of the ISO file and ran the setup file. (tested vs2010b2).

Update: 2/2/2010, recently I have tried Pismo File Mount, succeeded. No need to waste time to  copy files out of ISO file.
Also, suggested by #kivin, using latest DAEMON Tools lite to mount ISO can work.

Tags: ,

* Comments(3)

How to use OpenCV 2.0a in Visual Studio?

OpenCV 2.0 now uses CMake to organize the whole project. By default, it only provides linux library. So we need to compile it first.

Download Cmake for windows and install.

Go to C:\OpenCV2.0, execute the following cmd

 cmake . -G "Visual Studio 9 2008" 

Change "Visual Studio 9 2008" to your default compiler.

Cmake will generate a solution file (containing many projects) for you visual studio. Open it and build with “release”.

Add the following path to Tools–>Options–>Projects–>VC++ Directories–>Include files

C:\OpenCV2.0\include\opencv

Add following path to Tools–>Options–>Projects–>VC++ Directories–>Library files

C:\OpenCV2.0\lib\Release

When create a new project,

add following to “Project–>Properties–>Linker->Input–>Additional dependencies

cv200.lib cxcore200.lib highgui200.lib

Tested on OpenCV 2.0 on Visual Studio 2008

Related Post:

How to configue OpenCV 1.0 in Visual Studio – Reprice

Tags:

* Comments(35)

如何下载Youtube 的各种格式视频

网上流传了很多下载youtube的方法或者工具. 其实原理很简单, 只需要通过这样一个URL:

http://www.youtube.com/get_video?fmt=%(fmt)s&video_id=%(video_id)s&t=%(t)s

就可以下载到想要的格式和清晰度.

里面有三个参数, fmt, video_id, t.

对于fmt, 我会在最后列出一个表, 现在youtube所支持的fmt参数.

video_id就是对应于观看youtube video时候的url里的v=xxxxxxxx, 例如  http://www.youtube.com/watch?v=Cb7sPebuKLY&NR=1  video_id就是Cb7sPebuKLY.

t是一个类似cookie的东西, 在page source里可以找到. 在源码里搜索 ‘"t": ‘ 注意包含引号和冒号. 在这个video里的t就是

"vjVQa1PpcFPAdzenFnWSQ2nCQ0NxZ00JfWyv2qTMdTQ%3D".

有了这样几个参数后, 就可以下载想要的video了. 下面是fmt的表

fmt 说明
5 低品质 flv
13 低品质 3gpp
17 低品质 3gpp 略高于13
18 低品质 mp4 320×240??
22 高清品质 mp4 1280 x 720 (画面比例 16:9)
34 高品质 flv 
35 高清品质 864 x 480 ( 9:5 )
36 高品质 3gpp

到此为止, 随便写个程序实现下载已经很容易了, 若是徒手略微麻烦了点.

这里有一个javascript, 或者叫bookmarklet, 把它拖到bookmark栏里, 在看youtube的时候, 点它就可以下载. 比较方便. 但由于并不是所有的video都有高清的, 所以不能用一个javascript搞定所有的格式, 需要的时候自己修改修改里面的fmt吧.

Download Youtube Video

同时我写了个python程序下载, 点我下载

使用方法是 youtubeDownloader [localfile] [video_id|URL] [fmt]

下载的部分用了wget, windows版本的wget这里下载

另外有一个网站http://www.file2hd.com/ , 你只要把要下载的youtube url给他, 他能帮你整理出可以下载的video. 如果少量video下载也是很不错的选择.

 

有个疑问: 有些video算是HQ的, 但又没有到fmt=35的品质, 当然更到不了22这种, 对于这种video, 应该用fmt等于几来下载呢?  我尝试了各种fmt都是不行.  一个例子是http://www.youtube.com/watch?v=-E_8YzO6oL0, 谁有兴趣,帮忙尝试一下吧.

Comments(0)

Maltab Layout File Location

You might love your matlab layout configuration and may want to keep and use it along with you.

Here is the location of the layout file,

Windows:
C:\Documents and Settings\username\Application Data\MathWorks\MATLAB\R2009a

Mac:
/Users/username/.matlab/R2009a/

Comments(0)