What did I learn recovering from ACL injury?

There is always something good in a bad thing. Nearly a year ago, I ruptured my anterior cruciate ligament (ACL)  during a football match, which then followed by an almost year-long recovery. Now I can start to run slowly and soon I might be able to play football again.

I would never say the accident was fortunate for me. But I have been lucky to learn so much by recovering from the injury. In this writing, I will share my three most important lessons and their impact.

Your body is not immortal

If you are like me, 27-year-old dude who have been lucky to have a pretty decent health, play some amount of sport – sometimes be the guy who physically dominates during the football match, it would be hard to imagine one day you cannot stand on your feet, let alone walking. In these golden year of life, your body recovers so quick, so well that you think it will be like that forever.

But it’s not. Fast forward 20 or 30 years from now, most of us will be suffering from some significant reduction of our body function. If you do not believe me, check this out.

Getting ACL injury then going through the operation for me is like a trip to the future, where I see myself struggling to perform basic daily operations like standing or making coffee on my own. Someday it will repeat – because your body is not immortal. Like my doctor said “Your knee’s problem, after your fifty year-old, it will come back. It’ll come back someday”.

And as soon as I realize my body is not staying like this for long, I know I must take a good care of it. It not like putting my body in a permanent shield – it will not prevent aging FYI but it means that I would try to be nice with my body, live more healthily and play sport more safely.

Even Logan’s body is not immortal.

You will be better at things that you practice, it just takes time

2 months after the operation, I could barely stand on my own feet. The moment I got rid of the crutches for the first time, I though I would never stand again. I could not stabilize my left leg. Nor could I stretch it. I was scary.

But somehow I made it. Shortly 1 week after, I can stand. Then I can walk, not so stably. Then I can walk stably. I can squad, with 20 kg, then 40 kg and more. Now I can run slowly. Probably in few weeks I will run like I did last year.

You cannot see the big picture if you give up too soon.

So things do improve. It just takes a lot of time and persistence. And it is not a linear process, you just cannot guarantee that today it’s going to be a better than yesterday, but ignore the bad day and continue to practice.

There is always a possible Z for the equation “I will become as good as X at Y after Z days”. If you have not become X yet, maybe your Z is just not big enough. Keep calm and dont give up too soon.

It’s always better to fail as early as possible

I was lucky to recover from my injury. It was not easy. But it’s probably easier than if I have the same injury in 10 or 20 years. And this is true for many things apart from normal physical accident.

If you want to try new career direction, try it now because even if it fails, you can get back easier. When you get older, it might be more difficult to learn new things, make new friends or just give up your existing successful career to start a new one from scratch. If you want to found a startup, do it now. You will just have more time to start other startups if this one fails, let alone other benefit.

Thus, if you are wondering to try a new thing now, do it as early as possible, because if it fails, it it better fail as early as possible.






Making Fitbit API client with scribe-java for OAuth 2.0

So, recently Fitbit has upgraded its API’s OAuth standard to OAuth2.0, however, their docs does not strictly follow the standard of OAuth2.0.

For example, to get the access token, they require a basic authorization in header of the request and the value is the Base64 encoded string of the concatenation of your client id and secret separated by a colon (clientId:clientSecret). This is a bit redundant, IMO, as in the body parameters, you already need to send your client Id.

When I first found out that they use OAuth2.0, I could not wait to try scribe-java as it is a great library for OAuth2.0 client. However, as Fitbit’s one does not really follow exactly the standard, so it’s a bit of hacky to use scribe-java.

Nevertheless, it’s still quite simple to get the job done (thanks to the excellent work of scribe-java). I have made a simple demo in my Github’s repository. You can just copy two classes: FitbitApi20 and Fitbit20ServiceImpl and then the setup will be super smooth to do:

final OAuth20Service service = new ServiceBuilder()
                .scope("activity%20profile") // replace with desired scope
                .callback("http://example.com")  //your callback URL to store and handle the authorization code sent by Fitbit

Quite easy, isnt?

The PRACTICAL guide for Latex beginners (part 1)

It all started three months ago at the very first week of my Master when I saw my friend Serge who was about to write his report in Latex. I personally had experience with LaTex before when writing my paper but well, it was surely beautiful and fascinating yet somewhat still very complicated for me. ” It might be very time-consuming and inconvenient if I write all my reports in LaTex” said myself at that time.

Yes, it was!! It was very inconvenient, it was very time-consuming and it was actually sometimes tempting to just come back to write everything in MsWord.

But only AT FIRST! For my case, first three or four reports were quite annoying as I needed to google every time I wanted to insert a new symbol or just draw an image or even change the headline etc.  Fortunately I was patient and adventurous enough to stay with LaTex and now I never regret switching to LaTex.

However, what I noticed during those time is that there is not much PRACTICAL guides for those complete LaTex beginners even though there are some tutorials or even many books but from my experience, they are not very suitable and attractive for the new users. Thus, this blog (part 1 and part 2) aims to be an ‘instant noodle’ for those novices who want to jump into LaTex and use it right away rather than reading hundreds introductory pages with so much strange terminologies.

