2009年2月3日 星期二

Scene7 的說明



http://help.adobe.com/en_US/Scene7/4.0/WS26AB0D9A-F51C-464e-88C8-580A5A82F810.html

Scene7 的使用說明


Scene7 的使用說明

http://help.adobe.com/en_US/Scene7/4.0/WS26AB0D9A-F51C-464e-88C8-580A5A82F810.html

2009年1月21日 星期三

Camera rankings

Camera rankings


http://www.dxomark.com/index.php/eng/DxOMark-Sensor/Camera-rankings

Camera rankings

Microsoft Silverlight DeepZoom

Viewing Large Images - OpenLayers, GSIV, ModestMaps, DeepZoom, and Python







Viewing Large Images - OpenLayers, GSIV, ModestMaps, DeepZoom, and Python






Lately
I’ve been experimenting with displaying very large images on the
internet via a web browser, with pan and zoom functionality. The guts
of this functionality are the same regardless of implementation. On the
server, a tile cutter processes a large image, and constructs an image
pyramid. The image pyramid is a hierarchical structure composed of n
levels of the same image at different resolutions. Starting with the
bottom level as the original image, each successive level reduces the
image size by half, and the process is repeated log_2( max( width,
height)) times until finally an image of only 1 pixel (average of
entire image) is generated as the top of the pyramid. Each level’s
image is split into a set of fixed size tiles. A web browser client
implementation ( flash, ajax, etc) constructs  a zoom interface, that
responds to zoom in events by moving the viewport progressively further
down the pyramid, showing tile images of the larger resolution to give
the effect of zooming into an image. A nice illustrated write up of the
concept can be found here. I’ve probably made it sound more complicated than it really is.


The initial implementation I was working with utilized OpenLayers, which implements a client for accessing OpenGIS Web Feature Servers (WFS) and Web Mapping Servers (WMS).
Unfortunately the size of the library seems to be constantly increasing
(~200K in the last year) and currently weighs in at 560K uncompressed,
and requires a special implementation to serve up the tile images, ie.
a WMS Compliant system, in this case TileCache. For scaling and efficiency purposes, I’d much prefer to directly serve these images off a CDN, disk (nginx), or via varnish
and bypass any application code. Additionally the sheer size of the
OpenLayers code was unwieldy for the integrations requirements I had,
which did not include any GIS functionality.


Surveying the land for other non-commercial image viewers, turned up a few of interest. GSIV
( Giant Scalable Image Viewer), was a fairly basic but capable
javascript based viewer, that fit my requirements bill, small size at
26Kb uncompressed, and focused on pan and zoom functionality (demo).
However as a project it appears to be abandoned, and hasn’t been
touched in two years, although several patches have been submitted
which retrofit the implementation using jquery are extant.


I came across ModestMaps next, which is a flash (2 & 3 ) based implementation, with a small size (demo).
One nice feature of modest maps, is that it performs interpolation
between successive levels giving a smooth zoom experience to an end
user unlike somewhat jerky experience that GSIV produced. Unfortunately
being flash based meant a whole different chain of development tools. I
looked around at what was available for an opensource flash compiler
toolchain and found MTASC (Motion Twin Action Script Compiler ) and Haxe.
In the end i decided against it, partly due to its GIS focus, and the
customization/ maintenance cost for developing on propretiary platform
(Flash). Despite that, i think its the best of the opensource viewer
implementations if your already have/use an adobe flash development
stack.


