Ahmad Al-ajmi

My personal learning plan

Goal
----
Format my brain!

Current status
--------------
I'm not a CS student, but i love this world than anything else.
I know the basics of programming, web development, I ♥ CSS.
But there is a new world and challenges that waits my brain to work.

"Learning is not a product of schooling but the lifelong 
 attempt to acquire it." ==============> Albert Einstein

1 - Study Computer Science
    ----------------------
    + Computer Science isn't a science and it's not about computers.
    + Structre and Interpretation of Computer Programs. 
      - MIT Course MIT COURSE
      - Berkely SICP In Python

2 - Study Mathematics
    --------------------------
    + MIT Mathematics for Computer Science
      - MIT NOTES
    + Introduction to Algorithms

3 - Learn Python and JavaScript
    ---------------------------
    
4 - Learn Databese
    --------------
    + Stanford Course: Introduction to Databases 

5 - The very important thing is to join a team of talented 
    and motivated people, and start to build stuff.

A long term plan and a big challenge for me, Good Luck :)
For any suggestions please Contact.
My personal learning plan

Goal
----
Format my brain!

Current status
--------------
I'm not a CS student, but i love this world than anything else.
I know the basics of programming, web development, I ♥ CSS.
But there is a new world and challenges that waits my brain to work.

"Learning is not a product of schooling but the lifelong 
 attempt to acquire it." ==============> Albert Einstein

1 - Study Computer Science
    ----------------------
    + Computer Science isn't a science and it's not about computers.
    + Structre and Interpretation of Computer Programs. 
      - MIT Course MIT COURSE
      - Berkely SICP In Python

2 - Study Mathematics
    --------------------------
    + MIT Mathematics for Computer Science
      - MIT NOTES
    + Introduction to Algorithms

3 - Learn Python and JavaScript
    ---------------------------
    
4 - Learn Databese
    --------------
    + Stanford Course: Introduction to Databases 

5 - The very important thing is to join a team of talented 
    and motivated people, and start to build stuff.

A long term plan and a big challenge for me, Good Luck :)
For any suggestions please Contact.

SICP - Building Abstractions with Procedures

  • A computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology.

  • programs must be written for people to read, and only incidentally for machines to execute.

  • Second, we believe that the essential material to be addressed by a subject at this level is not the syntax of particular programming language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, but rather control the intellectual complexity of large software systems.

Computer Science

  • Computer Science is a terrible name for this business.
  • It's not about science. It is really much more about engineering or art than science.
  • It's not about computers, in the same way that physics is not really just about accelerators.
  • Declarative Knowledge => What is true?
  • Imperative Knowledge => How to Knowledge?

Control Complexity

  • Building abstractions that hide details when appropriate.

  • Establishing conventional interfaces that enable us to construct systems by combining standard, well-understood pieces in a ``mix and match'' way.

  • Establishing new languages for describing a design, each of which emphasizes particular aspects of the design and deemphasizes others. (Metaliguistic Abstraction)

Building Abstractions with Procedures

  • Computational processes are abstract beings that inhabit computers.
  • Fortunately, learning to program is considerably less dangerous than learning sorcery, because the spirits we deal with are conveniently contained in a secure way.

Lisp

Lisp was invented in the late 1950s as a formalism for reasoning about the use of certain kinds of logical expressions, called recursion equations, as a model for computation.

The language was conceived by John McCarthy and is based on his paper ``Recursive Functions of Symbolic Expressions and Their Computation by Machine'' (McCarthy 1960).

Lisp is a practical programming language.

A Lisp interpreter is a machine that carries out processes described in the Lisp language.

Lisp, whose name is an acronym for LISt Processing,

Lisp was designed to provide symbol-manipulating capabilities for attacking programming problems such as the symbolic differentiation and integration of algebraic expressions. It included for this purpose new data objects known as atoms and lists, which most strikingly set it apart from all other languages of the period.

Scheme

A dialect of Lisp, the power and elegant of Lisp and Algol

From Lisp
  • Metalinguistic power that derives from the simple syntax

  • The uniform representation of programs as data objects

  • The garbage-collected heap-allocated data
    From Algol (short for ALGOrithmic Language)
  • lexical scoping and block structure

Language Elements - Primitives

