自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Tech in Pieces

Technical blog of Evan Sun

  • 博客(132)
  • 收藏
  • 关注

原创 Linux虚拟机安装之后实现主机和虚拟机文件共享(共享软件选择)

文件共享很重要 有两种方式:使用FTP协议使用samba协议具体能用到的共享工具可以从WinSCP,Xftp, FileZilla中选择。

2020-10-31 11:40:16 234

原创 Linux的系统架构(linux由哪几部分组成?)

linux由以下几部分组成:内核bootloader文件系统shell应用程序下面分别来看:什么是内核?他是linux系统的核心 他往下链接硬件 网上链接应用程序什么是bootloader?一个单片机程序 用来引导系统启动什么是文件系统?有哪些文件系统?linux系统又ext3, ext4等等 与此相对照 windows有FAT32 NTFS等等什么是shell?shell是用户界面 提供了用户与内核进行交互操作的一种接口(就是说不需要你知道咋实现的 会用就行),之后会详细说什

2020-10-31 11:39:08 1569

原创 Linux常用的命令

常用的命令大约有二三十个 用多了就熟了 不记得了可以去查

2020-10-31 11:36:10 108

原创 Linux系统文件目录

这个目录是一个树状结构

2020-10-31 11:34:17 97

原创 Linux Vim

什么是Vim? 他是Linux里面一个很重要的编辑器但是所有操作必须通过命令行去完成 而且命令又很多很难记可以寓教于乐一下:https://mp.weixin.qq.com/s?__biz=MzU3NTgyODQ1Nw==&mid=2247485717&idx=1&sn=8a32ed14c5310e868957c4a053791850&chksm=fd1c7193ca6bf8856f1eb727455b1d918b0738ae790e2837c220aafe5c9c9c

2020-10-31 11:32:59 89

原创 Linux Shell常见的面试题(简单基础语法)

什么是shell脚本?一个Shell脚本是一个文本文件(就像是.py, .java文件一样),包含一个或多个命令。作为系统管理员,我们经常需要使用多个命令来完成一项任务,我们可以添加这些所有命令在一个文本文件(Shell脚本)来完成这些日常工作任务。(就像我们每次用git的时候把code推上去 都要搞一大堆命令一个接一个的输入)什么是默认登录shell?如何改变指定用户的登录shell?在Linux操作系统,**“/bin/bash”是默认登录shell,**是在创建用户时分配的。使用chsh命令可.

2020-10-31 11:24:25 1169

原创 Linux终端工具和编程工具选择

什么是终端工具?既可以利用终端工具远程到虚拟机进行操作。有哪些可以选择?MobaXterm, Xshell, Putty.什么是编程工具?这个不用多说了 但是有一点要说明:因为我们需要在windows上使用代码编辑工具编好 然后再Linux上进行编译。当然 我们可以在Linux下写代码 在linux下编译,比如可以用sublime text...

2020-10-31 10:40:50 145

原创 Linux环境搭建

两种方式 如果系统上已经装有Mac或者是windows,就安装虚拟机 如果没有 就直接在实体机上安装。两个虚拟机:VMWare, VirtualBox具体安装请参见其他教程

2020-10-31 10:28:51 105

原创 Linux有哪些要学习的东西?

从其中可以看出来 我现在水平还是 处在linux初级阶段,只会一些常用的命令,所以一些基本的东西我会在我的专栏linux中系统的讲解。总之 按照这个思维导图来就没有什么问题。

2020-10-31 10:26:22 290

原创 Java多态有什么好处?也就是说重写方法有什么好处?

这个就是理解错误了,多态的表现形式远远不止重写方法。多态可以分为变量的多态,方法的多态和类的多态变量的多态的表现形式是泛型(Generic),方法的多态就是我现在理解的多态(包括override and overload)类的多态:就是抽象类和接口...

2020-10-31 09:06:56 278

原创 What is the difference Put and Post and Get?

The difference between put and post: post create new resource and put means update resource.The difference between get and post: the parameters of get request are append behind the URL, and there are restrictions about the maximum length of URL. but the p

2020-10-30 02:37:26 158

原创 What is the difference between HTTP and HTTPs?

https is http with encryption. Https use SSL to encrypt normal http requests and responses.the post number of HTTP is 80 whereas HTTPs is 443

2020-10-30 02:28:47 191

原创 Java集合框架(Collection Frame)

虚点线是接口 虚线是抽象类 实线是普通类从图中可以看出来 Map, List, Set, Queue都是接口而stack, arraylist, linkedlist, hashtable, hashmap, hashset are the implement of those abstract classes.除此之外 注意右下角的的collections and arrays. 这两个实体类 提供了对collection进行排序和便利的多种算法实现 而arrays提供了对array进行排序和便利.

