How to install Harp on Ubuntu

Standard

Harp is a web static server with pre-processing for Ejs, Jade, Sass, Stylus, Markdown, Harp is written in Node.js. Harp lets you create a static website without any pain. The Harp web server does require any pre-configuration before running. Harp is not limited to creating a static website, It can also be used as a preprocessor for projects that use content that Harp supports to compile, Harp also lets you store your output locally and upload it to your web server, like any other static site generator.

To install Harp we need to install Node.js first. If you have Node.js you can skip this step.

Installing Harp as a global Node.js package.

sudo npm install -g harp  

Creating our first harp project.

harp init Blog  
cd Blog/  

Running Harp server, by default Harp runs on port 9000.

harp server  

You can change the port to any port you prefer

harp server -p 3000  

If you want to run Harp in production you have to set the Node environment variable into production. Running Harp in production will only re-compile files that have been changed and not the whole Harp application.

NODE_ENV=production  

Harp web server can run on port 80 or you can reverse proxy it with the help on NGINX web server.

Harp is installed on your system, you can read the documentation for more information over Harp

If you have any questions feel free to leave a comment below.

How to create a MD5 generator in PHP

How to create a MD5 generator in PHP Image 2
Standard

Let’s create an MD5 generator, If you don’t known what MD5 is you can visit read this Wikipedia article over MD5.

Requirements.

PHP 5.

Web server (Apache, Nginx, Lighttpd).

Writable web root.

First create a new file, you can name it what ever you want but to keep it simple I am naming it index.php.

We now have to write some HTML that would have an input and a submit button, lets do that.

<code class="language- html"><meta charset="utf-8"></meta><title> MD5 Generator </title><div class="container"><h1 class="title">MD5 Generator</h1><form action="index.php" method="post"><input name="content" placeholder="Enter some text" type="text"></input><input name="submit" type="submit" value="Hash!"></input></form><div><p class="output"></p></div></div>

Once you have written the basic HTML we require, you can add the PHP below in the top of the page that we will be using to check if the input isset or empty and hash the text.

The code below check if the input isset and checks if the input is left blank before the text is submitted , if not then the md5 function will continue and process the text and convert it into md5 hash

<code class="language- php"><?php if (isset($_POST['content'])) {  
    if (!empty($_POST['content'])) { 
        $hash = md5($_POST['content']);
    }

}

??>```

Now we need to echo the hash by adding these lines.

`<code class="language- php"><?php echo $hash ??>`

We can add the line above to the `<code class="highlighter-rouge">`

 that we had left empty, it should look something like this.

`<code class="language- php"><p class="output"><?php echo $hash; ??></p>`

Now the code should look something like this.

<?php if (isset($_POST['content'])) {
if (!empty($_POST['content'])) {
$hash = md5($_POST['content']);
}

}

??>```

<code class="language- php"><meta charset="utf-8"></meta><title> MD5 Generator </title><div class="container"><h1 class="title">MD5 Generator</h1><form action="index.php" method="post"><input name="content" placeholder="Enter some text" type="text"></input><input name="submit" type="submit" value="Hash!"></input></form><div><p class="output"><?php echo $hash; ??></p></div></div>

We can now style the web page using CSS.

<code class="language- html"><style type="text/css">  
        body, input { font: 0.9em Tahoma, sans-serif; }
        .title { font-weight: normal; }
        .container { width: 100%; max-width: 600px; text-align: center; margin: 0 auto; }
        input { padding: 10px; background: #ffffff; border:  1px solid #ccc; margin: 0;}
        input[type="text"] { width: 300px; }
        .output { border: 1px solid #ccc; padding: 10px;}
</style>```

Now that we have our page styled the code should look something like this.

<div class="highlighter-rouge">```
<span class="cp"><span class="cp"><?php if (isset($_POST['content'])) {  
    if (!empty($_POST['content'])) { 
        $hash = md5($_POST['content']);
    }

}

??></span></span>```

</div>```
<code class="language- php"><meta charset="utf-8"></meta><title> MD5 Generator </title><style type="text/css">
        body, input { font: 0.9em Tahoma, sans-serif; }
        .title { font-weight: normal; }
        .container { width: 100%; max-width: 600px; text-align: center; margin: 0 auto; }
        input { padding: 10px; background: #ffffff; border:  1px solid #ccc; margin: 0;}
        input[type="text"] { width: 300px; }
        .output { border: 1px solid #ccc; padding: 10px;}
    </style><div class="container"><h1 class="title">MD5 Generator</h1><form action="index.php" method="post"><input name="content" placeholder="Enter some text" type="text"></input><input name="submit" type="submit" value="Hash!"></input></form><div><p class="output"><?php echo $hash; ??></p></div></div>```

You can find the [source on GitHib

](https://github.com/DarrylDias/PHP-MD5-Generator)

Now we have successfully created an md5 generator. If you have any questions feel free to leave a comment below


How to install Cinnamon on Ubuntu

Standard

Cinnamon is a desktop environment based on GTK+ 3. Cinnamon is also one of the Desktop Environments that comes ship with Linux Mint, In Ubuntu Cinnamon is a regular package that has to be installed manually by the user and does not ship with it. Cinnamon that ships with Linux Mint is tweaked by the Linux Mint Team and comes with all the Cinnamon packages and extra packages too, On the other hand in Ubuntu Cinnamon is a package that comes with it’s panels and default theme, Cinnamon also is very easy to use and customize. The latest version of Cinnamon can be installed using a PPA.

Adding ppa to the local package repository database.

<code class="language- bash">sudo add-apt-repository ppa:lestcape/cinnamon  

You now have to update you local package repository database.

“`
sudo apt-get update
“`

Now you can install Cinnamon.

“`
sudo apt-get install cinnamon
“`

Now you have Cinnamon Desktop Environment installed on your Ubuntu system.

If the install give an issue you can easily uninstall it to. The commands need to be followed to remove Cinnamon completely.

“`
sudo apt-get purge cinnamon
“`

To remove the repository from your local package repository database.

“`
sudo add-apt-repository ppa:lestcape/cinnamon –remove

sudo apt-get update


</div>If you have any questions feel free to leave a comment below.