Posting From Win10 Bash

After more than one year no updating, here is my new posting from Win 10 Subsystem for Linux, instead of Ubuntu in VM.

I love this feature even though there are still some known and unknown bugs. For example, ‘mv dir_name1/ dir_name2’ will lead to bash hanging.

The initially installed bash do not have gcc/clang and Makefile, and very first time in my life I installed Makefile by myself, lol.

But I still like it!

2016/10/23 @Dublin, Ireland

Scala Learning Note 1: JVM, JDK, JRE

Scala is a very powerful and complex language base on JVM. In my previous post ‘Life As Developer’ I mentioned my plan of learning a functional programming language, so Scala is my decision.

Scala has been installed in Ubuntu in virtual machine, but the study progress is not that perfect. I met some environment setting issues about JDK and JRE (I have no experience about Java, JVM, Eclipse, JDK and JRE), so this post will record the basic concepts about Java environment.

The graph below shows the relation about the concepts:

Java Development Kit (JDK) is an implementation of either one of the Java SE, Java EE or Java ME platforms released by Oracle Corporation in the form of a binary product aimed at Java developers on Solaris, Linux, Mac OS X or Windows. [From Wiki]

Open Java Development Kit (OpenJDK) is a free and open source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. [From Wiki]

Java virtual machine (JVM) is an abstract computing machine. JVM has its complete virtual hardware structure like processor, stack, heap and register. JVM covers all the details about the OS to run one bytecode on different platforms.

Java Runtime Environment (JRE) released by Oracle is a software distribution containing a stand-alone Java VM (HotSpot), browser plugin, Java standard libraries and a configuration tool. It is the most common Java environment installed on Windows computers. It is freely available for download at the website java.com. [From Wiki]

HotSpot, released as the “Java HotSpot Performance Engine” is a Java virtual machine for desktops and servers, maintained and distributed by Oracle Corporation. It features techniques such as just-in-time compilation and adaptive optimization designed to improve performance. [From Wiki]

随想

前两天跟李博士去了一趟Sligo,往返的火车上探讨了不少问题,最近也思索了不少问题。此篇博客篇幅不够深入记叙,所以下一篇博客再详细记叙吧。

冰与火之歌和硅谷是我正在追的两个美剧,现在都出到了S2E08,一季10集的剧经过了前8集的铺垫,想必未来两集将要全程高能。冰与火之歌电视剧的剧情已经发展到了小说前面,Jon斩杀白鬼的镜头很带感,但是大量白鬼该如何斩杀很引人思索,融掉Jon的剑做成箭然后远程射杀骑马的白鬼(因为他们能把人变成白鬼)就有趣了。目前Arya不能死,她死了千面神这条线就断了;Jon不能死,他死了长城这条线就没的拍了;倒是Sansa死了的话北境这条线该怎么拍还怎么拍,按照这个尿性orz。硅谷中Jared跟Richard同房时说了好几句吓人的德语,后来Jared搬到隔壁家之后这条线索就这么暂时不提了,不过目测不会断掉,应该会在未来两集点燃。

战舰少女是个有不少缺点但是整体很不错的游戏。不得不说的是他们家的服务器性能太!差!了!动不动就连接超时!还好没有即时对战功能,如果即时对战的话估计要被喷出翔。这款游戏的目标是收集并养成少女画的二战期间各国知名战舰。最近因为苹果应用商店区域问题导致游戏不能升级,暂时不能玩,停玩之前收集到的知名战舰有日本的加贺号和德国的提尔皮茨号(Schlachtschiff Tirpitz)。

