Category: programming

SQLite load test for concurrent transactions using JMeter and JDBC Connection

I came across this article via a Hacker News post. This mentioned that SQLite was able to handle –

400 write transactions per second, and thousands of reads

I’ve recently started implementing applications with SQLite and with journal_mode set to WAL so that multiple concurrent writes could be done. However, I was curious to confirm the concurrent transactions number.

Earlier, I have used SQLite for development but usually on production we would face challenges with the notorious Database is locked error, we would move to Postgres or MySQL. However, I’ve always felt that for 90% of the applications we create don’t require these and was keen to back it up with numbers.

So, I decided to use Apache JMeter to try load testing a sample application.

Continue reading

VSCode terminal tab completion issue

I had logged into my server using VSCode the Remote-SSH extension, and had opened the terminal.

When I enter the ls command and tab, the files and directories auto-complete. However, when I give the mv command, tab completion fails.

After some googling, this Stackoverflow answer helped.

In my .bashrc file, I had to add the following lines –

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

ruby – difference between system, exec and backticks

There are multiple ways to run system commands from Ruby.

They are system, using backticks (‵), using %x(), using exec, or the more advanced option of using Open3. All of them behave in different ways.

system

The system method calls a system program. You have to provide the command as a string argument to this method. For example:

>> system("date")
Sat  4/10/2021   9:11:38
=> true

Note: In Windows, the date command also takes the input to change the system date after displaying the current system date. Press Enter to continue

The invoked program will use the current STDIN, STDOUT and STDERR objects of your Ruby program. In fact, the actual return value is either true, false or nil. In the example the date was printed through the IO object of STDIN. The method will return true if the process exited with a zero status, false if the process exited with a non-zero status and nil if the execution failed.

Continue reading

ruby strftime options

Every time I need to format ruby’s strftime options, I need to search for it on the internet. Putting them down here so that I don’t have to do that again!

Date Formatting 1

%YYear with century (e.g. 2015, 1995, etc)
%mMonth of the year, zero-padded (01..12)
%BThe full month name (e.g. January)
%bThe abbreviated month name (e.g. Jan)
%dDay of the month, zero-padded (01..31)
%jDay of the year (001..366)

Flags

Don’t pad a numerical output
_Use spaced for padding
0Use zeros for padding
^Upcase the result string
#Change case
:Use colons for %z
Continue reading

ruby – update default bundler

Whenever I get this error, I have to again do a google search. So, this post is for me not to do that again!

Could not find 'bundler' (2.1.4) required by your .Gemfile.lock.
 (Gem::GemNotFoundException)
To update to the latest version installed on your system,
run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`

Unfortunately, the suggestions don’t quite work.

The correct way to fix this is to run these three commands:

gem install --default bundler
gem update --system
bundler update --bundler

Courtesy of StackOverflow. (The correct answer on StackOverflow didn’t quite work either!)

ruby Open3 module

What a fantastic module!

Every once in a while I get to know a bit more of Ruby and I feel the joy which Matz talks about!

From: The Philosophy of Ruby

For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, So Ruby is designed to make programmers happy.

Today I was looking for executing a program from within Ruby. Now this program takes command line input and gives some output as well. So, I went around trying the usual %x(program.rb) but obviously that didn’t work.

Finally I came across Open3 which is a core module of Ruby!

Continue reading

ruby Classes and Modules

Classes and Modules in ruby have always intrigued me!

So, I thought I’ll write some code to understand what they were.

Besides the standard Class aspects of ruby, there are a lot of interesting things that can be done with them – like singleton objects.

Modules, of course, give another level of flexibility.

Continue reading

Copyright © 2026 the möbius trip

Theme by Anders NorenUp ↑