Skip to main content

Posts

First Angular Application

First Angular application 1. Open NetBeans or any other editor of your choice and Select File > New Project (Ctrl + Shift + N) 2. Select HTML 5  > HTML 5 Application. Click Next. 3. Enter Project Name: AngularDemo1 and click Finish. 4. Go to AngularJS.org  and download Angular JS 1. This will download will consist of a single file angular.min.js 5. Copy the file into the Site Root folder. 6. Drag the angular.min.js file into the index.html file as shown to generate a script tag that points to angular.min.js file. 7. Now add ng-app directive to body tag. Then to test if all works as expected lets add the following code     <body ng-app>         <div>The constant pi is equal to {{22/7}}.</div>     </body> 8. Right click AngularDemo1 project and select Run . 9. The output should look as shown below.

WCF Review Exercise 2

1. Download and open the WCF application  here . 2. Enable message logging in the host application 3. In the client application, handle CommunicationException, TimeOutException, and FaultException in the correct order.  4.  Use finally block to check if the client channel has entered a faulted state if it has then the abort the client and create a new instance of the client if the client is required again. 5. Enable reliable session by changing the app.config of the service host project.  6.  In the service host project, create a custom service host class called NewProdSrvHost. 7.   Override OnOpening() method to add an endpoint with basicHttpBinding and to enable metadata so that M etadata is always enabled with one endpoint. 8. Update the service host project to use the custom host class created above. 9. Update client reference and test the whole application.  10 Save and submit as a single zip file. 

CUMIPMT and CUMPRINC function

CUMIPMT Cumulative interest payment function allows you to calculate the interest paid for a loan or from an investment from period A to period B. When getting a loan, CUMIPMT function can be used to calculate the total amount of interest paid in the first five months or from period 12 to period 20. A period can be a month, a week or two week. Loan Amount : 350,000.00 APR: 4.5% Down payment: 0.00 Years: 25 Payment per year: 12 From the above data, we can calculate the following: No of Period: 25 × 12 = 300 Periodic Rate: 4.5/12 = 0.375% Here is how you will substitute these values into the function. = CUMIPMT (periodic rate, No of period, vehicle price, start period, end period,  ) = CUMIPMT (0.375, 300, 350000, 1, 5, 0) In an excel worksheet, we use cell address instead of actual values as shown below: Here is the formula view of the worksheet: CUMPRINC Another related function is CUMPRINC. CUMPRINC function is used to calculate c...

ASP.NET Web API

ASP.NET Web API is a framework based on ASP.NET for building HTTP endpoints. The ASP.NET Web API can be built as a part of ASP.NET Webforms or MVC to function as the services layer of a  web, mobile or client desktop application. ASP.NET Web API is recommended over WCF in many situations except if you are limited to use .NET 3.5 and/or if you need to expose a SOAP based service endpoints. ASP.NET Web API is different from REST since it may not fully comply with a RESTful architecture, however, a  REST based service can be built on top of Web API. Creating a simple ASP.NET Web API 1. Open Visual studio 2. Create a new project Template > Visual C# > Web > ASP.NET Empty Web Application 3. Right click on the project > Manage NuGet Packages... > Search for  Web API   > select  Microsoft ASP.NET Web API  > click  Install > Click Close 4. Add a new class to the project, name it MyApiControlle...

Excel PMT Function

PMT function is very useful for calculating monthly payment required to payback a loan or mortgage at a fixed rate. This function require a minimum of three inputs, periodic rate, number of periods, present value or the loan amount. Here is a simple example. Home Loan: 350,000.00 Interest rate: 4.5% Number of years to repay the loan: 25 Note: To calculate monthly payment, we need to find the monthly rate and number of months as shown above. Then it is simply a matter of substituting the values into the payment function, as shown in the formula view below.

Grouping Excel worksheets

Working with multiple worksheets Excel has a great feature that allows you to work in multiple worksheets simultaneously. This feature allows you to add content and/or format the contents in the multiple worksheet at the same time. Let's look at an example where this feature can be a great time saver. Let's say you have a yearly budget for five years and the data for each year is placed in a separate worksheet. For each year the structure of data set, column heading and row heading are the same. It has cell formatting and number formatting consistent across all worksheets. Now let's say that you want to modify all 5 worksheet simultaneously. This is when the grouping worksheets become very useful. Instead of modifying one worksheet and then copying the changes to other worksheets, you can modify all worksheets at the same time. To do this first group the worksheets that you want edit simultaneously. To group worksheets To group worksheets together use one of the...

Service Instance and InstanceContextMode attribute

InstanceContextMode can be set to PerCall, Single or PerSession. InstanceContextMode.PerCall Description New service instance for each call. To enable set InstanceContextMode.PerCall Service Instance created when The instance is created when a request is received from the client Service Instance disposed when Disposed after servicing a single call. Benefits Scalable, Service instance disposed after each call. Issues Stateless, lowers performance, Clients not aware of multiple instances created during session. InstanceContextMode.Single Description Single instance is used to serve all calls. To enable set InstanceContextMode.Single Service Instance created when The instance is created when the service host is created Service Instance disposed when Disposed when service host is closed. Benefits Easy to manage...