Champions League playoff fixtures announced

first_imgThe play-off fixtures for the third round of the Champions League have been announced following Monday’s draw in NyonThe ties have been separated into a champions path and a league path with the winners of the six fixtures set to be entered into the group stage draw.Eredivisie title holders PSV Eindhoven will face either Qarabag or BATE Borisov in the Champions path, which will take place between August 21 and 29.Benfica, whose four-year dominance of Portugal’s Primeira Liga came to an end last season, will first face Turkish giants Fenerbahçe before they can take on either Greek side PAOK or Spartak Moscow from Russia.Top 5 Atletico Madrid players to watch in next week’s UCL Tomás Pavel Ibarra Meda – September 14, 2019 With the Champions League about to start, we need to start talking about the Top 5 Atletico Madrid players to watch in the competition.Atletico…The exact third qualifying round contenders will be concluded on August 14.Champions League play-off draw Ties on 21 & 29 August: Champions path Crvena zvezda (SRB)/Spartak Trnava (SVK) v Salzburg (AUT)/Shkëndija (MKD) Qarabag (AZE)/BATE Borisov (BLR) v PSV Eindhoven (NED) League path Benfica (POR)/Fenerbahçe (TUR) v PAOK (GRE)/Spartak Moskva (RUS)Ties on 22 & 28 August: Champions path Young Boys (SUI) v Astana (KAZ)/Dinamo Zagreb (CRO) Malmö (SWE)/Vidi (HUN) v Celtic (SCO)/AEK Athens (GRE) League path Standard Liège (BEL)/Ajax (NED) v Slavia Praha (CZE)/Dynamo Kyiv (UKR)(As reported on the UEFA website).last_img read more

Minor Flooding Observed On The Kenai Peninsula

first_imgFacebook0TwitterEmailPrintFriendly分享The remnants of Typhoon Maliksi has brought heavy rain to much of the Kenai Peninsula causing water levels to continue rising throughout the area, especially in the Seward area. DOT is also advising drivers of minor flooding on the Sterling Highway at MP 52.5 (Gwin’s Lodge) and at Sawmill Creek. They are advising drivers to be aware of water on the roadways. The City of Seward has been notified that the State of Alaska Department of Transportation has closed the main runway of the Seward Airport for 24 hours due to flooding. Photo courtesy of DOT: flooding on the Seward Airport runway and on Sterling Highway The National Weather Service has also issued a ‘flood watch’ for the Kenai River area in Cooper Landing. The flood category was changed from no flood to near flood stage as of 6 a.m., this morning. City of Seward Public Works suggests that a combination of high tide and several days of rain flooding the Resurrection River have contributed to the flood event. Reopening will be reevaluated after 2 more tide cycles. At this time, the water is 12 feet from the center line and has started to over top the rock embankment.last_img read more

Daimler ships out first electric Freightliner semi truck in the US

first_img Tags Freightliner Electric Cars Car Industry Trucks More about 2019 Mercedes-AMG GT53 4-Door Comments Check out the Level 2 Freightliner Cascadia big rig at CES 2019 Review • 2019 Mercedes-AMG GT53 4-Door review: Defying expectations Now playing: Watch this: 22 Photos 2019 Chevy Malibu review: Swing and a misscenter_img 2020 Hyundai Palisade review: Posh enough to make Genesis jealous 2020 BMW M340i review: A dash of M makes everything better Share your voice 3 The first self-driving big-rig hits the road in Nevada 1:53 More From Roadshow Look for the first ones in Southern California Daimler First came the electric Freightliner box truck, and now we have the semi truck. Daimler said on Monday it’s built the very first eCascadia semi trucks and they’re on their way to the first lucky customers in the US.If the eCascadia looks and sounds familiar, that’s because it’s based on Freightliner’s normal Cascadia semi. Rather than its internal-combustion engine, there’s a battery-electric powertrain with a 550-kWh battery pack. Daimler has previously said the electric powertrain makes 730 horsepower and is good enough for 250 miles of range. Plug the big semi into the right connector and 80% of the battery’s capacity returns in 90 minutes.The electric semi isn’t exactly going into production just yet, however. Instead, the first eCascadias will be part of a “Freightliner Innovation Fleet” before the truck enters series production in late 2021. Penske and NFI are the two companies that will add the electric semi to their ranks first.Penske also took delivery of one of the first eM2 box trucks, the other electric truck from Daimler’s Freightliner division. Each of the eCascadias will operate in Southern California by the end of the year. Freightliner said it will deliver additional eCascadias to customers throughout this year.Effectively, Daimler has beaten Tesla to the electric semi market. The Silicon Valley-based automaker has promised the Tesla Semi will enter production soon, but so far, it hasn’t. Instead, the Semi has been used to deliver other Tesla vehicles and haul between the Gigafactory and various places.Yet, Daimler has spread its electric truck portfolio out. Not only does it have the eCascadia and the eM2, the automaker also showed off the Fuso eCanter and even an electric school bus.last_img read more

