Saturday, April 25, 2015


Elasticsearch is a great open source search engine built on top of Apache Lucene. Its features and upgrades allow it to basically function just like a schema-less JSON datastore that can be accessed using both search-specific methods and regular database CRUD-like commands. It is a real-time distributed search and analytics engine. It allows you to explore your data at a speed and at a scale never before possible. It is used for full-text search, structured search, analytics, and all three in combination:
  • Wikipedia uses Elasticsearch to provide full-text search with highlighted search snippets, and search-as-you-type and did-you-mean suggestions.
  • The Guardian uses Elasticsearch to combine visitor logs with social -network data to provide real-time feedback to its editors about the public’s response to new articles.
  • Stack Overflow combines full-text search with geolocation queries and uses more-like-this to find related questions and answers.
  • GitHub uses Elasticsearch to query 130 billion lines of code.
Elasticsearch is much more than just Lucene and much more than “just” full-text search. It can also be described as follows:
  • A distributed real-time document store where every field is indexed and searchable
  • A distributed search engine with real-time analytics
  • Capable of scaling to hundreds of servers and petabytes of structured and unstructured data
And it packages up all this functionality into a standalone server that your application can talk to via a simple RESTful API, using a web client from your favorite programming language, or even from the command line.
Elasticsearch can be used to search all kinds of documents. It provides scalable search, has near real-time search, and supports multitenancy. Elasticsearch is distributed, which means that indices can be divided into shards and each shard can have zero or more replicas. Each node hosts one or more shards, and acts as a coordinator to delegate operations to the correct shard(s). Rebalancing and routing are done automatically.
Another feature is called "gateway" and handles the long term persistence of the index; for example, an index can be recovered from the gateway in a case of a server crash. Elasticsearch supports real-time GET requests, which makes it suitable as a NoSQL solution, but it lacks distributed transactions.


HTML5 Canvas

Canvas element
The canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap and does not have a built-in scene graph. Canvas was initially introduced by Apple for use inside their own Mac OS X WebKit component in 2004, powering applications like Dashboard widgets and the Safari browser. Later, in 2005 it was adopted in version 1.8 of Gecko browsers, and Opera in 2006, and standardized by the Web Hypertext Application Technology Working Group (WHATWG) on new proposed specifications for next generation web technologies.
Canvas consists of a drawable region defined in HTML code with height and width attributes. JavaScript code may access the area through a full set of drawing functions similar to those of other common 2D APIs, thus allowing for dynamically generated graphics. Some anticipated uses of canvas include building graphs, animations, games, and image composition.
What is HTML Canvas?
The HTML <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript).
The <canvas> element is only a container for graphics, it has no drawing abilities of its own. User must use a script to actually draw the graphics.
The getContext() method returns an object that provides methods and properties for drawing on the canvas. Canvas has several methods for drawing paths, boxes, circles, text, and adding images. A canvas is a rectangular area on an HTML page. By default, a canvas has no border and no content.
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support <canvas> and its properties and methods.
Canvas vs SVG (Scalable Vector Graphics)
SVG is an earlier standard for drawing shapes in browsers. However, unlike canvas, which is raster-based, SVG is vector-based, i.e., each drawn shape is remembered as an object in a scene graph or Document Object Model, which is subsequently rendered to a bitmap. This means that if attributes of an SVG object are changed, the browser can automatically re-render the scene.
How to use Canvas
The following code creates a Canvas element in an HTML page:
<canvas id="canvasSample" width="200" height="200">
This text is displayed if your browser does not support HTML5 Canvas.
Using JavaScript, we can draw on the canvas:
var element = document.getElementById('canvasSample');
var context = element.getContext('2d');
context.fillStyle = 'red';
context.fillRect(30, 30, 50, 50);

Sunday, March 15, 2015

What's New in Visual Studio 2015

The following are the new features of the Visual Studio 2015