I was set on using GSIV, and then i came across a blurb on ajaxian
about Seadragon Ajax and Deep Zoom from Microsoft’s Live Labs.
Microsoft’s done some impressive work with image manipulation over the
last few years. The PhotoSynth TED talk is one of the most impressive technology demos i’ve seen to date. Deep Zoom is a SilverLight technology ( more propretiary platform lockin), that allows for multiscale image zooming with smooth zooming. The Seadragon Ajax
is a javascript implementation of the same functionality in a 154k
library ( 20k minimized and gzipped). It fit the bill perfectly,
standards (javascript) based, image zoom and pan, with a great user
experience. One problem unlike all the other tools mentioned here,
which have python based tile cutting implementations, Deep Zoom was
utilizing a Windows only based program to process images and cut tiles.
I had a couple of hundred gigabytes of images to cut, and not a windows
system in sight. But based on this excellent blog write up by Daniel Gasiencia,
I constructed a python program using PIL that can be used as a command
line tool or library for constructing Deep Zoom Compatible image
pyramids. It can be found here,
hopefully its useful to others. As a bonus, it runs in a fraction of
the memory (1/6 by my measurements) needed by the GSIV image tile
cutter and faster as well ( 100 images in 5m vs 1.25hr). Unfortunately
the Seadragon Ajax Library is not opensource, but non commercial usage
seems to be okay with the license, and i’ll give it over to some
lawyers to figure it out.


To process the several hundred gigabytes of images, i utilized this library and wrote a batch driver utilizing  pyprocessing remote queues, a small zc.buildout and cloudcontrol to process the images across a cluster, but thats left as an implementation detail for the reader

Photo Zoom Tools


http://www.softsia.com/flash-photo-zoom-download-1.html

2009年1月20日 星期二

Image Optimization 讀書心得


前言



上個月在 YUI Blog 上有 4 篇 Image Optimization 的連載,若你重視網站的效能,這篇是非常經典且必讀的文章。
主要在於圖片格式的介紹、使用免費的命令列工具縮小圖片但不失真。難能可貴的是,作者 Stoyan Stefanov 也做了許多的實際測試,讓這系列的文章非常有說服力。以下為文章列表:

http://josephj.com/entry.php?id=209


Flash Image Zoom



http://www.flashden.net/item/zoom-pan-controls-with-dynamic-image-settings/15713?page=5

2009年1月15日 星期四

Popular Science Magazine架站案例分享


http://drupaltaiwan.org/forum/20080325/1976

Popular Science Magazine screenshot

2009年1月7日 星期三

PHP: Object Oriented Web Forms

As I've gone from project to project over the years I've built up my
personal code library. One piece of code that I've found extremely
useful time and time again is an object oriented class for building web
forms. It allows me to keep consistent looking/acting forms throughout
a web application, rapidly develop new forms, make global changes by
editing a single file, and keep all the logic of a form within one file.


The following code and examples are for php version 5 or higher.


Example 1: The Basics

include("forms.php");
 
function Button1Clicked(&$data,&$error){
$error .= "Field 1 = ".$data["field1"]."<br/>";
$error .= "Field 2 = ".$data["field2"]."<br/><br/>";
$error .= "You clicked Button 1. <br/>";
 
return true;
}
 
$form = new form("myform");
 
$element = new form_element_text("field1","Field 1","This is field 1");
$form->add($element);
 
$form->newline();
 
$element = new form_element_text("field2","Field 2","This is field 2");
$form->add($element);
 
$form->newline();
 
$element = new form_button("Button 1","Button1Clicked");
$form->add($element);
 
$form->run();
Download or View Demo




Example 2: Pre-loading Data

function LoadData(&$data,&$error){
 
// Load initial data here.
$error .= "Data Loaded!!<br/>";
 
return true; // return true to show form and false to not show it.
}
 
...
 
$form = new form("myform", "LoadData"); // Call LoadData on load.
 
...
Download or View Demo




Example 3: Buttons

...
 
function Button1Clicked(&$data,&$error){
$error .= "You clicked Button 1. <br/>";
return true;
}
 
function Button2Clicked(&$data,&$error){
echo "You clicked Button 2. <br/>";
echo "<a href='example3.php'>Click here to go back.</a>";
return false;
}
 
...
 
$element = new form_button("Button 1","Button1Clicked");
$form->add($element);
 
