Ubuntu Feed

Building a Ractor based logger that will work with non-Ractor compatible code

Recently Mike Perham shared a tweet with this comment and a code sample on the Ruby 3.0 Ractors. If this code doesn’t work, how could Rails ever work? Ractor seems fundamentally incompatible with many heavily-used Rails APIs. require ‘logger’ class Rails def self.logger @logger ||= Logger.new(STDOUT) end end Ractor.new do Rails.logger.info “Hello” end.take During the …

Building a Ractor based logger that will work with non-Ractor compatible code Read More »

How to install PostGIS 2.3 on Ubuntu 16.04 LTS

Hey guys, today about the installation of PostGIS, an open source and OGC compliant spatial database extender for the PostgreSQL database management system. It is similar in functionality to ESRI ArcSDE, Oracle Spatial, DB2 spatial extender and something (SQL Server spatial…?)from Microsoft. It provides outstanding performance and functionality – for free! At this time the […]

The post How to install PostGIS 2.3 on Ubuntu 16.04 LTS first appeared on GIS-Blog.com.

Karafka framework 1.4.0 Release Notes (Ruby + Kafka)

This release mostly solves problems related to message deserialization and normalizes some of the naming conventions to ease during the upgrade to the upcoming 2.0 version. Note: This release is the last release with ruby-kafka under the hood. We’ve already started the process of moving to rdkafka-ruby. Note: If you are using Sidekiq-Backend plugin, please …

Karafka framework 1.4.0 Release Notes (Ruby + Kafka) Read More »

The hidden cost of the Ruby 2.7 dot-colon method reference usage 1

The hidden cost of the Ruby 2.7 dot-colon method reference usage

Note: This case is valid also for the “old” #method method usage. The reason why I mention that in the “dot-colon” context, is the fact that due to the syntax sugar addition, this style of coding will surely be used more intensely. Note: This feature has been reverted. See details here: bugs.ruby-lang.org/issues/16275. Note: Benchmarks and …

The hidden cost of the Ruby 2.7 dot-colon method reference usage Read More »

NameError: undefined method ‘parse’ for class ‘NilClass’ when doing Time.zone.parse

If you get following error when trying to parse time: Time.zone.parse(‘2019-01-01 11:11:11′) Traceback (most recent call last): 16: from /bundler/friendly_errors.rb:124:in `with_friendly_errors’ 15: from /bundle:30:in `block in ‘ 14: from /bundler/cli.rb:18:in `start’ 13: from /bundler/vendor/thor/lib/thor/base.rb:466:in `start’ 12: from /bundler/cli.rb:27:in `dispatch’ 11: from /bundler/vendor/thor/lib/thor.rb:387:in `dispatch’ 10: from /bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command’ 9: from /bundler/vendor/thor/lib/thor/command.rb:27:in `run’ 8: from /bundler/cli.rb:465:in `exec’ …

NameError: undefined method ‘parse’ for class ‘NilClass’ when doing Time.zone.parse Read More »

Karafka framework 1.3.0 Release Notes (Ruby + Kafka)

Note: These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the change logs or check out the list of commits in the main Karafka repository on GitHub. TL;DR If you would prefer to see the changes in the code, here’s the upgrade PR from the …

Karafka framework 1.3.0 Release Notes (Ruby + Kafka) Read More »

Synology DSM 6.2 Photo Station 6 – Failed to Load Data Fix

I’m a quite happy Synology user. For the past years I’ve been using it mostly to backup my things, so I didn’t pay much of an attention to the fact, that the Photo Station software would get slower and slower up to the point when I would end up with “Failed to load data” message …

Synology DSM 6.2 Photo Station 6 – Failed to Load Data Fix Read More »

How to take over a Ruby gem and what to do with it / RubyKaigi 2019 presentation

Using Ruby gems is safe, right? We’re a nice community of friendly beings that act towards the same goal: making Ruby better. But is that true? Can we just blindly use libraries, without making sure, that they are what they are supposed to be? Learn how you can take over a gem, what you can …

How to take over a Ruby gem and what to do with it / RubyKaigi 2019 presentation Read More »

Ruby on Rails HTTP Basic authentication with JSON failure message

A short snippet on how to make Ruby on Rails authenticate_or_request_with_http_basic respond with a JSON valid message upon failure. class ApplicationController < ActionController::API include( ActionController::HttpAuthentication::Basic::ControllerMethods ) before_action :http_authenticate! def http_authenticate! authenticate_or_request_with_http_basic do |key, secret| return if Resource.find_by( key: key, secret: secret ) end render( json: 'Invalid credentials'.to_json, status: 401 ) end end Cover photo by …

Ruby on Rails HTTP Basic authentication with JSON failure message Read More »