Shared posts

17 Nov 12:36

What ISIS Really Wants

by Graeme Wood
Islamic State fighters shown here in Syria have seen their ranks bolstered by an unprecedented inflow of foreign jihadists. (Medyan Dairieh/Zuma/Alamy)

What is the Islamic State?

Where did it come from, and what are its intentions? The simplicity of these questions can be deceiving, and few Western leaders seem to know the answers. In December, The New York Times published confidential comments by Major General Michael K. Nagata, the Special Operations commander for the United States in the Middle East, admitting that he had hardly begun figuring out the Islamic State’s appeal. “We have not defeated the idea,” he said. “We do not even understand the idea.” In the past year, President Obama has referred to the Islamic State, variously, as “not Islamic” and as al-Qaeda’s “jayvee team,” statements that reflected confusion about the group, and may have contributed to significant strategic errors.

The group seized Mosul, Iraq, last June, and already rules an area larger than the United Kingdom. Abu Bakr al-Baghdadi has been its leader since May 2010, but until last summer, his most recent known appearance on film was a grainy mug shot from a stay in U.S. captivity at Camp Bucca during the occupation of Iraq. Then, on July 5 of last year, he stepped into the pulpit of the Great Mosque of al-Nuri in Mosul, to deliver a Ramadan sermon as the first caliph in generations—upgrading his resolution from grainy to high-definition, and his position from hunted guerrilla to commander of all Muslims. The inflow of jihadists that followed, from around the world, was unprecedented in its pace and volume, and is continuing.

Our ignorance of the Islamic State is in some ways understandable: It is a hermit kingdom; few have gone there and returned. Baghdadi has spoken on camera only once. But his address, and the Islamic State’s countless other propaganda videos and encyclicals, are online, and the caliphate’s supporters have toiled mightily to make their project knowable. We can gather that their state rejects peace as a matter of principle; that it hungers for genocide; that its religious views make it constitutionally incapable of certain types of change, even if that change might ensure its survival; and that it considers itself a harbinger of—and headline player in—the imminent end of the world.

The Islamic State, also known as the Islamic State of Iraq and al-Sham (ISIS), follows a distinctive variety of Islam whose beliefs about the path to the Day of Judgment matter to its strategy, and can help the West know its enemy and predict its behavior. Its rise to power is less like the triumph of the Muslim Brotherhood in Egypt (a group whose leaders the Islamic State considers apostates) than like the realization of a dystopian alternate reality in which David Koresh or Jim Jones survived to wield absolute power over not just a few hundred people, but some 8 million.

We have misunderstood the nature of the Islamic State in at least two ways. First, we tend to see jihadism as monolithic, and to apply the logic of al‑Qaeda to an organization that has decisively eclipsed it. The Islamic State supporters I spoke with still refer to Osama bin Laden as “Sheikh Osama,” a title of honor. But jihadism has evolved since al-Qaeda’s heyday, from about 1998 to 2003, and many jihadists disdain the group’s priorities and current leadership.

Bin Laden viewed his terrorism as a prologue to a caliphate he did not expect to see in his lifetime. His organization was flexible, operating as a geographically diffuse network of autonomous cells. The Islamic State, by contrast, requires territory to remain legitimate, and a top-down structure to rule it. (Its bureaucracy is divided into civil and military arms, and its territory into provinces.)

We are misled in a second way, by a well-intentioned but dishonest campaign to deny the Islamic State’s medieval religious nature. Peter Bergen, who produced the first interview with bin Laden in 1997, titled his first book Holy War, Inc. in part to acknowledge bin Laden as a creature of the modern secular world. Bin Laden corporatized terror and franchised it out. He requested specific political concessions, such as the withdrawal of U.S. forces from Saudi Arabia. His foot soldiers navigated the modern world confidently. On Mohamd Atta’s last full day of life, he shopped at Walmart and ate dinner at Pizza Hut.

Nearly all the Islamic State’s decisions adhere to what it calls, on its billboards, license plates, and coins, “the Prophetic methodology.”

There is a temptation to rehearse this observation—that jihadists are modern secular people, with modern political concerns, wearing medieval religious disguise—and make it fit the Islamic State. In fact, much of what the group does looks nonsensical except in light of a sincere, carefully considered commitment to returning civilization to a seventh-century legal environment, and ultimately to bringing about the apocalypse.

The most-articulate spokesmen for that position are the Islamic State’s officials and supporters themselves. They refer derisively to “moderns.” In conversation, they insist that they will not—cannot—waver from governing precepts that were embedded in Islam by the Prophet Muhammad and his earliest followers. They often speak in codes and allusions that sound odd or old-fashioned to non-Muslims, but refer to specific traditions and texts of early Islam.

To take one example: In September, Sheikh Abu Muhammad al-Adnani, the Islamic State’s chief spokesman, called on Muslims in Western countries such as France and Canada to find an infidel and “smash his head with a rock,” poison him, run him over with a car, or “destroy his crops.” To Western ears, the biblical-sounding punishments—the stoning and crop destruction—juxtaposed strangely with his more modern-sounding call to vehicular homicide. (As if to show that he could terrorize by imagery alone, Adnani also referred to Secretary of State John Kerry as an “uncircumcised geezer.”)

But Adnani was not merely talking trash. His speech was laced with theological and legal discussion, and his exhortation to attack crops directly echoed orders from Muhammad to leave well water and crops alone—unless the armies of Islam were in a defensive position, in which case Muslims in the lands of kuffar, or infidels, should be unmerciful, and poison away.

The reality is that the Islamic State is Islamic. Very Islamic. Yes, it has attracted psychopaths and adventure seekers, drawn largely from the disaffected populations of the Middle East and Europe. But the religion preached by its most ardent followers derives from coherent and even learned interpretations of Islam.

Virtually every major decision and law promulgated by the Islamic State adheres to what it calls, in its press and pronouncements, and on its billboards, license plates, stationery, and coins, “the Prophetic methodology,” which means following the prophecy and example of Muhammad, in punctilious detail. Muslims can reject the Islamic State; nearly all do. But pretending that it isn’t actually a religious, millenarian group, with theology that must be understood to be combatted, has already led the United States to underestimate it and back foolish schemes to counter it. We’ll need to get acquainted with the Islamic State’s intellectual genealogy if we are to react in a way that will not strengthen it, but instead help it self-immolate in its own excessive zeal.

Control of territory is an essential precondition for the Islamic State’s authority in the eyes of its supporters. This map, adapted from the work of the Institute for the Study of War, shows the territory under the caliphate’s control as of January 15, along with areas it has attacked. Where it holds power, the state collects taxes, regulates prices, operates courts, and administers services ranging from health care and education to telecommunications.

I. Devotion

In November, the Islamic State released an infomercial-like video tracing its origins to bin Laden. It acknowledged Abu Musa’b al Zarqawi, the brutal head of al‑Qaeda in Iraq from roughly 2003 until his killing in 2006, as a more immediate progenitor, followed sequentially by two other guerrilla leaders before Baghdadi, the caliph. Notably unmentioned: bin Laden’s successor, Ayman al Zawahiri, the owlish Egyptian eye surgeon who currently heads al‑Qaeda. Zawahiri has not pledged allegiance to Baghdadi, and he is increasingly hated by his fellow jihadists. His isolation is not helped by his lack of charisma; in videos he comes across as squinty and annoyed. But the split between al-Qaeda and the Islamic State has been long in the making, and begins to explain, at least in part, the outsize bloodlust of the latter.

Zawahiri’s companion in isolation is a Jordanian cleric named Abu Muhammad al Maqdisi, 55, who has a fair claim to being al-Qaeda’s intellectual architect and the most important jihadist unknown to the average American newspaper reader. On most matters of doctrine, Maqdisi and the Islamic State agree. Both are closely identified with the jihadist wing of a branch of Sunnism called Salafism, after the Arabic al salaf al salih, the “pious forefathers.” These forefathers are the Prophet himself and his earliest adherents, whom Salafis honor and emulate as the models for all behavior, including warfare, couture, family life, even dentistry.

The Islamic State awaits the army of “Rome,” whose defeat at Dabiq, Syria, will initiate the countdown to the apocalypse.

Maqdisi taught Zarqawi, who went to war in Iraq with the older man’s advice in mind. In time, though, Zarqawi surpassed his mentor in fanaticism, and eventually earned his rebuke. At issue was Zarqawi’s penchant for bloody spectacle—and, as a matter of doctrine, his hatred of other Muslims, to the point of excommunicating and killing them. In Islam, the practice of takfir, or excommunication, is theologically perilous. “If a man says to his brother, ‘You are an infidel,’ ” the Prophet said, “then one of them is right.” If the accuser is wrong, he himself has committed apostasy by making a false accusation. The punishment for apostasy is death. And yet Zarqawi heedlessly expanded the range of behavior that could make Muslims infidels.

Maqdisi wrote to his former pupil that he needed to exercise caution and “not issue sweeping proclamations of takfir” or “proclaim people to be apostates because of their sins.” The distinction between apostate and sinner may appear subtle, but it is a key point of contention between al-Qaeda and the Islamic State.

Denying the holiness of the Koran or the prophecies of Muhammad is straightforward apostasy. But Zarqawi and the state he spawned take the position that many other acts can remove a Muslim from Islam. These include, in certain cases, selling alcohol or drugs, wearing Western clothes or shaving one’s beard, voting in an election—even for a Muslim candidate—and being lax about calling other people apostates. Being a Shiite, as most Iraqi Arabs are, meets the standard as well, because the Islamic State regards Shiism as innovation, and to innovate on the Koran is to deny its initial perfection. (The Islamic State claims that common Shiite practices, such as worship at the graves of imams and public self-flagellation, have no basis in the Koran or in the example of the Prophet.) That means roughly 200 million Shia are marked for death. So too are the heads of state of every Muslim country, who have elevated man-made law above Sharia by running for office or enforcing laws not made by God.

Following takfiri doctrine, the Islamic State is committed to purifying the world by killing vast numbers of people. The lack of objective reporting from its territory makes the true extent of the slaughter unknowable, but social-media posts from the region suggest that individual executions happen more or less continually, and mass executions every few weeks. Muslim “apostates” are the most common victims. Exempted from automatic execution, it appears, are Christians who do not resist their new government. Baghdadi permits them to live, as long as they pay a special tax, known as the jizya, and acknowledge their subjugation. The Koranic authority for this practice is not in dispute.

Musa Cerantonio, an Australian preacher reported to be one of the Islamic State’s most influential recruiters, believes it is foretold that the caliphate will sack Istanbul before it is beaten back by an army led by the anti-Messiah, whose eventual death— when just a few thousand jihadists remain—will usher in the apocalypse. (Paul Jeffers/Fairfax Media)

Centuries have passed since the wars of religion ceased in Europe, and since men stopped dying in large numbers because of arcane theological disputes. Hence, perhaps, the incredulity and denial with which Westerners have greeted news of the theology and practices of the Islamic State. Many refuse to believe that this group is as devout as it claims to be, or as backward-looking or apocalyptic as its actions and statements suggest.

Their skepticism is comprehensible. In the past, Westerners who accused Muslims of blindly following ancient scriptures came to deserved grief from academics—notably the late Edward Said—who pointed out that calling Muslims “ancient” was usually just another way to denigrate them. Look instead, these scholars urged, to the conditions in which these ideologies arose—the bad governance, the shifting social mores, the humiliation of living in lands valued only for their oil.

Without acknowledgment of these factors, no explanation of the rise of the Islamic State could be complete. But focusing on them to the exclusion of ideology reflects another kind of Western bias: that if religious ideology doesn’t matter much in Washington or Berlin, surely it must be equally irrelevant in Raqqa or Mosul. When a masked executioner says Allahu akbar while beheading an apostate, sometimes he’s doing so for religious reasons.

Many mainstream Muslim organizations have gone so far as to say the Islamic State is, in fact, un-Islamic. It is, of course, reassuring to know that the vast majority of Muslims have zero interest in replacing Hollywood movies with public executions as evening entertainment. But Muslims who call the Islamic State un-Islamic are typically, as the Princeton scholar Bernard Haykel, the leading expert on the group’s theology, told me, “embarrassed and politically correct, with a cotton-candy view of their own religion” that neglects “what their religion has historically and legally required.” Many denials of the Islamic State’s religious nature, he said, are rooted in an “interfaith-Christian-nonsense tradition.”

