When you speak publicly, as often as I am unfortunately charged with doing, the subject matter of lectures can become very repetitive. Topics can become cliche. And that can result in a very real challenge of either speaking in a way that is disinterested, meaning that you're speaking in a way that is not, you're not interested in the topic, or can force the speaker to talk, to make themselves feel enthusiastic about a topic that might otherwise not be, may not excite them. This evening's topic is one that I have spoken about before. And for a couple of reasons, it captured me from the moment that I found out I was going to be speaking about it first. The first reason for that is upon arrival, Mohammad Nasser pulled me aside. And as soon as the gates opened at the airport here in Singapore, he says to me, we have a crisis. And in my country, crisis is a very loaded word. So I was worried. I said, Habib is not coming, is he? And then I saw the golden arches in front of me, McDonald's. He said, come sit down. And so I knew something was really serious news. So he wouldn't answer me. But I said, Habib isn't coming. Now, like all of you, I was very excited to see Habib Ahmad Hafidullah this evening. And that's actually why I'm in Singapore. I'm here because I believe that Habib Omar was going to be here. And like all of you, I am both disappointed in his absence. But also, I had a moment before talking about this idea of understanding God's plan, I had a moment to be able to really reflect upon this idea. You travel from California to Singapore. Let's just say it's not exactly a short trip. It's a fairly lengthy trip. And you come here because you want to see somebody. And then you find out that that individual who you want to see is not going to be there. So then you have to ask a question, well, who willed this? Who's the one who decreed that he would not be here? And you understand that it's Allah.  Asa and takrahuhu shaytan wahuhu wa khayruan lakum. Perhaps you dislike a thing, and it is good for you. And then I reflected, and I said, subhanallah, I planned for several months to be here and traveled all this way. And for some reason, bifadli-lahi ta'ala, I wasn't that bothered. I wasn't as disturbed as I probably otherwise would have been. And I was thankful to Allah for that. I said, alhamdulillah, mashallah. He's not here, it's okay. There are other noble people to benefit from, and there's a beloved community here to see. But then I reflected at an even deeper level and said, what is it that we are even thinking about ourselves? What is it that we are even thinking about how I feel about it when my teacher lost his uncle? How absurd is it that I'm even thinking about me at all? When somebody who I claim to love is in a situation where they have lost their beloved? Look how selfish we are. May Allah forgive us. May Allah forgive us. And then I thought to myself, subhanallah, we expect so much from our teachers, so much from our leaders, so much from our mashayikh. And we have gone to the blame or the extent of almost treating them like they're entertainers. Almost treating them like they're there to serve us. Almost measuring the value of what they give us by how it makes us feel and how excited we may have been when in reality the question is about how much we benefit from what they are teaching us. So I got to think about this, understanding Allah's plan. And then I remember the saying of one of the knowers of Allah who said, I did not come into realize knowledge of God except through my resolves not being fulfilled. Meaning what? Every time I went to do something, it didn't happen. I planned and I did everything according to plan but then when it went for the thing to happen, it didn't happen. And modern people don't like that very much. They don't like that. What do you mean? All the ducks were in a row. All the teased were across. All the eyes were dotted. All the right relationships were built. I set 14 different alarms on my iPhone. Told my wife to wake me up and I still didn't get there on time. Subhanallah. Knew all of the right people was in the right place at the right time wearing the right thing. And it still didn't happen the way I wanted it to happen. Why? Because Allah is helping you to get to know him through knowing yourself and knowing that you may plan to do something but it's not going to happen the way that you want it to happen. And then Nasser began to talk to me about the event. You know, Muslims, we have events and we plan for events and a lot of work goes into it. And he said, some people may want a refund. I said, well, don't tell them I'm coming because they're really gonna want a refund if you tell them I'm coming.  But I said not in Singapore, Alhamdulillah. The Muslims here, Alhamdulillah, they have big hearts and they're generous people. And not only should we not want a refund but I would say we should be willing to pay double what we may have paid to get here to support simply Islam and the great work that they're doing and the great work that other organizations are doing. And he did not ask me to say that. May Allah Ta'ala reward you abundantly for that. The second reason this topic captured me is because like all of you, I'm on a journey. I am on a journey to try to know myself, to try to understand the world around me and through that to try to understand reality and to know my creator, Subhanahu wa Ta'ala. And everybody's journey is different. A husband and a wife, they live in the same home but the husband and the wife have a unique journey. A parent and a child, they live in the same home but the parent and the child, they're still on a unique journey to their Lord. Two best friends. If you take the two best friends in the world, they may spend all day together but they're still on a unique journey toward eternity and a unique journey to try to come to know their Lord. So as we reflect upon this topic this evening, let us do so within that context. Let us think about it in terms of how it relates to ourselves first and foremost because that's the most important thing. Not to think about how it relates to other people and whether or not they understand God's plan but how much we actually understand it as individuals and through that, inshallah, we will derive collective benefit. My comments will be divided into two parts. The parts based off of the topic. Understanding God's plan will be the first part and then the second part half empty or half full. This first part understanding God's plan. It's actually more of a how question than it is a what or a why question. What do I mean by that? As people who have chosen to orient themselves in the world as believers, we have chosen that. You have a choice, you get to decide. Do I want to believe that Allah is real? Do I want to acknowledge that he is real and do I want to orient myself from that position in everything else that I do and how I understand the world or does a person want to deny that? There are some people who've chosen to deny that and for them there's no need to understand God's plan. You know, when I worked in the prison there was a colleague of mine who was a psychologist and he was an admitted atheist. He said he believed in mullah. He says there's no God and we used to have very interesting conversations and when you're a Muslim chaplain you don't have to hide the fact that you're Muslim. You can't because your job title says Muslim. So there's no point in trying to hide. So here's the Muslim chaplain and the kafir doctor for all intents and purposes. He's a self admitted non-believing person. There's no God at all, he's an atheist. So we used to have really interesting conversations. So one day I said to him, doctor so and so how do you process gratitude? How do you, what do you do with the feeling of gratitude? And he said to me, I think you and I are having the same emotive experience. He begins to psychoanalyze me.  In other words, it's just arbitrary. It's just random. There's no divine plan. There's no providence. There's no God willing this. It's just circumstances and I appreciate them. There are people who've chosen to orient themselves in that way. But as people who've chosen and have been blessed to be to be people who believe in Allah and say that we are people who submit to that, it is actually more a question of how do I go along with Allah's plan with good manners? How do I go along with his plan and submit to his plan? More than it is, how do I understand it every step along the way? And I'll give you a simple example. I have a friend who's come here to Singapore with me before. His name is Micah Anderson. He's a white American convert and one of the things about him is that he's been all of these different places in the world. He's kind of a cultural aficionado. He knows something about everything and when you travel with him he knows where he's going. I am challenged in terms of knowing my way around the city. The first time I ever rode the subway in New York alone was last year and it felt like graduation because I'm usually with Micah. You know, tell me, take this train, take that train and so on and so forth. We were just in Osaka and Kyoto a couple days ago in Japan and I've never been to Japan before. You go to a country you've never been to, you need to know where you're going and one of the interesting things about Japan is that they write English words on the maps but then when you get close to the map there's no more English. So it says Osaka, then you get up close and it's all Japanese. So if I was there alone I wouldn't have made it to Singapore but Micah has been to Osaka before and so we would leave the hotel and we would go to the train station and we'd take this train and take that train and get off at this stop. Do you think I asked him every step of the way? What train are we getting on? Oh, where does it end up? He knows where he's going. I don't know where I'm going. I'm not gonna stop him. If I stopped him and said, are you sure you know where you're going? You know what he'd tell me? I'm gonna take your own train.  You tell the doctor, why didn't you do this first or do that? He'll tell you, I'm the doctor. You're the patient. You don't ask even your doctor. Maybe a more culturally appropriate example. You're watching an anti-make murtabak. The best murtabak maker in all of Singapore. Murtabak means layers, right? Layers. So when does she put the dough? When does she put the mutton? When does she put... You don't say, well, why did you do it this way? Why did you do it that way? She'd tell you what? Go to McDonald's. You're not getting murtabak. You don't ask questions along the way. So reflect with me for a moment on this verse from Surat Al Qasas. Your Lord creates whatever He wills and He chooses what He wants. It is not for them to choose. Glory be to Allah above all that they associate with Him. One of the reasons we don't read the Quran like we should read the Quran is because it bothers us. One of the reasons we don't read the Quran like we should read the Quran is because it agitates us. It's too honest. It's too direct. It's too real. They don't get to choose. Again, modern people don't like conversations like that. You mean I don't have a choice? You all have heard of Facebook. Facebook. Have you heard of Facebook? I went to their campus in California. A friend of mine works there. He says you should come to Facebook campus. For what? For Juma. We had Juma on the campus at Facebook. I said it's definitely the end of time. We're doing Juma on the campus of Facebook. It is the most amazing thing I've ever seen. It's a combination of a university campus and Disneyland. Anything you could possibly want to eat is there. Anything you could possibly want to drink is there. And it's all free.  They have laundry services.  Anything you could possibly want.  I said to my friend who's there, I said, do you have a gym? He said, yes. I said, do you all have a steam room in the gym? He said, no, but I should ask for it because they'll give it to us. I said, Subhanallah, as if it was Jannah. So after that, we went there and then the brothers and sisters who came with us were amazed at Facebook. They just want to go to Facebook for free food and free drinks. So I made the mistake of taking my children with me to Facebook one day, the campus. And we walked up inside of the cafeteria and my friend who's hosting us took us to the soda machine. He said, there are 266 some different options from this one soda fountain. You want Coke with seven up, seven up with Coke, cherry, whatever you want. Did you know that there are some 32,000 options of drinks at Starbucks? Combinations, you could, what do you want? I want a extra hot, half skim, half low fat, triple shot. Cold macchiato. How's it gonna be hot and cold at the same time? I don't know. Modern people don't like to be told you don't get to make a choice. You have no choice, you don't get to make a choice. Modern people don't like those kind of conversations. You don't get to make a choice. One of our seller found himself very ill and his friend came to visit him. And he said to him, me, ma, te, sheke, what's wrong? Me, ma, te, sheke, I mean, what are you complaining of? What did he say? Zunubi, my wrong actions. And we say what? Is it your stomach? Is it your head? Is it, what is it? What do you complain of? What is your ailment? He said Zunubi, my wrong actions. He said, ma, te, sheke, what would you like? When you're sick, people give you whatever you want. You want orange juice? You want chicken soup? What do you want? Ma, te, sheke, what do you want? He said, el jannah, paradise. He said, hel netikabit tabib, should we bring you a doctor? And he said, inna tabib akad hadar. The doctor's already present. The doctor's already here. And they said, ma, they'll call. What did the doctor say? Qal inni fa'alunima urid. The doctor said, I do whatever I want. Who's he referring to when he says the doctor? He's referring to Allah, subhanahu wa ta'ala. When Sayyidina Abu Bakr, his Sadiq, fell very ill. They said, hel netikabit tabib, should we bring you a doctor? He said, al tabib wa amradani. He said, the doctor made me sick. In other words, who's the doctor? Allah, subhanahu wa ta'ala. So these are people who understand faith. They understand the nature of being a believer. So you know an authentic conversation about religion when you feel agitated. We have to be very careful that we do not turn our religion into entertainment. That we do not turn our religion into what makes us feel good. What feels like a massage. An authentic conversation about religion is one that should make you feel uneasy. Not to the blame or the extent of being dislocated, but what you should feel uneasy. You should feel trepidatious as a believer in the world. You should feel concerned. And you should be deeply sober inside. You should be concerned. And you should have a sense of weight and magnitude about things because everything's in Allah's hand. Now the good news is this, it's found in a narration that Allah says, oh my servant, enta turid wa ana urid. You want and I will. We both have irada. You have things that you want and I have things that I want. wa inni fa'alani ma urid. But I, as God, do whatever I want. fa idha tarak dema turidu lima urid, kuntu laka ke ma turid.  La ilaha illallah. Now people say, but I thought you said we don't have a choice. How is Allah going to be how we want if we don't even have a choice? What that means is that Allah will inspire you to preemptively want what he's going to decrease so that when it happens, you have no objection to it. It happens and you say, mashallah, mashallah. That's what Allah willed. No matter what happens, you don't object to it. You don't feel bothered by it. You don't feel like, oh, it should be different than it is. Let's change it, but you find it exactly suitable. Now I want to reflect with you for a moment and I'm going to take a little departure. Reflect with you for a moment on what's happening to religion in a modern context. And we have to be very, very careful.  I'm an American and I'm proud to be an American and I love America and I love the American people. And I mean that with all sincerity. This study that was done by an American sociologist named Christian Smith in a book called Soul Searching and you should buy this book. I think it's available on Kindle as well. And this book is examining, the study is examining the spiritual and religious lives of American teenagers. Why is that important for people in Singapore? Because globalization doesn't just bring with it genes. It doesn't just bring with it Justin Bieber. It doesn't just bring with it Miley Cyrus. It brings with it Miley Cyrus religion, if you're not careful. In other words, exportation of American pop culture can bring with it an exportation of an American understanding of religion. And what I mean by that, I'm not saying this in some anti-American spirit. I wanna be really clear about that. I'm the last person who's gonna come here and bash America. That's my beloved homeland. But we have to be really clear about the fact that what is underway in influencing the minds, influencing the souls of Muslim youth across the world are these very same things. So I want you to think about this. Christian Smith argues that the notion that there's some type of separation between the religious identification of young people and that of their parents is actually incorrect. That there's more continuity between teenagers and their parents in terms of identifying with whatever religious tradition their parents identified with, that there's more continuity than is popularly assumed. He observes, however, that a minority of teens naturally absorb by osmosis the content and character encouraged by the religious traditions. In other words, what? Don't worry, we're Muslim. Our parents were Muslim. So our kids are naturally going to be Muslim and they're naturally going to absorb everything that we absorb from our parents. We're in an age where guess what? That doesn't happen as easily as it used to happen. People used to grow up with firm faith, strong religion just because they watched their parents. You can see you're now in an age more than ever before when young people may have very religious, very devout parents, but for some reason their children lose their iman. May Allah save us from that. He says that these religious traditions are being colonized. The religious traditions are being colonized, but what he calls moralistic therapeutic deism. Moralistic therapeutic deism. If anybody can remember that before the end of the night, I'll be very happy. Moralistic therapeutic deism. Shifting believers from the orthodoxy of their old faiths toward its alternative vision of quote, divinely underwritten personal happiness and interpersonal niceness. He said, divinely underwritten personal happiness. Understanding God's plan. So what do we mean by that? Oh, as long as it has in it, my own personal happiness, I'm fine with God's plan. But if it does not a happy story for me, then maybe sign up for a different plan. So listen, in simpler terms, he says that faith is reduced to the following things. One, God created and ordered the world and watches over human life on earth. This is deism. He created the world and he watches over life. Two, God wants people to be good, to be nice, and to be fair to each other as taught in scripture. No problem, we're okay with that. We agree with that.  And one of the most common questions asked by Muslim youth is, what if a person was a good person but they didn't believe in God, do they get to go to heaven? Which is not really our business in the first place. That's up to a law. Who goes to paradise and who doesn't? That's not the topic of tonight's conversation. Four, listen carefully. The central goal of life is to be happy and feel good about oneself. Sound familiar? The central goal of life is to be happy and to feel good about oneself. And finally, and most problematically, God does not need to be particularly involved in one's life except when needed to resolve a problem. Nassal allah al-afiha.  It's finals time. I have exams. Or I'm going to go ask for this girl's hand in marriage. Or I'm going to apply for the job all of a sudden, they need Allah. You need Allah. So now I need you to get involved, Allah. Can you help me out with this thing? And then when we're done, you go back to being God and all just do me. Nassal allah al-afiha. That's very, very different than how the prophet, alayhim salam, understood God's plan. And I'm gonna look at two examples, brief examples. Number one, Sayyidina Rasulullah Muhammad, salallahu alayhi wa alayhi wa salam. What personal happiness underwritten, what was in it for him, did he get? Salallahu alayhi wa salam.  Okay. At one of the low points, when the prophet, salallahu alayhi wa salam, no longer has support in Makkah, he goes to Ta'if, Wakana yu'ridu nafsuhu alal qaba'il, salallahu alayhi wa salam. And he used to go to the tribes and ask for them to help him to deliver the message. Just give me support. Why? They already offered him money, they already offered him women, they already offered him leadership. So what are you seeking? What do you want? I just need support so I can tell people la ilaha illallah. That's all I need. So he goes to Ta'if, salallahu alayhi wa salam, and he asked them to support him. Now, if a person goes and they're a notable person and they come to seek your help, your assistance, if you wanted to reject them, the least that you would do would say what? You'd send out the security or you would send out a staff member and say, sorry, we can't help you. But what do they do? They send the imbossos of the city. They send the riffraff of the city. They send children to throw stones at Sayyid al-Wujud, salallahu alayhi wa salam, until he's bleeding, left alone. For what? For what? There's no agenda. The agenda is to help people. And at that moment, what does he say? Laikid yarab. Why is this happening to me, Allah? Like people say. People say why to Allah? Why is this happening? To Allah? The Prophet's system doesn't say why. What does he say? Salallahu alayhi wa salam, La ilaha illallah il'azim al-halim. There's no God but God. The exalted, the forbearing. La ilaha illallah rabbul arshil'azim. There's no God but God, the Lord of the mighty throne. La ilaha illallah rabbul samawati wa rabbul ard, wa rabbul arshid kareem. There's no deity save God, the Lord of the heavens and the Lord of the earth and the Lord of the noble throne. This is really important. Before he prays for anything, he affirms God's reality. When you say to somebody who's generous that they're generous, you're asking them for something. Right?  Next time you come over, you say what? Dinner was really good last time. What are you saying to them? I hope that we have it again. If there's somebody who gave you a gift and you say to them, Dizzakalakir, the gift you gave me was really nice. You're saying in a way, what? Give me another gift. When you mention to a generous person a generosity, it's like asking them for something. Avkuru leka hajiti. O yekfini hayaouk. Should I mention to you my need or is your modesty enough for me? Ah, so he says what? La ilaha illallah.  The lack of my resources wa hawani ala nas. And my insignificance before mankind. Khaifa yukuna lahu hawan. Sallallahu alayhi wa alayhi wa sallam. And my insignificance before mankind. Sayyid al-wujud. Sallallahu alayhi wa alayhi wa sallam. And my insignificance before mankind. I'm complaining to you, Allah. Allah is the only one who loves to hear your complaint. Allah is the only one who loves to hear your complaint. One of our problems is that we complain too much. You know they have this new feeling button on Facebook? Feeling annoyed. Feeling sad. Feeling hungry. Care how you're feeling? You complain, you complain just to complain. Oh, oh, it's raining. Oh, it's not raining. Oh, you just find a reason to complain. Allah is the only one who loves to hear your complaint. You are the most merciful of the merciful. And you are the Lord of the helpless and the weak and you're my Lord. And to whose hands would you abandon me? Elamante to Keeluni. Who are you going to leave me to? Into the hands of an unsympathetic, distant one who would frown upon me? Or to an enemy who's been given control over my affairs? However, if your anger does not fall on me, there is nothing for me to worry about. If the limb yukun aleyye minka ghadabun phalaubali. If you're not mad at me, I don't care. That's understanding God's plan. That's it. If you want a treatable version, 140 characters or less, understanding God's plan, I don't know, I'm not going to count. If you are not mad at me, I don't care.  I do not mind. And then he goes on with his beautiful prayer, salallahu alayhi wa sallam. What happens next? What happens next? Gabriel comes. And this is the beautiful thing about the prophets, alayhim salam. I mean, think about it for a minute.  And Gabriel came to you and said, would you like me to take care of him? I mean, think about this for a minute. Yeah, yeah. See, I'm from a place where, if you know the right people, you never have any problems. I mean that. You don't have to do anything. If you know Big John, Big John is a hypothetical character. But if you know Big John, you don't have to worry about anything. You know, someone looks at you wrong, Big John says, you want me to take care of him? You say, no, Big John, don't worry about it. Because you know if Big John takes care of him, it's going to be bad. Gabriel comes, aleyhi salam. And what does he say? Ya Rasulullah, the angel of the mountains is seeking your permission to crush the city. Atbiquhah, I'll crush the city. Whoever's there, they're gone. Wipe them off the, why? Because of how great Sayyidina Muhammad is to Allah, subhanahu wa ta'ala. Sallallahu alayhi wa sallam. What does he say? Nay, I would rather it be that there come forth the people from their loins who worship Allah. I don't want people to be destroyed. I'd rather there be people who come from their loins that worship Allah. Sallallahu alayhi wa sallam. The second example, Abraham. Is anybody in the audience around 16?  Please, I wish I could raise my hand. Anybody, there's no one in the audience 15, 16, 17 years old. One person, one person back there. Anybody else? Two, three, anybody else? Four, five, six. Now, why am I asking that? Sayyidina Ibrahim alayhi sallam. According to one opinion, he was for a long time the only believer in the world. The only believer in the world. It's difficult, and I know about this, if you're the only Muslim in your family. There's two, three Muslims in my family. It's hard. You have family things, you're the only Muslim. If you're the only Muslim at your company, it's difficult. If you're the only Muslim in your neighborhood, it can be difficult. Imagine Abraham was the only believer on the face of the earth for a period of time. And what did he do? They worship idols, and what does he do? He challenges the idols and says they're fake. He opposes the idolatry that the power structure was perpetuating. And what happens? He was 16, according to one of the opinions, and Shaitan inspired Nimrod to build a catapult. They say that this is where the invention of the catapult came from, was from Satan who inspired Nimrod's people to build a catapult. Then they built a fire, and they lit a fire. And this fire was so hot that the birds couldn't fly above it, and people couldn't come near it, and it was stoked for the better part of a month or longer. All of that was to punish Abraham for simply challenging their idol worship. He's in the catapult, sitting waiting to be cast into the fire. Now imagine for a moment, I want you to really imagine this for a moment.  What would you be thinking? You know, what did I do to deserve this? What do you mean they're not gonna upgrade me to first class? What do you mean you ran out of milk? What do you mean I didn't get the job? What do you mean her father said no? Good for her that her father said no. What do you mean? What did I do to deserve this? What do you mean somebody spoke ill of me? He didn't do anything except propagate la ilahe la la. And he's sitting in the catapult, and they launch him into midair. Now imagine yourself flying through midair. Just imagine this. He's flying through midair, and who comes? Gabriel. Imagine for a moment, Gabriel stops you in midair, and he says to him, I like a haja, do you need anything? Yeah, so the guy's messing with you. He wants to fight you. Big John comes out of nowhere. You need anything? Big John, can you listen to this guy right here? Or you know somebody who's the CEO, or you know the CEO's son, or you know so-and-so who's the vice president, such and such, do you need anything? This is Gabriel, a la ka haja. If Gabriel came to me right now, I have a long list of things I could ask him to help me with. A long list. Do you have a minute, Gabriel? Because there's a few different things I need to talk to you about right now. Have you bought my didn't come? Can we go to Terim? Can you take me to Terim? What does he say? A la ka haja, do you need anything? I'm a ileka falat, not from you. Now, I wouldn't say that to Gabriel. I wouldn't say that to Gabriel. I'm a ileka falat, I don't need anything from you. What does Gabriel say to him? Sarabbak, ask your Lord. Now imagine you're in mid-air about to fall into the fire, and he says to him, not from you. I don't need anything from you. He says to him, ask your Lord. What would you do then? If Gabriel told you to ask your Lord, he'd say, what, ya Allah? What does he say? Hasbim insu'ali, i'nmuhu bihali. It's enough for me to not even ask that Allah knows what's going on with me. He didn't even ask Allah.  What did you do to deserve anything? What did you do to deserve to be thrown into the fire? And he says what? I'm so at peace with Allah. I am so submitted to the reality of Allah's divine guidance that I don't even need to ask him because I'm positive that he knows what's happening for me. I know Allah's got my back. I know Allah's gonna take care of me, and I know he knows what's happening. So what happens? He falls into the fire. You'd think what? Gabriel takes him out of midair, they fly away. No, no. He falls into the fire. Now he's in the middle of the fire. But what does Allah say? Oh fire, kuni berdan wa salamah. Oh fire, be peacefully cool for Abraham, ala Ibrahim. Oh fire, be peacefully cool for Abraham. The Mufesidine said something very interesting. If Allah had said yannaru kuni berda, oh fire be cool, the fire would have been so cold that it would have burned Abraham from the coolness. But he said what, yannaru kuni berdan wa salamah. Oh fire, be peacefully cool, ala Ibrahim for Abraham. And had he not specified ala Ibrahim, fire would have been eternally cold. Primordial fire, cosmic fire would have become cold and we wouldn't cook, we wouldn't burn, we wouldn't do anything with fire because he would have made it cold. But he said specifically, oh fire, be peacefully cold for Abraham. So what happens? Completely unscathed, not a burn, sits in the fire according to one opinion for seven days and comes out completely unscathed. And what are you gonna do now Nimrod? What are you gonna do now? He comes out of the fire, completely unscathed. And it was narrated that he said later, the sweetest days of my life were the days that I sat in the fire. Because he acquiesced to Allah's promise, alaihi salam, which leads us to the second point. Half empty or half full? Is it half empty or is it half full? This is the second point as we begin to wrap it up. We actually are presented with either one as an option. We get to choose. So is it half empty or half full? You get to decide. In a rigorously authenticated hadith, the prophet ﷺ narrates on his Lord, on behalf of his Lord, and the hadith Qudsi, that Allah says, I am as my servant thinks of me. So let him or her think of me what they will. Let them think of me what they will. If they think good, they will find good. And if they think bad, they will find bad. That's the answer to the half empty, half full thing. If you want to be someone who sees the glasses half empty, you have that option. The bad news is that it's going to be as you see it. If you see it as half empty, it's going to be half empty and things are going to be difficult for you. If you see it as half full, it's going to be half full and then things are going to be good and easy for you. But we have to be really, really careful with this. Why? Because we often measure it incorrectly. When we get an increase in money or we get a new home or we get a better job or a better car or a new pair of shoes or we say what, things are going great. When we lose the job, God forbid. Or you take the shoes to the masjid and they get stolen, God forbid.  Or you get sick, God forbid. You say what? Ya'aweili, ya'aweili. Things are horrible. It shouldn't be going this way. What did I do to deserve this? And then we ask questions like, am I being tried? Is this a tribulation? I have some really difficult news for myself and all of you, everything is a tribulation. Everything is a trial. And again, modern people don't like to hear that. The whole thing is a test. You guys are mad at me right now. It's not, I'm not telling you. It's not my interpretation. The one who created death and created life to test you.  I give you a better job to see which of you is better in action. And this is why the scholar said, the foundational reality of the world is tribulation. It's Ibtila, it's difficulty. And you're gonna be in one of two situations.  You are outwardly afflicted or you're outwardly well. Which means what?  Or you're healthy and rich and things are easy. So those are the one or two situations, but they're both being tried. And if you are outwardly well, which the majority of us are outwardly well, the fact that we're sitting here right now means we had health enough to walk here. We had wealth enough to pay to get here, et cetera, et cetera. We're not sitting freezing on the borders of Turkey, like Muslims from our community. We're not sitting imprisoned because we're fighting for our right to assembly, like many Muslims throughout the Muslim majority world. We're not experiencing a number of difficulties that people are experiencing throughout the world. Walilahi Alhamdulillah. So we're outwardly well.  And if you do not help them, you will become afflicted. And again, you might be mad at me, but it's not my idea. That's the truth. If we are outwardly well, Allah will send people to us that need help. And remember what the Prophet said, Sallallahu Alaihi Wasallam. Allah has certain people that he created, Khalaqahum li Hawa'ijin Nas, who he created for other people's need. Yafza'u nas, ilayhim fi hawa'ijihim. People will run to those people when they have need. They what? Something comes up, they run to that person. And you say, again, really? You need help again? Didn't they help you last week? Didn't I donate before? Yafza'u nas, ilayhim fi hawa'ijihim ula'ikil aminuna min adhabi lah. These are the people who will be safe from Allah's punishment. May Allah make us from them. Say, amin. ula'ikil aminuna min adhabi lah. These people will be safe from the punishment of God because other people come to them and they have need and they help them. May Allah make it easy for us to help other people. So, fa'amal insanu. Ifa maabtalaahu rabbuhu fa'akramuhu wana'amuhu fa'iqulu rabbi akraman. As for the human being, when his Lord tries him and then treats him with honor and makes him lead an easy life, he says, my Lord has honored me. I'm too blessed to be stressed. I'm too anointed to be disappointed. It's all good in the hood. She said yes. I got the job. I got the car. I got the house, et cetera, et cetera. Everything's perfect. Youkulu rabbi akraman. My Lord has honored me. wa'amma idhamabtalaahu fa'qadra'alahi risqahu fa'yukulu rabbi ahanan. But when he tries him differently, then limits his means of substance, he says, my Lord has disgraced me. Lekitha ya Rabb, why is this happening to me? How could I not get the job? What do you mean I didn't get upgraded to first class? What do you mean I didn't get accepted to the university?  What do you mean I lost something? Is a law disgracing me? He's the one who gave it to you in the first place. People come and say there's no God. Why is there no God? Because I lost a family member. Who created the family member? Who are you lost in the first place? And I'm not making light of people losing loved ones. I have lost a lot of loved ones. So you say, is a law disgracing me? No, you were fine when things were good. Everything was fine. But then when it becomes difficult, you should say what? Masha'Allah, give glad tidings to those when they are afflicted with an affliction. They say, inna lilahi, we're inna ilahi raja'un. Um salama, when her husband passed, Abu Salama, she was told, say this verse and say the dua, oh Allah reward me in this affliction of mine, wa khlifni khaydan minhu and give me that which is better in it. And she said to herself, who could be better than Abu Salama? Who could possibly be better than Abu Salama because he was a good man, radi Allahu anhu? And he passed away. But she said, I'll say the dua anyway. So she said the dua. Who married her? Sayyidina Rasulullah, Sallallahu alaihi wa sallam. And with all due respect to Sayyidina Abu Salama, she was married by the best of creation, Sallallahu alaihi wa sallam. So even in the most difficult situation, to remember that Allah is in control, inna lilahi wa inna ilahi raja'un. Remember that you're going to return to Him. May Allah make us realize all of this. That's what's important, nairam. So we have to maintain a good opinion of Allah. We have some people here in the crowd who were descendants of Imam al-Haddad. Allah be pleased with Imam al-Haddad. One of the great Imams of Islam. And he has a beautiful verse where he talks about having a good opinion of Allah. And he says, wa li husn al-dan ulazim. I'm constant in having a good opinion of Allah. Fahwa khilli wa halifi. So husn al-dan, this good opinion of Allah is my khil. It's my best friend. Khilli means what? It's my bosom friend. It's my very best friend. The prophet said, lo kuntu mutakhiden khaleelin ghayra rabbi la takhathru aba bakrin. If I was going to take a khaleel, a good friend, a bosom friend other than my lord, it would have been abu bakr. And they say, khaleel comes from the word that means emptiness. Something that is khali is empty. Which means what? You can't fit anything else in there. So Imam al-Haddad says, good opinion of Allah is my khil. Wa halifi. And he's also my ally. Why do you need an ally? Why do you need an ally? Because there's a battle going on. And there is a battle going on. There's a battle going on between us and Shaytan. There's a battle going on between us and our nefs. There's a battle going on between us and worldliness. So we need allies. And he says, who's my ally? Husn al-dan. Husn al-dan is my ally. Fahwa khilli wa halifi wa anisi. And the one who brings me a feeling of intimacy.  I just need someone to hang out with so that I can feel a sense of comfort. Fahwa khilli wa halifi wa anisi wa jaliisi. And the one who I sit with. I sit with husn al-dan. He personifies husn al-dan. Meaning what? I hang out with husn al-dan all the time. I'm constantly having a good opinion of Allah. Fahwa khilli wa halifi wa anisi wa jaliisi. Full lately one ahari, all night and all day. What does that mean? It means that I'm always going to try to see the glasses half full. Even in the most difficult situation, even when I can't even make any sense of it, I'm gonna have a good opinion of Allah subhanahu wa ta'ala. There's a weak hadith narrated by a Taborani. But the meaning is sound. Where the prophet is reported to have said that there is no deed better than having a good opinion of God and having a good opinion of his servants. There's no deed better than having a good opinion of Allah and having a good opinion of his servants. What does that mean? When you can interpret things through examining a situation and through attempting to look at all of the variables in a situation and you can make sense of the situation, then you can say, I understand this and it makes sense. When you can't, you should say what? Mashallah, there must be something going on here that I don't actually understand. There's something going on. It's beyond my ability to comprehend. It's beyond what I can see. You should always try to have a good opinion of Allah subhanahu wa ta'ala and have a good opinion of his servants as well. Meaning what? Even when you can see wrong in somebody, try to interpret it in a good way. And the people that made the likes of Habib Umar, Hafidhuullah, may Allah preserve him. The school, and what I mean the school, I mean that in the literal sense of the word, the way of understanding the madrasa that produced people like that is a madrasa that had the following type of understanding and bear with me as I share with you a brief story. One of the great Imams of their tradition studied with his father for a number of years. And this is one of the beautiful things about their tradition is that they studied with their fathers who studied with their father who studied with their father who studied with their father who studied with the prophet sallallahu alayhi wa sallam. Habib al-Aliya Jifri was visiting us in California and he narrated the Hadith of Muakala with one of our teachers, Sheikh Saleh bin Siddina. Allah, may Allah preserve them all. When you eat with someone, there's a Hadith called Hadith in Muakala who says that the prophet says whoever eats with me or ate with the person who ate with me will go to Jannah. So when the ulama meet, they eat and they narrate this Hadith to one another. And after Sheikh Saleh narrated to Habib Ali, Habib Ali narrated to Sheikh Saleh, Sheikh Saleh said there's a weakness in the chain of this Hadith but we narrated for Barakah. Habib Ali said that's true, but I'm narrating it to you on the authority of my Sheikh Habib Abdul Qadir bin Ahmed al-Saghaf, Rahimullah, who narrated it to me on the authority of his four fathers back to the prophet sallallahu alayhi wa sallam. His chain of transmission was his family tree. Are you all listening to me? His chain of transmission was his family tree. I took it from my father who took it from his father who took it from his father who took it from Sayyidina Ali from the prophet sallallahu alayhi wa sallam. Ya Allah. Can you imagine? So this is the madrasah that producing people, abin anjad, radi Allahu anhum jami'an. One of the great imams of their tradition studied with his father.  You have one more job. He said, labbeik, what is it? He said, I want you to go into Tehrin and I want you to find somebody who's less than you. Bring me someone who's less than you are. You're in a higher status in him. Just bring him back to the house. He said, okay. So he comes into the city and he sees a person on his way in doing something disobedient, doing something wrong. And he hides behind a tree and he comes back around. So the imam said to himself, perhaps between the time that he went around the tree and he came out, he made toba. He repented to a while. From the time he went around the tree and came out, he repented to Allah. So even though he was doing something outwardly wrong, there's no way that I'm better than him because he made toba and his toba is probably accepted from Allah. So he had a good opinion of the person. Then he comes and he sees a young boy. And he says to himself, yeah, there's no way that I'm better than this child because he's young. He hasn't been around very long and there's no way he could have committed wrongs such that I could be better than him. See, there's no way I'm better than this young person. So he says, I can't take him either. He walks along and he sees an older person, not religious ostensibly, no signs of religiosity. But he says, yeah, there's no way that I'm better than this man because he's older than I am. He's been around longer than me. He's worshiped a lot longer than I have. How could I be better than him? There's no way I'm better than him. So he says, I can't even find anybody in the whole city who's less than me. I'm gonna fail in my final task to my father. I'm gonna have to come home and say what? I couldn't fulfill the final thing you asked me to fulfill. So on his way back home, he looks and he sees part of the expression, the carcass of a dog, an old dead dog, Jeefit and Kelb Hashakumukumukumullah. And he says, I couldn't find a person but at least I'll go home and I'll take to my father this dead dog and I'll say to him, father, I couldn't find a person less than me but I found a dog carcass and this is all I could present to you. So he's carrying the dog carcass on his way back home and then he thought to himself about the day of judgment, la ilaha illallah. And he said to himself, there's gonna come a time when even the animals get justice, when even animals who are wrong will get justice. And at that moment, a person who denies faith will say, ya leite nikuntu turaba. Oh, that I was dust.  He said, I can't even take a dog carcass home to my father. So he put the dog carcass home. And he goes, he says, father, I failed. He said, what happened? He said, I couldn't find anybody in the whole city less than me. He said, now you're ready to teach. Now you're ready to teach. That's that medrassa. They said, you shouldn't see anybody as less than you. You say, no, but you don't understand, ahi. I prayed at the masjid this morning. He didn't pray at the masjid this morning. My hijab is spot on. She has four hairs hanging out. Of course I'm better than her. What good does it do for you to judge other people?  All it's gonna do is bring kibbut into your heart. Allah save us from that. Always assume people are better than you. So he should have a good opinion of Allah and a good opinion of the servants of Allah. Try to always see the glass as half full. And I'll leave you with one last story. This is the last thing that I'm going to say. Because some of you may have heard everything I've said and think to yourself, you just don't know how hard my life is. You don't understand what it's like to be going through the difficulty that I'm going through and you're absolutely 100% correct. I have no idea what it's like to be going through what you're going through. And you also don't know what it's like to be going through what the person next to you is going through. And they don't know what it's like to be going through what the person foresees down from them is going through. And that's exactly why I started by saying each and every one of us is on a unique journey. So it's not about me understanding what you're going through or you understanding what I'm going. It's not about that. It's about us recognizing that Allah is in control. But let's just assume for the sake of argument that your life is horrible. Your life is horrible. It could not be any worse. It couldn't possibly be any worse. You say no at what? And part of the expression, I'm hesitant to say this because of some of the people in the crowd. But I don't know if the, you guys know people speak in acronyms now. Like I was sitting with a staff member of mine and she asked me, is such and such gonna happen on such and such a day? I said, I'm not sure. She said, okay, JW. I said, JW. I thought she meant the JW Marriott. She said, JW. She said, yeah, just wondering. I said, just say just wondering, JW. JW. Now, now people, someone says something funny and you say LOL. You don't even laugh. Sorry, LOL. Someone says something silly, SMH. Shake my head. There's one FML, which I won't translate. It doesn't stand for formidable Muslim laughter. That's not what it stands for. I'm not gonna translate it. F my life, FML. So for example, hmm, yeah, ha. Can you come over for dinner? No, I can't. FML. No, no, seriously.  Whatever you feel in the blanks, FML.  Really? No, really think about that for a second. Really? The planes delayed, FML. My shoes untied, FML. They're out of, whatever, FML.  Think about that for a second. Okay, halas, FML. Subhanallah. The smallest thing happens, what? Forget, and it's not doesn't stand for forget.  You say couldn't get any worse. FML. Nassallallah ala afi. That's not what a Muslim, that's not what a Muslim thinks, right? But let's just say that you live in an FML type of situation.  It couldn't possibly be any worse. Someone says, you know what? I cannot believe Habib Omar, FML didn't come to the thing. Well, did you reflect upon the fact that Habib Omar was nine years old when he lost his father? Did you reflect upon the number of Habib Omar's teachers and loved ones who he saw persecuted by the secularists and by the communists? Did you reflect upon the fact that Habib Omar went to the masjid with his father when he was nine years old and came back with his shawl and never saw him again? And what it means for him to lose his uncle? Did any of us even have enough compassion to say, no, I paid 15 Singapore dollars? Habib Omar better, ooh, Habib Omar doesn't work for you. It doesn't work for me. He's mourning his uncle's passing, Rahimullah. We should, our hearts go out to them. We shouldn't be thinking about it. Habib Omar didn't come, FML. F simply Islam too. Astaghfirullah. They did all this hard work. We said, Jazahum Allah, khay. Mashallah. May Allah forgive us. Say Amin. The final story.  It could not be any worse. Your life as a carcass is horrible. Is just horrible. And then think for a moment about Jesus, aleyhi salam, walking with his companions and they come across a carcass. And they see this carcass and the disciple said, ma atyanahu.  Ma atyanahu. It smells so bad. What did Jesus say? Ma abyada asnana.  Are you all listening to me? Ma abyada asnana.  That's what they call the silver lining. You know the silver lining? Meaning what? Can you find something that's good? Can you find something to be grateful for? Can you find something that you can say SubhanAllah? Maybe X, Y and Z didn't go the way I wanted it to go. But A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, D, U, V, W. It's perfect. And that's the reality. Most things are beautiful. And there's a few things that aren't the way that we like them to be. I pray that Allah help us realize what we're talking about, Ya Rabbil Alameen. May Allah help us understand this, Ya Rabbil Alameen. May Allah make us people who truly submit to His will, Ya Arham Al Rahmeen. Ey Wallahi. So it's more about submitting to and navigating ourselves and having good edab with Allah's plan that it is understanding it and the glass is half full, but we have to strive and work really hard to see it as such. I ask Allah Ta'ala li walakum kamala tawfiq wa asaluhu an yamuna aalay wa aalaykum bi tawbat al-Nusuh, Ya Rabbil Alameen. Wa sallallahu wa sallam wa barak ala Sayyidina Muhammadin wa ala alihi wa sahbihi wa sallam wa alhamdulillahi rabbil alameen. Wa alafum min kum.


