RunforFood: 64 minutes to 400 hours

Woohoo! I’m just 64 minutes to the 400 hours milestone!

Capture

Advertisements

Some factoids about Air Quality and its measurement — My Take

For the last 5 days, we had experienced in Singapore what seems like a Hollywood movie script. “Crisis” loomed, leaders (perceived to be) giving bad decisions, people panic into revealing or rise to their true-selves.

SINGAPORE-INDONESIA-MALAYSIA-ENVIRONMENT-HAZE

Confusion, anger and desperation, partly because information was in bits and pieces in National Environment Agency (NEA) site. NEA website has finally re-organised it’s information with better clarity, although I think laymen would probably not understand. I thought I would share some of my takeaways after researching on the topic of air quality within and outside of NEA website. Some facts may well be my wrong interpretation, but all these are what I have concluded after going through NEA site, EPA/Airnow site, various countries environment agency sites such as Hong Kong, United States, Australia, Germany and UK.

  1. PM is no Prime Minister.  PM10 refers to particles of size less than 10 micron, which means it includes those that are smaller than 2.5 micron but bigger than 100 nanometer. Particulate matter is one of the pollutants used to measure air quality, and usually measured in terms of its concentration (microgram/cubic metre)
  2. PM10 versus PM2.5. Because PM10 include particles smaller than 2.5 micron, you would naturally expect concentration of PM10 to be higher than that of PM2.5. E.g. a PM10 concentration of 54 ug/m3 has the same air quality effect as a PM2.5 concentration of 12 μg/m3.
  3. PM10/PM2.5 concentration can be measured as 24 hour average, 3 hours average (in case of NEA for their 3 hours PSI computation), or hourly (used in Australia and some states in US).
  4. (NEA) PSI calculation method is similar to other air quality index used in other countries. Air quality index (or pollution standard index) looks at 5 pollutants (particulate matter, sulphur dioxide, carbon monoxide, ozone and nitrogen dioxide). The so called better AQI used in some countries, is because they look at PM2.5 concentration whereaas NEA looks at PM10. Each pollutant measure is sub-indexed based on a table of scale that corresponds to the concentration. For e.g. sub-index 50 is equivalent to 24 hour particulate matter concentration of 50 ug/m3, or 8 hour Ozone of 118 ug/m3. The PSI (or AQI) is then determined by taking the maximum sub-index of the 5 pollutants. So if PM10 index is 50, but Carbon monoxide index is 200, the air quality is indexed as 200.
  5. PSI is AQI, no? While NEA uses PM10 instead of PM2.5 to calculate the PSI (or AQI), it does report 24 hours PM2.5 separately, used to be every 4 hours but recently reported hourly due to the escalating haze. The PSI/AQI is therefore inaccurate, if every pollutant has low concentration, but the high concentration of particulate matter is mostly due to 2.5 micron or smaller particles. In recent haze incidents, this is not true though, mainly because the concentration of PM2.5 is exceptionally high, so even if PM2.5 pollutant is not used to measure air quality, it’s concentration is already reflected in PM10 measurement.
  6. PSI is not accurate? When 3-hour PSI is low, but PM2.5 concentration shows exceptionally high, that’s most probably because the latter is measured past 24 hour (in the case in Singapore). Only PM10 is measured on 3 hourly basis. Whether it’s 24 hour, 3 hour or 1 hour average, it shows AVERAGE measurement, and it does not correspond to what you see/smell NOW. Obviously, an 1 hourly average measurement will be closer to what you see, while a 24 hourly average will prevent unnecessary panic alarm (or false sense of comfort) due to a particular spike / drop. Therefore it is important to know the duration in which the pollutant or air quality is being measured, and used it accordingly.
  7. Hourly or 24 hourly average is the way going forward? When the air quality is already at hazardous level, a forecast measurement would be more helpful than an hourly or 3 hour reading, because one should already be taking the necessary precautionary measure against the haze. (This is just my take)
  8. Hourly or Real time AQI? Not all countries are using true hourly air quality index measurement. In Beijing and Hong Kong, the hourly report pollutants based on the same definition as Singapore. e.g. it uses 24 hour PM10 concentration at 1500 hrs for a 1500 hr AQI calculation. In US, not all states have 1 hour average PM2.5 / PM10 concentration reading (e.g. Colorado state), let alone 1 hour AQI. In Germany and UK, there’s no reports of 1 hour average measurement. In Australia, it does look like all states have 1 hour moving average readings (at least 2 out of 2 states I checked have 1 hour average readings). Last but not least, NO countries provide real time measurement of air quality index, or the associated pollutants.

Conclusion

I do stand corrected for the above interpretation, but the purpose of the writing is because I read too many postings and accusation that’s based on seriously wrong assumption or understanding. I hope this doesn’t create more confusion than it is already in the cyberspace. If I have more time, I will reference some of the sites to the above points so that you can read for yourself if I have interpreted wrongly or not.

