Author Archives: Ikram Hawramani

Ikram Hawramani

About Ikram Hawramani

The creator of IslamicArtDB.

IslamQA: Is it sinful to cherry-pick which scholars you listen to?

Is it sinful for me to cherry-pick what kind of da'wah I want to hear and accept? I don't enjoy and accept some of the 'ulama here in my country for their way of speaking or delivering the speech, even if it's true. I kinda disappointed by the traditionalist point of view and I want to start to build my own perspective to perceive Islam the way I really want to see and feel about it. I dislike the feeling of extremism that emerges every time I try to accept them, and so I stopped listening.

Actually according to Imam al-Ghazali it is obligatory upon you to build your own Islam out of all the pieces you can gather rather than trying to follow the opinions of others. So what you are doing is perfectly fine. If you are not satisfied with what you hear, that means you are intelligent enough to seek knowledge on your own and to surpass them in understanding. Become a scholar yourself.

I recommend reading Western scholarly works about Islam’s great scholars and thinkers, such as Imam al-Ghazali, Rumi, al-Shafi`i, Imam Malik and others then reading the books they cite, and you will find a whole new world open up to you.

Check out these books if possible:

Al-Ghazali’s Philosophical Theology

Misquoting Muhammad: The Challenge and Choices of Interpreting the Prophet’s Legacy

Malik and Medina: Islamic Legal Reasoning in the Formative Period 

A Muslim in Victorian America: The Life of Alexander Russell Webb

The First Islamic Reviver: Abu Hamid al-Ghazali and his Revival of the Religious Sciences

The Canonization of Islamic Law: A Social and Intellectual History 

The Rise of Humanism in Classical Islam and the Christian West: With Special Reference to Scholasticism

What Is Islam?: The Importance of Being Islamic

The Cambridge Companion to Classical Islamic Theology

IslamQA: How is the start of maghrib prayer determined?

I'm confused when exactly should maghrib be prayed, is it the start of sunset or when the sun has completely set? For example in England sunset is at 3.49pm and the Adhan is called at 3.54pm in my area.

Maghrib starts at sunset (when the sun completely falls below the horizon at sea level so that it can no longer be seen). I do not know why the sunset and maghrib times are different in England, maybe the sunset time you mentioned is not the sea-level sunset time, or maybe the mosque is simply choosing to call the adhan a bit later.

IslamQA: How is isha start time calculated?

How do you work out when isha salah should be prayed?

It is prayed when the red evening twilight disappears, which is around 75 minutes after sunset in many parts of the world. There are certain complexities involved for some locations, you should look at your local mosque’s timings to know the correct time. For more details on how isha is calculated see this article.

 

 

IslamQA: Determining start of fajr prayer in the UK

I've recently started to pray but I'm having difficulties with fajr and the timing. I'm from the uk and at my local mosque fajr start time is 3.05am but dawn is at 4.07am will my prayer be accepted or have I been praying too early

There are multiple definitions of “dawn”. You have probably looked at the beginning of the “civil” morning twilight, which is after 4 AM. The correct twilight to use for the UK appears to be the nautical twilight. See here for more details on the multiple twilights as they apply to London, you can enter your particular city in the search box if you live in another part of the UK:

https://www.timeanddate.com/sun/uk/london

And here is a discussion of fajr and isha times in Britain:

Fajr and Esha time in Britain

Generally the mosques know what they are doing. You could try visiting the websites of multiple mosques in your area, their sites usually show the prayer times. Here is a random London mosque site that lists the fajr prayer time as 3:04 AM (see the top right):

http://www.eastlondonmosque.org.uk/

I'm from the uk and rely on a timetable for salah, but I was wondering is it better to determine when fajr starts by looking at the sky? for example fajr starts at 5.38am here but it's still completely dark, and I'm worried I'm praying fajr too early. I've read that the Nautical Twilight should be considered as the beginning of the subh prayer time.

The topography of your location determines how light or dark it will be regardless of the actual fajr time, therefore it is better to rely on the Nautical Twilight rather than relying on the color of the sky. Look up the website of a mosque in your city and they usually have a table of the prayer times. You can rely on that.

Impiety by Mahwi (1836 – 1906 CE)

The cover of an edition of his diwan (collected poetry)

A famous poem by the Kurdish poet and Islamic scholar Mahwi (1836 – 1906 CE, full name: Mullah Muhammad son of Mullah Uthman Balkhi)

In impiety–woe to me!–my life has passed;
O God, let me go on living till I die at a pious man’s doorstep.

Wasted in meaninglessness my whole lifetime has gone:
I must even pray for time to die in from the Lord of Time.

The hour of death has come: “Be ready! It is the time of resignation and submission!”
Yet I, in obliviousness, am only starting to busy myself with childish matters.

The empty thoughts of the worldly life have so overcome me,
Only on the Day of Judgment will I be able to remember the Day of Judgment.

I have become a cripple, yet like a child I desire the world:
The frailty of old age prevents me from holding my head up, yet in worldliness my ego feels as if it is just beginning to walk.

What is its sin and crime that it has become a home of torment?
My grave, to the gravedigger, will be complaining thus until the Day of Judgment.

Tomorrow is the Day of Resurrection, my friends, it is your chance today:
Disown me–let no one’s judgment be with mine!

I do not know what my villainous ego can want of me anymore:
I am already an evil-doer, evil-mannered, evil-minded and evil-natured.

My only hope is that His attribute of the Coverer of Sins covers me with a wave of the sea of His Mercy
Otherwise my correction is unlikely, the covering of my sins impossible.

Kurdish text:

له‌ ناکه‌سکاریا خاکم به‌سه‌ر، رۆیی به‌با عومرم
خودا، تۆ بمژێنه‌ تا له‌به‌ر قاپی که‌سێ ئه‌مرم
به‌ ظایع چو له‌ مالایه‌عنیا، وه‌قتم هه‌مو یه‌عنی
ئه‌بێ وه‌قتێ له‌بولوه‌قتێ بخوازم، تا تیابمرم
ئه‌جه‌ل ده‌ورم ده‌دا، حاظڕبه‌ واده‌ی ده‌وروته‌سلیمه‌
منی غه‌فڵه‌تزه‌ده‌، تازه‌ خه‌ریکی مه‌سئه‌له‌ی ده‌ورم
خه‌یاڵی پوچی دنیا، وا ده‌ماغو دڵمی پێچاوه‌
قیامه‌ت هه‌ر مه‌گه‌ر رۆژی، قیامه‌ت بێته‌وه‌ فکرم
له‌پێ که‌وتومو نه‌فسم بۆ هه‌وا ده‌شنێ وه‌کو منداڵ
له‌به‌ر پیری سه‌رم خۆی ناگرێتو، تازه‌ پێده‌گرم
چیه‌ سوچو گوناهی؟ بۆچی ده‌یکاته‌ جه‌زاخانه‌؟
له‌ قه‌برهه‌ڵکه‌ن هه‌تا رۆژی جه‌زا، ده‌عوه‌ت چییه‌ قه‌برم
سبه‌ینێ (یحشر المرء)ه براگه‌ل، فورسه‌ته‌ ئه‌مڕۆ
ته‌به‌ڕابن له‌ من، با که‌سنه‌بێ حه‌شری له‌گه‌ڵ حه‌شرم
!له‌ من نازانم ئیتر، نه‌فسی به‌دخو چی ئه‌وێ (مه‌حوی)؟
که‌ به‌د کردارو به‌د ره‌فتارو به‌د ئه‌فکارو به‌د طه‌ورم
مه‌گه‌ر به‌ر مه‌وجی به‌حری ره‌حمه‌تمکا، وه‌سفی سه‌تتاری
وه‌گه‌رنا، زه‌حمه‌ته‌ پابونه‌وه‌م، نامومکینه‌ سه‌ترم

IslamQA: Cosmetic surgery is permissible in Islam (with conditions)

What is the Islamic verdict on cosmetic surgery?

There are many differing opinions on cosmetic surgery. Many jurists permit reconstructive surgery (for example cosmetic surgery that removes a blemish caused by injury) but forbid surgery done for enhancement. The reason for the generally negative view of Islamic jurists on cosmetic surgery is a saying of Satan quoted in the Quran:

“And I will mislead them, and I will entice them, and I will prompt them to slit the ears of cattle, and I will prompt them to alter the creation of God.” Whoever takes Satan as a lord, instead of God, has surely suffered a profound loss. (Verse 4:119)

Since according to them cosmetic surgery alters God’s creation, it is a form of obeying Satan to perform such surgery unless it is done for correction, not enhancement.

But the Egyptian scholar Yusuf al-Qaradawi (one of the most respected in the world) has a more nuanced view.1 He believes that the natural state of humans is to be beautiful, therefore cosmetic surgery that enhances a person’s looks is permissible with the following conditions:

  1. The surgery should not give a person an unnatural appearance (thus lip injections that create an unnatural pouting appearance are not permissible). Surgery done by old women to appear much younger or more sexually attractive (such as breast injections) are also forbidden.
  2. The surgery should not be an act of isrāf (wasteful extravagance), where a person who is already good-looking gets surgery done to become even better-looking.

Al-Qaradawi’s view is therefore that it is permissible for a woman to enhance her looks through surgery if the result is tasteful, elegant and not absurd, and if it is done to correct for a natural shortcoming of her looks rather than out of an extravagant desire to have extra good looks.

So there are no hard and fast rules on cosmetic surgery. If a person has doubts about whether their surgery is justifiable, it is best for them to consult their relatives and perhaps a religious authority.

The Meaning of Altering God’s Creation in the Quran

The negative view of cosmetic surgery of many scholars comes from a specific interpretation of altering God’s creation in verse 4:119. To them this refers to any change that is not completely forced by necessity. For this reason they approve of various forms of altering God’s creation while disapproving of cosmetic surgery. Commonly practiced forms of altering God’s creation are as follows:

  • Male circumcision
  • The neutering of male animals, such as oxen, on farms. Farms would be unmanageable without practicing this alteration of God’s creation.
  • Grafting: A tree is altered to bear fruits from other types of trees. This is a widespread practice in farming.

The Islamic approval of the above practices shows that altering God’s creation is permissible if it is done for a good purpose. We can actually construct a new understanding of 4:119 based on this: Satan is only referring to the superstitious and senseless altering of God’s creation, as in when an animal’s ear is slit for no proven benefit–it is done merely out of a superstitious belief that it brings benefit.

So the problem is not with the alteration itself. The problem is with altering God’s creation out of superstitious and senseless beliefs that are presumably inspired by Satan.

Since cosmetic surgery is not done for superstitious reasons but done for real benefits, it could be argued that verse 4:119 does not apply to it. It would only apply if someone performs cosmetic surgery for a superstitious or senseless reason (such as if they were to slit their ear or tongue in order to “enhance” some spiritual quality, or if they were to have cosmetic surgery to make themselves look like what they assume a vampire would look like). Ordinary cosmetic surgery that is done for reconstruction or enhancement is therefore not the type of the altering of God’s creation that 4:119 is speaking of.

However, other parts of Islamic law still apply to cosmetic surgery, as Yusuf al-Qaradawi asserts. Extravagance and self-mutilation are forbidden in Islam, so the type of cosmetic surgery that is permitted is surgery that fits social acceptability and common sense.

Asalam Walikum Is it haram to remove double chin and stomach fat surgically?

Removing fat and facial defects fall under the permitted category.

IslamQA: On the unreliability of the hadith on Muslims being fated to establish a Prophetic caliphate

Salam. A post in your website titled "The Muslim Plan for Western Civilization" talks about how Muslims should not seek power, and I do found that there is no explicit verse in The Quran that says for Muslim to establish an Islamic State. Back in my times being in a halaqa, there is a hadith that narrates about The 5 Periods of Era (The Prophetic Era of Muhammad, Caliphate, Mulkan Jabriyan, Mulkan 'Adhan, and Caliphate based on Prophethood). I hope you would explain it to me. Jazakallah.

Alaikumassalam wa rahmatullah,

There is no verse in the Quran that clearly and unequivocally asks Muslims to establish an Islamic state. It also never asks Muslims to seek power. Everything the Quran says about governance is vague and can be interpreted in many ways. Mainstream Muslim thinkers believe that this means that the Quran leaves it to each Muslim community to decide its own governance matters according to whatever works best in their particular time and place. I will be happy to discuss any particular verse you have in mind.

As for the hadith you mentioned, the final part that says “then a caliphate will be established according to the methodology of Prophethood” is narrated by only one person (Ibrāhīm al-Wāsiṭī) whose narrations are matrūk (”abandoned”) meaning they are so unreliable as to be unworthy of being cited. Please see the study (Arabic PDF) on this by the hadith scholar Dr. Salah al-Din al-Idlibi.

So there is no authentic narration (as far as I have heard) that talks about the establishment of a utopian caliphate in the future.

There is a serious problem with hadith narrations where there is a short authentic version and a longer version that someone modified according to their own imagination. For example there is a famous hadith that says Muslims will be divided into 73 sects. This is authentic. But then someone added this to its end: “And all of them will enter the Hellfire except one.” And that completely changed its meaning and turned it into a tool for intolerant groups to claim to possess the truth and claim everyone who disagrees with them will go to Hell (see my article on this hadith).

On Islam’s view of psychology and scientific reductionism

What do you think of theory of psychology like Myers-Briggs Type Indicator? Is it worth it to study it to understand human personality or is it just a mere fun and entertainment? Also, how does Islam view the majority of theory of psychology which was born in Western? Thank you. I love your blog!

Islamic theology embraces science because it considers this universe a simulation-like thing that is designed to work according to scientific principles (as I explain in my essay Al-Ghazali’s Matrix and the Divine Template – PDF file). So whatever is established by science will also be automatically confirmed by Islamic theology.

Psychology is like any other science. Whatever objective and verifiable results it discovers will be accepted by Islam. The Myers-Briggs Type Indicator is not firmly established (see the criticisms section on Wikipedia), so Islam’s view of it will have to take these criticisms into account.

Psychology has what is called a “replication crisis” where studies conducted to verify previous studies often come to different results. For this reason psychology is not as respectable as the other sciences and its results should always be treated with skepticism unless some result is validated by many studies.

There is, however, the issue of scientific reductionism which is likely what led to your question. Science tends to treat humans as if they were nothing more than “clever apes”, animals who happen to be intelligent and use language. This view operates under the belief that science can work out everything there is to know about humans through scientific studies.

Islam is opposed to that view. It will accept all empirical and verifiable results of the sciences, but similar to Christian philosophy it views humans as “embodied spirits” not clever apes. We all have an “inner ape” that can be studied by science; this refers to the parts of our biology and psychology that are under the control of physical factors like genes. Islam fully accepts this.

But Islam and Christianity both go a step beyond that: Humans also have uniquely human part that is layered on top of the ape part and that controls it. The uniquely human part has self-consciousness, free will and inviolable dignity.  There is nothing wrong with the biological and evolutionary study of humans, but there is something wrong with suggesting that that is all there is to humans. We believe that humans can transcend their physical limits and overcome the inner ape’s instincts in order to do what is better, more just and more admirable.

The view of Islam and Christianity is that humans have inner apes and potential inner saints. The perfect human in both Islam and Christianity is the one who strives always to embody the divine attributes that are fit for a human to have (generosity, fairness, mercy, compassion, empathy). We believe that all humans have been given a nature (what Islam calls a fiṭra and which is also mentioned by Christians like Thomas Aquinas) that seeks to transcend itself by communion with God and the embodiment of His attributes. This, needless to say, is a far more beautiful and humane worldview than what scientific reductionism believes about humans.

If someone uses psychology or other fields of science to build a theory that reduces humans to nothing more than clever animals, then that is rejected by both Islam and Christianity. But that is not science anyway; there is no proof that humans are merely animals. It is just an unproven conjecture that some people like. As for the respectable, non-conjectural parts of science that are supported by studies, they are accepted by modern Islamic theology and the Christian theology of thinkers like Alister McGrath.

The Islamic Case for Scientific Empiricism and Skepticism toward Supernatural Phenomena

In answer to questions regarding people observing miracles

I would explore all possible scientific explanations for seemingly miraculous events before thinking of supernatural causes. Even if there is no scientific explanation now, one may find such an explanation one day. As I mention in my essays on why God allows evil to exist and on reconciling Islam and the theory of evolution, one of God’s self-imposed rules is the principle of plausible deniability: God never performs anything provably supernatural for us to see.  God always wants Himself to be hidden from us. That is what His dual attributes of al-Ẓāhir al-Bāṭin (The Clearly Visible, the Hidden) refer to. God is everywhere to be seen for a person who has faith in Him. But He is also completely hidden from direct observation.

We hear stories about some person’s friend’s relative who saw a clear and obvious miracle but miraculously failed to take a video of it. Rather than believing such stories, if we were to take the Quran seriously, we would be as skeptical about them as an atheist is. We fully believe in the miracles mentioned in the Quran, but we also believe the Quran when it says God will no longer show us any miracles that force us to believe in Him.

God is involved in our lives every moment of every day, but, and this is a very important point, He never provably involves Himself in our lives. He will always leave sufficient room for doubt so that when He answers a prayer we can always later say it was actually just an accident that the prayer came true. God does not want us to see Him or see effects of His actions directly. He wants our faith in Him to be a completely free and unforced choice. He wants us to proactively appreciate Him and love Him. He does not want us to passively be forced by external evidence to submit to Him.

I occasionally get messages from Muslims asking what “proof” there is that God exists and that Islam is the true religion. They have the mistaken idea that it is the job of Islamic scholars to prove Islam for them. They got it backward: It is their job to seek God and seek proofs of the correctness of Islam. Islamic scholars can help, but ultimately the business of faith is a personal business between each person and God. God has zero need for people. A person who fails to do their homework of proactively seeking God has no one to blame but themselves on the Day of Judgment.

The Universal Digital Library: A Platform that Makes Digital Piracy Unnecessary, Funds Creators, and Makes eBooks, Games and Software Affordable

There is no reason why we can’t make a perfectly legal, and better, alternative to platforms like Popcorn Time

In my previous essay Why Digital Piracy is Ethical and Necessary I discussed why there are no proper digital libraries: publishers pretend that digital goods cannot be sold. They demand continuous rents for digital products they give to libraries, making things like ebooks costlier (and for more difficult to lend due to various licensing clauses) than printed books. In this essay I will discuss an alternative model for digital libraries that will accomplish the following:

  • It will accomplish everything the digital piracy scene currently accomplishes: providing a very low-cost method of conveniently accessing digital products.
  • It will help break the power of the publishers by bypassing them: the library becomes an alternative platform where creators can offer their products for “sale” (as will be explained).
  • It will help create an open alternative to the “walled garden” approaches of Steam and Kindle Unlimited.
  • It will help support creators by creating a highly convenient method for people from around the world to pool their funds in order to buy the products they need.

This is how the Universal Digital Library works: When the Library buys a copy of a digital product (we will use the example of an ebook), it buys the right to lend out one copy of this ebook to one user at a time for two weeks. If two library users want to access the same ebook at the same time, the Library pays for a second copy of the ebook to lend out to the second user. Once two weeks are over, the ebook is “returned”, meaning that it is deleted from the user’s computer by the Library program. Once it is returned, the ebook can be lent out again to another user.

In this way, the Universal Digital Library recreates the way a traditional, real-world library works. It treats digital goods exactly like physical goods. An ebook is just like a print book: the Library has to acquire one copy for each user. If there is a bestseller that thousands of people want to read at the same time, the Library will need to pay for thousands of copies of that book if it wants every user to read it immediately. If the Library cannot afford to pay for thousands of copies, users will need to join waiting lists as in a real library.

This creates an interesting economic effect: a digital product can only sell as many copies as there are people who want to use it simultaneously. If the maximum number of Library members who want to read your ebook is 1000 at the ebook’s most popular phase, and if the Library buys 1000 copies to satisfy all members, from then on the sales of the ebook will drop to zero since every member that comes afterwards will have access to one of those 1000 copies to borrow (once the members start “returning” them).

This, of course, means that ebook creators will have to price their ebooks very high in order to make a profit, since the Library gobbles all the copies it needs until it stops buying. And that is fine, as I discuss below.

Major Features of the Library

A Self-Publishing and Fundraising Platform for Digital Creators

The Library will have a self-serve system for ebook creators, video game makers, software makers, filmmakers and the creators of all other kinds of sell-able and lend-able digital products. If you write ebooks, you can upload the book to the library, set your price, then let the users start borrowing it. The Library will have a pool of money that it uses to buy copies of products that users borrow. The Library will need an algorithm to decide when to buy books: it will take into account the demand for it and the book’s sale price. If Stephen King wants to put his latest book on the Library, he can price each copy at $1,000 USD. For every Library member who joins the waiting list for that book, the Library assigns a certain portion of funds to buying a copy. In order to reward more affordably priced products, the Library can use the following algorithm to decide how much funds to allocate for buying each product:

for each member on the waiting list, during each funding round, assign this amount in dollars to the book's buying fund: 1 / square root of the sale price

This algorithm is designed to reward affordably priced products: the amount of funds assigned to each product decreases the higher its price is

So if a book is priced at $1,000, 1 over its square root is 1/31.6, or $0.03. This means that for every member who joins the waiting list for Stephen King’s book, the Library assigns $0.03 to buying it during each funding round. A funding round could be a daily thing: every day the Library distributes all its income (from donations and subscription fees) over all products on members’ waiting lists. So if there are 100,000 members on Stephen King’s book’s waiting list, that means 300,000 cents will be assigned to its buying fund per day, meaning $3000 per day. This means that the Library acquires three new copies of the book every day. Members will also be able to donate specifically to buying a certain product. So those 100,000 members on the waiting list may donate thousands of dollars daily to acquire more copies. In this way, the Library enables it members to pool their resources to acquire the products they want (if you wonder why anyone would want to donate, read on).

King may realize that he can make money faster by lowering the price. If he prices the book at $250 instead, that would mean $0.06 per user on the waiting list, amounting to $6000 per day. But that $6000 will now buy 24 copies every day. Within a month the Library will have 720 copies of the book. If King prices the book at only $10, the Library will pay out $31,000 per day, amounting to 3,100 copies bought per day. Within a month it will acquire about 100,000 copies, pay out about $1 million to King, and stop buying the book altogether since all possible demand is now met.

But when it comes to non-bestselling writers, they will have to price their books lower in order to make sales, since the waiting list for the book will be much shorter. Let’s say you write an ebook on repairing cars. You can upload the ebook to the Library and price it at $100. For each member who joins the book’s waiting list, 1/10 USD, or $0.10, will be assigned per day to its buying fund. Since the Library serves the entire world, 1000 people may simultaneously want to borrow the book at any one time, meaning that eventually the writer may sell $100,000 worth of the book. Each day the Library will assign $.10 USD for each member on the book’s waiting list, which equals $100 per day. The writer earns $100 per day for that ebook every day, and the Library acquires one new copy every day (since each copy costs $100). Eventually a point of equilibrium is reached where anyone can read the book without having to join a waiting list since the Library ends up having so many copies of it.

The Viable Photoshop Alternative

The Universal Library will not be for ebooks alone. It can also host anything else that can be sold digitally, such as software. The existence of the Library will actually encourage the creation of a wholly new ecosystem for software. A company may develop a Photoshop alternative, let’s call it Imageshop, and place it on the Library for $1000. The Library will have to acquire one copy of this software for each member who wants to use it. If the software is good enough, it would be no surprise of 100,000 people from around the world have a need for it simultaneously within a two-week period. And that means $100 million worth of copies that the Library will need to acquire in order to satisfy the demand.

Many companies may try to develop Photoshop alternatives to upload to the Library, and the ones that are priced cheaper will be funded more quickly due to the funding algorithm–provided that there is sufficiently high demand for it.

The way the Library will work on the client-side will be like Steam. Library members will “borrow” a piece of software, say Imageshop, which will be installed on their device for two weeks. Once the borrowing period is over, the Library program disables the software unless the Library member can renew their borrow and there is no waiting list. If there is a waiting list, the software may be disabled without being uninstalled until the borrow can be renewed. A member may also be allowed to renew their borrow by making a small donation which would cause them to jump to the top of the waiting list.

A Digital Sales Platform for Indie Films

If you want to make an independent film and sell it on the Internet, your options are limited to a few major companies that will demand a major share of any revenues. The Library can act as an independent movie publishing platform: Filmmakers upload their films to the Library and set a price. Similar to ebooks, high-demand films can set prices like $1000 and expect to make millions of dollars through the Library. Lower-demand films can set lower prices.

A Democratic Steam Alternative

Steam on my Linux desktop

Steam is Valve Corporation’s famous platform for buying and installing video games. Steam continues the anti-consumer traditions of the publishing industry but maintains a major user base due to its many convenient features. The Library can function as a Steam alternative: just like in the case for software, users can borrow games and play them for two weeks on their machines. The Library can function as a funding platform for independent video game companies: they can upload their game, set a price, and let the Library members decide (through joining the waiting list) how much the Library will spend on acquiring copies of it.

Ending Apple and Google’s App Store Walled Gardens of Garbage

Apple and Google’s approach to smartphone apps is “we and the publishers extracting every penny that can be extracted from consumers.” Google especially has made one of the most unusable app stores in its attempt to control which apps users buy. The Library can function as an app borrowing store where the same economics as those for other software will be at play.

Ending the Absurdity of Scientific Paper Pricing

How would you like to pay $15 to read a single article?

Today reading a 20-page scientific paper often costs $30 or more, making them unaffordable to independent researchers and encouraging the use of pirate platforms like Sci-Hub. The Universal Digital Library can democratize the scientific publishing world and allow researchers to pool their funds for convenient and low-cost access. Similar to ebooks, papers can be priced according to demand. A newly published paper that thousands of people will be interested in reading at the same time can be priced at $100 so that it earns about $100 per day from the Library. Lower-demand papers can be priced at $30 and still make thousands of dollars for its creators.

Ending Publisher Gatekeeping and Walled Garden Behavior

The promotional home page for Amazon’s rather limited Kindle Unlimited platform

The Library can act as a worldwide publisher that connects creators with consumers, making publishers unnecessary. Platforms like Kindle Unlimited are somewhat nice for reading books, but they are still extremely handicapped and consumer-unfriendly:

  • Amazon and publishers together decide what books to place on the platform. Users have no voice.
  • Amazon can arbitrarily remove any book it wants from its platform
  • Paying $10 a month to read a limited selection of books does not make sense unless you are the ideal Platonic consumer who only reads what major publishers dump on them (there is also a large selection of mostly sub-par works by unknown writers).

The Universal Digital Library will be the common-sense alternative to Kindle Unlimited. It will cost much less, it will break the power of publishers and middle men like Amazon, it will empower creators, and it will empower consumers by offering them full-featured versions of the products rather than highly stripped down and limited versions. Amazon’s Kindle Cloud Reader does not allow me to copy a single sentence from books I’m reading.

Kindle Unlimited is about turning ebooks into cable TV: Amazon and its friends get to decide what you can read and how you can read it.

If like me you are interested in making the world a better place through long-term-oriented projects, then you will see the Universal Digital Library as the wholesome, pro-humanity, creator-friendly and consumer-friendly alternative to absurd walled gardens like Kindle Unlimited.

The Two-Week Borrowing Period

I made a few mentions of a two-week borrowing period above. Such a period will have to be enforced just like in a physical library in order to allow members to have the time to use the digital products to their hearts’ content. The two-week borrowing period is also very important for creators since it decides how many copies of each product the Library will need. Since we are trying to recreate a physical Library in digital space, a two-week period seems sensible. However, just like in a physical library, users will be able to “return” their copies prior to the expiry of their borrow period.

How the Library Gets Funded

The Library will get funded through donations and possibly a low monthly subscription fee. The goal of the Library should be to make digital products accessible to those who cannot pay for them the ordinary way, so a free subscription plan may also be offered. The Library may also earn money through advertisements by recommending products to members, although the non-democratic nature of this always makes it a questionable practice. But if ads are necessary for the Library to exist or can make a significant contribution to improving it, then I believe they are justifiable.

 

We Can Make This Right Now

The Universal Digital Library does not have to wait for any breakthrough or legal change. It can be created right now. It will of course need to invite creators to upload their content according to the Library’s terms:

  • One copy for each simultaneous user.
  • The Library keeps the copy forever. Once it buys one copy of Imageshop, it is exactly the same as a physical library buying a physical book. The publisher has no right to demand it back.
  • The Library has the right to infinitely copy each product while paying the full price for each copy.

A single talented programmer will actually be able to build the entire platform. This is something I have thought about doing, but my other projects have so far prevented me.

On DRM

The most difficult part will be implementing DRM (digital rights management) to prevent easily copying and sharing of the content of the Library by unfriendly actors. Now, the Library must take a common-sense approach to this problem: There is no way to prevent all piracy. There should be a minimum DRM that prevents casual users from sharing the Library’s contents illegitimately, but the DRM should not make the digital products less useful. Users should have access to proper PDF versions of books.

At the beginning the Library can function without any DRM. It will be like existing digital libraries like the pirate-made Popcorn Time. If creators can be convinced to upload their digital products without the existence of DRM, then that would be the best solution. DRM is largely about giving creators a false sense of security since users intent on piracy can always find a way. Using a few free and open source Linux tools a person could easily–within just a few minutes–copy the entire contents of a Kindle ebook and turn it into a PDF using Kindle’s Cloud Reader website. There is nothing Amazon can do about this.

The Library makes piracy largely unnecessary, so it is almost entirely a waste of efforts for it to worry about making piracy impossible. The Library’s program on my computer should be like Steam: it should be so convenient to use, and so powerful and rich, that I never have to think about pirating anything.

IslamQA: Is it sinful in Islam to not love your parent?

Assalamu Aleikum, i have a question on which i always get mixed answers, is it haram for a person not to have love towards a parent as long as we dont disrespect them? I don’t have a relationship with my father at all and although it used to make me sad it doesn’t anymore because i’ve grown and accepted it. I’m mature enough to ignore his hateful behavior and ideas, he’s a difficult man for many reasons, is it bad that I don’t want him involed in my life without completely cutting him off?

Alaikumassalam wa rahmatullah,

The reason you get different answers is that people have different underlying assumptions. Those who have had great fathers find it unimaginable that one should not love their father, so they think of it as a character flaw.

At any rate, your father’s rights upon you are all material, not emotional. You have no duty to love him, but you have a duty to be charitable toward him, to care about his welfare, to treat him with respect and to not treat him like a stranger. These are all material duties and can be carried out whether you feel love toward him or not. It is actually a greater act of virtue to carry out your duties toward a parent when their personality makes it difficult to love them. It means these acts are done purely out of a sense of moral duty. When you have to force yourself to be kind and generous toward someone that requires a greater effort and sacrifice and therefore comes with an equally great reward.

Bad parents are a test like everything else in life and they are an opportunity for you to prove your virtue to God by doing what is good and right and kind regardless of how you feel and regardless of whether they deserve it.

If you can avoid them without making them feel bad or making them feel excluded (perhaps they do not care anyway), then that is fine. But if excluding them from something is likely to make them feel bad (such as not inviting them to a party), then it is better to invite them and suffer their presence.

As a human you have as much dignity as your parents and you are not required to sacrifice yourself for them. But by sacrificing some of your comfort and happiness for their sake every now and then you will prove your virtue and gain God’s rewards. A person who sacrifices their comfort to care for a sick parent even though they dislike it will invariably have other parts of their lives made easy and blessed for them: God may make their business prosper so that they have all the money they need while they care for the parent.

As a rule, whenever you make part of your life difficult for God’s sake, God will make other parts of your life easy for you.

HTML, CSS & JavaScript for Complete Beginners Code Examples

var text = 
    'And this is Dorlcote Mill. I must '
  + 'stand a minute or two here on the bridge '
  + 'and look at it, though the clouds are '
  + 'threatening, and it is far on in the afternoon. '
  + 'Even in this leafless time of departing February '
  + 'it is pleasant to look at,–perhaps the chill, '
  + 'damp season adds a charm to the trimly kept, '
  + 'comfortable dwelling-house, as old as the elms '
  + 'and chestnuts that shelter it from the '
  + 'northern blast. ';
  
var text_analyzer = {
    current_text : text,
    get_words_array : function() {
        var text = this.current_text;
        var split_text = text.split(' ');
        return split_text;
    },
    count_words : function() {
        var words_array = this.get_words_array();
        var length = words_array.length;
        return length;
    },
    get_average_word_length : function() {
      var all_word_lengths = 0;
      var words_array = this.get_words_array();
      for(var i in words_array) {
          var current_word = words_array[i];
          all_word_lengths = all_word_lengths +
              current_word.length;
      }
      return all_word_lengths / words_array.length;
    },
    get_longest_word : function() {
        var longest_length_seen_so_far = 0;
        var longest_word = '';
        var words_array = this.get_words_array();
        for(var i in words_array) {
            var current_word = words_array[i];
            if(current_word.length > 
                longest_length_seen_so_far) {
                longest_word = current_word;
                longest_length_seen_so_far =
                    current_word.length;
            }
        }
        return longest_word;
    },
    get_word_frequencies : function() {
        var words_array = this.get_words_array();
        var word_frequencies = {};
        for(var i in words_array) {
            var current_word = words_array[i];
            if(! (current_word in word_frequencies)) {
                word_frequencies[current_word] = 1;
            }
            else {
                var previous_frequency = 
                    word_frequencies[current_word];
                var new_frequency = previous_frequency
                    + 1;
                word_frequencies[current_word] =
                    new_frequency;
            }
        }
        return word_frequencies;
    },
};

function print_object(the_object) {
    document.write('{
'); for(var i in the_object) { var key = i; var value = the_object[i]; document.write('"' + key + '"'); document.write(' : '); if(Array.isArray(value)) { print_array(value); } else if(typeof value === 'object') { print_object(value); } else { document.write(value); } document.write('
'); } document.write('}
'); } function print_array(the_array) { document.write('[
'); for(var i in the_array) { var value = the_array[i]; if(Array.isArray(value)) { print_array(value); } else if(typeof value === 'object') { print_object(value); } else { document.write(value + ','); } } document.write(']
'); } document.write(text_analyzer.get_word_frequencies()['on']);

Chapter 12 “Program” starting code:


 
 
 
 
 
 

Chapter 12 four rectangles example. Remove the lines that say “remove this line” otherwise the code will not work.



Rectangle 1
Rectangle 2
Rectangle 3
Rectangle 4

Chapter 13 cookie-related code:

Who that cares much to know the history of man, and how the mysterious mixture behaves under the varying experiments of Time, has not dwelt, at least briefly, on the life of Saint Theresa, has not smiled with some gentleness at the thought of the little girl walking forth one morning hand-in-hand with her still smaller brother, to go and seek martyrdom in the country of the Moors?

+ Increase size
- Decrease size

Chapter 24 Reading Journal example (live demo)


My Reading Journal

  • Rebecca Stott, Darwin’s Ghosts: The Secret History of Evolution 2012
  • David W. Deamer, First Life: Discovering the Connections Between Stars, Cells, and How Life Began 2011
  • Alister E. McGrath, Dawkins’ God: From The Selfish Gene to The God Delusion 2015

IslamQA: Making wudu with nail polish: Is it the same as masḥ (wiping over socks)?

With regards to the impermissibility of nail polish due to wudu, can't the concept of masah be applicable to wearing nail polish as well? Doesn't it have the same logic?

Legally ablution by wiping over socks (al-masḥ ʿala l-khuffayn) is a highly specific exception designed to help travelers avoid having to take off their socks. It can only be maintained for three days before having to take off the socks to make ordinary ablution. We can make use of analogy (qiyās) to say that wiping moist hands over nail polish is similar to wiping moist hands over socks if a person takes off the nail polish after three days. The problem is that this is a far-fetched analogy. The vast majority of devout Muslims would not be satisfied with it. The masḥ exception appears to be specific to that case and appears to not have been meant to be extended by analogy to other cases.

I respect minority opinions so if there is one mainstream scholar that says exceptions can be made for nail polish then I would respect their opinion and those who follow it, although personally I would continue to support the majority opinion. But I have looked and have not found anyone who disagrees with the opinion that nail polish nullifies ablution.

Hopefully one day someone will invent a type of nail polish that makes it possible to make ablution while wearing it. I should mention that what is currently marketed as “halal” nail polish is likely not halal (see: Is “halal” nail polish really halal?).

The Quran and the Shape of the Earth: Is It Round or Flat?

There is some propaganda on the Internet about the Quran suggesting the earth is flat. They do not mention that respected and highly orthodox Islamic scholars like Ibn al-Jawzi, Ibn Taymiyya and Ibn al-Qayyim all believed the earth to be round. They also refer to a fatwa by Ibn Baaz (a follower of Wahhabism, a version of Islam probably followed by less than 1% of the world’s Muslims) who said that no Muslim has the right to say that the earth is round. To anti-Islam propagandists the opinion and thinking of 99% of Muslims can be dismissed in favor of the fringe 1% since it helps validate their prejudices against Islam when they can focus only on the most negative examples of Muslims they can find.

Sheikh Yasir Qadhi writes:

I was in a discussion yesterday with a young Muslim struggling with his faith. He mentioned that he had read from sources critical to Islam that the Quran clearly contradicts known facts and represents the world-view of its time (7th century CE). And of the most blatant examples, according to him, was that the Quran clearly preaches that the world is flat. Now, I have said and firmly believe that the genre of 'scientific miracles in the Quran' that we all grew up reading is in fact a dangerous genre, because it reads in 'facts' where no such facts exist, and because it posits one's faith on a purely scientific basis (so that when 'science', which is ever-evolving, might seem to contradict the Quran, this will lead to a weakness of faith). Nonetheless, to claim that the Quran preaches that the world is flat is an outrageous claim. In fact there is unanimous consensus amongst medieval Muslim scholars to the contrary.

Ibn Hazm (d. 1064 CE), wrote over a thousand years ago in his book al-Fisal, "I do not know of a single scholar worth the title of scholar who claims other than that the earth is round. Indeed the evidences in the Quran and Sunnah are numerous to this effect" [al-Fisal, v. 2 p. 78].

Ibn Taymiyya (d. 1328 CE), someone who is typically accused of literalism, wrote that there is unanimous consensus of all the scholars of Islam that the world is round, and that reality and perception also proves this, for, as he writes, it is well known that the Sun sets on different peoples at different times, and does not set on the whole world at the same time. In fact, writes Ibn Taymiyya, it is truly an ignorant person who claims that the earth is not round. [Majmu al-Fatawa, v. 6, p. 586]. And there are many others scholars, such as al-Razi, who wrote on this subject, and I do not know of any medieval scholar who held another view.

It is true that most of the Quranic verses on this issue are vague; there is no strong proof one way or another. There are verses like the following which could be referring to a flat earth or they may just be using literary language to speak of God’s active and highly thoughtful and considerate involvement in the design of the earth for the specific benefit of humans:

15:19 And the earth We have spread out (like a carpet); set thereon mountains firm and immovable; and produced therein all kinds of things in due balance.

20:53 He Who has, made for you the earth like a carpet spread out; has enabled you to go about therein by roads (and channels); and has sent down water from the sky.” With it have We produced diverse pairs of plants each separate from the others.

43:10 (Yea, the same that) has made for you the earth (like a carpet) spread out, and has made for you roads (and channels) therein, in order that ye may find guidance (on the way);

50:7 And the earth- We have spread it out, and set thereon mountains standing firm, and produced therein every kind of beautiful growth (in pairs)

The Quran says:

"He created the heavens and the earth in true (proportions): He wraps the night up in the day, and wraps the day up in the night." (Surah az-Zumar 5)

The word used for “wrap” is kawwara, which is used in Arabic to refer to wrapping something around a spherical thing, such as wrapping a turban around the head. The Arabic word for ball is kura, from the same root. In Arabic all words belonging to the same root have a similar theme to them; when the Quran says the night is wrapped around the day and uses kawwara, this creates the image of darkness overcoming a spherical thing in the mind. It is extremely silly to say there is no suggestion of the earth’s roundness in this verse.

The Quran also uses daḥāhā (”he threw it in a rolling motion”) in verse 79:30  to refer to God creating earth in space. The Meccan children used to play a game with stones similar to marbles that they called al-madāḥi (from the same root as daḥāhā). The root of this word brings up the image of a stone rolling, which is again in consonance with a round earth.

In another place, 41:11, it speaks of interstellar dust gathering to form the earth. It also speaks of the expansion of the universe:

We constructed the universe through power, and We are expanding it. (Verse 51:47)

A fair-minded reader of the Quran will find in it some incredibly suggestive hints toward its truth (such as the strange mention of the expansion of the universe) while not finding anything in it that clearly and unequivocally says the earth is flat. A person who starts out by thinking the earth is flat can certainly re-interpret everything in the Quran to make it support their theory. But such a person’s opinion stands against the opinion of the vast majority of scholars, who also studied the Quran and found it to support a round earth theory.

The flat earth issue in Islam is therefore made up of a fringe group of Islamic scholars, atheists and anti-Islam propagandists saying the earth is flat, and 99% of the world’s Muslims since the Middle Ages saying the earth is round.

IslamQA: What is there to do if you suffer because someone you love is far away from God?

Assalamualaikum... what should I do if I care so much about someone’s relationship with Allah ‪ﷻ‬ that it brings me depression because that someone is too far away from Him? I’m trying to help but I can’t, and I can’t bear this sadness either. Should I keep trying or should I take a step back? I can try again because that someone means a lot to me, but it affects my whole mood... i don’t know what to do. Jazakum Allah khairan

Alaikumassalam wa rahmatullah,

That is a difficult situation to be in and sadly there is no solution besides being patient. The Prophet PBUH sometimes strongly desired for someone to become a believer, but the Quran always reminded him that guidance was up to God:

You cannot guide whom you love, but God guides whom He wills, and He knows best those who are guided. (The Quran, verse 28:56)

Perhaps you may destroy yourself with grief, chasing after them, if they do not believe in this information. (The Quran, verse 18:6)

3. Perhaps you will destroy yourself with grief, because they do not become believers.4. If We will it, We can send down upon them a sign from heaven, at which their necks will stay bent in humility. (The Quran, verse 26:4)

Being attached to the idea of a person becoming a better believer is like any other worldly attachment. It is only through remembering God and attaching ourselves to Him that our attachment to the worldly life is weakened. So when it comes to anything that gives you suffering in this life, even if it is the desire for someone to become a better Muslim, the way to reduce this suffering is to get closer to God. The closer you feel to Him, the easier it is to deal with life’s difficulties because they lose their power over us. I recommend spend an extra hour every night in tahajjud to everyone who wishes to feel constantly close to God. Check out my essay Mysticism without Sufism: A Guide to Tahajjud, Islam’s Meditation Practice.

Doing things with the specific purpose of causing someone to become a better Muslim can actually backfire. It will likely be considered insulting by the person, because they want freely choose their own course in life. They do not want someone else to force them to have a specific course. For this reason I recommend that you focus on your own faith and do not pressure them at all to change. The best way to influence others to become better is to be an extraordinary example yourself. If people see in you extraordinary kindness, generosity, selflessness and acceptance toward others, and if they also see that you are dedicated to your faith and perform much extra worship, then these can strongly encourage them to emulate you.

Ideally, it is best not to attach our hearts to anyone becoming better, because there is no guarantee that it will ever happen. It is much better to attach our hearts to God and leave it to God to guide people if and when He wants.

IslamQA: Is it permissible for a man to marry if he needs his wife’s and relatives’ financial help?

Assalaamu 'Alaikum, In cities and towns with ridiculously high rent and living costs, young Muslim men are doomed. Apparently they're not allowed to marry if they cannot fully financially support the wife? If that's true, then how would one reconcile him now being exposed to immense fitnah (since they may have a women they love for marriage but dont financially qualify for nikah)? What if the couples' parents are willing to support the couple until the man can move out and provide for his wife?

Alaikumassalam wa rahmatullah,

The requirement that you should be able to support a wife means that legally she is entitled to sue you in court if you do not provide for her. But this does not mean that you cannot reach alternative arrangements with her as long as it is consensual. If she is willing to work to contribute financially to the marriage of her own free will temporarily until you can get a better job or a promotion, then she can do that and Islam does not prohibit it. In such a case her contributions would be legally considered charity from her to you, since it is not her legal obligation. But realistically since she is contributing to the good of both of you, in order to attain something both of you desire, it is not mere charity. But the law requires to define things , so according to the law it is charity. She can also give the money as a loan to you that you write down and pay back later in life, some men may prefer an arrangement like this. And in some cultures it is very common and natural for a woman to work and contribute to family finances without considering it an act of charity or a loan, and that is fine. If she is happy with such an arrangement then that satisfies Islamic law.

And if you need your parents’ help to make ends meet, then that is fine too as long as this is agreed upon by everyone involved.

When it comes to marriage, Islamic law only defines what you can sue your spouse for in court. It does not prohibit you from using your common sense and conscience to do what works better for the two of you as long as no duplicity or force or oppression is involved.

IslamQA: A woman’s prayer is still valid if part of her hair is unintentionally uncovered

The prayer is still valid and does not have to be redone.

According to Ibn Taymīya the prayer is only nullified if two conditions are true: if a highly inappropriate amount of the ʿawra (the part of the body that must be kept covered during prayer) is shown, and if that goes on for a long time (for the duration of the prayer or for most of it). Since a little hair is not a highly inappropriate amount, the first condition is not satisfied, so the prayer is still valid.

According to the Jordanian fatwa authority (representing the Shāfiʿī school, which is very strict in such matters), if the uncovered area is not immediately covered, the prayer is nullified.

According to the Egyptian fatwa authority (generally representing the opinions of the scholars of Al-Azhar University) the prayer is still valid as long as the area shown is not too much and as long as it is not out of gross negligence.

A fatwa on IslamWeb (managed by Qatar’s fatwa authority) dealing specifically with the issue of a woman unintentionally having some of her hair out during the prayer rules that it does not nullify the prayer even if it goes on for “a long time”, meaning for the duration of the whole prayer.

References (all in Arabic): Ibn Taymīya’s opinion | The Jordanian fatwa | The Egyptian fatwa | The Qatari fatwa

IslamQA: Can faith in God help you succeed in your studies even if you do not study enough?

Assalamualaikum,is it possible if someone has studied hard but probably not enough,but has full faith towards Allah to be a successful person?

Alaikumassalam wa rahmatullah,

Even if you do all the right things to be successful, “chance” or God’s decree (qadar) can make you unsuccessful. And even if you get everything wrong, God can still give you success. This is known as fatalism, the belief that nothing you do matters because you are not in charge anyway.

Islam’s view is not fatalism but what might be called dynamism. All of life is a conversation between you and God. You do something, God responds with something. You exert your sincere effort, God adds His own power and facilitation to it so that you end up being successful even though your effort wasn’t exactly enough. God is your rabb (master and mentor) who does not merely lord it over you asking you to do things for Him. He mentors you by constantly offering you choices and seeing what you do. If you live up to the highest ideals that He teaches you, He will reward you by raising your station in life and giving you a blessed and meaningful life.

So you are required to do your best while relying on God to help you whenever you fall short.

IslamQA: Dealing with missing someone after a breakup

Assalamualaikum,what do we do when we miss someone so dearly,It just literally kills us on the inside,I wanted him to make me halal but he rejected me in a kind way

Alaikumassalam wa rahmatullah,

Tragic life events such as breaking up with someone we love will invariably cause us to suffer. There is no way to avoid this suffering. It is a fact of human life that what brings us joy can also bring us great suffering. As believers, when faced with any hardship in life, we seek cures through spiritual or through material means. The best way is to try to combine both. Spiritually, by staying close to God and putting your focus on Him, the concerns of the worldly life will start to feel less important. I recommend dedicating an extra hour every day to worship to those who wish to always stay close to God. Closeness to God is something that requires daily work. Every day the life of this world takes us away from God and every day we must work to go back to Him through our worship. See my essay Mysticism without Sufism on the type of extra worship I recommend.

As for the material side, the best way to get over a breakup (assuming reconciliation is not possible) is to be in a new relationship. Of course this can be very difficult to consider when you are still in love with that person. All of us have an empty place in our hearts that is filled with the person we love, and when that person is taken away from us, we will continue to suffer feelings of loss until that empty place is filled again with something or someone else. A small number of people are able to use their loss to elevate them spiritually so that God starts to fill that place for them. But the majority of people are not able to achieve that and require the love of a new person to fill that place for them.

For that reason, difficult as it may be to consider, I recommend that you seriously consider a new relationship. Humans are designed to fall in love with any reasonably kind and attractive person of the opposite sex that they happen to interact with a lot, so if there are any decent men interested in marrying you then you should consider them. If you are both spiritual and kind to each other then it will be extremely difficult not to fall in love with each other sooner or later. This is what I have seen everywhere in the Middle East. Couples of the older generation often had their marriages arranged for them, yet the spiritual among them are almost all deeply in love with their spouses. And I don’t see how it can be otherwise. Men and women who have open hearts find it very easy to fall in love since their hearts are not blocked by hatred, selfishness or egotism. The purity of their souls makes them assume the best about their spouses and makes them love them for who they are rather than loving them only for how they make them feel, and in this way the constantly fall in love with each over and over again.

To summarize, the spiritual solution is get closer to God, and the material solution is to find someone new to love. If you remain single then it will be very difficult to get over that person. It will not be impossible, but it will require that you exert immense efforts at filling up that empty place with love for God and with focus on other things (such as your family). But a new relationship can make things very easy for you provided that you and the new person are both spiritual and do not set overly high expectations of each other.

Best wishes inshaAllah.

JavaScript for Complete Beginners Code Examples

var text = 
    'And this is Dorlcote Mill. I must '
  + 'stand a minute or two here on the bridge '
  + 'and look at it, though the clouds are '
  + 'threatening, and it is far on in the afternoon. '
  + 'Even in this leafless time of departing February '
  + 'it is pleasant to look at,–perhaps the chill, '
  + 'damp season adds a charm to the trimly kept, '
  + 'comfortable dwelling-house, as old as the elms '
  + 'and chestnuts that shelter it from the '
  + 'northern blast. ';
  
var text_analyzer = {
    current_text : text,
    get_words_array : function() {
        var text = this.current_text;
        var split_text = text.split(' ');
        return split_text;
    },
    count_words : function() {
        var words_array = this.get_words_array();
        var length = words_array.length;
        return length;
    },
    get_average_word_length : function() {
      var all_word_lengths = 0;
      var words_array = this.get_words_array();
      for(var i in words_array) {
          var current_word = words_array[i];
          all_word_lengths = all_word_lengths +
              current_word.length;
      }
      return all_word_lengths / words_array.length;
    },
    get_longest_word : function() {
        var longest_length_seen_so_far = 0;
        var longest_word = '';
        var words_array = this.get_words_array();
        for(var i in words_array) {
            var current_word = words_array[i];
            if(current_word.length > 
                longest_length_seen_so_far) {
                longest_word = current_word;
                longest_length_seen_so_far =
                    current_word.length;
            }
        }
        return longest_word;
    },
    get_word_frequencies : function() {
        var words_array = this.get_words_array();
        var word_frequencies = {};
        for(var i in words_array) {
            var current_word = words_array[i];
            if(! (current_word in word_frequencies)) {
                word_frequencies[current_word] = 1;
            }
            else {
                var previous_frequency = 
                    word_frequencies[current_word];
                var new_frequency = previous_frequency
                    + 1;
                word_frequencies[current_word] =
                    new_frequency;
            }
        }
        return word_frequencies;
    },
};

function print_object(the_object) {
    document.write('{
'); for(var i in the_object) { var key = i; var value = the_object[i]; document.write('"' + key + '"'); document.write(' : '); if(Array.isArray(value)) { print_array(value); } else if(typeof value === 'object') { print_object(value); } else { document.write(value); } document.write('
'); } document.write('}
'); } function print_array(the_array) { document.write('[
'); for(var i in the_array) { var value = the_array[i]; if(Array.isArray(value)) { print_array(value); } else if(typeof value === 'object') { print_object(value); } else { document.write(value + ','); } } document.write(']
'); } document.write(text_analyzer.get_word_frequencies()['on']);

Chapter 12 “Program” starting code:


 
 
 
 
 
 

Chapter 12 four rectangles example. Remove the lines that say “remove this line” otherwise the code will not work.



Rectangle 1
Rectangle 2
Rectangle 3
Rectangle 4

Chapter 13 cookie-related code:

Who that cares much to know the history of man, and how the mysterious mixture behaves under the varying experiments of Time, has not dwelt, at least briefly, on the life of Saint Theresa, has not smiled with some gentleness at the thought of the little girl walking forth one morning hand-in-hand with her still smaller brother, to go and seek martyrdom in the country of the Moors?

+ Increase size
- Decrease size