I just made my first investment in an ICO

A week ago, investing in an ICO seemed like a foreign concept. But now, after making my first investment it seems so simple. By the end of this article I want to have the confidence to find and invest in an ICO.

Interest in cryptocurrencies has remained steady until November this year when increased media attention sparked a craze among every-day investors with some spare cash. Suffering from chronic FOMO, I too decided to invest in cryptocurrencies.

Bitcoin is the easiest coin to invest in. Exchanges like c will happily take your cash in exchange for the current market value of Bitcoin, Ethereum or Litecoin. The ease of this process has made Coinbase and these three currencies skyrocket in value. However, the hype around these currencies, especially Bitcoin, isn’t warranted when you look a little further.

In the last 12 months, Bitcoin has increased by +2095.47%. A £100 investment on the 18th of December 2016 would now be worth £2095.47 just 12 months later. The same investment in my current savings account would be just £102.

Compared to a £100 investment in Litecoin, over the same period, would now be worth £8350 (+8406.08%) and a £100 investment in Ethereum would now be worth £9143.9 (+9079.87%).

So, if we do a little bit more research, can we find somewhere to put £100 that is currently pre-spike? This is what I was hoping when I invested in my first ICO.

What is an ICO? An Initial Coin Offering is a way for a start-up to raise capital in an unregulated and democratic way. You buy a popular cryptocurrency, like Bitcoin or Ethereum and then you exchange that for the ICO’s token.

After doing some due diligence, I decided to invest in Token Pay (referral link). The company has been around for a long time and their product road map looks solid.

To buy the coins, I first bought Bitcoin on Coinbase (referral link). The minimum purchase of Token Pay (TPAY) is 0.01 BTC and at the time that was around £110. I requested a payment link from Token Pay and sent the Bitcoin to the address. About 24 hours later the payment was confirmed and the TPAY was credited to my account. TPAY doesn’t hit the exchanges until Q1 2018 and so it doesn’t yet have a value.

So will you start investing in mainstream cryptocurrencies or will you chase the higher rewards that ICOs are promising?

All investments, especially cryptocurrencies are extremely high risk. You should only invest what you are prepared to lose.

Mongoose js query cheatsheet

Mongoose is a schema-based wrapper for Mongodb. Writing some of the basic functionality into Mongodb can be tiresome and painful. Mongoose has built incasting, validation, query building a business logic

Unfortunately, the documentation for Mongoose is not as straight forward as the application is to use. This article can be used as a reference to the most common Mongoose queries, with syntax definition and examples.

