LeetCode[Algorithms] Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe...
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe...
索引类型 - B-tree,Hash, GiST, SP-GiST, GIN。默认是B-tree B-tree - 适合处理等值和范围查询。支持的操作符: <, <=, =, >=, >, in, between, is null, is not null。 like和~ 操作支持从前匹配,如:foo% 、^foo。 B-tree也可用于获取排序后的数据,虽然效率...
numeric - 可以存储非常大数据,并且可存储高精度数据。numeric(precision, scale)例如:23.5141 precision=6, scale=4 可存储NaN值,代表not-a-number。在Postgresql中NaN和NaN数值是相等的,并且大于其他任何值。 serial - 用于自增字段。相当于: CREATE SEQUENCE tablename_...
记录阅读中在意的点 ###字段约束: check、notnull、unique、primary key、reference 外键必须关联primary key 或者unique字段。这两种字段都带索引。 exclude约束??? ###系统列 oid、tableoid、xmin、cmin、xmax、cmax、ctid。都是32位的字段。 ###schema(架构) 类似操作系统中的...
最近博客(www.coderli.com) 被几个流氓IP爬的厉害,流量超标。促使我萌生了将博客迁移到github.io的想法。整个迁移过程OneCoder之前也是不熟悉的,不过思路是清晰的。 1、 如何在github.io/GitCafe上建立页面。 github.io就是原github的page功能。建立的方式很简单。首先你需要有一个Github帐号,然后在你的github帐号下建...
在乱学装饰模式的时候给出了一篇参考文章,是对比装饰模式和代理模式的。自然,这就是OneCoder现在需要理解的问题。 先复习一下设计模式6大原则: 设计模式的六大原则(引自:http://zz563143188.iteye.com/blog/1847029) 1. 开闭原则(Open Close Principle) 开闭原则就是说对扩展开放,对修改关闭。在程序需要进行拓展的时候,不能去...
码农写码3,4年,设计模式用了不少,但又有一种在乱用的感觉。要么叫不出名字,要么感觉摸不到其精髓。其实所谓Java中的23种设计模式,OneCoder之前也乱乱的看过几遍,但是至今感觉也没有什么深刻的领悟。 之前,看到每种设计模式总会有一种“理所应当”的感觉,心里就好像在说本来就应该这么做啊,我也是这么写的啊。但是后头回头品味,总感觉缺少更认真的思考,应用的很不自如。得进步。 这次整理,...
先简单介绍下CSV和TSV文件的区别: TSV ,Tab-separated values的缩写,即制表符分隔值。关于TSV标准,参考:http://en.wikipedia.org/wiki/Tab-separated_values CSV,Comma-separated values,即逗号分隔值。关于CSV标准,参考:http://en.wikipedia.org/wiki/Comma...
可能网上已经有很多教程,这里只是记录OneCoder自己的搭建过程。 需要模拟实际环境进行一些验证工作,这里搭建环境也力图简便。没有自己编译Apache Http Server,而是下载了一个编译好的安装包:https://mirror.bit.edu.cn/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y...
项目里需要使用Mock Server(Mock Server是做什么的,您可以Google一下),这也是我个人比较喜欢的做法。这里我们选择的是Moco,OneCoder其实也没用过,所以就先学习一下。 官方地址:https://github.com/dreamhead/moc Moco服务端就是一个独立的jar包。通过命令(针对0.9.2版本): java -jar moco-runner...