Category: ajax
ajax跟蹤文件上傳進度條
利用 jQuery 及 Firebug 來 debug web
[AJAX] 微妙的時間差
Category: doctrine
Doctrine 2 Stable Release!!
2010-12-21 這天 Doctrin2 釋出正式穩定版.
Doctrine 2 First Stable Release
這個版本工程之浩大於2008就開始開發,歷經2年半的時間努力.核心開發團隊五人於最後一年最後整合應用保有 Doctrine 1功能並重構並且導入新的DataMapper.
What is new in Doctrine 2?
- DQL is now a real language inside Doctrine, based on an EBNF that is parsed and transformed to SQL. Benefits of this refactoring are readable error messages, the generation of an AST that allows us to support many different vendors and powerful hooks for developers to modify and extend the DQL language to their needs. DQL can either be written as a string or be generated using a powerful QueryBuilder object.
- Your persistent objects (called entities in Doctrine 2) are not required to extend an abstract base class anymore. Doctrine 2 allows you to use Plain old PHP Objects.
- The UnitOfWork is not an alibi-pattern as implemented in Doctrine 1. It is the most central pattern in Doctrine 2. Instead of calling save() or delete() methods on your Doctrine_Record instances you now pass objects to the data mapper object called EntityManager and it keeps track of all changes until you request a synchronisation between database and the current objects in memory. This process is very efficient and has consistent semantics. This is a significant improvement over Doctrine 1 in terms of performance and developer ease-of-use.
- There are no code-generation steps from YAML to PHP involved in the library anymore. YAML, XML, PHP and Doc-Block Annotations are four first-class citizens for defining the metadata mapping between objects and database. A powerful caching layer allows Doctrine 2 to use runtime metadata without relying on code-generation.
- A clean architecture and powerful algorithms make Doctrine 2 magnitudes faster than Doctrine 1.
- Doctrine 2 supports an API that allows you to transform an arbitrary SQL statements into an object-structure. This feature is used by the Doctrine Query Language itself and is a first-class citizen of the library. It essentially allows you to make use of powerful vendor-specific features and complex SQL statements without having to cirumvent the ORM completely.
- Inheritance is not akward anymore. There are now three different types of inheritance to choose from: Mapped Superclasses, Single-Table- and Joined-Table-Inheritance.
- Many more features, just see the reference guide on what is possible with Doctrine 2.
Doctrine 入門(一)
準備
依照之前整合的 Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4 環境,來做學習與測試.
更改index.php
application.ini 環境
;Doctrine
autoloaderNamespaces[] = "Doctrine_"
pluginPaths.ZendX_Doctrine_Application_Resource = "ZendX/Application/Resource"
resources.doctrine.debug = 1
resources.doctrine.paths.models_path = APPLICATION_PATH "/../models"
resources.doctrine.connections.orm1.dsn.adapter = mysql
resources.doctrine.connections.orm1.dsn.user = "user"
resources.doctrine.connections.orm1.dsn.pass = "password"
resources.doctrine.connections.orm1.dsn.hostspec = "localhost"
resources.doctrine.connections.orm1.dsn.database = "orm1_sd_idv_tw"
Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4
懶惰許久~~ 趕快來補一下功課.
這篇主要介紹 Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4 的結合方式.
Doctrine 1.2.3 跟 Zend Framework 1.11.0 結合主要參考 http://pastie.org/481633 http://pastie.org/481635 使用.
目錄結構:[
]1
PHP: Doctrine
[][1][
]2 Doctrine project 始於 2006 年,2008 年開始受到矚目;網站訪客數從每日 300 人到上千人;亦可在網上搜尋到許多 Framework 整合教學文章,例如
Zend Framework、Symfony 及 CodeIgniter。
Doctrine 的主要開發者 Jonathan H Wage,今年 24歲,非常年輕。Wage 在 Symfony 創始者的資助下成為 Doctrine 成立公司後的第一位員工。
Category: embedded
micro 2440 遠端rs232 控制
micro 2440 開箱 & Embedded Linux 初見面
Category: freebsd
Phabricator 安裝

