- 博客(99)
- 资源 (1)
- 收藏
- 关注
原创 ubuntu下安装Sublime Text
最简单的安装方法,当然是上Sublime Text自己的网站下载,解压后可以直接使用但是就无法在Ubuntu的Dash中,以及文件右键菜单中选择Sublime Text打开解决方法是使用别人打包好的ppa,以及deb包sudo add-apt-repository ppa:webupd8team/sublime-text-2sudo apt-get updatesudo
2013-04-16 11:54:56
923
转载 ubuntu设置服务自启动
update-rc.d XXX enable/disable如果提示: System start/stop links for /etc/init.d/mysql do not exist.则先执行 update-rc.d XXX defaults, 这个命令会将服务注册到自启动中zz from:http://zhouyaoemb.blog.163.com/blog/st
2013-03-04 10:39:04
4312
原创 ubuntu12.04美化
实在不喜欢默认的图标参考这篇文章,手把手教 打造个性化Ubuntu 11.10桌面,美化步骤如下:1. 安装gnome tweak tool后边修改图标主题,需要用到这个sudo apt-get install gnome-tweak-tool2. 安装Faenza图标主题个人比较喜欢这个sudo add-apt-repository ppa:tiheu
2012-06-30 07:58:24
2966
转载 用vim阅读内核代码
1. 生成cscope和tags在内核源码根目录,make cscope tags2. 安装cscope3. 安装taglist (http://www.vim.org/scripts/script.php?script_id=273)使用方法:cscope:首先在内核源码根目录打开vim, 输入:cs add cscope.out查找并打开定义:cs f g
2012-01-21 21:24:59
1370
原创 std::set/std::map的"建议插入"
std::set和std::map的插入函数, 通常使用的是这个: pair insert(const value_type& x)set和map往往用二叉平衡树一类的结构实现, 在最差的情况下(例如, 完全升序或者降序排列), 会导致一直调整"平衡", 导致开销很大这时候, 可以使用这个: iterator insert(iterator pos, const value_type&
2011-12-20 14:25:51
859
原创 解决ubuntu字体模糊问题
简单的说,就是修改默认字体为:文泉驿点阵正黑(对于Ubuntu 11.10,修改系统字体需要安装 gnome-tweak-tool)参考:http://www.liveme.org/chrome-font-in-linux.html
2011-12-17 23:07:50
4773
1
转载 x86_64的ubuntu, 安装32位共享库
安装32位共享库后,大部分32位程序运行应该是没有问题了方法:sudo apt-get install ia32-libs*zz from http://hi.baidu.com/otss/blog/item/031a33da113c2ad5b7fd4880.html
2011-12-06 00:53:24
1062
原创 My fstab(ubuntu 11.10)
/dev/sda7 /mnt/F ntfs auto,user,nls=utf8,umask=0,exec 0 0/dev/sda6 /mnt/E vfat auto,user,utf8,umask=0,exec 0 0
2011-12-04 10:59:49
485
转载 [ZZ]柔性数组
处理二进制协议时,过去常用的方法是,只定义协议头,或者用char data[1]定义协议体只定义协议头不够直观,需要计算协议体地址;而data[1]需要进行类型转换,其实也是计算协议体地址现在发现有一种更“优雅”的方法:柔性数组
2010-10-30 11:32:00
991
原创 如何解决动态链接导致的程序启动失败
工作中的程序,大部分为二进制发布但由此就很容易出现,由于某些库采用动态链接,发布后由于目标环境没有此库,导致程序启动失败默认情况下,gcc在-lxxx时,如果同时存在libxxx.so和libxxx.a,会优先链接动态库libxxx.so其中一种解决方案是,移除libxxx.so,但这显然不是一个很好的办法更好的办法是,明确告诉gcc,这个库链接其静态版本 在参考了这篇文章
2010-05-21 10:18:00
1520
转载 [ZZ]sed新手使用进阶全功略!
zz from http://www.linuxsir.org/bbs/showthread.php?t=189620作者:zhy2111314 看了各个linux 论坛的帖子,感觉sed的介绍不少,但有点零乱,在这里整理一下,希望能对学习者有所帮助!注:sed使用中除了多个命令时, -e选项一般可以省略!基础:正则表达式(Regular Expression)在学习sed前,首先了
2010-04-05 21:20:00
678
转载 [ZZ]彩色man page的配置
[zz from http://linux.cuit.edu.cn/?p=257] 彩色man page的配置 下边的代码加到 ~/.bashrc# colorful man pageexport PAGER="`which less` -s"export BROWSER="$PAGER"export LESS_TERMCAP_mb=$/E[01;34m
2010-03-24 22:48:00
689
原创 GetMemory问题
很常见的一道笔试题,下边的这段代码,会输出什么?char * GetMemory(){ char msg[] = "Hello, world!"; return msg;}int main(){ char * p = GetMemory(); printf("%s/n", p); return 0;} 返回并使
2010-03-20 23:54:00
876
原创 《大话设计模式》笔记
《大话设计模式》笔记 《大话设计模式》,程杰著,清华大学出版社(还有类图,不过现在没办法上传,先这样吧) 设计模式简单工厂模式简单工厂模式(Simple Factory):工厂类包含必要的逻辑判断,根据客户端的选择条件动态实例化相关的类,对于客户端来说,去除了与具体产品的依赖 策略模式策略模式(Strategy):定义了算法家族,分别封装起来,让它们之
2010-02-17 21:06:00
631
转载 【zz】Python常用资源网址
zz from 《可爱的Python》http://www.woodpecker.org.cn/ Python标准库 http://www.woodpecker.org.cn:9081/doc/Python/_html/PythonStandardLib/简明Python教程 http://www.woodpecker.org.cn:9081/doc/abyteofpyth
2010-01-19 11:40:00
698
原创 Linux常用脚本
Linux常用脚本 在目录中搜索特定字符串或模式egrep -n -R path/to/the/files egrep -n -R -f path/to/the/files
2009-12-19 22:13:00
546
原创 [FAQ]MySQL新建用户无法登录?
使用 grant all on im.* for im@% identified by im添加用户后,始终无法登录,提示登录失败原因:由于在本机登录,因此实际上使用im@localhost登录,mysql会匹配到匿名本地用户,导致登录失败解决方法:grant all on im.* for im@localhost identified by im就OK了
2009-10-15 23:38:00
2678
原创 How to screenshot in Linux
sleep 3s; import -window root screenshot.png learn from http://www.linux-noob.com/forums/index.php?/topic/339-how-to-take-a-screenshot-in-linux/
2009-10-02 00:21:00
733
原创 pku3615 Cow Hurdles
郁闷,一直TLE,看了一下discuss,把cout、cin改成printf和scanf就好了其实这个很早就知道,但就是没想起来。T最大可达40000,cout、cin效率的损失一下就显现出来了// pku3615 Cow Hurdles#include #include using namespace std;const long MAX_N = 300;cons
2009-08-15 19:05:00
640
原创 EqualTowers
又一道DP,刚开始时完全没有思路,上网搜了一下别人的程序,其实也不是很难……总结一下,大方向是对于每一块brick,搜索3种情况,放左边、右边、不放。但如果简单暴力搜索一定超时,3^500000DP的关键就是找到“状态”,以什么来表示状态上网搜了一下别人的程序,用“两塔高度差”作为状态,下来的思路就很简单了 找到“状态”是最难的一步,如何确定“状态”,目前我还没找到好的方法
2009-06-14 22:18:00
603
原创 Underprimes
低效版(对每个A~B的数,计算出质因数的个数,在Topcoder上不pass,怀疑超时)const int MAX_N = 100000;int primes[MAX_N+1];void createPrimes(){ static bool bInited = false; if (bInited) return; bInited = true;
2009-06-14 18:34:00
623
原创 pku3616 Milking Time
//pku3616 Milking Time#include #include #include using namespace std;typedef long INT32;typedef unsigned long UINT32;typedef struct tagINTERVAL{ INT32 iStart; INT32 iEnd; INT
2009-05-05 00:16:00
584
原创 pku3617 Best Cow Line
//pku3617 Best Cow Line#include using namespace std;typedef long INT32;const INT32 MAX_N = 2000;char oldLine[MAX_N], newLine[MAX_N];INT32 iNew = 0;enum RESULT { RE_HEAD, RE_TAIL, R
2009-05-03 17:26:00
729
原创 pku3618 Exploration
//pku3618 Exploration#include #include #include using namespace std;typedef long INT32;struct AbsGreater{ bool operator() (const INT32& left, const INT32& right) const { return a
2009-05-03 12:53:00
3014
原创 pku3620 Avoid The Lakes
vector修改前后,iterator可能发生不可预知的变化,必须谨慎! //pku3620 Avoid The Lakes#include #include using namespace std;typedef long INT32;const INT32 MAX_N = 100;enum STAT { ST_DRY=0, ST_SUBMERGE,
2009-04-30 00:43:00
1335
原创 pku3652 Persistent Bits
//pku3652 Persistent Bits#include typedef long INT32;typedef unsigned long UINT32;typedef unsigned short UINT16;const UINT16 usF16 = 0xffff;int main(){ INT32 iA, iB, iC, iS; IN
2009-04-28 23:04:00
604
原创 pku3664 Election Time
// pku3664 Election Time#include #include #include #define MAX_NUM 50000//#define MAX_NUM 10typedef unsigned short UINT16;typedef long INT32;typedef unsigned long UINT32;UIN
2009-03-31 00:22:00
691
原创 pku2777 Count Color
关于线段树基本思想是通过平衡二叉树表示线段// pku2777 Count Color#include #include typedef long INT32;typedef unsigned long UINT32;#define MAX_COLOR 30INT32 alColorShift[MAX_COLOR+1];#define MAX_L 2
2009-03-01 21:32:00
1144
1
原创 pku1321 棋盘问题
//pku1321 棋盘问题#include #include #define MAX_N 8typedef unsigned char BYTE;BYTE place[MAX_N][MAX_N];BYTE nPlace[MAX_N];long N, K;unsigned long gTotal;BYTE gMark = 0;void d
2009-02-17 23:28:00
579
原创 pku1325 Machine Schedule
涉及到二分图(二部图)、最小覆盖、最大匹配、匈牙利算法(匈牙利树)、增广路 原来这就是传说中的匈牙利代码上很简单,但思想非常精妙 //pku1325 Machine Schedule#include #include #define MAX_N 100char map[MAX_N][MAX_N];char mark[MAX_N];long lin
2009-02-15 22:06:00
618
原创 pku2243 Knight Moves
贴错代码,贡献了一次WA// zju1091 Knight Moves#include #include //using namespace std;char chessboard[8][8];struct POS{ long x; long y; POS(char str[]) { x = str[0]-a; y = str[1]-1;
2009-02-13 23:57:00
629
原创 pku1915 Knight Moves
简单的BFS,但还是花了266ms,真不知道牛人们是怎么0ms的 // pku1915 Knight Moves#include #include using namespace std;typedef long INT32;//typedef unsigned char BYTE;#define MAX_N 300struct POS{ I
2009-02-13 00:55:00
809
原创 POJ的另一种登录方法http://162.105.81.212
POJ的另一种登录方法http://162.105.81.212acm.pku.edu.cn无法登录,但http://162.105.81.212可以,真奇怪
2009-02-11 22:54:00
2076
原创 pku1323 Game Prediction
标记数组初始化错了一位,导致WA了2次(其实第一次WA更sb,竟然输出时忘了Case数目)错误的:memset(marks, 0, iTotalCards); 正确的:memset(marks+1, 0, iTotalCards); 完整代码://pku1323 Game Prediction#include #include #include using
2009-02-09 00:25:00
690
原创 pku1326 - Mileage Bank
poj又恢复了!赶紧AC啊! //pku1326 - Mileage Bank#include int main(){ char szOrg[256], szDst[256]; char szInput[256]; long iMiles, iSum = 0; char cClsCode; while (1) { gets(szInpu
2009-02-07 00:21:00
663
原创 zju1360 Radar Installation
//zju1360 Radar Installation#include #include #include #include using namespace std;#define MAX_N 1000#define PREC 1e-6char mark[MAX_N];struct NODE{ double val; long id;
2009-02-02 23:33:00
472
原创 zju1358 Moving Object Recognition
最后的输出竟然要这样子四舍五入,晕倒……害我WA了2次,代码走读了n遍if (speedY > 0) offset = 0.5;else offset = -0.5;speedY = ((long)(speedY*100.0+offset)) / 100.0;printf("%.2f %.2f/n", speedX, speedY); 另外,poj这两天是不是挂
2009-01-29 22:58:00
643
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人