The question is: how can we retrieve a owners class of a polymorphic association without loading the owner object into memory? Solution There are (at least) two ways to do this. First one is not recommended (as it might fail with multiple namespaces with same class names, etc: or a better one that will work […]
Read more at the sourceCategory Archives: Software
Karafka (Ruby + Kafka framework) 0.5.0 release details
I’m proud to announce that we’ve released a new shiny version of Karafka: Framework used to simplify Apache Kafka based Ruby applications development. In this article I will cover all the important changes and new features that you will be able to use. Karafka? But what is it? Karafka provides a higher-level abstraction than raw […]
Read more at the sourceRuby: Hash default value – be cautious when you use it
Few weeks ago a friend asked me, why this Ruby example acts so strangely: You may ask, why a hash that clearly has some values in a ‘foo’ key is empty when we print it? Furthermore, why once we delete this key, the values are still present? Everything goes down to the ::new method and […]
Read more at the sourceApache Zookeeper + Apache Kafka start / restart script
During my work on Karafka framework I have to start/stop/restart Apache Kafka and Zookeeper quite often. Here’s a short script that will pull the most recent version of Kafka and Zookeeper, will run them and print their IPs. Note, that it will also stop Kafka and Zookeeper if they were running.
Read more at the sourceKey points to consider when doing a software rewrite
The third post of Low Internal Software Quality series. As well as a big software refactor, a rewrite is not a simple thing either. After many years, we have gotten experience enough to point what you had better consider when planning and executing a rewrite process. Will the two platforms live together for some time … »
Read more at the sourceKey points to consider when doing a big software refactoring
The second post of Low Internal Software Quality series. Doing a big software refactor1 is not a simple thing. There are lots of points that you should think about, from planning and prioritizing to team motivation and execution. Understanding these points in a structured and clear way is part of the job. The good news … »
Read more at the sourceDry-Configurable lazy evaluated default settings
Dry-configurable is a simple mixin to make Ruby classes configurable. It is quite nice, uses Struct and allows you to have default values. Unfortunately, it does not support (yet hopefully) default values that are evaluated upon each setting key request. When would that be useful? Let’s take a simple example: Kafka + Zookeeper. Zookeeper stores […]
Read more at the sourceErrbit + HTTPS: Setting up Errbit reporter (Airbrake v5 gem) to work with self-signed HTTPS certificate
Note: If you’re using old Errbit version (0.2.0, 0.4.0) and an old Airbrake version (v4) please refer to this manual to make it work with self-signed certificates. Having an error catcher like Errbit behind SSL is generally a good idea. Especially when Errbit is hosted on a different server than you application (for example when […]
Read more at the sourceSynology DMS 6 + Gitlab Docker + Gmail
When you’ll setup your Gitlab instance using Synology DMS 6.0 UI, despite the fact that you’ve provided all the Gmail credentials, you will notice that it does not send any emails. You probably end up with a message similar to this one when: EOFError: end of file reached It may sound a bit enigmatic, but […]
Read more at the sourceIntegrating Trailblazer and ActiveRecord transactions outside of a request lifecycle
When you use Ruby on Rails with ActiveRecord, you can get used to having separate transaction on each request. This is valid also when using Trailblazer (when inside of a request scope), however Trailblazer on its own does not provide such functionality. It means that when you’re using it from the console and/or when you […]
Read more at the source