存档在 ‘开源项目’ 分类

WECHAT-PHP-SDK

2016年10月7日
  • 此 SDK 运行最底要求 PHP 版本 5.3.3 , 建议在 PHP7 运行以获取最佳性能。
  • 微信的部分接口需要缓存数据在本地,因此对目录需要有写权限。
  • SDK 已经过数个线上项目验证,可靠性极高,欢迎阅读 SDK 相关源码。
  • 我们鼓励大家使用 composer 来管理您的第三方库,方便后期更新操作(尤其是接口类)。
  • 近期发现 access_token 经常无故失效,此 SDK 加入失败状态检测,重新生成 access_token 并试图再次返回结果.

SDK开发文档

官方接口文档链接

SDK 封装对接及功能

  • 接入验证 (初级权限)
  • 自动回复(文本、图片、语音、视频、音乐、图文) (初级权限)
  • 菜单操作(查询、创建、删除) (菜单权限)
  • 客服消息(文本、图片、语音、视频、音乐、图文) (认证权限)
  • 二维码(创建临时、永久二维码,获取二维码URL) (服务号、认证权限)
  • 长链接转短链接接口 (服务号、认证权限)
  • 标签操作(查询、创建、修改、移动用户到标签) (认证权限)
  • 网页授权(基本授权,用户信息授权) (服务号、认证权限)
  • 用户信息(查询用户基本信息、获取关注者列表) (认证权限)
  • 多客服功能(客服管理、获取客服记录、客服会话管理) (认证权限)
  • 媒体文件(上传、获取) (认证权限)
  • 高级群发 (认证权限)
  • 模板消息(设置所属行业、添加模板、发送模板消息) (服务号、认证权限)
  • 卡券管理(创建、修改、删除、发放、门店管理等) (认证权限)
  • 语义理解 (服务号、认证权限)
  • 获取微信服务器IP列表 (初级权限)
  • 微信JSAPI授权(获取ticket、获取签名) (初级权限)
  • 数据统计(用户、图文、消息、接口分析数据) (认证权限)
  • 微信支付(网页支付、扫码支付、交易退款、给粉丝打款)(认证服务号并开通支付)

接口权限备注:

  • 初级权限:基本权限,任何正常的公众号都有此权限
  • 菜单权限:正常的服务号、认证后的订阅号拥有此权限
  • 认证权限:分为订阅号、服务号认证,如前缀服务号则仅认证的服务号有此权限
  • 支付权限:仅认证后的服务号可以申请此权限

账号creater/XXXXXX

另外一个项目:https://github.com/dodgepudding/wechat-php-sdk

A System for Detecting Software Plagiarism[代码查重]

2016年3月25日

Link:http://theory.stanford.edu/~aiken/moss/

UPDATES

  • May 18, 2014 Community contributions (incuding a Windows submission GUI from Shane May, thanks!) are now in their own section on this page.
  • May 14, 2014 And here is a Java version of the submission script. Thanks to Bjoern Zielke!
  • May 2, 2014 Here is a PHP version of the submission script. Many thanks to Phillip Rehs!
  • June 9, 2011 There were two outages over the last couple of days that lasted no more than a hour each (I think). I’ve made some changes to the disk management software that should prevent these problems from recurring.
  • April 29, 2011 There was an outage lasting a few hours today, the first since last summer, but everything is back up.
  • August 1, 2010 Everything is back to normal.
  • July 27, 2010 The Moss server is back on line. There may be some more tuning and possibly downtime in the coming weeks, but any outages should be brief. New registrations are not yet working, but people with existing accounts can submit jobs.
  • July 25, 2010 As many (many!) people have noticed, the Moss server has been down for all of July. Unfortunately the hardware failed while I was away on a trip. I am hopeful it will be back up within a few days.

使用libcurl获取cookies与HTTP消息头

2014年5月7日

最近有种想翻译libcurl官方的英文文档的冲动,也想深入的学学这个库,我知道如果去阅读这种有很多选项的库的源代码是一件很痛苦的事,所以我也不打算去读他的源代码。近期计划就是翻译官方提供的文档和写一个蜘蛛。

 

curl是个很好的工具(这里有以前的一个链接),libcurl则提供了一个丰富的编程库可供我们使用(这里有以前一个链接),官方提供了详尽的示例与文档(这里是官方链接)。

 

既然是学习,就得有所记录,在贴源代码之前,我先贴下我的一个小工具,这个工具用来执行一些控制台命令或者Win32控制台程序,提供便利的结果复制,但是前提是程序中输出都是标准输出STDOUT。因为系统自带的命令提示符黑窗口,在复制这块确实恶心,而且输出太多的话不能向上滚动。

