What is DART?? Same question arises until i see here.

Know about DART..

Dart is an open-source Web programming language developed by Google.The goal of Dart is “ultimately to replace JavaScript as the lingua franca(In simple words,language independent) of web development on the open web platform”.Dart is a class-based, single inheritance, object-oriented language with C-style syntax. It supports interfaces, abstract classes, reified generics, and optional typing.

The project was founded by Lars Bak and Kasper Lund.

There are three primary ways to run Dart code:

Compiled as JavaScript
When running Dart code in a web browser, the primary intended mechanism is to pre-compile the Dart code into JavaScript using the dart2js compiler. Compiled as JavaScript, Dart code is compatible with all major browsers with no specific browser adoption of Dart being required. Through optimization of the compiled JavaScript output to avoid expensive checks and operations, code written in Dart can, in some cases, run faster than equivalent code hand-written using JavaScript idioms.
In the Dartium Browser
The Dart SDK ships with a version of the Chromium web browser modified to include a Dart virtual machine (VM). This browser can run Dart code directly without compilation to JavaScript. It is intended as a development tool for Dart applications, rather than as a general purpose web browser. When embedding Dart code into web apps, the current recommended procedure is to load a bootstrap JavaScript file, “dart.js”, which will detect the presence or absence of the Dart VM and load the corresponding Dart or compiled JavaScript code, respectively, therefore guaranteeing browser compatibility with or without the custom Dart VM.
The Dart SDK also ships with a stand-alone Dart VM, allowing dart code to run in a command-line environment. As the language tools included in the Dart SDK are written primarily in Dart, the stand-alone Dart VM is a critical part of the SDK. These tools include not only the dart2js compiler, but also a package management suite called pub. Dart ships with a complete standard library allowing users to write fully functional system apps, such as custom web servers.

Browser adoption

A special version of Chromium (the open-source browser at the core of Google Chrome) comes with the Dart virtual machine, allowing it to run Dart programs. As of May 2013, Microsoft Internet Explorer, Mozilla Firefox, Opera Software’s Opera browser, and Apple Safari have no plan to embed a separate Dart VM.

Dart source code can be compiled to JavaScript, allowing applications written in Dart to run in all modern web browsers. In the M1 version, released in October 2012, the generated JavaScript reached about 78% of the performance of hand-written JavaScript while native Dart code ran about 21% faster than similar code in V8.


A Hello World example:

