Saturday, 14 February 2015

How to Download Udemy Videos

Happy weekend everyone and thank God its Friday. As this week comes to an end, I just wish to share with you this tip I use to get videos from the Udemy website.

When doing a course on Udemy, you usually want to have a copy of the videos so that you don't have to come back to the Udemy when you want to make reference. Udemy by default does not allow you to download its videos except in the case where the instructor allows you to.

I complained about this to a friend of mine and he made me understand that once anything runs on your computer, it exists in memory. I will not go into the complex process he described to me. All I will say is that you don't want to go there.

To be honest to my friend though, he did recommend the Torch Web Browser. Torch Web Browser allows you to download media files by using its media grabber.

The media grabber arrow is in the upper right corner of the browser. Once a video loads on your webpage, it starts to bob up and down. Click on it to start the download. It will download the video to your downloads folder on your machine.

So while you are watching any Udemy video, all you need to do is wait for the video to load. Once you see the media arrow bobbing, click on it to download the video.

I hope this helps you as much as it has helped me. Have a great weekend.

Friday, 13 February 2015

SVG with RaphaelJS - Introduction

Welcome to this series on SVG with RaphaelJS. I am Truston Ailende and over the period of the next 16 weeks, I will be taking you on a journey into the world of Scalable Vector Graphics (SVG). As a prerequisite, I expect that you know JavaScript. Beyond that, stick with me and I will take you through this course. At the end of this course, I expect that you will develop an appreciation of the power of SVG in creating web applications.

Scalable Vector Graphics (SVG) involve drawing objects using mathematical functions. In order to make this happen, in the past we would write SVG documents manually, or use a tool like InkScape that creates images in the SVG format and renders it to the browser.

This method was slow, painful and tedious. Mistakes were easy to make and there was a a limitation on how much could get done. To deal with this tedium we use RaphaelJS because it takes care of outputting our graphics in SVG at the browser level.

RaphaelJS is a JavaScript library that allows you to work with vector graphics using JavaScript. It acts like an interface for creating SVG without having to write code in SVG. Think of it like jQuery. Without a wrapper like jQuery providing a layer of abstraction for JavaScript, you would have to write raw JavaScript to do anything on the web. If you think of how tedious writing JavaScript is and multiply that by 10, you will have an idea of the difficulty of SVG.

RaphaelJS is a vector graphics library which is used to draw objects in the browser. In the world of frontend web development, there are a plethora of tools that are used to create interactive web applications. This tools involve working with HTML5, CSS3, SVG and WebGL.

RaphaelJS is great for creating Scalable Vector Graphics (SVG). The main advantage of SVG is that it allows you create graphics without the loss of resolution when they are resized. This might not seem like much to you but in a world of responsive design, it represents a big opportunity.

Take for example the map of Africa shown above. It is a composite shape made up of individual paths that each represents a country. With this knowledge, we can apply a transformation to the individual countries to any size. Provided we do the transformation uniformly, we can size or resize the image without distortion.

As we move on, we will cover the concepts that will allow us create such maps. For now lets get started.

Setup

RaphaelJS is a JavaScript library so setting it up requires simply connecting to it in your code by linking to it.

For this course, we shall use the following template to work with RaphaelJS. It is available on GitHub. The template structure is shown below

From the above, you can see that we have a HTML file at the root of our template. In this template, I observe the principle of separation of concerns. I will give an overview of the template by starting with the index.html file.

index.html

This is a simple HTML file at the root of the template folder. It is an HTML file that contains all the code to make the project work. In the spirit of separation of concerns, I have separated the code into CSS and JavaScript to this end, all the needed files can be found in their respective folders.

The code in index.html is given below


<!DOCTYPE html> <html>
<head>
<meta charset="utf-8">
<title>RaphaelJS Template</title>
<link rel="stylesheet" href="css/default.css">
<script src="js/jquery.js"></script>
<script src="js/raphael.js"></script>
<script src="js/init.js"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>

