socket.io and its related libraries such as socket.io-redis-adapter and socket.io-redis-emitter had a few breaking changes in either functions or behaviors since v3 which might cause issues during the v2-to-v3 migration. This post lists what was encountered and how to solve it for specific use cases based on hands-on experience.
Since I find myself writing code more and more in JavaScript nowadays regardless of backend or frontend development, I figure out I should at least give it a look seriously, the first time in more than 10 years, and here are the resources I find useful while diving into this long overlooked programming language.
When working under shared linux machine or environment, sometimes it is necessary to hide or protect some files that contain sensitive information, fortunately there is a tool called GnuPG that most Linux distributions already have pre-installed and we can conveniently make use of this tool and this post is about how easy and quick we can use it for a very basic scenario.
Ever wonder where ruby’s defined?
is defined? Because it looks so like a method, you might end up trying to check out a bunch of places, such as: Object
, Kernel
, BasicObject
, or even Class
or Module
, but only to find no luck locating it in any of such places. Well, only until you’ve realized it, the answer is pretty simple: defined?
is not a method but an operator or a keyword.
In rails apps among the commonly-used two popular web servers, unicorn serves requests with worker processes, while puma can do it with both process workers and threads. Therefore, switching to puma from unicorn can not only help improve concurrency but also reduce memory usage. Plus, since rails 5.0, the default web server used is puma.
Upgrading application rails version from 5.1
to 5.2
is much easier than doing from 4.2 to 5.0 or from 5.0 to 5.1, there are very few changes to handle and chances are there is no test failure.
With a gem called activerecord-import, importing a huge amount of records into mysql table becomes an easier task to do, and this post demonstrates how to achieve it.
Upgrading application rails version from 5.0
to 5.1
is easier than doing from 4.2 to 5.0, since it’s only a minor version update. However, there might still be quite a few things to address either from framework changes or due to outdated gems dependency.
RSpec is a popular test framework in ruby.
Rails framework autoloads constants so that in environments like development
or test
, the app does not need to load everything into memory before serving requests. However, autoloading is known to be thread unsafe in rails (at least for versions less than 6), and if you happen to be using threaded servers like puma
or webrick
, it’s very easy to step on unexpected issues caused by multiple threads.