2010-09-10

umlcanvas 透過 HTML5 & JavaScript 來製作 UML 圖表

UmlCanvas 使用了 HTML5 的特性與 JavaScript 來製作 UML ,

現在您多了一個選擇, 將製作好的圖, 透過網頁就可以方便大家察看您的想法


下載
http://umlcanvas.org/Download

文件
http://umlcanvas.org/Documentation


或許有天, 會有個網路上使用的完整工具, 很棒喔 !

快去學 !

2010-07-21

Converting Old Extensions to Joomla 1.5

Converting Old Extensions to Joomla 1.5  

XRefresh : 自動更新網頁, 網頁設計師與開發人員的利器

XRefresh : 可以自動協助我們將設定好的網頁進行自動更新的動作,

現在只需要在您的編輯器上按下 SAVE 的動作, Browser 就會自動幫您重新整理,

很方便

我使用的是 MAC OS + FF, 以下是我的安裝方式,

1. 安裝 Firebug 1.4 or higher

2. 安裝 XRefresh Addon

3. 安裝 RubyCocoa

4. 開啟 Terminal , 輸入

sudo gem install xrefresh-server --source http://gemcutter.org

安裝完成後, 先做第一次設定, Terminal 輸入 xrefresh-server, 
預設會寫入設定檔到 使用者目錄下

vim ~/.xrefresh-server.yml

# here specify list of paths to monitor
paths:
  - /Applications/MAMP/htdocs/ # by default watch user's home directory
# - /you/may/add/here/some/other/path
# - /you/may/add/here/some/another/path

預設的監控目錄是 /Users/使用者
您可以加入監控目錄, 在 paths 下加入您要監控的目錄, 就可以開始監控, 
我用 MAMP, 比較貪心, htdocs 全部都加入, Ya ~
現在啟動, 輸入 xrefresh-server


monitoring /Applications/MAMP/htdocs/
Waiting for file system events ...

然後開啟 Firefox, 啟動 Firebug, 找到選單中 XRefresh 啟動它, 就可以.










試試看 !


2010-07-20

MAC OS, 打開 Safari 5 開發工具選項

Safari 5 有內建的開發工具, 可以提供給開發人員使用,

若您需要使用這個選項, 您可以打開 terminal 然後輸入以下命令來啟用這個功能

defaults write com.apple.Safari IncludeDebugMenu 1

這樣就會在選單中, 找到開發人員的選單, 開始找蟲蟲吧.

2010-06-24

Ubuntu 10.04 LTS 安裝 Apache2, MySQL, PHP5, PHP-CLI, Pear, phpmyadmin

查看你的 Ubuntu 版本的指令

lsb_release -a

step 1. 先安裝 mysql-server

sudo apt-get install mysql-server
step 2. 安裝 Apache2, php5, php-cli, pear, phpmyadmin

sudo apt-get install apache2 php5 php5-mysql phpmyadmin php5-cli php-pear

step 3. 編輯 apache2.conf

sudo vi /etc/apache2/apache2.conf

加入

Include /etc/phpmyadmin/apache.conf

重新啓動 Apache2

sudo /etc/init.d/apache2ctl restart

若可以透過 http://localhost/phpmyadmin 看到 phpmyadmin 大致上就沒問題了.

PS : 筆記而已, 參考就好.

另外有位高手透過 PS3 安裝 Ubuntu 與 LAMP + Symfony 很酷, 分享給大家

http://demenzia.net/2007/08/21/linux-and-symfony-on-a-ps3/

Thanks

2010-06-05

xDebug 2.0.5 現在已經內含在 MAMP 1.9 的版本

真是好消息 ~

之前用的 MAMP 版本是 1.8.4, 沒有 xDebug, 現在新的版本 1.9 就內建了, 已經幫你編譯好 xDebug,

只需要打開 php.ini 加入設定內容 :

zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=

重新啓動 MAMP 就可以使用 xDebug, 太棒了 !