Every academic I asked about the Islamic State’s ideology sent me to Haykel. Of partial Lebanese descent, Haykel grew up in Lebanon and the United States, and when he talks through his Mephistophelian goatee, there is a hint of an unplaceable foreign accent.

According to Haykel, the ranks of the Islamic State are deeply infused with religious vigor. Koranic quotations are ubiquitous. “Even the foot soldiers spout this stuff constantly,” Haykel said. “They mug for their cameras and repeat their basic doctrines in formulaic fashion, and they do it all the time.” He regards the claim that the Islamic State has distorted the texts of Islam as preposterous, sustainable only through willful ignorance. “People want to absolve Islam,” he said. “It’s this ‘Islam is a religion of peace’ mantra. As if there is such a thing as ‘Islam’! It’s what Muslims do, and how they interpret their texts.” Those texts are shared by all Sunni Muslims, not just the Islamic State. “And these guys have just as much legitimacy as anyone else.”

All Muslims acknowledge that Muhammad’s earliest conquests were not tidy affairs, and that the laws of war passed down in the Koran and in the narrations of the Prophet’s rule were calibrated to fit a turbulent and violent time. In Haykel’s estimation, the fighters of the Islamic State are authentic throwbacks to early Islam and are faithfully reproducing its norms of war. This behavior includes a number of practices that modern Muslims tend to prefer not to acknowledge as integral to their sacred texts. “Slavery, crucifixion, and beheadings are not something that freakish [jihadists] are cherry-picking from the medieval tradition,” Haykel said. Islamic State fighters “are smack in the middle of the medieval tradition and are bringing it wholesale into the present day.”

The Koran specifies crucifixion as one of the only punishments permitted for enemies of Islam. The tax on Christians finds clear endorsement in the Surah Al-Tawba, the Koran’s ninth chapter, which instructs Muslims to fight Christians and Jews “until they pay the jizya with willing submission, and feel themselves subdued.” The Prophet, whom all Muslims consider exemplary, imposed these rules and owned slaves.

Leaders of the Islamic State have taken emulation of Muhammad as strict duty, and have revived traditions that have been dormant for hundreds of years. “What’s striking about them is not just the literalism, but also the seriousness with which they read these texts,” Haykel said. “There is an assiduous, obsessive seriousness that Muslims don’t normally have.”

Before the rise of the Islamic State, no group in the past few centuries had attempted more-radical fidelity to the Prophetic model than the Wahhabis of 18th‑century Arabia. They conquered most of what is now Saudi Arabia, and their strict practices survive in a diluted version of Sharia there. Haykel sees an important distinction between the groups, though: “The Wahhabis were not wanton in their violence.” They were surrounded by Muslims, and they conquered lands that were already Islamic; this stayed their hand. “ISIS, by contrast, is really reliving the early period.” Early Muslims were surrounded by non-Muslims, and the Islamic State, because of its takfiri tendencies, considers itself to be in the same situation.

If al-Qaeda wanted to revive slavery, it never said so. And why would it? Silence on slavery probably reflected strategic thinking, with public sympathies in mind: when the Islamic State began enslaving people, even some of its supporters balked. Nonetheless, the caliphate has continued to embrace slavery and crucifixion without apology. “We will conquer your Rome, break your crosses, and enslave your women,” Adnani, the spokesman, promised in one of his periodic valentines to the West. “If we do not reach that time, then our children and grandchildren will reach it, and they will sell your sons as slaves at the slave market.”

In October, Dabiq, the magazine of the Islamic State, published “The Revival of Slavery Before the Hour,” an article that took up the question of whether Yazidis (the members of an ancient Kurdish sect that borrows elements of Islam, and had come under attack from Islamic State forces in northern Iraq) are lapsed Muslims, and therefore marked for death, or merely pagans and therefore fair game for enslavement. A study group of Islamic State scholars had convened, on government orders, to resolve this issue. If they are pagans, the article’s anonymous author wrote,

Yazidi women and children [are to be] divided according to the Shariah amongst the fighters of the Islamic State who participated in the Sinjar operations [in northern Iraq] … Enslaving the families of the kuffar [infidels] and taking their women as concubines is a firmly established aspect of the Shariah that if one were to deny or mock, he would be denying or mocking the verses of the Koran and the narrations of the Prophet … and thereby apostatizing from Islam.

II. Territory

Tens of thousands of foreign Muslims are thought to have immigrated to the Islamic State. Recruits hail from France, the United Kingdom, Belgium, Germany, Holland, Australia, Indonesia, the United States, and many other places. Many have come to fight, and many intend to die.

Peter R. Neumann, a professor at King’s College London, told me that online voices have been essential to spreading propaganda and ensuring that newcomers know what to believe. Online recruitment has also widened the demographics of the jihadist community, by allowing conservative Muslim women—physically isolated in their homes—to reach out to recruiters, radicalize, and arrange passage to Syria. Through its appeals to both genders, the Islamic State hopes to build a complete society.

In November, I traveled to Australia to meet Musa Cerantonio, a 30-year-old man whom Neumann and other researchers had identified as one of the two most important “new spiritual authorities” guiding foreigners to join the Islamic State. For three years he was a televangelist on Iqraa TV in Cairo, but he left after the station objected to his frequent calls to establish a caliphate. Now he preaches on Facebook and Twitter.

Cerantonio—a big, friendly man with a bookish demeanor—told me he blanches at beheading videos. He hates seeing the violence, even though supporters of the Islamic State are required to endorse it. (He speaks out, controversially among jihadists, against suicide bombing, on the grounds that God forbids suicide; he differs from the Islamic State on a few other points as well.) He has the kind of unkempt facial hair one sees on certain overgrown fans of The Lord of the Rings, and his obsession with Islamic apocalypticism felt familiar. He seemed to be living out a drama that looks, from an outsider’s perspective, like a medieval fantasy novel, only with real blood.

Last June, Cerantonio and his wife tried to emigrate—he wouldn’t say to where (“It’s illegal to go to Syria,” he said cagily)—but they were caught en route, in the Philippines, and he was deported back to Australia for overstaying his visa. Australia has criminalized attempts to join or travel to the Islamic State, and has confiscated Cerantonio’s passport. He is stuck in Melbourne, where he is well known to the local constabulary. If Cerantonio were caught facilitating the movement of individuals to the Islamic State, he would be imprisoned. So far, though, he is free—a technically unaffiliated ideologue who nonetheless speaks with what other jihadists have taken to be a reliable voice on matters of the Islamic State’s doctrine.

We met for lunch in Footscray, a dense, multicultural Melbourne suburb that’s home to Lonely Planet, the travel-guide publisher. Cerantonio grew up there in a half-Irish, half-Calabrian family. On a typical street one can find African restaurants, Vietnamese shops, and young Arabs walking around in the Salafi uniform of scraggly beard, long shirt, and trousers ending halfway down the calves.

Cerantonio explained the joy he felt when Baghdadi was declared the caliph on June 29—and the sudden, magnetic attraction that Mesopotamia began to exert on him and his friends. “I was in a hotel [in the Philippines], and I saw the declaration on television,” he told me. “And I was just amazed, and I’m like, Why am I stuck here in this bloody room?

The last caliphate was the Ottoman empire, which reached its peak in the 16th century and then experienced a long decline, until the founder of the Republic of Turkey, Mustafa Kemal Atatürk, euthanized it in 1924. But Cerantonio, like many supporters of the Islamic State, doesn’t acknowledge that caliphate as legitimate, because it didn’t fully enforce Islamic law, which requires stonings and slavery and amputations, and because its caliphs were not descended from the tribe of the Prophet, the Quraysh.

Baghdadi spoke at length of the importance of the caliphate in his Mosul sermon. He said that to revive the institution of the caliphate—which had not functioned except in name for about 1,000 years—was a communal obligation. He and his loyalists had “hastened to declare the caliphate and place an imam” at its head, he said. “This is a duty upon the Muslims—a duty that has been lost for centuries … The Muslims sin by losing it, and they must always seek to establish it.” Like bin Laden before him, Baghdadi spoke floridly, with frequent scriptural allusion and command of classical rhetoric. Unlike bin Laden, and unlike those false caliphs of the Ottoman empire, he is Qurayshi.

The caliphate, Cerantonio told me, is not just a political entity but also a vehicle for salvation. Islamic State propaganda regularly reports the pledges of baya’a (allegiance) rolling in from jihadist groups across the Muslim world. Cerantonio quoted a Prophetic saying, that to die without pledging allegiance is to die jahil (ignorant) and therefore die a “death of disbelief.” Consider how Muslims (or, for that matter, Christians) imagine God deals with the souls of people who die without learning about the one true religion. They are neither obviously saved nor definitively condemned. Similarly, Cerantonio said, the Muslim who acknowledges one omnipotent god and prays, but who dies without pledging himself to a valid caliph and incurring the obligations of that oath, has failed to live a fully Islamic life. I pointed out that this means the vast majority of Muslims in history, and all who passed away between 1924 and 2014, died a death of disbelief. Cerantonio nodded gravely. “I would go so far as to say that Islam has been reestablished” by the caliphate.

I asked him about his own baya’a, and he quickly corrected me: “I didn’t say that I’d pledged allegiance.” Under Australian law, he reminded me, giving baya’a to the Islamic State was illegal. “But I agree that [Baghdadi] fulfills the requirements,” he continued. “I’m just going to wink at you, and you take that to mean whatever you want.”

To be the caliph, one must meet conditions outlined in Sunni law—being a Muslim adult man of Quraysh descent; exhibiting moral probity and physical and mental integrity; and having ’amr, or authority. This last criterion, Cerantonio said, is the hardest to fulfill, and requires that the caliph have territory in which he can enforce Islamic law. Baghdadi’s Islamic State achieved that long before June 29, Cerantonio said, and as soon as it did, a Western convert within the group’s ranks—Cerantonio described him as “something of a leader”—began murmuring about the religious obligation to declare a caliphate. He and others spoke quietly to those in power and told them that further delay would be sinful.

Cerantonio said a faction arose that was prepared to make war on Baghdadi’s group if it delayed any further. They prepared a letter to various powerful members of ISIS, airing their displeasure at the failure to appoint a caliph, but were pacified by Adnani, the spokesman, who let them in on a secret—that a caliphate had already been declared, long before the public announcement. They had their legitimate caliph, and at that point there was only one option. “If he’s legitimate,” Cerantonio said, “you must give him the baya’a.”

After Baghdadi’s July sermon, a stream of jihadists began flowing daily into Syria with renewed motivation. Jürgen Todenhöfer, a German author and former politician who visited the Islamic State in December, reported the arrival of 100 fighters at one Turkish-border recruitment station in just two days. His report, among others, suggests a still-steady inflow of foreigners, ready to give up everything at home for a shot at paradise in the worst place on Earth.

Bernard Haykel, the foremost secular authority on the Islamic State’s ideology, believes the group is trying to re-create the earliest days of Islam and is faithfully reproducing its norms of war. “There is an assiduous, obsessive seriousness” about the group’s dedication to the text of the Koran, he says. (Peter Murphy)

In London, a week before my meal with Cerantonio, I met with three ex-members of a banned Islamist group called Al Muhajiroun (The Emigrants): Anjem Choudary, Abu Baraa, and Abdul Muhid. They all expressed desire to emigrate to the Islamic State, as many of their colleagues already had, but the authorities had confiscated their passports. Like Cerantonio, they regarded the caliphate as the only righteous government on Earth, though none would confess having pledged allegiance. Their principal goal in meeting me was to explain what the Islamic State stands for, and how its policies reflect God’s law.

Choudary, 48, is the group’s former leader. He frequently appears on cable news, as one of the few people producers can book who will defend the Islamic State vociferously, until his mike is cut. He has a reputation in the United Kingdom as a loathsome blowhard, but he and his disciples sincerely believe in the Islamic State and, on matters of doctrine, speak in its voice. Choudary and the others feature prominently in the Twitter feeds of Islamic State residents, and Abu Baraa maintains a YouTube channel to answer questions about Sharia.