So, fasten your seat-belt and start the trip to Latex world!

What is LaTex?

 It is just another way of inputting text, image and other information to a document. Your traditional way may be MsWord-like way, where you type all the sentences while inserting special symbols or mathematical equations through a graphical user interface (GUI). Specifically, this way is  actually command-line user interface so when you switch from MsWord to LaTex, it feels similar to move to Linux after using Window where you are doing everything with comfortable yet limited GUI. How limited it is you wonder? Just remember how tedious and time-consuming writing your Physics lab’s reports during freshmen year were? Totally not productive and smart at all!!!!

What are the advantages of LaTex? (just say a few)

  • It looks much more beautiful and professional than MsWord documents. Just look at one’s CV written in LaTex and you will see why.
  • Convenient and time-saving to input mathematical equations and Greek letters.
  • Really easy to format your page.
  • If you insert an image and later the content of that image changes, LaTex will automatically change. No manual work needed here.
  • Significantly reduce the time and effort to produce a formal document.
  • Nearly 100% of scientific papers are written by LaTex, so I urge you engineering students, who are close to write your bachelor/Msc/Phd thesis or academic paper or just course work’s weekly report to get used to LaTex since it would be much easier for your life from now on.

Why is it difficult at first?

Remember how difficult it is the first time you have used MsWord? Everything is so hard at first because it is NEW and it takes time to get used to something. It can also be annoying as you need to figure out every basical things like how to insert a picture, how to draw a table , etc. But do not give up because LaTex is actually quite easy and powerful.

Hmm, but maybe I should say this at the front. Practice makes perfect. The only short-cut to fast forward this settling duration is to PRACTICE and PRACTICE more and more, with your own report and papers.


It’s time. Enough words. Let’s start to play around with LaTex! You are advised to follow all the steps behind to see how it works.


Actually, LaTex is not the name of a software to produce documents (like MsWord) but it is only a way so you need to install a software to run LaTex. For this, I would recommend TeXstudio for its balance between simple design and great functionality. You can download and install it from here:


Then just click on the file you have downloaded and follow the instruction. An other option (which is getting more and more popular) if you do not want to install anything is to use some online LaTex editors such as ShareLaTex or WriteLatex. It is up to your preference to choose the one that fits you.

Hello World program

Let’s try some writing in LaTex. Open your TexStudio program and create a new file (Ctrl+N) then copy and paste this paragraph:

\documentclass[a4paper, 11pt]{article}

Hello World! I am a new Latex user!

Press F1 (which is the short-cut for building the document in TexStudio) and see the result. Congratulations! You have created your first LaTex document!!

Basic structure of a Latex document

As you can see from the piece of code  above, there is only a sentence in line 5 (highlighted) actually appearing in the built document. Other parts are only for declaration i.e letting LaTex know what kinds of setting you want. The first line says that you want a document of A4-sized paper with font size of 11pt and the style is like the pre-defined article style in LaTex. There are other built-in styles in LaTex such as book (for real book) or letter (for writing letters).

The next thing you need to do is to declare which package  you want to use in line 2.  Here I simply use package english since I want to write in English. For more complicated purpose you may need to include more packages (talk about it later).

Finally, the actual content of the document will be enclosed in \begin{document}  and \end{document}, so everything you write outside of this should be considered invalid.

Too easy? Let’s make something more advanced!

Ok, this time, copy and paste this piece of code and again, press F1 and see the miracle happens:

\documentclass[a4paper, 11pt]{article}

\lhead{Test LaTex document}
\cfoot{\thepage\ }

Hello World! I am a new Latex user!

\textbf{Exponential example:}
e^{0} = 1 \\
e^{1} = e


Now do you see the difference compared to the Hello world example? Now we have the headline and footnote as well as various new features (equation, boldface…).  To do this, we need to add the new package fancyhdr, which is for making the headline and footnote then we actually use the page style fancy (line 4) then we just need to specify the actual text we want to put on the left headline (lhead), central headline (chead) or center footnote (cfoot) and so on. Note that we can put \today and LaTex will automatically know to put the date of today into the right headline and similarly \thepage means that the current page of the document. Told you, everything is ready in LaTex and you just need to call it.

In addition, we also try to make a sentence bold by using \textbf{} command. Also, for typing exponential notation, just use ^ then follow by the text you want to put on the superscript (enclosed by {}). You do not even need to number the equation by yourself.  It stays automatically and beautifully at the center. Super easy huh?

Enough for today maybe?

So up to now, we have tried pretty complicated LaTex documents (and it is not gonna be much more complicated than this) so that you can have a glance on what LaTex is and how it works. Part 2 of this blog will cover some vital components of a formal document (image, equations, page layout etc.) and I promise it is going to be very easy and practical so that you can start to use it on your next report immediately.