2022年4月24日 星期日

DLL 檢查相依性工具

Just a meno for DLL Dependency checker tool https://github.com/lucasg/Dependencies

2018年8月3日 星期五

Using Python with OpenCV

Just test Python with OpenCV for images process...

2014年6月13日 星期五

用C#開發 多執行緒的陽春Web Server

花了幾個小時搞出來的陽春Web Server , 打算用在克難的公司環境, 提供簡單的服務. C#其實不錯用, 多虧了MSDN, 省了不少功夫.... Source Code 等我整理好註解, 再丟上來吧...

2014年4月8日 星期二

JNI 呼叫C, 由C控制 DHT11讀取溫濕度 (完成版)

其實上次的錯誤有兩個原因, 那天躺到床上時, 忽然就想到了 XD

1. 權限問題, 要用  sudo java -Djava.library.path=. JavaDHT 來執行
2. 程式碼問題, 我忘記要先呼叫 bcm2835_init()

其他不多說, 看Code就行了....

2014年4月4日 星期五

JNI 呼叫C, 由C控制 DHT11讀取溫濕度 (未完成版)

今天嘗試使用JNI 呼叫C, 由C控制 DHT11讀取溫濕度的值.
不過遇到一個奇怪的錯誤.


pi@raspberrypi ~/jni $ sudo java -Djava.library.path=. JavaDHT
DEBUG theStr--> Java_JavaDHT_readDHTfromC
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xa8cb239c, pid=2663, tid=3057022064
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) Client VM (23.21-b01 mixed mode linux-arm )
# Problematic frame:
# C  [libJavaDHT.so+0x239c]  bcm2835_peri_read+0x18
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/pi/jni/hs_err_pid2663.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

這裡有個日本人也有類似問題, 不過夜深了, 明天再來研究好了
http://broadbeans.blog.so-net.ne.jp/2013-08-27

2014年4月3日 星期四

Raspberry Pi 上做LCD輸出

之前測試的Raspberry Pi 上做LCD輸出的照片~


參考資料:

JNI Example

由於許多控制電子元件適合用Native Code來做, 於是關注了JNI 的一些功能. 不可免俗的也做了JNI 版本的 HelloWorld.


1. 首先建立要使用JNI的 JavaCallC.java 檔 以及 要被JNI呼叫的 JavaCallC.c 檔
2. 利用建立好的 JavaCallC.java 產生 JavaCallC.h
javac JavaCallC.java
javah -jni JavaCallC

3. 產生 libJavaCallC.so
gcc -shared -I /opt/java/jdk1.7.0_21/include/ -I /opt/java/jdk1.7.0_21/include/linux/ JavaCallC.c -o libJavaCallC.so

4. 執行
java -Djava.library.path=. JavaCallC

5.結果輸出
Hello world from C Language JavaCallC.c csayhello!

參考資料

2013年11月12日 星期二

JavaSim

前一陣子使用JavaSim做一些Simulation時候發現, 當一次要重複Simulation時, 基於SimulationProcess 的 thread 會無法釋放,進而導致Server資源的浪費.解決方法是在 finalize 函式中對 mutex 做 notify(). 其實用OpenSource 的Project 要有Debug的能力, 因為通常沒有足夠的文件或是註解可以說明, 不過爬code也是很有趣的...
org.javasim.SimulationProcess.finalize ()

另外每次Simulation調用Scheduler之後要呼叫 Scheduler.reset();才能做第二次的Simulation

2013年4月9日 星期二

Good WEB UI Framework - Vaadin

好久沒有看到讓人興奮的新技術了,趁睡不著的時候,趕快紀錄一下~

今天同事分享了 Vaadin 這個Framework,真的讓我有驚為天人的感覺。其實他的概念和之前接觸到的JSF很像,不過看了原廠和同事的Demo後覺得這個真的是不錯的Framework,開發上使用了之前Java上慣用的Swing開發方式,前台網頁和JavaScript 和 AJAX 的互動全部由後台程式產生, 對開發人員而言真的是很方便。想到之前和CSS還有JQuery 奮戰的過程,不禁讓人覺得相見恨晚阿。不過看起來這樣的架構會不會有讓美工人員不易和程式設計師分工的問題還要深入研究一下, 當然對於中小型專案影響不大。

