Three days. It had been three days since their date and there wasn't a word from him. Not so much as a boo. Drumming her fingers against the desk, she propped up her chin on her hand, staring blankly at the desktop screen.
"That incessant drumming. It's diving me up the wall." Continuing to writeup observation charts, Shagun complained.
Khushi sat up. "Oh! Sorry..." her reply was a distant mumble.
It was now 8.00 pm and most of the patients had been settled in for the night. The only staff on call included two nurses, two interns and Khushi. The occasional shrill ring of a phone or beep of a pager disturbed the otherwise quiet ward. It was a good time to catch up with neglected paperwork. Shagun who was attempting to do just that, kept being distracted by the odd forlorn sigh from her friend. Giving up on the charts in front of her she swivelled her chair around to face Khushi.
"You should call him you know." she said fiddling with a pen.
"Why the hell would I do that?" she bit back a little harshly.
Shagun raised her eyebrows. "Because...you like him?"
Khushi turned away to face the computer screen again. "I'm not humiliating myself. He's obviously not interested."
Shagun laughed. "Well at least you didn't deny you liked him."
Khushi turned around with indignation written all over her face, ready to protest.
"Don't bother." she waived her off and continued..."Khushi you know what I've discovered over the years? The terms love and relationship are equally interchangeable with the words humiliation, embarrassment, denial, heart ache and pain... to begin with."
"What? You thought it was an easy ride? Gaurav and I drive each other nuts."
"But you guys seem perfect. I mean you married him. He couldn't have been that bad."
"He isn't. But he isn't perfect either." Shagun sighed trying to find the right words to explain what she meant. "What I'm trying to say is that no one is perfect. Everyone has to compromise. I married him because what we have together is a good thing. Better than all that other negative stuff. But you have to learn to take the good with the bad. Do you know how many times we have humiliated ourselves in front of one another? But that's what brings you closer. What bonds you."
"Wouldn't he have called he have called if he liked me though?" she asked petulantly.
"Khushi don't irritate me. He bloody chased you. Sent you coffee, flowers, grilled us about your every like and dislike not to mention his outrageous flirting. I mean this is when he is multibillionaire entrepreneur who had no time for anyone. Do you really think he's not interested? Have you ever thought that maybe he's waiting for you? Trying to see if you're interested?"
"That's not how it's supposed to go! Guys are supposed to ask you out...they're the ones that are meant to call."
Shagun stood up abruptly, frustrated by her stubbornness. "Fine! Then live in your damn fairy tale world all alone."
Khushi felt a little blindsided by Shagun's outburst. It was unlike her. Reclining back in to her chair she closed her eyes replaying the scene on a loop.
Arnav stood at the foot of the stairs, kicking up some loose gravel; his jacket folded over his forearm effortlessly. The night had inevitably come to an end and they stood outside her door looking at one other. For the first time that night he smiled a genuine smile. There were no traces of smug confidence or amusement. Just a smile. Khushi gulped unsure of what to do next.
"So Gupta...I had a nice time tonight."
"Me too." she said softly.
He grinned. "You sound surprised."
Climbing up the stairs he now stood directly beside her. "I'm glad." he muttered, brushing away a tiny wisp of her hair, grazing her cheek with the back of his hand. He stood ever so close to her, scanning her eyes, searching for something impalpable. Struggling to control her traitorous body, she pursed her lips as her lids instinctively fluttered shut. It seemed like forever, the tension prickling her skin.
Unexpectedly she felt her hand enveloped in warmth. She watched as he gently kissed her, his lips lingering, brushing against her knuckles. Even this innocent touch, sent a warmth washing over her. Gently dropping her hand back to her side, he straightened up and looked in her eyes again.
"Good night Khushi." his voice caressed her.
Khushi had replayed this scenario in her head god knows how many times. Trying to dissect every detail, every nuance....trying to figure out where it went wrong. She groaned in frustration. What was it about him that turned her into a dithering idiot? Maybe Shagun was right. Perhaps she could call him? It was the 21st century after all. Girls didn't have to wait to be rescued by prince charming.
Picking up her mobile she scrolled down to his last message. She still hadn't saved his number. Chewing down on her bottom lip she pressed dial. The dial tone rang once and she quickly disconnected. Looking around to make sure no one else had witnessed her humiliation she dialled again. This time she managed to get to two rings before hanging up as if her mobile was on fire. Irritated by her own fickleness she decided to concentrate on her own work.
Minimising all the lab reports that had come back from pathology, she opened up the internet browser hoping to read a recent article looking at the efficacy of a bronchial biopsy in determining the chance of rejection for a heart-lung transplant patient. Safari loaded and Google stared back at her, the cursor blinking in the search bar.
God Khushi! This is pathetic! You can't stalk him! Her mind was a tizzy as she battled with her ethics and her curiosity. It's free information! Anyone in the world has access to it! What if I was researching him as a potential endowment? It wouldn't be weird then. Ethics bit back. Yes but that's not why you're doing it. You want to know about him for your own selfish reasons.
Deciding to smother the voice of ethics she quickly typed in Arnav Singh Raizada and hit enter before she could change her mind. A wealth of information arrived at her fingers tips. Scanning the vast volumes written about him she picked up bits of detail that interested her. AR corporations was more an investment firm than an actual manufacturing entity. They held stakes in minerals and resources, high end fashion labels, Formula 1 teams, agricultural technologies and surprisingly medical technology focussed on applied research.
It was an area which had foreseeable future economic growth but not something she would have necessarily associated with him. Reading on further she came across articles citing his long list of alleged affairs but none with sufficient evidentiary proof to support the claims. Frowning she ignored the snuff pieces and went on to read about his personal life. Apparently Mr. Raizada wasn't the snotty brat she had assumed him to be. Having risen from obscurity he had made a name for himself in the business world rather swiftly; adversaries lauding his work ethic and good instinct.
The only known relative was a sister who went by the name Anjali Raizada- Mathur. She was a cardiologist currently residing in New York with her husband and child. Khushi tried to recall if she had ever heard the name. Perhaps she had referred patients here? Surely as a cardiologist she would have? Quitting out of the browser, Khushi opened the hospital's data bank and typed in her name. The search results took up a couple of pages.
It seemed Dr. Mathur had referred several patients here. As Khushi scanned the names she realised that she was not personally familiar with any of these people. About to log out for the night, one of the results grabbed her attention. She felt herself freeze as she read the name. Anjali Singh Raizada. Her maiden name. Except for she wasn't the referring doctor. She was the patient.
Her eyes widened. Should she click on the patient file? Her palms began to sweat at the thought. Is this why he had invested in applied research? To find a cure for his sister? People were not patients at Cleveland Clinic unless they were acutely ill. She could feel her heart rate increase as the stress of the decision weighed heavily on her. Should she or should she not? It wouldn't be right. She wasn't her patient and it wasn't any of her business. Yet the search result taunted her, daring her to peruse through the contents.
The decision had been made for her. There was an emergency AAA on its way. She had to scrub in as the only resident on call. Looking at the clock she started. It was 11. 07 pm. Where had the time gone? Pushing herself away from the desk she ran as fast as she could to the operating theatre, getting ready to scrub in.
Half an hour into the surgery and things were a mess. The aorta had ruptured just as they had opened the patient up, spilling blood all over the surgical gowns and gloves. Despite hanging up now almost the equivalent of his whole body volume of blood, the bleeding was still not under control. Clamping the aorta top and bottom, Khushi managed to get the patient on to by-pass. The surgical team simultaneously sigh in relief, catching their breath for a second.
"He's one lucky son a b**ch" The anaesthesiologist laughed, slightly in shock .
"That he is." Khushi murmured in agreement. There was about a 50% survival rate for ruptured aorta's and that was when those patients were in the hospital. If it happened to rupture outside a hospital it almost meant certain death. Though how such an aneurysm could have been missed was beyond her. The pulsatile mass should have been palpable and visible to the naked eye. Still, they were only halfway home. The actual repair work would start now.
The phone in the O.R rang and the scrub nurse went to attended the call.
"Dr. Gupta. There is a man waiting for you outside. He says he wants to meet you."
"Oh good. Is it the patient's family?"
"No. Well Linda doesn't seem to think so. She doesn't know who it it but she told him you were in surgery and he asked how long you would be."
The scrub nurse shrugged, holding her hand over the receiver. "Fine. Tell him I won't be done for another 5 hours or so. Book him in an appointment for tomorrow sometime whenever I'm free. But if he's really desperate he can wait."
She nodded and relayed the message.
Khushi yawned and twisted her back and rotated her shoulders, trying to work out the knots in her muscles. The patient was stable for now but he had to be monitored to see if the graft would hold. It was home time. Praise the lord! Taking off her pager, she handed it to Linda.
Linda smiled at her. "Not just yet unfortunately. Your visitor's still here."
"Yeah you know the one I called you about?"
"Oh I forgot." she said more to herself than anyone else. Pausing for a second she turned to Linda. "He waited?"
"Mmmmhmmm. He's in the visitor's lounge."
"Thanks" Grabbing her coat and handbag she went to see the mysterious man. Turning the corner into the lounge, her knees almost gave way. From the shock of seeing him or exhaustion she could not determine. Uncomfortably lying with his feet dangling over the edge of a one seater arm chair was Arnav Singh Raizada...fast asleep.
He looked exhausted. Vest and suit jacket lay discarded on the floor next to his small travel suitcase. His shirt sleeves had been rolled up to his elbow and the few top buttons were undone letting a few wiry chest hairs peek through. Khushi slowly made her way toward him, bending down on her knees so he was at eye level.
On closer observation she noticed the dark circles around his eyes and the few day old stubble. An errant lock of hair fell over his forehead painting him with boyish innocence, as he his slightly parted lips pouted noisily inhaling and exhaling. A surge of affection took her by surprise seeing him thus. A bouquet of pink and white frangipani's held loosely in his hand, threatened to fall on the floor.
Gently she tried to pry them out of his hands so as not to wake him.
His eyes fluttered open and his body stiffened as he tried to place his surroundings. Upon seeing her, relaxed back in to the supine position he had earlier occupied.
She smiled, her eyes slightly moist..."Are these for me?"
He nodded, his eyes smiling and huskily asked..."Come closer Gupta."
Khushi leaned forward, and he placed a soft kiss on her cheek. "Good morning."
Unable to help the blush that graced her cheeks she looked down shyly. Getting up from the chair, he stretched and yawned loudly. Khushi looked at him expectantly, waiting for some sort of an explanation.
Throwing up his hands he looked sheepish. "I know. I know. But I have a good reason."
"Jesus woman! I just waited seven hours for you and didn't even have dinner. Cut me some slack."
Surprisingly both him and herself, she leaned up on her tip toes and very gently kissed his jaw whispering "Thank you."
Arnav smiled so tenderly she felt her heart skip a beat. It was as if she had given him all the happiness in the world. He reached out to hold her hand and gave it a squeeze. "There was a family emergency. I was stuck. I swear otherwise I would have been stalking you the very next day."
Khushi felt slightly nervous as she remembered what she had discovered earlier in the night. Squeezing his hand back she replied..."It's ok." After a second she added. "You could have called or texted at least."
He raised an eyebrow. "You could have as well. Plus texting is really not my style. Don't you prefer flowers?"
"I thought as much. So... will you do me the honour of accompanying me to breakfast or will you keep this diabetic hungry?"
Grabbing her handbag she looked up at him. "Let's go Raizada."
Surprise! Bet you weren't expecting another update so soon! What did you guys think! Hope you liked it!
First of all there is the door step Sasak! and yes, it is in flashback, yesssssssssss!
Secondly he did come looking for her and i love him for that, and the poor thing waited 7 hours, i could just hug him.
Arnav is sooo shweeettt...awwww he waited so long fr her...nd Khushi is playing so hard to get tht so nt fair to him..bt yet I loved it this way..!!
Khushi is smitten by Arnav, I adored how she replayed the doorstep scene in her mind and then googled him !!! Arnav is hopelessly in love with her too, flowers in his hand, stubble on his chin, a smirk on his face... that's how I love to visualize Arnav.
that was sooo cuteee and lovely!!!
No I did not expect another update so soon!
I knew there was a reason he didn't call her back! I just hope that Anjali is okay.
Thanks for the update! I cant wait to read more!
And aww he waited for her! He too loves her or atleast infatuation for sure!! Very sweet of him man!
And then what's with Anjali! Sad man!
Love this ff. I don't know how I missed out on reading this.
1.Giving us THIS ARNAV all perfect gentleman.. chivalrous,warm,kind, considerate and utterly Handsome !!!!
2.Giving us This Khushi.... tough on the outside and mushy on the inside!!
3.Giving us update after update within a day's time!!
4.Giving us such a beautiful story!!!
5.Giving us a story which has parts of YLME and yet parts of its own which makes My heart a mushy mess!!!
omg he came n more thn tht he waited so long for her, isnt he a sweet heart.
now coming to anjali being a patient of cleveland, i can smell something fishy what i dnt knw but knwing u obv its not a straigh fwd story. is he persuing her cuz of anjali? i dnt knw i can guess but i am very curious.
Awwww what a sweet update. .
Aaahhhh, you bring the much awaited "heart" matters to the front. Anjali Singh Raizada as a patient and her brother investing money in research. Now, I can see Khushi's role as a doctor and a lover, both matters of the heart, in motion.
Seriously, as if YLME's Arnav wasn't a swoon-worthy character... you go ahead and create this man, who brings flowers to his girl? AAHHH!!! I am an absolute sucker of flowers. I know its a cliché means of endearment but if it comes with a message like "you should smile more often" then I am all mushy! lol.
Not that I am an expert in medical history database, but shouldn't your name be updated if you got married? If Anjali Singh Raizada was admitted into the database as a single and later on married to Aman Mathur, it should reflect that on the patient demographics, for insurance purposes. AAhh, that's the project coordinator at a pathology software solutions speaking. lol.
arnav singh raizada waiting in the hospital for 7 hours just to see her!!!
i adore this raizada! khushi is the lucky one!
abt im a little scared for Anjali... y is she at the hospital??
OMG that was awesome... The last scenes is just tooooo good..
Oh goodness gracious what an amazing story. I love the fact that they into each other. So romantic. He waited seven hours for her. She actually kisses him. So sweet.


