2019 - Coding Bot

Like Us On Facebook

Follow Us On Twitter

Drop Down Menu

Sunday, 14 April 2019

Download You Tube Videos & You Tube To MP3 Converter FREE



Hi friends,

YouTube recently launched its premium services, especially in India, where they have a super huge fan base of artists from all over the world, and not to forget that the people there pushed their channel T-series to YouTube's 2nd most subscribed channel (:P Sorry PewDiePie). But that's not what I am here to discuss today, I am here to tell you about two super cool ways you can increase your YouTube experience without putting a hole in your pocket (Unless you want this software's premium features ofcourse). Without further ado, let's address the elephant in the room.

If you are an audiophile like me, you must be scanning YouTube every now and then to listen to the latest buzz - EDM, Trap, Techno, Deep House, Bollywood (-_-), etc. One problem that I always used to face was if I can listen to these tracks like an mp3 file that can be played via my phone's audio app. There are many online ways to do the same, but specifically two of them outperform the others. And they are:


4k Video Downloader

I have never seen another app that achieves the same with so little input. This app is so versatile that all you need to do is enter the video's URL or playlist's URL and ~BAM~ your download starts.

It has options to control the download video quality and you can also download it as mp3. It firsts downloads the video and then locally creates an mp3 file out of it. 


Friday, 15 February 2019

A Clustering Guide to CrateDB and ElasticSearch

Hi friends,

Recently I ran CrateDB in multi-node environment as a trial and in this post I'll share my findings as to what is the basic setup and configuration that is required to have high availability setup in CrateDB. I am pretty sure that similar settings will be useful for ElasticSearch as well.

I used crateDB version 3.2.2 and Java 8 for this POC.

So there is some bootstrap checks before the server runs successfully. According to the documentation those are some mandatory checks that are mandatory and needed to get the cluster running smoothly in multi-node environment. 

The first problem I faced was related to increasing ulimit in Ubuntu, which I have explained in this post - Increase Open Files/File Descriptors/Ulimit in Ubuntu | CrateDB ElasticSearch.

Once my CrateDB ran successfully, I began to mess around with basic settings and configurations. Remember, many of the things can be customised, and I'll share a few read-worthy links if you truly want to customise all settings around your cluster, towards the end of this post.

So here's the final configuration that worked for me:

Here's the explanation for the non-obvious ones:



Increase Open Files/File Descriptors/Ulimit in Ubuntu | CrateDB ElasticSearch

Hi friends,

This week I faced a rather peculiar issue while trying to setup clustering in CrateDB, which is very much similar to the clustering done in ElasticSearch. As soon as I did the basic configuration which you can find here, starting the process showed the following kinds of exceptions:

ERROR: bootstrap checks failed
max file descriptors [16384] for elasticsearch process is too low, increase to at least [65536]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]


java.lang.RuntimeException: bootstrap checks failed
initial heap size ... not equal to maximum heap size ...; this can cause resize pauses and prevents mlockall from locking the entire heap
please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster
    at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:132)


[WARN ][o.e.b.BootstrapChecks    ] [node-1] max file descriptors [...] for elasticsearch process is too low, increase to at least [65536]
[WARN ][env ] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536]
[WARN ][o.e.b.BootstrapChecks    ] [node-1] max number of threads [1024] for user [] is too low, increase to at least [2048]
[WARN ][o.e.b.BootstrapChecks    ] [node-1] system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk   

The second one which is related to heap size can be very easily solved by specifying HEAP params in environment variables of your system for CrateDB or ElasticSearch. You need to have the same heap size for -Xmx and -Xms. Something like:

CRATE_HEAP_SIZE=2g
CRATE_JAVA_OPTS=-Xmx2g -Xms2g

The other one, max file descriptors, is related to ulimit set on your system. To see your existing hard and soft limits, use these commands in terminal:

$ ulimit -Hn
$ ulimit -Sn

In my case, hard limit was set to 4096 and soft limit was set to 1024 by default.
Also, using this option doesn't work in Ubuntu, atleast not in 18.04:
$ ulimit -n 70000
In order to solve the remaining issue related to max open files or increase file descriptors, just follow these steps and you will be good to go:

  • Go to the following file:

$ sudo vim /etc/security/limits.conf

  • Add the following lines in the file:

* soft nofile 80000

* hard nofile 80000

* soft nproc 80000

* hard nproc 80000

root soft nofile 80000

root hard nofile 80000
  • Save the changes.
  • Next you need to go to the following file:
$ sudo vim /etc/systemd/user.conf
  • Add this to the file and save changes:
DefaultLimitNOFILE=80000
  • Do the same in the following file:
$ sudo vim /etc/systemd/system.conf
DefaultLimitNOFILE=80000
These changes take care that the ulimit is increased for GUI based login.



