Search This Blog

Sunday, March 28, 2010

Maintainable JavaScript



What it means
Code should be Understandable to others as well as for us after sometime, Intiuitve,Adaptable, Extendable, Debuggable
Maintainability is writing or making code easy to understand and easy to debug

Why it is needed


  1. Mostly we are maintaining the code rather writing a new piece.

  2. It takes more time to figure out where we have to look out to solve a problem comparitively to create a solution for the problem

  3. It will be helpful for Co-worker present and in future.

  4. It will be helpful for Development community if we work for opensource projects
How it can be achieved

  1. Indenting Code which is easy as well as very important

  2. Commenting the code atleast at the top of each function and classes , while we use large code chunks , if we write any new algorithm or if we write any hack for display purpose on various browser

  3. Variable name should be nouns and function name should start with verbs with their usage.

  4. In client side we have three components they are JavaScript (behaviour),CSS(Presentation) and HTML (Structure )

  5. Maintain these separate dont mingle these things in one file which will leads to confusion.

  6. Keep Bussiness logic out of event handler.

  7. Dont extend objects which are native (Array,String,RegExp)

  8. Dont override methods which are from native objects

  9. Functions and variables should be attached to an object

  10. Dont use global variables instead use var Constants={name:value}

  11. Throw your own errors

  12. Avoid null comparisons (variable =='null' instead use variable instanceof Array or typeof variable =='string')

  13. Use constants when it is UI string ,repeated value ,URL and values which may change the future

What is HTTPS



  1. In many ways, https is identical to http, because it follows the same basic protocols.
  2. Use of https in a URI scheme rather than http indicates that an encryptedconnection is desired.
  3. Https works by transmitting normal http interactions through an encrypted system, so that in theory, the information cannot be accessed by any party other than the client and end server
  4. Https uses 443 port by default it can be changed using httpd.conf on apache server similar to port 80 on apache
  5. There are two common types of encryption layers: Transport Layer Security (TLS) and Secure Sockets Layer (SSL), both of which encode the data records being exchanged.
  6. Concept how https works : When using an https connection, the server responds to the initial connection by offering a list of encryption methods it supports. In response, the client selects a connection method, and the client and server exchange certificates to authenticate their identities. After this is done, both parties exchange the encrypted information after ensuring that both are using the same key, and the connection is closed
  7. In order to host https connections, a server must have a public key certificate, which embeds key information with a verification of the key owner's identity
  8. Most certificates are verified by a third party like goDaddy.
  9. Https is used in many situations, such as banking and where information security plays more vital role
  10. eg :https://mail.google.com/


    Please leave your comments 

Thursday, March 18, 2010

Install Tamil font in kubuntu

Install tamil font package 

 gt@gt-laptop:~$ sudo apt-get install language-support-ta

Install Scim (Input language can be changed using system tray flag icon)


sudo apt-get install scim

Default Font directory





cd /usr/local/share/fonts/


Create Dir 

mkdir truefonts

Copy tamil fonts here after downloading 

Update new fonts 

sudo mkfontscale && sudo mkfontdir && sudo fc-cache

Restart X server or reboot system

Done
....