Saturday, April 23, 2016

GIDS 2016

Getting ready for the GIDS 2016 Events on 26th Apr 2016 and 27th Apr 2016.

 

Here is my plan for session to attend for Day 1 & 2

Day 1

Day 2

 Looks interesting lot of stuff to absorb. Focus is on Microservices & AngularJS. Will blog as we progress on this event . So watch this blog . cye..


Saturday, May 11, 2013

Power Shell Script for Moving the File from Source Location to Destination Location based on File extension and Tenure wise

Hope this will help.

$SrcFolderPath="D:\SourceFolder"
$DestFolderPath="D:\DestinationFolder"
$Filter=$Filter=".exe",".dll"
function MoveFiles($str)
{
if($str.Attributes -ne "Directory")
{
if ($Filter -contains $str.Extension)
{
if (![string]::IsNullOrEmpty($str.DirectoryName))
{
$a=$str.DirectoryName.Replace($SrcFolderPath,$DestFolderPath)
$b=[string]::Concat($str.DirectoryName,"\$str")
$null= mkdir -Force $a
Write-Host $b
Move-Item -Force $b $a\$str
}
else
{
$a=$DestFolderPath
$b=[string]::Concat($str.DirectoryName,"\$str")
$null= mkdir -Force $a
Write-Host $b
Move-Item -Force $b $a\$str
}
}
}
}
Get-ChildItem -Path $SrcFolderPath -Recurse |
Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-7)} |ForEach-Object {MoveFiles($_)}

Wednesday, January 11, 2012

How to monitor the Execution Plan in Cache of SQL SERVER 2008



create function SqlAndPlan(@handle varbinary(max))
returns table
as
return select sql.text,cp.usecounts,cp.cacheobjtype,cp.objtype,cp.size_in_bytes,qp.query_plan from
sys.dm_exec_sql_text(@handle) as sql cross join
sys.dm_exec_query_plan(@handle) as qp
join sys.dm_exec_cached_plans as cp
on cp.plan_handle=@handle;

create view PlanCache
as
Select sp.* from sys.dm_exec_cached_plans as cp
cross apply SqlAndPlan(cp.plan_handle) as sp

select * from PlanCache

Saturday, April 23, 2011

GIDS 2011 Award Winners

Here are the Award Winners in the GIDS 2011
Best Analytics Award to DevExpress
Best in Development Environment to DevExpress
Best Design and Modeling to IBM Rational Rose
Best Framework Microsoft for Framework 4.0

Best Development Tools to Teleriks

GIDS.NET (19th April 2011)

At the whole Day 1 was very exciting and lot of fun with some good speakers like mark miller , venkat subramanaim,scott davis and others.
It is fun to share the experience of the day 1. So here we go…

Session I

After great struggling with traffic on road manage to reach GIDS 2011 venue. The day started with Ben Walters talk on “ Quality first – Building Quality Into your application throughout the life cycle”.it was 30 min session where Mr. Ben Walters spoke about how to ensure the Quality during the software development life cycle. Here are some the bullet point that was address during the session.
• 8% of companies using TDD in their software development life cycle.
• Test Driven Development should be carried out following below mentioned steps
o Write a Test – It fails ( i.e. Red State)
o Write the code to pass the test – it should pass( i.e. Green State)
o Refactor the code -- to improving the quality (i.e. Blue State)
• Code has to be seen from the client prospect rather than developer prospect.
• We can use the Microsoft visual Studio 2010 to write a unit test easily which will encourage the companies to adopt the TDD.
Session ended with the note that “The take away from this session is for the developer to focus on the fundamental of the technology than latest technologies”.
Session II: Stepping into the near future of the IDE by Mark Miller
Mark Miller Chief Architect of the IDE Tools division at Developer Express started his talk by given us a glimpse of 40 Years of IDE development how IDE evolved for last 40 years. Following which he showcased the Future of Hardware Trends given below
• 5 years down the line -> we will have Kinect & vision/Depth , hi-res & smarter IDE.
• 10 years down the line-> more detailed skeleton of data, including finger, facial recognition and emotion recognition will be added.
• 25 years down the line-> mouse is dead, keyboard goes custom, and Enabled brain implants will be come into effect.
o Look at the image below, you would be wondering what happen to mark miller. Is he becoming the musician/guitarist by any chance? Answer is yes as sort of :)


Actually mark miller what was showcasing the Demo of custom Keyboard what is expected to be the future. Wow awesome right!!!
Addition to above features, IDE will be better control, Tactile Feedback, Augmented Reality.
• 100 years down the line-> mouse is dead, keyboard is dead, and pad will also be dead.
So Mark miller covered the Future of Hardware trends, now let’s see what he has toward IDE future. Here we go.
• Change of Language on Key Press.
• Deeper scanning and understanding towards generating the code like first declaration.
• Modeless flat UI
• Heuristic for method naming.
• Adding the Bitmap within the code itself like dataflow diagram etc.
• Showing the data that is harder to see through highlighting feature.


