Posts

My workbench and Productivity tools

Hardware Laptop Mobile Phone Accessories Software Laptop Apps iOS Apps Cloud-based Apps Hardware Laptop Acer R11 Chromebook(11.5 inch, 2018) Information: 2018 year 11.6” HD (1366 x 768) 16:9 IPS 4

Writing technical content in Academic

Academic is designed to give technical content creators a seamless experience. You can focus on the content and Academic handles the rest. Highlight your code snippets, take notes on math classes, and draw diagrams from textual representation.

算法分析与设计-优先级队列

优先级队列 优先级队列:队列中的元素带有优先级,元素按照优先级

Linux Basic Concepts

VFS 文件系统 VFS 是一个软件层,用来处理与 Unix/Linux 标准文件系统相关的所有

Linux Bluetooth Setting

Introduce [I ran into this issue on my Lenovo P51 running Ubuntu 18.04, and I discovered that the pactl module “module-bluetooth-discover” was not loading properly at boot time. I fixed the issue by replacing it with “module-bluez5-discover” in my pulse configuration.

Algorithm part I Hash Table

Hash Table There are four part we need to talk about the Hash-Table: Hash Function, Separate Chaining, Linear Probing and Context Hash tables, a data structure that achieves constant-time performance for core symbol table operations, provided that search keys are standard data types or simply defined.

Display Jupyter Notebooks with Academic

Learn how to blog in Academic using Jupyter notebooks

Leetcode Algorithms. Binary Search

All the pictures in this post are coming from the video: 花花酱 LeetCode Binary Search - 刷题找工作 SP5 Summary The feature for the Binary

A 2-D Shooting Game

I would like to build a 2D game with the hero game. This game should have these features. (Sprite source: The images which in the asset are all comes from Google image and they all for free.

Algorim Lecture 2-Amortized Analysis

Amortized Analysis: Adding Things in Smart ways. Lots of analyses get easier when you add things together after re-grouping them in smart ways. Introduce Example: Think about an Algorithm from the Perspective of a Data Element… Example: Merge Sort

C++中两个类相互引用的情况

Question 现在有两个类A和B需要定义,定义A的时候需要用到B,定义B

面试题:使用一个stack实现Queue

Question You are given a Stack data structure that supports standard push and pop operations. You need to implement Queue data structure using one Stack instances. Picture From: Implement Queue

Mirai源代码分析1--Loader的工作过程

前言 The Mirai internet of things (IoT) botnet is infamous for targeting connected household consumer products. It attaches itself to cameras, alarm systems and personal routers, and spreads quickly.

synergy局域网共享鼠标键盘软件教程

Introduce synergy可以实现 mac / linux / windows三个操作系统之

C++ vector push_back() Vs emplace_back

Introduce

std::vector::push_back()

Appends the given element value to the end of the container.

  • The new element is initialized as a copy of value.
  • value is moved into the new element.

If the new size() is greater than capacity() then all iterators and references (including the past-the-end iterator) are invalidated. Otherwise only the past-the-end iterator is invalidated. (Cite from: cppreference.com)

2-D Game Engine Construction (CU CPSC6160)

2D游戏引擎设计这门课程是我在CU的2018 Fall选修的一门专业核心课程,老师是Clemson CS系比较受欢迎的 Brian Malloy教授

Paper Reading list

Network relation Kitsune: An Ensemble of Autoencoders for Online Network Intrusion Detection [ PDF] [ Slide] [ Video] Cloud Computing

Translation of Programming Languages(CU CPSC8270)

编译原理这门课程是我在CU的2018 Fall选修的一门专业核心课程,老师是Clemson CS系比较受欢迎的 Brian Malloy教授。在他的个人主页上面也有Python, C++, 2D游戏的教程,非常适合对CS感兴趣的同学学习。

Algorithm Introduce 2 - Abstract Data types and Hash Tables

Abstract Data Type What is the abstract data type? Specification of a data structure in terms of the operations it needs to support. Just a concr

C++软件设计模式之Singleton

什么是Singleton? 单例模式(Singleton),保证一个类仅有一个实例,并提供一个访问它的全局访问点。

可以考虑在下面的一些场景中应用:

  • Windows的Task Manager(任务管理器)就是很典型的单例模式(这个很熟悉吧),想想看,是不是呢,你能打开两个windows task manager吗? 不信你自己试试看哦~ 
  • windows的Recycle Bin(回收站)也是典型的单例应用。在整个系统运行过程中,回收站一直维护着仅有的一个实例。
  • 网站的计数器,一般也是采用单例模式实现,否则难以同步。
  • 应用程序的日志应用,一般都何用单例模式实现,这一般是由于共享的日志文件一直处于打开状态,因为只能有一个实例去操作,否则内容不好追加。
  • Web应用的配置对象的读取,一般也应用单例模式,这个是由于配置文件是共享的资源。
  • 在数据库连接池的设计一般也是采用单例模式,因为数据库连接是一种数据库资源。数据库软件系统中使用数据库连接池,主要是节省打开或者关闭数据库连接所引起的效率损耗,这种效率上的损耗还是非常昂贵的,因为何用单例模式来维护,就可以大大降低这种损耗。
  • 多线程的线程池的设计一般也是采用单例模式,这是由于线程池要方便对池中的线程进行控制。
  • 操作系统的文件系统,也是大的单例模式实现的具体例子,一个操作系统只能有一个文件系统 上述内容来自于: 单例模式的常见应用场景

单例模式应用的场景一般发现在以下条件下:

  • 资源共享的情况下,避免由于资源操作时导致的性能或损耗等。如上述中的日志文件,应用配置
  • 控制资源的情况下,方便资源之间的互相通信。如线程池等。