Exhuming Unmarked Graves In Sugar Land Inside The Process And What Can

first_imgCourtesy KTRKNearly 100 unmarked graves were found in Sugar Land on the site where Ft. Bend ISD is building a new career and technical center for the district’s students. To embed this piece of audio in your site, please use this code: X Nearly a hundred unmarked graves in Sugar Land will be exhumed after a judge earlier this month granted Fort Bend ISD permission to go ahead with the process in order to build a $59 million career and technical center for the district’s students.Workers discovered the bodies earlier this year. The process if expected to take about a month and cost around $1 million.The graves are believed to contain the century-old remains of African-American prison inmates. The area is near the Old Imperial Farm Cemetery, which contains more than 30 graves of guards and prisoners who were once part of the Imperial State Prison Farm. Houston Matters reported on that site back in 2016.Fort Bend ISD Superintendent Dr. Charles Dupre joins Houston Matters to explain the process of exhuming the bodies.Then, University of Houston anthropology professor Dr. Ken Brown explains why he thinks someone with a specialized knowledge of African-American history needs to examine the remains.center_img 00:00 /15:13 Share Listenlast_img read more

The Challenges Of Being A Black Millennial Mom

first_imgBy Christina Sturdivant Sani, Special to the AFROMy son turned 10 years old last month, which means I’m a whole decade into this mom life. And truth be told, sometimes I’m still shocked that I’m responsible for an entire little person. After getting pregnant unexpectedly in college, my life shifted and I was forced to move with it—controlling what I could and coming to terms with things beyond my control.Christina Sturdivant SaniAFRO contributor Christina Sturdivant Sani and her son.With Black millennial moms in particular, there seems to be a self-imposed pressure to succeed, according to Nikki Osei-Barrett, co-founder of District MotherHUED, a group that hosts events for millennial moms of color in the D.C. area. “My biggest challenge is balancing my overly ambitious nature with motherhood. I’m team do-the-absolute-most and it (often) takes away from my family,” Osei-Barrett told the AFRO.Unsurprisingly, Osei-Barrett is not alone. Below is a snapshot of challenges that Black millennial moms in the region face and how they are learning to progress. They are looking at themselves in the mirror—facing their perceived shortcomings and celebrating their beauty. They are overcoming fears and talking to their children about being Black in a racially-charged America. They are unabashedly relying on friends, relatives and counselors to get them on the other side of roadblocks. They are liberating themselves from society’s expectations of the ideal mom and paving their own ways with creativity, strength, and intuition.************************************************Aviance Amponsah-EfahAviance Amponsah-Efah—Homemaker, worship leader, and mom of three from Triangle, Virginia.What’s your biggest challenge as a millennial mom of color? My biggest challenge is remembering who I am as an individual. When you have kids, it consumes your life. All of a sudden you go from working on your goals to devoting all of your energy to making these little people great adults. You forget about yourself. You forget about your personal goals for yourself. Your reason is totally ‘I have to do this so I’m a good mom’ not ‘I have to do this to make myself happy,’How are you learning to overcome this challenge? Forcing time to dedicate to my personal goals.************************************************Brittney Simpson—Human resources manager and mom of one from Northwest, D.C. What’s your biggest challenge as a millennial mom of color? It’s difficult being the first within my friend group to become a mommy. It definitely has altered the friendships. Some friends have begun to distance themselves while others have fully embraced my new responsibilities. I don’t feel any sense of obligation to my employer. I’d rather be a stay at home mom for now and return to work later. I may go back to school in the meantime.How are you learning to overcome this challenge?I have a therapist. I spend time with friends who celebrate me and my son.************************************************Cierra Jennings—HR specialist and mom of one from Silver Spring, Md. What’s your biggest challenge as a millennial mom of color? Raising a young boy can be scary—especially seeing so many killings or our young black boys, the Me Too Movement, etc. I constantly feel the responsibility/pressure to make sure he understands boundaries and how he should respond in certain situations. I want to make sure he is respectful, kind, and treats people the way he wants to be treated. There are so many potential obstacles and mistakes that could be made. And as a parent, you want to know that you did all you could do to guide them down the right path.How are you learning to overcome this challenge? I’m learning to not let fear be the motivation—to keep things in perspective. I’m always going to take my responsibility as a parent seriously and do my best to prepare him to be a positive, contributing member of society—but not out of fear of what may come, out of love and because I want the best for him.************************************************Shar’del Haden—Photographer, writer, and mother of three from White Plains, Md. What’s your biggest challenge as a millennial mom of color? My biggest challenge is finding time for the things I want to do.How are you learning to overcome this challenge? I am learning to make time regardless of whatever else going on—I strive to make time for ME. ************************************************Niki Montgomery—Marketing/communications consultant and mother of three from Fort Washington, Md. What’s your biggest challenge as a millennial mom of color? As a Black millennial mom, there is an unspoken pressure to do and be all, and multi-tasking is often the vehicle. My biggest challenge has been learning NOT to multi-task. Multi-tasking is typically perceived as the best way to ‘crush your to-do list’ and get a ton of things done in a short amount of time, but for me has resulted in a lack of focus and a failure to be present.How are you learning to overcome this challenge? Being intentional about being present and focusing on one thing at a time.************************************************Folasade’ OgunmokunFolasade’ Ogunmokun—Media CEO and mother of one from Fort Washington, Md.What’s your biggest challenge as a millennial mom of color? I think the biggest challenge so far as a Black millennial mom is that I’m trying to change the world that my son will live in, while at the same time raising my Black son. There are still lynchings, still racism, still sexism happening and my son sees it all. My job is to show him a different picture and make the world see it too.How are you learning to overcome this challenge? You don’t exactly overcome a challenge like this, your become it. Everything I do effects this narrative. Everyone I bring my son around effects it and I have to learn to be transparent but also show strength, determination, and change.************************************************Patrice Hagan—Public relations manager and mother of two from Virginia. What’s your biggest challenge as a millennial mom of color? I’ve found it very difficult to balance making time for myself without guilt that I should be doing more for my family all the time. I give my family my all and sometimes I’m on “E” when it’s time to pour into myself. Although I know in my mind that self love and self care is essential, finding that balance of self care and care for my family is a daily art that I’m trying to practice.How are you learning to overcome this challenge? I have learned that without crying for myself, I’m no good to those I love and [am] caring for. I can’t pour from an empty cup. After having my children, my sense of self got blurry for a while. I became a full blown mommy, losing bits and pieces of myself and losing sight of the things that brought me joy—outside of my husband and children. So I’ve made a conscious effort to rediscover those things that make me happy and have made time to enjoy doing and practicing those things to ensure that my spirit is fed, in some big or small way, each day. This helps to avoid resentment and burnout when taking care of my family at the capacity that I do.************************************************Kalyn Hall—Marketing professional and mother of one from Rockville, Md. What’s your biggest challenge as a millennial mom of color? The workforce is not embracing or very flexible in ways that make it easier to handle motherly duties. From a your daily schedule to child care and managing daily/household routines. It is a constant challenge that only colleagues with kids actually understand and most of the time your boss is not a parent so they are highly insensitive in this regard.How are you learning to overcome this challenge? It is a work in progress but I am learning to ask for help. I have always taken on 100 percent of duties and parenting alone—despite being married. This year, I am committed to delegating and ensuring I give myself time to relax and rejuvenate.************************************************Keisha Blount NelsonKeisha Blount Nelson—Educator, entrepreneur, and mom of one from Elkridge, Md.What’s your biggest challenge as a millennial mom of color?I believe my biggest challenge is simultaneously my greatest reward: growth. Motherhood has challenged me to stretch and grow in areas and in ways that I could have never imagined. I am challenged daily to face my own insecurities and to confront aspects of my identity that I wasn’t quite prepared to tackle.I didn’t want motherhood to expose my issues with perfectionism, but it did when I struggled with trying to be and do the impossible with my son and got burnt out. Chile, trying to dot every ‘I’ and cross every “T” got a sista tired. I didn’t want motherhood to expose my insecurities with weight and body image, but of course that snap back was more of an emotional setback because I was neither kind nor realistic with myself after housing and birthing a human.I didn’t want motherhood to expose my tendency to be non-confrontational, but it did several times when needing to speak up for my son in different spaces. Never before have I felt more pressure in my Black millennial mom skin than having the charge to raise a liberated, conscious, spiritually grounded Black boy in a world that profits from his oppression.How are you learning to overcome this challenge?I take one day at a time. I’m trying to work on pacing myself, slowing down my thoughts while processing my ‘stuff.’ I pray… a lot. Rather than avoiding the issues that would usually bring me anxiety, I’ve been ‘doing the work.’ I try to attack root causes and work toward healing and minimizing their impact on his generation.I allow myself room to be imperfect. Rely on my supports: hubby, family, #momsquad.************************************************Phree White—Nonprofit marketing manager and mother of one from Alexandria, Virginia.What’s your biggest challenge as a millennial mom of color?My biggest challenge is dealing with being a reluctant mom. I love my child. She’s amazing. I don’t regret her, but there are times I wish I was an aunt instead of a mom because I’d be able to choose when I wanted to have this responsibility and when I didn’t. I’ve always been pretty self-sufficient and independent. I’m a pretty social person, but there are days when I want—need—to be alone.Because it’s just my child and I, I have no choice but to be there for her. I can’t close a door and tell her I don’t want to interact today or I don’t want to hug her or touch her today because I’m not feeling human interaction.There are days when I want to do nothing but come home and eat cereal and fall in the bed but that’s not possible because there’s homework every night and dinner every night and that whole routine.How are you learning to overcome this challenge?I used to feel guilty because I thought that when you became a mom there was some switch that flipped and you were happy to sacrifice yourself for the greater good of this little human you created and I thought mine never got turned on. I had to learn that me needing space for myself wasn’t me abandoning my child, but recognizing the things that I needed to replenish myself so that I could care for her properly. I learned to create alone time for myself each day and schedule at least a full 24 hours every two months so I could do whatever with no expectations that I care for anyone but me.************************************************Ashlee LaughlinAshlee Laughlin—Entrepreneur and mother of one from Greenbelt, Md.What’s your biggest challenge as a millennial mom of color?My biggest challenge so far as a millennial mom has been balance. I had gotten spoiled by being able to live my life in the fast lane, taking freelance opportunities, and traveling all over pursuing my career in entertainment. But when Taj was born, I initially felt fearful of how I would balance my dreams, my business and motherhood. As a Black mother and a child of a Black mother, you witness all the layers—strength, determination, sacrifice, and all the things mothers endure to ensure you are loved and safe. I want to emulate that. I don’t think anything could have prepared me for such an amazing journey. It’s humbling.How are you learning to overcome this challenge?I am learning that it’s ok to say NO! I think a lot of moms feel guilty because they are either unable to create a lifestyle that allows time for their kids or they are overly committed to growth in other areas. I feel liberated by my ability to create boundaries to protect the bonding time my son and I spend together. Nothing will ever come before him. My balance involves the time I create for my family, which I never realized I’d have to fight so hard for. If I can’t take on a project that requires me working crazy hours, I say no. No was never in my vocabulary before Taj.************************************************Karissa Uko—Senior Manager (events and communications) and mother of one from Lake Ridge, Va.What’s your biggest challenge as a millennial mom of color?The biggest struggle has been parenting without immediate family nearby. My husband and I have actively worked on building relationships with other parents in the area, but it’s really just him and I with our son.How are you learning to overcome this challenge?I am volunteering on the planning committee for the inaugural Momference. This platform powered by District MotherHUED is forcing me to network and be outgoing in a way I haven’t before. Meeting other moms that look and have relatable backgrounds as me is refreshing and much needed.last_img read more