greetings and welcome everybody this is a talk about Django about building a Django clone from scratch with a flask and well that is our Python user group's logo I am from Russia which is a small island in the Indian Ocean and our user group is called PyMug the Python user group of Mauritius you can view more about this on this provided link and a bit about me I am Abdulrahman Jahangir from well from Mauritius I'm a Python programmer for myself that you can find my Twitter you can find me on GitHub and you can find more about me on this URL also a flask on organizing member yes let us begin our talk and we put in the disclaimer that anybody following this talk should know both flask and Django should have used the flask and Django to build apps should have mainly used flask and also Django to build at least some apps so that you understand what the talk is about what is going on and how this talk might be beneficial for you to what degree it is the talk worth it so you'll be able to judge if ever you used both flask and Django so the idea about closing cloning Django it is about seeing what the aspects of Django makes the development experience interesting Django is widely popular because maybe in my opinion it's easy to to to set up it's easy to use it provides lots of functionalities out of the box and at the beginning it was used in an environment and the high pressure people liked it and we can say that most of the freelancing jobs today require Django if you go to even a freelancer.com you go to the all sheaves you will find that the most of the freelancing jobs for Python for web is in Django so we might ask ourselves what the aspects of Django makes the development experience interesting what aspects of Django makes it worth it to stick with Django to work with the Django well in my opinion these are some aspects that are really cool these are some aspects that in this talk will show how we can replicate those features using flask and we'll try and this one the first one is about modules well Django has modules with modules granular migration that is not only migration can control what you want to migrate single point of operation that is you don't have to run several files you it provides a central point of operation the queries are very cool the or the syntax of the OM is very cool you also have a wide number of packages online available and you have support tools meaning some rest API's etc are presented as a product oriented packages close base views generic views context bossing and you have the admin panel the admin panel which is wonderful experience for anyone is starting out that you just get to interact with your project products magically like out of the box you can add product can delete product you can manage products you can do what ever you want with your models it and you just get it free out of the box and that is something really cool well what we mean about modules is that Django allows you to do to have your forms to have related form codes to have related logic to have related views to have related models to have related URLs all in one place all in one folder with when normally when you make when you when you run the command Python Python is taught at Django you have Django Django automatically or I might say when you run the startup command Django automatically creates for you your some some files the folder and even some codes inside so that is what we get out of the out of the box with the Django and also the modules are just there and then you have to specify that you are installing the module that is you are using the module so what it is about grouping your related concerns together you get it with the Django and with modules your code is more organized is more like loosely coupled you might even share it with a friend and to hopefully he'll have it on his and he can interact with it he can use it and it is easier to get the big picture of what is going on with your project with modules like you know this this section this section this section you know exactly where the code is found where the logic is found and I heard of a case of someone who was using Django and he wrote like about over one GB of code before someone else took over and it was undocumented why in my opinion it's because it was clear to him in his head how things work how things are organized he didn't get lost even in a one GB could be so it modules make your code really organized and yes a gradual granular migration where the Django provides you with the migration mechanism out of the box first it gives you the ability to migrate out of the box and you can control what you want to migrate if you don't want to migrate everything that is your choice but Django provides you with the ability to do whatever you want and what that means for example Laravel Laravel is a Django inspired framework and Laravel has what we can say yes Laravel was inspired by Django and Laravel has gradual migrations if you organize your code into modules into a if you have a modular architecture in Laravel you can choose what to migrate and this results in less pollution like you don't migrate every change at once you choose what to reflect in the database and that Django provides out of the box and yes a single pointer of operation with a manage.py you can have a single file just input the file the command that comes after like you don't have to run a run.py you don't have to run a migrate.py you don't have to run and apply settings.py and yes these are all about the query Django provides cool queries out of the box and beginners I mean people just starting out people just starting it can be daunting but on the other hand it is really nice that just as you are beginning you just you just get to use the OIM just get to use the query which is really powerful yes you have powerful queries in simple lines of code and beginners get exposed to serious concepts from the beginning like you have you are using an OIM as a beginner which is very cool like which maybe you would have to wait for quite some times if you were through another route and the way if you if you use Django and the way Django is organized and the way Django does things I can say that it has a lasting impact on the way you write code on the way you do things because you've been exposed to a nice system to a nice way of doing things and yes Django has a wide a really wide range of choice for packages for example you have Django packages.org which is a an unofficial if I remember well. Repository for packages currently it has more than 3000 apps and that is really cool which is it's really great that people just share their a part of their of their a part of an application which you can just pull in and start using it which is it is something really amazing like it's great it's I can't describe it yes and the modules are plug-and-play you put it and you specify but basically it just works and that is about the packages support tools as packages for example Django mini packages are for debugging or for profiling or for testing your endpoints those packages are really great like they are not only for product oriented but they also like for debugging to to help you with your coding and these are some packages that you find open yes and Django has cloud space views it has some crud it gives you a nice advantage when you are using crud operations and which is really nice because you are using only Django you are you must adapt yourself to Django's way of doing things and it simplifies for you many things those are some some advantages of Django and also Django what makes it interesting to work with Django is the way Django parses template variables as you know you just pass a dictionary and normally in Floskey the normal way is to have optional parameters so passing template variables as as a dictionary is a really nice idea and you have yes the admin panel out of the box with which allows you to to work with your models like quite easily it also you can also out of the box interact with your users you can out of the box interact with the with permission groups the admin panel is really powerful and running in production.com it has a podcast with Tan better if i'm not mistaken and there we i was surprised to discover that to to know that real python actually uses the built-in Django admin for its editing for everybody to collaborate and it uses like it's possible it's a possibility in this time and era to have solidives and that's him working on the side which is really great the admin panel and this is and when i pinged my local friends so they said that this was one point that Mr Dominic he said that one point which makes it really useful to for him really interesting for him to work with the Django is the admin panel so i guess that the admin panel really makes a difference like sometimes you just want to to know the result to view what is happening now now it's a bit about those are like some features that we'll try to replicate in our app but this section is about what i don't in a clone that i'm building like if ever what i would want to to build something like Django from from scratch what i don't want to include so these are some points one it's about the oom well one point why why i i like flask i i don't like Django so much it is about the Django orm which which well it is not a complete orm but which is the root taken by many orms but compared to sql alchemy so the Django orm is not since it's simply not up to the level you must use for complex queries it is better to go with raw sql which kind of defeats the purpose of having and using an orm and many Django divs at the one at one point they they choose a web framework just because the orm is not up to the level just because they can't use some simple join queries which is like somewhat simple in sql and if you want if ever you want to have an overview on how the Django orm and sql alchemy differ and why sql alchemy is better than the Django orm the default Django orm then you can refer to to this article by mr. omin Rulaker about sql alchemy and you and what i mean about Django experience devs experience the Django developers switching over like the orm like growing out of the orm like quitting Django just because of the orm and i think if ever the Django developers the at one point or the other they decide to cancel their orm and use sql alchemy instead so i think it will be a very good move which will improve the adoption rate of Django and it will really properly really nice and though it is a undoubtedly very popular now but this is what the author of bwee has to say that he used the Django before but uh being a veteran sql uh user he did it uh he didn't feel feel comfortable comfortable with the default Django orm that is him and uh you know when when a an orm is great when for a question for example has anyone regretted using sql alchemy and this user who has been writing sql for quite some time he has to say that he searched for sql alchemy and he just doesn't miss uh row sql since the last two years whether your library is great even for when someone requests for these advantages you get you get advantages you get someone who has been using row sql turning to sql alchemy and of course sql alchemy gives you control over inflexibility over your your objects and uh yes when you use Django so you have uh some default apps uh coming along tag some default uh tables uh coming along tagging along like you haven't yet it started too good but your database is already filled but i know it's uh the case with event WordPress etc but uh if you want to to to to have a clean look at your database so you off with uh with you start with uh some some some some tables and uh one confusing point uh when you you teach Django it is about the url so you have several url.py and you ask uh students you ask people you ask attendees to modify such and such thing in the url.py but they end up modifying another url.py they end up like uh it's it's difficult to differentiate between those two like oh there are actually two types of urls.py one is for the modules and one is uh actually for the whole app to to map the the views but uh you it's not a problem for experienced users obviously and also why i what i don't like with the Django it is about having all apps on the same level you have your primary app on on on on one level and all all the apps you have it on the same level and you have to remind yourself like what is the name of my application and oh those are not my primary app so you have to to to kind of remind yourself you have to kind of uh because as you put new applications your your primary app moves up and down but that should not happen at least according to me yes now let us talk about our concretely speaking about our prototype and how we we want to implement it the the features we we discussed can we implement it how to implement it but it is to be to be noted that we chose a we'd not we chose it as near as possible to to Django how a Django application is but obviously we preferred the to keep at least one aspect of the flask spirit flask default working which is having the decorator above the function but we also discussed implementing clause based views in flask yes i said the Django clone from scratch using flask and not Django clone from scratch using python this is the architecture i can say of the application well you have app dot py manager py settings dot py dmsji dot py but you also have you and you have a foot a folder called modules in and in the folder called modules every module has to be in a folder and inside the module folder you have templates folder you have models forms and view files and then inside the templates folder you have another folder called blog same as same as the module name and that is why yes you might wonder in the last slide why in the templates folder there is another folder called blog it is because when flask will look for index dot html and if it finds several index dot html so it won't return what you expect it to return but if you put like some kind of name spacing in the templates if you put blog if you put like a folder name blog so you can refer to this particular html as blog slash index dot html which will be more clear in the coming slides yes this is for render template so you don't just want to render index dot html but you render blog slash index dot html and the app knows exactly which index dot html you are being pointing and the project which prompted me to write to to give this talk it is a project called chirpure which stands for shop plus python plus open and it is an ongoing ongoing experiment yes it is an experiment it is an ongoing experiment in replicating the features of jungle but more specifically about enhancing the flask development experience further modules came along this came along that came along and I say that well I'm having the features of Django I was looking for it I'm having it but the spirit behind is improving development experience using flask and you might be wondering well it's me who is saying that this app that this project I have is in Django cloud and like we clone the features of Django in it but is it really is it really convincing is it a convincing Django clone well I was talking to someone on our discord when he mentioned the project how we found how we were going over how a bit about how he found the project and then I said to him that well in this project we copied lots of Django features and he was like oh really it's not Django and I said no that's not Django and then he said well he was amazed that it's flask and then I explained to him different features that we copied and yes and so here's how we did it so here is how to implement Django modules in flask well this is the architecture that you have just a few moments for you to to analyze it to see that there is a folder called modules and inside it a folder called blog and inside that folder called blog there are your templates models forms and view now this is the layout how concretely do you achieve modules this is what we'll see so let us see about referencing let's see in in how do we reference a model from blog in modules to view.py let's say in modules too we have a view.py so how do we refer to a model which is found in blog so that's how we do it we say from modules.blog.models import let us say model called post so we import post and then let us say we are in blog in view we want to call a module find found in models like we are in the same folder how do we call it well we can call it generally from modules that blog.models import post or we can do as Django does from that models import post and also of course in view.py if you want to call something in forms.py you just say from that forms import your form now how do we to register blueprints how do we achieve the plug and play behavior well we must run now yes you do it like this you you have your let us say blueprint called people you say people blueprint you the name of the blueprint is people you template folder you put it as templates because remember we put out we name our templates folder template and the url prefix we put it as slash people so you will see people repeating at three places one is in people blueprint so that that's one place the first place where there is people the second is the name of the blueprint and the third is the url prefix and of course this is for the view but the modules folder is also named people and then not for every app but we have this snippet in our app.py which goes over every folder found in modules and then imports modules dot the modules name dot view it goes into the modules view.py and then it imports the blueprint which is of course named same as which is prefixed same as the folder's name so with this little trick we ought to register blueprints no need to to to import and to register that just you just lose time it looks for just but just you have to to to make this this convention you have to be consistent with this convention and using this snippet you ought to register your blueprints and then you just have to restart your server you get the plug and play behavior you get really plug and play behavior of course you have to migrate you have to migrate don't forget but what's what what is more important is that you get the plug and play behavior and now how do we implement manage dot py well i'm skipping imports but normally i'm using flask script you have with just these three lines you get your whole manage your whole migration management commands you need the database when you migrate and upgrade those two together form the migration command and of course you have the run server you define it as search you have the run debug and then here you have some custom commands you put you say that if by the measure py if the next argument is run server so you just apply the run server you just call the run server function run debug and then it start up what does it start up does is that instead of you remember what to keep consistent in creating modules it start up is just a helper function it just creates the files for you the folder for you and the file content for you suggests it's instead of you creating manually which effectively by the way replicates the Django's behavior python manage dot py is taught up and the name of the app and here it is the the the running the commands yes i was saying with them with our manage dot py with some simple line of code we are we already get run server we already create have the command to create our apps and it's python manage dot py is taught up robot it's a typo that i made so be careful about this yes and implementing context parsing normally in flask you render the template and then you say for template variable you say pencils is equal to five pens is equal to four like like that but you know it it is not very need to to pass parameter parameters to pass pass pass it's not very neat what you can do is you put it in a dictionary okay and you just unpack it in your render template another thing which you can do is to have for example if you have some template variables that needs to be shared among every template for example some some some values in the footer some values here some values there so you can have a global default values and then in inside each and every view function what you do you copy the the the default dictionary and then you update it and then you unpack it so that you get a similar behavior to Django's context dictionaries i know in Django some people they like to pass in locals like you they don't want to define any any you know variables but i think doing this in this way like you specify each variable so i think it's more explicit now what can we what can we customize further one it is about the admin panel i know that flask has the flask admin but and what is the beauty of flask admin is that it doesn't create your tables etc but it it it is a manager an effective manager with which its aim is to replicate the the Django the Django admin panel i feel that it it it aims to replicate it but of course it's not exactly as the admin panel so what is the solution is you go to to the empty tables that Django due to the tables that Django creates by default you see what feels there are and you will get an idea about how exactly Django managers permission how Django managers permission groups etc you will like how does it manage everything you will see the you can see if it's a square light you you go to a square light browser and you see the tables or whatever database you are using see the default tables for Django and try to implement one for you and of course share it with us afterwards yes if you are really adamant on having your real stutter py you you say well this talk is bluffing it's it misses the uos.py part and it's not complete well flask specifically implemented it for users who want the Django behavior to have uos.py so to flask provides a class based views so here it is a simple snippet taken from the flask that direct from the flask talks which is how you can do it and yes one thing i think it's worth exploring it is about metadata well what do i mean by metadata it is for example you have packages okay you have packages and you want to include some more info about maybe what other package you need to install so that this package works maybe you can have another another attribute another json attribute well you have the name you have the type show normally in shop you you can show or not show modules normally you have a control panel and we have different icons when you click it will it will it will link you to the index of the app and show we choose to whether to display the app or not it's a bit we took that concept we we were inspired by android where an application can ask not to show its icon on your phone which viruses abuse so that they they pass like incognito you you don't know if they if they exist on your phone because they ask not to not to show the the icon but here we put it because maybe some functional packages which doesn't need to show up in to show up so that's a bit why you have show and then the font awesome icon which plus i build also users appear the same idea and then you specify the the url prefix here so you get a bit more control but it also provides some more some more advantages some more options of what you can do with it in in the future and then what once you have the your info the json file in in your normal that's a quick fix that's a quick hack that's a proof of concept it's it's it needs to be improved certainly but that's how you can do it like you you have the directory part of the file and then you open the directory first part you append to it your info that json you can use us that part to join if you if you wish for the file you get the info and then you have the url prefix here you get it from your info file even the name you could have got from the info file but you would have to to be consistent with with it and maybe we can tweak it further etc but that's a that's a proof of concept that you can use you can have some metadata in your in your in your packages and yes for default users like how do you add new users that also of course the manage.py is very easy to to add your own custom function but you can also make it so that whenever you create a new project there are some initializations that get done you can have for example an initialize command that allows you to have some basis some some basic things set up such as adding a new user and in a function you add the add user to it and then you have a json where you have several you know users with the name and and email addresses etc which you which you get added by default in your database so that you can use them out of the box to test or if you implemented the panel to be able to use it spontaneously and to conclude we can see that this proof of concept that works yes that works we have what do we have what what Django features do we have one these modules with forms models views and we showed how you can implement your own us that be why if you ever want and of course your template how to make modules plug and play just like you would do with with Django how to make modules support metadata how to get the run server command how to apply migrations how to have the startup command how to have how to pass context and also exploring about the generic views how Flask provides out-of-the-box support for generic views if ever you you want and okay i i think i i i just repeated it over there but the the point below it's about having default users default settings that you can use out of the box how to customize it yes and if you ask me how to teach uh web programming how to how to to teach like back end programming i would start with it with it not deep but a thorough introduction a thorough explanation of api of requests of servers and then to teach people how to be behind the scenes them implementing that same thing they were interacting with using bare requests and from there when they get into into back end to to start the small and give them a a broad overview of whatever thing you can you can do and to let them you know come up with their own project to to make them you know really solid developers to provide them with teaching with a testing education and because you know if you just put every concept in a child at once like you know jungle does maybe it it won't be easy it won't it is not fun and but if you if you do it like incrementally you can have a better chance and it you can start i can say at a lower age and of course those who want it just just at once can can always go for it and that is one against the the link to to the project and some closing words about all flaws extensions reliable like the flaws ecosystem is it reliable well mr joker born spoke at floss gone 2020 and they spoke about his lessons building microservices with the floss and he said that the he has 65 000 requests per minute yes per minute and that's three billion rate limited requests per year and he said if you listen to dojo that we've had absolutely new issues and that is all i had to present thank you


