自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

原创 资源收藏贴

网上看到的好的资源,没时间立刻看完,收藏在这里走到哪里都能打开继续看。算法和数据结构:  少见但有用的数据结构:http://stackoverflow.com/questions/500607/what-are-the-lesser-known-but-useful-data-structuresC++C++ FAQ: http://www.parashift.com/c++-faq/面试题有趣

2015-09-04 23:57:37 453

原创 什么是CORS

英文原文来自我的GitHub页面。CORS = Cross-Origin Resource Sharing什么是 Origin要理解CORS,首先得理解什么是 “Origin”。参见RFC6454:如果两个URI拥有相同的schema,host和port,我们就认为他们是来自于相同的Origin。以下是一个完整的URI的定义:    scheme:[//[user[:passw

2018-02-01 14:50:01 3191

原创 CMS/PKCS#7 读书笔记

CMS/PKCS#7读书笔记和参考文献

2016-07-07 05:52:21 4156

原创 程序员的Job Security 之 信心来源

程序员的Job Security:下面这两点基本上是一个程序员Job Security的来源:项目经验和面试经验。

2015-11-09 02:30:34 716

原创 论 为啥把博客从163搬家到CSDN

把博客搬到CSDN就一个理由:Markdown编辑器

2015-11-09 02:25:42 461

原创 程序员的Job Security - 我的OJ(Online Judge)比较

又一次换了一个team,这回打算静下心来在这个新team做一段时间了。最近和朋友聊天中我们总结出码农保持自信的两大来源:项目经验得是能跟得上时代,离开现在公司也能找到工作的;保持基本的数据结构知识和算法编程能力。这俩是护体神功,保证自己有饭碗的底线。第一条只能靠换team或者换公司来保证了,有些项目经验不是靠回家做做side project能获得的,比如大数据、高并发。第二条则

2015-11-09 01:59:09 1430

原创 LeetCode趣题

本帖以收录LeetCode上面有趣的题目及其解法为目的。Gas Station一上来想到的肯定是模拟,结果必然是O(n^2),运气够好的话不会超时,但~700ms的结果是必然的了。O(n)的解法是有的,类似动归,从头开始遍历到底,记录gas和cost总量的差和每一站gas和cost的差距。如果否则的话,有解而且可能不止一个:每站差距里面cost比gas多的最多的那一站的下一站做起点必然是个可行解。

2015-09-04 23:57:34 553

原创 一句话Design Pattern:Bridge

定义:The bridge pattern is a design pattern used in software engineering which is meant to "decouple an abstraction from its implementation so that the two can vary independently". The bridge uses encap

2015-09-04 23:57:31 398

原创 动态规划

做完贪心就该动归了。动归的基本想法就是保存之前计算的结果为下一步做准备。这个计算结果要包括之前的各种可能。解题的关键在于找到递归的方程/关系,只要找到这个则写出程序并不困难。时间上不太可能优化,除非特例;空间上的优化则是看是不是能把结果矩阵转换成一个一维数组来实现。题目和解法归纳:1. Triangle这个题目可以从上到下做,但这样做就成了深度遍历,需要回溯,时间复杂度高,code也复杂。但如果反

2015-09-04 23:57:29 432

原创 贪心法

最近几个Leetcode题目选的都是贪心。1. 首先建模,看看能不能得到一个递进模型,使得这个模型的任何一步如果最优,持续计算下去不需回退即能得到全局最优解,那么这个题目就可以用贪心算法。2. 算法实际上很简单,即是每一步都尽量去得到最优的结果,于是很快就能得到最终解。题目和解法归纳:1. Jump Game对于任何一步都可以走0-A[i]步,所以每一步都可以走到最远而无需考虑回退。标准的贪心算法

2015-09-04 23:57:26 354

原创 Python 3.3 Tutorial Notes - 8:Standard Libraries - Briefly

1. OS     1.1 import os     1.2 import shutil2. File wildcards     2.1 import glob3. Command line arguments     3.1 import sys     3.2 sys.stderr and sys.exit() are also useful4. String Pattern Matchi

2015-09-04 23:57:24 351

原创 Python 3.3 Tutorial Notes - 7:Class

1. Allow multiple base classes2. namespace: Most namespaces are currently implemented as Python dictionaries3. attribute:      3.1 for any name following a dot — for example, in the expression z.real 

2015-09-04 23:57:21 362

原创 Python 3.3 Tutorial Notes - 6:Error and Exception

1. Handle exception: try-except. An except clause may name multiple exceptions as a parenthesized tuple.>>> while True:...      try:...           x = int(input("Please enter a number: "))...          

2015-09-04 23:57:19 360

原创 Python 3.3 Tutorial Notes - 5:Input and Output

1. Format string: str.Format()2. Convert to string: str(), repr()     2.1 The str() function is meant to return representations of values which are fairly human-readable     2.2 repr() is meant to gen

2015-09-04 23:57:16 362

原创 Python 3.3 Tutorial Notes - 4:Modules

1. File name is the module name2. where you call the "import", where the module will be put into the destination file. This means, if a module contains some code out of any functions, it will be execu

2015-09-04 23:57:13 330

原创 Python 3.3 Tutorial Notes - 3:Data Structure

1. List     1.1 list.pop([i]), list.sort(), list.reverse()     1.2 insert, remove or sort that modify the list have no return value printed – they return None.     1.3 list.pop() and deque.popleft() 

2015-09-04 23:57:11 343

原创 Python 3.3 Tutorial Notes - 2:Control Flow

1. if, else, elif1. Iterating over a sequence does not implicitly make a copy.2. "for" in Python is "foreach" in C#3. range(n) means n numbers: 0..n-1, good for for-loop4. range(n) is an object which

2015-09-04 23:57:08 319

原创 Python 3.3 Tutorial Notes - 1:Basic

1. "/": Division, always return float2. "//": Floor division, return integer3. "%": Reminder, return integer 1. "**": Power 1. Interactive mode, "_" means the value of the last printed expression. "_"

2015-09-04 23:57:06 393

原创 Python 3.3 Tutorial 阅读笔记

多年前用过Python 2.4,如今要重新捡起来用了,所以干脆直接看3.3。从官网上找来文档,用了一个星期,扫了一遍,感觉变化很大啊。做了点笔记,先把未整理版放上来,以后有空慢慢排版并且把sample code贴到GitHub(但愿以后有空。。。)官网文档:http://docs.python.org/3/tutorial/ 重要参考:http://docs.python.org/3.3/cont

2015-09-04 23:57:03 304

原创 Python 3.3 Tutorial - Online Resource

Will update this post once I see anything new and useful.Basic Documents: http://docs.python.org/3.3/contents.html To Be Continued...

2015-09-04 23:57:00 248

原创 一句话Design Pattern:Template Method

定义:The Template Method Pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without chan

2015-09-04 23:56:58 276

原创 一句话Design Pattern:Facade

定义:The Facade Pattern provides a unified interface to a set of interfaces in a sub-system. Facade defines a higher-level interface that makes the subsystem easier to use.一句话:为了好用而给一个subsystem写一套接口类比:类

2015-09-04 23:56:55 265

原创 一句话Design Pattern:Adapter

定义:The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn’t otherwise because of  incompatible interfaces一句话:当两

2015-09-04 23:56:52 253

原创 一句话Design Pattern:Command

定义:The Command Pattern encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.一句话:把一个reques

2015-09-04 23:56:50 278

原创 一句话Design Pattern:Singleton

定义:The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it一句话:系统里有些东西只需要一个,于是控制这个东西的constructor不能被外界访问。用途:thread pool, dialog, caches, registry, etc.

2015-09-04 23:56:47 320

原创 OO Principles

Encapsulate what varies Favor composition over inheritance Program to interfaces, not implementations Strive from loosely coupled designs between objects that interacts Classes should be open for exte

2015-09-04 23:56:44 340

原创 一句话Design Pattern:Abstract Factory

定义:The Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.一句话:为了实现一组对象的创建,用object composition,每个object都可以用Fa

2015-09-04 23:56:42 312

原创 一句话Design Pattern:Factory

定义:The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.一句话:构造一个

2015-09-04 23:56:39 308

原创 Big-Endian and Little-Endian

Wikipedia has a very clear graph and tells me that "big-endian" and "little-endian" comes from Gulliver’s Travels1. Big-Endian, Little-Endian is not only for bit level, but most likely people talk abo

2015-09-04 23:56:37 355

原创 一句话Design Pattern:Decorator

定义:The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.一句话:Subclass里面有一个base class

2015-09-04 23:56:34 259

原创 一句话Design Pattern:Observer

定义:The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.一句话:注册+通知机制类比:不需要C#:Event o

2015-09-04 23:56:31 294

原创 一句话Design Pattern:Strategy

定义:The strategy pattern defines a family of algorithm, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.一句话:action不是object

2015-09-04 23:56:29 293

原创 我的“一句话Design Pattern”

当年备战高考作文,无奈读书太少,每逢写议论文总是内容干瘪,没有论据。遂与同学相约借来“名人轶事六百则”上下册潜心研究。但总是看后面就忘前面,事后查找起来也不甚方便。终于决定一人一本,各花了一个月的课余时间,把每一个故事总结成一行字,然后复印了交换背熟。结果发现效果很好,每篇作文至少能弄出三五个故事充场面,两人作文最终以高分收场。后来看design pattern,几十个pattern看下来也是狗熊

2015-09-04 23:56:26 233

空空如也

空空如也

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

TA关注的人

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