Tuesday, 3 January 2012

How To store the Incoming traffice URL (php)


$refferr_url = $_SERVER['HTTP_REFERER'];
if(!empty($refferr_url)){
$parse = parse_url($refferr_url);
echo "<pre>";print_r($parse);exit;

}

Tuesday, 27 December 2011

2012: Beginning of the End or Why the World Won't End?

Remember the Y2K scare? It came and went without much of a whimper because of adequate planning and analysis of the situation. Impressive movie special effects aside, Dec. 21, 2012, won't be the end of the world as we know. It will, however, be another winter solstice. 

Much like Y2K, 2012 has been analyzed and the science of the end of the Earth thoroughly studied. Contrary to some of the common beliefs out there, the science behind the end of the world quickly unravels when pinned down to the 2012 timeline. Below, NASA Scientists answer several questions that we're frequently asked regarding 2012.

Question (Q): Are there any threats to the Earth in 2012? Many Internet websites say the world will end in December 2012.
Answer (A): Nothing bad will happen to the Earth in 2012. Our planet has been getting along just fine for more than 4 billion years, and credible scientists worldwide know of no threat associated with 2012. 

Q: What is the origin of the prediction that the world will end in 2012?
A: The story started with claims that Nibiru, a supposed planet discovered by the Sumerians, is headed toward Earth. This catastrophe was initially predicted for May 2003, but when nothing happened the doomsday date was moved forward to December 2012. Then these two fables were linked to the end of one of the cycles in the ancient Mayan calendar at the winter solstice in 2012 -- hence the predicted doomsday date of December 21, 2012.

Q: Does the Mayan calendar end in December 2012?
A: Just as the calendar you have on your kitchen wall does not cease to exist after December 31, the Mayan calendar does not cease to exist on December 21, 2012. This date is the end of the Mayan long-count period but then -- just as your calendar begins again on January 1 -- another long-count period begins for the Mayan calendar.

Q: Could phenomena occur where planets align in a way that impacts Earth?
A: There are no planetary alignments in the next few decades, Earth will not cross the galactic plane in 2012, and even if these alignments were to occur, their effects on the Earth would be negligible. Each December the Earth and sun align with the approximate center of the Milky Way Galaxy but that is an annual event of no consequence.
› More about alignment 

"There apparently is a great deal of interest in celestial bodies, and their locations and trajectories at the end of the calendar year 2012. Now, I for one love a good book or movie as much as the next guy. But the stuff flying around through cyberspace, TV and the movies is not based on science. There is even a fake NASA news release out there..."
- Don Yeomans, NASA senior research scientist
Q: Is there a planet or brown dwarf called Nibiru or Planet X or Eris that is approaching the Earth and threatening our planet with widespread destruction?
A: Nibiru and other stories about wayward planets are an Internet hoax. There is no factual basis for these claims. If Nibiru or Planet X were real and headed for an encounter with the Earth in 2012, astronomers would have been tracking it for at least the past decade, and it would be visible by now to the naked eye. Obviously, it does not exist. Eris is real, but it is a dwarf planet similar to Pluto that will remain in the outer solar system; the closest it can come to Earth is about 4 billion miles. 

Q: What is the polar shift theory? Is it true that the earth’s crust does a 180-degree rotation around the core in a matter of days if not hours? 
A: A reversal in the rotation of Earth is impossible. There are slow movements of the continents (for example Antarctica was near the equator hundreds of millions of years ago), but that is irrelevant to claims of reversal of the rotational poles. However, many of the disaster websites pull a bait-and-shift to fool people. They claim a relationship between the rotation and the magnetic polarity of Earth, which does change irregularly, with a magnetic reversal taking place every 400,000 years on average. As far as we know, such a magnetic reversal doesn’t cause any harm to life on Earth. A magnetic reversal is very unlikely to happen in the next few millennia, anyway. 
› More about polar shift 

