August F.Y. Chao

「41 資訊技術」分類文章彙整

Get to know Eclipse with PHP

In 00 炫耀02 備忘錄21 碩班課業41 資訊技術41_A 程式設計 on 十一月 9, 2007 at 12:59 上午

老實說,我從中華的大二開始,真的沒有認真地去用過整合開發環境。
但用 Eclipse 來開發軟體還真的滿開心的! 雖然一開始還滿難理解它的運作~ 花了不少時間…

繼續閱讀文章 »

玩 virtual machine 及管理方面的心得

In 00 炫耀01 論40 專業領域41 資訊技術41_C 系統管理 on 十月 25, 2007 at 6:49 上午

經過了在小黑灌的 Parallels 無端罷工及重灌 Windows 之後,我最大的心得是:

  1. 用 VM 灌 Windows 來當工作環境,是個不錯的方法!
  2. 備份 clone disk image 並壓到最小
  3. 工作目錄獨立在 guest OS 之外
  4. Windows 是給工程師用的!! Mac OS X 是給不懂電腦的人用的!

繼續閱讀文章 »

BBS 系統裡接 Internet Mail 的設定

In 40 專業領域41 資訊技術41_C 系統管理 on 十月 18, 2007 at 7:36 上午

正好有個案子要處理 Mail template 的問題~ 所以就想到用 BBS 接 Internet Mail 的方式來解決…
還滿不錯的!

繼續閱讀文章 »

真煩ne! 該死的 windows 爛掉了!

In 04 哀哀40 專業領域41 資訊技術41_C 系統管理 on 十月 9, 2007 at 12:25 上午

難道真的要我去裝有幾百萬種新功能的 vista 嗎?!

繼續閱讀文章 »

設定 Apache2+Mod_fastcgi+PHP5_cgi

In 02 備忘錄41 資訊技術41_C 系統管理 on 十月 8, 2007 at 7:24 下午
Configure Part #2

PHP bypasses the normal FastCGI process manager, and uses its own system to control how many copies of the PHP binary are running, bringing up 8 by default. Since you often want finer control, I usually install a tiny shell script with configuration variables in it into the cgi-bin directory and have it run PHP instead:

#!/bin/sh

PHPRC="/usr/local/etc/php/client"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
exec /usr/local/bin/php-fcgi

別忘了,要用 php-cgi 不能用 php

http://www.fastcgi.com/docs/faq.html#PHP

常用來架 服務 的 Open Source 軟體集~

In 02 備忘錄41 資訊技術41_C 系統管理43 商業模式43_A 學人精 on 四月 12, 2007 at 11:21 下午

C.K. Blog » Blog Archive » 常用Open Source

企業入口網站 (Enterprise Information Portal)

Drupal
Drupal 是一個彈性高,模組化強的內容管理系統,不管是想建立部落格 (Blogger),網站架設,電子商務平台,都可完成。
http://tw-drupal.info/
e107
e107 是一套知名的 CMS ( 內容管理系統 ),其架構是由 MySQL 與 PHP 組成。
http://e107.org/

eXo platform
eXo platform 是一套企業入口網站系統 (Portal),適合用來架設公司網站(對外)以及個別員工的資訊平台(對內)。
http://www.exoplatform.com/
Jahia
提供完整的 Portal (又名 EIP)解決方案。
http://www.jahia.org/jahia/Jahia
Joomla
一套由 Mambo 4.5.2 版衍生出來的入口網站軟體。
http://www.joomla.org/
Liferay
Liferay Portal 是一套相當成熟的Java/J2EE portal system,遵循 Portlet API JSR168 的標準。 http://www.liferay.com/
Mambo
用 PHP 來撰寫的架站軟體。
http://www.mamboserver.com/
PHP-Nuke
使用php+MySQL建立一個入口網站
http://www.phpnuke.org/
Plone
一套以 Zope來開發的網站內容管理系統,適合以群組合作方式來建立網站內容。
http://plone.org/
Xoops
用 PHP 來撰寫的架站軟體。
http://www.xoops.org/

員工入口網站 (Employee Portal) /協同作業平台 (Collaboration Platform)