2018-2019 Men's Track & Field News - Bridgewater St.
DEDHAM, Mass. -- Bridgewater State Universirty junior Olivier Ndikumana (Amherst, Mass.) competed on Saturday at the Jay Carisella Coaches Invitational hosted by Northeastern University at the Solomon Track & Field Facility in Dedham.
WILLIMANTIC, Conn. -- The Bridgewater State University men's outdoor track & field competed on Friday afternoon at the 12th Annual Eastern Invitational hosted by Eastern Connecticut State University.
BRIDGEWATER, Mass. -- For the fourth straight week, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Outdoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
Westfield, Mass. – Freshmen Jacob DeAndrade (Taunton, Mass.) and Kyle Koehler (Swansea, Mass.), and juniors Lamont Haynes (Boston, Mass.) and Olivier Ndikumana (Amherst, Mass.), each won individual events to lead the Bridgewater State University men's outdoor track & field team on Saturday at the Jerry Gravel Classic hosted by Westfield State University.
NEW HAVEN, Conn. -- Bridgewater State University senior Jamie Carlson (Jericho, Vt.) placed 14th in the decathlon on Friday at the Northeast Combined Events Challenge hosted by Southern Connecticut State University at Jess Dow Field in New Haven, Connecticut.
NEW LONDON, Conn. -- Bridgewater State University senior Joseph Keough (Walpole, Mass.), juniors Joshua Higgins (Fitchburg, Mass.) and Trevor Wysong (Taunton, Mass.), and sophomore Nikolas Beshere (Winthrop, Mass.) all competed on Friday evening at the Silfen Invitational hosted by Connecticut College.
BRIDGEWATER, Mass. -- For the third straight week, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Outdoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
FITCHBURG, Mass. – Freshman Jacob DeAndrade (Taunton, Mass.) and juniors Lamont Haynes (Boston, Mass.) and Nick Johnson (Marstons Mills, Mass.) each won individual events to lead the Bridgewater State University men's outdoor track & field team on Saturday at the Jim Sheehan Memorial Invitational hosted by Fitchburg State University.
BRIDGEWATER, Mass. -- For the second straight week, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Outdoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
BRIDGEWATER, Mass. -- Bridgewater State University freshman Jacob DeAndrade has been selected as both the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Outdoor Track Athlete and Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
BRIDGEWATER, Mass. – Freshman Jacob DeAndrade (Taunton, Mass.) won a pair of individual events to lead the Bridgewater State University men's outdoor track & field team at the season-opening BSU Bears Invitational on Saturday at Swenson Field.
BRIDGEWATER, Mass. – For the second straight week and seventh time this season, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
MEDFORD, Mass. – Several members of the Bridgewater State University men's indoor track & field team competed at the Tufts Final Qualifying Meet at the Gantcher Center.
BRIDGEWATER, Mass. – For the sixth time this season, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
BRIDGEWATER, Mass. -- For the fifth time this season, Bridgewater State University senior Jayci Andrews has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Women's Indoor Track Athlete of the Week.
BOSTON, Mass. -- Bridgewater State University junior Nick Johnson (Marstons Mills, Mass.) placed 13th in the weight throw at the BU Last Chance Invitational on Sunday.
CAMBRIDGE, Mass. – Freshman Jacob DeAndrade (Taunton, Mass.) garnered All-New England honors in two events to lead the Bridgewater State University men's track & field team at the 2019 Division III New England Indoor Track & Field Championship on Saturday at MIT.
BRIDGEWATER, Mass. -- For the third straight week, Bridgewater State University junior Lamont Haynes has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track Athlete of the Week. GEICO is the proud sponsor of the MASCAC weekly awards program.
BRIDGEWATER, Mass. – The Bridgewater State University men's track & field team captured its second straight conference indoor title and fourth in the last seven years on Saturday at the 2019 Massachusetts State Collegiate Athletic Conference (MASCAC) Indoor Track & Field Championships held at Plymouth State University.
BRIDGEWATER, Mass. -- For the second straight week, Bridgewater State University junior Lamont Haynes has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track Athlete of the Week. GEICO is the proud sponsor of the MASCAC weekly awards program.
BRIDGEWATER, Mass. – For the fifth straight week, Bridgewater State University freshman Jacob DeAndrade has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track & Field Rookie of the Week. GEICO is the proud sponsor of the MASCAC Weekly awards program.
BRIDGEWATER, Mass. -- Bridgewater State University junior Lamont Haynes has been selected as the Massachusetts State Collegiate Athletic Conference (MASCAC) GEICO Men's Indoor Track Athlete of the Week. GEICO is the proud sponsor of the MASCAC weekly awards program.
ROXBURY, Mass. -- Bridgewater State University senior Joseph Keough (Walpole, Mass.) placed 19th in the 3,000-meter run on Saturday at the New England Intercollegiate Amateur Athletic Association (NEICAAA) Indoor Track & Field Championships held at the Reggie Lewis Center.