上周六下午雪国在星巴克看完了雪国,一百多页的故事却从春节看到现在,自己实在是太浮躁了。本来以为整本200+页的书都是雪国,看完雪国才发后面一百多页是一个叫《湖》的故事。高中时读了《伊豆的舞女》,《古都》,《千纸鹤》等川端康成的作品,读过雪国之后算是读完了他的诺贝尔获奖作品。豆瓣上有人比较不同译本的雪国,讨论哪个译本更加符合原文的语境和气氛,我只能做个看客羡慕他们可以读原版。爱尔兰的日语课程大多用英文授课,但是作为一个中国人,通过中文学习日文显然是更加高效的方式,通过英文学习难免效率低下,会浪费些时间。

最近身边几个朋友都办了10年美国签证,而且貌似查的并不严,于是我也收集一下材料办一个好了。如果总是查的不严的话说不定会给美国移民局带来新的麻烦,然后导致这一签证政策被取消,所以最好尽快办好。

2015 Summer, @Dublin

Life As Developer

After been transferred into the new development team for a while, this is time to summarize the progress.

First of all, it is quite happy to start coding in professional career. Senior developer is my career target in the coming 3-5 years.

Secondly, the currently using programming language ABAP is a very funny one, according to wiki ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor, German for “general report creation processor”) is a high-level programming language created by the German software company SAP. It is quite powerful for business processing and analysing. The internal table feature of ABAP is not only used for report generation, but also similar with STL in C++, which could inserting, appending, deleting, sorting, of structs or objects in one line. Not sure about the complexity of the operations now, but I will figure it out in the week.

Thirdly, let me write some personal meaningless feelings. I am not sure it is because of the heavy training in HPC TCD or correct guy at correct position, after all my performance is higher than the average level of the team. Because my team have to working together with another team in Germany, we have to be in the meeting room 9:00am everyday to suit the 10:00am of Germany for daily phone meeting. Working time is not flexible at all, the only unhappy point at this moment.

Lastly, I am considering to learning a functional programming language, have not made a decision among Haskell, Scala, Lisp and OCaml yet. Saw an idea from Zhihu that a good programmer should learn at least 3 languages, one OOP language, one FP language and one script language. I already did C++ for OOP and Python for script, now is the time to explore the world of FP. Another thing in mind is rewriting the GongZhu (could be found in my github) with some funny C++ features, for C++ practise.

PS. Got the upgrading notification of new version 15.4 after I turned on Ubuntu in vm, looking forward what is new here. LOL.

2015 Summer (but as cold as winter), @Dublin.

正轨

差不多1/3年没有更新博客了,过去的几个月里发生了不少事情。

2014年底去日本玩了两周,回爱尔兰之后搞了两个TPO,工作不太顺利,2月13号到2月28号在国内过春节,3月份回到爱尔兰之后第一周在LA back office当DEA(相当于在国内的睡觉时间工作),感受到了南美人的狂野和无序,之后就一直在backoffice处理incident,并且盯着欧元一路下跌到6.5+。

欧元下跌+研发职业道路的无望导致了想换个地方的冲动,跟舅舅沟通了一下,他的建议是回国发展。我觉得他的建议是难得且靠谱的,因为他在中国和美国的大型IT公司都工作过几年,并且是中国籍+美国绿卡,处于有有自主选择权的状态。如果一个人为了一个选择的达成做出了一些不可逆的牺牲,那么谈到这个选择是否是好的的时候,这个人就会非理性的认为这个选择是好的,因为如果这个选择是不好的,这个人心里会产生不适感。果然大多数人都还是披着理性的外衣给自己的感性找借口。那么我想回国这件事情,到底是感性还是理性呢?

经理找我提了一次新组的事情,沉寂了一段时间,4月15号终于收到邮件,要转到insurance组去了,因为终于走回到了开发人员的轨道上,所以比较开心。

日本:

日本还是很不错的,一共去了东京,京都,大阪三个地方,除了街上没有垃圾桶,别的方面作为游客都觉得挺好。因为去的时候接近元旦,所以京都的御苑,二条城,大阪的天守阁都关门歇业了,比较遗憾。

京都最开心的是去了本能寺,1582年6月21日明智光秀发动本能寺之变,剿杀织田信长于此。