No 18 Louisville Falls at Syracuse 6949

first_imgStory Links Preview Buy Tickets Live Stats Postgame Notes SYRACUSE, N.Y. (AP)–  Elijah Hughes scored 18 points and Oshae Brissett had 16 to lead four players in double figures as Syracuse beat No. 18 Louisville 69-49 on Wednesday night.Syracuse (18-8, 9-4 ACC) suffered a 73-58 loss at North Carolina State in their last game a week ago, shooting just 35 percent, a weakness the Orange had displayed in all four of their conference losses. They found their mark from behind the arc against Louisville, hitting 11 3-pointers and holding the Cardinals in check throughout.The Cardinals (18-9, 9-5 Atlantic Coast Conference) were coming off two tough games.  In the most recent game on Saturday, the Cardinals barely eked out a 56-55 win over Clemson. Louisville led the Tigers by seven points with 17 seconds remaining and Clemson had one chance in the final seconds to walk off the court with a win.The slump continued against the Orange. Louisville entered the game shooting 36.3 percent from 3 and finished 14 of 54 (25.9 percent), a season low, and 6 of 28 from 3.Jordan Nwora had 11 points on 3-of-13 shooting to lead Louisville, Dwayne Sutton was 1 of 10 for five points.Buddy Boeheim had 14 points and Tyus Battle 11 for Syracuse.Syracuse led 35-23 at the break and the sluggish Cardinals couldn’t get untracked. After Cristen Cunningham missed a 3 from the top of the key and Nwora followed with an air ball, Battle converted a steal and dunk, then fed Hughes for an open 3 on the wing. Less than two minutes later, Hughes hit his fourth 3-pointer of the game to boost the Orange lead to 47-28 with 12:05 left.Syracuse’s 2-3 zone was purring in the first half, too, and the Orange led by as many as 16 after both teams struggled at the start. The Cardinals averted falling further behind by hitting 10 of 12 free throws.AWFUL STARTIn the opening nine minutes, the teams combined to shoot 4 of 18 from the floor, 2 of 10 from beyond the arc, and each had four turnovers. The Orange held the Cardinals without a basket for 7:20 and put together a 15-3 run to gain a double-digit lead. Boeheim hit a 3 and a runner, Hughes converted a pull-up 3 in transition, and Brissett’s left-handed layup gave Syracuse a 26-13 lead with 4:03 left in the first half. A dunk by Steven Enoch with 3:48 left broke the drought for the Cardinals, who trailed 35-23 at halftime after shooting just 1 of 13 from long range and 6 of 26 (23.1 percent) overall. They entered the game shooting 37.3 percent from 3-point range in league play.POLL IMPLICATIONSThe Cardinals will drop again in the next Top 25.BIG PICTURELouisville: After losing three of their previous four – all the losses to ranked teams – the Cardinals were reeling and have to figure out something fast with No. 3 Virginia up next.Syracuse: The Orange still have to play No. 1 Duke and No. 3 Virginia at home and No. 8 North Carolina, Wake Forest and Clemson on the road. That’s a daunting schedule before the postseason begins, and point guard Frank Howard is still not performing to his level of play. He took one shot and didn’t score against Louisville.UP NEXTLouisville hosts No. 3 Virginia on Saturday at noon.Syracuse hosts top-ranked Duke on Saturday night. Full Schedule Roster Raycom Sports/WHAS-TV Photo Gallery center_img Listen Live Next Game: VIRGINIA 2/23/2019 | Noon Matchup History PDF Final Box Print Friendly Versionlast_img read more