Hello and welcome to the channel. So I was just out here in the evening starting to plant up some of my perennials and some different flowers Some different pollinators that I want to plant here in my lasagna Garden bed, which is located pretty close to my garden here And I thought I'd better do some filming and capture what I'm doing so I can share it with you Because this year I'm very excited to have another watering plan For this area. It was really tough to keep it watered and The flowers didn't do so well the perennials Always struggle in my yard a lot of them never make it through the winter But every spring I try again and got a bunch here that I want to try planting up So what I've done is I purchased a 50-foot soaker hose here and I got it all connected and ready to roll but what I'm doing is I'm just I laid it all out here in my Garden bed Turned it on just to see how it works and it's you can see there's still some Water here, but yeah, it just seeps out water and as you can see it spreads pretty quickly So I'm hopeful that this is gonna be Helpful to my garden this summer and things will grow.  I think it's a flea beetle So I did throw some D earth Sprinkled some around here, and it seemed to have stopped the problem But I think I need to keep on top of that I'm gonna be losing a lot of my little leafy greens this year So I'm gonna just start planting and kind of keep the plants close to where this Hoses laying so that they're gonna get the moisture and just kind of use that as my guide And just get planting Okay, so I have been adding in some flowers Leftover annuals that I didn't have room for in my pots. I've been just throwing them in the ground here I got a bunch of perennials planted up. I got some seeds planted here and there So I'm just basically looking for little spots Where I can stick some more plants in And this is one of my winter sowing jugs here. This is chamomile This always does really well In the winter sowing method for me. So I'm going to stick some of that in this spot right here right now So I've got my Hori Hori knife here, which works great for digging in to these spots In the lasagna garden you have lots of layers of different materials that I've been piling on over the past couple years I'm just going to try and make a good spot here for All this chamomile to go in And like I say, I'm always trying to keep it in line with the soaker hose here So it'll get watered This is great for digging out You know small roots and stuff as well So usually I just try to keep it. I'm not going to try and separate this. I don't think Should come out fairly easy See there's a lot of roots Happening there I did plant these fairly thick in the winter sowing jugs, but I'm just going to break it up a little bit Try to spread it out Give those roots some room to grow. I'm just going to add a little bit more of my Potting soil mix that I made up and I'll just push back some of these this mulch Just to cover it up Once I think I got enough stuff here in my lasagna garden bed, then I will Do some mulching There's always going to be quack grass coming up, but It's very easy to maintain. You just keep piling on more materials. I don't worry too much about weeding You'll never win the battle against quack grass. That's for sure I like to grow chamomile and mint in my lasagna garden bed every year picking it throughout the summer and drawing it to make tea or to use in my skincare products So I received these Watson gardening gloves for Mother's Day gift this year and I absolutely love them I never realized what a difference it made having good quality gardening gloves These gloves really fit well. They are water resistant and Whenever they do get wet they dry out really fast as you can see I've been giving them a really good workout already this season And one great thing about them also is that they are made from 96 percent recycled pep bottles So 1 500 mil bottle is used to make one pair of gloves So as I said, I got quite a few things planted up here in my lasagna garden bed and as you can see the quack grass likes to creep its way in It's always an ongoing battle But I'm going to show you how I going to use my lawn mower with the mulcher to Do some mulching here on the edge and try to keep that quack grass at bay This is what it looks like after I have done my borders with grass clippings. This is how I edge my lasagna garden bed those grass clippings will form a nice matte and Hopefully keep the quack grass at bay doesn't really look great, but I Think over time all the flowers will start growing Spreading out and the color will kick in and you won't even notice What's on the ground? So over the next month or so as things start to grow and blossom. I'll probably be adding more Flowers who knows what you can find at the greenhouse at the end of the season That you might want to bring back home and stick into your garden Dried leaves wood chips straw. Hey all those materials work great To just put around your plants keep the weeds down And over time all that material just breaks down adds more organic matter to the soil and Just makes a great place for Flowers to grow. So I hope you enjoyed watching me set up and maintain my lasagna garden bed for another season Please hit that like button leave a comment and if you haven't already done so hit that subscribe button So you don't miss out on future videos coming to the channel Thanks for watching. Happy gardening


