2013/02/27

[工作點滴] Liberated networking technology

Our company update the home page to a brand new picture. There is a name 'Liberated' to describe the new networking technology we implemented. 
According to the dictionary, I'm most likely the description "free from traditional social restraints" because we are trying to make the fundamental change in different area that we enter. It's an interesting journey to me.
Although it's not 100% correct, I still want to record what I saw here. I plot the company's product map simply by personal thinking as follow from the webpage. 
It looks quite simple and most of the items are not new concept here. If we can do well in every point that describe here, we have big chance to success. So we have to be more hard working to liberated them all.

2013/02/25

[工作點滴] RabbitMQ - amqp protocol note

After the RabbitMQ server and client are setup, I start to learn more about the RabbitMQ system. The core of RabbitMQ is based AMQP protocol. There are lots of information we can get on wiki.
The AMQP is basically start from bank industry and that's why some related terminology like broker are used in AMQP specification. Here is model of the AMQP.
If we want to make the application to be two way communication, we have to make the application with publisher and consumer characteristics.
There are definitions in the specifications and we can check directly on it. 
Here is the packet sequence diagram that collect by the Wireshark.

The application plays two roles of clients in different thread.
We can define the private header and body in the content body for personal functions.
There is an important terminology name Routing Key. It's like the 'To:', 'cc:' and 'bcc:' in email. We have to synchronize the routing key name to let the message can send to the device we want. The definition in specification:
The first step of the application is basically done. Later we will implement more functions that we want on it.

[科技新知] Panasonic's 3D CMOS image sensor

3D image/video is blooming in recent years because of the entertainment industry like movie and game. There are also lot kinds of device appear like 3D camera, 3D TV...etc. The player play the 3D image in early stage is by put two camera into one and post processing the two photos into one.
Gopro has the similar structure of their hero camera and we have to buy two camera with some accessories to make this.
There are devices has already embedded two lens and sensors for having 3D functions like Sony camcorder.
I saw a news on Tech-on today that Panasonic developed a 2.1-Mpixel CMOS image sensor for camera systems capable of taking 3D movie with a single lens and announced it at ISSCC 2013. See following links.
For taking 3D video, it is necessary to separate light into light entering the left eye and light entering the right eye and to make sure that the two types of lights come to different pixels of the CMOS sensor. To realize this, Panasonic employed a structure that combines a lenticular lens and mirror elements (digital micro lenses: DMLs) made by forming patterns whose size is smaller than light wavelength with a lithography technology.
The lights separated by the lenticular lens are collected with the DMLs to increase their intensities. Then, they enter the pixels of the CMOS sensor. With this structure, the light entering the left eye and the light entering the right eye do not interfere with each other much. Therefore, the intensities of the lights become high enough. The received signals obtained in this way are processed via line memory to create 3D video.
Currently, Panasonic is planning to apply the CMOS sensor to industrial and mobile devices, expecting that products equipped with the sensor will debut in 2014.
This may realize the 3D camera system with lower cost because we just need one lens but there are still some information need to be check further. Like the sensitivity, resolution, optical format that lens need, back-end processor and the price of this sensor. I'm very excite for this sensor because it cam simplified the design of the 3D device system. We also can extend the advantages of the 3D system to some applications especially for image system.

[雜七雜八] Peking University Tickets King - 裴濟洋

There is a message post on Facebook by my former boss that talk about a guy in China who help people to order the ticket before important holidays. He is a Peking University student whose name is Ji-Yang Pei(裴濟洋), 23 years old. There is a report from China's TV station and the link is as following.
In China, people who left home for working would go home every Chinese Lunar New Year. It is the biggest human migration period in the world and it's quite hard to get a ticket to go home. Pei provide more opportunity for those people to get a ticket especially the underprivileged ones in past three years. Later, he did not just provide the fish but also teach us how to fish. Pei post a thousand words of article on the internet to let us know how to do it. Because of this, he become a famous person, lots of people call him the Ticket King of Peking University.
Why does Pei can do this? He said he has the train network and timetable is his head. Besides, we have to notice the dynamic message and have mentally prepared that it is a difficulty task to go home. We can not just cut diamond by diamond because the direct route for home is also the most popular one. The target is there, we can use our brain on the route to reach it. The thinking also can be the philosophy on business. When we encounter troubles on one way, we could have different way to reach the target.
This event make my thinking of the situation in Taiwan. We also encounter the same situation but we do not have that strong feeling before because there is only one train route there and another choice is bus. Besides, the distance from the most northern to southern is 400~500 kilometers and we always have direct thinking in our life. Is that why we become a person as stubborn as a mule? Just kidding.
I quite admire this young man because he observe the the society and help people with his ability. Even though he is a Peiking University student, he never think himself above business. Let's learn from him and have a hand clap to him.

