Ubuntu 18.04 uses
systemd to manage services.
To get an overview which services are available and running / not running, you can use
>service --status-all [ + ] acpid [ - ] alsa-utils [ - ] anacron [ + ] apache-htcacheclean [ - ] apache2 [ + ] apparmor [ + ] apport [ + ] avahi-daemon [ + ] avahi-dnsconfd [ - ] bluetooth [ - ] bootmisc.sh [ - ] brltty ...
+ means running,
- means not running,
? means unknown
We currently test most of our gems on Travis CI, but want to migrate those tests to Github Actions. This is a step-by-step guide on how to do this.
Note that this guide requires the gem to use gemika.
git checkout -b ci
mkdir -p .github/workflows; bundle exec rake gemika:generate_github_actions_workflow > .github/workflows/test.yml
If you're experiencing problems with your Google Chrome installation after an update, it might help downgrading Chrome to check if the problem disappears. Keep in mind though that running outdated software, especially web browsers, is in most cases not a good idea. Please verify periodically if you still need to run the old version or if an even more recently updated version fixes the problems introduced in your version.
Here's how to get old versions of Chrome for your Ubuntu installation:
First, go to [UbuntuUpdates](https://www.ubuntuup...
On some of our older projects, we use the mysql2 gem. Unfortunately, versions 0.2.x (required for Rails 2.3) and versions 0.3.x (required for Rails 3.2) can no longer be installed on Ubuntu 20.04. Trying this either leads to errors when compiling the native extension, or a segfaults when using it.
For Rails 4.2, mysql2 version 0.4.10 seems to work okay.
To install it, you have to switch the mysql2 gem to our fork. In your Gemfile, change mysql2 to either
gem 'mysql2', :git =>'https://github.com/ma...
While debugging a SPF record I found spf-record.de to be very helpful.
Also the advanced check at vamsoft.com has a very good interface to test new SPF policies.
Installing old Rubies (<= 2.3) with a standard rbenv + ruby-build is no longer possible on Ubuntu 20.04. This is because those Rubies depend on OpenSSL 1.0 which is no longer shipped with current Ubuntus.
We have forked ruby-build with a workaround that makes it compile and statically link the latest OpenSSL 1.0 version. This works on Ubuntu 20.04, as well as on Ubuntu 18.04.
To switch to our fork of ruby-build, update ruby-build like this
git -C ~/.rbenv/plugins/ruby-build remote add makandra...
It sometimes happen that a database dump, that would want to insert into your development database, does not match the current schema of the database. This often happens when you have an old dump, but your current setup is up to date with the the master.
Hint: In most cases it is sufficient to delete and recreate the local database in order to import the dump. If any problems occur, proceed as follows:
psql some.dump > some.dump.plain
.desktop files define launchers for applications installed on your machine. They specify the command that will be executed when launched, icons, titles, etc. There are two directories in which these files are stored:
# basic installation /usr/share/applications # installed via snap /var/lib/snapd/desktop/applications/
If you're using the webdrivers gem and VCR together, depending on your configuration, VCR will yell at you regulary.
The webdrivers gem tries to update your webdrivers on your local machine. To do so, it checks the internet for newer versions, firing an HTTP-request to e.g. https://chromedriver.storage.googleapis.com
You can "fix" this in multiple ways:
Update your drivers on your machine with
RAILS_ENV=test rake webdrivers:chromedriver:update
Ignore the driver update-URL in your ...
It's possible to install and use multiple versions of PostgreSQL on Ubuntu.
To install multiple (or just different) versions of PostgreSQL on Ubuntu you can add the official PostgreSQL apt-repository to your machine.
In general, the different versions simply run in the background as you expect, but listen to different ports.
Note: Modern Rails has two build pipelines, the asset pipeline (or "Sprockets") and Webpacker. The principles below apply for both, but the examples shown are for Sprockets.
After a recent Ubuntu update I didn't see the main menu bar of the RubyMine IDE (
File | Edit | View | ...) anymore.
This could be solved by changing a RubyMine registry entry:
ctrl + alt + n> click on
registry> click on
linux.native.menuand disable the checkbox
After rebooting RubyMine, you'll have gotten the menu bar back.
Selenium allows you to log all requests to the Webdriver API. Therefore add the following line to e.g.
Selenium::WebDriver.logger.level = :debug
If you want to see the output of the driver itself, here is an example on how to enable Chromedriver logging.
When you run a command like
bundle exec cucumber --format=pretty features/some.feature you will see the API communication before the step is printed (here you see the log for the step
And I press "Save").
Some cronjobs must only run on a single server. E.g. when you run nightly batch operations on the database, it should probably run on a single server. Running it on multiple servers would likely result in deadlocks or corrupt data.
Some cronjobs must always run on all servers. E.g. starting a sidekiq process on reboot.
If not configured otherwise, cronjobs defined in whenever's `s...
Rails middlewares are small code pieces that wrap requests to the application. The first middleware gets passed the request, invokes the next, and so on. Finally, the application is invoked, builds a response and passes it back to the last middleware. Each middleware now returns the response until the request is answered. Think of it like Russian Dolls, where each middleware is a doll and the application is the innermost item.
You can run
rake middleware to get the ordered list of used middlewares in a Rails application:
$> rake midd...
I experienced a lot of issues with google chrome that made it almost impossible to work with it. Here are some of them:
I finally discovered a setting that fixed these issues for me:
Use system title bar and borders
I'm not sure if this setting was changed by me or if it was the browser default.
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 changing MySQL's data directory.
Remember to have a look at AppArmor's daemon configuration (usually at
/etc/apparmor.d/) if you change daemon configuration and run into errors such as the one above.
grep is the go-to CLI tool to accomplish tasks like filtering large files for arbitrary keywords. When additional context is needed for search results, you might find yourself adding flags like
-B5 -A10 to your query. Now, every search result covers 16 lines of your bash.
There is another way: You can easily pipe your search results to the VIM editor and cycle through them.
vim -q <(grep -Hn -r "User" .) # vim -q starts vim in the "quickfix" mode. See ":help quickfix" # grep -...