自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(49)
  • 资源 (27)
  • 收藏
  • 关注

原创 简易web服务器

函数介绍init_socket:初始化网络套接字。 get_line:一次读取网络缓冲区的一行数据。 pare_request_line:解析请求行。 send_line_header:发送响应行和响应头。 send_html:发送html文件。 accept_client:线程函数,用于处理一个连接。流程分析代码的执行顺序为 main->init_socket->pthread_cre

2015-05-18 21:30:04 686

原创 输出nginx执行过程中函数调用关系

添加源文件首先在src/core/目录下添加两个文件,分别是my_debug.h和my_debug.c。#ifndef MY_DEBUG_LENKY_H#define MY_DEBUG_LENKY_H#include <stdio.h>void enable_my_debug(void) __attribute__ ((no_instrument_function));void disable_

2015-05-11 22:02:27 995

原创 用GDB调试nginx

阅读源码的最好方式就是跟踪调试代码,这里介绍了如何利用GDB调试nginx的配置和步骤。修改配置文件修改nginx.conf:#user nobody;master_process off;daemon off;daemon off;表示关闭守护进程模式,这样就免除了用GDB跟踪fork出的子进程了。如果默认启用守护进程,标准输出是被关闭的。因此关闭守护进程模式能够利用printf方便查看

2015-05-10 11:21:28 753

原创 MFC音乐播放器,界面漂亮,功能齐全+源码下载

源码下载地址 http://download.csdn.net/detail/wxq714586001/7070663     实现了播放器的绝大多数功能,例如:添加歌曲,保存列表,删除歌曲,删除重复,歌曲根据不同的关键字排序,播放模式的选择,调节音量,进度,显示歌曲进度时间和剩余时间,保存上次播放配置...   程序截图

2014-03-20 12:08:53 5320 2

原创 BFS、加权图最短路径的c++实现

一、测试数据输入顶点数和边数:7 12请输入边:第1条边:1 2 2第2条边:1 4 1第3条边:2 4 3第4条边:2 5 10第5条边:3 1 4第6条边:3 6 5第7条边:4 3 2第8条边:4 5 2第9条边:4 6 8第10条边:4 7 4第11条边:5 7 6第12条边:7 6 1请输入起始结点和终止结点:1 6BFS:

2014-03-16 20:25:25 3249

原创 MFC贪吃蛇+源代码

1、源代码下载地址:2、游戏开始界面3、游戏运行界面4、游戏结束界面 5、不足之处a、代码写得比较乱,还没理解什么事模块化编程b、MFC还有待进一步学习,多看优秀源码

2014-03-02 16:20:01 5675 1

原创 MFC的GDI对象的构造与释放

一、设备上行文CDC对象封装了设备上下文的一个句柄m_hDC,如果通过GetDC();来操作设备上下文,一定要在退出函数时调用ReleaseDC();GetDC();相当于获得了一个当前设备上下文的一个副本,调用它是会重新分配内存的,ReleaseDC();相当于将新分配的内存free。如果CClientDC来操作设备上下文,那么它会在对象的析构函数中调用ReleaseDC();

2014-02-25 08:57:11 2977

原创 最大子数组的递归实现

源代码//找最大子数组 数组索引从0开始//2014-2-23#include using namespace std;int* FindMiddle(int* array, int low, int high, int middle);int* FindMax(int* array, int low, int high);extern int* gresult

2014-02-23 21:08:11 1345

原创 归并排序、二分法查找的递归实现

一、归并排序// 归并排序// 2014-2-22#include using namespace std;void Merge(int* array, int p, int q, int r);void MergeSort(int* array, int p, int q);int main(){ int array[10]; for (int

2014-02-22 14:42:55 1480

原创 rt3070 无线wifi模块移植到linux,并连接无线路由上网

Linux发行版:ubuntu 10.4无线网卡芯片:rt3070路由器加密方式;WPA-PSK/AES驱动:2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2一 安装驱动(1) 驱动安装包需要解压两次。(2)修改Makefile-CHIPSET = 5370+CHIPSET = 30

2015-12-05 15:00:36 1658 1

原创 计数排序、基数排序、桶排序

#include #include #include #include #include using namespace std;class MySort {public: MySort(vector v):m_num(v) {} virtual ~MySort() = 0{} virtual void Sort() = 0; void display() { cop

2015-07-17 10:21:56 598

