Saturday, June 15, 2019

Exercising by Heart Beat

Normally one would want to exercise with some repeatable routine. Some go for fixed time. Others go for distance. More health conscious people will want to stick to an exercise/training routine depends on the type of exercise done.

I usually go for speed based exercise as I do walking and cycling. Recently, I am obsessed with heart beat based exercise. It is not scientifically proven but based on the ample talks about lowering heart beat, a controlled heart beat during exercise moves one towards lowering it. It will be good for controlling hyper tension, high blood pressure.

Before launching on the methods used to keep heart beat within a range during exercise, it will be good to about the basis of heart beat measure. According to scientific figures, the maximum heart beat a human can have is 220 beats per minute (BPM). Individual person's maximum heart beat is 220 - number of years of your age. People who exercise constantly will have their maximum heart beat considerably higher than normal people's heart beat.

Minimum heart beat depends on individual. Some athletes have resting heart beat around 40 BPM. Most people's heart beat is between 60 - 100 BPM. Children aged 6 -15 is around 70 - 100 BPM.

My range of heart beat I want to control while walking is 99 - 108. It is at the lower end of medium exercise range. The reason is to avoid excessive sweating. It is not easy to control the heart beat at this range as any lower than 98 BPM means I am out of medium exercise range. This is especially true if I don't do warm up before walking. It tends to fluctuate very much till the body is warm up.

Monitoring heart beat while cycling is a bit dangerous. However, all vehicle drivers including motor-cyclist have to keep monitoring their speed while driving. Their speed is very much higher. Just ensure that the coast is clear before you take a peek at the heart beat monitor. I only do it while cycling on long stretch of PCN or cycling path.

Depending on the type of cycling done, the heart beat range can be different. Usually, if I want to go for speed, I abandoned heart beat monitoring. Just go fast till your limit. On the other hand, for standard exercising, I go for 155 plus minus 10. It is at a comfortable heart rate without stress. Coincidentally, 155 is my maximum heart beat (theoretically).  Individuals must try and error to find a comfortable cycling speed for themselves.

At 155 BPM the speed of travel is basically below the 25 KPH limit of PCN. It is therefore safe and within the regulation.

GARMIN Connect has a stress measurement statistic page. It is to show how often you get stressed. My stress region is generally non existing except at the beginning  and end of exercise. It could be a result of my method used but there is no proof and I don't bother to prove it.

Below is a typical walking speed and heart beat chart.






Friday, May 24, 2019

Windows 10 grinds to a halt

First it was an extra application called Chromium get installed. Unable to install thus use IObit uninstaller to remove the program.

After that the computer suddenly goes unresponsive. It takes over a minute to respond to clicks.  Task manager indicated that CPU usage is low and Disk activity is low. It just puzzles me.

Nothing I do could solve the problem. Manage to get Win 10 to boot to safe mode by forcing it to close then start again 3 times.

Even at safe mode, it also responses not that well. On searching from internet, it was suggested to check page faults. Starts Performance Monitor and adds page fault. The percentage is 100. Netizens suggest using Sysinternals, Process Explorer. Downloaded it and run. There is an item that has more than one million page fault. It is Mcafee.

Uninstalled it and the system works as normal. One problem still persists. Windows Defender antivirus shows that "the virus protection is managed by other manager". No facility to set it back. Well, that is not part of this issue.



Tuesday, April 30, 2019

Profiling Tan Kin Lian

A person is gauged by his/her acts and speech. There seems to be quite a lot of news from Tan Kin Lian. The following is extracted from internet. I don't draw conclusion. It is up to you.

He portrayed NUS voyeur Nicholas Lim and mother as victims of the case just because the actual victim post his picture and name on Instagram.  The voyeuristic act is ignored. A "controversial statement" according to Tan Kin Lian himself.

"Paying Johor 15 million a year saves 15 million on defense". He thinks Singapore is going to make war with Malaysia for water. Also the idea of "paying Johor 15 million" is giving Malaysia what they wanted. There is no other way?

