Start of my Passive Income With Amazon Affiliate Program

First I learned about Passive income around 2011. I read Pat Flynn and Darren Rowse at that time but unfortunately I wasn’t convinced and didn’t believe in. Without realizing the future, Without calculating 5 future steps, I continue to my regular life.

The Knock of Passive Income

In last August 2016, I read two books related to Financial Freedom, Rich Dad, Poor Dad by Robert Kiyosaki and MONEY Master the Game: 7 Simple Steps to Financial Freedom by Tony Robbins. This two books gave me so much motivation and reasons that I decided to do something more than a regular job, which can free me in future from the chains of the job for the rest of my life.

My Start with Amazon Affiliate

I was searching without any idea what can be done to start a passive income. In the process, I get many ideas like

  • Affiliate Program in Amazon – most popular
  • CJ (Commission Junkie) Affiliate Program
  • Selling Kindle Books
  • Designing Tshirts in teespring.com
  • Invest in Property – not for me, this is for big shots
  • and few more

I have also found many blogs like Cloud Living, Passive Journal, etc and Cloud Living community is one of the best. I knew about Smart Passive Income before but only now I also studied it well. From many passive income ideas, I choose Amazon Affiliate program first as I am a web developer and it’s very easy for me to start. I buy the domain at August, hire a guy to write content and publish the first site at 1st week of September 2016.

First milestone: $100 In a Month

Today, 29 November 2016; I hit $100 in a month from the site. The value of the number is much higher than the value of the currency.

passive income from amazon, ariufl haque
$100.00 plus passive income in a month from Amazon Affiliate Site

The growth of the sale and revenue is way better than my expectation. Now I know, I can get this $100 each day if I stay focused and work hard and I can be in a place where I dreamed of being.

amazon passive income sale, ariful haque
The growth of my site in 3 months! Impressive to me!

My struggle and help

I need to work on the site along with my day job, masters study, family, and one-year-old kid. So I work at night and go to sleep at 5am and wake up at 10am. I am into a remote job, so I can start the office at 10/10.30am. Still now savings is a dream to me, I don’t have enough money to invest as I need and I am not an expert writer. Technical things I can handle, but content, themes, plugins, SEO, Backlinks, I need to pay for that. I don’t have a thing that I can sell, collect some money and invest in my site. My wife realized my frustration and she becomes my partner in business too. She started investing here from October 2016 from her Scholarship in P.hD. She also realized this can be our ultimate family business and we can have the life we want.

hard work in passive income
Only hard work and passion can take you to the top of Mount Everest

I am full of confidence today and I know anyone determined to do something better, s/he can do it. You need to work hard and climb to stand at the top of Mount Everest, so I started my journey and I hope I’ll keep sharing my updates here in my blog.

Start of my Passive Income With Amazon Affiliate Program Click To Tweet

Gitlab Permission denied (publickey) error SOLVED

Permission denied (publickey)

Seems a very common error in Gitlab.com or any Gitlab implementation. Last night I spend 4/5 hours without sleeping to solve the error.

Cloning into 'server'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
vagrant@advocado:/var/www/test/advo$ sudo git clone git@gitlab.com:arifulhaque/server.git
Cloning into 'server'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This is not first time I am adding SSH Key to Gitlab. My other VM have it in 2 different gitlab implementations but this new VM is not working.
Before I get the error, I created a SSH Key and added the Public Key to Gitlab.com All worked fine, but I couldn’t clone any repo from account through ssh git.

I guess maybe I read almost all the solution over internet but none worked in my case. So, how did I finally solved this? Very Easy!

Solution

Step 1: Added a config file in ~/.ssh/ folder which looks like

Host gitlab.com
       User git
       Hostname gitlab.com
       IdentityFile ~/.ssh/id_rsa_gitlab
       TCPKeepAlive yes
       IdentitiesOnly yes

Step 2: Just clone the git repo WITHOUT sudo.

git clone git@gitlab.com:your_account/user_repo.git

You can exclude git from git@gitlab.com also.

All done.. cloned the repo and did everything else without any problem.

Laravel 5 – Use multiple where clauses in your collection

Right now I am working on a project with Laravel 5.1. I’ve a situation here where I need to fetch all receipts from databased based on Start and End time of Breakfast, Lunch and Dinner. I could easily do it by three separate query to database and stored them in three variables but here I can reduct the hit to database server and use the collection functions.

I’ve first fetch all the receipts of a given date

$receipts	= Receipts::where(function($query) use ($report_date){
 
		$query->where(function($query) use ($report_date){
			     $query->where('date', '=', $report_date);
			});
		$query->where(function($query){
			$query->where('type', '=', 'restaurant');
				$query->orWhere('type', '=', 'takeaway');
			});
		})
		->orderBy('create_date')
		->get();

Now I have all receipts of a single day but I want to slice the receipts for breakfast, lunch and dinner receipts with the help of Laravel collection. I didn’t know how to use multiple filters in a single collection and founding nothing after searching google and stackoverflow. Then I started using common sense and it worked like a charm.

