自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

安静的程序猿

Hold on well at the current situation,look forward to the future...

  • 博客(171)
  • 资源 (4)
  • 收藏
  • 关注

原创 excel orm

excelPackage excel provides simple usage for reading excel to structsand the sheets in the excel need to have the same structure.go get github.com/tangximing/excelScan rows to datavar excelPath stringf, err := NewExcelFromFile(excelPath, HeaderRow(2

2022-04-19 20:09:15 211

原创 ddl2struct

Welcome to ddl2struct !!!Generate Golang Struct File From DDL.Install$ go get github.com/tangximing/ddl2structUsage$ ddl2struct -hgenerate golang struct file from ddlUsage: ddl2struct [flags]Flags: -d, --dir string golang dir to gener

2022-04-19 20:07:44 216

原创 分布式唯一ID生成方案

全局唯一ID使用场景分布式系统设计时,数据分片场景下,通常需要一个全局唯一id;在消息系统中需要消息唯一ID标识来防止消息重复;多系统打通需要一个全局唯一标识 (如集团各业务线面对不同用户,需要一个全局用户id)。如何生成一个全局唯一id?UUID概述Universally Unique Identifier 是自由软件基金会组织制定的唯一辨识ID生成标准,大多数系统已实现,如微软的GUID实现。生成格式如:3d422567-f034-4ab4-b98f-a34fd263d0de

2021-03-02 11:00:02 105

原创 密码学

对称加密算法非对称加密算法非对称加密:加密密钥与解密密钥成对出现,一般为私钥和公钥。私钥用于签名或加密;公钥用于验签或解密。RSA密钥生成OpenSSL明文生成命令如下:## generate private key without passwordopenssl genrsa -out rsa.key 2048## export public keyopenssl r...

2019-11-16 18:13:18 1528

原创 Negroni源码分析

#简介代码库地址:https://github.com/urfave/negroni在 Go 语言里,Negroni 是一个很地道的 Web 中间件,它是一个具备微型、非嵌入式、鼓励使用原生 net/http 库特征的中间件。在解析Negroni之前,先看一下正常http Server的处理逻辑:其中Listen&Accept在net/http中实现,具体不在此描述。本文重点...

2019-11-16 18:11:41 144

原创 Go Proxy搭建

Go-Get 原理不论是否开启Go Module功能,go get从版本控制系统VCS中取包的基础过程是类似的。假设依赖包github.com/liujianping/foo不在本地,需要通过go get获取。发起以下命令:go get github.com/liujianping/foo正则匹配出依赖包的查询路径go get可以指定具体包的import路径或者通过其自行分析代码中的im...

2019-11-16 18:11:04 899

原创 GO Plugin 编译问题

GO Plugin 编译问题初始问题现在用go mod和docker multi-stage生成的plugin在workflow中加载的时候,会遇到plugin与workflow用到的共用package(如:github.com/pkg/errors)版本不一致导致plugin加载失败。问题追踪运行时plugin.open(): https://golang.org/src/plug...

2019-11-16 18:10:00 3480

原创 J.U.C — Locks — ReentrantLock(二)

条件变量ConditionCondition实现了synchronized同步器的wait/notify/notifyAll的功能,Condition接口提供的API如下:Condition需要与Lock绑定,一个Lock可以有多个Condition,获取Condition的方式是lock.newCondition()。Condition的实现类在AQS中的Cond

2017-05-14 12:50:46 366

原创 J.U.C — Locks — ReentrantLock(一)

整体结构公平锁和非公平锁 如果获取一个锁是按照请求的顺序得到的,那么就是公平锁,否则就是非公平锁。     公平锁保证一个阻塞的线程最终能够获得锁,因为是有序的,所以总是可以按照请求的顺序获得锁。     不公平锁意味着后请求锁的线程可能在其前面排列的休眠线程恢复前拿到锁,这样就有可能提高并发的性能。     这是因为通常情况下挂起的线程重新开始与它真正

2017-05-11 23:52:26 296

原创 J.U.C — Collections — CopyOnWrite****

背景1.J.U.C 中主要由CopyOnWriteArrayList和CopyOnWriteArraySet(后者底层基于前者实现,add时调用前者的addIfAbsent方法保证不重复)。其基本思路是,从一开始大家都在共享同一个内容,当某个人想要修改这个内容的时候,才会真正把内容Copy出去形成一个新的内容然后再改,这是一种延时懒惰策略。  2. CopyOnWriteArray

2017-05-11 23:10:17 318

原创 J.U.C 研究之旅

背景不忘初心、坚持探索…..Java并发框架总体结构

2017-05-11 22:42:53 610

原创 TCP/IP三次握手与四次挥手

TCP传输控制协议,是面向连接的、可靠的数据流传输(可靠);UDP提供的是非面向连接的、不可靠的数据流传输(速度快)。图解TCP与UDP的三次挥手与四次挥手的过程三次握手:       所谓三次握手(Three-Way Handshake)即建立TCP连接,就是指建立一个TCP连接时,需要客户端和服务端总共发送3个包以确认连接的建立。整个流程如下图所示:  (1)第

2016-04-16 11:21:26 361

原创 Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 andn (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate numbe

2015-11-17 21:13:03 1194 1

原创 Missing Number

从一组非负整数中找出缺少的数,比如[0,1,3],缺少2

2015-11-15 13:47:26 864

原创 Basic Calculator

Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and em

2015-11-13 23:16:16 439

原创 Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in

2015-11-06 22:32:05 433

原创 Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",

2015-11-04 18:03:28 753

原创 Word Pattern

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in st

2015-10-29 22:28:48 500

原创 进程管理

进程管理

2015-10-25 12:39:53 401

原创 Pow(x, n)

Implement pow(x, n).注意:n可能小于0错误:pow(x,n) = x * pow(x,n - 1)栈溢出代码:public class Solution { public double pow(double x, int n) { if(n == 0) return 1; if(n < 0)

2015-04-18 19:47:13 536

原创 Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the fol

2015-04-18 09:07:50 411

原创 Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3

2015-04-16 17:19:55 360

原创 Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].解法:用栈来做,先将父节点入栈,再将右孩子

2015-04-16 17:14:59 495

原创 Regular Expression Matching

'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype should be:bool isMatch(c

2015-04-16 17:05:06 425

原创 Anagrams

Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.题意:找出一组字符串中是满足回文构词法(字符串中字符相同,但是顺序不同)的字符串数组。思路:对字符串数组中的每个字符串按字符排序,通过得到的字符序列来判断

2015-04-16 16:58:14 427

原创 Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa"

2015-04-01 13:35:52 360

原创 windows+Android studio+ndk

1. 配置环境:         windows 8.0/64         Android studio 1.1.0         ndk 10randroid studio 安装过程就不在此赘述了。2.ndk下载https://developer.android.com/tools/sdk/ndk/index.html#Installing3.新

2015-03-31 11:19:17 602

原创 Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 0000

2015-03-12 10:21:12 338

原创 hadoop-2.5.1虚拟机上集群安装

0. 服务说明NameNodeNameNode是HDFS的守护程序,负责记录文件是如何分割成数据块的,以及这些数据块被存储到哪些数据节点上。它的功能是对内存及I/O进行集中管理。 DataNode集群中每个从服务器都运行一个DataNode后台程序,后台程序负责把HDFS数据块读写到本地文件系统。需要读写数据时,由NameNode告诉客户端去哪个DataNode进行具体

2014-12-05 22:00:37 570

原创 eclipse + hadoop 远程文件操作中出现的问题

前提:项目中导入了需要的hadoop包(hadoop-2.5.1/share/)

2014-11-01 15:40:46 858

原创 Find Minimum in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in

2014-10-29 21:24:47 451

原创 Orange'S学习笔记(一)

学习环境:     Ubuntu 12.04 +

2014-10-21 23:48:30 523

原创 二叉树的前序·中序·后序遍历

二叉树的非递归遍历         二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的。对于二叉树,有前序、中序以及后序三种遍历方法。因为树的定义本身就是递归定义,因此采用递归的方法去实现树的三种遍历不仅容易理解而且代码很简洁。而对于树的遍历若采用非递归的方法,就要采用栈去模拟实现。在三种遍历中,前序和中序遍历的非递归算法都很容易实现,非递归后序遍历实现起来相对来说

2014-10-12 11:13:48 1244 1

原创 ubuntu 12.04 LTS 单网卡多节点搭建openstack

搭建环境:               系统:ubuntu 12.04 desktop LTS               控制节点(Control node:server1):192.168.8.44(200G的主分区+ 10G的Swap分区 + 200G + 200G)               注:其中200G用于nova-volumes,另外200G用于swi

2014-10-08 18:57:50 2157

原创 Subsets

Given a set of distinct integers, S, return all possible subsets. Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exam

2014-10-05 12:37:41 524

原创 Combinations

Given two integers n and k, return all possible combinations ofk numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [1,3], [

2014-10-05 12:34:11 533

原创 Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers

2014-10-05 12:32:05 433

原创 Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2014-10-05 12:28:53 479

原创 Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.题意:有一个m*n的二维数组,

2014-10-05 12:26:21 513

原创 Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?题意:

2014-10-05 12:21:16 409

jsp图片显示插件

用于显示图片的插件,支持图片的弹窗显示。

2014-04-03

MP3播放器源程序

这是用visual c#.net 开发的MP3程序

2012-05-12

黑客攻防与入门

该文档时对黑客攻防的相关讲解,便于初学者入门

2012-03-01

数据结构题集

该文件中包含很多数据结构的相关题集,代码都比较详细

2012-03-01

空空如也

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

TA关注的人

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