Search In This Blog

Friday, December 11, 2009

Pyramids of Egypt

Building of the Great pyramid of Giza

It is believed the pyramid was built as a tomb for Fourth dynasty Egyptian pharaoh Khufu and constructed over a 14[2] to 20 year period concluding around 2540 BC.[3] Khufu's vizier, Hemon, or Hemiunu, is believed by some to be the architect of the Great Pyramid.[4] It is thought that, at construction, the Great Pyramid was originally 280 Egyptian cubits tall, 146.59 metres (480.94 ft) but with erosion and the loss of its pyramidion, its current height is 138.74 metres (455.18 ft). Each base side was 440 royal cubits, 230.37 metres (755.81 ft) in length. A royal cubit measures 0.524 meters.[5] The total mass of the pyramid is estimated at 5.9 million tonnes. The volume, including an internal hillock, is believed to be roughly 2,500,000 cubic meters.[6] Based on these estimates, building this in 20 years would involve installing approximately 800 tonnes of stone every day. The first precision measurements of the pyramid were done by Egyptologist Sir Flinders Petrie in 1880–82 and published as The Pyramids and Temples of Gizeh.[7] Almost all reports are based on his measurements. Many of the casing stones and interior chamber blocks of the Great Pyramid were fit together with extremely high precision. Based on measurements taken on the north eastern casing stones, the mean opening of the joints are only 0.5 millimeters wide (1/50th of an inch).[8]

Great Pyramid of Giza from a 19th century stereopticon card photo

The pyramid remained the tallest man-made structure in the world for over 3,800 years,[9] unsurpassed until the 160 meter tall spire of Lincoln Cathedral was completed c. 1300. The accuracy of the pyramid's workmanship is such that the four sides of the base have a mean error of only 58 millimeter in length [10] The base is horizontal and flat to within 15 mm. The sides of the square base are closely aligned to the four cardinal compass points (within 4 minutes of arc)[11] based on true north, not magnetic north[12], and the finished base was squared to a mean corner error of only 12 seconds of arc[13]. The completed design dimensions, as suggested by Petrie's survey and later studies, are estimated to have originally been 280 cubits in height by 440 cubits in length at each of the four sides of its base. These proportions equate to π/2 to an accuracy of better than 0.05% (corresponding to the approximation of π as 22/7). Some Egyptologists consider this to have been the result of deliberate design proportion[14]. Verner wrote, "We can conclude that although the ancient Egyptians could not precisely define the value of π, in practise they used it".[15] Petrie, author of ‘The Pyramids and Temples of Gizeh', who was the first accurate surveyor of Giza and the excavator and surveyor of the Pyramid of Meidum, concluded: "but these relations of areas and of circular ratio are so systematic that we should grant that they were in the builders design".[16] Earlier in the chapter he wrote more specifically, that: “We conclude therefore that the approximation of 7 to 22 as the ratio of diameter to circumference was recognised”.[17] These proportions equated to the four outer faces sloping by approximately 51.842º or 51º 50' 35", which would have been understood and expressed by the Ancient Egyptians as a seked slope of 5 1/2 palms [18].

Giza's Materials

See also: Calculating the weight of megaliths

The Great Pyramid consists of more than 2.3 million limestone blocks. The Egyptians obtained the majority of the limestone blocks from a nearby quarry. The Tufa limestone used for the casing was quarried across the river. The largest granite stones in the pyramid, found in the "King's" chamber, weigh 25 to 80 tonnes and were transported more than 500 miles away from Aswan. Traditionally, ancient Egyptians cut stone blocks by hammering wedges into the stone which were then soaked with water. The wedges expanded, causing the rock to crack. Once they were cut, they were carried by boat either up or down the Nile River to the pyramid.[19]

Casing stones

casing stone

At completion, the Great Pyramid was surfaced by white 'casing stones' – slant-faced, but flat-topped, blocks of highly polished white limestone. These were carefully cut to what is approximately a face slope with a seked of 5 1/2 palms to give the required overall dimensions. Visibly, all that remains is the underlying step-pyramid core structure seen today. In AD 1301, a massive earthquake loosened many of the outer casing stones, which were then carted away by Bahri Sultan An-Nasir Nasir-ad-Din al-Hasan in 1356 in order to build mosques and fortresses in nearby Cairo. The stones can still be seen as parts of these structures to this day. Later explorers reported massive piles of rubble at the base of the pyramids left over from the continuing collapse of the casing stones, which were subsequently cleared away during continuing excavations of the site. Nevertheless, many of the casing stones can be seen to this day in situ around the base of the Great Pyramid, and display the same workmanship and precision as has been reported for centuries. Petrie also found a different orientation in the core and in the casing measuring 193 centimeters ± 25 centimeters. He suggested a redetermination of north was made after the construction of the core, but a mistake was made, and the casing was built with a different orientation.[20] Petrie related the precision of the casing stones as to being "equal to opticians' work of the present day, but on a scale of acres." and "to place such stones in exact contact would be careful work; but to do so with cement in the joints seems almost impossible."[21]

Construction theories

Many alternative, often contradictory, theories have been proposed regarding the Pyramid's construction techniques.[22] Not all even agree that the blocks were quarried, they might conceivably have been cast[citation needed]. However, most accept it was built by moving huge stones from a quarry, being only unable to agree whether they were dragged, lifted or even rolled into place. The Greeks believed that slave labour was used but modern Egyptologists accept that it was built by many tens of thousands of skilled workers. They camped near the pyramids and worked for a salary or as a form of paying taxes until the construction was completed.[citation needed] Their cemeteries were discovered in 1990 by archaeologists Zahi Hawass and Mark Lehner. Verner posited that the labor was organized into a hierarchy, consisting of two gangs of 100,000 men, divided into five zaa or phyle of 20,000 men each, which may have been further divided according to the skills of the workers.[23]

One of the mysteries of the pyramid's construction is how they planned its construction. John Romer suggests that they used the same method that had been used for earlier and later constructions, laying out parts of the plan on the ground at a 1 to 1 scale. He writes that "such a working diagram would also serve to generate the architecture of the pyramid with a precision unmatched by any other means." He devotes a chapter of his book to the physical evidence that there was such a plan.[24]

Interior

Diagram of the interior structures of the Great Pyramid. The inner line indicates the pyramid's present profile, the outer line indicates the original profile.

The Great Pyramid is the only pyramid known to contain both ascending and descending passages. There are three known chambers inside the Great Pyramid. These are arranged centrally, on the vertical axis of the pyramid. From the entrance, an 18 meter corridor leads down and splits in two directions. One way leads to the lowest and unfinished chamber. This chamber is cut into the bedrock upon which the pyramid was built. It is the largest of the three, but totally unfinished, only rough-cut into the rock. The other passage leads to the Grand Gallery (49 m x 3 m x 11 m), where it splits again. One tunnel leads to the Queen's Chamber, a misnomer, while the other winds to intersect with the descending corridor. The Grand Gallery itself features a corbel haloed design and several cut "sockets" spaced at regular intervals along the length of each side of its raised base with a "trench" running along its center length at floor level. What purpose these sockets served is unknown. An antechamber leads from the Grand Gallery to the King's Chamber.[3]

Entrance

Today, tourists enter the Great Pyramid via a forced tunnel dug by the Caliph Al-Ma'mum and his men around 820 AD. The tunnel continues for approximately 30 meters and eventually meets up with the Descending Passage which at the time was found to have been blocked by a series of massive granite plugs. Unable to remove the blocks, the workmen tunneled around the plugs discovering the Ascending Passage which leads to the Grand Gallery and interior chambers only to find them empty. The original entrance, which was apparently unknown at the time, can be seen today several meters directly above the forced entry and would have also been blocked by the granite plugs.

