Posts

Showing posts from 2017

How do I Extend a Linux partition in AWS EC2

Extending our Linux partition (in AWS EC2) is the resizing of your partition to use the whole disk.

Our running instance size was a Centos with 25GB hard disk space. Now, Amazon has told us that "This instance is scheduled for retirement" and we want to migrate to another instance. We found that we needed a little more space and wanted to extend the linux partition. So, when we created an image, we chose to provide for 50GB in storage.

So, we took a snapshot of the image and launched an instance from the image.

When creating the instance, the size was defined as 50GB. Then, the instance is started. 


The used hard disk space
Before we resized the Linux root partition, of the AWS EC2 instance, we needed to find out the status of the storage now. The df -h command will show us the storage space in the running instance. As seen below, it shows only 25GB.

al@ip-192-230-185-43:~/> df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde1       25G   17G  7.3G  71% /
none        …

How can we reduce the running cost on AWS Server?

Image
Cost Reduction or Saving money on AWS EC2 Instance

In AWS EC2, there are three main elements such as an Instance, a Snapshot and a Volume.

Each of these consume resources such as hard disk space, bandwidth and is costing us money on a daily basis.

The idea is to take a backup of our unused data and source and move them into cloud storage and then delete the dormant instances, snapshots and volumes.

This will result in an immediate reduction in our running costs of AWS EC2 instances. I will briefly explain how we do it, here.

Logon to our Amazon Web Services console and choose EC2.


What are the EC2 elements that cost money?

In the EC2 dashboard main screen, among other things, we will see Running Instances, Snapshots and Volumes. As indicated, these things cost us money, by the hour. Of course, Elastic IPs also cost, but only if we aren't using them.

Of these, the instances will cost us according to the server we have chosen, micro, small, medium, etc. The storage that we use for the serve…

நாட்டுப்பற்றுக்கு ஒரு சோதனை

நாட்டுப்பற்றுக்கு ஒரு சோதனை
வணக்கம். நான் ஒரு கணினி பொறியாளன். உங்கள மாதிரியே நாட்டுப்பற்றுள்ளவன்.  இதுல ஒரு விஷயம் பாருங்க, இந்த நாட்டுப்பற்றை எப்படி வெளிப்படுத்தறதுன்னு பல பேருக்கு தெரியறதில்லை.

நானும் யோசிச்சேன்.

வருஷத்துக்கு ஒரு முறை schoolலயோ, collegeலயோ, officeலயோ, தேசிய கோடி ஏத்தி கீதம் பாடினா ஆச்சா? இல்லை ஒவ்வொரு நாளும் ஒவ்வொரு நொடியும் அந்த உணர்வு நமக்குள் இருக்கணுமா?

நிச்சயமா இருக்கணும். இல்லியா?

சரி. அப்படின்னா மொதல்ல நாட்டுபற்றுன்னா என்னன்னு சின்னதா define பண்ணுவோம்.

நாட்டை பற்றிய ஒரு அக்கறை. நம் நாட்டு மக்களின் மீதுள்ள ஒரு அக்கறை. இந்த நாட்டின் சட்ட திட்டங்களை மதித்து நடத்தல் ஆகியன. இது மட்டும் இருந்தாலே போதும். அதாவதுங்க, நம்மை விட, நம்மை சார்ந்திருப்பவர்களின் நலனை நாம் உணரும்போது, நினைக்கும்போது, நாம் நாட்டுப்பற்று உள்ளவர்கள் ஆகிறோம்.

ஆனா, இது மனசளவுல இருந்தா மட்டும் போதாது. செயல்ல எப்படி காட்டுறது?

கஷ்டம் இல்லை... மிக சுலபம். உதாரணத்துக்கு, சாதாரண traffic signalஐ எடுத்துப்போம். நாம் என்ன செய்யறோம். முதலில், STOP LINE அப்படின்னு ஒண்ணு இருக்கு. அதை மீறி தான் வண்டியவே நி…

How can Cloudflare protect your server?

Cloudflare to safeguard your server
This message is not an endorsement of Cloudflare and its services. 

This is just a reflection on how we have been using Cloudflare for dns and basic site protection for many of our sites.

For those who do not know, Cloudflare is one of the best available CDN services. CDN stands for Content Delivery Network, which is a man in the middle software application which delivers your website content to your customers, while at the same time protecting your server from people and sites with malicious intentions.

Cloudflare FREE basic protection

The Cloudflare basic protection is free and is good enough for most sites, but if you are a site with a lot of hits and need better protection, you may opt for their business or enterprise plan though.

Some of you may have the question of "How do I setup Cloudflare for my webserver/website?" Here is an indication of what you need to do to put your site up on cloudflare.com.

Get yourself a Cloudflare accountAdd you…

Is the world a fair place?

