Saturday, October 6, 2012

Samsung Galaxy Camera – Review and Features


“Click and Share” is the motto of today’s generation. Today’s youngsters love to capture happy-sad moments in camera. Companies exactly figured out this need and brought digital cameras in very low price. However, after clicking your favourite snap, to share it on social networking sites; it is mandatory to connect camera to laptop or computer. To overcome these problem mobile companies came up with new idea – Smart phones. Now you can capture photo and share it on social networking sites using smart phones.


Today the giant name is smart phones market is Samsung. It is very interesting to see launch of every new product from Samsung. In every product they have designed; one can easily find out the balance Samsung provide in quality and cost effectiveness. If you consider this history of Samsung; I must say now Samsung have taken a very bold step. “We are bringing a camera to change the definition of photography” Samsung claims! The name is – Samsung Galaxy Camera. Camera operates on Android 4.1 Jelly Bean. Gone are the days of being jealous for not having high end cameras for commercial use. Samsung Galaxy Camera can be used for commercial and high end photography. Let’s understand its basic but new important features – 


Smart Pro Mode – 

Be ready to capture excellent photos. Smart PRO MODE will help you to capture various colours at night as well. Or you can capture a high speed scene with action freeze. For example, you can capture a bike rider with action freeze on a simple button click!!







Monday, September 3, 2012

WPF custom control and adding DependencyProperty to custom control


To create custom control in WPF, choose WPF Custom Control Library project in VS2010. Then rename the default added class to your choice. I am trying to create a custom list box with few user added properties in it. Then add a WPF project which will use this custom list box in it. So my solution structure is as follows –

Now I am going to add dependency properties in the class file. These properties will be then available in Properties window once you use the control in any WPF application.

Thursday, August 30, 2012

WPF – MVVM – Combobox binding with enums


WPF and MVVM is going smooth for me at least as of now. Today, I am going to disucss how combobx binding with enum can be done in MVVM pattern. Here I assume that, you have basic idea of MVVM and how it can be used with WPF applications. The MVVM explaination is out of scope for this blog post.
First of all create simple WPF application named as EnumToDDLBinding using VS2010. You can give any name as per your choice. If so then make sure that, you replace the namespace names in codes mentioned below with your namespace name.  Add a new folder named as “ViewModel”. Add a new class in it named as “MainWindowViewModel.cs. The add another class in solution and name it as “MyEnum.cs”.
 The overall structure of solution is as shown below –
 
Add sample enum to MyEnum.cs as shown below –
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 

Tuesday, July 24, 2012

Office 2013 – top features of Microsoft Office 2013

On my personal experience I can confidently say that; any person in the world who is new to computer and want to learn something about computer then he /she always demands for learning Microsoft Office. The reason is also obvious. MS Office simplifies many day to day activities for all of us. Every new launch of ms office has taken a step towards simplifying our life tremendously.
Yes! I agree that, to get comfortable with new versions of ms office; it takes time. But once you are through, then there is no problem. I am sure every one of us must be having same kind of experience with ms office various versions.
If you observe the history of ms office releases, the changes in different versions were not big or they were addendum to the existing features. However, I think Microsoft now has decided to change everything with release of windows 8 and Ms Office 2013 is no exception to that. MS Office 2013 is going to be the most ambitious release from Microsoft.
Based on my personal experience after interacting with various Microsoft product lovers, people tend to get confused with new releases and various features. Here in this post I am just trying to simplify the catchy features of Ms Office 2013.
What is Office 2013 –? What is difference between office 2013 and office 365?
Office 2013 is basically a desktop based application as opposed to Office 365 which is subscription based office version. As office 2013 is desktop based, it will be required to be installed on your devices be it, laptop, tablet, desktop Pc or anything. Office 2013 is traditional office product from Microsoft. Office 365 is subscription based cloud service which is not required to be installed on your devices. Office 365 delivers the office 2013 programs as a part of subscription service via Microsoft cloud.
Office 365 is an online subscription service that provides email, shared calendars, the ability to create and edit documents online, instant messaging, web conferencing, a public website for your business, and internal team sites—all accessible anywhere from nearly any device.
If you have Office 2013 installed then you can quickly configure it to work with Office 365 services. Office 365 can also be configured with 2007 and 2010. Office 365 is not office 2013. 
For example, If you use Office 2013 alone, the document will be saved on your device or computer. Hence it cannot be access anytime unless you carry your device everywhere. If you have Office 2013 configured to Office 365; then you can save the document to say SkyDrive and can access anytime on any device even if you don’t have your device or laptop or tablet with you.
This is the main difference between the two.

 Now let’s have a look at the features of Office 2013.

