24 August, 2010

Haveli

Following is my imagination of an ideal haveli. Consider this as fiction because there is no real structure like this.

Haveli is like a large house, town hall, manor house, residence of governor of village, fort, castle, meeting place. It have to be one in each village. A village is 1562.5 acres including surroundings and 1000 acres not including surroundings. Haveli is 1/25 in area of the village size, that is, 40 acres = 16 hectares = 160,000 sq meters = 193,600 sq yards = 1,742, 400 sq ft. This is the total plot of haveli.

Haveli consists of a central building and surrounding field all enclosed in a thick and large wall. The building is at the center and its size is 25% of the size of plot, which means 10 acres or 200 meters x 200 meters. To visualize this, think about a 4 x 4 square tiles block with the center 2 x 2 tiles being the real thing and rest being the surrounding. A 100 meters wide empty space is there at each side of building inside the plot.

The building consists of a central fort and surrounding slanted walls. The total area of fort plus slanted walls is 200 m x 200 m = 40,000 sq m, that is 25% of the plot. The fort is 100 m x 100 m at the center, therefore at each side of fort there is 50 m wide slanted wall. The slanted walls are at an angle of 60% making it very tough for anybody to climb up. It means the height of the slanted walls is 100 meters, twice its width. At two sides of this slanted wall, in middle of each of these two sides, stairs are made to climb up.

The fort consists of two large doors, at the sides of front and back stairs. On the other two sides there are large windows for ventilation. The fort consists of 5 floors: Ground floor, First floor, Top Floor, Basement and Deep Basement. Climbing up the stairs in the slanted walls one can reach the ground floor. The ground floor is nothing but a large halls, it has no rooms, no toilets, no stores, just a single large hall. Its purpose is to gather people for meeting, for addressing and for shelter. It has no furniture. A large number of people can be placed in it.

The first floor is strictly a residence of the governor of village. Some high ranking govt officials under the governor can also have residence there. This is only if village is large enough to have two layers of management of govt servants. No non-official villager is allowed to go to the first floor. The first floor has rooms, a large central hall etc.

The top floor is a semi sphere and its only purpose is to look the surrounding area and defend the haveli and the village. It has windows at critical locations with guns pointing out for both aerial and ground defense. Its dome shape is specially designed to efficiently and flexibility point guns in air and speedily move them with the moving bombers and missiles.

The basement is the working place of the haveli. Its where there is kitchen, store house, factory and toilet. The store house store food, fuel, clothings, gas masks, tools, spare parts etc. All the weapons and ammunition is stored at the top floor in the half sphere.

The deep basement, also called "deep", is where the prison of village is placed. It also has the well of the haveli. It also have long term storage place for excretions of people of haveli in case they have to live hidden in the haveli for multiple years. Its better to have a large water storage place instead of a well to completely isolate the haveli from its surroundings. Nobody is supposed to go in the "deep" because it should be working automatically. The deep can also have liquid nitrogen compound batteries for long term storage of electricity.

Each floor is 100 meters in height. The top and bottom 10 meters are used in making roof and base, the living place is the middle 80 meters. The height and width of each floor is also 100 meters with 10 meters used in making walls and 80 meters of middle being the living place. Therefore the living place at each floor is 80 meters x 80 meters x 80 meters = 512,000 cubic meters. The height is there for a lots of purposes including maintaining moral, ventilation and to provide a large storage place. The very center of the "deep" is water storage, 50 meters x 50 meters x 50 meters = 125,000 sq meters = 125,000 tons water. Living at a comfortable usage rate of 125 kg per person per day, this is enough for 1 million person-days or 2500 person-years. The air at ground floor which is free of any substructure contains enough air for 3600 person-years.

The basement, that is the first level of basement, which is directly below the ground floor is actually on the ground itself. Its because the ground floor of fort is 100 meters in air. The height of basement is 100 meters so it starts exactly at the ground level of empty place around haveli.

Having a height of 6 ft, a person can see approx 3 miles far in a flat field, this is called horizon. The horizon increases at the rate of square root of the increase in height. In standard units, at 1.7 meters height, horizon is 4.7 kms, at 6.8 meters height, horizon is 9.4 kms and so on. Standing at the floor of the top floor, 300 meters from ground level of surrounding of haveli, one can see as far as 62.61 km covering an area of 4000 sq kms or 1 million acres. Also note that 300 meters roughly means 1000 ft.

There is a reason I chose this size. The first man, prophet Adam had a height of 20 meters. Today, height of a well built and tall man is 2 meters (6 ft 8 inches). For such a man, a bedroom size of 4 meters x 4 meters is recommended (see post about Ideal Bedroom Size). For such a man the ideal hall size is 8 meters x 8 meters, 4 times the size of a bedroom. For such a man the ideal toilet, bathroom etc size is 2 meters x 2 meters. On that basis, I chose dimensions of haveli such that even prophet Adam can live in it. At a height of 20 meters, a 80 meters x 80 meters hall of ground floor of haveli is ideal for him.

The haveli is like 5 cubes, one over another, with each cube having its own covering in all six sides (roof, base, 4 walls). Each cube is a floor. Each floor has a total volume of 100 meters x 100 meters x 100 meters = 1,000,000 cubic meters. The living place in between is 80 meters x 80 meters x 80 meters = 512,000 cubic meters. Therefore, 488,000 cubic meters structure at each floor.