text:
Learning Care
Online World
3Diesel.com
More smiling, less worrying
Faze Banks Net worth, Girlfriend, Family, Home, Wiki, Bio
12 months ago Ronney
When what you love to do is give you money and put you in the spotlight, then you don't know how far you can go by doing it. Faze Banks is a famous American video game player who also goes by the name of Ricky Banks. What he likes to do is what made him famous and there is certainly no limit to what he can do with it. Today we share about Faze Banks Net worth, Girlfriend, Family, Home, Wiki, Bio, etc.
It belongs to a generation of young and promising celebrities who are popular today for what they do on the Internet of Things. These young talents are self-taught, which most people do for fun, they have converted into a means of wealth and an identity of popularity. Here we will discuss the family of Faze Banks, the wiki, the bio, the size, the status of the relationship. His house and without neglecting the most frequently asked question, his net worth.
Faze Banks Wiki, Organic, Family
Faze Banks also known as Ricky Banks was born on October 18, 1991, in Lawrence Massachusetts in the United States. He grew up in Lowell and, when he was older, moved to Florida. At Lowell, he graduated from Lowell High School in 2010. Faze Banks was very fond of playing video games when he was a child, even through adolescence and later into adulthood. As a child, he loved playing games like Madden NFL, NHL, and Halo. His dexterity and his mastery of the games like no one saw him be the leader of the SoaR game team before joining the now-famous Faze Clan.
Faze did not disclose any in-depth information about his education and family background; his parents, who they are and if he has siblings. It is not strange that he kept this information safe from the public, as most famous players tend to do. Maybe it's one thing among them or maybe the public. And social media have not been convincing enough to reveal answers to these very asked questions. Well, over time, as their net worth continues to grow, their bubbling fame will obviously reveal the once heavily guarded information. Keep in mind that his parents are from Florida and are both of white American descent.
Celebrity Faze began his playing career as a solo player in late 2011. He created a YouTube channel called "BanksHasBanks". He was able to command a huge number of subscribers. And currently has more than 1.7 million subscribers on the channel with more than 2.5 million video views. After a while, he changed the name of his solo game channel from BankshasBanks to Faze Banks, which is run by the famous Faze Clan.
He is the Deputy Chief Executive Officer of the group. Faze Clan was founded in 2013 in Miami, Florida. Other members of the group have the nicknames: Faze Temperr, Faze Rug, Faze Rain, Faze Adapt and Faze Adapt. The group is known on YouTube for its Call of Duty game videos.
Faze Banks Height, girlfriend
Faze Banks is a handsome young man who stands at an impressive height of 6 feet 5 inches. He is of moderate muscle shape and will certainly be noticed wherever he goes. If not as a celebrity of the game, then certainly as a handsome young man who will have girls who will turn to get a glimpse of his beautiful self.
Faze Banks met Alissa Violet in June 2017. They were able to chat online and hang out after a quick chat on a nice spring day. Faze described his feeling as if they had known each other for a very long time. He shared their love story in a video he posted on YouTube. The video had over 7.2 million views.
Alissa Violet is also a YouTube sensation who posts comic videos on the platform. She has more than 3 million subscribers on her channel with less than 50 videos.
Faze Banks net worth and home
Faze currently lives in Los Angeles, California in his "Clout House" with his girlfriend Alissa and some of the members of the Faze Clan. They plan to turn the house into a physical social media talent management location where talented roommates will be recruited and housed to develop their talent. The house has a Twitter hashtag of its own trend via #CloutGang. One of its neighbors is 21 Savage.
He has a net worth of $ 350,000 with an annual salary of $ 120,000.
Joe Rogan Net worth, Family, Daughter, Weight, Height, Biography
Philip DeFranco Net Worth and Biography!
What is Kevin Hart net worth? Here is how he became one of the richest comedians in the world
Bill Burr Net worth, Biography, Wiki, Wife – Nia Renee Hill, Daughter, Age, Height
Dave Chappelle net worth, biography, wife, children
Mike Tyson net worth of 2019, Forbes, Wiki, family, business and career
Teen Choice Award Winner Megan Fox Net Worth and Lifestyle
Tags: Bio family Faze Banks Net worth Girlfriend Home Wiki
Previous Six types of wool and their features
Next When Do Boys Stop Growing? Do Guys Grow Until 25?
The "never say die" of Men's fashions.
1 month ago Jubin
It's Time to Spruce up Your Garage
5 months ago Jubin
Super Somerset County
WHAT DO CRABS EAT?
Eva Longoria Height, Age, Husband, Net Worth, Other Facts
Natalie Portman Height, Weight, Age, Measurements
Top 4 natural gas detector
2 days ago Ronney
2 weeks ago Ronney
1 month ago Ronney
WHAT DO CRABS EAT? January 18, 2021
Eva Longoria Height, Age, Husband, Net Worth, Other Facts January 6, 2021
Natalie Portman Height, Weight, Age, Measurements December 25, 2020
Top 4 natural gas detector December 15, 2020
The "never say die" of Men's fashions. December 7, 2020
The Importance of Getting Online When Setting up a New Business December 1, 2020
What to buy the woman who has everything November 12, 2020
3 Diesel © All rights reserved. | Newsphere by AF themes.

redpajama_set_name: RedPajamaCommonCrawl


text:
Posted on September 21, 2020 by staff
eBike firm eyes UK expansion after $40m funding
Dutch firm says UK is key market for expansion as it announces latest funding will be used for further global expansion
TransportInvestment
Dutch eBike brand VanMoof has said the UK is a key market for expansion following news of its $40m (£31m) Series B investment from Norwest Venture Partners, Felix Capital and Balderton Capital.
The financing comes months after a $13.5m investment in May and bolsters VanMoof for further global expansion, giving the company a stronger e-bike market share in North America, Europe and Japan.
A VanMoof spokesperson told BusinessCloud: "The UK is a key market for expansion. We have recently opened a number of pop-up stores across the UK, including Edinburgh, Bristol and two London pop-up locations – Battersea and Shoreditch."
The firm also has a brand store in Covent Garden which opened in 2018 and now employs around 30 staff at its London locations.
The firm reports a 184% sales increase in the UK between February and April this year compared to the same period in 2019.
VanMoof claims to be the fastest-growing e-bike brand worldwide, having now raised a total of $73m.
The latest funding will be used to meet the increased demand and shorten delivery times.
A significant portion of the funding will go towards building a suite of rider service solutions. This ecosystem includes a global mobile service network, more intuitive app support, smarter software with remote diagnostic solutions, and more proactive customer support.
VanMoof was founded in 2009 by brothers Taco and Ties Carlier, and now boasts over 120,000 riders.
"Our next frontier is to transform our business by building a full support ecosystem around every rider," said co-founder Ties Carlier.
£147m for autonomous vehicle startup Wayve
Airportr founder: Investor rejection is hard to stomach – but listen to them
Personal safety app Busby rebrands to Flare
Fly Now Pay Later raises £55m for US rollout


