Friday, May 30, 2014

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


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
value 1
value 2
value 3
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.



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");

    startRows: 8,
    startCols: 6,
    rowHeaders: true,
    colHeaders: true,
    minSpareRows: 1,
    contextMenu: true

  hst = $'handsontable');

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

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

  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
  $("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);


Monday, March 31, 2014

CSS Score

(Original Article at

We all know that when many conflict css properties can be applied for one web element, it is by specification that the more specific properties will be applied. However, specific is an abstract word. Hence, it is better that we know about css score, or how browser choose which properties to override. 

Browser categorize css to 4 categories with the specificity from high to low as: 

1/ Style Attribute:

  • 2/ ID: #some_id{ color: red;} 

    3/ Class, pseudo class, attribute: .some_class {color:green;} 

    4/ Elements: li {color:black;} 

    From W3C recommendation, the result of this calculation takes the form of four comma-separated values, a,b,c,d,1 where the values in column “a” are the most important and those in column “d” are least important. A selector’s specificity is calculated as follows: 

    To calculate a, count 1 if the declaration is from a style attribute rather than a rule with a selector (an inline style), 0 otherwise. 
    To calculate b, count the number of ID attributes in the selector. 
    To calculate c, count the number of other attributes and pseudo-classes in the selector. 
    To calculate d, count the number of element names and pseudo-elements in the selector. 
    Here is one example using this rule: 

    body#home div#warning p.message --> 0, 2, 1, 3 

    Please notice the comma ',' in the css score, it is there to remind us that the score b, c, d can be equal or bigger than 10. Still, the rule to compare is left to right.

    Checking Javascript errors remotely

    Think of a scenario where your website has gone LIVE. Now there occurs a JavaScript error and because of that the record cannot be saved in database and this happens only with internet explorer 7. The client is now complaining.  You checked this at your end to analyse but it seems to be working at your end.

    For scenarios like above, i found a great tool which can help us to monitor JavaScript errors. Yes, but for this you need to add a script in the page where you want to monitor. Check below link

    Tuesday, January 28, 2014

    Real-Time Distributed Software Development Using Eclipse


    I recently came across a cool plugin that enables  Real-Time Distributed Software Development Using Eclipse.

    What is Saros? What is it not?

    Saros is an Open Source Eclipse plugin for distributed collaborative software development.

    • Currently, it works only with and within Eclipse. Saros users can use all Eclipse functionality as usual.

    Saros is a real-time collaborative editor for eclipse projects.

    • All collaborators have an identical copy of Eclipse projects.
    • Two or more users can jointly edit files in the project.
    • Each user has and modifies his or her own copy of the file locally.
    • Saros keeps these copies in sync by transmitting each change to all of the other collaborators.

    Saros supports up to 5 participants at once.

    • Saros is designed to at least work with two participants in a session - as inherent for pair programming.
    • But it supports up to 5 distributed parties in a session.
    • The initiator of a session, the host, has a privileged role.

      Saros is not screen sharing, desktop sharing, or application sharing.

      • That means for instance that it does not support joint interactive testing.

      Saros can be used in various scenarios:

      Joint review
      One participant ("driver") reviews the contents of one or more files together with other participants ("observers"). Saros is set to always show the observers the same region of text (program code or whatever else) that the driver sees ("follow mode"). At any time, any participant (driver as well as observers) can highlight text with the mouse for all the others to see. Also, any participant can become driver at any time.
      Introducing beginners
      Much like before, except that explaining rather than reviewing is the goal. Each of the beginners (staying in the observer role) can individually peek at other regions of the file or even other files without influencing the flow of the session for the others. To do that, s/he will temporarily leave follow mode.
      Distributed Party Programming
      Two or more participants work together in a loosely coupled fashion. They work independently much of the time, but can call one of the others to help whenever the need arises, for possibly only a very short time or for a longer episode. In this mode, distributed work can even be more powerful than working in the same room, as nobody needs to leave a seat to help multiple others in the course of an hour. Just think how this can speed up the coordination work just before release time after a code freeze!
      Distributed Pair Programming 
      Is a particular form of Distributed Party Programming in which two people develop code or text in continuous close collaboration, discussing the approach and combining the best of their ideas.

    Tuesday, January 14, 2014

    Friday, November 1, 2013

    Upgraded to OSX Mavericks on my Mac


    I upgraded my Mac with OSX Mavericks.  Apple claims that they have made improvements on speed, multiple windows and yeah, they seem to have succeeded in that.

    Upgradation process went smooth and it was quick and steady.


    Ujjwal Soni

    Friday, October 25, 2013

    New line break problem with EPPLUS when exporting data


    Recently i have been facing an issue while exporting data  using C# and EPPLUS. I used below solution to get that done ::

    Since my data is coming from stored procedure and this data is stored in a single column, i used a special character to seperate data.


    so in excel this will be displayed as


    if you send data from DB like for example :: ENTRY1\r\nENTRY2, it didnt work even if i convert that to a string. So, i replaced this special character in my c# code.

      int rowCnt=ws.Dimension.End.Row;
               for (int i = 1; i <= rowCnt; i++)
                 using (var rngs = ws.Cells["FD"+i])
                   var rt1 = rngs.RichText.Text;
                   if (!string.IsNullOrEmpty(rt1))
                     rngs.Style.WrapText = true;
                     var rt2 = rng.RichText.Add(rt1.Replace("***", "\r\n"));
                     rngs.Style.WrapText = true;


    Ujjwal Soni

    Thursday, October 17, 2013

    Internationalization in Demandware

    i18n / internationalization

    Although internationalization (or i18n for short) covers a number of different aspects, its primaryrole is to provide pages in multiple languages. To ensure this can be achieved, one should never include language-specific text in a template or controller directly. Instead of this, one should use the Demandware property mechanism. As familiar from languages such as Java, this permits thedefinition of entities known as "property" files, which assign the actual language-specific texts to unique keys. Since Demandware loads all property files automatically, this means you always have access to the keys of all property files.

    Instead of using the Resource class from Demandware, you should utilize the i18n method provided by the framework. This offers a few extensions that, among other things, permit the utilization of property file content in frontend JavaScript functions.
    Sample property file (""):

    user.profile.complete.head=Complete Your Profile is this?


    Ujjwal Soni

    Demandware UX Studio plugin installation in eclipse

    Step 1:  In Eclipse, from the main menu,  select  Help > Install New Software.
    The Available Software dialog appears.

    Step 2:  In the Work with field, enter the URL for your version of Eclipse:

        Indigo -
        Juno -

    Step 3:  Select Demandware from the list and select Next. At this point Eclipse will compare the UX Studio requirements with what is available to ensure compatibility. After this process is complete,
     the Install Details dialog appears. 

    Step 4:  Select the I accept the terms of the license agreements button and then select Finish. The Installing Software dialog appears showing the progress of the installation.

    Step 5:  Select Yes when prompted to restart Eclipse.


    Ujjwal Soni

    Wednesday, October 16, 2013

    Demandware Graphical Pipelines Disadvantages


    Below are some disadvantages i discovered while working on demandware :

    The graphical pipelines have a number of disadvantages. First, they are highly static and difficult to maintain. Above all, however, it is also theoretically impossible to work on a pipeline with multiple developers. The reason for this is that even the repositioning of a single pipe let leads to changes at various places in the XML file – a file in which the pipeline is ultimately saved. This leads to a situation where conflicts that occur when merging before checking-in to a shared repository are very difficult – or impossible – to resolve. In addition, the URLs that result from the pipeline model are strictly predefined (

    Above all, i found implementing MVC model much better and easy in comparision to Graphical Pipeline.

    Comments are welcomed.


    Ujjwal Soni

    Thursday, October 10, 2013

    SharePoint Vs LifeRay

    Similarity between SharePoint and LifeRay
    NoSharePoint Server 2010Liferay 6.0.9 CE
    1SharePoint have web Part which only render in portion of the PagesLiferay have Portlet which also have same feature
    2Per User Website provide by SharePoint (Standard and Enterprise Edition contain this feature)Per User custom Page is present in Liferay
    3User Profile does collaboration part for SharePointOpenSocial provides collaboration plugins for LifeRay
    4Finding Employee(User) is very easilyFinding Employee(User) Search is very easily
    5Visual Studio 2010 IDE contain template for SharePointEllipse or Liferay Studio IDE contain template for SharePoint
    6Multi tenancy is fulfilled with Farm / Site CollectionMulti tenancy is fulfilled with Department (as per Liferay )
    7SharePoint Setup information is store in Database and registryLiferay Setup information is store in XML file only
    8Document Versioning and Co –Worker changes can be done in SharePointLiferay Plug ins Social Office provide very similar feature in it.
    Difference between SharePoint and Liferay
    NoSharePoint Server 2010Liferay 6.0.9 CE
    1Publishing Feature which give provision for user to have data entry pages convert into WebPagesLiferay does not have any such provision for Publishing
    2Database is very complex and customization is not recommendedLiferay Database is very simple and custom query can be written on it
    3SharePoint Designer give huge boost to Information Worker to work on itInformation worker need to be depend Developer for lots of activity which can be done by Information Worker
    4SharePoint UI is different and learning is requireLiferay UI is very simple and easily to learn in it.
    5Lots of Activity can be done without writing single line of CodePlugins can help but still user does not have lots of controls as compare to SharePoint
    6User can View their Microsoft Office content in the BrowserLiferay does not have this provision in it
    7SharePoint Enterprise Search is too huge and provide lots of option to filter and data gathering  and so onLiferay search is simple as compare to SharePoint Enterprise Search (Plugins can make Liferay search upto SharePoint Enterprise Search)
    8Business Connectivity Service provide option for integrated with another Enterprise Product with in OrganizationLiferay does not have any such feature either Plugins or Web Service can fulfil this needs
    9SharePoint Does not have chat service integrated with itLiferay have chat and lots of other service integrated with it (plugins are provided with setup)
    10Microsoft Own SharePointCommunity Developed and Open Source
    11Support is very Expensive from Microsoft and never come under LicenseEnterprise Edition provide Support which is part of the license
    12Single Instance cannot be @ zero cost  ( Windows Server 2008 R2 , SQL Server 2008 & )Single Instance can be @ zero cost (Ubantu OS, My SQL Database)
    Personnel Option
    1. Liferay is very cheap and good solution for small and mid size enterprise
    2. Liferay UI is too good and user can learn very easily
    3. SharePoint is good tools for Rich and Large organizations
    4. SharePoint have lots of feature as compare to Liferay
    5. Liferay is better than other CMS tools like Dot Net Nuke , Orchard , Word Press , Joomla or Drupal
    1. http://www.liferay .com
    2. LifeRay Development Guide
    3. LifeRay Administrator Guide

    Monday, September 16, 2013

    Tuesday, August 6, 2013

    Copying files over network shared folder using Java

    Problem :: One of my blog reader posted a problem that he cannot copy files over a network shared folder using java.

    Solution :: Java alone doesn't have support for networked file sharing. But if you use a library, like Samba, then you can. 

    You can check below source code which successfully copies file from my local drive to a shared network folder ::

     * To change this template, choose Tools | Templates
     * and open the template in the editor.
    package networkupload;

    import jcifs.Config;
    import jcifs.smb.NtlmPasswordAuthentication;
    import jcifs.smb.SmbFile;
    import jcifs.smb.SmbFileOutputStream;

     * @author ujjwal
    public class NetworkUpload {

         public static void main(String[] args) throws IOException {
      final String userName = "Ujjwal";
      final String password = "ujjwal12345";
      final String domain = "ujjwal12345";
      //source path begins with / as i am using macbook (mac osx), in your case it will be windows drive path
      final String sourcePath = "/Developer/test.pdf";
      final String destinationPath = "smb://";

      copyFileUsingJcifs(domain,userName, password, sourcePath, destinationPath);

      System.out.println("The file has been copied using JCIFS");

     public static void copyFileUsingJcifs(final String domain,final String userName,
       final String password, final String sourcePath,
       final String destinationPath) throws IOException {

      final NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
        domain, userName, password);
      final SmbFile sFile = new SmbFile(destinationPath, auth);
      final SmbFileOutputStream smbFileOutputStream = new SmbFileOutputStream(
      final FileInputStream fileInputStream = new FileInputStream(new File(

      final byte[] buf = new byte[16 * 1024 * 1024];
      int len;
      while ((len = > 0) {
       smbFileOutputStream.write(buf, 0, len);

    If you face any issues implementing this code, you can contact me ::
    Ujjwal Soni
    best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4actual-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | money-back-guarantee    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    |    |    |