Friday, March 13, 2015

Windows 10 for Raspberry PI

Microsoft announced that windows 10 would be available for Raspberry PI. Although, this version will be quite different version than what is being used in Desktops and will be much faster.

New Raspberry PI tourbocharges with new Broadcom BCM2836 system-on-chip. This is a VideoCore IV GPU with four 900MHz ARMv7 Cortex-A7 cores. Also, there’s twice as much memory: 1GB LPDDR2 SDRAM.

Windows 10 for the Raspberry Pi 2 will be available for free for the maker community via Microsoft’s Windows Developer Program for IoT.

Have ordered my new Raspberry PI and waiting for it to be delivered.

Thanks,
Ujjwal

Tuesday, December 16, 2014

Features of MVC 6 and ASP.Net vNext

1. MVC 6 added new cloud computing optimization system of MVC , web API, SignalR and entity framework.

2. The Microsoft  make a bundle of MVC, Web API, WebPages, SignalR , That bundle we called MVC 6.

3. In MVC 6, Microsoft removed the dependency of system.web.dll from MVC 6  because it's so expensive. Typically  it consume 30K memory per request/response.
Right now, in MVC 6 consume 2K  memory per request response. It's too small memory  consume.

4. Most of the problem solved using the Roslyn Compiler.

5. The ASP .Net  vNext used the Roslyn Compiler,  By using Roslyn compiler do not need to compile the application Its  compile automatically the application code.

6. The .Net vNext is a cross platform and open source.


7. The .Net vNext has the new project extension project.json. Basically project.json contain the all dependency dll of the application.

8. In MVC 5.1 and 5.2 support to Enum and EnumHelper in  razor views.

9. MVC 6 added new cloud computing optimization system of MVC ,
web API, SignalR and entity framework. The Microsoft  make a
bundle of MVC, Web API, WebPages, SignalR , That bundle we called MVC 6. In MVC 6, Microsoft removed the dependency of system.web.dll

Friday, November 21, 2014

Encoding issue when exporting linq data to CSV C#

Hi,

I had been generating export in csv format from C# Code.

I faced an issue where CSV content heading had some Currency symbols and those were perfectly getting displayed in CSV but when you open those in excel, it shows some corrupted symbols.

i managed to resolve it using below sequence of development tasks.

My Earlier Code

  byte[] Bytes = GetFileDataBytes(filename);
 return File(Bytes , "text/csv", "report-" + DateTime.Now.ToString("yyyy-MMM-dd") + ".csv");

My New Code

  byte[] Bytes = GetFileDataBytes(filename);
 var result = Encoding.UTF8.GetPreamble().Concat(Bytes).ToArray();
 return File(result , "text/csv", "report-" + DateTime.Now.ToString("yyyy-MMM-dd") + ".csv");

Using Above code, i managed to open csv in excel with all special characters in it. :)

Thanks,
Ujjwal

Tuesday, June 24, 2014

Hike Messenger Download

Hi,

Recently i downloaded Hike Messenger on my Note 3 mobile. I am already using whatsapp. The great feature i liked about Hike is the Location sharing feature, its really great. I'll post other features soon.

Thanks,

Ujjwal

Friday, May 30, 2014

Issue Rendering Large Table in Internet Explorer 9 using jquery modal box dialog

Hi,

Recently i had to render large amount of data in an html table in modal dialog box. This worked fine in all browsers except internet explorer 9 specifically. The problem was some rows getting skipped while rendering.

I had a simple table structure in jquery template as below
<pre>
<tr>
<td>
value 1
</td>
<td>
value 2
</td>
<td>
value 3
</td>
</tr>
</pre>
and so on....

I struggled a lot to find the root cause and discussed it on many forums, some said its due to memory related issues in Internet Explorer 9 and some were questioning on the jquery table structure i have used.

However, i managed to resolve this simply by removing extra spaces from td tag. Something like below solved my issue :

<pre><tr><td>value 1</td><td>value 2</td><td>value 3</td></tr></pre>

Let me know if you have any questions.

Cheers,

Ujjwal

Tuesday, April 1, 2014

Saving handsontable data

What prompted me to use handsontable

I was working on replacing an old Excel web control with a more user friendly and needed a JavaScript library that provided the functionality that I needed. After investigating several libraries I decided that handsontable provided me the best solution.

I thank Marcin Warpechowski, for creating this wonderful library. The community around this is very helpful and this library is rapidly evolving into an even better library!

What my solution involved

My project that I was implementing handsontable was a classic example of Web Forms with PostBack and code behind access of form elements directly.

How to save the data

I did not try to create a Web Form custom element, instead I just took advantage of what was already implemented. I started out with creating everything I needed to render a blank handsontable to my page where I was replacing this old control. You can get that from the handsontable demo pages.
I then added the JSON2 library, from Douglas Crockford's Github repository, to my project and included it in the page that the table is on.

Lastly, I used jQuery to bind an event on the form submission that ran a simple verification that there were no invalid cells in my table. If my table was completely valid, then the event would harvest the data from handsontable and with JSON2 serialize that data into a valid JSON string and save it into a hidden field that my code-behind would pick up. Once it is on the server you can do what you need to do to this.

How to retrieve the data

With Web Forms and the page I was working with, I needed to be able to repopulate the table with data that had traveled across my PostBack event. So just as I did with my form submission event, I wrote a specialized page load event that populated an object for my handsontable to use during it's creation.

My event just listens for the ready event of the page and then looks for that hidden field I created to save the data. It pulls the data out of the hidden field and uses JSON2 to deserialize the object out of the string and that result is passed to my handsontable create table method.


var hst = (function () {
  var $container = $("#hst");

  $container.handsontable({
    startRows: 8,
    startCols: 6,
    rowHeaders: true,
    colHeaders: true,
    minSpareRows: 1,
    contextMenu: true
  });

  hst = $container.data('handsontable');

  var $dataLocker = $("#dataLocker").val();

  if ($dataLocker.length > 0) {
    var data = JSON.parse($dataLocker);

    hst.loadData(data);
  }
  return hst;
})();

// Enable a click handler for the button to save data and submit the form
$("#saveContent").click(function (e) {
  // Save the table data before sending the form
  $("#dataLocker").val(JSON.stringify(hst.getData()));
  $("body > form").submit();

});




using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using Newtonsoft.Json;

namespace HandsonDemo
{
    public partial class _Default : System.Web.UI.Page
    {
        protected HtmlInputHidden dataLocker;
        private List<List<int?>> Data = new List<List<int?>>
        {
            new List<int?> { 1, 2, 3, 4, 5, 6 },
            new List<int?> { 7, 8, 9, 10, 11, 12 },
            new List<int?> { 13, 14, 15, 16, 17, 18 },
            new List<int?> { 19, 20, 21, 22, 23, 24 },
        };

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                // if we are posting data to the server deserialize it so that we can manipulate it
                Data = JsonConvert.DeserializeObject<List<List<int?>>>(dataLocker.Value);
            }

            // store the data object to be rendered to the handsontable
            dataLocker.Value = JsonConvert.SerializeObject(Data);
        }
    }

}