Is the world a fair place?
May be you wished to ask "is nature cruel?"
An honest and experienced opinion would be "Nature is Just". And nature at all times, gives us only what we deserve. 
Nature gives us experience every moment of our lives, in order for us to learn from it and elevate ourselves in our quest for the truth.
What is required of us is to accept the fact that nature is always working towards our betterment. The experience and understanding of life would be different for each of us, depending on how advanced our souls are. Those near the top end of the pyramid would probably be able to see the truth in the short anecdote that follows.
Left side mirror in automobile needs to be replaced. Customer gets a call from dealer. Customer is upset and angry when representative told the painting work will be done only after customer visits the dealer.
After sometime, the dealership called and said the spare part would be sent across to the customer's address. But, …

NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP) Cannot communicate securely with peer: no common encryption algorithm(s)

NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP) Cannot communicate securely with peer: no common encryption algorithm(s). * Closing connection 0

I encountered a link which told me to update nss to fix the issue, like so.

If you're on CentOS 7 and are getting these errors while using yum, updating nss nss-util nss-sysinit nss-tools will fix it.

But, then, it did not seem to solve my problem, while setting the "setopt" option in curl for SSLVERSION seemed to fix it, magically.

See below:

The problem was sorted out when the following options were set in the curl_setopt() before calling curl

curl_setopt($ch, CURLOPT_SSLVERSION, 6);

Problem SOLVED

SOLVED: sftp Error: Connection timed out after 20 seconds of inactivity

Error:Connection timed out after 20 seconds of inactivity
I just want to share a peculiar sftp connectivity issue that we encountered recently.
This is the message we got when trying to connect to the server using sftp
Status:Connecting to mydomain.com... Response:fzSftp started, protocol_version=8 Command:keyfile "somefile.ppk" Command:open "user@mydomain.com" 22 Error:Connection timed out after 20 seconds of inactivity Error:Could not connect to server
We usually connect to my remote server using sftp to upload and download the work files.
All was well till yesterday, when suddenly, the connectivity to the server was not happening.
We distinctly remember being able to connect till sometime back, before the above error cropped up suddenly.
We were breaking our heads as to why the connection was not happening.
Rolled back in time and evaluated the things that we did during the past hours. It was suddenly that we got a brainwave that solved the problem.
The explanation:
It occurre…

Maximum allowed value for a string variable content in JavaScript

What is the maximum string content that can fit inside a Javascript variable?

I had this requirement where my Ajax script would return a sizeable amount of data for processing.

It was at this moment that I wondered if the returned value would fit inside a variable. I browsed through some of the available feedback in a Google search.

Most of them opined that there is no limit on the string variable content.

How do we check the maximum value for a string variable?

So, I thought, "let us check it in real time".

As per my test, I found out that a large string with a length of 102400 was initialized without generating any JavaScript error.

I am sure, nobody would require anything more than this inside their JavaScript variable.

Here is my statement:
I tested by initializing a JavaScript variable, in the browser console, with over 100,000 characters without an error.

My test machine was an I7 with 4GB of RAM.

What is Spirituality?

Essentially, spirituality is the individual's search to understand the Universal truth.

So, what is the Universal truth?
It is a fact that we are all in this world, to play endless games (re-births! Are they for real? We will discuss this later), to make us ready for the next stage in our evolution.

Over the course of time, we will try to find logical and rational reasons for the meaning of life on Earth.

Spirituality is a subject that we learn, like any other.

And like any subject, the students of spirituality rank from being in the kindergarten to the ones who have achieved the doctorate level.

One tends to understand inherently the ways and means of the cosmic system and consciousness over a period of time.

One trait I have seen in spiritual people is compassion for self and other fellow beings, humans, animals and others; a universal love which encompasses all the living and non living beings.

A spiritual being does not want to disturb nature. He/she enjoys being one with nature; blen…

Solved "XAMPP: Couldn't start MySQL!"

The error XAMPP: Couldn't start MySQL!seems to be an issue related to one or more corrupt log files; system running Red Hat. It was sorted out by the following steps.
Corrupt log file in MySQL
A review of the error log revealed the following 
170308 19:44:18 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ip-192-168-2-1.pid ended 170308 19:48:20 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql 170308 19:48:20 [Note] Plugin 'FEDERATED' is disabled. 170308 19:48:20 InnoDB: The InnoDB memory heap is disabled 170308 19:48:20 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 170308 19:48:20 InnoDB: Compressed tables use zlib 1.2.3 170308 19:48:20 InnoDB: Initializing buffer pool, size = 512.0M 170308 19:48:20 InnoDB: Completed initialization of buffer pool InnoDB: Error: log file /opt/lampp/var/mysql/ib_logfile0 is of different size 0 5242880 bytes InnoDB: than specified in the .cnf file 0 134217728 bytes! 170308 19:48:20 [ERROR] Plugin 'I…

Debugging jQuery Code for dummies

At least some of us might have learnt jQuery the hard way.

As it has been said for a long time, the best way to understand jquery or any other code is to read through code written by other people. jQuery is unique because it uses html and css flags to make things happen.