$element = new form_button("Button 2","Button2Clicked");
$form->add($element);
 
$element = new form_button("Button 3");
$element->submit = false;
$element->on["Click"] = "alert('You clicked Button 3!!');";
$form->add($element);
 
...
Download or View Demo




Example 4: Individual Element Styling

Most of the styling is done via the forms.css file but occasionally you'll need to apply a style to an individual element.

...
 
$element = new form_element_text("field1","Field 1");
$element->style = "width: 400px;";
$form->add($element);
 
...
Download or View Demo




Example 5: Validation

Form validation is done through making an element required and/or
applying a regular expression to an element that the value must match.
If you need more complicated validation then you would put that logic
within the function associated with a form_button.

...
 
function Button1Clicked(&$data,&$error){
if ($data["field1"] == strtoupper($data["field1"])){
echo "Form Validated!<br/>";
echo "<a href='example5.php'>Click here to continue.</a>";
return false; // Don't show form.
}else{
$error .= "Field 1 must be all uppercase.<br/>";
return true;
}
}
 
...
 
$element = new form_element_text("field1","Field 1","UPPERCASE only.");
$element->required();
$form->add($element);
 
...
 
$element = new form_element_text("field2","Field 2","Integer value only.");
$element->required();
$element->regex("\d+","Field 2 must be an integer.");
$form->add($element);
 
...
Download or View Demo




Note that Button1Clicked() never gets called until the built-in form validation passes.





Example 6: Other Form Elements

...
 
$element = new form_element_text("field1","text");
$form->add($element);
 
$form->newline();
 
$element = new form_element_password("field2","password");
$form->add($element);
 
$form->newline();
 
$element = new form_element_textarea("field3","textarea");
$element->cols = 50;
$element->rows = 3;
$form->add($element);
 
$form->newline();
 
$element = new form_element_checkbox("field4","checkbox");
$form->add($element);
 
$form->newline();
 
$element = new form_element_select("field5","select");
$element->option("","");
$element->option("option1","Option 1");
$element->option("option2","Option 2");
$form->add($element);
 
$form->newline();
 
$element = new form_element_select("field6","select (multiple)");
$element->multiple = true;
$element->option("option1","Option 1");
$element->option("option2","Option 2");
$element->option("option3","Option 3");
$element->option("option4","Option 4");
$form->add($element);
 
$form->newline();
 
$element = new form_element_radio("field7","radio");
$element->option("option1","Option 1");
$element->option("option2","Option 2");
$form->add($element);
 
...
Download or View Demo




Download the Code


forms.php
The form class to include in your php code.

PHP: Easy Tabs for your webpages

PHP: Easy Tabs for your webpages









Easy tabs is a short and simple php class that makes it very easy to have tabbed dialogs in your webpages.



Usage


$tabs = new tabs("mytabs");
 
$tabs->start("Tab1");
// Tab1's content goes here....
$tabs->end();
 
$tabs->start("Tab2");
// Tab2's content goes here...
$tabs->end();
 
$tabs->run();





Examples




Here we just create 3 tabs and put some text in each one.


include("tabs.php");
 
$tabs = new tabs("example1");
 
$tabs->start("Tab #1");
echo "This is tab number one.<br/>";
$tabs->end();
 
$tabs->start("Tab #2");
echo "This is tab number two.<br/>";
$tabs->end();
 
$tabs->start("Tab #3");
echo "This is tab number three.<br/>";
$tabs->end();
 
$tabs->run();


View Example or Download Source




For a bit of a more complicated example, we use the forms class from a previous article to put some simple forms in each tab.

include("tabs.php");
include("forms.php");
 
function Form1_Button1_Clicked(&$data,&$error){
$error .= "You clicked button 1 on Form 1!<br/>";
return true;
}
 
function Form2_Button1_Clicked(&$data,&$error){
$error .= "You clicked button 1 on Form 2!<br/>";
return true;
}
 
 
$tabs = new tabs("example2");
 
