2016年3月4日 星期五

LuCI (Lua Configiration Interface)

  • LuCI (Lua Configiration Interface) 是 OpenWRT 的 Web 管理介面。

  • LuCI 是一個 MVC framework,所以我們可以在 LuCI 的基礎上寫 Web 的應用程式。

  • OpenWRT management flow:   
  • official reference:



2015年10月30日 星期五

[Tool] 將 PDF 轉換為 PowerPoint


付費的官方解法 - Adobe Acrobat DC

網路上有不少免費的web版轉換工具,但很多轉出來都跑版或是一片空白

smallpdf目前測試正常








2015年9月3日 星期四

Google Cloud Platform V.S AWS



價格試算:

Amazon Web Service:

Google Cloud Platform:


IO PK:

By the numbers: How Google Compute Engine stacks up to Amazon EC2


價格PK:

Google vs. AWS Pricing: Google Cuts Are First of 2015


網路速度PK

Need for speed: Testing the networking performance of the top 4 cloud providers

Amazon EC2 vs Azure vs Rackspace Cloud vs Google C. Engine | Some tests and stats


總結:


  • Google Cloud在大優點是在台灣有機房,相比AWS東京,ping大勝
  • Google在價格上有優勢
  • AWS在產品完整度上Google目前還不能比
以新創、低需求、低成本來考慮的話,Google或許是個好選擇?



2015年6月8日 星期一

joomla 移除url中的index.php



1.系統->全站設定->網站設定->使用網址重寫(URL rewrite)選擇Yes



2.將joomla站點根目錄下的htaccess .txt文件重命名為.htaccess


2015年6月3日 星期三

[轉貼]2015 5月 android 版本市佔率


統計期間: 2015/5/26~2015/06/01

VersionCodenameAPIDistribution
2.2Froyo80.3%
2.3.3 -
2.3.7
Gingerbread105.6%
4.0.3 -
4.0.4
Ice Cream Sandwich155.1%
4.1.xJelly Bean1614.7%
4.2.x1717.5%
4.3185.2%
4.4KitKat1939.2%
5.0Lollipop2111.6%
5.1220.8%












資料來源:

2015年5月19日 星期二

linux sync指令


Linux 系統中,為了加快資料的讀取速度,寫入硬盤的資料有的時候為了效能,會寫到 filesystem buffer 中,這個 buffer 是一塊記憶體空間,如果欲寫入硬碟的資料存此 buffer 中,而系統又突然斷電的話,那資料就會流失!


  • 可以透sync 指令,將存 buffer 中的資料強制寫入disk中;


Name

sync - synchronize data on disk with memory

Synopsis

sync [--help] [--version]

Description

 sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The sync program does nothing but exercise the sync system call.
The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the file system corrupted as a result. sync ensures that everything in memory is written to disk.

sync should be called before the processor is halted in an unusual manner (e.g., before causing a kernel panic when debugging new kernel code). In general, the processor should be halted using the shutdown or reboot or halt commands, which will attempt to put the system in a quiescent state before calling sync.




  • 或是在程式中利用sync() function ;


Name

sync - commit buffer cache to disk

Synopsis

#include <unistd.h>

void sync(void);

Feature Test Macro Requirements for glibc

sync():
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED


Description

sync() causes all buffered modifications to file metadata and data to be written to the underlying file systems.

Errors

sync() is always successful.


資料來源:
sync(2) - Linux man page
sync(8) - Linux man page

2015年4月6日 星期一

[轉貼/筆記]JNI


JNI 是用來讓Java跟別種語言溝通的函式庫,以C/C++ 為例,分為C call Java與Java call C。


JNI整個流程(java call c 的範例

開發環境:Netbeans, Microsoft Visual Studio 2005

1.使用Netbeans新增專案,選擇Java Application


2.專案名稱:JNIFirst


3.新增Java Class檔


4.檔名:JNIHello,注意不要將JNIHello.java包在package內,不然編譯.h檔時會error。



5.撰寫JNIHello.java內的code


6.接下來要產生.h檔,要用commend line的方式下指令,若你的電腦尚未設定用cmd下java指令的 話可以參考我寫的這篇"設定java環境變數使cmd能下javac等命令";首先要先
切換到JNIHello.java檔的目錄下,下指令產生.class,再用class檔產生.h檔,指令:javac JNIHello.java
javah -jni JNIHello
(2010.1.25新增:要是有package, 輸入指令javah -jni [PACKAGE].[CLASSNAME]
,並注意要移到package的上層資料夾.)
(2010.8.30新增:修改package名稱請檢查三部分-----1.重新產生.h檔 2.修改include檔名 3.修改function名稱. )
如圖中。


7.Netbeans使用暫告一段落。開啟Microsoft Visuall Studio 2005,新增專案選
類別庫(library),
專案名稱:JNIHelloWorld。


8.將剛剛由Netbeans產生的
JNIHello.h檔copy到此Project的JNIHelloWorld目錄下。


9.將專案自動產生的
JNIHelloWord.h刪除加入我們剛copy進來的JNIHello.h檔。(當然也可以在新增專案時將名稱設為JNIHello,這樣就不用改名稱直接覆蓋即可,此處為了要說明.h檔與Project的關係故意取不同名稱。)


10.加入JNIHello.h。


11.打開JNIHello.h檔看一下紅框處,function name為Java_JNIHello_printHelloWorld,撰寫cpp檔時就要用這個function。


12.撰寫JNIHelloWorld.cpp,code如圖中。


13.因為有include"jni.h"所以要設定VC的path讓它找的到。選工具->選項。


14.選VC++目錄,include檔案,新增path。


15.設定好之後可以來產生.dll檔案了,選擇建置方案或按F7。


16.建置完成會產生JNIHelloWorld.dll,
注意檔案是產生在JNIHelloWorld Project目錄下的debug,d為小寫,不是產生在JNIHelloWorld->JNIHelloWorld->Debug;將dll複製到Netbeans的Project目錄下。


17.開Netbeans,看一下我們剛寫JNIHello.java,由於dll的檔名為JNIHelloWorld.dll,所以要
將紅框處修改為JNIHelloWorld


18.現在來建置一下看看結果是否成功,選run main project。


19.秀出Hello World!。成功囉!


JNI下的Java資料型別


JNI下的C/C++程式如果要使用Java的資料型別,型別名稱前必須要加上「j」,例如:「int」變成「jint」,「long long」變成「jlong」,「String」變成「jstring」,都是小寫字母。這裡要注意的是,如果是物件型別(非基本資料型別)的話,只有特定幾個物件可以直接加上「j」,像是「String」或是「Array」,不然的話都是「jobject」。



資料來源: