星期日, 12月 20, 2009

在過山車裡上天落地 經歷就當福氣

我感冒了,昨天下午上大埔墟去看中醫。回程時經過天主教教堂,我翻起burberry乾濕褸的領子,拾級而上,來到聖殿門前。

As the deer panteth for the water
So my soul longeth after you You alone are my heart's desire And I long to worship you

我聽見偏廳有人在彈結他,有人在唱歌。我便推開偏廳的門。

You alone are my strength, my shield To you alone may my spirit yield You alone are my heart's desire And I long to worship you

彈結他者對我微笑,圍圈而坐的菲裔女士也對我微笑。

You're my friend and you are my brother Even though you are a king I love you more than any other So much more than anything

零九年,因為生之寂寞及亂擇信任,我行錯了一步又一步。我流血了,我流淚了。But now all bygone. Let bygones be bygones.

You alone are my strength, my shield To you alone may my spirit yield You alone are my heart's desire And I long to worship you

I want you more than gold or silver,
only you can satisfy. You alone are the real joygiver and the apple of my eye. You alone are my strength, my shield

To you alone may my spirit yield
You alone are my heart's desire And I long to worship you

以後陰天時,我會記得打起傘子。

星期六, 12月 19, 2009

記下我的氣息








白武士

終於如願,兩間位於中環的房子,一自住一收租。

稍為意料之外的是由於金管局收緊樓按,收租那間要引入白武士注資。

興漢雷蒙律師是我的白武士。我和他這兩個 strangers in equity 今天往銀行去開聯名戶口,並且 outline 了未來該如 streamline 收租供樓的行政事項。

白武士說他資金的融資成本是五年後還五萬元利息給銀行。我們這房子月租九千,月供五千,他兩年已經返本......

白武士雖然也有利潤,但他這次出手實在是及時雨。

今午在中環我與他繞臂前行,我對他說:「見你對我咁好,我就贈送你半年秘書服務啦!」

律師果然是律師:「半年後會收幾錢架如果我用慣左想繼續用?」

驚險星期一

1000 中區地產:「七十小姐你手上太多物業,hkmc唔會批你中環果間上九成會架啦。蝕三十萬摸走佢當買個教訓...」
1100 同事:「七十姐你個中文版script快d譯好佢。老板見客等住用呀。」
1200 中區地產:「七十小姐我幫你收左買家票啦,你今日向邊?我拎份約你簽。快d攪掂件事算數...」
1600 髮型師:「七十你不要愁眉深鎖,我很擔心呀。我冇野幫到你,不過我一定幫你整靚個頭。」
1800 低密度地產:「七十小姐有實客問價,今晚睇樓得唔得?下?九點?好,我約一約買家。」
1900 測計師行:「七十小姐你叔叔話你要撻訂,果間樓既資料你俾我,睇下我有冇辦法幫你。」
2000 醫生:「你當09年係俾學費既一年啦。」
2100 七十:「你地一個二個欺負我!」
地產:「別這樣說啦,我佣金唔駛你俾全數啦。」

我因為要deal駁deal,所以低密度房子僅連雜費平手離場咋。

呢個遊戲太刺激啦,我以後都唔會玩。

星期五, 12月 18, 2009

購物狂尋找白武士

知道09年我買了多少個香奈兒嗎?

十個。

知道09年我買了多少間房子嗎?

三間。

幸好現在成功售出了其中一間,並且在金管局突然收緊樓按的情況下找到白武士與我共同投資收租物業。

購物狂的角色我扮演夠了,2010年我要踏踏實實做人。

我跌低,我爬起來。

星期三, 12月 09, 2009

Gadget

哈哈哈哈哈你地覺得我會有弄清事情來龍去脈的一天嗎?





What is a gadget?


Google gadgets are HTML and JavaScript mini-webpages, mostly served in iFrames that can be embedded in web pages and other apps. Gadgets may be embedded in iGoogle, Google Desktop and any page on the web. Gadgets that can work on iGoogle, Google Desktop, and other pages across the Web are created using the Universal Gadgets API, and they are as easy to develop as a webpage.


While simple gadgets can be created in a few minutes, in order to develop a useful gadget with interesting functionality and an appealing look and feel we suggest learning about HTML, JavaScript and Google's Gadget API.


A gadget is described in an XML file. This XML file defines the gadget look and feel as well as its functionality.


Here is an example "Hello World" gadget:



<?xml version="1.0" encoding="UTF-8" ?>

<Module>

<ModulePrefs title=“Hello World" />

<Content type="html”><![CDATA[

<b>Hello World!</b>

]]></Content>

</Module>


A gadget is defined in an XML document containing a module root element. In this example the module contains a ModulePrefs element and a Content element. The ModulePrefs element describes general gadget preferences, such as its title ("Hello World" in this example) and may also contain other gadget preferences, such as Description, Author and more. The Content element is the heart of the gadget and it describes the actual HTML displayed by the gadget (the >Hello World!</b> string in this example). The Hello World gadget in this example is very simple - it has very limited functionality and will just display a "Hello World!" text - but more advanced gadgets will use the Content element to put their JavaScript and HTML code. The <![CDATA[..]]> markers are XML standard way of embedding data strings within XML elements. Learn more about CDATA here.