He said he will stand for election of enough like minded people come forward to support him. "I will change my mind if I do not see enough of them coming forward". He expects to be ushered into parliament? First he ask for 300 likes on FaceBook then he ask for 1000 after it is achieved.

He posted "Changi Airport custom officer - Are you Mr Tan? Any Tongkat Ali to declare? A traitor tipped him off". After that he claimed he was joking on Twitter. In his earlier post he described how to make Tongkat Ali tea.

He cancelled Grab booking 3 times in a row. Maybe he don't know how Grab works.

He ran in the 2011 Presidential election and forfeited $48,000 because he cannot get enough votes.

 He said on Facebook "I boarded SMRT 857 and found that I was in Mumbai." A statement unbecoming of a presidential candidate. He apologized and deleted the post.

According to some his departure from insurance cooperative is not entirely voluntary.

Some accused him of being a detractor of the presidential election. He instead accused Tan Jee Say of being "the last candidate" thus should consider withdrawal. It is noted that he only got 4.9% vote whereas Tan Jee Say has 25%.

http://tankinlian.blogspot.com/2011/07/sia-website.html is yet another blog of his showing how much he knows about internet of things.

He posted his personal data online and dares people to hack his SingPass. Well, his SingPass got locked out within hours.

The above are just gathered from internet. There is no checks on whether those are false news. At least I don't see any report that they are false news.




Friday, April 26, 2019

NUS Peeping Tom Case

In olden days when internet was not that popular. Any such offence simply gets unnoticed even if the accused gets persecuted. The victim does not have any further say as to whether the punishment is just.

With the IoT, at least the victim can voice out the feeling of injustice. Although the victim's post on social media could be viewed as 'doxxing', it is still a victim's voice. Where else could the victim voice out the frustration.

Netizens have various views and comments even politicians chipped in. The following are comments on some of it.

1. The police. The police have decided not to prosecute the accused based on their reasoning that the offender is just a first offender with no traits of such offensive behavior. They therefore give the accused a 12 month conditional warning. If they prosecute the offender then there will be a permanent record which will ruing a person's life even before he get started in life.

2. NUS. NUS is like any educational institution, which is supposed to uphold individual's privacy and integrity. The initial punishment is suspense from a semester, banned from entering campus residence and write a letter of apology to victim.  I am not here to judge the punishment but it does looks like a slap on the hand. Of course I can't say how much punishment is enough but it is not even near the police's punishment level. There are already 20 NUS previous cases in last 3 years and there is no review on how to stop it. They finally apologize and get to hold a review on this.

3. The accused. Beside being given punishment by Police, NUS, Great Eastern, he only express "no excuse" in a ST interview. No public apology was given  as far as I can see.

4. The victim. As said before, her post could be viewed as 'doxxing'. There are better ways to express frustration than to identify the person with pictures in social media.

5. 'Trial by social media'. Those against voicing out saying it is TBSM. However, if this wasn't brought up, nobody knows about it and the vicious cycle continues unabated and unknown. At least now we know that Police have their reason and NUS no longer wants to keep it quiet.

6. Great Eastern. As a company, it cannot be seen to be doing nothing. Firing the accused is the only way out.

7. Agrarian. The company cuts ties with NUS on condition that NUS expel the accused. I don't think this is the right way. It becomes issuing a threat to NUS. Others simply says that the company join in to the media rush to be heard and seen, a typical business tactic.

8. A blogger seems to be biased against the victim in her lengthy blog on the issue. She question about the rights of the accused future. One other post that talks about the blog question how she feels if she or her family member is the victim.

9. Tan Kin Lian is giving support to the accused. He portrayed them as victims. If he is referring to 'doxxing' then it may be true. It depends on who is viewing the incident at what instance? I will be grossly unjust if the focus is only on the consequence of the victim's action than the voyeur's action. It reminds me of the "Singapore Kindness movement" which sides with the perpetrator rather than the wronged.

