Saturday, September 22, 2018

香港爬山径

这是一个与香港朋友一起走的路径。由金钟地铁到黄竹坑地铁路过香港仔上水塘。首先去香港公园。公园里见到第一·朵花是大花蘆莉。


这杜鹃叶山茶也蛮漂亮。


下一段去的文具博物馆。可惜太早了,门还没开。再来的是细叶粉扑花。



接下来去霍士杰温室。有分干燥和湿热类。第一朵花是矮种猫尾巴 【铁苋菜属】。


接下来是丝带。


红皱椒草是我没见过的。



蝎尾空气凤梨也是第一次看到。


水晶连看来看去都不像水晶。


十二之卷是好奇怪的名称。


沙鱼掌就没什么特别。


镰叶天冬像杂草如果没名牌根本不会注意。


珍珠草就很漂亮。


第一次看到漆亮胡椒树。


火轮凤梨不可以吃的。


榄仁的果实是有翅膀的。可惜聚集不对。朦了。


接下来去尤德观鸟园。第一个上镜的是绿皇鸠。


斑皇鸠也来抢镜头。


長冠八哥不怕人。我走的很近都不飞走。


鳳頭鳩夫妇在休息。


橙斑鹎的学名找了很久。聚集不是很好。


中国雉鸡夫妇也出来走动却不要合照。大男人主义。



打扰了绿翅金鸠吃早餐。


黑顶吸蜜鹦鹉也在吃早餐。



神秘的方尾卷尾也亮相了。


黄脸树八哥是第一次看到。


鳳頭鳩来一个全身照。


新加波也有画眉不过·从没拍过。


接下来就爬楼梯了。在宝云道看到这构树。




旖斑蝶很普通但是唯一的昆虫照。他也不慌不忙的等我拍。


在宝云道健身径看到降真香树。



附近还有百合科麦冬。



这豆科是假地豆。



这紅樓花出现在湾仔自然径。


这司徒拔道的树的名称不详。应该是玉兰树的一种。



想不到还看到野猪在渔光道的车站篱笆后面。我站的非常近。


接下来就没再拍照片了。穿过香港仔海旁道缘海边走。再沿鴨脷洲橋道下的

水渠走到黄竹坑地铁。好玩的坐地铁到海怡半岛·站才打道回酒店。

此程爬了64层楼高。步行8公里。接下来还陪家人购物。一天爬了82层楼高。累死了。

路径图在https://www.endomondo.com/users/247642/workouts/1193802525

相片集有蒙古和维多利亚花园的照片就不列出了。

Saturday, September 15, 2018

Raspberry Pi for Visual Impaired

Had a chat with a visual Impaired person during a flight. We talk about enterprises mass producing thus lowering the cost of products for VI (visual Impaired). I had mentioned that the pricing will probably be lower if the product is usable to both general public and VI than just for VI alone.

On passing, I mention that Raspberry PI is a compact and cheap computer with many sensors available and there is a screen reader that allow VI to be able to use it.

Can Raspberry PI be used by VI? The answer is positive. There are already VI using Raspberry PI with Raspbian and Orca. The latter is a screen reader. Unlike Apple, Raspbian (the most popular Linux distro) does not require application to comply to AT-SPI specification. Orca only works with apps that implements the specification. Just a few apps like Firefox, Mozilla, OpenOffice (those apps that probably most ordinary users will use) is able to work with Orca. Some programming tools like eclipse and Java can work with Orca too.

What apps ordinary VI will use? They most probably use browser to access Internet. It is a good source for learning.

They will probably also use LibreOffice Writer to do text proccessing. Some may use Calc to do spreadsheets. Experts may even use Base for database.

Email is quite common communication feature. Thunderbird, a Mozilla produce can be used as mail client. Major mail client can be web based.

With just the above few apps, it will cover most user's daily usage. More sophiscated users will probably use hand phones or laptop PC to suit their needs.

I propose to use Raspberry PI due to cost considerations. It costs about $50 to get a basic board. Just provide a few accessories like casing, power supply, and keyboard, you will get a complete system. With organisations providing free WiFi access, it will allow many who cannot afford to access this technology and be able to tap the vast range of data to upgrade themselves.

If you think that it is all that Raspberry PI can do, you should see what others use it to provide facilities for VI.