2020-10-30 02:28:32 156

原创 为什么hashtable不允许设置Null但是hashmap允许?

Why HashTable doesn’t allow null and HashMap does?To successfully store and retrieve objects from a HashTable, the objects used as keys must implement the hashCode method and the equals method. Since null is not an object, it can’t implement these methods

2020-10-30 02:26:35 721

原创 Java Comparable and Comparator

reference: https://www.geeksforgeeks.org/comparable-vs-comparator-in-java/这两者都是属于collection的一员。他们都是实现集合中的元素的比较排序的。下面分别来说:Comparable是一个接口 任何类 只要想实现实例之间的比较 比如说整数类(但是字符串类就是一个反例)都要implement Comparable,然后需要在类的内部实现compareTo的方法。如果我们就按照定义好的比较方法来比较 那么就是默认比较方法 所

2020-10-29 10:15:59 120

原创 我们为什么需要获取器(Getter)和设置器(Setter)?

为什么要设置这两个看起来没有用的东西?因为这两个东西是非常有用的 有用在哪呢?有用在给我们的类的属性变量加上锁 使得不是谁想拿就拿 谁想设置我们的属性就乱设置的。而是我们允许他们拿他们才可以拿 允许设置他们才可以设置 而且还可以规定设置的在我们要求的合理范围之内。可是这些不是private该干的活吗?设置了private 其他的谁都拿不到了 可是这也意味着 既不能访问也不能修改。所以这就是getter和setter的优势所在。允许你修改才能修改 允许你访问你才能访问。而且就算你修改了 我也可以限制你的

2020-10-29 10:15:47 411

原创 SOLID Principles

It’s a very important principle in OOP.Single responsibility : every single class should just do one thingOpen closed: extension but not modificationLiskov substitution: any instance in any place, we can just replace it with it’s subclass instance witho

2020-10-29 10:15:36 118

原创 究竟什么是数据库索引?一句话

Indexing is a data structure that store all the values of a column, and whenever it’s necessary, we can search s specific value very fastthat’s why we are using B+ tree to do the indexing in MySQL

2020-10-29 10:15:13 116

原创 Stream in Java8

Stream is the enhancement of Collection package, it focuses on providing convenient aggregate operation for the elements in collection. So it is not a datatype or anything, it is about algorithms, it’s like an advanced Iterator. The original iterator can o

2020-10-29 10:14:59 187

原创 Three ways to create Multi Thread in Java

Extend thread class, implement runnable, callable

2020-10-29 10:14:45 114

原创 HTTP working process and its status code

It’s a protocol that can make hyper text from server to web browser: it’s a protocol based on TCP/IP.The http request: request line, header, the data requested.The http response: status line, info head, and the html partHttp status code:1: information

2020-10-29 10:14:29 154

原创 What is checked and unchecked exceptions?

https://blog.csdn.net/kingzone_2008/article/details/8535287Most people use unchecked exceptions.Checked exception: try catch throwUnchecked exception: runtime exception, there are some common runtime exception: arithmetic exception, classcast exception,

2020-10-29 10:14:15 164

原创 final/finalize()/finally keywords in Java

Final keyword can be used with class, method and variable. A final class can’t be instantiated, a final method can’t be overridden, and a final variable can’t be reassigned.Finally keywords are used to create a block of code that follows a try block. A fi

2020-10-29 10:13:59 111

原创 Synchronized and Volatile keywords in Java

