Waiting for a new project (I am so excited about a new one!) is a good time to go back to recent problems. (Un)fortunately some time ago me and my colleague noticed problems on the one of our production servers. After a few hours we discovered the reason. There were two things - our lack of knowledge and a little bug in
ruby-kafka gem. Debugging was really fun, so I decided to describe it.
CRuby has a Global Lock Interpreter, that imposes certain limitations on us. I wrote about it a bit in my previous article.
The most common way to use concurrency in Ruby is to use
Threads, but do you heard about
multiprocessing that allows as to parallel execution?
Machine Learning is like a magic word now - for sure you have heard something cool about it, a lot of developers tried to build some models using ready to use libraries like
scikit-learn, but still some of us are affraid of it. But do you know that you can implement your first ML algorithm for your own. I read some time ago, not sure where, that k-Nearest neighbors is the first what you should try if you are interesting in ML.
I thought that it could be good excercise to write script that will use graphs to find “cheapest way” using some algorithm. I know that there are probably plenty of ready, well tested libraries which we can use but that’s not the way - we don’t want to use it, we want to create it!
One think I really like in Rubymine is that it knows where are classes are and thanks to that we can move to them with one click. After moving to VIM I installed vim-definitive plugin that adds this future. Unfortunatelly, it doesn’t work with ruby gems, we can go to definitions in project, but not to gems.
ActiveRecord provides a bunch of useful methods. One of them is a
find_or_create_by which is cool, because it avoids using IF statement.
Unfortunately, as in life, everything that is easy to use, isn’t always optimal. Under certain conditions, we may encounter some problems. Sometimes, even though it will work on one thread well, doesn’t mean it will be working correctly on parallel.
If you’re using VIM, you have probably noticed, that after update to Mojave your VIM has some problems..
In times of great and powerful IDE’s - VIM looks poor. It’s a fact - my default VIM offered only 8 colours. Magic is hidden - we only need to turn it on!
Form objects separated into a new classes are great for separating views from business logic. They are especially useful when we update one model, for example user details, on a few steps.
Recently I was preparing a list of things to learn for my friend who decided to change his profession. There are a lot of books and tutorials, but it would be wise to plan the learning process. I thought it would be a good idea for my first post.