Tuesday, July 10, 2012

WPF Binding – Element Binding example - Enable Disable Control based on another control property in WPF

Gone are the days for me to work on Azure. 3 weeks back started with WPF. I have been in web technology for last 5 years and now suddenly shifted to windows applications using WPF.
Now struggling with binding, converters and what not. Anyways, I have started to digest simple WPF concepts one of which I am going to discuss here.
I want to bind a controls property “IsEnabled” to another controls property value. As an example, I am taking the textbox control to enable or disable based on the selction of value in drop down. Ohh sorry, combobox!!! (drop down we generally refer in web application!!)
Lets create a simple WPF application, add two controls viz. combobox and textbox. I created a simple class having 2 properties value and text. This class I will use to bind to combo box. The class is as shown –
public class MyItem
    {
        public int Value { get; set; } 

        public string Text { get; set; }
    } 

    public class MyItems : ObservableCollection<MyItem>
    {
    } 

Friday, June 1, 2012

Nokia PureView 808 – 41 mega pixel camera – Pre-launch review

The company who brings product in market first, gets the benefit of early bird launching. Then same brand name gets used in various similar products. For example, In India, Colgate was the toothpaste brand came first. So many people asks shopkeeper to give “Babool’s Colgate”. So In India Colgate has become a substitute name for tooth paste. Nokia got the same benefit in India in mobile market. Everyone will agree to the fact that, mobile reached to every single person in India mainly because of Nokia. So the equation was – mobile means Nokia. However, in last few years first Motorola, then Sony Ericson and now Samsung is responsible to end this monopoly of Nokia in Indian mobile market.

Now Nokia has again geared up to penetrate deep in Indian mobile market and is keeping all faith in Nokia Lumia. Similar to Nokia, Computer OS giant Microsoft has lost the wave in Mobile market. Therefore both Nokia and Microsoft will be benefitted if Nokia mobiles running on windows OS become popular.

Nokia understands the people pschycology very well and knows that, people will not notice you till you show some miracle. Nokia is about to bring this new miracle with the launch of Nokia PureView 808 mobile. In coming few weeks Nokia Pureview 808 mobile will be launched in India. Nokia is going to take mobile cameras to new height with the launch of Nokia PureView 808. The camera in Nokia PureView 808 is going to be of 41 mega pixels. This is really unbelievable. Nokia is using satellite technology to bring 41 megapixels camera in Nokia PureView 808.

Usually satellites have excellent quality remote sensors to get the pictures of Earth’s surface from space. These remote sensors are used in Nokia PureView 808 by keeping the efficiency same size is reduced. This is why you can also do HD recording in Nokia PureView 808. The experience of Nokia PureView 808 was provided to people who were present in Nokia Strategy Meet during cricket IPL season.

Monday, May 28, 2012

Set top box and DTH Set top box difference. Things to consider while buying Set top box in India

