Monday, July 20, 2015

Get the benefit of Linda.com trail period

Linda.com offers a free trail period of 10 days to access all there valuable resources.
Get the most out of it.

10 Days Trail


























Monday, March 31, 2014

Improve productivity using Visual Studio Add-Ins - Free Stuff

Here's the ones that make my life better.

Productivity Power Tools 2013


A set of extensions to Visual Studio Professional (and above) which improves developer productivity.

Summary of features

  1. Peek Help
  2. Solution Explorer Errors
  3. Structure Visualizer
  4. Double click to maximize windows
  5. Timestamp margin
  6. Quick tasks – Edit Present On
  7. Ctrl + Click to Peek Definition
  8. HTML Copy improvements
  9. Recently Closed Documents
  10. Match Margin
  11. Power Commands context menu cleanup
  12. Quick Tasks
  13. Power Commands
  14. Color printing
  15. Middle-Click Scrolling 
  16. Organize Imports for Visual Basic
  17. Custom Document Well
  18. Tools Options Support
  19. HTML Copy
  20. Fix Mixed Tabs
  21. Ctrl + Click Go To Definition
  22. Align Assignments
  23. Column Guides
  24. Colorized Parameter Help 


CodeMaid is an open source Visual Studio extension to cleanup, dig through and simplify our C#, C++, F#, VB, XAML, XML, ASP, HTML, CSS, LESS, JavaScript and TypeScript coding.

Summary of features

  1. Code Cleaning
  2. Code Digging
  3. Reorganizing
  4. Formatting
  5. Collapsing
  6. Progressing
  7. Configuring
  8. Switching
  9. Joining
  10. Finding
NuGet Package Manager


A collection of tools to automate the process of downloading, installing, upgrading, configuring, and removing packages from a VS Project.


Adds many useful features to Visual Studio for web developers.



SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.



Code Compare is an advanced file and folder comparison tool. This programming languages oriented diff tool can be used as a Visual Studio add-in and as a standalone application.



GhostDoc is a Visual Studio extension that automatically generates XML documentation comments for methods and properties based on their type, parameters, name, and other contextual information.

Benefits

  • Save keystrokes and time
  • Simplify documenting your code
  • Benefit of the base class documentation
  • StyleCop compliant documentation templates
  • XML Comment Preview

An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with a tool window. Extra options are available to control how elements and attributes in XML and MAML files are spell checked.



SQL Server Compact 3.5 and 4.0 Toolbox add-in for Visual Studio. This add-in adds several features to help your SQL Server Compact development efforts: Scripting of tables and data, import from SQL Server and CSV files and much more.


Another must have tool for developers - LINQPad

Wednesday, January 15, 2014

Lazy Initialization

Lazy initialization is an amazing feature which is introduced with .NET 4.0


Lazy initialization means delaying initialization until a object or component is used.

Advantages.
* Improve performance
* Avoid wasteful computations
* Reduce program memory requirements

Real life situations for apply.

Users don't have to pay initialization time for features they will not use. Suppose you were initialize some components of your application up front. This will slowdown the application startup and users would have to wait dozens of seconds or minutes before application is ready to use.They are waiting on initialization of features that they may never use or not use right away.

If you defer initializing those components until its use time, your application will start up much quicker.

Quick demo :-

Classes :

    public class Subject{string id;}

    public class Student
    {
        private readonly Lazy<Subject> lazySubjects;
        private readonly Subject subject;

        public int Id { get; set; }
        public string Name { get; set; }

        public Subject LazySubject
        {
            get { return this.lazySubjects.Value; }
        }

        public Subject Subject
        {
            get { return this.subject; }
        }

        public Student()
        {
            lazySubjects = new Lazy<Subject>();
            subject = new Subject();
        }
    }

Test method :

 public MainWindow()
        {
            //Create Student object as lasy initialization
            Lazy<Student> studentObject = new Lazy<Student>(true);

            //Check whether Student object is actually created or not
            bool isStudentCreated = studentObject.IsValueCreated;

            //Sets the id of the Student
            studentObject.Value.Id = 1;

            //Check whether Student object is actually created after getting the customer Id
            bool isStudentCreatedFinish = studentObject.IsValueCreated;
        }

