- 博客(74)
- 资源 (4)
- 收藏
- 关注
转载 curl_easy_perform 返回值说明
response=curl_easy_perform(curl);response返回的状态值CURLE_OK: printf(“send ok!\n”);CURLE_HTTP_POST_ERROR: printf(“post error!\n”);CURLE_COULDNT_CONNECT: printf(“cannot connect to server\n”);CUR
2014-03-26 13:38:01 3429
原创 curl_setpot record
无营养,只是为了记录c.getinfo(c.HTTP_CODE)c.getinfo(c.TOTAL_TIME)c.getinfo(c.SPEED_DOWNLOAD)c.getinfo(c.SIZE_DOWNLOAD)c.getinfo(c.CONTENT_TYPE)c.getinfo(c.NAMELOOUP_TIME)c.getinfo(c.REDIRECT_TIME)
2014-03-05 14:45:57 843
原创 clucene mac os 10.9编译会报错的解决办法
如果直接编译的话,第一个错误的原因是没有写第二个错误是_tcsstr会有二异性,修改方法如下:/*------------------------------------------------------------------------------* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team*
2014-03-01 12:07:14 1087
原创 mac creat lib
The source codehelloworld.c1 #include 2 void printHelloWorld(void)3 {4 printf("Hello World!\n");5 }6 helloworld.h1 void printHelloWorld(void);main.c1 #include "he
2014-01-13 21:31:16 676
原创 mac下使用hash_map头文件的方法
#if defined __GNUC__ || defined __APPLE__#include ext/hash_map>#else#include #endifint main(){ using namespace __gnu_cxx; hash_mapint, int> map;}
2014-01-01 13:01:23 1880 1
转载 #pragma once与 #ifndef的区别
#pragma once与 #ifndef的区别为了避免同一个文件被include多次1 #ifndef方式2 #pragma once方式在能够支持这两种方式的编译器上,二者并没有太大的区别,但是两者仍然还是有一些细微的区别。 方式一: #ifndef __SOMEFILE_H__ #define __SOMEFILE_H__
2014-01-01 12:40:05 542
原创 c++ int、char、double转string
#include #include #include using namespace std;int main() {stringstream ss;string str;int fuck = 123;ss ss >> str;cout return 0;}简单明了粗暴,转double等也是类似
2013-12-14 16:46:23 670
原创 python读取utf-8文件
在mac下python读取utf-8编码的txt文件,如果文件里有中文,直接输出的话会显示成乱码,也无法直接转成utf-8,所以必须想将其转成gbk,然后在转成utf-8# -*- coding: utf-8 -*-import osfilename = open(".txt")while True:s = filename.readline()if s
2013-12-13 20:18:25 4040
原创 pycurl字符编码方面的一些问题
python真的是一门很神奇的语言假设str1是utf-8的编码,str2是unicode的编码str = str1 + str2后,打印str的type,显示的是str但是在c.setopt(pycurl.URL,str)时则会报错,原因是str2并不是str,必须要进行转码.....
2013-12-12 22:09:57 1188
原创 pycurl post json data to php
利用pycurl把write到的data post给web,在网上找了很多,没有一个合适的,于是了解原理后自己手写了一个import osimport jsonimport pycurlimport StringIOss=StringIO.StringIO()s=StringIO.StringIO()url = "xxxxxxxxx" #需要抓取
2013-12-12 19:19:28 1882
转载 PycURL 网络编程
简单的PycURL例子import pycurlimport StringIO url = "http://www.google.com/"crl = pycurl.Curl()crl.setopt(pycurl.VERBOSE,1)crl.setopt(pycurl.FOLLOWLOCATION, 1)crl.setopt(pycurl.MAXREDIRS, 5)crl.
2013-12-11 20:42:00 813
原创 wxPython控件学习续
wxTextEntryDialog(wxWindow* parent, const wxString& message, const wxString& caption = "Please enter text", constwxString& defaultValue = "", long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint
2013-12-10 21:25:12 740
原创 wxPython控件学习
wx.BoxSizer:1.构造函数 boxSizer = wx.BoxSizer(integer orient) orient可以是wx.VERTICAL or wx.HORIZONTAL2.向sizer里面增加一个控件。box.Add(wx.Window window, integer proportion=0, integer flag = 0, integer border = 0)
2013-12-09 23:13:04 2620
原创 安装第三方库出现 Python version 2.7 required, which was not found in the registry
import sys from _winreg import * # tweak as necessaryversion = sys.version[:3]installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)installkey = "Inst
2013-12-05 23:41:29 735
原创 wxpython编写的简单划线工具
import wxclass SketchWindow(wx.Window): def __init__(self, parent, ID): wx.Window.__init__(self, parent, ID) self.SetBackgroundColour("White") self.color = "Black
2013-12-05 23:35:29 1623
原创 sublime python的一些使用命令
package control : shift + command + psublime codeintel : jump to definition = control + click / control + command + alt + upgo back = control + command + alt + leftmanual code intelligence = c
2013-12-03 20:57:13 641
原创 windows下配置curl
1、去CURL的官网下载最新的CURL包2、用vs打开:curl-xxxxxx\vs\vc8\vc8curl.dsw3、分别在debug和release下进行编译,注意debug和release模式下生成的lib是有区别的4、添加curl文件:拷贝curl-xxxxxx\include\curl到你的工程目录下5、拷贝libcurl.lib到工程目录下,libcurl.lib是re
2013-12-03 20:53:29 935
转载 UTF8和GB2312编码转换
#include #include //UTF-8到GB2312的转换char* UTF8ToGB(const char* utf8){int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);wchar_t* wstr = new wchar_t[len+1];mem
2013-12-03 20:37:54 780
转载 前K条最短路径算法
[注:为了简便我这里只列出算法的步骤和伪代码,详细的数学证明请参见相关论文。C++代码的算法实现可以在我的sourceforge目录https://sourceforge.net/projects/ksp 下载使用。特别要指出的是葡萄牙教授Martins对此算法有深入研究,发表了为数众多的相关论文,我这里采用的也是基于他早期提出的deletion algorithm。Martins的Fortr
2013-12-01 12:22:20 7063
转载 c++and c read test
#include #include #include #include #include #include using namespace std;template double benchmark(Func f, size_t iteration) {f();timeval a,b;gettimeofday(&a, 0);for (;
2013-11-30 12:07:06 734
原创 The shortest path-dp+tsp
#include #include using namespace std;#define inf 0x7fffffffstruct node { double x,y;};double map[220][220],dp[220][220];double cal(node a,node b){ double x=a.x-b
2013-11-28 19:52:40 685
原创 String Problem-kmp+最小表示法
#include using namespace std;char a[1000010];int nex[1000010];void nexts(){ int i=0,j=-1,k=strlen(a); nex[0]=-1; while (i if (j==-1||a[i]==a[j]) {
2013-11-28 19:51:23 598
原创 Sorting by Swapping
#include using namespace::std;int main(){int m,n,i,lab,a[10000]={0},b[10000]={0};cin >> m;while(m--){cin >> n;for(i=1;i{cin >> a[i];b[a[i]]=i;}lab=0;for(i=1;i{i
2013-11-28 19:50:40 900
原创 Smallest Difference-模拟
#include using namespace std;int main(){ int t; scanf("%d\n",&t); while (t--) { char a[20]; gets(a); int i,j,flag=15,len=0,k=strlen(a),b[20]={0},m
2013-11-28 19:49:46 772
原创 Number Transformation-bfs+素数筛选法
#include #include using namespace std;struct node { int v,cnt; node() { v=0;cnt=0; }};int n,m,pri[1005],v[1005];int bfs(int s){ memset(v, 0, size
2013-11-28 19:48:12 632
原创 Normalized Form-二叉树
#include #include using namespace std;char a[34000];bool cal(int &i,int m){ int n=m; for (++i; a[i]; i++) { if (a[i]=='(') { if (m) n&=cal(i,
2013-11-28 19:47:28 1059
原创 Missing Numbers-位运算
#include #include #include int main() { __int64 i,n,num,n1,n2,j,s1,s2,max; char ch; while(1) { scanf("%I64d",&n); if(n==0) break; s1=0;
2013-11-28 19:45:55 914
原创 MatrixPowers-矩阵连乘
#include using namespace std;#define N 105#define FF(i,n) for(i=0;iint ans[N][N];int init[N][N];int buf[N][N];void matrixMul(int a[][N],int b[][N],int n,int mod){int i,j,k;FF(i,n)FF(
2013-11-28 19:44:58 665
原创 Longge's problem-数论
#include #include #include using namespace std;__int64 cal(__int64 m){__int64 i=m,k=sqrt(m),flag=m;for(i=2;iif(m%i==0)flag=flag/i*(i-1);while(m%i==0)m/=i;}if(m!=1)fla
2013-11-28 19:44:16 576
原创 Intervals-bellman-ford+差分约束
#include using namespace std;const int inf=0x2fffffff;struct node { int s,t,w;}edge[50010];int main(){ int n; while (~scanf("%d",&n)) { int i,j,flag,x=i
2013-11-28 19:43:21 579
原创 How many-字典树+最小表示法
#include using namespace std;struct node { node *next[2]; node(){ next[0]=next[1]=NULL; }};char str[10010][110];int mins(char a[]){ int i=0,j
2013-11-28 19:42:02 623
原创 How many ways-dp
#include using namespace std;int n,m,a[101][101],dp[101][101];int main(){ int t; scanf("%d",&t); while (t--) { int i,j,i1,j1; scanf("%d%d",&n,&m);
2013-11-28 19:41:25 523
原创 Hidden Password-最小表示法
#include using namespace std;int mins(char s[],int len){ int i=0,j=1,k=0,t; while (i t=s[(i+k)%len]-s[(j+k)%len]; if (!t) k++; else {
2013-11-28 19:40:39 534
原创 Glass Beads-最小表示法
#include #include #include using namespace std;int mins(char s[]){ int i=0,j=1,t,k=0,len=strlen(s); while (i t=s[(i+k)%len]-s[(j+k)%len]; if (!t)
2013-11-28 19:39:46 659
原创 find the longest of the shortest-spfa删边
#include #include using namespace std;const int inf=0x2fffffff;#define N 1005struct node { int v,w,next; node() { v=w=next=0; }}e[N*N];int n,m,cnt,dis
2013-11-28 19:38:45 540
原创 Cleaning Robot-dfs+bfs+tsp
#include #include using namespace std;struct node { int x,y,step; node() { x=y=step=0; }};int n,m,len,ans,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1},d[30][30];ch
2013-11-28 19:37:24 804
原创 Is- dp求正则表达式
#include using namespace std;int main(){ char a[101],b[101]; int n; scanf("%s",a); scanf("%d",&n); while (n--) { scanf("%s",b); int i,j,k,l1=strl
2013-11-23 19:29:10 639
原创 Compromise-dp加标记路径
#include #include #include using namespace std;int dp[110][110],mark[110][110],loc[110],cnt;char a[110][40],b[110][40];void print(int i, int j){ if (i==0||j==0) retur
2013-11-23 13:19:03 614
原创 一个人的旅行--spfa
#include #include using namespace std;const int inf=0x3fffffff;int map[1010][1010],dis[1010],v[1010];int main(){ int n,m,k; while (~scanf("%d%d%d",&n,&m,&k)) { int
2013-11-23 13:16:17 635
原创 位图
#include #include using namespace::std;int main(){ int i,j,x,y,k,flag=1,b[182][182]={0}; char a[182][182]; scanf("%d%d",&x,&y); for(i=0;i for(j=0;j
2013-11-23 13:14:51 734
CTU Open Contest 2009
2010-10-29
2008 ACM ICPC South Central USA Regional Programming Contest
2010-10-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人