All posts by felixha

Pro Skill (7) – Android

Use this Google post to start development for Android!

Key UI paradigms in Android:

  1. Action bar,
  2. Overflow menu,
  3. Back button: back button pop activity from main OS stack.
  4. Share action,

Key differences with iOS:

  1. No need for class prefix
  2. Ivars start with m, not _
  3. Have to check NULL
  4. No Properties

Project Structure:

Android applications primarily has 2 sections:

  1. Java Source-code:
    1. Activities: (like UIViewControllers). Android OS keeps a main application’s activity stack – when 1 app launched -> main activity of that app is pushed on stack. (Many apps can be launched and so pushed on the same stack). Back button pops from OS stack -> can pop different applications.
      • Activities can be created with Intents (like UIViewController with custom init). Activities can also return data -> placing data on the Intents.
      • Any activity can be Entrance for application if registered in AndroidManifest.
      • To be sent between intents & fragments, objects have to implement Parcelable interface. (like NSCopying protocol in iOS)
    2. Fragments: (since Android 3.0) mini controllers that can be instantiated to fill activities (like subviews). Use many fragments on an activity!
    3. Views:
    4. Adapters,
    5. Data (models and managers).
  2. Resource (res folder)
    1. Images
    2. XML Layout files: like xib files
    3. XML Values files: like plist
  3. AndroidManifest.xml (similar to  Project-Info.plist)
    1. Store activities, app names and Intents

Pro Skill (6) – Intro to Haskell

There are many popular functional programming languages, some of them are:
OCaml,
Erlang,
Clojure,
Scala,
Python and Haskell.

Haskell: purely functional programming language, which means functions in Haskell do not have side-effect.

  1. Pure function vs impure: i) it does not have any observable side-effects (like output to device, changing a mutable object) and, ii) it doesn’t change when passed the same parameter (random is impure, date() which returns current time is impure…) Lazy evaluation: avoids evaluation anything until the actual value is needed.
  2. Learn Haskell in 10 minutes
  3. Try haskell: try haskell online
  4. Haskell Wiki: Foundation of Haskell 
    1. Haskell has 2 popular implementations: Hugs – interpreter used for teaching. GHC (Glasgow): it compiles to native code, provides debugging tools, supports parallel execution. ghc (compiler), ghci (interpreter), runghc (run ghc as script).
  5. Syntax:
    1. /= (which is !=),
    2. numbers are not convertible to True and False,
    3. enumeration notation [1..10]
    4. concatenation  [3,1,3] ++ [3,7] -> [3,1,3,3,7]
    5. add   1 : [2,3] -> [1,2,3]
    6. text string is a list of individual characters
    7. x :: y –>  “the expression x has the type y
    8. :type x -> show type of x
    9. — lines beginning with “–” are comments.

Pro Skill (4) – JavaScript & Node.js

Node.js is a framework designed for server-side applications. It’s usually being compared to PHP.

Angular.js (Google) is one of the most popular client-side frameworks (along with Backbone.js, Ember.js) for building web applications. Basically, these frameworks are used to build web applications, while jQuery is used for building web sites.

All of these frameworks are based on JavaScript and therefore are so popular with Web developers.

— Comparisons: Angular vs jQuery

AngularJS : AngularJS is for developing heavy web applications. AngularJS can use jQuery if it’s present in the web-app when the application is being bootstrapped. If it’s not present in the script path, then AngularJS falls back to its own implementation of the subset of jQuery.

JQuery : jQuery is a small, fast, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler. jQuery simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.

Overview: Angular vs Backbone vs Ember

1. At first, there was plain old JavaScript, in which back in the day no one wanted to write it when it was just that due to all of the cross-browser issues.

2. Then jQuery came along, and since it can be summarized to be a DOM manipulation library, it removed the cross-browser issues. It also had an AJAX API that enabled a lot of things, so it was sort of the second step in the evolution of building JavaScript applications.

3. The third generation would be Backbone and Knockout. Those two came about because people were realizing at that point that they weren’t able to reuse code and pages when they wrote jQuery applications, and they felt as though they were writing these nested codes.

Of course, they could write good jQuery code, but it wasn’t leading them into success all the time. Promises make things better, but you can still quickly break the back button by making a few AJAX calls with your jQuery code. As you build more of your app in JavaScript, you eventually hit the edge of jQuery. Backbone helped make code cleaner, and there were a lot of micro-frameworks competing against it, but Backbone won. In addition, people really liked the 2-way data-binding in Knockout.

4. Finally, the next evolution of frameworks came along, which is Angular and Ember. They gathered all the ideas of what people liked and put together a more inclusive framework as opposed to a library.

Pro Skill (1) – Lisp

LISP

Lisp (1958) is the second-oldest high-level programming language (behind Fortran-1957). Lisp is actually a family of languages, with CommonLISP (an attempt to unify many Lisp variations) and recently Clojure.