Since September, authorities have been investigating the three men on suspicion of supporting terrorism. Because of this investigation, they had to meet me separately: communication among them would have violated the terms of their bail. But speaking with them felt like speaking with the same person wearing different masks. Choudary met me in a candy shop in the East London suburb of Ilford. He was dressed smartly, in a crisp blue tunic reaching nearly to his ankles, and sipped a Red Bull while we talked.

Before the caliphate, “maybe 85 percent of the Sharia was absent from our lives,” Choudary told me. “These laws are in abeyance until we have khilafa”—a caliphate—“and now we have one.” Without a caliphate, for example, individual vigilantes are not obliged to amputate the hands of thieves they catch in the act. But create a caliphate, and this law, along with a huge body of other jurisprudence, suddenly awakens. In theory, all Muslims are obliged to immigrate to the territory where the caliph is applying these laws. One of Choudary’s prize students, a convert from Hinduism named Abu Rumaysah, evaded police to bring his family of five from London to Syria in November. On the day I met Choudary, Abu Rumaysah tweeted out a picture of himself with a Kalashnikov in one arm and his newborn son in the other. Hashtag: #GenerationKhilafah.

The caliph is required to implement Sharia. Any deviation will compel those who have pledged allegiance to inform the caliph in private of his error and, in extreme cases, to excommunicate and replace him if he persists. (“I have been plagued with this great matter, plagued with this responsibility, and it is a heavy responsibility,” Baghdadi said in his sermon.) In return, the caliph commands obedience—and those who persist in supporting non-Muslim governments, after being duly warned and educated about their sin, are considered apostates.

Choudary said Sharia has been misunderstood because of its incomplete application by regimes such as Saudi Arabia, which does behead murderers and cut off thieves’ hands. “The problem,” he explained, “is that when places like Saudi Arabia just implement the penal code, and don’t provide the social and economic justice of the Sharia—the whole package—they simply engender hatred toward the Sharia.” That whole package, he said, would include free housing, food, and clothing for all, though of course anyone who wished to enrich himself with work could do so.

Abdul Muhid, 32, continued along these lines. He was dressed in mujahideen chic when I met him at a local restaurant: scruffy beard, Afghan cap, and a wallet outside of his clothes, attached with what looked like a shoulder holster. When we sat down, he was eager to discuss welfare. The Islamic State may have medieval-style punishments for moral crimes (lashes for boozing or fornication, stoning for adultery), but its social-welfare program is, at least in some aspects, progressive to a degree that would please an MSNBC pundit. Health care, he said, is free. (“Isn’t it free in Britain, too?,” I asked. “Not really,” he said. “Some procedures aren’t covered, such as vision.”) This provision of social welfare was not, he said, a policy choice of the Islamic State, but a policy obligation inherent in God’s law.

Anjem Choudary, London’s most notorious defender of the Islamic State, says crucifixion and beheading are sacred requirements. (Tal Cohen/Reuters)

III. The Apocalypse

All Muslims acknowledge that God is the only one who knows the future. But they also agree that he has offered us a peek at it, in the Koran and in narrations of the Prophet. The Islamic State differs from nearly every other current jihadist movement in believing that it is written into God’s script as a central character. It is in this casting that the Islamic State is most boldly distinctive from its predecessors, and clearest in the religious nature of its mission.

In broad strokes, al-Qaeda acts like an underground political movement, with worldly goals in sight at all times—the expulsion of non-Muslims from the Arabian peninsula, the abolishment of the state of Israel, the end of support for dictatorships in Muslim lands. The Islamic State has its share of worldly concerns (including, in the places it controls, collecting garbage and keeping the water running), but the End of Days is a leitmotif of its propaganda. Bin Laden rarely mentioned the apocalypse, and when he did, he seemed to presume that he would be long dead when the glorious moment of divine comeuppance finally arrived. “Bin Laden and Zawahiri are from elite Sunni families who look down on this kind of speculation and think it’s something the masses engage in,” says Will McCants of the Brookings Institution, who is writing a book about the Islamic State’s apocalyptic thought.

During the last years of the U.S. occupation of Iraq, the Islamic State’s immediate founding fathers, by contrast, saw signs of the end times everywhere. They were anticipating, within a year, the arrival of the Mahdi—a messianic figure destined to lead the Muslims to victory before the end of the world. McCants says a prominent Islamist in Iraq approached bin Laden in 2008 to warn him that the group was being led by millenarians who were “talking all the time about the Mahdi and making strategic decisions” based on when they thought the Mahdi was going to arrive. “Al-Qaeda had to write to [these leaders] to say ‘Cut it out.’ ”

For certain true believers—the kind who long for epic good-versus-evil battles—visions of apocalyptic bloodbaths fulfill a deep psychological need. Of the Islamic State supporters I met, Musa Cerantonio, the Australian, expressed the deepest interest in the apocalypse and how the remaining days of the Islamic State—and the world—might look. Parts of that prediction are original to him, and do not yet have the status of doctrine. But other parts are based on mainstream Sunni sources and appear all over the Islamic State’s propaganda. These include the belief that there will be only 12 legitimate caliphs, and Baghdadi is the eighth; that the armies of Rome will mass to meet the armies of Islam in northern Syria; and that Islam’s final showdown with an anti-Messiah will occur in Jerusalem after a period of renewed Islamic conquest.

The Islamic State has attached great importance to the Syrian city of Dabiq, near Aleppo. It named its propaganda magazine after the town, and celebrated madly when (at great cost) it conquered Dabiq’s strategically unimportant plains. It is here, the Prophet reportedly said, that the armies of Rome will set up their camp. The armies of Islam will meet them, and Dabiq will be Rome’s Waterloo or its Antietam.

“Dabiq is basically all farmland,” one Islamic State supporter recently tweeted. “You could imagine large battles taking place there.” The Islamic State’s propagandists drool with anticipation of this event, and constantly imply that it will come soon. The state’s magazine quotes Zarqawi as saying, “The spark has been lit here in Iraq, and its heat will continue to intensify … until it burns the crusader armies in Dabiq.” A recent propaganda video shows clips from Hollywood war movies set in medieval times—perhaps because many of the prophecies specify that the armies will be on horseback or carrying ancient weapons.

Now that it has taken Dabiq, the Islamic State awaits the arrival of an enemy army there, whose defeat will initiate the countdown to the apocalypse. Western media frequently miss references to Dabiq in the Islamic State’s videos, and focus instead on lurid scenes of beheading. “Here we are, burying the first American crusader in Dabiq, eagerly waiting for the remainder of your armies to arrive,” said a masked executioner in a November video, showing the severed head of Peter (Abdul Rahman) Kassig, the aid worker who’d been held captive for more than a year. During fighting in Iraq in December, after mujahideen (perhaps inaccurately) reported having seen American soldiers in battle, Islamic State Twitter accounts erupted in spasms of pleasure, like overenthusiastic hosts or hostesses upon the arrival of the first guests at a party.

The Prophetic narration that foretells the Dabiq battle refers to the enemy as Rome. Who “Rome” is, now that the pope has no army, remains a matter of debate. But Cerantonio makes a case that Rome meant the Eastern Roman empire, which had its capital in what is now Istanbul. We should think of Rome as the Republic of Turkey—the same republic that ended the last self-identified caliphate, 90 years ago. Other Islamic State sources suggest that Rome might mean any infidel army, and the Americans will do nicely.

After its battle in Dabiq, Cerantonio said, the caliphate will expand and sack Istanbul. Some believe it will then cover the entire Earth, but Cerantonio suggested its tide may never reach beyond the Bosporus. An anti-Messiah, known in Muslim apocalyptic literature as Dajjal, will come from the Khorasan region of eastern Iran and kill a vast number of the caliphate’s fighters, until just 5,000 remain, cornered in Jerusalem. Just as Dajjal prepares to finish them off, Jesus—the second-most-revered prophet in Islam—will return to Earth, spear Dajjal, and lead the Muslims to victory.

“Only God knows” whether the Islamic State’s armies are the ones foretold, Cerantonio said. But he is hopeful. “The Prophet said that one sign of the imminent arrival of the End of Days is that people will for a long while stop talking about the End of Days,” he said. “If you go to the mosques now, you’ll find the preachers are silent about this subject.” On this theory, even setbacks dealt to the Islamic State mean nothing, since God has preordained the near-destruction of his people anyway. The Islamic State has its best and worst days ahead of it.

Abu Bakr al-Baghdadi was declared caliph by his followers last summer. The establishment of a caliphate awakened large sections of Koranic law that had lain dormant, and required those Muslims who recognized the caliphate to immigrate. (Associated Press)

IV. The Fight

The ideological purity of the Islamic State has one compensating virtue: it allows us to predict some of the group’s actions. Osama bin Laden was seldom predictable. He ended his first television interview cryptically. CNN’s Peter Arnett asked him, “What are your future plans?” Bin Laden replied, “You’ll see them and hear about them in the media, God willing.” By contrast, the Islamic State boasts openly about its plans—not all of them, but enough so that by listening carefully, we can deduce how it intends to govern and expand.

In London, Choudary and his students provided detailed descriptions of how the Islamic State must conduct its foreign policy, now that it is a caliphate. It has already taken up what Islamic law refers to as “offensive jihad,” the forcible expansion into countries that are ruled by non-Muslims. “Hitherto, we were just defending ourselves,” Choudary said; without a caliphate, offensive jihad is an inapplicable concept. But the waging of war to expand the caliphate is an essential duty of the caliph.

Choudary took pains to present the laws of war under which the Islamic State operates as policies of mercy rather than of brutality. He told me the state has an obligation to terrorize its enemies—a holy order to scare the shit out of them with beheadings and crucifixions and enslavement of women and children, because doing so hastens victory and avoids prolonged conflict.

Choudary’s colleague Abu Baraa explained that Islamic law permits only temporary peace treaties, lasting no longer than a decade. Similarly, accepting any border is anathema, as stated by the Prophet and echoed in the Islamic State’s propaganda videos. If the caliph consents to a longer-term peace or permanent border, he will be in error. Temporary peace treaties are renewable, but may not be applied to all enemies at once: the caliph must wage jihad at least once a year. He may not rest, or he will fall into a state of sin.

One comparison to the Islamic State is the Khmer Rouge, which killed about a third of the population of Cambodia. But the Khmer Rouge occupied Cambodia’s seat at the United Nations. “This is not permitted,” Abu Baraa said. “To send an ambassador to the UN is to recognize an authority other than God’s.” This form of diplomacy is shirk, or polytheism, he argued, and would be immediate cause to hereticize and replace Baghdadi. Even to hasten the arrival of a caliphate by democratic means—for example by voting for political candidates who favor a caliphate—is shirk.

It’s hard to overstate how hamstrung the Islamic State will be by its radicalism. The modern international system, born of the 1648 Peace of Westphalia, relies on each state’s willingness to recognize borders, however grudgingly. For the Islamic State, that recognition is ideological suicide. Other Islamist groups, such as the Muslim Brotherhood and Hamas, have succumbed to the blandishments of democracy and the potential for an invitation to the community of nations, complete with a UN seat. Negotiation and accommodation have worked, at times, for the Taliban as well. (Under Taliban rule, Afghanistan exchanged ambassadors with Saudi Arabia, Pakistan, and the United Arab Emirates, an act that invalidated the Taliban’s authority in the Islamic State’s eyes.) To the Islamic State these are not options, but acts of apostasy.

The United States and its allies have reacted to the Islamic State belatedly and in an apparent daze. The group’s ambitions and rough strategic blueprints were evident in its pronouncements and in social-media chatter as far back as 2011, when it was just one of many terrorist groups in Syria and Iraq and hadn’t yet committed mass atrocities. Adnani, the spokesman, told followers then that the group’s ambition was to “restore the Islamic caliphate,” and he evoked the apocalypse, saying, “There are but a few days left.” Baghdadi had already styled himself “commander of the faithful,” a title ordinarily reserved for caliphs, in 2011. In April 2013, Adnani declared the movement “ready to redraw the world upon the Prophetic methodology of the caliphate.” In August 2013, he said, “Our goal is to establish an Islamic state that doesn’t recognize borders, on the Prophetic methodology.” By then, the group had taken Raqqa, a Syrian provincial capital of perhaps 500,000 people, and was drawing in substantial numbers of foreign fighters who’d heard its message.

