Category Archives: Technology

Find out which program is locking a file with Process Explorer (Windows)

Ever wonder why you can’t delete a file? When the dreadful message appear: “Your file is opened in another program”, the stupid computer won’t allow you to delete that file!

We have just the solution: Process Explorer from Microsoft. I choose to introduce this program because it is easy to use, even if you don’t know anything about bash script and the likes. Let’s see how it works:

1. Download Process Explorer from Microsoft TechNet

2. Start the program. No installation needed

Process Explorer

3. Open menu Find/Find File or DLL Handle

Open menu Find Handle

4. Search for the file/folder name you want. Take note of the PID (Process ID)

Search file name and take note of the PID

5. Use Ctrl + Alt + Del to open task manager

6. In Menu View, enable column PID for Task Manager

Enable custom column for task manager

Enable custom column PID for task manager

7. Sort Task Manager processes by PID. Find the troublesome process and kill it

Kill the possessing process

The other scenario that this tool could prove useful:

1. To track down a “lingering” DLL that refuse to go away (eg: Visual Studio refuse to build because it cannot delete the old DLL)

2. Cannot clear an old folder “just because” it is opened in windows explorer

3. You cannot delete a file because another user has it opened in their notepad in their session

Credit: this solution is taken from many places, yet the most credible source is the question “Find out which process is locking a file or folder in Windows” in StackExchange SuperUser.

StackOverflow: why it succeed?

You succeed when you reach your goal. Simple at that.

Why StackOverflow is a success? It’s not because that the website has reach 560M page view/ month. It’s because it makes software developer’s life easier.

My criterion for whether Stack Overflow works: when you type your question into Google, and you’re happy to see a Stack Overflow result rather than a result at another one of those Q&A sites where you have to sign up and pay a monthly fee to see the answer. - Joel Spolsky

Once you understand the site’s goal, you would understand the hard choice that its creators have made. Many people complain how the site has been so strict in its “standard” for question and answer. When they come to the site asking for help, but leaving unsatisfied. Or worse, their question would be closed in few seconds because it’s “too broad”.

It’s because that SO “true” customer are the indirect users, those who come searching for an answer. The answer gets written only once, but it gets read millions of times years later.

The more time you spend on writing a short, clear and coherent question, the more time would be saved from your reader.

Logging or debugger?

It all begins when I read a small story over the net:

A young girl watching her mother prepare a ham to bake for dinner. As the mother cut both ends off the ham, the daughter asked why. Mom replied that her mother had always done it that way. When the daughter still insisted on knowing why, a quick call to grandma revealed the reason: “Because the pan was too small.”

The story above is exactly what I usually get when I try to present something new. Like what I’m going to do here.

Well, not exactly new. Debugging by using log vs. debugging using debugger was a long time debate. We can google dozens of articles written about the subject. And while most of them use the very political phrase “it depends” as an answer, I would confidently tell you “logging is obviously superior in 99% of the time“. Continue reading

Simple things matter

Today, out of boring, I did visit again codility to take a few tests. Their free tests aren’t much of a challenge, so I got them one by one, each in 5 minutes or so. Then I come across a test which, to my opinion, just a little trick question:

Problem: PermMissingElem

Task description
A zero-indexed array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
Your goal is to find that missing element.
Write a function:

 class Solution { public int solution(int[] A); } 

that, given a zero-indexed array A, returns the value of the missing element.
For example, given array A such that:
A[0] = 2
A[1] = 3
A[2] = 1
A[3] = 5
the function should return 4, as it is the missing element.

Feel free to drop a few minutes to think it through. It isn’t even hard.

You finished your program? Ok, then let’s continue.
I took my 5 minutes and write a very simple script, including the unit tests:

