- 博客(191)
- 资源 (22)
- 收藏
- 关注
原创 windows mutex waitforsingleobject
example:#define THREAD_INSTANCE_NUMBER 3 LONG g_fResourceInUse = FALSE; LONG g_lCounter = 0; HANDLE hMutex; DWORD ThreadProc(void *pData) { int ThreadNumberTemp = (*(int*)pData); Wa
2014-08-04 11:08:01
333
原创 SQLAPI的入门学习
参考网址:#include "stdafx.h"#include #include #include "SQLAPI.h"using namespace std;#pragma comment(lib,"sqlapi.lib")int main() { SAConnection conn; try{ conn.Connect("test","root","root",
2014-08-03 15:41:47
1311
原创 opencv Mat几种访问方式效率的比较
Mat m(1,4,CV_32F); float arr[]={2,3,4,1}; float arr2[]={2,3,3,3}; struct timeval tpstart,tpend;gettimeofday(&tpstart,NULL);for(int j=0;j<10000;++j){ for(int i=0;i<4;++i){
2014-02-19 11:13:49
301
原创 qt学习例子
#include "mainwindow.h"#include #include#include#include#includeint main(int argc, char *argv[]){ QApplication app(argc, argv);// QPushButton *btn=new QPushButton("quit");// QObject
2014-01-15 16:39:04
299
原创 c++ boost 序列化对象存储及其访问
参照下面的例子就可以完成。#include #include #include #includeusing namespace std;using namespace cv;using namespace std;struct IvNode{ friend class boost::serialization::access; te
2013-12-13 18:34:57
338
原创 opencv ransac
Mat img11=imread("/home/daizhou/Holidays/jpg/100000.jpg"); Mat img12=imread("/home/daizhou/Holidays/jpg/100002.jpg"); Mat img1,img2; cv::resize(img11,img1,cv::Size(256,256)); cv::resize(img12,
2013-11-25 13:24:56
401
转载 unix网络编程的搭建
http://awind.blog.51cto.com/4628868/861306环境:Kubuntu 11.10IDE:Eclipse要开始接触网络编程,用的是大名鼎鼎的Unix Network Programming这本书,第一个例子就遇到困难了,unp.h没有,到谷歌上搜索了一下,找到了一些方法。先下载unpv13e.tar.gz,1.解压下载的unpv13e.tar.gz
2013-11-08 15:54:21
300
原创 xapian的搭建及第一个例子
安装xapian-corewget http://oligarchy.co.uk/xapian/1.0.13/xapian-core-1.0.13.tar.gztar zxvf xapian-core-1.0.13.tar.gzcd xapian-core-1.0.13./configure --prefix=/usr/local/xapianmakemake inst
2013-11-06 16:47:49
360
原创 在ubuntu和win7下配置samba
一:在ubuntu上进行配置。参考http://www.startos.com/ubuntu/tips/2012031333097.html 1 安装Samba文件 我们需要做的第一件事是安装Samba,你可以在Ubuntu软件中心搜索软件,然后安装。如果你想通过终端安装,可复制这个命令: sudo apt-get install samba samba-common 2
2013-10-31 12:58:36
465
原创 套接口生产传统本地地址和抽象本地地址
#include#include#include#include#include#include#include#include#include#include#includestatic void bail(char* on_what){ perror(on_what); exit(1);}int main(int argc,char*
2013-10-27 11:26:38
251
原创 套接口,父子进程的通信
#include#include#include#include#include#include#include#include#includeint main(){ int z; int s[2]; int mlen; char* msgp; char buf[80]; z=socketpair(AF_LOCAL,SOCK_STREAM
2013-10-27 10:44:42
264
原创 用套接口实现I/O
#include#include#include#includeint main(){ int z; int s[2]; char* cp ; char buf[80]; z=socketpair(AF_LOCAL,SOCK_STREAM,0,s); if(z==-1){ perror("create socket");exit(1); }
2013-10-27 10:10:55
254
原创 socketpair的使用
一:socketpair的使用:#include#include#include#include#include#include#includeint main(){ int z; int s[2]; z=socketpair(AF_LOCAL,SOCK_STREAM,0,s); if(z==-1){ perror("create");
2013-10-27 09:57:23
289
原创 烽火2014一个笔试题
class Base{ public void func1(){ System.out.println("Base::func1"); } public static void funcstatic(){ System.out.println("Base::func1_static"); } }class Derived extends Base{ public void
2013-10-26 16:21:48
515
原创 vimrc的设置
map :call SaveInputData()func! SaveInputData() exec "tabnew" exec 'normal "+gP' exec "w! /tmp/input_data"endfunc"colorscheme torte"colorscheme murphy"colo
2013-10-25 19:28:00
332
转载 网络ip地址的头部校验和的理解
原文:http://hi.baidu.com/zengzhaonong/item/6d194fd9d28de63f49e1dd7b 在发送数据时,为了计算数IP据报的校验和。应该按如下步骤:(1) 把IP数据报的校验和字段置为0。(2) 把首部看成以16位为单位的数字组成,依次进行二进制反码求和(3) 把得到的结果存入校验和字段中。在接收数据时,计算数据报的校验和相对简
2013-10-25 18:13:21
668
原创 android学习系列八 SQLite的使用
设置几个按钮: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); create=(Button)findViewById(R.id.c
2013-10-12 14:24:10
267
原创 android学习系列七 Handler的使用
xml中:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height
2013-10-11 17:33:16
260
原创 android学习系列 ListView的使用
运行截图:注意有两个xml:第一个main.xml:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layou
2013-10-11 16:11:46
303
原创 android学习系列六 RadioGroup CheckBox
Activity:package com.example.relativelayout;import android.app.Activity;import android.os.Bundle;import android.view.Menu;import android.widget.CheckBox;import android.widget.CompoundButton;
2013-10-11 11:41:29
312
原创 android学习系列五 布局
LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match
2013-10-10 17:39:01
262
原创 android学习系列四 Activity的生命周期
protected void onCreate(Bundle savedInstanceState);在第一次被创建的时候调用 protected void onStart(); 当Activity能被我们看到的时候调用 protected void onRestart();重启 protected void onResume();获得用户焦点的时候调
2013-10-10 16:31:31
258
原创 android学习系列四 Activity的生命周期
protected void onCreate(Bundle savedInstanceState);在第一次被创建的时候调用 protected void onStart(); 当Activity能被我们看到的时候调用 protected void onRestart();重启 protected void onResume();获得用户焦点的时候调
2013-10-10 15:55:10
62
原创 android学习系列三 常用控件 计算两个数的乘积
遇到的问题:在新增ResActivity后没有在AndroidManifest中进行设置,折腾了好久MainActivity.this.startActivity(intent);忘记写了,老是没有跳转。一些关键步骤如下:一设置四个控件: <EditText android:id="@+id/facOne" android
2013-10-10 15:16:17
455
原创 android学习系列二 intent传递数据 发短信
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn=(Button)findViewById(R.id.myBtn); b
2013-10-10 10:09:30
333
原创 c++读者写者问题
利用boost库:class rw_data{private: int m_x; shared_mutex rw_mu;public: rw_data():m_x(0){} void write(){ unique_lock ul(rw_mu); ++m_x; } void read(int* x){ shared_lock sl(rw_mu); *
2013-10-10 09:35:13
873
原创 c++生产者和消费者问题
利用boost库:#includeclass buffer{private: mutex mu; condition_variable_any cond_put; condition_variable_any cond_get; stack stk; int un_read,capacity; bool is_full(){ return un_read==ca
2013-10-10 09:34:23
407
原创 android的helloworld的创建
创建Activity的步骤:1 一个Activity就是一个类,需要继承Activity2 需要复写onCreate方法3 每个Activity需要在AndroidManifest.xml中进行配置4 为Activity添加控件如果在AndroidManifest.xml在某个activity中配置
2013-10-09 21:59:09
277
原创 boost中future的用法
int fab(int n){ if(0==n||1==n) return 1; return fab(n-1)+fab(n-2);}int main(){ packaged_task pt(boost::bind(fab,10)); unique_future f=pt.get_future(); thread(boost::move(pt)); f.wait
2013-10-09 17:10:27
991
原创 阿里的一道java笔试题
public class Test1 { public Test1(String str) { System.out.println((++k) + ":" + str + " i=" + i + " n=" + n); ++i; ++n; } public static int k = 0; public static Test1 t1 = new Test1("
2013-10-08 17:46:06
320
转载 myeclipse 10 破解 myeclipse 10.1 破解
破 解地址myeclipse 10 破解https://skydrive.live.com/redir.aspx?cid=a49c7ec35de5344f&resid=A49C7EC35DE5344F!327&parid=A49C7EC35DE5344F!227myeclipse 10.1 破解https://skydrive.live.com/redir.aspx?ci
2013-10-08 17:02:42
315
原创 hdu1003 max sum
题目:点击打开链接Sample Input25 6 -1 5 4 -77 0 6 -1 1 -6 7 -5 Sample OutputCase 1:14 1 4Case 2:7 1 6int main() { freopen("in.txt","r",stdin); int T; cin>>T;
2013-09-27 20:17:12
219
原创 boost学习--回调函数
#includeclass demo_class{private: typedef std::tr1::function func_t; func_t func; int n;public: demo_class(int _n):n(_n){} template void accept(CallBack f){ func=f; } void run(){ func
2013-09-26 10:21:44
240
原创 boost学习--bimap的学习
#include#include#include#include#include#include#includeusing namespace std;using namespace boost;int main(){ typedef boost::bimap bm_type; bm_type bm; bm.insert(bm_type::value_type(1,"he
2013-09-24 17:46:33
365
原创 boost学习---用筛选法找出n以内的素数
#include#include#include#includeusing namespace std;using namespace boost;int main(){ cin>>n; dynamic_bitset<> db(n); db.set(); for(dynamic_bitset::npos;i=db.find_next(i)){ for(dynamic_bi
2013-09-24 16:49:41
326
原创 boost学习--lexical_cast format
#include#include#include#includeusing namespace std;using namespace boost;templateclass Base{public: friend ostream& operator<<(ostream& os,const T& x){ os<<typeid(x).name(); return os;
2013-09-24 15:30:41
313
原创 windows下boost的配置
第一步:下载boost,我下载的方法是从http://www.boost.org/上找最新的下载。名字叫boost_1_54_0.zip。第二步:在E创建一个目录boost,拷贝进去并解压到当前文件夹。第三步:开始->程序->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio 命令提示(2010),打开一个控制台
2013-09-24 09:51:12
371
原创 2013 腾讯的一道笔试题,基类,派生类,派生类成员顺序问题
#include#include#include#include#includeusing namespace std;class test{public: test(){cout<<"test"<<endl;}};class Base{public: Base(){cout<<"base"<<endl;}};class test2:public Base{pu
2013-09-23 09:27:48
230
转载 B-树和B+树的应用:数据搜索和数据库索引
B-树1 .B-树定义B-树是一种平衡的多路查找树,它在文件系统中很有用。定义:一棵m 阶的B-树,或者为空树,或为满足下列特性的m 叉树:⑴树中每个结点至多有m 棵子树;⑵若根结点不是叶子结点,则至少有两棵子树;⑶除根结点之外的所有非终端结点至少有[m/2] 棵子树;⑷所有的非终端结点中包含以下信息数据: (n,A0,K1,A1,K2,…,Kn,An)
2013-09-21 20:11:17
249
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人