If we had identified the Islamic State’s intentions early, and realized that the vacuum in Syria and Iraq would give it ample space to carry them out, we might, at a minimum, have pushed Iraq to harden its border with Syria and preemptively make deals with its Sunnis. That would at least have avoided the electrifying propaganda effect created by the declaration of a caliphate just after the conquest of Iraq’s third-largest city. Yet, just over a year ago, Obama told The New Yorker that he considered ISIS to be al-Qaeda’s weaker partner. “If a jayvee team puts on Lakers uniforms that doesn’t make them Kobe Bryant,” the president said.

Our failure to appreciate the split between the Islamic State and al-Qaeda, and the essential differences between the two, has led to dangerous decisions. Last fall, to take one example, the U.S. government consented to a desperate plan to save Peter Kassig’s life. The plan facilitated—indeed, required—the interaction of some of the founding figures of the Islamic State and al-Qaeda, and could hardly have looked more hastily improvised.

It entailed the enlistment of Abu Muhammad al Maqdisi, the Zarqawi mentor and al-Qaeda grandee, to approach Turki al-Binali, the Islamic State’s chief ideologue and a former student of Maqdisi’s, even though the two men had fallen out due to Maqdisi’s criticism of the Islamic State. Maqdisi had already called for the state to extend mercy to Alan Henning, the British cabbie who had entered Syria to deliver aid to children. In December, The Guardian reported that the U.S. government, through an intermediary, had asked Maqdisi to intercede with the Islamic State on Kassig’s behalf.

Maqdisi was living freely in Jordan, but had been banned from communicating with terrorists abroad, and was being monitored closely. After Jordan granted the United States permission to reintroduce Maqdisi to Binali, Maqdisi bought a phone with American money and was allowed to correspond merrily with his former student for a few days, before the Jordanian government stopped the chats and used them as a pretext to jail Maqdisi. Kassig’s severed head appeared in the Dabiq video a few days later.

Maqdisi gets mocked roundly on Twitter by the Islamic State’s fans, and al‑Qaeda is held in great contempt for refusing to acknowledge the caliphate. Cole Bunzel, a scholar who studies Islamic State ideology, read Maqdisi’s opinion on Henning’s status and thought it would hasten his and other captives’ death. “If I were held captive by the Islamic State and Maqdisi said I shouldn’t be killed,” he told me, “I’d kiss my ass goodbye.”

Kassig’s death was a tragedy, but the plan’s success would have been a bigger one. A reconciliation between Maqdisi and Binali would have begun to heal the main rift between the world’s two largest jihadist organizations. It’s possible that the government wanted only to draw out Binali for intelligence purposes or assassination. (Multiple attempts to elicit comment from the FBI were unsuccessful.) Regardless, the decision to play matchmaker for America’s two main terrorist antagonists reveals astonishingly poor judgment.

Chastened by our earlier indifference, we are now meeting the Islamic State via Kurdish and Iraqi proxy on the battlefield, and with regular air assaults. Those strategies haven’t dislodged the Islamic State from any of its major territorial possessions, although they’ve kept it from directly assaulting Baghdad and Erbil and slaughtering Shia and Kurds there.

Some observers have called for escalation, including several predictable voices from the interventionist right (Max Boot, Frederick Kagan), who have urged the deployment of tens of thousands of American soldiers. These calls should not be dismissed too quickly: an avowedly genocidal organization is on its potential victims’ front lawn, and it is committing daily atrocities in the territory it already controls.

One way to un-cast the Islamic State’s spell over its adherents would be to overpower it militarily and occupy the parts of Syria and Iraq now under caliphate rule. Al‑Qaeda is ineradicable because it can survive, cockroach-like, by going underground. The Islamic State cannot. If it loses its grip on its territory in Syria and Iraq, it will cease to be a caliphate. Caliphates cannot exist as underground movements, because territorial authority is a requirement: take away its command of territory, and all those oaths of allegiance are no longer binding. Former pledges could of course continue to attack the West and behead their enemies, as freelancers. But the propaganda value of the caliphate would disappear, and with it the supposed religious duty to immigrate and serve it. If the United States were to invade, the Islamic State’s obsession with battle at Dabiq suggests that it might send vast resources there, as if in a conventional battle. If the state musters at Dabiq in full force, only to be routed, it might never recover.

Abu Baraa, who maintains a YouTube channel about Islamic law, says the caliph, Baghdadi, cannot negotiate or recognize borders, and must continually make war, or he will remove himself from Islam.

And yet the risks of escalation are enormous. The biggest proponent of an American invasion is the Islamic State itself. The provocative videos, in which a black-hooded executioner addresses President Obama by name, are clearly made to draw America into the fight. An invasion would be a huge propaganda victory for jihadists worldwide: irrespective of whether they have given baya’a to the caliph, they all believe that the United States wants to embark on a modern-day Crusade and kill Muslims. Yet another invasion and occupation would confirm that suspicion, and bolster recruitment. Add the incompetence of our previous efforts as occupiers, and we have reason for reluctance. The rise of ISIS, after all, happened only because our previous occupation created space for Zarqawi and his followers. Who knows the consequences of another botched job?

Given everything we know about the Islamic State, continuing to slowly bleed it, through air strikes and proxy warfare, appears the best of bad military options. Neither the Kurds nor the Shia will ever subdue and control the whole Sunni heartland of Syria and Iraq—they are hated there, and have no appetite for such an adventure anyway. But they can keep the Islamic State from fulfilling its duty to expand. And with every month that it fails to expand, it resembles less the conquering state of the Prophet Muhammad than yet another Middle Eastern government failing to bring prosperity to its people.

The humanitarian cost of the Islamic State’s existence is high. But its threat to the United States is smaller than its all too frequent conflation with al-Qaeda would suggest. Al-Qaeda’s core is rare among jihadist groups for its focus on the “far enemy” (the West); most jihadist groups’ main concerns lie closer to home. That’s especially true of the Islamic State, precisely because of its ideology. It sees enemies everywhere around it, and while its leadership wishes ill on the United States, the application of Sharia in the caliphate and the expansion to contiguous lands are paramount. Baghdadi has said as much directly: in November he told his Saudi agents to “deal with the rafida [Shia] first … then al-Sulul [Sunni supporters of the Saudi monarchy] … before the crusaders and their bases.”

The foreign fighters (and their wives and children) have been traveling to the caliphate on one-way tickets: they want to live under true Sharia, and many want martyrdom. Doctrine, recall, requires believers to reside in the caliphate if it is at all possible for them to do so. One of the Islamic State’s less bloody videos shows a group of jihadists burning their French, British, and Australian passports. This would be an eccentric act for someone intending to return to blow himself up in line at the Louvre or to hold another chocolate shop hostage in Sydney.

A few “lone wolf” supporters of the Islamic State have attacked Western targets, and more attacks will come. But most of the attackers have been frustrated amateurs, unable to immigrate to the caliphate because of confiscated passports or other problems. Even if the Islamic State cheers these attacks—and it does in its propaganda—it hasn’t yet planned and financed one. (The Charlie Hebdo attack in Paris in January was principally an al‑Qaeda operation.) During his visit to Mosul in December, Jürgen Todenhöfer interviewed a portly German jihadist and asked whether any of his comrades had returned to Europe to carry out attacks. The jihadist seemed to regard returnees not as soldiers but as dropouts. “The fact is that the returnees from the Islamic State should repent from their return,” he said. “I hope they review their religion.”

Properly contained, the Islamic State is likely to be its own undoing. No country is its ally, and its ideology ensures that this will remain the case. The land it controls, while expansive, is mostly uninhabited and poor. As it stagnates or slowly shrinks, its claim that it is the engine of God’s will and the agent of apocalypse will weaken, and fewer believers will arrive. And as more reports of misery within it leak out, radical Islamist movements elsewhere will be discredited: No one has tried harder to implement strict Sharia by violence. This is what it looks like.

Even so, the death of the Islamic State is unlikely to be quick, and things could still go badly wrong: if the Islamic State obtained the allegiance of al‑Qaeda—increasing, in one swoop, the unity of its base—it could wax into a worse foe than we’ve yet seen. The rift between the Islamic State and al-Qaeda has, if anything, grown in the past few months; the December issue of Dabiq featured a long account of an al‑Qaeda defector who described his old group as corrupt and ineffectual, and Zawahiri as a distant and unfit leader. But we should watch carefully for a rapprochement.

Without a catastrophe such as this, however, or perhaps the threat of the Islamic State’s storming Erbil, a vast ground invasion would certainly make the situation worse.

V. Dissuasion

It would be facile, even exculpatory, to call the problem of the Islamic State “a problem with Islam.” The religion allows many interpretations, and Islamic State supporters are morally on the hook for the one they choose. And yet simply denouncing the Islamic State as un-Islamic can be counterproductive, especially if those who hear the message have read the holy texts and seen the endorsement of many of the caliphate’s practices written plainly within them.

Muslims can say that slavery is not legitimate now, and that crucifixion is wrong at this historical juncture. Many say precisely this. But they cannot condemn slavery or crucifixion outright without contradicting the Koran and the example of the Prophet. “The only principled ground that the Islamic State’s opponents could take is to say that certain core texts and traditional teachings of Islam are no longer valid,” Bernard Haykel says. That really would be an act of apostasy.

The Islamic State’s ideology exerts powerful sway over a certain subset of the population. Life’s hypocrisies and inconsistencies vanish in its face. Musa Cerantonio and the Salafis I met in London are unstumpable: no question I posed left them stuttering. They lectured me garrulously and, if one accepts their premises, convincingly. To call them un-Islamic appears, to me, to invite them into an argument that they would win. If they had been froth-spewing maniacs, I might be able to predict that their movement would burn out as the psychopaths detonated themselves or became drone-splats, one by one. But these men spoke with an academic precision that put me in mind of a good graduate seminar. I even enjoyed their company, and that frightened me as much as anything else.

Non-muslims cannot tell Muslims how to practice their religion properly. But Muslims have long since begun this debate within their own ranks. “You have to have standards,” Anjem Choudary told me. “Somebody could claim to be a Muslim, but if he believes in homosexuality or drinking alcohol, then he is not a Muslim. There is no such thing as a nonpracticing vegetarian.”

There is, however, another strand of Islam that offers a hard-line alternative to the Islamic State—just as uncompromising, but with opposite conclusions. This strand has proved appealing to many Muslims cursed or blessed with a psychological longing to see every jot and tittle of the holy texts implemented as they were in the earliest days of Islam. Islamic State supporters know how to react to Muslims who ignore parts of the Koran: with takfir and ridicule. But they also know that some other Muslims read the Koran as assiduously as they do, and pose a real ideological threat.

Baghdadi is Salafi. The term Salafi has been villainized, in part because authentic villains have ridden into battle waving the Salafi banner. But most Salafis are not jihadists, and most adhere to sects that reject the Islamic State. They are, as Haykel notes, committed to expanding Dar al-Islam, the land of Islam, even, perhaps, with the implementation of monstrous practices such as slavery and amputation—but at some future point. Their first priority is personal purification and religious observance, and they believe anything that thwarts those goals—such as causing war or unrest that would disrupt lives and prayer and scholarship—is forbidden.

They live among us. Last fall, I visited the Philadelphia mosque of Breton Pocius, 28, a Salafi imam who goes by the name Abdullah. His mosque is on the border between the crime-ridden Northern Liberties neighborhood and a gentrifying area that one might call Dar al-Hipster; his beard allows him to pass in the latter zone almost unnoticed.

Pocius converted 15 years ago after a Polish Catholic upbringing in Chicago. Like Cerantonio, he talks like an old soul, exhibiting deep familiarity with ancient texts, and a commitment to them motivated by curiosity and scholarship, and by a conviction that they are the only way to escape hellfire. When I met him at a local coffee shop, he carried a work of Koranic scholarship in Arabic and a book for teaching himself Japanese. He was preparing a sermon on the obligations of fatherhood for the 150 or so worshipers in his Friday congregation.