然後重要的來了~他是採Apache V2 授權的開放原始碼專案,可以有效降低期初的投入成本,商業應用上也比較ok。

其他的部份要看完文件和實做才能深入體驗,看起來文件也蠻豐富的,又有新東西可以研究了,也是美事一樁阿~

https://vaadin.com/comparison 這個比較表很適合快速瀏覽一下他和其他framework的不同。



2013年1月25日 星期五

自動化模擬軟體

最近的工作內容接觸到一些生產線的分析,不過目前看起來用靜態分析方式會有蠻大的落差. 使用自動化模擬軟體可能是比較完整的解決方案。

目前業界比較有名的自動化模擬軟體如下:
Enterprise Dynamics,Flexsim,AutoMod,Arena,WITNESS

不過依照本人愛好自由軟體的精神,也找了一套Open Source的相關軟體,目前是德國漢堡大學在維護的.


DESMO-J is an object-oriented framework targeted at programmers developing simulation models. The acronym "DESMO-J" stands for "Discrete-Event Simulation and Modelling in Java". This longer name highlights DESMO-J's two significant properties:

DESMO-J supports the discrete-event simulation paradigm. In models of this type, all system state changes are supposed to happen at discrete points in time. Between such events the system state is assumed to remain constant. Discrete-event simulation is therefore particularly suitable for systems in which relevant changes of state occur suddenly and irregularly, like queueing networks for example.
DESMO-J is implemented in Java. Using this framework to build simulation models ultimately results in writing a Java program.

還有另一套用GPL 授權的 JSL(Java Simulation Library)  https://bitbucket.org/rossetti/jsl/overview
真的要玩再來研究一下....

不過簡單的分析可以透過用程式語言的分散式架構配合多執行緒直接Coding, 目前在想有必要作到這個程度嗎...

https://bitbucket.org/rossetti/jsl/overview

2012年8月3日 星期五

開放源始碼(Open Source) game project 的評估

今天抓了幾個sourceforge上的Game研究一下, 簡略列一下優缺點

Pros:

  1. 部分可以使用
  2. 有較完整的軟體介面及遊戲邏輯可以參考
Cons:
  1. 大部分沒有完整的Document和注解, 維護和修改要花不少時間
  2. sourceforge上大多採取GPL的授權, 找了幾個WEB Game 都是採取AGPL的授權...也就是修改後必須公開原始碼(包含修改的部分)這方面比較會有爭議
  3. 不同的Project用了不同的開發環境, 建置開發環境及編譯原始碼要花不少精神

以HTML5的Web Game為例,有不少的game engine可以用,例如  impactjs 這個號稱開發一個乒乓球遊戲只要15分鐘. 以目前遊戲開發的工具越來越普及和易用的狀況下,自行開發應該彈性較大

這兒有開放源始碼(Open Source)相關授權的說明,可以參考一下

那些台灣軟體產業所缺少的 – 開放源始碼
ASP 與自由/開放源碼軟體的散布條款
授權條款內容的修改
Open Source霧裡看花懶人包
別怕 GPL

一些遊戲開發工具的連結

2012年7月5日 星期四

安裝Hadoop 1.0.2 在Ubuntu 11

安裝Hadoop的部份還蠻簡單的,照著網路上的文章就可以成功了

http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/
http://changyy.pixnet.net/blog/post/25245658-%5Blinux%5D-%E5%AE%89%E8%A3%9D%E5%96%AE%E6%A9%9F%E7%89%88-hadoop-0.20.1-single-node-cluster-(p

這部份沒有特別要注意的,接下來要測試Hadoop的功能以及實做多節點的Cluster

2012年4月2日 星期一

Boot into text mode with Ubuntu 11.10

基本上是參考這篇,不過照著作不Work...
又看了這一篇,自己試了一下好像可以了,趕快筆記一下...

