Skip to main content


Showing posts from 2018

Performance of a Data Structure

Why data structures matter The fact is that programs are all about processing data. Data structures are referred to how data is organized which affects the time of executing a program.
How to measure the performance of a data structure In order to measure "how fast"/efficiency/performance of a data structure, we measure the performance of its operations. There are four basic operations including reading, searching, insertion, and deletion. A pure time consuming is not used for the measuring because it is not reliable depending on the hardware that it is run on. But instead, we use the term time complexity which refers to how many steps an operation takes.
An example of how a single rule can affect efficiency Let's compare two data structures: Array and Set (with N elements).
1. Array - Reading: 1 step (because the computer has the ability to jump to any particular index in the array)
- Searching: N steps (the worst case with linear search)
- Insertion: N + 1 steps (the wo…

My must-have apps for daily work

There is no doubt that cool apps can help us be more productive and enjoyable at work. For the time being, I really love the following apps which are used by me almost every day.
1. A personal Kanban In fact, a personal kanban is the most useful app for me. Why does it matter? It is not just a to-do list, but it keeps me motivated every day because it helps me be able to know what my "big picture" is. I usually set up my plans together with a path to reach them. KanbanFlow is my preferred tool.
2. A terminal Needless to say, a terminal is a must-have app for every developer, especially the ones use macOS/Linux. Due to its importance, I love to decorate and enhance it to be super exciting with various tools such as iTermoh-my-zsh, and thefuck. ;)

3. A documentation "ecosystem" As a developer, I can not remember all things that I have experimented a day. Moreover, a document is really useful for sharing an idea with other people. I use the set of tools for helping…

Applying pipeline “tensorflow_embedding” of Rasa NLU

According to this nice article, there was a new pipeline released using a different approach from the standard one (spacy_sklearn). I wanted to give it a try to see whether it can help with improving bot’s accuracy.

After applying done, I gave an evaluation of “tensorflow_embedding”. It seemed to work better a bit. For example, I defined intents “greet” and “goodbye” with some following messages in my training data.
## intent:greet- Hey! How are you? - Hi! How can I help you? - Good to see you! - Nice to see you! - Hi - Hello - Hi there ## intent:goodbye- Bye - Bye Bye - See you later - Take care - Peace In order to play around with Rasa NLU, I created a project here. You can have a look at this change from this pull request. Yay!

When I entered message “hi bot”, then bot with “tensorflow_embedding” could detect intent “greet” with better confidence scores rather than bot with “spacy_sklearn”. The following are responses after executing curl -X POST localhost:5000/parse -d '{&qu…

Sharing a virtualenv across several Python projects using Pipenv

There is a standard library for all projects in Python. However, several projects don’t always have the same dependencies all the time. That is where virtual environments come to play.

You can follow this official document to use two separated tools virtualenv and pip to fulfill that need. My preferred alternative is to use pipenv. Pipenv is easy to use and convenient. The following are my steps to make a shared virtualenv for my all projects which requires the same dependencies.

Step 1. Create an isolated virtualenv.
python -m venv my-shared-env Step 2. Create a symbolic link to the created virtualenv.
cd project_1 ln -s ~/.local/share/virtualenvs/my-shared-env .venv I have encountered the following issue at step 1.
FileNotFoundError: [Errno 2] No such file or directory: '{my_project_path}/.venv/bin/pip': '{my_project_path}/.venv/bin/pip' The root cause was I tried to create virtualenv by running pipenv install and renaming the generated virtualenv to a new name but …

"Java & Agile" was renamed "Python & Machine Learning"

I have started blogging since 2014. In fact, I just happened to know a very nice free blogging course of John Sonmez. Time flies!

I currently work at a startup to build an AI chatbot. It was where Python and Machine Learning become my most focus from now on. That also was a reason why I wanted to rename my blog theme. I still keep using Java in my projects though.

Thank you all for reading my blog so far. It motivates a lot to keep me carrying on this habit.

A new topic "Python & Machine Learning" is added to my blog theme today. Yay!

When we don't see the sun, we see other stars