eGroupware
在同一個網站應用程式裡包含許多實用的群組軟體。適合一般辦公室團隊作內部使用,提供辦公室或專案工作小組資源分享、資訊交換的協同平台。
http://www.egroupware.org/
PHPfileNavigator
PHPfileNavigator 是一套線上檔案管理系統,可方便的將文件資訊,共享與傳送,並可支援不同的作業系統。使用簡便,是線上檔案管理系統中一個好的選擇。
http://pfn.sourceforge.net/
Timeclock
Timeclock 是一套簡單容易上手的網頁打卡鍾系統,可以輕易實現網路線上即時打卡,取代傳統打卡簽到。
http://timeclock.sourceforge.net/
Tutos
一套功能不錯的群組軟體,適合一般中小企業的工作團隊內部使用。
http://www.tutos.org/
WebCalendar
提供一個個人或群組使用的行事曆,具備如安排會議、郵件通知、分享行事曆等功能。
http://webcalendar.sourceforge.net/

專案管理系統 (Project Management)

DotProject
一套專案管理系統,讓專案管理員儲存專案產生的各種相關資料。
http://www.dotproject.net/

購物網站 (Shopping Mall)

OSCommerce
快速地建立一個含購物車、線上管理台等網上購物站。
http://www.oscommerce.com/
XTCommerce
快速地建立一個含購物車、線上管理台等網上購物站 。
http://www.xtcommerce.com/

企業資源規劃(ERP)/財務會計(Accounting)

Compiere
以 Java 來開發的 ERP 系統,深受國外歡迎。
http://www.compiere.org/
TurboCASH
TurboCASH 是一套相當簡潔的進銷存以及會計軟體,適合小型的企業使用。
http://www.turbocashuk.com/
webERP
webERP 是一套 web-base 的 ERP 系統,主要功能為財務會計的管理,以及庫存管理的應用。
http://www.weberp.org/

客戶關係管理 (CRM)

SugarCRM
以 PHP 來開發的 CRM 系統,讓工作人員透過網頁瀏覽器查尋客人相關的資料。
http://www.sugarcrm.com/
vtiger CRM
Vtiger CRM 是一套 100% 開放原始碼客戶關係系統,主要協助企業建立與客戶之間業務往來互動資訊。
http://www.vtiger.com/index.php?option=com_content&task=view

線上教學系統 (e-learning)

Atutor
提供一個支援線上教學的網站。
http://www.atutor.ca/
Moodle
一套功能強大、版面簡潔的線上教學系統。
http://www.moodle.org/

流量訪客資料分析

AWStats
AWStats 是一個免費的功能強大的服務器日誌分析工具,它可以告訴你所有的Web統計數據,包括訪問量、訪問者數量、頁面、點擊、高峰時段等等。
phpMyVisites
這是一套免費的PHP + MySQL的網站訪客分析軟體,支援多站台管理及多國語言轉換
http://www.phpmyvisites.us/
Cacti
可以取代MRTG的一套軟體,結合SNMP及RRDTool工具,並使用php+MySQL去做有效管理也可外掛 Scripts 及加上 Templates 來作出各式各樣的監控圖
http://www.cacti.net/

其他

Care2x
Care2x 主要是一套以 PHP 撰寫的醫療資訊管理系統。
http://care2x.com/
Enhydra Shark
支援標準的商業流程引擎格式及提供流程設計介面。
http://shark.objectweb.org/
Knowledge Tree
這是一套知識管理系統 (KM),幫助企業快速搜尋及版本控管各類如 Word、HTML、TXT、PDF 等文件檔案。
http://kt-dms.sourceforge.net/
Phplist
是一個管理通訊名單(mailing list)及電子快訊(Newsletter)的網上應用程式。
http://tincan.co.uk/phplist
phpMyTicket
phpMyTicket 是一套線上訂位系統,適合用來線上訂票與選位(如購買電影票或上課券)。
http://www.phpmyticket.com/
PhpMyAdmin
一套全能功的 MySQL 管理及應用程式。讓使用者透過網頁瀏覽器去檢視、建立或修改資料庫的大小事務。
http://www.phpmyadmin.net/
Webmin
一套強大的 Linux 管理工具,讓管理員能夠透過網頁瀏覽器去管理 Linux 系統及設定各種伺服器。
http://www.webmin.com/

跟 timeout 打交道~

In 02 備忘錄40 專業領域41 資訊技術41_A 程式設計 on 四月 9, 2007 at 11:11 下午

Care and Feeding of Timeout.timeout

Segment7 – The Blog

–>

edit

Care and Feeding of Timeout.timeout