The Blue Marble: Next GenerationEarth, as seen in the Blue Marble: Next Generation collection of images, showing the color of the planet's surface in high resolution. This image shows South America from September 2004.Q: Is the Earth in danger of being hit by a meteor in 2012?
A: The Earth has always been subject to impacts by comets and asteroids, although big hits are very rare. The last big impact was 65 million years ago, and that led to the extinction of the dinosaurs. Today NASA astronomers are carrying out a survey called the Spaceguard Survey to find any large near-Earth asteroids long before they hit. We have already determined that there are no threatening asteroids as large as the one that killed the dinosaurs. All this work is done openly with the discoveries posted every day on the NASA NEO Program Office website, so you can see for yourself that nothing is predicted to hit in 2012.

Q: How do NASA scientists feel about claims of pending doomsday?
A: For any claims of disaster or dramatic changes in 2012, where is the science? Where is the evidence? There is none, and for all the fictional assertions, whether they are made in books, movies, documentaries or over the Internet, we cannot change that simple fact. There is no credible evidence for any of the assertions made in support of unusual events taking place in December 2012.
› Why you need not fear a supernova
› About super volcanoes 

Q: Is there a danger from giant solar storms predicted for 2012?
A: Solar activity has a regular cycle, with peaks approximately every 11 years. Near these activity peaks, solar flares can cause some interruption of satellite communications, although engineers are learning how to build electronics that are protected against most solar storms. But there is no special risk associated with 2012. The next solar maximum will occur in the 2012-2014 time frame and is predicted to be an average solar cycle, no different than previous cycles throughout history.
› More about solar storms

Thursday, 22 December 2011

PAKISTAN'S MISSILE TECHNOLOGY


Patron Lt Gen (Retd) SARDAR FS LODI 
goes over the whole gamut of the advent of missile technology in Pakistan