First Solution
class Solution {
public int solution(int[] A) {
// write your code in Java SE 8
int sum = 0;
int sumTotal = (A.length + 1) * (A.length + 2) / 2;

for (int i = 0; i < A.length; i++) {
sum = sum + A[i];

int result = sumTotal - sum;
return result;

Unit tests:

  • [6,5,4,3,2]
  • [2, 5, 1, 4]
  • [2]
  • [1]
  • [6,3,5,4,2,1]

All my unit tests passed. I submitted, kind of waiting for another 100%. But it was FAILED with n ~ 1,000,000.

My algorithm is right, I know that. So what’s the matter with big number?

In case you’re still wonder, here’s the program that worked and got 100% score:

Right Solution

class Solution
public int solution(int[] A) {
// write your code in Java SE 8
int sum = 0;
int sumTotal = 0;

for (int i = 0; i < A.length; i++) {
sum = sum + A[i];

for (int i = 1; i <= A.length + 1; i++) {
sumTotal = sumTotal + i;

int result = sumTotal - sum;
return result;

Can you tell the difference? :)

Shiseido – and Japan philosophy of service

Little Omotenashi photo little-omotenashi_zpsb24a009a.jpgOmotenashi

The highest form of hospitality is Omotenashi. In summary, it’s “the host anticipates the needs of the guest in advance and offers a pleasant service that guests don’t expect.”

Coming from a pharmacy, to a leading cosmetics vendors in the world economy, is not simple. However, Shiseido did it.

I will not go further into the analysis how a small pharmacy can grow to a company, and how an Asian organization can succeed in such a competitive market, where Western companies have lots of technology advantages. There are quite a few reasons: the timing, the technologies, marketing… and so on.  Just forget them for now. The only thing that makes Shiseido special, in my view, is the reason for that the company exists.

Shiseido is built on the philosophy of Omotenashi.

Omotenashi photo japanesegirl_zpsb9b6cc23.jpg

Omotenashi: The word ‘Omotenashi’ in Japanese comes from omote (surface) and nashi (less), which means “single-hearted”, and also mote (carry) and nashi (accomplish), which means “to achieve”. Therefore, Omotenashi has two meanings, which include offering a service without expectation of any returned favour, and the ability to actualise that idea into an action.

Don’t take the word, look into their action:

Only in the Mirai-Tsubaki 2012 project, Shiseido sent out 45,800 employees to do 131 social welfare activities throughout the world. They build schools, give books to students, promoting good traffic behaviors, send cosmetics (yep) to victims of the Japan earthquake 2011, training handicapped women in Vietnam, planting trees, developing natural-friendly cosmetics, recycling drugs,… And they do it all when the financial situation is going down.

Shiseido considers the most beautiful skin is the natural skin. It believes that the skin itself can’t be good without the well-being of the whole person, the harmony of both body and mind. The true beauty doesn’t come from the skin itself, but come from the caring, empathy of the people. I remember a story, when a young American girl comes to cosmetics store for a make-up. The consultant tells her: “you are young, and your skin is beautiful already. You don’t need any make-ups. Instead, you should learn how to take care of your skin, so that it will be always beautiful.”

That’s how an organization can LAST.

Never use “reserved keyword” as column name

The title says it all. Never EVER use the reserved keyword of a database system for a column name. You will meet problems that cost lots of time (which isn’t worth at all!)

If someone tells you about this little trick:

    &lt;class name=&quot;long.model.User&quot; table=&quot;USER&quot;&gt;
        &lt;cache usage=&quot;read-write&quot;/&gt;
        &lt;id name=&quot;id&quot; column=&quot;ID&quot;&gt;
            &lt;generator class=&quot;sequence&quot;&gt;
                &lt;param name=&quot;sequence&quot;&gt;user_seq&lt;/param&gt;

        &lt;property name=&quot;position&quot; column=&quot;&amp;quot;POSITION&amp;quot;&quot;/&gt;

Then just kick him in the ass! Why we should use something as dirty as “"”?

If you still not believe, take the example above, then try to UPDATE the position of a random user.

As you may guess:

UPDATE public.user set position = 'MANAGER'; // NOT WORK 
UPDATE public.user set 'position' = 'MANAGER'; // NOT WORK 
UPDATE public.user u set u.'position' = 'MANAGER'; // NOT WORK AGAIN 
UPDATE public.user u set u.POSITION = 'MANAGER'; // NOT WORK! 


Here’s what you MUST do if already get fallen into the trap

UPDATE public.user set &quot;POSITION&quot; = &quot;MANAGER&quot;; // WORK! Windows only 
UPDATE public.user set &quot;POSITION&quot; = 'MANAGER'; // WORK! only Linux 

Hence don’t try to trick the system. Curiosity is good, but you might need to pay for it by several hours playing with how Postgresql deal with case-sensitive name. Nice to find out, but either way, it isn’t a portable database script.

[Duolingo Introduction] Part 1: From Captcha to Digitalizing the books


Duolingo is a startup that focus on language-learning. And it’s a nice one.

Being constructed by the founder of Re-captcha, Duolingo also shares the vision of utilizing the power of community to make the world better. So, before the story of Duolingo, I’ll tell you the tale about how  Luis von Ahn creates Recaptcha.

recaptcha-exampleHave you even registered in any website? Did you see little words that you must type to prove that you are not a auto-robot? “If you type the weird words in the images right, you may get in”. If you saw it, you know what a Captcha is. It’s a simple mechanism – based on the fact that no matter how far technology goes, it’s still nearly impossible for a machine to tell a bad writing from random images with thousands of senseless dots.

Ok, but have you ever asked yourself, why sometimes, you must type 2 words instead of 1?

The reason is simple. When Luis sees that we all must type Captchas everyday, he wants to make it more useful.  He told himself: we still have lots of books/ materials in paper form. If we scan them, they still be in pure image form – we won’t be able to search them like a text ebook. The current technology doesn’t allow machine to translate from image to text accurately. But what if people can help in the process?

So Recaptcha was born. Among 2 word-images Recaptcha gives you, it only knows exactly 1 word. If you type that word right, Recaptcha will recognize you as a human and let you in. And yes! Because you type one word right, the second word should be right too! You just translate an image to a word!

missing you

The result is that a lot of books in Google Scholar is digitalized that way.

ibus-bogo – New replacement for Vietnamese Keyboard on Ubuntu!

/** Vietnamese: Tin tốt cho người sử dụng Ubuntu ở Việt Nam – ibus-bogo – một bộ gõ mới, ít lỗi & gõ mượt hơn nhiều so với những bộ gõ cũ. **/

Good news for Vietnamese Ubuntu user! Nguyen Ha Duong is a good guy, and he writes quite a good software!

No more advertising. Let’s try it at . It’s version 0.2 now.

This is one among the projects at “Khong gian cong dong” (Community Space). Cheers for Vietnamese opensource developers!