Self-evaluating primitives => Value of expression is just object itself
  • Numbers => 12, 1.25, 2e5
  • Strings => "Scheme", "lisp"
  • Boolean => true or false
  • Built-n procedures => to manipulate primitive objects
  • Numbers => +, -, *

  • Strings => string=?, string-length

  • Boolean => and, or, not

Language Elements - Combination

Rules of evaluating
  • If self-evaluating primitives, return the value.
  • If name, return the value associated with name in environment.
  • If a Special Form, do some thing special.
  • If a Combination,
  • Evaluate all subexpressions of combination (in any order)
  • apply the operator to the values of the operands (arguments) then return result.

Evaluating Combinations

To evaluate a Combination, the lisp interpreter is following a procedure

  • Evaluate each subexpression of the combination
  • Apply the procedure (operator) to the arguments that are result of the evaluated subexpression (operands)

Parameter vs Arguments

the parameters that defined in the function declaration the arguments that defined in the function call

The substitution model for procedure application

Lisp uses applicative-order evaluation over normal-order evaluation:

  • More efficiency by voiding multiple evaluations of expressions
  • Much less complicated than normal-order evaluation

Single var Pattern in JavaScript

The Single var Pattern is very useful pattern to use at the top of functions in javascript. The pattern help to type all local variables at the top of function and to reduce the global variables.

So we use one var statement to declare multiple variables, we can figure what variables we have in one place. It also will improve the code readibility, Hoisting so we can avoid errors when calling a variable before it's defined.

JavaScript with Douglas Crockford part 1

Douglas Crockford: "The JavaScript Programming Language"/1 of 4 @Yahoo! Video

Learning JavaScript with Douglas Crockford lectures is highly recommended, he walks from scratch to advanced techniques of JavaScript. So if you are a beginner you can start with them. So, in this first post i just take notes that i found very useful from the part one

He started talk about the histroy of the language.

1992 - The first steps when James Gosling at sunmicrosystems invent a new language called OAK and then the name changed to Java at a cofeeShop.

1995 - After that they make a webbrowser by java called hotjava, but after time they look at java and say this is not suitable for a webpage because it's a heavy language to do simple thngs such as form validation so they want something much lighter.

Brendan Eich at Netscape start a new language called livescript inspired by:

  • Self ["prototypel inheritance", "dynamic objects"]
  • Scheme ["lambda", "loose typing"]
  • Java ["syntax", "conventions"]
  • Perl ["regular expression"]

and it was the first scripting langaue implementd in a web browser and a web server(LiveWire platform)

1996 Microsoft made a copy of javascript called jscript :). Microsoft and NetScape toke live script and jscript to ECMA to make a standarlization of the language so the generate EcmaScript(Language Standard).

Javascript has java as a pfefix but it's completly different from java. Script as a suffex, it's not a toy language but a completly programming language.

He recommended "Javascript, The Definitive Guide" book

Key Ideas

Load and go delivery:

that means javascript is an interpreted not compiled language and delivered as text because webpage is text

Loose Typing:

this means you can declare any variable without define it's type.

Objects are general containers:

Unification of Objects and hash tables, Objects are completly dynamic things which means new members and new methods could be added at any time.

Object oriented language:

every thing is an object

Prototypel inheritance:

Object inherit directly from object and there are no classes.

Lambda:

that means it use function as first class objects so you can use, pass, return and store functions as values.

JavaScript Values

Numbers

one number type in Javascript no integers represented as 64-bit floating-point

NaN => not a number

Tocix > any arithmetic operation with NaN as an input will have NaN as a result

NaN is not equal to any thing including NaN, but it's a number, for example if you ask the typeof NaN it will return "number"

Number function

Number() => convert a value such as string into a number It will return NaN if value has a problem

ParseInt() is a javascript function that converts a string value to a number.

It takes two arguments one for the string value and another for the radix.

radix is an optional integer arguments that represent the base of the vaue. specifying 10 will tell parseInt() to parse a decimal number(from 1 through 9), if it 8 will tell parseInt() to parse a octal number (from 0 through 7) if it 16 will parse value as a hexdecimal number (start with 0X).

If radix is omitted parseInt() will determine the value on it's based

So radix is strongly recommended because it defines the base of the value to be passed, because parseInt() stops at the first none digit character so if the first digit is 0 it interpret is as octal base (start with 0 through 7)