It has always been a pleasure to stock books from Gray Friar Press run by Gary Fry… is it really 2005 when we bought our first Gray Friar Press books (Poe's Progeny)? So we were very sorry to hear that Gary has decided to call it a day and Gray Friar will not be publishing any more books.
From the wonderfully named "Bernie Herrmann's Manic Sextet," the excellent "Terror Tales" Series and the very charming "Traditional Winter Ghost Stories" many interesting titles have come out from Gray Friar over the years.
If you are looking to complete your Gray Friar Press collection, then just put Gray Friar into our advanced search (or drop us an email and we'll send you a complete list) and you'll see all our stock including the excellent The Terror Tales Series (great covers).
Terror Tales of the Ocean; Scottish Highlands; Yorkshire; Wales; Seaside; Cotswolds (signed by Simon Clark on his story page); Lake District (signed by editor Paul Finch and Simon Clark on his story page) and East Anglia.
Gray Friar may be gone, but Gary hasn't! We've just taken delivery of Gary's latest novella – The Doom that Came to Whitby Town which Gary has kindly signed.
As we are almost neighbours…. Middlesbrough isn't that far from Whitby… perhaps we should be worried…..


text:
Q: python code that implements LU decomposition I found the following In my search for a python code that implements LU decomposition I found the following. I have two questions:

*

*I am wondering if this code uses partial pivoting or not; I am
looking for one that does not use partial pivoting.

*When I run this code, I get the following errors:

Traceback:
IndexError                                Traceback (most recent call last)
<ipython-input-13-88eb5f3643e3> in <module>()
 60
 61 A = [[7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6]]
---> 62 P, L, U = lu_decomposition(A)
 63
 64 print ("A:")

<ipython-input-13-88eb5f3643e3> in lu_decomposition(A)
 54         for i in range(j, n):
 55             s2 = sum(U[k][j] * L[i][k] for k in range(j))
---> 56             L[i][j] = (PA[i][j] - s2) / U[j][j]
 57
 58     return (P, L, U)

 IndexError: list index out of range

And here is the code I am using
import numpy as np
import pprint

def mult_matrix(M, N):
    """Multiply square matrices of same dimension M and N"""

    # Converts N into a list of tuples of columns
    tuple_N = zip(*N)

    # Nested list comprehension to calculate matrix multiplication
    return [[sum(el_m * el_n for el_m, el_n in zip(row_m, col_n)) for col_n in tuple_N] for row_m in M]

def pivot_matrix(M):
    """Returns the pivoting matrix for M, used in Doolittle's method."""
    m = len(M)

    # Create an identity matrix, with floating point values
    id_mat = [[float(i ==j) for i in range(m)] for j in range(m)]

    # Rearrange the identity matrix such that the largest element of
    # each column of M is placed on the diagonal of of M
    for j in range(m):
        row = max(range(j, m), key=lambda i: abs(M[i][j]))
        if j != row:
            # Swap the rows
            id_mat[j], id_mat[row] = id_mat[row], id_mat[j]

    return id_mat

def lu_decomposition(A):
    """Performs an LU Decomposition of A (which must be     square)
    into PA = LU. The function returns P, L and U."""
    n = len(A)

    # Create zero matrices for L and U
    L = [[0.0] * n for i in range(n)]
    U = [[0.0] * n for i in range(n)]

    # Create the pivot matrix P and the multipled matrix PA
    P = pivot_matrix(A)
    PA = mult_matrix(P, A)

    # Perform the LU Decomposition
    for j in range(n):
    # All diagonal entries of L are set to unity
        L[j][j] = 1.0

        # LaTeX: u_{ij} = a_{ij} - \sum_{k=1}^{i-1} u_{kj} l_{ik}
        for i in range(j+1):
            s1 = sum(U[k][j] * L[i][k] for k in range(i))
            U[i][j] = PA[i][j] - s1

        # LaTeX: l_{ij} = \frac{1}{u_{jj}} (a_{ij} - \sum_{k=1}^{j-1} u_{kj} l_{ik} )
        for i in range(j, n):
            s2 = sum(U[k][j] * L[i][k] for k in range(j))
            L[i][j] = (PA[i][j] - s2) / U[j][j]

    return (P, L, U)

A = [[7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6]]
P, L, U = lu_decomposition(A)

print ("A:")
pprint.pprint(A)
print ("P:")
pprint.pprint(P)

print ("L:")
pprint.pprint(L)

print ("U:")
pprint.pprint(U)

A: The problem is obvious with a little diagnostic use of print:
    for i in range(j, n):
        s2 = sum(U[k][j] * L[i][k] for k in range(j))
        print("size PA:", len(PA), len(PA[i]), i, j)
        print("PA", PA[i][j])
        print("size L :", len(L),  len(L[i]),  i, j)
        print("L",  L[i][j])
        print("size U :", len(U),  len(U[i]),  i, j)
        print("U",  U[j][i])
        L[i][j] = (PA[i][j] - s2) / U[j][j]

Output:
size PA: 4 4 0 0
PA 7.0
size L : 4 4 0 0
L 1.0
size U : 4 4 0 0
U 7.0
size PA: 4 0 1 0
Traceback (most recent call last):
  File "so.py", line 68, in <module>
    P, L, U = lu_decomposition(A)
  File "so.py", line 57, in lu_decomposition
    print("PA", PA[i][j])
IndexError: list index out of range

You get to a point where PA has 4 rows, but the first row is empty.  You cannot index location 0 of an empty list.
As for fixing the problem, you need to diagnose just how the algorithm works, and where you implementation fails to match the given algorithm.  I, for one, am not going to reverse-engineer the algorithm from code that is barely documented and deals in one- and two-letter abbreviations for anonymous concepts.  As the posting guidelines tell you, make it easy for us to help you.

redpajama_set_name: RedPajamaStackExchange


text:
Build Change Named a 2008 Tech Award Laureate by Tech Museum of Innovation
Tech Award and China Expansion
Exciting News! Build Change has been named a 2008 Tech Awards Laureate, one of 25 global innovators recognized each year for applying technology to benefit humanity and spark global change.
The Tech Awards, a signature program of The Tech Museum of Innovation in San Jose, California, and presented by Applied Materials, Inc., selected Build Change from among hundreds of nominations representing 68 countries. Click Here to read the full press release.
Build Change is recognized as a Tech Laureate in the Swanson Foundation Equality Category for ensuring that each homeowner has access to affordable technology to build a house that will not collapse and injure or kill their families in an earthquake, regardless of income level.
Build Change's work will be recognized during the annual Awards Gala in San Jose on November 12. Click Here for a Live Webcast starting at 6:30 PM Pacific time. The Tech Awards will be featured by the local NBC News network at 6:00 PM and 11:00 PM.
Build Change Expands to China
Build Change is working with homeowners, builders, and international and local agencies to rebuild earthquake-resistant houses in the aftermath of the devastating May 12 earthquake in Sichuan, China. 87,000 people were killed and nearly 8 million housing units were destroyed in the magnitude 7.9 earthquake.
Understanding why houses collapsed is the first step to building back better, so our work in China began in June 2008 with a technical reconnaissance, hosted by Sichuan University and coordinated by the University of California, Office of the President 10 + 10 Strategic Partnership. Visit our website to download our technical reconnaissance reports (contact us for the Chinese version).
Well designed and built confined masonry buildings performed well in this earthquake, while unreinforced or partially confined masonry buildings with precast concrete plank roofs collapsed in massive numbers. We are nearly finished with designing safe, affordable, and culturally appropriate houses and developing training materials and programs, and we will start providing hands-on technical assistance and training directly to homeowners, builders, and other agencies this month.
Support from Mercy Corps and the Echoing Green Accelerator Fund have made this expansion possible - but this is only a start and we need your support to reach more families. Donate Now.
Position Opening in Sichuan
We're Hiring! Seeking a Program Manager to expand our homeowner-driven reconstruction programs in Sichuan, China. The successful candidate will combine proven management, coordination and training skills with hands-on construction experience. Structural earthquake engineering design expertise and marketing experience are helpful. For more details click here. To apply send cover letter and CV to info@buildchange.org by November 21, 2008.
Earthquake-resistant construction is within the reach of homeowners in developing countries. Minor, low or no-cost changes to existing ways of building and a little knowledge, go a long way toward safe, culturally appropriate and sustainable construction. Your contributions continue to make this possible.
Elizabeth Hausler
Build Change
DONATE ON-LINE
Through our site on Universal Giving. Use your credit card or Paypal account. Note that a service fee is charged by Paypal.
Send your check, payable to Build Change, to:
M. Timothy Louis
169 Throckmorton Ave., No. 2
Upgraded to a higher resolution digital camera, and not sure what to do with your old one? Reuse by donating your durable digital camera to Build Change. Reply to this e-mail for more information.
DONATE MILES
Offset our travel costs by donating your frequent flyer miles. Reply to this e-mail for more information.
If we missed you with our previous newsletters, visit our archive here.
About Build Change
Build Change is a 501(c)3 status non-profit social enterprise incorporated in the State of California on September 2, 2004. Your donation is tax-deductible to the fullest extent of the law.
Visit Build Change Website
Email Marketing by


text:
Reflecting on the Zuckerberg testimony from yesterday, the biggest take away from the joint hearing between the Judiciary Committee and the Commerce, Science, and Transportation Committee is that no one sitting on either committee has a clue about what Facebook is, what Facebook does, and the only person in the equation that has the ability to ask a legitimate question on Facebook is Zuckerberg himself. And he's picking answers off a sheet of paper that gives little insight, clarification, or does anything but market Facebook as a dorm room startup that made some mistakes and will do better in the future, and just consider all the good that it can do.
Literally, no one in that chamber has a clue what to ask, how to ask it, and it wouldn't matter if they did. It's a farce. Watch a video about nailing Jell-O to a tree, or go do it yourself, you'll get the same kind of insights into Facebook and data privacy as you would get from watching the Senate hearing.
Just a few questions that needed to be asked and honestly, genuinely, and succinctly answered regarding Facebook, the data users share, their role as moderators of an online community, and the implications that Facebook has in the lives of their billions of users: Continue reading "Softball with Zuckerberg: When Being the "Smartest Guy in the Room" is a Global Disaster"
From the great brain trust of West Virginia, it's elected officials and their "Ok Google, what's the shortest path to Almost Hell West Virginia" ilk, comes a wonderful new express lane for getting there. In Health department suspends needle-exchange portion of harm reduction clinic, The Gazette-Mail—The Charleston, WV based newspaper burdened with the soul-crushing task of keeping us informed regarding the antics and hijinks of our seemingly brain-damaged state capital—gives us a look at the brilliant plan to reduce crime and start a new epidemic from Police Chief Steve Cooper and Mayor Danny Jones. Ill-contented with the pace of our state's race to last place in everything, Cooper and Jones have apparently made it their mission to manipulate policy intended to facilitate discretion, common sense, and flexibility in implementing harm reduction efforts, choosing instead to eradicate the intelligent efforts to keep people alive and healthy. Can't say these two are soft on crime, they are rock hard on property theft, and they are gleeful at the opportunity to shove their drooling members into public health to prove that virility. Continue reading "Wild, Wonderful Infectious Diseases: New WV Slogan is Catching"
Monday seemed like it was set to be a rather uneventful day. True, I had to go to the Post Office and mail some things (a rare occurrence), but other than that, just do some studying, clean the house, and otherwise have a forgettable day. And then, a Facebook post about the suicide of a mutual friend. "What?!"
Part of me wants to be upset, rage at the world about "how does this happen," to be furious that there wasn't more I could offer him, that I didn't have the insight to offer, that the world couldn't have been a better place for him. The situation of his life had become quite dire in the last year in a half and left him feeling like a square peg struggling to survive in a world full of round holes. A kind and beautiful soul, liked and loved, but feeling like a houseguest that had overstayed his welcome. There didn't seem to be a way forward, financially tapped out, that wonderful soul trapped in a body that was failing, in a world that felt rejecting.
And I can't say that I don't understand it. I can't say that I can't see where he was coming from, that I didn't see him painted into a corner with no way out. I don't think anyone wanted to see it, that we were all hoping for a tomorrow that will never come. A day in which his problems would lessen, a job offer would arrive, his health would improve. A day in which the storm would finally pass and he would find himself standing in the sun. Continue reading "Taking Control: Suicide of a Friend"
For the entire 20th century, from 1900 to 1999, there were 270 school shootings, 254 people were killed, 406 were injured. Of those 270 shootings, 82 took place from 1987 when I started Kindergarten, until 2000 when I graduated High School, most of the deaths and injuries occurring during the 1980s and 1990s.
There have currently been 207 school shootings since I graduated High School, 227 killed, 278 injured, at last count. That count is only through the end of 2017.
One of those school shootings, in 1993, took place in my high school, just a few years before I started there. Asked about the "spot on the wall" outside his classroom, with a cold detachment, our teacher told us the story of what happened. One shot was fired into a wall to prove a gun was loaded. A student, with a sawed-off shotgun and a pistol, took hostages in a classroom. No one dead, no one injured. Just a painted over spot on a cinderblock wall. Continue reading "Spot on the Wall"
My Struggle to Get My Comp TIA A+
I'm supposed to be studying, I should be studying, I should be further along in the book, I should be registering for my exam by now, I should…
But, I'm struggling. I'm struggling with the words, "if you can do it, it must not be very hard." So it's either going to be hard and I won't pass and I don't want to spend $500 to find out that I'm stupid, or it's going to be "easy" because I pass it and I've wasted $500 to get a meaningless certification, further proof of how stupid I am. The further I get in the book, the more tests I pass without struggling to answer, the more stupid I feel. So I'm stalled.
I don't know how to get past this block, or how to fix this accomplishment issue. And I don't know why anyone should ever be given that message about their accomplishments. Was it to stall me out later in life? Was it to undermine my self-confidence and tear me down? Were they just thoughtless words from a thoughtless man?
"Vulnerability is the birthplace of innovation, creativity and change."
Instead of studying, I find myself trying to understand my issue, and getting lost in the works of Brene Brown. And I question whether I'm actually absorbing those ideas, or using them as a balm for old wounds and a distraction from my growing issue. I'm running out of time to make this happen. I'm running out of airstrip and I'm hurtling toward disaster, and my wheels are still firmly planted on the ground. I've turned to writing. The thing I'm usually procrastinating because that usually scares me more than anything else because it is currently less frightening than finishing the Comp TIA A+ book and taking the test. At least if I fail here, it feels like no one can see me.
Cloudflare & You: A Little Known Website May Have Exposed Your Data
As an IT person, there's a point when it seems like there isn't much that can really shake up the industry. And then something comes along that does. From exciting new hardware to frightening new viruses, there does seem to occasionally be that thing. The current thing has been dubbed Cloudbleed, in reference to a memory leak in Cloudflare's code that hemorrhaged out data.
Who is Cloudflare? What do they do?
Cloudflare is a Content Delivery Network (CDN) service provider.
Cloudflare's description of how their CDN service works and the improvement it makes in website load times.
CDNs are used to help websites operate globally by replicating a site to servers all over the world. Essentially, you pay a CDN to copy your website so that a user in Dubai has the same experience as users in New York, NY or someone three blocks from your server. One CDN server may encompass multiple sites, and there's no real division between what sites are contained on that server. They don't have a "kids site" server, a "porn site" server, "business site" server, "wholesome non-profit" server, etc. all of it is stored together. Continue reading "Cloudflare & You: A Little Known Website May Have Exposed Your Data"
Why the interest in Caregiving?
Caregiving, neither for the faint of heart or the weak of stomach, has been such an enormous part of my life. And I don't really see a life "after" caregiving. It all started with my mother and a diagnosis of early on-set Alzheimer's Disease back in the 90's, and continues today as I work to help my grandmother who is in her 90's continue to live in her home.
It's more than an interest, it has become a way of life. And here in West Virginia it is certainly a needed way of life. so much of our elderly community has found themselves alone, forgotten, or just plain out of options. for all of our talk about being a retirement state, there wasn't much planning put into managing the ongoing lives once the golf, shopping, travel, and dining days were replaced by the darker parts of aging. In a recent conversation with a local elder services director, it was mentioned that our county has a population of almost 15,000 seniors (65+), but they only receive funding to provide services to about 1,000, much less than the demand for their services.
Although many of those 15,000 don't need help and support, not only can that can easily change, but there are many caregivers struggling to make it through until they, essentially, win the elder services lottery.
It's a rainy New Year's Day in Princeton, WV, but that doesn't discourage me. No, 2016―a year best left to the dust bin of history―is finally gone and we hope a bright 2017 awaits us. A year in which we need to find a renewed sense of purpose and opportunity. And those are my wishes for you, that you may find those with abundance this year.


Jasmin Gravenhorst has been appointed sole CEO of doc.station Medienproduktion GmbH. The announcement was made by Fred Burcksen, President and CEO of ZDF Enterprises GmbH.
doc.station Medienproduktion GmbH, founded in 1999, has been wholly owned by ZDF Enterprises since December 2007.
After many years working as a producer and consultant for format developments, documentaries, talk shows and reports on Sat.1, ZDF, UFA Non-Fiction, Provobis, Gruner und Jahr, Multimedia Film- und Fernsehproduktion and Ziegler-Film, Jasmin Gravenhorst joined doc.station in 2007. Under Jasmine's leadership, more than 60 custom productions have been created in the Hamburg-based documentary studio for customers such as ARD, ZDF, arte, 3sat, National Geographic and Swiss Television. The range includes everything from documentaries on history and science to docudramas plus reports and wildlife films. The productions have won various accolades including the Ecran d 'Argent de la Fiction, the Deauville Green Award and the New York Festivals Award.


Netflix considering interactive films and TV shows | What Hi-Fi?
The Butterfly Effect, Blade Runner and I Am Legend: films with alternate endings that are better than their director's (or studio's) chosen one. Confident you would pick the right one? Netflix could soon give you a stab at the director's chair.
The streaming service is considering launching content that lets viewers choose how a show will end.
People who are supposedly 'familiar with the matter' have told Bloomberg that it is working on specials that will let subscribers choose between a list of storylines in a TV episode or film.
And rumour has it that one interactive episode will be part of Black Mirror's upcoming (fifth) season, which is due for release in December.
Interactive entertainment seems to be a very 'now' concept, with the smart speaker platform also venturing down the audience participation path to entice and engage users.
The new series would be Netflix's first foray into choose-your-own-adventure film and TV shows for adult viewers, although it already uses that model for interactive kids animation programmes. The first shows with this feature were Puss In Book: Trapped In An Epic Tale and Buddy Thunderstruck: The Maybe Pile, while a third show, Stretch Armstrong: The Breakout, is due to land on Netflix next year.


In the first episode of In Vogelvlucht we are going through the air to follow the route Genemuiden – Steenwijk. We will come through lovely villages, cities and monuments.
The route Genemuiden-Steenwijk is characterized by the numerous water and wildlife.
Be surprised by the Kop van Overijssel from the air.
From Genemuiden we will take the ferry across to Zwartsluis. We continue to Meppel. From there we can see the Waterpark Beulaeke Haven very well. It is located in the scenic Lake District of Overijssel. The park is centrally located between the National Park Weerribben-Wieden.
From the beautiful park we come across beautiful water from the north of Overijssel, like Blokzijl, Kalenberg and Giethoorn. We end up in the fortified town of Steenwijk. With this classic image we leave fortified city Steenwijk with its beautiful scenery from the air.


Students submit an online video of themselves giving a 5 minute special occasion oratory. Six finalists will be chosen to present their speeches and compete for monetary prizes and the chance to speak at the Patriotic Service at the BYU Marriott Center. Up to 6 students will be invited to a final competition.
MARCH 16, 2019 – Deadline for all speeches to be uploaded electronically.
Open to all 9th – 12th grade Utah students.
You may use visuals or video with your speech.
Speech must be your own work (family or friends may critique your speech but cannot write it for you).
Time limit is 5 minutes (penalty if speech is too short or too long).
The speech should be positive and hopeful, expressing ideas on how to build America and patriotism, while discussing sound principles of freedom.
Professional dress is requested for presentation.
Finalist speaks at the Patriotic Service.
Register and upload your video by March 16, 2019. clicking here.
If you have a google account you can login with that and go to the next step. If you don't have a google login then click on "sign up for YouTube" and then fill out the necessary info.
Click on the button that says "video upload" and then upload your video.
In the privacy section be sure to check the "Public" option.
You may have to wait a while for your video to upload, after your video is done precessing go to your published video page.
Copy the url link and paste it in the filed on the submission form.
Would you like future information from the Freedom Festival?


text:
Q: Having trouble installing Prism in Xamarin When I try to install Prism in my Xamarin application in visual studio I get this error
"[nuget.orgUnable to load the service index for source http://prism.azureedge.net/main.mrep. The content at 'http://prism.azureedge.net/main.mrep' is not a valid JSON object. Unexpected charater encountered while parsing value: <.Path ", line 0, position0.]"