回国:

回国之后睡眠一直不好,晚上一觉只能睡4个小时,睁着眼睛玩几个小时手机,再睡4个小时。见了一些好多年没见的亲友,表妹刚出生的女儿,赵JN刚出生的女儿,和赵YD卢DY二位。想想上次见赵貌似是2011年刚毕业的时候,上次见卢貌似是2012年还没去伊朗的时候。

跟张L,张Y,李YZ碰了个面,觉得人走上了不同的路之后就会进入截然不同的人生,他们三个还是大学生的样子。

王HL生活似乎很逍遥,从榆林沙漠转岗到了办公室里,并且买了房。

Backoffice:

在backoffice里的第一个月收获挺多,使用各种工具,接触各种蛋疼的客户,之后收获就没那么多了。在incident中跟各种印度客户战斗,其中在印度,美国和UK的都有。

Insurance:

经过了一点小周折,终于收到了Insurance组的开会的邮件。经理之前说了要测试,但是目前还没有,不知道是不是因为Uwe过来巡视,赶鸭子上架攒了个新组出来了。

新组经理让收到邮件的人多学习ABAP和保险,目前组经理却让我优先搞backoffice的工作,但是backoffice的lead肯定会说:你在backoffice就不要搞别的事情。我还没有面对过这样的困境,感到颇为困惑,不知道该不该明天开会的时候跟新组经理提一下。

GG回爱尔兰:

GG回爱尔兰参加毕业典礼,大家一起去海兰江和巴蜀,然后去酒吧喝一杯,再去他们家升级或者拱猪,像极了过去的日子。只是那时的我不快乐,现在依旧算不上快乐,或许我就是个不快乐的人吧。

毕业典礼那天我和DD作为guest去了一下,给她拍了不少照片,第二天去了高威一趟。高威天气太差城市又小,午饭后就觉得无事可做,只好找了家咖啡馆拱猪,后来赶着李老师同班火车回了都柏林。

Mindfulness:

4月16日上午参加了这么个活动,觉得跟禅定还是比较像的,鉴于最近晚上都睡得很晚,决定还是坚持练习禅定。

============================================================================

或许过几天会给这篇博文加几张图片吧,下一篇暂定写TCP/IP。

2015 Spring, @Dublin

How Google Translate Works

I had been thinking about how translation websites work for days and discussed with some friends. However when I searched about the result, I got a different answer.

The idea of Google:
The link below was uploaded to youtube by Google to explain the basic theory of Google Translate. When a sentence was given to the dialog, Google Translate even dont know the exactly meaning of the sentence but the translation result could be generated from statistical data (big data wow). The disadvantage of this algorithm is when a pair of nature languages have very rich translation texts to be analyzed, the machine translation result would be much more accurate than a pair with limited texts. Maybe for the pair without rich texts, my idea could be a solution.

http://www.google.ie/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCAQtwIwAA&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_GdSC1Z1Kzs&ei=DlGTVP3cJ6Ka7gajkYHgDg&usg=AFQjCNF7A9_TKG-dxl5FWjcnO4en6JGzZA&sig2=8cYLQD99GD9qbFQ5uK7OuA&bvm=bv.82001339,d.ZGU

My idea:
I had explored (not learning) some features of Sanskrit, which in my understanding is the official version of an ancient India language (Pali is the secular version which is spoken by Buddha and his fellows). Some features of Sanskrit are similar with Latin, like complex grammar, rigorous structure, Indo-European Family and used as kind of religion language today.

Sanskrit had been considered by some computer scientists to be used as ‘meta-language’ for machine translation because of its rigorous feature (even more rigorous than Latin). But this idea is not used by Google Translate today, the reason and current research is not what I want to search.

