Restart an ASP.NET application programmatically without editing the web.config ( Reset IIS Cache)

Several times I would be working on a site and some data would not change due to session variables or the .NET cache. This can’t be eliminated by clearing the browser cache but would need the whole ASP.NET application to be restarted to clear all sessions and cache. A traditional way of doing so is to edit the web.config slightly (a space, comma, fullstop would do the trick) … however this was happening often so I decided to restart my application automatically through my code. To do so, I used the Global.ascx on application_start and added this simple line of code which restarts the ADO.NET application:

System.Web.HttpRuntime.UnloadAppDomain();

Javascript Write Properties

To Write in a TextBox / input / label:

document.getElementById(“sample”).value = “Hello”;

 

To Write in a divider / paragraph / span :

document.getElementById(“sample”).innerText = “Hello”;

 

To Write in a divider / paragraph / span     using FireFox :

document.getElementById(“sample”).textContent = “Hello”;

 

To Look for a word in a TextBox / input / label (if it does not find it, it returns null):

document.getElementById(“sample”).value.match(“Hello”);

 

To Look for a word in a divider / paragraph / span (if it does not find it, it returns null):

document.getElementById(“sample”).innerText.match(“Hello”);

 

To Look for a word in a divider / paragraph / span     using FireFox (if it does not find it, it returns null):

document.getElementById(“sample”).textContent.match(“Hello”);

 

To Set a Textbox / input / label / divider/ paragraph / span or anything else HIDDEN / INVISIBLE:

document.getElementById(“sample”).style.display = “none”;

 

To Set a Textbox / input / label / divider/ paragraph / span or anything else SHOW/ VISIBLE:

document.getElementById(“sample”).style.display = “block”;

 

Fluent Nhibernate Made Easy

fluent-nhibernate

Progressing from using NHibernate to Fluent NHibernate is a practical way of not using XML files. For people like me, who are not very comfortable using XML files, Fluent NHibernate gives the opportunity to map your domain class entities through traditional C# classes. So lets start by specifying the requirements to complete this tutorial:

Requirements for this Tutorial:

  • NuGet Package Manager (unless you already have Fluent NHibernate)
  • Visual Studio 2010
  • MS SQL 2005 or 2008

Note: If you have never used NHibernate at all, I suggest you start from my previous tutorial NHibernate made easy

This tutorial will be very similar the the previous one, however it will include all changes required to use Fluent NHibernate rather than NHibernate. Continue reading

Nhibernate simple Select, Insert, Update and Delete

nhibernate

Nhibernate is one of the many Object-Relational Mapping (ORM) tools for the .NET platform.

A very quick description of ORM:

ORM is the process of mapping objects to database relations without the requirement of writing SQL statements (such as SELECT, INSERT, UPDATE, DELETE, JOIN, etc etc) generally through the use of XML files.

Nhibernate eliminates the requirement of using ADO.NET, Linq, etc and thus is the back bone of the Data Access Layer (in nThier Architectures).

Requirements for this Tutorial:

This tutorial will be split in 12 steps:

Step 1:- Create a 2-Thier Project

Step 2:- Install Nhibernate

Step 3:- Define Business Objects (Domain Folder)

Step 4:- Define the Mapping (Mappings Folder)

Step 5:- Setting XML Schema

Step 6:- Configure Nhibernate

Step 7:- Create ISessionFactory

Step 8:- Create Table from Schema and Test Connection

Step 9:- Create Repositories

Step 10:- Define Method from Repositories

Step 11:- Testing Add, Update, Delete Method

Before we continue, I want to add that “I know this is a very long and mostly text based tutorial” but I have searched the internet sooo much for a decent working tutorial without errors and complications that this post here should cover it ALL … I also did it again while writing it to make sure no errors are found. So, hold on and read through… EVERYTHING should be there 🙂

So, lets begin …

Continue reading

Tortoise SVN Command List

tortoisesvnWhen i initially installed Tortoise SVN I used to get confused between check out and export, check in and import, commit and update, etc etc… so I wrote everything on paper to better understand. So now I decided to put it here so that I can finally get rid of the papers on my desk :p

Checkout: Get a new working copy of the project. The project will still be on SVN repository.

Export: Get the project out of SVN repository.

Checkin /commit : push your changes into your project on SVN repository.

Update: Updare your local working copy FROM the project in SVN repository.

ADD: Include a file which is in your local working copy. When committed, the added files will be uploaded to the project in SVN.

Delete: unless we use SVN Delete, a file will always pop up again when updating our local copy. So we always delete a file using right-click >> SVN >> Delete and not the usual delete process.

Copy: Copy something using SVN (changes are applied to repository when you commit)

Please Note: All file operations such as Delete, Copy, Rename, etc all have to be done using SVN commands in order to be updated to repository after committing.