$tabs->start("Form 1");
$form = new form("form1");
$element = new form_element_text("field1","Field 1","This is field 1");
$form->add($element);
$element = new form_element_text("field2","Field 2","This is field 2");
$form->add($element);
$element = new form_button("Button 1","Form1_Button1_Clicked");
$form->add($element);
$form->run();
if ($form->submitted){ $tabs->active = "Form 1"; }
$tabs->end();
 
$tabs->start("Form 2");
$form = new form("form2");
$element = new form_element_text("field1","Field 1","This is field 1");
$form->add($element);
$element = new form_element_text("field2","Field 2","This is field 2");
$form->add($element);
$element = new form_element_text("field3","Field 3","This is field 3");
$form->add($element);
$element = new form_button("Button 1","Form2_Button1_Clicked");
$form->add($element);
$form->run();
if ($form->submitted){ $tabs->active = "Form 2"; }
$tabs->end();
 
$tabs->run();


View Example or Download Source




Download


If you would like to use Easy Tabs you can download and include the tabs.php file below.

Also included is a sample tabs.css file to get you started on styling it to fit your website.

memcached - 解決高流量問題

memcached - 解決高流量問題




###################################################

# 文章來源 http://www.ecstart.com

# 作者 : FIEND

# 轉貼請註明出處

###################################################



介紹 :





現在機器的記憶體真的比起過去便宜太多了....



看到這個套件 感觸蠻多的 ^^ ....



使用這個套件 必需是個有經驗 而且具備分析和規畫能力的 programer ..



因為它必需要建置 services 時 就開始想怎麼去規畫它 .





http://tw2.php.net/manual/en/intro.memcache.php





什麼是 memcache :



memcache 官方網站的介紹 -



memcached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load.



Danga Interactive developed memcached to enhance the speed of LiveJournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers.
memcached dropped the database load to almost nothing, yielding faster
page load times for users, better resource utilization, and faster
access to the databases on a memcache miss.





##############



台灣同時幾萬人就很了不起了 @@



百萬人環境 存取資料庫將會非常的可怕 , 一般這種流量等級的網站是絕對不會輕易的把資料庫的存取對外的 .



所以 能夠節省 動態網頁 / user 存取動作去接觸到 db 的動作 能快取就盡量快取 ( 最好能沒有 db 就盡量全部從 db doump 出靜態 html )



當然這樣的苦和想法 早在很久以前就大家都玩過了 , 很多做 http 技術多年的朋友們看到這個工具應該都會覺得現在的硬體科技進步太多了 ^^ .



而 這個工具主要是為了 降低 存取 資料庫次數及要求 將 動態網頁 所需要的存取行為快取下來 , 而沿生出來的工具 .



當然 它還有一個好處是可以去避免 sql injection 啦... @@





感想 :



@@ 不過 這麼幹算你狠 ....



我記得多年前 在某一家流量蠻大的公司...



@@ 同時線上人數四萬人 , 會員人數二百多萬..每日點擊次數 幾千萬 , 而且 server 還是 p4 1.x 及 p3 古董 等級的 cpu 而 記憶體 也才 幾百mb 就是屌了.



光是靜態的一個服務就要幾台 做 分散式架構了 ...而且 我們在做這種東西時都只能存在 硬碟 .. ( 記憶體那有這麼大 @@ )



而它提供了 記憶體存取 物件 , 而且可以 分散式的存取 .



現在寫程式的人真幸福... @@ 看到這個 tool 我直接聯想就是... 記憶體真便宜 哈哈哈....



這個玩法 之前和一個南非工程師在閒聊 他們公司是 java 好像也是用類似這樣的工具來做的 在南非有五萬人會同時去存取他們的伺服器...



用這個方法 一台伺服器就可以搞定五萬人同時存取... @@ 只是 記憶體用的超兇... 不過總比 買一堆伺服器好吧  ccc