What I thought was: since programming language is more rigorous than nature languages, is it possible to construct a computer-middle-language system to express all possible nature expressions for machine translation? All nature sentences are translated into the constructed computer-middle-language and then translated again into a sentence of the target language. This is a very straightforward idea and the disadvantages are very obvious, the complexity parts like ambiguous meaning and polysemant would be difficult to be dealt by the computer-middle-language.

/ ================================================================================== /

After all, the 2 languages (English and Chinese) I can use are both used by more than billion people, this made my limitation because in both languages a particular meaning could be expressed in multi ways. Maybe a language of only millions of users is an other picture and probably I would never know that.

Next blog will talk about Database.

3Body

3Body is an independent program aims to simulate 3-body motion. This article will record the progress and fun points of the program.

The structure of the program is Python but the simulation part is written in C++ to speed up. As a python beginner, hope this program could be a good practice. Following blocks are useful links on different topics, which I am planning to improve my ability in.

/ ===================== Makefile Related Links ===================== /

/ ===================== Py<->C++ Related Links ===================== /

The default return variable from C function to python is int, if what we want to return is double or something else, where wont show any warning but the result should be wrong. To change this, we have to do something like:

xx.restype = ctypes.c_double // for return value..
xx.argtype = ctypes.c_int // for input argument..
xx.argtypes = ctypes.c_int, ctypes.c_double // for input arguments..

Another point is that the support of long double of Python is poor, I have not actually meet any problem about long double but note this here to keep this in mind.

/ ===================== const Related Links ===================== /

http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777416.html

/ ===================== C++ file Related Links ===================== /

/ ==================== hexo blog Related Links ===================== /

http://zipperary.com/2013/05/30/hexo-guide-4/

I am still learning how to use hexo lol.

2014 Winter, @Dublin

MPI and pthread Synchronization

This is my first blog with a pic lol~

The following picture displays how could we synchronize all threads in a multi-process-multi-thread program. The structure is not complex and had been tested.

This idea came to me when I was coding my master degree graduation project but was not used in my final version.

PS1, I just wrote a python script to backup all posts of this blog into github. The name of the repo is ‘Backup’, you can find it very easily. I am going to write about it later, maybe after some optimization on git part.

PS2, I am using Ubuntu 14.04.1 LTS and the GUI has some bug (input $ lsb_release -a). When I click the panel, sometimes the Unity just dies.

Some Idea

今天下午在游泳馆试着潜水。游泳馆不算大,6道x25米,每一道都有一半的深水区和一半的浅水区,人不多。

每次游到深水区一端时,都用脚蹬着水池壁冲出一段距离,同时头向下低,双腿翻动向前下方前进。最深到达过伸手可以拍到池底的地方,应该是水深1.5米处。问题是每次上浮的时候头都会有点疼,不知道是为什么。

晚上改自己的cv,在projects一栏写了5个项目,分别是:交通仿真,遗传算法,金融随机微分方程,短波通信仿真,三体问题。

============ 主要是想记录这么一个想法 ============

假设:从众/服从,与,独立/叛逆,是全人类人格深处的两面。

从众/服从表现在西方人的社会中:精神世界中上帝所施加的不容反抗,不容置疑的神权。

独立/叛逆表现在西方人的社会中:小团体的独立精神,造成了欧洲诸多小国。

从众/服从表现在中国人的社会中:集体主义精神比西方浓厚,有大一统精神。

独立/叛逆表现在中国人的社会中:陈胜喊出的‘王侯将相宁有种乎’,一个政权过于操蛋就干翻之。上帝是无论如何干不翻的,好在政权干得翻。

不知道跟上古时期的历史有没有关系,西方有诺亚方舟的传说,东方有大禹治水的传说。诺亚方舟的故事中人类面对滔天的洪水主要是听天由命,而东方人则选择自己治水并且成功了。

==================================================

最后,今天做了胜寒俱乐部(汉语圈高智商俱乐部)的入门题目,40分钟把5道题都做出来了,但第5题把握不大,他们的要求是2小时做不出来3道就算了。

2014 Winter, @Dublin