Posted by Eric Hodel
on 2006/04/12

If you’re not careful when using Timeout.timeout you can end up with some hard to find bugs.

The first is that nesting timeouts without different timeout
exception classes is very bad. Let’s say you have a process that
can connect to multiple servers, but you want to give up and try the
next server if it takes too long. You’d probably write something
like this:

require 'timeout'

servers = [1, 2]
current_server = 0

begin
Timeout.timeout 2 do
puts "Connecting to server #{servers[current_server]}"
sleep # simulate work
end
rescue Timeout::Error
puts "Failed"
current_server += 1
retry unless current_server == servers.length
end

This is sensible code, if the work takes to long you’ll fail and move on to the next server.

But now its been a few months and you’ve added servers,
but you want your application to only try for so many seconds then give
up completely. Your real app would be properly factored (of course) so
the bug with the simple solution wouldn’t necessarily be obvious:

require 'timeout'

servers = [1, 2]
current_server = 0

Timeout.timeout 5 do
puts 'Setting up some stuff'
sleep 4
begin
Timeout.timeout 2 do
puts "Connecting to server #{servers[current_server]}"
sleep
end
rescue Timeout::Error
puts "Failed."
current_server += 1
retry unless current_server == servers.length
end
end

When we run this code we run longer than we were supposed to:

<samp>$ time ruby t.rb
Setting up some stuff
Connecting to server 1
Failed.
Connecting to server 2
Failed.

real 0m7.044s
user 0m0.014s
sys 0m0.011s

Why seven seconds instead of five? The inner timeout block caught
the out timeout block’s exception and continued doing what it was
doing. This isn’t what we want, but Timeout.timeout allows you to
change the raised exception:

require 'timeout'

servers = [1, 2]
current_server = 0

class ServerTimeout < Timeout::Error; end
class AppTimeout < Timeout::Error; end

Timeout.timeout 5, AppTimeout do
puts 'Setting up some stuff'
sleep 4
begin
Timeout.timeout 2, ServerTimeout do
puts "Connecting to server #{servers[current_server]}"
sleep
end
rescue ServerTimeout
puts "Failed."
current_server += 1
retry unless current_server == servers.length
end
end

So now the outer timeout can stop execution even from inside the inner timeout:

<samp>$ time ruby t.rb
Setting up some stuff
Connecting to server 1
/usr/local/lib/ruby/1.8/timeout.rb:54: execution expired (AppTimeout)
from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
from t.rb:13
from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
from t.rb:9

real 0m5.069s
user 0m0.022s
sys 0m0.015s</samp>

The second to watch out for is Timeout killing your rescue or ensure
blocks. A timeout raised inside an ensure block will stop execution, so
for critical ensure blocks you should wrap them in their own begin/end
block:

require 'timeout'

Timeout.timeout 2 do
begin
puts "Allocating the thingy..."
sleep 1
raise RuntimeError, 'Oh no! Something went wrong!'
ensure
# Since we might time out, hold onto the timeout we caught
# so we can re-raise it when we're done cleaning up.
timeout = nil
begin # we really need to clean up
puts "Cleaning up after the thingy..."
sleep 2
puts "Cleaned up after the thingy!"
rescue Timeout::Error => e
puts "Timed out! Trying again!"
timeout = e # save that timeout then retry
retry
end
# Raise the timeout so we time out all the way to the top.
raise timeout unless timeout.nil?
end
end

我○七年三月吃飽太閒的計劃

In 00 炫耀01 論20 校園22 研究方向23 學生生活41 資訊技術41_A 程式設計 on 三月 17, 2007 at 7:46 上午

my_mar_07_plan.jpg

不要問我這個在幹嘛~ 我也不知道~

ADBM 0312 #1

In 02 備忘錄20 校園21 碩班課業40 專業領域41 資訊技術 on 三月 12, 2007 at 3:44 下午

Data Models

  1. Structure
  2. Operation
  3. Constraints <- SA 寫清楚,不然就只有靠程式人員的經驗

Database State: Snapshot 某個時間的狀態

Intention V.S. extension

*下次考式會給你一個小小的Schema來畫。*

three-schema-architecture
Three-Schema Architecture:

  1. Internal Schema 內部結構
  2. Conceptual schema 企業組織
  3. External Schema 使用者與AP

Logical Data Independence and Physical Data Independence, 中間叫 mapping
DDL: Data Definition Language
DML: Data Manipulation Language (SQL)