In India, after digitization, TV transmission is going change. This change in TV transmission will start from 1st July 2012 in 4 metro cities of India. With respect to this announcement, customers in India will have to choose either “Direct To Home (DTH) set top box” or “Cable set top box”. Of course It is customer who is going to get benefitted out of this change. However, I saw that, there are many people who are confused about this change and don’t know what are the important points to be considered before buying DTH or Cable set top box. Following are the few points I feel one should consider while going for purchase of Set Top Box in India. First of all let’s understand digitization.
What is Digitization of TV services –
TV signals are currently distributed in India in analog format as well as digital format. Most cable operators within country provides analog format TV services whereas all DTH operators provide digital format TV services. Digitization means that all household TV sets using cable services would receive digital TV signal through Set Top Box. As a part of digitization every cable operator will be legally bound to transmit digital signals, which can be received at subscribers home through set top box only.
Comparing DTH and Cable Service at high level-
At high level if we compare DTH and Cable set to box, then I will say DTH is better. Because, DTH receives signal directly from satellite and reach to the TV through Set top Box; hence the picture quality is extremely good. However, the primary requirement of DTH is, the sky should be clean else disturbance in signal is observed. Signal disruption is a common problem in rainy season in India. Also DTH is costly and few may not find suitable financially. Cable set top box is attached to TV using fiber wires and it is cheaper as compared to DTH service.
DTH providers in India are Dish, Airtel, Sun, Videocon whereas for cable connection in Mumbai, we have Hathway cable, In cable, DigiCable, Den Cable providers. All these DTH and cable providers work as per rules and regulations set by TRAI however, quality of services will vary depending on the company network capabilities.

Wednesday, May 23, 2012

Windows Azure – Shared Access Signature for Azure Blob Storage Container

My client has amazing chemical gotcha in his mind. One moment he says something and next moment he asks me to do exactly opposite of it.
Anyways, He asked me to create a Private container in Windows Azure Blob storage and then asked me to give rights to access the container for 1 hour. This is where I came to know about creating Shared Access Signature for Blob Storage. Shared Access Signature can be used in scenarios Azure Blob Storage container is private & still you want to give access to it for certain time duration say 10 days.
Following is the example how Share Access Signature can be created for Windows Azure Blob Storage container and how you can retrieve data from it. For demo purpose I am using development storage. As usual, let’s create a simple cloud service project and add a sample web role in it. Then add a page SharedAccessPolicyDemo.aspx in the web role. I added 2 buttons & few labels on the page to create Shared Access Signature for a private container and access data present in the blob. My final Solution structure is as follows –
Page design is as follow -

Wednesday, May 16, 2012

HTC one V – an android 4.0 powered smart phone from HTC - Features and Review


In the field of smart phone, along with BlackBerry, one more company penetrated deep in the market. The name is HTC. Initially, in the starting age, “smart phones mean HTC” was the trend. After that, Samsung and other few companies stepped into smart phone and HTC had gone on back foot. Now HTC is trying to rise again with new series of smart phones.
Great things in Small Packages
HTC describes their new smart phone HTC one V as “Great things in small Packages”. Main change in HTC 1 V lies in the size!!! The new HTC one V is rectangle in shape however corners are curved. Because of this curvature HTC one V has become easy to hold in hand.
Display
 It's a 3.7in LCD panel with a resolution of 480 x 800 pixels. The only downside is that the surface is less oleo phobic (lacking affinity for oils) than other smart phone screens so fingerprints are more vivid.

Thursday, May 10, 2012

Using SQL Azure for Session State Management in Windows Azure Applications

We all know that, Inproc session management will not work in WindowsAzure. I am going to explain you how SQL Azure can be used for maintaining session state in Windows Azure Web Role Applications.
To start with let’s create a simple cloud service project in VS2010 and add a web role in it. Then I opened master page and changed the heading to “Session Management using SQL Azure Demo”. Open default.aspx and add a button and textbox. Input text written by user in textbox will be saved in session on the button click and on another button click it will be populated in label. Code on both the buttons is as follows –
protected void btnAddSession_Click(object sender, EventArgs e)
        {
            Session["Value"] = txtValue.Text;
        }

        protected void btnGetSession_Click(object sender, EventArgs e)
        {
            lblValue.Text = Convert.ToString(Session["Value"]);
        }

So my final solution structure and default.aspx layout is as follows –

Wednesday, May 2, 2012

Heat map using Bing and Windows Azure Web Role

