原创 BKDRHash 算法java實現

背景: BKDRHash算法是字符串hash算法。是一種簡單快捷的hash算法。java的繼承Object類的提供的hashCode()函數也是採用這種hash算法。下面使用100000個不同字符串產生的衝突數,大概在0~3波動,

原创 【源碼閱讀】修改elasticsearch源碼並且編譯打包

前言 相信很多人在啓動elasticsearch 5版本以上的應用過程中曾被以下錯誤終止啓動了。 max virtual memory areas vm.max_map_count [%d] is too low, increas

原创 【基礎算法】大數加法

##C++ #include <bits/stdc++.h> #define rep( x, a, b ) for ( int x = a; x != b; ++x ) #define clr( x, val ) memset(

原创 給定一個隨機數範圍,產生另一個隨機數範圍

#include <bits/stdc++.h> using namespace std; int rand6(){ return rand()%6+1; } int rand7(){ int i = (rand6()-1)*6+

原创 【前端技術】window搭建react-native開發環境

源碼鏈接:https://github.com/phypor/react-web-demo 1.設置下載器配置和安裝依賴包 npm config set registry https://registry.npm.taobao

原创 【桌面應用】nw.js 開發跨平臺應用(2)使用nw打包項目

我們在上一篇文章中用vue-cli創建了一個的項目,並且使用nw 打開某個鏈接,這次我們講述如何使用nw打包一個vue-cli創建的項目。 進入vue項目後,我們可以使用npm run dev 打開8080端口訪問頁面,在使用

原创 【桌面應用】nw.js 開發跨平臺應用(1)部署開發環境

node.js 下載頁面https://nodejs.org/en/download/ nw.js 下載頁面 https://github.com/nwjs/nw.js 或者https://nwjs.io/ 以下是mac系統下

原创 【基礎算法】利用priority_queue實現top K

#include <bits/stdc++.h> using namespace std; class fix_priority_queue { int max_size; priority_queue <int, vec

原创 sysbench fileio 基準測試

sysbench介紹 源碼地址:https://github.com/akopytov/sysbench sysbench is a scriptable multi-threaded benchmark tool based o

原创 【基礎算法】走10級樓梯題目解法總結

#include <bits/stdc++.h> using namespace std; //遞歸 int handle1(int N){ if(N == 1) return 1; if(N == 2) return 2; i

原创 【前端技術】ztree.js 擴展name自定義格式

場景: 樹的節點名字需要顯示一些額外的信息。比如名字是 阿里雲(100) 100這個是我當前節點的內容之一,目前由於ztree沒有支持render回調函數,沒法拼接內容得到。 下載ztree js源碼,可以知道樹節點的顯示

原创 【前端技術】基於nodejs開發的web工程開啓代理轉發功能

背景: web開發中,我們需要訪問mock server則需要把web中所有請求代理到mockserver中。 在啓動web開發模式的腳本中,添加以下代碼。其中a-api是一個訪問路徑。 const proxy = require

原创 【基礎算法】求全排列的方法

##深度優先法 #include <stdio.h> int sum = 0; int n; int in_hand[10]; int tmp[10]; void dfs(int in_) { if(in_ == n+1) {

原创 動手創建一個Docker鏡像

1. 拉取centos基礎鏡像 執行 docker pull centos:7.2.1511。 2. 創建Dockerfile文件 創建一個新目錄,然後增加以下內容到Dockerfile文件裏面。 FROM centos:7.2.