To summarize the future of IDE we can say future will make the IDE better Quality, more Efficient and Sophisticated.
Wow, future programming will be so easy with this sort of features and we will be able to increase the productivity massively. Best of luck mark awesome job.


Session III: Design Pattern by Ventak Subramaniam


The Session III was yet another good session after a very encouraging session by Mark Miller. Ventak Subramaniam founder of agile developer, Inc, started in more formal way by setting up the agenda for the session which set the mind of the audience that what they can expect from the session very nice way , even I to follow the same approach while giving out the presentation. Agenda for the session was as below.
• Why patterns?
• Abstract Factory
• Cascade Pattern
• Pluggable Behavior
• Execute Around method Pattern (EAM)
• EAM in Exception Test
• Summary.


Pattern gives proven and tested way for implementing certain solution. Mr. Ventak started explaining how factory pattern help development and project to follow the best practice. He explained the scenario where object is created by developer but unloading of object is not handled. By having a static method for creating the object, performing the transaction and releasing the object. The Developer of the class can ensure object creation and destruction is done properly without adding the implication on developer to handle the creation, execution and destruction of object.


Now it’s time for Cascade Pattern, Mr. Ventak consider the Mailer class for explaining the Cascade Pattern where in by making the method of the class to return the object of that class can give a better readable and not redundant code.

 
Here is the example
Let say we have below shown mailer class
1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Public  class Mailer{
Private string strToEmailId=string. Empty;
Private string strFromEmailId=string.Empty;
 Protected void To(String strEmailId)
{ If(strEmailId.Lenght>0)
{
 strToEmailid=strEmailId;
}
}
Protected void From(String strEmailId)
{ If(strEmailId.Lenght>0)
{
 strFromEmailId =strEmailId;
}
}
Protected void Send()
{
// code for send the mail using strToEmailid, strFromEmailId;
}
}
}
//Using the Mailer class
Static void main ()
{
 Mailer mailer= new Mailer();
mailer.To(.);
mailer.From();
mailer.send();
}

In the above code we are using the object name more than once for calling its method. But this can be avoided by using the Cascade Pattern. Now lets refactor the Mailer class code to use cascade pattern.
1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Public  class Mailer{
Private string strToEmailId=string. Empty;
Private string strFromEmailId=string.Empty;
Protected Mailer To (String strEmailId)
{ If(this.strEmailId.Lenght>0)
{
 this.strToEmailid=strEmailId;
}
 return this;
}
Protected void From(String strEmailId)
{ If(this.strEmailId.Lenght>0)
{
 this.strFromEmailId =strEmailId;
} 
return this;
}
Protected void Send()
{
// code for send the mail using strToEmailid, strFromEmailId;
}
}
}
//Using the Mailer class after refactoring with Cascade pattern
Static void main ()
{
 new Mailer().To(.).From().send();
}

That’s the Cascade pattern very simple and elegant. No come the Execute Around Method pattern click on the for more details. These patterns are taken from Smalltalk. At the whole I got to learn some more patterns which keeps me going thanks to Mr. Venkat. Also I got to learn one more thing that I like to share , using of System.Activator class that Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects. This class cannot be inherited. That’s nice :)

Saturday, April 16, 2011

GIDS 2011 Event

Sessions that i will be attending are as follows.

