Leetcode:1. Two Sum

作者:JerryXia | 发表于 , 阅读 (22)
class Solution {public:vector<int> twoSum(vector<int>& nums, int target) {int n = nums.size();vector<int> res;for(int i = 0; i < n-1; i++) {for(int j = i+1; j < n; j++) {if(nums[i] + nums[j] == target) {res.push_back(i);res.push_back(j);return res;}...阅读全文

Mysql主从搭建

作者:JerryXia | 发表于 , 阅读 (24)
创建用户并分配权限
mysql> create user 'dante'@'mysql002' identified by '123456';Query OK, 0 rows affected (0.01 sec)mysql> grant replication slave on *.* to 'dante'@'mysql002' identified by '123456';Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show master status;+------------------+----------+--------------+------------------+-------------------+| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |+------------------+----------+--------------+------------------+-...阅读全文

项目迁移记录:svn  to gitlab

作者:JerryXia | 发表于 , 阅读 (26)
补充上面是最基本的一个方式。下面补充一些其他内容,不翻译了。
Optionally, prepare an authors file so svn2git can map SVN authors to Git authors. If you choose not to create the authors file then commits will not be attributed to the correct GitLab user. Some users may not consider this a big issue while others will want to ensure they complete this step. If you choose to map authors you will be required to map every author that is present on changes in the SVN repository. If you don’t, the conversion will fail and you will h...阅读全文

一次集群文件无故被删问题排查

作者:JerryXia | 发表于 , 阅读 (25)
前言发现集群部分目录文件丢失,但是都有一定的规律,比如该目录下,只留了七天的数据。这个事情挺严重的,需要排查一下具体问题。
[cluster]$ hadoop fs -ls /data/logs/log1Found 6 itemsdrwxr-xr-x   - user supergroup          0 2016-07-15 01:13 /data/logs/log12016-07-14drwxr-xr-x   - user supergroup          0 2016-07-16 01:12 /data/logs/log12016-07-15drwxr-xr-x   - user supergroup          0 2016-07-17 01:11 /data/logs/log12016-07-16drwxr-xr-x   - user supergroup          0 2016-07-18 01:11 /data/logs/log12016-07-17drwxr-xr-x   - user supergroup          0 2016-0...阅读全文

Leetcode:121. Best Time to Buy and Sell Stock

作者:JerryXia | 发表于 , 阅读 (26)
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
Example 1:
Input: [7, 1, 5, 3, 6, 4]Output: 5max. difference = 6-1 = 5 (not 7-1 = 6, as selling price needs to be larger than buying price)...阅读全文