少年神探狄仁杰

前几天开始在 Youtube 看少年神探狄仁杰。这个是唐高宗和武则天时代的破案高手。

之前我都看包公的,旧版新版和少年版包公都看完了。狄仁杰则是第一次看,也是先直接看少年版的。

我上网搜索比较狄仁杰 vs 包公看谁比较厉害,多数人都觉得狄仁杰比较厉害。一,包公每次都要问公孙策,而狄仁杰可以自己破案。二,包公不会武功,狄仁杰会武功而且文武双全。三,包公虽然有王朝马汉那班人,但是狄仁杰当官的时候跟的人更多。四,狄仁杰的官衔比包公高。

最后,这部戏呢,太多儿女私情了,少一点应该会比较好。

The LLVM Compiler

The LLVM Compiler Project is a collection of modular and reusable compiler and toolchain technologies. The primary sub projects are LLVM Core, Clang, and 11 more.

LLVM has three important elements: front end, optimizer, back end.
Front end can be any languages.
Optimizer is a target independent intermediate language.
Back end can be any target system architecture, like x86_64.

I came approach to this tutorial, step-by-step approach to implement a simple functional language Kaleidoscope showing how fun and easy of LLVM. By following tutorial we can learn how to build a lexer, parser / AST, code generation to LLVM IR, adding JIT and Optimizer support, extending language with conditional flow (SSA construction), extending language with user defined operators (very significant), mutable variables.

Because LLVM is target independent, meant, we can implement any source language as input, convert to LLVM IR, and then output to any target architecture like Windows/Linux 32/64 bit, makes our languages portable.

Other than these, some keywords scanned. SSA and CPS. SSA, Static Single Assignment Form is a property of an intermediate representation (IR), which requires that each variable is assigned exactly once, and every variable is defined before it is used. In the other hand, CPS, Continuation-passing style is a style of programming in functional language by explicitly passing control in the form of continuation. But need to be careful as using CPS without tail call optimization will result call stack being grown and leaked. Tail Call Optimization is a compiler specific action to optimize tail call structure, which tail call is a subroutine can be performed as the final action of procedure. The procedure said to be tail-recursive when the subroutine call itself at the end, recursive function. Refer to Tail recursive in Erlang in my previous post.

I forced myself to read every single piece of information of this tutorial although it seem quite hard but yet valuable for knowledge.

Update:
10 August 2014 12:17pm, LLVM Publication, A Compilation framework for lifelong program analysis & Transformation. < http://llvm.org/pubs/2004-01-30-CGO-LLVM.pdf>

Mashape API Interface Down?

Today I spot check my Mashape API Analytics Usage on Mashape API Platform. Check out the link here. I felt really down when I see the traffic goes down to zero. I quickly control my tears log in to my several back end servers and confirmed no issue, working perfectly. But I tried to click “Test Endpoint” on Mashape API hub for my API, it showed no responsive.

Screen Shot 2014-08-09 at 11.37.00 am

I referred to Endpoint definition, found something strange. Under first box, the URL something like http://elb-proxy… this is an Amazon URL, they change to Amazon URL as a proxy. Previously is https://text-sentiment.p.mashape.com/analyze. They are not testing properly… Directly change in production.

Screen Shot 2014-08-09 at 11.38.55 am

And I manually run the CURL command line in my terminal, you know what happen?

Screen Shot 2014-08-09 at 11.41.50 am

It complained me to use HTTPS protocol. Eh, you changed to Amazon URL why don’t use HTTPS. I quickly test another people API, also got this problem, so, Mashape you tricks us.

Guys, please use the old API interface confirmed still working.


curl -X POST --include "https://text-sentiment.p.mashape.com/analyze" \
-H "X-Mashape-Host: text-sentiment.p.mashape.com" \
-H "X-Mashape-Key: Ri4j5gX4ORmshweHbjBSUUMevXWIp1i0xRujsnjCz7wW9w5zLB" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "text=I am not really happy"

Alternatively, please visit my Runnable example code, also working. Link: http://runnable.com/U80nxyBJjrp4wcOH/text-sentiment-analysis-for-node-js-and-mashape

I had inbox Mashape Guys to look into this issue matter.

Updated: 9 August 2014 4:37pm SGT Time checked the issue is solved

MIT 最新技术:从静音视频中提取声音

MIT 最新技术:从静音视频中提取声音
太夸张了。
MIT Latest Technology, extract audio from an audio absent video.
Core objective: every sound wave get a very tiny vibration when it reach an object. Analyse the vibration can get back the original sound wave.

Link: http://blog.jobbole.com/74941/

English version: link

Linux Grep and Windows Find

When working I experienced using Linux Grep and Windows Find in terminal to search string. It is quite useful so I share here and for future reference.

When using Windows, we may use

netstat -abon | find "Segments"

When using Linux, we may use

ifconfig | grep "192.168"

When using Linux to search occurrences of something over folders

grep -r "something to search" "folder name"

Mashape Weather API Update Fallback Mechanism

Mashape Weather API had been updated with fallback Mechanism. The default API Provider will be Yahoo Weather, the fallback API provider currently support Open Weather Map. If Yahoo Weather is down, the fallback API will be called, so reduce fail chances.

Personal hourly alert will be sent to me if fallback API really triggered.

Read more on https://www.mashape.com/fyhao/weather-13/announcements