At each floor there are pillars too. Its because we can't expect a 20 meter thick roof can be hanged with a gap of 80 meters between walls. Infact, we have to make a pillar at every 10 meter, and that pillar have to be 1 meter wide and 1 meter long. There have to be 7 x 7 = 49 pillars at each floor, and each pillar would be 8 meter tall. This adds up 7 x 7 x 8 x 1 x 1 = 392 cubic meters structure at each floor, negligible in front of 488,000 cubic meters.

We have five floors so we have 488,000 cubic meters x 5 = 2,440,000 cubic meters structure. All this structure need to be of stone. The slanted walls have an area of 50 meters x 100 meters x 100 meters / 2 x 4 = 1,000,000 cubic meters. So altogether we need to make 2,440,000 + 1,000,000 = 3.44 million cubic meters structure.

Golden Code: Maintain Sorting While Moving to Next Page In Data Grid


default.aspx:


< asp : datagrid id="grd" runat="server" allowpaging="true" pagesize="4" allowsorting="true" autogeneratecolumns="false" onpageindexchanged="grd_PageIndexChanged" onsortcommand="grd_SortCommand">
< columns >
< asp : boundcolumn headertext="ID" datafield="ID" sortexpression="ID" />
< asp : boundcolumn headertext="Name" datafield="Name" sortexpression="Name" />
< asp : boundcolumn headertext="Marks" datafield="Marks" sortexpression="Marks" />
< / columns >
< pagerstyle horizontalalign="Center" mode="NextPrev" />







default.aspx.cs: (Code behind file)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Data_Controls
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FillGrid();

if (!Page.IsPostBack)
{
FillColumnsSortDirectionList();
}

SetPagingSorting();
}

private void FillGrid()
{
DataView view = LoadView();

this.grd.DataSource = view;
this.grd.DataBind();
}

private void FillColumnsSortDirectionList()
{
DataView view = (DataView)this.grd.DataSource;
List ColumnsSortDirectionList = new List();

foreach (DataColumn column in view.ToTable().Columns)
ColumnsSortDirectionList.Add(new Pair(column.ColumnName, "asc"));

Session.Add("ColumnsSortDirectionList", ColumnsSortDirectionList);

Session.Add("SortColumn", "ID");
}

private void SetPagingSorting()
{
((DataView)this.grd.DataSource).Sort = Session["SortColumn"].ToString() + " " +
Utility.PairList__GetValue((List)Session["ColumnsSortDirectionList"], Session["SortColumn"].ToString());
}

private DataTable LoadTable()
{
DataTable tab = new DataTable();
tab.Columns.Add("ID", typeof(int));
tab.Columns.Add("Name", typeof(string));
tab.Columns.Add("Marks", typeof(double));

tab.Rows.Add(new object[] { 1, "Atif", 85.40d });
tab.Rows.Add(new object[] { 2, "Jamal", 70.00d });
tab.Rows.Add(new object[] { 3, "Nawaz", 60.00d });
tab.Rows.Add(new object[] { 4, "Salma", 75.00d });
tab.Rows.Add(new object[] { 5, "Yasir", 78.00d });
tab.Rows.Add(new object[] { 6, "Shabnam", 50.00d });
tab.Rows.Add(new object[] { 7, "Naseem", 74.32d });
tab.Rows.Add(new object[] { 8, "Tauseef", 58.00d });
tab.Rows.Add(new object[] { 9, "Nasreen", 18.00d });
tab.Rows.Add(new object[] { 10, "Sadiq", 90.00d });

return tab;
}

private DataView LoadView()
{
return LoadTable().DefaultView;
}

protected void grd_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.grd.CurrentPageIndex = e.NewPageIndex;
this.grd.DataBind();
}

protected void grd_SortCommand(object source, DataGridSortCommandEventArgs e)
{
Session["SortColumn"] = e.SortExpression;

ColumnsSortDirectionList__ToggleValue(e.SortExpression);

((DataView)this.grd.DataSource).Sort = e.SortExpression + " " +
Utility.PairList__GetValue((List)Session["ColumnsSortDirectionList"], e.SortExpression);
this.grd.DataBind();
}

private void ColumnsSortDirectionList__ToggleValue(string _Name)
{
List ColumnsSortDirectionList = (List)Session["ColumnsSortDirectionList"];

foreach (Pair p in ColumnsSortDirectionList)
{
if (p.Name == _Name)
{
if (p.Value == "asc")
p.Value = "desc";
else if (p.Value == "desc")
p.Value = "asc";

break;
}
}
}

}
}

Pair.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Data_Controls
{
public class Pair
{
public string Name;
public string Value;

public Pair(string _Name, string _Value)
{
this.Name = _Name;
this.Value = _Value;
}
}
}

Utility.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Data_Controls
{
public class Utility
{
public static string PairList__GetName(List _PairList, string _Value)
{
string returnValue = "";

foreach (Pair p in _PairList)
{
if (p.Value == _Value)
{
returnValue = p.Name;
break;
}
}

return returnValue;
}

public static string PairList__GetValue(List _PairList, string _Name)
{
string returnValue = "";

foreach (Pair p in _PairList)
{
if (p.Name == _Name)
{
returnValue = p.Value;
break;
}
}

return returnValue;
}
}
}