Pocius said his main goal is to encourage a halal life for worshipers in his mosque. But the rise of the Islamic State has forced him to consider political questions that are usually very far from the minds of Salafis. “Most of what they’ll say about how to pray and how to dress is exactly what I’ll say in my masjid [mosque]. But when they get to questions about social upheaval, they sound like Che Guevara.”

When Baghdadi showed up, Pocius adopted the slogan “Not my khalifa.” “The times of the Prophet were a time of great bloodshed,” he told me, “and he knew that the worst possible condition for all people was chaos, especially within the umma [Muslim community].” Accordingly, Pocius said, the correct attitude for Salafis is not to sow discord by factionalizing and declaring fellow Muslims apostates.

Instead, Pocius—like a majority of Salafis—believes that Muslims should remove themselves from politics. These quietist Salafis, as they are known, agree with the Islamic State that God’s law is the only law, and they eschew practices like voting and the creation of political parties. But they interpret the Koran’s hatred of discord and chaos as requiring them to fall into line with just about any leader, including some manifestly sinful ones. “The Prophet said: as long as the ruler does not enter into clear kufr [disbelief], give him general obedience,” Pocius told me, and the classic “books of creed” all warn against causing social upheaval. Quietist Salafis are strictly forbidden from dividing Muslims from one another—for example, by mass excommunication. Living without baya’a, Pocius said, does indeed make one ignorant, or benighted. But baya’a need not mean direct allegiance to a caliph, and certainly not to Abu Bakr al‑Baghdadi. It can mean, more broadly, allegiance to a religious social contract and commitment to a society of Muslims, whether ruled by a caliph or not.

Quietist Salafis believe that Muslims should direct their energies toward perfecting their personal life, including prayer, ritual, and hygiene. Much in the same way ultra-Orthodox Jews debate whether it’s kosher to tear off squares of toilet paper on the Sabbath (does that count as “rending cloth”?), they spend an inordinate amount of time ensuring that their trousers are not too long, that their beards are trimmed in some areas and shaggy in others. Through this fastidious observance, they believe, God will favor them with strength and numbers, and perhaps a caliphate will arise. At that moment, Muslims will take vengeance and, yes, achieve glorious victory at Dabiq. But Pocius cites a slew of modern Salafi theologians who argue that a caliphate cannot come into being in a righteous way except through the unmistakable will of God.

The Islamic State, of course, would agree, and say that God has anointed Baghdadi. Pocius’s retort amounts to a call to humility. He cites Abdullah Ibn Abbas, one of the Prophet’s companions, who sat down with dissenters and asked them how they had the gall, as a minority, to tell the majority that it was wrong. Dissent itself, to the point of bloodshed or splitting the umma, was forbidden. Even the manner of the establishment of Baghdadi’s caliphate runs contrary to expectation, he said. “The khilafa is something that Allah is going to establish,” he told me, “and it will involve a consensus of scholars from Mecca and Medina. That is not what happened. ISIS came out of nowhere.”

The Islamic State loathes this talk, and its fanboys tweet derisively about quietist Salafis. They mock them as “Salafis of menstruation,” for their obscure judgments about when women are and aren’t clean, and other low-priority aspects of life. “What we need now is fatwa about how it’s haram [forbidden] to ride a bike on Jupiter,” one tweeted drily. “That’s what scholars should focus on. More pressing than state of Ummah.” Anjem Choudary, for his part, says that no sin merits more vigorous opposition than the usurpation of God’s law, and that extremism in defense of monotheism is no vice.

Pocius doesn’t court any kind of official support from the United States, as a counterweight to jihadism. Indeed, official support would tend to discredit him, and in any case he is bitter toward America for treating him, in his words, as “less than a citizen.” (He alleges that the government paid spies to infiltrate his mosque and harassed his mother at work with questions about his being a potential terrorist.)

Still, his quietist Salafism offers an Islamic antidote to Baghdadi-style jihadism. The people who arrive at the faith spoiling for a fight cannot all be stopped from jihadism, but those whose main motivation is to find an ultraconservative, uncompromising version of Islam have an alternative here. It is not moderate Islam; most Muslims would consider it extreme. It is, however, a form of Islam that the literal-minded would not instantly find hypocritical, or blasphemously purged of its inconveniences. Hypocrisy is not a sin that ideologically minded young men tolerate well.

Western officials would probably do best to refrain from weighing in on matters of Islamic theological debate altogether. Barack Obama himself drifted into takfiri waters when he claimed that the Islamic State was “not Islamic”—the irony being that he, as the non-Muslim son of a Muslim, may himself be classified as an apostate, and yet is now practicing takfir against Muslims. Non-Muslims’ practicing takfir elicits chuckles from jihadists (“Like a pig covered in feces giving hygiene advice to others,” one tweeted).

I suspect that most Muslims appreciated Obama’s sentiment: the president was standing with them against both Baghdadi and non-Muslim chauvinists trying to implicate them in crimes. But most Muslims aren’t susceptible to joining jihad. The ones who are susceptible will only have had their suspicions confirmed: the United States lies about religion to serve its purposes.

Within the narrow bounds of its theology, the Islamic State hums with energy, even creativity. Outside those bounds, it could hardly be more arid and silent: a vision of life as obedience, order, and destiny. Musa Cerantonio and Anjem Choudary could mentally shift from contemplating mass death and eternal torture to discussing the virtues of Vietnamese coffee or treacly pastry, with apparent delight in each, yet to me it seemed that to embrace their views would be to see all the flavors of this world grow insipid compared with the vivid grotesqueries of the hereafter.

I could enjoy their company, as a guilty intellectual exercise, up to a point. In reviewing Mein Kampf in March 1940, George Orwell confessed that he had “never been able to dislike Hitler”; something about the man projected an underdog quality, even when his goals were cowardly or loathsome. “If he were killing a mouse he would know how to make it seem like a dragon.” The Islamic State’s partisans have much the same allure. They believe that they are personally involved in struggles beyond their own lives, and that merely to be swept up in the drama, on the side of righteousness, is a privilege and a pleasure—especially when it is also a burden.

Fascism, Orwell continued, is

psychologically far sounder than any hedonistic conception of life … Whereas Socialism, and even capitalism in a more grudging way, have said to people “I offer you a good time,” Hitler has said to them, “I offer you struggle, danger, and death,” and as a result a whole nation flings itself at his feet … We ought not to underrate its emotional appeal.

Nor, in the case of the Islamic State, its religious or intellectual appeal. That the Islamic State holds the imminent fulfillment of prophecy as a matter of dogma at least tells us the mettle of our opponent. It is ready to cheer its own near-obliteration, and to remain confident, even when surrounded, that it will receive divine succor if it stays true to the Prophetic model. Ideological tools may convince some potential converts that the group’s message is false, and military tools can limit its horrors. But for an organization as impervious to persuasion as the Islamic State, few measures short of these will matter, and the war may be a long one, even if it doesn’t last until the end of time.

This article was originally published at http://www.theatlantic.com/features/archive/2015/03/what-isis-really-wants/384980/








06 May 00:38

Flagpole

by xkcd

Flagpole

So, you're falling from a height above the tallest building in your town, and you don't have a parachute. But wait! Partway down the side of that skyscraper there's a flagpole sticking out, sans flag! You angle your descent and grab the pole just long enough to swing around so that when you let go you're now heading back up toward the sky. As gravity slows you and brings you to a halt, you reach the top of the skyscraper, where you reach out and pull yourself to safety. What's the likelihood this could happen?

Rex Ungericht

If you're like me, your first thought on hearing this question was, "That's ridiculous; there's no way that could work."

Your first thought is right. But just to be sure, let's take a closer look.

Grip strength depends on a lot of factors, like hand slickness and surface material. But for the moment, let's assume Rex's hands are able to grab the pole tightly. What happens to the rest of his body?

It's hard to find good numbers on how much force it takes to tear off a person's arm.[1]Which is probably a good thing, to be honest. There are threads on the question on MetaFilter and the Straight Dope message boards, and frequent discussion of the death of Robert-François Damiens,[2]Damiens was tortured to death for attempting to assassinate Louis XV, but a team of horses had trouble tearing him limb from limb. but not too much hard data.

For the record, there are lots of studies and lectures on the breaking strength of tendons, which tend to give values of around 50-150 MPa. That's stronger than skin (27 MPa) but weaker than bone (120 MPa). However, to figure out the overall strength of the arm, we need to tally up all the tendons, muscles, and tissues in the wrist, arm, and shoulder, their cross-sectional area, and figure out which parts would be put under strain in what order.

Instead, it might be easier to consider people who try to pull off this maneuver in real life: Gymnasts.

A gymnast on the uneven parallel bars pushes the human body to its limits while performing maneuvers very similar to Rex's flagpole stunt.[3]In some ways, at least. A 2009 study used 3D motion capture to measure the forces involved in an elite gymnast's routine. They found that the athlete's hands exerted a force of over 3 kN on the bar at the bottom of a swing. In other words, the gymnast was briefly supporting almost 700 lbs of weight.

Let's be generous and assume that Rex is even better than the elite gymnast in the study. (After all, the gymnast has to worry about long-term injury, while Rex's concerns are a lot more short-term). Suppose Rex's arms can handle a swing force of over 10 kN, three times more than the gymnast (and twice as much as these guys!). How will he do?

Let's see how much force Rex needs to withstand. The "tallest building in town" here in Boston is the 240-meter-tall Hancock Tower; if he jumped off the top, he'd be going nearly 100 mph by the time he was halfway down. At that speed, the force on his arms (speed squared over the radius of his turn[4]Which is effectively somewhere between 1 and 2 meters here.) would be around ... 100 kN.

Really, the numbers are just telling us what common sense told us from the start: You can't grab hold of something while going 100 mph, much less swing around it.

If you want get a more vivid intuitive sense of the forces involved, consider this: In 2006, GQ put baseball star Albert Pujols in a lab and measured his swing. They clocked the speed of his bat at 87 mph, similar to the speed of the flagpole relative to our falling person.

So if you want to pull off Rex's stunt, first go find Albert Pujols, have him swing his bat as hard as you can ... and try to grab it.

And remember: You're just trying to stop the momentum of a 31-ounce piece of wood. When you're falling past the flagpole, you're going to be catching your whole body, so it's going to be up to 100 times worse.

Good luck!

16 Mar 17:20

Ultron’s Ultimate Weakness [Comic]

by Geeks are Sexy
14 Mar 15:18

Entering the BIOS

by sharhalakis

by @just_hank_moody, andreibkn and necessaryaegis

10 Mar 02:04

The Story of Grace Hopper: Pioneering Computer Scientist [Comic]

by Geeks are Sexy

This is a fantastic comic by artist Pablo Stanley illustrating the story of pioneering computer scientist Grace Hopper (1906-1992,) also known as “Amazing Grace.”

grace
grace1
grace2
grace3

[Source: Stanley Color | Udemy]

The post The Story of Grace Hopper: Pioneering Computer Scientist [Comic] appeared first on Geeks are Sexy Technology News.

05 Mar 19:05

172. ISAAC ASIMOV: A lifetime of learning

by Gav

ASIMOV01

Isaac Asimov (1920-1992) was a writer, known for his contribution to science fiction (including The Three Laws of Robotics, I, Robot and the Foundation series) and his staggering work in other genres and non-fiction.

Asimov had a formal education in chemistry, earning his PhD and working as a chemist for the Navy during WWII. He taught biochemistry and later became a professor at the Boston Univeristy of Medicine, all while writing stories for fantasy magazines in his spare time. He finally left the University in 1958 to focus on writing. Asimov’s output was truly mind-blowing, writing over 500 (!!!) books and 90,000 letters. He said: “Writing is my only interest. Even speaking is an interruption.”

Asimov’s non-fiction books were mostly on astronomy, but his other titles covered general science, history, mathematics, physics, Shakespeare, the Bible and mythology. He was completely self-taught in these areas and was successful for being able to take difficult scientific concepts and make them entertaining for the general public. He said he could “read a dozen dull books and make one interesting book out of them.” To get some idea of how vast Asimov’s knowledge was, his books appear in nine of the ten Dewey Decimal Classes.