8 recipes to master Promises in ECMAScript 2018

first_img console.log(‘Before promise created’); console.log(‘Before promise created’); console.log(‘Before promise created’); console.log(‘Before promise created’); console.log(‘After promise created’); } Create a function addBoosters that throws an error: function addBoosters (rocket) { throw new Error(‘Unable to add Boosters’); } Create a function performGuidanceDiagnostic that returns a promise that rejects an error: function performGuidanceDiagnostic (rocket) { return new Promise(function (resolve, reject) { reject(new Error(‘Unable to finish guidance diagnostic’)); }); } Use Promise.resolve to pass the rocket object to these functions, and chain a catch off each of them: export function main() { new Promise(function (resolve) { }); console.log(‘Before promise created’); const rocket = {}; Promise.all([]) console.log(‘After promise created’); } Attach a then call to the chain and log that the rocket is ready for launch: const rocket = {}; Promise.all([ Promise.resolve(rocket).then(addBoosters), Promise.resolve(rocket).then(performGuidanceDiagnostic), Promise.resolve(rocket).then(loadCargo) ]).then(function (results) { console.log(‘Rocket ready for launch’); console.log(results); }); Start your Python web server and open the following link in your browser:http://localhost:8000/. You should see the following output: How it works… Promise.all is similar to Promise.resolve; the arguments are resolved as promises. The difference is that instead of a single result, Promise.all accepts an iterable argument, each member of which is resolved individually. In the preceding example, you can see that each of the promises is initiated immediately. Two of them are able to complete while performGuidanceDiagnostic continues. The promise returned by Promise.all is fulfilled when all the constituent promises have been resolved. The results of the promises are combined into an array and propagated down the chain. You can see that three references to rocket are packed into the results argument. And you can see that the operations of each promise have been performed on the resulting object. There’s more As you may have guessed, the results of the constituent promises don’t have to return the same value. This can be useful, for example, when performing multiple independent network requests. The index of the result for each promise corresponds to the index of the operation within the argument to Promise.all. In these cases, it can be useful to use array destructuring to name the argument of the then callback: Promise.all([ findAstronomers, findAvailableTechnicians, findAvailableEquipment ]).then(function ([astronomers, technicians, equipment]) { // use results for astronomers, technicians, and equipment }); Handling errors with Promise.catch In a previous recipe, we saw how to fulfill a promise with an error state using reject, and we saw that this triggers the next catch callback in the promise chain. Because promises are relatively easy to compose, we need to be able to handle errors that are reported in different ways. Luckily promises are able to handle this seamlessly. In this recipe, we’ll see how Promises.catch can handle errors that are reported by being thrown or through rejection. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-07-handle-errors-promise-catch. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file with a main function that creates an object named rocket: export function main() { return new Promise(function (resolve) { setTimeout(function () { console.log(‘guidance diagnostic complete’); rocket.guidanceDiagnostic = ‘Completed’; resolve(rocket); }, 2000); }); } Create a function named loadCargo that adds a payload to the cargoBay: function loadCargo (rocket) { console.log(‘loading satellite’); rocket.cargoBay = [{ name: ‘Communication Satellite’ }] return rocket; } Use Promise.resolve to pass the rocket object to these functions within Promise.all: export function main() { console.log(‘Before promise created’); Promise.resolve(Math.random() > 0.5) .then(addBoosters) .then(() => console.log(‘Ready for launch: ‘)) What are Promises in ECMAScript? In earlier versions of JavaScript, the callback pattern was the most common way to organize asynchronous code. It got the job done, but it didn’t scale well. With callbacks, as more asynchronous functions are added, the code becomes more deeply nested, and it becomes more difficult to add to, refactor, and understand the code. This situation is commonly known as callback hell. Promises were introduced to improve on this situation. Promises allow the relationships of asynchronous operations to be rearranged and organized with more freedom and flexibility. In this context, today we will learn about Promises and how to use it to create and organize asynchronous functions. We will also explore how to handle error conditions. Creating and waiting for Promises Promises provide a way to compose and combine asynchronous functions in an organized and easier to read way. This recipe demonstrates a very basic usage of promises. This recipe assumes that you already have a workspace that allows you to create and run ES modules in your browser for all the recipes given below: How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 03-01-creating-and-waiting-for-promises. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that creates a promise and logs messages before and after the promise is created, as well as while the promise is executing and after it has been resolved: // main.js export function main () { const rocket = {}; console.log(‘After promise created’); } Create a function named addBoosters that throws an error if its first parameter is false: function addBoosters(shouldFail) { if (shouldFail) { throw new Error(‘Unable to add Boosters’); } console.log(‘After promise created’); } Create a function named addBoosters that creates an object with boosters to an object: function addBoosters (rocket) { console.log(‘attaching boosters’); rocket.boosters = [{ count: 2, fuelType: ‘solid’ }, { count: 1, fuelType: ‘liquid’ }]; return rocket; } Create a function named performGuidanceDiagnostic that returns a promise of a successfully completed task: function performGuidanceDiagnostic (rocket) { console.log(‘performing guidance diagnostic’); center_img console.log(‘After promise created’); } Start your Python web server and open the following link in your browser:http://localhost:8000/. You will see the following output: How it works… By looking at the order of the log messages, you can clearly see the order of operations. First, the initial log is executed. Next, the promise is created with an executor method. The executor method takes resolve as an argument. The resolve function fulfills the promise. Promises adhere to an interface named thenable. This means that we can chain then callbacks. The callback we attached with this method is executed after the resolve function is called. This function executes asynchronously (not immediately after the Promise has been resolved). Finally, there is a log after the promise has been created. The order the logs messages appear reveals the asynchronous nature of the code. All of the logs are seen in the order they appear in the code, except the Finished promise message. That function is executed asynchronously after the main function has exited! Resolving Promise results In the previous recipe, we saw how to use promises to execute asynchronous code. However, this code is pretty basic. It just logs a message and then calls resolve. Often, we want to use asynchronous code to perform some long-running operation, then return that value. This recipe demonstrates how to use resolve in order to return the result of a long-running operation. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-02-resolving-promise-results. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that creates a promise and logs messages before and after the promise is created: // main.js export function main () { return { boosters: [{ count: 2, fuelType: ‘solid’ }, { count: 1, fuelType: ‘liquid’ }] }; } Use Promise.resolve to pass a Boolean value that is true if a random number is greater than 0.5 to addBoosters: export function main() { const rocket = {}; Promise.resolve(rocket).then(addBoosters) .catch(console.error); Promise.resolve(rocket).then(performGuidanceDiagnostic) .catch(console.error); console.log(‘After promise created’); } Within the promise, resolve a random number after a 5-second timeout: new Promise(function (resolve) { setTimeout(function () { resolve(Math.random()); }, 5000); }) Chain a then call off the promise. Pass a function that logs out the value of its only argument: new Promise(function (resolve) { setTimeout(function () { resolve(Math.random()); }, 5000); }).then(function (result) { console.log(‘Long running job returned: %s’, result); }); Start your Python web server and open the following link in your browser:http://localhost:8000/. You should see the following output: How it works… Just as in the previous recipe, the promise was not fulfilled until resolve was executed (this time after 5 seconds). This time however, we passed the called resolve immediately with a random number for an argument. When this happens, the argument is provided to the callback for the subsequent then function. We’ll see in future recipes how this can be continued to create promise chains. Rejecting Promise errors In the previous recipe, we saw how to use resolve to provide a result from a successfully fulfilled promise. Unfortunately, the code doesn’t always run as expected. Network connections can be down, data can be corrupted, and uncountable other errors can occur. We need to be able to handle those situations as well. This recipe demonstrates how to use reject when errors arise. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-03-rejecting-promise-errors. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that creates a promise, and logs messages before and after the promise is created and when the promise is fulfilled: new Promise(function (resolve) { resolve(); }).then(function (result) { console.log(‘Promise Completed’); }); Add a second argument to the promise callback named reject, and call reject with a new error: new Promise(function (resolve, reject) { reject(new Error(‘Something went wrong’); }).then(function (result) { console.log(‘Promise Completed’); }); Chain a catch call off the promise. Pass a function that logs out its only argument: new Promise(function (resolve, reject) { reject(new Error(‘Something went wrong’); }).then(function (result) { console.log(‘Promise Completed’); }).catch(function (error) { console.error(error); }); Start your Python web server and open the following link in your browser:http://localhost:8000/. You should see the following output: How it works… Previously we saw how to use resolve to return a value in the case of a successful fulfillment of a promise. In this case, we called reject before resolve. This means that the Promise finished with an error before it could resolve. When the Promise completes in an error state, the then callbacks are not executed. Instead we have to use catch in order to receive the error that the Promise rejects. You’ll also notice that the catch callback is only executed after the main function has returned. Like successful fulfillment, listeners to unsuccessful ones execute asynchronously. See also Handle errors with Promise.catch Simulating finally with Promise.then Chaining Promises So far in this article, we’ve seen how to use promises to run single asynchronous tasks. This is helpful but doesn’t provide a significant improvement over the callback pattern. The real advantage that promises offer comes when they are composed. In this recipe, we’ll use promises to combine asynchronous functions in series. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-04-chaining-promises. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that creates a promise. Resolve a random number from the promise: new Promise(function (resolve) { resolve(Math.random()); }); ); Chain a then call off of the promise. Return true from the callback if the random value is greater than or equal to 0.5: new Promise(function (resolve, reject) { resolve(Math.random()); }).then(function(value) { return value >= 0.5; }); Chain a final then call after the previous one. Log out a different message if the argument is true or false: new Promise(function (resolve, reject) { resolve(Math.random()); }).then(function (value) { return value >= 0.5; }).then(function (isReadyForLaunch) { if (isReadyForLaunch) { console.log(‘Start the countdown! ‘); } else { console.log(‘Abort the mission. ‘); }}); Start your Python web server and open the following link in your browser:http://localhost:8000/. If you are lucky, you’ll see the following output: If you are unlucky, we’ll see the following output: How it works… We’ve already seen how to use then to wait for the result of a promise. Here, we are doing the same thing multiple times in a row. This is called a promise chain. After the promise chain is started with the new promise, all of the subsequent links in the promise chain return promises as well. That is, the callback of each then function is resolve like another promise. See also Using Promise.all to resolve multiple Promises Handle errors with Promise.catch Simulating finally with a final Promise.then call Starting a Promise chain with Promise.resolve In this article’s preceding recipes, we’ve been creating new promise objects with the constructor. This gets the jobs done, but it creates a problem. The first callback in the promise chain has a different shape than the subsequent callbacks. In the first callback, the arguments are the resolve and reject functions that trigger the subsequent then or catch callbacks. In subsequent callbacks, the returned value is propagated down the chain, and thrown errors are captured by catch callbacks. This difference adds mental overhead. It would be nice to have all of the functions in the chain behave in the same way. In this recipe, we’ll see how to use Promise.resolve to start a promise chain. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-05-starting-with-resolve. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that calls Promise.resolve with an empty object as the first argument: export function main () { Promise.resolve({}) } Chain a then call off of resolve, and attach rocket boosters to the passed object: export function main () { Promise.resolve({}).then(function (rocket) { console.log(‘attaching boosters’); rocket.boosters = [{ count: 2, fuelType: ‘solid’ }, { count: 1, fuelType: ‘liquid’ }]; return rocket; })} Add a final then call to the chain that lets you know when the boosters have been added: export function main () { Promise.resolve({}) .then(function (rocket) { console.log(‘attaching boosters’); rocket.boosters = [{ count: 2, fuelType: ‘solid’ }, { count: 1, fuelType: ‘liquid’ }]; return rocket; }) .then(function (rocket) { console.log(‘boosters attached’); console.log(rocket); })} Start your Python web server and open the following link in your browser: http://localhost:8000/. You should see the following output: How it works… Promise.resolve creates a new promise that resolves the value passed to it. The subsequent then method will receive that resolved value as it’s argument. This method can seem a little roundabout but can be very helpful for composing asynchronous functions. In effect, the constituents of the promise chain don’t need to be aware that they are in the chain (including the first step). This makes transitioning from code that doesn’t use promises to code that does much easier. Using Promise.all to resolve multiple promises So far, we’ve seen how to use promises to perform asynchronous operations in sequence. This is useful when the individual steps are long-running operations. However, this might not always be the more efficient configuration. Quite often, we can perform multiple asynchronous operations at the same time. In this recipe, we’ll see how to use Promise.all to start multiple asynchronous operations, without waiting for the previous one to complete. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-06-using-promise-all. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file that creates an object named rocket, and calls Promise.all with an empty array as the first argument: export function main() { console.log(‘Before promise created’); console.log(‘After promise created’); } Add a then function to the chain that logs a success message: export function main() { console.log(‘Before promise created’); Promise.resolve(Math.random() > 0.5) .then(addBoosters) const rocket = {}; Promise.all([ Promise.resolve(rocket).then(addBoosters), Promise.resolve(rocket).then(performGuidanceDiagnostic), Promise.resolve(rocket).then(loadCargo) ]); console.log(‘After promise created’); } Start your Python web server and open the following link in your browser:http://localhost:8000/. You should see the following output: How it works… As we saw before, when a promise is fulfilled in a rejected state, the callback of the catch functions is triggered. In the preceding recipe, we see that this can happen when the reject method is called (as with performGuidanceDiagnostic). It also happens when a function in the chain throws an error (as will addBoosters). This has similar benefit to how Promise.resolve can normalize asynchronous functions. This handling allows asynchronous functions to not know about the promise chain, and announce error states in a way that is familiar to developers who are new to promises. This makes expanding the use of promises much easier. Simulating finally with the promise API In a previous recipe, we saw how catch can be used to handle errors, whether a promise has rejected, or a callback has thrown an error. Sometimes, it is desirable to execute code whether or not an error state has been detected. In the context of try/catch blocks, the finally block can be used for this purpose. We have to do a little more work to get the same behavior when working with promises In this recipe, we’ll see how a final then call to execute some code in both successful and failing fulfillment states. How to do it… Open your command-line application and navigate to your workspace. Create a new folder named 3-08-simulating-finally. Copy or create an index.html that loads and runs a main function from main.js. Create a main.js file with a main function that logs out messages for before and after promise creation: export function main() { console.log(‘Before promise created’); console.log(‘After promise created’); } Add a catch to the chain and log out the error if thrown: export function main() { console.log(‘Before promise created’); Promise.resolve(Math.random() > 0.5) .then(addBoosters) .then(() => console.log(‘Ready for launch: ‘)) .catch(console.error) console.log(‘After promise created’); } Add a then after the catch, and log out that we need to make an announcement: export function main() { new Promise(function (resolve) { console.log(‘Executing promise’); resolve(); }).then(function () { console.log(‘Finished promise’); }); console.log(‘Before promise created’); Promise.resolve(Math.random() > 0.5) .then(addBoosters) .then(() => console.log(‘Ready for launch: ‘)) .catch(console.error) .then(() => console.log(‘Time to inform the press.’)); console.log(‘After promise created’); } Start your Python web server and open the following link in your browser:http://localhost:8000/. If you are lucky and the boosters are added successfully, you’ll see the following output: 12. If you are unlucky, you’ll see an error message like the following: How it works… We can see in the preceding output that whether or not the asynchronous function completes in an error state, the last then callback is executed. This is possible because the catch method doesn’t stop the promise chain. It simply catches any error states from the previous links in the chain, and then propagates a new value forward. The final then is then protected from being bypassed by an error state by this catch. And so, regardless of the fulfillment state of prior links in the chain, we can be sure that the callback of this final then will be executed. To summarize, we learned how to use the Promise API to organize asynchronous programs. We also looked at how to propagate results through promise chains and handle errors. You read an excerpt from a book written by Ross Harrison, titled ECMAScript Cookbook. It’s a complete guide on how to become a better web programmer by writing efficient and modular code using ES6 and ES8. Read Next: What’s new in ECMAScript 2018 (ES9)? ECMAScript 7 – What to expect? Modular Programming in ECMAScript 6last_img read more

