...low-level logic and have good reasons to do otherwise, probably stick with option 1.
...for the root user and you prefer using a password for root. Solution Step 1 is getting a root mysql shell that allows us to change user credentials. We need...
...MariaDB [mysql]> UPDATE user SET password='', plugin = 'unix_socket' WHERE user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 Re-read permissions
irb(main):001:0> require 'json' => true irb(main):002:0> JSON.parse('{"qty": 1, "qty": -1}') => {"qty"=>-1} Character Collision irb(main):009:0> JSON.parse('{"qty": 1, "qty\ud800...
...incomplete surrogate pair at 'qty\ud800": -1}') irb(main):007:0> JSON.parse('{"qty": 1, "qty"": -1}') JSON::ParserError (784: unexpected token at '{"qty": 1, "qty"": -1}') This one was unexpected...
...PDF file, you can use ghostscript to compress embedded images: ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=new-smaller-file.pdf large-original-file.pdf Note that your PDF printer (or similiar...
...put this snippet into your ~/.bash_aliases: alias pdf_compress='_compress(){ ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$1".c.pdf "$1";}; _compress' Reload aliases (source ~/bash_aliases) and...
...and weekdays differ. Times are formatted differently in different regions. Some regions use a 12 hour clock instead of 24 hours. Numbers and money amounts have different fractional separators and...
...has many issues that can lead to stored timestamps being off by some hours (1, 2, 3, 4). You can control this, but you will shed tears.
...next if [:string, :text].exclude?(column.type) attribute_name = column.name class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{attribute_name}=(value) super(value.to_s.strip.presence) end RUBY end rescue PG::ConnectionBad, ActiveRecord::StatementInvalid
...9200/my_documents Index ansehen: http GET :9200/my_documents { "my_documents": { "aliases": { }, "mappings": { }, "settings": { "index": { "creation_date": "1556793804746", "number_of_replicas": "1", "number_of_shards": "5", "provided_name": "my_documents", "uuid": "Q9nNksJhT3Ky7SOqDQa4bA", "version...
...PUT :9200/my_documents/post/1 { "title": "A sample document", "body": "I wrote something", "author": { "name": "Tobias" } } { "_id": "1", "_index": "my_documents", "_primary_term": 1, "_seq_no": 0, "_shards": { "failed": 0, "successful": 1,
...than a few months, it may stay at level 2. Never go below level 1. 0. Working code You have implemented that feature and it works. Congrats! You have reached...
...three levels of code quality lie ahead. First, make sure your code is reliable: 1. Reliable code In order to reach the baseline for good code, make your code:
accepts_nested_attributes_for :invoice_items, :allow_destroy => true # the critical code 1/2 before_save :calculate_and_store_amount # the critical code 2/2 private def calculate_and_store...
accepts_nested_attributes_for :invoice_items, :allow_destroy => true # the critical code 1/2 before_save :calculate_and_store_amount # the critical code 2/2 private def calculate_and_store...
IRB 1.2 (shipped with Ruby 2.7, but works on 2.5+) brings pretty syntax highlighting and multiline cursor navigation. However, pasting longer contents is incredibly slow. You can fix that by...
...disabling said features. [1] Ruby 3.0.0-pre2 solved the issue (however, the fix does not appear to be included in IRB 1.2.6, it must be Ruby itself). Option 1:
...the application again. How can we invalidate old session cookies on logout with Devise? 1) Reset password The only option provided per default by Devise is to change the password...
As mentioned above, the esbuild_error_development.txt file must exist for Guard to watch it. [1] Sadly, Git does not offer a way to add a file and ignore further changes...
...esbuild, and break stuff. You should see error messages be delivered by your application. [1] Side note: Our implementation of the controller module also expects the file to exist. If...
...the commit I want to fixup: alias fixup='git log --oneline | fzf | awk '\''{print $1}'\'' | xargs -I '\''{}'\'' git commit --fixup {}' After you have used fixup you still will have run...
.../etc/fstab are meaning? The first number fs_freq When this field is set to 1 dump(8) will make a backup of the partition. Not using dump for backups? You...
There are multiple ways to redirect URLs to a different URL in Rails, and they differ in small but important...
...node-sass with esbuild. See here - you have to downgrade esbuild-sass-plugin to 1.x for that, because 2.x does not support node-sass anymore.). add libraries, that...
...gedacht. Du kannst das nicht alles lesen: Gesamter TCP/IP Guide Ziele Was ist RFC 1918, welche Bereiche sind es und wofür sind diese? Du weißt, wofür man NAT verwendet und...
...wie es funktioniert Du kannst diesen tcpdump-Output erklären: 13:33:37.560666 ARP, Request who-has 10.0.1.42 tell 10.0.1.56, length 28 13:33:37.561108 ARP, Reply 10.0.1.42 is-at...
:file => "CarrierWave::Storage::File", :fog => "CarrierWave::Storage::Fog" } config.storage = :file config.cache_storage = nil # (1) config.fog_attributes = {} config.fog_credentials = {} config.fog_public = true config.fog_authenticated_url_expiration = 600 config.fog_use_ssl...
...with HTTP code 422 Unprocessable Entity instead of the default 200 OK. This is (1) to be a good HTTP citizen and (2) to allow frontend code like detect a...
...functionality with a lot of code: https://github.com/jquery/jquery/blob/master/src/event.js Overhead of adding and removing 1000 event listeners Method duration Element#addEventListener() 11.3 ms native code $.fn.on() 60.3 ms
...of userland code up.on() 15.9 ms ~ 130 lines of userland code Overhead of adding 200 elements to an Array vs. adding to a jQuery collection Method duration Array.prototype.push()
...in our library) Everyday Rails Testing with RSpec (in our library) Concentrate on chapters: 1 (Introduction), 2 (Setting up RSpec) 3 (Model specs) 4 (DRY enough specs) 8 (Testing the...
...have a reference to their parent uploader class DemoUploader < CarrierWave::Uploader::Base process :resize # 1 before :cache, :do_something # 3 version :thumb do # 2 process :crop end private
...provides strong results at a lower cost. However, due to its significantly higher cost—$186.5 compared to $18.16 for o3-mini—o1 is best suited for highly analytical and complex...
...your database, you might run into an error like pg_restore: error: unsupported version (1.15) in file header This is because your local pg_restore version is too old to...
...doesn't matter here. For example, the official Ubuntu 20.04 sources include only PostgreSQL 12, so your pg_restore version will also be v12. Ubuntu 22.04 includes version 14 in...