Thursday 30 January 2014

You are not alone out there!

Now that you have become familiar with the basics of HTML5 I am going to give you some references that you can learn to extend your knowledge. One good thing about web development is that you can always find useful resources on the web itself! There are billions of webpages on the internet that you can see at any of them and learn. In other words, you have a book with billions of example for learning! Besides seeing the creativity used in websites created by other people, organizations, etc. you do actually have access to the HTML source code of all these webpages! Try the following:
If you are using Google Chrome as a browser you can press and hold 'Ctrl+U' to see the HTML source code of any webpage. Another way to do just the same thins is that you right-click on the webpage then click on 'View page source'.
   But doesn't this seem very insecure that you have access to the source code of any website???In the next topic I will answer and discuss these security issues further.
Image Source: 
<http://www.gannett-cdn.com/-mm-/788fd70a1894fdda76d2d844335fe2d901c071f3/c=63-53-719-546&r=490x368/local/-/media/USATODAY/GenericImages/2013/08/29/1377793382000-Sh-ThumbLock.jpg>

Friday 24 January 2014

A simple HTML Document

Finally, we get to some real-world coding. I now explain to you how to create a simple HTML document that contains a little bit of JavaScript code. If you do not already know, HTML is a language used to define the format and layout of webpages. In this post I am not going to get into so much details, but rather I just want to show you how things work. Before you read my below instructions, it is important that you have a text-editing software. If you have not yet done so, then nothing to worry about! Just get back to my previous posts and download one of my recommended text-editing software (except Emacs). So here are the instructions (specifically for Sublime-text):
1- Open Sublime-text
2- Click on File->New. Now a new tab is opened where you can write text (just like a normal word processing software)
3- Copy the following code between 'start' and 'end':

<!--     START OF CODE         -->

<!DOCTYPE HTML>
<html>
<head>
<script>
function doIt(){
alert("Why did you click him? Don't listen to him! He is lying.");

}

</script>
</head>
<body>
<h3>This is a simple HTML document</h3>
You can:
<ol>
<li>Edit this document</li>
<li> Learn basic useage of HTML from it</li>
<li>Become familiar with JavaScript</li>

</ol>

<h4>Now you may click on the button below:</h4>
<button onclick="doIt()">Click me! Please Click me!</button>
Feel free to edit this sample. I will post more examples on my <a href="http://behnamazizi.blogspot.ca/">blog</a> soon!
</body>
</html>

<!--     END OF CODE         -->

4- Now click on File->save or simply press 'Ctrl+s', then choose the location where you want to save the file (a location that you can remember).
5- Open your browser (No! You don't need to do that as your browser is already open!)
6- press 'Ctrl+o' then open the file you just saved
7- If you follow the steps correctly you should now see how the HTML code looks like in your browser. Your browser turns all the code into this format that you see. Isn't this amazing?

Tuesday 21 January 2014

Choosing a good text-editor

So far all I have done is that I showed you some algorithms and some piece of code. We'll soon be executing some code, but before then, what we should do is to choose a good editor for editting our codes.
Instructions:
The first thing you need is to download a text editor. There are many text editors out there you can download. A few of them are as follows:
- Notepad++
- Sublime-text
- Gedit (Still better than Emacs, or Vim)
- Emacs (Avoid this. Seriously avoid this. This is my most hated text editor)
- Vim (If this is your choice, I guess it is better off using Microsoft Word as a text-editor)
My favorite text editor so far is Sublime. (Those of you who still use Emacs or even Vim, please forgive me for being so rude). Of course, there are definitely text editors out there better than Subilme, but at least one feature that Sublime has especially for begginers, is that it is very simple.Here is a screenshot of the environment in Sublime-text:
Image Source: http://www.drweb.de/magazin/wp-content/uploads/SublimeText2.jpg

In the next posts I will provide you with sample code. Besides, I will actually tell you how to use Sublime-text to create a simple HTML document.

Friday 17 January 2014

JavaScript

Now let's start to do the actual programming. In this post and the next posts I am going to talk about a few basic commands used very often in programming languages. The first thing that I want to explain is the 'for' loop. Suppose you want to ask the computer to repeat a procedure 100 times. Suppose there is a function (I will explain about functions more in detail later) or command that sends emails. For example, suppose the command 'print("hello world")' prints the sentence "hello world" on the screen. The the following 'for loop' will print that on screen 100 times: for(var i=0; i<100; i++){ print("hello world"); } Congratulations! You just learned your first lesson in JavaScript. The above code is actually written in a language named "JavaScript". JavaScript is mainly used on web pages. I will later explain more about the language and interesting things you can make with it.

Thursday 16 January 2014

Algorithms

The whole concept of programming is based on algorithms. An algorithm is a description that can be used by anyone to solve a problem. When programming a software or part of a software, we basically translate algorithms into a piece of code which is understandable by the machine. We usually first write a Pseudocode, and algorithm written in English (or any other language understandable by humans), then we convert or Pseudocode to a code which machine understands. An example of Pseudocode is this:

For each of the students in class:
  Add 1 to their grades

And the Pseudocode above translated into C++ language, for example, would be this:


int numOfStudents = 152;
for(int i=0; i < numOfStudents; i++){
   students[i] += 1;
}



Monday 6 January 2014

The notorious "Hello World "

In this blog I am going to talk about programming, and as you probably already noticed, like any other programming subject I started with the boring and overused sentence "Hello World". But wait! The rest will not be boring, as we are going to talk about pretty interesting things. We start with simple pseudocodes that solve simple everyday problems and are easy to understand, later we will try to solve a couple of more complex programming puzzles together. I will also talk about the differences that exist between different programmng languges. In addition, I will spend some time on discussing markup languages like HTML5 and how it can be used to create web application with the aid of JavaScript and server-sided programming languages.

Source: "http://www.cs.tufts.edu/comp/105/progLanguages.jpg"