FreeBSD 安裝Gitlab 4.1
GitLab
GitLab 是一套webbase的管理系統,與有名的github 非常類似.
特性 快速, 安全與穩定的方案使用 Rails & Gitolite開發,並且使用MIT License授權.
如果這樣還沒有概念那就看看官網的 screenshots.
再來看怎摸安裝…
FreeBSD官網不支援,觀玩建議安裝使用Debian/Ubuntu 其他如RedHat linux bases都有人安裝成功過.
就是沒有FreeBSD!!!!!!!!!阿阿阿阿阿阿阿阿阿阿
FreeBsd 9.1 安裝遇到 Python not found!
Redis Key-Value資料庫建置實測
reids
Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。從2010年3月15日起,Redis的開發工作由VMware主持。
通常,Redis將數據存儲於記憶體,或被配置為使用虛擬記憶體。通過兩種方式可以實現數據持久:使用快照的方式,將內存中的數據不斷寫入磁碟;或使用類似MySQL的日誌方式,記錄每次更新的日誌。前者性能較高,但是可能會引起一定程度的數據遺失(後者相反)。
Mac 使用brew安裝reids
-> % brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.8.tar.gz
######################################################################## 100.0%
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
If this is an upgrade and you already have the homebrew.mxcl.redis.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
To start redis manually:
redis-server /usr/local/etc/redis.conf
To access the server:
redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.8: 9 files, 424K, built in 5 seconds
FreeBSD 9.0 架設安裝 redmine
之前有介紹過FreeBSD 架設 redmine.
不過現在因為版本關係不相容,以無法使用.
$ cd /usr/ports/www/redmine
$ make install clean
===> redmine-1.3.1 is marked as broken: Does not work with RubyGems 1.8.
*** Error code 1
Stop in /usr/ports/www/redmine.
$
gitolite 安裝
FreeBSD gitolite 安裝
安裝:
# cd /usr/ports/devel/gitolite ; make install clean;
安裝結束最後面會看到以下提示:
==============================================================================
Final gitolite installation instructions:
Any ssh user can be a gitolite provider. Simply run the following command as
the user:
/usr/local/bin/gl-setup /path/to/admin.ssh.key.pub
This will setup up the configuration files for gitolite, designating where the
repositories are located and other options.
The admin ssh key allows full access to the gitolite-admin repository where
additional users and repositories can be configured.
By default, the git user is created for use by gitolite.
==============================================================================
===> Correct pkg-plist sequence to create group(s) and user(s)
===> Registering installation for gitolite-2.1
===> Cleaning for gitolite-2.1
Lua for PHP 安裝
FreeBSD 架設 git Server
FreeBSD 8.2-RELEASE
Ntop FreeBSD
VirtualBox-OSE on FrreeBSD 免x11
FreeBSD 上使用 wkhtmltopdf 做網頁擷取
以往要用程式控制將網頁輸出pdf或擷取網頁,都是件浩大工程.
這次介紹如何在FreeBSD 命令列模式下即可輕易辦到,並且不需龐大的X Windows 圖形系統適合在server上跑.
以下是軟體原文介紹.
wkhtmltopdf
Convert html to pdf using webkit (qtwebkit)
Description
Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.
Introduction
Searching the web, I have found several command line tools that allow you to convert a HTML-document to a PDF-document, however they all seem to use their own, and rather incomplete rendering engine, resulting in poor quality. Recently QT 4.4 was released with a WebKit widget (WebKit is the engine of Apples Safari, which is a fork of the KDE KHtml), and making a good tool became very easy.
此軟體使用WebKit開發完成,除了flash以外其他接可正常顯示!!(包含js)
在安裝前請先確定你的FreeBSD已安裝 linux-base 套件並正常使用,並且將port tree更新.
筆記 Haproxy 設定
FreeBSD NGINX + PHP5
學習 FreeBSD ports
QEMU on FreeBSD 8.0 再你的的server上,建立自己的虛擬電腦 lab 以供測試開發.
一直以來你是否有跟我有相同的困擾? 手頭上只有一台機器,效能尚可系統負載不高.
但工作需要執行多種環境測試實驗,無法隨身攜帶各種系統. 等等困境….
一般的虛擬機器軟體又需要圖型介面,才可設定使用.(這無疑對系統又是一種負擔,與當機危險)
現在終於有實際解決方案~所需費用 0.
跨平台效能TEST
紀錄 FreeBSD make.conf
apache2 限流模組 mod_cband 說明文件
DELL PERC 6/i on FreeBSD
FreeBSD PHP4 PHP5 APACHE1 APACHE22 共存
Freebsd 安裝 iftop
Apache DDOS mod_evasive20設定檔
php execl dde
Apache的rewrite的重寫相關的參數
筆記 有用的RC.CONF
FreeBSD 7.0-RELEASE了
rrdtool create 網路圖表檔案
rrdtool 實作6台主機 LOADING 繪圖
RRDtool
ajax跟蹤文件上傳進度條
利用imagemagick來作縮圖
Freebsd 6.2 stable 之路
webalizer 分析多網站記錄 note
Link Aggregation on FreeBSD多網卡合併 頻寬
Portsnap 方式 更新porttree
印表機的安裝 on FreeBSD
color ls 彩色世界
非mmcache!Memcached的應用:多網站伺服器 PHP 共享 Session
AWStats 6.3 網站分析 簡易安裝與設定
安裝MRTG 主機流量分析
FreeBSD 安裝nvidia-driver顯卡驅動程式
SSH-keygen SSH加密KEY
freebsd 6.1 amd64(64bit) 安裝筆記
FreeBSD 6.1安裝筆記
FreeBSD 使用PHP 透過FTP連線拋檔 備份
一個小巧的程式(於英文console顯示BIG5文件)
FreeBsd上使用bt
Apache2.1.4 重新啟動時出現httpready
Category: git
Phabricator 安裝