Here you can see the object is not getting initialized until you are accessing it.

Reference : http://msdn.microsoft.com/en-us/library/dd997286(v=vs.110).aspx

Thursday, January 24, 2013

Check if Internet connection is available with C#

There can be situations when you need to check, whether your application has Internet access
Maybe you have to download/upload some file or database, or just run some application check. 
In my case, my application mainly developed based on Service Oriented Architecture. So application must have an Internet connection to work.
There are plenty different ways to archive this. I will describe the one which is very easier first.
This is the method.


System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()


If you want to check whether the internet connection is available on application life time, you can have a timer and check whether the connection is available. If not you can set warning for the user.
Here how I done that in WPF.


using System.Threading;
using System;
namespace Example
{
 public partial class MainWindow : Window
 {
        private Timer timer;
        public MainWindow()
        {
            InitializeComponent();
            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            { 
               MessageBox.Show("Internet connection not available, \n Please check your connection");
               return;
            }
            timer = new Timer(UpdateNetworkStatus, nullnew TimeSpan(0, 0, 0, 0, 500), new TimeSpan(0, 0, 0, 0, 500));
            lblNetworkStatus.Visibility = Visibility.Collapsed;
        }
        private void UpdateNetworkStatus(object o)
        {
            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                lblNetworkStatus.Visibility = Visibility.Visible;
            else
                lblNetworkStatus.Visibility = Visibility.Collapsed;
        }
 }
}

Will clean this a bit and describe the other ways once I got free time.
I just write this blog post because I thought that it will helpful for most of the developers.
Cheers!!!

Friday, January 4, 2013

How to Improve ASP.NET Performance

Yesterday I had an interview for the senior software engineer at xxx company :) One interview question leads me to write this post. The question was,

If there is an ASP page with a grid which will contain a millions of data on it, how do you going to improve the performance?

At that circumstance I can only think about the pagination as I haven't even think about such situation before. :) So I try to tell about pagination in different ways. such as by having page numbers at the bottom of the grid, or load data accordingly when scrolling the page etc.. :)
All are correct but not the exact answer. Finally he given me the answer. It was

By Disabling the View State.

Then I have a problem about, Why is that correct? ( I can't again ask that from the interviewer.. :) so I kept that in my mind and return back to home.)

Actually If the page doesn't have any user inputs and no point of having view state. So we can simply disable that. It will save CPU Time to build the view state.

Then you will have a problem about, How to disable the View State?

This is how each page's header looked after the change:

<%@ Page EnableViewState=”false”...%>

This is pretty simple change for ASP.NET mark up, So no rebuild required.

And also I like to mention another point here.
If you are accessing the session only for reading in some pages you can set the EnableSessionState for ReadOnly. It's again improve the performance of the page.
This is how you do both at the page header

<%@ Page EnableViewState=”false”EnableSessionState=”ReadOnly” ...%>

Here is the link for get more deep idea about Improving .NET Application Performance and Scalability

Hope this will help you.

How to ensure external files correctly get copied when publishing

Before I go into the topic I have to say, this is my first blog post. So It might have some issues. Please apologize me on that. :) The main reason I have motivated to write this blog is to give my experience on software development to out side world. Then they can over come the issues I faced really easily.
Lets start.
Yesterday I was working on some project which associated with the SQLight. Actually project was working really fine on my developer machine and when it gets published it was stopped working on client machine as saying,
So I searched many blog posts and internet to solve that issue, but came up with nothing as I cant find exact way to search on that issue. :)
I did several experiments to over come that issue. Finally I came with a solution by changing the external file properties. Luckily it was solved.
Following is the way to follow that.
  1.  Go to solution explorer
  2.  Right click on the file you want to send with the release
  3.  Click on properties
  4.  Set Build Action into Content
  5.  Set Copy to output directory into Copy if newer or Copy always ( I will discuss about the difference of those later)
  6.  Publish :)

Yes. That't it. Hope It will help you.
Cheers!...