What are your motivations for creativity? - I want to make a change.
- It makes me happy! It is a need of my mind.
How to be creative for a thing? There are two steps: - See the thing as every people see it - Think about a new different thing from it How to think about a new different thing? There are two ways: - Forget all things you have already known. - A whack on the side of your head. ;)
This was what I have learned from the following great book:
Well! A physical whack on the side of your head is needed sometimes but the meaning behind is that you need to break these 9 following locks on your mind. Remove them!
The lock #1: "The correct answer" We all learn from schools that there is only one correct answer to a question. For example, a proposition is only true or false in Algebra. In reality, there are always some answers to a question basing on a point of view. For example, number 6 becomes number 9 if you look it in the opposite.
The lock #2: "That is not logic&…

Fulfilling Your Contribution Needs

Human resource management motivation Managing human today is quite different from the industrial age which treats people as just "chickens". Rather than people now are very important to the success of an organization. People are an organization's special resource. They should be encouraged to grow to contribute their effort and creativeness to their beloved working environment because the contribution is one of their most needs in life.
Training people: getting rid of the ineffective model and adopting the new one The ineffective model of training people: Hiring new people --> giving them a crash course once --> expecting them working effectively. 

That somehow makes sense but you're about to expect a luck because you do not really spend your effort for mentoring them. If they can work effectively, well...lucky you! Otherwise, you will blame that these people are ineffective and you let them go and hire the new ones. What a waste of time!

The new effective one…

Google I/O '18

Here are my top 5 impressions on this conference.

Gmail - live sentence suggestion It looked like the way developers use intelligent code completion in an IDE when coding.
Google Photos: converting a photo has a document to pdf I have a paid app on my iPad called "Scanner for Me" but now I can use Google Photos instead. ;)
Google Assistant: bot makes a real call to book a restaurant dinner or a hair salon Wow! This feature, for me, is really a big innovation. My team is working so hard on building our bot which is able to have a continued conversation. Google is so good!
Google Maps: using Phone's camera to watch the direction When I saw a fox as a cicerone on the demo, I was thinking of Pokémon GO.
Google Lens: extract text from images I have heard a story from a friend of me that he had to use his app about "optical character recognition (OCR)" to scan and translate the texts into English whenever he saw texts in China. Google Lens would be a good helper for…

Daily Meetings - Coordinate and Communicate Every Day

Using daily meetings for frequent course corrections. However, you should keep the meeting short because time is burn rate.
Though good collaboration doesn't guarantee a project's success, poor collaboration almost always guarantees a project's failureWhat benefits does the daily meeting bring to you?

- Keeps inexperienced developers and experienced ones on-track.
- Avoids reinventing the wheel.
- Limits tumbleweed developers' damage.
- Leverages the entire team’s experience to solve problems quickly.
- Improves team communication.
- Helps every people have a big-picture
point of view.
Who are tumbleweed developers? We’ve all worked with a few tumbleweed developers. These developers lose direction and drift through their days. They wade through the random code and “improve” it, cleaning up method signatures, polishing algorithms, and reformatting brackets. Tumbleweed developers lack the discipline to finish any task you ask them to do and generally cause more harm th…

git cherry-pick [commit]

Customer Needs My team already had a go-live app in a customer environment some months ago. We have been developing some new features for our next milestone. The situation is described in the picture below:

We used Git for our codebase management. The go-live app running on our customer environment was at version `v1`. The latest sprint release was at version `v7` for our developing app.

Our customers wanted to have two separated release packages for our current sprint release. We all know that it was easy to ship the package to the developing app. However, the issue was that how we just picked some features needed for the go-live app. We called this package was a hotfix.
Git Cherry-Picking Fortunately, we found that Git provided a way to achieve this task. Actually, we had all commits on the branch `master` already. We created a new branch called `hotfix/v1.1` and we traced back which commits needed. We used cherry-picking for merging these commits to this branch.

For example, let&#…

Creating a Chatbot with RiveScript in Java

Motivation"Artificial Intelligence (AI) is considered a major innovation that could disrupt many things. Some people even compare it to the Internet. A large investor firm predicted that some AI startups could become the next Apple, Google or Amazon within five years"
- Prof. John Vu, Carnegie Mellon University.

Using chatbots to support our daily tasks is super useful and interesting. In fact, "Jenkins CI, Jira Cloud, and Bitbucket" have been becoming must-have apps in Slack of my team these days.

There are some existing approaches for chatbots including pattern matching, algorithms, and neutral networks. RiveScript is a scripting language using "pattern matching" as a simple and powerful approach for building up a Chabot.
Architecture Actually, it was flexible to choose a programming language for the used Rivescript interpreter like Java, Go, Javascript, Python, and Perl. I went with Java.