現在可以一窺大型套件的內容了, Ya!

PS : 我有試過用自己編譯 xDebug, 版本是 2.0.4, 2.0.5, 2.0, xdebug-2.1.0RC1, 這三個版本,
努力了一個下午, 不行, 所以我才使用 MAMP 1.9, 因為它內建了...

若是要自己編譯 xDebug, 要注意編譯出的編號

xDebug 官方文件說明

Q: What to do with: Xdebug requires Zend Engine API version xxxxxxxx. The Zend Engine API version 2xxxxxxxx which is installed, is newer.
A: This message means that you are trying to load Xdebug with a PHP version for which it wasn't built. If you compiled PHP yourself, it is most likely because you compiled Xdebug against PHP headers that belong to a different PHP version that you're running. For example, you're using PHP 5.3 and the headers you're using are still PHP 5.2. If you are using a pre-compiled binary, then you're using the wrong one.
To diagnose if this is your problem, make the following steps:

* Check what the "Zend Extension" API number is of the PHP version that you are running by looking at phpinfo() (or "php -i") output. You can find it in the top part of the output, in the same block as the PHP logo and the PHP version. As examples, for PHP 5.2, the number is "220060519" and for PHP 5.3 it is "220090626".
* Check what the output of "phpize" is when you're completing the compilation steps. The number that you're looking for is on the line that says "Zend Extension Api No".

If the two numbers from above do not match, you're compiling with the wrong PHP headers. Refer to the next FAQ entry to figure out which phpize to use.


更多 xDebug 說明

Joomla! 1.6 Quick Look: Template Styles



Joomla 1.6 Quick Look: Modules



Joomla! 1.6 Quick Look: Administrator Menu



Joomla! 1.6 Quick Look: Toolbars



Joomla! 1.6 Quick Look: User Groups



Joomla! 1.6 Quick Look: Content Access Levels



Joomla 1.6 Quick Look: Categories



Joomla 1.6 Quick Look: Trash



Joomla! 1.6 Spotlight: Hathor



NetBeans 6.9 Beta Tutorials

可以用 NetBeans 開發 Zend Framework, 真棒 !

Zend Framework Support in NetBeans IDE

2010-06-03

2010 : 希望入荷書籍清單, 持續更新中...

最近很喜歡上, O'REILLY 逛書店, 我好愛這個網站, 很想大聲說, 老闆我全部都要買, XD

2010 年購書清單, 希望可以快點到手, 好好學習







持續更新中...


2010-05-07

prototype.js 1.6.1 與 jQuery 1.3.2 再 IE8 上的問題與解決方式

IE8: fix for coexistence problem prototype.js (1.6.1) with jQuery (1.3.2)

我在專案上使用了, prototype.js version 1.6.1, 與 jQuery version 1.3.2

再 IE8 上遇到了問題,

IE8 說 : prototype.js 行 4811 有問題

var nodes = $(element).getElementsByTagName('*');

修正方式, 找到 prototype.js 行 4817 加入以下 script
if (Prototype.Browser.IE) { if (className == 'e') return []; }

就可以避開這個問題

想知道更多原因請看叁考連結

http://www.devcomments.com/IE8-fix-for-coexistence-problem-prototype-js-1-6-1-with-jQuery-1-3-2-at7993.htm

2010-05-05

修正 IE 上, 無法使用 document.getElementsByTagName 來取得 TagName

若你再, IE 上撰寫 JavaScript, 用到 document.getElementsByTagName,
發生了錯誤, 
你可以嘗試加入以下的 函數來進行修正

if(typeof(window.external) != 'undefined'){    
    document.getElementsByName = function(name, tag){
        if(!tag){
            tag = '*';
        }
        var elems = document.getElementsByTagName(tag);    
        var res = []
        for(var i=0;i<elems.length;i++){
            att = elems[i].getAttribute('name');
            if(att == name) {
                res.push(elems[i]);
            }
        }
        return res;
    }
}

