I feel like the Course is bringing us to this experience that in order to have peace of mind we have to raise up the ego belief system in the mind and and release it be free of the filters. So you might say that the human condition of Gabriel Maslow had his hierarchy of needs and sexuality would be right down in those lower basic needs of human beings and you might say that the very belief in need is egoic. In heaven there are no needs. In oneness or perfection there are no needs. So in terms of sexuality, it's basically part of the perception of being a human being. You know hunger and thirst, sexuality, there's things that psychologists like Maslow would say those are basic needs and then if those needs are filled fairly regularly then the mind can kind of raise up a bit and advance into higher order needs and he would call that self-actualization. You might find on the way up a deeper intimacy and need for deep deeper intimacy and then ultimately to remember who you are as a spirit that would be at the top of the pyramid. So none of those things can be ignored. So when we teach the Course, we're really teaching about the process of forgiveness and the teachings of forgiveness, how this is applied in your mind, giving great instructions and details, but in terms of sexual expression you might say that sexual expression is our distorted miracle impulses. When Jesus first was dictating the Course in Miracles to Helen Shepman he actually didn't use the word sexual impulses at the beginning. He basically said physical impulses are distorted miracle impulses. So that's a much broader category than sexuality and sexual impulses. We could say hunger, thirst, the desire to be warm or cool or maintain a moderate temperature with the body. All the things that we would say are part of the human condition are part of this distorted miracle impulse where basically every moment of every day you're being called back to God. You're being called into the miracle, being called to forgive.  And that beam of light comes through the ego filter, which is one of lack and need. Then it comes out on the surface of human consciousness as cravings and needs. So even when we're hungry, that's God calling. When we have sexual desire, that's God calling. When we're getting tired and fatigued, that's God calling. You know, when we want stimulation or music or massage, when we're thirsty, that's God calling. You know, the miracle impulse, it would be like a beam of light calling us home, calling us to return back to heaven. When it comes through the filter of the ego, it just comes out on the surface as I need this. I need that. I want this. I want that. So I've already mentioned, like, the 23rd Psalm in the Bible, written by David, the Lord is my shepherd, I shall not want. As long as the mind believes in the ego, of course, there's wanting, because the ego is the belief system in lack. That's where the wanting comes from. There's no wanting in heaven. But you have to work with the Holy Spirit and Jesus on really clearing that belief system in lack, so that you can experience those miracle impulses directly, not through the filter. And what would that be if you experience it directly? Well, that's, there's all kinds of prompts and guidances of what to say, what to do, how to be truly helpful. That's like the prayer at the beginning of the course. I'm here only to be truly helpful. That's why we're called through, of course, miracles to be miracle workers.


Distant giant galaxy clusters, around 4 billion light-years away, have been able to lens galaxies twice that far away. Without gravitational lensing, we would never have detected these more distant galaxies. At these distances, we need to take into account the expansion of the universe in order to determine how far away they are. For that, we use the Friedman metric. With this and a stated set of coefficients for the flat-lamb to cold-dark matter model, we get the galaxy's distance from us when the light we see started its journey. The distance the light traveled to get here, and the distance from us the object is now. Here are a few examples. Astronomer Timothy Hamilton, using the Hubble Space Telescope, discovered these unusual objects now named after him. The objects are the stretched images of a gravitationally-lensed distant galaxy located more than 7 billion light-years away. One appears to be a mirror image. In this case, a precise alignment between the background galaxy and a foreground galaxy cluster 7 billion light-years away produced twin magnified copies of the same image of the remote galaxy. This rare phenomenon occurs because the background galaxy straddles a ripple of dark matter in the foreground galaxy. As the far away galaxy light passes through the cluster along this ripple, two mirror images are produced. Along with a third image, they can be seen off to the side. This Hubble image shows a massive galaxy cluster about 4.6 billion light-years away. Along its border, four bright arcs are visible. These are copies of the same distant galaxy, nicknamed the Sunburst Arc. It's almost 11 billion light-years away. Its light is being lensed into multiple images by strong gravitational lensing. The Sunburst Arc is among the brightest lensed galaxies known, and its image is visible at least 12 times within the four arcs. Here's a closer look at three of them. The lens makes various images from 10 to 30 times brighter. This allows Hubble to view structures as small as 520 light-years across. A rare detailed observation for an object that far away. This is a close-up look at the brightest distant magnified galaxy in the universe known to date. It is one of the most striking examples of gravitational lensing. In this image, the light from a distant galaxy, nearly 10 billion light-years away, has been warped into a nearly 90-degree arc of light in the galaxy cluster. The galaxy cluster that is bending the light buys 5 billion light-years away. Here's another one. The light from this galaxy travel 4.48 billion light-years to get here. These foreground galaxy clusters are magnifying the light from the faint galaxies that lie far behind it. The faint light from these lensed galaxies traveled up to 12.8 billion light-years. It's the gravitational lensing that allows us to see that far back in time. Without the magnification, these galaxies would be invisible for us. This is able 1689. It's one of the most massive galaxy clusters known. The gravity of its trillion stars plus dark matter acts like a 2 million light-year wide lens in space. Here's gravitationally lensed galaxy A1689-ZD1. It is one of the most distant spectroscopically confirmed sources with a redshift of 7.5. We are seeing what ZD1 look like when the universe was only 700 million years old. It is the earliest known galaxy where dust was detected in its interstellar medium. And surprisingly, it has the same ratio of dust to total mass as very mature galaxies such as our own Milky Way.