編輯 /etc/default/grub

arthur@ubuntu:~$ sudo vi /etc/default/grub
[sudo] password for arthur:

將下面這行
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
改成
GRUB_CMDLINE_LINUX_DEFAULT="text"

然後在把這行前面#拿掉
GRUB_TERMINAL=console  //text base grub menu


存檔後作 update-grub
arthur@ubuntu:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-17-generic
Found initrd image: /boot/initrd.img-3.0.0-17-generic
Found linux image: /boot/vmlinuz-3.0.0-16-generic
Found initrd image: /boot/initrd.img-3.0.0-16-generic
Found linux image: /boot/vmlinuz-3.0.0-12-generic
Found initrd image: /boot/initrd.img-3.0.0-12-generic
Found memtest86+ image: /boot/memtest86+.bin
done
arthur@ubuntu:~$

要啟動桌面的話輸入 startx  就可以了,不過不要desktop的話直接裝server版就好了...我好像多此一舉...

2012年3月20日 星期二

跨平台的APP應用程式框架

本來認為使用HTML + CSS 配合jQuery 就可以在前端應用方面打遍天下無敵手了~不過在行動裝置上的使用者體驗還是不夠好,加上無法和行動裝置的硬體(ex.相機)直接互動,總是不夠完美。

目前跨平台的APP應用程式框架有Titanium MobilePhoneGap 兩種,端看應用程式需求來選擇。
偏向遊戲開發有 corona unity 可以選用。

不過目前開發的方向也還沒確定,所以先筆記一下...

參考資料
再談Titanium Mobile與PhoneGap的差異
從使用者角度看 Native app vs Web app

2012年3月17日 星期六

Hadoop

最近稍微看了一下Apache 的 Hadoop 簡單的說 Hadoop 就是雲端系統的架構。
然後發現產業界也蠻多公司在使用的,像是FaceBook 的內部系統就有兩組clusters

A 1100-machine cluster with 8800 cores and about 12 PB raw storage.
A 300-machine cluster with 2400 cores and about 3 PB raw storage.

一千多台的電腦組成的Cluster,想到就覺得很壯觀。

好奇查了一下台灣的使用情形,意外的發現TSMC有在用Hadoop而且還組成推廣小組,同時計畫要作 semiconductor manufacturing and engineering related applications.

2011年12月23日 星期五

強迫中止Scan32.exe

這問題困擾了一段時間,主要是公司的電腦在特定的時間會自動運行 scan32.exe.
CPU loading 是不高,不過佔用Disk I/O 非常嚴重~連要回個mail 都不行...

Google 一下後,發現用ntsd 可以Force Kill process.

指令如下:
@ntsd -c q -pn scan32.exe

弄完之後,終於可以回mail 了...

2011年11月25日 星期五

Siena 全文檢索的問題

最近使用Play! + Siena + GAE 時發現,作類似SQL Like 的Search 時,會傳回所有的資料...
在Stackoverflow 中的討論發現,Siena 由於GAE的限制,在這方面的實做有限...

http://stackoverflow.com/questions/6307841/how-does-siena-query-search-work

也就是支援文字完全相同的和結尾字串相同的比對...真的很雞肋...
就算使用JDBC也必須先手動建立Full text index...

所以看來還是JPA比較有彈性...

2011年7月22日 星期五

轉換程式碼為HTML

備忘一下~線上程式碼語法高亮產生器 - Online syntax highlighting
http://jsgears.com/thread-120-1-1.html

還有另一個網站也有
http://tohtml.com/java/

2011年7月6日 星期三

Play Framework 實驗筆記 5- 上傳到GAE

專案在本地端測試完成之後,接下來就把專案部署到GAE裡面去吧~

1. 先修改 N:\PlayFramework\play-1.1\members\war\WEB-INF\appengine-web.xml
將GAE設定的Application ID 和版本號填入
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
	<application>arthur201104</application>
	<version>1</version>
</appengine-web-app>

再將專案匯出成WAR目錄架構
N:\PlayFramework\play-1.1>play war members -o members.war

