自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Maverick

never stop thinking

  • 博客(184)
  • 收藏
  • 关注

转载 linux下的shell 快捷键

转自:http://blog.sina.com.cn/s/blog_7556be720100ryp2.htmlCtrl+p重复上一次命令Ctrl+a跳到第一个字符前Ctrl+x同上但再按一次会从新回到原位置Ctrl+b前移一个字符不删除字符情况下Ctrl+h删除前一个字符Ctrl+u删除提示符前的所有字符Ctrl+w同上Ctrl+d删除提示符后一个字符或exit或l

2015-09-28 15:22:56 927

转载 Linux进程间内存共享机制mmap详解

转自:http://kenby.iteye.com/blog/1164700共享内存可以说是最有用的进程间通信方式,也是最快的IPC形式, 因为进程可以直接读写内存,而不需要任何数据的拷贝。对于像管道和消息队列等通信方式,则需要在内核和用户空间进行四次的数据拷贝,而共享内存则只拷贝两次数据: 一次从输入文件到共享内存区,另一次从共享内存区到输出文件。实际上,进程

2015-08-28 13:30:12 12477 1

转载 内存泄漏检查工具valgrind的安装与使用

转自:http://blog.chinaunix.net/uid-26000296-id-4161684.html一、 安装1. autoconf# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz # tar -zxvf autoconf-2.69.tar.gz # cd autoconf-2.69# ./

2015-08-20 16:47:13 4031

转载 解决C++项目编译时的multiple definition of重定义问题

转自:http://www.cppblog.com/baye/archive/2007/11/11/36398.html编译C++工程时,出现“multiple   definition   of ”,即有很多函数和变量的重定义我把所有的全局变量写在一个global.h里,然后其他文件都include 了它 ,于是出现了 multiple   definition   of 

2015-08-20 11:13:44 21107 1

转载 git查看commit的内容

转自:http://blog.csdn.net/qxb1229/article/details/8189997git查看commit的内容     在push之前有时候会不放心是不是忘记加某些文件,或者是不是多删了个什么东西,这时候希望能够看看上次commit都做了些什么。一开始想到的是用gitdiff,但是gitdiff用于当前修改尚未commit的时候较为方便,一旦

2015-08-17 14:55:29 2526

原创 Linux系统装有多个PHP的版本切换问题

问题:通过url访问php函数时,用phpinfo()检查版本,显示时5.3.28通过控制台在根目录下执行 php -v 命令时,显示php版本是5.3.3由于版本不同,导致在命令行进行php服务重启时 service php-fpm restart ,对实际用到的5.3.28版本没有作用,衍生了很多问题解决:将要用的php版本5.3.28的安装程序拷贝到 /usr/local

2015-07-30 16:20:14 7643

原创 PHP调用C++扩展时memset/sizeof函数无效的问题

问题:在C++中,我习惯用memset函数对数组进行初始化,如:int sz = 100;int *a = (int*)malloc(sizeof(int) * sz);memset(a,0,sizeof(a));上面的代码动态开辟了一个int数组a,大小为sz,并把开辟的这段内存赋值为ASCII码0在PHP调用这段C++代码时(使用url调用PHP函数),发现memset函数并没

2015-07-14 11:55:57 904

原创 在Linux下用C扩展PHP(打包成so)的方法

本文主要讲一下在Linux下用打包C扩展程序.so文件和Windows下的不同,详细的代码和配置方案请参加另一篇博客:http://blog.csdn.net/maverick1990/article/details/46519045步骤:1.安装php环境到目录 /usr/local/php/ 目录下2.下载相同版本的php源码包,安装到 /root/php-5.6.

2015-07-07 11:52:24 3522

原创 用C++扩展php时函数重定义redefinition问题

问题:我在用C++扩展php时,用到了一些数学库函数如sqr,sqrt等,需要在C++扩展工程的源文件test.cpp中#include ,但是编译时发现这些函数出现了重定义redefinition的问题。多次尝试后,发现将test.cpp开头的#include "php.h" 去掉时,就没有这个问题了原因:查询得知,因为php.h中,将很多C++库函数做了inline内联,直接定

2015-07-07 11:13:26 1071

转载 在Windows下用C++扩展PHP

转自:http://521-wf.com/archives/241.html这篇文章主要介绍了用C++开发PHP扩展时,和C语言的区别目前,PHP编程语言也是相当成熟,各种文档,各种问题,只要Google一下,总有你想要的答案。当然“如何开发PHP扩展”的文章也不少,但是很少有专门来介绍使用C++开发PHP扩展的介绍。C++编程语言功能的强大,促使好多公司后台程序选择使用它,因此碰