QQ图片20140507194257

至于libcurl的使用,手册我还在翻译与修改之中,后面完成后会贴出来,先示意下如何看消息头与cookies。

#include "stdafx.h"
#include <curl/curl.h>
#include <iostream>
using namespace std;
#pragma comment(lib, "curllib.lib")

size_t process_data(void *buffer, size_t size, size_t nmemb, void *user_p)
{
	FILE *fp = (FILE *)user_p;
	size_t return_size = fwrite(buffer, size, nmemb, fp);
	return return_size;
}

int main(int argc, _TCHAR* argv[])
{
	CURLcode return_code;
	return_code = curl_global_init(CURL_GLOBAL_WIN32);
	if (CURLE_OK != return_code)
	{
		cerr << "初始化libcurl失败" << endl;
		return 1;
	}

	CURL *easy_handle = curl_easy_init();
	if (NULL == easy_handle)
	{
		cerr << "获取CURL handler失败" << endl;
		curl_global_cleanup(); 
		return 1;
	}

	FILE *fp = fopen("data.html", "ab+");
	char *url = "http://www.baidu.com";	

	curl_easy_setopt(easy_handle, CURLOPT_URL, url);
	curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, &process_data);
	curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, fp);

	curl_easy_setopt(easy_handle, CURLOPT_VERBOSE, 1L);
	curl_easy_setopt(easy_handle, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */

	curl_easy_perform(easy_handle);
	cout<<"Starting ..."<<endl;
	struct curl_slist *cookies = NULL;  
    return_code = curl_easy_getinfo(easy_handle, CURLINFO_COOKIELIST, &cookies); 
	if(return_code != CURLE_OK)
	{
		curl_global_cleanup();
		fclose(fp);
		return 1;
	}
	struct curl_slist *nc = cookies;
	int i = 1;  
    while (nc) {  
		cout<<"["<<i<<"]:"<<nc->data<<endl;
        nc = nc->next;  
        i++;  
    }  
    if (i == 1) {  
		cout<<"none"<<endl;
    }  
    curl_slist_free_all(cookies);  
	fclose(fp);
	cout<<"End ..."<<endl;
	system("pause");
	return 0;

}

以下首先是提示信息,另外提供一个http协议的讲义

  HTTP协议详解.pdf (unknown, 516 hits)

