For a particular table,
SELECT pg_size_pretty( pg_total_relation_size('tablename') );
$ sudo apt-get install build-essential zlib1g zlib1g-dev libruby1.9.1 libxml2 libxml2-dev libxslt1-dev | |
$ sudo apt-get build-dep ruby1.9.1 | |
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2 | |
$ tar xvjf ruby-1.9.2-p0.tar.bz2 | |
Open ruby-1.9.2-p0/ext/Setup and uncomment the zlib line | |
$ ./configure | |
$ make |
Using an HTC Desire (Android 2.2 Froyo), I experienced two weird problems at some time. | |
1. When listening to music with the default player (didn't try others), I wasn't able to adjust the media volume. The media volume bar moved but the volume actually didn't change. This happened only when earphones/headphones were plugged in. | |
2. When having a phone call, the phone automagically switched to using the phone speakers. I had to manually switch the speakers off. Each time. | |
These problems appeared suddenly and were permanent. | |
I familiarized with the problems since I wasn't able to find a solution. I read about some solutions regarding resetting the phone completely and switching it "off and on again" (seriously…). Tried switching it off and on again, no changes. Didn't try resetting it. |
class My::Channel < EM::Channel | |
attr_accessor :watcher, :logger | |
def self.create! | |
channel = new | |
channel.logger = Logger.new 'sinatra.log' | |
channel.watcher | |
channel | |
end | |
def watcher |
# rack_sse.ru | |
# | |
# An example of basic real-time, single-room broadcast chat using Server Sent | |
# Events in plain old Rack. This example does NOT use hijack, or the async | |
# hacks, it just relies on a well implemented threaded Rack server (at time of | |
# writing this will therefore only work with puma!). Other servers should be | |
# fixed to support this, as it is pretty critical to how Rack *should* work on | |
# most servers. The only spec-acceptable failure in this case is not flushing | |
# the content stream on each yield (for which the rack spec has no workaround | |
# today). |
# config/initializers/draper.rb | |
Draper::CollectionDecorator.delegate :current_page, :total_pages, :limit_value, :total_count |
posts = Post.all | |
ActiveRecord::Associations::Preloader.new.preload(posts, :comments, Comment.where('id > 42')) |
# Check server process is using jemalloc | |
# ref. [Japanese] https://tech.studyplus.co.jp/entry/2019/09/09/094140 | |
class AppController < ActionController::Base | |
def show | |
r = `strings /proc/#{Process.pid}/maps | grep jemalloc` | |
render plain: "<h1>#{ENV['LD_PRELOAD'].presence || 'empty'}</h1><pre>#{r}</pre>" | |
end | |
end |
For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.
Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.
FROM ruby:3.1.2-bullseye
RUN apt-get update ; \