在無名還沒賣掉前 我在 it home 看到 無名小站用了 幾百台伺服器才搞定 超高流量存取量的問題 ( 我家伺服器還在貨櫃上 厚~ 別跟大家說你用 php 架 services  ) .....



看到這篇報導時我覺得當時還真是會亂花錢 , 還好賣掉了 cccc ....



你家網站存取量超級高而且機器用很兇嗎??? 玩看看吧. ^^





範例

In this example, an object is being saved in the cache and then
retrieved back. Object and other non-scalar types are serialized before
saving, so it's impossible to store resources (i.e. connection
identifiers and others) in the cache.
複製內容到剪貼板
代碼:
<?php



$memcache = new Memcache;

$memcache->connect('localhost', 11211) or die ("Could not connect");



$version = $memcache->getVersion();

echo "Server's version: ".$version."

\n";



$tmp_object = new stdClass;

$tmp_object->str_attr = 'test';

$tmp_object->int_attr = 123;



$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");

echo "Store data in the cache (data will expire in 10 seconds)

\n";



$get_result = $memcache->get('key');

echo "Data from the cache:

\n";



var_dump($get_result);



?>
複製內容到剪貼板
代碼:
<?php



$session_save_path = "tcp://$host:$port?persistent=1&weight=2&timeout=2&retry_interval=10,&nbsp; ,tcp://$host:$port  ";

ini_set('session.save_handler', 'memcache');

ini_set('session.save_path', $session_save_path);



?>

2009年1月5日 星期一

傻瓜相機拍攝教學

回486的小窩



新手篇   入門篇  瞭解篇  進階篇  夜景拍攝



善用程式模式    善用小山遠景模式    淺談構圖












Dscf2146.jpg (25108 bytes) 數位相機重要三大功能之『測光模式』。

一般來說,測光有三種模式。分別是:平均測光、點測光、中央側光這三種。但不一定每種相機都一定會內建這三種測光模式。當然,最好還是要有比較好啦。


當日正當中,豔陽高照,人物背光『背光就是背後有強光』時,主題會明顯過暗。


這張是以『平均測光』來拍攝。


主題的那郭...大葉子植物,一坨黑黑的,誰知到那是啥阿。




 









Dscf2145.jpg (14694 bytes) 分析:

這時候你就能使用『點測光模式』來拍攝了。


將測光模式調到點測光,畫面對著右下方紅點左右的位置,半按快門對焦與測光之後,再將畫面移到你要拍的角度按下快門既可。


 




 









DSCF0665.JPG (34330 bytes) 範例2

前幾年與太太旅遊時拍攝的。


當時因為背光,所以也是利用點測光來測臉部之後拍攝。


使用點測光時,背景一般來說會曝光過渡,造成一遍白茫茫。但這效果,也往往能將主題很清楚明確的表達出來。




 









DSC06524.JPG (41757 bytes) 相反的,我們也能利用點測光來達到一種所謂『剪影』的特殊感覺。

拍攝方法:


將點測光對著光亮之處,半按快門之後再進行畫面構圖。


你看,醬子一來,有種很特殊的味道了吧。




 








筆記本:

平均測光:將畫面分割成64等分、甚至254等分之後,相機會去計算每一個格子的明暗度後,平均數值總和來判斷曝光值。拍照時大多使用這模式。


中央測光:以畫面中間約60%~70%來做曝光值計算的一種方式。




 















brfg01.JPG (31952 bytes) 白平衡:

相機選項幾乎一定會有一個『白平衡』的設定模式。除非你是非常低階的數位相機。


相機大多會內建幾種白平衡模式。例如『AUTO』、『太陽』、『陰天』、『燈泡』、『日光燈』等。比較好一點的,還會有1~2組『自訂白平衡』模式。


簡單說,在戶外出太陽時,白平衡就要調成『太陽』,戶外陰天時,就要調成『陰天』,依此類推。