Appendix

London AQI definition http://uk-air.defra.gov.uk/latest/currentlevels

Run for Food: 1000km milestone!

It has been more than 11 months since I started my running regiment. Today, I reached the milestone of completing 1000km of running. It is not a lot for a seasoned runner, but certainly a magic number for me. 11 months ago, I would not have thought I would clock a mileage of 100km, let alone 1000km.

 

 

From the chart, you can tell that I had cut down my running activities in Aug – Sept period. It was due to the injury I sustained in August, and in fact am still recovering from it. Thankfully, it didn’t hold me from attaining my goal.

Incidentally, I had curry fishhead for dinner, what a way to celebrate the goal accomplishment, and keep the motivation going!

Run for Food: Swimming as effective weight loss exercise?

Ever since I had started swimming 3 weeks ago, I had observed my body is responding to the exercise much better than before. This is despite after reading about swimming burns less calories, or how it is less effective than running in achieving weight loss.

Apart from feeling the ache of my body muscles all round after a swim,  versus the feeling of ligament strains after a run, I thought I have become leaner after 3 weeks if daily swim, at least psychologically.

Here’s my reasoning; It is an established fact that exercising burns different source of our body “fuel” (fat, carbohydrates, protein, etc), depending on the zone that our heart is exercising. At aerobic zone, our body burns more calories than exercising at fitness zone, while consuming a more balance percentage of energy source between fat and carbohydrates.  Unless I am on low carbohydrates diet, aerobic zone is the most effective weight loss zone.  Having run for 9 months, I know it is not an easy to keep to aerobic zone throughout the one hour of running, probably due to the loss of body fluid. On the other hand, I noticed that I can keep to the aerobic zone consistently regardless of whether I stick to a 30 mins or 1 hour swimming session.

Back on swimming, I am never been a natural swimmer from the onset. I do not feel comfortable when in the water, even when I could stay a float or swim. For a long while, I would have struggled to complete a 100m  freestyle, let alone a long distance freestyle swim. In the last 3 weeks of swimming, I have been doing one lap of  freestyle with one lap of  breast stroke routine for my swim. The breast stroke is more like a rest stroke for me to catch my breathing before doing the next freestyle lap. But 2.5 weeks of consecutive swimming seems to have paid off.

Me Swimming

On 12th September, I managed to stretch my swimming distance to 2.5km, albeit with the alternate strokes method. Despite four consecutive days of 2km (with one of them being 2.5km) swims, I did not feel any more fatigue, unlike a week ago. While I only completed a 1.5km distance on the 5th swim day (I had originally planned for a 1km swim) I actually completed a 40 continuous laps (or 1km) of freestyle swim. It is simply amazing that after 40 years, I have finally achieved this feat.

With all said, I figure that I should try and improve my strokes so that I can breathe on the alternate sides. That would probably be my next goal while continuing to stretch my freestyle swimming distance. In the meantime, I am looking forward for my next run (target to be a week later), as I am confident that 4 weeks of daily swimming should bring some positive impact to my running sessions.

Exercise Statistics Dashboard (as of 14th September 2012)

 Activity Type  Activity Counts  Activity Distance (km)
 Running  120  862.12
 Cycling  8  220.5
 Swimming  11  26.1

Animal Protection – It starts with you

Ministry of National Development had recently set up an online survey, to collate public feedback on pet ownership and stray management policies. If you have not already done so ( in giving your feedback), it’s high time you do so, whether you are a pet lovers or not. At least, the authority would be able to tweak their policies so to protect the innocent animals while making sure all the ‘troublesome’ human-beings happy (Note: I am referring to both pet and non-pet lovers, as I think human beings are always the problematic one, not the animals themselves)

For me, I think the stray issues need to be dealt with a multi-pronged approach;

1. Pet Homing policies to curb the overcrowding situation in the animal shelters.

The HDB policy on pet ownership should be revisited, so that it would be more supportive in homing of medium dogs. In helping to re-home the stray animals which a significant number of them do not meet HDB guidelines, whether it’s an “all inclusive” or “by exception” policy, it will go a long way to address or mitigate the overcrowding challenge that the animal shelters are facing today. This will also give some hope to the poor homeless, abandoned animals as they deserve better than what they are receiving today.

2. AVA policies to protect the puppies who are helplessly mishandled by the unethical pet commercial entities

OK, not all pet shops or farms are unethical. But that does not mean there is none in this “dark” industry as they disregard the welfare of the baby animals. We do not expect any pet commercial entities to run like an animal welfare association. But at minimum they should and must be pet lovers. A pet lover would not have done what some of us had encountered ourselves, which I had recently blogged in a true revelation of a pet warehouse and the feedbacks I had gathered from the like-minded pet lovers.

The authority could do more to keep such irresponsible entities in check. Do not believe on what some of the companies would say in their “PR-tically” right statements, as some of them are just wolf wearing the skin of a sheep. They might project themselves to be animal lovers, but in reality they are just taking the poor animals as a mere commodity.