2013/02/23

[產業觀察] India electronic policy

I saw a news recently that talk about the national policy on electronics 2012 of India. Kapil Sibal, the Minister for Communications and Information Technology says the government approve the policy and plan to invest 100 billion for electronics industry fostering before 2020. It's natural trend for India to extend from their famous software industrial to hardware.
Kapil visit Japan's recently and says it's very important to have strategy cooperation with Japan electronics company. The most important one is to build first semiconductor factory. The plan will kick-off before October 2013 and start to production around 2015~2016. Then based on the plenty of software engineer, Japan company can have much progress in India on embedded system.
According the news, I think India have the right strategy to do this. Japan's electronics industry gradually lose their competitive since years ago because their thinking do not keep up with the trend. India have a lots of advantages to help Japan's company reverse this situation including the software industry, low cost man power, big market...etc. Besides the economic view point, the political strategy in Asia, it is inevitable for Japan to keep more relations with China's neighbor union.
Let's keep observing how the things going.

2013/02/22

[科技新知] Google Glass launch

After I wrote the Vuzix Smart glasses for just hours, Google launched their glass and built a new web site for this product. Maybe google do not want to be left behind when Vuzix award from CES.
http://www.google.com/glass/start/
The page is simple and clear. We could see a video in the link to sense how it feels. All the functions that describe in what it does are totally from audio, video and gesture recognition. We can take the photo, record the video, translation, search the information, navigation...etc in real-time.
All of the recognition technology have to link with the requirements of people and that's why google raise a competition for people to write down "what would you do if you had Glass". Once the idea is adopted, we could become the Glass Explorer and buy Glass with USD $1500.
However, this activity is for 18+ years old and live in the US. Anyway, I could not wait to see what's happen next.

2013/02/21

[休閒運動] The trade of Houston Rockets

I like to play basketball since I was a high school student and I still play around one to twice a week now. Although I love this sport, I do not have too much passion to see the games like NBA after MJ retired. In past year, I started to pay attention on it. One reason is Jeremy Lin and the other is the CEO of my company bought Memphis Grizzlies last year. I start to realize this is not just only a game but also contain a lot of things in it.
There are two trades that I noticed in recently. One is no doubt Grizzlies because it's much more related to  my life. But I'm more interesting on Houston Rocket's trade. There is an article that wrote by blog in Taiwan and I learn a lot from this article.
This guy 'isay' observe the unusual dispatch of the McHale before the all star game. He analysis the position, salary...etc of all players and provide a list of 5 players on 2/17. The news disclosed early today, 4 players in the list are traded. I'm amazing that he have the high accurate prediction. Maybe this author have the business sense too. After this, I may have a different view to see the sports not only NBA but also MLB...etc.

2013/02/20

[科技新知] Vuzix Smart Glasses M100

I saw a news that about the Vuzix Smart Glasses M100 and it get a recipient of the CES (Consumer Electronics Show) Innovations 2013 Design and Engineering Award BEST OF INNOVATIONS, and selected as Best Technology in the Wireless Handset Accessory category. More information in following link.
http://www.vuzix.com/consumer/products_browse.html#video-eyewear

It's an interesting device but there are still challenges behind. Since Google launch their project glass, Vuzix is the 2nd company to make the similar product. So M100 get a lot of discussion even google guys go their booth to have it a look. According to the hardware specification from Vuzix web sites. It's totally an android based smart phone and the difference is the glasses appearance only. It's not special by just hardware specification only.




I think the story of this product is based on the intelligence functions like the video recognition, gesture recognition, voice recognition...etc. When these functions are introduced, this device become very interesting.
Vuzix also provide the SDK for developers and it may follow the smart phone pace to have variety of apps on the market.
So, let's look forward to it.

2013/02/18

[工作點滴] AirVision 2.0 preview on Win7

Before the Chinese Lunar New Year, I got the latest alpha version of the AirVision2. It does not only  inherit the pros from previous version but more quick and stable also. I just have some preview here about the installation and main pages showing.
After double clicking the windows installer, following the step of installation. When executing the airVision2, there is a windows security information pop up, please make sure the firewall does not block your application.