GIDS .net - DAY 1

  • Quality First - Building Quality Into Your Application Throughout the Lifecycle--Ben Walters

  • Stepping into the Near Future of the IDE--Mark Miller

  • Design Patterns for .NET Programmers--Venkat Subramaniam

  • Caring about Code Quality--Venkat Subramaniam

  • Agile Estimation--Stephen Forte

  • JavaScript for the C# Developer--Julian M. Bucknall

  • The Science of Great UI--Mark Miller

  • Complexity Theory and Software Development--Tim Berglund


  • GIDS.WEB - Day 2
  • Building the Next Generation of Experiences--Arijit Chatterjee

  • PlayBook - Change the Game!--Andrew Vardon

  • Building Trust into Software--Vishnu Patankar

  • Tomorrow's Tech Today: HTML 5--Scott Davis

  • Programming with HTML 5--Venkat Subramaniam

  • Unleashing a more Beautiful Web--Harish Vaidyanathan

  • jQuery at Work: A Beginner's Guide--Tom Marrs

  • Introduction to WCF RIA Services for Silverlight 4 Developers--Stephen Forte

  • JavaScript - There's a Real Language In There--Venkat Subramaniam
  • Sunday, August 15, 2010

    Concatenating the pdf files into a single consolidated pdf file

    Hi folks,
    I’m back with a helpful stuff for those people looking for concatenating the pdf files into a single consolidated pdf file. Also this piece of code exhibit use of iTextSharp open source library. You can get this library from below mentioned link.
    iTextSharp Library
    Ok, Lets start step by step
    1) Download the library.
    2) Create a Console application.
    3) Add the reference to itextsharp.dll assembly.
    4) Add below given code into appropriate files and add these files to your project.
    5) Build this application.
    6) Now you are set to go.
    What this program do?
    It a command line application which takes output pdf file name along with path as the first argument followed by list of the source file(i.e. source pdf files) names along with path for each file. On successful execution of the application all the pdf documents will get consolidated into output pdf file.

    Program.cs


       1:  using System;

       2:  namespace ConcatenatePDF

       3:  {

       4:      /// <summary>

       5:      /// 

       6:      /// </summary>

       7:      class Program

       8:      {

       9:          /// <summary>

      10:          /// 

      11:          /// </summary>

      12:          /// <param name="args"></param>

      13:          static void Main(string[] args)

      14:          {

      15:              if(args.Length>1)

      16:              {

      17:                  try

      18:                  {

      19:                      string[] sourceFile = new string[args.GetUpperBound(0)];

      20:                      Array.Copy(args, 1, sourceFile, 0, args.GetUpperBound(0));

      21:                      string strMsg=PDFOperations.ConcatenatePDF(sourceFile, args[0]);

      22:                      Console.WriteLine(strMsg);

      23:                      Console.ReadKey();

      24:                  } catch (Exception ex)

      25:                  {

      26:                      Console.WriteLine(ex.Message);

      27:                  }

      28:              }

      29:          }

      30:      }

      31:  }



    PDFOperations.cs



       1:  #region Using Directives

       2:  using System;

       3:  using System.Collections.Generic;

       4:  using System.IO;

       5:  using System.Security;

       6:  using System.Security.Permissions;

       7:  using System.Text;

       8:  using iTextSharp.text;

       9:  using iTextSharp.text.pdf;

      10:  #endregion

      11:  namespace ConcatenatePDF

      12:  {    /// <summary>

      13:      /// PDFOpertaions class holds the methods to perform various tasks as of now

      14:      /// PDFOperations class have the method for concatenate the PDF file into a single pdf file.

      15:      /// </summary>

      16:      public class PDFOperations

      17:      {

      18:          /// <summary>

      19:          ///  This Method can be used for concatenating the more than on pdf file into a single 

      20:          /// pdf file. 

      21:          /// </summary>

      22:          /// <param name="sourcePdFfiles">This string arrays will hold the filenames along with the path to be 

      23:          /// concatenated

      24:          /// </param>

      25:          /// <param name="destinationPdfFile">Name of the output file along with path</param>

      26:          public static String ConcatenatePDF(Array sourcePdFfiles, string destinationPdfFile)

      27:          {

      28:              int numberOfPages;

      29:              StringBuilder stringBuilder= new StringBuilder();

      30:              List<string> srcPDFFileList = new List<string>();

      31:              Document pdfDoc = new Document();

      32:              FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, destinationPdfFile);

      33:              try

      34:              {

      35:                  f2.Demand();

      36:                  PdfCopy copy = new PdfCopy(pdfDoc, new FileStream(destinationPdfFile, FileMode.CreateNew));

      37:                  pdfDoc.Open();

      38:                  foreach (string file in sourcePdFfiles)

      39:                  {

      40:                      if (File.Exists(file))

      41:                      {

      42:                          PdfReader reader = new PdfReader(file);

      43:                          numberOfPages = reader.NumberOfPages;

      44:                          for (int pageCount = 0; pageCount < numberOfPages; )

      45:                          {

      46:                              copy.AddPage(copy.GetImportedPage(reader, ++pageCount));

      47:                          }

      48:                      } else

      49:                      {

      50:                        stringBuilder.Append(String.Format("{0}: {1}", file, ": This file does not exists.\n"));

      51:                      }

      52:                  }

      53:                  pdfDoc.Close();

      54:                  if (File.Exists(destinationPdfFile))

      55:                  {

      56:                      stringBuilder.Append(String.Format("{0}: {1}", destinationPdfFile, ": created successfully.\n"));

      57:                  }

      58:              } catch (UnauthorizedAccessException s)

      59:              {

      60:                  stringBuilder.Append(String.Format(" Error Occurred :{0} \n", s.Message));

      61:                 

      62:              }

      63:              catch (SecurityException s)

      64:              {

      65:                  stringBuilder.Append(String.Format(" Error Occurred :{0} \n", s.Message));

      66:              }

      67:             return stringBuilder.ToString();

      68:          }

      69:      }

      70:  }



    Please provide the feedback and revert for any clarification