為何要這樣麻煩呢?那是因為相機構造不像人的眼睛醬子精密與複雜。


不管是在戶外、室內、燈泡下、還是日光燈,我們人眼所看到白色紙張時,我們就知道那是一張白色的紙張,不會誤判『色盲除外』。


相機就沒這麼聰明了『廢話,花100萬元買你一對雙眼你肯挖出來賣嗎』。


所以我們必須告訴相機這些資訊、訊息來幫助相機判斷。


以左邊,下方照片就是標準顏色。


當然,現在相機越做越聰明,大多數場合,使用AUTO模式也不一定會造成相機的誤判。


有時候我們也能利用刻意亂調白平衡來做一些特殊色彩的變化喔。


 

brfg04.JPG (35735 bytes)
brfg03.JPG (30880 bytes)



 












DSC00035_2.JPG (54503 bytes) DSC00036_2.JPG (58936 bytes)
1998年,世貿資訊展。筆者故意將白平衡設成『燈泡』模式,拍出左邊比較冰冷的感覺。而右邊則為AUTO白平衡模式。

你看,兩張照片感覺有差吧!




 









DSC00006.JPG (41353 bytes) 1998年攝於筆者辦公室。

有沒有感覺到很怪異的偏綠色色調?


現在室內燈源太複雜啦。明明都是日光燈管,但廠牌、型號不同,其顏色都不一樣。


這時候,若相機有『自設白平衡』功能,只要隨便找一張白紙,就能立即做設定。


可惜當時筆者的相機沒有這功能,所以辦公室內所拍的照片,都是這個怪色調。




 









010708162.JPG (16346 bytes) 在光線不夠明亮的時候,相機為了達到足夠的光線,會降低快門的速度。

快門一放慢,若主題晃動或者拍攝者的身體、手也晃動,那麼拍出來的效果就是這個樣子。


感謝我兒子286友情客串。




 









010708165.JPG (21579 bytes) 窩喔,那怎辦阿,拍得那樣模糊,有拍跟沒拍也沒甚麼兩樣了耶!

沒關係,教你一招『必殺技』。




 









0106100041.JPG (22674 bytes) 挖咧....別亂教啦486,要是學你這一招,我不被我家人打死才怪...

好啦好啦,講正經的。


若光線不足,你可以移一展檯燈過來,醬子不就行啦。




 









DSCF0820.JPG (34712 bytes) 或者等白天再拍不會喔。

不要不要...人家就是要在晚上拍攝啦。


 




 









DSCF0785.JPG (25804 bytes) 其實你可以開啟閃光燈來拍。

但若有些場合不能開啟閃當燈,又或者拍小寶寶怕閃燈會傷害寶寶眼睛,你可以將ISO值調高一些。


這是才是這單元要講的重點啦!


大多數位相機值能從100調到400。數值越高,感光度越高。


但,有部分相機,若ISO值太高,畫面的顆粒會很粗糙喔。


所以關於這點,挑選相機時要問問口碑了。




2002.08.27 



新手篇   入門篇  瞭解篇  進階篇  夜景拍攝



善用程式模式    善用小山遠景模式    淺談構圖

光影魔術手使用說明














































































































































































2007.08.20 【分享】nEO 撕邊修改
mscraft

2007.08.08 【分享】nEO 撕邊應用
mscraft

2007.07.23 【分享】nEO 撕邊下載
mscraft

2007.07.16 【分享】nEO 撕邊邊框
mscraft

2007.07.02 【分享】nEO 素材站
mscraft

2007.06.25 【教學】nEO 嚴重白平衡
mscraft

2007.06.04 【教學】nEO 浮水印(三)
mscraft

2007.04.16 【教學】nEO 自由文字圖層
mscraft

2007.04.09 【分享】nEO 多圖邊框論壇
mscraft

