雲端服務 vs. 雲端運算
除了雲端運算這項口號之外,還有人提出了雲端服務的概念,這是由於雲端運算通常指的是在網路上提供且為商業和客戶服務的消費模型,這些服務包含了以資訊科 技為主的服務,如軟體即服務(SaaS, Software as a Service)以及提供伺服器運算及儲存能力的服務等,但實際上還有更多和資訊科技無關的商業和客戶的服務,如線上購物、銷售、娛樂等,而這些服務多半 與運算的功能無關,而更為貼近人們的生活,對這些客戶而言,他們所使用的不是雲端運算這項功能,而是由雲端運算環境所提供的雲端服務。
乍看之下好像沒有特殊之處,但實際上該數字比宇宙所有的基本粒子數量總和還要大。Googol這個字是由美國數學家Edward Kasner九歲的侄子Milton Sirotta發明的,後來在數學家Edward Kasner和James Newman的著作《Mathematics and the Imagination》(http://tinyurl.com/lxunra)中被引用,Google公司使用這個字顯示了公司想征服網路無窮無盡資 料的夢想,最後沒有選用Googol可能是因為版權的問題,而且當註冊Google.com網域的時候已經被註冊。
在函數編程中很早就有了Map和Reduce觀念,其實類似於演算法中各個擊破的作法(Divide and Conquer),也就是將問題分解成很多個小問題之後再做總和。Map函數的輸入是一個鍵/值序對組,輸出則為另一組中繼過渡的鍵/值序對組。而 Reduce函數則負責針對相同的中繼過渡的鍵/值序對組合併其所有相關聯的中繼值,並產生輸出結果的鍵/值序對組,如圖4所示。
圖4:MapReduce運算方式。
/**
* A simple extension of the Spark Panel component
* that enables dragging.
*/
public class DraggablePanel extends Panel
{
//————————————–
// Constructor
//————————————–
public function DraggablePanel()
{
super();
}
//————————————–
// Skin Parts
//————————————–
/**
* The skin part that represents the title bar of the underlying Panel.
* NOTE: The default PanelSkin already has this, it’s just not defined as a skinPart in the Panel class.
* We want it so that we can capture dragging.
*/
[SkinPart(required=”true”)]
public var topGroup:Group;
public final class ArrangeTool
{
private static var instance:ArrangeTool;
public static function getInstance():ArrangeTool{
if (instance == null){
instance = new ArrangeTool();
}
return instance;
}
/**
* 將物件排成弧型
*/
public function drawArc(startX:int,endX:int,Y:int,radius:int,items:Array):void{
//先算出圓心座標
var center:Point = new Point((startX+endX)/2,Y+Math.sqrt(radius*radius-Math.pow(startX-endX,2)/4));
//將該區域的圓切成相同大小等份,先算整個弧線的角度,以角度切
var totalAngel:int = Math.asin((endX – center.x)/radius)*360/Math.PI;
var onePiece:int = totalAngel/(items.length-1);
//要取出該弧形的點的座標及角度
var angle:int;
for(var i:int=0;i< span="">
angle = 90-(totalAngel/2)+onePiece*i;
var tmp:Point = getPoint(radius,angle);
items[i].x = center.x-tmp.x-(items[i].width/2);
items[i].y = center.y-tmp.y-(items[i].height/2);
//以程式改變註冊點
var A:Point=items[i].localToGlobal(new Point(items[i].width/2,items[i].height/2));
items[i].rotation = (angle-90);
var B:Point=items[i].localToGlobal(new Point(items[i].width/2,items[i].height/2));
items[i].x-=B.x-A.x;
items[i].y-=B.y-A.y;
}
}
private function getPoint(radius:int,angel:int):Point{
var y:int = Math.sin(angel*Math.PI/180)*radius;
var x:int = Math.cos(angel*Math.PI/180)*radius;
return new Point(x,y);