2015/01/17

Java public static final or private static final

About

This is a blog post about keywords public static final and private static final in JAVA world. To be honest, answers came from Stackoverflow. Putting them together is what I have done in this blog.

About static

There is one and only one copied in the memory. Even though there are millions of instances, they are all accessing the same pieces of memory if it had been specified with static. Refer to here for further explanation.

About final

You are not allowed to change value of a variable if it had been defined with final. Refer to here for explanation.

public final static vs private final static

The best practice is using the latter one. For the explanation, please refer to here

References

2015/01/04

How to use Google trend

About

Google trend, as the name, records and reports the search trend during a certain period. So, how can you benefits from them? Below is my sharing on analyse the behaviour of MPF’s price.

The fact….

While reading the MPF reports, there is a huge drop between 2013/1/1 ~ 2013/6/30. Due to curiosity (and I bought a lot), I would like to find out reasons for this drop.

Start working….

Before using google trend, it is better for us to know the starting point of the drops.
The peak value is around 13.4160 HKD and it seems starting at the beginning of the 2013. By the help of filters from the finance report, we get below graph.
April 2013 is the starting point.

Heading to Gooooooogle trend

OK. Let’s look at the overview of year 2013 in Hong Kong.



In 2013, we could see h7n9 was a hot topic in Hong Kong.

To confirm the drops and H7N9

How can we link up these two facts?
Let’s filter results by setting date from 2013/3/1 to 2014/1/1.


H7N9 is the only one which affect the MPF’s price.

Let’s see the searching trend of H7N9.



Perfect match. According the facts that MPF’s price drop at April 2013 and H7N9 searching trend starting at April 2013, we can see the relationships between them and that’s the critical factor for the poor drops.

2015/01/02

AngularJS: this VS $scope in controller

While wring angular application, I found that there are 2 choices to wire up controller’s attributes with html template.
So, I am wondering which one is the best programming practise.
Official documents shows usage for both of them. For example, here shows you how to do the linking by using this and controller as syntax while here shows you how to do that by using $scope angular service.
However, after digesting the most common answers from stackoverflow, I decided to use the this way to write my angular application.
Well, syntax in the first approach is more native and without the necessity to inject $scope to my controller is another good thing to point out.