The airVision shows at the right bottom. Click the Launch a Browser to start a webpage for further.

First, we have to enter the name of the host PC name, language and position we are.

Second step, to create an account to accessing the airVision.

Third step, to add controller. If no, just go Next.

Finally, finish the first time configuration.

Login.

Clicking the unmanaged part of cameras and a list of unmanaged cameras show up.

Entering the information of the camera and clicking the Manage to make the connection.

Open the Map page.

Drag and drop the camera we want to the Map.

Same as the previous version, when detect motion, the color is change.

Add all the cameras on the Map we have.

We can see all the devices information in Devices page.

We can get the related statistics information in the Statistics page.

We can handle the recording in the Recordings page.

Analytics function as well.

The toggle bar at the bottom has lots of system information.

After quick playing, it's really over my expectation. Hope it can be launched soon.
There is a video demo on youtube for previous version. Maybe we can do comparisons in near future.



2013/02/17

[工作點滴] Miracast in surveillance system

Weeks ago, the supplier demo the Miracast function to us and my colleague told me maybe we can think if there are applications for surveillance system. At first I saw nothing special for surveillance application but I may find there is now.
Here is a capture picture from the whitepaper of WiFi alliance.
Basically, Miracast is a protocol and this means Miracast can be over any kind of infrastructure. However, Miracast connections are expected to be predominantly established between Wi-Fi devices connected with each other directly, without an AP acting as an intermediary. According to the topology, what we can see is a source to a sink and it is a peer-to-peer connection.
Go back to the topic we want to talk for surveillance. I plot a picture as follow, and this is just like a traditional surveillance system with cameras, recorder and monitor.
Now the connection part become the Miracast wifi direct to the adapter like NVR and play the video through HDMI to monitor finally. In future, the smart TV integrate the adapter and monitor part and link to cloud service as the picture.
If our target system is small with 4~8ch or under, this structure is quite simple and real for home, small store...etc. It's interesting and I'm looking forward to see it happen in near future.



2013/02/16

[工作點滴] pure public or hybrid cloud for surveillance system?

The pure public cloud is no doubt that we build the web services on public and the hybrid combine the private part. According to the information on wiki, the public cloud aka external cloud is related to the service is provided by third party. There is a picture on wiki can describe exactly what we talk about.
Basically, there are four deployment models on wiki. The private cloud can't satisfy the requirements of the surveillance system. We do not talk about the community cloud also because it's not real on surveillance system.
There is a famous network camera company named Dropcam that deployment as pure public cloud system. When we install the the devices, we have to create an account and register them. As I know, Dropcam use the Amazon Web Service as the infrastructure. I just plot some simple block diagrams to describe it.
The way of Dropcam is the left bottom and all services are provided by Dropcam that host on AWS. The role of Dropcam become not only the device maker anymore but also service provider. The total system is the most easiest and simplest by this way.
The other three block diagrams are more and more complicated. Some surveillance company still want to expand their system base on the traditional type and the whole system may become the most complicated upper one. They will get into trouble soon.
There is still a question that not all people like to feed their private contents to service provider. That's why the original surveillance still there and get most market share but I think this situation will become different in recent years.
After studying, I'd like to shorten the deployment into two kinds. One is the Dropcam's way and the reason has already described above. Another one is because some weak points that the pure public can't overcome at this moment.
So which one is better, left or right? Let's wait and see what will happen next.


2013/02/09

[心情隨筆] Happy lunar new year

Today is the end of the Dragon year and we use to have a good supper on this day. It's brand new lunar year tomorrow and we call it Snake year. Sometimes, we'd call it Small Dragon year rather than Snake year because because Dragon is much more significant in traditional.
Hope my family and friends have a brand new good Small Dragon Year.

2013/02/08

[工作點滴] I2S bus channels setting in gstreamer alsasrc plugin