Hi, I'm Rusty Komori, and this is Beyond the Lines. We are broadcasting live from the beautiful Think Tech Hawaii TV studio in the Pioneer Plaza in downtown Honolulu. This show is based on my book, also titled Beyond the Lines, and it's about leadership, creating a superior culture of excellence, and finding greatness. My special guest today is truly an amazing woman. She has helped thousands of people improve their lives by overcoming their adversities because she is a life expert. She is Alice E. Noy, and today we are going beyond happiness. Alice. Rusty, thank you. So excited to have you on the show today. Likewise. Now, we have so many things to talk about, and I want to start off by asking, where did you grow up at? Many people don't know this. I grew up. I was born in San Francisco, but I was raised in Taiwan, and I lived there about 10 years. Wow. And what brought you to Hawaii? Okay. So, going back a little bit, so I was raised there for 10 years, and then I went to university in America, in California, went to live in Japan. And while I was there, about my third year there, I was in my mid-20s, and I was thinking, what do I want to do with my life? Where do I want to go? And just at that moment, a television show of Konishi, the sumo wrestler, coming to Hawaii, was on the screen, and I thought, Hawaii, I've never been there. I actually never really heard of it. I booked a ticket to Hawaii and came here, loved it. Some synchronous cities happened where I got a job while I was here on vacation. I moved over here exactly 30 years ago this week. Wow. And you speak other languages? Yeah. So, growing up in Taiwan, my mother is Chinese. My father is Caucasian, so I learned Chinese growing up. And then I went and lived in Japan, and I learned Japanese. So, by the time I was 25, I had experienced three different cultures and literally speak three different languages. How was it when you first got here to Hawaii? It was really challenging. The job that I got was an organization that wasn't really above the lines or kind of below the lines. You go beyond the lines. They're below the lines. And so, I dealt with a lot of trauma and craziness, but as you know, challenges is what helped us grow. Yeah. Now, I want to know, Alice. You and Alan Wang. Alan is your husband and such a great guy. I love his restaurant. How did you and Alan meet? I was exercising at the Honolulu Club. And we would just meet and talk by the water fountain. And I was unaware that he was a chef. And when I asked him what he did, he says, oh, I flip hamburgers. And he said it jokingly, but I took it seriously. So, I thought that he worked at the shore bird. And that's how we met. And I think sometimes it's great to meet people and meet them with their hearts versus their titles. And so, I just immediately felt like he was just such an amazing person. And later found out what he did. That's funny because I see him at the Honolulu Club, too, working out. He's such a great guy. Very humble. Yeah. And that's what I learned. He didn't come out and say, I'm this award-winning chef. He just said, I flip hamburgers. And we talked about life and we talked about things that mattered to people. And I found that that was really inspiring for me. Alice, I want to show you a picture. OK. OK. Who is this in this picture? OK, this is the first time this picture is being shown publicly. OK. So that is me. And if you look at that picture, it's very difficult to probably imagine that was me. And I was in my 20s at that time. And I was 40 pounds heavier, 1,000 times more unhappy. I did not have any control of my life. And I just hated life. And I was in a really bad place. So tell me more specifics about that, because it seems like that was like your lowest point. Yeah. So I think we can all relate to a part of ourselves that don't feel included, that don't feel good. So that's me that was unhappy, was expressed outwardly through my behavior, how I ate, how I thought. At this sort of victim mentality, like, why me? Life is horrible. And now what's so interesting is looking back, I realized life was great, but I was focusing on all the things that weren't good. And that created the reality that I absolutely lived. And so I think my story really relates to everyone. Like we, none of us grow up with full confidence thinking that life is perfect. So that's me. So at that time, OK, at that time, how did you deal with, how did you overcome that? You know, I really didn't. I think I just stayed in that place for a long time until one day, I remember this specifically, I was in my final week of college and back then we would pass notes and some person I didn't know passed a note to me when I opened it up and it said, do you even know what happiness is? Are you ever happy? And I'd never questioned happiness before. I just didn't like my life and I just hated everything about the people and the situations that I had to deal with that I dealt with growing up. And I think that was a wake up to, wow, happy, what is that? And so it was a period of from there, maybe from my 20s to my 30s, 40s, even now until my 50s where I'm constantly looking for, how do I reach that next level? Because we have so much more ability to shape our lives than we think we do. And Alice, that makes sense to me now because you dealing with that major adversity in your own life, that's why you're able to help thousands of people improve their lives to really overcome their adversities. Yeah, I feel like I can connect to adversity because I feel like I've been through everything, everything from emotional abuse, physical abuse, to being disempowered, to looking at the negative. I mean, everything you share with me about any client that would come and share about their challenges. I've experienced it in some way, shape, or form, and I get it. Yeah. And Alice, you write a weekly column for Midweek and the Star Advertiser, and I love reading your columns.  Tell me about present focus. How important is present focus? Well, if you think about it, what we're doing right here this moment is seeding something. Right? So what we say, what we do. It seeds tomorrow. Everything you are today is a collection of yesterday's. And sometimes we tend to delegate to our future self to deal with everything we're dealing within the present moment. So for me, present moment focus is just asking ourselves mindfulness, being aware. What am I saying? What am I doing? What am I thinking? How can I create my life to be something that I'm responsible for rather than throwing blame on everything around us? So when you focus on your life and you allow other people to focus on their life, then we have more fuel for the journey. And, you know, as a coach for my team, I would always highlight past focus, future focus, but we should all be in present focus. Because this is where everything happens right now this moment. And if we always focus on what's not good about our life or what's not good, you're going to look back and have some pretty unhappy memories. But even in the midst of adversity and challenges, which everyone is going through in some way, shape or form, if we know what to focus on, at least we can start to use that to create a better tomorrow. Yeah, no, I love that. And speaking of books, OK, you are an author of multiple books, Mindful Moments, More Mindful Moments, your new book called Master Your Superpowers.  And I'm just starting into the Superpowers book. Tell me about Master Your Superpowers. Master Your Superpowers is my eighth book. And it's it's my favorite because what I did was I took an ancient system of the five Chinese elements and I personified them. And then I went further and created superheroes out of each of them. And it's a personality assessment test. And I believe that as human beings, we want to know who we are. We want to know how we belong. And I created the system so that we could understand ourselves and get along better with each other and understand that people we live and work with. Yeah, and you you're helping like the fire department and a ton of organizations right now. How's that going? Yeah, it's going great. What what happened? We launched the book in March and immediately I was able to take it into all of my corporate work. And we've been doing team building with it. We did.  There's lots of companies that are looking to say, who am I? What are my strengths and what are your strengths and what are our weaknesses? And how do we how do we neutralize our weaknesses and improve our strengths? And how do we understand each other? And how do I communicate with you if I know that you're a quiet type? Well, what are you good for? Right, so how do I understand you and not like get upset at you for being who you are? Yeah, and your your first book, Mindful Moments. You know, how did that come about? So Mindful Moments is just a collection of my weekly midweek articles that come out every Wednesday. It's on Pamela Young's page. And that just came from people coming up saying, I cut it out, I cut it out, it's tattered, it's torn. And I just ended up putting into into a book. And what I love about that is it's all about perspective, attitude, mindset. I mean, literally, you can turn to any page and really get something out of it that's tangible, that's relatable right now. Like a fortune cookie, like a fortune cookie. Just open it and see what you get. Usually it's relevant to your life. That evolved because I remember Reverend Osumi, you might be too young. Oh yeah, yeah, yeah. Okay, so years ago when I first moved to Hawaii, remember there, he was a newspaper articles called Thought of the Day, Daily Thought of the Day. So that in some way, shape, or form inspired me. So I wanted that, what I do to be kind of the modern present moment version of life wisdom. Yeah, and you are. Now Alice, you talk about love and wisdom being the two most important things we need in life. Can you expand on that? I think what I mean by that is that no one can take away from you the love that you have in your heart. Whatever love that you've cultivated or your family, for your community, for yourself, for the things that you're doing, no one can take that away from you. And that is what helps us to fill that void within us. So love, no one can take it away from you and it's important. Wisdom, it's the same thing. It doesn't matter what's going on in your life. If you can cultivate your wisdom and you can have love and wisdom in your heart, you're never gonna be in trouble. You'll always have the strategies that you need and the love and the trust and the balance that you need to see things from a bigger picture. And in the midst of our challenges, we have support, but we sometimes don't see it. We just wish the challenges would go away. So love and wisdom, we have love for ourselves and even love, love of the challenges because life is not here for us to just have an easy time. We're in life so we can grow and there's never a moment that you're not growing. So if you're not growing, you're stagnating or worse, you're decaying. So that's sort of the mindset behind that. I love it. Now what are your thoughts about fulfillment? So fulfillment is to me feeling filled from within and I think our society and just the times where now we go through stress, we don't want that stress so we look for outside things and that splits us from the core of who we really are. So for me what I think about fulfillment is looking at the things that do fill you up and not judge them because we're told when we're younger you have to do this to be happier, that to be successful or this, that, this, that. So we get sort of fed to us structures, even our culture, our authorities tell us how life should be and so we start to do what others think we should do and then we feel like we're not really happy so then we go outside to look for what's happy and it's kind of a inverted way of thinking. So fulfillment to me is saying what is important and making sure that you are centered and focused on that here regardless of what the voices in your head are saying or your society, your culture are telling you how you need to be. Makes sense. Now I want to ask you your thoughts about jealousy because oftentimes when people or teams become successful there's other people that get very jealous of their success and I always say they actually admire that because if they didn't, why would they care anyway? What are your thoughts about jealousy? So there's two thoughts on that. One thought is the person that is jealous, yes exactly to what you're saying it's like they feel that they don't have it but I believe that every single person has every single thing within them to fulfill their life. I really believe that but we think that someone else has what we don't. So when people are jealous they're simply upset at themselves for not going out and doing what you've done so that's one thing. Oftentimes people will say that jealousy is a form of negativity people wanting to bring you down. Now you know this world is polar we have day and night, up and down, left and right happy, sad, right? So you're never gonna have one without the other. So the greater amount of negativity that you see coming at you that's your cue to find all the positivity that's within you to balance that out. So what I would say a leader if you can only withstand one unit of negativity you can only impact one unit of positivity in your field but the more negativity you can handle the more positive that you will have and the greater you'll be able to grow. So to me I love it when people write in you love and you're saying that you love what I do but there's many people that don't and we get lots of letters and lots of disagreements with what I'm doing and what I'm writing and in the beginning it used to bother me I wanted everyone to like me what this is positive this is good but the truth is for every person that loves me there's gonna be a person that dislikes me with equal intensity and the more that I can see that manifest the more of an impact I know I'm making on the world. So I welcome negativity I embrace it because I know that helps me grow. Well what a great perspective to have but you know I feel so much positive energy from you I mean how can anyone not like you? Well when the camera goes off I get really negative you know talk to Alan I'm the worst nightmare to live with. I'm just kidding I think it's a range it's a spectrum I try not to I and this is this is the good thing try not to be over positive because you know what if you try to be over positive guess what one negative things happen it's gonna take you right down to balance you out so yeah so I may appear to be positive to you but I'm constantly monitoring myself right so don't you hate when people are like extra positive oh yeah like it's so great and love and like when you're overly positive that's when you're gonna draw the negativity to you so the key is to remain in balance so fulfillment happiness it's all about being in balance not being not putting yourself up and not putting yourself down not looking down or looking up okay yeah it's just being here right now present moment focus enjoy the moment yeah no it is it is the moment and that's all we've got right what else do we have but these moments that we string together that are the tapestry of our lives and so if these moments we're not mining the moment for the good then we're not really creating a beautiful tapestry for our life and and for others to be inspired by Alice we're gonna take a quick moment of a quick break and when we come back we're gonna talk about going beyond happiness still okay we'll do it you are watching Beyond the Lines on Think Tech Hawaii with my special guest Alice Inoi we will be back in 60 seconds Hey hello everyone and welcome to the Think Tech Hawaii studio my name is Andrew Lanning I'm the host of The Pretty Matters Hawaii we air here every Tuesday at 10 a.m. Hawaii time trying to bring you issues about security that you may not know issues that can protect your family protect yourself, protect our community protect our companies, the folks we work with please join us and I hope you can maybe get a little different perspective on how to live a little safer Aloha Hi guys I'm your host Lillian Cumick from Lillian's Vegan World and I come to you live every second Friday from 3 p.m. and this is the show where I talk about the plant-based lifestyle and veganism so we go through recipes, some upcoming events information about health regarding your health and just some ideas on how you can have a better lifestyle, eat healthier and have fun at the same time so do join me I look forward to seeing you and Aloha Welcome back to Beyond the Lines on Think Tech Hawaii my special guest today has helped thousands of people improve their lives by dealing with challenges in a positive way she is life expert Alice Inoi and today we are going beyond happiness Alice I can talk with you all day I mean I could do literally a 10 hour show with you I'm in Now I want to ask you your thoughts about my book Beyond the Lines Okay what I loved about your book was that not only did we get to know about you but that you were able to take something that you did and translate that through life and leadership and as we were speaking earlier it's just about leading yourself right it's one thing to lead yourself it's another thing to lead others and I love the way that you did the parallels Yeah I have a lot of stories and examples in there and stories, stories connect us and I love the stories I love just even the thought that you were able to extrapolate all that you did and put it in such a succinct way that it's like a workbook Well you know Alice I'm glad that some CEOs are using it as training tools in their management meetings but you know I only wrote one book you wrote eight you're like my idol It's really all it is is like well you've won 22 national championships so you're my idol I think what's really great is that if we can open up to see the brilliance that is around us then we can improve ourselves and so when we're small minded we just see what they have what we don't have but if you can see that someone has what we also have the potential to develop within us then we win then we can go beyond just small minded thinking yeah then we go beyond the lines right like I shook your hand beyond this line so chapter one the title is the choice is yours how important is choices well I think choices make up every single thing in our life and we I will hear people say I was born to a disadvantaged situation or you don't know my family or you don't know my my situation but even when you are the most oppressed we have a choice and the choice that we make and that's what I mean nobody can take away the love we have in our hearts the wisdom we have so the more that wisdom you have the more you can go within and make a choice to see things in a different way full spectrum how you have to look at your life not just a slice our perspective sees things like this when it happens to me I feel like disempowered I want to blame somebody for what happens to me but if I change that to how did this happen for me then I see the benefit of the negative somebody stole my money oh my god that's horrible I can focus on that develop resentment anger at the person that that betrayed me that way but I can also say well did it not learn me to draw stronger boundaries around how I spend my time and money does it did it not help me in the future so we have to mind the moment for the positive hindsight is 2020 if you can see it in the moment you master your life so in every single thing that's happening to whether it's awesome or not awesome it is helping you and hurting you at the same time wow yeah interest that's balance that's the balance so you can get a whole bunch of money and you can say that's all I want money is great but the truth is you get a lot of money you're gonna get lazy you're not gonna work as hard you're gonna have to say no to people that want to borrow money you're gonna be looked at as a bad person you're gonna have to buy more things get more accountants it's gonna be a crazy mess so the good is coupled with the bad no money we all know how that feels but there's good because we search and we're finding more meaningful experiences so yeah no and mindset is huge and how do you help people have the correct mindset and then make that into a habit well number one I love what we do well I'll just say with happiness you my school which is a personal growth studio as well as the majority of my time is spent training at companies and organizations and the secret is practice every single person has the ability to look at something different but when we're close to it we don't look at it so the secret really is to practice so when you say how do you become more mindful it's the practice being more mindful how do you become more positive it's to practice looking for what is more positive people feel that negativity is something they want to get rid of negativity is something you want in your life embrace it because it's helping you grow so if we can find the positive within the negative situation that's how we grow yeah does that make sense it makes sense I get it it's like the good stuff is good that's gonna come and we can be appreciative and be grateful we're always grateful and appreciative for what's good but whoever says oh thank you for these challenges thank you for all these hardships those are the things that we need to focus on and we have to focus on it consistently because you know you can't just say I want to be a great tennis player and just not do anything right so I think it's it's mindset is the focus and how do you do it? consistency yeah I totally agree that's sort of I mean we would work with my teams on that I mean every single season you gotta have the right habits but you gotta have the right mindset yes and people will say why is it so easy to be negative and so hard to be positive like I try so hard to be positive but my goodness everything just gets me down how do you think that is? well I mean a lot of it too is you know it takes just as much energy to focus on being negative as it does to be positive it does it's just you need to train yourself to be positive and the more you train yourself the stronger the muscle is and we live in a world of gravity everything goes down right we're laughing early droopy your body falls down your your mind goes down right when we're tired we lay down so in order to be up we have to practice being up we are negative by nature did you know that we have to be negative to defend ourselves against challenges we have to be negative and so it's part of our DNA but we can also always choose choose to be positive you can't get rid of negative but you can choose to add positivity to your life and it has to start with one little tiny speck of I'm going to look at this differently and we don't want to be droopy no droopy like who wants to be droopy the older you get the more upy you want to be yeah but the mindset is like that the more you practice the stronger it is so you can stay strong and resilient even in times of challenges and that's the beauty of practice and everyone has that ability to make that choice and to make changes in their life to look at things differently and Alice you've been doing tons of inspirational speaking for many businesses many organizations I mean and you do a lot of one-on-one life coaching as well and earlier you talked about being grateful how important is gratitude? gratitude is extremely important and one thing that people do not know about gratitude that I always want to share is it's not enough to say I'm thankful for my family I'm thankful for my health I'm thankful for my job that's what usually people do when you ask them what they're thankful for in order for it to specifically work on your brain so that you can build resilience you have to say I am thankful for my health because I can walk with my family from Disneyland or you have to be very specific about what you're grateful for and when you do that it rewires your brain it makes your brain start to look for what is good so it's important because if you're not if you it's like if you gave me a gift and I never said thank you you gave me a gift I never said thank you eventually you're going to stop giving me a gift so it's like the universe is like that there's all these gifts that you've been given but if you keep focusing on what you don't like and what you don't want you're going to stop getting gifts gratitude is important because not only do you feel better when you recognize what is awesome in your life but then you also get to attract more of it and I think we all we're all kind of addicted to the positive we all want more of what's good but we have to embrace what's not good yeah and our social media is such a big part of our society now yeah and in your book you talk about the Facebook reality is not life's reality tell me more about that yeah so what I started noticing is that as social media started to become more and more prevalent that it's really a curated one side reality of the situation but as you start putting out the reality of what you want people to see then more so you want to hide the part that you don't want people to see so we start to create a split and then we have all these people looking at all the one-sided reality looking at where they're lacking not recognizing that it's just one side of the story and we jump to stories we jump to conclusions and we're negative by nature so we're going to look at things and look at where we're not so yeah and I found that to be interesting and it's true and we're joking it's like I'm going to post when I have lots of students at the school I'm not going to post when nobody shows up right so we create a one-sided reality of what we want people to see yeah it totally I mean you're so spot on it's so funny though but it's true and then I talk further about if you watch people's streams sometimes people will just show me, me, me, look at me I'm happy with my relationship look at me I'm in this awesome job me, me, me and that's very narcissistic after a while that's not a balanced feed but then you have people that all they do is here look at this positive quote here I'm sharing this with you very altruistic but why would I listen to you if you're not somebody so we need a balance of narcissism and altruism together in order to create balance so if I show you I have value because I'm on Rusty Calmore's TV show then when I give you advice people might listen do you see if I'm just always giving, giving, giving then I have no value so that's what I noticed about social media I love it Alice before we wrap I want to ask you one more question what gives you fulfillment? hmm for me what gives me fulfillment it's, it's, it's really I guess it's, it's owning what I love like really owning what I love and not letting others say what I should and shouldn't do with what I want to create and that's not easy for any of us right we all have a secret desire inside to be someone or do something or have something and if you can trust that that's who you are and you own that then there's a sense of fulfillment with that so for me I think this path that I've created it's never been fully supported even though it seems very positive but there's a lot of things that I had moved through so I feel my, what makes me feel fulfilled is I'm doing what I, what I really love to do and sometimes that's hard for people to create that in their lives but I just would want to encourage anyone who feels unfulfilled in their life to trust their heart and take action and know that anything that you want in your life you can create that if you are looking for how it's possible versus talking about how it's impossible Alice, I want to thank you for being on the show today I mean and sharing all of your great insights I, I want more Alice Enoy's in the world Okay I'll um, you ready? somehow make that happen ha ha ha ha ha ha Thank you Rusty, I really appreciate your time Thank you Alice and thank you for watching Beyond the Lines on Think Tech Hawaii for more information please visit RustyKamori.com and my book is available on Amazon and Barnes & Noble and Alice's books are available on Amazon I hope that Alice and I will inspire you to create your own superior culture of excellence and to find your greatness and help others find theirs Aloha


