JavaScript Promise All - Parsing Hackernews Stories using Promise.all

This post is an entry to describe a use case when the Promise.all JavaScript method is needed. The official reference can be found here. This assumes that the reader has a basic understanding of how promises work. Before we start, there is a need to understand how certain RESTful services are structured. For example, the Hacker News API has an end-point called topstories. This end-point however, does not contain any other information besides a list of item IDs....

October 25, 2019 · Jian

Traveling Sales Person using Genetic Algorithms

This post is best viewed using the light theme. This post uses GA to generate a high-quality solution to the Traveling Salesman Problem. Traveling Salesman Problem using Genetic Algorithm This blog post is regarding using a genetic algorithm to solve the Traveling Salesman Problem. In a one-liner, the TSP asks the following question: Given a list of cities and the distances between each pair of the cities, what is the shortest possible route that visits each city and returns to the origin city?...

October 23, 2019 · 4 min · Jian

Genetic Algorithm using Web Workers

This post is a simple implementation of Genetic Algorithm GA. Here, you would start with a random string and end up with the target string. This post is heavily inspired based on this website. However, I created the codes with a very different methodology to also include newer JavaScript methods using classes and also web worker so it runs behind the scenes. The implementation of it can be seen here...

October 19, 2019 · 2 min · Jian

Hacker News Word Cloud

The word cloud generated here is based on the website hacker news. The reason this post is; is so that it would easier to see the word that appeared the most for the day. Even though the use of a word cloud is not exactly a good representation of occurrence, it still looks nice. Please note that the posts here are generated based on the Hacker News API by doing GET requests....

October 14, 2019 · 1 min · Jian

Sentiment analysis for the subreddit Hong Kong

Sentiment Analysis for the Sub-Reddit “HongKong” This post will perform sentiment analysis using AFINN. AFINN is a list of words rated for valence rated with an integer between minus five(negative) and plus five (positive). This implementation uses AFINN-en-165. 1 This approach however is very naive as it does not build any models to determine the context of the usage of the word itself. Please note that the posts here are generated based on the Reddit website by doing GET requests....

October 13, 2019 · 3 min · Jian