关于Trie

File Searching Using Variable Length Keys 最早提及Trie树的一篇文章 MANY computer applications require the storage of large amounts of information within the computer’s memory where it will be readily available for reference and updating. Quite commonly, more storage space is required than is available in the computer’s high-speed working memory. It is, therefore, a common practice to equip computers with magnetic tapes, disks, or drums, or a combination of these to provide additional storage. This additional storage is always slower in operation than the computer’s working memory and therefore care must be taken when using it to avoid excessive operating time. ...

2021-01-16 · 17 min · 3602 words

LeetCode- Replace Words Solution

题目: In English, we have a concept called root, which can be followed by some other word to form another longer word - let’s call this word successor. For example, when the root "an" is followed by the successor word "other", we can form a new word "another". Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the successors in the sentence with the root forming it. If a successor can be replaced by more than one root, replace it with the root that has the shortest length. ...

2021-01-12 · 4 min · 677 words

docker安装 zookeeper, dubbo-admin

1 . 环境: cenos7(X86_64) + openssh 2 . 安装 配置镜像加速器, 尝试从Docker Hub下载, 速度太慢 /etc/docker/daemon.json { "max-concurrent-downloads":1, "registry-mirrors": [ "https://hub-mirror.c.163.com", "https://mirror.baidubce.com" ] } 抓取zookeeper镜像 docker pull zookeeper 抓取dubbo-admin镜像 docker pull apache/dubbo-admin 启动zookeeper容器 docker run --name zookeeper -p 2181:2181 -d zookeeper 启动duboo-admin容器 docker run -d \ -p 8081:8080 \ -e dubbo.registry.address=zookeeper://192.168.37.201:2181 \ -e dubbo.admin.root.password=root \ -e dubbo.admin.guest.password=guest \ apache/dubbo-admin 验证 浏览器输入 http://192.168.37.201:8081/ 参考及引用 http://blog.csdn.net/zxl8899/article/details/107413063 Photo by Steve Johnson from Pexels

2020-12-23 · 1 min · 68 words

docker安装tomcat

1 . 环境: cenos7(X86_64) + openssh 2 . 安装 配置镜像加速器, 尝试从Docker Hub下载, 速度太慢 /etc/docker/daemon.json { "max-concurrent-downloads":1, "registry-mirrors": [ "https://hub-mirror.c.163.com", "https://mirror.baidubce.com" ] } 抓取tomcat镜像 docker pull tomcat 启动容器 docker run -d --name tongda-user -p 8082:8080 -v /root/log/user-log:/usr/local/tomcat/user-log tomcat 验证容器 http://xxx.xxx.xxx.xxx:8082 HTTP状态 404 - 未找到 类型 状态报告 描述 源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示。 Apache Tomcat/9.0.41 调整 docker exec -it mytomcat /bin/bash mv webapps webapps2 mv webapps.dist/ webapps exit 验证成功 3 . 环境变量及配置文件: Tomcat 镜像环境变量: CATALINA_BASE: /usr/local/tomcat CATALINA_HOME: /usr/local/tomcat CATALINA_TMPDIR: /usr/local/tomcat/temp JRE_HOME: /usr CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar 配置文件默认位置: ...

2020-12-22 · 1 min · 89 words

cenos7 docker安装

环境: cenos7(X86_64) + openssh 安装工具yum 安装 1 检查更新 sudo yum check-update 2 安装依赖包 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 3 增加docker repo地址 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 4 安装docker sudo yum install docker 5 启动docker服务查看状态 sudo systemctl start docker 开机启动 sudo systemctl enable docker 查看状态 sudo systemctl status docker0 参考及引用 https://phoenixnap.com/kb/how-to-install-docker-centos-7 Photo by Steve Johnson from Pexels

2020-12-21 · 1 min · 57 words

spring boot+maven 生成多模块项目