We need AVA help to weed out such socially irresponsible dog breeders/sellers, so we do not have a situation of animal ill treatment.  We would also be able to minimize the number of stray dogs. Many of these dogs were abandoned partly due to these scrupulous commercial entities. They will hard-sell their “commodities” to potential pet owners who are not ready yet for pets.The end result? Abandoned animals.

3. Educate potential pet owners about the responsibility of being one

The saying goes, it takes two hands to clap, and the stray situation is no different. If all potential pet owners were to do their homework, on what their duties are in owning a pet, then we would know the pet will be in the goods hand of a responsible owner. The unfortunate truth is a lot of potential pet owners do not. They would therefore be easily swayed by the sweet-talk of the sales people, and the cute-innocent look of the puppies. By the time they bring their “toy” back home, they will realize that the life of a pet owner is not as easy as one have made it out to be. Issues of strays and/or mistreatment by pet owners are brewed as a result.

4. Execute, and execute wisely and properly.

With all the policies in place, it’ll be useless if they are not governed or executed well. A case in point is a recent incident involving a restaurant suspected of selling dog meat. The officers made a first trip to the restaurant for preliminary check, and then subsequently made a second trip to the restaurant again to obtain meat samples. Perhaps they were just following the protocols, but for heaven sake, exercise some common sense because what they had done was just plain meaningless. The restaurant could have gotten sufficient lead time to cover up their bad deeds, if they were indeed guilty. Do more mystery or surprise audit check on these commercial entities where there’s suspect of cruelty treatment of animals, I am sure one will see a different story, and one that matches the reality.

And it is not just with the authorities that should get their acts together, the society needs to play its part as well. As pet owners, we need to do what is necessary to keep our pets clean and happy, but not forgetting to stay in harmony with our fellow neighbors and friends who may not necessary a pet lover. For non pet lovers, let’s exercise some graciousness, for I am sure there are other things you like to do which others may not. But more importantly, if we all exercise our capability as human being in doing what we can to protect the innocent animals, we would not have seen the proliferation of the “pet warehouse” in the recent years.

So let’s take the first step. Let’s give our feedback to MND 🙂

 

Assembly 101 on Android Dalvik Code

Recently, I have been meddling with Android theme resources to modify the theme for my Android-based Galaxy Tab. It was yet another great learning process,  which involves manipulating the graphic resources, replacing the de-compiled XMLs that control the layouts and styling of the interface, etc. Just as I thought I had enough of them, I fumbled on a theming problem which seemed so impossible to fix. I pinpointed the offending code, created the right “answer” to the problem,  but it just didn’t work!

Almost giving up, I decided to trace the source code of the module. It turns out that the code explicitly sets the color of the text (the theming “bug”), and thus all the layout and style modification attempts would not have any effect at all.

   if (entry.label != null) {
            holder.appName.setText(entry.label);
            holder.appName.setTextColor(getResources().getColorStateList(
            entry.info.enabled ? android.R.color.primary_text_dark : android.R.color.secondary_text_dark));
   }

Instead of going back to source codes for changes, I contemplated reverse-engineering. Thankfully with the help of smali, an assembler/disassembler tool for Android apk,  I could correct the problem on the executable directly. Addictive Tips  gave a good overview of an Android application in ODEX and DEODEX format,

WHAT IS AN ODEX FILE?

In Android file system, applications come in packages with the extension .apk. These application packages, or APKs contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.

THEN COMES DEODEX

Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled intoclasses.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.

In summary, Deodexed ROMs (or APKs) have all their application packages put back together in one place, allowing for easy modification such as theming. Since no pieces of code are coming from any external location, custom ROMs or APKs are always deodexed to ensure integrity.

So before I could attempt the “hack”, the application must be DEODEX’ed, so that we have the complete executable for disassembly. The executable in Android system is in .dex format, or Dalvik Executable, and is stored as classes.dex within the Android Package (.apk) along with other application resources (graphic resources, layout binaries, etc). I extracted out the classes.dex, and do a disassembly.

java -jar baksmali.jar -o out  classes.dex

This will disassemble the executable classes.dex into assembly codes in the folder named out. This step can be skipped if you have previously used APK Tool to decompile Android package to access to the XML codes. The latter however would not assemble the assembly codes when you compile using the tool, so the subsequent steps would still be required if you have made changes to the assembly code.

In my case, the offending code is ManageApplications$ApplicationsAdapter, and the section of the code matches the

    invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getColorStateList(I)Landroid/content/res/ColorStateList;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setTextColor(Landroid/content/res/ColorStateList;)V

I simply commented off the third line in the above section of the code, which effectively eliminates the set color instruction. I proceeded to re-assemble the codes,

 java -jar smali.jar -o  classes.dex  out

The output of the assembler is a modified classes.dex, which I then re-package it to the original APK (Settings.apk).