Fix : The repository ‘http://archive.ubuntu.com/ubuntu disco-backports Release’ no longer has a Release file.

Issue : When doing an apt update, we get the this error.
The repository ‘http://archive.ubuntu.com/ubuntu disco-backports Release’ no longer has a Release file. N: Updating from such a repository can’t be done securely, and is therefore disabled by default.

fix :

[bash] vi /etc/apt/sources.list replace all occurrences of archive.ubuntu.com to old-releases.ubuntu.com [/bash]

Cannot connect to DB from a process inside Docker container ? This could fix it.

I had recently hit a blocker to production deployment, when my processes just won’t connect to my Cassandra DB from within their containers.

This is how I could fix it –

  • Start by checking if the target port is open. For eg, if it is the Cassandra DB that the processes cannot access, make sure that its host port 9042 is not blocked by any firewall rules (or security group settings in case of AWS)
  • From the host machine where your docker’ed process has a connectivity issue, use telnet or netcat to check if you can access the target machine and port.

  • Once you verify that you can access the port of the service you want to access, from the host machine where your docker process is failing, and still the problem persists, do these steps-
  • Verify the IP address of the problem container –
  • If the IP address so obtained is found to be conflicting with the IP addresses of your network, provide a new sub-net for the the docker containers within the host as below-
    • vim /etc/docker/daemon.js
    • Add the following lines with the subnet address of your preference
  • Restart docker service and start your containers.
  • Check your connectivity issue is solved.
  • If your application still cannot connect to your target service, lets reset docker by deleting the docker inventories and restarting it-
  • The above steps usually fixes the faulty bridge network created previously by deleting and recreating it.

Else, as it happens mosltly, you are on your own 🙂

Best of luck for your resolution, and please comment if you have have a different solution to the problem.

Open ports in Ubuntu’s firewall using IP Tables

On the terminal, do the following to open port 80

Persisting the rule changes across boot cycles –

iptables-persistent will look for the file “/etc/iptables/rules.v4” after boot up, to restore the rules for IPV4, thus automating the restore for each boot.

Make a new disk available in Ubuntu on AWS

To make a new disk you just added to the Ubuntu device, please go through the following steps –

Check whats the /dev path of the disk. On terminal, run-

lsblk

NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  97M  1 loop /snap/core/9289
loop1         7:1    0  18M  1 loop /snap/amazon-ssm-agent/1566
nvme0n1     259:0    0   1T  0 disk 
nvme1n1     259:1    0  10G  0 disk 

You would have got a result as above.

In this case, the disk I wanted add is the 1 TB disk, which is /dev/nvme0n1

Format the disk with a new compatible filesystem (XFS).

sudo mkfs -t xfs /dev/nvme0n1

Wait for the file-system creation to finish.

sudo mkdir /data
sudo mount /dev/nvme0n1 /data
sudo cp /etc/fstab /etc/fstab.orig
sudo blkid

From the output of the last command, find the UUID of your disk

sudo vim /etc/fstab

Append the line –

UUID=[your disk's UUID]  /data  xfs  defaults,nofail  0  2

Note that in the above replace your disk’s UUID without the square brackets, and save the file.

sudo umount /data
sudo mount -a
df -h

Verify that /data is listed as a disk in the last command. If not, please check the /etc/fstab file, apply correction of UUID, spaces etc, and repeat the above test block again.

Machine Learning – the basics

Hey there !

So you are a programmer, wanting to master machine learning ?

You are at the right place.

Lets get started.

So, what exactly is machine learning ?

We as programmers, have been programming some pretty complex algorithms, which made our computers really smart. So how do we understand machine learning from the perspective of programmers ?

Machine learning and programming achieves the same purpose – as in both makes the computers do some useful work for us. The approaches are in exact opposition to each other.

While programming is about setting the rules to reach a particular output from inputs, machine learning is about finding these rules from existing output and work inwards.

While programming is intrinsic logic directly added by a programmer, machine learning is extrinsic – existing output data massaging a malleable function into shape, so that this function is the “new program” which can be put to use to find outputs from new previously unseen inputs.

And whats Deep learning ?

Its very tempting to help a function (which works backwards from output data) with what we know about the domain of the problem.

For example, when predicting the prices of houses in a city, we naturally would make use of our knowledge that it’s location in the city, the area of the house etc have a direct bearing on its price. These are called features of our function, which has to find the importance of each feature in predicting the output by working backwards.

Machine learning is what we call the data driven shaping of solution function (or program) when the features or the broader input variables are set by us.

When we have enough historical data (of inputs vs outputs) we have the luxury of the letting the function decide for itself which inputs are actually features (have a say in the output). This is more like larger program which makes use of sub routines to filter input signals to allow only relevant ones to enter the main routine. Only that the main routine and sub routines – all are shaped up by many iterations of massaging inwards by the historical data. Such a system which does automated feature selection and predicts output from the features so found, is know as a Deep learning system.

Deep learning systems obviously have more stacks of variables layered between input to output, to facilitate filtration or amplification of input signals as the need be, in preceding layers.

Fixing Cqlsh Import Error

Problem:

Running Cqlsh exits with the error :

from cqlshlib import cql3handling, cqlhandling, pylexotron,sslhandling, copy
ImportError: No module named cqlshlib

Fix:

Set right python path

find /usr/lib/ -name cqlshlib
#assume you got the result as /usr/lib/python2.7/dist-packages/
export PYTHONPATH=/usr/lib/python2.7/dist-packages/