Hello, and thank you for joining my talk. My name is Mark and in this talk I would like to demonstrate to you a method for deriving information from running our code. I will show you a few demos during this talk and you can find all the code for the demos in this GitLab repository and the code will also be uploaded to the conference website. Before I start, let me give you a small example that we will use as a kind of running example during this talk. Here I have created a small production script, which is sort of a prototype for the production script. We read some data, we filter out some bad cases, we aggregate the data computing the means over column 3 and 4 grouped by the values in column 1 and 2, we write this output to another CSV file and we warn the user that we're all done. So this is kind of a prototype production script where you read data, process it and write it out. Now what I would like to do is when I run such scripts in production is to maybe tap some information. For example it could be interesting to see how much memory is used after each statement or you could maybe measure how much time it takes to run each expression or maybe you want to see what happens exactly to the data that you read in and what expression does what to the data. So you can sort of estimate the influence that every step has on your output. So in general there are all kind of interesting ways in which you may want to follow the run of a production script while it's running. This talk is about a very general method that you can use to write software that actually can derive such information. So I want to derive this information and I have a few demands here. I have a sort of primary data flow that's the script that's written by the user, that's a script that you just saw. It reads data and step by step by step processes and writes data in the end.  The person who wrote the production script should not be aware or as little aware as possible of the fact that information is being tapped off and it should also not interfere with the process that is running here. So you would like to separate these two processes as much as possible. This is kind of the main challenge in this method. So let me first give you an example of what you could expect from a method like this. So here is an R session and one way to run a production script is to use source. So source is a base R function. You can give it a file name and it will run all the R code in that script. And if I do that, the script is called MyScript. If I do that, the file will run and in the end I get a message indeed all done with the penguins and I can actually read the output and here's all the aggregated data. So that's what you expect. Now I wrote another function, kind of a variant of source called runFile that also runs MyScript. That's exactly the same thing except that it also counts the number of expressions that were run in the script. So I'm going to use this kind of as the hello world example with the idea that if you can run a script, count expressions and have some control over how they are counted, if you can do that, you can do more complicated things as well. So let's see how this runFile function works. Because having a runFile kind of function is like the first step in the method. So the runFile is the easiest part, I think, of this methodology. What it does, it's a function, it accepts a single argument called filename. It reads that filename with a function called parse and the output of parse is just a list of expressions that are in the file. I create a new environment and an environment for R you can think of as a place, a box, a cabinet where R can store and retrieve variables. So we create a new environment, I initiate a counter and then for each expression in the list of parsed expressions, we evaluate the expression in our runtime environment. So when the data is read, for example, using read.csv, the data variable called penguins is created in this runtime environment. After evaluating the expression, we increase the counter and when the loop is finished, we print the number of expressions that were evaluated, and we return the runtime environment. So it's kind of a variant of source, a very simple variant, but it does a little bit extra, it allows us to inject a little bit of code between running the expressions. And the important thing is, the user never sees this variable and expression. The user script will only see what is stored here in runtime. So this really separates the two environments flows of data, if you will. Okay, so this is kind of the easy part. The more the harder part or what took me at least the longest time to figure out is how to make it possible for a user who writes this script to influence how data is stepped while you are running the script. So for example, ideally, I would have a situation like this, where a user just writes a script, and maybe the user wants to have some control over when counting is actually starting. So you could call a function start counting, everything is count until here, and then stop counting, and then these two expressions are not counted anymore. And then the question is, how do we get the information that a user gives the signal I want to start counting or stop counting? How do we get that information into the file runner? Okay, so if you know, already some are programming, there are a few things that will are kind of easy to think of. So one thing you could do is say, okay, start counting will set a global variable in the user environment. And then the file runner can detect that. That's not really desirable. We do not want a function to write something in user space because it can influence variables that the user created for another purpose, for example. So we rather not do that. Another option is to sort of set it as an option or an environment variable, which is a little bit, it's still in the user space, but a little bit on the edge, let's say. But that's also not desirable, because suppose that the production script crashes halfway, and an option was set, then this option is set even after the crash. So then you leave behind a state that's different from when the script was running. So it's also not desirable. And the third thing you could think of is run file is now at the moment only reading and executing expressions. But it could also sort of analyze the user expressions and see whether start counting is is run yes or no. But that makes it hard. And especially if start counting would have some arguments, for example, to, to, to really analyze it in a way that's very generally usable. So we would like to basically let our do the work as much as possible. So we don't have to think about it. And there is a trick for that. So the main idea is the following. We make very simple user facing functions. In this case, our functions start and stop counting just emit true and false. And we make sure that these results are captured by run file. And there are two techniques that I use for this.  So a side effect is where a function alters something outside of its own space outside of its own scope. But I'm going to do it in a very controlled way.  So we make sure that the correct function is seen when we want it. It sounds a bit mysterious. But let me show you a demo what I mean with local side effect. So what I'm going to do is first I'm going to create some storage room. An environment in our again is a place where I can create, store and look up variables. So create a new environment called store. Now I'm going to make a function called new mean. And I'm going to make that function using another function called capture. It's a function that I wrote. And capture accepts three arguments, a function that is going to mimic sort of storage room and the name of the variable that will be created in the storage room. Okay. So let's see our store is empty. With LS, we can see what's in the store. If I use mean, I just get a result that we would expect. If I use new mean, I get exactly the same result as mean. So for me, the user new mean behaves exactly like mean, except if I now look in store, there is a variable created. And I can actually access that variable. And you see that the output of mean has now been copied to out as well as sent back to the user. So this is what I call a local side effect. The function new mean has a side effect. But it's in a place that I can specify very well by using this capture function. So let me show you what this capture function looks like. Here it is in the bottom half of this slide. The capture function accepts a function, an environment and the name of a variable that will be created in the environment. And it returns a function. And what the return function does is it just executes the function here with all the arguments that the user supplies. It stores the output, copies it into this environment under the name given here, and returns the output. So it's a very short, very simple function. If you want, you can even do it with one line of code less. But it takes a bit of knowledge and trickery of knowledge of our to come up with it. And it's one of the things that at least took me some time to figure out. Okay, so the second trick is called local masking. So the user sees the function. This one this is the user facing function. If a user inspects this function, it will just see start counting. And it will just return true. What we are going to do in our file runner is the following. We start the same, we parse the file, we create a new runtime. Then we have three lines of code extra. We create a store. And in this store, we create a captured version of our start counting function. And we also create a captured version of our stop counting function. Now, remember, when we started when we were started evaluating the user expressions that are stored in past, we looked over every expression in past, and we evaluate this expression in runtime. So now, when a when a user calls start counting, it will not find the user facing function, it will actually find the captured version of this function. And the captured version will not only return the value to the user, but also send that value to the store. And now to be to count when the user wants it, the only thing we have to do in here is to check whether store dollar count is true. And if so, increase the counter. And if not, we don't give you a very short demo to convince you that it works. My script two is the version of the script where start count and stop count is called. And now you see we counted only three expressions. Okay, so some applications. The first place where I use this is in the lumberjack package, which allows you to run a file. And user in the user's file can say start log on this R object using this logger.  So this is the user facing function. And run file runs the file and you can follow, for example, a data frame. And afterwards you can read which expression did what to what cell in which data frame. Another application is the tiny test package that I built. Tiny test is a package for unit testing. It allows you to include unit tests, for example, in a package. And here the user facing functions are the expectation functions. So you could say expect the output of some calculation to be equal to a known value. And all these expect values are the user facing functions. And then what the function run test file does is just run the script that contains these expectations. And then capture all the output of these expectations and organize this in a nice way so the user gets a nice overview of all the test results. So two very different applications. But the exact same technique is applied here with a very clean separation between what a user sees and what the code sees that is deriving information. Finally, if you would like to read more about this, I wrote a short article for the R Journal. It's not published in the R Journal yet, but you can find the paper in the archive in the link shown here. Thank you for watching.