Today I will explain how Azure web role can be used with Bing Maps to draw Heat map based on the input file. The input file data is as follows –
I have state name of USA, latitude and longitude, number of units sold of a product (typical sales data) in the particular state sorted in ascending order.

38.34,-121.29,100,California    
30.26,-84.17,200,Florida         
44.26,-72.57,300,Vermont       
33.26,-112.04,400,Arizona      
39.09,-119.45,500,Nevada       
42.73,-84.55,600,Michigan     
38.19,-84.87,700,Kentucky      
35.28,-97.30,800,Oklahoma    
32.80,-96.76,900,Texas          
46.35,-112.02,1000,Montana    
44.57,-123.02,1100,Oregon      
21.18,-157.51,1200,Hawaii        
38.98,-76.48,1300,Maryland   
35.41,-105.56,1400,New Mexico          
44.22,-100.21,1500,South Dakota        
38.53,-77.02,1600,Washington
39.74,-104.99,1700,Colorado   

I have downloaded heatmap.js javascript file to plot heat map on Bing map using HTML 5 canvas element. The complete code of heatmap.js is here. We need to add this file in Scripts folder of web role.
Now let’s create a web role. I will have my input file added in the web role. In the page load I will read input text file and plot heat map.

Code for HeatMap.js and BingHeatMap.aspx file

Code for heatmap.js is taken from http://alastaira.wordpress.com

/*******************************************************************************
* Description:
* This JavaScript file provides an algorithm that can be used to add a heatmap
* overlay on a Bing Maps v7 control. The intensity and temperature palette
* of the heatmap are designed to be easily customisable.
*
* Requirements:
* The heatmap layer itself is created dynamically on the client-side using
* the HTML5 <canvas> element, and therefore requires a browser that supports
* this element. It has been tested on IE9, Firefox 3.6/4 and
* Chrome 10 browsers. If you can confirm whether it works on other browsers or
* not, I'd love to hear from you!

* Usage:
* The HeatMapLayer constructor requires:
* - A reference to a map object
* - An array or Microsoft.Maps.Location items
* - Optional parameters to customise the appearance of the layer
*  (Radius, Intensity, and ColourGradient), and a callback function
*
*/