The quotes used in this comic are taken from a fantastic interview Asimov did in 1988 (which you can watch on YouTube). In it, Asimov predicts how in the near-future, personal computers will help anyone learn anything ‘that strikes their fancy’ in the privacy of their own home and at their own leisure. Of course, that prediction came true with the internet, and even though the technology from The Matrix isn’t available yet, where we could upload information directly into our brain and shout “I know kung-fu!”, it has never been easier to learn whatever you want, no matter how niche. Thanks to reader Jenny for sending me the quote and the Brain Pickings article that featured the interview.

RELATED COMICS: Carl Sagan Pale Blue Dot. Richard Dawkins The Lucky Ones. Albert Einstein A Human Being is Part of the Whole. Jack London I Would Rather be Ashes Than Dust.

– I admit not having read any of Asimov’s books. Where should I start? The Foundation series? His story Nightfall was voted the best short science fiction story of all-time, so maybe that?
– Asimov said that one of only two men he knew who was smarter than himself was his good friend Carl Sagan.

05 Mar 18:49

When you think you have it under control

by sharhalakis

by uaiHebert

05 Mar 01:11

How to respond about on-going outages

by sharhalakis
image

uaiHebert

24 Feb 14:57

Project handover

by sharhalakis
image

by uaiHebert

22 Feb 17:34

New Tattoo Removal Cream Exploits Immune System

by JLister

falkenham

A university researcher says he’s developing a tattoo removal cream that could remove tattoos cheaply and without pain.

A tattoo doesn’t work simply by burying ink deep enough  (in the dermis) that it remains in place as the skin regenerates. Instead it’s that the needle doesn’t just deliver the pigment, but rather that its penetration causes the body’s immune system to send protective cells known as macrophages to the wound. These macrophages soak up the pigment to protect the rest of the skin and, while some macrophages are carried to the lymph nodes, others stay lodged in place, with the dye remaining visible through the skin.

At the moment, most tattoo removal involves using lasers to break down the ink particles so that they are small enough to be absorbed into the body. In effect it’s an attempt to speed up a natural process by which tattoos fade over time because of exposure to sunlight (just not quickly enough for the tattoo to disappear during an average lifespan.) That can mean painful inflammation and even scarring.

Alec Falkenham, a PhD student at Dalhouse University in Halifax, Nova Scotia, has developed what he calls Bisphosphonate Liposomal Tattoo Removal cream. Although it doesn’t require puncturing the skin, it simulates the introduction of a foreign body that comes with tattooing. The idea is that this stimulates the body to deliver fresh macrophages, with the existing ones (containing the pigment) carried to the lymph nodes.

At the moment Falkenham has only tested the cream on mice. He’s looking to move to pigs next before eventual human tests. The estimated price of the cream would be just four and a half cents per square centimetre, though Falkenham isn’t yet sure how many treatments would be needed in humans.

Falkenham has four tattoos and, although perfectly happy with them, says the experience of getting them started him thinking about the relationship between tattooing and the immune system.

The post New Tattoo Removal Cream Exploits Immune System appeared first on Geeks are Sexy Technology News.

16 Feb 13:31

Forgot to push the commits

by sharhalakis

by uaiHebert

10 Feb 16:13

Lockess algorithm

by sharhalakis
image

by Lwahonen

(Correction: lockless)

07 Feb 01:39

Comic: Precautions

by tycho@penny-arcade.com (Tycho)
New Comic: Precautions
06 Feb 19:57

Before diving into the legacy code

by sharhalakis

by Ordon

03 Feb 21:06

The Ingredient for Life [Comic]

by Geeks are Sexy
30 Jan 15:31

Ops after a long night deploy

by sharhalakis

by uaiHebert

25 Jan 00:55

The ‘X-Files’ Is Getting a Reboot

by Remy Carreiro

xfiles1

Holy crap, the X-Files is getting a reboot. Though they have been in talks for years about bringing this exciting show to the masses once again, up until now it had only been speculation. As of yesterday, speculation crossed over into fact (like an actual X-Files episode). From Vanity Fair:

Over the weekend, Fox confirmed that they were in the logistical phase of rebooting the series. That is to say, they were checking to make sure they could get all the original players back and available at the same time because, Fox promised, they’re not doing The X-Files without Mulder and Scully.

I will admit, I am a huge fan of the original series, and watched it weekly without missing an episode. And even though it sounds like they’re doing it right by getting the original cast, I’m a tad bit hesitant. While I am very excited about the prospect of getting to explore the paranormal with agents Mulder and Scully again, can lightning strike twice for this prestigious series? Guess we will have to just wait and see. I have faith, though. I KNOW the truth is still out there, so their work isn’t done yet.

[Story from VanityFair | Image Source]

The post The ‘X-Files’ Is Getting a Reboot appeared first on Geeks are Sexy Technology News.

25 Jan 00:50

Too Darn Bright [Comic]

by Geeks are Sexy
24 Jan 23:52

The Truth About the Internet

by Zach Weinersmith

it will scare you

Continue reading on Medium »

24 Jan 23:48

Calvin and Hobbes for January 20, 2015

24 Jan 18:45

A fear submitted by liamkruger to deep dark fears. Check out...



A fear submitted by liamkruger to deep dark fears. Check out prints and stuff at the deep dark fears store.

24 Jan 18:29

Lunar Swimming

by xkcd

Lunar Swimming

What if there was a lake on the Moon? What would it be like to swim in it? Presuming that it is sheltered in a regular atmosphere, in some giant dome or something.

Kim Holder

This would be so cool.

In fact, I honestly think it's cool enough that it gives us a pretty good reason to go to the Moon in the first place. At the very least, it's better than the one Kennedy gave.

Floating would feel about the same on the Moon as on Earth, since how high in the water you float depends only on your body's density compared to the water's, not the strength of gravity.

Swimming underwater would also feel pretty similar. The inertia of the water is the main source of drag when swimming, and inertia is a property of matter[1]♬ BILL NYE THE SCIENCE GUY ♬ independent of gravity. The top speed of a submerged swimmer would be about the same on the Moon as here—about 2 meters/second.

Everything else would be different and way cooler. The waves would be bigger, the splash fights more intense, and swimmers would be able to jump out of the water like dolphins.

This[2]Not this one. The other one.​[3]The simplest approach, which gives us an approximate answer, is to treat the swimmer as a simple projectile. The formula for the height of a projectile is:

\( \frac{\text{speed}^2}{2\times\text{gravity}} \)

... which tells us that a champion swimmer moving at 2 meters per second (4.5 mph) would only have enough kinetic energy to lift their body about 20 centimeters against gravity.

That's not totally accurate, although it's enough to tell us that dolphin jumps on Earth probably aren't in the cards for us. But to get a more accurate answer (and an equation we can apply to the Moon), we need to account for a few other things.

When a swimmer first breaks the surface, they don't have to lift their full weight; they're partially supported by buoyancy. As more of their body leaves the water, the force of buoyancy decreases, since their body is displacing less water. Since the force of gravity isn't changing, their net weight increases.

You can calculate how much potential energy is required to lift a body vertically through the surface to a certain height, but it's a complicated integral (you integrate the displacement of the submerged portion of their body over the vertical distance they travel) and depends on their body shape. For a human body moving fast enough to jump most of the way out of the water, this effect probably adds about half a torso-length to their final height—and less if they're not able to make it all the way out.

The other effect we have to account for is the fact that a swimmer can continue kicking as they start to leave the water. When a swimmer is submerged and moving at top speed, the drag from the water is equal to the thrust they generate by kicking and ... whatever the gerund form of the verb is for the things your arms do while swimming. My first thought was "stroking," but it's definitely not that.

Anyway, once the jumping swimmer breaks the surface, the drag almost vanishes, but they can keep kicking for a few moments. To figure out how much energy this adds, you can multiply the thrust from kicking by the distance over which they're kicking after breaking the surface, since energy equals force times distance. The distance is most of a body length, or 1 to 1.5 meters. As for the force from kicking, random Google results for a search for lifeguard qualifications suggest that good swimmers might be able to carry 10 lbs over their heads for a short distance, which means they're generating a little more than 10 pounds-force (50+ N) of kicking thrust.

We can combine all these together into a big ol' equation:

\[ \text{Jump height}=\left(\frac{\tfrac{1}{2}\times\text{body mass}\times\left(\text{top speed}\right)^2+\text{kick force}\times\text{torso length}}{\text{Earth gravity}\times\text{body mass}}\right)+\left(\text{buoyancy correction} \right) \] footnote contains some detail on the math behind a dolphin jump. Calculating the height a swimmer can jump out of the water requires taking several different things into account, but the bottom line is that a normal swimmer on the Moon could probably launch themselves a full meter out of the water, and Michael Phelps may well be able to manage 2 or 3.

The numbers get even more exciting when we introduce fins.

Swimmers wearing fins can go substantially faster than regular swimmers without them (although the fastest swimmer wearing flippers will still lose to a runner, even if the runner is also wearing flippers and jumping over hurdles).

Champion finswimmers can go almost 3.2 m/s wearing a monofin, which is fast enough for some pretty impressive jumps—even on Earth. Data on swimfin top speeds and thrusts[4]This paper provides some sample data. suggest that on the Moon, a champion finswimmer could probably launch themselves as high as 4 or 5 meters into the air. In other words, on the Moon, you could conceivably do a high dive in reverse.

But it gets even better. A 2012 paper in PLoS ONE, titled Humans Running in Place on Water at Simulated Reduced Gravity, concluded that while humans can't run on the surface of water on Earth,[5]They actually provide a citation for this statement, which is delightful. they might just barely be able to do so on the Moon. (I highly recommend reading their paper, if only for the hilarious experimental setup illustration on page 2.)

Because of the reduced gravity on the Moon, the water would be launched upward more easily, just like the swimmers. The result would be larger waves and more flying droplets. In technical terms, a pool on the Moon would be more "splashy".[6]The SI unit of splashiness is the splashypant.

To avoid splashing all the water out, you'd want to design the deck so water drains quickly back into the pool. You could just make the rim higher, but then you'd spoil one of the key joys of a pool on the Moon—exiting via Slip 'N Slide:

I 100% support this idea. If we ever build a Moon base, I think we should absolutely build a big swimming pool there. Sure, sending a swimming pool's worth of water (135 horses) to the Moon's surface would be expensive.[7]If you decided to bundle a backyard pool into individual two-liter bottles, and sent them in 3,000 batches of 10 each via the startup Astrobotic, it would cost you $72 billion (according to their website's calculator). But on the other hand, this lunar base is going to have people on it, so you need to send some water anyway.[8]Sending a supply of water and a filter system is probably cheaper than sending a replacement astronaut every 3 or 4 days, although I encourage NASA to run the numbers on that to be sure.

And it's really not impossible. A large backyard swimming pool weighs about as much as four Apollo lunar landers. A next-generation[9](or, heck, previous-generation) heavy-lift rocket, like Boeing's NASA SLS or Elon Musk's SpaceX Falcon Heavy, would be able to deliver a good-sized pool to the Moon in not too many trips.

So maybe the next step, if you really want a swimming pool on the Moon, is to call Elon Musk and ask for a quote.

24 Jan 18:21

What The Old Reader Readers Are Reading

Do you know what’s popular on the web right now?

If you ignore search engines, social media, and shopping, the most popular content on the web is sports (espn.com), news (cnn.com, huffingtonpost.com, foxnews.com), and porn.

If you ignore celebrities like Katy Perry, the most popular stuff on Twitter is mainstream news sites (CNN, BBC). 

If you look at what’s popular among The Old Reader users, you get a much different picture. 

First off, you like comics. Really, really like comics. XKCD, Dilbert, and the Oatmeal dominate the list of most popular feeds on The Old Reader. 

image

After comics, the majority of feeds are tech blogs and tech news sites. Then comes lifestyle stuff like Lifehacker. There is also a lot of longer form content like TED Talks or in-depth magazine reporting. We also see national news sites like nytimes.com and what might be considered local news sites, like Boston.com.

Interestingly, there is very little sports in our feeds. That might be because our users are just not sports fans. Or it might be that sports is easy to consume on Twitter. 

Looking at all of the data, I’m starting to think that The Old Reader is like a newspaper. Our readers are using it to compile a single source of information, news, analysis, satire, and opinion. It’s a source of information that you would have to work really hard to get just going online or using social media.

In fact, I think that the popularity of comics on our list supports my theory. It seems to me that just like in the days of the newspaper, comics are the one thing everyone can agree on. 

And as a comic fan, I’d like to point out that the comics you like are not childish entertainment. These comics are satire. Satire is only useful or interesting to people who have a good handle on what’s going on and are looking for a more subtle, sophisticated take- a way to make sense of the all the other stuff they read.  

On the Internet or social media, most people don’t read much beyond the headlines on mainstream news sites. But judging from our most popular feeds, The Old Reader makes it possible to consume a broader range of stuff, from comics and satire to news and analysis, to blogs and feature-length content.

Having information and being informed are not the same thing. Our users are looking to be informed. The paradox of our time is that you can have all of the information in the world available and learn less. There are more sources of information, but you need new literacy skills to decode messages in the way news and information are presented.

Most of us don’t have the time or mental energy to really analyze everything coming at us. But if you use it right, I really believe The Old Reader can help you get a better handle on a complicated world. 

14 Jan 15:49

sudo

by sharhalakis

by Mau

plus this older post

13 Jan 19:56

Why You Should Never Use MongoDB

by sarahmei
Renato Cerqueira

Pros amg programadores, ando lendo sobre o assunto pra um projeto que eu ando desenvolvendo, alguém tem pontos a favor ou contra? Corroborando ou discordando da amg que escreveu o post?
Tem mais posts sobre o assunto? :)