Thursday, 14 February 2019

Switch Between Multiple Java Versions on Linux

Hi friends,

In my previous blog post - Install Java 11 and Java 8 on Linux, I shared the way to install Java 11/Java 8 on your Linux machine. Now many of the current applications do not support Java 11 yet, so you must need a way to quickly switch between different installations of Java on your Linux machine. Without further ado, let's get started.


Way 1:

If you actually followed my way of installing Java 8/ Java 11 on your machine, and did set Java 8 / Java 11 default by using either of these commands:

sudo apt install oracle-java8-set-default

sudo apt install oracle-java11-set-default

Simply install the other command and it will automatically set that version as default in your system.

Now if you have both the above packages installed and now you want to set either of them as default, simply purge the one you wish to set as default and reinstall it.

So if you want to set Java 8 as default, run these commands in your terminal in order:

sudo apt purge oracle-java8-set-default

sudo apt install oracle-java8-set-default


If you want to set Java 11 as default, run these commands in your terminal in order:

sudo apt purge oracle-java11-set-default

sudo apt install oracle-java11-set-default



Way 2:




Sunday, 10 February 2019

Install Java 11 and Java 8 on Linux

Hello friends,

As many of you must be knowing that Oracle officially ended the support for Java 8 in January this year. What this means for you? You get to try your hands on the latest JDK, which is 11.0.2 as of now. I will cover practical daily-code uses of Java 11 in a separate post soon. But till that time, let's discuss how to install Java 11 on your Linux distro. 

Now since many of your applications might still be using Java 8 and switching to Java 11 on production might not sound the best idea to your manager. This leaves you to find a way to install multiple Java versions on your machine and be able to switch between them in real-time.



In this post I'll share the steps to install Java 8 and Java 11 on your Linux machine and you can find how to switch between these two installations in this post -> How to switch between Java versions on Linux. 



Monday, 14 January 2019

Log4j SMTP Appender Using System Environment Variables

Hey friends!

Earlier last week, I was stuck for a short while in a what should've been an easy task, but took my more than expected working hours to completely solve that: SMTP appender for Log4j.

So as we all know, SMTP or Simple Mail Transfer Protocol is used to send emails from your java program, generally when a particular level of exception occurs in your code. Log4j is a well known Java logging utility, but this particular appender wasn't discussed as about much as I expected earlier. 


LOG4J SMTP APPENDER

Earlier I was using log4j2.yml file for logging but due to some versioning reasons, it wasn't picking up the Log4j keywords properly from the version of Log4j that I added. So eventually I had to shift to using the XML version.



Thursday, 10 January 2019

Fixed — ElasticSearch CrateDB Logstash — ClusterBlockException Forbidden Index Read-Only

Hey friends,

Ever since I started working with ElasticSearch, CrateDB and Logstash, I have faced plenty of issues and exceptions that maybe had a clear reason and fix but were not documented well anywhere. I had to research through tons and tons of documentation and StackOverFlow pages to atleast get some hints as to what might be causing the issue and how to fix it. 


It was then I decided that I will document such problems for easy access and quick solution for others. One such exception that I got multiple times was:



09:46:07.741 [main] ERROR
 io.crate.shade.org.postgresql.util.PSQLException: ERROR: ClusterBlockException: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];
    at io.crate.shade.org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
    at io.crate.shade.org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
    at io.crate.shade.org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)


This was due to:
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] rerouting shards: [high disk watermark exceeded on one or more nodes]
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[INFO ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] rerouting shards: [high disk watermark exceeded on one or more nodes]
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[WARN ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] high disk watermark [90%] exceeded on [Piz Roseg][/crate/
[INFO ][o.e.c.r.a.DiskThresholdMonitor] [Piz Roseg] rerouting shards: [high disk watermark exceeded on one or more nodes]

The Cause:

This particular exception is caused by a very simple problem - Disk Space. You are definitely running out of disk space on the disk where ElasticSearch/Logstash/CrateDB is installed. 



Wednesday, 9 January 2019

Add/Edit Startup Applications in Ubuntu Linux

Hey friends,

I recently switched over to Ubuntu and I must say it feels a better and crunchier experience as compared to my alternate previous OS, the Windows. That said, switching over to Ubuntu brought its own set of problems and Ububtu 18.10 (Bionic Beaver) is not as stable as 17.04 was for me. 

So today I am going to share a very easy way to edit the startup applications on your Ubuntu machine. This approach should work for previous versions as well.

Now just like Windows, there are some startup applications in Linux which can be added/deleted as per your own convenience. Without further ado, let me show you how:

  • The most easy way is to first press Alt + F2 keys together.

  • Then write gnome-session-properties and press Enter. You will be presented with the following screen.