Tuesday, October 06, 2020

Media Article and Response of Reader

 

Recently the Straits Times published an article "Silvia Lim's Motion on Parti Liyani case not picked for Parliament Sitting". There were quite a few exchange of words between MPs and readers.

The article's choice of words are entirely the author's in the author's own understanding and expression. It may be carefully crafted to make the title striking or perhaps crafted to mislead people. However, in the context it was clearly stated that it was "decided by ballot".

The question on whether it is deliberately crafted to mislead or just simply stroking reader's reaction is best left to the author since it is worded by the author. The author may well be in the "you know" mindset that assumed reader understand the title by reading the context. Thus, the choice of word is entirely the author's "bias".

On the readers' side, it may be entirely misunderstanding of the title coupled with the lack of interest in the context or lack of knowledge in Parliament Process  or deliberately reading the title out of context before commenting. Other readers reading the content is thus lead in the comment to belief what was stated and thus MP responded by lashing out. This is typical readers mindset. They formulate the message entirely in their own understanding of the title. Again is is said to be readers' "bias".

Obviously, there will be others who jump in the wagon and make a scene out of it like the article published in "The Independent" showcasing MPs and readers comment thus making a case out of it.

There is no way in stopping the authors' choice of word in the title and no way to stopping readers to response in anyway they like. One must be aware of the subtle messages conveyed by the title yet understand that it could be just plain inadequate portraying an incident or a deliberate means of attracting readers' attention misfired. The author's article would have been vetted by the publisher before being published. Depending on the bias of the publisher, it is then shown to the public as an edited article. 

Since (according to some) the publisher is pro-government, it may well be a gimmick backfired rather than "bias" as stated by Tan CJ in his comment.




Saturday, October 03, 2020

Blind Navigation System using QR Code

 My previous blog talks about using RFID for navigation. The only problem is that the reader is not cheap and is hard to come by. This blog talks about an alternative for the RFID.

QR code is good because it can tolerate high margin of errors.  QR code can be scanned using a hand phone. Thus the data and the reader is available cheaply. QR Code need not be read from a close proximity. Just enlarge it and it can be read from a distance. 

I tried a two inch square QR code (1234-56) and it can be read from a meter away. Proportionally, a 5 inch (12.7 CM) should ideally be read from 5 meters away. In actual fact, it can be read at 3 meters distance only . However, that will be good enough otherwise it cannot fit the camera view at close distance.

The use of it is similar to RFID. There is a mapping of all the QR code within the area. They are placed 3 meters apart. 3 meter is used to ensure that the next QR code is within scanning distance. Using the same triangulation method of the RFID, the same navigation method can be done.

Obviously, the QR code should be hanging high enough so that human traffic will not obscure it. Since it is passive, Visual Handicapped may totally lost trace of it and wonders off course. Illumination is also a issue unless the place is perpetually lit.

See my post on RFID here.




Friday, October 02, 2020

玄幻小说

 近来无聊的去看网上玄幻小说。看了几篇后有感想。他们大都采用同种格式。都有抄袭的嫌疑。不但是抄袭而且一直重复。以下是一些范例。

1. 穿越 - 死后穿越到另一个世界。附体于另一个人的身体。美名为夺舍。

2. 进阶 - 故事通常为武术。可以进阶。 进阶时是以梯级式而不是线性累进的。跟网上游戏一样。

3. 夺宝 - 时常有秘境开放。有进阶上限。进去时会分开。时间到会自动弹出。宝物常有武功传承,武器,药物,进阶等。

4. 异兽 - 像人一样有阶段。生体内有灵晶。

5. 竞选 - 不同形式的武术比赛。

6. 地位 - 进了宗门有外门,内门,精英等分别。要往上爬就必须进阶或比赛。

7. 闯关 - 通常有几层的。失败的会被弹出或死亡。

8. 成神 - 不少小说主人会成神或仙。会升仙。

9. 同阶无敌 - 通常是越阶挑战。

10. 灵药 - 灵药生长地一定有灵兽保护。

11. 天谴 - 进阶到某种程度,修炼超世而受天惩罚降下九道雷劈。

12. 不死 - 人被打死死了灵魂可以离体找人夺舍重生。

13. 储物戒指 - 可大量的储存物资。

14. 离题 - 作者会加上个人写作感想或请求。

15. 法则 - 武功的一种。时间与空间法则为最厉害。

16. 领域 - 另一种武功。

17. 大话 - 在打斗前对方常说的话。

18. 自废 - 对方常没开打就叫主角自废后给他全尸或自己断手脚。

如果情节完美结束那还可以接受。某些作者半途以主角死亡结束或没头没尾的完章。有一个作者完全迷失情节搞到主角变成另一个人然后突然结束。









Sunday, March 22, 2020

Telling lies

From the bible the biggest lie that was told is in Genesis 3:4 "You will not certainly die". Gen 2:17 clearly says "for when you eat from it you will certainly die".