Example schema

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var userSchema = new Schema({
    username: String,
    email : String,
    password : String,
    registration_date : {type: Date, default: Date.now },
    friends : [{
        friend_id : mongoose.Schema.ObjectId

var User = mongoose.model('User', userSchema);
module.exports = User;


‘Find’ syntax

User.find(query, fields, options, callback);

In the above syntax example, both fields and options are optional.

‘Find’ example

User.find({ 'username': 'an example username' }, function (err, user) {
        throw err;
        console.log('User found: ' + JSON.stringify(user));
        console.log('No user found');

Find the username for each user

User.find({}, 'username', function (err, user) {
        throw err;
        console.log('User found: ' + JSON.stringify(user));
        console.log('No user found');


Mongoose ‘findOne’ syntax

User.findOne(query, fields, options, callback);


Mongoose ‘findById’ syntax

User.findById(query, fields, options, callback);

‘findById’ example

User.findById('58405e43f905162fe4604fc1', function (err, user) {
        throw err;
        console.log('User found: ' + JSON.stringify(user));
        console.log('No user found');


Mongoose ‘findOneAndRemove’ syntax

User.findOneAndRemove(query, options, callback);

‘findOneAndRemove’ example

User.findOneAndRemove('username' : 'Tom', function (err, user) {
        throw err;
        console.log('User found and removed');
        console.log('No user found');


Mongoose ‘findOneAndUpdate’ syntax

User.findOneAndUpdate(query, options, callback);

‘findOneAndUpdate’ example

User.findOneAndUpdate('username' : 'Tom', function (err, user) {
        throw err;
        console.log('User found and updated: ' + JSON.stringify(user));
        console.log('No user found');


Mongoose ‘count’ syntax

User.find({ 'username': 'an example username' }, function (err, user) {
        throw err;
        console.log('User found: ' + JSON.stringify(user));
        console.log('No user found');

How to Install Nodebb with MongoDB and Nginx on Ubuntu

NodeBB is free and open-source bulletin board software. The application is written in Nodejs and is fast becoming a popular solution. The software has several advantages over the free and open-source competition, such as:

  • JavaScript on the node (Nodejs) is extremely fast
  • The application takes advantage of Single Page Application (SPA) principals
  • Takes advantage of NoSQL database software
  • Includes modern web app features straight out of the box

In this tutorial we will be installing NodeBB on the following a DigitalOcean server running Ubuntu. We will then install Nginx as the web server, MongoDB as the database software, Nodejs and finally, NodeBB.

Should I use DigitalOcean?

You don’t have to use DigitalOcean, but if you’re asking yourself if you should, the answer is yes. DigitalOcean has a fantastic service at a Fantastic price. We will be using the one-click MongoDB server, allowing us to skip the MongoDB installation process completely. There are several other major advantages to using DigitalOcean, but this is not the post for that.

To get $10 free from DigitalOcean, register with signup HERE.

Start your DigitalOcean server

After registering an account with DigitalOcean, click the big green button at the top of the page that says ‘Create Droplet’. You will want to click the One-Click Apps tab and select ‘MongoDB’.

Select your plan, the $5 per month server is more than enough to run your forum during development. Choose your location, name your server and click ‘Create’.

How to create a digitalocean droplet for NodeBB

When your server has finished being generated, you will receive an email with your server IP address, root user (usually root) and your password. You can then connect to the server with PuTTy.

Create a MongoDB database and user

Like all good applications, MongoDB has a built-in console tool that allows us to quickly communicate with the application. To access the MongoDB console type:

$ mongo

Creating a MongoDB database is extremely easy, to create one called ‘nodebb’ issue the following command.

$ use nodebb

To create a user called ‘nodebb’ that has access to our nodebb database, issue the following command:

$ db.createUser(
     user: "nodebb",
     pwd: "your-strong-password",
     roles: [ "readWrite", "dbAdmin" ]

Install Nodejs

The following command will install v4.2 Argon.

$ sudo curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -

Then install Nodejs and some dependencies

$ sudo apt-get install -y git nodejs mongodb build-essential

Navigate to where you want NodeBB to live. Personally, i use /var/www, but you can use whatever you like.

$ cd /var
$ mkdir www
$ cd www
$ git clone -b v1.x.x https://github.com/NodeBB/NodeBB.git nodebb

Next, we will install NodeBB and obtain its dependencies

$ cd nodebb
$ npm install --production

Next, we will run the NodeBB setup. This is where you will enter your MongoDB username, password and database. You will then be asked for an administrator user, email and password.

$ ./nodebb setup

Finally, we can start NodeBB by running:

$ ./nodebb start

You should then be able to access your NodeBB installation by visiting http://ip-address:4567

However, this is not desirable and we will almost always want to use a domain name. So lets now configure Nginx to handle requests from the internet.

Install Nginx

$ sudo apt-get update
$ sudo apt-get install nginx

That’s it, Nginx is now installed and you can do the usual start, stop and restart with the following command:

$ service nginx start
$ service nginx stop
$ service nginx stop

Configure Nginx 

Nginx is going to act like a reverse proxy for your domain. When a user types in your-domain, they are going to serves the pages from your-ip:4567. To do this, you will need to navigate to your configuration file.

$ cd /etc/nginx/sites-available/

Personally, I remove the configuration and create a new one.

$ rm default
$ nano default

Inside the configuration file I use the following:

server {
    listen 80;

    server_name domain.com;

    location / {
    root /var/www/nodebb;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

You will need to change domain.com to your own domain name and the root path to wherever you installed NodeBB.

Ruby on Rails SEO tips and tricks

A Ruby on Rails (RoR) application isn’t too SEO friendly straight out of the box. There needs to be some customisation to make your application more search engine friendly. When optimized correctly, a RoR application can perform extremely well in the search results. Unlike installing a WordPress theme and adding some content, you will have complete control over the structure and content on your website. In this post we will cover on-page SEO for your RoR application. I am going to assume that your RoR application has been developed in Ruby on Rails 4. The topics will include:

  • Titles content display
  • SEO friendly URL structures
  • HTML title tags
  • Meta descriptions
  • Responsive design

Titles content display

Optimizing your pages to have a report-like structure is always ideal and doing this in RoR is extremely easy. To maximize the potential for each page, plan how the content is going to be structured. Blogs are good examples of an application that is easy to optimize. However, not all of us are making blogs with RoR and in fact, you probably should just use WordPress for that. Making sure you plan the page layout before implementing functionality can help you prepare for the uncertainties of user-generated content. Having the user put in a title, that you can wrap in<h1> tags and a description will help your on-page SEO. GitHib is a nice example of a well optimized RoR application. If we look at the profile, we can see that the user’s name and username is wrapped in <h1> tags. Such as:

<h1 class="vcard-names">
      <span class="vcard-fullname" itemprop="name">Tom Nagle</span>
      <span class="vcard-username" itemprop="additionalName">tomanagle</span>

SEO friendly URL structures

Possibly the most annoying part of an out of the box RoR application is the user of the ID as the unique identifier in the URL. Luckily, this is easily fixed with the friendly_id gem. After we add the gem to our Gemfile we can run bundle install and start using it. There are several ways to use the gem, but the best way will result in a hyphenated URL that has no ID. In this example, I will be using a content type called posts. We need to add a slug to our posts by creating a migration file with:

rails g migration add_slug_to_posts slug_string

Then run:

rake db:migrate

In our posts model we will add the following:

extend FriendlyId 
friendly_id :title, use: :slugged

In our posts_controller we will need to change:

def set_post
  @post = Post.find(params[:id])


def set_post
  @post = Post.friendly.find(params[:id])

The problem with this is, if we already have posts, they won’t have a slug applied to them. We can fix this by entering into the rails console and typing:


HTML title tags

The title tag is problematic because it is automatically defined in the views/layouts/application as a static string. We want to make this dynamic and be able to hook into it with our different views. There are several ways to do this, but we want the cleanest way that will result in the least amount of code in each view. We will start by making a helper method in app/helpers/application_helper.rb

def title(page_title)
  content_for (:title) { page_title}

This helper method is universal and can be hooked into in any view that you like. We will need to display the results of the helper method in out application layout by changing the title tags to:

<title><%= yield :title %></title>

Next, tell the helper method what you want the title to be with:

<% title @post.title %>

Meta descriptions

Implementing the meta description will be exactly the same as the title tag. If we are going to be generating our own content, the best way to deal with the meta description is to generate a migration that adds a new field to the post for your discretion. This is because if you grab the description from the post body, you have less control over its length. However, we are going to assume that the content is user generated and therefore we have no control over its length. Implement a helper method for the description with:

def description(meta_description)
  content_for (:description) {meta_description}

Output this in out application layout with:

<meta name="description" content="<%= yield :description %>">

The tell the helper method what that view’s description should be with:

<% description truncate(@rat.description, lenth: 160) %>

Responsive design

In February of 2015, Google announced that responsive design would be counted as a ranking signal. The change now affects all searches on mobile devices in every language and country. So, making your RoR application mobile friendly is going to affect your organic traffic for mobile devices. There are several ways to make your application, or any website, mobile friendly. The first is to create your own style sheets that have media queries and resize content bases on the size of the device. The other option is to use a framework such as Bootstrap or Zurb’s Foundation. Both have well maintained Ruby Gems that can be used in your applications. Which one you choose is simply a matter of preference, both are mobile-first 12 column grid systems with different syntax. Each of the frameworks has a very detailed guide on how to install them, then you can continue to use the framework in your views.

RoR SEO tricks

Use a sitemap gem such as sitemap or dynamic_sitemaps to submit your website’s content to search engines.

Implement breadcrumbs with the gretel gem for improved internal link structure and usability.

Use i18n – Internationalization if your website is not in English. This can be achieved with config/locales/xx.yml and setting the local in the application controller.


Why @[4:0] will show Mark Zuckerberg’s name on Facebook

There is a well-known Facebook trick that will insert Mark Zuckerburg’s name, and tag him, anywhere on the website if you type @[4:0]. In fact, its not a trick at all, its a bug in the way Facebook tags users.

Facebook allows users to tag each other by starting a word with the @ symbol. However, when you type the @ symbol, you will be shown a list of names that you might be trying to tag. Each of these users will have a unique ID in the database. The fact that @[4:0] tags Mark Zuckerberg and links to his profile means that he is the 4th user in the database.

So who are the first three?
There isn’t any first three profiles. Visiting ‘https://www.facebook.com/profile.php?id=1’ will bring up an error. All three IDs will bring up an error, until you get to the 4th which displays Zuck’s profile.

Does that mean it will work for any profile?
Every single profile on Facebook is uniquely identified in the database by its numeric ID. You can find your Facebook ID with findmyfbid.com and do the same trick with your own profile, or any other profile on the website.

It didn’t work for me – has my Facebook been hacked?
I can across this picture on Facebook recently that stated if this trick didn’t work for you then your Facebook must have been hacked. To be honest, you have to be pretty special to believe this. If your Facebook had somehow been hacked, you’d know about it before you typed @[4:0]. How someone would come to that conclusion is beyond me. It doesn’t seem to work when you’re using the Facebook app, which may call data differently to the web application.


Update – February 2 2017

After some testing, it seems that this trick no longer works. Facebook may have patched the web application so tagging can no longer be done by calling a user’s ID. Inspecting the source of the tags shows no reference to the actual ID of the user tagged.

With PaidSocialMediaJobs.com you can earn up to $316/day with Facebook and other popular social media platforms. Click HERE to see how other people are doing it.

Compare two XML files and output the difference with PHP

Sometimes product data feeds work perfectly, but most of the time they don’t. In this post we will discuss how you can compare two XML files, an old and new, then output the difference between to two files. We will finally email the results to ourselves at 8 am every day.

Possible use case: You run an online store and need to use a data feed from a supplier. The data feed is in XML format and removes the product from the feed when it goes out of stock. This becomes problematic when you have different feeds running from different suppliers. You don’t want to remove every product on your website that does not appear in the feed, but you need to know which products from that supplier have been taken out of stock.

In this posts I will be using new.xml to refer to the newest XML file and olx.xml to refer to the oldest XML file.

Step 1: Delete old.xml
Step 2: Rename new.xml to old.xml
Step 3: Get the latest XML file from the supplier and call it new.xml
Step 4: Make an array from old.xml with a unique identifier, usually the product barcode or SKU.
Step 5: Make an array from new.xml with the same unique identifier we used in the step above.
Step 6: Loop through the old product array and see if the unique identier exists in the array of new products. If its not, the product must have been taken out of stock.
Step 7: Loop through the new products array and see if its in the array of old products. If its not, the product must be new in stock.
Step 8: Send yourself an email with the out of stock products and the products that are new in stock.

The first couple of stocks will be done with a cron job and so we will start at step 4.

Make an array of products from old.xml

if (file_exists('old.xml')) {
    $oldxml = simplexml_load_file('old.xml');
    //Load all the old product IDs into an array
    $oldproductsarray = array();
    foreach($oldxml->Product as $oldp){
        $productdata = array(
        $oldproductsarray[] = $productdata;
    die("Old XML does not exist");

The above PHP code will first check to see if the file exists. If itdoes exist, it will load the file into a simplexml object called $oldxml, else the script will die. The multidimensional $oldproductsarray loads the id element from XML file, with ‘id’ as a key. This part will need to be changed to suit your XML file. Make sure you get all the data that you will need to use in your script.

Make an array of products from new.xml

if (file_exists('new.xml')){
    $newxml = simplexml_load_file('new.xml');
    //Load the new product IDs into an array
    $newproductsarray = array();
    foreach ($newxml->Product as $newprod){
        $newproductsarray[] = (int)$newprod->Id;
    die("New XML file does not exist");

The above script will load the product id from each product in new.xml and put it into an array with id as the key.

Define a Bootstrap table 

<div class="table-responsive">
    <table class="table table-bordered">

We want to be able to display the data for testing purposes, making sure we get everything right before sending email. A HTML table is the perfect way to display the data and Bootstrap makes it look pretty. The above snippet of HTML will define a Bootstrap table with some headings.

Check to see if products are out of stock

//Loop though the old products
            foreach($oldxml->Product as $oldproduct) {
                //Add the current product's id to $x
                $x = $oldproduct->Id;
                //Test to see if the current product's Id is the array of new products
                //if it is not then it must be out of stock
                if(!(in_array($x, $newproductsarray))) {
                    echo '<tr class="danger">';
                    echo '<td>Out of stock</td>';
                    echo '<td>' . $oldproduct->Name . '</td>';
                    echo '<td>' . $oldproduct->Barcode . '</td>';
                    echo '</tr>';
            unset($oldproduct);//End the loop

In the above PHP we loop through the $oldxml object that we created earlier and define a variable called $x which holds the product’s id for the current iteration of the loop. We then test to see if the value of $x does not exist in the array of new products. If $x doesn’t exist, the supplier must have taken that product out of the XML file, therefore its out of stock. We then make a new row for the product and echo out some data that will help us identify the products.

Check to see if products are back in stock
This snippet of code is similar to the above code, but in reverse.

//Loop through new products
            foreach($newxml->Product as $newproduct){
                //Add the current product's Id to $y
                $y = $newproduct->Id;
                //Test to see if the current product's Id is in the array of old products
                //if it is not it must be back in stock
                if(!(in_array($y, $oldproductsarray))) {
                    echo '<tr class="success">';
                    echo '<td>In stock</td>';
                    echo '<td>' . $newproduct->Name . '</td>';
                    echo '<td>' . $newproduct->Barcode . '</td>';
                    echo '</tr>';
            unset($newproduct);//End loop

Make a proper HTML document
Our PHP file doesn’t have its HTML head or body definition yet, so lets add that.

    <title>Feeds = $$$$</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<div class="container-fluid">

Make sure you have put your PHP tags around all PHP code, or you will just output the code and not the results.

Test your output
Test the output of the script to make sure you are getting the right results. You should see a table that first outputs all the out of stock products in rows that have the ‘danger’ class, making them red. Then, all the products that are new in stock will e displayed in rows that have the ‘success’ class, making them green.

Send yourself an email with updates
We will now send an email to ourself with updates on the products. We can send an email every day at a certain time, or we can send it once a week. How often you send the email will depend on how much time you have to check products on your website.

//Define the recipient of the email
$to = "[email protected]";
//Define the email subject
$subject = "Your email subject";
$message = '<html><body>';
$message .= '<div class="table-responsive">
    <table style="width:100%;max-width:100%;">
foreach($oldxml->Product as $oldproduct) {
    //Add the current product's id to $x
    $x = $oldproduct->Id;
    //Test to see if the current product's Id is the array of new products
    //if it is not then it must be out of stock
    if(!(in_array($x, $newproductsarray))) {
        $message .= '<tr style="background-color: #f2dede;">';
        $message .= '<td>Out of stock</td>';
        $message .= '<td>' . $oldproduct->Name . '</td>';
        $message .= '<td>' . $oldproduct->Barcode . '</td>';
        $message .= '</tr>';
            unset($oldproduct);//End the loop

                        //Loop through new products
            foreach($newxml->Product as $newproduct){
                //Add the current product's Id to $y
                $y = $newproduct->Id;
                //Test to see if the current product's Id is in the array of old products
                //if it is not it must be back in stock
                if(!(in_array($y, $oldproductsarray))) {
                    $message .= '<tr style="background-color: #dff0d8;">';
                    $message .= '<td>In stock</td>';
                    $message .= '<td>' . $newproduct->Name . '</td>';
                    $message .= '<td>' . $newproduct->Barcode . '</td>';
                    $message .= '</tr>';
            unset($newproduct);//End loop
$message .= '</table>';
$message .= '</html></body>';

//Define some headers for the email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";

//Send and test if the email sent
    echo "Email sent";
    echo "Email could not be sent";


You will need to modify the above PHP so that it matches your arrays and XML files. If you have questions about what you will need to modify, please ask in the questions below. Remember that I will need to information about your XML file so please do not just ask “How do I modify the email?”.

Automating the process

We don’t really want to have to move files around, get new files and load the web page every single day, we need it to send us an email without any more work from us. For this step you will need to have shell access to your web server and know how to use Linux from the command line.

Create a script
Make a new file called update.script in the same folder that your project files are located.

rm old.xml
mv new.xml old.xml
wget http://dta-feed-URL.com
php5 ./index.php

The above script will first remove old.xml and then rename new.xml to old.xml before getting the new XML file and calling it new.xml. Finally, the script will execute your PHP file that does all the magic.

To hit this script at our scheduled time we will make a cron job  that looks something like this:

0 8 * * 1-5 /path-to-your-script/update.script

To make sure you get your crontab right, you can use the Crontab Generator.

You will now have a file that compares two XML files and sends you an email with the difference between the two files.

[et_bloom_inline optin_id=”optin_2″]

Accessing the Instagram API with Ruby on Rails

In this post we will have a look at the Instagram API and how you can use it within Ruby on Rails. Before you get started, you will first need to register an application with Instagram. Go to instagram.com/developers and click manage clients. Click ‘Register New Client’ and make sure you use http://localhost as your redirect URI. I am going to assume that you’re comfortable with Rails basics, such as creating an application, model, view and controller.

Preparing the application

Instagram is kind enough to provide us with a gem that will make development much faster. Create a new application and put the instagram gem in your GemFile with:

gem 'instagram'

The run bundle install.

The next thing we need to do is register our client ID and access token so they can be attached to the query string with every request automatically in true Rails fashion. Create a new file called instagram.rb in config>initializers. Please the following code inside:

 require "instagram"
    Instagram.configure do |config|
    config.client_id = "YOUR CLIENT ID"
    config.access_token = "YOUR ACCESS TOKEN"

To get your access token put the following URL into your browser:


You’ll then be rewarded with your access token.


If you get an error that says implicit OAuth is disabled, you will need to un-tick ‘Disable implicit OAuth’ in your client settings. Click edit on your client and then click the security tab. Un-tick Disable implicit OAuth and click ‘Update Client’.

Using the application

You’re now ready to start using the Instagram API in your Rails application. Create a new controller called home with an index view. In config> routed make the index the root of the application with:

root 'home#index'

In your home controller, in the index definition, start creating some variables that can be used on the index of the application. To get popular images make your HomeController look like this:

class HomeController < ApplicationController
  def index
  	@popular = Instagram.media_popular

To access Instagram’s endpoints with our popular variable we will loop through the variable and grab the data as we need it. Here is an example of a page that will display 20 of the latest popular Instagram posts and display them a Bootstrap layout.

<h1>Instagram Lookup</h1>
  <% @popular.each do |popular| %>
  <div class="col-sm-12 col-md-4">
    <div class="thumbnail">
      <%= image_tag popular.images.low_resolution.url %>
      <div class="caption">
        <%= popular.user.username %>
<% end %>

You can then practice with all of Instagram’s endpoints that are defined in the documentation found here: https://instagram.com/developer/endpoints/

How to Make a Website Using HTML

It is not common that a website will be made purely of Hypertext Markup Language (HTML). This does not mean that HTML does not have a place on the world wide web. HTML is the consistent variable across all websites, being a language that most browsers can understand. Learning HTML as a foundation to website development is a good idea. Having an understanding of how the language works and how it differs to other website languages is a must. Before we start to dive into the language, we must first realize the differences between ‘server-side’ and client-side languages.

Server-side Languages 
A server-side programming language is one that runs on the server that holds all the website files. The server processes information depending on the input and serves up a website made of client side languages. The server sends the client-side code to the internet browser such as Google Chrome, Firefox or regrettably Internet Explorer. Server-side languages play an important part in the web, they allow the website to process data without leaking that data to the internet. Most websites have a database that stores sensitive information. To connect to the dataset, we use several checks and balances, such as password authentication and IP address authentication. So, the database will allow a connection and start severing data is the password is correct and the request is coming from a known IP address. Serving this data to a client’s browser would make password authentication useless. Therefore, client side languages, such as PHP, Java and Ruby serve two purposes.

  • Processing information so the client does not have to
  • Retrieving data from a database securely

Client-side Languages
After the web server has done its processing, it serves the website to the client’s browser. This website is now in human readable form and usually consists of three different languages, HTML, CSS and JavaScript. The website’s browser can interpret these languages and have an understanding of what the webmaster intended this particular page to look like. The browser represented the webmaster’s intention on the screen for the client. Because this code is now on the client’s computer, they have the ability to read through it, taking out any information that the server has presented them with. This can be extremely useful for a webmaster to debug their code, or it could be deviating for a webmaster that has not been careful in planning what their code should do.

Now that we have an understanding of the difference between client-side and server-side languages, we cannot begin to understand what HTML is. HTML is made up of pre-defined tags that are opened and closed. They can be opened and closed in the same tag, or they can be closed later on in the code. The very first tag that must be defined in your page is the <html> tag. This tag is then closed at the end of the website with its corresponding </html> tag. Please take note of the difference between the two tags, this is extremely important in HTML. The send tag that we need to define is the <head> tag and then the <body>.

Your HTML document should now look like this:



Inside the <head> and <body> tag goes your entire website. The <head> will consist of any links to style sheets and JavaScript. It will contain the website meta information such as meta descriptions and titles. The <head> will usually contain the navigation, depending on your planned layout and the website’s logo. The <body> tag will contain the rest of your website.

Inside each of these tags will be a number of other HTML tags. There are thousands of different HTML tags and all of them are easily found on the internet. A post that discusses how to use each of them is not plausible, therefore I will go through and explain just the most common HTML tags. This will give you an understanding of how to use these tags, along with an understanding of the HTML language. Once you are confident that you can use these tags, you will be able to move onto learning CSS and JavaScript.

HTML <div> Tag
Your website will be made up of several different sections. You may have a blog and for each post you have a title, a body and an image. Each of these different elements will need to have their own division. However, divisions can be nested in each other. So, the body of your article may have a &lt;div> tag inside it for the image. The image has its own <div> tag applied so it can be manipulated differently. This scenario would like a little like this:


            <div>The title would go here</div>
            <div>The body may go here</div>

Note: The image <div> is before the body <div> closes. This is because the image is nested inside the body of the article.

HTML headings
Heading levels are present in any formatted text and HTML is no different. We need to level our headings because it gives the reader an understanding of its important and hierarchy in the article. When we are developing a website, we need to think about software that may be reading our website, such as the Google spider. Naturally, we want our website to be indexed and rank well in search engines. However, software is stupid, it has no logic like humans do. A human may be able to read your article and understand how important a paragraph is, but software cannot. To overcome this, we use heading levels, such as <h1> for heading level one and <h2> for heading level two. On our website partial, we will want the title of our article to be a heading level one, it would look like this.


            <div><h1>The title of my article</h1></div>
            <div>The body may go here</div>

Note: The <h1> tags are nested inside the <div> that has been defined for the header. The <h1> tag is then closed with its corresponding </h1> tag.

HTML Tables
Defining a table in HTML is one of the most useful things that you can do. Tables can be used to store your menu items to display data in a logical format. An HTML table consists of several different elements, table rows, header cells and standard cells. Each of these elements is recognized across all five of the commonly used web browsers.

Firstly, a table must be defined with the <table> tags. Inside the table comes a table row, which is defined by the <tr> tags. In the row are either header cells or standard cells. Usually, you will have a header cell at the start of each table row and then standard cells below it. A two row table may look like this:

      <th>Row one heading</th>
      <td>Row one standard cell</td>
      <th>Row two heading</th>
      <td>Row two standard cell</td>


These are just a couple of many HTML tags that you can play with and use in your projects. All this can be written using notepad or a text editor such as Programmer’s Notepad and Notepad++. Playing with HTML is the best way to learn and using some CSS to enhancing the look or your website is also an excellent way to learn both languages. It is important when learning these two languages that you do not stress about knowing all the tags and syntax fluently. Getting stuck into a project and understanding how you would solve a problem is all you ever need to know.

Anchor tag
The anchor tag is how we navigate around the internet. The anchor tag is accompanied with a href attribute, telling the web browser where the hyperlink should point to. The opening <a href="yourURL.com"> is followed by the text that you want to anchor. This text can be anything, however, it is common practice to make this text meaningful. Remember, we are not just writing for humans, we are also writing for software that does not know what ‘click here’ is referring to. By giving the anchor tag some meaningful text, we are telling Google spiders how the page we are linking to relates to the one that we are linking from. An anchor tag to example.com with the text ‘example’ would look like this:

<a href="http://example.com">example</a>

Note the closing </a> at the end of the text. IF we omit this closing tag, we will hyperlink the rest of the page.

An <a> tag can have a number of other attributes defines within it, before the href attribute. The most common of these attribute is rel, where you would define nofollow. The nofollow attribute tells search engines that you are linking to this website, but you should not use my link towards their authority. You may be linking to a website because they have a horrible website and you do not want this to mean you are vouching for them to the search engines. You can do this with nofollow. An anchor tag with a nofollow attribute would look like this:

<a rel="nofollow" href="http://example.com">example</a>

Tips for using HTML

  • Use CSS to give your <div> tags a splash of color. By doing this, you will be able to see exactly where they are and how they fit with the other elements on your page.
  • Plan a page with a pencil and paper and challenge yourself to make a web page that looks like your template. Use all the tools you have at your disposal, including Google.
  • Think about what humans will be reading your page and what software may be crawling your page. Design a friendly navigation system for both these clients.

How to encrypt text files with Notepad++

Notepad++ is a popular text editor with tons of useful features and plugins to extend its functionality. A plugin called NppCrypt will help you to encrypt text files using notepad++. There will be times when you need to hide your selected text or text files from preying eyes, so lets see how to do the encryption part with Notepad++.

First of all you will need to download and install Notepad++.

After installing open Notepad++, open the plugin manager by going to:
Plugins > Plugin Manager > Show Plugin Manager

The Notepad++ plugin manager that will appear

Select NppCrypt from the plugin list and click the install button below to install it. After installing NppCrypt, restart Notepad++.

To encrypt the selected text, open the text file with notepad++ and select the text you want to encrypt then go to:
Plugins > NppCrypt > Encrypt

a small dialogue box will open, in that select the cipher you want to use and enter a strong password, finally click the ok button to encrypt.
If you want to encrypt the entire text file, do the same process as above but without selecting any text. To decrypt, open the encrypted text file and go to:
Plugins > NppCrypt > Decrypt.

How to Install Linux, Apache, MySQL and PHP on Ubuntu 14.04

The Linux, Apache, MySQL and PHP (LAMP) stack is used to host websites. The LAMP stack comes with several advantages, firstly, all components is free to use and secondly, get its the job done with minimal hassle. In this tutorial, I will show you how to setup an Amazon EC2 instance with the LAMP stack. As a result of completing this tutorial, you will be able to install your Content Management Software (CMS) and begin building your website on your very own Virtual Private Server (VPS). So, what sets this tutorial apart from the many that are already available? From experience, I have found that most LAMP stack tutorials are not complete. They will explain how to install the software and you’re on your own from there. As a result of completing this tutorial you will have an understanding of:

  • How to setup an Amazon EC2 instance
  • How to connect to your Amazon EC2 instance via Secure Shell (SSH)
  • How to install the LAMP stack
  • How to configure Apache, ready for a website

Before we begin, it is important to point out why you would complete this tutorial. There are many hosting providers that offer a pre-configured solution at a fairly reasonable price. The advantages can be realized when you consider the difference between shared hosting and virtual private hosting. Shared hosting means your website is on the same server as hundreds, if not thousands of other websites. These websites will often share the same IP address and this can be disadvantageous when it comes to SEO. The other main advantage is cost. Amazon is just one of many VPS providers. By looking at their pricing table, you will begin to understand how you can save money on hosting. The third and often forgotten advantage to hosting your website on an Amazon EC2 instance is scaling. The ability to shutdown the instance and reboot a larger instance, in a matter of minutes is priceless. This means, you do not need to start paying for a larger server before you need it. It also means that when it’s time to upgrade, your website will not need to be moved. These are just some advantages of using a VPS service such as EC2.

What you will need

Since writing this post I have made a more details post about creating an Amazon EC2 instance. I suggest you read that post and skip to step 3. 

Step 1: Setup your EC2 Instance

Login to your AWS account and click EC2 in the very top left corner. In the left menu you will see a link that reads ‘Instances’, click it. This is a list of the instances in your account. Click Launch instance and click ‘Select’ next to Ubuntu Server 14.04, or the latest version of Ubuntu. In the bottom right click ‘Next: Configure Instance Details’ and then click ‘Next: Add Storage’. Click ‘Next: Tag Instance’ and select a tag for your instance. You should be on ‘Step 6: Configure Security Group’ where you will select ‘Create a new security group’.

For now, we will only need SSH and HTTP. SSH is already selected so we can click ‘Add Rule’ and on the new drop down select HTTP. The ports for these two protocols will already be selected, you will not be able to change them. Click ‘Review and Launch’ and then click ‘Launch’. A dialogue will appear telling you that you need to select an existing key par or create a new key pair. From the drop down, select ‘Create a new key pair’ and name the key. Save that file to a secure location. Click ‘Launch Instance’ and your instance will begin to launch.

Step 2: Creating a private key

Open PuTTYgen and click ‘Load’. Find the key that you saved from Amazon and select it. Click the ‘Save private key’ button and save the key to a safe location.

Step 3: SSH into your EC2 instance

By now your EC2 instance should be running. If you select it, you will be able to see a description of your instance down the bottom of the page. In this description will be a public IP address. Copy this address and paste it into PuTTY where it says ‘Host Name or IP address’. When you have a domain pointing at your IP address, you will be able to put your domain in this box. Because the EC2 instance does now allow root login with a password by default, we will need to use the key we generated with PuTTYgen. In PuTTY, expand ‘SSH’ and select ‘Auth’. At the bottom of this tab there will be a browse button, click it and select your private key that you generated.

Note: Your private key will have the extension .pem and you will not be able to see the key. Click show all files and select the key.

Click ‘Open’ in PuTTY and a dialogue will appear asking if you want to connect, click Yes.

Login to your server with the username: ubuntu

We are now connected with the user ‘Ubuntu’ which is good. However, this can get pretty annoying because we will need to write side in front of the commands. To change to root user type: sudo su

Step 4: Installing the LAMP stack

To get started type these two commands

sudo apt-get update
sudo apt-get install apache2

Navigate to your IP address and ensure Apache is installed correctly. The image below depicts what your website will look like with Apache installed correctly.

Apache2 installed correctly

Step 5: Install MySQL

We now have the LA components of the LAMP stack and its time for the M. We will again use the apt-get command to acquire and install the software. Run the following command to install MySQL:

apt-get install mysql-server php5-mysql

When promoted to continue, type Y and press enter. The installer will ask you for a password, make sure you choose something very strong. Type the password twice when prompted and press enter after each time. MySQL should finish installing soon after.

Step 6: Install PHP

We now have the LAM and its time for the P. PHP is a language that is used by most CMS, including WordPress. Type the following command to install PHP:

apt-get install php5 libapache2-mod-php5 php5-mcrypt

Step 7: Simple Apache configuration 

We are almost finished! In this step we will configure Apache, ready to start running our website files. To do this, we will make an Apache configuration file and then enable the website.

Move to your sites-available directory with the command:

cd /etc/apache2/sites-available/

Make a new configuration file with your website address and add.conf at the end. For example, if your website is techcress.com, you will make a new file called techcress.com.conf with the command:

nano techcress.com.conf

Inside this file we will need to put some configuration. Copy the following code and replace www.techcress.com with your website address. Make sure you omit any http:// or trailing slashes.

ServerName www.techcress.com
ServerAlias techcress.com *.techcress.com
DocumentRoot /var/www/www.techcress.com

RewriteEngine On
RewriteCond %{HTTP_HOST} !=www.techcress.com [NC]
RewriteRule ^/(.*)$ http://www.techcress.com/$1 [R=301,L]

ErrorLog /var/log/apache2/www.techcress.com-error.log
LogLevel warn
CustomLog /var/log/apache2/www.techcress.com-access.log combined

Press Ctrl + x to exit and when prompted type y and hit enter to save the file.

The DocumentRoot /var/www/www.techcress.com component tells Apache where your files are located. This folder will not exist so we will need to make it. To make the folder www.techcress.com you would type:

mkdir /var/www/www.techcress.com

Note: You will need to modify the folder name to be your website address.

Enable your new website by typing:

a2ensite www.techcress.com.conf

You can now put the WordPress files, or any CMS files inside the folder located at /var/www/your folder and navigate to your website

How to make a proxy server with an Amazon EC2 instance

After you have setup an Amazon EC2 instance run the following command in your terminal window:

apt-get install tinyproxy

In the Amazon AWS console, go to ‘Security Groups’ and select the security group that you will be using for your instance. Click edit and ‘Add Rule’. Make a Customer TCP Rule that has a port range of 888 and a source of anywhere.

Add a custom TCP rule

In your terminal windows edit the tiny proxy configuration file with:

nano /etc/tinyproxy.conf

In the tinyproxy.conf file change the port value to 888 from 8888. You can find where a line is with the command

ctrl + w

Before closing the tinyproxy.conf file find the lines that say Allow and write a line that says: Allow your IP address. Visit www.whatismyip.com to find your IP address. If your IP address was the line should read:


To close and save the configuration file, press:

CTRL + X then Y

You can then start to use your proxy server as you wish. To change the IP address of the server, simply click STOP on the server and then start it again. Make sure you are not browsing with the proxy server in your browser settings when you stop the proxy, you won’t be able to view web pages. To fix this, simply unselected the ‘use a proxy’ option in your browser settings.

[et_bloom_inline optin_id=”optin_2″]

The OSI model explained in simple terms

The Open System Interconnection model (OSI) is a seven layer model used to visualize computer networks. The OSI model is often viewed as complicated and many fear having to learn the model. However, the OSI model is an extremely useful tool for development and problem solving. Each of the seven layers goes up in increments of one as it gets closer to the human user. Layer one – the application layer, is closest to the person while layer seven – the physical layer is where the network receives and transmits raw data. The OSI model belongs to the International Organization for Standards (ISO) and is maintained by the identification ISO/IEC 7498-1. In this post, each of the seven layers of the OSI model will be explained in simple terms. The layers will be explained from layer seven to layer one, as this is where the data flow starts.

OSI Model Burger

The seven layers of the OSI model

Layer 7 – Application

The application layer is where the user inputs data and data is output to the user. The application layer is usually software that is run off the local machine, however this depends on the network architecture. The software could be cloud based, meaning it runs off a server in a remote location and data is transferred over the internet, or the software could be run on a local server. The application layer provides services for email, Telnet and file Transfer for example. An example of the application layer is an internet browser, an FTP client or even Microsoft Word.

Layer 6 – Presentation

The presentation layer is where the operating system lies. This operating system could be Windows, OS X, a Unix based operating system or one of the many others available. Where the human user interacts with the application layer described above, the application layer interacts with the presentation layer. This may be done directly, or through a runtime environment such as the Java Runtime Environment (JRE).

Layer 5 – Session

The session layer is responsible for creating and maintaining sessions between the operating system on the presentation layer and other, third party machines. For example, when a user is browsing the internet, they are interacting with the application layer, the application layer is interacting with the presentation layer and the session layer allows the operating system to interact with the web server.

Layer 4 – Transport

The transport layer is responsible for the logistics of the session. In the example used above, the transport layer would be responsible for determining what and how much information is transferred between the operating system and the web server.

Layer 3 – Network

The network layer is where routers operate. A router is a hardware device that forwards packets of information between computers on a network. This is where your IP address comes from and in the example used above, the router is responsible for sending packets of information out into the internet and receiving them. These packets origin and destination is determined by the IP address of your router.

Layer  2 – Data link

The data link layer is where switches operate and provides a reliable link between two directly connected nodes. The data link layer is also responsible for detecting and possibly fixing any packet errors that may form on the physical layer. The data link layer is divided into two separate layers, the Media Access Control (MAC) and Logical Link Control (LLC) layers. The MAC layer is responsible for controlling how devices connected to the network gain access. The LLC layer controls error checking, possible fixes and packet synchronization.

Layer 1 – Physical

The physical layer is literally the physical hardware that makes up the network. This layer has several major functions:

  • Defining physical specifications
  • Defining protocols
  • Defining transmission mode (half duplex & full duplex)
  • Defining the network’s topology

Hardware such as the physical components of Ethernet cables and Bluetooth are just some examples of the physical layer.

Purpose of the OSI Model

Even after reading a description of each of the seven layers, you may still be confused as to how the OSI model applies to real life networking. It’s commonly misunderstood how a model can be used to solve real-life problems and in some cases, a model may not be the best approach. However, in many aspects of Information & Communications Technology(ICT), a model can be extremely useful and that is the case for the OSI model.

When first discovering a networking problem, it can be confusing as to where you should start. The OSI model helps you to start figuring out where the problem may reside and therefore, help you to solve the problem. For example, a client’s computer is not able to reach a website. The problem is isolated to one device on the network, so it can be assumed that the problem is likely to be on the application layer. However, after testing you find that the problem still exists when you try a different web browser and so the application layer is ruled out. You then assume that the problem resides on the presentation layer and start looking for faulty settings. After some digging around you find that your client has entered some DNS settings incorrectly and so you then conclude the problem is on the presentation layer.

You may already be using the OSI model for simple problem solving such as the example above without even realizing it. However, when dealing with large, corporate scale networking a purposeful use of the OSI model can make your job much easier and more enjoyable.

Applied to other areas of ICT

The OSI model is most commonly thought of as a model that explains networking layers. However, many other fields of ICT use the model, or similar models. In web development, the model may be referred to as a ‘stack’. When a developer uses the term stack, they are referring to the operating system that the application is running on, the database software and the back-end software or programming language. A common use of the word stack is the LAMP stack. This ‘stack’ can be used in the same way as the OSI model to narrow down problems to their possible causes.

Further reading

If you’re studying to become a network engineer, or just interested in high-level concepts, the OSI model is an excellent model to learn. No matter what sub-field of IT you land in, you will always be able to refer back to it, helping you solve even the most complex problems. To gain a deeper understanding of the model and how you can apply it to everyday IT troubleshooting, here are some suggested books.

The OSI Model: simply explained by Ronald Schlager
The-OSI-Model-simply-explainedThis publication is available in both paperback and Kindle versions. The book explains the seven layers of the OSI model and how to use each layer, all in a simple and easy to understand way.

The author, Ronald Schlager, has been in the communications technology field since the 1980s and is the owner of schlager communications services GmbH.

The book is just 26 pages and will explain everything you need to know about the OSI model in a way that you will understand.