Orange France has reacted to rival Bouygues Teleco

first_imgOrange France has reacted to rival Bouygues Telecom’s introduction of a low-cost fibre offering by using its low-cost subsidiary Sosh to launch a new low-cost quad-play offering including fibre-based internet.From July 3, Sosh will offer a combination of Orange’s Livebox plus mobile, with internet speeds of up to 200Mbps downstream and 50Mbps upstream for the same price as its current €44.99 and €49.99 ADSL-based quad-play combinations and for €5 more than its current €29.99 and €34.99 packages.Sosh customers not currently equipped with Livebox Play will have their receiver swapped out by a techician when they have fibre installed.The move follows Bouygues’ launch of a €25.99 fibre offering last week. Until now, Sosh customers could only take ADSL or VDSL-based broadband. Sosh has about 2.1 million customers. Orange can currently offer fibre to about three million homes using the Sosh brand.Orange’s own-branded fibre service offers internet speeds of up to 500Mbps.SFR and Free have yet to join the ultra-high speed quad-play price war.Separately, cable operator Numericable has signed a definitive agreement to acquire Virgin Mobile France operator Omer Telecom. The deal, which is subject to regulatory approval, follows Numericable’s offer last month for the Virgin Mobile business, valuing the company at €325 million.Numericable’s owner, Patrick Drahi’s Luxembourg-based investment company Altice, last week raised €911 million by placing 17.9 million new ordinary shares, the proceeds of which will be used to finance the €529m cash payment to Carlyle and Cinven for their 14% stake in Numericable, as previously announced on April 7, with the balance being used to reduce net debt andfor general corporate purposes.The Virgin Mobile acquisition comes after Drahi’s deal to acquire the much larger mobile and fixed operator SFR from Vivendi for an initial €13.5 billion and is part of his overall plan to use Numericable as a leading consolidator in the French fixed and mobile communications business.last_img read more