A: I can't say I'm entirely sure what you're doing, but let me try to clarify some things for you.
The URL http://prism.azureedge.net/main.mrep is ONLY meant to be added as an Extensions Repository Source for Visual Studio Mac. It has nothing to do with NuGet and is not compatible with any other version of Visual Studio. That feed provides the Visual Studio Mac Extension to provide the Prism Project & Item Templates as well as several code snippets.
If you are looking for the Prism CI Feed to take advantage of the latest Prism build you need to add https://www.myget.org/F/prism/api/v3/index.json as a NuGet Package Source.


All of us are guilty of comparison and a rude, subconscious envy of others as we see beautiful things on social media. But here's some real talk, I too wrestle with fear and anxiety; afraid of not being enough, or doing enough. But the fear subsides when I remember it is not out of my own strength that I do anything...we have to come back, time and time again to who we are and where our identity comes from, or drown in the exhausting cycle of trying to be someone else.


This is the School of Informatics web server for events being hosted at Informatics. Not all events will use this server.
The views and content of these pages is the responsibility of the individual publishers.
Actual event pages can be found at http://events.inf.ed.ac.uk/<event name>/.


text:
//
//  PNResponseDeserialize.m
//  pubnub
//
//  This class was created to help deserialize
//  responses which connection recieves over the
//  stream opened on sockets.
//  Server returns formatted HTTP headers with response
//  body which should be extracted.
//
//
//  Created by Sergey Mamontov on 12/19/12.
//
//

#import "PNResponseDeserialize.h"
#import "NSObject+PNAdditions.h"
#import "NSData+PNAdditions.h"
#import "PNLogger+Protected.h"
#import "PNLoggerSymbols.h"
#import "PNPrivateMacro.h"
#import "PNResponse.h"
#import "PNHelper.h"
#import "PNMacro.h"

// ARC check
#if !__has_feature(objc_arc)
#error PubNub response deserializer must be built with ARC.
// You can turn on ARC for only PubNub files by adding '-fobjc-arc' to the build phase for each of its files.
#endif

#pragma mark Static

static void * const kHTTPHeaderStartMarker = "HTTP/1.1";
static void * const kHTTPHeaderEndMarker = "\r\n\r\n";
static void * const kChunkedHTTPPackenEndMarker = "\r\n0\r\n\r\n";
static void * const kNewLineFeedMarker = "\r\n";
static NSString * const kPNTransferEncodingHeaderFieldName = @"Transfer-Encoding";
static NSString * const kPNChunkedTransferEncodingHeaderFieldValue = @"chunked";

static NSString * const kPNContentEncodingHeaderFieldName = @"Content-Encoding";
static NSString * const kPNGZIPCompressedContentEncodingHeaderFieldValue = @"gzip";
static NSString * const kPNDeflateCompressedContentEncodingHeaderFieldValue = @"deflate";

static NSString * const kPNContentLengthHeaderFieldName = @"Content-Length";

static NSString * const kPNConnectionTypeFieldName = @"Connection";
static NSString * const kPNCloseConnectionTypeFieldValue = @"close";

#pragma mark Private interface methods

@interface PNResponseDeserialize ()

#pragma mark - Properties

// Reflects whether deserializer still working or not
@property (nonatomic, assign, getter = isDeserializing) BOOL deserializing;

#pragma mark - Instance methods

- (BOOL)isChunkedTransfer:(NSDictionary *)httpResponseHeaders;
- (BOOL)isCompressedTransfer:(NSDictionary *)httpResponseHeaders;
- (BOOL)isGZIPCompressedTransfer:(NSDictionary *)httpResponseHeaders;
- (BOOL)isDeflateCompressedTransfer:(NSDictionary *)httpResponseHeaders;
- (BOOL)isKeepAliveConnectionType:(NSDictionary *)httpResponseHeaders;
- (NSUInteger)contentLength:(NSDictionary *)httpResponseHeaders;
- (NSString *)contentCompressionType:(NSDictionary *)httpResponseHeaders;

- (PNResponse *)responseFrom:(const void *)buffer withSize:(NSUInteger)bufferSize
           malformedResponse:(BOOL *)isMalformedResponse;

/**
 @brief      Allow to find HTTP response in specified buffer.

 @param buffer       Pointer to the buffer with data inside of which packet should be found.
 @param bufferSize   Original buffer size.

 @return \c NSNotFound in case if there is no more packets in specified buffer.

 @since 3.7.10
 */
- (NSUInteger)HTTPResponseLocationIn:(const void *)buffer withSize:(NSUInteger)bufferSize;

