Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Google Chrome 50 stable version

This is our first post on release news and team decided to share some information on latest Google Chrome team release update, hope more users update chrome with latest version that fixes some high level security bugs those exists in previous version.

Google chrome team has announced the release of Google Chrome 50 stable version for Windows, Mac and Linux.

Google chrome team shared some bug fixes description on its blog post and mentioned in post that they will share more information in next post.

Release key features:

What we know about Google 50 already is its list of security-related bug fixes, which the company has announced on its blog.

This update includes 20 security fixes, some of them with short description we listed below

1. High:  Universal XSS in extension bindings.

2. High:  Out-of-bounds write in V8. 

3. Medium:  Out-of-bounds read in Pdfium JPEG2000 decoding.

4. Medium:  Uninitialized memory read in media.

5. Medium:  Use-after-free related to extensions.

6. Medium:  Android downloaded file path restriction bypass.

7. Low:  Address bar spoofing. Credit to Luan Herrera. Potential leak of sensitive information to malicious extensions.

Team mentions many of security bugs are detected using AddressSanitizer, MemorySanitizer, Control Flow Integrity or LibFuzzer.

Reference and more detail:

Bug related more information you can check using bug tracker link

How to update:


Why You Should Use AngularJS


One of my friend told me why you are using old JavaScript and JQuery, why not tried angular JS.

After reading some tutorials and googling my opinions is for Single Page Applications the crazy new AngularJS framework can do a lot more than classic old JavaScript and JQuery.


AngularJS Is a free open source framework developed by Google Employee and presently maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.

Why AngularJS?

If you haven’t tried AngularJS then you are really missing actual JavaScript magic’s.
According to me JavaScript is most dynamic and flexible language for web development.

Here are some advantages that tells you why you should be using Angular.

1. Testability Advantage 

a. Inbuilt support:

Inbuilt Unit testing Support provided with AngularJS.

b. Dependency injection:

AngularJS was designed considering testable environment, it fully supports dependency injection and encourages behavior-view separation, comes pre-bundled with mocks.

Dependency injection is also a core to AngularJS. This means that any component which does not fit your needs can easily be replaced.

2. Directive Advantages 

Directives is a unique and powerful feature available only in Angular. Directives let you invent new HTML syntax, specific to your application.

a. Reusable components

You can use AngularJS directives to create reusable components; these components hide complex DOM structures, CSS and behavior.

b. Localization

Each and every important application is available all local languages, and all successful and famous framework provides localization features.

Localization is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.

AngularJS filters and stemming directives provides features to make your application available in all local languages.

3. Dom and HTML Markup 

a. Easy and quick to use:

You can use angularJS with local basic html file, not required web server like require always IIS.

Simply add angularJS in HTML page and rune one any browsers it works.

Easy, readable and quick to develop application.

b. Dynamic and integration with existing App:

AngularJS starts evaluating the page at the end of the loading process (i.e. once HTML is in the DOM), it is easy to attach your small angularJS code in existing application.


If you want to add small functionality on page, for example leave summery of employee you can easily add this functionality without major changes in existing pages.

c. Extensibility:

AngularJS is fully extensible and works well with other libraries. 

You can modify and replace existing features according to your need that is allowed in AngularJS Framework. 

4. Data-Binding Advantage

AngularJS applications provide automatic synchronization of data between the model and view components.

There are two types of binding used:

1. One way data binding (Model to View)

2. Two way data binding (Model to View and View to model continues update)

When model changes the view reflects the change and vice versa, here model is real data and view is projection on model.


You can create your new webpages, you can add data binding whenever you feel that you have some dynamic data.

Angular will then provide you a $scope handler, which you can populate (statically or through calls to the web server).

5. DOM Manipulation Advantage

In MVC application using angular DOM is not manipulated in VIEW, DOM manipulation code is available inside directive.

Angular consider view is projection on model to place data and a simple html page.

Advantage of this feature is your view is clean and easy to maintain and change.

6. Data validation and data filtering advantage

a. Data validation

AngularJS provide client side form validation rules without writing any JavaScript code, additionally you can use HTML5 data validation rules easily.

Write less code and have “Girlfriend/Boyfriend “and Beer Sooner.

b. Filters:

A filter formats the value of an expression for display to the user.

C# provide nice feature called LINQ to filter data with less code, with angularJS you can filter data with existing and custom filters using lesser code than LINQ.

You can also use filters in controllers, services, and directives.

Writing your own filter is very easy: just register a new filter factory function with your module. Internally, this uses the filterProvider.

7. MVC Advantages

Existing other MVC firework you have to divide your code in MVC components and again you require to write code to bind together.

With angualarJS in first stage write your code in MVC component, then rest angularJS will do for you.