2007.03.26 【教學】nEO 裁剪虛化(二)
mscraft

2007.03.21 【教學】nEO 裁剪填充(一)
mscraft

2007.03.12 【分享】nEO 新版上市
mscraft

2007.03.05 【分享】nEO 新版0.24
mscraft

2006.12.18 【分享】nEO 繁體中文 0.23
mscraft

2006.11.29 【教學】nEO 油畫效果 II
mscraft

2006.11.24 【教學】nEO 油畫效果
mscraft

2006.10.02 【分享】nEO 開發中的 0.23
mscraft

2006.09.29 【教學】nEO 花樣邊框 INI
mscraft

2006.09.25 【下載】花樣邊框
mscraft

2006.08.28 【分享】nEO 花樣邊框下載
mscraft

2006.08.14 【分享】nEO 官方論壇
mscraft

2006.08.11 【教學】nEO 邊框工廠
mscraft

2006.08.09 【分享】光影魔術手 0.22
mscraft

2006.07.21 【下載】撕邊邊框(四) 
mscraft

2006.07.07 【下載】光影魔術手0.21版
mscraft

2006.06.23 【下載】nEO 邊框下載
mscraft

2006.06.05 【下載】撕邊邊框下載 總整理
mscraft

2006.05.15 【分享】nEO 撕邊邊框下載(三)
mscraft

2006.05.12 【下載】nEO 撕邊邊框(二)
mscraft

2006.05.11 【下載】nEO 撕邊邊框(一)
mscraft

2006.05.03 【教學】nEO 郵寄戳章 & 浮水印(十)
mscraft

2006.05.02 【教學】nEO 撕邊邊框 DIY(九)
mscraft

2006.04.28 【教學】nEO 花樣邊框DIY(八)
mscraft

2006.04.27 【教學】nEO 撕邊邊框(七)
mscraft

2006.04.26 【教學】nEO 輕鬆與花樣邊框(六)
mscraft

2006.04.21 【教學】nEO 製作多圖組合(五)
mscraft

2006.04.20 【教學】nEO 自動處理(四)
mscraft

2006.04.19 【教學】nEO 白平衡(三)
mscraft

2006.04.18 【教學】nEO 曝光調整(二)
mscraft

2006.04.17 【教學】nEO 檢視縮放(一)
mscraft

2006.03.30 【教學】nEO 0.2 繁體中文版
mscraft

2006.03.28 【分享】光影魔術手

2008年12月29日 星期一

Web Application 自動測試軟體

Selenium IDE - 測試,原來也可以這麼輕鬆


Filed under: JavaScript, Programming, Technologies, 技術 — Alan @ 23:27



Selenium IDE: Selenium IDE


今天介紹的這個工具真是做 web testing 的終極武器。Selenium IDE,是一個 Browser 的
plugin,安裝之後,你可以把你在網頁上的操作錄製起來。加上一些 check point 之後,就是一個全自動的 web testing
了。以前猛點、一直 key in
資料、搞不清楚自己按了什麼的日子不再出現。觀念簡單,操作容易,我想多寫幾句話去解釋它都有點難。如果還沒有弄懂的就看一下 demo影片吧


安裝方面,下載後直接安裝就好了。雖然是 Firefox plugin 但在 Flock 用也沒問題喔!


使用上,就是像影片看到的,用錄的方式,你點什麼或打什麼字就會錄起來了。關鍵是 check point 的設定,如同 xUnit
一派的做法,可以由一些 assertXXX 來當 check point。最當用的大概就是把文字選取起來,點右鍵就會出現
assertTextPresent 的選項,目的當然是希望來到這頁時需要檢查有沒有出現目標字串囉。錄製好之後,按 run 就會從頭跑一次,到
check point 的地方如果正確就會是綠色,出現錯誤會是紅色。而錄起來的 script 可以存成多種格式。


