Decorative image frame

Solito

Buring silence in SHA.

Solito

Mini-program project demo for starter

demo program

  1. 我要圣诞帽
    https://github.com/jasscia/ChristmasHat
    图片编辑,存图

  2. 掌故
    https://github.com/Gesangs/PhoneStory
    新闻推送

  3. 简约睡眠Music
    https://github.com/shajinyang/BeautyAudio
    音乐播放器

  4. 运势小程序
    https://github.com/panyefan/wxfortune
    测运势,存图

  5. 跑马灯,左侧菜单,抽屉层,加载动画
    https://github.com/youzouzou/wxapp
    小程序组件合集

    Read More...

NBI & SBI

Northbound Interface

NBI conceptualizes lower level details (e.g. data or functions) used by, or in the component. It interfaces to higher level layers and is normally drawn at the top of an architectural overview.
e.g. REST API, SMMP, CORBA, SNMP
北向接口,用于接口编程开发各app,采集、分析app在运行中产生的各种数据,因网络管理中从上而下分应用层、数据处理层、数据管理层,北向接口即应用层和数据处理层之间的数据交互定义接口(见下图),因为朝上(上北下南)称北向接口。

Southbound Interface

A southbound interface decomposes concepts in the technical details, mostly specific to a single component of the architecture. Southbound interfaces are drawn at the bottom of an architectural overview.
e.g. OpenFlow, NETCONF, XMPP

Read More...

Send batches of data creation requests to http server via Shell

In order to test the data pool volume, send over 60000 creation data to server.
Shell Script:

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
a=1

while [ $a -le 60000 ]; do # start from 1, end by 60000
json="{\"areas\":[{\"new\":[58,60,57],\"id\":\"$a\", \"center\":[-39,49],\"name\":\"$1$a\",\"Version\":\"1.0\"}";

a=$((a+1))

curl -v -X POST -H "Content-Type: application/json; charset=UTF-8" -H "Cookie: sessionId=_____" http://url -d "$json";

done

Mind the syntax especially the space, "" and '', using \ for escaping “” inside json to avoid syntax error.


other materials:

  1. curl 的用法指南

Gson LinkedTreeMap

Problem

Given a Gson object with format LinkedTreeMap<String, String>, e.g.:

1
2
3
4
5
6
LinkedTreeMap<String, String> misc = {
misc1: misc_site,
misc2: misc_sector,
misc3: null,
misc4: null
}

I got the HashMap with

1
2
3
4
5
{
misc: null
}
and
{}

And pass case assertThat(misc).isNull(); is what I expected. Unfortunately both were deleted not Null.
I try to transform the type into HashTable but got:

1
ERROR: com.google.gson.internal.LinkedTreeMap cannot be cast to java.util.Hashtable
Read More...

File Upload and Display

input [type=file] 获取上传文件的内容

Modify:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
_addFileContent: function (fileTag) {
fileTag.addEventHandler("click", function () {
$("#fileUpload").change(function () {
var file = document.getElementById("fileUpload");

if (file.files.length > 0) {
var trueFile = file.files[0];
console.log(document.getElementById("fileContent").value);
var reader = new FileReader();

reader.readAsText(trueFile, 'UTF-8');

reader.onload = function () {
if (reader.error) {
console.log(reader.error);
} else {
var urlData = this.result;
document.getElementById("fileContent").value = urlData;
}
};
} else {
console.log("Failed to upload file!");
}
});
});
}

Other ref:
Change event | MDN

Some tips about OpenLayer

Using openlayer in work currently and need to write down some notes about it.

EPSG 4326 VS EPSG 3857

地理Coordiante系统由EPSG编号标识。最常用于网络地图应用的两个坐标系统是EPSG:4326和EPSG:3857。

  • EPSG:4326(又名WGS84,未投影)是一个地理的非项目坐标系。它是lat,longs GPS显示器,单位是十进制度。EPSG:4326无法在平面地图上以有意义的方式显示。
  • EPSG:3857(又名Pseudo-Mercator,球形墨卡托或Web墨卡托)是投影坐标系。这是Google Maps和几乎所有其他Web制图应用程序使用的坐标系。

通常,数据存储在EPSG:4326中并显示在EPSG:3857中,自行转换。

ref link

Read More...

WebUploader

Using WebUploader as 3pp to upload files to system.

1. 初始化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 仅包含了常用参数
var uploader = new WebUploader.Uploader({
duplicate: true, // 是否允许重复文件 default undefined
auto: false, // 选完文件后,是否自动上传
swf: 'path_of_swf/Uploader.swf', // swf文件路径
server: "/upload.html", // 文件接收服务端
pick: { id: "#uploadFile", innerHTML: "localImg" }, // 选择文件的按钮。可选
accept: { // sample, 只允许选择图片文件
title: 'Images',
extensions: 'gif,jpg,jpeg,bmp,png',
mimeTypes: 'image/*'
},
threads: 1, // 线程数
fileSingleSizeLimit: 2000, // 单文件大小限制
fileNumLimit: 10, // 单次上传文件数量限制
fileSingleSizeLimit: // 验证单个文件大小是否超出限制, 超出则不允许加入队列
compress:false, // 是否压缩上传
chunked: true, // 是否要分片处理大文件上传, default false
chunkSize: 5242880, // 如果要分片,分多大一片? default 5242880 (5M)
chunkRetry: 1, // 如果某个分片由于网络问题出错,允许自动重传多少次? default 2
threads: 1, // 上传并发数。允许同时最大上传进程数 default 3
formData:{}, // 文件上传请求的参数表,每次发送都会发送此对象中的参数
method: 'GET', // POST or GET, default POST
});
Read More...

Promise

js async - Promise

How Promise works is that, each async task will return result and construct a Promise instance, and each instance has a then, which is used for directing to next callback func.
Here is a simple promise example:

1
2
3
4
5
6
7
8
9
function f1(resolve, reject) {
// async codes here..
}

var p1 = new Promise(f1); // f1 is an async callback function/task,
// promise instance p1 receives f1's result

// when f1 is done, do f2
p1.then(f2); // f2 is the next async func to be executed
Read More...

ES6 - Template strings

刷题的时候遇到了这个新语法 - 模板字符串,记录一下用法。

是增强版的字符串,用反引号(`)标识。主要用法:

  1. 作为普通字符串使用

    1
    `string text`
  2. 定义多行字符串

    1
    2
    3
    4
    console.log(`string text line 1
    string text line 2`);
    // "string text line 1
    // string text line 2"
  3. 在字符串中嵌入变量

    1
    2
    let expression = "xxxx";
    `string text ${expression} string text`
    Read More...

CDT Learning

Skeleton

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my-app/
.cdt # installed lib and conf,do not modify
help/ # help docs
locales/ # translation files
resources/ # imgs & other resources that are not js files
src/ # src code. Contains only one folder (my-app)
my-app/ # name = app name, fully lowercase
test/
bit/ # FT, API concerned only
unit/ # UT
.editorconfig # coding styles,已删
.gitignore
app.config.js # metadata for app
build.json # used by the build module
container.config.js # only for dev, never used in production, contains dev version of container
Read More...