Line 1
<!DOCTYPE html> is a DOCTYPE declaration that lets the browser know that the document to be rendered is an HTML5 document.

Line 6
<link rel="stylesheet" href="css/default.css"> is a link to the CSS stylesheet for this page. href="css/default.css" means that the stylesheet is in the css folder which you saw in the template file structure.

Line 7, 8, 9
<script src="js/jquery.js"></script> is a script tag in HTML. Script tags are used to inform the browser that code to be executed is JavaScript code. src="js/jquery.js" means that the code is found in the js folder of our template. The same logic applies to js/raphael.js and js/init.js. However, I must add that init.js is the file we will be writing our code in.

Line 12
<div id="container"></div> contains a div element. The id of the div is "container" this allows jQuery identifies the drawing area. In HTML5, this drawing area is called a canvas. However when working with SVG, the term paper is used to avoid confusion.

default.css
This is the styling for our page, all I did was center the paper and display a grid image on the background. You can view the code here


#container { clear:both;
width:500px;
height:500px;
background:url(../img/grid.jpg) repeat;
display: block;
margin: 0 auto;
}

The # value in front of the container means that it is an id value. With this we allow the CSS identity the id of an element in HTML and style it. By doing this, we place a grid on the background in an area of 500 by 500 pixels.

init.js
This is where we will be editing our code. Doing it this way makes it easier to teach concepts. The code for our template looks like this


$(function(){ var paper = Raphael('container', 500, 500);
});

It is in this file that I keep my JavaScript code. In the first line of code, we use the jQuery function to ensure that the page has loaded before any operation can commence.

In line 2, var paper = Raphael('container', 500, 500); creates a drawing area of 500 by 500 pixels. It is here that the grid is drawn.

So that is it for this week. You can get the code from GitHub. This is Truston Ailende. Thank you for your time.

Thursday, 12 February 2015

How to Install WordPress on WAMP

After you install WAMPServer as explained in this post. You see the above picture when you browse to localhost after starting your WAMPServer. We are going to install WordPress on WAMP because we want to develop our websites locally before moving them to production.

Now my WAMP installation is the default installation. Click on the phpmyadmin link on your installation. When you scroll to the bottom, you will see the following:
This means that I am running the root user with no password. Since it is my local machine, it is of no consequence. Please don't do this for production. Or if you want, you can change your root password.

In order to install WordPress on WAMP, do the following
  1. Go to WordPress.org and download WordPress.
  2. Unzip the archive file in a suitable location.
  3. Copy the unzipped folder to C:\wamp\www folder. When you do this and refresh your browser, the project will show up there. This shows you that the folder is now seen as a project by WAMPServer.
  4. Click on the phpmyadmin link
  5. Once you get to this page, click on the Databases tab.
  6. In the new database area, type in your database name. I will be using wordpress as my own.
  7. Click on the Create button to create a new database.
  8. You will get a flash message and see it in the list of databases.
  9. Go to http://localhost/wordpress in your browser and wait for the page to load
  10. Choose your language as English and click on Continue
  11. Read the information screen carefully. It contains information that will be required from you. Click the Let's go button.
  12. Enter the details of your database as I have done below. Note that the password field is empty as we did not set a password for our root user. Click the submit button.
  13. Now click the Run the install button
  14. Provide the information needed. Since you are running a local website, uncheck the Allow search engines to index this site mark. Click on Install WordPress
  15. Congratulations, your have successfully installed WordPress on your local machine
  16. Login to your blog
  17. Browse to your frontend at http://localhost/wordpress
Congratulations, you now have a WordPress sandbox to use as you please.

Wednesday, 11 February 2015

How to Install Git on Windows 8 Part 2


In my last post, I explained how to install Git on Windows. Now that your installation is completed, you need to configure your Git environment with your identity. This will allow you to maintain projects with your credentials even as you make upgrades to Git.

Git comes with a tool called git config which allows you to set global variables for how Git looks on your machine.