PS : 我忘了版本, IE6 or IE7, 試試看.

2010-04-26

實作 Joomla Component



影片觀賞建議使用 (HD) 並全螢幕, 部份內容將提到程式碼撰寫 (片中並無背景音樂)

這個影片是 Hamm 所拍攝, 主要是瞭解如何撰寫 Joomla Component,

與瞭解程式碼的進入點, 我們並還沒有開始討論 Joomla MVC or Joomla 架構,

這個範例只是簡易的輸出妳想要顯示的內容, 分別再前端與後台,

希望有助妳瞭解 Joomla, 而且可以快速的開發 (前提是我們要努力去瞭解它!)

2010-04-25

Test : Syntax Hightlighter

<?php

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

class HelloMVCcontroller extends JController {
    function display() {
        parent::display();
    }
}

2010-04-13

wordpress + joomla

Wordpress + Joomla 真厲害 !






Firefox 3.6.3 無法使用 Library Detector 解決方式

我喜歡 Library Detector, 也愛使用 Firefox,

最近發現 Firefox 更新速度很快, 不自覺的更新到 3.6,

卻發現, Library Detector 目前無法支援,

若你也需要這個 plug-in 就需要密切的 等待更新版本,

若你和我一樣缺它不可, 可以嘗試以下方式 :

2010-03-23

Full Calendar, jQuery Calendar, 功能像 Google Calendar, 這個很棒

Full Calendar 是一個很類似 Google Calendar 的 jQuery Library,

建議下載使用它, 很方便, 又可以接 Google Calendar 所發怖的資訊,

就等於是自訂 Calendar 介面, 也可以擴充, 棒!

Full Calendar

2010-01-29

Joomla 筆記 (個人紀錄)

// 取得目前所選用的 Template 路徑
$app =& JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();

// Joomla Document Object
$doc =& JFactory::getDocument();

// 引用 Css File
$doc->addStyleSheet($templateDir . "/css/mycssfile.css");

// 引用 JavaScript File
$doc->addScript($templateDir . "/js/myJavaScript.js");

備註 : 可以使用 CDN 的方式來引用 JavaScript & Css File.
$templateDir 是目前使用中的樣板路徑


// 引用 Joomla DBO 物件
$db =& JFactory::getDBO();

// 查詢 Content Table 資料表
$stmt = "SELECT * FROM " . $db->getPrefix() . "content";
$db->setQuery($stmt, 0);

// 顯示查詢內容
if ($rows = $db->loadObjectList()) {
  foreach ($rows as $row) {
    printf("%s", $row->title);
    printf("%s", $row->alias);
    printf("%s", $row->introtext);
  }
}


由於 Joomla 預設是採用 mootools, 若你想使用其他 JavaScript 套件,
可以透過下面的程式碼來移除 mootools
// remove mootools.js and caption.js
$headerstuff = $this->getHeadData();
reset($headerstuff['scripts']);
foreach($headerstuff['scripts'] as $key=>$value){
  unset($headerstuff['scripts'][$key]);
}
$this->setHeadData($headerstuff);





2010-01-27

PHP Object Basics

  • Class and objects: Declaring classes, instantiating objects
  • Constructor methods: Automating the setup of your objects
  • Primitive and class types: Why type matters
  • Inheritance: Why we need inheritance, and how to use it
  • Visibility: Streamlining your object interfaces and protecting your methods and properties from meddling

  • 類別與物件 : 如何宣告類別, 實例化物件
  • 建構式方法 : 初始化物件
  • 原型類別     : 建構原型需要留意哪些事項
  • 繼承             : 為何需要繼承, 我該如何使用它
  • 可視性         : 物件的特性與介面透過封裝來保護物件與物件之間的溝通


2010-01-26

利用 StarUML 產生一個簡易的PHP類別