Multiple Where clauses in a single Collection Object

Here I need to give breakfast_start and breakfast_end time and it will filter with create_date property of the object. Anything in between, it will return the breakfast receipts .

$breakfast = $receipts->filter(function($item) use($breakfast_start){
		    return $item->create_date >= $breakfast_start;
	        })
		->filter(function($item) use($breakfast_end){
		    return $item->create_date <= $breakfast_end;
	    });

The code worked perfectly and I thought I should share the code snippet which might be helpful for someone like me.

DevSpace – Ubuntu 14.04 Vagrant Box for LAMP stack development environment

DevSpace Vagrant is a simple Ubuntu Trusty64 vagrant configuration for LAMP stack developers which also includes many related modern development tools.

Ubuntu 14.04 Vagrant Box – DevSpace

This vagrant use ubuntu/trusty64 from Atlas Vagrant Box. On your ‘vagrant up’ command, this vagrantfile will automatically download the box. Vagrant folder here contain a bootstrap.sh file which provision the vagrant box.

You need to place your projects in projects directory. This directory is synced with /var/www/htmldirectory in the virtual machine. This project folder also contain a config folder which is used during the provisioning.

This vagrant box is configured to use ‘1024mb’ of RAM and 1 Cpu. You can change ths configuration from Vagrantfile.

DevSpace Vagrant Installation

Install via Git

To use DevSpace vagrant, clone this github repo

$ git clone https://github.com/arifulhb/devspace.git

to your mac/pc/linux. When clone is complete, go to the `devspace` and now you are ready to use your Virtual Machine.

Use

Start the VM

$ cd /devspace
$ vagrant up

First time of your ‘vagrant up’ will provision the vagrant. You can see the status of your VM from http://192.168.33.10. You can check the `phpinfo` from http://192.168.33.10/phpinfo.php

List of Packages in DevSpace Vagrant

  • Apache2
  • PHP 5.6.7
  • MySQL 5.5.41
  • Git 1.9
  • Composer
  • Nodejs
  • NPM
  • Bower
  • Gulp

Requirements

You must have Vagrant and VirtualBox installed in your pc.

Default Credentials

These are credentials setup by default.

Host Address: – Hose: 192.168.33.10 (Change in Vagrantfile if you like)

SSH: vagrant / vagrant

MySQL: root/root
– Host: localhost
– Port: 3306

Fork and Tweet

This project is shared as Github Rep. If you find it helpful, you can Star and Fork in github. You can also help me to grow this project by tweet this.

How to remove controller name from URL in CodeIgniter

In CodeIgniter or any MVC application, the regular URL structure is like example.com/controller/function/parameter which appear as example.com/user/profile/ariful.  But sometimes we may want to omit the controller name here to make the url more beautiful like example.com/profile/ariful or even example.com/ariful as best url.

This beautiful url can be achieve through the URI Routing of CodIgniter. In
For example.com/ariful, use this code

 application/config/route.php

application/config/route.php file, you’ve to write following code for example.com/profile/ariful

  $route['user/(:any)']             = "user/profile/$1";

For example.com/ariful, use this code

  $route['(:any)']                  = "user/profile/$1";

If you have multiple parameters like

public function profile($username, $city)
{
     echo "You are ".$username." from ".$city;
}

Your route will be

5
  $route['(:any)/(:any)']                  = "user/profile/$1/$2";

If you want to use number in parameter instead of string like these examples, you need to use (:num) instead of (:any).

If you are looking for something like modifying URL, I hope this post may help you. If you’ve any further question, you can comment bellow.

Collection of My Web Development Assets

This is a short story of why I initiated the GitHub repo  “Frameworks Library Plugins I use in work”

I am developing web sites and web applications from 2011. Though I was working as a programmer for long time, I drive into web technologies after staring freelancing and outsourcing through oDesk.

My evolution is something like WordPress > CodeIgniter > Laravel > AngularJs > Nodejs. I started my outsourcing career with small WordPress thick and Installation, Theme modification and ended with WordPress theme development. Then eventually moved to Web Application development using CodeIgniter, Laravel and Angularjs. Though these are only the lading Frameworks, I used many other library, plugins, scripts etc. But most of time I keep forgetting which library or plugin or script I used in last projects and needed to research those. I considered this as a time killing process.

To solve this issue, I though to initiate and maintain a list of Frameworks, Library, Plugin, Scripts I used. It will be easy for me to track my usages and might be helpful for others too. So I initiated GitHub repo named “Frameworks Library Plugins I use in work”.  This is not I’ve listed all things I used in past years, of-course I’ve forgot many of them but I am intended to keep it filling.

If you like the repo, you can fork it and continue as your repo as well.

Remove index.php from URL to avoid duplicate content issue

You want to redirect example.com/index.php/welcome to example.com/welcome ? Are you tired of finding proper solution about how to Remove index.php from URL to avoid duplicate content issue  or to redirect index.php to actual URL without index.php? You are in the right place mate!