UI debugging tools for XAML
Two new tools — the Live Visual Tree and the Live Property Explorer — that can use to inspect the visual tree of your running WPF application, as well as the properties on any element in the tree. In short, these tools will allow to select any element in your running app and show the final, computed and rendered properties.

Single sign-in
The new release, reduces the authentication prompts required to access many integrated cloud services in Visual Studio. Now, when user authenticate to the first cloud service in Visual Studio, we will automatically sign in, or reduce the authentication prompts for other integrated cloud services.

With CodeLens, user can find out more about code while staying focused on work in the editor. User can now see the history of C++, SQL, or JavaScript files versioned in Git repositories by using CodeLens file-level indicators. When working with source control in Git and work items in TFS, user can also can get information about the work items associated with C++, SQL, or JavaScript files by using CodeLens file-level work items indicators.

Code Maps
When you user to understand specific dependencies in thier code, visualize them by creating Code Maps. User can then navigate these relationships by using the map, which appears next to code.

Diagnostics Tools
The Diagnostic Tools debugger window has the following improvements:
 1. Supports 64-bit Windows Store apps
 2. The timeline zooms as necessary so the most recent break event is always visible

Exception Settings
User can configure debugger exception settings by using the Exception Settings tool window. The new window is non-modal and includes improved performance, search, and filter capabilities.

JavaScript Editor
The JavaScript editor now provides you with IntelliSense suggestions when passing an object literal to functions documented using JSDoc. User can use the Task List feature to review task comments, such as // TODO, in JavaScript code.

Unit Tests
In Visual Studio 2015 preview, introduced Smart Unit Tests, which explores developer's .NET code to generate test data and a suite of unit tests. Smart Unit Tests enables support for an API that can use to guide test data generation, specify correctness properties of the code under test, and direct the exploration of the code under test.

XAML Language Service
The XAML language service has been rebuilt on top of .NET Compiler Platform so that it can provide you with a fast, reliable, and modern XAML editing experience that includes IntelliSense.

Timeline Tool
The new Timeline tool provides you with a scenario-centric view of the resources that your applications consume, which you can use to inspect, diagnose, and improve the performance of your WPF and Windows Store 8.1 applications.

What's New in .NET Framework 4.6

The following are the new features of the .NET Framework 4.6

64-bit JIT Compiler for managed code
The .NET Framework 4.6 features a new version of the 64-bit JIT compiler. This compiler provides significant performance improvements over the existing 64-bit JIT compiler.

Changes in Base Class Library
There are so many new APIs have been added to this new .NET Framework to enable key scenarios, especially for the Cross-Platform environment. The CultureInfo.CurrentCulture and CultureInfo.CurrentUICulture properties are now read-write rather than read-only. Additional collections implement ReadOnlyCollection<T> such as Queue<T> and Stack<T>. It implement System.Collections.ObjectModel.ReadOnlyCollection, including System.Collections.Generic.Queue and System.Collections.Generic.Stack.

Resizing in Windows Forms controls
The .NET Framework 4.6 expanded some namespaces that enable us to resize Windows Forms forms. This is an opt-in feature.
To enable it, set the EnableWindowsFormsHighDpiAutoResizing element to true in the application configuration (app.config) file.

Support for code page encodings
The core .NET Framework  primarily supports Unicode encodings and by default it provides limited support for code page encodings. We can add support for code page encodings that are available in the .NET Framework but unsupported in .NET Core by registering code page encodings with the Encoding.RegisterProvider method.

Open-source .NET Framework packages
Some great .NET packages such as the Immutable Collections and SIMD APIs are now available, open source, on GitHub. GitHub is a repository that contains the foundation libraries that make up the .NET Core development stack.

Improvements to event tracing
An EventSource object can now be constructed directly and you can call one of the Write() methods to emit a self-describing event.

