2009年3月31日星期二

ASP rs.Fields.Countrs

<%
Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
cn.Open Application("guestDSN")
rs.ActiveConnection = cn
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Source = "SELECT * FROM authors"
rs.Open
%>

ASP Function Listing

ASP Function Listing
It is critical that you learn and understand all available ASP functions. That way when you are coding a project, you know that you're doing your task in the most efficient manner possible. If you don't know that a function exists, you won't know to use it to solve your problems.

String Functions
Numeric Functions
Array Functions
Date / Time Functions

Variable Testing Functions
File System Functions

VBScript Replace Function

The Replace function replaces a specified part of a string with another string a specified number of times.

Syntax
Replace(string,find,replacewith[,start[,count[,compare]]])

Parameter Description
string Required. The string to be searched
find Required. The part of the string that will be replaced
replacewith Required. The replacement substring
start Optional. Specifies the start position. Default is 1
count Optional. Specifies the number of substitutions to perform. Default value is -1, which means make all possible substitutions
compare Optional. Specifies the string comparison to use. Default is 0
Can have one of the following values:

•0 = vbBinaryCompare - Perform a binary comparison
•1 = vbTextCompare - Perform a textual comparison


Example 1
dim txt
txt="This is a beautiful day!"
document.write(Replace(txt,"beautiful","horrible"))Output:This is a horrible day!

Basic ASP Coding and Concepts

It's critical when learning any language to understand the basics before you begin. Here are some basic concepts in ASP to learn and understand.

ASCII and HTML
ASCII definition
ASCII Chart
Choosing a Doctype

Basic Operations
Basic ASP Concepts
Commenting your Code
Output Basics
If-Then Looping
For-Next Looping

Variables
Variable Basics

The FREE ASP On Line Course

The FREE ASP On Line Course
Want to learn how to program in ASP? Don't want to pay hundreds or thousands of dollars to learn? Here is everything you need to know to get started, in a simple, FREE on line course. If you want, I also have several ASP Ebooks available on this site, to further your knowledge.
What Is ASP?With all of the acronyms floating around the web, ASP might seem to stand for anything.
Setting up the Webserver for ASPYou can't just stick ASP in a HTML file and expect it to work.
Writing Output in ASPOne of the first things to learn in ASP is how to create output.
Naming and Defining VariablesOne of the key features of using ASP is the ability to use a variable.
Defining and Using ArraysInterested in using arrays to help you organize your variables?
IF-THEN and CASE statementsThere are often times that you want to do something different in different situations.
FOR-NEXT and DO-WHILE Code LoopingOne of the most important concepts in programming with ASP is looping through an operation.
Using the REQUEST ObjectASP is very commonly used to process form requests.
Keeping your Code Modular with INCLUDEDo you find yourself doing the same thing over and over in your pages? This will help.
Search Engines & ASPEvery website wants to be found. Here is how to ensure that yours is.In addition to these lessons, this site has a complete database of functions, collection of sample code, as well as other information. Read through the entire site to build your ASP knowledge.

Replace ASP String Function

Replace is a commonly used ASP function that allows you to replace one character or characters in a string with another character or characters.

It takes in three parameters:

* The string variable to operate on
* A character or characters to look for
* A character or characters to replace that with

The original string variable is not altered.

There are MANY reasons to use Replace. One of the most common ones is in fixing email problems when people submit an email address to you. People are notorious for adding extra spaces to the beginning, end or even middle of their email address. Many mailers choke on those extra spaces. So to get rid of all spaces - replacing them with "nothing" - you would use:

RecEmail = Replace(RecEmail, " ", "")

Another common use of replace is to take in a comment that a user has typed in and format it for web reading. Users type in returns, or CHR(13) into their text. However, web browsers of course ignore hard returns so the user's text all mushes together. To change all of those returns with the web command

which is the paragraph break, you would use:

UserComment = Replace(UserComment, CHR(13), "

")

Now when you display UserComment, there are paragraph breaks to nicely separate the user's paragraphs.

Hundreds of migrants feared dead off Libyan coast

• Just 23 of 300 Italy-bound migrants have survived
• Charity says 13,000 died in this manner in last decade

A policeman distributes bread to migrants who were rescued from one of the three boats which sank in a violent storm off the coast of Libya. Photograph: AFP/Getty Images

The Libyan navy yesterday called off a search operation for more than 200 migrants feared drowned after strong winds capsized the rickety boat in which they were sailing to find a new life in Europe.

After leaving Libya on Saturday, the packed vessel - designed to carry 50 - turned over 30 miles out to sea, leaving 23 survivors swimming alongside 21 corpses in the choppy water.

The rest of the reported 250 to 260 passengers vanished into the Mediterranean, a UN spokesman said.

The probable number of drownings was lower than earlier reports, but yesterday were put in context by the Italian charity Caritas which called the Mediterranean a "cemetery without tombstones".

It said that 13,000 migrants had died in 10 years as they tried to reach Italy on leaking and crowded vessels. "We hear the daily reports from fishermen who are finding more and more bodies caught up in their nets," said Oliviero Forti, an immigration official at Caritas.

Details also emerged of a rescue operation that prevented the likely number of drownings at the weekend more than doubling.

A second vessel carrying 350 migrants lost engine power after setting off from Libya on Saturday, but was spotted and towed back to Tripoli by an Italian tug boat. "The seas were rough and they were heading for a horrible fate," said Francesco Barraco, the ship's captain, who was tipped off after staff on a nearby oil rig spotted the marooned vessel. Barraco's crew took 14 hours to tow the boat to port at no more than five knots to avoid it sinking.

"They sat dead still on board, knowing they were going back, but knowing the storm would have stopped them making it," said Barraco. "I have towed a lot of migrant boats, but usually with 10 or 15 people, never this number."

One UN official said Europe's plunging economies were unlikely to deter desperate people from handing over $1,200 on Libyan beaches to make perilous crossings.

"Families now receiving less money from relatives already in Europe are more tempted to migrate, while the plunging price of commodities like coffee and cotton mean the downturn is affecting everywhere," said Jean-Philippe Chauzy.

The passengers on the rescued vessel were a snapshot of a world on the move. The UN said 66 Bangladeshis, five Indians, 15 Syrians and two Pakistanis were among the passengers brought back to Tripoli, as well as Egyptians, Somalians, Ghanaians, Nigerians, Tunisians, Eritreans, Algerians and Moroccans.

Other vessels have made it through the rough weather in recent days, with 400 migrants making successful landings in Sicily - where over a hundred are now bedding down in a small town gym - and 222 arriving on the Italian island of Lampedusa, where 37,000 migrants arrived last year.

More than 700 migrants are now spread between two reception centres on the island, where tensions remain high since the Berlusconi government decided at Christmas to end the practice of shunting asylum seekers on to other centres on the mainland, from where many abscond.

With more than 1,500 migrants packed on the island, rioting broke out, fires were set and a group of migrants broke out of one centre before being rounded up by police.

"Confusion reigned, and the government backed down on the policy," said one UN official.

Interior minister Roberto Maroni said on Monday that long planned joint patrols of the Libyan coast line jointly by Italian and Libyan crews would start on May 15 and put paid to migrant vessels setting out. "On that day I expect the flow of people entering Italy from the Libyan channel to stop," he said.

Francesco Barracco, captain of the Italian tug boat, noted that a Libyan naval vessel had already pulled up at the marooned vessel by the time he got there on Saturday. "I have never seen that before, so maybe the Libyans have decided to do something." But the UN's Chauzy was sceptical the flow of migrants could be stamped out. "Look at Senegal where they stepped up patrols and the traffickers simply sent people overland to Libya."

Obama Said to Find Bankruptcy Likely for GM, Chrysler (Update1)

By John Hughes, Linda Sandler and Rebecca Christie

April 1 (Bloomberg) -- President Barack Obama believes a quick, negotiated bankruptcy is the most likely way for General Motors Corp. to restructure and become a competitive automaker, people familiar with the matter said.

Obama also is prepared to let Chrysler LLC go bankrupt and be sold off piecemeal if the third-largest U.S. automaker can’t form an alliance with Fiat SpA, said members of Congress who were briefed on the GM and Chrysler situation before the president said two days ago that the automakers’ viability plans were insufficient.

The president gave GM 60 days to come up with deeper cost and debt reductions than the biggest U.S. automaker proposed in its plan submitted last month. The “quick and surgical” bankruptcy his administration said was also an option appears to be inevitable, said the members of Congress and two other people familiar with the matter. Obama personally signed off on asking GM Chief Executive Officer Rick Wagoner to step down, which he did on March 29, they said.

A GM bankruptcy would mark the fall of a corporate icon that as recently as 2004 posted a $2.8 billion profit and in 1962 controlled 51 percent of the domestic car market. A plunge in sales of sport-utility vehicles and pickups as gasoline prices soared, coupled with the seizing up of credit markets, caused GM to lose $82 billion in the last four years and seek government help to survive.

$17.4 Billion

“The president’s position has not changed,” a White House official said. “He remains committed to a significant restructuring without a bankruptcy if at all possible.”

“Our focus is on accelerating the speed of our operational restructuring and reducing liabilities and debt on the balance sheet,” GM spokeswoman Renee Rashid-Merem said in an e-mail. “GM will take whatever steps are necessary to successfully restructure our company.”

Chrysler will work with Fiat and the Obama administration “to secure the support of necessary stakeholders,” Chrysler said in a statement.

GM and Chrysler received $17.4 billion in aid since December to avoid bankruptcy as auto sales reached a 27-year low. The carmakers have been trying to shed debt and workers and trim health-care costs to win $21.6 billion in added assistance.

Obama said their recovery plans were insufficient. He gave GM a deadline to “fundamentally restructure” and said he would consider more aid for Chrysler only if it completed a partnership with Italy’s Fiat within 30 days.

60-Day Deadline

Obama still expects GM to try to avoid bankruptcy through negotiations with bondholders and the United Auto Workers and for Chrysler to continue talks with Fiat, though administration officials aren’t optimistic, the people said.

Detroit-based GM must shrink $27.5 billion in debt that bondholders have been reluctant to exchange for equity and $20.4 billion in obligations to a union-run health-care fund. A bankruptcy may make recoveries for bondholders and the UAW more difficult.

“We’ll get it done in court or we’ll get it done out of court,” Fritz Henderson, who became GM’s CEO after Obama forced out Wagoner, said yesterday.

Creditors doubt an equity exchange can be completed before the 60-day government deadline to slash GM debt sufficiently, a person familiar with the matter said.

The government probably is considering putting GM and Auburn Hills, Michigan-based Chrysler into bankruptcy and then quickly selling their best assets to form new companies, Rod Lache, a Deutsche Bank analyst based in New York, said in a note to investors on March 30.

GM Contingency Plan

The process, a “363 sale” that refers to a section of bankruptcy code, would be a way to keep the automakers from sitting in a prolonged bankruptcy that might undermine sales of their vehicles, Lache said.

“The administration is a bit more focused on a structured, or prepackaged, bankruptcy than some might think,” Representative Candice Miller, a Michigan Republican, told reporters yesterday. “There would be an outcome that would almost be predetermined, that could happen very quickly, and it would be much about renewal rather than destruction.”

GM has a contingency plan ready for a new company that would split off its best assets into an entity that might later be sold, advisers to the company and Obama’s auto task force said.

Stakes of any dissident creditors, including bondholders, would be “crammed down” or forcibly reduced in a bankruptcy, according to the advisers, who declined to be named because GM and the government’s plan remains private.

Longer Bankruptcy

GM’s new-company plan, which the people said was ready to go, would split the automaker into “good” and “bad” entities, the advisers said. The new GM would be powered by brands such as Cadillac and Chevrolet and valuable foreign operations. Unprofitable brands, such as Hummer, contracts with surplus dealers and financial obligations would be hived off in bankruptcy court, said one of the advisers.

While the new company could be created in 30 days or less, allowing GM to operate without interruption, bankruptcy may go on much longer, focused on bad assets, said a GM adviser.

Senator Carl Levin, a Michigan Democrat, said the public focus on a bankruptcy risks bringing about that very scenario.

“The more you talk about it publicly as a possibility, the more people have doubts as to whether they want to buy the cars in that company,” Levin told reporters yesterday.

“I know what they’re trying to do is signal to the bondholders that folks, you’ve got to come to the table,” Levin said of the Obama administration. “I would have done it differently.”

To contact the reporters on this story: John Hughes in Washington at jhughes5@bloomberg.net

Last Updated: March 31, 2009 23:00 EDT

PC users brace for attack by Conficker worm

By Hiawatha Bray
Globe Staff / April 1, 2009

Today may see the beginning of a global online crime wave - or the biggest April Fool's Day joke in Internet history.

It all depends on what happens to as many as 15 million personal computers that could be infected with an insidious worm called Conficker. On April 1, these machines are supposed to receive new instructions from the worm's creators via the Internet. And computer security experts don't know what to expect.

"There's just no way to tell," said Fred Rica, who oversees the computer threat and vulnerability management practice at PriceWaterhouseCoopers LLP in Florham Park, N.Y. There might be a surge in spam e-mails or digital attacks on major Internet sites, or, said Rica, "it could be a nonevent."

First spotted in November 2008 by computer security researchers, Conficker attacks computers running Microsoft Corp.'s Windows XP or Vista operating systems. Conficker is made possible by a security flaw in the Windows software that allows an infected machine to spread the worm to other Windows computers through the Internet. Microsoft issued a fix for the problem months ago, but millions haven't installed it. Conficker can also be spread by infected removable disks or USB drives. If a machine is already infected, getting a cure can be difficult, because Conficker will block the computer from visiting websites that provide antivirus products.

Computer security experts say Conficker has infected relatively few US computers. It's mainly attacked machines in countries like China and India, where millions use unauthorized copies of Windows. Microsoft does not provide automatic security updates for pirated software.

But Richard Wang, manager of Sophos Labs US in Burlington, a major computer virus research center, said Conficker-infected machines in other countries could have a big impact in America. "You don't have to be infected by Conficker to receive the spam it sends," Wang said.

Conficker has already drawn blood. It forced the French Navy to ground some of its fighter planes and tainted so many desktop computers at the British Ministry of Defense it took two weeks to repair the damage. And this happened even before the worm went active.

Computer researchers who analyzed the Conficker code found that infected machines are supposed to contact remote servers over the Internet on April 1, and download a set of instructions. But only the unknown vandals who created Conficker know what these instructions will be.

The experts fear that Conficker will transform the infected machines into a "botnet" - a remote-controlled computer network that could launch digital attacks on major online services or crank out billions of spam e-mail messages. Or the Conficker masterminds might order the computers to do nothing at all - at least, not yet. After April 1, the infected machines will keep trying to download new instructions every day. So a wave of Conficker-related cybercrime may not strike for days, weeks, or months.

"The whole date of April 1 has been blown a bit out of proportion," said Wang. "Focusing on a single day is really not the answer to this kind of security problem."

Instead, Wang said that computer users must consistently use good security practices. Windows computers should be set to automatically download and install the latest security patches, and users should always run an up-to-date antivirus program.

Those who suspect that their machines have already been infected with Conficker may not be able to directly download a program to remove the worm, because Conficker can prevent this. They should use a different computer to download a removal program, and then install and run this program on the infected machine.

Removal programs are available at the website of Microsoft Corp. and major antivirus software makers like Symantec Corp., Sophos PLC, and McAfee Inc.

Hiawatha Bray can be reached at bray@globe.com.

Absentee Ballots to Decide N.Y. House Race

Absentee Ballots to Decide N.Y. House Race
Democrat Murphy Has Slender Lead Over Tedisco in Closely Watched Contest
By Keith B. Richburg and Paul Kane
Washington Post Staff Writers
Wednesday, April 1, 2009; Page A04

NEW YORK, March 31 -- No winner could be called Tuesday night in a special election in Upstate New York to fill a vacant House seat. Instead, absentee ballots will decide the race, and the result could be held up as long as two weeks, election officials said.

With all precincts reporting, Scott Murphy (D), a businessman and venture capitalist making his first run for office, outpolled State Assembly Minority Leader Jim Tedisco (R) by 59 votes. More than 154,000 votes were cast Tuesday.

But election officials said more than 5,000 absentee ballots were yet to be counted.

That left frozen a race that the two major national parties were trying to interpret as either an endorsement of President Obama's economic policies or the start of a GOP comeback after recent national defeats. Determining the result could take a while; New York agreed to count ballots mailed from overseas until April 13, after the Justice Department sued the state over the issue.

Before the polls closed, Republicans were trying to play down the contest, just in case Tedisco were to lose. Democrats, at the same time, were reminding anyone who would listen that the 20th Congressional District, which includes most of the Albany suburbs and stretches north to Lake Placid, is a traditionally conservative, gun-friendly area where Republicans enjoy a 70,000-person edge in registered voters.

Murphy closed strongly, overcoming an initial double-digit deficit in polls. The two parties, and various interest groups and unions, spent millions of dollars to inundate the district with radio and television advertisements.

For most of the month-long campaign across the sprawling district, the candidates debated national issues, including the $787 billion federal stimulus act, which the Democrat supports and the Republican opposes, and the issue of executive compensation and bonuses paid to top officials of the insurance giant American International Group.

The previous House member from this district was Democrat Kirsten Gillibrand, since appointed to the Senate. Former president George W. Bush carried the district twice, but Obama won here last year.

With the latest polls showing the race moving away from Tedisco, Republicans began backing away from their previous effort to highlight it as a referendum on Obama's economic agenda. House Minority Leader John A. Boehner (R-Ohio) told reporters that the district was a "Democratic seat" and that "President Obama won this seat."

Rep. Aaron Schock (R-Ill.), who campaigned with Tedisco last month, said "all politics is local" and suggested that the campaign pivoted on how the candidates reacted to the larger economic struggles in the district.

House Speaker Nancy Pelosi (D-Calif.), meanwhile, said that "the strength of the recovery package" had allowed Murphy to close the gap and provided him a framework for talking about a positive economic agenda.

"The people are really attracted to it," Pelosi said of the legislation.

Kane reported from Washington.

2009年3月30日星期一

Ahead of North Korea’s planned rocket launch, US dispatches destroyers

The US has said it won't use destroyers to shoot missiles down. But they could gather intelligence.

By Carol Huang | 03.30.09

The US said Sunday that it won’t shoot down whatever rocket North Korea is apparently preparing to launch between April 4-8. Why, then, have US Navy destroyers modified for ballistic missile defense been leaving Japanese and South Korean ports?

The anticipated launch has dramatically raised tensions in recent weeks: Pyongyang claims it’s merely launching a satellite; Washington, Seoul, and Tokyo say it’s a missile. (Read the Monitor’s coverage about recent developments here and about preparations being made at a South Korean air base.)

One reason for dispatching the destroyers could be to provide backup for Japan. The close US ally has itself deployed antimissile systems and vowed to shoot down any debris falling toward its territory – a difficult task for which it would only have 10 minutes notice, according to Reuters.


“I wouldn’t lose sleep at night. Japan is very safe,” said Rear Admiral James Kelly, commander of the US Naval Forces in Japan, according to Kyodo, a Japanese news agency. US forces are “postured the right way” to respond, he said.

Another option, someone familiar with missile defense system points out, is that the US may just want destroyers capable of tracking and intercepting missiles hanging around when secretive Pyongyang launches one. How often does it get such a close-up shot at gathering intelligence about the secretive country’s rocket capabilities?

In related news, further ratcheting up tensions, North Korea announced Monday that two American journalists detained on the border with China on March 19 will stand trial for “illegal entry” and “hostile acts.” Since being seized, the two reporters – Euna Lee and Laura Ling, both working for California-based Current TV – were undergoing “intense interrogation” at a military guesthouse outside Pyongyang, Reuters reported, citing a South Korean newspaper.

Obama visits Capitol to make case for budget

By ANDREW TAYLOR – 38 minutes ago

WASHINGTON (AP) — President Barack Obama told his House Democratic allies Monday that despite a weak economy, now is the time to take on ambitious agenda items such as education, health care and clean energy — or else they won't get done.

Obama's closed-door appearance comes as the House and Senate this week take up companion budget outlines that constitute their initial response to the $3.6 trillion fiscal plan for 2010 submitted by Obama last month.

Typically, the first year of a presidency — when a president has political capital from a winning election — is the most opportune time to take on big issues.

Obama assured the assembled lawmakers that the country has confidence in Democratic leadership and that continued unity is needed to produce results that will in turn keep the party's standing high with the public, according to notes taken by a House aide who required anonymity to describe the private session.

"We are in this together," Obama said.

Speaking to fiscal hawks in the House, Obama said that the reason his budget predicts such large deficits is not because of new spending for health care, energy and education but because of structural deficits that he inherited.

Obama said he is "serious as a heart attack" about addressing the nation's long-term deficit problems.

Rep. Chris Van Hollen, D-Md., said Obama said his administration remains focused primarily on the economy but added that "'we can do more than one thing at a time.'"

Obama appeared before Senate Democrats last week, where he received supportive questioning as moderates queasy over big deficits and rapidly rising debt held their tongues.

Meanwhile, debate started in the Senate on that chamber's response to the budget Obama submitted in February.

Obama's Capitol Hill allies have kept their budget blueprints close to Obama's despite being forced by worsening deficit projections to pare back some initiatives.

In the absence of key details on signature Obama proposals such as how to fulfill his promise to guarantee health care coverage or reduce U.S. emissions of heat-trapping gases, the nonbinding congressional budget plans track Obama's plans only generally in key respects.

Obama, according to notes taken by a second aide, said a vote for the budget is a necessary first step toward implementing his ambitious but politically difficult agenda.

"We will create a sense of momentum that will allow us to do health care reform and education" and other major initiatives, Obama said.

Debate on the Senate's budget plan opened Monday, with a vote expected Thursday night or Friday. On Thursday, the House is expected to approve its plan, which promises slightly higher spending and somewhat worse deficits.

House Speaker Nancy Pelosi, D-Calif., promised: "Yes we will pass a budget this week."

Under Congress' arcane budget legislative process, lawmakers devise a nonbinding budget resolution that sets the terms for subsequent legislation. As a practical matter, the most immediate impact is to provide a pot of money to the appropriations panels to fund Cabinet agencies' annual budgets.

Obama backs consumer incentives to boost auto sales

WASHINGTON (Reuters) - President Barack Obama ordered tough steps on Monday to restructure General Motors and Chrysler but he also offered incentives and other plans to boost sales and reassure consumers.
"We must also recognize that the difficulties facing this industry are due in no small part to the weakness in our economy," Obama said in announcing several steps to invigorate sales that are near 30-year lows.

Detroit and top overseas manufacturers are expected to report a severe decline in U.S. sales for March, continuing a trend that has accelerated this year as the recession deepened and consumer credit woes worsened.

Manufacturers have responded with zero percent financing, cash rebates, and deep discounts to lure consumers with little success.

The centerpiece Obama incentive is proposed legislation that would give consumers a voucher worth between $3,000 and $5,000 toward a new, fuel efficient car in exchange for a poorer performing older model.

The program, which was scuttled in Congress last year, has been credited with turning around sales in Germany and elsewhere in Europe. But the plan would cost billions and Obama and congressional supporters would have to find a way to fund it.

"Even the most dramatic of restructurings will only help the auto companies if more Americans decide to buy cars," said Sen. Charles Schumer, a New York Democrat and member of the Banking Committee.

"For Americans who have an inefficient clunker sitting in their driveway, our bill would provide a better trade-in offer than they could get from most car dealerships," Schumer said, hoping that Obama's endorsement will help the measure move quickly through Congress.

The Obama administration also is planning to accelerate the purchase of fuel efficient vehicles for the federal fleet using economic stimulus money, and further aid auto finance companies to stimulate lending.

Separately, Obama said the IRS, would immediately begin alerting consumers of a new program that allows consumers to deduct sales taxes when purchasing a new car.

To reassure consumers wary of purchasing a vehicle from a financially distressed company, Obama said the government

would underwrite warranties beginning on Monday.

"Let me say it as plainly as I can, if you buy a car from Chrysler or General Motors, you will be able to get your car serviced and repaired, just like always. Your warranty will be safe," Obama said.

(Reporting by John Crawley; editing by Carol Bishopric)

Minister urges Pakistan to unite

Pakistan's interior minister has urged the country to unite against insurgents after gunmen launched a deadly attack on a police academy in Lahore.
Rehman Malik said the country had a choice between letting the Taleban take over and uniting to fight them.
He also pointed the finger at other extremist groups, while suggesting that a foreign state may have been involved.
There was no immediate claim of responsibility for Monday's attack, which left at least 18 people dead.
Two civilians, eight policemen and eight militants were killed, and 95 people injured, during the eight-hour battle to wrest back control of the academy, according to the interior ministry.
It came less than a month after gunmen attacked the Sri Lankan cricket team in Lahore, killing six policemen.
Until this year, the city, Pakistan's cultural capital, had remained relatively free of post-9/11 militant violence.
But Pakistan's militants appear to be running riot, the BBC's Damian Grammaticas reports from Lahore.
Country 'destabilised'
Mr Malik said Pakistan's integrity was "in danger at this time".

Jill McGivering reports from outside the academy near Lahore
This was a well-organised attack that will raise concern about the sophistication of the group behind it.
Pakistan is facing a broad insurgency from groups linked to al-Qaeda, the Afghan Taleban and the Pakistani Taleban, as well as from religious extremists and criminals taking advantage of the situation.
It is unclear who was responsible for this attack, but its co-ordinated nature could point to one of the more international groups.

He told reporters in Lahore that the militants were believed to be fighters loyal to Pakistani Taleban leader Baitullah Mehsud who had come from the South Waziristan tribal region.
"The entire planning was done there," he said.
One of the attackers, he said, was an Afghan national.
The minister also suggested that a foreign country was interfering in Pakistan's domestic affairs.
"Some rival country, or some hostile [intelligence] agency is definitely out to destabilise our democratic forces," he said, in a possible reference to Pakistan's long-time foe, India.
Indian officials have condemned the attack on Lahore.
Mr Malik also told state-run TV that Pakistan's police were not equipped to fight the wave of militancy.
"In our country, at our different borders, arms are coming in, stinger missiles are coming in, rocket launchers are coming in, heavy equipment is coming - it should be stopped," he said.
"Whoever the anti-state elements are, they are destabilising the country."
Scene of carnage
Gunmen seized the Manawan police training school on the outskirts of Lahore during a morning drill on Monday.
MAJOR PAKISTAN ATTACKS
27 March 09: Suicide bomber demolishes crowded mosque near the north-western town of Jamrud, killing dozens
3 March 09: Six policemen and a driver killed, and several cricketers injured, in ambush on the Sri Lanka cricket team in central Lahore
20 Sept 08: 54 die in an attack on the Marriott hotel in Islamabad
6 Sept 08: Suicide car bombing kills 35 and wounds 80 at a police checkpoint in Peshawar
Aug 08: Twin suicide bombings at gates of a weapons factory in town of Wah leave 67 dead
March 08: Suicide bombs hit police headquarters and suburban house in Lahore, killing 24
Security forces used helicopter gunships against the compound as troops entered to confront the grenade-throwing militants.
Some of the militants are believed to have blown themselves up with suicide vests.
Our correspondent, who witnessed the aftermath, saw broken glass, bullet casings and pieces of human flesh scattered over the floor of the academy.
The attack came days after US President Barack Obama pledged to put Pakistan, along with Afghanistan, at the heart of his fight against al-Qaeda militants.
He said "al-Qaeda and its extremist allies" were "a cancer that risks killing Pakistan from within".
US officials have pledged to help Pakistan target so-called "safe havens" for militants in Pakistan's north-west tribal region bordering Afghanistan.

He told reporters in Lahore that the militants were believed to be fighters loyal to Pakistani Taleban leader Baitullah Mehsud who had come from the South Waziristan tribal region.
"The entire planning was done there," he said.
One of the attackers, he said, was an Afghan national.
The minister also suggested that a foreign country was interfering in Pakistan's domestic affairs.
"Some rival country, or some hostile [intelligence] agency is definitely out to destabilise our democratic forces," he said, in a possible reference to Pakistan's long-time foe, India.
Indian officials have condemned the attack on Lahore.
Mr Malik also told state-run TV that Pakistan's police were not equipped to fight the wave of militancy.
"In our country, at our different borders, arms are coming in, stinger missiles are coming in, rocket launchers are coming in, heavy equipment is coming - it should be stopped," he said.
"Whoever the anti-state elements are, they are destabilising the country."
Scene of carnage
Gunmen seized the Manawan police training school on the outskirts of Lahore during a morning drill on Monday.

Security forces used helicopter gunships against the compound as troops entered to confront the grenade-throwing militants.
Some of the militants are believed to have blown themselves up with suicide vests.
Our correspondent, who witnessed the aftermath, saw broken glass, bullet casings and pieces of human flesh scattered over the floor of the academy.
The attack came days after US President Barack Obama pledged to put Pakistan, along with Afghanistan, at the heart of his fight against al-Qaeda militants.
He said "al-Qaeda and its extremist allies" were "a cancer that risks killing Pakistan from within".
US officials have pledged to help Pakistan target so-called "safe havens" for militants in Pakistan's north-west tribal region bordering Afghanistan.