I am a PHP based developer and most of time I use CodeIgniter as my php framework. Those who use CodeIgniter and obviously other framework, we use some technique to remove index.php  from our URL to make it more clean, short , Web 2.0 friendly and penitentially to avoid duplicate content issue in Google Web Master. In CodeIgniter, we do it in two steps:

How to remove index.php from URL in CodeIgniter

Step 1: We update application/config/config.php file

//keep the variable empty to remove index.php after your domain name
$config['index_page'] = '';

Step 2: We update our .htaccess file as

RewriteEngine on
Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Cool! That removes index.php from our URL.. thats really great… but wait! What if anyone put index.php in your url like http://www.example.com/index.php/welcome/ ? Yes that is still accessible and duplicate content of http://www.example.com/welcome/ .

How I removed the index.php from url

I had the same problem in one of my project and needed to solve it. I spend hours to solve it but couldn’t found any solution until I found this post htaccess remove index.php from url in stackoverflow. I just put following lines in my .htaccess file

RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

and my problem solved.

Now if you intentionally write http://www.example.com/index.php/welcome/ in your address bar, it will be converted to http://www.example.com/welcome/ . I guess your problem is solved to.

Let me know if it helps you

 

CodeIgniter .htaccess and index.php issues – Solution

CodeIgniter index.php and .htaccess issue ruined my last night. I’ve solved this simple issue many times before but not any solution was working that time.

Few days before today, I was working in a client project which I’ve been demonstrating to my client from my personal demo server which is a HostGator Baby Plan Hosting.  The site was running fine in my local pc (Win7 running XAMPP 1.7.7 running the site in VirtualHost) and in my demo server but when I push the code in client’s staging server (Rackspace Cloud server with CentOS 6.4, Apache2 ) , I was getting a 404 Page Not Found error message. First I checked my .htaccess file and it was same as my demo server, same as my local pc which is

RewriteEngine on
Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

In my config.php file, I set

$config['base_url'] = 'http://staging.example.com/';
$config['index_page'] = '';

but nothing was working. I tried every solution I used before and I found over Internet but couldn’t find any perfect solution to solve my problem.

Everything seems fine and I was getting frustrated. Finally one solution I found where it says, I’ve to edit my httpd.conf file

httpd.conf File location in CentOS 6.4
httpd.conf File location in CentOS 6.4

and change AllowOverride None to AllowOverride All and saintly this solution worked Perfectly.

VirtualHost settings
VirtualHost settings to remove index.php file in CentOS 6.4

What Problem this was?

With my little understanding on server things, I understand that though we set the rule in .hetaccess to remove the index.php file, it was not fully permitted by staging.conf file. When working in Windows with XAMPP, this file location is in your drive:\xampp\apache\conf\extra\httpd-vhosts.conf

If you still reading, let me know if the solution work for you or If I need to update this posting in anywhere. I am open to creative suggestions 🙂

How to get value of Array in foreach loop

While working on my CodeIgniter based Open Source Project Management tool “Koronio”, suddenly I needed create a loop to generate a Dropdown element with array key as option value. This is very simple trick, provably everyone knows it, though I felt to share it.

Lets say, we have a php array named $priority which has 5 items.

$priority=array('Low','Normal Low',"Normal",'Normal High','High');

We want to show this items in a Select Item with Array value as option name and Array key as option value.

foreach($priority as $key=> $val)
{
echo '<option value="'.$key.'">'.$val.'</option>';
}

Thats It! You’ll have a dropdown list with the Priority list and value as option value.

Check Password Strength with jQuery Plugin

I was developing an Web Application recently. Like all other web app, this has user registration process and  password field for user. My client wanted to use a Password Strength Meter to indicate user how strong is his/her password. Well that’s a nice and must have feature for most of apps now.

I been searching for a jQuery plugin for this password strength feature and found a lots of plugins available for use. Well, I can’t use a lot of plugins but just one and I had to pick only one and I picked a simple one.

I choose this jQuery Password Strength Plugin from many. Reason for this choosing is,

  • easy to use
  • small but good documentation
  • little but necessary customization options

How to use Query Password Strength Plugin

Requirements

  • jQuery
  • jquery.passstrength.js or jquery.passstrength.min.js

Download jquery.passstrength.js or jquery.passstrength.min.js from original site and keep them in your root folder or any folder you want (figure1)

Files for password strength meeter
Figure 1

Assume following is your html for password field in index.html (figure2)

<div id="passwordmeter">
  <label for="password">Password</label>
  <input type="password" id="password"/>
</div>
password field
Figure 2

Now add the following javascript at bottom of your page (before </body>).

<script type="application/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="application/javascript" src="passstrength.min.js"></script>
<script type="application/javascript">
jQuery(document).ready(function()
{
  jQuery('#password').passStrengthify();
});
</script>

Well, that’s it. This should be working like this now.

Password Strength Meeter
Password Strength Meeter

See the demo here. Download Demo