用LaTeX上瘾之后,什么东西都想用LaTeX来做。前段时间由于经验不足,折腾LaTeX版的实验报告模板未果,这次在写LaTeX简历之前,足足做好了功课,最后总算是做出来了,感觉很棒。
推荐几个LaTeX模板,一个是以前找到的,不过我最后没采用。点此下载>>>
另外一个是在这里找到的:http://www.davidgrant.ca/latex_resume_template,作者使用了shading宏包,但是我用了XeTeX包后shading包似乎就不起作用了,后来在作者文章后面发现一个留言,似乎是个变通的办法,但是shading是有了,边框却没了。最后去smth上的TeX版求助,可爱的版主大人瞬间就回帖告诉我,用\fcolorbox等比较常见的包中的命令就能搞定,于是我就搞定了。经过我修改后的LaTeX模板,我只贴一个文件\begin{document}前面的那部分吧,因为简历的内容真的是不好意思拿出手-。-和我下载的那个网页的主人比起来,真是汗颜啊~~
这部分改动还是挺多的,特别是修改了几个命令,请注意自己替换,并且请使用xelatex命令编译。
Read the rest of this entry »
欢迎光临Caspar Ant,如果您喜欢本站的内容,欢迎订阅我的RSS;如果您需要出于非商业性质的转载,请先阅读版权声明页面。
03月 30th, 2009 | 513 views如何创建QT工程
刚才打了一大段字,不小心给其他页面覆盖了……看来WP的自动保存功能还是得开启……
最近有心学一下GUI编程,在GTK, wxWidgets和QT之间选择,最后因为QT Designer和喜欢C++的缘故选择了QT。当然QT4 Designer也不是那么傻瓜化的东西,有很多步骤都需要自己来完成。经过一番Google上的学习之后,我总算完成了一个简单的QT工程的创建,因此以这个工程为例,记录一下创建过程,以供参考。
项目名称:POS
主程序名:main.cpp
主窗口及SIGNAL/SLOT处理:POSMainWindow[.h, .cpp]
界面文件:ui_POSMainWindow.h, POSMainWindow.ui
Meta Object Compiler文件:moc_POSMainWindow[.h, .cpp]
1. 新建界面配置文件(POSMainWindow.ui)
Read the rest of this entry »
因为我在KDE下不想装那个GNOME依赖关系超多的tomboy,所以暂时把这些非常过时的日常技巧发上来,众人不要怪我凑日志数哦~
1. MySQL授权用户:
GRANT ALL PRIVILEGES
ON `DATABASE`.`TABLE`
TO 'USER'@'DOMAIN'
IDENTIFIED BY 'PASSWORD'
WITH GRANT OPTION ;
Mysql 改密码:
mysqladmin -u root -p password 'NEW_PASSWORD'
2. 批量修改文本文件的编码:find . -iname '*.*' -execdir iconv -f GB18030 -t UTF-8 -o {} {} \;
批量缩小图片到50%: for i in *; do convert $i -resize 50%x50% sm-$i; done
3. HTML中使用脚本实现网页跳转:< script>window.location="http://url/to/be/redirected"< /script>
4. VIM中把TAB批量转为空格 :retab
VIM中使用F3键关闭粘贴时的缩进:set pastetoggle=< F3>
VIM中删除含特定字符串的行:g/str/d
Read the rest of this entry »
这是一首灰常有意思的歌曲,翻唱自Julia Ecklar的"God Lives on Terra"。
可以看看这里了解一下这首歌曲的歌词:http://www.gnu.org/fun/jokes/eternal-flame.html
GNU社区还推荐了很多有意思的东东,可以去http://www.gnu.org/fun/humor.html查看,作为一个Linuxer和一个Programmer,这些内容可算是相当不错的休闲佐料了~
顺便试一下WP的1bit插件:eternal-flame
囧,居然不支持ogg格式的播放……传个MP3格式的算了,ogg格式下载点此:eternal-flame
附上歌词一览:
Read the rest of this entry »
问题描述:The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process. Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials. The agent places two of the ingredients on the table. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients, and the cycle repeats.
问题分析:通过问题描述,可以构建出一个 4 进程的系统,其中 3 个进程为 smoker 程序的实例,另一个是 agent 程序的实例。首先,Agent 执行提供材料的操作(原则上来说,抽烟者先就座等待也是可行的,代码上也易于实现,但是我编写了一段代码发现很累赘,这作为一个需要改进的部分,暂时在代码中做 TODO 标记),然后执行对 Smoker_i的 V 操作唤醒 Smoker_i,其信号量增 1,i 的值由 Agent 随机确定。接着,Agent 开始等待,进程切换到Smoker_i,Smoker_i 执行 P 操作,信号量减为 0,开始获取材料,卷烟,抽烟操作。抽完烟后 Smoker_i执行 V 操作,通知 Agent,然后 Smoker_i 循环至开头,开始等待,进程切换回 Agent。Agent 也开始循环,如此周期往复。采用同步机制的 PV 操作伪码如下:
Read the rest of this entry »
曾经写过一篇文章《对awn-applet的notification area的一个小改动》,目的是为了避免高像素图标将notification area这个applet的高度撑破,经过修改,确实能将每个图标的像素给固定住,使得applet保持原大小。今天通过重新解读代码,发现原来的修改步骤并不那么完美,事实上只需要修改一条语句即可,仍旧是在applet.c这个源文件中,看到如下代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
| static void
tray_icon_added (EggTrayManager *manager,
GtkWidget *icon,
TrayApplet *applet)
{
//gtk_widget_set_size_request (GTK_WIDGET (icon), 24, 24);
g_object_set_qdata (G_OBJECT (icon), new_quark, GINT_TO_POINTER (1));
g_object_set_qdata (G_OBJECT (icon), del_quark, GINT_TO_POINTER (0));
applet->icons = g_list_append (applet->icons, icon);
gtk_widget_set_size_request (icon, icon_size, icon_size);
tray_applet_refresh (applet);
} |
Read the rest of this entry »
话说,用了awn-extra-applet之后,腰不疼了,腿不酸了,吃饭也香了,身体也有劲儿了……还能做两个半俯卧撑了……
不过有点不爽的就是,awn applets里面的notification area(用来代替panel上的notification area的东东)显示图标有问题。当某程序的status icon使用的是高像素图标(比如128x128)时,整个notification area就被撑满了,高度也撑破了。
如下图:

于是好好的一个awn的美观就被破坏殆尽。
最近对代码有点犯怵,不过还是去看了看notification area的代码,发现只有三个文件。
在applet.c中,找到这么一段代码:
Read the rest of this entry »
06月 29th, 2008 | 935 views0x5f3759df
Quake III的代码里面找出来的一段飞速计算平方根的倒数的代码。算法是牛顿迭代法的无限逼近,亮点在标题的这个0x5f3759df,被称为“Magic Number”,这个东东让计算平方根比一般的牛顿逼近快了4倍。又据说,0x5f375a86这个数比0x5f3759df效率更高。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
#ifndef Q3_VM
#ifdef __linux__
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
return y;
} |
Read the rest of this entry »
06月 10th, 2008 | 1,481 views纯发泄,Java考点
自动调用toString方法——
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| //A.java
public class A extends B
{
public String toString()
{
return "A";
}
}
//B.java
public class B
{
public String toString()
{
return "B";
}
}
//C.java
public class C
{
public static void main(String[] args)
{
Object o[] = {new A(), new B()};
System.out.print(o[0]);
System.out.print(o[1]);
}
} |
Read the rest of this entry »