Raspberry PI have facility to plug in a large range of sensors and actuators. For example, user can use the camera module to take a picture of a book and use a OCR app to convert it to text thus allow user to read books.

Another use is to use the $3 Raspberry PI Zero, plug in a Bluetooth LE dongle and install a GitHub app to simulate an iBeacon. It is much cheaper than a hardware iBeacon. This simulated iBeacon can be used to make an indoor navigation system for VI.

Using a ultrasonic range sensor module, Raspberry PI can be turned into a navigation system by measuring the distance from an object.

The infrared transciever module can also be used to detect large objects for navigation use.

What about using the camera module to do object recognition? Branko Blagojevic had an offline object detection and tracking app on Raspberry PI using Yolo algorithm.

Raspberry PI is small but it is still a full Linux OS. It's processing power may be lower, but many things can be done with it.

AI is the trend. Raspberry can install Google TensorFlow to do deep learning. Microsoft is also providing AI for Raspberry PI.

With AI, robotics is next natural thing to do.

Are those technologies just empty talk? They are actually information taken from individual blogs and sites. Those people already done it.

To be neautral, the following are some issues that forms a hindrance to VI.

Raspberry PI does not come preinstalled with an OS. VI will not be able to install the OS without assistance.

Configuring the system to enable Orca is also not easy without voice.

Blind associations or companies may have to provide the device with OS and screen reader preinstalled.

There is a group that tried to assist VI in the use of Raspberry PI. The web address is https://www.raspberryvi.org. Download is disabled since 2016.

In conclusion, Raspberry PI can and be used by VI for various accessibility functionalities to improve the lives of VI.

The link to Raspberry PI is https://www.raspberrypi.org.


Wednesday, September 12, 2018

Indoor Navigation System

While in the World Blind Union regional accembly Mongolia, a delegate from Malaysia shared on the use of beacons for navigation during a small talk.

In 2015 October, I attended 中国第十一届信息无障碍论坛. There was a talk about Guangzhou public bus using BLE beacon technology to help user identify the bus.

This BLE beacon technology is quite new. Apple introduced iBeacon in 2013. One of the use is for Indoor Navigation. It's distinguished feature is it's ability to measure the precise distance between the beacon and it's receiver, notably user's iPhone.

What are the pros and cons of using it as an indoor Navigation system?

PROS

1. The system was specifically designed for this purpose.

2. It does not require complex system to set up although it does require a database system to provide a navigation map.

3. Scalability is flexible.

4. It can tell precisely the distance and the approximate direction by moving the reader around.

5. Both iPhone and Android are now capable of accessing BLE beacons.

CONS

1. The beacon is an active device that requires power supply in the form of battery or wired power line. Constant maintenance is required if battery is used.

2. Each device have a specific ID. In times of breakdown, maintenance will have a hard time detecting it unless the specific location is reported.

3. Cost is a great concern. In a typical building, a complete navigation system will require high numbers of beacons.

4. Proximity of beacon. The beacons cannot be placed too closely together. At any time only one can be accessed as it only tells the distance not direction. This could be overcomed by multiple scanning but it will slow down the speed of reading.

5. Implementation is also an issue. Unless the public is willing to invest in the beacon infrastructure, it will be limited. It will not be cost effective to provide for a small groups of clients. Small Enterprise will find it more costly to implement by themselves.

6. Unless hand phones can be cheap enough, user may not even have access to the technology.

Other devices like wifi/bluetooth hotspot or active RFID requires special reader devices that may have to integrate with hand phones. Proximity measurement virtually does not exist. Recently, I device a method of using RFID for navigation. If RFID is laid along a path with a known distance gap, A reader can read at least 2 or 3. While on the move, the reader can read more RFID and can tell which one is no longer in the list. By comparing with the last read RFID, You can actually tell which direction the reader is moving. This is provided a map of all the RFID are done. It like picking up sweets on the floor that is laid in a trail. This method does not require active RFID thus it is much cheaper to deploy and maintain.

Ultra sound emitters that sends out coded data requires higher power and may disturb guide dogs. I am not sure hand phones can receive ultra sound. Also in noisy environment. It will be difficult to implement.

Coded UV light communication will be directional but cannot determine proximity unless programmers can write codes to measure it. It also requires special hardware.

