2012年5月9日星期三

Upload images to our BBS abroad

Seems that our BBS can not allow we to upload image from other countries...
OK. This script can bypass the IP checking and do the uploading. It is developed by Zimu Liu.

#!/bin/sh

if [ -z "$1" ]; then
 echo "Usage:  ./`basename \"$0\"` "
 exit -1
fi

FULLPATH="$1"
if [ ! -r "$FULLPATH" ]; then
 echo "File does not exist, or you do not have read privilge!"
 exit -1
fi

FILESIZE=$(cat "$FULLPATH" | wc -c)
if [ $FILESIZE -ge 300000 ]; then
 echo "The size of file exceeds 300000 bytes!"
 exit -1
fi

FILENAME="`basename "$1"`"
EXT=$(echo $FILENAME | grep -i .gif$ || echo $FILENAME | grep -i .jpg$)
if [ -z "$EXT" ]; then
 FILENAME="$FILENAME.jpg"
fi

URL=$(curl -F "up=@${FULLPATH};filename=c:\\${FILENAME}" \
 -F MAX_FILE_SIZE=300000 -F board=C_Computer -F level=0 -F live=9999 -F "exp=" \
 bbs.njupt.edu.cn/cgi-bin/bbsdoupload \
 | tr -d "\015" | tr -d "\012" \
     | sed "s/^$//g")

echo "\nCopy the following URL to your brower:\n"
echo "http://bbs.njupt.edu.cn/cgi-bin/$URL\n"


Solving the LaTeX error: "Too many unprocessed floats"

Yesterday I generated a LaTeX document using Matlab script. This document have about 50 tables, with even table embedded with 30 images. So LaTeX thought that it I can't handle this much floating objects.

I searched around on the internet and found the best solution for me is to add
\clearpage
after every table. This command will force LaTeX to dump all the cached floating objects till here. So basically it will print one table per page, which is fine in my case.

2012年3月31日星期六

Kindle菜单乱码问题简单解决方案

Kindle看中文电子书最大的头痛就是菜单有如完形填空,我最喜欢的作家钱锺书居然能变成三个框框,各种纠结。当时上网找方案基本都是教唆我越狱,实在嫌麻烦。今天在网上找到了一个超级方便的,特此留底。

源链接:

解决办法很简单,就是改变默认的语言设置,输入以下命令即可:

;debugOn
~changeLocale zh-CN
;debugOff

输入时要注意大小写,具体输入步骤是:在home页面,先按下回车(也就是方向键旁边那个弯弯箭头键),会出现一个输入框,输入第一条命令后,回车,再输入第二条,再回车,再第3条回车。这样就设置成功了,然后重启kindle 3。

重启步骤:home -> Menu -> Settings -> Menu -> Restart

也就是进入设置那里再按MENU选择restart重启,或者直接滑动那个关机键按住15秒左右就重启了。

重启之后就感觉世界终于清净了,不仅Home里面所有书名都完整显示了,而且之前一直乱码的告别天堂也终于没问题了。