On April 6, 1998 Pakistan carried out a successful flight-test of a medium range surface ballistic missile. It is the fifth in the current Hatf series and has been named Ghauri. It has an optimum range of 1500 kilometers and can carry a payload of about 700 kg. The missile is in the research and development phase and is part of the Integrated Missile Research and Development Programme. The test confers on Pakistan a credible indigenous missile capability.
Hatf V (Ghauri) was fired from Malute, near the city of Jhelum, about 76 miles south of the Capital Islamabad at 7.25 a.m. It climbed to a height of 350 kilometers before taking the direction to its planned impact area in the desert of Balochistan where it hit the designated target at 7.33 a.m. after a flight of eight minutes. Hatf V (Ghauri) missile weight 16 tons and consists of 13 tons of fuel, a one ton warhead and the remaining weight is of the casing and equipment.
Pakistan started planning its missile programme in early 1987, on the explicit information gained that India was on the road to pursue its missile programmes, writes General Mirza Aslam Beg, a former chief of the Army Staff in his article Ghauri won't rock the region' (DAWN April 27, 1998) General Beg continues Its authenticity was checked and rechecked. General Zia ul Haq , who was the then president, in consultation with the concerned departments, took two crucial decisions. The first one was based on moral principles that Pakistan would not develop chemical weapons. The second one was to build missiles of short and medium range capabilities, to be equipped with proper guidance systems.
General Beg says that the name Hatf for the surface-to-surface missile was selected by the Research and Development (R & D) Committee of the General Headquarters (GHQ) of the Pakistan Army, as it was the name of the lance of the Holy Prophet (peace be upon him) which was used in many ghazva , and had the unique distinction of never missing its target. Similarly the name Anza, a lance of the Holy Prophet (PBUH) was selected for a similar consideration, for the shoulder-fired ground-to-air missile, which was also developed during the same period. later the anti-tank Baktarshikan missile was also produced.
The testing of Hatf V (Ghauri) missile is the result of the dedication, hard work and single minded devotion to a cause displayed by our scientists and engineers working on the research and development of missile technology. Initially Hatf I was developed with a range of 80 kilometers and a payload of 500 kgs. Efforts continued to improve its performance, resulting in Hatf II with an enhanced range of 250 kms and the same payload of 500 kgs. Both were free flight missiles with inertial guidance systems following a ballistic trajectory. Hatf II was produced in 1989 and displayed at the Pakistan Day parade of March 23, 1990 and 1991.
The testing of Hatf III in July last year was a major break-through in missile development in Pakistan. It has a range of 600 kms with a payload of 500 kgs and a proper terminal guidance system giving it an accuracy of 0.1 per cent, as the circular error probability ( CEP) at 600 kms, similar to the Indian Prithvi surface to surface ballistic missile at 250 kms. This meant that Hatf III was to be controlled by an on-board computer for accuracy and was not to follow a purely ballistic trajectory. The main features of Hatf III missile are its two-stage rocket ability for war-head separation, a terminal guidance system and five different types of warheads. The most difficult part of the missile was the its guidance system which was developed entirely by Pakistani engineers and scientists.
By successfully test-firing Hatf V (Ghauri) missile overland within Pakistan territory our engineers and scientists have amply demonstrated their own technical skills and accuracy of the missile. India on the other hand tests her missiles from the missile range at Chandipur-on-Sea on the Orissa coast, and these are fired into the Bay of Bengal. India successfully tested its intermediate range ballistic missile Agni' on May 22, 1989, after two failed attempts to test the system earlier in the year.
In a successful first launch of Hatf V (Ghauri) missile, which is capable of reaching targets 1500 kms away, Pakistani scientists and engineers have demonstrated their skill and mastery of the modern and up to date missile technology. It means our scientists and engineers have been able to overcome the problems presented by the first four major sub-systems of a medium-range ballistic missile. These are the rocket boosters, navigation and guidance system, missile flight control system and the re-entry vehicle. The fifth is of course the warhead. These sub-systems can be tested separately but it is important for success to integrate them and to flight-test the complete missile system as was done in the case of Hatf V (Ghauri) using a dummy warhead.
Gregory Koblentz, a junior fellow with the Nuclear Non-proliferation project at the Carnegie Endowment for International Peace in Washington, D.C. in his article Theater Missile Defence and South Asia', A Volatile Mix', published in the Non-Proliferation Review, vol 4, No. 3 of 1997 writes According to the Pentagon, Pakistan's missile programmes are driven by a desire to augment limited offensive air capabilities against India, which holds a nearly 3.1 advantage in combat aircraft, and to field a more effective delivery system. Therefore, without a credible aerial delivery capability, Pakistan will have to rely mainly on ballistic missiles to overwhelm India's defences.
Foreign experts believe that India and Pakistan are fast developing ballistic missiles. As with other weapons programmes, Pakistani and Indian pursuit of ballistic missiles is largely driven by the perception that these missiles are necessary to counter their rival's capabilities. India's development of Medium Range Ballistic Missiles (MRBMs) is also motivated by its desire to be recognized as a great power and strategic competitor with China, they feel.
India started its missile programme in 1983. The Pakistan-specific' short range surface-to-surface ballistic missile Prithvi' was first tested in 1988 and after conducting about 15 tests to perfect it, the production of the missile was started in 1994. The most advanced long range Prithvi missile was test-fired by India in January 1996. With its longer range of about 150 miles the missile can strike most major cities of Pakistan five minutes after launch. A shorter range version of the missile, which can carry a 1000 kms warhead approximately 90 miles, was already in limited production. Both versions are highly mobile, and although India insists that all Prithvis will be tipped by conventional explosives, both are capable of carrying nuclear warheads. Washington was so concerned that the Prithvi missile launch would provoke a strong Pakistani response that Deputy U.S. National Security Adviser, Sandy Berger was dispatched to Islamabad in February 1996 to counsel restraint.
The arrival of the new Prithvi, said the U.S. News & World Report of February 12, 1996, will qualitatively change the nature of the strategic balance ( between India and Pakistan), because ballistic missiles reach targets faster than other weapons and are difficult to defend against. The report goes on to say, Indian Prime Minister P.V. Narasimha Rao (at the time) has been careful not to openly acknowledge Prithvi production or deployment. But sources in the Indian Defence Ministry say the first short-range missiles already have been handed over to the Army, which has set up a special unit called the 33rd Missile Group in the southern city of Secunderabad. The report concludes by saying Pakistan, a narrow country that is vulnerable even to short-range missiles, has struggled to keep pace.
On May 27, 1997, without any provocation India sent a Russian made MIG-25R military reconnaissance aircraft deep into Pakistan airspace. This was followed a week later by the move forward to the Pakistan border of India's ground-to-ground ballistic missile Prithvi', as reported by U.S. officials in Washington on June 4, 1997, who disclosed that India's military forces recently moved a handful of medium-range ballistic to a prospective launch site near the Pakistani border. U.S. intelligence have concluded that fewer than a dozen of them are now located near the city of Jullundur in the state of East Punjab in north west India.
We know that the missiles have been moved, and in the wrong direction said one US official who is familiar with intelligence reports on the matter. This is going to prompt a bad reaction-even an overreaction in Pakistan, said another official. The US officials expressed uncertainty why the missiles were moved to that site at a time when senior Indian and Pakistani political officials have been moving toward an improved dialogue and a possible reduction of political tension. The Washington Post also reported in its issue of June 3, 1997, deployment of the Indian Ballistic Missiles at a prospective launch site near Pakistan's border.
As a consequence the Pakistan Foreign Office on June 3, 1997 expressed serious concern at the deployment of medium-range ballistic missile, Prithvi, by India near Pakistan's borders and said it reserved the right to take measures for its security. The statement said The deployment of Prithvi missiles entails a qualitative change in the security environment in South Asia and could trigger a dangerous ballistic arms race in the region.
The Pakistan Foreign Minister Mr. Gohar Ayub Khan in a letter to the US Secretary of State Ms. Madeline Albright said that the deployment of Prithvi missiles by India near Pakistan border has created a dangerous security environment combined with a potential of unleashing a missile race in South Asia. He said India appears to have been encouraged by the discriminatory American Legislation against Pakistan that has resulted in a serious military imbalance in the region. The letter continued by saying that the Indian missile threat leaves us no choice but to take appropriate measures.
India denied that any missiles had been deployed near the Pakistan border. The Indian Prime Minister at the time Mr. I.K. Gujral while talking to the representative of the weekly India Abroad' in Washington on July 14, 1997 said that India had undertaken missile manufacturing for a long time and had not made a secret of it. India's present storage capacities have been filled. Since it could not spend money building more storage capacities, the Jullundur capacity was used for Prithvi. This statement is in complete variance with the US disclosure based on the intelligence estimates that a handful of medium-range ballistic missiles had been moved to their prospective launch sites near the Pakistani border. They have in fact been issued to the No. 60 Artillery Regiment located in the area for some time.
Violation of Pakistan's air space and the deployment of medium-range ballistic missiles by India near the Pakistan border created some misgivings in the official and political circles in the country and some alarm in the public's mind. The test-firing of Haft III rocket by Pakistan in July 1997 seems to have been a natural consequence for a small country safeguarding its security interests in the absence of any outside support.
In the meantime India had decided to acquire the Russian made S-300V air defence and anti-ballistic missile system. This is similar to the US patriot missile and is capable of targeting incoming enemy aircraft and ballistic missiles. The agreement was signed by India's former Defence Minister Mulayam Singh Yadav during his visit to Russia on July 14, 1997, heading a high-powered defence delegation consisting of the Secretary of Defence and the Vice-Chiefs of the three defence services.
The daily Telegraph of London had reported that the Indian Defence Research and Development Organization (DRDO) had been instructed by the government of India to carry out detailed evaluation of the advanced technologies of the Russian S 300V anti-ballistic missile in consultation with the Army and Air Force for possible incorporation in the later version of the Indian Akash' surface-to-surface missile to provide it anti-ballistic missile capability.
India started her ambitious Integrated Guided Missile Development Programme (IGMDP) in July 1983 with an original cost of production at Rs. 3,380 million which has since been revised to Rs. 7840 million. The original plan was to design and develop Prithvi (Earth) Medium range surface-to-surface ballistic missile; Trishul (Trident) anti-ship missile; Akash (Sky) surface-to-surface air missile; Nag (Cobra) anti-tank missile and Agni ( Fire) an Intermediate-range Ballistic Missile (IRBM). However later Surya and Sagarika have been added to the IGMPD. The Surya is an Inter-Continental Ballistic Missile (ICBM) with a range of 12,000 to 20,000 km, while Sagarika has range of 300 km and is a submarine launched ballistic missile. The Navy also wants a redesigned Prithvi ballistic missile for its use.
The hectic missile activity going on in India is a cause of great concern for her small neighbours. It is therefore the duty of every government to protect the country from foreign aggression and internal subversion. It was therefore appropriate and timely for Prime Minister Nawaz Sharif to declare, while addressing the National Defence College in Islamabad on April 6, 1998, his resolve to make Pakistan a strong, stable, prosperous and democratic country. Defence of Pakistan was being given priority as he considered a strong defence essential for economic development of the country.
The new BJP-led government in India has aggravated to a large extent Pakistan's defence problems owing to additional provocation and threats emanating from India. This is evident from its election promises and the action taken and contemplated on assuming power. Mr. Savita Pande, a research fellow at India's Institute for Defence Studies and Analysis writing in The Pioneer' of New Delhi in its issue of February 17, 1998 says that the Bharatiya Janata Party (BJP), in its 31- page manifesto has promised to re-evaluate the country's nuclear policy and exercise the option to induct nuclear weapons. It has also declared its intent to expedite the development of the Agni series of ballistic missiles (India's intermediate range missile with a range of 2,500 kms). The author goes on to say that the party's (BJP) nuclear agenda can no longer be dismissed as mere pre-poll propaganda. As BJP's attaining power in India will place it in a position to call the shots in nuclear and strategic issues. The author concludes with the following words. By mentioning the completion of the Agni programme in the same breath as the induction of nuclear weapons, the BJP has made its posture more credible both inside and globally. How soon will the BJP government carry out its election promises is the deadly question which is receiving the urgent attention of India's small neighbours. The situation is also being watched by the Western government who have interest in South Asia and the region around it.
Russia is helping India to build a Sea-launched ballistic missile system that can carry a nuclear warhead and strike deep into Pakistan, the New York Times' (NYT) reported on April 27, 1998. In an exclusive report the Times' said India was getting Russian assistance since last three years. The newspaper quoting an official of the US administration said, despite assurances from Russia that its scientists were not contributing restricted technology to India's missile programme, the assistance had continued. US Vice President Al Gore and other senior administration officials had appealed to Russia to halt the support, but Russia paid little attention to it. India, the NYT noted, has long had military ties to Russia, it has been trying for years to develop a series of more powerful missiles. Although not tested , the sea-launched missile, the Sagarika, whose name means Oceanic in Hindi, is said to have a range of nearly 200 miles and is meant to be launched from submerged submarines.
The NYT said this would be a technological breakthrough for India in its arms race with Pakistan. American intelligence officials regard the simmering rivalry one of the most dangerous flash points for conventional or even nuclear war. Clearly this (Russian) cooperation with India raises questions said a senior US administration official, who, as with others, insisted on anonymity, because of political sensitivities and to protect American intelligence sources. Another officials who tracked the reports said the Russian help to India had included significant engineering services as well as parts and equipment necessary to build and launch the missile, said the Times.
It should be appreciated that India is making an all out effort to develop a large-scale missile industry capable of browbeating and dominating South Asia and the region around it. Missile technology was freely transferred from Western sources and is now being done by the Russian. India's acquisition of missiles and other high-profile defence equipment is well beyond her legitimate defence requirements. It poses a valid and active threat to the independence of her small neighbours. It is with this background that the successful test-firing of Pakistan's Hatf V (Ghauri) missile had been welcomed with some enthusiasm by the entire nation. The development of missile technology will give strength to the Prime Minister's resolve to make Pakistan militarily strong and giving priority to defence, as it contributes enormously to the well being of the country and its economic development. It must be remembered that weakness has over the ages invited aggression whereas adequate strength has deterred it.
The significance of Pakistan's missile technology resulting in the test-firing of Hatf V (Ghauri) and the impact it is likely to have on regional, particularly South Asian defence capabilities and the balance it will create has been discussed in great details in official circles and the press of both India and Pakistan. The upshot is, that at present India's Pakistan-specific Prithvi missile deployed on our borders covers most of the important towns, airfields and communication centres in Pakistan.

When Hatf V (Ghauri) missile is deployed in Pakistan it will cover most of India except its eastern and southern portion and the coast, along the Bay of Bengal. It will deprive India of the advantage of strategic depth that it enjoys at present in relation to Pakistan. It will therefore give Pakistan a degree of defence parity that has been reducing in the last few years. Pakistan will now be in a position to hit back effectively if subjected to aggression by India and inflict unacceptable damage to India's important and vulnerable areas and particularly those areas which were hitherto considered safe, owing to the distance from the Pakistan border.
This should give any potential aggressor cause for genuine concern and caution its military planners.
In the modern defence concept, the missile system is the most essential element. In fact it is now the core of any viable defence structure and the cutting edge of an adequate defence capability of any nation. It cannot therefore be ignored by the defence planners. In Pakistan's security environment an adequate missile defence will prove an effective and reliable deterrent. The essence of deterrence worldwide, is a country's power to retaliate in kind. It was after all, the power of deterrence that prevented a third World War between the Western allies and the Soviet empire for over 50 years. In case of South Asia deterrence should provide the foundation for lasting peace and security on the basis of sovereign equality of nations and in accordance with the charter of the United Nations.

Tuesday, 13 December 2011

2012 phenomenon End Of The Earth


The 2012 phenomenon comprises a range of eschatological beliefs according to which cataclysmic or transformative events will occur on December 21, 2012.This date is regarded as the end-date of a 5,125-year-long cycle in the Mesoamerican Long Count calendar. Various astronomical alignments and numerological formulae related to this date have been proposed.
A New Age interpretation of this transition is that this date marks the start of time in which Earth and its inhabitants may undergo a positive physical or spiritual transformation, and that 2012 may mark the beginning of a new era.Others suggest that the 2012 date marks the end of the world or a similar catastrophe. Scenarios suggested for the end of the world include the arrival of the next solar maximum, or Earth's collision with a black hole, passing asteroid or a planet called "Nibiru".
Scholars from various disciplines have dismissed the idea of such cataclysmic events occurring in 2012. Professional Mayanist scholars state that predictions of impending doom are not found in any of the extant classic Maya accounts, and that the idea that the Long Count calendar "ends" in 2012 misrepresents Maya history and culture. Astronomers and other scientists have rejected the proposed events as pseudoscience, stating that they are contradicted by simple astronomical observations.

Wednesday, 7 December 2011

How to download data in .csv format (php)


function export2csv(){
$file = 'export';

$result = mysql_query("SHOW COLUMNS FROM tbl ");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field'].", ";
$i++;
}
}
$csv_output .= "\n";