parseInt() will return NaN if the string value start with none digit number such as string, or the radix less than 2 or greate than 36. and we can use isNaN() function to test the result.

So lets see parseInt() in action

Strings

Strings are a sequences of 0 or more 16-bit characters.

Characters are encoded using UCS-2, not quit UTF-16

No seperate character type : characters are represented as strings with a length of 1 String.length: determine the number of 16-but character in a string

You can create Strings in JavaScript in two ways

Way one is to create by calling the constructornew String() and this way will create a string object

Way two is to create without new in front and this will create a primitive string, also notice that

When you ommit the String and define the value directly this will also create a primitive string (literal string)

A String function String(value) converts the value to a string

To know the type of the string we use typeof operator, and to covert the String Object to a primitive String use valueOf() method

Strings ar immutable and that means you can't manibulate thas string once is it created

Strings also have methods and you can call String Object methods on String primitive bacause javascript automaticaly coverts between them.

For example you can use a length property on a string primitive

Booleans

Booleans just true of false

Boolean function Boolean(value) + return true if the value is truthy + return false if the value is falsy + similar to !! prefix operator + ! operator convert the value to boolean and the negates it

Objects

null => is an object and a value that is not any thing

undefined => when you declare a variable through var and do not give it a value

The default value for variables and parameters

the value of missing members in objects

undefined can be confusing becuse variables can contain the velue undefined

False vaues in javascript

  • false
  • null
  • undefined
  • ""
  • 0
  • NaN

True values in JavaScript

All other value (including all objects) are truthy.

Every thing is an object

unifications of objects and hashtables that mean objects are completly dynamic to add new members and methods at any time.

new Object() : produces an empty container of name/value pairs. A name can be any string, a value can be any thing except undefined

members can be accessed by dot notation or subscript notation

JavaScript it a loosley type language that means any variable can receive any kind of value and any function parameter can receive and return any kind of value.

JavaScript is syntactically a C family language but it differs from C mainly in it's type system, which allows function to be values

Identifiers

Start with a letter or _ or $ Followed by zero or more letters, digits, _ or $

By conventions, all variables, parameters, members and function names start with lower case except for constructors which starts with upper case

Initial _ should be reserved for implementations

$ was added to ECMA specefecations specefecly for machines and recommended to not use $ and should be reserved for machines.

operators

Arithmetic ( + - * / % )

+ for addition and concatenation, if both operands are numbers will add them, if one is a string convert both to string and concatenate them. /Division of two integers can produce a non-integer result

== != Equal and not Equal operators but they do type coercion and it's recommend to use === and !=== instead which don't do type coercion

Logical ( && || ! )

&& The guard operator, aka logical and if the first operand is truthy it return the second operand, else return the first operand

||The default operator, aka logical or if the first operand is truthy then it return the first operand else it returns the second operand

! Prefix logical not operator,if the operand is truthy, the result is false. Otherwise the result is true.

A Survey of the JavaScript Programming Language

This is the first part of the video series and i will post them later, so stay tuned!

Install Rhino javascript shell on ubuntu 10.10

Javascript shell is the fast and best way to test a snippets of javascript.
Rhino is a command line programme Like iPython in Python or IRB on Ruby.
Rhino is build in java so make sure you have java installed

>> which java

if you get output like

>> [code]/usr/bin/java[/code]

if not open ubuntu software center and seach for java to install it.
after you have java installed just write theses commands in terminal

>> curl ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip > rhino.zip

>> cd rhino1_7R2

to start Rhino type

>> java -jar js.jar

and you should see

js>

For more information about Rhino visit Rhino shell

Strings in javascript

You can creat Strings in javascript in two ways

Way one is to create by calling the constructor new String() and this way will create a string object

Way two is to create without new in front and this will create a primitive string, also notice that when you ommit the String and define the value directly this will also create a primitive string (literal string)

<>A String function String(value) converts the value to a string

to know the type of the string we use typeof operator, and to covert the Strong Object to a primitive String use valueOf() method

Strings ar immutable and that means you can't manibulate thas string once is it created

Strings also have methods and you can call String Object methods on String primitive bacause javascript automaticaly covverts between them.

For example you can use a length property on a string primitive