/**
 @brief      Allow to find next HTTP response in specified buffer.
 @discussion This method used as addition to \c -HTTPResponseLocationIn:withSize: and use it's
             output as offset in buffer to find another HTTP packet start location.

 @param buffer       Pointer to the buffer with data inside of which packet should be found.
 @param bufferSize   Original buffer size.
 @param searchOffset Used on buffer pointer to get reference on new pointer starting from which
                     search should be done.

 @return \c NSNotFound in case if there is no more packets in specified buffer.

 @since 3.7.10
 */
- (NSUInteger)nextHTTPResponseLocationIn:(const void *)buffer withSize:(NSUInteger)bufferSize
                               andOffset:(NSUInteger)searchOffset;

- (NSUInteger)HTTPHeadersEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize;

- (NSUInteger)chunkedHTTPPacketEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize;
- (BOOL)hasChunkedHTTPPacketEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize;
- (NSUInteger)newLineFeedMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize;

/**
 * Allow to compose response data object from chunked data using
 * octet values to determine next chunk size
 */
- (const void *)joinedDataFromChunkedDataUsingOctets:(const void *)buffer withSize:(NSUInteger)bufferSize
                                       andJoinedSize:(NSUInteger *)joinedBufferSize;

#pragma mark -

@end

#pragma mark - Public interface methods

@implementation PNResponseDeserialize

#pragma mark - Instance methods

- (id)init {

    // Check whether initialization successful or not
    if((self = [super init])) {

        [self pn_setupPrivateSerialQueueWithIdentifier:@"response-deserializer"
                                           andPriority:DISPATCH_QUEUE_PRIORITY_DEFAULT];
    }

    return self;
}

- (void)parseBufferContent:(dispatch_data_t)buffer
                 withBlock:(void(^)(NSArray *responses, NSUInteger fullBufferLength,
                                    NSUInteger processedBufferLength,
                                    void(^readBufferPostProcessing)(void)))parseCompletionBlock {

    [self pn_dispatchBlock:^{

        if (!self.deserializing) {

            @autoreleasepool {

                self.deserializing = YES;
                __block dispatch_data_t normalizedBuffer = dispatch_data_create(NULL, 0, NULL,
                                                                                DISPATCH_DATA_DESTRUCTOR_DEFAULT);
                NSUInteger bufferSize = dispatch_data_get_size(buffer);
                __block NSUInteger processedLength = 0;
                __block NSUInteger packetsCount = 0;
                __block NSUInteger httpPacketStart = NSNotFound;
                __block NSUInteger httpPacketLength = 0;

                __block NSUInteger previousPacketStartLocation = NSNotFound;
                __block __pn_desired_weak void(^bufferProcessingBlockWeak)(const void *, size_t, size_t);
                void(^bufferProcessingBlock)(const void *, size_t, size_t);
                bufferProcessingBlockWeak = bufferProcessingBlock = ^(const void *bytes, size_t size,
                                                                      size_t offset) {

                    // Search for HTTP packet start location in suggested buffer.
                    NSUInteger packetStartLocation = [self HTTPResponseLocationIn:bytes withSize:size];

                    // Check whether packet start has been found or not.
                    if (packetStartLocation != NSNotFound) {

                        // Calculate real HTTP packet start location using data region offset and
                        // packet start location information.
                        NSUInteger originalPacketOffset = (offset + packetStartLocation);

                        // Check whether already found packet start earlier or not.
                        if (httpPacketStart != NSNotFound) {

                            // Calculate target HTTP packet size
                            httpPacketLength = originalPacketOffset - httpPacketStart;
                            if (originalPacketOffset > httpPacketStart) {

                                packetsCount++;
                                processedLength = (httpPacketStart + httpPacketLength);
                                dispatch_data_t packetData = dispatch_data_create_subrange(buffer, httpPacketStart, httpPacketLength);
                                normalizedBuffer = dispatch_data_create_concat(normalizedBuffer, dispatch_data_create_map(packetData, NULL, NULL));
                            }

                            // Update tracked HTTP packet information.
                            httpPacketStart = originalPacketOffset;
                            httpPacketLength = 0;
                        }
                        else {

                            // Check whether there is a garbage from previous incomplete HTTP packet or
                            // not.
                            if (offset == 0 && packetStartLocation != 0) {

                                [PNLogger logDeserializerInfoMessageFrom:self withParametersFromBlock:^NSArray * {

                                    return @[PNLoggerSymbols.deserializer.garbageResponseData,
                                             @(originalPacketOffset)];
                                }];

                                [PNLogger storeGarbageHTTPPacketData:^NSData * {

                                    return [NSData dataWithBytes:bytes length:originalPacketOffset];
                                }];
                            }
                            // Looks like potentionally we have read buffer which may haave more content in next portion.
                            else {

                                httpPacketStart = originalPacketOffset;
                            }
                        }

                        // Store previous packet start location
                        previousPacketStartLocation = packetStartLocation;

                        // Search for next HTTP packet start location in suggested buffer.
                        packetStartLocation = [self nextHTTPResponseLocationIn:bytes withSize:size
                                                                     andOffset:packetStartLocation];

                        // Check whether there is more HTTP packets in this buffer or not
                        if (packetStartLocation != NSNotFound) {

                            if (size >= packetStartLocation && (size - packetStartLocation) > 0) {

                                bufferProcessingBlockWeak(bytes + packetStartLocation,
                                                          size - packetStartLocation,
                                                          offset + packetStartLocation);
                            }
                        }
                        // Looks like there is no more HTTP packet in this buffer. Check whether HTTP packet
                        // start has been found or this is last sub-buffer.
                        else if (httpPacketStart != NSNotFound && (offset + size) == bufferSize){

                            // Calculate target HTTP packet size
                            httpPacketLength = bufferSize - httpPacketStart;
                            if (bufferSize > httpPacketStart && httpPacketLength > 0) {

                                packetsCount++;
                                processedLength = (httpPacketStart + httpPacketLength);
                                dispatch_data_t packetData = dispatch_data_create_subrange(buffer, httpPacketStart, httpPacketLength);
                                normalizedBuffer = dispatch_data_create_concat(normalizedBuffer, dispatch_data_create_map(packetData, NULL, NULL));
                            }
                        }
                    }
                    // Check whether de-serializer found packet start in previous buffer chunk or not.
                    else if (previousPacketStartLocation != NSNotFound && (offset + size) == bufferSize) {

                        // Calculate target HTTP packet size
                        httpPacketLength = bufferSize - httpPacketStart;
                        if (bufferSize > httpPacketStart && httpPacketLength > 0) {

                            packetsCount++;
                            processedLength = (httpPacketStart + httpPacketLength);
                            dispatch_data_t packetData = dispatch_data_create_subrange(buffer, httpPacketStart, httpPacketLength);
                            normalizedBuffer = dispatch_data_create_concat(normalizedBuffer, dispatch_data_create_map(packetData, NULL, NULL));
                        }
                    }
                };

                // Iterate over chunks of data stored in buffer.
                dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset,
                                                  const void *bytes, size_t size) {

                    bufferProcessingBlock(bytes, size, offset);

                    return true;
                });

                NSMutableArray *parsedResponses = [NSMutableArray array];
                NSUInteger normalizedBufferSize = dispatch_data_get_size(normalizedBuffer);
                if (bufferSize > 0) {

                    // Check whether at least one HTTP packet has been found in provided buffer.
                    if(normalizedBufferSize > 0) {

                        void(^malformedResponseParseErrorHandler)(void const *, NSUInteger) = ^(void const *malformedBuffer, NSUInteger malformedBufferSize) {

                            [PNLogger logDeserializerErrorMessageFrom:self withParametersFromBlock:^NSArray *{

                                NSString *encodedContent = [[NSString alloc] initWithBytes:malformedBuffer
                                                                                length:malformedBufferSize encoding:NSUTF8StringEncoding];
                                if (!encodedContent) {

                                    encodedContent = [[NSString alloc] initWithBytes:malformedBuffer
                                                                              length:malformedBufferSize encoding:NSASCIIStringEncoding];

                                    if (!encodedContent) {

                                        encodedContent = @"Binary data (can't be stringified)";
                                    }
                                }

                                return @[PNLoggerSymbols.deserializer.unableToEncodeResponseData,
                                         @(malformedBufferSize),
                                         (encodedContent ? encodedContent : [NSNull null])];
                            }];
                        };

                        dispatch_data_apply(normalizedBuffer, ^bool(dispatch_data_t region, size_t offset,
                                                                    void const *bytes, size_t size) {

                            BOOL malformedResponse;
                            PNResponse *response = [self responseFrom:bytes withSize:size
                                                    malformedResponse:&malformedResponse];
                            if (response) {

                                [parsedResponses addObject:response];
                            }
                            else {

                                if (packetsCount == 1 || (offset + size) == normalizedBufferSize) {

                                    if (malformedResponse) {

                                        malformedResponseParseErrorHandler(bytes, size);
                                    }
                                    else {

                                        if (processedLength >= size) {

                                            processedLength -= size;
                                        }
                                    }
                                }
                                else {

                                    [PNLogger logDeserializerInfoMessageFrom:self withParametersFromBlock:^NSArray * {

                                        return @[PNLoggerSymbols.deserializer.garbageResponseData,
                                                 @(size)];
                                    }];

                                    [PNLogger storeGarbageHTTPPacketData:^NSData * {

                                        return [NSData dataWithBytes:bytes length:size];
                                    }];
                                }
                            }

                            return true;
                        });
                    }
                    else {

                        [PNLogger logDeserializerInfoMessageFrom:self withParametersFromBlock:^NSArray * {

                            return @[PNLoggerSymbols.deserializer.garbageResponseData,
                                     @(bufferSize)];
                        }];

                        processedLength = bufferSize;
                        [PNLogger storeGarbageHTTPPacketData:^NSData * {

                            const void *garbageData;
                            unsigned long garbageDataSize = 0;
                            dispatch_data_t new_data_file = dispatch_data_create_map(buffer, &garbageData, &garbageDataSize);
                            NSData *garbage = nil;
                            if (new_data_file && garbageDataSize > 0) {

                                garbage = [NSData dataWithBytes:garbageData length:garbageDataSize];
                            }

                            return garbage;
                        }];
                    }
                }

                parseCompletionBlock([parsedResponses copy], bufferSize, processedLength, ^{

                    [self pn_dispatchBlock:^{

                        self.deserializing = NO;
                    }];
                });
            }
        }
    }];
}

