struct topic_info_t { int topic_id; float topic_pr;};float sim(const vector& query_info,const vector& adwords){ vector::iterator it1 = query_info.begi...
分类:
其他好文 时间:
2014-08-25 16:59:24
阅读次数:
149
Linux2.4下驱动中定时器的应用我的内核是2.4.18的。Linux的内核中定义了一个定时器的结构:#includestruct timer_list{ struct list_head list;unsigned long expires; //定时器到期时间unsigned long dat...
分类:
系统相关 时间:
2014-08-25 16:51:24
阅读次数:
322
题目:定义一个函数,输入一个链表的头结点,反转该链表并输出反正后链表的头结点。#include#includetypedef struct node{ int Element; struct node *Link;}Node;Node *ReverseList(Node *first){...
分类:
其他好文 时间:
2014-08-25 16:48:44
阅读次数:
143
只想说 字典树必释放内存
#include
#include
#include
using namespace std;
struct node {
node *next[53];
int num;
node (){
for(int i=0;i<=53;i++)
next[i]=NULL;
num=0;
}
}*root...
分类:
其他好文 时间:
2014-08-25 15:03:54
阅读次数:
175
7.1、7.2、7.3#include#include#include#includeusing namespace std;struct Sales_data{ string bookNo;//isbn编号 unsigned units_sold=0;//该书的销量 double...
分类:
编程语言 时间:
2014-08-25 14:45:24
阅读次数:
297
Golang的多态是个技巧性质的东西,我看许式伟的书中并未提到真正意义的多态,我自己摸索了一下,我觉得以下的书写,可能最复合工程需要。首先看例1:type IFly interface { fly()}type A struct {}func (a A) fly() { println(...
分类:
其他好文 时间:
2014-08-25 14:35:04
阅读次数:
873
头文件
/**
* 功能:句柄类,头文件只包含公共的接口和单一的指针,该指针指向一个没有
完全定义的类
* 时间:2014年8月25日07:52:42
* 作者:cutter_point
*/
#ifndef HANDLE_H_INCLUDED
#define HANDLE_H_INCLUDED
class Handle
{
struct Cheshire; //...
分类:
编程语言 时间:
2014-08-25 10:07:34
阅读次数:
240
最近线上Postgresql数据库中其中几台服务器更新时变得非常慢,经过排查和对比,发现时因为autovacuum未启动导致的。1、使用表pg_stat_all_tables查看autovacuum执行记录selectschemaname,relname,last_autovacuum,last_autoanalyzefrompg_stat_all_tables;如上图,发现所有的对..
分类:
数据库 时间:
2014-08-25 02:22:33
阅读次数:
263
/**
* TCP,使用非阻塞 connect
**/
#include "unp.h"
int
connect_nonb(int sockfd, const SA *saptr, socklen_t salen, int nsec)
{
int flags, n, error;
socklen_t len;
fd_set rset, wset;
struct timeval tval;
//1.调用 fcntl 设置套接字为非阻塞
flags = Fcntl(sockfd, ...
分类:
其他好文 时间:
2014-08-24 23:57:13
阅读次数:
464
/**
* UDP,协议无关,调用 getaddrinfo 和 udp_client
**/
#include "unp.h"
int
udp_client(const char *host, const char *serv, SA **saptr, socklen_t *lenp)
{
int sockfd, n;
struct addrinfo hints, *res, *ressave;
//1.调用 getaddrinfo
//协议地址族为 AF_UNSPEC ,套接字类型为...
分类:
其他好文 时间:
2014-08-24 23:57:03
阅读次数:
601