Tuesday, October 25, 2016

How to add/concatenate string in Excel

The CONCATENATE function in Excel is designed to join different pieces of text together or combine values from several cells into one cell.

The syntax of Excel CONCATENATE is as follows:
CONCATENATE(text1, [text2], …)

Concatenating the values of several cells
The simplest CONCATENATE formula to combine the values of cells A1 and B1 is as follows:
=CONCATENATE(A1, B1)

Concatenating a text string/formulas and cell value
There is no reason for the Excel CONCATENATE function to be limited to only joining cells' values. You can also use it to concatenate various text strings and formulas to make the result more meaningful.
For example:
=CONCATENATE("Last Updated: ",TEXT(TODAY(), "mm/dd/yyyy"))

Thursday, October 20, 2016

PHP vs ASP.NET Comparison

Things that need to observe before finalize between PHP and ASP.NET on any project.

ASP.NET code executes a lot faster compared to PHP. In general most of time of pages rendering time dependent on accessing DB and querying database.

In connecting database ASP.NET is a lot better - in asp.net we typically use LINQ which translates our object queries into stored procedures in SQL server database. Also connection to database is persistent, one for one website, there is no need for reconnecting.
PHP, in comparison, can't hold SQL server connection between request, it connect, grab data from DB and destroys, when reconnecting the database is often takes 20-30% of page rendering time.

ASP.NET have two main frameworks designed for it (Web forms and MVC), installed with environment, where in PHP you must get a open-source framework. There is no standard framework in PHP like in ASP.NET.
Since PHP is open source, its popularity differs based on people usage. So every year a new framework will come up for PHP in top list.

Whereas ASP.NET language is so rich, standard library has solutions for very much common problems, for PHP its standard library very open to public and any one can override.

Regarding Costing, PHP, MySQL server, PostgreSQL server, Apache server, and Linux OS are all free and upgrades are also free. 
ASP.NET and IIS are free if you purchase Windows OS. There is a substantial licensing cost for a Microsoft Windows Server, Microsoft SQL Server and future upgrades. For example, Microsoft Server 2008 R2 Standard - 64-bit cost is about approximately $1029 and Microsoft SQL Server 2008 Standard Edition For Small Business cost approximately $1038.

For Hosting, Now a days both hosting of PHP and .NET websites are no different. Both a similar or more over same when compared Windows and Linux environments.
PHP requires LAMP (Linux, Apache, MySQL and PHP) which is popular among hosting companies. ASP.NET requires Windows hosting.

Until a few years ago, Windows hosting used to be significantly more expensive than Linux web hosting. This is hardly true today; you can easily find Windows hosts for almost the same price as Linux web hosts. When we have PaaS, Platform as a Service all hosting provides are offering Pay as you service. Ex: Azure, Amazon WS etc.,

PHP is platform independent and can run on any platform — Linux, Unix, Mac OS X, Windows.

ASP.net is built to run only on Windows platform.

There has been much debate about this subject and most of the debates have been biased and have been tailored to promote one of the programming languages instead of informing the audience.
Scalability and ease of maintenance have nothing to do with whether you select PHP or ASP.NET platform. Web Application scalability and ease of maintenance primarily depend on:

  • Programmers' experience
  • Using the best programming practices
  • Using a solid programming framework
  • Following programming guidelines and standards

In my experience ASP.NET can certainly compete and surpass PHP in terms of raw speed. My personal opinion is that a ASP.NET-MVC compiled web application would run more efficiently/faster than the same project that would be written in PHP.

And this debate goes on and on!!!
 
Thank you

Types of exception in c#

A C# exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero. Exceptions provide a way to transfer control from one part of a program to another.

C# exception handling is built upon four keywords: try, catch, finally, and throw.

  • try: A try block identifies a block of code for which particular exceptions is activated. It is followed by one or more catch blocks.

  • catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.

  • finally: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.

  • throw: A program throws an exception when a problem shows up. This is done using a throw keyword.

Types of Exceptions in C#

Exception Class

Description

System.IO.IOException

Handles I/O errors.

System.IndexOutOfRangeException

Handles errors generated when a method refers to an array index out of range.

System.ArrayTypeMismatchException

Handles errors generated when type is mismatched with the array type.

System.NullReferenceException

Handles errors generated from deferencing a null object.

System.DivideByZeroException

Handles errors generated from dividing a dividend with zero.

System.InvalidCastException

Handles errors generated during typecasting.

System.OutOfMemoryException

Handles errors generated from insufficient free memory.

System.StackOverflowException

Handles errors generated from stack overflow.