King's Chamber

At the end of the lengthy series of entrance ways leading into the interior is the structure's main chamber, the King's Chamber. This granite room was originally 10 × 20 × 11.4 cubits, or about 5.235 m × 10.47 m × 5.974 m[25][26], comprising a double 10 × 10 cubit square floor, and a height equal to half the double square's diagonal. Some believed that the height was consistent with the geometric methods for determining the Golden Ratio φ (phi) as the height is approximately phi times the width minus ½, while phi can be derived from other dimensions of the pyramid[27], but evidence from Petrie’s surveys and later conclusions drawn by others shows that it was in fact the circular proportions that were deliberately incorporated into the internal and external designs of the Great Pyramid by its architects and builders, for symbolic reasons[28]. The so called golden ratio phi simply exists in the proportions of the architecture as an inadvertent by-product of the inclusion of the circular proportions. The reason for the inadvertent inclusion is that phi, the golden ratio, has a naturally occurring mathematical relation to the circular ratio pi that is unrelated to the architecture or geometry, and which was unknown to the pyramid's builders. Petrie confirmed that the King’s Chamber was a triumph of Egyptian geometry, the ratio of its length to the circuit of the side wall being the same as the ratio of 1 to pi, and that the exterior of the pyramid had been built to the same proportions[28][29][30]

The sarcophagus of the King's Chamber was hollowed out of a single piece of Red Aswan granite and has been found to be too large to fit through the passageway leading to the chamber. Whether the sarcophagus was ever intended to house a body is unknown, and no lid has ever been found. The King's Chamber contains two small shafts that ascend out of the pyramid. Despite being originally discovered closed off at both ends, these shafts were once thought by Egyptologists to have been used as "ventilation shafts", but this idea was eventually abandoned, leaving them to conclude they were instead used for ceremonial purposes. It is now thought that they were to allow the Pharaoh's spirit to rise up and out to heaven.[31]

The King's Chamber is lined with red granite brought from Aswan 935 km (580 miles) to the south. There are 5 relieving chambers above the kings chamber. The first one is reached through a breach in the wall at the upper end of the Grand Gallery, this was named the Davidson chamber. Howard Vyse suspected there was another chamber above this when he found that he was able to thrust a long reed through a crack in the ceiling. He blasted through to find 4 more relieving chambers. These chambers were named the Wellington, Nelson, Lady Arbuthnot and Cambell's chambers. The kings chamber and the first 4 relieving chambers have roofs made out of granite. Each roof includes 8 or 9 granite slabs weighing 25 to 80 tonnes each. Cambell's chamber has a pented roof made of large limestone slabs.[32][33] Egyptologists believe they were transported on barges down the Nile river.[34]

Queen's Chamber

The Queen's Chamber is the middle and the smallest, measuring approximately 5.74 by 5.23 meters, and 4.57 meters in height. The chamber is lined with fine limestone blocks and the pented roof is made of large limestone slabs.[35] Its eastern wall has a large angular doorway or niche. Egyptologist Mark Lehner believes that the Queen's chamber was intended as a serdab, a structure found in several other Egyptian pyramids, and that the niche would have contained a statue of the interred. The Ancient Egyptians believed that the statue would serve as a "back up" vessel for the Ka of the Pharaoh, should the original mummified body be destroyed. The true purpose of the chamber, however, remains uncertain.[31] The Queens Chamber has a pair of shafts similar to those in the King's Chamber, which were explored using a robot, Upuaut 2, created by the German engineer Rudolf Gantenbrink. In 1992, Upuaut 2 discovered that these shafts were blocked by limestone "doors" with two eroded copper handles. The National Geographic Society filmed the drilling of a small hole in the southern door, only to find another larger door behind it.[36] The northern passage, which was harder to navigate due to twists and turns, was also found to be blocked by a door.[37]

Unfinished chamber

