If my battery is dead and the doors and trunk are locked, how do I get into the car?
Thread: If my battery is dead and the doors and trunk are locked, how do I get into the car?
Many members have posted with this problem and the complete solution has finally been presented by Qsilver7 and cnn.
If you're battery is dead and your doors are locked, first try this method to gain access to the interior and the battery (which is in the trunk) for jumping.
Owners unfamiliar with how to unlock their cars in the event of an electrical failure has plagued every BMW forum I've ever been on...going back to my first BMW...a 1985 e30 325e. In each case 99% of the time it is OPERATOR ERROR. First, most asking the question either missed it, forgot it, or never read the info in their owners manual...then when told what to do...they many times fail to turn the key far enough counter clockwise to the manual unlock position.
This is the manual unlock position for the driver's door (as an example that the lock DOES turn that far)....if your's don't, then when was the last time you lubricated your locks?
BTW...the same goes for the trunk lock cylinder on the e39 sedan (the e39 Touring does not have an external lock cylinder...but the tail gate can be opened manually from inside...see your owners manual for instruction).
If you (like many other E39 owners) can't get the doors/trunk to unlock manually, try this method which provides power to the car externally and allows the doors to be unlocked via the key fob.
Jack up the driver's side front wheel and support with jackstand for safety reason.
There is a red cable going to the starter motor.
You can jump through that (+) post labeled "Red Positive Cable" and a ground (such as Transmission).
PM me for Interior Trim Wraps!!! Get rid of your old wood!
Jamesdc4 - very, very "Q"ish (& that's a very good thing)!
Very good explanation for a very common problem people run into.
James, Cam and others,this is excellent information here and i know it will prove to be a gem for many to come. I feel it should also be stressed that we ideally should jump start from the battery terminal in the engine compartment, not the battery. Directly from the battery has been known to create electrical issues.
My method is basically the "last-line-of-defense" one.
- As QSilver7 said, one should be able to open door and trunk manually (even with dead battery).
- However, I have seen this in different forums that some people are locked out when the battery is dead, and they cannot open the door or trunk manually even with some force. Does anyone know the exact mechanism of the manual mode failure: i.e., exactly what part in the lock actuator goes wrong that prevent people from opening their door/trunk manually? Any door actuator expert here?
Back to this trick of jumping the "Red Positive Post" when you are desperate, I just confirmed with my 1998 528i (and probably true for all I6 models, and maybe V8 too) that there is no need to remove any plastic shield to get to it.
1. Make a note of the Rear part of the tire (the driver's side front tire). The "Red Positive Post" is directly inward of the Rear part of the tire.
Laying on your back and reach your hand in and you will see it (a large makeup $5 mirror will be very useful).
- Place a jackstand under the subframe. This is very important if you don't want to be crushed!
- Then do the jumping of (+) and (-) terminals as mentioned previously.
On some of the cars, the trick of using the manual keys and tickling the door handle will pop the lock open, but this is not always reliable, and sometimes just simply doesn't work well.
While it requires a certain "touch", and if you've never done it, it may not be easy, even when you know what you're doing, it can "fail".
I used to have this periodically on my E34 M5, and found a workaround to get into the car's front door by the following means.
Manually open the trunk by key. This never failed, even with dead battery.
Then the front could be opened, then the trunk, then the ardous process of jump starting could begin.
Sealbeach: OMG... "Q'ish"... I've now achieved adjective status! Thanks, I'm humbled ...that made my day...I've been "verbed" before (Q'd) but I think this is the first time being an adjective.
Last edited by Qsilver7; 06-03-2016 at 06:19 PM.
Glad my incompetance has helped others, lol. Seriously though, you guys are life savers.
I thought the Official BMW diagnostic procedure requires the summoning of no less than One (1) Magical Wizard.
You still have not explained to the group why you cannot open your door manually....LOL.
1. Lower the driver's window so you reach inside.
3. Reach inside and hit trunk release; open the trunk and d/c battery ground cable.
Now try to open your door manually, can you open it manually?
(The reason for #1 above is in case you cannot open the door manually, the window is down so you can still get inside the car).
For those who follow QSilver7's instructions to the "t" and still cannot open the door manually, this is my theory. It was 10F and I parked the car outside and used my manual key, it was stiff to turn to -45 deg position (see post #5 above) to open the door.
1- If you always use your remote, then your cylinder lock never goes through the "daily workout".
2- Now add water from rain, car wash, freezing rain over a 10-year period.
3- Now add the fact that you fail to lubricate your lock cylinder with the appropriate graphite lubricant.
When you look at all 3 factors above, 10 years later, when your battery is dead, there is a chance that your lock cylinder is seized (rusted in) and you can't open it manually.
- Once a month, give the lock cylinder a "workout": open it manually.
This way when you face with emergency, you are not caught by surprise!
Last edited by cnn; 01-03-2011 at 10:27 AM.
If the trunk is open, why not just jump the battery directly?
I agree with ElleShooTiger, once the trunk is open, the battery is accessible.
I think it might be a better idea to just use this method to get power to the car to open the doors. Then I would pop the hood and jump from the proper terminals in the engine bay. As mentioned earlier in the thread, bad things can possibly happen jumping from anywhere other than under the hood.
CNN, i greased the lock, works fine now. I couldn't get my lock past the 45 deg mark.
Keep working on it (to go past -45 deg mark). Spray WD-40 etc.
The key thing is to get to -90 deg!
Eventually, you should be able to get past the -45 deg mark.
Last edited by cnn; 01-03-2011 at 12:44 PM.
Cam forgot to add he's not responsible if you break your key in two.
Once again the "board" sheds a better light , and in finding this post another question was answered , it has been several months since tearing down the top end of my daughters car in the process of a h/g - turned into cracked cylinders (2) and now I am almost ready to install the new engine . Could not remember what the brass bolt on top of the i/m was till seeing the pics.
Thanks for the tips. In my case, I have a 2002 525ita sports wagon and the key solution did not work (I only had a +45 and -45 movement regardless of lubrication or not. Also, you can only use the key from the drivers side as there is no hatch key. The trick for me was to do what CNN had showed and jacked/braced the car on the drivers side and jump the car from the starter. The only issue with CNNs note was that with a decent pair of jumpers, you will have to take the red shield off the bolt to jump the car. However, the cover is only snapped in place and is easily removable once you are under the car and it provides full access for the jumper contact. After you jump the car, you can snap the cover back in place.
Worked like a champ. Thanks guys!!
i accidently locked my manual key in back of the trunk of a 745li and the battery was disconnected how do i get to trunk ? any suggestion would help!
Just wanted to write and chime in with an almost - similar situation. No real new info but just wanted to re-iterate what worked.
1. Battery went bad. Warnings.
2. Decided to change battery.
5. No way to open trunk without battery.
6. LUCKILY door was open.
8. Went to store and bought new battery.
9. Connected new battery to jump start terminal.
10. Used remote to open trunk. Completed battery install.


MONTPELIER – Health care reform could easily have been the spotlighted topic of the 2014 legislative session given the nonstop headlines about Obamacare and insurance exchanges for the past six months.
Add to that the fact that Gov. Peter Shumlin and the 2011 Legislature put the Vermont on a course leading to Green Mountain Care, a government-financed health insurance system that would cover all Vermont residents beginning in 2017 — a monumental change less than three years away.
Instead Gov. Peter Shumlin chose to trumpet only opiate addiction in his inaugural address and lawmakers focused their energies on more bite-sized initiatives such as mandating the labeling of genetically modified foods, raising the minimum wage, setting standards for share land development and banning drivers from using cellphones.
Health reform remained out of the limelight for much of the session and the bill finally drafted was inconsequential enough that legislative leaders were prepared to let it die if negotiations were going to delay adjournment. The final bill includes four principles "to guide financing of health care" and directives for six reports and a symposium.
Inaction was a fine result from Dr. Deb Richter's perspective. Richter, an advocate for publicly funded health insurance covering all Vermonters, visited the Statehouse throughout the session to monitor whether lawmakers would backtrack on Green Mountain Care.
Dr. Deb Richter, advocate for publicly funded health insurance covering all Vermonters, monitored the Legislature all session to make sure lawmakers didn't backtrack on the promise to keep the state headed toward implementation of Green Mountain Care in 2017.
When the Legislature adjourned without changing course, Richter said, "In my view it was mission accomplished."
Those Vermonters who worry about the risks associated with a single-payer health insurance system suggest Shumlin and the Democratic majority in the Legislature chose to take a bye in 2014 on big decisions about Green Mountain Care that might feed Vermonters' anxiety about health reform in an election year.
The administration certainly wanted to avoid calling any more attention than was necessary to the troubled rollout of Vermont Health Connect — a government-run online marketplace for health insurance mandated by the federal Affordable Care Act.
"I don't think the governor wanted to talk about it. That is why he led with the heroin problem," said Darcie Johnston, head of the only organization dedicated to challenging Shumlin's drive to establish the first state-run health insurance system in the U.S. "Kudos to him, he succeeded."
Those who support the plan to consolidate and expand government-financed health insurance under one umbrella argue this was a year to prepare for the analysis and decision-making that will be required next session.
House Health Care Committee Chairman Michael Fisher, D-Lincoln, explained that the 2011 law authorizing Green Mountain Care, Act 48, left few decisions to be made this year.
The 2015 session will be the year for decisions, which was why Senate President Pro Tempore John Campbell asked five committees to review Act 48 "to ensure that we fully understand the legislative task ahead."
Senate Finance Chairman Tim Ashe, D/P-Chittenden, elaborated on the background work his committee did.
"Our focus was on putting ourselves in the best position to make the best decision on a new health care system next year," Ashe said. The committee mapped out actions expected of the administration. They include submitting a preliminary application asking the federal government to allow Vermont's Green Mountain Care experiment, setting timetables to receive important information about those affected by Green Mountain Care and figuring out where independent physicians fit into the long-term Vermont health system equation.
Green Mountain Care remains a high priority for the governor even if he focused on other issues this session, said House Ways and Means Chairwoman Janet Ancel, D-Calais. "He has been rock solid in his commitment to make this change."
Neither the governor nor the Legislature could ignore the troubles that plagued Vermont Health Connect from opening day on Oct. 1 right into the session. The federally mandated online marketplace struggled with so many technical problems that Shumlin quickly arranged for small employers to be able to bypass it and buy their federally approved plans directly from insurance companies.
"From a systems perspective, it was really important to understand what had happened," House Speaker Shap Smith, D-Morristown, said. The House Health Care Committee had administration personnel report weekly.
"I don't think action was necessary," Smith also said. The only exchange-related provision in the final health care bill specifies that the business bypass Shumlin set up in the fall could continue.
Johnston of Vermonters for Health Care Freedom criticized the Legislature for being wimpy watchdogs over Vermont Health Connect. "It was a failed exchange and it still isn't working correctly."
"The majority party seemed to buy the very weak arguments of the administration," she continued. "There just doesn't seem to be the fire in the belly to go up against the governor."
House Health Care Chairman Fisher countered that critics focused only on the problems of Vermont Health Connect, not on its successes. "The reality is mixed," he said, noting that some Vermonters gained access to health care for the first time and others saw their out-of-pocket costs shrink.
Lawrence Miller, reassigned by the governor in January from his post at secretary of commerce to help bring Vermont Health Connect through the troubled waters, credited lawmakers with asking the administration tough questions about the lessons that government needed to learn to succeed with future ambitious projects. Miller will become head of health care reform for the administration in June.
Lawrence Miller, who will become chief of health care reform for the Shumlin administration on June 1, introduced himself to the House Health Care Committee on April 18 and fielded questions about how state government will do a better job managing future health initiatives.
Republican Leader Don Turner of Milton said accountability about the exchange was a priority for his caucus during the session. "When the Legislature is there, it keeps a little pressure on them."
Still he said he went home last week without assurance that the Legislature would continue oversight of the exchange.
Opponents of Shumlin's publicly financed health care plan have protested since the Green Mountain Care law passed about the delivery timing of the administration's plan for paying for the new system. They wanted it before the 2012 election, but the law said Shumlin could deliver it in January 2013.
Last year, however, Shumlin pushed off providing his financing proposal until January 2014. This year, he failed to deliver it in January. He suggested his staff might have something in March and now says the long-sought report will be ready in 2015 — after yet another election.
Democratic legislators mostly defend the governor's decision to delay, but the House version of the health bill included a deadline for delivery of the plan and a financial penalty. Those provisions disappeared in the final negotiations on the bill.
"I personally think the governor got to the leadership and told them what he would accept," Turner said.
"Whatever fell by the wayside was a mere function of lack of time," Ashe declared. "The administration had nothing whatsoever to do with the negotiations over the final health care bill."
Democrats insist the Shumlin administration must deliver next winter or jeopardize his health reform legacy.
"The administration needs to give the best possible plan at the earliest possible date," Ways and Means Chairwoman Ancel said. "The later we get the proposal, the further out the state date of any change will be."
Ancel said she wants to assure Vermonters that the Legislature won't rush its evaluation. "We will take as much time as we need to evaluate it."
Dr. Richter said she doesn't believe the public is in a rush to see the financing plan. "Mostly what people want are honest answers," she said, adding, "It is better to get it right."
Shumlin's political critics say the delays in producing the financing plan have cranked up public and business uncertainty about the future.
"Vermonters need answers. There is so much insecurity," House Republican Leader Turner said. "Until you get something from the governor that says this is what I'm going to do, you really can't discuss it on Main Street and explain the magnitude of what he is trying to do."
Johnston at Vermonters for Health Care Freedom plans to make the inaction on Green Mountain Care financing an issue in the election.
The governor and other supporters of publicly funded health care will "have to explain how they are going to pay the $2 billion it is going to cost," she said. "Democrats throughout the state should have their feet held to the fire on that question."
Richter said she doesn't believe health reform will become a liability in the 2014 election. "The majority of Vermonters want a publicly funded, universal health care system," she said. "Candidates who support it shouldn't be afraid to talk about it."


text:
Geography Alumni
Department of Geography @ University of British Columbia
From Vancouver to Newcastle
By Craig Jones
I'm a Lecturer in Political Geography here in Newcastle and I've been here with my wife, Caitrin, for just over a year and a half. Life here is good. I've got beautiful views to the east and on a clear day I can see the North Sea. Today is cloudy, but my spirits are high because writing this feels like I'm reconnecting with you all at UBC, and that always brings a smile. I have few complaints and lots to be grateful for, not least my health. The transition back into UK life and work was surprisingly straightforward and despite having spent nearly nine years in Vancouver, in many ways it feels like I never left. Caitrin insists that my accent is become more British by the week, to which I incredulously reply, "I am British". We like it here. Newcastle is an understated post-industrial city that seems to make the most of its fairly recent – and still felt – decline. It is understated, eminently walkable, comparatively cheap and is full of friendly Geordies who more than live up to their stereotype. It's also surrounded by some of the most stunning countryside and coastline in Britain, much of which feels 'untouched' compared to many places in the South of the country. I sometimes even feel a vague and confused sense of northern pride. To the locals, I may as well be from Cornwall, and Caitrin, of course, is automatically a Trumplander.
There is no such thing as a day in the life of a Lecturer here at Newcastle – much like anywhere else, I suspect. Weeks and months have a certain rhythm, but during term-time the days feel like organised chaos. We are contracted to teach and do admin for around 60 per cent of the time – and the remainder 40+ per cent is spent on research. Student numbers are high, as are tuition fees, so there is a parallel responsibility not only to ensure 'Teaching Excellence', but also to create student satisfaction. The latter has a seemingly insatiable appetite, and one's work is never done. One big difference between the UK and Canadian systems – so far as I can tell – is that here in the UK we do a lot of team-teaching. This can mean several people teaching on an individual course (or 'module' here). It also means that it is common to teach across and 'drop in' to several courses for the odd lecture. This has both benefits and drawbacks but one thing I have particularly enjoyed is the co-creation of lectures and knowledge and learning from many different pedagogic styles.
I've been asked to reflect on how I leveraged my PhD from UBC in order to transition into my current position as a Lecturer at Newcastle University, which is not necessarily an easy task. It is not easy because I think that each PhD is unique, as are all of our ambitious and career paths, but even more than this, getting a job is overdetermined: you never quite know the exact reason as to why you – and not the many other qualified people out there – got the job. But with that equivocation aside, I think three things helped me with the transition. First, I tried to publish as much as I could from my PhD as early as possible and did so by submitting only to top-ranked journals. At risk of stating the painfully obvious, where you publish matters a great deal in this line of business. Second, I had a lot of teaching experience and had developed and taught my own course on the Geographies of the Middle East, which was one of the best things I did at graduate school. More than anything, years of TA'ing and doing as much lecturing as I could at UBC gave me confidence in the classroom. It is the sort of confidence that translates elsewhere, into research presentations and conference mingling, both of which, become important. Finally, and taking sage advice from my wonderful supervisor, Derek Gregory, I approached my PhD/dissertation as a long book project. Book publishers don't always like lengthy literature reviews, and they want to sell books to more than the 5 members of your PhD committee, so a book demands a different style but also a different frame of mind. It feels satisfying, if perhaps a little precocious and arrogant to say, "I'm writing a book", but the words are performative – if you tell people you're doing it, you better well do it, and sooner or later you find yourself…actually doing it! A book is not for everyone and it suits some projects better than others. Crucially, it all depends what you want from graduate school and where you want to go next. If it's a career outside of academia/teaching, then I'm afraid that the above will almost certainly be irrelevant to you. But if it's the academy that calls you, then I have but one word of advice: publish.
I want to end by reflecting on something that I think many graduate students feel and experience at one point or another during their studies – the idea that graduate degrees should or must lead to academic jobs. The truth, of course, is that there are more graduates than academic jobs. Many of those jobs have become increasingly temporary, precarious and exploitative over the last decade or two. We do those jobs in the hope that something more secure and less precarious will come along; sometimes those jobs come up, but often they do not – leaving a Twittersphere and blogosphere full of painful stories of dashed hopes and precarity. I'm in no place to write about such things because I have a full-time permanent job, but here at Newcastle we're fighting against precarity and trying to obtain decent positions for those on year-to-year contracts.
But the flip side of all this is that we should not think of graduate school as a factory for the production of new academics. Graduate school provides students with a wide variety of skills that are valuable far beyond academia. Many of my most cherished friends elected for careers outside of academia and they're doing all kinds of wonderful things. Academia has its perks – or rather it can have its perks, depending on the circumstances of one's employment – but it also has its drawbacks, one of which is that we work in an increasingly neoliberal environment with its attendant metrics, performance indications, and excellence frameworks (whatever all that even means). But perhaps more importantly, the world is full of problems and puzzles that cannot be solved by academia, or more generously, cannot be solved by academia alone. There are multiple places and perspectives to work from and often we academics lag behind cutting edge work and cutting edge political movements. There may well be better places to view the world from than inside the academy, which is why I've never understood this implicit assumption – made explicit in all sorts of ways – that graduates must go on to be academics. Graduate school should be about expanding the future horizons of those who pass through it, so if you want to become an academic, great and good luck, and if not, then all power to you. If you want to talk about any of this, or have questions about life after graduate school, please do get in touch.
All that remains then is to thank you all for making my years at UBC such a wonderful experience – they were the very best years of my life and I miss you all dearly.
Craig received his PhD in the Department of Geography in November 2017. In January 2017 he started a job as Lecturer in Political Geography at Newcastle University. You can follow his research and teaching on his blog or via Twitter: www.thewarspace.com, @thewarspace. He can be contacted at craig.jones@newcastle.ac.uk
Posted in UBC Geography - PhD on June 15, 2018 by Danny Wong. 1 Comment
← The Prodigal Geographer Returns Home: My Ongoing Hunt for the Elusive 'Ideal' Job A decade-long odyssey from UBC Geography to geoscience consulting →
Khaled Abu Ali says:
Great Craig.
I am proud of you.
Self made man, I think every one succeeded has stories must to be written with gold.
Hopes to see you in Gaza.
A decade-long odyssey from UBC Geography to geoscience consulting
The Prodigal Geographer Returns Home: My Ongoing Hunt for the Elusive 'Ideal' Job
Career Moves of a Third Culture Kid in 2018: Somewhere between geography, design, and new media
My journey from a very keen but distracted (and probably depressed) undergraduate to a Professor of Geography at Simon Fraser University
Khaled Abu Ali on From Vancouver to Newcastle
UBC Geography – BA
UBC Geography – MA
UBC Geography – MSc
UBC Geography – PhD

redpajama_set_name: RedPajamaCommonCrawl


text:
Home USA Health Health Risks of Wood-Fired Cooking Revealed
Health Risks of Wood-Fired Cooking Revealed
Bobby Ramakant
Fri September 7, 2012
(CNS): LOVING memories of my grandmother's cooking hut in the backyard of Zimbabwe are still fresh inside me like morning dawn. Yet, I also remember how the hut would fill up with smoke that choked my throat and stung my eyes and how I sat through it all enjoying a meal or engaged in conversation with loved ones. Little did I know that it was a health hazard. Like most Zimbabweans – approximately 70 per cent of the population lives in rural areas – it was a normal facet of our lives. In fact, if one revealed any lack of resilience against the smoke, they would be regarded as a snobbish urbanite. And not many people are willing to be associated with such a tag.
The health risks of being exposed to indoor smoke are barely known and even if they were, there is no real alternative. But the problem is not unique to Zimbabwe: nearly 3 billion people, most living in low-income countries, rely on solid fuel for cooking, lighting and heating.
"The greatest challenge we face is that people are unaware of the problem, particularly those most vulnerable to it. Moreover, the diseases that women get from the smoke exposure occur only after many years of exposure and this means that they are unlikely to make the connection between the exposure and the disease. The best way to inform people and engage them for change is to select 'change agents' in the community who are affected by the problem," said Professor Donald A Enarson, Scientific Advisor on lung health, TB, indoor air pollution to the International Union Against Tuberculosis and Lung Disease (The Union) in an email interview to Citizen News Service (CNS).
Rudimentary wood-fired cook stoves and open fires emit fine particles, carbon monoxide, and other pollutants at levels up to 100 times higher than the recommended limits set by the World Health Organization (WHO). Mortality and burden of disease attributable to selected major risks, indoor air pollution is responsible for 2.7% of the global burden of disease.
Three types of lung diseases have been shown to have a strong association with solid fuel smoke: acute lower respiratory infections (ALRIs) in children, chronic obstructive pulmonary disorder (COPD) in women, and lung cancer in women exposed to coal smoke. WHO estimates that nearly 2 million people die each year from diseases caused by unhealthy cook stove technologies, including more than 1 million people, mostly women, who die from COPD. Nearly half of deaths among children under 5 years old from ALRIs are due to particulate matter inhaled from indoor air pollution from household solid fuels. Close to 1 million children under 5 die each year from pneumonia. 1.5% of annual lung cancer deaths are attributable to exposure to carcinogens from indoor air pollution.
"Indoor air pollution from biomass fuel smoke is an important issue because this is a fuel source that is widely used by poor people and is associated with serious health issues that make poor people even poorer. It particularly affects women and children in poor communities. The clearest health consequence of breathing this smoke is in women who can develop lung cancer and serious and chronic lung disease that result in death," said Enarson.
"In addition, the smoke promotes the development of pneumonia in small children, the most important cause of death in this age group. It is particularly important because it is possible to avoid these consequences with rather simple procedures that even poor people are able to introduce." In Africa, particularly in rural areas, indoor pollution is rampant, but it is not regarded as a serious public health issue, and therefore very little is being done yet with a few, simple steps it is possible to stop unnecessary deaths.
"There are a series of steps that can be taken. Clearly, the most dangerous situation is with open fires (for heating or cooking) within the same rooms that people inhabit. The first step is to move the cooking from inside the house to a 'shed' in the back yard with a roof but relatively open walls to improve ventilation. The second step is to make a protection around the fire (the best is to use an enclosed 'stove' made of ceramic or metal) so that the smoke can be directed away from people. The final step is to improve the ventilation for the smoke from the stove by constructing a stove pipe to direct the smoke out of doors and / or to open ventilation paths (either under the eaves of the house or through windows) to reduce the level of the smoke in the living area," said Enarson. He added that all of these steps can be taken with very little cost and can be done by the people themselves without outside assistance.
"Obviously a shift to energy sources using natural gas or electricity goes a long way to improving the situation but this is dependent on actions of the authorities outside the community itself and costs a great deal more than the simple steps that can already reduce the problem substantially," he said.
citizen news service
cook stove
Masimba Biriwasha
Bobby Ramakant is a CNS Policy Adviser who writes extensively on health and development, as it affects many countries throughout the world.
Are Your Frequent UTIs From the Food You're Eating?
The Relentless Race for Longevity and Cognitive Health
Pristyn Care – A Seamless Patient Experience Provider in Elective Surgeries
Walk the Talk and Herd Away from the Flock- Simple Steps to Stay Fit
Consumers Losing the War Against Meat Antibiotics
Spring Cleaning Tames Allergies
Indoor Air Pollution May Have Greater Effect on Health that Outdoor Pollution
Everything The Public Needs to Know About Opioid Addiction
There is WHAT in the meat?
Healthcare News from PR Newswire
New Book by Dwight L. Schwab


"If they say: Who cares if one more light goes out?
"Who cares when someone's time runs out? If a moment is all we are - We're quicker, quicker / Who cares if one more light goes out? Well I do"
It's okay to call parties, risk taking and wild experiences fun & exciting, just as long as you don't expect to achieve happiness through them. Happiness isn't acquired through one event or person. It's more subtle.
Happiness is what's left when the party's over. True happiness isn't a bunch of people laughing and yelling at a party, it's an inner contentment that comes naturally as a byproduct of living a meaningful life. It's knowing that you're going in the right direction on the long road to actualizing your potential. So have a good time, but just remember that it's the little things - the good moments you work for and that take time to get - that matter most in the long run.
It may seem obvious, but when choosing your friends try and hang with real people who actually care about you (I'm not talking about the people you nod to in the hall or who you wish you were friends with). Real friends value you for who you are.
My primary ambition in school was making friends with popular people and becoming loved by everyone. But these "friends" were fickle and their friendship came at a cost. It's crazy how we might agonize over the opinion of someone who will never speak to you after high school ends and doesn't really care about you now either, all the while ignoring our parents and loved ones who, while we may find annoying, deeply care about our happiness. Always remember who really worries about your wellbeing, and that those who do are precious. Be good to them. Express that love openly. Who knows how long we will have the fortune of being able to do so?
As we all know, school can be super competitive and completely consuming. It's easy to spend all of your time focusing only on homework and after school activities (this includes Netflix and Snapchat by the way), but I encourage you to find a bit of time in your schedule to give to those less fortunate. Choose any project or club that speaks to you, or create your own.
Helping those in need puts life into perspective. Getting into USC or UCSC seems less of an awful dilemma when you realize that many people don't have the opportunity to enjoy the most basic comforts of life, let alone a college experience. It's easier to get depressed when we're self absorbed. If life is only about me, so if things aren't going perfectly, what's the point? But what if life's not only about what you need, but more importantly about what you're needed for?
Giving back is more than a volunteer event or two - it's a mentality. We have endless opportunities right in front of us everyday: Help someone at school who struggles in class or in making friends. Even a quick smile can be amazingly powerful for someone. We have no idea the power that adding positivity in another's life can have. A nice comment on someone's Instagram can brighten their day and remind them that they aren't alone.
I've watched young friends and acquaintances die from drug overdoses, suicide, and other premature ways. Life is fragile, especially at this age. All I thought about in high school was the immediate, that my wellbeing was assured and I was untouchable. That I would live forever -regardless of the risk involved.
These impulsive feelings actually make perfect sense based on Scientific research: The teen brain is unique. It thinks primarily with the amygdala - the emotional side of the brain, while adults think with their prefrontal cortex - the part that responds to situations with good judgement and a focus on the long term consequences of an action. It takes until your mid 20's for the prefrontal cortex to fully develop. So until then, remember that this moment will pass and your life has a lot ahead of it - if you play your cards right. One momentary error in judgement can have a big impact, even if you don't see it right now.
There were countless times in high school when I put myself in danger, where one wrong move could've had dire consequences. I remember one Saturday night during senior year when I broke up a fight. I chastised myself for weeks for not hitting the bully earlier to protect my friend better. Three years later I read in the news that the same bully had beat someone to death. Turns out that impulse I had might've been shortsighted.
Ask yourself if experimenting with hard drugs will be worth the risk to your brain while it's still developing. Is that emoji on your text message while you're driving worth it? These are all decisions you must make for yourself. Just remember to keep an eye out for the bright future that awaits you beyond this moment, and the loved ones who care for you more than you might care for yourself. Know that elderly millionaires & billionaires would give up their fortune to live just one more healthy day. Being alive is the most precious gift of all.
5) It's All Going to be Fine!
Feeling sad or a bit depressed is, sadly, quite normal. But, based on everything we just said about how the teen brain primarily sees only the immediate reality, it's easy to feel hopeless - that the pain we're going through right now is forever. But I'm here to tell you that it will pass! There's SO many better life experiences on the other side of your teen years.
Didn't get that date with your crush for the homecoming dance? A truly loving relationship may be awaiting you in the future.
Got a B- on the History test you expected an A in? Trust me, it won't impact your long term happiness, and definitely not the sales pitch you'll make for your business when you're 25. The key is only that you continue to try and grow everyday. Some do that through academic excellence, while others grow their skills in business, the arts, or something else they're passionate about.
Yes, do your best in school and try to succeed in all your endeavors; not only for college but because it builds your mental strength, perseverance and responsibility. But also follow your inner passion and creativity and don't let school define you. As a matter of fact, don't let any one skill define your worth - grades, romance, sports, or how skilled you are at gaining followers on social media.
You have an intrinsic, infinite value. So treat yourself with love. Then give that love to others. What we like most about other people is when they're happy with who they are - not trying to be someone else but just being themselves while being nice to others and showing they care. Why be someone else when you are a unique light that the world has never seen before? That's why you had to be born - without you humanity was incomplete.
Remember to trust the process, that every detail of your life is being carefully watched over with love, with a special plan in store for you.
Remember that there's ALWAYS light after the darkness: The darkness is only there to lead you to an even greater light afterwards.
During my rocky teen years, I listened almost exclusively to Rap music. My frustrations, anger at the world, and dreams of a big future one day found resonance in the rhymes of Tupac, Nas, and others. Most beloved to me though was 2pac. Look, I wouldn't encourage people to look to Dr. Dre & Snoop Dogg for an inspiring, spiritual experience. And yes, the most famous rap songs usually focus on themes of power, girls, money, drugs and violent crime. But while 2pac often focused on these themes and had lots of inner demons, unlike most of the others he was a true poet, often touching on meaningful ideas, wearing his deepest emotions, fears, and aspirations on his sleeve. He even wrote a book of poetry, "A Rose that Grew from the Concrete", a title that encapsulated his life: You can shine your unique light and change the world, even if you come from the bleakest of environments.
When going through tough times, I could listen to his intense struggles and felt like I wasn't the only one experiencing the pain I was feeling. In "Keep ya head up" and "Dear Mama", 2pac hailed the greatness of women in our world. Don't let anyone keep you down. I made sure his just released song "Changes" was played at my Bar Mitzvah party, a song that shows the power rap can have in a positive sense when deployed with an elevated message. Gunned down at just 25 yrs. of age, I think 2pac would've eventually moved beyond his thug life persona and progressed into a powerful, positive leader in the U.S.A. We will never know.
At 17, I began to connect with my spiritual side, leading to my exploration of Judaism in depth. By 2007, I was learning full time in a high level Yeshiva in Brooklyn, New York, home to the Notorious B.I.G, Jay Z, and a big Hassidic Jewish community - a perfect life balance for me. When the holiday of Purim came around, I signed up as a volunteer to bring the holiday joy to Jews in need. I was assigned by the Aleph Institute - which serves Jewish prison inmates - to visit penitentiaries in upstate New York, ranging from white collar to maximum security. The Lubavitcher Rebbe taught that living as a lofty soul in a body that desires only material pleasures is a bit like being in a prison for the soul. Being a prison inmate, then, is a doubled incarceration of the spirit. I felt this was a great mission to undertake, bringing the joy of the Purim salvation to those most in need of feeling redemption.
Armed with hamantaschen cookies, the Megillah scroll of Esther, and other goodies, my friends and I set off from Brooklyn into the snow filled New York night. Our coins for charity weren't allowed in, as the officers worried they would be used to buy things between inmates. During the megillah reading, when reaching the name of the wicked Haman, the graggers (noise makers) shaken by the inmates brought the guards into the room thinking a riot might be starting!
The next morning we visited a prison in Woodmere. One of the attendees looked vaguely familiar, but I couldn't remember from where and I doubted I knew anyone in a prison in upstate New York. We sang and danced together, and this sad looking man smiled for the first time. We discussed the story, the power of positive thinking, and soon our time was up. I returned to yeshiva and freedom, celebrating the end of the holiday with gusto.
Years later, while visiting a small town in Italy, I turned on my laptop and read a shocking news story: Shyne, the popular gangster rapper of the late '90's I used to listen to, was free from prison after serving 9 years for an infamous night club shooting involving his mentor Sean "P. Diddy" Combs and Jennifer Lopez. But that wasn't what so surprised me. What shocked me was that he had become an orthodox Jew and had moved to Jerusalem to study Torah. And then it hit me: This was the sad looking guy at our Purim party at Woodmere prison!
Now you have to understand something: Shyne wasn't just your average rapper. He epitomized the streets, as authentically gangsta as it comes. To see this transformation was nothing short of incredible. But it makes sense. We can only truly be happy if we nourish our souls like we nourish our bodies. Without any deep purpose or direction to life, nothing stops it from spiraling into chaos, and that's what Shyne felt.
Jews and Hip Hop have always been deeply connected. In the early '80's it was The Beastie Boys who started things off. Soon after, the legendary Rick Rubin founded Def Jam Records, later led by Israeli boss Lyor Cohen, the instrumental label that produced most of East Coast Hip Hop's success of the '90's and 2000's. Today, Jewish rappers Drake, Mac Miller, Lil Dicky and Action Bronson are running things, and producers Alchemist and Scott Storch have produced countless hits.
But it wasn't until Matisyahu came around that deeply meaningful living was incorporated into rap lyrics. Like no one else before him, he fused rap with Godliness and Jewish philosophy, and he impacted me greatly as I too looked to fuse Jewish spiritual living with modern American life and pop culture.
Rappers Nosson Zand, Prodezra, Zeke Finn, Remedy, Kosha Dillz, Darshan, Nissim Black and many others are today doing the same, and it's a beautiful thing.
Judaism teaches that we are to take our talents, passions and creative expression - and to use them to uplift the world. Everything in this world can be elevated to a higher purpose. Musicians have one of the most powerful gifts humanity has to offer, and rap is one of the most clear and direct mediums of artful expression. Describing gritty street life is real and needs to be expressed. But my hope is that talented artists, in whatever they're doing, will more and more use their skills for a greater, elevated purpose, to inspire their audience to be greater. We saw how powerful that style of music could be when Eminem came out with "Lose Yourself."
Whatever talent or passion we have, let's use it to make the world a better, more Godly place. I think that's what 2pac would tell us today.
I will leave off with this religious Jewish dude spitting fire on a street corner in NYC.
Why do we need a Temple again?
The Temple in Jerusalem served as a conduit for spiritual vitality to all - it was the heart of the world, helping all to thrive.


text:
Q: Double hop marshaling in COM Consider the following.

*

*Process A is a COM client. It creates an object in process B

*The object has a method that returns an interface pointer

*The implementation in B creates an object in process C and returns that to A

After this, will calls from A to C go through B? If the process B quits, will the object proxy in A error on method calls?

A: Tested. As of Windows 10 19044, COM short circuits the double hop. Killing B doesn't break the channel.
Here are the samples. Build a.cpp, b.cpp, and c.cpp as three separate Windows GUI apps in Visual Studio. Run B and C in either order, then A. The A program has some UI to drive the test.

redpajama_set_name: RedPajamaStackExchange


DST is a leading provider of specialised technology, strategic advisory, and business operations outsourcing to the financial and healthcare industries. DST employs around 5,000 people across 12 locations in the UK and Ireland.
South Essex Active Travel presented at the Basildon Business Group meeting in March hosted by DST at their Head Office in Basildon. After the meeting, we were approached by their Head of Facilities Management and invited to come along and promote our active travel initiatives.
We attended DST in May 2018 to engage with existing staff regarding their travel choices.
We spoke with 130 staff regarding travel. Of these, 58 completed Personal Travel Plans.
To encourage additional interest, we took along our ever-popular smoothie bike, meaning staff members were able to have a go at generating enough energy by pedaling to work the smoothie machine to create a healthy fruit drink! Many discussions around fitness, health and wellbeing were had.
Of the 58 travel plans completed, nine staff signed up to cycle training and 25 took part in simply stride walking initiatives. Two ladies have swapped to the bus with many more looking to bus, cycling and walking as a future option.


It's exactly 1 year ago that we released this campaign to raise awareness about clean water and to collect donations for our water filter project in Kenya. In one year we sold 851 clean water shirts! This is something we never expected. So awesome.
In February we'll proceed again with the next distributions. These take time and are combined with a workshop, the past two months a certificate had to be renewed. Everything has been sorted out again. New distributions with our local partner The Nathan Hall Williams Center are planned within the next weeks. We can't say this enough: thanks for supporting this project, shout out to all the bands and partners.


text:
Brenda Miller
Writer, Mentor, Teacher
Tell it Slant, Third Edition
Sample Writing
The Rumpus Interview with Brenda Miller
Rappahannock Review
An Interview with Brenda Miller and Julie Marie Wade
Sweet: A Literary Confection
An interview with Brenda Miller and Lee Gulyas
Talking with essayist Brenda Miller by Dinah Lenney
Sarabande Books Interviews: Season of the Body
This book presents the reader with an unusual structure: a memoir in essay form. Could you talk about how the book came together? And was the theme of childlessness apparent to you from the start?
The "oldest" essay in the book is "Prologue to a Sad Spring," and that is really the first personal essay I ever wrote. I took a class in the personal essay at the University of Washington about fifteen years ago, just for fun, and I was immediately drawn to this particular genre. I had been writing poetry and fiction, but neither of those seemed to hold my particular voice in a way that was satisfying. When I wrote this essay, my voice seemed to expand, and free up; the essay practically wrote itself, and I still think it has that kind of flow and energy to it. I'm pleased that the Weston photograph that inspired it is the cover photograph for this book!
I continued writing essays for many years, never with the idea that they would become a book. I just wrote what was "up" for me at any one time. But our writing will always reveal our deepest passions and obsessions, so naturally the theme of infertility and children kept arising, all in the context of how my body has moved through the world. Even in the essays that do not ostensibly deal with this subject, the language and pace and rhythm are informed by this stance. I often write in fragments, with white space bridging the different sections; to me this style is very much "of the body"; sometimes what cannot be spoken is more truthful than what is verbalized, and so the gaps may be the most "real" parts of the essay. This style also implies a different kind of relationship with the reader; John D'Agata, lyric essay editor of The Seneca Review, says that lyric essays "invite the reader in to complete their meanings." So, I guess more than childlessness, or even the body, my book is about communication: how we touch one another, how we connect and fail to connect. . . .
Your spiritual quest utilizes both traditional Jewish teachings, meditation, massage, and other philosophies. Do you think there's any danger in mixing these spiritual paths?
Well, I never claim to be an expert on religious and spiritual matters. It's a very personal thing, and all I can speak to is my own experience. I know that as I've matured, I've begun to see the connections, rather than the disparities, between many different traditions. I now feel a kinship with Judaism as an adult that I never felt as a child, precisely because I've grown to appreciate the importance of ceremony and ritual in my life. There is also a long history of meditation in Judaism that is quite akin to the mindfulness tradition in which I now practice.
Your writing style shifts almost effortlessly in time and often braids together scenes of your life that are twenty or more years apart. How do you manage to keep present in each moment and avoid the"flashback effect" that slows down some fiction?
Since I'm not tied to a chronological sequence, or to a traditional narrative arc, I pay more attention to the images that bridge the gaps in time and place. So, through the fragments, I'm able to put together an essay that is flexible enough to juggle many different elements at the same time. If I'm writing a more linear essay, I pay very close attention to transitions. I'm always telling my students that the key to powerful writing is in the transitions, whether you're working in a linear way, or more lyrically; it's the transitions that give the reader confidence in you as a writer. The reader won't necessarily notice the transitions, of course, but the transitions will create the essential structure that keeps the reader secure. It's like being in a well-built house: you don't want your guests to necessarily crawl down into the basement to admire the foundation, or to inspect the floorboards for well-placed nails; you just want them to feel good and comfortable, to know they are in a safe and pleasing space where anything is possible.
Speaking of fiction—did you ever bend the facts to suit the form of the essay?
Sometimes. But whenever I do, I try my best to alert the reader to what I'm up to. Creative nonfiction demands a certain allegiance to artifice over experience. . . . What I mean by this is that we're not necessarily setting out to transcribe, or record, the facts of our lives; the goal should be to create art that arises out of experience. That means you will employ imagination, hyperbole, compression: really all the tools of the writing trade to create an essay that is aesthetically pleasing and emotionally true. It doesn't mean that you lie about facts essential to the self; I would never, for instance, make up the fact of the miscarriages or infertility. That would betray my relationship with the reader. But I may condense several trips to the desert into one, as I did in "A Field Guide to the Desert." Do you see the difference between the two situations? One has to do with content; the other, with form. You have to look at your intent: Am I making this particular move to shock the reader, or to aggrandize myself; if so, I'm not going to do it. But if I'm making a move that is essential for an artistically satisfying essay, without betraying fundamental facts, then I have no qualms whatsoever.
Again, I try to let the reader in on this as much as possible. I'll use a lot of key phrases: "I imagine…" "I would like to believe…" "I don't remember, but…." Also, the unusual forms help this along: of course life does not unfold as a "field guide," or as a "How To" piece, and so if you put your memories into this form you are already alerting the reader to the fact that we're not in the realm of reportage. As long as you are straight with your reader, I think you can give yourself a lot of freedom. And we have to bear in mind that memory, itself, is creative nonfiction; we create satisfying narratives, or myths, about our lives in order to have a strong sense of self. There's nothing wrong with this. It's part of our essential makeup as human beings. From the moment we utter our first words, we're telling stories about ourselves in order to make sense of the world.
©2023 Brenda Miller | WordPress Theme Design by Superbthemes


scikits.learn.svm now uses LibSVM-dense instead of LibSVM for some support vector machine related algorithms when input is a dense matrix. As a result most of the copies associated with argument passing are avoided, giving 50% less memory footprint and several times less than the python bindings that ship with libsvm, which stores data in the very inefficient python list structure. On the performance side I didn't see any significant difference, although on large datasets less memory footprint can make the difference between swapping or not.


Galway Ladies consigned Fermanagh to the bottom of the table when they produced a whopping 6-22 to 0-5 victory in Sunday's Tesco Home Grown NFL division two contest.
With their second win on the trot St Gabriel's Caitriona Cormican scored 1-02 in the opening seven minutes to set the tone for the remainder of the match.
Over the next 18 minutes Galway scored 3-04 to leave the northern girls chasing the game. Roisin Leonard scored 1-01, Barbara Hannon two points, and goals from Lorna Joyce and Annette Clarke, and a point from Aoibheann Daly, put Galway firmly in command.
Fermanagh's only reply was a point from Joanne Doonan as Galway closed the half with four unanswered points, two each from Annette Clarke and Barbara Hannon, to leave the half-time Fermanagh 0-03 Galway 4-10.
Galway continued the second half where they left off and a super move in the third minute saw Roisin Leonard's low shot come back off the post, but Lorna Joyce was on hand to put the ball over the bar. As the Galway management started to introduce subs, Corofin's Una Carroll secured their next point.
Two frees from Roisin Leonard and more points from Clarke, Hannon and Joyce kept the scoreboard ticking over.
Fermanagh's only answer was a point from Maura McDonald as the onslaught continued.
Galway: Johanna Connolly, Nicola Warde, Mairead Coyne, Orla Dixon, Rebecca Mc Philbin, Sarah Conneally, Sinead Burke (cpt ), Annette Clarke (1-03 ), Geraldine Conneally, Aoibheann Daly (0-02 ), Caitriona Cormican (1-02 ), Claire Hehir, Barbara Hannon (0-05 ), Roisin Leonard (1-05,3f ), Lorna Joyce (1-02 ). Subs, Tina Hughes for Johanna Connolly, Meadhbh Maloney for Orla Dixon, Una Carroll(1-01 ) for Claire Hehir, Annie Connaghton for Nicola Warde, Olivia Divilly (0-02 ) for Barbara Hannon, Charlotte Cooney (1-00 ) for Caitriona Cormican, Sinead Egan for Ger Conneally, Eilis Gannon for Lorna Joyce, Noelle Connolly for Sarah Conneally, Sarah Lynch for Rebecca McPhilbin, Gillian O Connor for Roisin Leonard, Nicola Burke for Aoibheann Daly, Emer Flaherty for Sinead Burke.
* Galway Ladies Football are holding their 2014 Celebration Night in the Claregalway Hotel on Saturday. Tickets are now on sale at €25.


Classic Ford graphics adorn this cool Ford beverage chiller to speak straight to the heart of Blue Oval fanatics and American Muscle enthusiasts alike. Pull open the double-layer glass door of the 1.8 cu. ft. mini fridge emblazoned with etched-look graphics and reach for a frosty cold beverage or snack – the Ford Chiller holds an entire case of cold ones and has an adjustable cooling level, interior light, and adjustable shelf. ETL listed. Measures 19.7" H x 17.1" W x 18.7" D. Weighs approximately 40lb.


text:
MASONIC BIOGRAPHIES
FAMOUS FREEMASONS
Albert Gallatin Mackey
Mackey, Encyclopedia 1966. frontispiece
Dr. Mackey practiced medicine until 1854, after which literary and masonic pursuits fully occupied his time. In July, 1865, President Johnson appointed him Collector of the Port. Later defeated in a senatoral race, he moved to Washington, D.C. in 1870.
Compiler of A Lexicon of Freemasonry in 1845, he went on to publish many books on Freemasonry, most notably his Encyclopedia of Freemasonry.
At various times he edited such publications as the Western Masonic Miscellany (1849-54), the Masonic Quarterly Review (1857-58), the American Freemason (1859-60), and Mackey's National Freemason (1871-74) and the Voice of Freemasonry (1875-79).
Initiated, Passed and Raised: 1841
Saint Andrews Lodge No. 10, South Carolina
Worshipful Master : 1842
Solomon's Lodge No. 1, Charleston
Founding member : 1851
Landmark Lodge No. 76
Grand Secretary : 1842-1867
Affiliated : 1870
Landmark Lodge No. 19, D.C.
Source: Albert G. Mackey, Encyclopedia of Freemasonry.
ANTI-MASONRY | FAMOUS FREEMASONS | HOME | ESSAYS & PAPERS | SITEMAP
© 1871-2021 Grand Lodge of British Columbia and Yukon A.F. & A. M. Updated: 2003/09/27
freemasonry.bcy.ca/biography/mackey_a/mackey_a.html


Elegant Tide Chart Cape Cod – From the thousands of images on the internet about tide chart cape cod, selects the best choices having best image resolution just for you, and this photographs is actually among pictures choices inside our best photographs gallery concerning Elegant Tide Chart Cape Cod. I'm hoping you will like it.
That impression (Tide Chart Cape Cod Awesome Lbi Tide Chart Long Beach island Tide Chart Best Picture Chart) preceding is usually labelled with: tide charts, all for you.
Placed by walper on 2017-04-04 00:56:45. To view just about all pictures in Elegant Tide Chart Cape Cod photos gallery make sure you follow this particular url.


text:
Q: How to use mysql unix_timestamp() as the starting point for auto increment? I would like to know if it is possible do create a table having the auto increment start with the value of the unix timestamp (the time of create of the table), i.e.
create table something(
    something_id bigint not null primary key auto_increment,
    something_name varchar(10) not null,
    something_random varchar(3) not null
) engine=InnoDB auto_increment=round(unix_timestamp(curtime(4)) * 1000);

Note that I can just replace auto_increment=round(unix_timestamp(curtime(4)) * 1000) with the value of select round(unix_timestamp(curtime(4)) * 1000);. But what I want is a way to do it automatically when creating my tables.
After reading mysql select section everything I tried gave me a compiler error.
Thanks.

A: One way could be to use a stored procedure that does this.
Procedure that receives the table creation command and concatenates (CONCAT function) the value of the expression at the end. Since the query is in string format, the Prepared Statement is used to execute it.
DELIMITER $$

DROP PROCEDURE IF EXISTS `createTable`$$

CREATE PROCEDURE createTable(IN strCreateQuery TEXT)
BEGIN
        SET @query = CONCAT(strCreateQuery, " auto_increment=", ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000));

        PREPARE stmt FROM @query;
        EXECUTE stmt;
        DEALLOCATE PREPARE stmt;
END$$

DELIMITER ;

Once created, simply execute the procedure with the creation query of the desired table.
CALL createTable("
create table something(
    something_id bigint not null primary key auto_increment,
    something_name varchar(10) not null,
    something_random varchar(3) not null
) engine=InnoDB");


text:
namespace kudu {

class ConstContiguousRow;
class MaintenanceManager;
class MaintenanceOp;
class MaintenanceOpStats;
class MemTracker;
class MonoDelta;
class RowBlock;
class ScanSpec;
class Throttler;
class Timestamp;
struct IteratorStats;

namespace log {
class LogAnchorRegistry;
}

namespace tablet {

class AlterSchemaTransactionState;
class CompactionPolicy;
class HistoryGcOpts;
class MemRowSet;
class RowSetTree;
class RowSetsInCompaction;
class WriteTransactionState;
struct RowOp;
struct TabletComponents;
struct TabletMetrics;

class Tablet {
 public:
  typedef std::map<int64_t, int64_t> ReplaySizeMap;
  friend class CompactRowSetsOp;
  friend class FlushMRSOp;

  class CompactionFaultHooks;
  class FlushCompactCommonHooks;
  class FlushFaultHooks;
  class Iterator;

  // Create a new tablet.
  //
  // If 'metric_registry' is non-NULL, then this tablet will create a 'tablet' entity
  // within the provided registry. Otherwise, no metrics are collected.
  Tablet(scoped_refptr<TabletMetadata> metadata,
         scoped_refptr<clock::Clock> clock,
         std::shared_ptr<MemTracker> parent_mem_tracker,
         MetricRegistry* metric_registry,
         scoped_refptr<log::LogAnchorRegistry> log_anchor_registry);

  ~Tablet();

  // Open the tablet.
  // Upon completion, the tablet enters the kBootstrapping state.
  Status Open();

  // Mark that the tablet has finished bootstrapping.
  // This transitions from kBootstrapping to kOpen state.
  // Returns an error if tablet has been stopped.
  Status MarkFinishedBootstrapping();

  // Shuts down the tablet, unregistering various components that may attempt
  // to point back to it, and changing the lifecycle state to 'kShutdown'.
  void Shutdown();

  // Stops the tablet from making any progress. Currently-Applying operations
  // are terminated early on a best-effort basis, new transactions will return
  // with Status::Aborted(), tablet maintenance ops will no longer be
  // scheduled, and the lifecycle state is set to 'kStopped'.
  //
  // Currently, the tablet will only be Stopped as the tablet is shutting down.
  // In the future, it can be Stopped when it hits a non-recoverable error
  // (e.g. a disk error) to immediately prevent further writes.
  void Stop();

  // Returns whether the tablet has been stopped, i.e. is in either the
  // 'kStopped' or 'kShutdown' state.
  bool HasBeenStopped() const;

  // Decode the Write (insert/mutate) operations from within a user's
  // request.
  Status DecodeWriteOperations(const Schema* client_schema,
                               WriteTransactionState* tx_state);

  // Acquire locks for each of the operations in the given txn.
  //
  // Note that, if this fails, it's still possible that the transaction
  // state holds _some_ of the locks. In that case, we expect that
  // the transaction will still clean them up when it is aborted (or
  // otherwise destructed).
  Status AcquireRowLocks(WriteTransactionState* tx_state);

  // Starts an MVCC transaction which must have a pre-assigned timestamp.
  //
  // TODO(todd): rename this to something like "FinishPrepare" or "StartApply", since
  // it's not the first thing in a transaction!
  void StartTransaction(WriteTransactionState* tx_state);

  // Like the above but actually assigns the timestamp. Only used for tests that
  // don't boot a tablet server.
  void AssignTimestampAndStartTransactionForTests(WriteTransactionState* tx_state);

  // Insert a new row into the tablet.
  //
  // The provided 'data' slice should have length equivalent to this
  // tablet's Schema.byte_size().
  //
  // After insert, the row and any referred-to memory (eg for strings)
  // have been copied into internal memory, and thus the provided memory
  // buffer may safely be re-used or freed.
  //
  // Returns Status::AlreadyPresent() if an entry with the same key is already
  // present in the tablet.
  // Returns Status::OK unless allocation fails.
  //
  // Acquires the row lock for the given operation, setting it in the
  // RowOp struct. This also sets the row op's RowSetKeyProbe.
  Status AcquireLockForOp(WriteTransactionState* tx_state,
                          RowOp* op);

  // Signal that the given transaction is about to Apply.
  void StartApplying(WriteTransactionState* tx_state);

  // Apply all of the row operations associated with this transaction.
  Status ApplyRowOperations(WriteTransactionState* tx_state) WARN_UNUSED_RESULT;

  // Apply a single row operation, which must already be prepared.
  // The result is set back into row_op->result.
  Status ApplyRowOperation(WriteTransactionState* tx_state,
                           RowOp* row_op,
                           ProbeStats* stats) WARN_UNUSED_RESULT;

  // Create a new row iterator which yields the rows as of the current MVCC
  // state of this tablet.
  // The returned iterator is not initialized.
  Status NewRowIterator(const Schema &projection,
                        gscoped_ptr<RowwiseIterator> *iter) const;

  // Create a new row iterator for some historical snapshot.
  Status NewRowIterator(const Schema &projection,
                        const MvccSnapshot &snap,
                        const OrderMode order,
                        gscoped_ptr<RowwiseIterator> *iter) const;

  // Flush the current MemRowSet for this tablet to disk. This swaps
  // in a new (initially empty) MemRowSet in its place.
  //
  // This doesn't flush any DeltaMemStores for any existing RowSets.
  // To do that, call FlushBiggestDMS() for example.
  Status Flush();

  // Prepares the transaction context for the alter schema operation.
  // An error will be returned if the specified schema is invalid (e.g.
  // key mismatch, or missing IDs)
  Status CreatePreparedAlterSchema(AlterSchemaTransactionState *tx_state,
                                   const Schema* schema);

  // Apply the Schema of the specified transaction.
  // This operation will trigger a flush on the current MemRowSet.
  Status AlterSchema(AlterSchemaTransactionState* tx_state);

  // Rewind the schema to an earlier version than is written in the on-disk
  // metadata. This is done during bootstrap to roll the schema back to the
  // point in time where the logs-to-be-replayed begin, so we can then decode
  // the operations in the log with the correct schema.
  //
  // REQUIRES: state_ == kBootstrapping
  Status RewindSchemaForBootstrap(const Schema& new_schema,
                                  int64_t schema_version);

  // Prints current RowSet layout, taking a snapshot of the current RowSet interval
  // tree. Also prints the log of the compaction algorithm as evaluated
  // on the current layout.
  void PrintRSLayout(std::ostream* o);

  // Flags to change the behavior of compaction.
  enum CompactFlag {
    COMPACT_NO_FLAGS = 0,

    // Force the compaction to include all rowsets, regardless of the
    // configured compaction policy. This is currently only used in
    // tests.
    FORCE_COMPACT_ALL = 1 << 0
  };
  typedef int CompactFlags;

  Status Compact(CompactFlags flags);

  // Update the statistics for performing a compaction.
  void UpdateCompactionStats(MaintenanceOpStats* stats);

  // Returns the exact current size of the MRS, in bytes. A value greater than 0 doesn't imply
  // that the MRS has data, only that it has allocated that amount of memory.
  // This method takes a read lock on component_lock_ and is thread-safe.
  size_t MemRowSetSize() const;

  // Returns true if the MRS is empty, else false. Doesn't rely on size and
  // actually verifies that the MRS has no elements.
  // This method takes a read lock on component_lock_ and is thread-safe.
  bool MemRowSetEmpty() const;

  // Returns the size in bytes of WALs that would need to be replayed to restore
  // the current MRS.
  size_t MemRowSetLogReplaySize(const ReplaySizeMap& replay_size_map) const;

  // Returns the total on-disk size of this tablet, in bytes.
  // Includes the tablet superblock.
  size_t OnDiskSize() const;

  // Returns the on-disk size of this tablet's data, in bytes.
  // Excludes all metadata (both tablet metadata and the metadata of this tablet's rowsets).
  size_t OnDiskDataSize() const;

  // Get the total size of all the DMS
  size_t DeltaMemStoresSize() const;

  // Same as MemRowSetEmpty(), but for the DMS.
  bool DeltaMemRowSetEmpty() const;

  // Fills in the in-memory size and replay size in bytes for the DMS with the
  // highest retention.
  void GetInfoForBestDMSToFlush(const ReplaySizeMap& replay_size_map,
                                int64_t* mem_size, int64_t* replay_size) const;

  // Flushes the DMS with the highest retention.
  Status FlushBestDMS(const ReplaySizeMap &replay_size_map) const;

  // Flush only the biggest DMS
  Status FlushBiggestDMS();

  // Flush all delta memstores. Only used for tests.
  Status FlushAllDMSForTests();

  // Run a major compaction on all delta stores. Initializes any un-initialized
  // redo delta stores. Only used for tests.
  Status MajorCompactAllDeltaStoresForTests();

  // Finds the RowSet which has the most separate delta files and
  // issues a delta compaction.
  Status CompactWorstDeltas(RowSet::DeltaCompactionType type);

  // Get the highest performance improvement that would come from compacting the delta stores
  // of one of the rowsets. If the returned performance improvement is 0, or if 'rs' is NULL,
  // then 'rs' isn't set. Callers who already own compact_select_lock_
  // can call GetPerfImprovementForBestDeltaCompactUnlocked().
  double GetPerfImprovementForBestDeltaCompact(RowSet::DeltaCompactionType type,
                                               std::shared_ptr<RowSet>* rs) const;

  // Same as GetPerfImprovementForBestDeltaCompact(), but doesn't take a lock on
  // compact_select_lock_.
  double GetPerfImprovementForBestDeltaCompactUnlocked(RowSet::DeltaCompactionType type,
                                                       std::shared_ptr<RowSet>* rs) const;

  // Estimate the number of bytes in ancient undo delta stores. This may be an
  // overestimate.
  Status EstimateBytesInPotentiallyAncientUndoDeltas(int64_t* bytes);

  // Initialize undo delta blocks for up to 'time_budget' amount of time.
  // If 'time_budget' is not Initialized() then there is no time limit.
  // If this method returns OK, the number of bytes found in ancient undo files
  // is returned in the out-param 'bytes_in_ancient_undos'.
  Status InitAncientUndoDeltas(MonoDelta time_budget, int64_t* bytes_in_ancient_undos);

  // Find and delete all undo delta blocks that have a maximum op timestamp
  // prior to the current ancient history mark. If this method returns OK, the
  // number of blocks and bytes deleted are returned in the out-parameters.
  Status DeleteAncientUndoDeltas(int64_t* blocks_deleted = nullptr,
                                 int64_t* bytes_deleted = nullptr);

  // Count the number of deltas in the tablet. Only used for tests.
  int64_t CountUndoDeltasForTests() const;
  int64_t CountRedoDeltasForTests() const;

  // Return the current number of rowsets in the tablet.
  size_t num_rowsets() const;

  // Attempt to count the total number of rows in the tablet.
  // This is not super-efficient since it must iterate over the
  // memrowset in the current implementation.
  Status CountRows(uint64_t *count) const;

  // Verbosely dump this entire tablet to the logs. This is only
  // really useful when debugging unit tests failures where the tablet
  // has a very small number of rows.
  Status DebugDump(std::vector<std::string> *lines = NULL);

  const Schema* schema() const {
    return &metadata_->schema();
  }

  // Returns a reference to the key projection of the tablet schema.
  // The schema keys are immutable.
  const Schema& key_schema() const { return key_schema_; }

  // Return the MVCC manager for this tablet.
  MvccManager* mvcc_manager() { return &mvcc_; }

  // Return the Lock Manager for this tablet
  LockManager* lock_manager() { return &lock_manager_; }

  const TabletMetadata *metadata() const { return metadata_.get(); }
  TabletMetadata *metadata() { return metadata_.get(); }
  scoped_refptr<TabletMetadata> shared_metadata() const { return metadata_; }

  void SetCompactionHooksForTests(const std::shared_ptr<CompactionFaultHooks> &hooks);
  void SetFlushHooksForTests(const std::shared_ptr<FlushFaultHooks> &hooks);
  void SetFlushCompactCommonHooksForTests(
      const std::shared_ptr<FlushCompactCommonHooks> &hooks);

  // Returns the current MemRowSet id, for tests.
  // This method takes a read lock on component_lock_ and is thread-safe.
  int32_t CurrentMrsIdForTests() const;

  // Runs a major delta major compaction on columns with specified IDs.
  // NOTE: RowSet must presently be a DiskRowSet. (Perhaps the API should be
  // a shared_ptr API for now?)
  Status DoMajorDeltaCompaction(const std::vector<ColumnId>& col_ids,
                                const std::shared_ptr<RowSet>& input_rs);

  // Calculates the ancient history mark and returns true iff tablet history GC
  // is enabled, which requires the use of a HybridClock.
  // Otherwise, returns false.
  bool GetTabletAncientHistoryMark(Timestamp* ancient_history_mark) const WARN_UNUSED_RESULT;

  // Calculates history GC options based on properties of the Clock implementation.
  HistoryGcOpts GetHistoryGcOpts() const;

  // Method used by tests to retrieve all rowsets of this table. This
  // will be removed once code for selecting the appropriate RowSet is
  // finished and delta files is finished is part of Tablet class.
  void GetRowSetsForTests(std::vector<std::shared_ptr<RowSet> >* out);

  // Register the maintenance ops associated with this tablet
  void RegisterMaintenanceOps(MaintenanceManager* maint_mgr);

  // Unregister the maintenance ops associated with this tablet. This will wait
  // for all ops to finish before returning.
  //
  // This method is not thread safe, but is currently only called during
  // TabletReplica::Shutdown(), which is single-threaded by design.
  void UnregisterMaintenanceOps();

  // Cancel the maintenance ops associated with this tablet. This will prevent
  // further scheduling of the ops and will not wait for any ops to finish.
  //
  // This method is thread-safe.
  void CancelMaintenanceOps();

  const std::string& tablet_id() const { return metadata_->tablet_id(); }

  // Return the metrics for this tablet.
  // May be NULL in unit tests, etc.
  TabletMetrics* metrics() { return metrics_.get(); }

  // Return handle to the metric entity of this tablet.
  const scoped_refptr<MetricEntity>& GetMetricEntity() const {
    return metric_entity_;
  }

  // Returns a reference to this tablet's memory tracker.
  const std::shared_ptr<MemTracker>& mem_tracker() const {
    return mem_trackers_.tablet_tracker;
  }

  // Throttle a RPC with 'bytes' request size.
  // Return true if this RPC is allowed.
  bool ShouldThrottleAllow(int64_t bytes);

  scoped_refptr<clock::Clock> clock() const { return clock_; }

  std::string LogPrefix() const;

  // Return the default bloom filter sizing parameters, configured by server flags.
  static BloomFilterSizing DefaultBloomSizing();

 private:
  friend class Iterator;
  friend class TabletReplicaTest;
  FRIEND_TEST(TestTablet, TestGetReplaySizeForIndex);

  // Lifecycle states that a Tablet can be in. Legal state transitions for a
  // Tablet object:
  //
  //   kInitialized -> kBootstrapping -> kOpen -> kStopped -> kShutdown
  //         |               |             |        ^^^
  //         |               |             +--------+||
  //         |               +-----------------------+|
  //         +----------------------------------------+
  enum State {
    kInitialized,
    kBootstrapping,
    kOpen,
    kStopped,
    kShutdown
  };

  // Sets the lifecycle state of the tablet. See the definition of State for
  // the valid transitions.
  //
  // Must be called while 'state_lock_' is held.
  void set_state_unlocked(State s) {
    DCHECK(state_lock_.is_locked());
    switch (s) {
      case kBootstrapping:
        DCHECK_EQ(kInitialized, state_);
        break;
      case kOpen:
        DCHECK_EQ(kBootstrapping, state_);
        break;
      case kStopped:
        DCHECK(state_ == kInitialized ||
               state_ == kBootstrapping ||
               state_ == kOpen);
        break;
      case kShutdown:
        DCHECK(state_ == kStopped ||
               state_ == kShutdown);
        break;
      default:
        LOG(DFATAL) << "Illegal state transition!";
    }
    state_ = s;
  }

  // Returns an error if the tablet is in the 'kStopped' or 'kShutdown' state.
  // Must be called while 'state_lock_' is held.
  Status CheckHasNotBeenStoppedUnlocked() const;

  // Returns an error if the tablet is in the 'kStopped' or 'kShutdown' state.
  Status CheckHasNotBeenStopped() const {
    std::lock_guard<simple_spinlock> l(state_lock_);
    return CheckHasNotBeenStoppedUnlocked();
  }

  Status FlushUnlocked();

  // Validate the contents of 'op' and return a bad Status if it is invalid.
  Status ValidateOp(const RowOp& op) const;

  // Validate 'op' as in 'ValidateOp()' above. If it is invalid, marks the op as failed
  // and returns false. If valid, marks the op as validated and returns true.
  bool ValidateOpOrMarkFailed(RowOp* op) const;

  // Validate the given insert/upsert operation. In particular, checks that the size
  // of any cells is not too large given the configured maximum on the server, and
  // that the encoded key is not too large.
  Status ValidateInsertOrUpsertUnlocked(const RowOp& op) const;

  // Validate the given update/delete operation. In particular, validates that no
  // cell is being updated to an invalid (too large) value.
  Status ValidateMutateUnlocked(const RowOp& op) const;

  // Perform an INSERT or UPSERT operation, assuming that the transaction is already in
  // prepared state. This state ensures that:
  // - the row lock is acquired
  // - the tablet components have been acquired
  // - the operation has been decoded
  Status InsertOrUpsertUnlocked(WriteTransactionState *tx_state,
                                RowOp* op,
                                ProbeStats* stats);

  // Same as above, but for UPDATE.
  Status MutateRowUnlocked(WriteTransactionState *tx_state,
                           RowOp* mutate,
                           ProbeStats* stats);

  // In the case of an UPSERT against a duplicate row, converts the UPSERT
  // into an internal UPDATE operation and performs it.
  Status ApplyUpsertAsUpdate(WriteTransactionState *tx_state,
                             RowOp* upsert,
                             RowSet* rowset,
                             ProbeStats* stats);

  // Return the list of RowSets that need to be consulted when processing the
  // given insertion or mutation.
  static std::vector<RowSet*> FindRowSetsToCheck(const RowOp* op,
                                                 const TabletComponents* comps);

  // For each of the operations in 'tx_state', check for the presence of their
  // row keys in the RowSets in the current RowSetTree (as determined by the transaction's
  // captured TabletComponents).
  Status BulkCheckPresence(WriteTransactionState* tx_state) WARN_UNUSED_RESULT;

  // Capture a set of iterators which, together, reflect all of the data in the tablet.
  //
  // These iterators are not true snapshot iterators, but they are safe against
  // concurrent modification. They will include all data that was present at the time
  // of creation, and potentially newer data.
  //
  // The returned iterators are not Init()ed.
  // 'projection' must remain valid and unchanged for the lifetime of the returned iterators.
  Status CaptureConsistentIterators(const Schema *projection,
                                    const MvccSnapshot &snap,
                                    const ScanSpec *spec,
                                    OrderMode order,
                                    std::vector<std::shared_ptr<RowwiseIterator> > *iters) const;

  Status PickRowSetsToCompact(RowSetsInCompaction *picked,
                              CompactFlags flags) const;

  // Performs a merge compaction or a flush.
  Status DoMergeCompactionOrFlush(const RowSetsInCompaction &input,
                                  int64_t mrs_being_flushed);

  // Handle the case in which a compaction or flush yielded no output rows.
  // In this case, we just need to remove the rowsets in 'rowsets' from the
  // metadata and flush it.
  Status HandleEmptyCompactionOrFlush(const RowSetVector& rowsets,
                                      int mrs_being_flushed);

  Status FlushMetadata(const RowSetVector& to_remove,
                       const RowSetMetadataVector& to_add,
                       int64_t mrs_being_flushed);

  static void ModifyRowSetTree(const RowSetTree& old_tree,
                               const RowSetVector& rowsets_to_remove,
                               const RowSetVector& rowsets_to_add,
                               RowSetTree* new_tree);

  // Swap out a set of rowsets, atomically replacing them with the new rowset
  // under the lock.
  void AtomicSwapRowSets(const RowSetVector &to_remove,
                         const RowSetVector &to_add);

  // Same as the above, but without taking the lock. This should only be used
  // in cases where the lock is already held.
  void AtomicSwapRowSetsUnlocked(const RowSetVector &to_remove,
                                 const RowSetVector &to_add);

  void GetComponents(scoped_refptr<TabletComponents>* comps) const {
    shared_lock<rw_spinlock> l(component_lock_);
    *comps = components_;
  }

  // Create a new MemRowSet, replacing the current one.
  // The 'old_ms' pointer will be set to the current MemRowSet set before the replacement.
  // If the MemRowSet is not empty it will be added to the 'compaction' input
  // and the MemRowSet compaction lock will be taken to prevent the inclusion
  // in any concurrent compactions.
  Status ReplaceMemRowSetUnlocked(RowSetsInCompaction *compaction,
                                  std::shared_ptr<MemRowSet> *old_ms);

  // TODO: Document me.
  Status FlushInternal(const RowSetsInCompaction& input,
                       const std::shared_ptr<MemRowSet>& old_ms);

  // Convert the specified read client schema (without IDs) to a server schema (with IDs)
  // This method is used by NewRowIterator().
  Status GetMappedReadProjection(const Schema& projection,
                                 Schema *mapped_projection) const;

  Status CheckRowInTablet(const ConstContiguousRow& row) const;

  // Helper method to find the rowset that has the DMS with the highest retention.
  std::shared_ptr<RowSet> FindBestDMSToFlush(const ReplaySizeMap& replay_size_map) const;

  // Helper method to find how many bytes need to be replayed to restore in-memory
  // state from this index.
  static int64_t GetReplaySizeForIndex(int64_t min_log_index,
                                       const ReplaySizeMap& size_map);

  // Test-only lock that synchronizes access to AssignTimestampAndStartTransactionForTests().
  // Tests that use LocalTabletWriter take this lock to synchronize timestamp assignment,
  // transaction start and safe time adjustment.
  // NOTE: Should not be taken on non-test paths.
  mutable simple_spinlock test_start_txn_lock_;

  // Lock protecting schema_ and key_schema_.
  //
  // Writers take this lock in shared mode before decoding and projecting
  // their requests. They hold the lock until after APPLY.
  //
  // Readers take this lock in shared mode only long enough to copy the
  // current schema into the iterator, after which all projection is taken
  // care of based on that copy.
  //
  // On an AlterSchema, this is taken in exclusive mode during Prepare() and
  // released after the schema change has been applied.
  mutable rw_semaphore schema_lock_;

  const Schema key_schema_;

  scoped_refptr<TabletMetadata> metadata_;

  // Lock protecting access to the 'components_' member (i.e the rowsets in the tablet)
  //
  // Shared mode:
  // - Writers take this in shared mode at the same time as they obtain an MVCC timestamp
  //   and capture a reference to components_. This ensures that we can use the MVCC timestamp
  //   to determine which writers are writing to which components during compaction.
  // - Readers take this in shared mode while capturing their iterators. This ensures that
  //   they see a consistent view when racing against flush/compact.
  //
  // Exclusive mode:
  // - Flushes/compactions take this lock in order to lock out concurrent updates when
  //   swapping in a new memrowset.
  //
  // NOTE: callers should avoid taking this lock for a long time, even in shared mode.
  // This is because the lock has some concept of fairness -- if, while a long reader
  // is active, a writer comes along, then all future short readers will be blocked.
  mutable rw_spinlock component_lock_;

  // The current components of the tablet. These should always be read
  // or swapped under the component_lock.
  scoped_refptr<TabletComponents> components_;

  scoped_refptr<log::LogAnchorRegistry> log_anchor_registry_;
  TabletMemTrackers mem_trackers_;

  scoped_refptr<MetricEntity> metric_entity_;
  gscoped_ptr<TabletMetrics> metrics_;
  FunctionGaugeDetacher metric_detacher_;

  std::unique_ptr<Throttler> throttler_;

  int64_t next_mrs_id_;

  // A pointer to the server's clock.
  scoped_refptr<clock::Clock> clock_;

  MvccManager mvcc_;
  LockManager lock_manager_;

  gscoped_ptr<CompactionPolicy> compaction_policy_;

  // Lock protecting the selection of rowsets for compaction.
  // Only one thread may run the compaction selection algorithm at a time
  // so that they don't both try to select the same rowset.
  mutable std::mutex compact_select_lock_;

  // We take this lock when flushing the tablet's rowsets in Tablet::Flush.  We
  // don't want to have two flushes in progress at once, in case the one which
  // started earlier completes after the one started later.
  mutable Semaphore rowsets_flush_sem_;

  // Lock protecting access to 'state_' and 'maintenance_ops_'.
  // If taken with any other locks, this must be taken last, i.e. no locks can
  // be acquired while holding this this.
  mutable simple_spinlock state_lock_;

  State state_;

  // Fake lock used to ensure calls to RegisterMaintenanceOps and
  // UnregisterMaintenanceOps don't overlap. This serves to ensure that only
  // one thread is updating the maintenance op list at a time.
  DFAKE_MUTEX(maintenance_registration_fake_lock_);

  // Fault hooks. In production code, these will always be NULL.
  std::shared_ptr<CompactionFaultHooks> compaction_hooks_;
  std::shared_ptr<FlushFaultHooks> flush_hooks_;
  std::shared_ptr<FlushCompactCommonHooks> common_hooks_;

  std::vector<MaintenanceOp*> maintenance_ops_;

  DISALLOW_COPY_AND_ASSIGN(Tablet);
};

// Hooks used in test code to inject faults or other code into interesting
// parts of the compaction code.
class Tablet::CompactionFaultHooks {
 public:
  virtual Status PostSelectIterators() { return Status::OK(); }
  virtual ~CompactionFaultHooks() {}
};

class Tablet::FlushCompactCommonHooks {
 public:
  virtual Status PostTakeMvccSnapshot() { return Status::OK(); }
  virtual Status PostWriteSnapshot() { return Status::OK(); }
  virtual Status PostSwapInDuplicatingRowSet() { return Status::OK(); }
  virtual Status PostReupdateMissedDeltas() { return Status::OK(); }
  virtual Status PostSwapNewRowSet() { return Status::OK(); }
  virtual ~FlushCompactCommonHooks() {}
};

// Hooks used in test code to inject faults or other code into interesting
// parts of the Flush() code.
class Tablet::FlushFaultHooks {
 public:
  virtual Status PostSwapNewMemRowSet() { return Status::OK(); }
  virtual ~FlushFaultHooks() {}
};

class Tablet::Iterator : public RowwiseIterator {
 public:
  virtual ~Iterator();

  virtual Status Init(ScanSpec *spec) OVERRIDE;

  virtual bool HasNext() const OVERRIDE;

  virtual Status NextBlock(RowBlock *dst) OVERRIDE;

  std::string ToString() const OVERRIDE;

  const Schema &schema() const OVERRIDE {
    return projection_;
  }

  virtual void GetIteratorStats(std::vector<IteratorStats>* stats) const OVERRIDE;

 private:
  friend class Tablet;

  DISALLOW_COPY_AND_ASSIGN(Iterator);

  Iterator(const Tablet* tablet, const Schema& projection, MvccSnapshot snap,
           const OrderMode order);

  const Tablet *tablet_;
  Schema projection_;
  const MvccSnapshot snap_;
  const OrderMode order_;
  gscoped_ptr<RowwiseIterator> iter_;
};

// Structure which represents the components of the tablet's storage.
// This structure is immutable -- a transaction can grab it and be sure
// that it won't change.
struct TabletComponents : public RefCountedThreadSafe<TabletComponents> {
  TabletComponents(std::shared_ptr<MemRowSet> mrs,
                   std::shared_ptr<RowSetTree> rs_tree);
  const std::shared_ptr<MemRowSet> memrowset;
  const std::shared_ptr<RowSetTree> rowsets;
};

} // namespace tablet
} // namespace kudu

redpajama_set_name: RedPajamaGithub


When Blue Mountain Renewables (BMR) began operating its 36-megawatt wind farm in Potsdam, St Elizabeth, a few months ago, the facility became Jamaica's largest private-sector renewable energy project.
Minister of Science, Energy and Technology Dr Andrew Wheatley, who gave the keynote address at the official opening on August 11, pointed out that the wind farm would help to diversify the country's energy matrix and ease the dependence on imported fossil fuels.
"The wind farm is expected to reduce greenhouse gases by about 66,000 tons of carbon dioxide equivalent per year, roughly equivalent to taking 13,000 cars off the road," he informed.
Wheatley also applauded the relationship and assistance the company has given to the neighbouring schools, Munro College and Hampton High, as well as the treatment of farmers in St Elizabeth who were affected during the construction phase.
Principal of Hampton High Heather Murray said that she could literally see the 'wind of change' with the advent of the BMR wind project.
She bemoans the fact that nearly a quarter of her school's budget is spent on high electricity cost, money that could be spent on building a state-of-the-art science laboratory.
"BMR brings hope and we welcome them wholeheartedly. We are also excited about the efforts to go green and we are doing our part here at Hampton. Earlier this year, we swapped all fluorescent light bulbs for more environmentally friendly LED bulbs," Murray stated.
She also informed that Hampton had installed about 12 solar panels to integrate renewable energy into their electric supply. The panels, combined with small wind turbines on the campus, now provide about one-fifth of the school's energy needs, she noted.
The BMR Jamaica Wind project will serve thousands of customers annually. Power will be sold to the Jamaica Public Service (JPS) Company, under a 20-year power-purchase agreement. This electricity is expected to be among the lowest cost sources of power available on the JPS system.
Jamaica currently relies on oil imports to meet 90 per cent of its energy needs. This leaves the country vulnerable to fluctuating oil prices, which can make it difficult to budget and plan effectively.
To ease the dependence, the country has set a target to generate 30 per cent of its energy from local renewable sources such as hydro, wind and solar power by 2030.
President of BMR Bruce Levy said construction of the project was made easier by the cooperation of the Potsdam residents and the appreciation they showed for the work being done in their community.
"We made sure there was significant benefit to the local and wider community, with billions of dollars of direct spending and employment of hundreds of Jamaicans during construction. We say, without any fear of contradiction, that we are committed to community development," he said.
Levy informed that the wind farm was made possible through a US$62.7 million financing package, including a US$42.7 million loan from the Overseas Private Investment Corporation (OPIC); a US$10 million loan from the International Finance Corporation (IFC), and a US$10 million loan from the IFC-Canada Climate Change Programme. BMR Energy provided an equity investment of US$26.9 million.
Category/ies:Jamaica News, Jamaica Projects, News, Projects, Renewable Energy, Success Story, Wind energy.