My colleague did some experiments on gstreamer alsasrc and osssrc plugins and he found that alsasrc consume lots of cpu resource(around 16% on the chip we use). He asked me why the test tool that provided from chip vendor is quite efficient(around 1~2%). It was a big gap to me and I started to find why is that.
After hours checking, I found that the plugin may cause a busy wait in a while loop when the parameters set to non-blocking mode. I do a simple code modification and execute again but the cpu rate just lower to 12%. I'm a little frustrated about it but still had some enhancement.
So I started to try different parameters combination because he told that he found three differences from alsasrc plugin and the test code.
1. The setting of alsasrc is non-block mode but the test code is set to block mode.
2. The channels setting of alsasrc is 1 but the test code is set to 2.
3. The buffer size is limit in test code but alsasrc do not have that limit.
For 1: I thought the non-block mode should be much more efficient but the busy wait should change.
For 2: This is really weird because when I set the channels to be 2 in alsasrc plugin, the cpu rate become quite low. So I start to wondering if this is the characteristics of the I2S bus. I googled on the internet but did not find any information to describe that we have to set the channels parameter to be 2 in alsasrc plugin of gstreamer when the audio data bus is I2S. So I'll confirm it later.
For 3: I think it's reasonable to limit the buffer size.

2013/02/07

[工作點滴] RabbitMQ setup and test


RabbitMQ setup and test

Server side:
My desktop PC is windows 7 and we download the rabbitmq server from http://www.rabbitmq.com/.
The installation guide is here http://www.rabbitmq.com/install-windows.html.
I use extra ethernet card and set the ip address to be 192.168.1.19 and make sure the firewall would not block the port 5672.

Client side: we put the send and listen on same device.
I use the package from https://github.com/alanxz/rabbitmq-c. We can follow the guide in the link to cross build and install on the embedded device we use.



[工作點滴] The realtime of transport stream on Miracast

When I google the internet with realtime and transport stream, I could not find the information I want. The word 'realtime' must construct on the relative thinking. For example, there is camera and screen and the camera's video can be showed on the screen with quite small latency. We assume the latency is under 150ms or 300ms whatever and we can call this is realtime or not when we can have comparisons.
The structure of the transport stream or what we call MPEG-TS is not that simple. What I say is compare with raw encoded media direct push to intermedia. Maybe the transport stream is design for broadcasting usage, so the media stream can be selected and video can be smooth played are much more important than realtime. Because people would not feel any latency happened when they just watch TV.
If we want to convert raw encoded media to transport stream. First, we have to packetize the raw encoded media to packetized elementary stream(PES). Second, we handle the PES by the muxing, splitting to small slice AV data...etc to program stream or what we call transport stream. Finally, we send the transport stream to internet or satellite for people to receive and watch it on display. These steps create lots of latency and make us feel it's not realtime enough.
Let's go back to the definition of the Miracast. It is to convert the raw encoded media stream to transport stream and then encapsulate the stream to RTP. Finally go through the wifi directly to display. I'm not sure how many latency will be created? Maybe someone can tell me.

2013/02/05

[工作點滴] Airplay, DLNA and Miracast

Today, there is a supplier come to our company to introduce their solution with DLNA and Miracast support. I survey the internet and found three kinds of protocols are discussed on the market. The DLNA has been talked for a long time and Apple is DLNA member originally. But Apple left DLNA and create the proprietary Airplay protocol. The Miracast is created by Wifi Alliance. It seems that Android alliance choose the Miracast to fight with Apple?

且讓我們繼續看下去...

[工作點滴] STL notes


國外工程師用boost c++ library來進行相關專案的開發, 進而看到一些相關的STL語法, 所以還是得抽空K一下相關資料, 至少要把code看懂.


The Standard Template Library (STL) is a C++ software library that influenced many parts of the C++ Standard Library. It provides four components called algorithms, containers, functional, and iterators.
The STL provides a ready-made set of common classes for C++, such as containers and associative arrays, that can be used with any built-in type and with any user-defined type that supports some elementary operations (such as copying and assignment). STL algorithms are independent of containers, which significantly reduces the complexity of the library.
The STL achieves its results through the use of templates. This approach provides compile-time polymorphism that is often more efficient than traditional run-time polymorphism. Modern C++ compilers are tuned to minimize any abstraction penalty arising from heavy use of the STL.
The STL was created as the first library of generic algorithms and data structures for C++, with four ideas in mind: generic programming, abstractness without loss of efficiency, the Von Neumann computation model, and value semantics.

Learning plot


2013/02/04

[工作點滴] msgpack-idl howto


msgpack-idl howto

Step1 get the msgpack-idl
$ git clone git://github.com/msgpack/msgpack-idl.git

Step2 install the ruby tool that required
$ sudo apt-get install ruby1.9.1

Step3 go to msgpack-idl folder.
$ sudo gem install msgpack-idl
$ sudo msgpack-idl --install java