9. Right to be forgotten. Singapore has this Personal Data Protection Act in place. This should give the accused back his life.




Monday, March 25, 2019

Evaluation of Careeach HR

The Careeach HR is a free tracker provided by Health Promotion Board. The following is a comparison with Garmin Forerunner 935. The comparison is one way. That is to say only compare what Careeach HR has to Forerunner similar functionality only. It is unfair to compare with all the available features of Forerunner 935.

1. Steps - Steps are fundamental feature however it is noted that Careeach HR always track about 10% less compared to Garmin even the steps setting are the same. Garmin seems to show slightly more steps than usual.

2. Heart Rate - Careeach heart rate measurements are very unstable. It can go above 150 while Forerunner shows a modest sub 90. The measurement can simply drops well below 80 while exercising and can drop out of continuous measure mode unexpectedly. Its auto mode is most unreliable. I always turn on continuous mode while exercising. Garmin shows a bit less accurate in auto mode but function well in continuous mode. I can use Garmin to control the heart beat rate but not Careeach. The latter heart beat goes up and down too much and too quickly. Careeach calculates max heart rate according to age. It will buzz user to slow down if the heart rate goes beyond heavy range. Garmin does not buzz user and its range is fixed percentage.

3. Display of the Careeach tracker is always off but can be activated by hand or a twist of the hand but often have to make very large angle swing of arm in order to activate it. Garmin does not have this feature as its display is always on. Both tracker will switch over to clock mode if it not in continuous measure mode. Garmin heart rate display will switch to clock mode after a while but it will stay if it is displayed in sports tracking mode.

4. Upload of data is a hassle. At times the HPB App has to be turned off and on a few times to make it update. Sometimes, the whole hand phone has to be rebooted to get it to work. Garmin update to HPB is via its apps. Although two steps are required but the updates are usually reliable.

5. Charging of Careeach is via USB but the display can some times go straight into full by just plugging in the tracker. The full charge display can stay till it run suddenly out of juice thus lost valuable data. Turning off and on the tracker does not help. Garmin charging can be a bit of problem due to contact issues but never have wrong display issue.

6. Careeach states that its tracker is splash proof. However, one tracker died after going though a light drizzle. Had to replace it. Garmin is water proof up to 50 meters.

7. Battery life of Careeach is way too low to be compared to Garmin. But it can last at least 10 hour of continuous heart beat tracking mode. It could last 2 days or more on normal mode.

8. Careeach will buzz user if they stay static for too long. I am not sure Garmin has it.

For a free device, Careeach HR could be used for tracking steps. Heart rate is at best good for indicator only. Just don't exercise in the rain or use quick charger to charge it.




Monday, March 18, 2019

Time and light

I am fascinated about time. There are already two blogs on the subject. This blog is to further elaborate on it against light.

The concept of time has already been discussed in earlier blogs. Light is the visible element that enables us to see things when light reflects on it. The speed of light is 299792458 meters per second or 1080,000,000 KPH. The speed of light according to WikiPedia is "a universal physical constant". However, X ray and laser seems to be travelling faster than light. Thus it is merely a reference value. Lets just take the reference value as the standard.

Now to see the light one second before now, you have to travel faster than the speed of light. It takes twice the speed to reach the light one second ago if you are travelling in the same direction as light. However, you can't travel in the opposite direction as light has not reflected from the object yet otherwise you would have gone past the object and chasing the light that does not exist. At best, you would have chased the past light in the other direction if the light is always on.

Travelling to see one second of the light before now needs you to travel at double the speed for one second. How long to take before you can catch up with the light one hour before at the same speed?

Now, even when you can see the light one second before, there is nothing you can do to alter it since it is already in the past. Therefore, the theory of changing the events that occur in the past is meaningless since you are only chasing the light not the object.