var HeatMapLayer = function(map, locations, options) {

  /* Private Properties */
  var _map = map,
      _canvas,
      _temperaturemap,
      _locations = [];

  // Set default options
  var _options = {
    // Opacity at the centre of each heat point
    intensity: 0.5,

    // Affected radius of each heat point
    radius: 20,

    // Colour temperature gradient of the map
    colourgradient: {
      "0.00": 'rgba(255,0,255,20)',  // Magenta
      "0.25": 'rgba(0,0,255,40)',    // Blue
      "0.50": 'rgba(0,255,0,80)',    // Green
      "0.75": 'rgba(255,255,0,120)', // Yellow
      "1.00": 'rgba(255,0,0,150)'    // Red
    },

    // Callback function to be fired after heatmap layer has been redrawn
    callback: null
  };

  /* Private Methods */
  function _init() {

    // Create the canvas element and place it in the DOM
    _canvas = document.createElement('canvas');
    _canvas.id = 'heatmapcanvas'
    _canvas.style.position = 'relative';
    var _mapDiv = _map.getRootElement();
    _mapDiv.parentNode.lastChild.appendChild(_canvas);

    // Override defaults with any options passed in the constructor
    setOptions(options);

    // Load array of location data
    setPoints(locations);

    // Create a colour gradient from the suppied colourstops
    _temperaturemap = createColourGradient(_options.colourgradient);

    // Wire up the event handler to redraw heatmap canvas
    Microsoft.Maps.Events.addHandler(_map, 'viewchangestart', clearHeatMap);
    Microsoft.Maps.Events.addHandler(_map, 'viewchangeend', createHeatMap);

    delete _init;
  }

  /* Public Methods */
  function clearHeatMap() {
    var ctx = _canvas.getContext("2d");
    ctx.clearRect(0, 0, _canvas.width, _canvas.height)
  }

  function createColourGradient(colourstops) {
    var ctx = document.createElement('canvas').getContext('2d');
    var grd = ctx.createLinearGradient(0, 0, 256, 0);
    for (var c in colourstops) {
      grd.addColorStop(c, colourstops[c]);
    }
    ctx.fillStyle = grd;
    ctx.fillRect(0, 0, 256, 1);
    return ctx.getImageData(0, 0, 256, 1).data;
  }

  function colouriseHeatMap() {
    var ctx = _canvas.getContext("2d");
    // Colourise
    var dat = ctx.getImageData(0, 0, _canvas.width, _canvas.height);
    var pix = dat.data; // pix is a CanvasPixelArray containing height x width x 4 bytes of data (RGBA)
    for (var p = 0; p < pix.length; ) {
      var a = pix[p + 3] * 4; // get the alpha of this pixel
      if (a != 0) { // If there is any data to plot
        pix[p] = _temperaturemap[a]; // set the red value of the gradient that corresponds to this alpha
        pix[p + 1] = _temperaturemap[a + 1]; //set the green value based on alpha
        pix[p + 2] = _temperaturemap[a + 2]; //set the blue value based on alpha
      }
      p += 4; // Move on to the next pixel
    }
    ctx.putImageData(dat, 0, 0);
  }

  function setOptions(options) {
    for (attrname in options) {
      _options[attrname] = options[attrname];
    }
  }

  function setPoints(locations) {
    _locations = locations;
  }

  function createHeatMap() {
    // Ensure the canvas matches the current dimensions of the map
    // This also has the effect of resetting the canvas
    _canvas.height = _map.getHeight();
    _canvas.width = _map.getWidth();

    var ctx = _canvas.getContext("2d");

    // Create the Intensity Map
    for (var i = 0; i < _locations.length; i++) {
      var loc = _locations[i];

      // Convert lat/long to pixel location
      var pixloc = _map.tryLocationToPixel(loc, Microsoft.Maps.PixelReference.control);
      var x = pixloc.x;
      var y = pixloc.y;

      // Create radial gradient centred on this point
      var grd = ctx.createRadialGradient(x, y, 0, x, y, _options.radius);
      grd.addColorStop(0.0, 'rgba(0, 0, 0, ' + _options.intensity + ')');
      grd.addColorStop(1.0, 'transparent');

      // Draw the heatpoint onto the canvas
      ctx.fillStyle = grd;
      ctx.fillRect(x - _options.radius, y - _options.radius, x + _options.radius, y + _options.radius);
    }

    // Apply the specified colour gradient to the intensity map
    colouriseHeatMap();

    // Call the callback function, if specified
    if (_options.callback) {
      _options.callback();
    }

  }

  this.SetOptions = function(options) {
    setOptions(options);
  }

  this.SetPoints = function(points) {
    clearHeatMap();
    setPoints(points);
    createHeatMap();
  }

  this.Remove = function() {
    var _mapDiv = _map.getRootElement();
    _mapDiv.parentNode.lastChild.removeChild(_canvas);
  }

  // Call the initalisation routine
  _init();

};

BingHeatMap.aspx –
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BingHeatMap.aspx.cs" Inherits="HeatMapGenerator.BingHeatMap" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Bing Maps Client Side Heat Map</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
    <!-- Include the heatmap library -->
    <script type="text/javascript" src="Scripts/heatmap.js"></script>
    <script type="text/javascript">
           var map;
           var heatmapLayer;

        var coordinatesToMap = <%= coodinateString%>;


           function GetMap() {
               map = new Microsoft.Maps.Map(document.getElementById("divMap"),
           { credentials: "YourBing Map Key",
               center: new Microsoft.Maps.Location(36.592, -95.332),
               mapTypeId: Microsoft.Maps.MapTypeId.road,
               labelOverlay: Microsoft.Maps.LabelOverlay.hidden,
               zoom: 4
           });

               heatmapLayer = new HeatMapLayer(
           map,
           coordinatesToMap,
             { intensity: 0.25,
             radius: 25,
             colourgradient:
                {
                 0.0: '#FF0000',
                 0.1: '#FF0000',
                 0.2: '#FF0000',
                 0.3: '#FF0000',
                 0.4: '#FF0000',
                 0.5: '#FFFF00',
                 0.6: '#FFFF00',
                 0.7: '#90EE90',
                 0.8: '#9ACD32',
                 0.9: '#228B22',
                 1.0: '#008000'                    

//                 0.0: '#FF0000',
//                 0.1: '#FF0000',
//                 0.2: '#FF0000',
//                 0.3: '#FF0000',
//                 0.4: '#FF0000',
//                 0.5: '#FF0000',
//                 0.6: '#FFFF00',
//                 0.7: '#90EE90',
//                 0.8: '#9ACD32',
//                 0.9: '#228B22',
//                 1.0: '#008000' 
                }                     
             }
             );

           }
    </script>   
    <style type="text/css">
        .style1
        {
            width: 100%;
            height: 113%;
        }
    </style>
