uday's blog

Rails gem pg install failed - Lessons Learned 6

I created new Rails 7 app using Bootstrap

$rails new stockapp -c bootstrap -j esbuild

$cd stockapp/

$./bin/dev

The application worked as expected.

Then I added pg gem to Gemfile

$bundle install

However, it used to fail to install gem pg and I was getting error

Installing pg 1.4.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 

I solved this by running following command

$sudo apt-get install libpq-dev

$bundle install

How I made space on Digital Ocean droplet

The droplet on Digital Ocean for my Rails project did not have any space left.

Here is how I created space by deleting files.

1. Login using SSH and check available space using $df -h

2. Check disk usage using du command.

$du -h | sort -h

This will list the directories showing the biggest size at the bottom.

I noticed that ./project/shared/log folder was consuming 3.3GB space.

3. In another terminal window, I opened sftp session.

4. sftp>cd project/shared/log

How to add bootstrap 5 to an existing Rails 7 app

I tried to install bootstrap 5 in existing Rails 7 application. The keyword "existing" is very important because for a new application you can try following.

$rails new app-name -j esbuild --css cssbundling-rails (Note: Do NOT miss -j flag to install JavaScript first. In one Youtube video, it was skipped, however it did NOT work for me for a test app I tried to install. Not sure why.)

How to set up Ubuntu 20.04 laptop

Recently, I could not boot into my laptop because the laptop ran out of space. No attempt to resize sda was successful. Since the disk was encrypted, I could not even access my data files.

I had to wipe out my current installation of Ubuntu 18.10 and install Ubuntu 20.04

Here are the steps I had to take to get the laptop ready.

0. Create Ubuntu iso image CD and install Ubuntu 20.04 onto laptop.

1. Install Mullvad VPN client

2. Customize Firefox browser

Raiser's Edge DLL registration

regsvr32 command can be used to register .dll file as command components in the registry.

Windows commands can be accessed from here.

Examples:

1. Unload Research.bat

The file will contain:

regsvr32 /u /s "%programfiles(x86)%\Blackbaud\Research.dll"
del "%programfiles(x86)%\Blackbaud\Research.dll" 

2. Save Resarch.bat