- (BOOL)isChunkedTransfer:(NSDictionary *)httpResponseHeaders {

    NSString *transferEncoding = [httpResponseHeaders objectForKey:kPNTransferEncodingHeaderFieldName];
    NSComparisonResult result = [transferEncoding caseInsensitiveCompare:kPNChunkedTransferEncodingHeaderFieldValue];

    return transferEncoding && result == NSOrderedSame;
}

- (BOOL)isCompressedTransfer:(NSDictionary *)httpResponseHeaders {

    return [self isGZIPCompressedTransfer:httpResponseHeaders] || [self isDeflateCompressedTransfer:httpResponseHeaders];
}

- (BOOL)isGZIPCompressedTransfer:(NSDictionary *)httpResponseHeaders {

    NSString *contentEncoding = [self contentCompressionType:httpResponseHeaders];
    NSComparisonResult result = [contentEncoding caseInsensitiveCompare:kPNGZIPCompressedContentEncodingHeaderFieldValue];

    return contentEncoding && result == NSOrderedSame;
}

- (BOOL)isDeflateCompressedTransfer:(NSDictionary *)httpResponseHeaders {

    NSString *contentEncoding = [self contentCompressionType:httpResponseHeaders];
    NSComparisonResult result = [contentEncoding caseInsensitiveCompare:kPNDeflateCompressedContentEncodingHeaderFieldValue];

    return contentEncoding && result == NSOrderedSame;
}

- (BOOL)isKeepAliveConnectionType:(NSDictionary *)httpResponseHeaders {

    NSString *connectionType = [httpResponseHeaders objectForKey:kPNConnectionTypeFieldName];
    NSComparisonResult result = [connectionType caseInsensitiveCompare:kPNCloseConnectionTypeFieldValue];

    return connectionType && result != NSOrderedSame;
}

- (NSUInteger)contentLength:(NSDictionary *)httpResponseHeaders {

    NSString *contentLength = [httpResponseHeaders objectForKey:kPNContentLengthHeaderFieldName];
    NSUInteger length = 0;
    if (contentLength && ![contentLength isEqualToString:@"0"]) {

        length = strtoul([contentLength UTF8String], NULL, 10);
    }

    return length;
}

- (NSString *)contentCompressionType:(NSDictionary *)httpResponseHeaders {

    return [httpResponseHeaders objectForKey:kPNContentEncodingHeaderFieldName];
}

- (PNResponse *)responseFrom:(const void *)buffer withSize:(NSUInteger)bufferSize
           malformedResponse:(BOOL *)isMalformedResponse {

    // Mark that request is incomplete because from the start we don't know for sure
    // (also this make code cleaner)
    *isMalformedResponse = YES;
    PNResponse *response = nil;

    CFHTTPMessageRef message = NULL;
    NSUInteger httpHeadersEndMarkerLocation = [self HTTPHeadersEndMarkerIn:buffer withSize:bufferSize];
    NSUInteger responseBodyOffset = 0;
    if (httpHeadersEndMarkerLocation != NSNotFound) {

        responseBodyOffset = (httpHeadersEndMarkerLocation + strlen(kHTTPHeaderEndMarker));

        // Appending only portion of bytes which contains reference on all passed with response
        // HTTP headers which will be used during body processing.
        message = CFHTTPMessageCreateEmpty(NULL, FALSE);
        CFHTTPMessageAppendBytes(message, buffer, (CFIndex)responseBodyOffset);
    }

    if (message) {

        // Ensure that all headers has been received.
        if (CFHTTPMessageIsHeaderComplete(message)) {

            // Fetch HTTP headers from response
            NSDictionary *headers = CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(message));

            // Fetch HTTP status code from response
            NSInteger statusCode = CFHTTPMessageGetResponseStatusCode(message);
            CFRelease(message);

            // Check whether response is chunked or not
            BOOL isResponseChunked = [self isChunkedTransfer:headers];

            // Check whether response is archived or not
            BOOL isResponseCompressed = [self isCompressedTransfer:headers];

            // Check whether server want to close connection right after this response or keep it alive
            BOOL isKeepAliveConnection = [self isKeepAliveConnectionType:headers];

            // Retrieve response body length (from header field)
            NSUInteger contentLength = [self contentLength:headers];

            if (!isResponseChunked || [self hasChunkedHTTPPacketEndMarkerIn:buffer withSize:bufferSize]) {

                // Retrieve pointer on actual message body (all headers stripped from it).
                const void *responseBody = (buffer + responseBodyOffset);
                NSUInteger contentSize = (bufferSize > responseBodyOffset ? (bufferSize - responseBodyOffset) : 0);

                if ((contentLength > 0 && contentSize > 0) || contentSize > 0) {

                    if (statusCode != 200 && !(statusCode >= 401 && statusCode <= 503)) {

                        [PNLogger logDeserializerInfoMessageFrom:self withParametersFromBlock:^NSArray *{

                            NSString *encodedContent = [[NSString alloc] initWithBytes:buffer
                                                        length:bufferSize encoding:NSASCIIStringEncoding];

                            return @[PNLoggerSymbols.deserializer.unexpectedResponseStatusCode,
                                    @(statusCode), (encodedContent ? encodedContent : [NSNull null])];
                        }];

                        // In case if response arrived with unexpected code, store it for future research.
                        [PNLogger storeUnexpectedHTTPDescription:nil packetData:^NSData *{

                            return [NSData dataWithBytes:buffer length:bufferSize];
                        }];
                    }

                    // Check whether there provided content is larger than declared by
                    // 'Content-Length' or not
                    if (!isResponseChunked && contentSize > contentLength && contentLength > 0) {

                        // Looks like there is an extra data at the end of parsed response which
                        // should be truncated to the correct size
                        contentSize = contentLength;
                    }

                    // Real content can be larger then specified in 'Content-Length' and it will be
                    // truncated during processing step.
                    BOOL isFullBody = (contentSize == contentLength);

                    if (isResponseChunked) {

                        NSUInteger packetEndLocation = [self chunkedHTTPPacketEndMarkerIn:buffer
                                                                                withSize:bufferSize];

                        isFullBody = (packetEndLocation != NSNotFound);
                        if (isFullBody) {

                            // Calculate new useful body content size. This will allow to truncate
                            // and data which has been appended by server aside from declared
                            // chinked content.
                            contentSize = (packetEndLocation + strlen(kChunkedHTTPPackenEndMarker));
                        }
                    }

                    if (isFullBody) {

                        if (isResponseChunked) {

                            NSUInteger joinedSize;
                            responseBody = [self joinedDataFromChunkedDataUsingOctets:responseBody
                                                                             withSize:contentSize
                                                                        andJoinedSize:&joinedSize];
                            contentSize = joinedSize;
                        }

                        if (isResponseCompressed) {

                            NSUInteger extractedSize;
                            if ([self isGZIPCompressedTransfer:headers]) {

                                responseBody = pn_GZIPInflate(responseBody, contentSize, &extractedSize);
                            }
                            else {

                                responseBody = pn_inflate(responseBody, contentSize, &extractedSize);
                            }
                            contentSize = extractedSize;
                        }
                        *isMalformedResponse = (contentSize == 0);

                        [PNLogger logDeserializerInfoMessageFrom:self withParametersFromBlock:^NSArray *{

                            NSString *rawData = [[NSString alloc] initWithBytes:responseBody
                                                 length:contentSize encoding:NSUTF8StringEncoding];

                            return @[PNLoggerSymbols.deserializer.rawResponseData, @(statusCode),
                                    (rawData ? rawData : [NSNull null])];
                        }];
                        response = [PNResponse responseWithContent:[NSData dataWithBytes:responseBody length:contentSize]
                                                              size:contentSize code:statusCode
                                          lastResponseOnConnection:!isKeepAliveConnection];
                    }
                }
            }
            else {

                *isMalformedResponse = !isResponseChunked;
            }
        }
    }

    return response;
}

- (const void *)joinedDataFromChunkedDataUsingOctets:(const void *)buffer withSize:(NSUInteger)bufferSize
                                       andJoinedSize:(NSUInteger *)joinedBufferSize {

    NSMutableData *joinedData = [NSMutableData data];
    BOOL parsingChunkOctet = YES;
    BOOL parsingChunk = NO;
    NSUInteger chunkStart = 0;
    NSUInteger chunkSize = 0;

    NSUInteger cursorLocation = [self newLineFeedMarkerIn:buffer withSize:bufferSize];

    while (cursorLocation != NSNotFound && (parsingChunkOctet || parsingChunk)) {

        if (parsingChunkOctet) {

            // Get size of the chunk with data
            chunkSize = strtoul(buffer + chunkStart, NULL, 16);
            parsingChunkOctet = NO;
            parsingChunk = (chunkSize > 0);

            // Adjust chunk start position to the end of chunk size line feed
            chunkStart = cursorLocation + strlen(kNewLineFeedMarker);

            // Check whether octet report that next chunk of data will
            // be zero length or not
            if (chunkSize == 0 || chunkSize == INT_MAX || chunkSize == INT_MIN) {

                break;
            }
        }

        if (parsingChunk) {

            if (chunkStart + chunkSize <= bufferSize) {

                [joinedData appendBytes:(buffer + chunkStart) length:chunkSize];
                parsingChunk = NO;

                // Adjust chunk start position to the end of chunk size line feed.
                // New line feed has been added, because each chunk of data end up with new line
                // feed not counted in chunk size.
                chunkStart += (chunkSize + strlen(kNewLineFeedMarker));

                if (bufferSize > chunkStart) {

                    parsingChunkOctet = YES;
                    cursorLocation = [self newLineFeedMarkerIn:(buffer + chunkStart)
                                                      withSize:(bufferSize - chunkStart)];
                    if (cursorLocation != NSNotFound) {

                        cursorLocation += chunkStart;
                    }
                }
            }
        }
    }

    *joinedBufferSize = joinedData.length;

    return (joinedData.length ? joinedData.bytes : NULL);
}

- (NSUInteger)HTTPResponseLocationIn:(const void *)buffer withSize:(NSUInteger)bufferSize {

    return pn_str_location(buffer, bufferSize, 0, kHTTPHeaderStartMarker);
}

- (NSUInteger)nextHTTPResponseLocationIn:(const void *)buffer withSize:(NSUInteger)bufferSize
                               andOffset:(NSUInteger)searchOffset {

    NSUInteger location = NSNotFound;
    if (searchOffset != NSNotFound) {

        searchOffset++;
        if (bufferSize > searchOffset) {

            location = pn_str_location(buffer + searchOffset, bufferSize - searchOffset, 0,
                                       kHTTPHeaderStartMarker);
        }
    }

    return location;
}

