Monday, October 28, 2019

National Step Challenge Can it be Completed?

I joined and faithfully completed National Step Challenge season 4.  I continue to join Season 5. Season 5 added 2 more tiers to MVPA in Season 5 when I started the season, I was thrown back to Season 4 MVPA tier 5. So my Season 5 cannot start huh? Am I a completer then?

On calculating the time needed to complete 6 tiers of MVPA, I was surprised that it requires 187 days (40 points a day maximum). The challenge period is 189 days. To start MVPA challenge  I am supposed to complete the steps challenge tier 2. Minus the bonus, It takes at least 37.5 days to complete tier 2 of the step challenge. Adding it to 187 days, it is impossible to complete.

Now that I am thrown back to Season 4, I need another 75 days. It is equivalent to I cannot be a completer in season 5. I decided to quit completely. It is a challenge with a set period so it should start and stop within the period. HPB make it so difficult to complete. I wonder why.

By the way, in Season 4, HPB actually recommends 150 minutes per week for MVPA. That is 5 days of 30 minutes MVPA. Which translate to 200 points. Therefore, to complete the 6 tiers (7500 points), you need 37.5 weeks which is 262.5 days. Another puzzling figure. Absolutely mission impossible.

Saturday, September 28, 2019

One Plus One

Most kids will know that 1 + 1 = 2. But to adults. It has quite a variety of answers. The following is a list of answers.

  1. 1 + 1 =2 (simple arithmetic)
  2. 1 + 1 =11 (simply put two 1 together)
  3. 1 + 1 = II (roman number)
  4. 1 + 1 = ∥ (parallel symbol
  5. 1 + 1 = 1 (logical OR function)
  6. 1 + 1 = 1 (overlap two 1)
  7. 1+1 = 王 (if you turn your head side ways)
  8. 1+1 = 土 (if you overlap two 1 with + and look side ways)
  9. 1 + 1= 士 (same way except using a smaller 1)
  10. 1 + 1 = 干 (same way but turn your head the other side)
The above is based on the principle that the ones stays in its natural vertical form. If you can place any one or both side ways,  It has another dimension.

  1. 1 + 1 = T (one vertical one horizontal)
  2. 1 + 1 = + (same as above but move the horizontal one to the middle.
  3. 1 + 1 = L (move the horizontal one all the way down and to the right.
  4. 1 + 1 = Γ ( Greek Gamma character)
  5. 1 + 1 = 二 (both placed horizontally)
  6. 1 + 1 = 一 (overlap both horizontally)
  7. 1 + 1 = V (bottom end touch each other)
  8. 1 + 1 = X (both touch center)
  9. 1 + 1 = Λ (Greek Lamda character)
  10. 1 + 1 = = (equal symbol)
  11. 1 + 1 = > (greater than symbol)
  12. 1 + 1 = < (less than symbol)
The above is not an exhaustive list. There are probably more that can be made out of it.

So, don't just take things as is, think out of the box and you find a lot of simple things can be viewed in different ways.

Sunday, September 08, 2019

Defending our faith

As a Christian, we are to defend our faith. However, does it means that we have to do it every time some one says something against our faith?

Singapore have a law on Maintenance of Religious Harmony Act. Which explicitly prohibits "causing feelings of enmity, hatred, ill-will or hostility between different religious groups" (Wikipedia). Some company thus have rules against religious activities and discussions while conducting business.

While in this working environment, if some one starts to provoke you by saying something against Christianity, do we have to defend our faith regardless?

Jesus have a solution. Matthew 22:17-21 says "Give to Caesar what is Caesar's and to God what is God's". Jesus is saying that taxes are taxes and religion is religion. While you are doing your duty, you should do your duty and not mix religion in it.  Why break the rule just because some one did not observe religious harmony and badmouth Christianity?

On a Facebook page, some friend of mine posted two religious quotes side by side. One is based on Old Testament (Joshua 6:21) total destruction of a city another portray his religion as a peaceful religion ( i will not disclose the religion nor the quote). Obviously, he is trying to portray Christianity as violent and destructive compared to the peaceful nature of his religion.

Now I can defend Old Testament by saying that it is the act that is commanded by God for a specific purpose and reason at that specific time. It cannot be applied to Christianity in general. The quote is simply out of context. I will not venture into the person's religious quote and draw a different picture. By doing so I am in breach of causing hostility on other religion. The person is probably trying to provoke a hostile response.

By Just defending our Bible, I already achieved the purpose of defending our faith. There is no need to bring down the other part of the statement by the person. It served the purpose and still maintains religious harmony.

Tuesday, July 02, 2019


拜读了题目文章后 (刊在《历史开讲了》),觉得那是人类的问题不是中国独特问题。这问题是在于权力与控制。如果中国是真正民主制度就可大大减少定律问题。下面是我的见解。





3. 包围定律





朋党不是问题。那个社会没有朋党? 不受控制的朋党才是大问题。民主制度才能有些控制。

6. 黄宗义定律




8. 权大欺主定律


9. 皮毛定律

也是独裁问题。 语言自由是民主制才有的。只有霸权社会才控制语言自由。


Sunday, June 23, 2019

Navigation system for Blind using Passive RFID

It is always troublesome to find our way in a big shopping center. This applies to Visual Handicapped as well as sighted. Currently, the best way is to use beacons system to provide navigation and information around the beacon.

To maintain the beacon system is not that cheap. Beacons are life beacons that needs power source. In a big building, the number of beacons used is staggering. There are ways and means of using other technologies to provide navigational needs for the Visual Handicapped. Below is one which I think is viable.

RFID has been in the market for decades already. Passive RFID is just a piece of paper attached with a tiny chip and an antenna. It is very cheap and can be bough in bulk. Each RFID is unique. Therefore, if you are near enough with a reader, you could know which RFID is near you.

Firstly, you need to lay breadcrumb (RFID) trails on every path in the building. A mapping of each RFID and nearby POI (point of interest) is necessary for navigation. The breadcrumbs should be spaced at a fixed distance apart. Ideally, at every junction, a breadcrumb should be right in the center of it.

User using RFID reader could then able to read the breadcrumbs as he/she walks along the path. By limiting the range to just able to read at least 2 breadcrumbs, The system will be able to know which direction the user is moving since the last one will drop off and new ones will appear. With the mapping, you can then tell the direction of movement.

At junctions, user should be informed that there are branches and alert user on the possible direction and POI. User can then make a decision to move to the specific direction.

The app can be in a form of a map of the building with blinking dots to show current user position and with voice assistance for Visual Handicapped to use. It will have a list of POI to assist users. It will be good to have a search function that finds the nearest point matching the search string like "exit". A highlighted path to the search string, like map navigation, will be helpful.

Since passive RFID is cheap and need no power, it is just a install and forget type. Any missing RFID can be replaced with the same ID. It is, therefore, simple and cheap to maintain such a system.

Now the expensive part is the RFID reader. It needs to be Wi-Fi enabled so that it can be integrated with hand phone app. The app has to be custom designed to use it as navigation system. All these costs eats into user's budget. However, it reduces the cost of building owners so that they will be more willing to invest in the infrastructure. With many building owners willing to install the system, the cost of the application can then be reduced thus lessens the financial burden of users.

Since this navigation can be used for sighted, it becomes universal navigational system thus further reduces the costs. It is a win-win situation.

This system need not to be indoors only. Outdoor place like parks can install such system using weather proof containers for the RFID. It can even be used for temporary venues like a carnival. The uses are multiple.

GSX Questions

It was something that was started quite sometime ago but wasn't made compulsory. Questions are a set of data that was posted as questions and user is supposed to answer it accordingly. Its as simple as that.

However, the Questions are nested questions and no fixed pattern. Previously, a pointer is used if there are nested questions. It could not work that well. Recently GSX changed the data format to JSON and the Questions were set in nested JSON format. This makes it much easier to follow as we just need to traverse the nesting structure typical of JSON.

Fortunately, Questions uses fixed format in the form of Questions and Answers. The nesting is always at the Answers array or as a array in the Questions level.

This blog talks about how to traverse through the list and nested questions using FileMaker. As it is, GSX returns a JSON. Since FileMaker has JSON functions that can read nodes from JSON stored in fields or variables and the format (path) of reading the nodes is like "XX.YY.ZZ". If it is an array, just add the array number after the node name like "XX[0]".

The method of traversing the nodes is simple. The path is stored in a variable.  We start off with $trees="questionDetails[0].trees[0].questions[0].answers[0]". Using JSONListKeys($json;$trees) we can get a list of keys. If there is no answers, we remove the last node and add 1 to the previous level array then repeats to find the answer keys.

Upon finding the answer, we post the question and gets an answer from user. Depends on answer type, user have to respond accordingly. Once finished answering then we look for nested questions in the answer. If there are nested questions, we add one new level after answers and go to the first question in the nested questions.

In the nesting, if there are more items in the array, we go into the next item in the array and look for questions or answers. If there is no more or no questions/answers. we back up one level and see if there are more items in that level.

In this way, we could go into the nesting systematically and back up to the higher level if there are no more array item.

GSX requires you provide the question ID when you answers. So you must create an answer JSON that corresponds to the Questions. Every time you add a question/answer level you need to add the array first so that when you answer, you can write the answers using the same $trees array.

I won't be diving into showing examples of traversing. Do figure out how to do it yourself.

Thursday, June 20, 2019

Communicating with Apple Web Services (GSX) via Filemaker 2

My previous blog on the same subject is 3 years ago. Since then Apple has changed from using XML to JSON as a means of transferring data. Therefore there is a need to show how to do it with JSON.

JSON (Javascript Object Notion) by its name, is a Javascript feature but it has extended its use to many other applications. It is a format of storing data just like XML except it is more human readable when you format it nicely.

Fortunately, FileMaker has caught up with the latest trend by including a few JSON related functions. It is not that easy to use those functions to compose JSON but it is very much easy to get data from JSON.

To create simple JSON you just need to use $example =JSONSetElement("";"elementkey";"elementvalue";1) and it will create a nice JSON '{"elementkey":"elementvalue"}'. However, if you want to insert nested JSON then it is a bit tedious.

For example, you want to create a key that contains an array with one key and  value. First you must create the key and value as a JSON like last paragraph. Then you have to create an array to contain that JSON like $array= JSONSetElement("[]";0;$example;3).

Finally you then create the root element like $root=JSONSetElement("";"root";$array;4). You have created a JSON '{"root":[{"elementkey":"elementvalue"}]}'. This format is generally used by Apple in GSX in both request and response.

If it is a simple JSON that need to store a small set of data with fixed keys, it is better to create the JSON with unique values for each element that needs to be changed like "~!1", "~!2" etc. After that use substitute function to replace the "~!x" sequence. Two lines instead of 3. In actual fact, one line encompassing both action can be done by just using the JSON as source of substitute directly. In this way you could reuse the same code repeatedly or even store it as custom function.

The parameters used in JSONSetElement can be found at. JSONSetElement.

Getting values from "elementkey" in the above JSON is easy. $value=JSONGetElement($root;"root[0].elementkey")

If you looking at this blog first then I suggest you go to the previous blog on the same subject first to get an understanding.