~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.1, http://www.playframework.org
~
00:44:41,359 INFO  ~ Starting N:\PlayFramework\play-1.1\members
00:44:41,390 INFO  ~ Module siena is available (N:\PlayFramework\play-1.1\module
s\siena-1.5)
00:44:41,390 INFO  ~ Module gae is available (N:\PlayFramework\play-1.1\modules\
gae-1.4)
00:44:42,187 WARN  ~
00:44:42,187 WARN  ~ Google App Engine module
00:44:42,187 WARN  ~ ~~~~~~~~~~~~~~~~~~~~~~~
00:44:42,203 WARN  ~ No Google App Engine environment found. Setting up a develo
pment environement
00:44:42,218 WARN  ~ Don't forget to define your GAE application id in the 'war/
WEB-INF/appengine-web.xml' file
00:44:42,218 WARN  ~
00:44:42,218 INFO  ~ Precompiling ...
00:44:48,218 INFO  ~ Done.

~ Packaging current version of the framework and the application to N:\PlayFrame
work\play-1.1\members.war ...
~ Done !
~
~ You can now load N:\PlayFramework\play-1.1\members.war as a standard WAR into
your servlet container
~ You can't use play standard commands to run/stop/debug the WAR application...
~ ... just use your servlet container commands instead
~
~ Have fun!
~


最後上傳至GAE,第一次上傳過程中需要輸入Google的帳號和密碼...
M:\appengine-java-sdk-1.4.3\bin>appcfg update N:\PlayFramework\play-1.1\members.
war
Reading application configuration data...
2011/7/6 上午 12:59:14 com.google.apphosting.utils.config.AppEngineWebXmlReader
readAppEngineWebXml
資訊: Successfully processed N:/PlayFramework/play-1.1/members.war\WEB-INF/appen
gine-web.xml
2011/7/6 上午 12:59:14 com.google.apphosting.utils.config.AbstractConfigXmlReade
r readConfigXml
資訊: Successfully processed N:/PlayFramework/play-1.1/members.war\WEB-INF/web.x
ml
2011/7/6 上午 12:59:14 com.google.apphosting.utils.config.IndexesXmlReader readC
onfigXml
資訊: Successfully processed N:\PlayFramework\play-1.1\members.war\WEB-INF\appen
gine-generated\datastore-indexes-auto.xml
Beginning server interaction for arthur201104...
0% Creating staging directory
5% Scanning for jsp files.
20% Scanning files on local disk.
25% Scanned 250 files.
28% Initiating update.
31% Cloning 252 application files.
33% Cloned 100 files.
34% Cloned 200 files.
40% Uploading 70 files.
52% Uploaded 17 files.
61% Uploaded 34 files.
68% Uploaded 51 files.
73% Uploaded 68 files.
77% Initializing precompilation...
90% Deploying new version.
95% Will check again in 1 seconds.
98% Will check again in 2 seconds.
99% Will check again in 4 seconds.
99% Closing update: new version is ready to start serving.
99% Uploading index definitions.

Update completed successfully.
Success.
Cleaning up temporary files...

M:\appengine-java-sdk-1.4.3\bin>


完成之後連到你在GAE設定的Application網址,就可以看見成果了~
http://arthur201104.appspot.com/basicmemberoperation/index


http://arthur201104.appspot.com/enhancememberoperation/index

2011年7月4日 星期一

離線讀取註冊檔內容

之前發生過Windows 作業系統異常,重裝之後發現有些軟體的設定不見了(ex. PUTTY)
主要的原因是因為那些設定存於系統註冊檔裡面。所以找了一些方法將資訊挖出來...

我用的是 MiTeC Windows Registry File Viewer 可以將註冊表資訊由檔案中擷取出來。

Putty 的資訊是放在 HKEY_CURRENT_USER\Software\SimonTatham 下面,所以只要開啟 C:\Documents and Settings\UserName\NTUSER.DAT 就可以讀取設定。

至於註冊表資訊放在哪個實體檔案中,可以參閱下面連結:

資訊來源:介绍两款读注册表文件的软件