</head>
<body onload="GetMap();" style="height: 100%">
    <form id="form1" runat="server">
    <table border="1" style="width: 100%; height: 100%;">
       
        <tr>
            <td id="k" >
                <table style="height: 100%; width: 100%;">
                    <tr>
                        <td style="height: 100%; width: 70%;">
                            <div id="divMap" style="position:relative; width:840px; height:480px;"></div>
                           
                         </td>                      
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

BingHeatMap.aspx.cs –
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;


namespace HeatMapGenerator
{
    public partial class BingHeatMap : System.Web.UI.Page
    {
        /// <summary>
        /// variable used for creating point to plot on bing map. This variable will be accessed in javascript code after finalising points to plot.
        /// </summary>
        public string coodinateString = "[";       

        /// <summary>
        /// Page load function used for downloading the input from blob and plotting points on Bing map
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {  
                string line = string.Empty;

                // Read the file and display it line by line.
                System.IO.StreamReader file = new System.IO.StreamReader(AppDomain.CurrentDomain.BaseDirectory + "Input/HeatMapInput.txt");               

                //create random number generator
                Random r = new Random();

                int pointCount = 1;
                while ((line = file.ReadLine()) != null)//read till end of file is reached
                {
                    //split the lne based on ',' delimiter and retrieve lattitude and longitude
                    string[] words = line.Split(new char[] { ',' });
                    double baseLat = Convert.ToDouble(words[0]);
                    words[1] = words[1].Substring(0, (words[1].Length - 1));
                    double baseLongi = Convert.ToDouble(words[1]);
                    double lat = baseLat;
                    double longi = baseLongi;

                    //loop to plot bing map points in the near vicinity
                    for (int i = 1; i <= pointCount + 6; i++)
                    {
                        coodinateString = coodinateString + "new Microsoft.Maps.Location(" + lat.ToString() + "," + longi.ToString() + "),";

                        #region point plotting combination 1
                        if (lat >= baseLat + 2)
                        {
                            lat = lat - r.Next(1, 3);
                        }
                        else
                        {
                            lat = lat + r.Next(0, 3);
                        }

                        if (longi >= baseLongi + 2)
                        {
                            longi = longi - r.Next(1, 3);
                        }
                        else
                        {
                            longi = longi + r.Next(0, 3);
                        }
                        #endregion

                        #region point plotting combination 2
                        //if (lat >= baseLat + 2)
                        //{
                        //    lat = lat - r.NextDouble() - 1;
                        //}
                        //else
                        //{
                        //    lat = lat + r.NextDouble() + 1;
                        //}

                        //if (longi >= baseLongi - 3)
                        //{
                        //    longi = longi - r.Next(1, 3) - 1;
                        //}
                        //else
                        //{
                        //    longi = longi + r.Next(0, 3) + 1;
                        //}
                        #endregion
                    }
                    pointCount = pointCount + 3;
                    //pointCount = pointCount + 1;
                }
                coodinateString = coodinateString + "]";

                //close the file streamreader
                file.Close();
               
            }
            catch (Exception ex)
            {
               
            }
        }
    }
}