Skip to main content


Gzip upload on browsers

Today, I faced a problem that I could not upload my archive file with gzip format on Firefox, even it worked on Chrome. I was using macOS. My application had a setting to whitelist accepted files. I’ve already added "application/gzip" to that list. "It’s strange!", I thought.

I finally figured out that my uploaded file's type actually was "application/x-gzip" on Firefox. I also asked my colleagues to check their uploaded files on Window and Ubuntu. Hmm… they were totally different! It was "application/x-compressed" on Window, and was "application/x-compressed-tar" on Ubuntu.

In fact, gzip is already standardized by IANA. There is a note in RFC-6713 as below:

"Some applications have informally used media types such as application/gzip-compressed, application/gzipped, application/x-gunzip, application/x-gzip, application/x-gzip-compressed, and gzip/document to describe data compressed with gzip. The media types defined in this d…
Recent posts

What the heck is Meteor DDP?

I was using Meteor for my messenger project. I was so curious about the real time connection. I wanted to know how exactly this mechanism works. In this post, I will go through the DDP Specification, an overview of WebSocket, and a simple demo about how to subscribe a publication of Rocket.Chat (containing a DDP server) from an external webpage.

At a glance, I knew that Meteor invented a protocol called DDP which uses for handling real time connection. So then, what is DDP?

"DDP (Distributed Data Protocol) is the stateful WebSocket protocol that Meteor uses to communicate between the client and the server." [1]

All right! Why does DDP matter?

"DDP is a standard way to solve the biggest problem facing client-side JavaScript developers: querying a server-side database, sending the results down to the client, and then pushing changes to the client whenever anything changes in the database". [2]
In order to understand deeply the protocol, I decided to explore its specif…

The culture war at the heart of open source

I enjoyed reading this post:

Here is my highlight:

If you ask a random developer what “open source” means to them, you won’t often hear “software that follows the Open Source Definition.” If you ask them “what’s the difference between free software and open source software,” you’ll often hear “aren’t those the same thing?” or “you can charge money for open source software, it’s not always free.” You may even hear “it’s on GitHub.”

In brief, there was a man Richard Stallman (and his team) starting a project called "GNU Project" in 1983. This project was about to develop a free software system. The term "free" here meant "freedom", not only about the price. The Free Software Foundation appeared to support this project. But then, the term "free software" was so ambiguous. "In addition, the ambiguity of the term “free software” was seen as discouraging business adop…

AI for Everyone

You might have heard of a lot about AI, Machine learning, Data science, Deep learning, etc,... But, what exactly these terms mean and how is the connection between those. Here is my understanding:

There are two ideas of AI: - ANI (Artificial Narrow Intelligence): E.g., smart speaker, self-driving car and web search. - AGN (Artificial General Intelligence): do anything a human can do.
ANI is realistic and incredibly valuable. Though AGN is still too far away, and there is no need to unduly worry about it.
When talking about data in term of AI that means talking about dataset. There are several methods to get a dataset: - Manual labeling - Observing user behaviors - Observing behaviors of other things such as machine - Downloading dataset from a website or acquiring it from a partner.
Machine learning (ML) is a tool in AI. Supervised learning is a type of ML that learns A to B, or input to output mappings. Deep learning/Neural networks is a type of supervised learning which can maximize …

Generating PDF/A From HTML in Meteor

My live-chat app was a folk of project Rocket.Chat which was built with Meteor. The app had a feature that administrative users were able to export the conversations into PDF files. And, they wanted to archive these files for a long time.

I happened to know that PDF/A documents were good for this purpose. It was really frustrated to find a solution with free libraries. Actually, it took me more than two weeks to find a possible approach.

Using Puppeteer to generate a normal PDF and using PDFBox to load and converting the generated PDF into PDF/A compliance.
What is PDF/A? Here is a definition from Wikipedia:
PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for use in the archiving and long-term preservation of electronic documents. PDF/A differs from PDF by prohibiting features unsuitable for long-term archiving, such as font linking (as opposed to font embedding) and encryption. The ISO requirements for PDF/A file viewers include color man…

Math fundamentals and Katex

It was really tough for me to understand many articles about data science due to the requirements of understanding mathematics (especially linear algebra). I’ve started to gain some basic knowledges about Math by reading a book first.The great tool Typora and stackedit with supporting Katex syntax simply helps me to display Math-related symbols.Let’s start!The fundamental ideas of mathematics: “doing math” with numbers and functions. Linear algebra: “doing math” with vectors and linear transformations.1. Solving equationsSolving equations means finding the value of the unknown in the equation. To find the solution, we must break the problem down into simpler steps. E.g:x2−4=45x2−4+4=45+4x2=49x=49∣x∣=7x=7 or x=−7\begin{aligned} x^2 - 4 &= 45\\ x^2 - 4 + 4 &= 45 + 4\\ x^2 &= 49\\ \sqrt{x}&=\sqrt{49}\\ |x| &= 7\\ x=7 &\text{ or } x=-7 \end{aligned}x2−4x2−4+4x2x​∣x∣x=7​=45=45+4=49=49​=7 or x=−7​2. NumbersDefinitions
Mathematicians like to classify the d