Lukasz Krawczyk blog | JavaScript

High performance JavaScript – part 1

When building an application which requires fast array computation (e.g. analysing video/sound stream in real time, drawing on canvas) performance improvement becomes a very important part of the development.

There are several things we can focus on:

This time we will check which kind of loop we should choose to get the best performance.

Continue readingContinue reading

Clustering in JavaScript

Suppose we’re preparing a campaign for our shop. During the campaign we want to sell some new producs and focus on several customer groups. But… what are these groups?

We have some general knowledge, based mainly on daily observations, but how can we understand the whole picture?

The simplest solution is to stand in front of a shop and ask each customer what he or she likes.
Another, make an survey and… hold on, we’re living in the 21st century! Let’s solve this problem using Machine Learning.

Continue readingContinue reading

Anomaly Detection for JS

Internet is an extremly dynamic environment for any application. Vast amounts of data and users make management difficult. Except managing we also need to protect our system from unexpected users’ behaviour or anomalies in data.

For example, if the data we want to check are static and fairly easy to predict, we can use some kind of threshold-based alerting system. But what if data we monitor depends on many conditions, or changing inconstantly across the time? Well, we will need a system which is changing together with the environment our application is living in. This is just another field where machine learning can be applied.

In this post I will show you an example of a simple anomaly detector for JavaScript. Let’s go!

Continue readingContinue reading

JS Keydown event and Japanese characters

Anyone who works currently with web applications focused on Japanese/Chinese market, will surely sooner or later face a problem with word auto-completion. This exactly happened to me a few days ago, when I was working on a portfolio tagging system. The idea was to show hints with the most common tags starting from the letter user typed. Usually, this is done in JavaScript by listening to an event called “keydown”.

Continue readingContinue reading

Onigiri – WebStorage library for JavaScript

Some time ago I had to create a system which was able to save data on a client’s browser. Of course, the most simplest solution which came to my mind was cookies. But I needed a solution in which my data will be accessible for application opened in multiple tabs. I needed a better solution. Soon, I found specification of LocalStorage and IndexedDB, which is a part of HTML5 WebStorage specification. This amazing technology enables you to save data directly on the client’s browser and makes them accessible at any time from any place.

Continue readingContinue reading