Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.61 KB

ARTS16-1021.md

File metadata and controls

77 lines (55 loc) · 2.61 KB

ARTS16-20181021

第十六周ARTS。这个周末也不消停,一家人都得了感冒,前两天吃了药就会很困,实在坚持不住。乘着这会儿孩子睡着了,赶紧把ARTS写了,这一周已经积累了arts的素材,应该不会耗时太久。

Algrithm

package org.nocoder.leetcode.solution;

import java.util.Set;

/**
 * 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.
 * <p>
 * For example, given
 * s ="leetcode",
 * dict =["leet", "code"].
 * <p>
 * Return true because"leetcode"can be segmented as"leet code".
 *
 * @author jason
 * @date 2018/10/22.
 */
public class WordBreak {
    public boolean wordBreak(String s, Set<String> dict) {
        int len = s.length();
        boolean[] arrays = new boolean[len + 1];
        arrays[0] = true;
        for (int i = 1; i <= len; ++i) {
            for (int j = 0; j < i; ++j) {
                if (arrays[j] && dict.contains(s.substring(j, i))) {
                    arrays[i] = true;
                    break;
                }
            }
        }
        return arrays[len];
    }
}

Review

http://cloudurable.com/blog/kafka-tutorial-kafka-producer/index.html https://dzone.com/articles/writing-a-kafka-consumer-in-java

封装kafka client 操作考虑以下几个问题

  • 创建过程对调用者透明
  • 对资源关闭的封装
  • 客户端类不能使用单例

Tip

使用 jenkins pipeline 定时运行python脚本

每次pull 新的docker image下来运行起来后,如果image的标签没有变化,那么在本地旧的image会变成标签为none的镜像,留着基本没什么用,堆积多了之后非常占用存储空间,这类镜像是需要我们手动清除的。正好测试服务器上安装了jenkins,就使用jenkins pipeline 项目来运行写好的python脚本

  • 在 jenkins 上创建 pipeline 项目
  • sh 'python ssh_cmd.py'
  • 注意权限,jenkins项目 是用 jenkins 用户来执行命令的
  • 定时触发执行或者在其它项目构建完后触发执行

Share

关于分库分表

分表分库常见的几种方式,垂直分库,垂直分表,水平分表,水平分库分表,目前项目的情况,我们决定选用单库水平分表的方式来优化现有的软件。

http://www.infoq.com/cn/articles/key-steps-and-likely-problems-of-split-table?utm_source=articles_about_dsgsgsfd&utm_medium=link&utm_campaign=dsgsgsfd

http://www.infoq.com/cn/articles/key-steps-and-likely-problems-of-horizontal-split-table?utm_source=articles_about_dsgsgsfd&utm_medium=link&utm_campaign=dsgsgsfd