A new development is to use Augmented Reality. Apple have ARkit and Google have ARcore Unfortunately Google terminated the Tango project and replaced it with ARcore which does not do well detecting proximity unless OEM uses two camera technology and Google ARcore adds the "Measure" technology to make use of it. Other uses of this technology like heptic feedback is used to let VH "touch" objects but that is not the topic of discussion.

One of the main requirement of navigation is routing. It allows users to get to their destination from specific location. Routing requires waypoints. Thus it is important to get location info from waypoints. Besides beacons, there is actually a lack of such hardware. AR series uses camera to read the surrounding. If a known start point is determined, it does not require many waypoints. Unfortunately the technology is still new and lacks critical modules to determine precise proximity as currently it lack depth of field resolution capability.

Unless manufacturers and enterprises are willing to develope hardware that could determine direction and proximity and integrate with hand phone, it is still a long way for VH to fully navigate by themselves without assistance.

AR series technology is promising as it does not require hardware beacon devices to provide waypoints. If both Apple and Google are willing to use two camera devices to develop depth of field measurement, it will be good news to VH society. It is still feasible as we don't require precise measurement of objects. VH just need to use their cane to do more close proximity of distance.

One hardware I would like to introduce is the Raspberry PI computer. It is quite small (cigarette box size without battery and keyboard) with a complete Linux OS but it packs a punch. It has big range of sensors that can be used. Raspberry Pi Zero is a US$5 device that have USB Port. Just plug in a BLE USB dongle to provide bluetooth capability. All that is required is to make it a transmitter with unique ID. GitHub already have a Python script to simulate iBeacon funtionality. The standard Raspberry pi can be used as a navigation device. It costs just US$35. It does not have facility to compute proximity as provided by Apple or Google yet. The Zero series can be used with iPhone or Android already.





Wednesday, August 29, 2018

Active Mobility Advisory Panel Recommendation

AMA recommended to reduce cycling speed on footpaths to 10 KPH and mandatory helmet on roads. It provoked quite a stir in the cycling community even resulted in the resignation of a member of the panel.

The reduction from 15 KPH to 10 KPH is probably in view of the increase of accidents between PMDs and pedestrians. It is quite difficult to judge whether it is appropriate as 10 KPH is considered very slow to cyclists. However, if it endangers pedestrians even on 15 KPH, it is for the good of pedestrians.

Dutch cycling rule prohibits cycling on footpaths and walkways. They have the most cyclist population. Their consideration is appropriate to protect pedestrians. However, they have extensive dedicated cycling paths which we are trying to achieve. In view of this, cycling on footpaths and walkways is an alternative but if it cause more injuries to pedestrians, the compromise should be to reduce speed.

I used to commute around and often encounters a lot of pedestrians on footpaths. It is almost impossible to cycle greater than 10 KPH. At times, I have to just patiently follow elderly folks at their speed. I don't advocate using bells to get people to give way. They have the same right to use the path. Moreover, pedestrians do not have "keep left" rule. They can any how walk on the footpath. Often two or more people will give way to both sides and I have to slowly inch forward between them so as not to accidentally make contact.

Obviously, if the footpath is empty then the law should close one eye and allow faster speeds. It should be a responsible cycling style rather than a regulated cycling style.

On mandatory cycling helmets on road. It is a very controversial issue. On the one end it is to provide some form of protection. On the other, it is not convenient for many users. For myself, I always wear helmets regardless. No big fuss about it.

For the Dutch, they have extensive cycling path. Cyclists are mostly shielded from other vehicles. In Singapore, we are just plainly underdogs on roads. Cycling helmet does not prevent accident. It is just trying to reduce injuries for minor accidents. I fell a number of times. If not for the helmet, I probably have a number of head injuries. I don't fully agree with mandatory helmet rule but I do highly recommends wearing one.






Does it make sense for Google to launch Dragonfly

Google withdrew from China in 2010 due to China's insistence on censorship. Recently Google intend to launch Dragonfly in China. Dragonfly is a version of Google that complies to China's censorship. A big backlash has been forming since The Intercept first reported it.

Lets just forget about the opposition to Dragonfly and look at why Google wanted to do it.

Firstly, Google will loose money on such a huge market. China has a population of 1.4 billion according to 2010 census, the largest in the world. 12.44% of the world population speaks Chinese according to Wikipedia. It is the largest spoken language. How could Google ignore such a big market by not being in China?

