...T06:22:17.484221 #2698200] INFO -- : [53a240c1-489e-4936-bbeb-d6f77284cf38] more Goal When searching through Rails logs on production, it's often hard to see all lines that belong to...

...the same requests, since output of different requests is often interwoven. Instead, we want to find all requests that match a pattern, and then print all lines that share the...

...not be observable by non-jQuery code. This is currently a WONTFIX for jQuery (see closed issues #2476, #3347). Native events always work for everyone Note that if you trigger...

...listeners using jQuery's trigger(). Note that you might use third-party libraries like select2 that use trigger(). If your entire app is written in jQuery and you don't...

...the new way to do it, and it's great, especially in combination with Sprockets (or Propshaft on Rails 7). You might be missing some convenience features, though.

...cover one specific issue: Once you have started your development Rails server and esbuild with the --watch option (if you used jsbundling-rails to set up, you probably use bin/dev...

Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways: Per project, in the project's .gitignore file

Downsides of per-project .gitignore entries While it might be tempting to set it per project (other devs might benefit from it), you need to do it each...

PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or Algolia, but it's good enough if you just need...

...to search and rank large volumes of text. This card will teach you how to index, search and rank your Rails models in a PostgreSQL full-text index. We will...

makandra dev

There are two ways a logout in SAML can happen: Service Provider (SP) initiated and Identity Provider (IDP) initiated logout. I'll explain how to implement both flows with devise...

...on logout and devise does not do that we get a Unsafe redirect to "https://some-idp.example.com/realms/dev/protocol/saml?SAMLRequest=fZJBb9QwEIX%2FSm45zcZx4j...", pass allow_other_host: true to redirect anyway. upon trying to logout.

CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these defaults and adjust for your project wherever necessary.

...also find suggestions on what to change below. Understanding the default configuration Here is the current default config for version 2: config.permissions = 0644 config.directory_permissions = 0755 config.storage_engines = { :file => "CarrierWave...

...issues, depending on the exact version, and depending on your app. However, it is still possible to give some generic advice on how you want to tackle the update in...

...really confident about upgrading Rails, have a look at Rails LTS. How many update steps? Besides the Rails upgrade itself, you might also want to upgrade your other gems and...

...exception of the currently running kernel, the kernel version that was installed on the system before that and, of course, the latest updated version of the kernel. However, it will...

...This could lead to unexpected removal of packages. So please check the output of sudo apt-get autoremove closely. One-shot, manual method sudo apt-get autoremove Automatically remove unused...

...an extra rendering step just for your JavaScript. An example would be: function logBoxHeight() { box.classList.add('super-big'); console.log(box.offsetHeight); // Forces the browser to re-render *now* } Verdict: Make sure you...

...always first read, then write style-relevant values. How to debug: Chrome shows warning icons in the event list in the Timeline for scripts that cause layout trashing. Performance issue...

Get an idea of the varying support for HTML/CSS/JavaScript features in different browsers like Chrome, Firefox, Internet Explorer, Edge, Safari. Look up a few modern features like "subgrid", ":has...

...Understand how we test for older browsers using BrowserStack Ask a colleague for our shared BrowserStack credentials What are "Evergreen browsers"? Understand which browsers you are supposed to support in...

Database connections are not thread-safe. That's why ActiveRecord uses a separate database connection for each thread. For instance, the following code uses 3 database connections: 3.times do

...a new connection end end These three connections will remain connected to the database server after the threads terminate. This only affects threads that use ActiveRecord. You can rely on...

...method to automatically compute an ETag from the given record, array of records or scope of records: class UsersController < ApplicationController def show @user = User.find(params[:id]) fresh_when @user

...by passing an array of ETaggable objects to fresh_when. class UsersController < ApplicationController def show @user = User.find(params[:id]) # The show template also renders the user's posts. fresh_when...

A severe bug was found in ImageMagick by Bryan Gonzalez from Ocelot Team. It allows to embed the content of an arbitrary remote file when ImageMagick parses PNG files.

...on updated Packages for Ubuntu (https://ubuntu.com/security/CVE-2022-44268). Due to that we patched our systems as follows: Ubuntu 22.04: Get package source on a Ubuntu 22.04 system: apt-get source...

...table, two things happen: Rails tries to load all involved records in a huge single query spanning multiple database tables. The preloaded association list is filtered by the where condition...

...you only wanted to use the where condition to filter the containing model. The second case's behavior is mostly unexpected, because pre-loaded associations usually don't care about...

...Plotting graphs in Ruby with Gruff, which comes handy for many uses cases, you sometimes might need configuration for more advanced plots, e.g. for academic concerns. Then using Gnuplot, the...

...first academic open source plotting software, might be a good option. There are several wrappers for Ruby available and I mainly looked at one of the two most frequently used...

...command-line tool for REPL (Read Eval Print Loop). Type gem help info to see a list of available switches. Note that the Ruby API offers a bit more insight...

...Gem Ruby API (at runtime) First, get the Gem::Specification of the gem you are looking for. That object holds all the information from the gem's gemspec file, and...

...gem like accept_language. Customizing Rails error messages for models and attributes Rails I18n scope for humanized attribute names HTML: Making browsers wrap long words Use the same translations for...

...I18n fallback locales Rails: Including HTML in your i18n locales Even for a single language, locales are useful Even if your application only supports a single language, it makes sense...

makandra dev
wiki.debian.org

This note is a reminder that there is something called AppArmor that could cause weird errors ("File not found", "Can't open file or directory", ...) after configuration changes, e.g. when...

...is a gem for working with daytimes. That's a tuple of (hour, minute second) without a day, month or year. Another additional gem? Thus SQL has a time datatype...

...for storing time of day in the format hh:mm:ss, neither Ruby nor Rails themselves offer an elegant way to deal with day times. Time and DateTime both handle...

digitalocean.com

...to be done separatly for each node version on your system, though. Install yarn 1 system-wide via apt The yarn package depends on the nodejs debian package, but with...

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update...

...chapters from The Pragmatic Programmer, anniversary edition (in our library): Chapter 1, Topic 3: Software Entropy Chapter 2, Topic 9: The Evils of Duplication Chapter 2, Topic 10: Orthogonality

...Chapter 5: Formatting Chapter 8: Boundaries Chapter 10: Classes Chapter 12: Emergence Chapter 17: Smells and Heuristics Also read: How to write modular code Keep It DRY, Shy, and Tell...

If you want to find the commits that touched a specific text in a file, use git log -S 'text in the code' -- path/to/file If you use tig you may...

...run a similar command to get a navigatable list of affected files: tig -S'text in the code' Example Here is an example, where the move of the convert_number...

...a MacBook that uses an M1 or M2 Chip. Documentation on the Internet is sparse and not even the Geniuses at the Genius Bar are 100% sure. We found out...

...your MacBook, using more than one external display is only possible with workarounds. Docking stations Whenever you're considering using more than 1 external display, it makes sense to consider...