$values = mysql_query("SELECT Colum1 , Colum 2  FROM tbl");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j].", ";
}
$csv_output .= "\n";
}

$filename = "filename_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
}

Monday, 5 December 2011

How To Upload .csv file (php)



<?php
$counter = 1;
$row = 1;
if(isset($_FILES['up_info_file']) && $_FILES['up_info_file']!='' ){

// $ext = getFileExtension($_FILES['up_info_file']['name']);
$ext = substr($_FILES['up_info_file']['name'], strrpos($_FILES['up_info_file']['name'], '.'));
if($ext == '.csv'){
$handle = fopen($_FILES['up_info_file']['tmp_name'], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
//echo '<pre>'; print_r($data[1]); exit;
$num = count($data);
$row++;
$counter;
if($data[0] != '' && $counter != 0){
echo '<pre>'; print_r($data[1]);
echo '<pre>'; print_r($data[0]);
}
}
$counter++;
}
}// end if file not empty
else{ echo "File is Empty";}
//while endss
fclose($handle);
?>

Thursday, 1 December 2011

Why women love a bad boy

Bad boys are unreliable and selfish, but some women seem to love them anyway. We talk to the experts to find out why.

We all know one, a bloke who lives his romantic life by the motto "treat 'em mean, keep 'em keen".