spring boot + maven配置, 创建一个包含多个模块项目的步骤 项目创建 使用spring的initializr 选择一下就可以生成代码 项目: tongda (jar) 模块: user (war) order (war) common (jar) 配置: Project : Maven Project Language : Java Spring Boot : 2.4.1 Dependencies: Java : 11 Packaging :jar/war 调整 parent POM 修改tongda的pom.xml, 打包类型设置为pom 新增packaging 标签并设置为pom <packaging>pom</packaging> 通知增加模块配置 <modules> <module>user</module> <module>order</module> <module>common</module> </modules> 各个模块中调整parent标签 order, user模块 pom.xml文件 <parent> <groupId>com.tongda</groupId> <artifactId>tongda</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> 验证 > mvn clean package ... [INFO] Reactor Summary: [INFO] [INFO] tongda 0.0.1-SNAPSHOT .............................. SUCCESS [ 1.250 s] [INFO] user ............................................... SUCCESS [ 9.161 s] [INFO] order .............................................. SUCCESS [ 6.106 s] [INFO] common 0.0.1-SNAPSHOT .............................. SUCCESS [ 4.226 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ ... 参考引用 https://www.baeldung.com/maven-multi-module https://github.com/bz51/SpringBoot-Dubbo-Docker-Jenkins Photo by Zaksheuskaya from Pexels

2020-12-21 · 1 min · 116 words

用Spring boot 生成Java项目

学习java, 尝试用了spring boot创建了一个项目, 使用是maven配置, spring boot 提供很多的模板, 创建项目非常方便, 这让我想起了visual studio 点击几下鼠标自动生成模板代码。 项目创建 使用spring的initializr 选择一下就可以生成代码 我的配置: Project : Maven Project Language : Java Spring Boot : 2.4.1 Dependencies: Spring Web 创建一个web项目 Spring Boot Actuator 提供健康检查功能 Lombok: 通过注释说明生成代码需要安装相关插件 Java : 11 Packaging :jar 相关代码 : 自动生成代码如下: package com.garlicspace.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @RestController public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } 通过"/hello"文根实现页面输出"hello World!" package com.garlicspace.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } @RequestMapping("/hello") public String hello(){ return "hello World!"; } } cmd运行: ...

2020-12-16 · 2 min · 322 words

LeetCode- Map Sum Pairs Solution

题目: Implement a MapSum class with insert, and sum methods. For the method insert, you’ll be given a pair of (string, integer). The string represents the key and the integer represents the value. If the key already existed, then the original key-value pair will be overridden to the new one. For the method sum, you’ll be given a string representing the prefix, and you need to return the sum of all the pairs’ value whose key starts with the prefix. ...

2020-09-22 · 2 min · 354 words

Ext4 布局及inode,block信息统计

inode定义 node The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attributes may include metadata (times of last change,[2] access, modification), as well as owner and permission data.[3] from inode wiki inode数据结构用于描述文件系统中的文件、目录等, 每一个inode保存了文件系统系统对象memdata如修改时间,访问时间以及权限等。Dennis Ritchie对于inode中i可能代表index,而被访问的文件列表,被组织为存放存放在磁盘上的一维数组。 block ext4文件系统以block为单位分配存储空间。 环境准备 Linux Distributions: CentOS 7 通过fdisk划出一个10M分区, 格式化为ext4 ...

2020-09-16 · 10 min · 1951 words

Understanding Linux filesystems: ext4 and beyond

这篇文章Understanding Linux filesystems: ext4 and beyond 是出自opensource opensource.com 作者 Jim Salter 文章主要介绍ext简要历史,ext4一些特性及问题, 以及其他一些文件系统. ext发展过程 ext主要经历了MINIX文件系统, ext,ext2, ext3, ext几个阶段。 Minix文件系统 Andrew Tannenbaum 为了教学的目的而开发了MINIX,并于 1987 年发布。Minix有自己的文件系统, 不过比较简单最多只能处理14个字符的文件名,并且只能处理64MB的存储空间。 ext ext是由一名发过软件开发人员 Rémy Card 1992 年实现,同时他也设计了ext2, ext使用VFS抽象层,并且能够支持2G存储,以及255长度的文件名。关于时间戳,ext只有一个. ext2 Rémy Card 发现了ext的局限性,一年后也就是1993年他便设计出了ext2, ext2支持到GB级别文件大小和TB级别的文件系统大小, 但是磁盘碎片, 数据写入安全性上尚存在不足,比如: 如果在将数据写入磁盘时系统崩溃或断电,则容易发生灾难性损坏. ext3 1998年, Stephen Tweedie 改进ext2, 2001合并如2.4.25内核版本主线。ext3实现了日志来解决异常情况下数据写入不一致问题。 像之前的ext2一样,ext3使用16位内部寻址。 这意味着块大小为4K时,它可以处理的最大文件大小为2 TiB,最大文件系统大小为16 TiB。 ext4 Theodore Ts’o , 中文名曹子德 ext3主要开发人员。 2006年,发布ext4, 两年后加入 2.6.28 内核主线。 ext4比较ext3有很多新的特征:可以参见以下链接, https://ext4.wiki.kernel.org/index.php/New_ext4_features 作者文章发表的时候计划开发特征已经实现, 比如Metadata Checksums 3.1 Multiblock Allocation 3.2 Delayed Allocation 3.3 Exceed 32000 subdirectory limit 3.4 directory Inodes reservation 3.5 nsec timestamps 3.6 inode version on disk 3.7 uninitialized block groups 3.8 journal checksumming 3.9 persistent preallocation (fallocate) 3.10 Online Defragmentation 3.11 First Class Quota Support 3.12 Big Allocation Blocks 3.13 Metadata Checksums 3.14 Large file support 3.15 Large directory support ...

2020-09-16 · 1 min · 145 words