- (NSUInteger)HTTPHeadersEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize {

    return pn_str_location(buffer, bufferSize, 0, kHTTPHeaderEndMarker);
}

- (NSUInteger)chunkedHTTPPacketEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize {

    return pn_str_location(buffer, bufferSize, 0, kChunkedHTTPPackenEndMarker);
}

- (BOOL)hasChunkedHTTPPacketEndMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize {

    return [self chunkedHTTPPacketEndMarkerIn:buffer withSize:bufferSize] != NSNotFound;
}

- (NSUInteger)newLineFeedMarkerIn:(const void *)buffer withSize:(NSUInteger)bufferSize {

    return pn_str_location(buffer, bufferSize, 0, kNewLineFeedMarker);
}

- (void)dealloc {

    [self pn_destroyPrivateDispatchQueue];
}

#pragma mark -

@end

redpajama_set_name: RedPajamaGithub


Addiction to drugs and alcohol is a dynamic and multi-faceted disease process in humans, with devastating health and financial consequences for the individual and society-at-large. In humans, drug and alcohol use disorders (i.e., abuse and dependence) are defined by clusters of behavioral symptoms that can be modeled to various degrees in animals. Hallmark behavioral symptoms associated with drug and alcohol dependence are compulsive drug use, loss of control during episodes of drug use, the emergence of a negative emotional state in the absence of the drug, and chronic relapse vulnerability during drug abstinence. The transition to drug dependence is defined by neuroadaptations in brain circuits that, in the absence of drugs, mediate a variety of critical behavioral and physiological processes including natural reward, positive and negative emotional states, nociception, and feeding. Chronic drug exposure during the transition to dependence spurs (1) within-systems changes in neural circuits that contribute to the acute rewarding effects of the drug and (2) recruitment of brain stress systems (neuroendocrine and extra-hypothalamic).
There are substantial genetic contributions to the propensity to use and abuse drugs, and drug abuse is highly co-morbid with various other psychiatric conditions (e.g., anxiety disorders, major depressive disorder) that may precede or follow the development of drug use problems. Across drugs of abuse, there are overlapping and dissociable aspects of the behavioral and neural changes that define the transition to dependence. Even within a single drug, people abuse drugs for a variety of reasons. The picture is further complicated by the fact that humans often abuse more than one drug concurrently.
Even in the face of these challenges, pre-clinical and clinical research is making exponential gains into understanding the neurobiology of drug addiction. With the advent of new technologies and their combination with traditional approaches, the field is able to ask and answer addiction-related research questions in increasingly sophisticated ways. Here, we hope to assemble a collection of articles that provide an up-to-the-moment snapshot of the prevailing empirical, theoretical and technical directions in the addiction research field. We encourage submissions from all investigators working to understand the neurobiology of addiction, especially as it pertains to reward and stress pathways in the brain.


text:
Scheduling Courses
myLSU Portal: Join a Waitlist for a Course
[Return to myLSU Portal: LSU Overview]
Students are now able to join a waitlist when scheduling their courses for the next semester. By joining a waitlist, students no longer have to check for openings in courses they are trying to add to their schedule. By simply requesting to join the class VIA waitlist, students will be added to a queue of students requesting to be added to the course. As additional spots become available within the course, students will be added in the order they joined the waitlist. Once a student has been added to a course, they will then be notified by e-mail. Students can waitlist up to three courses per semester. Being added to a waitlist is now the most efficient way to schedule classes at LSU. For more information about wait lists, visit the Office of the University Registrar.
To Join a Waitlist
1. Log into the myLSU Portal (my.lsu.edu).
2. Click Registration Services, located in the sidebar.
3. Click Schedule Request.
4. Select the semester from the menu and click View Schedule Request.
5. Enter the course you wish to add into the Schedule Request form and then click Add Course.
6. If the section is full, a waitlist will then be available to join. Select W to be added to the waitlist.
7. Once you have been added to the waitlist, a status box will be displayed at the bottom of the page listing the course, time, and your position within the queue.
8. Click Remove at any time to be taken off the waitlist.
Last Updated: 11/22/2022 2:36:36 PM


text:
HomeCAAs/ANSPsFacility consolidation could save billions: Reason Foundation
Facility consolidation could save billions: Reason Foundation
April 3, 2013 CAAs/ANSPs, NextGen, News 0
Bob Poole of The Reason Foundation chairing one of the panels at this year's World ATM Congress
A new study, just released by the Reason Foundation, estimates that large-scale consolidation of TRACONs and Centres in the continental United States could yield one-time savings of $1.7 billion and ongoing savings of about a $1 billion per year.
"Air Traffic Control from Anywhere to Anywhere: The Case for ATC Facility Consolidation," was researched and written by Michael Harrison, Ira Gershkoff, and Gary Church of Aviation Management Associates.
Bob Poole, director of transportation policy at the Reason Foundation, a think tank based in Los Angeles, reports in his latest newsletter that the study relies on two underlying premises. The first is that the new paradigm of air traffic management, under way via NextGen, makes it possible to control air traffic anywhere in the country from any location, thus severing the link between ATC facility location and the geographical boundaries of airspace. Hence, instead of rebuilding the 187 mostly aging and obsolescing Centres and TRACONs, they could be replaced by a much smaller number of new, high-tech facilities in less-costly geographic locations.
The second underlying premise is economies of scale. The project team quantified this using FAA data to calculate the productivity of each of its Centres and TRACONs. New York Centre is the most productive, averaging over 9,400 operations per controller; Denver Center is least productive, at just over 5,400 operations per controller. A similarly large variation in productivity was found among TRACONs.
The research team then used these data to estimate the potential savings from facility consolidation. For Centre staffing they created a regression equation which posits that the number of controllers at a Centre equals a constant plus a variable term based on the number of air carrier operations, air taxi operations, general aviation operations, and military operations.
Using FAA data for those variables from each of the 20 Centres, the regression equation found that the constant term is 84.6.
"That means if you have a Centre at all, it needs a minimum of 85 people, with the rest determined by the various amounts of traffic handled. A similar equation for TRACONs had a constant term of 8.56, with the rest being variable based on types and amounts of traffic," says Poole.
When two Centres are combined, the workloads measured by the variable terms based on traffic are added together, but you now have only the one constant of 85 baseline people. The authors developed a large-scale consolidation plan to even out workloads among facilities, aiming for higher overall productivity.
The plan they came up with replaces the 20 existing Centres with five high-altitude en-route facilities and eight "Integrated Control Facilities" that combine en-route and terminal airspace in the largest metro areas. Smaller TRACONs would be consolidated regionally, ending up with 38 such facilities. Overall then, the plan reduces 187 existing en-route and terminal facilities to 51—just over one-quarter as many.
Because compensation practices call for higher pay in higher-activity facilities, the savings in operating costs are not as great as might be expected, and many controllers would end up with increased compensation. But some, needless to say, would be phased out or transferred to other FAA positions.
The authors estimate that consolidation would save a net $314 million a year due to the lower staffing made possible by combining facilities. In addition, productivity gains due to NextGen technology and procedures might add between $540 and $680 million per year. Add another $109 million in maintenance savings due to fewer buildings and total annual savings could be in the $1 billion range. Poole points out here that this analysis does not address possible productivity gains with control towers, such as expanding the use of contract services and/or implementing remote towers.
But the savings don't stop there, says Poole. Since a large fraction of the existing 187 Centres and TRACONs are nearing the end of their useful lives, the FAA is rapidly approaching the point at which it must either engage in large-scale rehabilitation of these facilities where they are today or replace them with a smaller number of consolidated facilities. Selling the land, buildings, and equipment associated with facilities recommended for closure would yield $1.7 billion toward the cost of the new facilities, based on analysis of data in two FAA property databases.
The Centre consolidation approach outlined here is similar to the initial concept the FAA's Air Traffic Organization (ATO) developed several years ago, when it began facing up to the need to replace aging facilities and the potential changes NextGen would make possible. Unfortunately, says Poole, last year the agency changed focus. Instead of developing an overall consolidation plan, with a schedule and cost estimates, it will proceed one project at a time. For now it is focusing all its efforts on an initial Integrated Control Facility for the airspace in the Northeast.
That approach is high-risk since state and national elected officials in the affected areas are already mobilizing to fight the loss of jobs in their jurisdictions. In the view of the Reason study's authors, a far wiser approach would be to follow the kind of comprehensive approach that has been used several times for large-scale military base closures and consolidations. An overall nationwide plan is drawn up, and Congress has a choice of either accepting it as a whole or rejecting it. This makes the battle one between winners (those gaining new or expanded facilities) and losers, rather than just between potential losers and everyone else who is not affected.
"And if that approach seems too difficult for Congress to work out, the report suggests an alternative: separate the ATO from the FAA and from the federal budget process, by making it a self-supporting ANSP," says Poole.
"That way, as shown in facility consolidations carried out successfully by such ANSPs in Australia, Canada, Germany, and the U.K., these decisions can be made as business decisions, rather than political decisions. That would allow Congress to avoid a decade or more of fighting over facility consolidations, as well as easing the ATO's looming budget problems."
In response to the Reason Foundation report on facility consolidation, US controllers' union NATCA said it supports facility consolidations and realignments where they enhance operational services and the safety and efficiency of the National Airspace System.
"For example, we are collaborating with the FAA on the planned New York Integrated Control Facility which will combine NY Centre and NY TRACON into one facility. We also support the implementation of NextGen as a way to modernise the system over the long term. Unfortunately, sequestration is hampering these critical efforts. The indiscriminate nature of the cuts means that both current and future operations will be impacted. We continue to urge policy makers to replace these cuts so that efforts to improve, enhance and modernise our national airspace can continue."
Read More: Front & Centre
digital tower


text:
function colors = eod_color_from_range(scores, score_range, color_map)
% given a vector of scores and a range (must cover all real value), return colors in matrix form where each row is the color for corresponding score in the scores vector
if nargin < 3
    n_color = numel(color_range);
    color_map = cool(n_color);
end

n_score = numel(scores);
colors = zeros(n_score,3);
for score_idx = 1:n_score
    [~, color_idx] = histc(scores(score_idx), score_range);
    colors(score_idx, :) = color_map(color_idx, :);
end