Secondly, search engines in China is building up rapidly. Baidu (百度), Sogou (搜狗), Easou (宜搜) all are competing for the same turf. They are available internationally. This means that they are eating into the pie while Google sits tight.

Thirdly, Google is a commercial company. It does not make sense to fight against China. It can't afford to. All it wanted is to make money. Yes, its logo is "Do no Evil". But by doing it, it hampers the finance.

Fourthly, Microsoft forms a partnership with Baidu to provide English language search result. Although at times it is also blocked but at least it is in it. Not all of Yahoo sites are being blocked in China blacklist. It is a threat to Google.

Fifthly, China simply wants to censor sensitive news. There are huge search topics that are still allowed. It is a great loss for such a limited topic.

Lastly, it is not just Google search engine. A number of Google products are blacklisted too due to their search capability.

I am not pro Chinese censorship. The above is just a neutral analysis of why Google wants back in China.



Sunday, August 12, 2018

SQLITE query hourly data over a date range

There was a request to get monthly summary data in a half hourly period. This is to allow user to view the month's data by the half hour range. For example, user need to know what is the volume of customer coming in at which period so that they could prepare to have enough staff to cater to the inflow.

The following is assuming the date is stored as UnixTimeStamp.

The first task is to get the half hour period using strftime.

strftime('%H',DateCreated,'unixepoch','localtime') as Hour, case when cast(strftime('%M',DateCreated,'unixepoch','localtime') as integer) <30 as="" else="" end="" minute="" p="" then="">
Don't forget to get the count

,count(Customer) as Count

Of course you must define the table

from Customer

Next thing to set is the date range as month.

where strftime('%Y-%m-%d',DateCreated,'unixepoch') between '2018-08-01' and '2018-09-01'

We also want to limit the time to 10am-10pm

and strftime('%H:%M:%s',DateCreated,'unixepoch','localtime') between '10:00:00' and '23:00:00'

Finally group by the hour and minute

group by Hour, Minute

The result is you get 3 columns Hour, Minute, Count like

10 00 5
10 30 1
11 00 95
,..

Obviously, at a certain time, there will be no data thus the specific time period will be missing. A good way is to create an associative array with all the time defined and the value of Count set as 0. Use Hour, Minute as the key like '1000'. Update the count using the keys from the result. In this way a complete list of the period will be available.








Thursday, August 02, 2018

HTML Table Scrollable Tbody

HTML tables can display rows and columns of data in a nicely excel like layout. With CSS, you can make beautiful tables. With huge rows of data, the header tends to be scrolled out of the screen making it difficult to know what the column represents.

Using CSS, you can actually fix the header and able to scroll the data. The trick is to use THEAD and TBODY with CSS.

For THEAD and TBODB, you need to use Display: Block. For TBODY only you need to use overflow-y: auto so that it could scroll up and down.

The problem with this arrangement is that the column width is uncontrollable especially when a column data is all empty. THEAD columns cannot sync with TBODY. Its really painful to have it working yet not able to align the column widths. I wonder why it is still not fixed.

One way to align the tables is to use Javascript. However, if user set to not allow JavaScript then the display is messed up. Therefore, a CSS way is more proper. The catch is to use fixed width columns. Many designer frown on such idea. There is no choice if you want to scroll.

However, Width:50px, for example, does not work well, the width still self adjusts according to the text length especially when the table size is limited. Putting too big a width also make the table look ugly. I used the following to at least make the width more consistent. It is not a cure but at least it looks more presentable.

The HTML/CSS used is as follows :-

  1. Assign the table with a class name.
  2. Set the table width to 100%, Table_Layout: fixed
  3. use table.classname thead to define display:block
  4. use table.classname tbody to define display:block and overflow-y:auto
  5. use table.classname th:nth-child(x), table.classname td:nth-child(x) to define the min-width and other styles.
Item 5 above actually forces both header and body column as defined by x to the same size. Assign a minimum size (min-width) to the column so that it will accommodate the longest single word text in the column (text with spaces will wrap by default). It will take a while to adjust it but at least the columns will align if the tbody cells are empty. Each column must have a corresponding width setting.

Until such a time when W3C solved the scrollable table issue, this is probably the make-do way. Others might have a better solution but this one is an accumulation of various designer's idea.