曾經在開發專案時開玩笑的說如果 UAT (User Acceptence Test) 能夠自動化就好了。因為 UAT 有幾十到幾百個
test case,由專人去跑一遍可能也要個一兩天,對時程是很傷的。而且大家都知道,測試通常會找出一些問題,那問題改了是要全部重測還是只測
fail case?考量到人力跟時間資源,大部份會只測 fail case,好一點再加抽幾個 test case
做抽檢。問題是,天知道改一個東西會影響到哪些部份,除非你敢保證你的 change impact analysis
做得很好。如果沒有,那還是乖乖全測比較保險。有了 Selenium IDE,那就好辦啦,把 script 開始來重跑一次就好了嘛!UAT
自動化不是夢!


另一個可行的用途是,網管或 MIS 需要確保 service alive,把 Selenium IDE 當作 service
monitor 也沒有什麼不行的,至少它簡單好用,在你學會或有錢買那些重型產品前之前,用 Selenium IDE
先頂住至少日子會好過一點。說穿了 service monitoring 就是一種測試嘛 (測試 service 有沒有活著)。


Selenium IDE 是由 OpenQA 所開發的,lincense 是親切可愛的 Apache 2.0。除了 Selenium IDE 以外,OpenQA 還有很多不錯的產品都是在 QA 方面會有用的。目前還沒有詳細做研究,但是 Selenium RC 似乎可以把 Selenium IDE 錄製的 script 再做點事。因為存 script 時的格式有些就是 for Selenium RC 的。如果你是 developer/tester,那不要懷疑了,趕快安裝 Selenium IDE 吧。

2008年12月24日 星期三

如果8051電路沒有動作,硬體除錯流程



如果8051電路沒有動作,硬體除錯流程






2008/03/09 11:02




如果8051電路沒有動作~~大部份都是哪邊出了問題?
先撇開"程式沒燒入進去"這問題來說~

硬體除錯流程
0)確定 電路 VCC/GND 沒短路, 電壓是你要的
一般的 8051 大部分 4.8 ~5.1V 都會正常工作。
1)用示波器量一下 18, 19 pin, 看有沒有 clock
 有些 Crystal的輸出很弱,用示波器會把它吃掉變沒有信號。
 如果沒信號,建議要試試 ALE確認。
2)量 40 VCC, 31 EA pin 和 20pin 的壓差是否為 VCC
 因為大部分的 8051都使用內部程式空間開機,EA要 pull-high。
3)量 20 GND pin 是否為 GND(0V)
4)量 第9 RST pin 看RESET 時 是不是 拉到VCC(5V) 再下降到 GND(0V)
 8051 是 high reset,R/C下降曲線不要太長,一般 R 4.7K / C 0.1uF 就可以了。
 如果一直是high,那當然是不會工作囉。
5)如果使用 Port 0 記得加 提升電阻,一般加10K
 不然 High時沒sink 電流出去,輸出會變成 high-Z。
6)把 pin 31 EA 接地, 重開電源,量 ALE 應該有脈波信號。
 沒信號的話,也有可能是 AT89S5X的 lock bit 設定,不要誤殺喔!

上述信號都對, 但 51 還是沒正常工作, 恭喜你 --> CODE 不對。

但是有時一開機對,程式好像也沒錯,但是一下子電路就掛點了~
1) 輸出短路,這有可能是你控制錯誤,像電晶體導通時造成的。
2) 電壓不穩定
 有時用7805 降壓,但是實在太多壓降在7805上造成發燙過熱,會使 7805失常。
 負載超量,比方用USB電源只有 500mA,有些甚至是HUB 100mA而已,
 你多亮幾個LED 可能就超載了,要注意~
3) 電路雜訊太大
 控制交流輸出時,要避免輸出漣波交連回數位區,最好用隔離式控制,Relay / 光耦合。
4) 浮接點雜訊輸入
 只要有用到的點,都不可以浮接,要不pull-high
要嘛 pull-low,不要空接不確定。