Git 與遠端Server 應用
乘上篇文章gitolite 安裝.
當你開心使用git一陣子,又在網路上免費或付費支援git平台的版本控管後是否發覺….
真的好麻煩每次都要同步好幾台SERVER上面的repositories…
有沒有在push上server後自動幫你搞定呢?!
gitolite 安裝
FreeBSD gitolite 安裝
安裝:
# cd /usr/ports/devel/gitolite ; make install clean;
安裝結束最後面會看到以下提示:
==============================================================================
Final gitolite installation instructions:
Any ssh user can be a gitolite provider. Simply run the following command as
the user:
/usr/local/bin/gl-setup /path/to/admin.ssh.key.pub
This will setup up the configuration files for gitolite, designating where the
repositories are located and other options.
The admin ssh key allows full access to the gitolite-admin repository where
additional users and repositories can be configured.
By default, the git user is created for use by gitolite.
==============================================================================
===> Correct pkg-plist sequence to create group(s) and user(s)
===> Registering installation for gitolite-2.1
===> Cleaning for gitolite-2.1
Category: go
Go 語言~ 初學筆記
Category: iot
制霸 IoT 30Day! Day 30總結
制霸 IoT 30Day! Day 29 AIoT介紹
制霸 IoT 30Day! Day 28 Alexa語音服務開發介紹
制霸 IoT 30Day! Day 27 Mesh Network網狀網路
制霸 IoT 30Day! Day 26 LoRaWAN 開發介紹
制霸 IoT 30Day! Day 25 資料應用
制霸 IoT 30Day! Day 24 實際案例 空氣盒子專案(三)
制霸 IoT 30Day! Day 23 實際案例 空氣盒子專案(二)
制霸 IoT 30Day! Day 22 實際案例 空氣盒子專案(一)
制霸 IoT 30Day! Day 21 藍芽硬體連結
制霸 IoT 30Day! Day 20 藍芽硬體開發
制霸 IoT 30Day! Day 19 藍芽資料發送接收
制霸 IoT 30Day! Day 18 藍芽溫濕度計使用
制霸 IoT 30Day! Day 17 藍芽偵測使用
制霸 IoT 30Day! Day 16 圖表(二)
制霸 IoT 30Day! Day 15 圖表(一)
制霸 IoT 30Day! Day 14 硬體與MQTT使用連結
制霸 IoT 30Day! Day 13 MQTT使用與連結
制霸 IoT 30Day! Day 12 MQTT介紹
MQTT 介紹
昨天介紹基本的雲端連結方式非常基本,今天來介紹真正因應 IoT 而生的 MQTT(Message Queuing Telemetry Transport).
起源
MQTT 消息隊列遙測傳輸(Message Queuing Telemetry Transport)是 ISO 標準(ISO/IEC PRF 20922)下基於發布/訂閱範式的消息協議。它工作在 TCP/IP 協議族上,是為硬體性能低下的遠程設備以及網絡狀況糟糕的情況下而設計的發布/訂閱型消息協議,為此,它需要一個消息中間件 。 為何說是硬體性能低下,因為應用場景在 IoT 的應用需要考慮在低耗電長時間待命的狀態下在短時間內完成資料傳送過程。 以及網絡狀況糟糕,因為地處偏遠訊號複雜狀態下會做訊息傳送與接收的確認。
制霸 IoT 30Day! Day 11 硬體開發介紹(二)
硬體開發介紹(二)
上一篇介紹硬體的溫斯度讀取,看是沒有相關其實今天要來介紹真正上雲端的部分!實際把家裡的溫度濕度傳送到雲端。
制霸 IoT 30Day! Day 10 硬體開發介紹(一)
硬體開發介紹(一)
前幾天介紹一些開發工具現在使用 PlatformIO 來開發,現在進入正式開發先從小東西開始!溫度。這邊就紹如何取的溫度,依照手邊材料目前有 AHT10。
AHT10
制霸 IoT 30Day! Day 09 開發工具介紹(二)
開發工具介紹(二)
昨天介開發工具 Windows, Linux, MacOSX 都可以使用的 Arduino 工具。介面簡單操作直覺但是其實還是很多不便利的,程式編輯器部分沒有很聰明易用,今天介紹另一款整合在編輯器的開發工具。
PlatformIO
PlatformIO 是一個開源的 IoT 開發工具平台。包含跨平台開發,除錯,單元測試還有韌體上傳一應俱全。
PlatformIO logo
制霸 IoT 30Day! Day 08 開發工具介紹(一)
開發工具介紹(一)
前幾天一直都在介紹相關知識與論述,現在進入開發階段會介紹幾個基本開放源碼的免付費工具。一般來說都是跨平台的開發工具 Windows, Linux, MacOSX 都可以使用唷。
Arduino Software IDE
首先介紹最具知名的Arduino專案始於 2003 年,作為義大利伊夫雷亞地區伊夫雷亞互動設計研究所的學生專案,是一家製作開源硬體和開源軟體的公司。同時兼有專案和用戶社群,該公司負責設計和製造單板微控制器和微控制器套件,用於構建數位裝置和互動式物件,以便在物理和數位世界中感知和控制物件。該專案的產品是按照 GNU 寬通用公共許可證(LGPL)或 GNU 通用公共許可證(GPL)許可的開源硬體和軟體分發的,Arduino 允許任何人製造 Arduino 板和軟體分發。 Arduino 板可以以預裝的形式商業銷售,也可以作為 DIY 套件購買。
制霸 IoT 30Day! Day 07 平台 雲端服務介紹
平台 介紹
ARM® mbed™ IoT
Mbed 是 ARM 2009 年 9 月 21 日 所創立一個平台和作業系統,用於基於 32-bit ARM Cortex-M 微控制器的連接網際網路的裝置,這些裝置也叫做物聯網裝置。這個專案由 ARM 和它的技術夥伴共同作業開發。
現有各種針對 mbed 平台的硬體演示板,其首為最初的 mbed Microcontroller board。mbed 微控制器開發板(以「mbed NXP LPC1768」銷售)是基於 NXP 微控制器的演示板,它有一個 ARM Cortex M3 核心,執行於 96 MHz,帶有 512 KB flash,64 KB RAM,還有一些介面包括乙太網路、USB 裝置、CAN、SPI、I²C 和其他 I/O。mbed 微控制器在 2010 年收到了第一個獎項,年度 EDN 軟體/嵌入式工具類創新獎。
制霸 IoT 30Day! Day 06 2.4GHz 裝置介紹(二)
2.4GHz 裝置(二)
再來繼續介紹 2.4Ghz 的裝置 然後是 Bluetooth, ZigBee 這部分的裝置。這些有特點就是司要閘道去送資料到網際網路。或者就是區域型基地台直接做接收處理,像是手機與藍牙通訊手機統整資料再發送到雲端或客戶直接操作。
標題文字 | WIFI | Zigbee | 電力載波 | Bluetooth |
---|---|---|---|---|
傳輸距離 | 100-300M | 50-300M | 500M | 1-10M |
傳輸速率 | 300Mbps | 250kbps | 500Mbps | 1Mbps |
功耗 | 10-50mA | 5mA | zigbee 和 WIFI 之間 | |
特點 | 應用最廣 | 可自組網,網路節點數最大可達 65000 個。 | 可基於電力線傳輸,無需布線。 |
回顧一下優各個重點
制霸 IoT 30Day! Day 05 2.4GHz 裝置介紹(一)
2.4GHz 裝置
再來介紹 2.4Ghz 的裝置,這部分 IoT 主要的是應用使用的頻譜區塊。因為是開放的共用區塊只有台灣還是得經過NCC認證才可販售,應用的傳輸很多種目前主要 WIFI, Bluetooth, ZigBee。
制霸 IoT 30Day! Day 04 IoT LPWAN介紹
LPWAN 低功率網路
這邊首先一開始先介紹 LPWAN(Low-Power Wide-Area Network,低功率廣域網路)也稱為 LPWA (Low-Power Wide-Area) 或 LPN(Low-Power Network,低功率網路),是一種用在物聯網(例如以電池為電源的感測器),可以用低比特率進行長距離通訊的無線網路。低電量需求、低比特率與使用時機可以用來區分 LPWAN 與無線廣域網路,無線廣域網路被設計來連接企業或用戶,可以傳輸更多資料但也更耗能。
制霸 IoT 30Day! Day 03 IoT 語音智慧裝置
制霸 IoT 30Day! Day 02 IoT 介紹
IoT 概論
IoT 技術(英語:Internet of Things,縮寫 IoT)是網際網路、傳統電信網等資訊承載體,讓所有能行使獨立功能的普通裝置實現互聯互通的網路。更廣泛定每個物件都可以透過網路通訊傳送資料或怎與其他裝置互動。原始構想一個人周圍大約含有一千至五千個裝置。所以在換算人口數量其中預期數量會很驚人大約會有一千兆以上裝置。
制霸IoT 30Day!Day 01
制霸 IoT 30Day! Day 01
動機
這是我第一次參加 IT 邦幫忙鐵人賽,老實說我也不知道我會不會完賽。以往經驗的要連續 30 天來產出文章來說,對於我這個文筆不好又不善於表達的人大約有 101 這樣高的障礙吧。 目前來說看到這塊領域 IoT 這邊算是百花齊放的時代,君不見台灣有專門課程或成熟的觀念來做的相關應用與學術探討。
Category: iphone-developer
iPhone SDK 相關網站
加入 iPhone Developer
Category: javascript
一堆 width / height
使用Js來讓IE支援png圖片透明效果
javascript正則表達式中用於replace
Category: jetson-nano
Jetson Nano OpenCV 測試
Category: jquery
jQuery 1.4 研究與報導 之個人見解(二)
New .toArray() method
.get()用來轉換陣列,將被移除.
jQuery1.4 請使用.toArray() 不用帶入參數可以自動解析.
jQuery() returns empty set
在舊版jQuery1.3 jQuery() 會回傳整個結構函數.
jQuery1.4 將改善此現象 回傳一個空函數.
PS:保留jQuery().ready() 和 jQuery(function(){}).
jQuery(“TAG”)
快數透過TAG目標定義選取.
CSS
The performance of the .css() method has seen a 2x performance improvement.
.css()速度大幅增長2倍,請看官方圖表.
The performance of the .addClass()
, .removeClass()
, and .hasClass()
methods has seen a 3x performance improvement.
.addClass().removeClass().hasClass()
速度大幅增長3倍,請看官方圖表.
Category: lua
Lua for PHP 實測
繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度.
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.
index.php
array_b = $array_b;
//測試PHP物件排序效能
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_a);
rsort($array_a);
//var_dump($array_a);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示PHP執行結果所需時間
echo "PHP rsort time $times \n";
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_b);
//測試Lua物件排序效能
$array_b = $lua->test();
//var_dump($array_b);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示Lua執行結果所需時間
echo "Lua array sort time $times \n";
test.lua
function test()
table.sort( array_b )
return array_b
end
Lua for Windows 開發 筆記
下載:Lua 5.2.0-work2 – Release 1
先參考此篇教學Using Lua with C#並去 LuaInterface 下載回來,看了一下注意事項好像必須 Microsoft Visual C++ 2008 可轉散發套件 (x86) 一併下載回來比較保險.
後來找到 luaforwindows Windows底下Lua整合套件.
Lua for PHP 安裝
Category: mac-osx
Open Source TextMate 2
Redis Key-Value資料庫建置實測
reids
Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。從2010年3月15日起,Redis的開發工作由VMware主持。
通常,Redis將數據存儲於記憶體,或被配置為使用虛擬記憶體。通過兩種方式可以實現數據持久:使用快照的方式,將內存中的數據不斷寫入磁碟;或使用類似MySQL的日誌方式,記錄每次更新的日誌。前者性能較高,但是可能會引起一定程度的數據遺失(後者相反)。
Mac 使用brew安裝reids
-> % brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.8.tar.gz
######################################################################## 100.0%
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
If this is an upgrade and you already have the homebrew.mxcl.redis.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
To start redis manually:
redis-server /usr/local/etc/redis.conf
To access the server:
redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.8: 9 files, 424K, built in 5 seconds
ZFS on MAC OSX
ZFS 是很好檔案系統,可惜因為種種原因…沒有機會在OSX 上面使用.
MACZFS
是好心人porting到MAC OSX上面,只要下載安裝包下來就可以直接使用.
以下是實際使用方式:
先查看目前磁碟使用狀況.
# diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 300.9 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
4: Apple_HFS data 198.2 GB disk0s4
Category: micro-2440
micro 2440 遠端rs232 控制
micro 2440 開箱 & Embedded Linux 初見面
Category: php-amp-mysql
Using Redis.
Readis
Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
1.Installation
a.Mac OSX[
]1
b.Ubuntu
-> % sudo apt-get install redis-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libjemalloc1 redis-tools
The following NEW packages will be installed:
libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 84 not upgraded.
Need to get 410 kB of archives.
After this operation, 1,272 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/universe libjemalloc1 amd64 3.5.1-2 [76.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/universe redis-tools amd64 2:2.8.4-2 [65.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/universe redis-server amd64 2:2.8.4-2 [267 kB]
Fetched 410 kB in 2s (176 kB/s)
Selecting previously unselected package libjemalloc1.
(Reading database ... 300693 files and directories currently installed.)
Preparing to unpack .../libjemalloc1_3.5.1-2_amd64.deb ...
Unpacking libjemalloc1 (3.5.1-2) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../redis-tools_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-tools (2:2.8.4-2) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../redis-server_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-server (2:2.8.4-2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libjemalloc1 (3.5.1-2) ...
Setting up redis-tools (2:2.8.4-2) ...
Setting up redis-server (2:2.8.4-2) ...
Starting redis-server: redis-server.
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Processing triggers for ureadahead (0.100.0-16) ...
stevelo@stevelo-pc [12:01:47] [~]
Using Twig with Phalcon PHP and kill it!!
Using Twig with Phalcon PHP.
Twig is a modern template engine for PHP.
Now we can Using Twig with Phalcon.
How to do:
1.Install Twing in library as git submodule.
git submodule add git@github.com:fabpot/Twig.git app/library/Twig
2.Install phalcon incubator in library as git submodule.
git submodule add git@github.com:phalcon/incubator.git app/library/incubator
Phalcon framework testing
luosteve@SteveMac [10:55:51] [~/tmp]
-> % git clone --depth=1 git://github.com/phalcon/cphalcon.git
Cloning into 'cphalcon'...
remote: Counting objects: 1437, done.
remote: Compressing objects: 100% (971/971), done.
remote: Total 1437 (delta 593), reused 799 (delta 352)
Receiving objects: 100% (1437/1437), 2.08 MiB | 792.00 KiB/s, done.
Resolving deltas: 100% (593/593), done.
Checking connectivity... done.
luosteve@SteveMac [10:56:01] [~/tmp]
-> % cd cphalcon/build
root@SteveMac [10:56:35] [~/tmp/cphalcon/build] [master]
-> # ./install
.
.
.
.
.
.
une=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -o phalcon.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/luosteve/tmp/cphalcon/build/64bits/modules phalcon.lo
gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/phalcon.so -bundle .libs/phalcon.o -march=native -mtune=native
dsymutil .libs/phalcon.so || :
warning: no debug symbols in executable (-arch x86_64)
creating phalcon.la
(cd .libs && rm -f phalcon.la && ln -s ../phalcon.la phalcon.la)
/bin/sh /Users/luosteve/tmp/cphalcon/build/64bits/libtool --mode=install cp ./phalcon.la /Users/luosteve/tmp/cphalcon/build/64bits/modules
cp ./.libs/phalcon.so /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.so
cp ./.libs/phalcon.lai /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.la
----------------------------------------------------------------------
Libraries have been installed in:
/Users/luosteve/tmp/cphalcon/build/64bits/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /Users/luosteve/.phpbrew/php/php-5.5.10/lib/php/extensions/no-debug-non-zts-20121212/
Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation
./install 27.78s user 3.81s system 99% cpu 31.690 total
Gearman 不一樣的用法~~
Gearman
你所知道的Gearman
可以導入大量數據、發送許多電子郵件、編碼視頻文件、挖據數據並構建一個中央日誌設施 — 所有這些均不會影響站點的體驗和響應性。可以並行地處理數據。而且,由於 Gearman 協議是獨立於語言和平台的,所以您可以在解決方案中混合編程語言。比如,可以用 PHP 編寫一個 producer,用 C、Ruby 或其他任何支持 Gearman 庫的語言編寫 worker。
你所應用Gearman[
]1
PHP extension Redis 安裝使用
PHP extension Redis 安裝使用
安裝 PHP extension for Redis 使PHP可以與Redis運作.
安裝
$ cd /tmp
$ git clone git://github.com/nicolasff/phpredis.git
$ cd /tmp/phpredis
$ phpize
$ ./configure
$ make
$ make install clean
#編輯 php.ini加入
extension=redis.so
Redis Key-Value資料庫建置實測
reids
Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。從2010年3月15日起,Redis的開發工作由VMware主持。
通常,Redis將數據存儲於記憶體,或被配置為使用虛擬記憶體。通過兩種方式可以實現數據持久:使用快照的方式,將內存中的數據不斷寫入磁碟;或使用類似MySQL的日誌方式,記錄每次更新的日誌。前者性能較高,但是可能會引起一定程度的數據遺失(後者相反)。
Mac 使用brew安裝reids
-> % brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.8.tar.gz
######################################################################## 100.0%
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
If this is an upgrade and you already have the homebrew.mxcl.redis.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
To start redis manually:
redis-server /usr/local/etc/redis.conf
To access the server:
redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.8: 9 files, 424K, built in 5 seconds
FuelPHP FrameWork 進入! Enter~~
安裝之前有說過哩:請參考 FuelPHP FrameWork 初體驗~~
之前說過 作者將APP 整個包在FrameWork 內的蠢話. 我可以不承認嗎XDD
其實算是給開發人員快速進入,實作體驗FrameWork用的.
如果要自行快速分離請先參考 同事強做:【程式筆記】建立一個FuelPHP的應用程式Git Repository
如果這樣不能滿足你,接下來江示範如何調整.
FuelPHP FrameWork 初體驗~~
FuelPHP is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.
FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧.
安裝
安裝方式不免俗來了,快速按裝.(不錯唷)
$ curl get.fuelphp.com/oil | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 244 100 244 0 0 240 0 0:00:01 0:00:01 --:--:-- 1257
Password:
$
Gearman Install on Ubuntu
MongoDB Sharing
MongoDB Sharing[
]1
可以先看看官網介紹:Sharding Introduction
Shards 類似 Mysql 的Data nodes.
Config Servers 類似 Mysql 的Management node.
Routing Processes 類似 Mysql 的SQL node.
MongoDB VS Mysql 簡單測試.
廢話不多說.
MongoDB 使用 MongoDB Object Document Mapper測試.
Mysql 使用 Object Relational Mapper測試.
MongoDB部分:
config.php
register();
$classLoader = new ClassLoader('Doctrine\ODM\MongoDB', __DIR__ . '/../../lib');
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\MongoDB', __DIR__ . '/../../lib/vendor/doctrine-mongodb/lib');
$classLoader->register();
$classLoader = new ClassLoader('Symfony', __DIR__ . '/../../lib/vendor');
$classLoader->register();
$classLoader = new ClassLoader('Documents', __DIR__);
$classLoader->register();
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setHydratorDir(__DIR__ . '/Hydrators');
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm_sandbox');
//使用safe模式
$con = new Connection('localhost',array('safe'=>true, 'w' => 2,'wtimeoutMS' => 2000));
//使用一般模式
//$con = new Connection('localhost');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\');
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents'));
$dm = DocumentManager::create($con, $config);
Lua for PHP 實測
繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度.
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.
index.php
array_b = $array_b;
//測試PHP物件排序效能
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_a);
rsort($array_a);
//var_dump($array_a);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示PHP執行結果所需時間
echo "PHP rsort time $times \n";
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
//var_dump($array_b);
//測試Lua物件排序效能
$array_b = $lua->test();
//var_dump($array_b);
$mtime = explode(' ', microtime());
$times=number_format(($mtime[1] + $mtime[0] - $starttime), 8);
//顯示Lua執行結果所需時間
echo "Lua array sort time $times \n";
test.lua
function test()
table.sort( array_b )
return array_b
end
MongoDB 新手入門筆記~
Lua for PHP 安裝
Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4
懶惰許久~~ 趕快來補一下功課.
這篇主要介紹 Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4 的結合方式.
Doctrine 1.2.3 跟 Zend Framework 1.11.0 結合主要參考 http://pastie.org/481633 http://pastie.org/481635 使用.
目錄結構:[
]1
FreeBSD 上使用 wkhtmltopdf 做網頁擷取
以往要用程式控制將網頁輸出pdf或擷取網頁,都是件浩大工程.
這次介紹如何在FreeBSD 命令列模式下即可輕易辦到,並且不需龐大的X Windows 圖形系統適合在server上跑.
以下是軟體原文介紹.
wkhtmltopdf
Convert html to pdf using webkit (qtwebkit)
Description
Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.
Introduction
Searching the web, I have found several command line tools that allow you to convert a HTML-document to a PDF-document, however they all seem to use their own, and rather incomplete rendering engine, resulting in poor quality. Recently QT 4.4 was released with a WebKit widget (WebKit is the engine of Apples Safari, which is a fork of the KDE KHtml), and making a good tool became very easy.
此軟體使用WebKit開發完成,除了flash以外其他接可正常顯示!!(包含js)
在安裝前請先確定你的FreeBSD已安裝 linux-base 套件並正常使用,並且將port tree更新.
Zend Framework multidb 不好用我自己來 Mudb
Zend Framework + Smarty3 整合應用
Zend Framework + Smarty2 + Smarty3 整合應用
Zend Famework 1.10.3 + ZFDebug
FreeBSD NGINX + PHP5
Loadfile Class PHP效能增進
改造 ZF架構呼叫檔案方式
安裝php mssql 模組 使用FreeTDS編譯遇到的問題
MySQL Master/Slave Server (Replication Database)
ajax跟蹤文件上傳進度條
PHP MySQL Tips
IE中打開UTF-8編碼title為中文的網頁會顯示空白頁的問題
月曆
亂數取碼當成驗證碼的問題
如何秀出複數的排序條件資料
PHP GooGle PageRank程式
Category: python
PyMSN Python 開發的MSN 模組 (一)基本介紹
Category: ruby
FreeBSD 安裝使用RVM
Ruby Version Manager
Ruby Version Manager
介紹
最近同事都在看Ruby,想說跟進一下神人們的腳步.看看是不是可以開竅點@@
Ruby 依照以前安裝套件經驗,版本是最難搞的.
慶幸有很多開發人員先鋒,做的很多貢獻.
如今才有RVM Ruby Version Manager 誕生!!解決很多初學者很多困擾障礙.
RVM是一套Ruby版本控管可以在各版號切換.甚至自定版號與安裝套件之間切換.
Category: zend-framework
Zend Framework 2.0 的一點筆記AutoLoader HelperBroker
此筆記心得:
AutoLoader改變:
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader();
$loader->registerNamespace('ZFDebug', __DIR__ . '/../library/ZFDebug')
->registerPrefix('Phly_', __DIR__ . '/../library/Phly');
$loader->register();
Zend Framework 2.0 體驗~
Zend Framework 以sub domain 為基準 routes
以Zend Framework 建置專案大部分的 routes:
http://www.test.tw/module/controller/action
例如:
http://www.test.tw/index/main/frontpage
則:
module 為 index
controller 為 main
action 為 frontpage
Doctrine 入門(一)
準備
依照之前整合的 Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4 環境,來做學習與測試.
更改index.php
application.ini 環境
;Doctrine
autoloaderNamespaces[] = "Doctrine_"
pluginPaths.ZendX_Doctrine_Application_Resource = "ZendX/Application/Resource"
resources.doctrine.debug = 1
resources.doctrine.paths.models_path = APPLICATION_PATH "/../models"
resources.doctrine.connections.orm1.dsn.adapter = mysql
resources.doctrine.connections.orm1.dsn.user = "user"
resources.doctrine.connections.orm1.dsn.pass = "password"
resources.doctrine.connections.orm1.dsn.hostspec = "localhost"
resources.doctrine.connections.orm1.dsn.database = "orm1_sd_idv_tw"
Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4
懶惰許久~~ 趕快來補一下功課.
這篇主要介紹 Zend Framework 1.11.0 and Doctrine 1.2.3 and Smarty 3.0.4 的結合方式.
Doctrine 1.2.3 跟 Zend Framework 1.11.0 結合主要參考 http://pastie.org/481633 http://pastie.org/481635 使用.
目錄結構:[
]1
Zend Framework multidb 不好用我自己來 Mudb
Zend Framework + Smarty3 整合應用
Zend Framework + Smarty2 + Smarty3 整合應用
Zend Famework 1.10.3 + ZFDebug
改造 ZF架構呼叫檔案方式
Zend Framework(一)
Category: 剪輯
Final Cut Pro X 10.4.9 配置測試
Category: 工作
工作上用的工具整理
Category: 工具
受保護的內容: WinAgents.MIB.Browser
Category: 未分類
phalcon-devtools 增加專案樣板
phalcon-devtools 增加專案樣板
之前phpconf 有會眾提到說是否自行增加樣版?基本上不會有問題而且開發團隊有增加樣版也都還沒補上.
接下來會簡單講解如何加入自行樣板.
安裝使用phalcon-devtools[
]1
Embeda UNO.Net新手測試!! 接 熱釋紅外線感應 BISS0001
之前介紹過Embeda 現在來實際玩玩.
逛了網拍 找到 人體紅外線感應模組 熱釋紅外線感應 BISS0001來試試.[
]1
Embeda(mbed) 介紹 & Mac 10.8 開發使用
Embeda 是由國內廠商,於知名mbed所開發而來的.相容原有mbed系統(目前我測試是這樣的)資源豐富.
而mbed(MCU微控制器)類似於Arduino 都屬於簡單易用可快速架構開發.
各位可以前往官網查詢購買方式.
http://www.embeda.com.tw/tw/
接下來直接開箱:[
]1
(收到的樣子,大家可以看到實際大小實在夠迷你!!)[
][2][
]3
(整個控制版)[
]4
(接上usb即可使用)
Phalcon !! 以C開發的php freamwork!!
Redis Key-Value資料庫建置實測
reids
Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。從2010年3月15日起,Redis的開發工作由VMware主持。
通常,Redis將數據存儲於記憶體,或被配置為使用虛擬記憶體。通過兩種方式可以實現數據持久:使用快照的方式,將內存中的數據不斷寫入磁碟;或使用類似MySQL的日誌方式,記錄每次更新的日誌。前者性能較高,但是可能會引起一定程度的數據遺失(後者相反)。
Mac 使用brew安裝reids
-> % brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.8.tar.gz
######################################################################## 100.0%
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
If this is an upgrade and you already have the homebrew.mxcl.redis.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
To start redis manually:
redis-server /usr/local/etc/redis.conf
To access the server:
redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.8: 9 files, 424K, built in 5 seconds
Gearman Install OSX
MongoDB VS Mysql 簡單測試.
廢話不多說.
MongoDB 使用 MongoDB Object Document Mapper測試.
Mysql 使用 Object Relational Mapper測試.
MongoDB部分:
config.php
register();
$classLoader = new ClassLoader('Doctrine\ODM\MongoDB', __DIR__ . '/../../lib');
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\MongoDB', __DIR__ . '/../../lib/vendor/doctrine-mongodb/lib');
$classLoader->register();
$classLoader = new ClassLoader('Symfony', __DIR__ . '/../../lib/vendor');
$classLoader->register();
$classLoader = new ClassLoader('Documents', __DIR__);
$classLoader->register();
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setHydratorDir(__DIR__ . '/Hydrators');
$config->setHydratorNamespace('Hydrators');
$config->setDefaultDB('doctrine_odm_sandbox');
//使用safe模式
$con = new Connection('localhost',array('safe'=>true, 'w' => 2,'wtimeoutMS' => 2000));
//使用一般模式
//$con = new Connection('localhost');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\');
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents'));
$dm = DocumentManager::create($con, $config);
FreeBSD 架設 redmine
redmine 安裝:
1.先更新本機的port tree
$ portsnap fetch update
2.安裝
cd /usr/ports/www/redmine; make install clean
FreeBSD DenyHosts 擋掉暴力破解 ssh 的使用者
# cd /usr/ports/security/denyhosts; make install clean;
-------------------------------------------------------------------------------
To run denyhosts from startup, add denyhosts_enable="YES"
in your /etc/rc.conf.
Configiration options can be found in /usr/local/etc/denyhosts.conf
-------------------------------------------------------------------------------
In order to proper working of denyhosts
1. edit your /etc/hosts.allow file and add:
sshd : /etc/hosts.deniedssh : deny
sshd : ALL : allow
2. issue the following command if /etc/hosts.deniedssh does not exist yet
touch /etc/hosts.deniedssh
-------------------------------------------------------------------------------
Warning:
syslogd should ideally be run with the -c option; this will ensure that
denyhosts notices multiple repeated login attempts.
To do this, add syslogd_flags="-c" to /etc/rc.conf
-------------------------------------------------------------------------------
===> Installing rc.d startup script(s)
===> Registering installation for denyhosts-2.6_3
===> Cleaning for denyhosts-2.6_3
#