Even if you are chasing the object that travels away from you, you are merely reaching the object in its present state. There is no way you could have change anything before that state even if you travel ahead of it. You will only be able to see the "now" state of the object. Obviously you could change the environment before the object reach you but its not the future of the object, you are merely changing the "now" state of the environment so that the "now" state of the object and the "now" state of the environment where you are now coincides.

An analogy can be shown by a person shooting an arrow towards a target and another person moved the target before the arrow reaches it. It is just the "now" moment with the two object. 

Frankly speaking. The "now" state occurs on everything simultaneously. Nothing you do that could possibly change the "now" state as time is a measurement of a past event that is not changeable.

On the speed of light thing, a person can only withstand a certain G-force before he black out or dies. 1 G is 9.81 meters per sec. Light speed is 299792458 meters per sec. Without calculation, you will know that it is impossible to survive if you travel at the speed of light.

On the joking side. If there is no light then you can see nothing. How would you be able to chase the light at light speed? How is it possible to see anything?

One other thing, if you are travelling at the speed of light, those light you will see is probably a small area of light that is travelling in the parallel direction. How big a lens would be able to use to view an area of a square meter that is 299792458 meters away?



Friday, January 11, 2019

SQL Aggregate Function as Table using PHP

SQL aggregates as defined by netizens is "perform a calculation on a set of values to return a single scalar value". We often use aggregate functions with GROUP BY, HAVING clause of SELECT statements.

While it is very simple showing tables with just one aggregate or a set of aggregate functions using SELECT and GROUP BY then showing the table as retrieved by the SELECT statement, the table is practically vertical listing in nature. For example

SELECT states, people, SUM(revenue) FROM sales GROUP BY states,people order by states DESC

will show when you format it as table from the query result directly.

People   Revenue   State
Sam       100,000    Selangor
Ken        200,000    Selangor
Joe         100,000    Johor

What if you want to show all the people in the state regardless whether there are sales made by individual and the percentage of their Revenue for the state? It is quite impossible to do it in a single select statement.

The following method shows how to use a single statement to get a list of people and their revenue plus percentage of the group.

First we create an associative array from a list of people and populate it in the array.

$keys=array('Sam','Ken','Joe','April');
$values=array('Revenue'=>0,'Percent'=>0);
$total=0; //totals of the group
$revenue=array_fill_keys($keys,$values)

Retrieve the data using the previous SELECT statement like below. The example uses SQLite.

$db=new SQLite3('revenue.db');
$result=$db->query("select people, sum(revenue) from sales group by people");
while ($row=$result->fetchArray(SQLITE3_NUM))){
$ppl=$row[0];
$revenue[$ppl]['Revenue']=$row[1];
$total +=$row[1];
}
$db->close();
//do calculation and populate table
foreach ($revenue as $key=>$row){
$percent=round($row['Revenue']/$total*100,2);
echo " {$key}
{$row['Revenue']}{$percent}";}

Obviously, the above could be done by 2 queries. One to retrieve the overall total and the other one as above. However, what if you want to list the sales by date and show the people in columns? That is not an easy task representing it in one or two SQL.

You could retrieve the query by revenue grouped by date and people. Your array setting will be

$keys=array('Date','Sam','Ken','Joe','April');
$people=array_fill_keys($keys,$values)
$revenue=Array(); //you could fill the array with every date in the period you choose.

In the while loop, do as follows (assuming date is unix datetime),

$rdate=$row[0]; // the date field
if (!isset($revenue['A'.$rdate])){
$revenue['A'.$rdate] =$people;
$revenue['A'.$rdate]['Date']=date('m/d/Y',$$rdate);
) // set up the array and populate the 'Date' of the array for easy retrieval later
$people = $row[1] //the people field
$revenue['A'.$rdate][$people]=$row[2]; // the revenue field

With this you could populate the whole columns of people with date as first column. Displaying the table is then a breeze using the FOREACH example above.