8. Data models are Plain JavaScript (POJO)

 Models in angualarJS are classic old JavaScript objects (POJO) and don’t require extraneous getter and setter functions. You can add and change properties directly on it and loop over objects and arrays at will.

Your code is clean, simple and readable using these natural old JavaScript objects (POJO).

This makes your code easy to test, maintain, reuse, and again free from boilerplate.

9. AngularJS inbuilt services and Server Communication

Angular provides a rich built in support for communication with the server, it not only provides the low level mechanism which acts as building block to communicate with the servers, but it also provides built-in wrappers for communication with services.

AngularJS provides built-in services on top of XHR as well as various other backends using third party libraries. Promises further simplify your code by handling asynchronous return of data.


You can use the AngularFire library to wire up a Firebase backend to create real world a simple Angular app.


My suggestion is for single page web application,CRUD based web applications and responsive web application prefer AngularJS then old JQuery or JavaScript.

Angular JS is like Messi of “Football” and “Kolhi” of Cricket for single page web application.



Linq to XML


For any application common approach is use database or XML documents to store backend data.

a. LINQ provides LINQ to SQL component to directly manipulate relational data, you can perform linq queries on Data directly.

b. For XML document .net framework provided LINQ to XML interface that enables In-memory XML document modification.

In this article I will describe LINQ to XML in detail with some sample examples.

What is LINQ to XML?

LINQ to XML is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET Framework programming languages.

LINQ to XML is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, LINQ to XML different from DOM.

Using LINQ to XML, you can

a. Load XML from files or streams.
b. Serialize XML to files or streams.
c. Create XML from scratch by using functional construction.
d. Query XML using XPath-like axes.
e. Manipulate the in-memory XML tree by using methods such as Add, Remove, ReplaceWith, and SetValue.
f. Validate XML trees using XSD.
g. Use a combination of these features to transform XML trees from one shape into another.


Why LINQ to XML?

LINQ to XML enables you to create and modify XML documents easily by using LINQ query expressions instead of XPath or XQuery.

Compared with classic complex XML parsing approach LINQ to XML expressions are easy to read xml document and modify XML document.

Advantages using LINQ to XML:

1. LINQ to XML makes XML easier by providing a query experience that is similar to SQL.
2.   Allows to use query result as parameters to XElement and XAttribute object constructors enables a powerful approach to creating XML trees.
This approach, called functional construction, enables developers to easily transform XML trees from one shape to another.
3. Main advantage of LINQ to XML is its integration with LINQ, This integration allows you to write queries on the in-memory XML document to retrieve collections of elements and attributes.
   var result = xdoc.Descendants("Types")
                 .Where(n => n.Attribute("id").Value == "1");
4. Easy to create XML trees with LINQ to XML.
5. Compiled and in memory use, so it runs faster.
6. Allows for better string manipulation.
7. Ability to work directly with XML elements instead of creating a container XML document, as required with W3C DOM.
8. In-memory XML document modification that is powerful, yet simpler to use than XPath or XQuery.
9. You can perform sorting, grouping on xml data.

LINQ to XML Example with Sorting Data:

Following example LINQ to xml query sort’s student’s xml data by year in ascending order.


<?xml version="1.0" encoding="UTF-8"?>

LINQ to XML Query:

IEnumerable<decimal> Students =
         from el in doc.Elements("Students")
         let year = (decimal)el.Element("Year")
         orderby year
         select year;
           foreach (decimal student in Students)


LINQ to XML methods with use of extension method:

In following example count method is used with XML document  

var doc = XDocument.Load("~/nmk/students.xml");
int descendantsNodes =doc.Descendants().Count(); // counts ALL descendants elements
int childNodes = doc.Root.Elements().Count(); //counts direct children of the root element

User Defined Extension methods with LINQ to XML:

In following example I have created extension methods for data casting, those methods I used with LINQ to XML query.

  var products =
               from elem in xElem.Descendants("Product")
               orderby elem.Attribute("ProductName").Value
               select new Product
                   ProductId = elem.Attribute("ProductId").GetAsInteger(),
                   ProductName = elem.Attribute("ProductName").GetAsString(),
                   Category =
                   Price = elem.Attribute("Price").GetAsDecimal()

User Defined Extension method:

public static string GetAsString(this XAttribute attrbute)
    string ret = string.Empty;
    if (attrbute != null && !string.IsNullOrEmpty(attrbute.Value))
      ret = attrbute.Value;
    return ret;


Using existing .net Framework provided extension methods with LINQ to XML:

Following LINQ to XML query example returns valid products data for existing categories only

var ValidProductsDeatils = xElem
     x =>  x .Elements("Category")
         z => z.Attribute("Id").Value !="0"
         z =>