原创 排序算法总结

#include #include using namespace std;class MySort {public: MySort(vector v):m_num(v) {} virtual ~MySort() = 0{} virtual void Sort() = 0; void display() { copy(m_num.begin(), m_num.end(),

2015-07-16 20:28:08 545

原创 N-QueensII : 4ms and short

class Solution {public: void helper(int row, int &res, int n, vector& solution) { if (row == n+1) { ++ res; } for (int i = 1; i <= n; ++ i) { if (canPlac

2015-07-09 15:45:09 557

原创 Restore IP Addresses : 0ms

class Solution {public: void helper(int dot, int pos, int len, vector& res, string& s, string& target) { int deltaLen = len - pos; if (dot == 3) { string tmp = s.substr(pos, de

2015-07-09 10:06:09 486

原创 Sudoku Solver : 53 lines and 12 ms

class Solution {public: bool helper(int r, int c, int mpRow[][9], int mpCol[][9], int mpGroup[][9], vector >& board) { if (r >= 9) { return true; } if (c >= 9){ c = 0; if (helper(r

2015-07-09 09:13:29 866

原创 scrapy抓取知乎话题v0.2(实现qq发送邮件功能)

源码下载地址:一共由两个scrapy工程实现。第一个工程zhihu_topic:实现抓取关注人数超过2000的知乎话题、相应链接、父子话题并存入MySQL数据库。这个工程只要执行一次,第二个工程会利用这里获取到的链接(link_id)。usage:    scrapy crawl topic下面是从数据库中获取一部分话题的截图第二个工程zhihu:先贴出

2015-07-07 21:28:43 2228

原创 Longest Substring Without Repeating Characters: 12ms

class Solution {public: int lengthOfLongestSubstring(string s) { int hash[256] = {0}; int len = s.size(); if (len <= 0) return 0; int maxLen = -1, curL

2015-07-02 17:29:46 668

原创 Binary Search Tree Iterator: O(1)时间复杂度,O(h)空间复杂度

class BSTIterator {public: BSTIterator(TreeNode *root) { while (root) { lst.push_back(root); TreeNode *tmp = root->left; root = root->left; }

2015-06-30 17:35:57 1519

原创 Sum Root to Leaf Numbers : 精简实现方式

class Solution {public: int helper(TreeNode* root, int target) { if (root && !root->left && !root->right) return target * 10 + root->val; else if (!root) return 0;

2015-06-30 16:20:15 569

原创 Symmetric Tree: 简单的实现方式

class Solution {public:    bool isSymmetric(TreeNode* rootl, TreeNode* rootr){        if (!rootl && !rootr)            return true;        else if (rootl && rootr && rootl->val == rootr->val

2015-06-30 15:06:00 648

原创 Remove Duplicates from Sorted List II simple and fast

class Solution {public: ListNode* deleteDuplicates(ListNode* head) { ListNode dummy(-1), *pre = &dummy, *iter; dummy.next = head; while (pre && pre->next) { if

2015-06-28 09:39:25 566

原创 Reverse Nodes in k-Group short and 24ms AC

class Solution {public: ListNode* reverseKGroup(ListNode* head, int k) { if (!head || k <= 0) return head; int len = 0; ListNode dummy(0), *iter = &dummy; dummy.next = he

2015-06-27 21:08:59 579

原创 Swap Nodes in Pairs 11行AC

class Solution {public: ListNode* swapPairs(ListNode* head) { ListNode new_head(0); new_head.next = head; ListNode* iter = &new_head; while (iter->next && iter->next->ne

2015-06-27 11:29:44 825

原创 scrapy抓取知乎话题v0.1

一、简介     抓取知乎某一子话题,赞同人数超过10的会被抓取。回答ID、赞同人数、回答时间、内容、提问被保存到mysql数据库中,支持更新(多次抓取时对于同一回答的ID只更新赞同人数)。usage:scrapy crwal zhihu二、效果:抓了一个通宵将编程子话题全部抓完,抓取了13M的内容,下面是保存为json的数据。但是,数据量一大用json来保存就很不方便

2015-06-23 23:12:55 1016

原创 leetcode:Container With Most Water 6行AC

class Solution {public: int maxArea(vector& height) { int start = 0, end = height.size() - 1; int imax = INT_MIN; while (end > start) { int res = (end - start)

2015-06-23 10:20:29 494

原创 leetcode:Merge Sorted Array 5行代码AC

class Solution {public: void merge(vector& nums1, int m, vector& nums2, int n) { int indexNum1 = m - 1, indexNum2 = n - 1, index = m + n - 1; while (indexNum1 >= 0 && indexNum2 >=

2015-06-22 17:03:43 490

原创 scrapy爬取豆瓣读书的图书信息

usagescrapy crawl dou一、效果二、源码下载地址http://download.csdn.net/detail/wxq714586001/8826869三、实现过程done list:    1、定义Item       2、开始爬取网页         a、定义类继承自CrawlSpider        b、定义name/a

2015-06-21 21:18:07 1379

原创 scrapy爬豆瓣电影

usage:scrapy crawl first一、抓取效果二、源码下载http://download.csdn.net/detail/wxq714586001/8821149三、总结done:1、解决了将unicode字符串(类似于‘\uxxx\n\t\t’)转换为实际的文字,困扰了很久。2、用正则表达式替换字符串。3、scrapy的基本使用方法。

2015-06-19 00:04:12 863

原创 python 知乎回答按赞排序

一、实现效果二、源码#coding:utf-8import reimport timeimport codecsimport StringIO, gzipimport osimport urllibimport urllib2from bs4 import BeautifulSoupimport chardetdef my_cmp(a, b): r

2015-06-15 22:27:31 2129

原创 python 白云黄鹤十大

一、效果能捕获按键的输入,无需按enter确认。二、源码# -*- coding:utf-8 -*-import selectimport sysimport timeimport osimport termiosimport reimport urllibimport urllib2import codecsimport chardetimpo

2015-06-11 21:27:00 1488

原创 python 爬直播吧NBA录像

一、运行结果二、源码# -*- coding:utf-8 -*-import urllibimport urllib2import reimport osimport codecsclass NBA(object): def __init__(self, team = ur'(热火vs马刺)'): self.base_url = ur'h

2015-06-09 20:25:21 1525

原创 nginx动态数组ngx_array_t

ngx_array_t是nginx中设计的动态数组,类似于STL中的vector。下面我们结合实例分析。一、实例#include #include "ngx_config.h"#include "ngx_conf_file.h"#include "nginx.h"#include "ngx_core.h"#include "ngx_string.h"#include "ngx_

2015-06-03 10:32:40 896

原创 nginx双向链表ngx_queue_t

一、介绍ngx_queue_t是nginx中实现的双向链表,在要用到双向链表的自定义结构体中将ngx_queue_t嵌入到自定义结构体中即可。还有一个特点是ngx_queue_t不涉及到内存分配。二、例子下面的源码是将《深入理解nginx》第7章关于ngx_queue_t的源码整合起来。Makefile则是参考http://blog.csdn.net/livelylittlefish/

2015-06-02 17:35:42 712

原创 配置简单的nginx反向代理

最近在阅读ngx_http_upstream_module源码,首先要让该模块运行起来,然后调试跟踪。这里介绍了配置简单的nginx反向代理。一、安装httpdyum install httpdecho “hello world!” > /var/www/html/index.htmlservice httpd start 完成了上述步骤,可以测试一下:curl htt

2015-06-01 16:27:40 616

原创 ngx_http_concat_module

一、ngx_http_concat_module模块介绍该模块是由淘宝网发布在github,用来合并多个静态文件的请求为一个请求,减少服务被访问的次数。二、配置在/path_install_nginx/html/static/js目录中添加两个js文件,a.js和b.js。在里面写入内容。       修改配置文件:location /static/js {       c

2015-05-29 22:29:24 2418

原创 lua与c语言互相调用

lua和c语言之间的互调大量出现在lua-nginx-module中,这里给出《lua程序设计》第24-27章的一些测试代码。#include #include #include #include #include #include #include #include #define MAX_COLOR 255static void stackDump(lua_State

2015-05-27 15:55:21 1699

原创 nginx调试过程:No symbol "*" in current context

原因:自动生成的Makefile开启了编译优化选项 ‘-O’。解决办法:删除Makefile中的-O选项。补充:优化选项有不同级别,-O0、-O1、-O2...。-O等价于-O1。

2015-05-26 22:11:01 731

原创 nginx模块开发:ngx_xqw_backtrace_module

模块介绍当nginx运行过程中收到异常退出信号SIGINT,会将当前函数调用堆栈输出到日志文件当中。除了处理SIGINT之外,还可以在模块中添加相应信号。模块开发流程创建配置结构体typedef struct ngx_xqw_backtrace_conf_s{ ngx_log_t *log; // 日志 ngx_int_t size; // 栈最大深度}ngx_xqw_back

2015-05-20 11:42:52 693

原创 LINK : fatal error LNK1158: 无法运行“cvtres.exe”

在win7的64位操作系统装vs2010遇到了无法运行”cvtres.exe”。解决办法:重新下载cvtres.exe。替换Microsoft Visual Studio 10.0\VC\bin\cvtres.exe。 下载链接:http://download.csdn.net/detail/wxq714586001/8713287

2015-05-18 18:55:15 16192

原创 python入门总结

python是一门面向对象的脚本语言,有丰富的web库和网络处理能力,在开发nginx模块时也会用到。这里对学习到的基础知识点做一个小总结。变量在定义的过程中不用指定类型,可以用type()函数查看变量或常量类型 i = 1 type(i) type(“hello world”) 函数的定义 def func(arg): command return val 条件执行语句和循环

2015-05-11 22:31:40 541

zhihu_topic_v0.2

1、存储关注人数超过2000的话题、相应链接、父子话题,存入mysql数据库。 2、抓取某一话题的回答,通过设置赞的阈值对结果进行筛选。 3、发送抓取结果到qq邮箱。

2015-07-07

scrap_zhihu_topicv0.1

抓取知乎某一个话题的所有回答,代码中设定赞同数超过10的回答会被抓取下来,抓取下来的回答会被保存到mysql中。

2015-06-23

doubanbook_scrapy

scrapy获取豆瓣读书上的图书信息,避免了被ban。

2015-06-21

douban_scrapy

爬取豆瓣上的top250电影,入门scrapy很简单的例子。

2015-06-18

nginx启动图

把nginx的启动流程以图表画出来,可以让我们从大局了解nginx的启动流程。

2015-06-07

ngx_xqw_backtrace_module.zip

当nginx收到异常信号SIGINT退出时,会将此时的函数调用堆栈输出到日志文件中,方便调试。

2015-05-20

Linux下c语言实现的简单服务器

c语言实现的简单http web服务器,能通过浏览器访问linux上的网页,是学习http协议,网络编程的很好的资料。

2015-05-18

cvtres.exe

解决问题 LINK : fatal error LNK1158: 无法运行“cvtres.exe”

2015-05-18

xz-5.0.8.tar.bz2

linux中*.xz格式文件解压工具,简单易用

2015-04-18

yasm-1.3.0.tar.gz

linux加速编译过程的工具,安装ffmpeg有用到。

2015-04-18

ffmpeg-2.0.1.tar.gz

linux平台,集视音频解码,服务器ffmpeg源码。

2015-04-18

inetd.tar.gz

linux中网络超级进程inetd源码。

2015-04-18

ctags-5.8.tar.gz

linux,ctags,vim标志函数插件。

2015-04-18

AStyle.rar

SourceInsight 代码格式化工具

2015-04-18

MFC音乐播放器

实现了播放器的绝大多数功能,例如:添加歌曲,保存列表,删除歌曲,删除重复,歌曲根据不同的关键字排序,播放模式的选择,调节音量,进度,显示歌曲进度时间和剩余时间,保存上次播放配置...。

2014-03-20

MFC贪吃蛇(完美运行)

实现的界面美化,保存排名,游戏音乐播放,能正常运行,资源没BUG。

2014-03-02

modelsim仿真教程

modelsim、仿真教程、很适合初学者

2013-08-30

上位机函数

上位机函数、cypress cyapi programmer's reference(上位机函数接口说明)

2013-08-30

USB技术开发文档

不仅包括usb的协议的介绍,还具体以芯片为例子,更容易上手与理解

2013-08-30

FIFO原理、FPGA

文档详细介绍了FIFO的设计原理,对同步时钟FIFO和异步时钟FIFO都讲得非常详细

2013-08-30

fpga消抖设计

fpga、按键消抖、脉冲边缘检测、文档中还讲了非阻塞赋值和阻塞赋值的理解,是初学者的福利

2013-08-30

fpga按键消抖

fpga、按键消抖、脉冲边缘检测、文档中还讲了非阻塞赋值和阻塞赋值的理解,是初学者的福利

2013-08-30

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除