- 博客(380)
- 资源 (2)
- 收藏
- 关注
原创 源文件注释格式定制
@Aleda 2014-09-02 14:21 字数 4277 阅读 0源文件定制Linux-C/C++我也有技术恐惧症,所以自己认识一项艺术性的技术,就要去学会它。这固然是优点,但伴随的缺点是从不能很好的坚持。希望现在在真正的工作了,可以养成学习一个东西就要坚持的好习惯,这个markdown上手可能还是有点麻烦的,不过我举得只要上手了就
2014-09-02 14:19:56 1168
原创 解题报告
#!/bin/bash 2 3 #function: crawl the webpage, and get urls 4 #data: 2015/5/19 5 #author: Aleda 6 7 #$1 is the website 8 9 function curlLinks() 10 { 11 for ((i=0; i<63; i++
2014-05-20 20:04:18 1219
原创 Bitmap操作
#include #include #include using namespace std;const int BYTESIZE = 8;void SetBit(char* p, int position){ for (int i = 0; i < position / BYTESIZE; i++) { p++; } *p = *
2014-04-26 22:13:28 922
原创 线索二叉树
#include #include #include using namespace std;struct BinThrNode{ int data;//结点的数据 BinThrNode* lChild;//左孩子 BinThrNode* rChild;//右孩子 bool lTag; //有左孩子是1 bool rTag; //有右孩子是1
2014-04-26 16:58:11 854
原创 并查集
#include using namespace std;void Init(){ for (int i = 0; i <= N; i++) { set[i] = i; }}int Find(int x){ return set[x] = (set[x] == x ? x : Find(set[x]));}int main()
2014-04-24 23:07:16 803
原创 非递归遍历便利二叉树
#include using namespace std;struct TreeNode{ TreeNode* lChild; TreeNode* rChild; int m_iData; TreeNode() { lChild = NULL; rChild = NULL; m_iData = 0;
2014-04-24 22:49:27 858
原创 哈希探查的三种方法
#include #include #include #include using namespace std;const int MAXSIZE = 100;int hash[MAXSIZE];int MOD = MAXSIZE - 1; //小于MAXSIZE的一个质数vector hashTable[MAXSIZE];/* 线性探查int LinearProbi
2014-04-24 21:41:51 1419
原创 快速幂
#include #include using namespace std;long long QuickPow(int a, int n, int mod){ int ans = 1; while (n) { if (n & 1) { ans = (long long)ans * a % mod;
2014-04-24 21:02:33 667
原创 函数传参
#include #include #include #include using namespace std;int Max(int a, int b){ return a > b ? a : b;}int GetMax(int a[][6], int N, int M){ int iMax = 0; for (int i = 0; i < N;
2014-04-22 20:48:41 905
原创 双栈模拟队列
#include #include using namespace std;templateclass CQueue{public: T& push(T&); T& front(); void pop();private: stack m_stack1; stack m_stack2;};templateT& CQueue:: pu
2014-04-19 20:13:25 945
原创 根据前序,中序求后续
#include #include #include #include #include using namespace std;void postOrder(char *pre, char *in, int len) { if (len <= 0) { return ; } int i; for (i = 0; i < len; i++) { if (in
2014-04-19 18:30:35 1395 1
原创 根据前序,中序构建出BinaryTree
#include #include #include using namespace std;struct TreeNode{ int m_iValue; TreeNode* m_pLeft; TreeNode* m_pRight; TreeNode() { m_pLeft = NULL; m_pRight =
2014-04-19 18:27:28 940
原创 洋气的SPFA
#include #include #include #include using namespace std;const int MAXN = 100 + 11;const int INF = 0x3FFFFFFF;class Edge{public: Edge(); ~Edge(); int getBegin(); void setBeg
2014-04-16 22:50:42 786
原创 虚函数的实现机制
#include using namespace std;class CBase1 { private: int a; int b; void sayBye() { cout << "Bye, CBase1!" << endl; } public: CBase1() { cout << "Hello CBase1!" << endl;
2014-04-16 20:19:43 825
原创 C++一些宏定义
#include #define PI 3.1415926 //#define #define MIN(X, Y) (X) () #define Conn(X, Y) X##Y //简单的把x和y连接起来,但不处理。即Conn(a, 2)--->a2, 编译的时候,如果没有a2就会报错。//#define TOCHAR(X) #@X 不可以这样使用#define TOSTRING(X
2014-04-16 13:13:52 842
原创 CreateThread()和_biginthreadex()
HANDLE WINAPI CreateThread( _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ SIZE_T dwStackSize, _In_ LPTHREAD_START_ROUTINE lpStartAddress, _In_opt_ LPVOID lpParameter,
2014-04-15 20:04:43 1115
原创 堆排序
#include #include #include #include using namespace std;void print(int *a, int n){ for (int i = 1; i <= n; i++) { printf("%d ", a[i]); } cout << endl;}void heapify(int *a, int x, int
2014-04-14 11:39:13 803
原创 合并排序
#include #include #include #include const int INF = 0x7fffffff;using namespace std;void merge(int *a, int l, int mid, int r) { int L[100]; int R[100]; int cnt = 0; for (int i = l; i <=
2014-04-14 11:27:53 743
原创 快排(随机取数)
#include #include #include #include #include #include using namespace std;int partition(int *A, int L, int R, int p){ swap(A[p], A[R]); int i = L; int j = R; int pivot = A[R]; while (i
2014-04-14 11:15:10 830
原创 内存池的简单实现
#include using namespace std;templateclass SimpleMemPool{public: T* New() { if (!m_pFreeChunks) //如果空内存不存在,则重新申请一个大的block; { MemChunk* t = new MemChunk();
2014-04-14 10:55:56 858
原创 union的用法
#include #include using namespace std;union myUnion{ int m_iVar; char m_cVar[2];};int main(){ myUnion u; u.m_iVar = 0; cout << u.m_iVar << endl; u.m_cVar[0] = 11; //0
2014-04-13 22:58:36 728
原创 priority_queue的正确使用方法
其实priority_queue的正确用法:#include #include #include using namespace std;class Node{public: Node(){Node(0);} Node(int v): m_iVar(v){}; ~Node(){} bool operator < (Node& t); in
2014-04-13 22:28:07 1316
原创 swap的方法书写
#include using namespace std;int swap1(int& x, int& y){ x += y; y = x - y; x = x - y;}int swap2(int& x, int& y){ x ^= y; y ^= x; x ^= y;}int main(){ int x = 1,
2014-04-13 19:46:04 789
原创 自增、自减运算符的重载
#include using namespace std;class Increment{public: Increment(): m_iVar(0){}; ~Increment(); Increment& operator ++(); const Increment operator ++(int); int getVar();private
2014-04-13 19:31:42 1006
原创 自增、自减运算符的运算
#include using namespace std;int main(){ int a = 1; a = a+++a; // a = 3 int b = 1; b = b+++(++b);// b = 4; int c = 1; ++c = c+++c++;// c = 5; 第一部执行的是等号左边的++c return 0;
2014-04-13 19:09:49 1343
原创 operator new 和operator delete的重载应用
#include using namespace std;/* 重载后的operator new实现的功能是,看一看刚刚回收的垃圾堆上还有没有位置, 有位置的话,就直接拿一块下来,用来初始化。*/class FreeListBase{public: FreeListBase(): next(NULL){}; virtual ~FreeListBas
2014-04-13 18:31:29 850 1
原创 Singleton
#include using namespace std;/* 考虑多线程的Singleto实现方式,用局部静态变量也可以实现单例模型。单例模型就是解决创建对象时,只用维护一个对象的情况。*/ class Singleton{public: static Singleton* getInstance(); //静态函数 private: Singleton(); vir
2014-04-12 13:46:50 653
转载 JAVA类继承过程中其成员的一些问题
JAVA类继承过程中其成员的一些问题构造函数不能继承。子类的构造函数可以通过super关键字显式调用父类中的构造函数。如果子类中的构造函数没有显式调用父类中的构造函数,编译器就会自动在子类的构造函数中调用父类中参数为空的构造函数。于是,当父类中没有参数为空的构造函数,而子类中又没有显示调用父类的其他构造函数,编译时就会报错。这一点需要特别注意。当父类中没有定义任
2014-03-03 22:33:39 858
原创 test
public void random() { int temp; boolean flag = true; a[0] = (int)(Math.random() * 320); for (int i = 1; i < 320; i++) {; if (flag) { temp = (int)(Math.random() * a[i - 1]); a[i] =
2014-01-02 15:15:02 709
原创 关于Ubuntu下安装MyEclipse
三还是没有想到在Ubuntu下也可以装MyEclipse,我想用这应该还可以把。我也用了这么长时间的Ubuntu了,感觉也是一般,因为速度上其实还不如windows来的快,不管是有些热启动呀,还是冷启动,感觉效果都不是很好,最快也就和windows一样把,当然我期望自己能在linux下体验出超频的效果,果然不可以呀,呵呵,硬件还是硬伤啊。这里讲讲MyEclipse的安装把,其实也不是很难,你百度应
2013-12-15 22:16:44 2535 1
原创 struts2类型转换
啊啊三三这几天的时间都在看书,看英语,做自己的wordpress的网站搭建,Domain买好了,但是找免费的空间真的很难找,而且适合自己的太难找了。外国的免费空间真的不少,但是国内的访问速度真是不敢恭维呀,但是如果是买国内的付费空间也不是嫌贵,就是自己觉得,自己还是等等国外的空间域名绑定成功再看看吧,真的很不爽,时间用了这么长时间了,还是没有绑定好,心里没底啊! 英语六级考完了,怎
2013-12-14 20:38:00 895
原创 struts2中多种提交的处理
啊啊啊今天看了个老兵打新兵的视频,我瞬间就愤怒了。怎么能这样,这哪是打新兵?这分明是要死新兵!没有哪个人是真的怕,仅仅是愤怒而已。所以,人啊,不能不发生在自己身上就不当回事,这是劣根性,所以,记住一定要当一个勇敢的人,怕什么!顶天立地才是男子汉。如果作为一个男人尊严都没有了的话,或者又有什么意思! 接着不说了别的了,说说struts处理多种提交请求的处理吧,我不知道以前做的对不对,
2013-12-09 20:31:34 942
原创 Struts2的exception配置
啊啊啊啊今天顺便把exception的配置也看了看,还有interceptor的,一会再写,exception的配置也是非常的简单的,如果是你自己写exception的话,就抛出自己的exception就行了,配置的时候首先配置好映射关系,然后把你的result的名字写好,然后根据你的result的名字,下面的result配置就可以为你的exception来一个跳转界面,很方便也很简单。这里面我就
2013-12-09 17:11:36 814
原创 struts2的struts.xml简单介绍
啊 昨天其实就发现了的,struts的MVC结构非常的正规,感觉这样处理起来确实是将各个问题都分开解决了,谁也不会影响谁的,后台的处理后台,前台的处理前台。关于这里的链接这些东西的就是struts.xml了,这个东西是非常重要的,你要配置好这个xml文件才能将整个MVC架构起来! 下面说一下,几个比较重要的知识点:第一、就是默认的action,就是如果没有找到对应的actio
2013-12-07 11:13:26 784
转载 struts的工作机制及分析
概述本章讲述Struts2的工作原理。读者如果曾经学习过Struts1.x或者有过Struts1.x的开发经验,那么千万不要想当然地以为这一章可以跳过。实际上Struts1.x与Struts2并无我们想象的血缘关系。虽然Struts2的开发小组极力保留Struts1.x的习惯,但因为Struts2的核心设计完全改变,从思想到设计到工作流程,都有了很大的不同。Struts2是
2013-12-06 10:22:19 876
原创 Myeclipse快速配置struts2.1
三其实在Myeclipse中是默认安装了struts2.1的,因此你直接那来用就可以了,除了上面我写的文章那样可以自己配置struts2.1以外,你也可以直接就创建一个web project然后点击菜单栏上的Myeclipse选项然后选择struts2.1就可以了。
2013-12-06 10:06:16 953
原创 struts2的第一个程序
还是比较高兴的呀,呼呼。我觉得我就应该是这种学习的方式,前面的学习方式都不怎么样,一知半解,然后就照着书去敲代码,那样代码,思想终究不是自己,错了自己也是无法改正的。而如果是自己真的曾经想过,并且快乐的实现了,并且其中出了些许错误,在自己的一步步排除查找下,找到错误并改正,这样才能真正的了解其中的精髓。 这第一个struts2架构的
2013-12-05 22:04:10 834
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人