Now what is a "lie"?  According to Cambridge English Dictionary, "something you said that you know is not true." In Gen 3:4, the serpent knows it and tried to deceive Eve, the woman that is created after Adam was told not to eat the fruit. The reason why the serpent lie to Eve is that she does not receive the command from God thus only knows the command second hand. This is not to say that woman is weaker than man just that the doubt is planted by the serpent on a person who does not receive the command directly. That person happened to be Eve. If it is Adam that defies God, directly mankind probably no longer exists.

The wider purpose of a lie is to gain something from a lie for personal benefit. The serpent lied so that it could destroy faith in God. For most people, it is just to benefit self.

When a person tells a lie that could prevent the lost of a life other than your own, is that still a lie? Literally it is still a lie but it is used for a different purpose. During WW2, Chiune Sugihara issued visas to Jews despite being told not to. He lied so that 6000 Jews could live. What does he gain? A dismissal from foreign office. He and his family felt no shame on it because it served a higher purpose.

We are just little people but often we have to tell lies just to avoid embarrassing the person we lied to. We gained little from telling the lie. It is wrong to tell lies to prevent embarrassing ourselves or cover our wrong doing.

Real lie is from people that tried to achieve gains from it. The lying person tell lies that could benefit from it or served his/her purpose. They tell lies to gain from others or prevent damage to themselves.

Lying is not just for monetary gains. It could be used to destroy faith in the person or state. For example, giving false statements. Singapore has a law against POFMA (Protection from Online Falsehood and Manipulation Act). Although it could be used to deter people from telling the truth, it generally prevents ill hearted people or group that tries to destroy others.







Monday, December 30, 2019

PHP Use of Openssl Encryption

There are a number of encryption methods available in PHP. While they are used in various applications, the main objective here is to talk about a two way encryption/decryption using Openssl.

Openssl is a general cryptography library. PHP has a number of functions that handles openssl. To use openssl you have to create or buy a SSL certificate. Buying from a cert authority means that your certificate are certified authentic. Creating your own private cert has its own use. For the purpose of encryption and decryption, there is no advantage in not using a authentic cert sine your purpose is only between two parties. You can generate ssl private cert using command line Openssl library. I will skip this part as it does not involve using PHP.

A certificate has two keys (a set of strings that can be used for encryption/decryption). One is Private key the other is Public key. By its name, you can see that the former is only used by one party. The Public key can be distributed to many others. Its uses is discussed below.

The user that has a private key uses it to encrypt a string. Any one with the corresponding Public key can decrypt it. Any one with Public key can use it to encrypt a string but only the one with the corresponding Private key can decrypt it. The former is for sending common data to many people that has the Public key. Its actual use is for a specific purpose detailed later. The latter is for many people to send data to a central person. This means people can sent personal data to a site but only the site can read it.

Lets talk about using Public Key to encrypt and decrypt data. First we do public key encryption.

$aok = openssl_public_encrypt($data. $encrypted, $pubvlicpemkey);

$aok is just for checking whether the encryption is successful. $data is the raw data to be encrypted. $encrypted is simply the variable to store the encrypted data. $publicpemkey is the Public Key in PEM form.

To prevent data transmission error, we need to convert the encrypted data into a special text format using "base64_enconde($encrypted)".

On the receiving end, we need to use bse64_decrypt($encrypted) to return back the encrypted string before using

$aok = openssl_private_decrypt($encrypted, $data, $privatepemkey);

As usual $data is the decrypted data.This method is basically used by sites to let customer send personal data or banking transaction. Since only the site is able to decrypt, the transaction is secure.

Next we use private key to encrypt. Its use is to ensure that the sender is authentic (if it uses recognized cert authority certs or has a understanding between sender and receiver.) Its main use is just to sign the data that was send in plain or encrypted text. It usually involve two certs each exchange their public cert with the other.

The method use is

openssl_private_encrypt($data, $encrypted, $privatepemkey);

The other party then uses the following to decrypt the data.

openssl_pubhlic_decrypt($encrypted, $data, $publicpemkey);

Since only the sender that has the private key can encrypt the data to be decrypted by the receiver with the public key, the receiver basically can be sure that the data is from the sender with the private key.

Another use of the Openssl is to send a signature. A signature generally follows a text and is used to prove that the text is authentic from a specific person. It is similar to sending a private key encrypted message but with a layer of security added called hashing (a method of mapping a data to a specific size).

$hashed = hash($method, $data, false);

There are many methods of hashing. Usually we uses 'sha256'. The last parameter specify using raw output to ensure that nothing is changed.

The next method encrypts the data using a different functtion

openssl_sign($hashed, $signature, $privatepemkey);

Obviously, by sending the above does not quite let the receiver know how to identify the signature. The signature is basically used to accompany a plain text or an encrypted text. If it is encrypted then the receiver has to decrypt it first using methods previously discussed above.

On the receiving end, the following decrypts the signature. Before doing anything, the receiver has to hash the text (plain or encrypted) that comes with the signature. If the text is encrypted then the receiver has to decrypt it first. The following function then is used to verify that the hash matches the signature.

$hashed = hash($method, $data, false);
openssl_verify($hashed, $signature, $publicpemkey, OPENSSL_ALGO_SHA256);

The last parameter specify 'sha256' hash method.

Note that if the text is encrypted, it usually use a public key from the receiver otherwise the encrypted text is already proving that the sender is authentic.





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.