Debugging jQuery code is sometimes not easy, even with some experience. This is because, parts of html and JavaScript code are linked together by a id or a class.

Steps to debug jQuery
I will try and explain the steps by way of a html and jQuery code example below.

Find the trigger word
You see, buttons or links are created with id or class and the id and class names are then used to trigger activity.

In one part of the code, there will be something like

Edit
Save

There are events that trigger an action. The event may be on an input field, a list box a submit button or something else; and the event may be a change in the field, a click on a field, a mouse over action, a mouse out action and other such events.

Locate the trigger …

The Secret to a Better Life

Is there any one thing, which if we do, we will have a better future?
I would say "Yes, there is".

BE STILL! Do nothing!
Essentially, we are all spiritual beings, who are here for a reason. We are given a chance to live life in a manner that benefits us and others.

As we see, each one of us experiences life differently, based on our past experiences, our past acts done out of anger, humility, love, greed and so on.

But, because of our limited knowledge of the universe and its workings, we are happy during good times and during bad times complain that God is being cruel to us for no fault of ours.
What we fail to realize is that whatever experiences that we are going through in our life, it is all the result of an accumulation of past activities; ours, our ancestors and our society. It has been called many names from ancient times, but for the sake of better understanding, we will call it Causal action.

The Buddha Story
You must have heard about this story about the Buddha. He used …

Why is there so much suffering in the world

If God is real then why is there so much suffering?
How can there be a God who can allow all this atrocities to happen?

These are the kind of questions that arise in most minds, whether they follow any of the world's religions such as Christianity, Buddhism, Islam or other religions or atheism or neutral in their belief.

The philosophical answer to this is that it is the destructive actions of humans that caused it. Then, the reactions of humans to the ills happening to them perpetuates it.


The top executive is concerned with macro issues
The logical answer to this is that assuming there is a God, He is not coming down to help you out of a fix, in the same manner that President Obama or whoever is your head of state, is not going to come down to you and help you out of a fix.

The top person never addresses micro level problems; their focus is at the macro level.


We are responsible for our actions, nobody else
Next, whatever problems that we are in, are the result of our past actions. This…

Steps to install wkhtmltopdf in Centos 7 Redhat

Steps to install wkhtmltopdf in Centos 7 Redhat
As you may know, wkhtmltopdf is a tool that is used to create a pdf on the fly from the Linux/Unix shell from any html document
Step 1 is to create a html document
Step 2 is to call wkhtmltopdf with the html document as input and pdf as output

But, before that, we need to install wkhtmltopdf in the Linux server machine.

Install wkhtmltopdf in Centos 7

Before we install wkhtmltopdf, we need to install the dependencies or support packages, which are required for wkhtmltopdf to work as expected.

So, we execute the following steps.

i. sudo yum install -y xorg-x11-fonts-75dpi
ii. sudo yum install -y xorg-x11-fonts-Type1

Let us get the rpm package from the link gna.org using the link below.
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

sudo rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

error: Failed dependencies:
        libXext is needed by wkhtmltox-1:0.12.2.1-1.x86_64
        libXrender is needed b…

Call to undefined function mcrypt_encrypt() in ... on line ...

Call to undefined function mcrypt_encrypt() in ... on line ...
When porting from my local server to the live server for testing, the php page was not loading and returned an Error 500 or Internal Server Error.

Analyse Apache error logs
As a first step, we tried to analyse the apache error logs to shortlist the reasons. The following line seemed to hold the key to the problem.

PHP Fatal error:  Call to undefined function mcrypt_encrypt() in /path/to/myAppFolder/myFile.php on line 13

Identify the problem
Missing php-mcrypt module
The issue seems to be related to a missing module in the Centos server. The php program was using the php-mcrypt module and it was not yet installed on the server yet.

Install php-mcrypt and restart Apache
So, we installed the php-mcrypt module using the below command

sudo yum install php-mcrypt

As a final step, we restarted the Apache Web Server

sudo systemctl restart httpd

Calling the php program now does not generate error now. Problem of Call to undefined function mcryp…

Ajax call not working as expected in Firefox

Ajax call not working as expected in FirefoxOkay, I had this peculiar problem of my web form updating the relevant tables when being called from Google Chrome and not doing so, when the call was made through Firefox.

The form went into sleep and did not respond after the Submit button was clicked. It looked as if the Ajax call was in indefinite loop in Mozilla Firefox.

As we went digging for reasons that this was happening, we realised that Firefox is strict about how data has to be sent to it.

Google Chrome is someone who tries to make sense out of the data and so, we got away with Chrome.

So, we understand that what we need to return from a php, which is being called through an ajax request, is content preceded by a header, which indicates the type of content that follows.

It could be any of these types as defined below.

Header Content-type: Common examples:
application/json
application/x-www-form-urlencoded
application/pdf
multipart/form-data
text/html
text/plain image/png
image/jpeg

image/gif

So,…