Author: abhijit

Run Postgres exposed to the internet

Although this is not recommended, there might be scenarios where there are no other options.

An example is an analysis software which doesn’t give the capability to connect via SSH. I came across this scenario when someone wanted to use QLik. Although this has a lot of capabilities, but when something like this is required, I’d rather use the open source and free Metabase.

Continue reading

Backup / Restore Postgres, MySQL, SQLite database using Sequel

Sequel is a fantastic ORM available in Ruby.

It also comes with an IRB console so it can be run directly from the command line with various options.

For example, to console into an SQLite database testdb.sqlite in the current directory –

$> sequel sqlite://testdb.sqlite

Or for Postgres –

$> sequel postgres://dbuser:dbpassword@localhost/testdb

However, I use sequel most frequently to take quick database backups or to restore them.

Continue reading

ExtJs – Bindable allowBlank

ExtJs does have a attribute for required by the allowBlank configuration against fields.

However, this configuration doesn’t have a setAllowBlank or a getAllowBlank method, because of which, it is not possible to bind those fields via the viewModel. So, usually, those fields have to be somehow fetched in the Controller and then that attribute.

This situation can however be remedied very easily.

Continue reading

ExtJs – Monthfield Picker

ExtJs, by default, doesn’t provide a month picker.

A monthfield picker allows you to choose specific months only.

The customization that was required, was to have a start date and an end date for those months, so that at the end of the operation, those specific dates could be saved.

Continue reading

setup Tiddlywiki with NodeJs server

I’ve always been fascinated by TiddlyWiki, which is considered a personal wiki and non-linear notebook (Wikipedia).

The main reason that was holding me back from using it was that every time I make changes, I would need to save it explicitly or use some browser extension.

I then discovered a very nice Tiddlywiki server on NodeJs (link).

I also wanted this to be password protected and this server provides simple and easy ways to do all that.

Continue reading

Install and run Metabase

Metabase is a data analyzer and visualizer tool which can connect to many types of databases.

It can do some smart analysis as well as let you write proper SQL queries to create charts and graphs.

Metabase is a Java application which can be run directly. Conversely, it can also be run via Docker.

Continue reading

error while running rake task – “Don’t know how to build task”

The default method to pass arguments to Rake tasks is to give the parameters in square brackets –

desc 'Method #1: Use the default rake way to add two numbers and log the result'
task :add, [:num1, :num] do |t, args|
  puts args[:num1].to_i + args[:num].to_i
end

Reference: 4 ways to pass arguments to a Rake task

$ rake add[1,2]
# => 3

However, I would rather pass the arguments like this –

$ rake add 1 2
# => 3
Continue reading

Setup up READ_ONLY users on Postgres

To grant access to users for only viewing a database (i.e. no INESRTs or CREATE or UPDATE access) there are certain conditions.

First, access should be only allowed through ssh.

Second, the ssh user should not be able to get into a shell directly.

And finally, the database should restrict access to that particular user with relevant permissions.

Continue reading

Copyright © 2024 the möbius trip

Theme by Anders NorenUp ↑