Author Archive for Zz85-nds

For Each Loops

Looping through each item in a collection is usually mandatory in programming, yet its fun and easy.

Here’s how to do it in different languages.

> php
foreach($array as $key => $value):
# use these variables
print($key.’ -> ‘.$value.’
‘);
endforeach;

> javascript/actionscript 3
for (var obj in window){
document.write( ‘window.’+obj +’ =>’+ window[obj] );
}

note the difference between the java and javascript’s loop is that the obj in js for returns the index of the item rather than the object itself.

> java 5
for (Object var : collection) {
// Do your stuff
}

> python
for item in container:

> shell
foreach {i j} {a b c d e f}

The fun part with looping a collection is that there isn’t a need to define indexes and limits for the loop. Sometimes in situations I have a fix loop but still prefer a for-each loop, I’ll create a predefined collection, perhaps a json array for javascript and associative collection for php, then run a for each loop over them.

This should be pretty old stuff and I’ve been thinking of this post long ago but really didn’t get my fingers typing until now.

Jogging in the Valley

The air is cold.

The ears freeze

The brain spins

The fingers numb

The nose runs

The air feels thin

and

The lungs scream

我不知明天的道路

这是我所喜欢的一首诗歌

Directions

《一》
我不知 明天的道路 每一天 只为主活
我不惜 明天的太阳 因明天 或许阴暗
我不要 为将来忧虑 因我信 主的应许
我今天 要与主同行 因他知 前面如何

《副歌》
有许多 未来的事情 我现在 不能识透
但我知 谁管着明天 我也知 谁牵我手

《二》
每一步 越走越光明 象攀登 黄金阶梯
每重担 越挑越轻省 每朵云 披上银衣
在那里 阳光常普照 在那里 没有眼泪
在美丽 彩虹的尽头 众山岭 与天相连

《三》
我不知 明天的道路 或遭遇 生活苦楚
但那位 养活麻雀者 他必然 也眷顾我
他是我 旅途的良伴 或经过 水灭之灾
但救主 必与我同在 他宝血 把我遮盖

下载谱

DVBS

前几天真高兴能够参帮忙儿童们的假期圣经班,能接触许多可爱但顽皮的孩子们!

这一回与”佳*老师”帮忙手工。

首先折纸星!

也折纸心!(有押韵呢,哈哈)

“张先生”和”大姐”在竞争比他们的微型纸心

剪刀

胶水

针线

金属丝

手工完成了!

想起来,本人与学生身份参加应该有六年了吧!也想起第一次帮忙弹琴时擦一点出大祸,呵呵。


虽然我也许不再是小孩子了,但能够与孩子一起同享幸福也很不错!

Cooking Fried Rice (with taiwan sausages)

One of my goals this holidays is actually to cook all my favorite dishes from Zi Char 煮炒 (zhu2 chao3) literally meaning ‘cook & fry’ or restaurant style.

So I started with fried rice 炒饭. How’s how I did it.

Cooking Ingredients

(left to right)Pepper, soya sauce, 2 eggs, corn cooking oil, sausages (used because I didn’t get char siew)

Standby Ingredients

Cooled cooked rice. Sliced sausages and chopped cabbages.

Crack eggs into a bowl

Stir, add soya sauce, stir, add pepper, stir.

Add oil to wok

Fry rice in the oil.

Add the eggs mixture.

Throw in sausages.

Stir-fry.

Throw in cabbages.

Done.

The mess I made of my home’s kitchen.

Time to clean up!

Completed dish, yum yum.

Other variations of fried rice can be created with different ingredients - using small onions(my dad’s method), spring onions, char siew, slice carrots, samba, peas etc etc…

Links
Yang Zhou Fried Rice on Baidu’s “Wiki” (in chinese)