Tag Archives: Development

Financial Functions in .Net (C#)

I recently worked on a project where I had to perform financial calculations. The main project requirements where provided on an Excel and because of the sensitivity of the calculations(mortgage payments), I had to keep within 1cent accuracy.

After reviewing the needed calculations, my main issue was the NPV (Net Present Value); although I am familiar with the formula and applications of NPV, I was not sure of the exact implementation in Excel.

So, I jumped to Google to see if there was any implementations and found the Excel Financial Functions for .Net: “… a .NET library that provides the full set of financial functions from Excel.”.

Great! BUT. The library is actually implemented in F# and only the source code is provided, no compiled version…. No problem, since all .Net languages compile into IL (Intermediate Language), all I needed to do was to compile the F# project and then reference it on my C# one.

After I add ed the Financial.dll reference to my project (compiled version included in the provided source code), I am ready to use it on my code, however, note that the following reference is required:




With the reference in place, I can now use the NPV function as follow:


Comparing the signature of the NPV function on Financial.dll to excel, we can see they are virtually the same:


And even though I have shown mainly the NPV usage, this library contains implementation pretty much all financial functions in Excel (Complete List).

There you have it; if you ever have a project where you need to use Excel functions, you can refer t the Excel Financial Functions for .Net library; you can use the compiled library provided on this example, but I recommend reviewing the library page regularly to check for updates.

Hope this helps!

Tools from MS Real Development 07 – Toronto

On October 29-07, I attended the real development event in Toronto presented by Jean-Luc David. I found this event interesting because it was really targeted at developers; it was mainly all demos, and the best part is that they showcased some interesting tools to help us develop better sites.

Not all of the tools shown where new to me, but they were used in a way made those tools that I was already using even more useful. Important to notice that the majority of the tools are free.

 I plan to present here a summary of all the tools they used, with a bit of description. I believe this will be helpful to the development community that couldn’t attend to the event.
Continue reading

ASP.Net 2.0 web application deployment

Originally written on April, 2006 

ASP.Net 2.0 has introduced a few new different concepts in regards of dll generation and deployment.

 In ASP.Net 1.x, all your class files would get compiled into 1 dll and that was it. In the new world there are actually 3 options:

  1.  You release everything including class files and they get compiled on the fly. This means nothing of the web application gets copied to the bin folder.
  2. You release only binaries. Everything, including ASPX pages are pre-compiled (If you open the ASPX file after the compilation you can’t see your client side code). This means everything is in the bin folder, pretty much one precompiled file per file in your application.
  3. A mix of the 2 above (and the most similar to ASP.Net 1.x). Every class gets compiled, but ASPX pages remain normal. Even in this scenario, multiple dlls get generated per project. 

One of the main challenges here is the version management; you can not implicitly assign versions (no AssemblyInfo.cs in web apps), plus there are multiple assemblies generated.

However, there is a command that will merge all your dlls (per application) into one, applying versions, signatures, etc. The utility command is called aspnet_merge.exe. It is important to know what it does, but notice that we won’t have to use it directly as Microsoft has now released it as an Add-On for Visual studio.

The Add-On is really easy to use, and I would recommend we all get familiar with it. You can get it here: http://msdn2.microsoft.com/en-us/asp.net/Aa336619.aspx

Facebook Profile Management

In this post I will discuss how I implemented the Profile Management for Network Trotters .

Profile Management Generals

As an application developer, you get the opportunity to place some information in the user profile page. Specifically you can set a Profile Action (link below the Profile Pic) and a Profile Box.

In your application you basically tell the Facebook platform where it should get the FBML/HTML that defines both the Profile Action and Profile Box. It is important to notice, that Facebook will Cache this FBML/HTML, until you specifically tell them to refresh it.

So in summary, you set the user Profile from your application, but you have to build a mechanism to refresh the users profile periodically.


I am using the Facebook Development Toolkit as the Facebook Platform API wrapper; and the profiles are set by using Urls.

.Net Implementation (one of many)

In my implementation, the profile management contains 3 main components:

  • Profile Content Page
  • Setting a user profile
  • Refresh the profile

Continue reading