Multi-Tier Client-Server Architecture.

  • Hierarchical Data Model,
  • Network Model,
  • Relational Model,
  • Object Oriented Model, 使用O/R Mapping 機制而使用 Relational Database.

*請看黑體字,謝謝。*

Entity 跟 Attribute 怎麼分,決定你的功力。如果是用來描述別人的,就是Attribute。如果有獨立存在的意義,那就是 Entity。
Entity, Attribute, Relationship 在 ER Model.
兩條線是total participation, 就是全部都會,如果只有一條就不見的是全部。
虛線是不登記,但算的出來。
Weak Entity, 會有一個 own entity, 一個 own relationship.
Recursive Relationship: 一個 supervisor 看很多個 supervises.
Constraints: Cardinality and Existence Dependent.
Notation: 1:1, 1:N, N:1, or M:N.

* Review All E-R Diagrams. *

UML class diagram 與 E-R Model 不同在 UML 有動態的資料。

#1 Ruby Learning Class

In 02 備忘錄21 碩班課業22 研究方向40 專業領域41 資訊技術41_A 程式設計 on 三月 3, 2007 at 4:27 下午

Ruby From Other Languages

Naming conventions

Ruby enforces some naming conventions. If an identifier starts with a capital letter,
it is a constant. If it starts with a dollar sign ($), it is a global variable. If
it starts with @, it is an instance variable. If it starts with @@,
it is a class variable.

Fake keyword parameters

Ruby doesn’t have keyword parameters, like Python has. However, it can be faked by
using symbols and hashes. Ruby on Rails, among others, uses this heavily. Example:

def some_keyword_params( params )
params
end
some_keyword_params( :param_one => 10, :param_two => 42 )
# => {:param_one=>10, :param_two=>42}

The universal truth

In Ruby, everything except nil and false is considered true.

Access modifiers apply until the end of scope

class MyClass
private
def a_method; true; end
def another_method; false; end
end

class MyClass
# Now a_method is public
def a_method; true; end

private

# another_method is private
def another_method; false; end
end

Method access

Ruby differs slightly. public is, naturally, public. private means
the method(s) are accessible only when they can be called without an explicit receiver. Only self is
allowed to be the receiver of a private method call.

protected is the one to be on the lookout for. A protected method can be called
from a class or descendant class instances, but also with another instance as its receiver.

$ irb
irb(main):001:0> class Test
irb(main):002:1> # public by default
irb(main):003:1* def func
irb(main):004:2> 99
irb(main):005:2> end
irb(main):006:1>
irb(main):007:1* def ==(other)
irb(main):008:2> func == other.func
irb(main):009:2> end
irb(main):010:1> end
=> nil
irb(main):011:0>
irb(main):012:0* t1 = Test.new
=> #<Test:0x34ab50>
irb(main):013:0> t2 = Test.new
=> #<Test:0x342784>
irb(main):014:0> t1 == t2
=> true
irb(main):015:0> # now make `func` protected, still works
irb(main):016:0* # because protected allows the other reference
irb(main):017:0* class Test
irb(main):018:1> protected :func
irb(main):019:1> end
=> Test
irb(main):020:0> t1 == t2
=> true
irb(main):021:0> # now make `func` private
irb(main):022:0* class Test
irb(main):023:1> private :func
irb(main):024:1> end
=> Test
irb(main):025:0> t1 == t2
NoMethodError: private method `func' called for #<Test:0x342784>
from (irb):8:in `==
'
from (irb):25
from :0
irb(main):026:0>

Classes are open

Ruby classes are open. You can open them up, add to them, and change them
at any time.

Singleton methods

Singleton methods are per-object methods.

class Car
def inspect
"Cheap car"
end
end

porsche = Car.new
porsche.inspect # => Cheap car
def porsche.inspect
"Expensive car"
end

porsche.inspect # => Expensive car

# Other objects are not affected
other_car = Car.new
other_car.inspect # => Cheap car

Missing methods

Ruby doesn’t give up if it can’t find a method that responds to a particular
message. It calls the method_missing method with the name of the method
it couldn’t find and the arguments.

Message passing, not function calls

A method call is really a message to another object:

# This
1 + 2
# Is the same as this ...
1.+(2)
# Which is the same as this:
1.send "+", 2
Follow

Get every new post delivered to your Inbox.