Interchangeability of code and datamakes Lisp very easily recognisable.

  • Syntax: (f arg1 arg2 arg3) : a function f with 3 arguments.
  • Everything is written in expression. There is no difference between expression and statements.

List:

(list 1 2 ‘foo) = [1,2,foo]     //  ‘ prevents the argument to be evaluated

(list 1 2 (list 3 4)) = [1, 2, [3,4]]

Operators:

(+ 1 2 3 4) = 1+2+3+4

 

 

Clojure

Clojure is a general purpose language, it targets the JVM, and combines elements of scripting language with multithreaded environment.

Clojure compiles directly to JVM byte-code, it is a compiled language but is completely dynamic – supported at run-time.

Clojure is a dialect of LISP, and also has code-as-data character. It is predominantly a functional programming language.

– One of the great sites to learn clojure is http://www.4clojure.com/

– Intro to Clojure at http://clojure.org/getting_started

 

 

 

A life of love

While some Christians said “It’s not by deeds that we are saved” – I think this understanding can be very misleading, it’s can take people focus away from living a life of love, a life full of actions done in love.

It’s all about our actions in this life – by actions we express love, we train how to love, and we can live a life of love. A life of love is the most important purpose of our existence. We are here to learn to love, this human experience will definitely end someday, no human will live forever, but at the end of our day, there is nothing as fulfilling as living a life collecting love… If you have loved, there will be no regret. If you have loved, you will be rich of love. And with love, you will be happy.

Most of the organisations have their own rules – and I , as a Christian going to Church, should follow their rules. But there is a much greater rule that I should always remember, the rule of Jesus Christ – love God and love others. This rule should be more important than any other rule, this rule should filter all my actions and words, should never allow me to harm other people, gossip, hurt others emotionally, verbally or physically.

Loving God is probably the most profound feeling in this world. God is everywhere, in each of the tree, in each of the living entities from a fly to the elephant, and in un-living ones like mountains, lakes, seas, oceans… Loving God is to cherish life, appreciate the human, the pets, the animals and the world. The purpose of this life is to bring good changes to people, if not in the scale of what Bill Gates is doing, then for family, friends and other people I meet or know.

Honestly, I want to live a life full of blessings. I don’t think about a second life after I die, if my soul will survive, I want no regret. I want to know that I have done my best to love, to not judge people, but that I have helped whenever I could, that I have cared, assisted and brought happiness, that I have not hurt, harmed, judged, talked bad about or neglected when I could have made a difference. I have a tendency to judge people, to not see the beautiful things in them, but to love is not to judge, and the less I judge, the more I can love.

Lets continue to live a positive life, doing only good things and no bad things. Because any thing that I have done for people, God always give me back more. Thank you, amazing God.

Lời cầu nguyện cho bố mẹ, vợ và em trai

Kính laỵ Đức Chúa Trời vĩ đại là Cha của con. Chúa là Đấng Nhân từ vĩ đại và cứu vớt con người khỏi con đường lầm lạc. Con đến với Chúa, hết lòng kêu cầu Chúa đoái thương linh hồn của mẹ Quyên, bố Tân và vợ con là Hồng Hạnh, em trai con là Nhất Việt đang lưu lạc trên con đường riêng của mình mà không được biết đến sự yêu thương và ngọt ngào của Đức Chúa Trời vĩ đại. Cầu xin Chúa cho Thánh Linh của ngài dẫn dắt bố mẹ và vợ con, em trai con vào tình yêu thương và con đường nhân ái của Ngài.

Con xin cầu danh Chúa Giêsu mà trói buộc thế giới tối tăm vô hình đang vận hành trên họ khiến họ không thấy được tình yêu và ánh sáng của Ngài. Con sẽ tiếp tục cầu nguyện cho đến khi Chúa giải thoát cho bố mẹ, vợ con và em trai con.

Con cầu xin Đức Thánh Linh che phủ và vận hành để rọi ánh sáng vào linh hồn họ khiến họ được tỉnh ngộ mà thoát khỏi con đường tăm tối và hạ mình xuống để thấy và vâng phục Ngài. Lạy Chúa dù việc cứu chuộc họ có khó đến mấy thì Chúa đã phán rằng Ngài sẽ vẫn làm được. Xin Chúa thực hiện lời hứa của Ngài mà động cham đến tấm lòng của họ. Con thiết tha cầu nguyện trong danh Chúa Giê-su, Đấng Cứu Thế. Amen.

Skills (6) – English (Speaking)

The most important speaking tips for an Asian is:

  1. The ending sound – remember the s, t, d and the ending sound of the word.
  2. The th-sound, like: the, that, three, third, teeth..
  3. The intonation: it’s better to have no intonation, then going up and down wrongly. If possible, record yourself, and copy the intonation of some english guys like Tony Blair, Cumberbatch …

Listen to these audio books:

  1. http://www.loyalbooks.com/book/fairy-tales-by-the-brothers-grimm