On your computer, open the Git Shell. You do this by right clicking on your desktop and choosing Git Bash. You should see an image like the one above.

In the shell, type in the following command:

git config --global user.name "Your username"
 My username is Truston Ailende so I will place that in.


Next your type the following command to set your email:
git config --global user.email "youremail@gmail.com"

I hate spam so I will not give you my email. If you desire to contact me, my details are in the About section of this blog.

Next your want to check your settings to make sure you got everything alright. To do this, run the command below:

git config --list

This will give you the image shown below:


Apart from my email which I blacked out, you can see my Git Configurations. Now you are ready to work.

Tuesday, 10 February 2015

How to Install Git on Windows 8 Part 1


Git is a version control system that allows you to manage your projects. I plan to start a series on SVG with RaphaelJS and I intend to use Git for version control.

In order to install Git, please follow the following steps:

  1. Click the Downloads for Windows button on the page. It will redirect you to the page shown in the picture.
  2. Once your download is completed, double click on it and allow your user control to let the installation start.
  3. You will see a welcome screen. Click the Next button.
  4. You will see a license agreement. Click the Next button.
  5. Leave the default location.
  6. In this screen we are given a choice of the components to install. Additional icons will place shortcuts to Git on your desktop as well as your quick launch bar. In the Windows Explorer Integration, you need to click both Git Bash and Git GUI as they will allow you use the Git command line and a GUI. This choice eliminates Git Cheetah a Windows client interface you could use with Git.

  7. So my selection is like this. I choose this because I want to use the Git command line as a lot of programs typically use it. Click the Next button.
  8. Leave the default startuup menu folder as Git. If you are on a 64 bit computer, leave the Don't create a Start Menu folder unchecked.
  9. Next you get a screen asking you to adjust your class path.
  10. I choose the last option. What it allows you to do is run Git from your command line. Then I click the Next button.
  11. It then takes us to the screen where we must configure the file ending. I choose the default then I click on the Next button.
  12. Now the process of installation begins.
  13. Congratulations, your installation is completed. Click the Finish button.
In my next post, I will go into how to set up Git for a first time user.

Monday, 26 January 2015

How to Install WAMP Server on Windows 8


When doing web programming, the LAMP stack is taken as the default. However, when developing on a Windows machine, you replace the L in LAMP with W and you have WAMP.

WampServer is a bundle for web development for windows. It allows you run your own web server on your local machine. This is great because you can test all your web applications on your website and then upload it to your production environment.

In order to install WampServer on your machine, you need to do  the following:

  1. Visit the WampServer  website and click on the Start Using WAMPSERVER button.
  2. It will redirect you to this page
  3. Click the download button for your machine. I am using a 64 bit machine so I will choose that one.
  4. You get the warning below. Read and look for the download directly link.
  5. Clicking on the download link starts your download in your browser window.
  6. Wait for your download to complete. Double click on the file in your browser window.
  7. You get a User Control Notification. Agree to all of them.
  8. The installation starts. Click the next button.
  9. Accept the licence agreement and click next.
  10. Select the installation destination. I am using the default.
  11. Select additional tasks to be performed. I will choose none because I want to have my WampServer on my start page. Click the Next button.
  12. Your installation is ready to begin. Click on the Install button.
  13. Wait as your installation is progressing.
  14. Once the installation is done, it will ask you to choose your default browser. It like Opera for web development so I will look for it.
  15. Once you do that, your installation concludes. All that is left is to choose your email settings. I will not do that now as we have to configure WAMP to send emails.
  16. Congratulations, you have successfully installed WAMP on your machine.
  17. Launch WampServer on your machine by leaving the check box and clicking finish.
  18. Launching WampServer  brings up the User Control. Agree to everything.
  19. Go to the notification area of your machine and find the WampServer  icon. Left click and put your server online.
  20. Type localhost into your browser window. You will see the screen shown below:
So there you have it. You can now develop web applications on your machine. Next I will explain how to configure your WampServer to send emails.