* About to connect() to www.baidu.com port 80 (#0)
*   Trying 119.75.217.56... * connected
* Connected to www.baidu.com (119.75.217.56) port 80 (#0)

其次是向百度服务器的get请求

> GET / HTTP/1.1
Host: www.baidu.com
Accept: */*

接着是百度服务器返回的头部,返回码为200。

< HTTP/1.1 200 OK
< Date: Wed, 07 May 2014 11:45:29 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: Keep-Alive
< Vary: Accept-Encoding
* Added cookie BAIDUID="03009B14A2FACCA77E057B525306E577:FG=1" for domain baidu.
com, path /, expire -748020531
< Set-Cookie: BAIDUID=03009B14A2FACCA77E057B525306E577:FG=1; expires=Thu, 31-Dec
-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
* Added cookie BDSVRTM="0" for domain www.baidu.com, path /, expire 0
< Set-Cookie: BDSVRTM=0; path=/
* Added cookie H_PS_PSSID="4392_1445_5223_4760_6017_6382_6400" for domain baidu.
com, path /, expire 0
< Set-Cookie: H_PS_PSSID=4392_1445_5223_4760_6017_6382_6400; path=/; domain=.bai
du.com
< P3P: CP=" OTI DSP COR IVA OUR IND COM "
< Cache-Control: private
< Expires: Wed, 07 May 2014 11:45:21 GMT
< X-Powered-By: HPHP
< Server: BWS/1.1
< BDPAGETYPE: 1
< BDQID: 0xf02f6c2900035fb1
< BDUSERID: 0
<
* Connection #0 to host www.baidu.com left intact

最后是输出cookies

Starting ...
[1]:.baidu.com  TRUE    /       FALSE   -748020531      BAIDUID 03009B14A2FACCA7
7E057B525306E577:FG=1
[2]:www.baidu.com       FALSE   /       FALSE   0       BDSVRTM 0
[3]:.baidu.com  TRUE    /       FALSE   0       H_PS_PSSID      4392_1445_5223_4
760_6017_6382_6400
End ...
请按任意键继续. . .

How to compile C program using the OSSP mm library and gcc?

2013年8月28日

Has anyone here have any experience using OSSP mm library?

The documentation is very limited for someone like me who is new to linux and c programming.

The installation procedure is as follows:
$ ./configure –prefix=/path/to/mm
$ make
$ make test
$ make install

but I changed /path/to/mm to /usr/local/
I did the other things accordingly and executed the test code successfully.

The OSSP mm library comes with mm-config which is (taken from the mm-config man page):
“The mm-config program is a little helper utility for easy configuring and building applications based on the mm(3) library. It can be used to query the C compiler and linker flags which are required to correctly compile and link the application against the mm(3) library.”

It also contains a sample on how to use the mm-config:
CC=cc
CFLAGS=-O `mm-config –cflags`
LDFLAGS=`mm-config –ldflags`
LIBS=-lm `mm-config –libs`
all: foo
foo: foo.o
$(CC) $(LDFLAGS) -o foo foo.o $(LIBS)
foo.o: foo.c
$(CC) $(CFLAGS) -c foo.c

I tried to follow this sample, however I cannot seem to successfully execute my code and it produces the following error:

[aky@snoopy test]$ error while loading shared libraries: libmm.so.14: cannot open shared object file: No such file or directory

Kindly tell me what I am doing wrong.

Also, if anyone could tutor me on how to use OSSP mm or provide me with sample codes or direct me to OSSP mm support groups, it would be greatly appreciated.

Thanks in advance

开源免费的C/C++网络库(c/c++ sockets library)

2013年6月26日

(1)ACE
庞大、复杂,适合大型项目。开源、免费,不依赖第三方库,支持跨平台。
http://www.cs.wustl.edu/~schmidt/ACE.html

(2)Asio
Asio基于Boost开发的异步IO库,封装了Socket,简化基于socket程序的开发。
开源、免费,支持跨平台。
http://think-async.com/

(3)POCO
POCO C++ Libraries 提供一套 C++ 的类库用以开发基于网络的可移植的应用程序,功能涉及线程、线程同步、文件系统访问、流操作、共享库和类加载、套接字以及网络协议包括:HTTP、 FTP、SMTP 等;其本身还包含一个 HTTP 服务器,提供 XML 的解析和 SQL 数据库的访问接口。POCO库的模块化、高效的设计及实现使得POCO特别适合嵌入式开发。在嵌入式开发领域,由于C++既适合底层(设备I/O、中断处理等)和高层面向对象开发,越来越流行。
http://pocoproject.org/

(4)libevent
Libevent是一个轻量级的开源高性能网络库,从它的官网标题:libevent-an event notification library就能知道它的机制是采用事件触发,封装了以下三种事件的响应:IO事件,定时器事件,信号事件。select模型来实现跨平台的操作,Windows环境下支持IOCP。Google的开源WEB浏览器Chromium在Mac和Linux版本中,也使用了Libevent,足见该库的质量。
http://libevent.org/

(5)libev
libev和libevent很像,按照作者的介绍,可以作为libevent的替代者,能够提供更高的性能。
libev是一个高性能事件循环,所实现的功能就是一个强大的reactor。
http://software.schmorp.de/pkg/libev.html

(6)c++ sockets library
封装了sockets C API的C++类库。
支持SSL, IPv6, tcp 和 udp sockets, sctp sockets, http协议, 高度可定制的错误处理。
http://www.alhem.net/Sockets/

(7)libcurl
libcurl是免费的轻量级的客户端网络库,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet, TFTP. 支持SSL, HTTP POST, HTTP PUT, FTP上传, HTTP form上传,代理,cookies, 用户名与密码认证。
如果你开发的是客户端,libcurl是一个不错的选择。
http://curl.haxx.se/libcurl/

看了之后觉得每个库都不错,这里我具体下载这些库看一下,简单总结一下;
顺便添加一些我找到的网络库;

(1)ACE
庞大、复杂,适合大型项目。开源、免费,不依赖第三方库,支持跨平台。
http://www.cs.wustl.edu/~schmidt/ACE.html
注:除非特别需要,否则不建议;
(2)Asio
Asio基于Boost开发的异步IO库,封装了Socket,简化基于socket程序的开发。
开源、免费,支持跨平台。
http://think-async.com/
注:要配置Boost库,还要熟悉Boost,还是麻烦;

(3)POCO
POCO C++ Libraries 提供一套 C++ 的类库用以开发基于网络的可移植的应用程序,功能涉及线程、线程同步、文件系统访问、流操作、共享库和类加载、套接字以及网络协议包括:HTTP、 FTP、SMTP 等;其本身还包含一个 HTTP 服务器,提供 XML 的解析和 SQL 数据库的访问接口。POCO库的模块化、高效的设计及实现使得POCO特别适合嵌入式开发。在嵌入式开发领域,由于C++既适合底层(设备I/O、中断处理等)和高层面向对象开发,越来越流行。
http://pocoproject.org/
注:没用过,看上面提示为 适合 嵌入式 开发;

(4)libevent
Libevent是一个轻量级的开源高性能网络库,从它的官网标题:libevent-an event notification library就能知道它的机制是采用事件触发,封装了以下三种事件的响应:IO事件,定时器事件,信号事件。select模型来实现跨平台的操作,Windows环境下支持IOCP。Google的开源WEB浏览器Chromium在Mac和Linux版本中,也使用了Libevent,足见该库的质量。
http://libevent.org/
注:看了倒是不错,还是有点麻烦;

(5)libev
libev和libevent很像,按照作者的介绍,可以作为libevent的替代者,能够提供更高的性能。
libev是一个高性能事件循环,所实现的功能就是一个强大的reactor。
http://software.schmorp.de/pkg/libev.html
注:没看;

(6)c++ sockets library
封装了sockets C API的C++类库。
支持SSL, IPv6, tcp 和 udp sockets, sctp sockets, http协议, 高度可定制的错误处理。
http://www.alhem.net/Sockets/
注:看着功能不错,编译,应用还是有点麻烦;

(7)libcurl
libcurl是免费的轻量级的客户端网络库,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet, TFTP. 支持SSL, HTTP POST, HTTP PUT, FTP上传, HTTP form上传,代理,cookies, 用户名与密码认证。
如果你开发的是客户端,libcurl是一个不错的选择。
http://curl.haxx.se/libcurl/
注:没看,放到这里,以后编写网络客户端的时候看看;

(8):C++ Socket Class for Windows ,http://www.adp-gmbh.ch/win/misc/sockets.html;
注:这个文章的文件不可以下载自己复制 保存 h 和 cpp文件;
我用了一下,觉得很不错,也很简单,例子很明了; 不过有一个小小的缺点,只收发字符串,而且接收函数中的判断也有点不好;
如果要用这个库传输文件等数据,需要 自己重载 收发函数,不过也很简单;

(9):SimpleSockets,http://sockets.carrierlabs.com/index.html跨平台,支持 TCP ,UDP;

linux下HTTP/FTP客户端开发库

2013年6月13日

网页抓取和ftp访问是目前很常见的一个应用需要,无论是搜索引擎的爬虫,分析程序,资源获取程序,WebService等等都是需要的,自己开发抓取库当然是最好了,不过开发需要时间和周期,使用现有的Open source程序是个更好的选择,一来别人已经写的很好了,二来自己使用起来非常快速,三来还能够学习一下别人程序的优点。

【libwww】
官方网站:http://www.w3.org/Library/
更多信息:http://www.w3.org/Library/User/
运行平台:Unix/Linux,Windows

Libwww 是一个用C语言写成的高度模组化用户端的网页存取API 。

【libcurl】
官方网站:http://curl.haxx.se/libcurl
更多特点:http://curl.haxx.se/docs/features.html
运行平台:Unix/Linux,Windows

libcurl为一个免费开源的,客户端url传输库,支持FTP,FTPS,TFTP,HTTP,HTTPS,GOPHER,TELNET,DICT,FILE和LDAP,跨平台(支持 Windows,Unix,Linux等),线程安全,支持Ipv6,并且易于使用。

【libfetch】
官方网站:http://libfetch.darwinports.com/
更多信息:http://www.freebsd.org/cgi/man.cgi?query=fetch&sektion=3
运行平台:BSD

【HTTP/FTP客户端库】
资料来源:http://curl.haxx.se/libcurl/competitors.html
Free Software and Open Source projects have a long tradition of forks and duplicate efforts. We enjoy “doing it ourselves”, no matter if someone else has done something very similar already. Free/open libraries that cover parts of libcurl’s features:
libcurl (MIT)
a highly portable and easy-to-use client-side URL transfer library, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TELNET, DICT, FILE, TFTP and LDAP. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, http proxy tunnelling and more!
libghttp (LGPL)
Having a glance at libghttp (a gnome http library), it looks as if it works rather similar to libcurl (for http). There’s no web page for this and the person who’s email is mentioned in the README of the latest release I found claims he has passed the leadership of the project to “eazel”. Popular choice among GNOME projects.
libwww (W3C license) comparison with libcurl
More complex, and and harder to use than libcurl is. Includes everything from multi-threading to HTML parsing. The most notable transfer-related feature that libcurl does not offer but libwww does, is caching.
libferit (GPL)
C++ library “for transferring files via http, ftp, gopher, proxy server”. Based on ‘snarf’ 2.0.9-code (formerly known as libsnarf). Quote from freshmeat: “As the author of snarf, I have to say this frightens me. Snarf’s networking system is far from robust and complete. It’s probably full of bugs, and although it works for maybe 85% of all current situations, I wouldn’t base a library on it.”
neon (LGPL)
An HTTP and WebDAV client library, with a C interface. I’ve mainly heard and seen people use this with WebDAV as their main interest.
(LGPL) comparison with libcurl
Part of glib (GNOME). Supports: HTTP 1.1, Persistent connections, Asynchronous DNS and transfers, Connection cache, Redirects, Basic, Digest, NTLM authentication, SSL with OpenSSL or Mozilla NSS, Proxy support including SSL, SOCKS support, POST data. Probably not very portable. Lacks: cookie support, NTLM for proxies, GSS, gzip encoding, trailers in chunked responses and more.
mozilla netlib (MPL)
Handles URLs, protocols, transports for the Mozilla browser.
mozilla libxpnet (MPL)
Minimal download library targeted to be much smaller than the above mentioned netlib. HTTP and FTP support.
wget (GPL)
While not a library at all, I’ve been told that people sometimes extract the network code from it and base their own hacks from there.
libfetch (BSD)
Does HTTP and FTP transfers (both ways), supports file: URLs, and an API for URL parsing. The utility fetch that is built on libfetch is an integral part of the FreeBSD operating system.
HTTP Fetcher (LGPL)
” a small, robust, flexible library for downloading files via HTTP using the GET method. ”
http-tiny (Artistic License)
” a very small C library to make http queries (GET, HEAD, PUT, DELETE, etc.) easily portable and embeddable ”
XMLHTTP Object also known as IXMLHTTPRequest (part of MSXML 3.0)
(Windows) Provides client-side protocol support for communication with HTTP servers. A client computer can use the XMLHTTP object to send an arbitrary HTTP request, receive the response, and have the Microsoft? XML Document Object Model (DOM) parse that response.
QHttp (GPL)
QHttp is a class in the Qt library from Troll Tech. Seems to be restricted to plain HTTP. Supports GET, POST and proxy. Asynchronous.
ftplib (GPL)
” a set of routines that implement the FTP protocol. They allow applications to create and access remote files through function calls instead of needing to fork and exec an interactive ftp client program.”
ftplibpp (GPL)
A C++ library for “easy FTP client functionality. It features resuming of up- and downloads, FXP support, SSL/TLS encryption, and logging functionality.”
GNU Common C++ library
Has a URLStream class. This C++ class allow you to download a file using HTTP. See demo/urlfetch.cpp in commoncpp2-1.3.19.tar.gz
HTTPClient (LGPL)
Java HTTP client library.
Jakarta Commons HttpClient (Apache License)
A Java HTTP client library written by the Jakarta project.

开源项目记录

2013年6月6日

转载时,请加上http://unix8.net
1.libcurl–是一个免费并且易用的客户端URL传输库,如果你开发的是客户端,libcurl是一个不错的选择。
2.libevent-一个轻量级的开源高性能网络库【http://libevent.org/】
3.ACE-重量级的网络框架
4.OSSP-共享内存(仅仅适用于进程间)
5.ZeroMQ-一个封装好的网络通信库
6.Protocol Buffers-比XML更高效的一款google开源库
7.lighthttp:轻量级的http服务器代码。
8.mangos-魔兽世界 私服的服务器代码,开源项目,很不错,还比较好懂,
9.ascent -魔兽世界 私服服务器代码,很不错,无论是架构还是网络处理模块。
10.sqlite-轻型的数据库
11.Asio-基于Boost开发的异步IO库,封装了Socket,简化基于socket程序的开发。[http://think-async.com/]
12.POCO-一套 C++ 的类库用以开发基于网络的可移植的应用程序,功能涉及线程、线程同步、文件系统访问、流操作、共享库和类加载等【http://pocoproject.org/】
13.libev-ibev和libevent很像,可以作为libevent的替代者,能够提供更高的性能。
14.C++ Sockets Library
15.sparsehash

机器人定位坐标变换相关

2013年5月28日

机器人定位坐标变换相关
前一状态(XBaseIn, YBaseIn, angle1)相对于大地坐标。
后一状态(Xin,Yin,angle2),在前一状态的坐标系下(机器人坐标系)
根据前后两个状态可以计算出Xin,Yin,然后进行坐标变换后得到大地坐标系下的坐标,测试正常。
» 阅读更多: 机器人定位坐标变换相关