2015-07-03 11:36:33 764

转载 调用dll时出现"Unhandled exception 堆已损坏(heap corruption)“异常解决方法

转自:http://blog.sina.com.cn/s/blog_668aae780101iou9.htmlhttp://yaogangshi.iteye.com/blog/1001690http://bbs.csdn.net/topics/390019506问题:在用c++扩展php进行调试时,用malloc或new开辟数据空间并将php的array数据传入时,出现

2015-06-26 14:16:20 12093

转载 VS2013开发调试PHP扩展

转自:http://blog.csdn.net/a600423444/article/details/12720543前言开发中必不可少的环节就是调试,而调试的方式直接影响到开发效率和软件质量。之前开发PHP扩展,一直不会DEBUG调试,每次调试都是重新编译、执行再运行PHP脚本看运行状况再调试。太痛苦、太影响效率了。也百度、谷歌了如何调试PHP扩展的问题,但回答的几乎都是GD

2015-06-24 12:24:51 3190

原创 在Windows下用C扩展PHP(打包成dll)的方法

1、目的为了在php中使用C语言的扩展,本文介绍一种将C扩展打包成dll文件,提供给php调用的方法2、需要安装的软件(1)wamp server:其中包含php,本文中php版本为5.5.12安装路径如:C:\wamp\,其中C:\wamp\bin\php\php5.5.12为php所在路径,将其加入环境变量Path(2)Visual Studio:本文中版本为VS2

2015-06-16 19:27:22 7413

转载 Ubuntu 14.04中文输入法的安装

Ubuntu默认自带的中文输入法是IBUS框架的ibus-pinyin,IBUS-Bopomofo等。对于习惯于搜狗,紫光华宇,谷歌拼音的我们可能有点使用不习惯。下面就是安装常用的IBUS中文输入法。1,安装IBUS-googlepinyin,ibus-sunpinyin. 直接在Ubuntu软件中心搜索IBUS,然后选择显示不常用项,即如下找到相应的输入法。如果除了系统自

2014-11-21 16:56:47 2741

原创 Google中国2015校园招聘笔试Round D APAC Test Problem D. Itz Chess

ProblemGiven an arranged chess board with pieces, figure out the total number of different ways in which any piece can be killed in one move. Note: in this problem, the pieces can be killed despite

2014-11-14 14:50:40 1207

原创 Google中国2015校园招聘笔试Round D APAC Test Problem C. Sort a scrambled itinerary

ProblemOnce upon a day, Mary bought a one-way ticket from somewhere to somewhere with some flight transfers.For example: SFO->DFW DFW->JFK JFK->MIA MIA->ORD.Obviously, transfer flights at a

2014-11-14 11:44:02 1519

原创 Google中国2015校园招聘笔试Round D APAC Test Problem B. GBus count

ProblemThere exists a straight line along which cities are built.Each city is given a number starting from 1. So if there are 10 cities, city 1 has a number 1, city 2 has a number 2,... city 10

2014-11-13 23:37:48 1357

原创 Google中国2015校园招聘笔试Round D APAC Test Problem A. Cube IV

ProblemVincenzo decides to make cube IV but only has the budget to make a square maze. Its a perfect maze, every room is in the form of a square and there are 4 doors (1 on each side of the room). T

2014-11-13 23:28:45 1402

原创 leetcode-Word Break II

Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "

2014-07-22 23:53:16 775

原创 leetcode-Substring with Concatenation of All Words

You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an

2014-07-20 18:18:00 963

原创 C++<algorithm>中sort的比较函数写法

定义排序函数:方法1bool Less(const Student& s1, const Student& s2){return s1.name }std::sort(sutVector.begin(), stuVector.end(), Less);或者bool operator{return s1.name }std::sort(sutV

2014-07-13 14:17:42 16345 1

原创 leetcode-Largest Rectangle in Histogram

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o

2014-07-09 00:21:58 771

转载 字符串匹配的KMP算法

字符串匹配是计算机的基本任务之一。举例来说,有一个字符串"BBC ABCDAB ABCDABCDABDE",我想知道,里面是否包含另一个字符串"ABCDABD"?许多算法可以完成这个任务,Knuth-Morris-Pratt算法(简称KMP)是最常用的之一。它以三个发明者命名,起头的那个K就是著名科学家Donald Knuth。这种算法不太容易理解,网上

2014-07-07 13:47:08 671

原创 leetcode-Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non

2014-07-06 16:18:56 752

原创 leetcode-Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题意:拷贝一个带有随机指针的单链表

2014-07-06 14:27:05 1350

原创 leetcode-Container With Most Water

Container With Most Water Total Accepted: 11787 Total Submissions: 38592My SubmissionsGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai)

