自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(267)
  • 资源 (3)
  • 收藏
  • 关注

转载 C语言编程技巧-signal(信号机制) 与中断

用户态到内核态切换途径:        1:系统调用        2:中断   3:异常中断类型分为如下两大类:一、强迫性中断:正在运行的程序所不期望的,来自硬件故障或外部请求。1、I/O 中断:来自外部设备通道;2、程序性中断:运行程序本身的中断,如 溢出、缺页中断、缺段中断、地址越界。3、时钟中断4、控制台中断5、硬件故障

2017-07-13 21:56:55 2976

原创 java虚拟机与jvm内存模型

1.Java虚拟机本质与编译器由来 Java虚拟机jvm(一个c++程序而已,当然也有其他语法实现的)其实是一个进程虚拟机--上面跑进程的(,普通服务器虚拟机是跑操作系统的),启动一个java程序就是启动一个java虚拟机上面跑这个java程序,这个启动的java虚拟机对操作系统来说其实就是一个(c++)进程,这个进程会调用本地方法(C/C++/汇编语言编写,编译成和处理器相关的机

2017-06-09 00:17:41 5214

原创 leetcode 8 String to Integer

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2017-01-24 09:07:49 583

转载 <context-param>与<init-param>的区别与作用

的作用:web.xml的配置中配置作用1. 启动一个WEB项目的时候,容器(如:Tomcat)会去读它的配置文件web.xml.读两个节点: 和 2.紧接着,容器创建一个ServletContext(上下文),这个WEB项目所有部分都将共享这个上下文.3.容器将转化为键值对,并交给ServletContext.4.容器创建中的类实例,即创建监听.5.在监听中会有conte

2016-12-12 11:38:29 470

原创 JAVA Web servlet 与监听器

Servlet生命周期1.servlet可以在web.xml 配置映射路径servlet> servlet-name>welcomeservlet-name> servlet-class>org.test.welcomeservlet-class> servlet>welcome/en/welcome/zh/welcome2.web

2016-10-06 13:20:55 387

原创 oozie安装

安装1.缺包去:https://repo.spring.io/simple/hortonworks/org/apache/$ bin/mkdistro.sh [-DskipTests]Running =mkdistro.sh= will create the binary distribution of Oozie. By default, oozie war will not c

2016-09-09 19:04:57 1430

原创 leetcode 1. Two Sum

题目Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given

2016-08-31 23:20:10 272

原创 leetcode:154. Find Minimum in Rotated Sorted Array II

Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a sorted array is rotated at some pivot u

2016-08-25 00:33:40 342

原创 leetcode:152. Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest

2016-08-24 00:33:38 340

转载 Hadoop和Spark修改shh端口以及web监控端口

SSH端口不是默认端口22如果ssh端口不是默认的22,在etc/hadoop/hadoop-env.sh里改下。如:export HADOOP_SSH_OPTS="-p 18921"

2016-07-12 18:59:41 9288

转载 波兰表示法与逆波兰表示法(前缀、中缀、后缀表达式)

1、为什么要把中缀表达式转化为后缀,前缀?计算机没法计算带有括号,以及区分优先级的表达式,或者说很难计算。使用后缀,前缀,消除了括号和优先级。2、计算机如何计算后缀,前缀表达式?计算后缀:从左到右遍历后缀表达式,遇到操作数,放进栈,遇到操作符,栈顶两个数出栈,进行运算,运算结果放进栈,直到读完后缀表达式。计算前缀:从左到右遍历前缀表达式,遇到操作符,放进栈,遇到操作

2016-07-11 22:15:02 3581

原创 js与flash

js与flash交互js操作flash比如播放、暂停等,这个要flash程序自己暴露这些接口才行,它没有暴露,那js是无能为力的。(网上js中控制flash的函数,我都试了下,没有用……)flash会至于顶层,点击flash的点击事件会被flash捕获,包裹flash的div这些是无法捕获点击事件onclick的。有两种方式捕获点击:在外层div 中 添加onmousedo

2016-07-11 19:42:10 1558

原创 spring bean 入门

参考:慕课网http://www.imooc.com/video/3668一.spring 注入方式spring注入是指实例化某个类时,对该类的成员变量赋值spring有两种注入方式(即两种赋值方式):1.构造器注入:在构造函数中传入要初始化的成员变量的值,在构造函数值赋值2.设值注入:调用该类的相应的成员变量的set方法对改成员变量赋值public class Injec

2016-07-10 23:20:08 814

转载 java单元测试junit

转自:http://blog.csdn.net/typa01_kk/article/details/8513548推荐:http://my.oschina.net/pangyangyang/blog/144495http://blog.csdn.net/andycpp/article/details/1329218 Unit3.81与JUnit4.0区别:1.在 J

2016-07-10 13:26:53 425

原创 leetcode 151. Reverse Words in a String

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".思路:预处理,删除首尾空格。先翻转每一个单词,再全部翻转。在翻转每一个单词时,删除多余空格注意:1.删除连续空格,判断下个位置时一定

2016-07-06 23:22:40 640

原创 leetcode 149. 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.法一:两点确定一条直线(两两组合),然后在判断其他点是否在这条直线上,O(n^3)法二:遍历每一个点i {其他点j与该点i组成直线的斜率xl,斜率相同,统计加1----斜率相同又过同一个点i

2016-07-05 22:53:11 443

原创 leetcode 148. Sort List

Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int

2016-07-03 01:26:18 452

转载 泛型中? super T和? extends T的区别

原文链接          李璟([email protected])经常发现有List、Set的声明,是什么意思呢?表示包括T在内的任何T的父类,表示包括T在内的任何T的子类,下面我们详细分析一下两种通配符具体的区别。extendsList foo3的通配符声明,意味着以下的赋值是合法的:01// Numbe

2016-06-25 21:05:28 431

原创 leetcode 147. Insertion Sort List

Sort a linked list using insertion sort.Subscribe to see which companies asked this question思路一:常规做法,将链表头结点拆开(head->next=null)来做待返回的新的有序链表的头,从头结点的下一个开始遍历每个结点往这个新的有序链表中添加/** * Definition f

2016-05-23 23:48:22 344

原创 不用加减乘除实现加法

思路:不用加减乘除,那只能用位运算。1.两个数a,b相加,二进制如果不考虑进位 0+0 得 0 ;1+0 得 1;1+1 得 0   =》 其实就是异或^ 得到  tmp12.考虑进位,只有 1+1 的位置上会导致前一位(左边)进位加1                      =》用按位与 & 选出 都是两个数为1的位置,然后左移1位  得到进位 tmp2把1,2 的结果tm

2016-04-17 12:51:57 825

转载 SQL优化

网上关于SQL优化的教程很多,但是比较杂乱。近日有空整理了一下,写出来跟大家分享一下,其中有错误和不足的地方,还请大家纠正补充。这篇文章我花费了大量的时间查找资料、修改、排版,希望大家阅读之后,感觉好的话推荐给更多的人,让更多的人看到、纠正以及补充。1.对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。2.应尽量

2016-04-05 16:14:00 473

原创 leetcode 143. Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it t

2016-01-15 20:18:42 385

原创 muduo源码分析:reactor模型封装

图中FileDescriptor、socket都不是类EventLoop:loop  --》poller::loop --》pollPoller ::loop   或者epollpoller,循环等待io事件poller是抽象类,pollpoller和epollpoller 是其子类,实现poll(),updateChannel(),和 removeChannel() 三个纯虚函数。c

2016-01-11 16:12:41 861

原创 leetcode 142. Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?思路:先

2016-01-07 22:34:36 644

转载 auto_ptr、shared_ptr、weak_ptr、scoped_ptr用法小结

auto_ptr auto_ptr是现在标准库里面一个轻量级的智能指针的实现,存在于头文件 memory中,之所以说它是轻量级,是因为它只有一个成员变量(拥有对象的指针),相关的调用开销也非常小。 下面的代码来自于VC++ 8.0里面的源码:  里面有个auto_ptr_ref的数据结构,我们可以把它忽略,这个只是内部使用的代理结构,用于一些隐式的const变化

2016-01-07 15:12:15 489

转载 使用gdb调试nginx源码

工欲善其事必先利其器,如何使用调试工具gdb一步步调试nginx是了解nginx的重要手段。ps:本文的目标人群是像我这样初接触Unix编程的同学,如果有什么地方错误请指正。熟悉gdb的使用这里就不说了,谷歌一搜一堆,这里推荐一篇文章:GDB 命令详细解释请重点看一下step,run,break,list,info,continue命令下载nginx源码

2016-01-04 11:21:16 756

原创 leetcode 146. 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

2016-01-02 21:30:09 520

转载 git/github初级运用自如

转自:虫师 http://www.cnblogs.com/fnng/archive/2012/01/07/2315685.html      之前初学过一点git版本控制工具,利用github做仓库,照着github上的文档练习的了一下。不过那只篇只是照虎画猫(我的水平只能照着老虎画个猫模样,嘻嘻!)。最近在学hibernate,公司与家之间都要调用我练习的小项目,交给git/gi

2016-01-02 13:07:39 532

原创 muduo源码分析:日志相关类(1)

1.stringPiece 类:当字符串来用统一 char * 字符串 和 std::string 。通过char *字符串 或者 string作参数 传递 字符串 ,形参为stringPiece类型,就不会有内存拷贝stringPiece 只有两个变量const char*   ptr_; //字符串首地址int           length_; //字符串长度其实 形参

2015-12-23 21:08:12 1022

原创 C++ 数组引用传递与指针传递

#include #include #include using namespace std;class SourceFile{ public: template //这来两个构造函数编译器能区分? __FILE__ 调用哪一个?? inline SourceFile(const char (&arr)[N]) : data_(a

2015-12-23 17:13:44 2802

原创 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 = "

2015-12-15 21:22:27 548

原创 muduo源码分析:ThreadLocalSigleton类

单例+特定数据// Singleton 所管理的对象是 ThreadLocal ,ThreadLocal 在进程内是单例,所有线程共一个ThreadLocal  实例          Singleton调用instance方法获取ThreadLocal实例,ThreadLocal实例调用ThreadLocal::value方法获取Test类型线程特定数据的引用,value返回的是各自线程

2015-12-14 21:06:39 701

原创 leetcode:Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2015-12-13 21:47:38 406

原创 muduo源码分析:线程特定/私有数据类ThreadLocal

线程私有数据1.__thread : gcc内置的线程局部存储设施__thread只能修饰POD类型POD类型(plain old data),与C兼容的原始数据,例如,结构和整型等C语言中的类型是 POD 类型,但带有用户定义的构造函数或虚函数的类则不是__thread string t_obj1(“cppcourse”); // 错误,不能调用对象的构造函数__thre

2015-12-13 16:19:00 931

原创 muduo库源码解析:单例模式singleton

单例模式实现boost::noncopyable 防止复制,如果是自己实现,那要把构造函数、拷贝构造,复制构造都私有公有方法:获取单例对象:instance() 返回 value 引用,(第一次 -->pthread_once --> init  ) 私有:初始化new一单例:init()--并 atexit 注册销毁函数释放delete value构造函数、拷贝构造,复制

2015-12-12 17:09:51 1631

原创 muduo源码分析:线程池类ThreadPool

线程池包括成员变量:一个任务队列:deque queue_,用条件变量同步线程组:ptr_vector threads_bool running :标志是否start启动了,或者stop 停止了成员函数:start:初始化线程数目stop:停止线程池take:从queue中获取任务runInThread:线程执行函数 :循环 调用 take 获取任务,并执行

2015-12-09 22:01:23 2187

原创 muduo源码分析:无界队列和有界队列(消费者-生产者)

muduo库的队列很简单:无界队列put --生产take--消费size--返回现在的产品数产品存放在deque里面无界队列可以一直生产put,所以不用等待队列中有位置才生产,每生产一个产品就notify,只要通知一个消费者,不需要通知所有人只有消费take时要判断有无产品,所以只需要一个条件变量notEmpty,消费者用来等待notEmpty有产品可以消费#

2015-12-09 17:11:44 1407 1

转载 leetcode:Single Number

Single NumberGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement i

2015-12-08 22:04:39 517

原创 leetcode :Candy

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on

2015-12-08 16:12:09 404

原创 muduo源码分析:互斥锁、条件变量、倒计时封装

互斥锁封装:Mutex.hMutex类:对pthread_mutex_t 封装,提供了lock 、unlock  、是否被当前线程锁了isLockedByThisThread 、assertLocked 四个方法MutexLockGard类:通过传递Mutex引用,在构造函数中对其加锁,析构中对其解锁----RAII(资源的地点是构造函数,释放点是析构函数)#ifndef MUDUO_

2015-12-07 20:44:14 750

iNodeClient_Linux(32/64)

inode客户端linux版本,本身是32位,但是通过安装相应的库,也可以用在64位的系统上:http://blog.csdn.net/le119126/article/details/49950815 64位redhat亲测可用

2015-11-20

C#与VB.NET的转换工具

C#、VB.NET和delphi之间的相互转换工具,免安装,只支持单个文本文件转换,不支持这个工程文件转换。

2012-03-28

mysql-connector-net-6.3.6(包括src源文件)

目前最新的。包含源文件。感觉用在.net上操作mysql很不错。。

2011-03-20

空空如也

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

TA关注的人

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