可逆计算 reversible computing

本周在学习Trie数据结构的时候,看到了他的发明者 Edward Fredkin,他也在研究reversible computing 弗雷德金(Fredkin)对计算,硬件和软件一直很感兴趣。 在1960年代初期,他在BBN编写了第一台PDP-1汇编程序。 他是trie数据结构,Fredkin gate和Billiard-Ball计算机模型的可逆计算的发明者。 他的主要贡献包括他在可逆计算和元胞自动机方面的工作。 他还研究领域还包括计算机视觉,人工智能研究和计算机象棋。 ...

2021-01-17 · 1 min · 70 words

关于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