This is because, postgres isn’t having a role with this name. To get rid of this error, you need to create this role. Make sure the name of the new role is same as showing in the error message. I suppose its XXX . Lets do this.

Run the following comand:

sudo -i -u postgres

Then login to psql with the default and superuser provided by default i.e postgres . Run this command now.

psql -U postgres

It will take you to the psql shell. Here you can create your role. Run the following command to create a simple role.

CREATE ROLE XXX WITH LOGIN ENCRYPTED PASSWORD 'YYYYY';

This will create a role names XXX with password YYYY .

To see all roles and their privileges, run the following command.

\du

Type \q to exit. We’re done.


I was trying to pull an updated branch and it got stuck with some conflicts. These conflicts were nearly impossible to resolve. You know all the way messy. So the better approach to tackle this issue was to checkout all changes, delete the branch locally, and then fetching the fresh and updated branch. So when I tried and git checkout it ended up with the following error:

error: path '***file***' is unmerged
error: path '***file***' needs a merge.

It’s worth understanding what those error messages mean — needs merge and error: you need to resolve your current index first indicate that a merge failed, and that there are conflicts in those files. …


If anywhere in the HTML document, you want to display text within a specific width in such a way that if stays there in that width. In case the text is too long and going out of that width, luckily CSS provides solution for this.

Use this

text-overflow:ellipsis;
overflow: hidden;
white-space:nowrap;
width: XXXpx;

NOTE: text-overflow:ellipsis; only works when the following are true:

  • The element’s width must be constrained in px (pixels). Width in % (percentage) won't work.
  • The element must have overflow:hidden and white-space:nowrap set.

I have a simple use case:

User has my businesses via membership and Business has many team_members(users) via memberships. While Membership, being bridge table, has only 2 entries i.e business_id and user_id.

And i’m trying to pluck user’s email and business’s name for each membership.

This worked smoothly.

Membership.includes(:user,:business).all.pluck("businesses.name", "users.email")

If you facing this error, may be you haven’t downloaded/installed ngrok setup or may be there was an issue in going through this.

Make sure you’ve followed these steps.

  • Download the zip file.
  • Unzip it.
  • Open The terminal in the current location (inside unzip folder) where you unzip the file.
  • Execute the following command into the terminal :
  • sudo cp ngrok /usr/local/bin
  • Now Run ngrok http 80
    this xpose a web server on port 80 of your local machine to the internet

Now your ngrok execuatable file is successfully copied to the /usr/local/bin directory. Now you are able to run the ngrok command in the terminal


Sometimes, in our DB, we’ve have column with names like maxUser or firstName . In this kind of situations, queries like .having('COUNT(foo.id) > bar.maxUsers' will change maxUsers to maxusers .

Identifiers in SQL (such as table and column names) are case-insensitive unless they’re quoted. Standard SQL says that unquoted identifiers are folded to upper case, PostgreSQL folds them to lower case, hence the bar.maxusers in the error message.

The solution is to quote the offending column name:

.having('COUNT(foo.id) > bar."maxUsers"') 

Note that you must use double quotes for quoting the identifier as single quotes are only for string literals. Also note that identifier quoting is database-specific: standard SQL and PostgreSQL use double quotes, MySQL uses backticks, SQL Server uses brackets, …


Actually, I figured it out … I just needed to replace the Elastic IP with the private IP and configure the security groups properly to allow instances to communicate!

Transferring from Machine A to Machine B

I am running this code on machine A

scp -i ~/Path-To-Key-File/AAA.pem /path/file  ec2-user@<Private IP of Machine B>:/path/file

If you’re going to transfer a directory, use this

scp -r -i ~/Path-To-Key-File/AAA.pem /path/file  ec2-user@<Private IP of Machine B>:/path/file

If you want to transfer data from your local ubuntu machine to a remote server/instance, use this:

scp -i path/to/local/keypair.pem path/to/local/file.ext user@remote-host:path/to/remote/file.ext

If you want to transfer data from your remote machine to local, use…


1. Overview

This tutorial will guide you through the setup of running ubuntu desktop on an AWS EC2 instance using TightVNC on a system running Ubuntu 16.04+.

What you’ll need :

  • Access to an AWS EC2 instance using commandline — This tutorial assumes that you’re logged into the machine using SSH
  • A machine running ubuntu 16.04+
  • Remmina Remote Desktop Client (Pre-installed on 16.04+)

2. Setting up TightVNC on AWS

Let’s install Ubuntu Desktop and TightVNC on your EC2 instance. After logging in to your EC2 instance using the terminal, enter the following commands to install the tools that will be required to run Ubuntu desktop :

sudo apt update
sudo apt install ubuntu-desktop
sudo apt install tightvncserver
sudo apt install gnome-panel gnome-settings-daemon metacity nautilus…

I wanted to run bundle install on my Jenkins project script in the context of a given RVM Ruby Installation. But Jenkins wasn’t able to load/locate installed RVM. After digging into it, I did something like

#!/bin/bash
echo '##################### BUNDLE/MIGRATION #####################'
source ~/.bashrc
rvm use 2.6.5@gemset
bundle install
bundle exec rake db:schema:load RAILS_ENV=test
bundle exec rake db:test:prepare

In my .bashrc I have the lines

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin

It should run now. But in case you’re still facing issue, do this.

#!/bin/bash -l

In the manual it says -l "makes bash act as if it had been invoked as a login shell". So it worked for OP in the local machine so after adding it makes it works in jenkins also.

After these changes, it ran smoothly :)


Sometimes, it happens that after fetching a branch, you still not able to checkout the newly fetched branch. The branch is likely present in more than one remote. (You can confirm this with git branch --list --remotes '*/feature-branch'.) git checkout only creates branches like that if they’re unambiguous. From git-checkout(1):

If <branch> is not found but there does exist a tracking branch in exactly one remote (call it <remote>) with a matching name, treat as equivalent to

$ git checkout -b <branch> --track <remote>/<branch>

So you’ll need to do that instead:

git checkout -b feature-branch --track origin/feature-branch

About

Wajeeh Ahsan

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store