Developing gadgets does not require special development tools. You may either use the online Google Gadgets Editor tool (GGE), or use your favorite text editor to edit the gadget and upload it using GGE.




Some gadget examples


Gadget functionality runs from simple static HTML pages to very sophisticated HTML, JavaScript, AJAX with Server Side functionality gadgets, such as a virtual keyboard that lets you type in your own locale even if you are are using a kiosk computer that does not have that locale installed, and lets you also email the text you type using an email server.


To get a good sense of what gadgets can do let us review some gadgets examples.
In this section we will introduce some gadgets and in the next section we will review more gadgets, view their source code and learn how they operate.





Some Code Examples


To learn how gadgets work, let's go through some gadget code examples:


A Hello World


As a reminder let's look at the Hello World gadget presented before.



<?xml version="1.0" encoding="UTF-8" ?>

<Module>

<ModulePrefs title=“Hello World" />

<Content type="html”><![CDATA[

<b>Hello World!</b>

]]></Content>

</Module>


A Better Hello World


The following example also displays a Hello World message, but also introduces the ModulePrefs and the UserPref sections.


A better Hello World gadget


In this example we see a module named "My First Gadget".


The first section (green) describes the gadget preferences in the ModulePrefs XML element. The ModulePrefs section describes the gadget name, description, height, author's name and a category. All these attributes are used by Google when the gadget is published to the gadgets directory.


The second section (blue) describes user preferences. The set of user preferences used by the gadget is really up to the gadget developer. In this example we chose Color, Toggle and Locations. The developer of the gadget chooses the set of user preferences that make sense to the gadget. After publishing the gadget the user of the gadget selects the preferred values for the gadget preferences and saves them as her own preferences. An example would be color. A gadget developer creates a Color UserPref XML element and the user of the gadget may chose her favorite color, such as "blue". The Color is saved by iGoogle and next time she logs in to iGoogle the value "blue" is restored.


The third section (red) is the content of the gadget. In this case, it's the same HTML string seen before containing the "Hello World" text. This time the "Hello World" text is colored in red. Note that, in this example, even though user preferences were introduced they were not actually used by the gadget content (e.g. in this example, the color of the "Hello World" text is always red). In the next example, however, we demonstrate how they can be used.


Notes example - Storing State


The notes example allows a user to create a note and save it.

The next time the user visits iGoogle the note will be restored.

It also lets the user set a different background color for the gadget.


Storing State in a gadget


The color is selected by a user and stored into the "color" user preference. Note the <UserPref name="color" element. In this example a user may choose 3 different colors: Yellow, Blue and Green.
In the content section you may notice there is a <style> block. This block determines the look and feel of the gadget using CSS. CSS is a widely used standard for controlling HTML look and feel. Inside the style block you'll find the text
background-color: __UP_color__;
This means that the value of the background-color CSS property is replaced for each user of the gadget with the value of the user preference color selected by the user from the UserPref section. This is done automatically by iGoogle.


Another example of user preferences usage would be the text UserPref highlighted in red.
In this example we use a hidden text UserPref. Since user preferences are stored by Google, the text UserPref lets us save the content of the note. We use JavaScript to populate the test UserPref with the value of the note textarea.
The <Require feature="setprefs"/> element provides us with programmatic access to the user preferences object using JavaScript. Programmatic access to user preferences is an optional feature, this is why we include the Require section. To learn more about optional features see http://code.google.com/apis/gadgets/docs/reference.html#Feature_Libs


The <UserPref name="text" default_value="Type text here.” datatype="hidden"/> element defines a hidden user preference. The hidden user preference is used to store the content of the note. However, this is not done automatically. We do it by calling the JavaScript save() function.
The JavaScript save() function is called whenever a user clicks the "Save Note" button. The method uses the __IG_Prefs() object to set the value of the user preference keyed "text" with the content of the "note" textarea element. _gel() is just a simple replacement for JavaScript's document.getElementById(), which gets a reference to an HTML element using its ID.


This example is simple, yet demonstrates the power of gadgets using Google Gadgets API.




Before You Start


