Giter VIP home page Giter VIP logo

blog's People

Contributors

shyangs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

blog's Issues

清單: Online Tools / Online Service / SaaS

DNS

ip 說明 / 備註
168.95.192.1 (hntp1.hinet.net) Hinet
168.95.192.2 (hntp3.hinet.net) Hinet
168.95.1.1(dns.hinet.net) Hinet
1.1.1.1 CloudFlare
8.8.8.8 Google
8.8.4.4 Google
9.9.9.9 Quad 9
101.101.101.101 Quad 101 是由 TWNIC 所設立的免費 DNS 解析服務
101.102.103.104 Quad 101

參考

查 IP 資訊

Service 說明 / 備註
IPinfo.io
InfoByIp.com

縮網址, 短網址

Service 說明 / 備註
TinyURL.com TinyURL
百度短网址 百度短网址

轉碼, 加密, 解密

Service 說明 / 備註
HTML Entities Converter Escapes/Converts Special Characters in Text to HTML Entities
r12a.github.io/app-conversion/ Unicode code converter 字元編碼
Online Tools Hash、Checksum、Encode / Decode 線上工具
chacuo.net 在线加密解密工具; AES, DES, RSA...
海姹网 在线AES加解密
Keylala在线工具 aes在线加密解密
MD5 Hash Generator Online MD5 Hash Generator
www.base64decode.org Base64 Decode and Encode - Online

字典

Service 說明 / 備註
Unicode查詢 Unicode查詢 - 國家發展委員會之「CNS11643中文標準交換碼全字庫」(簡稱全字庫)網站
國際電腦漢字及異體字知識庫

JSON

Service 說明 / 備註
https://codebeautify.org/jsonminifier JSON Minifier
https://www.cleancss.com/json-minify/ JSON Minify
https://jsonlint.com/ JSON Validator
http://json-schema-validator.herokuapp.com/ JSON Schema validation online
https://jsonschema.net/home JSON Schema Tool / JSON Schema Generator

時間

Service 說明 / 備註
EpochConverter Epoch & Unix Timestamp Conversion Tools
Online Clock Online Clock

Online Notes Sharing

Service 說明 / 備註
notepad.pw Save your notes online for free and share them with friends!
notes.io Online Notes Service. Notes.io is a online note taking app. You can take your notes and share with others by providing the shorten url to a friend.
shrib.com

網路硬碟 (网盘)

Service 說明 / 備註
Firefox Send
TMP.link 免费的文件分享工具 TMP.link - 少数派, 锋潮评测室
奶牛快傳 不限速、不需帐号就能用的网盘服务,奶牛快传值得一试 - 少数派
文叔叔 小於20M的檔案下載不限次數
uplovd.com
WeTransfer WeTransfer 可使用 Email 分享並追蹤的檔案分享空間,單檔 2GB 保存七天

Online Compiler

Service 說明 / 備註
rextester.com
Compile and Execute Java Online

硬體資訊

CPU

Service 說明 / 備註
PassMark Software - CPU Benchmark Charts

GPU / 顯卡

Service 說明 / 備註
GPU Specs Database -TechPowerUp TechPowerUp 發佈過軟體 GPU-Z

網站狀態 GFW / Website Down or Not?

Service 說明 / 備註
China Firewall Test Test if any site is blocked by the Great Firewall of China in real time. GFW.
Test if a site is blocked in China - Comparitech
Down for Everyone or Just Me
Is it down or just me? Let us help you find out if a website is down for everybody or if it's just you.

掃毒

Service 說明 / 備註
VirusTotal
Kaspersky Threat Intelligence Portal

軟體

See #9

其他

Service 說明 / 備註
JSCompress JavaScript Compression Tool
File Extensions Information For Windows Find which Windows software can open a file with specified extension 查詢特定副檔名的資訊,和可以用哪個軟體開啟.
Graphemica 找特殊符號的英文名和詳細資料
Emojipedia
Emoji中文百科(顏文字詞典) Emoji中文百科(顏文字詞典)
EmojiAll Emoji表情符號詞典
svgicons.sparkk.fr SVG Icons
FileFormat.Info
online-convert.com convert video, images, audio and documents for free
Caniuse test page
Features Detection - BrowserLeaks.com Features Detection - Modernizr Helper - All Browser Features Detections in One Page
StackShare Software and technology stacks used by top companies
Fancy Font Fancy Font (unicode); Mathematical Alphanumeric Symbols. These characters were added to Unicode primarily for mathematicians to write equations. 𝖊, 𝕖, and 𝓮 could mean different things, so it’s crucial the styles stay the same, no matter where they appear.

Fonts

格式

副檔名 Name caniuse 說明 / 備註
.ttf TrueType
.ttf, .otf OpenType
.svg, .svgz SVG Font
.eot Embedded OpenType
.woff Web Open Font Format
.woff2 Web Open Font Format

Icon Fonts

Name 🏠 License 說明 / 備註
GLYPHICONS 🏠 The glyphicons you see in Bootstrap are part of a set called Glyphicons Halflings and were created by the very talented Jan Kovařík over at GLYPHICONS.
Font Awesome 🏠

Noto

Name 🏠 License 說明 / 備註
思源黑體 Source Han Sans
思源宋體 Source Han Serif

參考

Packages of Sublime ( Sublime 的外掛 )

Sublime 的 Package(套件), 大致上相當於 Notepad++ 的 Plugin, Visual Studio Code 的 Extension 或 Firefox 的 Addon, 是用來為本體程式外掛新功能的。所有 Sublime 套件的使用者定義檔 ( *.sublime-settings ),都會放在 %APPDATA%\Sublime Text 3\Packages\User 目錄.

