Friday, July 28, 2017

Language: HTML (1)........

HTML: HyperText Markup Language
Its the most common language for web designing.
HTML - 5 online used
http://www.tutorialspoint.com/try_html_online.php
Script extension is .htm
script and terminal are preview and webview in HTML jargon.
Links:
www.w3.org/TR/html5/
Things to know: Tags, elements, attributes, formatting, comments, images, tables, lists,..
tags have attributes.
---------------------------
tags
</html>, </body>, <head> ,  <title>,  <h1>, <div>, <p>, <hr /> , <nav>, <em>, <img>, <a>
attributes
href, src, alt
---------------------------
Values are kept inside the quotations
closing tags: </html>, </body>
<head> contains <title>
<body> has tags as <h1>, <div>, <p>
<hr /> is an example of empty element.
------------------------
<!DOCTYPE html>
<html>
   <body>
      <h1>Hello World!</h1>
   </body>
</html>
Hello World!
------------------------
<!DOCTYPE html>
<html>
<head>
<title>This is document title</title>
</head>
<body>
<h1>A beautiful story</h1>
<p>Long long ago.....</p>
</body>
</html>
A beautiful story
Long long ago..... 
------------------------
Level of headings (6 types, it can't get smaller than that)
<!DOCTYPE html>
<html>
<head>
<title>Heading Example</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5

This is heading 6
------------------------
Paragraph tag
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<p>Sycamore is a big tree.  </p>
<p>Coral tree blooms are red.</p>
<p>Jacaranda flowers are purple.</p>
</body>
</html>
Sycamore is a big tree.
Coral tree blooms are red.
Jacaranda flowers are purple.
------------------------
Line break tag
<!DOCTYPE html>
<html>
<head>
<title>Line Break Example</title>
</head>
<body>
<p>Hi,<br />
How are you? Hope all is well.<br />
Its nice to see you.<br />
Seema</p>
</body>

</html>
Hi,
How are you? Hope all is well
Its nice to see you.
Seema

------------------------
Sentence centering
<!DOCTYPE html>
<html>
<head>
<title>Centring Example</title>
</head>
<body>
<p>The garden is serene.</p>
<center>
<p>Its on a hillock.</p>
</center>
</body>
</html>
The garden is serene.
Its on a hillock.
------------------------
Horizontal lines
<!DOCTYPE html>
<html>
<head>
<title>Horizontal Line Example.</title>
</head>
<body>
<p>I like photography.</p>
<hr />
<p>Its a nice form of creativity.</p>
</body>
I like photography.

Its a nice form of creativity.
------------------------
Format preserving 
<!DOCTYPE html>
<html>
<head>
<title>Preserve Formatting Example</title>
</head>
<body>
<pre>
The poem goes like this:
   "The woods are dark, lovely..
</pre>
</body>
</html>
The poem goes like this:

   "The woods are dark, lovely..
------------------------
Nonbreaking spaces (using &nbsp;)
<!DOCTYPE html>
<html>
<head>
<title>Nonbreaking Spaces Example</title>
</head>
<body>
<p>"Two&nbsp; male&nbsp; mallard&nbsp; ducks."</p>
</body>
</html>

"Two  male  mallard  ducks."
------------------------


Other web technologies: CSS, AJAX

Language: php (1).........

php: PHP Hypertext preprocessor
Its a server-side scripting language (data collect, save, add, delete, modify, encrypt). It is much like HTML (HTML-embedded) and syntax is C-like. Its case-sensitive
Web development and database (MYSQL, Oracle, Microsoft SQL Server) can interact through php
First released in 1996
It supports protocols as IMAP, POP3, LDAP
Characteristics of php: simple, flexible, forgiving, secure, efficient, fast, compatible
Componnets needed for php web page operation: web server, database, php parser
Script extension is .php
php configuation file is php.ini
php tag style  <?php...?>
Comments: # for single line
                   /* for multi-line*/
Executing script from command prompt:  php script.php
php constants: _LINE_, _FILE_,_FUNCTION_,_CLASS_,_METHOD_
-------------------------
#Hello script 
<html>
   <head>
      <title>Online PHP Script Execution</title>  
   </head>

   <body>
 
      <?php
         echo "<h1>Hello</h1>";
      ?>

   </body>
</html>
Hello
-------------------------
#Case sensitive nature of php
 <html>
   <body>
 
      <?php
         $age = 21;
         print("I am $age<br>");
         print("I am $Age<br>");
      ?>
 
   </body>
</html>
I am 21
I am 
-------------------------
#If statement, condition check, braces to make blocks
<html>
   <head>
      <title>Online PHP Script Execution</title>
   </head>

   <body>
 
      <?php
         if (4 == 2 + 2)
   print("TRUE<br>");
   
        if (5 == 2 + 2){
   print("FALSE");
   };
      ?>

   </body>
</html>
TRUE
-------------------------
Variables (Integers, double, boolean)
Integers
<?php
   $a = 7;
   $b = 3;
   $sum = $a + $b;
   $minus = $a - $b;
   print ("$a + $b = $sum <br>");
   print ("$a - $b = $minus <br>");
?>
7 + 3 = 10
7 - 3 = 4 
-----------
Doubles
<?php
   $a = 2.7;
   $b = 5.8;
   $total = $a + $b;
   print ("$a + $b = $total <br>");
?>
2.7 + 5.8 = 8.5 
-----------
Boolean
<?php
   if (TRUE)
   print("Yes<br>");

else
   print("No <br>");
?>
True
-----------
Assigning multiple lines to single variable
<?php
$abc =<<<_XML_
<abc>
<description>Winter night.</description>
<description>Its raining.</description>
</abc>
_XML_;
echo <<<END
Mid December.
END;
print $abc;
?>
Mid December. Winter night. Its raining.
-----------
<?php
   define("MINSIZE", 24);
   
   #echo MINSIZE;
   echo constant("MINSIZE"); 
?>
24
-----------
If......else
<?php
   $d=date("D");
         
    if ($d=="Sun")
         echo "Play"; 
         
    else
        echo "Study"; 
?>
Study
-----------
elseif (When at least one condition is true)
<?php
       $d=date("D");
         
       if ($d=="Sat")
            echo "Hike";
         
       elseif ($d=="Sun")
            echo "Play"; 
         
       else
            echo "Study"; 
      ?>
Study
-----------
switch (evaluates, matches, if found executed, otherwise executes a specified default code)
 <?php
         $d=date("D");
         
         switch ($d)
         {
            case "Mon":
               echo "Study";
               break;
            
            case "Tue":
               echo "Study";
               break;
            
            case "Wed":
               echo "Study";
               break;
            
            
            default:
               echo "Relax on weekend.";
         }
      ?>
Study
-----------
for loop (specified number of time)
while (as long as condition is true)
do....while
foreach (loops for each element)


-----------

Language: LISP .......

Lisp (LISt Processing) is a very old language (1958).
; for line commenting
script extension is .lisp
CLisp is common lisp.
terpri function outputs a newline to output-stream. (TERminate PRInt line)
...........................................
String printing
(write-line "Autumn leaves make me happy")
(write-line "I love picking them.")
(write-line "His authored a book titled \"Eternal peace.\"")
Autumn leaves make me happy                                                                     
I love picking them                                                                             
His authored a book titled "Eternal peace."
---------------------
Case-sensitive comparison
(write (string= "hi" "Hi"))
(terpri)
(write (string> "hi" "Hi"))
(terpri)
NIL                                                                                                                           
0
---------------------
String case conversion
(write-line (string-upcase "winter is almost here."))
(write-line (string-capitalize "sun sets very early."))
WINTER IS ALMOST HERE.                                                                
Sun Sets Very Early. 

(write-line (string-downcase "PLUMERIA FLOWER IS VERY FRAGRANT."))
(write-line (string-capitalize "seaweeds are algae."))
plumeria flower is very fragrant.                                                     
Seaweeds Are Algae.
---------------------
Stripping the spaces
(write-line (string-trim "   Its a cold night   "))
(write-line (string-left-trim "       Owls are hooting."))
(write-line (string-right-trim "Bats are flying    "))
(write-line (string-trim " "I"    I an scared."))

---------------------
Finding length of string
(write (length "Chaparral flora"))
(terpri)
; pull all characters except the number 1 character
(write-line (subseq "Chaparral" 1))
; pull the character only at index 1
(write (char "Chaparral" 1))
15                                                                                                              
haparral                                                                                                        
#\h                                                                                                             
---------------------
Sorting the strings (ascending, descending order)
(write (sort (vector "milk" "egg" "fruits" "vegetables") #'string<))
(terpri)
(write (sort (vector "milk" "egg" "fruits" "vegetables") #'string<))
(terpri)
#("egg" "fruits" "milk" "vegetables") 
#("vegetables" "milk" "fruits" "egg") 
---------------------
Joining strings (order of strings vary based on < or > symbol used).
(write(merge'vector(vector "tulip" "hibiscus")(vector "rose" "jasmine")#'string<))
(terpri)
(write(merge'vector(vector "tulip" "hibiscus")(vector "rose" "jasmine")#'string>))
#("rose" "jasmine" "tulip" "hibiscus")                                                              
#("tulip" "rose" "jasmine" "hibiscus")  
---------------------
Reversing a string
(write-line (reverse "Calley pear blooms are spectacular."))

Joining strings
(write-line (concatenate 'string "I like hiking." "Nature fascinates me."))
---------------------

Language: Scala ......

Scala (Scalabale Language) is a Java-based, hybrid language that integrates features of object-oriented and functional languages. Its popular among application developers.
Here, every value is object and every function is a value.
So, every function is an object.
Migration between Scala and java is easy, as they share same run-time platform.
download Scala from http://www.scala-lang.org/downloads
#HelloWorld as script
object HelloWorld {
     def main(args: Array[String]) {
      println("Hello, world!") // prints Hello World
   }
}

#Execution
scalac HelloWorld.scala
scala HelloWorld

Scala has about 50 keywords e.g. val, var
//One line comment
/*Multi-line comment*/

#Package declaration
package com.liftcode.stuff

#Package import
import scala.xml._

#Single class import from a Package
import scala.collection.mutable.HashMap

#Multiple class import from a Package
import scala.collection.immutable.{TreeMap, TreeSet}

#Script Test.scala
object Test {
   def main(args: Array[String]) {
      println("Hello\tWorld\n\n" );
   }


#Execution of the above script
scalac Test.scala   
scala Test  

Thursday, July 27, 2017

Language: Ruby.......


Script extension is .rb
Used online IDE http://www.tutorialspoint.com/execute_ruby_online.php
--------------------------------
# Hello World
puts "Hello World!";
Hello World!
# The Hello Class
class Hello

   def initialize( name )
      @name = name.capitalize
   end

   def salute
      puts "Hello #{@name}!"
   end
end

# Create a new object
h = Hello.new("Ruby")

# Output "Hello Ruby!"
h.salute
Hello Ruby! 
--------------------------------

Language: Julia........


Wednesday, July 26, 2017

Language: C#.......

C# (C sharp) is an object-oriented, structured language, as part of .NET initiative
C# is based on C and C++, resembles Java.
Its case-sensitive, ends with ;, execution starts with main method, class name can be different from file name
Online tool
http://www.tutorialspoint.com/compile_csharp_online.php
C# source code file has extension .cs
 IDE: Visual Studio (VS), Visual C# 2010 Express, Visual Web Developer
Compiling (Mono C# compiler)
mcs file.cs -out file.exe
Executing
mono file.exe
using is a keyword
namespace is a collection of classes
class has many methods behavior)
There is one main method.
--------------------------
using System.IO;
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}
Hello, World! 
---------
using System;
namespace HelloWorldApplication
{
   class HelloWorld
   {
      static void Main(string[] args)
      {
          Console.WriteLine("Hello, World");
         Console.ReadKey();
      }
   }
}
Hello, World 
--------------------------

Laboratory tools and reagents (Micro-pipettes)...

Micro-pipettes are essential tools of R & D labs, and integral part of Good Laboratory Practices (GLPs) Micro-pipetting methods include ...