So I'm hoping that you will kind of act as a focus group for me, because I'm going to ask a lot of questions of you. And I hope you're willing to be open with me. And feel free to put your ideas in the notes. I'm not requiring it by no means. But as I ask these questions, I wonder if you will be open with me as I'm open with you. And as we talk about OER and sharing, I think an important question to ask is why do we share? Why sharing? And I think everybody that's probably at this conference has some experience with sharing. Probably a lot of people here have shared some great things. And I'm wondering really what you have shared. And I wonder really why you share. Maybe I should go out a little bit into why I share. I share personally because I feel like being a person that comes from fortunate circumstances and comparatively across the globe, I feel like I have a moral obligation to help other people. Worked with, I don't know if you guys know Steve Hargadon. He'll be talking to us next, but we were talking earlier today about the Global Education Conference. And this is an online conference that Steve's put together. And last year was the first year. And how many different countries were represented? We were talking about this. Oh, you were talking about a different network. Hundreds of different countries were represented in this conference for free. And I think those in other countries are just starving. They're starving for content. They're starving for educational resources. And I think it's really our job. I think honestly we have a responsibility to help them. Like was mentioned earlier in the keynotes this morning, the president will mention, he will always say we want to be number one. And we do. But I think we should be number one in sharing. And by doing so, we can lift others. So why do I share? I've gained a lot through sharing. I share because I think it's my responsibility. I also share because of this, because it's easy. This is a quote from Dave Cormier. I'm not sure if I'm saying his name right. But he is an early pioneer, Opadette. He said a couple of years ago, he said our blogs are now less megaphone and more like 21st century lockers. And that's been true for me. I've been a portable blogger in the last year or two. But I share on Twitter, I share on blogs, I share on other social networks. And honestly, one of the reasons I share is because it's a place to store my thoughts. It helps me, writing helps me to figure out what I'm thinking. And I can tell you how many times I've gone back to my blog to find stuff that I've written to share with others. So it's been a nice repository. So I'd like to get some feedback from you. And I'd like you to consider, if you wouldn't mind, for about two minutes here. Consider the most meaningful creation you've ever publicly shared. Think about it for a minute.  Maybe it's D106 radio, earlier on, we heard about that. How did you share, why did you share and what impact did sharing have on you and on others? Anybody here to share? Meaningful to me or meaningful to the world? Sure. No, I'm asking you a question. How about meaningful to you? I'm a musician and I've shared stuff through mp3.com and YouTube and things like that. I live in a small community and I don't have the opportunity to share otherwise. So it's been important that way. That's good. Did everybody hear that? I'm sure the musician you shared is music through mp3.com, through other avenues. How did that sharing impact you? I got feedback from the whole world. I have very educated people who gave positive and negative feedback that helped. So that affect future creating?  I feel like I'm very much a sharer right now. But I can remember that I almost was sort of forced into it. It was my first big community project caused from 2.0 and I ended up taking a job with Ming and because of that I was evangelizing the platform and sort of intriguingly enough, I don't think I would have done that on my own but once I did it, it felt like the benefits to me personally in terms of engagement, my personal engagement. I was so great that I was really grateful for that experience. Awesome, thank you. I think fundamentally as a woman, I'm a mother of two small children and when you have most meaningful creation, they are the most meaningful thing to me right now. But giving my children, you think of labor, how did you share it, and you went through that process. But the why is greater than yourself, giving to the extended family and then the impact is to be seen. I have a 15-month-old and a 3-year-old and it's exciting to me to see what my husband created and how that will impact the world. Fantastic. Is that somebody over here? I wrote a book once and when the copyright lapse I just asked for the, or when the publishing set put out a print and I asked for the rights back and it made the digital version free and then I just recorded myself reading it and put it on iTunes as an audio book and at random moments I'll be, it's a book to teenagers and at random moments I'll be giving a speech to teenagers and someone will come up to me and be like, hey, that story's not your story, I've got great iTunes. Awesome. Thanks a lot. Pleasure to meet you. Hey, what's the name of the book? I lost my phone number, can I have yours? I like that. I've been to the States, you can hear my accent up from somewhere across the waters. I grew up in South Africa and I've been teaching in the United States. So being involved with less commonly taught languages I developed an open site for Africans initially and then realized I really like to do that for all these commonly taught languages. So I created openlanguages.net which specifically goes there. I asked myself that question, why do I invest so much in this and I'm not getting a penny for it that's just open and sharing. And it's actually more of a spiritual thing to me and that is I realize life is short. You've got a mark to be made and that you really want to bless humanity. Do it, don't wait. You're going to be expiring real soon and then you might discover it. And I realize that a time is really short. If you've got something unique that you want to bless humanity with jump on it and share. Don't reserve what I want to make money and so forth. You've got it wrong, it's about money isn't it? And your love for humanity is over this. So I've just been spiritually driven to share what I've got instead of having this, I want to be a millionaire. Life is short, that's the pessimistic view, right? This is the pessimistic crowd. And sure, I think that's fantastic, thank you. Let's do one more right in the back over here. I'm a pretty open person, I share almost everything I do but the most meaningful one was a college lecture that I blogged. And I thought it helped me, well when I helped me do two things. One, I thought about the material more and more and helped me synthesize and actually learn it better. And two, it got my data off my back because it was always pestering me, what are you learning at that college if there was anyone? There you go. Transparency. That's good. So if you didn't get a chance to share yours, you're welcome to share it in the notes. Again, those are public, so be careful what you share and why you, your motives for sharing. Anybody know who this person is? Let's get into some difficult questions now. Anybody know who this person is? It's not George Washington. I think Arnold Jefferson. Arnold? Yes. That is Benedict Arnold. What is the story of Benedict Arnold? So we're talking about the 1700s, right? He was a general in the Colonial Army. He was privy to a lot of inside information. They were open with him. And he took that openness and made them pay. There's one of our questions when it comes to competition. If they, remember they might be, if they have more honor students than we have students, are we really safe to share? I'd like to hear your thoughts on that. It's a competitive world. And, you know, we're in it. It's so competitive now anyway, even here in the United States, right? In education. We've got public education. We've got private education. We've got charter schools fighting for dollars, public dollars. And then here in Utah, if you're not from Utah, you may not be familiar with Senate Bill 65. That's a new bill that came out that said that all public students can now have the option to attend any online Utah online high school or credit. And if they choose to go to another online school, then their local district will need to pay for them to attend. And I think the dollar amounts somewhere at 750 or so, it's the WPU. So their district would lose money for those students that are attending these other schools. So if they have more honor students than we have students, if people are fighting for our money, why should we share? That's one dilemma I think we need to consider. Any comments, thoughts or questions on that? I'll just start a brief one. I'm talking tomorrow, and this is really part of my thing too. The money makers and the for-profit people are well organized and they can pay to do marketing, to hire great content developers and so forth, and to really, the money drives it. And we see ourselves kind of vulnerable. The way that we can do it is by really getting organized. Because as you look at free software, by being organized, you can really do some magic. But if you're not organized, if you divide it, you are very vulnerable. Yes, I agree. It's not Halloween. Again, this is a very deep question. I think it's a spiritual question too. And it has to do with whether we see ourselves as an individual separate from our environment, or if we see ourselves and our organization as a part of something we're doing ourselves. And if we take that latter view, then I believe we will find practical ways to do it, for example what was just mentioned. I think this has been alluded to rather than said, but in a research context, your intellectual property is pretty much leading to the future employed sometimes. So it's very difficult to create a culture in which people feel comfortable giving it away. There's one more up in here. I don't know. I think a lot has to do with developing good institutions and make the whole idea like this common resource work.  If you have some ways to keep it, I don't know, guaranteed, there's no easy answer. So we've talked a little bit about culture and creating a culture of sharing and how critical that is. I think an important aspect of that culture is the willingness to attribute the work of others. And I think you were alluding to that in the back. When that happens, sharing can be beneficial all around. Well, I don't know why I chose the word safe, except in thinking of Benedict Arnold, not sure how safe it was for them to share information with him, even though they weren't knowing that it would eventually harm them. I think that's a potential roadblock we're going to run into all the time. I'm thinking more about this question, is it safer really to share with our friends or is it safer to share with our enemies or people that we don't even know? In Benedict Arnold's case, I think it was not very safe to share with friends. So it's a tough thing. And I agree that it's a spiritual question. This is one that lies... The answer lies deep within people. It lies deep within the people of our country as an example. If we're going to be number one in sharing, that means a lot. It means we're going to need to change some things. It complicates it too that there are different levels of sharing, right? So if I just blog about what I'm doing in my class, I could come and say, oh, I'm open about what I'm doing, right? But that's very different than taking my actual lesson class, putting those online, or taking those and putting them in a package, doing the actual work to make it usable by other people. They're all these different phases, right? And I think sometimes we get caught up in, oh, do I share or do I not share? Rather than, you know, at what level am I sharing? How much work am I going to put into this and become vulnerable to other people as a result? Good. Back to that. Also with my experience, it's not only a question of teachers it's even students. I have a website that allows students to collaborate on coursework and the primary reason they don't contribute is that they're worried about giving up their competitive advantage. Find it with those notes and I'm going to get an A and I don't want you to get an A as it makes mine less valuable. As a teacher, how important is it to change that mindset? It's really changing culture. It's incredibly difficult to do, but I think it is worthwhile. And then back. And going back to the public comment. So we hear it, it depends on what you share. If you're at a research one and you're going to get a A or not based upon your research, you're not going to be given that A to everyone. But if you're teaching at a $100 course and you create a lesson that you think is pretty cool and you want to share that, you know, it's a different. Good stuff. I was looking at that from a state government perspective. So I was thinking about how we typically don't incentivize collaboration. So there is not really a, there's been more reward, I guess, for competition in some ways and individual outcomes than that happened for collaboration and collective outcome. So this is almost a policy issue too, isn't it? Anyway. There's an emerging question. Is when do you share and when do you compete? And that's not easy to answer. No. Competition is something that can be eliminated in any environment. So maybe we should leave the question and we should start asking ourselves how we can develop an ecosystem in which competing for openness is recognized and evaluated and valued so that actually you can actually compete but for being open and free. That's a great idea. To a certain extent we're already sharing. And if you're college faculty to publish hopefully your work will be either showing up in a database that thousands of millions of libraries will have access to where faculty and students would see your research and cite from it. The other thing is that people, faculty are already publishing online journals which are open access available through any Google scholar search. So this is already sharing. And that's totally free because that's not getting indexed by database companies. So anybody who isn't a paying student or an employee faculty member of the university to access this, there are some conferences, not this one unfortunately, where they archive people's conference presentations. Thank you.