以下介紹幾個 Sublime 的套件。

  • Package Control:第一個套件請安裝 Package Control, 這是套件管理員(package manager),相當於 Notepad++ 的 Plugin Manager。 連到 Package Control 官網後,依頁面指示開啟 Sublime 的 Console ( ctrl+` ), 在裡面貼上Package Control 官網提供的安裝程式碼,按下 [Enter] 即可安裝完成。

  • ConvertToUTF8:Sublime 預設不支援 GBK, BIG5, EUC-KR, EUC-JP, Shift_JIS 編碼,所以需要安裝 ConvertToUTF8 來解決這個問題。如果已安裝了 Package Control, 可以用 Package Control 來安裝這外掛( package control >> install package >> ConvertToUTF8 ). 以下外掛的安裝方法亦同此理。

  • Emmet:Zen Coding 的後繼者。打縮寫語法,再摁下 [TAB] 鍵,自動補全為完整標準語法。見 Emmet 文件: 常用縮寫語法

  • Sublime​Tmpl:新增文件或按下熱鍵時,自動輸入預先寫好的模板/範本。

  • 自動完成(auto-complete)

    • SublimeCodeIntel
    • Sublime Better Completion
    • 在 JavaScript 的支援上,SublimeCodeIntel 內建沒有 getElementsByClassName, Sublime Better Completion 則有。但同時安裝會相衝突。需要同時安裝的話,可以針對語言停用其中一個套件的自動完成,例如:SublimeCodeIntel 設定值"codeintel_live_disabled_languages": ["JavaScript"],Sublime Better Completion設定值"javascript": true
    • CSS3
    • Autoprefixer: Sublime plugin to prefix your CSS or SCSS
  • AutoFileName:自動完成 (路徑和)檔名。見https://www.youtube.com/watch?v=t8uFiYo2k4A

  • Pretty JSON:JSON 格式化( CTRL + ALT + J )、壓縮( Ctrl+Alt+M )。

  • SublimeLinter:interactive code linting( validation )。只裝這套件是沒有作用的,要按照想檢測的程式碼安裝相對應的套件。

  • BracketHighlighter:Bracket and tag highlighter for Sublime Text

  • All Autocomplete:Extend Sublime autocompletion to find matches in all open files of the current window.

  • SideBarEnhancements

  • Color Highlighter

  • TrailingSpaces: Highlight trailing spaces and delete them in a flash.

  • Markdown Preview

  • AutoHotkey

  • ChineseLoremIpsum

  • FakeImg Placeholder Snippet

  • iconfont snippets


參考

Web/Browser Bug

IE

SCRIPT5009: 'console' is undefined (console未被定義)

No .innerHTML support on Table, THead, TBody, TFoot, Tr's in IE

X-UA-Compatible

當父網頁為 IE11、IE10、IE9 模式,透過IFrame內嵌網頁會沿用父網頁的文件模式,透過X-UA-Compatible亦無法改變。
當父網頁為 IE8、IE7、IE5 模式,IFrame 內嵌的網頁可透過 X-UA-Compatible 切換與父網頁不同的 IE 模式,但 Edge、IE10、IE9 會降為 IE8。

The catch to Try Catch Finally in IE

In IE5~7, if you don't supply a catch statement, your finally statement will never be called!

Relative Path 相對路徑

相對路徑

. 代表目前所在的目錄,..代表父目錄 ,/代表根目錄

範例 說明
file_name.ext 表示同一層目錄下的 file_name.ext 檔案
./file_name.ext 表示同一層目錄下的 file_name.ext 檔案
image/pic01.png 表示 image 子目錄下的 pic01.png 檔案
../index.html 表示上一層目錄下的 index.html 檔案
../blog/article01.html 表示上一層目錄的 blog 子目錄下的 article01.html 檔案
/pagefile.sys 表示根目錄下的 pagefile.sys 檔案

參見

XAMPP 安裝與設定 (PHP, Apache, MariaDB, phpMyAdmin)

本文使用 XAMPP 7.2.6 安裝,下文提到的 MySQL 資料庫,皆指 MariaDB.

下載與安裝

  1. 下載 XAMPP https://www.apachefriends.org/
    xampp-install-select-components
  2. 執行 xampp 的安裝檔,依預設值安裝,一路 OK 或 NEXT. 唯有安裝路徑,如因C槽太小,可改至其他槽。
    xampp-install-folder
  3. 如 XAMPP, Apache, MySQL 要求通過防火牆,請允許。

啟動XAMPP Control Panel

  1. 安裝完XAMPP, 會自動啟動 XAMPP Control Panel, 如果沒有,請手動啟動 C:\xampp\xampp-control.exe
    xampp-control-panel
  2. XAMPP Control Panel 正確啟動如上圖,若出現紅字,表示有錯誤,我們需要解決它。例如,下圖的紅字訊息顯示:Skype.exe占用了80和443port。Apache需要80和443port。MySQL需要3306port。請不要讓其他程式占用這些port。
    80 and 443port

設定與啟動 Apache

  1. XAMPP Control Panel 正確啟動後,我們接著設定Apache。
  2. 在 XAMPP Control Panel 上,按下Apache對應的Config按鈕,選擇 httpd.conf ( 或者用你喜歡的文字編輯器修改C:\xampp\apache\conf\httpd.conf ),加入字串ServerName <IP or DNS name>:80,如下圖。(請自行取得網域或固定IP)
    apache config
  3. 在 XAMPP Control Panel 上,按下Apache對應的Start按鈕,啟動Apache。
  4. 在 XAMPP Control Panel 上,按下Apache對應的Admin按鈕,會啟動瀏覽器顯示XAMPP的首頁或者可以在瀏覽器輸入http://localhost/index.php。如下圖。(可將網址列中的localhost改為並瀏覽,以確認httpd.conf有正確設定。)
    xampp-index.php

啟動 MySQL,並用phpMyAdmin設定之

  1. 在XAMPP Control Panel 上,按下MySQL對應的Start按鈕,啟動MySQL。
  2. 在XAMPP Control Panel 上,按下MySQL對應的Admin按鈕,會啟動瀏覽器顯示phpMyAdmin的管理頁。(或輸入網址http://localhost/phpmyadmin/ ) 如下圖。
    xampp-phpmyadmin-000
  3. 為了安全性我們要為 MySQL的預設帳號 root 設定密碼。 選擇 [使用者帳號] 分頁 > 帳號 root 主機名稱 localhost > [編輯權限]。如下圖。
    phpmyadmin001ed
    phpmyadmin002
  4. 選擇 [修改密碼]。設定密碼後,按執行。如上圖。
  5. 接著用文字編輯器開啟 C:\xampp\phpMyAdmin\config.inc.php 依下述步驟修改。參見下圖。
    1. $cfg['Servers'][$i]['auth_type'] = 'config'; 改為 $cfg['Servers'][$i]['auth_type'] = 'cookie';
    2. $cfg['Servers'][$i]['password'] = ''; 刪去。
    3. $cfg['Servers'][$i]['AllowNoPassword'] = true; 改為 $cfg['Servers'][$i]['AllowNoPassword'] = false;
      phpmyadmin011
  6. 重新開啟phpMyAdmin的管理頁(網址http://localhost/phpmyadmin/ )。輸入 root 的帳密,登入。(root 的密碼是先前我們[修改密碼]那步驟所設定的)
    重新開啟phpMyAdmin的管理頁, 需要登入
  7. 我們在前面的步驟設定了 root (localhost) 的密碼。接著同樣為root (127.0.0.1) 和 root (::1) 設定密碼。

設定 Discuz 和 UCenter

UCenter

帳號免激活, 自動激活("您的帳號需要激活", action=activation)

default
[Discuz! Board 管理中心] > [站長] > [UCenter 設置] >
[是否允許其他應用的會員在站點激活:] (是)
[是否允許直接激活:] (是)

U+2018 U+2019 U+0027

Firefox 和 Chrome 的 Findbar 把 ‘ (U+2018)、 ’ (U+2019)、 ' (U+0027) 視為相同. IE 和 Edge 把他們視為不同.
2017-06-29 14 48 50

Configuration File Format List (常見)設定檔格式清單

 格式   🏠 開發者 註解
Python 🏠 Guido van Rossum # 註解
Lua 🏠 Tecgraf🏠 --註解
JavaScript 🏠 Brendan Eich // 註解 或 /* 多行註解 */
Jsonnet 🏠 Google // 註解
JSON 🏠 Douglas Crockford ❌ 不支援
JSON5 🏠 Aseem Kishore & Jordan Tucker // 註解 或 /* 多行註解 */
HOCON 🏠 Lightbend // 註解 或 # 註解
Hjson 🏠 // 註解 或 # 註解 或 /* 多行註解 */
HCL 🏠 HashiCorp // 註解 或 # 註解 或 /* 多行註解 */
MSON 🏠 (Oracle) Apiary🏠 // 註解 或 # 註解 或 /* 多行註解 */
CSON 🏠 Bevry🏠 # 註解
OpenDDL 🏠 Eric Lengyel // 註解 或 /* 多行註解 */
JsonML 🏠 ❌ 不支援
SXML
XML 🏠 W3C <!--註解-->
YAML 🏠 Clark Evans # 註解
TOML 🏠 Tom Preston-Werner # 註解
RON (Rusty Object Notation) // 註解
xupl 🏠 // 註解 或 /* 多行註解 */
.plist Apple Inc.
.ini ; 註解
.properties # 註解
.csv
.tsv

參考:

用 Eclipse 建立 Web Service ( Axis2, SOAP 1.2 )

STEP 00

使用的工具/環境:

  • windows10
  • jdk1.8.0_141
  • Eclipse Jee 2018-12
  • Tomcat 9.0.21
  • axis2-1.7.9
    • (WAR distribution) axis2-1.7.9-war.zip 解壓, 得到 axis2.war
    • (Binary distribution) axis2-1.7.9-bin.zip 解壓到 C:\mylib\axis2-1.7.9 (或你喜歡的位置)

STEP 01

Tomcat 我下載的是 apache-tomcat-9.0.21.zip, 這是免安裝版, 把下載的 axis2.war 放到 apache-tomcat-9.0.21\webapps 目錄下, 執行 apache-tomcat-9.0.21\bin\startup.bat
開啟瀏覽器, 輸入 http://localhost:8080/axis2/ , 如果出現了Axis2的 welcome 頁, 表示Axis2成功安裝到Tomcat裡了.
執行 apache-tomcat-9.0.21\bin\shutdown.bat 關掉 Tomcat.

axis2-welcome

STEP 02

設定 Eclipse 的 Preferences / Web Services / Axis2 Preferences/ Axis2 Preferences / Axis2 runtime location 設定為 C:\mylib\axis2-1.7.9
下方出現 Axis2 runtime loaded successfully 表示設定成功.

eclipse_web-services_axis2_preferences_runtime_location

STEP 03

Eclipse 設定 Server 使用 tomcat-9.0.21

STEP 04

Eclipse 裡新增一個 Dynamic Web Project.

  • Project name 填 WsAxis2Demo
  • Target runtime 填 Apache Tomcat v9
  • Dynamic Web Module Version 填 2.5 (ref: stackoverflow#4674363)
  • 點 Configuration 右側的 Modify.. 在新出現的Project Facets視窗裡, 勾選 Axis2 Web Services, 按OK 在原來的視窗按 Finish

Dynamic_Web_Project

STEP 05

JSTL

如果這時候 Eclipse 報錯 Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
把 jstl-1.2.jar 放到專案的 /WEB-INF/lib/ 裡 (ref: stackoverflow#13285826)

XmlSchema Core

把 xmlschema-core-2.2.4.jar 放到專案的 /WEB-INF/lib/ 裡 (ref: stackoverflow#35188087)

STEP 06

建一個class

package io.github.shyangs;

public class MyWs {
	public int addTwoNumbers(int firstNumber, int secondNumber) {
		return firstNumber + secondNumber;
	}
}

STEP 07

  • MyWs.java 上右鍵選 Web Services / Create Web Service
  • 點 Configuration 下方的 Server runtime 連結
  • Web Service runtime 選擇 Axis2
  • 一路 Next 後, 啟動 Server

service_deployment_configuration_web-service_runtime_axis2

STEP 08

用瀏覽器開啟 http://localhost:8080/WsAxis2Demo/services/listServices 會看到我們的 Web Service 資訊
同頁的藍色連結,則是 WSDL

listServices

STEP 09

修改 services.xml 裡的 messageReceiver mep屬性值

<service name="MyWs" >
	<Description>
		Please Type your service description here
	</Description>
	<messageReceivers>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
	</messageReceivers>
	<parameter name="ServiceClass" locked="false">io.github.shyangs.MyWs</parameter>
</service>

改為

<service name="MyWs" >
	<Description>
		Please Type your service description here
	</Description>
	<messageReceivers>
	    <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
	    <messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
	</messageReceivers>
	<parameter name="ServiceClass" locked="false">io.github.shyangs.MyWs</parameter>
</service>

否則Client呼叫時, 會叫不到Service, 報出錯誤 The ServiceClass object does not implement the required method in the following form: OMElement xxxxx(OMElement e)
(ref: stackoverflow#36319901)

改完要重啟 Server.

參考

Unix 與 MS-DOS 指令對照表

Unix Windows CMD / MS-DOS 說明
cd cd / chdir 改變工作目錄
ls dir 列出目錄內容
man help 顯示(指令)說明
mkdir md / mkdir 新增資料夾
cp copy / xcopy 複製檔案
mv ren / rename 重新命名檔案
mv move 移動檔案或目錄
rm del / erase 刪除檔案或目錄
  tree 顯示目錄的樹狀結構
ifconfig ipconfig, netsh 網路連線的設定. 常用 netsh 指令
netstat netstat 顯示通訊協定統計資料和目前的 TCP/IP 網路連線
ps tasklist display the currently-running processes
ln fsutil, junction, linkd, mklink 新增符號連結(symbolic link)
fsck chkdsk/scandisk Check Disk,磁碟檢查
fdisk/parted fdisk / diskpart 磁碟分割
mkfs format 格式化磁碟
  compact NTFS 壓縮
  PnPUtil 驅動管理
exit exit
shutdown shutdown
  • #11 How to find chkdsk results in Windows 10

ref:

Primitive Data Type in Java ( Java 的 基本資料型別 )

基本資料型別

整數

關鍵字 位元數bit 數值範圍 實體變數預設值[*]
byte   8 (-27) ~ (27-1) [即 -128 ~ 127 ]   0
short   16 (-215) ~ (215-1)   0
int   32 (-231) ~ (231-1)   0
long   64 (-263) ~ (263-1)   0

浮點數

關鍵字 位元數bit 數值範圍 實體變數預設值[*] 備註
float   32 IEEE 754 0.0 單精度浮點數有效位數是 7位(十進制)
double   64 IEEE 754 0.0 雙精度浮點數有效位數是 15位(十進制)

布林值

關鍵字 位元數bit 數值範圍 實體變數預設值[*]
boolean   1 true, false false

字元

關鍵字 位元數bit 數值範圍 實體變數預設值[*]
char   16 '\u0000' ~ '\uFFFF' 空字元 ( 即 '\0', '\u0000') [註: 不是空字串"\0" ,也不是空格(\u0020)]

[*] 區域變數在宣告時,Java不會自動設定初值,因此在存取時前必須先指定初始值,你可以在宣告時同時指定區域變數初值,也可以在宣告完後再指定區域變數初始值。實體變數在宣告時會自動設定初值 (實體變數預設值),你也可以在宣告時同時指定初值;但不可以在宣告完後又再指定實體變數初始值,編譯(compile)時會有錯誤訊息。

埃氏篩法 Sieve of Eratosthenes

import java.util.*;

public class PrimeSieve {

	public static LinkedList<Integer> sieve(int n) {
		if (n < 2) { return new LinkedList<Integer>(); }

		LinkedList<Integer> primes = new LinkedList<Integer>();
		LinkedList<Integer> nums = new LinkedList<Integer>();

		// nums = [2, 3, 4, 5, 6, 7, ..., n]
		for (int i = 2; i <= n; i++) { 
			nums.add(i);
		}

		// 從 nums移除所有 2 的倍數, 把 2 放入primes
		// 從 nums移除所有 3 的倍數, 把 3 放入primes
		// 從 nums移除所有 5 的倍數, 把 5 放入primes
		// ...
		while (nums.size() > 0) {
			int nextPrime = nums.remove();
			for (int i = nextPrime * nextPrime; i <= n; i += nextPrime) {
				nums.removeFirstOccurrence(i);
			}
			primes.add(nextPrime);
		}
		return primes;
	}

	public static void main(String[] args) {
		System.out.println("Please input an integer: ");
		Scanner scanner = new Scanner(System.in);
		System.out.println( sieve( scanner.nextInt() ) );
		if (scanner != null) { scanner.close(); }
	}
}

List of JavaScript Libraries

Name 🏠 License 相容 dependencies 說明 / 備註
jQuery 🏠 MIT If you need to support older browsers like Internet Explorer 6-8, Opera 12.1x or Safari 5.1+, use jQuery 1.12
jQuery Migrate 🏠
Zepto.js 🏠 IE10+ jQuery-compatible API
DHTMLX 🏠 Commercial, GPLv2
Math.js 🏠 Apache 2.0
Modernizr 🏠 MIT

Client-side storage

Name 🏠 License 相容 dependencies 說明 / 備註
js-cookie 🏠 MIT To support IE6-8, you need to include the JSON-js polyfill JSON
localForage 🏠 Apache 2.0 IE8+, see the wiki of localForage 非同步的本地存儲. localForage 中文文档

Date and Time

Name 🏠 License 相容 dependencies 說明 / 備註
date-fns 🏠 MIT
Day.js 🏠 MIT same API as moment
js-joda 🏠 BSD 3-clause a date API in JS that map to java 8 date types
Moment.js 🏠 MIT * 評論,
* Moment.js進入維護狀態,不會再增加新功能,並建議新項目不要使用Moment.js
* Momentjs 宣布正式進入維護期
* Moment.js 宣布停止開發,現在該用什麼?

Utility Function

Name 🏠 License 相容 dependencies 說明 / 備註
Underscore.js 🏠 MIT
Lodash 🏠 MIT See #20
Ramda 🏠 MIT

Shim / Polyfill

Name 🏠 License 相容 dependencies 說明 / 備註
json2.js 🏠 Public Domain Use json2.js if you want to improve the performance of your page. json2.js 性能好於JSON 3.
JSON 3 🏠 MIT IE6+
es5-shim 🏠 MIT es5-shim完美模擬了所有 ES5 中可以被完美模擬的方法。
es5-sham 🏠 MIT es5-shim 如果你要用的方法在 es5-shim 中都包含了,那麼就不需要 es5-sham。但如果你要用的方法只包含在 sham 中,那你要明白 sham 只是盡力模擬,並不能保證對應方法的功能正確。

console.log

Name 🏠 License 相容 dependencies 說明 / 備註
console-polyfill 🏠 MIT
console-shim 🏠 MIT
Polyfillr Console 🏠 GPL3
jsmini/console 🏠 MIT

Promise

Name 🏠 License 相容 dependencies 說明 / 備註
bluebird 🏠 MIT IE7+
es6-promise 🏠 MIT IE6+, see stefanpenner/es6-promise#12
yaku 🏠 MIT IE5+ 💬

fetch

Name 🏠 License 相容 dependencies 說明 / 備註
fetch-polyfill (司徒正美 ) 🏠 MIT IE6+ JSON, Promise
unfetch 🏠 MIT IE8+ Promise
whatwg-fetch 🏠 MIT IE10+

前端路由

Name 🏠 License 相容 dependencies 說明 / 備註
Crossroads.js 🏠 MIT JS-Signals
Davis.js MIT jQuery
director MIT director.js 簡明中文教學 - 羋老頭@博客園
Finch.js 🏠 MIT
page.js 🏠 MIT IE8+ [path-to-regexp]
PathJS 🏠 MIT IE7+
(itorr) Q.js Apache 2.0 Q.js放棄了 HTML5 State,通過#!格式的 url hash 重現了 url 路由功能
router.js MIT
router5 MIT
Sammy.js 🏠 MIT jQuery
StateMan 🏠 MIT IE6+ 特色:處理深層次的路由,複雜的單頁應用

疑難排解

使用了前端路由後與HTML錨點(anchor)衝突

解法: 放棄HTML錨點使用JS錨點

let scrollToAnchor = (anchorName) => {
    if (anchorName) {
        let anchorElement = document.getElementById(anchorName);  // 要跳轉到的元素
        if(anchorElement){ anchorElement.scrollIntoView(); } // 如果對應元素存在,就捲動到該位置
    }
  }

參考

CGI programming in VBScript / JScript (Windows Script Host (WSH))

CGI programming in VBScript / JScript (Windows Script Host (WSH))

環境準備:假設開發環境已建立好了。參閱 #24 XAMPP 安裝與設定 (PHP, Apache, MariaDB, phpMyAdmin)。

VBScript

  1. 在目錄 C:\xampp\cgi-bin\ 新增一腳本 test1.vbs ,該腳本內容如下:
'!c:\WINDOWS\system32\cscript.exe /nologo
WScript.Echo "Content-type: text/html" & vbcrlf ' vbCrLf 是 Visual Basic中的一個字串常數,即「 Chr(13) & Chr(10) 」(回車字元與換行字元連接在一起 \n\r ),是換行的意思. 

'Above two lines are required do not change
'Some basic html follows:

WScript.Echo "<h1>Hello World</h1>" 
WScript.Echo "<p>This is output from VBScript</p>"

WScript.StdOut.WriteLine "<h2>Microsoft VBScript engines version</h2>"
WScript.StdOut.WriteLine ( _ 
	Join(Array( _ 
		ScriptEngine, ScriptEngineMajorVersion, ScriptEngineMinorVersion, ScriptEngineBuildVersion _ 
	), ".") _ 
)
  1. 在瀏覽器輸入網址 http://localhost/cgi-bin/test1.vbs。如下圖,印出 Hello world 和 VBScript 引擎版本。
    WSH_VBScript_test1 vbs

JScript

  1. 在目錄 C:\xampp\cgi-bin\ 新增一腳本 printenv.wsf ,該腳本內容如下:
'!c:/windows/system32/cscript -nologo

'https://github.com/apache/httpd/blob/trunk/docs/cgi-examples/printenv.wsf 

' To permit this cgi, replace ' on the first line above with the
' appropriate shebang, f.e. '!c:/windows/system32/cscript -nologo
'
' ***** !!! WARNING !!! *****
' This script echoes the server environment variables and therefore
' leaks information - so NEVER use it in a live server environment!
' It is provided only for testing purpose.
' Also note that it is subject to cross site scripting attacks on
' MS IE and any other browser which fails to honor RFC2616. 

''
''  printenv -- demo CGI program which just prints its environment
''

<job>
<script language="JScript">

WScript.Echo("Content-type: text/html; charset=utf-8");
WScript.Echo("\n");

WScript.Echo("Hello World!");

WScript.StdOut.WriteLine("<h2>Microsoft JScript engine version</h2>")
WScript.StdOut.WriteLine([
	ScriptEngine(), ScriptEngineMajorVersion(), ScriptEngineMinorVersion(), ScriptEngineBuildVersion()
].join('.'));

WScript.Echo("<h2>server environment variables (&#20282;&#26381;&#22120;&#29872;&#22659;&#35722;&#25976;)</h2>");

var objShell = new ActiveXObject("WScript.Shell");
var objArray = new Array();
var e = new Enumerator(objShell.Environment("PROCESS"));
for (;!e.atEnd();e.moveNext()) {
  var i = e.item().indexOf("=");
  var envvar = e.item().substring(0, i);
  var envval = e.item().substring(i + 1, e.item().length);
  envval = envval.replace("\n", "\\n");
  objArray.push(envvar + "=\"" + envval + "\"");
}
objArray.sort();
WScript.Echo(objArray.join("<br/>"));
</script>
</job>
  1. 在瀏覽器輸入網址 http://localhost/cgi-bin/printenv.wsf。如下圖,印出 Hello world 、 JScript 引擎版本和伺服器環境變數。
    WSH_JScript_printenv wsf

參考資料

Hello, React.js!

<!DOCTYPE html>
<html>
  <head>
	<!-- 引入 react.js, react-dom.js 和 babel-core 的 browser.min.js -->
	<script src="build/react.js"></script>
	<script src="build/react-dom.js"></script>
	<script src="build/browser.min.js"></script>
  </head>
  <body>
	<div id="example"></div>
	
	<!--
	   `type=text/babel` 的 script 使用 JSX 語法.
	   透過 Babel 將 JSX/ES6/ES7 轉譯成 ES5.
	-->
	<script type="text/babel">
		// ReactDOM.render 是 React 最基本的方法,
		// 用於將模板轉為 HTML 語言,並插入指定的 DOM 節點
		ReactDOM.render(
		  <h1>Hello, React.js!</h1>,
		  document.getElementById('example')
		);
	</script>
  </body>
</html>

上文使用「內嵌」的方式來載入 JSX, 我們也可以從外部引入

<script type="text/babel" src="main.jsx"></script>

其他教學文章

CGI programming in Perl / batch file

CGI programming in Perl / batch file

環境準備:假設開發環境已建立好了。參閱 #24 XAMPP 安裝與設定 (PHP, Apache, MariaDB, phpMyAdmin)。

Perl

  1. 啟動 Apache,在瀏覽器輸入網址 http://localhost/cgi-bin/perltest.cgi。如下圖。
    GCI_with_MiniPerl
  2. 在瀏覽器輸入網址 http://localhost/cgi-bin/printenv.pl。如下圖,印出環境變數。(demo CGI program which just prints its environment)
    printenv pl

batch file ( 批次檔 / 批处理文件 )

  1. 文字編輯器修改 C:\xampp\apache\conf\mime.types ,將 application/x-msdownload exe dll com bat msi 改為 application/x-msdownload exe dll com msi
  2. 在目錄 C:\xampp\cgi-bin\ 新增一批次檔 hello.bat ,該批次檔內容如下:
@echo off
echo Content-type: text/html
echo.
echo Hello, world!
echo ^<h2^>Environment Variables ^&percnt;PATH^&percnt;^<^/h2^>
echo %PATH%
  1. 在瀏覽器輸入網址 http://localhost/cgi-bin/hello.bat。如下圖,印出Hello, world!和系統環境變數 PATH。
    hello bat

參考資料

安裝 Discuz

  1. 先為Discuz新增一個MySQL資料庫。從phpMyAdmin的管理頁,選擇 [資料庫] 分頁。新資料庫名稱 discuz (可自訂)。編碼 utf8mb4_unicode_ci。按下[建立]。如下圖。
    mysql-utf8mb4_unicode_ci
  2. 將 Discuz 壓縮檔裡的 upload 資料夾解壓縮放到 C:\xampp\htdocs\ 並將 upload 改名為 bbs (可自訂)。如下圖。
    Discuz-upload-folder
  3. 用瀏覽器開啟 http://localhost/bbs/,會自動轉向至http://localhost/bbs/install/開始Discuz的安裝。
  4. 安裝STEP1,確認都是綠色勾,下一步。如下圖。
    002ed
  5. 安裝STEP2,我們是全新安裝,選全新安裝那項。如下圖。
    003ed
  6. 安裝STEP3,填入要用的資料庫相關資料。資料庫主機位址 localhost、資料庫名稱 discuz、帳號 root 和密碼。並設定論壇管理員資料。如下圖。註:若資料庫改過port,比如13306,則資料庫位址填 127.0.0.1:13306
    004ed
  7. 完成 Discuz 安裝。論壇首頁是 http://localhost/bbs/index.php 。若你在Apache 的 httpd.conf 有設定 ServerName。首頁是 http://<ServerName>/bbs/index.php
    006

Discuz官方網站

http://www.discuz.net/
https://gitee.com/ComsenzDiscuz/DiscuzX

Access Modifiers in Java ( Java 的存取權限修飾字)

存取權限範圍

       同 Class 同 package sub-class   全域  
public   OK   OK   OK   OK
protected   OK   OK   OK   x
default (friendly)   OK   OK   x   x
private   OK   x   x   x

什麼東西 可使用 存取權限修飾字

        類別    方法   屬性    建構式 
public   OK   OK   OK   OK
protected   x   OK   OK   OK
default (friendly)   OK   OK   OK   OK
private   x   OK   OK   OK

How to find chkdsk results in Windows 10

How to find chkdsk results in Windows 10

  1. 開啟事件檢視器(Event Viewer)(Press Windows+R to open the Run dialog, enter eventvwr (or eventvwr.msc) )
  2. 左側欄選擇 Windows Logs (Windows 記錄) - Application(應用程式)
  3. 左側欄選擇 篩選目前記錄(Filter Current Log)... 並填入事件識別碼 event ID: 26214, 26226 或 1001 ( Winint )
    Event Viewer: Event ID = 26226

常用軟體清單

開發工具

text editor / IDE (Integrated development environment)

軟體名 🏠 說明 / 備註 Written in
Visual Studio Code 🏠 TypeScript
Microsoft Visual Studio 🏠 免費版叫 Visual Studio Community C++, C#
Android Studio 🏠 Android Studio體驗(一)--Window版本安裝 Java
Eclipse 🏠 📖舊版Eclipse下載 Java
NetBeans 🏠 Java
jEdit 🏠 GPLv2 Java
Geany 🏠 GPLv2 C, C++
EmEditor 🏠 Windows Only, 專有軟體. 關於免費版([CTRL+Q],輸入「降級」,然後按兩次 ENTER 鍵)
Notepad++ 🏠 Windows Only C++
Sublime Text 🏠 專有軟體 C++
SciTE 🏠 C++
Textadept 🏠 Textadept使用心得 - Alexander Misel Lua, C
(GitHub) Atom 🏠 CoffeeScript, JavaScript
(Adobe) Brackets 🏠 2021.09.01後,Adobe官方不再維護. 轉交社區維護. JavaScript

程式語言 / 編譯器 / 直譯器

軟體名 🏠 📖 說明 / 備註
Java 🏠 📖
JavaScript 🏠 📖
Node.js 🏠 📖 Portable 免安裝 Node.js
Python 🏠 📖

資料庫相關

資料庫管理工具 ( database administrator tools )

軟體名 🏠 📖 說明 / 備註 Written in
DBeaver Java
HeidiSQL Object Pascal
phpMyAdmin PHP
SSMS (Microsoft SQL Server Management Studio)

database driver

軟體名 🏠 📖 說明 / 備註 Written in
node-oracledb 🏠 📖 JavaScript, C

反編譯器Decompiler

軟體名 🏠 說明 / 備註 Written in
Java Decompiler 🏠 Java decompiler Java

自動化工具 Automation

軟體名 🏠 📖 說明 / 備註 Written in
AutoHotkey 🏠 📖 可攜版Portable C++, C
Sikuli 2012後已不再維護
SikuliX 🏠 Java
PyAutoGUI 🏠 📖 Python

CASE tools

軟體名 🏠 說明 / 備註 Written in
Astah* 🏠 舊名JUDE。日本的專有軟體。 最後一版免費的Community版版本號為Astah Community 7.2.0/1ff236 (release-notes) Java

software prototyping tools

軟體名 🏠 說明 / 備註 Written in
Pencil Project 🏠 JavaScript

Server

Servlet Container / (web container)

軟體名 🏠 說明 / 備註 Written in
Tomcat 🏠 Apache Tomcat Versions Java
JBoss 🏠 付費支援版:JBoss EAP (Enterprise Application Platform), 社群免費版:WildFly (舊稱為 JBoss AS) Java

HTTP Server / (web server)

軟體名 🏠 說明 / 備註 Written in
IIS (Internet Information Services) 🏠 C++
Apache HTTP Server 🏠 C
Nginx 🏠 C

live-reload server for frontend development

軟體名 🏠 說明 / 備註 Written in
Live Server 🏠 #6 JavaScript
Puer 🏠 JavaScript

installation software

軟體名 🏠 說明 / 備註 Written in
Nullsoft Scriptable Install System (NSIS) 🏠 C, C++
InstallJammer 已不再維護 Tcl

Office Software

軟體名 🏠 說明 / 備註
Microsoft Office 專有軟體
LibreOffice 🏠

E-book reader (PDF, EPUB, .mobi, .azw)

軟體名 🏠 說明 / 備註 Written in
(Adobe) Acrobat Reader 🏠 專有軟體
Adobe Digital Editions 🏠 專有軟體
PDFCreator 🏠 PDF虛擬印表機. 不同版本可能綑綁工具列、廣告軟體. 見 en-wiki. C#
calibre 🏠 電子書管理工具 Python, C
Sumatra PDF 🏠 SumatraPDF is a multi-format (PDF, CHM, DjVu, EPUB, FB2, MOBI, TIFF, WEBP, XPS) reader for Windows. (Windows Only) C, C++

Operating System

軟體名 🏠 說明 / 備註
Microsoft Windows 專有軟體. 如何下載 Windows 10 舊版本的 ISO 檔
Ubuntu 🏠
Xubuntu 🏠
Lubuntu 🏠
Linux Mint 🏠

Remote Desktop

軟體名 🏠 說明 / 備註
Chrome 遠端桌面 🏠 用戶端 BSD 授權. source code
UltraVNC 🏠 written in C++, C
AnyDesk 🏠 專有軟體
LogMeIn 🏠 專有軟體
ShowMyPC 🏠 專有軟體
TeamViewer 🏠 專有軟體
Wayk Now 🏠 專有軟體
(贝锐科技)向日葵远程控制 🏠
(贝锐科技)AweSun 🏠

Virtualization Software

軟體名 🏠 說明 / 備註 Written in
Oracle VM VirtualBox 🏠
VMware Workstation Player 🏠 專有軟體
Sandboxie 🏠 專有軟體. GPLv3 C, C++

Mathematical software

軟體名 🏠 說明 / 備註
The Geometer's Sketchpad (GSP) 🏠 專有軟體
GeoGebra 🏠

File Manager

軟體名 🏠 說明 / 備註
Double Commander 🏠
Q-Dir 🏠 Windows Only, 專有軟體. 💬

Firewall / Antivirus Software

請勿同時安裝兩個防毒軟體.

軟體名 🏠 說明 / 備註
Avast Antivirus 🏠 專有軟體, 仍有適用 XP 的免費版.
Avira AntiVirus 🏠 專有軟體
AVG AntiVirus 🏠 專有軟體
Bitdefender 🏠 專有軟體, 免費版為 Bitdefender Antivirus Free Edition
ClamAV 🏠 開放原始碼的防毒軟體; 圖形介面版本為ClamWin
Comodo Internet Security 🏠 專有軟體
Malwarebytes Anti-Malware 🏠 專有軟體
ZoneAlarm 🏠 專有軟體, 免費版防火牆爲 ZoneAlarm Free Firewall
Windows Defender 🏠 專有軟體. 如何關閉Windows Defender: win7, win10

System Monitor / Management

軟體名 🏠 說明 / 備註 Written in
FreeMeter 🏠 系統監測工具,可檢測磁碟、CPU、內存的使用情況,網路流量,磁碟傳輸速率 (Windows Only, 專有軟體)
Glances 🏠 system monitoring tool Python
LXTask 🏠 Lubuntu 的工作管理員. Linux Only. C
MSI Afterburner 🏠 微星小飛機: 顯卡監測,超頻工具(Windows Only, 專有軟體)
Open Hardware Monitor 🏠 硬體溫度/使用量監控. 💬, 💬 C#
Process Hacker 🏠 CPU, RAM, I/O使用量監控. Windows Only. C
[Windows Sysinternals] Process Explorer 🏠 Process Explorer is a task manager and system monitor for Microsoft Windows (Windows Only, 專有軟體)
[Windows Sysinternals] Autoruns 🏠 Windows 開機啟動項目管理 (Windows Only, 專有軟體)
CPU-Z 🏠 偵測硬體規格資訊 (Windows Only, 專有軟體)
GPU-Z 🏠 偵測顯示卡資訊 (Windows Only, 專有軟體)
Don't Sleep 🏠 休眠關機管理 (Windows Only, 專有軟體)
Winaero Tweaker 🏠 Windows 系統設定調整工具 (Windows Only, 專有軟體)
Joulemeter 🏠 電腦用電量監控(瓦數Watt估算) (Windows Only, 專有軟體)
JMeter 🏠 壓力測試工具, 可以執行Http、FTP、RDBMS(關聯式資料庫)、LDAP、SOAP與WebService等的負載以及效能測試 Java
Wireshark 🏠 網路封包分析軟體 C, C++
VisualVM 🏠 Java Troubleshooting Tool Java

磁碟檢查 / 儲存媒體管理工具

軟體名 🏠 說明 / 備註 Written in
CrystalDiskInfo 🏠 磁碟健康狀態檢測工具. 💬 C++
CrystalMark 🏠 磁碟基準測試工具. 💬 C++
Hard Disk Sentinel 🏠 磁碟監控軟體(專有軟體)
PageFileUsageMonitor 🏠 pagefile.sys 虛擬記憶體使用量 Visual Basic 6
WinCDEmu 🏠 WinCDEmu 超方便的虛擬光碟軟體 取代酒精Alcohol 120%、DAEMON Tools. 💬 C++
WinDirStat 🏠 a graphical disk usage analyzer for Microsoft Windows. Windows Only. C++

影音媒體播放器 / image viewer、多媒體軟體

軟體名 🏠 說明 / 備註 Written in
Audacity 🏠 音訊編輯軟體,用於錄音和編輯音訊 C, C++
Avidemux 🏠 視訊編輯軟體 C, C++
Shotcut 🏠 視訊編輯軟體. 💬 C++
Equalizer APO 🏠 等化器。均衡器。音效調整 。💬將電腦喇叭的左右聲道互換 C++
emulsion 🏠 Rust
FastPreview 🏠 A PicaView replacement. C, C++
JPEGView 🏠 授權協議: GPLv2, 原版作者: David Kleiner C++
VLC media player 🏠 多媒體播放器. 💬 C, C++, Objective-C
Open Broadcaster Software (OBS) 🏠 錄影. 可攜版Portable C, C++

(解)壓縮軟體

軟體名 🏠 說明 / 備註 Written in
7-Zip 🏠 官方在Linux下只有命令行版本. 7z沒有rar的rr3恢復記錄(Recovery Record)功能, 想得到同樣的功能需搭配支援Parchive的軟體, 例如Multipar. 💬, 💬 C++, C
Peazip 🏠 跨平臺GUI Free Pascal

其他

軟體名 🏠 說明 / 備註 Written in
ColorGrab 🏠 color picker 螢幕取色器 C++
CopyQ 🏠 剪貼簿加強工具 C++
ConvertZ 🏠 將簡體字檔名批次改成繁體, 💬
FastCopy 🏠 Windows 平台上檔案複製、搬移、刪除速率最快速的工具. 💬, 💬 C++
Intel® 驅動程式與支援助理 🏠 intel driver and support assistant
Joplin 🏠 基於Electron筆記軟體 TypeScript, JavaScript
KeePassXC 🏠 密碼管理器 C++
Locate32 🏠 desktop search engine C++
Locale Emulator 🏠 讓軟體待在一個虛擬為日文作業系統、日本時區的系統上運作. 此為 AppLocale 的替代品, AppLocale不支援win10. C#
LockHunter 🏠 解除電腦(使用中的)檔案鎖定的工具。此為 Unlocker 的替代品, Unlocker不支援win10.
Meazure 🏠 螢幕尺. Windows Only. C++
MediaInfo 🏠 顯示媒體檔案相關的技術資訊,以及音訊和視訊檔的標籤資訊. Pascal, C++
MiTeC Mail Viewer 🏠 Mail Viewer, 觀看郵件資料庫檔案(.idx、.mbx、.dbx)或是郵件檔案(.eml)的軟體 (Windows Only, 專有軟體)
.NET Web Service Studio 🏠 WebService測試工具 C#
NoClose 🏠 Disable the Close button (X) of selected windows. AutoHotkey
NVIDIA Inspector 🏠 NVIDIA Inspector, also known as nvidiaProfileInspector. NVIDIA Inspector is a handy application that reads out driver and hardware information for GeForce graphics cards
Rufus 🏠 製作可開機的 USB 磁碟機 (Windows Only) C
SendToBackWindowsApplication 🏠 視窗置頂置底小工具 (Windows Only, 專有軟體)
SoapUI 🏠 an open-source web service testing application Java
TestDisk 🏠 磁碟分割(表)備份/還原/救援工具 C
WinMerge 🏠 file comparison tool C++
Workrave 🏠 電腦使用時間計時器, 提醒休息軟體 C++, C

參考

Site 說明 / 備註
AlternativeTo.net Crowdsourced software recommendations. 让我们的软件应用有多个可替代的选择
SaaSHub Software Alternatives And Reviews
Filehippo.com 軟體下載網站
OldApps.com 提供旧版本应用下载
OldVersion.com Old versions of Windows, Mac and Linux Software, Apps & Abandonware Games

Hello, Java!

使用 cmd

  1. 建立一個 HelloWorld.java 純文字文件檔,假設路徑為 C:\Temp\HelloWorld.java,其內容為:
public class HelloWorld {
	public static void main(String[] args) {
		System.out.println("Hello World!");
	}
}
  1. 開啟 cmd, 切換路徑到放置 HelloWorld.java 的目錄,在此命令為 cd C:\Temp
  2. 使用 javac 命令來編譯,在此命令為 javac HelloWorld.java,在 HelloWorld.java 同資料夾裡編譯出了 HelloWorld.class ,在此路徑為 C:\Temp\HelloWorld.class
  3. 使用 java 命令來執行Class檔,在此命令為 java HelloWorld ,將看到輸出 ‵Hello World!‵
    cmd: Hello World! (Java)

使用 NetBeans

  1. NetBeans IDE >> [File] >> New Project... >> Categories: Java / Projects: Java Application >> [Next]
  2. 填寫 Project Name 和 Create Main Class >> [Finish]
  3. 開啟 {{Project Name}}.java, 撰寫程式碼。第一支程式,簡單的印出字串。在 main 函式裡,打上 System.out.println("Hello, Java!");
  4. 試著跑跑看,看結果 Run Project (F6)

NetBeans : new java application in netbeans ide

NetBeans :  my first java application

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package io.github.shyangs.helloworldprinter;

/**
 *
 * @author Java
 */
public class HelloWorldPrinter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("Hello, Java!");
    }
    
}

使用 Eclipse

  1. NetBeans IDE >> [File] >> New >> Java Project >> 填寫 Project name >> [Finish]
  2. 在 Source Folder (src) 上點右鍵 >> New >> Class >> 填寫 Package >> 勾選 public static void main(String[] args) >> [Finish]
  3. 開啟 {{Project Name}}.java, 撰寫程式碼。第一支程式,簡單的印出字串。在 main 函式裡,打上 System.out.println("Hello, Java!");
  4. 試著跑跑看,看結果 Run Project ( Ctrl + F11)

Eclipse:  New Java Project
Eclipse: Java Project >> New Class
Eclipse:  New Java Class
Eclipse: Hello, Java!

package io.github.shyangs.helloworldprinter;

public class HelloWorldPrinter {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Hello Java!");
	}

}

JS模板引擎

Name 🏠 License 相容 dependencies 說明 / 備註
art-template 🏠 MIT IE8+ JSON, es5-shim, es5-sham
doT.js 🏠 MIT
EJS 🏠 Apache-2.0
ETPL 🏠 BSD 3-Clause
Handlebars.js 🏠 MIT [source-map]
JsRender 🏠 MIT
jQuery.tmpl 🏠 MIT, GPLv2 jQuery 已停止維護
lodash.template 🏠 MIT
mustache.js 🏠 MIT
Nunjucks 🏠 BSD-2-Clause
Pug (formerly Jade) 🏠 MIT
PowJS 🏠 MIT PowJS 是一个 ECMAScript 6 编译型 Real-DOM 模板引擎.
NornJ 🏠 MIT IE9+ NornJ是一款同時支持渲染純字串(html)和HyperScript(React virtual dom)的模板引擎. 使用新一代js模板引擎NornJ提升React.js開發體驗
template.js (yanhaijing) 🏠 MIT 💬 ES5
Template Literals ES6 人生苦短,我用ES6 模板

參考

Build Old Version Lodash (Compatible with IE6, IE8)

Lodash 3.x 版本支援的環境有:
Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, io.js 2.5.0, Node.js 0.8.28, 0.10.40, & 0.12.7, PhantomJS 1.9.8, RingoJS 0.11, & Rhino1.7.6

要讓 Lodash 支援IE8,我們需要安裝舊版的 lodash-cli (v3.10.1),如果已經安裝了新版的 lodash-cli 請先移除之.
npm uninstall -g lodash-cli

接著安裝 lodash-cli (v3.10.1)
npm i -g [email protected]

最後組建 lodash
整個 lodash.js (v3.10.1)
lodash compat
或只要工作在瀏覽器上, 選用函數為round, floor和ceil
lodash compat include="round,floor,ceil" exports="global"

參考

CGI programming in JavaScript ( QuickJS )

CGI programming in JavaScript ( QuickJS )

QuickJS

  1. 在目錄 C:\xampp\cgi-bin\ 新增一腳本 quickjs.js ,該腳本內容如下 ( 請依照 Quick.JS 的執行檔 qjs.exe 所在路徑,修改腳本第一行 ):
#!D:\Programs\QuickJS\bin\qjs.exe

console.log('Content-type: text/html');
console.log('');
console.log('<h2>Hello World</h2>');

import('std')
    .then((std) => {
        console.log('<h2>std.getenviron()</h2>');
        // console.log(JSON.stringify(std.getenviron()));
        // console.log('<br /><br />');
        
        const obj = std.getenviron();
        for(const key in obj){
          console.log(key, ' = ', obj[key]);
          console.log('<br />');
        }
    })
    .catch((err) => {
        console.log(err);
    });
  1. 在瀏覽器輸入網址 http://localhost/cgi-bin/quickjs.js。如下圖,印出 Hello world 和伺服器環境變數。
    cgi_quickjs

參考

Install Node.js and live-server on Ubuntu 16.04

live-server 的用途:

安裝

需要依序安裝的有 curl, Node.js (和 npm), live-server

  1. 首先安裝 curl, 按下 Ctrl + Alt + T, 開啟 Terminal, 輸入下列指令
    sudo apt install curl
  2. 按照 Node.js 官網的安裝指示,安裝 Node.js (和 npm)
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install -y nodejs

Install Node.js

  1. 安裝 live-server
    sudo npm install -g live-server
  2. 接下來我們測試一下. 在桌面新增一個資料夾 TodoApp , 用 sublime (或其他文字編輯器) 建一個 index.html 檔案,內容為:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
<body>
    <div>Hello, world!</div>
</body>
</html>
  1. Terminal 切換路徑到上述 index.html 檔案所在路徑 ( 在此例為 cd 桌面/TodoApp/ ),輸入命令live-server,將會啟動伺服器,開啟瀏覽器,前往 http://localhost:8080index.html 檔案會顯示Hello, world!在網頁上。
    live-server: Hello, world!

  2. 如果出現Error: listen EACCES {{path}}:{{port}}錯誤訊息,可能是該port被本機其他伺服器佔據了,請換其他port,比如 live-server --host=127.0.0.1 --port=1234
    註: EACCES (aka "Permission denied")

  3. 如果出現'live-server' 不是內部或外部命令、可執行的程式或批次檔。(live-server: command not found) 請檢查環境變數 PATH的設定值。(Windows 裡應加入 ;C:\Program Files\nodejs;%AppData%\npm;)

jQuery / Bootstrap Plugins List

jQuery

Name 🏠 相容 說明 / 備註 License
jQuery UI 🏠 jQuery UI 1.11 officially dropped support for IE7 but left all the existing workarounds in place. jQuery UI 1.12 has removed all of the IE7 workarounds. In addition, official support for IE8, IE9, and IE10 have been removed, but the workarounds are still in place and will be removed in 1.13. a collection of GUI widgets MIT
fancybox (v1) 🏠 jQ v1.3 ~ 1.8 (依賴 jQuery.browser) 燈箱 Lightbox MIT, GPL
fancybox v2 🏠 燈箱 Lightbox CC BY-NC 3.0, commercial license
fancyBox3 🏠 燈箱 GPLv3, commercial license
jquery.browser 🏠 A jQuery plugin for browser detection. (jQuery v1.9.1 dropped support for browser detection) MIT
jQuery LoadingOverlay 🏠 Edge12+, 依賴CSS Flexible Box Layout Module A flexible loading overlay jQuery plugin MIT
jquery-treegrid 🏠 TreeGrid plugin for jQuery MIT
友環 jQWidgets 🏠 CC BY-NC 3.0, Commercial
w2ui 🏠 MIT
Haole Zheng jquerywidget 🏠 jQ v1.11+ MIT

Bootstrap

Name 🏠 相容 說明 / 備註 License
bootstrap-select 🏠 Bootstrap-select is a jQuery plugin that utilizes Bootstrap's dropdown.js to style and bring additional functionality to standard select elements. MIT
Better Collapse 🏠 bs2 Expands upon the Bootstrap collapse plugin to dynamically hide and show elements inside the toggler. 不再維護, 可用 CSS 代替之.
<!-- 用 CSS/HTML 替代Better Collapse -->
<style>
  [data-toggle="collapse"]{
    cursor: pointer;
  }
  span[data-hide-on="collapsed"]{
    display: none;
  }
  [data-toggle="collapse"].collapsed span[data-hide-on="collapsed"]{
    display: inline;
  }
  [data-toggle="collapse"].collapsed span[data-hide-on="expanded"]{
    display: none;
  }
</style>
<div class="page-header" data-target="#divMainContent" data-toggle="collapse">
  <h4>
    <span data-hide-on="expanded"><i class="glyphicon glyphicon-triangle-bottom"></i></span>
    <span data-hide-on="collapsed"><i class="glyphicon glyphicon-triangle-right"></i></span>
    <!-- 標題文字 -->
  </h4>
</div>
<div id="divMainContent" class="collapse in">
  <!-- 可折疊區 -->
</div>

參考

  • Awesome jQuery: A curated list of awesome jQuery plugins, resources and other shiny things.

List of JavaScript Table / Grid Widgets(Controls)

Name 🏠 License 相容 dependencies 說明 / 備註
ag-Grid 🏠 Commercial, MIT ag-Grid Community 為 MIT 授權
FancyGrid 🏠 Commercial, MIT
Handsontable 🏠 Commercial, MIT Handsontable Community 為 MIT 授權; Handsontable 7.0.0 版本起,Handsontable Pro 和 Handsontable CE 合併,並且不再開源.
DataTables 🏠 MIT jQuery
jsGrid 🏠 MIT jQuery
jqGrid CC BY-NC 3.0 jQuery
jQuery-KingTable MIT jQuery
jquery-treegrid 🏠 MIT jQuery TreeGrid plugin for jQuery
SlickGrid 🏠 MIT jQuery
Ember Table 採用Ember.js實現的表格控制項

參考

Code Snippets

spiltByIndex

public class Snippet {
	public static String[] spiltByIndex(String str, int... idxs) {
		int tSize = idxs.length;
		String[] tResults = new String[tSize + 1];
		for (int i = 0; i <= tSize; i++) {
			int indexStart = 0;
			int indexEnd = 0;
			if (0 < i) {
				indexStart = idxs[i - 1];
			}
			if (tSize > i) {
				indexEnd = idxs[i];
			}
			if (tSize == i) {
				indexEnd = str.length();
			}
			tResults[i] = str.substring(indexStart, indexEnd);
		}
		return tResults;
	}

	public static void main(String[] args) {
		print(spiltByIndex("ABCDEFGHIJ", 1, 4));
	}
	public static void print(String[] arr) {
		for (String el : arr) {
			System.out.println(el);
		}
	}
}

UUID

方法一

java.util.UUID.randomUUID().toString();

方法二

public class Snippet {
	public static String createUUID() {
		 String[] s = new String[36];
		 String[] hexDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
		 for (int i = 0; i < 36; i++) {
		        s[i] = hexDigits[(int) Math.floor(Math.random() * 16)];
		}
		 s[8] = s[13] = s[18] = s[23] = "-";

		 StringBuilder sb = new StringBuilder();
		 for(int i = 0; i < s.length; i++) {
			 sb.append(s[i]);
		 }
		 return sb.toString();
	}

	public static void main(String[] args) {
		System.out.println(createUUID()); //4638b26a-5c3f-e4d8-cd20-7d759484f04f
	}
}

getStrFromInputStreamByCharset

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Snippet {
	public static String getStrFromInputStreamByCharset(InputStream pInputStream, String pCharsetName, String pCSeparator) {
		StringBuilder builder = new StringBuilder();
		BufferedReader reader = null;

		try {
			reader = new BufferedReader(new InputStreamReader(pInputStream, pCharsetName));
			String line = reader.readLine();
			for ( boolean firstLine = true ; null != line; line = reader.readLine() ) {
				if (firstLine) {
					builder.append(line);
					firstLine = false;
				} else {
					builder.append(pCSeparator);
					builder.append(line);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				reader.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return builder.toString();
	}
	
	public static String getStrFromInputStreamByCharset(InputStream pInputStream, String pCharsetName) {
		return getStrFromInputStreamByCharset(pInputStream, pCharsetName, System.lineSeparator());
	}

ZIP壓縮

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class Snippet {
	public static void main(String[] args) throws IOException {
		File fileOrDirWantToZip = new File("D:" + File.separator + "zipTempDir");
		File outZipFile = new File("D:" + File.separator + "zipFile.zip");
		zipDirOrFile(fileOrDirWantToZip, outZipFile, "資料夾");
		// zipDirOrFile(fileDir, zipFile, "");
		System.out.println("壓縮完成");
	}

	public static void zipDirOrFile(String pathFileOrDirWantToZip, String pathFileZipOut) throws IOException {
		File fileOrDirWantToZip = new File(pathFileOrDirWantToZip);
		File outZipFile = new File(pathFileZipOut);
		zipDirOrFile(fileOrDirWantToZip, outZipFile);
	}
	public static void zipDirOrFile(File fileOrDirWantToZip, File fileZipOut) throws IOException {
		zipDirOrFile(fileOrDirWantToZip, fileZipOut, null);
	}

	public static void zipDirOrFile(File fileOrDirWantToZip, File fileZipOut, String dirName) throws IOException {
		ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(fileZipOut));
		if (fileOrDirWantToZip.isFile()) {
			String dir = "";
			if ( null == dirName || "".equals(dirName) ) {
				dir = "";
			} else {
				dir = dirName + File.separator;
			}
			zipFile(zipOut, fileOrDirWantToZip, dir + fileOrDirWantToZip.getName());
		} else if (fileOrDirWantToZip.isDirectory()) {
			String dir = "";
			if ( null == dirName || "".equals(dirName) ) {
				dir = "";
			} else {
				dir = dirName;
			}
			zipDir(zipOut, fileOrDirWantToZip, dir);
		} 
		zipOut.close();
	}
	
	private static void zipDir(ZipOutputStream zipOut, File dirWantToZip, String dirName) throws IOException {
		String dir = "";
		if ( null == dirName || "".equals(dirName) ) {
			dir = "";
		} else {
			dir = dirName + File.separator;
		}
		
		File[] files = dirWantToZip.listFiles();
		for (int i = 0; i < files.length; ++i) {
			File tFileOrDir = files[i];
			if (tFileOrDir.isFile()) {
				zipFile(zipOut, tFileOrDir, dir + tFileOrDir.getName());
			} else if (tFileOrDir.isDirectory()) {
				zipDir(zipOut, tFileOrDir, dir + tFileOrDir.getName());
			}
		}
	}
	
	private static void zipFile(ZipOutputStream zipOut, File fileWantToZip, String newFilePathInZip) throws IOException {
		InputStream input = new FileInputStream(fileWantToZip);
		zipOut.putNextEntry(new ZipEntry(newFilePathInZip));
		int temp = 0;
		while ((temp = input.read()) != -1) {
			zipOut.write(temp);
		}
		input.close();
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.