And the most puzzling thing about him is that he does indeed seem to keep them keen. Despite his complete lack of chivalry and a history of messing women around, they still seem to be queuing up for his attentions.

In other words, he's a living embodiment of the old cliché that women love a bad boy. Here's why science says that might be so, and how even good guys can get a piece of the action.

Do women really want bad boys?
Studies suggest that the answer is, in some cases, yes. One study found that men who display a "dark triad" of traits - narcissism, thrill-seeking and deceitfulness - had more sexual partners than those who didn't.

And according to behavioural psychologist Jo Hemmings, some women like bad boys precisely because they're mad, bad and dangerous to know.

"There can be something extraordinarily tempting about bad boys," she admits. "It's partly the forbidden nature of it all - the rebel in women that still deserves to be unleashed from time to time. Bad boys keep us on our toes, can't be taken for granted and deliver the sort of fun and excitement that might be lacking in the more conventional, reliable guy."

Bad boys are fun
According to Hemmings, bad boys are "often passionate, unorthodox in their lifestyles and couldn't give a toss what anyone else thinks". And this, she thinks, is just what some women are after, quite a lot of the time.

Because if they don't really care what anyone else thinks, bad boys will be spontaneous, rule-breaking and experimental - in and out of the bedroom. They might be moody, unreliable and shallow, too, but at least life will never be dull. That's a large part of the bad boy appeal.