Aliás, não precisa ser só sobre mongo, pode ser sobre qualquer coisa "nosql" nesse estilo.

Disclaimer: I do not build database engines. I build web applications. I run 4-6 different projects every year, so I build a lot of web applications. I see apps with different requirements and different data storage needs. I’ve deployed most of the data stores you’ve heard about, and a few that you probably haven’t.

I’ve picked the wrong one a few times. This is a story about one of those times — why we picked it originally, how we discovered it was wrong, and how we recovered. It all happened on an open source project called Diaspora.

The project

Diaspora is a distributed social network with a long history. Waaaaay back in early 2010, four undergraduates from New York University made a Kickstarter video asking for $10,000 to spend the summer building a distributed alternative to Facebook. They sent it out to friends and family, and hoped for the best.

But they hit a nerve. There had just been another Facebook privacy scandal, and when the dust settled on their Kickstarter, they had raised over $200,000 from 6400 different people for a software project that didn’t yet have a single line of code written.

Diaspora was the first Kickstarter project to vastly overrun its goal. As a result, they got written up in the New York Times – which turned into a bit of a scandal, because the chalkboard in the backdrop of the team photo had a dirty joke written on it, and no one noticed until it was actually printed. In the NEW YORK TIMES. The fallout from that was actually how I first heard about the project.

As a result of their Kickstarter success, the guys left school and came out to San Francisco to start writing code. They ended up in my office. I was working at Pivotal Labs at the time, and one of the guys’ older brothers also worked there, so Pivotal offered them free desk space, internet, and, of course, access to the beer fridge. I worked with official clients during the day, then hung out with them after work and contributed code on weekends.

They ended up staying at Pivotal for more than two years. By the end of that first summer, though, they already had a minimal but working (for some definition) implementation of a distributed social network built in Ruby on Rails and backed by MongoDB.

That’s a lot of buzzwords. Let’s break it down.

“Distributed social network”

If you’ve seen the Social Network, you know everything you need to know about Facebook. It’s a web app, it runs on a single logical server, and it lets you stay in touch with people. Once you log in, Diaspora’s interface looks structurally similar to Facebook’s:

A screenshot of the Diaspora interface

A screenshot of the Diaspora user interface

There’s a feed in the middle showing all your friends’ posts, and some other random stuff along the sides that no one has ever looked at. The main technical difference between Diaspora and Facebook is invisible to end users: it’s the “distributed” part.

The Diaspora infrastructure is not located behind a single web address. There are hundreds of independent Diaspora servers. The code is open source, so if you want to, you can stand up your own server. Each server, called a pod, has its own database and its own set of users, and will interoperate with all the other Diaspora pods that each have their own database and set of users.

The Diaspora Ecosystem

Pods of different sizes communicate with each other, without a central hub.

Each pod communicates with the others through an HTTP-based API. Once you set up an account on a pod, it’ll be pretty boring until you follow some other people. You can follow other users on your pod, and you can also follow people who are users on other pods. When someone you follow on another pod posts an update, here’s what happens:

1. The update goes into the author’s pod’s database.

2. Your pod is notified over the API.

3. The update is saved in your pod’s database.

4. You look at your activity feed and see that post mixed in with posts from the other people you follow.

Comments work the same way. On any single post, some comments might be from people on the same pod as the post’s author, and some might be from people on other pods. Everyone who has permission to see the post sees all the comments, just as you would expect if everyone were on a single logical server.

Who cares?

There are technical and legal advantages to this architecture. The main technical advantage is fault tolerance.

Here is a very important fault tolerant system that every office should have.

If any one of the pods goes down, it doesn’t bring the others down. The system survives, and even expects, network partitioning. There are some interesting political implications to that — for example, if you’re in a country that shuts down outgoing internet to prevent access to Facebook and Twitter, your pod running locally still connects you to other people within your country, even though nothing outside is accessible.

The main legal advantage is server independence. Each pod is a legally separate entity, governed by the laws of wherever it’s set up. Each pod also sets their own terms of service. On most of them, you can post content without giving up your rights to it, unlike on Facebook. Diaspora is free software both in the “gratis” and the “libre” sense of the term, and most of the people who run pods care deeply about that sort of thing.

So that’s the architecture of the system. Let’s look at the architecture within a single pod.

It’s a Rails app.

Each pod is a Ruby on Rails web application backed by a database, originally MongoDB. In some ways the codebase is a ‘typical’ Rails app — it has both a visual and programmatic UI, some Ruby code, and a database. But in other ways it is anything but typical.

The internal structure of one Diaspora pod

The visual UI is of course how website users interact with Diaspora. The API is used by various Diaspora mobile clients — that part’s pretty typical — but it’s also used for “federation,” which is the technical name for inter-pod communication. (I asked where the Romulans’ access point was once, and got a bunch of blank looks. Sigh.) So the distributed nature of the system adds layers to the codebase that aren’t present in a typical app.

And of course, MongoDB is an atypical choice for data storage. The vast majority of Rails applications are backed by PostgreSQL or (less often these days) MySQL.

So that’s the code. Let’s consider what kind of data we’re storing.

I Do Not Think That Word Means What You Think That Means

“Social data” is information about our network of friends, their friends, and their activity. Conceptually, we do think about it as a network — an undirected graph in which we are in the center, and our friends radiate out around us.

Photos all from rubyfriends.com. Thanks Matt Rogers, Steve Klabnik, Nell Shamrell, Katrina Owen, Sam Livingston-Grey, Josh Susser, Akshay Khole, Pradyumna Dandwate, and Hephzibah Watharkar for contributing to #rubyfriends!

When we store social data, we’re storing that graph topology, as well as the activity that moves along those edges.

For quite a few years now, the received wisdom has been that social data is not relational, and that if you store it in a relational database, you’re doing it wrong.

But what are the alternatives? Some folks say graph databases are more natural, but I’m not going to cover those here, since graph databases are too niche to be put into production. Other folks say that document databases are perfect for social data, and those are mainstream enough to actually be used. So let’s look at why people think social data fits more naturally in MongoDB than in PostgreSQL.

How MongoDB Stores Data

MongoDB is a document-oriented database. Instead of storing your data in tables made out of individual rows, like a relational database does, it stores your data in collections made out of individual documents. In MongoDB, a document is a big JSON blob with no particular format or schema.

Let’s say you have a set of relationships like this that you need to model. This is quite similar to a project that come through Pivotal that used MongoDB, and was the best use case I’ve ever seen for a document database.

At the root, we have a set of TV shows. Each show has many seasons, each season has many episodes, and each episode has many reviews and many cast members. When users come into this site, typically they go directly to the page for a particular TV show. On that page they see all the seasons and all the episodes and all the reviews and all the cast members from that show, all on one page. So from the application perspective, when the user visits a page, we want to retrieve all of the information connected to that TV show.

There are a number of ways you could model this data. In a typical relational store, each of these boxes would be a table. You’d have a tv_shows table, a seasons table with a foreign key into tv_shows, an episodes table with a foreign key into seasons, and reviews and cast_members tables with foreign keys into episodes. So to get all the information for a TV show, you’re looking at a five-table join.

We could also model this data as a set of nested hashes. The set of information about a particular TV show is one big nested key/value data structure. Inside a TV show, there’s an array of seasons, each of which is also a hash. Within each season, an array of episodes, each of which is a hash, and so on. This is how MongoDB models the data. Each TV show is a document that contains all the information we need for one show.

Here’s an example document for one TV show, Babylon 5.

It’s got some title metadata, and then it’s got an array of seasons. Each season is itself a hash with metadata and an array of episodes. In turn, each episode has some metadata and arrays for both reviews and cast members.

It’s basically a huge fractal data structure.

Sets of sets of sets of sets. Tasty fractals.

All of the data we need for a TV show is under one document, so it’s very fast to retrieve all this information at once, even if the document is very large. There’s a TV show here in the US called “General Hospital” that has aired over 12,000 episodes over the course of 50+ seasons. On my laptop, PostgreSQL takes about a minute to get denormalized data for 12,000 episodes, while retrieval of the equivalent document by ID in MongoDB takes a fraction of a second.

So in many ways, this application presented the ideal use case for a document store.

Ok. But what about social data?

Right. When you come to a social networking site, there’s only one important part of the page: your activity stream. The activity stream query gets all of the posts from the people you follow, ordered by most recent. Each of those posts have nested information within them, such as photos, likes, reshares, and comments.

The nested structure of activity stream data looks very similar to what we were looking at with the TV shows.

Users have friends, friends have posts, posts have comments and likes, each comment has one commenter and each like has one liker. Relationship-wise, it’s not a whole lot more complicated than TV shows. And just like with TV shows, we want to pull all this data at once, right after the user logs in. Furthermore, in a relational store, with the data fully normalized, it would be a seven-table join to get everything out.

Seven-table joins. Ugh. Suddenly storing each user’s activity stream as one big denormalized nested data structure, rather than doing that join every time, seems pretty attractive.

In 2010, when the Diaspora team was making this decision, Etsy’s articles about using document stores were quite influential, although they’ve since publicly moved away from MongoDB for data storage. Likewise, at the time, Facebook’s Cassandra was also stirring up a lot of conversation about leaving relational databases. Diaspora chose MongoDB for their social data in this zeitgeist. It was not an unreasonable choice at the time, given the information they had.

What could possibly go wrong?

There is a really important difference between Diaspora’s social data and the Mongo-ideal TV show data that no one noticed at first.

With TV shows, each box in the relationship diagram is a different type. TV shows are different from seasons are different from episodes are different from reviews are different from cast members. None of them is even a sub-type of another type.

But with social data, some of the boxes in the relationship diagram are the same type. In fact, all of these green boxes are the same type — they are all Diaspora users.

A user has friends, and each friend may themselves be a user. Or, they may not, because it’s a distributed system. (That’s a whole layer of complexity that I’m just skipping for today.) In the same way, commenters and likers may also be users.

This type duplication makes it way harder to denormalize an activity stream into a single document. That’s because in different places in your document, you may be referring to the same concept — in this case, the same user. The user who liked that post in your activity stream may also be the user who commented on a different post.

Duplicate data Duplicate data

We can represent this in MongoDB in a couple of different ways. Duplication is any easy option. All the information for that friend is copied and saved to the like on the first post, and then a separate copy is saved to the comment on the second post. The advantage is that all the data is present everywhere you need it, and you can still pull the whole activity stream back as a single document.

Here’s what this kind of fully denormalized stream document looks like.

Here we have copies of user data inlined. This is Joe’s stream, and it has a copy of his user data, including his name and URL, at the top level. His stream, just underneath, contains Jane’s post. Joe has liked Jane’s post, so under likes for Jane’s post, we have a separate copy of Joe’s data.