StarUML 現在可以利用 template 產生 PHP 程式碼, 也就是說, 我們可以透過類別圖定義來產生 PHP 的程式碼, 下面將說明如何產生一個簡易的 Class  ShopProduct
  1. starUML 下載 http://staruml.sourceforge.net/en/download.php
  2. PHP5 Code Generator Template http://staruml.sourceforge.net/en/templates.php
下載好後, 請先安裝 starUML, 安裝好後將 PHP5 code Generator Template 解壓縮,

並放入到 C:\Program Files\StarUML\modules\staruml-generator\templates 目錄下

(小提示)
安裝目錄不一樣請將 PHP5 code Generator Template
放入到 StarUML\modules\staruml-generator\templates 目錄下

1. 接下來啟動 starUML

2. 選擇 Empty Project

3. Model Explorer 右鍵新增一個 model, 並命名為 PHP Generator Code

4. 在 PHP Generator Code 中右鍵 Add Diagram, 我們選 Class Diagram,
並給這張圖一個名稱, ShopProduct

5. 點選 Class 確定它是被選取狀態, 並在ShopProduct Class Diagram 中空白處在點選一次,
這時你就會看見一個 Class Diagram, 我們將它名命 ShopProduct

6. 新增 ShopProduct Properties ,  我們設定了 Title, producerMainName, producerFirstName, price

7. 新增二個 Method, 分別 __construct(), getProducer()

8. 按下 F9 會出現驗證對話方塊, 驗證一下畫的圖對不對

9. 選單 Tools -> StarUML Generator...

10. Select templates for generator 選 PHP 5 code Generator

這樣 starUML 就會幫你產生 PHP 程式碼, 在 starUML 中定義的 shopProduct









2010-01-25

primitive types and ckecking functions in PHP

Type Checking
Function
Type Description
is_bool()
Boolean
one of the two special values true or false
is_integer()
Integer
A whole number
is_double()
Double
A floating point number (a number with a decimal point)
is_string()
String
Character data
is_object()
Object
An object
is_array()
Array
An Array
is_resource()
Resource
A handle for identifying and working with external resources such as databases or files
is_null()
NULL
an unassigned value

2010-01-23

PHP 基本資料型別


PHP 基本資料型別

  • 4 種 scalar (純量型別)

    • boolean

    • integer

    • floating (double)

    • string

  • 2 種 compound (複合型別)

    • arrays

    • objects

  • 2 種 special type (特殊型別)

    • Resource

    • NULL




提示 scalar (純量) :
只有大小(magnitude),
例如:質量(mass),體積(volume),長度(length), 速率(speed),時間(time),溫度(temperature)

引用參考  :  scalar (純量)




Joomla Framework 1.5


                                                  Joomla 1.5 Framework (圖一)


Joomla Framework

Joomla 具備 物件導向的特性 (object oriented design),
實現了抽象化類別 (abstract class) 與實例 (instance) 之間的互動性,
使你在開發的過程可重複使用套件中所提供的功能, 並落實於你的系統或子系統

一個完整的軟體框架 (Framework), 通常具備了程式語言 (programs), 程式庫 (libraries),
腳本語言 (scripting language), 當然也包含了豐富的 API,
並整合各自單元, 便於讓你進行專案開發或是撰寫軟體元件, 模組
Joomla Framework 具備了以上的特性

(圖一)

  • Extension layer (展示層)

    • Modules (模組)
      • 資訊內容提供與展示, 給予前端頁面 (front page), 所需的資料流

    • Components (元件)
      • 可延伸套件之特性, 通常是使用 Joomla 中的元件進行擴充開發

    • Templates (範本)
      • 版面設定與調整

  • Application layout (應用層)

    • Joomla Application
      • 提供 Joomla Application Class 應用

  • Framework layout (軟體框架)

    • Libraries (程式庫)

    • Frameworks (框架套件)

    • Plugs (軟體元件, 擴充性元件)