Volatile is a field modifier, while synchronized modifies code blocks and methods.When we use the regular variablegeti1() accesses the value currently stored in i1 in the current thread.(there are many thread for a single variable, because each thread h

2020-10-29 10:13:44 103

原创 Transaction in Database? ACID. 什么是数据库事务?

A transaction symbolizes a unit of work performed within a database management system, and it is independent with other transactions but they are coherent and reliable. So in short, it represents any changes in the database.It has four properties: ACIDAt

2020-10-28 07:40:13 176

原创 SQL Join, Inner Join, Outer Join, Left join

Join == inner join, it selects records that have matching value in both tables.Outer join equals to full join: it returns all the records when there is match in left and right table records.Left join returns all the records from the left table and the ma

2020-10-28 07:35:16 62

原创 数组和链表到底有什么区别?What is the difference between linkedlist and arraylist?

different implementationarraylist uses dynamic array and linkedlist uses doubly linkedlistdifferent storage ways:arraylist stores its elements in memory consecutively, but linkedlist don’t have to because of the pointers.different interface it implem.

2020-10-28 07:28:02 183

原创 Java普通类,抽象类和接口的区别?The difference between ordinary class, abstract class and interface?

Abstract class have abstract and concrete methods, but interface can only have abstract methods.Regular class use class keyword to claim but abstract class us abstract class, and the interface uses the keyword: interface.Regular class can extend regular

2020-10-28 06:59:00 157

原创 Java三大特性:封装 继承 多态 各自用一句话总结

Encapsulation: we hide the details of implementation, and we only allows the user to use what we want them to use. it enhances the security and simplified the process so the user won’t have to understand all the details before use it.Inheritance: based o

2020-10-28 06:53:05 249

原创 Lambda in Java8

Lamda表达式又称为闭包 是JAVA8的新特性,它允许把函数作为参数传递到方法种而且lamda表达式的写法可谓是相当方便 大大简化了函数的书写方式There are some very important properties:Optional datatype claim: we don’t need to claim the data type of parametersOptional bracket of parameters: if we only have one parameter

2020-10-28 06:42:46 127

原创 Is Hashmap thread safe? how to make it thread safe?

It is not thread safe. because when we use put/get, or put/put the same time, there will be problemshow to make it safe? don’t use them, instead, use collections.synchronizedMap() or concurrentHashMap or hashtable.but not many people use hashtable, becau

2020-10-28 01:53:23 156

原创 What is REST and RESTful API?

REST represents for the representational state transfer, it’s the core idea of resource objected architecture. It define the whole net system structure from the perspective of resource. It sepreate the resource, the appearance of resource and the action of

2020-10-28 01:31:56 208

原创 Java异常处理中throw与throws的用法区别

我们都知道 try catch finally 语句,就是说我们对try里面的语句是存有疑问的 一旦这段代码不能运行 那么我们就会在catch中处理异常。然后我们会把其他不管异常是否存在都要执行的代码放到finally里面。而且我们也知道 throw/throws是用来抛出异常的,那么他们之间有哪些不同呢?首先我们来看一下他们的不同的作用位置:throws写在方法的声明上面,表示此方法不处理异常(我们不在这个函数里面处理异常,b表示我们不会自己去写try catch语句) 而是在调用此方法的时候会(

2020-10-28 00:25:58 273

原创 如何创建自定义异常?(How to create custom exceptions in Java?)

class WrongInputException extends Exception { // 自定义的类 WrongInputException(String s) { super(s); }}class Input { void method() throws WrongInputException { throw new WrongInputException("Wrong input"); // 抛出自定义的类 }}clas

2020-10-28 00:02:09 585

原创 构造函数和析构函数(constructor and destructor)

构造函数是绝大多数面向对象编程的语言都有的,其目的就是为用户初始化一个新的对象。比较正规一些的定义是:类的构造函数是类的一种特殊的成员函数,它会在每次创建类的新对象时执行。而析构函数的定义如下:类的析构函数是类的一种特殊的成员函数,它会在每次删除所创建的对象时执行。简单明了。但是由于Java Python等语言拥有自己的垃圾回收机制 可以自动的进行垃圾回收,所以并不需要析构函数 而想C或者C++ 需要自己进行垃圾回收,所以析构函数很重要...

2020-10-27 23:41:45 473

原创 Convert char to String(Java)

String.valueOf(Object obj)Character.toString(char c)

2020-10-26 11:26:35 206

原创 MapReduce用的机器越多越好吗?

当然不是。机器数量增加的好处:每台机器负载就越少 速度 也更快机器数量增加的坏处:启动时间增加,而且增加是有上限的 就是说最多是key的数目

2020-10-25 23:08:29 130

原创 MapReduce常见问题

mapper和reducer使用时工作吗?mapper结束了reducdder才能运行如果有个mapper或者reducer挂了怎么办?重新分配一台机器如果reducer的一个机器的Key特别大怎么办?加一个random后缀 类似shard keyinput和output存放在哪里?存放在GFS中Mapper和reducer可以放在同一台机器上吗?这样实际不是特别好 因为map和reduce之前都有许多要预处理的工作 两台机器可以并行预处理。...

2020-10-25 23:07:31 355

原创 System design of WhatsApp/Message/WeChat(4S)

设计一个即时聊天系统Scenario: 都是设计什么功能?登陆注册通讯录两个用户互相发消息多个用户互相发消息用户的在线状态其他高级功能:历史消息和多设备登录然后要设计的多牛批?1B MAU 750M DAUAverage QPS and peak QPS为了储存相关信息 每天会新增多少使用空间?service:Message service:信息的管理real-time service:信息的推送storage:我们肯定需要message table.但是如果我们想差一些

2020-10-25 23:06:04 273

原创 HTTP Protocol

http: hyper text transfer protocol, it is a protocol that let the hyper text from server to client.it’s based on TCP/IP

2020-10-25 23:05:28 74

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除