Thursday, September 18, 2014

Install MongooseIM on Ubuntu

Ever wondered what awesome technology is used behind WhatsApp which was sold at $10B? It's MongooseIM. And here's how to get you started using it, in Ubuntu..

Install the Pre-Built Package:

wget http://packages.erlang-solutions.com/site/esl/mongooseim/FLAVOUR_1_main/mongooseim_1.4.0-1~ubuntu~trusty_amd64.deb

dpkg -i mongooseim_1.4.0-1~ubuntu~trusty_amd64.deb

Configure it

cd /usr/lib/mongooseim/etc
vim ejabberd.cfg

Run it

mongooseimctl live

Monday, June 30, 2014

Linux: Deleted a File and Its NOT Freeing Up Space?


There is only one reason for it - the file is held by a process.

To fix the issue:

1) Find which process is holding it.

Check open files and return the process using an unlinked file (deleted file)
# lsof +L1

2) Kill the process

# kill -9 <pid>

For a graceful kill but can/may take a while.

# kill -15 <pid>

Friday, May 30, 2014

PayPal: You must specify valid values for the A3, P3, and T3 parameters


When you the error "You must specify valid values for the A3, P3, and T3 parameters" it means that the values you sent to PayPal are invalid.

It could mean that,

1) A3 is not a number
2) P3 is beyond the acceptable limits
3) T3 is not valid.

Usually, the problem is a combination of P3 and T3 issue.

In my case, it was sending more than 24 mos for P3. The solution is to convert T3=M to T3=Y and change the P3 to rounded up years, so P3=3. This solve the issue. I wasn't able to find any documentation associated with the acceptable ranges and user inputs to these 3 required parameters for integration recurring payment button.

Sunday, May 18, 2014

Install Jenkins on Ubuntu/Debian

If you wish to install Jenkins (fork of Hudson, maintained by original developers), do the following:

sudo -i
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-get update
apt-get install jenkins


Note: make sure JAVA is installed.

Install ElasticSearch 1.0.x on Ubuntu/Debian

ES released an apt-get repo for ElasticSearch. It is the recommended package-driven deployment.

sudo -i
apt-get install openjdk-7-jre-headless -y
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -

vim /etc/apt/sources.list

#Append the following, then save

deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main



apt-get update
apt-get install elasticsearch


service elasticsearch start

Thursday, May 15, 2014

Yum Install ElasticSearch 1.x

Note: Works for CentOS/RHEL/Fedora.
rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-1.0]
name=Elasticsearch repository for 1.0.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.0/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
yum update
yum install java-1.7.0-openjdk.i686 -y
yum install elasticsearch

Start ElasticSearch

/etc/init.d/elasticsearch start

If you are wondering where the data directory is for this installations steps, it is stored at:

/var/lib/elasticsearch/elasticsearch

Monday, March 24, 2014

The Idiot PHP Developer's Creed

I am a PHP Developer and this is my creed.

PHP is the best programming language, ever. 
I don't need no framework or library, my native code is light and fast.
I can code anywhere, as long as it works, it is correct.
I don't need OOP,  best practices, design patterns, software architecture and all that crap. They slow me down.
I rate myself 9 out of 10 because I memorised most of the native functions or pretend to be.
I rate myself 10 out of 10 because I can build a shopping cart website within 3 days or because of whatever. 
I prefer the use of arrays because they are better than objects.
I believe project managers, business analysts and QA are useless.
I don't have to test my work, somebody else should.
I don't have to look at the error logs, my code is perfect.
I copy-paste code that the first page of my Google search results which seems cool and working.
I don't need to understand what I copy-pasted.
I claim the copy-pasted code as my own and grin with pride.
If my code CANNOT be understood, then I am super awesome.
The hardest thing I did is to build a website using WordPress.
I don't need Math, Statistics, Science, or Business to level up in my field. I can do anything with PHP.
I develop PHP using WAMP and use a Windows-based IDE while production deployment is in Linux/Unix.
I use get_browser() function to detect user agent.
I use static methods, globals, constants every chance I get. 
I only need if-then-else to implement logic and algorithm. The longer, the better. I love spaghetti.
I loop through an external resource call.
It takes an FTP uploader to deploy my code.
I have hardcoded stuff everywhere.
I don't need to document my code or put doc blocks for that matter. It takes away precious development time.


(to be continued)