msgbartop
My technology blog
msgbarbottom

14 Feb 10 推荐一个vim的配色方案desertEx

可以在这里下载:http://vimcolorschemetest.googlecode.com/svn/colors/desertEx.vim

使用方法:

将文件下载到vim目录下的colors。然后在vimrc里面加入colo desertEx就好了。

感觉比默认的desert清爽一点。

效果图:

(more…)

Tags: ,

12 Feb 10 A small visual tool for the problems of Computational Geomery

I call it vertion 1.0:)

It create a ps file which can be opened by Gsview.

Here it is:

Class of Visual Tool
  1. class Draw {
  2.     private:
  3.         FILE * file;
  4.         P base;
  5.         double rate;
  6.         void moveto(P a) {
  7.             fprintf(file, "%f %f moveto\n", a.x, a.y);
  8.         }
  9.         void lineto(P a) {
  10.             fprintf(file, "%f %f lineto\n", a.x, a.y);
  11.         }
  12.         void show(const char *s) {
  13.             fprintf(file, "(%s) show\n", s);
  14.         }
  15.         P update(P a) {
  16.             return (a + base) * rate;
  17.         }
  18.         void done() {
  19.             fprintf(file, "stroke\nshowpage\n");
  20.             fclose(file);
  21.         }
  22.     public:
  23.         Draw (const char * filename, double minx, double maxx, double miny, double maxy) {
  24.             //file name must be *.ps. The next four arguments form the boundary of the plane.
  25.             base = P(-minx, -miny);
  26.             rate = min(499 / (maxx – minx), 499 / (maxy – miny));
  27.             file = fopen(filename, "w");
  28.             fprintf(file, "/Times-Roman findfont\n");
  29.             fprintf(file, "20 scalefont\n");
  30.             fprintf(file, "setfont\n");
  31.             fprintf(file, "newpath\n");
  32.         }
  33.         ~Draw() {
  34.             done();
  35.         }
  36.         void draw_segment(P a, P b) { //draw a segment.
  37.             moveto(update(a));
  38.             lineto(update(b));
  39.         }
  40.         void draw_line(P a, P b) {//draw a line
  41.             a = update(a);
  42.             b = update(b);
  43.             moveto(a + (b – a).trunc(1000));
  44.             lineto(b + (a – b).trunc(1000));
  45.         }
  46.         void draw_arc(P mid, double r = -1, double deg1 = -180, double deg2 = 180) {
  47.             //draw arc; mid is the center of the circle. r is the radius.
  48.             //deg1, deg2 are the range of the angle. (counter-clockwise).
  49.             //if you want to draw a point just call draw_arc(mid),
  50.             // and if you want to draw a circle, call draw(mid, r).
  51.             r = r == -1? 1: r * rate;
  52.             mid = update(mid);
  53.             moveto(mid + P(cos(deg1 * pi / 180), sin(deg1 * pi / 180)) * r);
  54.             fprintf(file, "%f %f %f %f %f arc\n", mid.x, mid.y, r, deg1, deg2);
  55.         }
  56.         template <class T> void draw_polygon(T s, T t) {//draw a polygon, use it in a way like stl.
  57.             moveto(update(*s));
  58.             while (s != t–) {
  59.                 lineto(update(*t));
  60.             }
  61.         }
  62.         void draw_word(P p, const char *s, double sita, double len = 15) {//draw a word.
  63.             //len is the distance between point p and the center of the first letter of the word.
  64.             //sita is the slope of vector (P, center of the first letter).
  65.             sita = sita * pi / 180 – pi / 8;
  66.             moveto(update(p) + P(18 * cos(sita), 18 * sin(sita)));
  67.             show(s);
  68.         }
  69. };

(more…)

Tags: ,

12 Feb 10 My vimrc for ACM/ICPC, Version: 1.0

在这里发布一下我平时写竞赛小程序用的vimrc。

一是方便我自己备份,二是给有需要的人。

http://gaoyunxiang.com/wp-content/uploads/2010/02/vimrc.zip

使用方法:用上面的连接下载下来,里面有两个文件,一个是vimrc另一个_run.exe。

替换掉vimrc之后,把_run.exe放到和gvim.exe的同一个目录下。 (more…)

Tags:

08 Feb 10 Windows 7中的病毒Trojan.PWS.Legmir.AD / W32.Ahlem.A@mm

自从装了Win7之后,电脑总是是不是的提醒我电脑里有病毒.

Remove the Trojan.PWS.Legmir.AD / W32.Ahlem.A@mm virus from your computer

This problem was caused by Trojan.PWS.Legmir.AD / W32.Ahlem.A@mm, a known computer virus.

To prevent this problem from occurring again, install and run an up-to-date antivirus program on your computer.

刚看到这个提示消息的时候特别奇怪,我用电脑的习惯一直很好,从来没有装过杀毒软件,Win7又是一个新系统,安全性也挺高的,怎么会有病毒呢? 想当年用Win98的时候我都是裸奔…怎么Win7会提示中了病毒呢…

思索半天无果…只好把这个消息无视了.

不过最近还是频繁提示这个消息,郁闷了我好久…

这几天突发灵感,实验良久终于找到了问题所在.

原来是因为我写的程序a.exe被系统当作这个病毒了…

估计经常写小程序的人会碰到这个问题…大家都无视之吧,这个是Win7的误判…

Tags: ,