Step4 create a sample file 'sample' with content as follow.
message Node {
  1: string address
  2: map<string,string> properties
  3: optional string? description
}
message StorageNode < Node {
  4: long capacity
  5: optional int weight = 1
}

Step 5 generate the java code by following command
$ msgpack-idl --example sample > sample.msgspec
$ msgpack-idl -g java sample.msgspec -o ./out/

More information, see following link:

But this seems support to generate Java only. Another idl implementation that written in Haskell is more active than the Ruby implementation.
It can generate c++ code. To study it later if we really need IDL for our ipc.

Link as follow:


[工作點滴] message pack rpc install on openwrt

Message pack with RPC extension required 3 packages.


  • msgpack
  • msgpack-rpc
  • mpio

The msgpack and mpio are required by msgpack-rpc. The following are openwrt makefiles that I use to build the packages.


msgpack library
include $(TOPDIR)/rules.mk

PKG_NAME:=msgpack
PKG_VERSION:=0.5.7
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://msgpack.org/releases/cpp/
PKG_MD5SUM:=705106a9378c792fe22d285dba5c142c
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/msgpack
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Message Pack library
  URL:=http://msgpack.org
endef

define Package/msgpack/description
  MessagePack is an efficient binary serialization format.
  It lets you exchange data among multiple languages like JSON but it's faster and smaller.
endef

define Build/Configure
     $(call Build/Configure/Default, )
endef

define Build/InstallDev
     $(INSTALL_DIR) $(1)/usr/include/
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/include/* \
          $(1)/usr/include/

     $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/lib/libmsgpack*.{la,so*} \
          $(1)/usr/lib/
endef

define Package/msgpack/install
     $(INSTALL_DIR) $(1)/usr/lib
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/lib/libmsgpack*.* \
          $(1)/usr/lib/
endef

$(eval $(call BuildPackage,msgpack))

mpio library
include $(TOPDIR)/rules.mk

PKG_NAME:=mpio
PKG_VERSION:=0.3.7
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=libtool
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/mpio
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Multipurpose parallel IO
  URL:=https://github.com/frsyuki/mpio
endef

define Package/mpio/description
  Multipurpose parallel I/O framework for C++ with fully multithreaded
  event loop implementation
endef

define Build/Prepare
     mkdir -p $(PKG_BUILD_DIR)
     $(CP) src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
     $(call Build/Configure/Default, )
endef

define Build/InstallDev
     $(INSTALL_DIR) $(1)/usr/include/
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/include/* \
          $(1)/usr/include/

     $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/lib/libmpio*.{la,so*} \
          $(1)/usr/lib/
endef

define Package/mpio/install
     $(INSTALL_DIR) $(1)/usr/lib
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/lib/libmpio*.* \
          $(1)/usr/lib/
endef

$(eval $(call BuildPackage,mpio))

msgpack-rpc library
include $(TOPDIR)/rules.mk

PKG_NAME:=msgpack-rpc
PKG_VERSION:=0.3.1
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://msgpack.org/releases/cpp/
PKG_MD5SUM:=e5e8f3631ac83d20cdf65fa0d7bfee21
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/msgpack-rpc
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Message Pack library
  URL:=http://msgpack.org
  DEPENDS:=+libmsgpack +libmpio
endef

define Package/msgpack-rpc/description
  MessagePack-RPC is an extension to support RPC through message pack.
endef

define Build/Configure
     $(call Build/Configure/Default, )
endef

define Build/InstallDev
     $(INSTALL_DIR) $(1)/usr/include/
     $(CP) \
          $(PKG_INSTALL_DIR)/usr/include/ \
          $(1)/usr/include/
endef

define Package/msgpack-rpc/install
     $(INSTALL_DIR) $(1)/usr/lib
endef

$(eval $(call BuildPackage,msgpack-rpc))

[工作點滴] Linux工具小記錄

打patch的command

diff -Naur [from-file] [to-file] > [YourFileName.patch]
-N  In  directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory.
-a  Treat  all  files as text and compare them line-by-line, even if they do not seem to be text.
-u  Use the unified output format.
-r  When comparing directories, recursively compare any subdirectories found.

SVN版本控制下要移除所有目錄底下.svn
$ rm -rf `find . -type d -name .svn`

GIT版本控制下要移除.git
只需要移除主目錄底下.git相關的info即可

NFS mount command

mount -t nfs -o nolock 10.0.0.3:/home/vm_share /mnt/shares