The Google Gadgets API uses a few simple building blocks: XML, HTML, and JavaScript. Here are some resources that could help you get familiarized with building your own gadget. As a starting point, all you need is a basic understanding of HTML. Later, as you write more sophisticated gadgets, you will probably want to learn some JavaScript if you're not familiar with it already.



  • HTML is the markup language used to format pages on the Internet. The static content of a gadget is typically written in HTML. HTML looks similar to XML, but it's used to format Web documents rather than to describe structured data.

  • JavaScript is a scripting language you can use to add dynamic behavior to your gadgets.

  • Google Gadgets API is the JavaScript library developed by Google used for implementing the more sophisticated gadgets features, such as controlling user preferences programatically, tabs, remote server communication and more.

  • In addition, it would be useful to understand some basic XML concepts and syntax. XML is a general purpose markup language. It describes structured data in a way that both humans and computers can read and write. XML is the language you use to write gadget specifications. A gadget is simply an XML file, placed somewhere on the internet where Google can find it. It may be hosted by Google as well as on your own server. As demonstrated before, the XML file that specifies a gadget contains instructions on how to process and render the gadget. The XML file can contain all of the data and code for the gadget, or it can have references (URLs) for where to find the rest of the elements. References (URLs) were not discussed on this page. To learn more about them read http://code.google.com/apis/gadgets/docs/fundamentals.html#URL

  • Gadgets are open-source by design. A immediate consequence is that if you see a gadget with interesting functionality, you may simply open the the gadget module definition file with your browser and examine its source code. For example, the source code for the Date & Time gadget is here: http://www.google.com/ig/modules/datetime.xml. This is the best way to learn about gadgets development.




Gadget Hosting and Placement


As a gadget developer you have two options for hosting your gadget - you may host the gadget on Google's servers or you may host the gadget on your own server. Hosting the gadget on Google's servers is very convenient since you don't need to have administrative access to a web server. If, however, you do have access to a web server, you can use it to host your gadget as well.


Follow these steps to publish a gadget using Google hosting service:



  1. Use the Google Gadgets Editor (GGE) or any text editor to write your gadget specification, and host it on a public Web server. The easiest way to do this is through GGE. When you save a gadget in GGE, it is automatically hosted in the GGE environment.

  2. In GGE, choose File > Publish. This step will put your gadget on Google's servers, available on the internet.

  3. You may grab the URL to your published gadget. In the Publish dialog use the link that reads "Your gadget is located here".


Gadgets may be placed on iGoogle, as well as on any other blog or Web site such as http://blogger.com, http://orkut.com or your own website.


To add your gadget to your iGoogle page use the following procedure:



  1. Use the Google Gadgets Editor (GGE) or any text editor to write your gadget specification, and host it on a public Web server. The easiest way to do this is through GGE. When you save a gadget in GGE, it is automatically hosted in the GGE environment.

  2. In GGE, choose File > Publish.

  3. In the Publish Your Gadget dialog, choose Add to my iGoogle page. If you don't already have an iGoogle page, you must create one as described in Getting Started.

  4. Go to http://www.google.com/ig, and make sure you are logged in. You will see the gadget you just published to iGoogle.


For more details visit http://code.google.com/apis/gadgets/docs/basic.html


To place gadget on your website use the following procedure:



  1. Create a gadget using GGE or your favorite text editor

  2. Publish the gadget, by choosing File > Publish in GGE

  3. In the publish dialog select the Add to a web page option. This action is also referred to as Syndication.

  4. Select your preferred color, width etc, click the Get the Code button and copy the code in the text box. This is a short JavaScript code that will display your gadget on any Web site.

  5. Paste the copied code on your blog or Web site.


Gadgets you create may be used by other users (if you choose to publish them), and any gadgets that you see and like can be added to your personalized iGoogle page, blog or Web site.
To add gadgets created by others to your iGoogle page go to http://www.google.com/ig and click Add Stuff. Browse the gadgets directory and add which ever gadget you like.
To add gadgets created by others to your website go to http://www.google.com/ig/directory?synd=open, select your gadget and click Add to your webpage.




Internationalizing a Gadget


After implementing a useful gadget you may extend its reach by making it available to users speaking different languages by internationalizing the gadget.


Localizing a gadget is simple. Let us start with an example:


Internationalizing a gadget


In this example we see the Hello World example from previous sections, in different languages: The title and the "Hello, World!" messages are externalized and translated into two languages, English and Japanese.
In the gadget module definition the "Hello, World!" string was replaced with __MSG_hello__ and the title was replaced with __MSG_title__. In addition to this change, there are now two message bundles that go along with the gadget: the en.xml message bundle, which translates __MSG_hello__ to "Hello, World!" and ja.xml which translates __MSG_hello__ to the "こんにちは、世界" Japanese string.
When a user uses your gadget, Google will make sure that the gadget automatically uses the user's own language, where available, as indicated by the user's domain and language preferences.


We recommend that you to prepare the gadget for internationalization and start with English. This requires from you to externalize all strings in your HTML by using __MSG_ variables and creating an English message bundle.
If you speak another language, you can also translate the English message bundle to this other language and include it with the gadget.


If your gadget becomes popular enough, you may want to consider translating it into even more languages. But the important thing is that you make your gadget ready for internationalization in the first place by using __MSG_ strings rather than the actual English strings in the module definition.


To learn more about internationalization visit here.




Where to Go Next


You're ready to start writing your first gadget. Here are some resources to help you:



For additional information consult the resources below:



Third party gadgets and links are listed for your convenience. Google does not make any representation, endorsement or warranty regarding their content.





Related Posts Plugin for WordPress, Blogger...