2014-07-05 23:33:29 772

转载 如何选择机器学习分类器?

你知道如何为你的分类问题选择合适的机器学习算法吗?当然,如果你真正关心准确率,那么最佳方法是测试各种不同的算法(同时还要确保对每个算法测试不同参数),然后通过交叉验证选择最好的一个。但是,如果你只是为你的问题寻找一个“足够好”的算法,或者一个起点,这里有一些我这些年发现的还不错的一般准则。你的训练集有多大?如果训练集很小,那么高偏差/低方差分类器(如朴素贝叶斯分类器)要优于低偏差/高方差分

2014-07-03 14:46:00 1482

转载 搜索背后的奥秘——浅谈语义主题计算

摘要:两篇文档是否相关往往不只决定于字面上的词语重复,还取决于文字背后的语义关联。对语义关联的挖掘,可以让我们的搜索更加智能化。本文着重介绍了一个语义挖掘的利器:主题模型。主题模型是对文字隐含主题进行建模的方法。它克服了传统信息检索中文档相似度计算方法的缺点,并且能够在海量互联网数据中自动寻找出文字间的语义主题。近些年来各大互联网公司都开始了这方面的探索和尝试。就让我们看一下究竟吧。

2014-06-24 12:14:17 845

原创 leetcode-Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X

2014-06-03 18:06:25 897

原创 leetcode-Word Ladder II

Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word must exi

2014-06-03 14:48:22 1886

原创 Morris Traversal - 不需递归和栈中序遍历二叉树

Morris Traversal的基本思想是线索二叉树

2014-05-27 15:42:40 1291

转载 bootstrps 、bagging与 boosting

转自:http://blog.sina.com.cn/s/blog_5dd2e9270100c8ko.htmlbootstrps bagging boosting这几个概念经常用到,现仔细学习了一下:他们都属于集成学习方法,(如:Bagging,Boosting,Stacking),将训练的学习器集成在一起,原理来源于PAC学习模型(Probably Approxima

2014-05-09 15:08:18 1009

转载 C++ STL 容器技术 之 deque双端队列容器

转自:http://hi.baidu.com/xuehuo_0411/item/f72d5120d5006ad0a517b6b8C++ STL 容器技术 之 deque双端队列容器简介:deque双端队列容器(double-ended queue)与vector非常相似,算法的时间复杂度也是常数阶O(1),deque内部的数据机制和执行性能与vector不同,一般说来,

2014-04-24 23:25:25 3400

原创 leetcode-LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if

2014-04-16 13:41:27 747

原创 Google Code Jam 2014-Qualification Round-Problem C. Minesweeper Master

ProblemMinesweeper is a computer game that became popular in the 1980s, and is still included in some versions of the Microsoft Windows operating system. This problem has a similar idea, but it do

2014-04-14 23:28:49 1373

原创 编程之美2014-资格赛-题目2:大神与三位小伙伴

时间限制:2000ms单点时限:1000ms内存限制:256MB描述L国是一个有着优美景色且物产丰富的国家,很多人都喜欢来这里旅游并且喜欢带走一些纪念品,大神同学也不例外。距离开L国的时间越来越近了,大神同学正在烦恼给她可爱的小伙伴们带什么纪念品好,现在摆在大神同学面前的有三类纪念品A, B, C可以选择,每类纪念品各有N种。其中种类为A_i, B_i, C

2014-04-14 22:54:21 1215

原创 leetcode-Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题意:给出平面上若干点的(x,y)坐标,求

2014-04-11 14:10:12 1174

原创 leetcode-Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did

2014-04-09 16:01:04 3129

原创 leetcode-Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku

2014-04-08 17:23:21 950

转载 STL---set基本使用--取集合的交、并、差、对称差

转自:http://blog.sina.com.cn/s/blog_4c98b9600100az2v.htmlset是集合,其底层数据结构是红黑树,STL中set、map均采用红黑树结构作为底层支持,红黑树与AVL树类似,是一种平衡查找树。set的特性是集合的基本特性:元素唯一性等。通过algorithm中提供的set_intersection、set_unio

2014-04-08 17:00:04 4225

空空如也

空空如也

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

TA关注的人

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