Saturday, December 4, 2010
新东方背单词粘贴乱码问题
日文XP操作系统,安装新东方背单词,区域和语言选项里面设置非unicode程序默认语言为汉语。这样可以防止一些不是unicode对应的应用可以正确的显示中文。
副作用是一些随机附带的日文非unicode软件不能正确显示日文(乱码),原因是日文编码的资源(菜单等)按照中文来解码的缘故。
问题是添加自定义注释的时候,从dict.cn拷贝的一些中文粘帖到新东方之后,显示为乱码。
可能的原因:
dict.cn编码为GBK中文编码,拷贝倒剪贴板之后被转换为unicode编码(windows XP内部编码),当粘帖到新东方的时候,由于新东方非unicode程序,默认按照GBK解码,结果变为乱码。过程如下:
1. dict.cn (gbk) -> clipboard (unicode) :内部自动转换(假设中文输入法关闭)
2. clipboard ->新东方:内部自动转换,但是默认加铁板是GBK编码,实际却是unicode。
解决办法(可行):
复制的时候打开中文输入法。dict.cn网站打开中文输入法既可。
上述步骤2应该没有变,步骤1可能多了一层转换,从而让步骤2的转换变成正常。 具体内部细节待考。
Thursday, December 2, 2010
太傻论坛资料下载出错问题
如果使用Free Download Manager或者Flashget等批量下载工具一次性下在多个文件的时候,往往刚上来可以下载一部分文件,随后下载下来的文件成为attachment.php。如果设置重名文件自动重名的话,下载下来一堆attachment.php(数字)文件。
原因
太傻的下载链接里面含有时间戳信息,下载链接会在一段时间之后失效,具体多长时间失效不是很清楚。所以刚上来可以下载,多了一段时间之后由于链接失效,下载下来的文件实际上是一个出错的HTML文件。
解决方法
根据自己网络速度和单个文件大小,调整下载文件个数。一次不要贪太多。等第一批文件下载完了之后,刷新太傻的网页(这一步是必需的,不然连接里面的时间戳还是旧的),添加第二批要下载的文件。
补充:
可以设置最多3个线程下载。
Monday, October 25, 2010
设置浏览器使用Foxit Reader打开PDF文件
Wednesday, August 25, 2010
Ubuntu 10.04 启动时黑屏问题【解决】
1. 症状
从9.10升级到10.04, 升级之后进入10.04之后,splash出现一会儿之后黑屏。使用Alt+Fx键等也无法切换到控制台。Ctr+Alt+Del也没有任何反应。只能手工关机重启。机器是toshiba笔记本 A50, 5年前的型号,显卡使用intel extreme X 内置显卡。
2. 原因
问题在于login画面显示上。虽然为黑屏,实际上是login画面,如果盲敲密码和回车的话,还是可以进入桌面的。问题出在了从splash切换到login画面时候显卡的mode设置上,可能一些老的显卡不工作。
3. 解决方法
修改启动参数,添加i915.modeset=1。
如果不行i915.modeset=0。
如果还不行xforcevesa。
任何一个如果可以正常启动,修改/etc/default/grub文件,找到GRUB_CMDLINE_LINUX_DEFAULT=“…”行,添加相应参数即可。
其他显卡以及其他解决方法,参考:
https://wiki.ubuntu.com/X/Bugs/Lucidi8xxFreezes
4. 注
好像该问题仅仅与2.6.32内核有关,如果其他方法不行,改换为2.6.31或者升级内核即可解决该问题。
Tuesday, July 13, 2010
Josephus问题求解
/*#include <iostream>
* Josephus问题:
* 设有n个人围坐一个圆桌周围,现从第1个人开始报数,数到第m的人出列,
* 然后从出列的下一个重新开始报数,数到第m的人又出列……如此重复,直
* 到所有的人全部出列为止。
* 对任意给定的n、m,求按出列次序得到的n个人员的顺序表。
*/
#include <sstream>
#include <list>
using namespace std;
int main(int argc, char** argv) {
if(argc != 3)
{
cout<<"Commandline parameter not correct!"<<endl;
exit(0);
}
int n=0, m=0;
stringstream ss;
ss<<argv[1];
ss>>n;
ss.clear();
ss<<argv[2];
ss>>m;
std::list<int> li;
for(int i=1;i<=n; ++i)
li.push_back(i);
while(li.size()>1)
{
for(int j=1;j<m; ++j)
{
++it;
if (it == li.end())
it = li.begin();
}
// output person who’s going to leave
cout<<*it<<endl;
it = li.erase(it); // erase return the next iterator
if(it==li.end())
it = li.begin();
}
// output last person
cout<<li.front()<<endl;
}
Saturday, November 8, 2008
XP remote desktop connection lost
I am using Windows XP SP3, and I connect to windows 2000 VPN server at work. After I use RDP to connect to my work PC for a while, then the connection is broken.
The error message is following:
The connection has been lost. Attempting to reconnect to your session...
2. Solution from internet
I googled and found a solution for using vista to connect to VPN server. It said that the following command will work.
netsh interface tcp set global autotuninglevel=disabled
But when I ran this on my XP box, I was prompted that command "interface tcp set global autotuninglevel=disabled" didn't exsit.
So this solution doesn't work for me.
3.My solution
Expand Options on the initial RDP screen. Then go to Advanced tab.
Click settings button and select do not use a TS gateway server radio butoon.
This setup seems work for me.
-
Tuesday, September 30, 2008
How to use wget to download globbing files
You tried wget http://www.server.com/dir/*.gif, but that didn't work
because HTTP retrieval does not support globbing.
In that case, use:
wget -r -l1 --no-parent -A.gif http://www.server.com/dir/
More verbose, but the effect is the same. -r -l1 means to retrieve
recursively, with maximum depth of 1. --no-parent means that refer-
ences to the parent directory are ignored, and -A.gif means to down-
load only the GIF files. -A "*.gif" would have worked too.
>>From mget manual.
You can use globbing for downloading globbing files from ftp servers.
wget ftp://ftp.server.com/dir/*.gif
--