Used Technologies and ToolsOracle JDK 1.8.0_151Apache Maven 3.5…

A Case Study of Custom JSF Converters - Automatically Converting Years With 2 Digits Into 4 Digits

You can find the demonstrated code of this post on my Github repo here.
The user story" As a banker, I want to enter a client's birthday like 01.01.80 or 01.01.1980,
So that the birthday can be displayed as 01.01.1980 "
Implementation Firstly, I thought about how to use a built-in converter likes the following.

<h:inputText id="birthdate" value="#{data.birthdate}" type="date" > <f:convertDateTime/> <f:ajax event="change" listener="#{data.onCalculate}" execute="@this" render="@this" /> </h:inputText>
However, without defining a pattern, JSF used its default one which was not my desire. It threw an exception when I tried to enter a date like "01.01.90".

> myform:birthdate: '01.01.90' could not be understood as a date. Example: Mar 4, 2018 

Actually, I even could not define either pattern "dd.MM.yyyy" or "dd.MM.yy" for "…

Trước Bình Minh Luôn Là Đêm Tối

This is a book telling about many stories of the book's author, Ta Minh Tuan. Each his story is not only a valuable lesson but also a heart-to-heart talk. Think Big, Start Small, Move Fast I accidentally attended a $2 meetup which was held by in 2013. It was the first time for me to see the author. At that time, he wanted the attendees to repeat many times a sentence "Think big, start small, move fast" (a mindset for entrepreneurs). It was really impressed to me. I've been following him on Facebook since 2013. This book was his recommendation. Do It Anyway Your success is defined by yourself. It is built by your habits. Habits are the things need time to tackle. To me, that somehow means JUST following your heart combining with your brain because you're the one who knows what you're doing. Believe in yourself and never betray your dream!
We Are One The author said that "everything is connected". This is also the theory of Buddha. He beli…

4 Remarkable Notes for JSF Apps Using HTML5

In the previous post, I've already shared with you how my team consults clients by using a HTML prototype. This post is about the used technologies for reusing the provided HTML template and communicating with backend.
What is the issue when using HTML elements with Primefaces components? Primefaces is a great extension for developing JSF web apps. However, it is really frustrating in case we have to make it work with an existing HTML template. Why?
- Primefaces has its own theme for styling.
- Primefaces changes the HTML structure.
Therefore, that would be a huge effort to use the Primefaces' components to replicate the elements of the HTML template; especially it is impossible for images drawing by "canvas" tag.

That requires us to find a better approach. Since Java EE 7 (introducing JSF 2.2 included), it supports to use HTML5 elements. The idea is that JSF components don't effect the style and HTML structure, so we can easily reuse the provided HTML template.…

Consulting Services

The topic is about my experience on my first project with my freelance team. We implement the last step of this process which you can find in the end of this post.

You might have heard of something like the following:
Many customers don't know what they want. Yes, that's a fact. In order to help customers solve their needs, we'd better consult them or we provide a consulting service. The next questions is "how?".

Our approach is enhancing the collaboration with customers or providing a design of customer interactions. Firstly, we create a website wireframe to express the idea of website's functionalities. For example:

Source: Wikipedia
And, the further step is that we make a running app based on the created wireframe where the real UI/UX is demonstrated. However, it is just a GUI/frontend with dummy data without interaction to a backend. Technically, that is just a html template which contains source code of HTML, CSS and Javascript. For example:
Source: ThemeF…

My 2017 Review

Passion for System Design After finishing a one year project, my longest stable team (lasted for 3 years) was separated into two smaller teams. Sadly, but that was a good chance for me to become a key member in my new team. My preferred skills were about system architectures; therefore most of the tasks of building the application structures were handled by me. In order to enhance my design system skills, I have spent much my time for reading books closely after work. These following books help me a lot.
- Object-Oriented Thought Process | Matt Weisfeld
- Head First Design Pattern | Elisabeth Freeman and Kathy Sierra
- Java 8 in Action: Lambdas, Streams, and Functional-style Programming | Alan Mycroft and Mario Fusco
Junior Technical Architect I was requested to join a technical architect team (aka Team. Alpha) where I actually had gained experiences almost on interviewing candidates for my company (lol). Besides, I noticed myself must improve the skills of convincing people because …