It's also true that bad boys represent a challenge, but one with a very satisfying reward. If they can tame a bad boy when so many others have tried and failed, it's a great esteem-booster for any woman. The attraction of a bad boy is the chance to be the only one who can bring out his inner - well-hidden - romantic side.

Women love bad boy looks
Even if most women don't really want a bloke who will cheat on them at the drop of a hat, many of them fancy a bloke who looks like he might.

That's the conclusion of one recent study, in which more than 1,000 adults were asked to rate the sexual attractiveness of pictures of the opposite sex. The women in the study tended to be far more attracted to men who looked proud or brooding than they were to happy, smiling blokes.

"While showing a happy face is considered essential to friendly social interactions, including those involving sexual attraction, few studies have actually examined whether a smile is, in fact, attractive," said Jessica Tracy, a professor in the University of British Columbia psychology department, where the research was carried out.

And to women, it clearly isn't. Brooding, proud men were considered attractive, perhaps because their expression seemed to display high status. On the other hand, smiling men may have been seen as too eager to please, something that denotes lower status.

There's a caveat to all this. The women were only asked to rate the men on raw sexual attractiveness, not on their suitability for a long-term relationship. And that's worth bearing in mind.

How to become a 'good' bad boy
The message in all of this is that women fancy the bad boy stereotype, but don't want a proper bad boy for a boyfriend. They see a bad boy as a challenge - and the challenge is to bring out his good side.

They may want some bad boy traits without wanting the full vain, arrogant, selfish, pain-in-the-arse package. If you're a good guy - and we assume you are - you can use that knowledge to your advantage.

The Columbia study suggests that you shouldn't be too eager to please. Be friendly, interested and engaging, but don't agree with everything she says. Have an opinion, argue the point, and don't be at her beck and call.

And if the bad boy cliché says anything, it's that we should try to be spontaneous and just a little bit unorthodox, at least from time to time. Because what Hemmings and others say the bad boy appeal really means is that women are worried about getting into a relationship rut.

They don't want steady-as-she-goes all the time. They don't want to know in advance what every weekend holds, or indeed how the next hour in bed might turn out. They want passion, impulsiveness and a devil-may-care attitude - in the right circumstances.

But they don't want the other stuff - the deception, infidelity or moodiness. In the end, science says the real bad boys lose the girl. "Take heart; most women will want a good guy with good prospects (a stable job and lifestyle) eventually," writes psychologist Dr Nando Pelusi. "Work on being independent and assertive and allowing spontaneity into your repartee. Discover your connection with someone in visceral, not just cerebral, ways."