.Net Native
It is a pre-compilation technology for building and deploying Windows Store apps. It compiles apps that are written in managed code (Like Visual C#) and that target the .NET Framework to native code. It is quite different from Just-In-Time (JIT) as well as the Native Image Generator (NGEN).

Friday, February 27, 2015


Did you know?
 The Raspberry Pi sprang out of a desire by colleagues at the University of Cambridge’s Computer Laboratory to see a return to the days of kids programming inexpensive computers. The rise of expensive PCs and games consoles put paid to the BBC B, Spectrum and C64 generation of home programmers, leading to applicants for computer studies courses lacking the necessary skills.
The basic concepts behind the Raspberry Pi were to make it as affordable as possible, supply only the basics and provide it with a programming environment and hardware connections for electronics projects. The Pi is a series of credit card-sized single-board computers, which runs a modified version of Linux called Raspian with Wheezy Raspian being the preferred option for newcomers to the device. Raspian runs directly on an SD card and provides a command-line interface for using the operating system.

The original Raspberry Pi and Raspberry Pi 2 are manufactured in several board configurations through licensed manufacturing agreements with Newark element14 (Premier Farnell), RS Components and Egoman.

Fig: Raspberry Pi (Model B)

Programming the Pi
There are two programming languages supplied by default with the Pi: Scratch v1.4 and Python. They both have shortcut icons on the graphical desktop. Scratch was designed by Lifelong Kindergarten Group at the MIT Media Lab as a firststep in programming. It uses tile-based language commands that can be strung together without having to worry about syntax. Commands are split up into easy-to-understand groups and dragged onto the scripting area. Sounds, graphics and animation can be added. Projects can be saved or uploaded to the Scratch website and shared for remixing by other users.
The other language is Python v3.2.3 which starts with a Python Shell. Python is an interpreted language, where commands are read and implemented one line at a time. The high level commands and data structures make it ideal for scripting. The previous version of Python is still quite popular and has more development aids, so is also supplied. The icons for these are IDLE 3 and IDLE, which stands for Integrated Development Language for Python.

The Pi Store
The Pi Store isn’t just home to apps and tools to help you use your Raspberry Pi. There’s also a selection of home-grown video games to get your teeth into, that are developed by the Raspberry Pi community.

Monday, February 9, 2015

CQRS (Command Query Responsibility Segregation) Pattern

Command–query separation (CQS) is a principle of imperative computer programming. It was devised by Bertrand Meyer. It states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, methods should return a value only if they are referentially transparent and hence possess no side effects.

Command Query Responsibility Segregation (CQRS) applies the CQS principle by using separate Query and Command objects to retrieve and modify data, respectively. CQRS Pattern segregate operations that read data from operations that update data by using separate interfaces. This pattern can maximize performance, scalability, and security; support evolution of the system over time through higher flexibility; and prevent update commands from causing merge conflicts at the domain level.

CQRS is a pattern that segregates the operations that read data (Queries) from the operations that update data (Commands) by using separate interfaces. This implies that the data models used for querying and updates are different. The models can then be isolated, although this is not an absolute requirement.
Compared to the single model of the data that is inherent in CRUD-based systems, the use of separate query and update models for the data in CQRS-based systems considerably simplifies design and implementation.
The query model for reading data and the update model for writing data may access the same physical store, perhaps by using SQL views or by generating projections on the fly. However, it is common to separate the data into different physical stores to maximize performance, scalability, and security; as shown in Figure.
The read store can be a read-only replica of the write store, or the read and write stores may have a different structure altogether. Using multiple read-only replicas of the read store can considerably increase query performance and application UI responsiveness, especially in distributed scenarios where read-only replicas are located close to the application instances. Some database systems, such as SQL Server, provide additional features such as failover replicas to maximize availability. Separation of the read and write stores also allows each to be scaled appropriately to match the load.

When to Use this Pattern
This pattern is ideally suited to:
  • Collaborative domains where multiple operations are performed in parallel on the same data.
  • Use with task-based user interfaces (where users are guided through a complex process as a series of steps), with complex domain models, and for teams already familiar with domain-driven design (DDD) techniques.
  • Scenarios where performance of data reads must be fine-tuned separately from performance of data writes, especially when the read/write ratio is very high, and when horizontal scaling is required
  • Scenarios where one team of developers can focus on the complex domain model that is part of the write model, and another less experienced team can focus on the read model and the user interfaces.
  • Scenarios where the system is expected to evolve over time and may contain multiple versions of the model, or where business rules change regularly.
  • Integration with other systems, especially in combination with Event Sourcing, where the temporal failure of one subsystem should not affect the availability of the others.
This pattern might not be suitable in the following situations:
  • Where the domain or the business rules are simple.
  • Where a simple CRUD-style user interface and the related data access operations are sufficient.
  • For implementation across the whole system. There are specific components of an overall data management scenario where CQRS can be useful, but it can add considerable and often unnecessary complexity where it is not actually required.

Event Sourcing and CQRS
The CQRS pattern is often used in conjunction with the Event Sourcing pattern. CQRS-based systems use separate read and write data models, each tailored to relevant tasks and often located in physically separate stores. When used with Event Sourcing, the store of events is the write model, and this is the authoritative source of information. The read model of a CQRS-based system provides materialized views of the data, typically as highly denormalized views. These views are tailored to the interfaces and display requirements of the application, which helps to maximize both display and query performance.
Using the stream of events as the write store, rather than the actual data at a point in time, avoids update conflicts on a single aggregate and maximizes performance and scalability. The events can be used to asynchronously generate materialized views of the data that are used to populate the read store.
Because the event store is the authoritative source of information, it is possible to delete the materialized views and replay all past events to create a new representation of the current state when the system evolves, or when the read model must change. The materialized views are effectively a durable read-only cache of the data.

Friday, January 30, 2015

Codenamed "Threshold" : Windows 10

An update to Windows 8, codenamed Threshold, a "wave of operating systems" across multiple Microsoft platforms and services, scheduled for release around the second quarter of 2015. The goals for Threshold was to create a unified application platform and development toolkit for Windows, Windows Phone and Xbox One (which all use a similar Windows NT kernel). It was speculated that Threshold would be branded as "Windows 9". But Threshold was officially unveiled during a media event on September 30, 2014, under the name "Windows 10".
  • Windows 10 designed with enterprise customers in mind
  • One converged Windows platform
  • Designed for the way you live and work
  • Helping protect against modern security threats
  • Managed for continuous innovation
  • Windows 10 helps keep customers secure and up to date
  • Enabling management for every scenario
  • An app store that is open for business
Window 10 Features:
User interface and desktop
Windows 10's user interface changes its behavior depending on the type of device and available inputs, and provides transitions between interface modes on convertible laptops and tablets with docking keyboards.
Online services
Windows 10 incorporates Microsoft's intelligent personal assistant Cortana, as introduced on Windows Phone, It is implemented as a search box located next to the Start button.
Multimedia and gaming
Windows 10 will provide heavier integration with the Xbox ecosystem: an updated Xbox app succeeds Xbox SmartGlass on Windows, allowing users to browse their game library (including both PC and Xbox console games), and Game DVR is also available using a keyboard shortcut, allowing users to save the last 30 seconds of gameplay as a video that can be shared to Xbox Live, OneDrive, or elsewhere.
Update system
Windows 10 will be serviced in a significantly different manner from previous releases of Windows. By default, users receive critical updates, security patches and non-critical updates to the operating system and its functionality as they are released, but can optionally opt out of or delay the installation of non-critical updates.
 Other cool stuff:
  • Start Menu is Back
  • New Task View
  • Snap Assist helps you snap windows
  • The Command Prompt Got Way More Than Just Ctrl-V
  • Notifications Are Getting a Makeover
  • Pin the Recycle Bin to The Start Menu and Taskbar
  • Explorer Has a New "Home" With Your Most-Used Folder Locations
  • Keyboard Shortcuts Make Virtual Desktops Super Easy to Use
  • File History is Now Its Own Tab in Properties
  • Windows 10 Universal apps, apps now float on the Desktop