You can see why this is attractive: all the data you need is already located where you need it.

You can also see why this is dangerous. Updating a user’s data means walking through all the activity streams that they appear in to change the data in all those different places. This is very error-prone, and often leads to inconsistent data and mysterious errors, particularly when dealing with deletions.

Is there no hope?

There is another approach you can take to this problem in MongoDB, which will more familiar if you have a relational background. Instead of duplicating user data, you can store references to users in the activity stream documents.

With this approach, instead of inlining this user data wherever you need it, you give each user an ID. Once users have IDs, we store the user’s ID every place that we were previously inlining data. New IDs are in green below.

MongoDB actually uses BSON IDs, which are strings sort of like GUIDs, but to make these samples easier to read I’m just using integers.

This eliminates our duplication problem. When user data changes, there’s only one document that gets rewritten. However, we’ve created a new problem for ourselves. Because we’ve moved some data out of the activity streams, we can no longer construct an activity stream from a single document. This is less efficient and more complex. Constructing an activity stream now requires us to 1) retrieve the stream document, and then 2) retrieve all the user documents to fill in names and avatars.

What’s missing from MongoDB is a SQL-style join operation, which is the ability to write one query that mashes together the activity stream and all the users that the stream references. Because MongoDB doesn’t have this ability, you end up manually doing that mashup in your application code, instead.

Simple Denormalized Data

Let’s return to TV shows for a second. The set of relationships for a TV show don’t have a lot of complexity. Because all the boxes in the relationship diagram are different entities, the entire query can be denormalized into one document with no duplication and no references. In this document database, there are no links between documents. It requires no joins.

On a social network, however, nothing is that self-contained. Any time you see something that looks like a name or a picture, you expect to be able to click on it and go see that user, their profile, and their posts. A TV show application doesn’t work that way. If you’re on season 1 episode 1 of Babylon 5, you don’t expect to be able to click through to season 1 episode 1 of General Hospital.

Don’t. Link. The. Documents.

Once we started doing ugly MongoDB joins manually in the Diaspora code, we knew it was the first sign of trouble. It was a sign that our data was actually relational, that there was value to that structure, and that we were going against the basic concept of a document data store.

Whether you’re duplicating critical data (ugh), or using references and doing joins in your application code (double ugh), when you have links between documents, you’ve outgrown MongoDB. When the MongoDB folks say “documents,” in many ways, they mean things you can print out on a piece of paper and hold. A document may have internal structure — headings and subheadings and paragraphs and footers — but it doesn’t link to other documents. It’s a self-contained piece of semi-structured data.

If your data looks like that, you’ve got documents. Congratulations! It’s a good use case for Mongo. But if there’s value in the links between documents, then you don’t actually have documents. MongoDB is not the right solution for you. It’s certainly not the right solution for social data, where links between documents are actually the most critical data in the system.

So social data isn’t document-oriented. Does that mean it’s actually…relational?

That Word Again

When people say “social data isn’t relational,” that’s not actually what they mean. They mean one of these two things:

1. “Conceptually, social data is more of a graph than a set of tables.”

This is absolutely true. But there are actually very few concepts in the world that are naturally modeled as normalized tables. We use that structure because it’s efficient, because it avoids duplication, and because when it does get slow, we know how to fix it.

2. “It’s faster to get all the data from a social query when it’s denormalized into a single document.”

This is also absolutely true. When your social data is in a relational store, you need a many-table join to extract the activity stream for a particular user, and that gets slow as your tables get bigger. However, we have a well-understood solution to this problem. It’s called caching.

At the All Your Base Conf in Oxford earlier this year, where I gave the talk version of this post, Neha Narula had a great talk about caching that I recommend you watch once it’s posted. In any case, caching in front of a normalized data store is a complex but well-understood problem. I’ve seen projects cache denormalized activity stream data into a document database like MongoDB, which makes retrieving that data much faster. The only problem they have then is cache invalidation.

“There are only two hard problems in computer science: cache invalidation and naming things.”

Phil Karlton

It turns out cache invalidation is actually pretty hard. Phil Karlton wrote most of SSL version 3, X11, and OpenGL, so he knows a thing or two about computer science.

Cache Invalidation As A Service

But what is cache invalidation, and why is it so hard?

Cache invalidation is just knowing when a piece of your cached data is out of date, and needs to be updated or replaced. Here’s a typical example that I see every day in web applications. We have a backing store, typically PostgreSQL or MySQL, and then in front of that we have a caching layer, typically Memcached or Redis. Requests to read a user’s activity stream go to the cache rather than the database directly, which makes them very fast.

Typical cache and backing store setup

Application writes are more complicated. Let’s say a user with two followers writes a new post. The first thing that happens (part 1) is that the post data is copied into the backing store. Once that completes, a background job (part 2)  appends that post to the cached activity stream of both of the users who follow the author.

This pattern is quite common. Twitter holds recently-active users’ activity streams in an in-memory cache, which they append to when someone they follow posts something. Even smaller applications that employ some kind of activity stream will typically end up here (see: seven-table join).

Back to our example. When the author changes an existing post, the update process is essentially the same as for a create, except instead of appending to the cache, it updates an item that’s already there.

What happens if that step 2 background job fails partway through? Machines get rebooted, network cables get unplugged, applications restart. Instability is the only constant in our line of work. When that happens, you’ll end up with invalid data in your cache. Some copies of the post will have the old title, and some copies will have the new title. That’s a hard problem, but with a cache, there’s always the nuclear option.

Always an option >_<

You can always delete the entire activity stream record out of your cache and regenerate it from your consistent backing store. It may be slow, but at least it’s possible.

What if there is no backing store? What if you skip step 1? What if the cache is all you have?

When MongoDB is all you have, it’s a cache with no backing store behind it. It will become inconsistent. Not eventually consistent — just plain, flat-out inconsistent, for all time. At that point, you have no options. Not even a nuclear one. You have no way to regenerate the data in a consistent state.

When Diaspora decided to store social data in MongoDB, we were conflating a database with a cache. Databases and caches are very different things. They have very different ideas about permanence, transience, duplication, references, data integrity, and speed.

The Conversion

Once we figured out that we had accidentally chosen a cache for our database, what did we do about it?

Well, that’s the million dollar question. But I’ve already answered the billion-dollar question. In this post I’ve talked about how we used MongoDB vs. how it was designed to be used. I’ve talked about it as though all that information were obvious, and the Diaspora team just failed to research adequately before choosing.

But this stuff wasn’t obvious at all. The MongoDB docs tell you what it’s good at, without emphasizing what it’s not good at. That’s natural. All projects do that. But as a result, it took us about six months, a lot of user complaints, and a lot of investigation to figure out that we were using MongoDB the wrong way.

There was nothing to do but take the data out of MongoDB and move it to a relational store, dealing as best we could with the inconsistent data we uncovered along the way. The data conversion itself — export from MongoDB, import to MySQL — was straightforward. For the mechanical details, you can see my slides from All Your Base Conf 2013.

The Damage

We had eight months of production data, which turned into about 1.2 million rows in MySQL. We spent four pair-weeks developing the code for the conversion, and when we pulled the trigger, the main site had about two hours of downtime. That was more than acceptable for a project that was in pre-alpha. We could have reduced that downtime more, but we had budgeted for eight hours of downtime, so two actually seemed fantastic.

NOT BAD

Epilogue

Remember that TV show application? It was the perfect use case for MongoDB. Each show was one document, perfectly self-contained. No references to anything, no duplication, and no way for the data to become inconsistent.

About three months into development, it was still humming along nicely on MongoDB. One Monday, at the weekly planning meeting, the client told us about a new feature that one of their investors wanted: when they were looking at the actors in an episode of a show, they wanted to be able to click on an actor’s name and see that person’s entire television career. They wanted a chronological listing of all of the episodes of all the different shows that actor had ever been in.

We stored each show as a document in MongoDB containing all of its nested information, including cast members. If the same actor appeared in two different episodes, even of the same show, their information was stored in both places. We had no way to tell, aside from comparing the names, whether they were the same person. So to implement this feature, we needed to search through every document to find and de-duplicate instances of the actor that the user clicked on. Ugh. At a minimum, we needed to de-dup them once, and then maintain an external index of actor information, which would have the same invalidation issues as any other cache.

You See Where This Is Going

The client expected this feature to be trivial. If the data had been in a relational store, it would have been. As it was, we first tried to convince the PM they didn’t need it. After that failed, we offered some cheaper alternatives, such as linking to an IMDB search for the actor’s name. The company made money from advertising, though, so they wanted users to stay on their site rather than going off to IMDB.

This feature request eventually prompted the project’s conversion to PostgreSQL. After a lot more conversation with the client, we realized that the business saw lots of value in linking TV shows together. They envisioned seeing other shows a particular director had been involved with, and episodes of other shows that were released the same week this one was, among other things.

This was ultimately a communication problem rather than a technical problem. If these conversations had happened sooner, if we had taken the time to really understand how the client saw the data and what they wanted to do with it, we probably would have done the conversion earlier, when there was less data, and it was easier.

Always Be Learning

I learned something from that experience: MongoDB’s ideal use case is even narrower than our television data. The only thing it’s good at is storing arbitrary pieces of JSON. “Arbitrary,” in this context, means that you don’t care at all what’s inside that JSON. You don’t even look. There is no schema, not even an implicit schema, as there was in our TV show data. Each document is just a blob whose interior you make absolutely no assumptions about.

At RubyConf this weekend, I ran into Conrad Irwin, who suggested this use case. He’s used MongoDB to store arbitrary bits of JSON that come from customers through an API. That’s reasonable. The CAP theorem doesn’t matter when your data is meaningless. But in interesting applications, your data isn’t meaningless.

I’ve heard many people talk about dropping MongoDB in to their web application as a replacement for MySQL or PostgreSQL. There are no circumstances under which that is a good idea. Schema flexibility sounds like a great idea, but the only time it’s actually useful is when the structure of your data has no value. If you have an implicit schema — meaning, if there are things you are expecting in that JSON — then MongoDB is the wrong choice. I suggest taking a look at PostgreSQL’s hstore (now apparently faster than MongoDB anyway), and learning how to make schema changes. They really aren’t that hard, even in large tables.

Find The Value

When you’re picking a data store, the most important thing to understand is where in your data — and where in its connections — the business value lies. If you don’t know yet, which is perfectly reasonable, then choose something that won’t paint you into a corner. Pushing arbitrary JSON into your database sounds flexible, but true flexibility is easily adding the features your business needs.

Make the valuable things easy.

The End.

Thanks for reading! Let me sum up how I feel about comments on this post:

12 Jan 11:41

When a recruiter asks for a devops certification

by sharhalakis

by @maximilienriehl

09 Jan 12:36

Hearing that your project failed, then realizing it was someone else's fault

by sharhalakis

by Craig

02 Jan 02:40

M&Ms Trick Your Brain When Positioned on a LEGO Checkerboard [Pics]

by Geeks are Sexy

check

Mary Coffelt, Briena Heller, and Michael McCamy have created this fun take on Akiyoshi Kitaoka’s “Bulge” illusion at the Barrow Neurological Institute last summer. Sure, we all now that lines on a LEGO checkerboard can’t be anything but straight, but when you strategically position M&Ms on it, your brain warps your vision and make the whole thing all funny looking.

Can can check out this video to see what happens to a similar illustion when you make the “dots” disappear all at once.

[Source: SciAm | Via IO9]

Created by Mary Coffelt and her colleagues at the Barrow Neurological Institute, this version of Akiyoshi Kitaoka’s “Bulge” illusion uses strategically placed white and purple M&Ms to warp your perception of a checkerboard built from legos of the same color. (Hit the jump to see a video of the Bulge illusion in action.)

The post M&Ms Trick Your Brain When Positioned on a LEGO Checkerboard [Pics] appeared first on Geeks are Sexy Technology News.

18 Dec 17:09

Thanks for the commit, but do not break the build again

by sharhalakis

by uaiHebert

16 Dec 11:35

Mentirinhas #745

by Fábio Coala

mentirinhas_734

Melhor que ser hackeado.

O post Mentirinhas #745 apareceu primeiro em Mentirinhas.