The "unfinished chamber" lies 27.5 meters below ground level and is rough-hewn, lacking the precision of the other chambers. Egyptologists suggest the chamber was intended to be the original burial chamber, but that King Khufu later changed his mind and wanted it to be higher up in the pyramid.[38] Egyptologist Bob Brier believes it was an insurance policy in case Khufu died early. When he was still alive and healthy after about 5 years of construction, the second (Queen's) chamber was begun. Sometime around the fifteenth year this chamber was also abandoned unfinished and the last or King's Chamber was built high up in the center of the pyramid.[39]

Pyramid complex

Map of Giza pyramid complex

The Great Pyramid of Giza is the main part of a complex setting of buildings that included two mortuary temples in honor of Khufu (one close to the pyramid and one near the Nile), three smaller pyramids for Khufu's wives, an even smaller "satellite" pyramid, a raised causeway connecting the two temples, and small mastaba tombs surrounding the pyramid for nobles. One of the small pyramids contains the tomb of queen Hetepheres (discovered in 1925), sister and wife of Sneferu and the mother of Khufu. There was a town for the workers of Giza, which included a cemetery, bakeries, a beer factory and a copper smelting complex. A few hundred meters south-west of the Great Pyramid lies the slightly smaller Pyramid of Khafre, one of Khufu's successors who is also commonly considered the builder of the Great Sphinx, and a few hundred meters further south-west is the Pyramid of Menkaure, Khafre's successor, which is about half as tall. In May 1954, 41 blocking stones were uncovered close to the south side of the Great Pyramid. They covered a 30.8 meter long rock-cut pit that contained the remains of a 43 meter long ship of cedar wood. In antiquity, it had been dismantled into 650 parts comprising 1224 pieces. This funeral boat of Khufu has been reconstructed and is now housed in a museum on the site of its discovery. A second boat pit was later discovered nearby.[40]

Thieves, tourists and excavators

Although succeeding pyramids were smaller, pyramid building continued until the end of the Middle Kingdom. However, as authors Briar and Hobbs claim, "all the pyramids were robbed" by the New Kingdom, when the construction of royal tombs in a desert valley, now known as the Valley of the Kings, began.[41][42] Joyce Tyldesley states that the Great Pyramid itself "is known to have been opened and emptied by the Middle Kingdom", before the Arab caliph Abdullah Al Mamun entered the pyramid around AD 820

Friday, November 20, 2009

How To Be Attractive To Women

If you're looking to get women, one of the hardest things to do is seduce them. Why would I say that? Well, because it is far easier to change yourself into the type of man that attracts women rather than going out and seducing them into thinking they're attracted to you.

Seduction has a place, that is for sure. But if you want to be successful, you must know how to be attractive to women. If you can manage this, your work is more than half done. All there is left is not messing anything up.

When you approach a woman, the last thing you should be thinking about is how to impress them. Women don't only want to be impressed by men. They want to be attracted to them first. If you fail to accomplish this, even if you get a chance to chat with them, you will fail. Attraction is a law that absolutely must be obeyed when it comes to relationships.

The easiest way to attract women is being confident and being charismatic. Yeah, yeah. I know. It must seem redundant, but like I say in my other articles, repetition is the key to mastery and the more you hear something, the more you're likely to use it.

So, how do women decide whether a man is confident or not? Over the years I have seen and have been guilty of doing things that poisoned any chance with a woman. I'm going to detail some of the "red-flags" that women look out for or are unconsciously avoiding when interacting with a man.

The first thing I would like to stress is the one thing women absolutely hate! This is, of course, is a man who's all over her and touches her way too much when they first begin socializing.

Hanging all over a woman is a mistake because it not only makes you look like a pervert, she will look at you as an insecure, needy man. The one thing you must ABSOLUTELY avoid.

A confident man doesn't show affection in the beginning stages of a relationship. He will stay cool and get to know a woman. After all, he projects the security that he can get any woman and will not rush into anything. He lets the woman do the touching and will read these touches like a true seduction master.

You want to make the women you meet crave your touch, not feel smothered by it. Sure, later on when you've made some good headway with a woman touching is very important. But early on, do everything you can to avoid it.

Another thing you should be aware of is how to use your passion. If you are a passionate guy, this may be difficult but crucial if you don't want to repulse a woman. When used effectively, passion could be what attracts a woman to you. This was the case with myself and how I attracted my girlfriend.

Stay passionate, but only with the things you love. Never go off on the things that bother you or anger you. Fueling these negative feelings with you will make you seem bitter and a woman will see you as a complainer.

Don't speak negatively about women, especially women from your past. I have read this advice over and over only to overhear a guy talking about how evil his ex was. Do you think women want a guy who, if it doesn't work out with him, will go off to others about how ridiculous she was? NO!

This goes for a lot more in life than just women, too. Speaking poorly about a past employer will give the impression that you are difficult to please and hard to get a long with. Women know this and is something they do not want to deal with.

Something else I've seen and cannot understand since I've never been the type, is to be a people pleaser. Trying to please everyone and accommodating everyone's needs shows that you are insecure and are looking for validation. A confident man knows he's cool and lets others find it out on their own. He doesn't market himself like a pitch page on the Internet.

When it comes to women, you don't want to be a puppy dog. A confident man has way too much pride than to obey everything that is asked of him. He will do only the things that he believes he should do and has the time for. You have to project the idea that you will never be used and are way too busy for meaningless demands.

On the other side of the coin, you don't want to be a prick. There are exceptions to every rule, so doing good things for people is not only okay, it's recommended. If you give the impression that you are selfish and inconsiderate, no woman will want to be with you.

Also, you don't want to be an attention whore. Saying and doing things that are obviously meant to receive attention is very unattractive. I know that people compare marketing yourself to women with talking about your strengths to a prospective employer, but nothing could be further from the truth. Instead of talking about your accomplishments and talents to a woman, you will have to learn how to show her.

I know that you must have heard somewhere that in order to be attractive to a woman you must be cocky and funny. Though not necessary, it will help you with a lot more than making a girl laugh. Unfortunately for a lot of men, they accomplish being either or and come across as either a clown or a cocky bastard.

When you are socializing with women, don't be outspoken. Excessive arguing is a turn off and makes you look as though you're close minded. If you don't agree with what a woman is saying, challenge her - don't tell her she's wrong. No woman (or man for that matter) wants to be told or made to feel as though their opinions are invalid or stupid.

If you ever do find yourself in a conversation with a woman who is trying to argue, don't return argument. Challenging her with something cocky and funny or find a way to change the subject immediately. There will be plenty of time to take part in debates later if you do find yourself in a relationship with her.

You know that saying "you can talk the talk, but can you walk the walk?" It's one you should really live by. Start showing people, especially women, what you can do and not talk about it. Actions, as most of you are already aware, are far more effective than words.

Confidence can projected way before even meeting a woman. If you are at a bar, for example, be the leader of your group and not one of the followers. Make the decisions and show all the women that are around that you are not needy. Women like a man who takes charge and find it annoying, stressful, and very unattractive when they are the ones deciding everything. Don't be that type of man.

Attraction is a lot deeper than just looking good. You have to know what women want, and what they don't want. There is a fine line between the two, and learning how to balance will work wonders for you. You want to show women that you are confident and not an ego maniac. Finding this middle ground will not only make you more attractive to women you are interested in, it will also help with your interactions with everyone else.

Being attractive through confidence and security is not only a seduction technique, it is also very valuable in life in general. Take this advice on how attract women and you will surely see a big increase in your chances with them.

Wednesday, November 11, 2009

ألب أرسلان - محطم الإمبراطورية البيزنطية


القوة الجديدة وسنة الاستبدال


إن لله عز وجل سنناً لا تتبدل ولا تتخلف بإذن الله، وفقه هذه السنن من الأمور الهامة في حياة المسلمين أفراداً وأمماً، لأن هذه السنن من أهم دعائم بقاء الأمم واستمرارها وتمكنها وظهورها، وهذه السنن لا تعرف جوراً ولا محاباة، فهي جارية على خلق الله جميعاً مؤمنهم وكافرهم، فأيما أمة أو جماعة أو أفراد استوفوا شروطها وعملوا بمقتضياتها جرت عليهم السنن وجوداً وعدماً، سالباً وإيجاباً، ومن أعظم هذه السنن سنة الاستبدال التي جعلها الله عز وجل لحفظ دينه ونصرة شريعته .


وعمل هذه السنة يقتضى أنه إذا لم يقم الجيل المسلم القائم بأعباء الدين والواجب المناط به تجاه الدعوة والأمة، فإن الله عز وجل يستبدل هذا الجيل ويأتي بالجيل القادر على حمل مسئولية الدين والأمة، وهذا ظاهر صراحة في قوله عز وجل [وإن تتولوا يستبدل قوماً غيركم ثم لا يكونوا أمثالكم] سورة 'محمد' الآية '38'، وقد عملت هذه السنة في دولة الخلافة العباسية التي بلغت مبلغاً بعيداً في الضعف والتفكك وتسلط الغير عليها وقد واجهت التحدي الأكبر لوجودها وشرعيتها عندما ظهرت الدولة الفاطمية الباطنية الشيعية والتي استولت على مصر والشام والحجاز واليمن، وأصبح العالم الإسلامي مهيأ لظهور القوة الجديدة التي ستعيد لأمة الإسلام قوتها وشبابها، وكانت هذه القوة الجديدة : قوة السلاجقة وهي قبائل تركية ظهرت منذ أوائل القرن الخامس الهجري في سهول التركستان، وظلت في تقدم وتوسع وانتشار خاصة عندما آلت قيادة هذه القبائل للسلطان 'طغرلبك' الذي وسع نطاق نفوذ السلاجقة وأعلن ولائه الكامل للخليفة العباسي ولأهل السنة عموماً واتسعت دولة السلاجقة لتشمل خراسان وإيران وبلاد ما وراء النهر كلها .


كان لظهور هذه القوة الجديدة أثر بعيد على الساحة العالمية خاصة عند القوى المعادية للإسلام وهي ممثلة في الإمبراطورية البيزنطية الصليبية والدولة الفاطمية الشيعية، فكلاهما لا يرغب في قوة جديدة للمسلمين، وبالفعل وقع الصدام بين السلاجقة والبيزنطيين عدة مرات ولكن كانت معركة 'أرزن' على حدود أرمينية سنة 450 هجرية وفيها انتصر السلاجقة انتصارا عظيماً ثبت وضع ومكانة السلاجقة على الساحة الدولية وخريطة القوى العالمية .


واستمر 'طغرلبك' في جهاده ونصرته للخلافة العباسية والمسلمين حتى توفاه الله عز وجل سنة 455 هجرية وتولى السلطنة بعده بطلنا الجسور ألب أرسلان .


الأسد الباسل


هو السلطان الكبير والملك العادل، عضد الدولة، أبو شجاع ألب أرسلان محمد بن جفرى بك داود بن ميكائيل بن سلجوق بن دقاق التركمانى، ومعنى ألب أرسلان بالتركية الأسد الباسل وكان حقاً منذ شبابه وقبل ولايته أسد باسلاً شجاعاً يستعين به عمه 'طغرلبك' في المهام الصعبة والجسيمة وكان في منزلة القائد العام للجيوش السلجوقية وهو دون الثلاثين من العمر وقد كلفه عمه 'طغرلبك' بأهم منصب في الدولة السلجوقية ألا وهو منصب حاكم إقليم خراسان المضطرب، فأبدى كفاءة وحزم وعزم شديد في مواجهة التحديات والصعوبات الكثيرة خاصة وأن دولة السلاجقة كانت مازالت بعد في مراحلها الأولى رغم قوتها وشبابها .


الخلافات الطارئة


لم يكد ألب أرسلان يستلم منصب السلطان حتى دبت خلافات طارئة داخل البيت السلجوقى، حيث ثار عليه بعض أقربائه منهم أخوه سليمان وعمه 'قتلمش' واضطر ألب أرسلان مكرها أن يقاتل الخارجين عليه، وقد نصره الله عز وجل على خصومه على الرغم ما إن عمه قتلمش قد حاربه بتسعين ألفاً، في حين ألب أرسلان كان في اثني عشر ألفاً فقط، ولما علم ألب أرسلان نبأ مقتل عمه في المعركة بكى بشدة وتأسف على نهايته .


بعد ذلك انشغل ألب أرسلان في القضاء على بعض الثورات الداخلية التي قام بها بعض حكام الأقاليم فلقد ثار حاكم إقليم 'كرمان' و غيره ،وعانى أيضاً ألب أرسلان من غارات القبائل التركمانية التي لا تنضوي تحت راية أحد وتعيش على السلب والنهب.


استراتيجية القيادة الناجحة


لقد ورث السلطان ألب أرسلان إمبراطورية عظيمة واسعة الأرجاء تمتد من سهول التركستان إلى ضفاف دجلة، بها الكثير من المدن الكبار والأقاليم الواسعة والشعوب المتباينة، لذلك فلقد كانت مسألة قيادة هذه الإمبراطورية في غاية الصعوبة وتحتاج لاستراتيجية حكيمة وقيادة قديرة، وهذا ما اتبعه الأسد الباسل 'ألب أرسلان' وذلك بإتباع الخطوات الآتية : ـ


أولاً :ـ استخدام الرجال الأكفاء


وكان ذلك حجر الزاوية في نجاح استراتيجية القيادة عند ألب أرسلان، فلقد استخدم ألب أرسلان في منصب الوزارة وهو أهم منصب في الدولة رجلاً قديراً كان سبب سعادة الدولة السلجوقية وهو الوزير العظيم 'نظام الملك' الذي جمع بين العلم والورع والحنكة السياسية والمقدرة القيادية وحب العلماء والصالحين والزهاد، ولقد استمر نظام الملك وزيراً طوال حكم ألب أرسلان وولده 'ملك شاه' من بعده أي استمر من سنة 455 هجرية ـ 485 هجرية، وهذا يؤكد على مدى أهمية البطانة الصالحة والرجال الأكفاء في المناصب الحساسة، فكم من وزيراً وقائد أضاع أمته أما بجهالة أو عمالة أو طمع في الدنيا، وكم عانت الأمة الإسلامية من رجال وسُد إليهم الأمر وهم من غير أهله، فضاعوا وأضاعوا وضلوا وأضلوا .


ثانياً :ـ تأليف الخصوم


عندما ظهرت القبائل السلجوقية اصطدمت بقوة مع الدولة السبكتكينية التي كانت تسيطر وقتها على خراسان وسهولها التركستان والسند، ودارت بين السلاجقة ومحمود بن سبكتكين ثم ولده مسعود معارك كثيرة وطاحنة استمرت قرابة الخمسين سنة في صراع بدا للعيان أنه لن ينتهي أبداً، حتى جاء الأسد الباسل إلى السلطة وقرر حسم هذا الصراع الطويل ليتفرغ إلى مهمته الأصلية: فتح القسطنطينية وفتح مصر، واستطاع ألب أرسلان أن يتألف خصمه اللدود الدولة السبكتكينية بأيسر السبل بأن صاهر سلطانها على ابنته فزوجها لابنه 'إياز'، ثم صاهر سلطان الدولة الخانية [بلاد ما وراء نهر جيحون[ على ابنته أيضا، فزوجها لابنه الآخر 'تكش' وهكذا استطاع ألب أرسلان أن يؤلف خصومه وألد أعدائه وجعلهم أقرباه وأهله وهذا من قمة الذكاء الاستراتيجي للقائد القدير .


كانت أيضا القبائل التركمانية من أشد خصوم السلاجقة رغم الاتفاق العرقي بين الطرفين فالسلاجقة أصلاً من التركمان، ولكن هذه القبائل الموجودة في منطقة الأناضول أو آسيا الصغرى كانت تعيش على السلب والنهب والإغارة على المسلمين والرومان على حد السواء، فقرر ألب أرسلان استغلال هذه الطاقة الهجومية عند هذه القبائل في الإغارة على الدولة البيزنطية وحدها دون المسلمين، وهو ما نجح فيه ألب أرسلان باقتدار، حتى أصبحت هذه القبائل هي أكبر تهديد يواجه الدولة البيزنطية وعنصر قلق دائم لها خاصة في منطقة 'أرمينية' .


ثالثاً:ـ إتباع أسباب البقاء


إن للبقاء أسباباً وللاستمرار عوامل ومعطيات من تناولها وعمل بها تم له البقاء والصمود حتى حين، وهذا ما أدركه السلطان ألب أرسلان جيداً،فسار في رعيته سيرة حسنة صالحة ضمنت له رضا الناس عنه، فقد كان ألب أرسلان كريماً، رحيماً، شفوقاً على الرعية، رفيقاً على الفقراء باراً بأهله وأصحابه ومماليكه، كثير الدعاء بدوام النعم عليه، كثير الصدقات، لم يعرف في زمانه جناية ولا مصادرة، فلا يأخذ من أموال الرعية إلا ما حل للدولة من خراج وزكاة، له سياسة عظيمة مع ولاته وعماله، فلقد كتب إليه بعض الوشاة في وزيره 'نظام الملك' فاستدعاه ثم قال له {خذ إن كان هذا صحيحاً، فهذب أخلاقك وأصلح أحوالك وإن كذبوا فاغفر لهم زلتهم}، كما كان ألب أرسلان شديد الحرص على حفظ مال الرعية فلقد بلغه يوماُ أن أحد مماليكه قد أخذ إزاراً لأحد الناس ظلماً، فأمر بصلبه حتى يرتدع باقي المماليك عن الظلم، وهكذا نرى هذا القائد الحكيم قد أدرك بفطرته القيادية أسباب البقاء فسار على طريقها واتبعها خير إتباع .


بين المطرقة والسندان


كما قلنا من قبل كانت الدولة السلجوقية الكبيرة تقع بين عدوين كبيرين كلاهما يتربص بهذه القوة الجديدة، العدو الأول الإمبراطورية البيزنطية عريقة العداء مع المسلمين، والعدو الثاني الدولة العبيدية الخبيثة في مصر، وكان ألب أرسلان في الحقيقة يريد أن يفتح مصر أولاً وذلك لعدة اعتبارات : منها تخليص العالم الإسلامي من حالة الفوضى القيادية في ظل وجود خلافتين كلاهما يدعى الأحقية والشرعية، ومنها القضاء على منبع تصدير الشرور والضلالات والاغتيالات في الأمة الإسلامية .


ومن أجل التفرغ لفتح مصر والشام كان لابد على الأسد الباسل ألب أرسلان أن يؤمن حدوده مع الأقاليم الأرمينية والجورجية التابعة للدولة البيزنطية والمتاخمة لبلاده، وكان كما ذكرنا آنفاً قد استعان بقبائل التركمان ووجه طاقاتهم القتالية لصالح المسلمين، فأغاروا على هذه الحدود وقاموا بدورهم في إضعاف القوى الدفاعية للدولة البيزنطية، ولكن هذه الغارات المقطعة لم تصرف همة الأسد ألب أرسلان لئن يسدد ضربة موجعة للدولة البيزنطية تنشغل بها حيناً من الدهر ريثما يقوم هو بمشروعه الكبير في فتح الشام ومصر وإسقاط الدولة العبيدية الخبيثة .


ضربة الأسد


هذه الضربة قام بها الأسد الباسل 'ألب أرسلان' بعد انتهائه مباشرة من خلافاته الطارئة مع عمه 'قتلمش' حيث توغل بجيوشه إلى قلب الأناضول قاصداً مدينة قيصرية الغنية التي فتحها ألب أرسلان في ربيع الثاني سنة 456 هجرية وغنم منها غنائم عظيمة، ثم توجه بعدها إلى أذربيجان ثم إلى أرمينية وبلاد الكرج 'جورجيا الآن' في جيش ضخم قسمه إلى جزأين، جزء يقوده ولده وولى عهده 'ملكشاة' ووزيره الشهير 'نظام الملك' واتجه ناحية القواعد الجبلية، والجزء الأخر يقوده ألب أرسلان نفسه وتوجه إلى مدينة 'آني' عاصمة أرمينية البيزنطية واجتمع مع الجزء الأول من الجيش على حصار المدينة العريقة لعدة شهور حتى فتحها في أواخر سنة 456 هجرية، وبذلك سيطر السلاجقة على أرمينية التي كانت بمثابة الحصن المنيع لبيزنطة من الشرق، وتلقت الدولة البيزنطية ضربة موجعة من الأسد الباسل جعلتها تعيد ترتيب أوراقها وتفكر في تغيير قياداتها وأسلوب معاركها وهذا ما سيظهر أثره في معركة ملازكرد .


العودة إلى الهدف الأول


بعد نجاح ألب أرسلان في فتح أرمينية البيزنطية والكرج قرر الأسد العودة إلى الهدف الأول وهو فتح الشام ومصر، فتوجه إلى شمال الشام الذي كان به العديد من أمراء المسلمين الموالين للدولة البيزنطية وأيضا موالين للدولة الفاطمية، وهاجم ألب أرسلان القلاع البيزنطية في الرها وأنطاكية وقيسارية، وأخضع بني شداد في حران وبني عقيل في الموصل وكان ولاؤهم للفاطميين، ثم عبر نهر الفرات واتجه إلى مدينة حلب ومنها إلى نفوذه كي يحمى ظهره من الخطر الشيعي حيث كان أميرها محمود بن صالح شيعياً فاطمياً .


الصحوة


في هذه الفترة الذهبية للدولة الإسلامية والتي كان فيها الأسد الباسل ناشراً رايات الجهاد على عدة جبهات، كانت الدولة البيزنطية تضطرم بروح انتقامية عارمة وتبحث عن القيادة القادرة على رد عادية السلاجقة والقبائل التركمانية التي أنهكت القوى الدفاعية للإمبراطورية العجوز ولقد وجدت الدولة البيزنطية ضالتها في القائد العسكري الشاب 'رومانوس ديوجين' الذي لمع نجمه بعد عدة انتصارات حققها في القتال ضد البوشناق في بلغاريا فانعقدت عليه الآمال وحطت عنده الرحال خاصة بعد ثلاثة انتصارات متتالية على بعض أمراء المسلمين في الفترة ما بين سنة 461 هجرية ـ 463 هجرية، فتربع إمبراطوراً على بيزنطة وتلقب برومانوس الرابع وأخذ في التحضير لعمل عسكري ضخم ضد المسلمين ينهي بها وجودهم في منطقة آسيا الصغرى والجزيرة وشمال الشام، وبالفعل بعد عدة شهور من توليه العرش البيزنطي بدأ العمل في سد المنافذ التي استخدمها السلاجقة في التدفق على أراضى الإمبراطورية، كما سعى إلى احتلال بعض المواقع الإستراتيجية في بلاد الشام والجزيرة الفراتية، وشن ثلاث حملات ضد إمارة حلب في الشام ثم الجزيرة فاستولى خلالها على مدينة 'منبج' ثم قام في الثالثة بالهجوم على أرمينية الإسلامية، فاستولى على كثير من الحصون وشحنها بالمقاتلين واستعد لمعركة حاسمة لم يكن يدرى أنها بالفعل ستكون حاسمة وللأبد ولكن عليه لا له.


معركة ملازكرد


حشد 'رومانوس' كل ما استطاع من القوى اللازمة لتحطيم الأمة الإسلامية، واستعان بالفرق الفرنجية من غرب أوروبا كمرتزقة في جيشه واستعان أيضا بالقبائل الروسية وكانت حديثة عهد بالنصرانية وانضم إليه كثير من الأرمن والجورجيين وتضخم جيشه حتى وصل لأكثر من ثلاثمائة ألف مقاتل وفي نيته قلع الأمة الإسلامية من أساسها ومحو الإسلام كدين والمسلمين كأمة .


وصلت الأنباء للسلطان ألب أرسلان وهو في مدينة 'خوى' من أعمال أذربيجان فقرر رغم قلة جيشه الزحف باتجاه الجيش العملاق لوقف تقدمه بأرض الإسلام، في حين واصل رومانوس زحفه حتى وصل إلى مدينة ملازكرد [وتنطق أيضا منازجرد ومنازكرد ] وهي بلدة حصينة تقع على فرع نهر 'مرادسو' بقلب الأناضول وهذه المدينة مازالت موجودة حتى الآن بتركيا .


انطلق الأسد الباسل بمنتهي السرعة مستغلاً خفة حركته لقلة جيشه وذلك لنجدة المدينة المحاصرة وجاءت أول بشارات النصر عندما التقت قوات الاستطلاع المسلمة بطلائع الروم وكانوا من القبائل الروسية فانتصر المسلمون ووقع قائد الروم الروسي 'بازيلكوس' في الأسر .


ورغم هذا الانتصار المشجع إلا إن ألب أرسلان الذي كان يقدر مدى الفارق الكبير بين الجيشين أرسل إلى رومانوس يطلب الهدنة ولكن هذا الطلب جعل رومانوس يغتر بكثرته وتفوقه في العدد والعدة ورد على طلب السلطان بالهدنة بأن قال بلا هدنة إلا في الري] والري هي عاصمة الدولة السلجوقية ولم يعلم رومانوس أنه بذلك قد كتب نهايته ونهاية دولته البائسة .


الأسد بطل ملازكرد


لما وصل هذا الرد المستفز للأسد الباسل 'ألب أرسلان' حميت عزيمته واشتعلت الغيرة على الإسلام في قلبه واستوثق الإيمان في نفسه وتأكد من صحة عزم هذا الصليبي على إبادة الأمة الإسلامية وقرر التصدي له وحده وبمن معه من جنود، على الرغم من التفاوت الشاسع بين الجيشين فالروم البيزنطيون وحلفاؤهم أكثر من ثلاثمائة ألف، والمسلمين في خمسة عشر ألف فقط لا غير .


كان ألب أرسلان مؤمناً صادقاً غيوراً يعلم أن الله عز وجل سوف ينصره لأنه على الحق وعدوه على الباطل،وكان من عادة هذا السلطان الصالح أن يصطحب معه في غزواته وحملاته الجهادية العديد من العلماء والفقهاء والزهاد كقيادة روحية ومرجعية دينية، وكان معه في هذه المرة الفقيه الكبير [أبو نصر محمد بن عبد الملك البخاري] الذي قال لألب أرسلان هذه العبارة الرائعة [إنك تقاتل عن دين وعد الله بنصره وإظهاره على سائر الأديان، وأرجو أن يكون الله تعالى قد كتب باسمك هذا الفتح فالقهم يوم الجمعة بعد الزوال في الساعة التي يكون الخطباء فيها على المنابر فإنهم يدعون للمجاهدين بالنصر] .


وبالفعل استجاب الأسد الباسل لهذه النصيحة الغالية التي تشرح بأوجز العبارات أسباب الانتصار المادية والمعنوية،فالمجاهدين يحتاجون تماماً للدعاء مثلما يحتاجون إلى السيف والرمح، وفي يوم الجمعة 7 ذي القعدة 463 هجرية ـ 26 أغسطس 1071 ميلادية قام ألب أرسلان وصلى بالناس وبكى خشوعاً وتأثراً ودعا الله عز وجل طويلاً ومرغ وجهه في التراب تذللاً بين يدي الله واستغاث به، ثم لبس كفنه وتحنط وعقد ذنب فرسه بيديه ثم قال للجنود {من أراد منكم أن يرجع فليرجع فإنه لا سلطان هاهنا إلا الله} ثم امتطى جواده ونادى بأعلى صوته في أرض المعركة {إن هزمت فإنى لا أرجع أبداً فإن ساحة الحرب تغدو قبري} وبهذا المشهد الذي ينفطر له أقسى القلوب وتخشع أمامه أشقى النفوس استطاع 'ألب أرسلان' أن يحول 15 ألف جندي إلى 15 ألف أسد كاسر ضاري .


وعند الزوال اصطدم الجيشان وألب أرسلان على رأس جيشه يصول ويجول كالأسد الهصور ودارت معركة طاحنة في منتهي العنف حاول البيزنطيون حسم المعركة مبكراً مستغلين كثرتهم العددية الضخمة، ولكن ثبات المسلمين أذهلهم وأنساهم كل المعارك التي خاضوها من قبل حتى أصيب الروم بالتعب والإرهاق وذلك عند غروب الشمس، فحاول 'رومانوس' الانسحاب إلى الخلف قليلاً للراحة ومواصلة القتال في اليوم التالي، وعندها انتهز الأسد الباسل الفرصة وشد بكامل جيشه على الرومان حتى أحدث بصفوفهم المنسحبة ثغرة، أنسال منها سلاح الفرسان الإسلامي إلى قلب الجيش البيزنطي وأمطروهم بوابل من السهام المميتة فوقعت مقتلة عظيمة وانكشفت صفوف البيزنطيين وركبوا بعضهم بعضاً وفرت الفرق الفرنجية المرتزقة من أرض المعركة ووقع في الأسر أعداد كبيرة منهم الإمبراطور 'رومانوس' نفسه.


بين الأسد وفريسته


في صباح اليوم التالي للمعركة أخذ القيصر الإمبراطور 'رومانوس' الأسير، وكان أول قيصر يقع في أسر المسلمين، إلى معسكر ألب أرسلان أو عرين الأسد، ووقف الفريسة بين يدي الأسد، ومن الطبيعي جداً بل لا أكون متجاوزاً إذا قلت أنه يجب على الأسد ألا يترك فريسته تفلت منه دون عقاب ولابد أن يبطش بها بما يليق بجرم هذه الفريسة التي سول لها شيطانها أن تنتهك حرمة الأسد، ولكن الأسد الذي جمع بين الشجاعة والبسالة والإيمان واليقين أضاف إلى كل هذه الخصال العظيمة فضيلة العفو والصفح عند المقدرة .


فبعد أن أناب ألب أرسلان رومانوس على جرائمه وضربه بيده ثلاث مقارع ووضع قدمه على هامة 'رومانوس' تحقيراً وإذلالاً له وجعله يقبل الأرض باتجاه بغداد حيث الخليفة العباسي لإظهار عز الإسلام وأهله ، قام بالعفو عن رومانوس نظير دفع فدية كبيرة وفك أسر كل الأسرى المسلمين في سائر بلاد الروم وإلزامه بالقسم بأغلظ الأيمان على عدم العودة مرة أخرى لقتال المسلمين .


الآثار الخطيرة لملازكرد


كانت الضربة الموجعة التي وجهها الأسد ألب أرسلان للإمبراطورية البيزنطية من أشد ما نالته هذه الدولة العريقة وكانت نذير السقوط الوشيك، فلقد فقدت الإمبراطورية لقب حامية الصليب وفتحت هذه المعركة الطريق لتدفق المسلمين في منطقة آسيا الصغرى وأقام السلاجقة دولة بالأناضول عرفت باسم سلطنة سلاجقة الروم، حيث إن ألب أرسلان بعد المعركة قام بعد المعركة بتعيين ابن عمه 'سليمان بن قتلمش' حاكماً على الأراضي المفتوحة بالأناضول [لاحظ أنه قد جعل سليمان بن قتلمش حاكماً رغم أن أباه قتلمش قد خرج عليه من قبل وقاتله، وذلك لتأليف بني عمومته وربما كنوع من راحة الضمير] .


كما كانت هذه المعركة من أهم الأسباب الدافعة لتحريك الحملات الصليبية من غرب أوروبا بعدما ضعفت شرق أوروبا أو الدولة البيزنطية، ووصل الأمر لئن يذهب قيصر القسطنطينية 'ميخائيل السابع' والذي توج على العرش بعد وقوع 'رومانوس' في الأسر إلى 'روما' مستنجداً ببابا روما كبير الكاثوليك راكعاً على ركبتيه، باكياً بين يديه طالباً من شن حرباً صليبية من ناحية الغرب على المسلمين .


مصرع الأسد

إن المرء ليعجب حقاً من خواتيم أبطال الإسلام وعظمائهم الذين خاضوا غمار الكثير من المعارك وطلبوا الموت من كل مظانه وتعرضوا له في جميع مواطنه ووقفوا له في كل سبيل طلباً للشهادة، ثم يأتيهم حمام الموت غدراً بيد عميل أو خائن أو طامع أو حاسد أو مأجور وهذا ما حدث للأسد الباسل وهو في ريعان شبابه '41 سنة' وهو في قمة ظفره وتمكنه وعلو شأنه حتى حاز بحق لقب سلطان العالم وسلطان الدنيا والدين .


وذلك عندما قام أحد الخارجين عليه واسمه 'يوسف الخوارزمي' بطعنه بالسكين والسلطان يعاتبه على جرائم ارتكبها هذا المجرم الخارجي، لتنتهي هكذا في لحظة حياة هذا الأسد بطعنة غادر مجرم، ليهلل لموته كل أعداء الإسلام شرقاً وغرباً وتلتقط الدولة الفاطمية أنفاسها ويهدأ روعها بعدما أوشكت على السقوط والتهاوي تحت ضربات الأسد ولقد قتل الأسد ألب أرسلان في 10 ربيع الأول سنة 465 هجرية، وبمصرعه ظهرت الأطماع والشرور ورفع أعداء الإسلام رؤوسهم، وكما قال الحكيم [إنما ضغت الثعالب عندما غاب الاسد)


الموضوع منقول من مفكرة الاسلام


من موقع مفكرة الإسلام.

Tuesday, November 10, 2009

INF: Shrinking the Transaction Log in SQL Server 2000 with DBCC SHRINKFILE

Shrinking the log in SQL Server 2000 is no longer a deferred operation. A shrink operation attempts to shrink the file immediately. However, in some circumstances it may be necessary to perform additional actions before the log file is shrunk to the desired size.

MORE INFORMATION




When DBCC SHRINKFILE is run, SQL Server 2000 shrinks the log file by removing a...



When DBCC SHRINKFILE is run, SQL Server 2000 shrinks the log file by removing as many virtual log files as it can to attempt to reach the target size. If the target file size is not reached, SQL Server places dummy log entries in the last virtual log file until the virtual log is filled and moves the head of the log to the beginning of the file. The following actions are then required to complete the shrinking of the transaction log:
  1. You must run a BACKUP LOG statement to free up space by removing the inactive portion of the log.
  2. You must run DBCC SHRINKFILE again with the desired target size until the log file shrinks to the target size.
The following example demonstrates this with the pubs database and attempts to shrink the pubs_log file to 2 MB:
  1. Run this code:




    DBCC SHRINKFILE(pubs_log, 2)
          
    NOTE: If the target size is not reached, proceed to the next step.




  2. Run this code if you want to truncate the transaction log and not keep a backup of the transaction log. Truncate_only invalidates your transaction log backup sequence. Take a full backup of your database after you perform backup log with truncate_only:




    BACKUP LOG pubs WITH TRUNCATE_ONLY
    -or-
    Run this code if you want to keep a backup of your transaction log and keep your transaction log backup sequence intact. See SQL Server Books Online topic "BACKUP" for more information:



    BACKUP LOG pubs TO pubslogbackup



  3. Run this code:



    DBCC SHRINKFILE(pubs_log,2)
         
    The transaction log has now been shrunk to the target size.


REFERENCES

For more information, see the Shrinking the Transaction Log and DBCC SHRINKFILE topics in SQL Server 2000 Books Online.

For additional information about shrinking the transaction log in SQL Server 7.0, click the article number below to view the article in the Microsoft Knowledge Base:
256650  (http://support.microsoft.com/kb/256650/EN-US/ ) INF: How to Shrink the SQL Server Transaction Log

Monday, November 09, 2009

INFO: Required Network Rights for the SourceSafe Directories


Improperly setting network rights for the SourceSafe directories may cause errors with the system.
The following tables list the SourceSafe directories and the rights that need to be set for network access. Full access includes read, write, and destroy privileges.

For SourceSafe 3.x


SourceSafe for         Rights Required
   Windows NT             for
   Directory              Network Access
   ---------------        ----------------

   \SS\WINNT              Read

   SourceSafe for         Rights Required
   MS-DOS or Windows      for
   Directory              Network Access
   -----------------      --------------------------------------------

   \SS                    Read
   \SS\DATA               Full access or read-only for read-only users
   \SS\ADMIN              None - But SourceSafe admins should have
                          full access

   \SS\TEMP               Full access
   \SS\USERS\   Full access
   \SS\WINNT              None
   \SS\MACROS             Read
 

SourceSafe 4.0 Server Installation

SourceSafe for         Rights Required
   32-bit Windows         for
   Directory              Network Access
   -----------------      --------------------------------------

   \VSS\WIN32             None-But SourceSafe admins should have
                          full access

   SourceSafe for         Rights Required
   16-bit Windows         for
   Directory              Network Access
   -----------------      --------------------------------------

   \VSS\WIN               None-But SourceSafe admins should have
                          full access

   \VSS\DOS               None-But SourceSafe admins should have
                          full access

   SourceSafe for         Rights Required
   MS-DOS or Windows      for
   Directory              Network Access
   ------------------     --------------------------------------------

   \VSS                   Read
   \VSS\DATA              Full access or read-only for read-only users
   \VSS\TEMP              Full access
   \VSS\USERS\  Full access
   \VSS\NETSETUP.X86      Read
   \VSS\MACROS            Read

SourceSafe 5.0 Server Installation

SourceSafe for         Rights Required
   32-bit Windows         for
   Directory              Network Access
   -----------------      --------------------------------------

   \VSS\WIN32             None-But SourceSafe admins should have
                          full access

   SourceSafe for         Rights Required
   MS-DOS or Windows      for
   Directory              Network Access
   -----------------      --------------------------------------------

   \VSS                   Read
   \VSS\DATA              Full access or read-only for read-only users
   \VSS\DATA\LOGGEDIN     Full access
   \VSS\TEMP              Full access
   \VSS\USERS\  Full access
   \VSS\NETSETUP          Read

SourceSafe 6.0 Server Installation

SourceSafe for         Rights Required
   32-bit Windows         for
   Directory              Network Access
   -----------------      --------------------------------------

   \VSS\WIN32             None-But SourceSafe admins should have
                          full access

   SourceSafe for         Rights Required
   MS-DOS or Windows      for
   Directory              Network Access
   -----------------      --------------------------------------------

   \VSS                   Read
   \VSS\DATA              Full access or read-only for read-only users
   \VSS\DATA\LOGGEDIN     Full access
   \VSS\DATA\LABELS       Full access
   \VSS\TEMP              Full access
   \VSS\USERS\  Full access
   \VSS\NETSETUP          Read
NOTE: The immediately preceding set of permissions does not allow the user to run NetSetup. If you want to allow a given user to run NetSetup (for SourceSafe installation), make sure that you grant Execute permissions to that user in the \VSS directory.
Although not recommended for performance reasons, if your SourceSafe Clients intend to run the SourceSafe executables directly from the Network (that is, they are not going to create a client installation on their local drives), then modify the table above with the following changes:
SourceSafe for         Rights Required
   32-bit Windows         for
   Directory              Network Access

   ---------------        --------------------------------------

   \VSS\WIN32             Read-But SourceSafe admins should have
                          full access

   SourceSafe for         Rights Required
   16-bit Windows         for
   Directory              Network Access
   ----------------       --------------------------------------

   \VSS\WIN               Read-But SourceSafe admins should have
                          full access

   \VSS\DOS               Read-But SourceSafe admins should have
                          full access
NOTE: In this scenario, all users will have access to the maintenance utilities (ANALYZE, DDCONV etc.) located in these directories. These may be moved to an alternate location if desired.

Sunday, November 08, 2009

Optimistic Concurrency


In a multiuser environment, there are two models for updating data in a database: optimistic concurrency, and pessimistic concurrency. The DataSet object is designed to encourage the use of optimistic concurrency for long-running activities such as when you are remoting data and when users are interacting with data.
Pessimistic concurrency involves locking rows at the data source to prevent users from modifying data in a way that affects other users. In a pessimistic model, when a user performs an action that causes a lock to be applied, other users cannot perform actions that would conflict with the lock until the lock owner releases it. This model is primarily used in environments where there is heavy contention for data, where the cost of protecting data with locks is less than the cost of rolling back transactions if concurrency conflicts occur.
Therefore, in a pessimistic currency model, a user who reads a row with the intention of changing it establishes a lock. Until the user has finished the update and released the lock, no one else can change that row. For this reason, pessimistic concurrency is best implemented when lock times will be short, as in programmatic processing of records. Pessimistic concurrency is not a scalable option when users are interacting with data, causing records to be locked for relatively large periods of time.
By contrast, users who use optimistic concurrency do not lock a row when reading it. When a user wants to update a row, the application must determine whether another user has changed the row since it was read. Optimistic concurrency is generally used in environments with a low contention for data. This improves performance as no locking of records is required, and locking of records requires additional server resources. Also, in order to maintain record locks, a persistent connection to the database server is required. Because this is not the case in an optimistic concurrency model, connections to the server are free to serve a larger number of clients in less time.
In an optimistic concurrency model, a violation is considered to have occurred if, after a user receives a value from the database, another user modifies the value before the first user has attempted to modify it.
The following tables follow an example of optimistic concurrency.
At 1:00 p.m., User1 reads a row from the database with the following values:

CustID     LastName     FirstName
101          Smith             Bob
Column name Original value Current value Value in database
CustID 101 101 101
LastName Smith Smith Smith
FirstName Bob Bob Bob

At 1:01 p.m., User2 reads the same row.
At 1:03 p.m., User2 changes FirstName from "Bob" to "Robert" and updates the database.

Column name Original value Current value Value in database
CustID 101 101 101
LastName Smith Smith Smith
FirstName Bob Robert Bob

The update succeeds because the values in the database at the time of update match the original values that User2 has.
At 1:05 p.m., User1 changes Bob's first name to "James" and tries to update the row.

Column name Original value Current value Value in database
CustID 101 101 101
LastName Smith Smith Smith
FirstName Bob James Robert

At this point, User1 encounters an optimistic concurrency violation because the values in the database no longer match the original values that User1 was expecting. The decision now needs to be made whether to overwrite the changes supplied by User2 with the changes supplied by User1, or to cancel the changes by User1.

Testing for Optimistic Concurrency Violations

There are several techniques for testing for an optimistic concurrency violation. One involves including a timestamp column in the table. Databases commonly provide timestamp functionality that can be used to identify the date and time when the record was last updated. Using this technique, a timestamp column is included in the table definition. Whenever the record is updated, the timestamp is updated to reflect the current date and time. In a test for optimistic concurrency violations, the timestamp column is returned with any query of the contents of the table. When an update is attempted, the timestamp value in the database is compared to the original timestamp value contained in the modified row. If they match, the update is performed and the timestamp column is updated with the current time to reflect the update. If they do not match, an optimistic concurrency violation has occurred.
Another technique for testing for an optimistic concurrency violation is to verify that all the original column values in a row still match those found in the database. For example, consider the following query:
SELECT Col1, Col2, Col3 FROM Table1

To test for an optimistic concurrency violation when updating a row in Table1, you would issue the following UPDATE statement:
UPDATE Table1 Set Col1 = @NewCol1Value,
              Set Col2 = @NewCol2Value,
              Set Col3 = @NewCol3Value
WHERE Col1 = @OldCol1Value AND
      Col2 = @OldCol2Value AND
      Col3 = @OldCol3Value

As long as the original values match the values in the database, the update is performed. If a value has been modified, the update will not modify the row because the WHERE clause will not find a match.
Note that it is recommended to always return a unique primary key value in your query. Otherwise, the preceding UPDATE statement may update more than one row, which might not be your intent.
If a column at your data source allows nulls, you may need to extend your WHERE clause to check for a matching null reference in your local table and at the data source. For example, the following UPDATE statement verifies that a null reference in the local row still matches a null reference at the data source, or that the value in the local row still matches the value at the data source.
UPDATE Table1 Set Col1 = @NewVal1
  WHERE (@OldVal1 IS NULL AND Col1 IS NULL) OR Col1 = @OldVal1

You may also choose to apply less restrictive criteria when using an optimistic concurrency model. For example, using only the primary key columns in the WHERE clause results in the data being overwritten regardless of whether the other columns have been updated since the last query. You can also apply a WHERE clause only to specific columns, resulting in data being overwritten unless particular fields have been updated since they were last queried.

The DataAdapter.RowUpdated Event

The DataAdapter.RowUpdated event can be used in conjunction with the techniques described earlier, to provide notification to your application of optimistic concurrency violations. RowUpdated occurs after each attempt to update a Modified row from a DataSet. This enables you to add special handling code, including processing when an exception occurs, adding custom error information, adding retry logic, and so on. The RowUpdatedEventArgs object returns a RecordsAffected property with the number of rows affected by a particular update command for a modified row in a table. By setting the update command to test for optimistic concurrency, the RecordsAffected property will, as a result, return a value of 0 when an optimistic concurrency violation has occurred, because no records were updated. If this is the case, an exception is thrown. The RowUpdated event enables you to handle this occurrence and avoid the exception by setting an appropriate RowUpdatedEventArgs.Status value, such as UpdateStatus.SkipCurrentRow. For more information about the RowUpdated event, see Working with DataAdapter EventsWorking with DataAdapter Events.
Optionally, you can set DataAdapter.ContinueUpdateOnError to true, before calling Update, and respond to the error information stored in the RowError property of a particular row when the Update is completed. For more information, see Adding and Reading Row Error Information.

Optimistic Concurrency Example

The following is a simple example that sets the UpdateCommand of a DataAdapter to test for optimistic concurrency, and then uses the RowUpdated event to test for optimistic concurrency violations. When an optimistic concurrency violation is encountered, the application sets the RowError of the row that the update was issued for to reflect an optimistic concurrency violation.
Note that the parameter values passed to the WHERE clause of the UPDATE command are mapped to the Original values of their respective columns.
[Visual Basic]
Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind")

  Dim custDA As SqlDataAdapter = New SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers ORDER BY CustomerID", nwindConn)

  ' The Update command checks for optimistic concurrency violations in the WHERE clause.
  custDA.UpdateCommand = New SqlCommand("UPDATE Customers (CustomerID, CompanyName) VALUES(@CustomerID, @CompanyName) " & _
                                        "WHERE CustomerID = @oldCustomerID AND CompanyName = @oldCompanyName", nwindConn)
  custDA.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID")
  custDA.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 30, "CompanyName")

  ' Pass the original values to the WHERE clause parameters.
  Dim myParm As SqlParameter
  myParm = custDA.UpdateCommand.Parameters.Add("@oldCustomerID", SqlDbType.NChar, 5, "CustomerID")
  myParm.SourceVersion = DataRowVersion.Original
  myParm = custDA.UpdateCommand.Parameters.Add("@oldCompanyName", SqlDbType.NVarChar, 30, "CompanyName")
  myParm.SourceVersion = DataRowVersion.Original

  ' Add the RowUpdated event handler.
  AddHandler custDA.RowUpdated, New SqlRowUpdatedEventHandler(AddressOf OnRowUpdated)

  Dim custDS As DataSet = New DataSet()
  custDA.Fill(custDS, "Customers")

  ' Modify the DataSet contents.

  custDA.Update(custDS, "Customers")

  Dim myRow As DataRow

  For Each myRow In custDS.Tables("Customers").Rows
    If myRow.HasErrors Then Console.WriteLine(myRow(0) & vbCrLf & myRow.RowError)
  Next


Private Shared Sub OnRowUpdated(sender As object, args As SqlRowUpdatedEventArgs)
  If args.RecordsAffected = 0
    args.Row.RowError = "Optimistic Concurrency Violation Encountered"
    args.Status = UpdateStatus.SkipCurrentRow
  End If
End Sub
[C#]
  SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind");

  SqlDataAdapter custDA = new SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers ORDER BY CustomerID", nwindConn);

  // The Update command checks for optimistic concurrency violations in the WHERE clause.
  custDA.UpdateCommand = new SqlCommand("UPDATE Customers (CustomerID, CompanyName) VALUES(@CustomerID, @CompanyName) " +
                                        "WHERE CustomerID = @oldCustomerID AND CompanyName = @oldCompanyName", nwindConn);
  custDA.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID");
  custDA.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 30, "CompanyName");

  // Pass the original values to the WHERE clause parameters.
  SqlParameter myParm;
  myParm = custDA.UpdateCommand.Parameters.Add("@oldCustomerID", SqlDbType.NChar, 5, "CustomerID");
  myParm.SourceVersion = DataRowVersion.Original;
  myParm = custDA.UpdateCommand.Parameters.Add("@oldCompanyName", SqlDbType.NVarChar, 30, "CompanyName");
  myParm.SourceVersion = DataRowVersion.Original;

  // Add the RowUpdated event handler.
  custDA.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated);

  DataSet custDS = new DataSet();
  custDA.Fill(custDS, "Customers");

  // Modify the DataSet contents.

  custDA.Update(custDS, "Customers");

  foreach (DataRow myRow in custDS.Tables["Customers"].Rows)
  {
    if (myRow.HasErrors)
      Console.WriteLine(myRow[0] + "\n" + myRow.RowError);
  }


protected static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs args)
{
  if (args.RecordsAffected == 0) 
  {
    args.Row.RowError = "Optimistic Concurrency Violation Encountered";
    args.Status = UpdateStatus.SkipCurrentRow;
  }
}

Followers