void main() {
  print('Hello World!');

A function to calculate the nth Fibonacci number:

int fib(int n) => (n > 1) ? (fib(n - 1) + fib(n - 2)) : 1;
void main() {
  print('fib(20) = ${fib(20)}');

A simple class:

// Import the math library to get access to the sqrt function.
import 'dart:math' as math;
// Create a class for Point.
class Point {
  // Final variables cannot be changed once they are assigned.
  // Create two instance variables.
  final num x, y;
  // A constructor, with syntactic sugar for setting instance variables.
  Point(this.x, this.y);
  // A named constructor with an initializer list.
      : x = 0,
        y = 0;
  // A method.
  num distanceTo(Point other) {
    var dx = x - other.x;
    var dy = y - other.y;
    return math.sqrt(dx * dx + dy * dy);
  // Example of Operator Overloading
  Point operator +(Point other) => new Point(x + other.x, y + other.y);
// All Dart programs start with main().
void main() {
  // Instantiate point objects.
  var p1 = new Point(10, 10);
  var p2 = new Point.origin();
  var distance = p1.distanceTo(p2);

How to start and where to start?


https://www.dartlang.org/ ( you can native dart editor from here)



V8 Javascript Engine

V8 JavaScript Engine

V8 is Google’s open source JavaScript engine.

V8 is written in C++ and is used in Google Chrome, the open source browser from Google.

V8 implements ECMAScript as specified in ECMA-262, 5th edition, and runs on Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems that use IA-32, x64, or ARM processors.

V8 can run standalone, or can be embedded into any C++ application.

The V8 JavaScript Engine is an open source JavaScript engine developed by Google for the Google Chrome web browser.

V8 compiles JavaScript to native machine code (IA-32, x86-64, ARM, or MIPS ISAs) before executing it, instead of more traditional techniques such as interpreting bytecode or compiling the whole program to machine code and executing it from a filesystem. The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code’s execution profile.

V8 is intended to be used both in a browser (notably in Chrome and Chromium browsers) and as a standalone high-performance engine that can be integrated into independent projects, for example server-side JavaScript in Node.js, or client side JavaScript in .NET/Mono using V8.NET.

For more: https://code.google.com/p/v8/

ng-class in angularjs

The ngClass directive allows you to dynamically set CSS classes on an HTML element by databinding an expression that represents all classes to be added.

Say Example, If text box is touched/invalid/error you can highlight with different colors like..

touched – green

invalid – orange

error – green

Similarly you can have your own scenarios of using this beautiful ng-class.

Example with clear scenario:



How to create a static server using nodejs


Good Noon..

Good things happens with good sharing of knowledge..

I gain something good knowledge from this great techie geeky Ryan Florence today.

Actually my scenario looks like this..

I have to build a project say project zero..where it have to run on its own without any wamp/IIS servers. Project should run with its own server using nodejs. So i have a filename called app.js where that single js file acts like a server to run my index.html page in http://localhost:8888

What i have to do for all this is only two steps:

1. run the command in command prompt (myprojectpath>node app.js)

2. hit the url in my funky browser. (http://localhost:8888)

Lets go through the code now..


var http = require(“http”),
url = require(“url”),
path = require(“path”),
fs = require(“fs”)
port = process.argv[2] || 8888;

http.createServer(function(request, response) {

var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);

path.exists(filename, function(exists) {
if(!exists) {
response.writeHead(404, {“Content-Type”: “text/plain”});
response.write(“404 Not Found\n”);

if (fs.statSync(filename).isDirectory()) filename += ‘/index.html’;

fs.readFile(filename, “binary”, function(err, file) {
if(err) {
response.writeHead(500, {“Content-Type”: “text/plain”});
response.write(err + “\n”);

response.write(file, “binary”);
}).listen(parseInt(port, 10));

console.log(“Static file server running at\n => http://localhost:” + port + “/\nCTRL + C to shutdown”);


This is index.html

Steps to follow to run and check:

1. Open command prompt and do as follows

14-12-2014 13-30-01

2. Just type http:localhost:8888

14-12-2014 13-32-30

Thats it..soo crazy code right 😉

Just say thanks to https://gist.github.com/rpflorence 🙂

Source: https://gist.github.com/rpflorence/701407


Same origin policy

Same-origin policy

The same-origin policy restricts how a document or script loaded from one origin can interact with a resource from another origin. Same-origin Policy is used as a means to prevent some of the Cross-site Request Forgery attacks.

Definition of an origin

Two pages have the same origin if the protocol, port (if one is specified), and host are the same for both pages. The following table gives examples of origin comparisons to the URL http://store.company.com/dir/page.html:

URL Outcome Reason
http://store.company.com/dir2/other.html Success
http://store.company.com/dir/inner/another.html Success
https://store.company.com/secure.html Failure Different protocol
http://store.company.com:81/dir/etc.html Failure Different port
http://news.company.com/dir/other.html Failure Different host

Git Vs SVN

To my understandings..

An SVN workflow looks like this:

The trunk directory represents the latest stable release of a project.
Active feature work is developed within subdirectories under branches.
When a feature is finished, the feature directory is merged into trunk and removed.
Git projects are also stored within a single directory. However, Git obscures the details of its references by storing them in a special .git directory. For example, a Git project with two features under development might look like this:

A Git workflow looks like this:

A Git repository stores the full history of all of its branches and tags within the .git directory.
The latest stable release is contained within the master branch.
Active feature work is developed in separate branches.
When a feature is finished, the feature branch is merged into master and deleted.


SVN stores in server where as git stores in local machine and have a reference in server

when server is down..we cannot access svn and we are stucked. but git can work offline and when it comes online it updates the server

svn work with windows version easily where as git works with commands. for windows version we use gitbash. but git is more secured.

The key difference is that it is decentralized. Imagine you are a developer on the road, you develop on your laptop and you want to have source control so that you can go back 3 hours.

With Subversion, you have a Problem: The SVN Repository may be in a location you can’t reach (in your company, and you don’t have internet at the moment), you cannot commit. If you want to make a copy of your code, you have to literally copy/paste it.

With Git, you do not have this problem. Your local copy is a repository, and you can commit to it and get all benefits of source control. When you regain connectivity to the main repository, you can commit against it.

Even some major points are listed in below link





Here are some major differences between HTTP and HTTPS:

URL begins with “http://” URL begins with “https://”
It uses port 80 for communication It uses port 443 for communication
Unsecured Secured
Operates at Application Layer Operates at Transport Layer
No encryption Encryption is present
No certificates required Certificates required
Events will work and track No events work and you cannot track anything

How https works
Suppose you want to open a new account with facebook. There would be a new signup form with ‘https’ in the beginning of the URL. This is to secure the information (In the form of username, password, and other particulars) that you would send to the facebook server. The https would secure the data by encrypting the information while it is traveling from the client browser to the web server. The acknowledgement of the receipt from the web server to the browser would also be in an encrypted form and would be decrypted by your browser’s https security layers.
– See more at: http://readanddigest.com/difference-between-http-and-https/#sthash.bfK3UKuZ.dpuf