text:
Sacramento Parent's magazine
In 1988 Congress decided that October would be Pregnancy and Infant Loss Awareness Month. October 15 specifically is Pregnancy and Infant Loss Remembrance Day.
Sacramento Parent Magazine (http://www.sacramentoparent.com/community.htm) is a local magazine that focuses on a lot of parent issues on a local level.
A month or so ago one of the writers contacted us regarding their October Issue. The magazine wanted to tackle some of the tougher parts of pregnancy and infant loss, some of the issues that are not often dealt with. They asked if we would assist them with an interview. We did.
Coping with the death of a child
by Heidi Doerfert
Every parent has two nightmares – one is the fear that something will happen to you and you won't be there for your child; the other is that something terrible will happen to your child. Sadly, that other nightmare comes true for approximately 2,500 parents in the United States every year, parents who lose their babies to Sudden Infant Death Syndrome (SIDS). Denise Miller, a 26-year-old mother from West Sacramento, is one of those parents.
Denise's daughter, Kaitlyn, has sunny blond hair and bright blue eyes. She is just shy of her fourth birthday when we meet. I watch Kaitlyn pluck a flower from a nearby bush and skip over to her mommy. Denise smiles as her daughter hands it to her. Denise's pregnancy with Kaitlyn was fairly easy, she says, aside from some morning sickness in her first trimester. With Matthew, it seemed things would go even more smoothly; she felt fine, even energetic. Then, at six months, her water broke.
She was diagnosed with preterm premature rupture of membranes, or pPROM. In most pPROM cases, women deliver in the first 72 hours to 12 days, but Denise was hospitalized for over nine weeks, only allowed to lie on her left side. She went into labor at 33 weeks, and her baby boy, who was breech, was delivered via C-section.
Matthew had typical preemie issues, including lung problems. After a month in the Neonatal Intensive Care Unit (NICU), Matthew finally came home. Denise, her husband, Dusty, and big sister, Kaitlyn, were all ecstatic. Denise says Matthew nursed frequently, was gaining weight and doing well. "Being a preemie, he wanted to be held a lot," Denise remembers, something his parents were "more than happy" to do. Still, they were very careful not to expose him to germs. They avoided enclosed public places and even limited preschooler Kaitlyn to toe kisses.
On October 15, 2007, 10 week-old Matthew didn't wake up for his 2:30 a.m. feeding. Dusty tried to resuscitate him until the EMTs took over. Denise knew the situation was dire when they wouldn't let her ride in the ambulance. She followed in the sheriff's car while Dusty stayed behind to wait for Kaitlyn's grandparents to come over. The circumstances left Denise alone when she received the news of Matthew's death.
Despite their trauma, the Millers agreed to an optional SIDS research study. Just hours after Matthew's death, hospital staff came to their house and re-created how the baby slept. They took photos and even took samples of Denise's breast milk. "I was basically incoherent at this point," Denise recalls. "We were just going through the motions."
Denise and Dusty couldn't bear to go home after the loss. "We still had unopened baby gifts… It was just too much," says Denise. They stayed at her parents' house for two weeks. No further answers came from the researchers' efforts, leaving the Millers to puzzle over the SIDS diagnosis.
No Real ExplanationSIDS is the nation's leading cause of death for babies between 1 and 12 months old, with ninety percent of those cases occurring before 6 months, yet it remains somewhat of a medical mystery. Research (published in the November 2006 edition of the Journal of the American Medical Association) has indicated that infants who die of SIDS may have abnormalities in a part of the brain that helps control heart rate, breathing, blood pressure, temperature, and arousal. Dr. Hannah Kinney, the study's senior author, believes that with further investigation, healthcare providers may one day be able to identify, prevent, and maybe even treat SIDS. Still, for families like the Millers, these findings offer little (if any) comfort, and a year after baby Matthew's death, the family still struggles with the fact that they have no real explanation for why their baby died. "We did everything right," says Denise. "And we still lost our son."
According to FirstCandle.org, an online support community for parents who have lost children to SIDS or stillbirth, it is very important that all those touched by a SIDS death understand that SIDS has no specific symptoms, that it occurs in the best of families and to the most capable, careful and loving parents.
Close to a year later, the raw emotion of her loss is still evident when Denise talks about it, yet her main concern now is Kaitlyn and how she is handling her own grieving process. "We didn't tell Kaitlyn her brother died for four days," says Denise with tears in her eyes. "Forever is a hard concept for a three-year-old."
Helping Kids CopeLyla Tyler, a Sacramento Marriage and Family Therapist, says children may experience the same five stages of grief that adults do (denial, anger, bargaining, depression and acceptance), although not necessarily in the same order. "Young children don't understand the finality of death," explains Tyler. "They will have a really hard time with that concept. They may ask when their sibling will come back from heaven and those types of questions." Tyler encourages parents to use the term "die" and not vague terms like "gone away."
Some kids will even be scared that they, too, might die like their sibling; these children need reassurance. In a SIDS case, an appropriate explanation could be, "the baby died of something called SIDS. We don't know why it happens but it only happens to some babies."
Young children may also think they did something to cause the baby's death. It's typical for an older sibling to be jealous of a baby sister or brother, and if they wished for the baby to "go away" and then it actually happened, they could feel responsible. In this case, parents may see regression – potty accidents, acting like a baby, etc. The child may also want to become a baby again to replace the lost child for their parents.
Some children handle grief by escaping into play and pretending the baby is still alive. Others may keep it inside and not show a lot of emotion. There also may be aggression and acting out. Tyler says all of these behaviors are normal. "What you look for is if the child is moving on or if they are stuck. After six months to a year, have they gotten back to their normal play? Have the grief behaviors lessened in frequency and intensity?"
Denise says Kaitlyn used to be very outgoing and loved visiting family, but since the death of her baby brother, she has developed separation anxiety. Tyler says this is a normal response, but if it continues for several months, Mom and Dad must take a look at their own behavior. Parents who have lost one child may become very anxious and fearful of losing another child. With the Millers, Tyler would suggest that Kaitlyn go to Grandma's for a very short amount of time at first, gradually extending the length of her visits.
If parents are stuck in their own grief, a child will definitely pick up on that, Tyler notes. "Preschoolers depend upon their parents to regulate them and their mood. If they have a parent who is very depressed and having a hard time, it will be more difficult for the child." Depression in a young child will manifest itself in withdrawal, loss of appetite, trouble sleeping, and poor concentration. Tyler says art therapy, drawing pictures of what makes them sad, is very helpful. She also encourages parents to talk about the sibling, read to them from books about death that are written for young children, and help their child make a memory book about their brother or sister.
Social support groups also provide comfort and help to both parents and children. Denise believes talking about Matthew and keeping his memory alive is essential to her healing process. She found solace through online SIDS and pPROM support groups, and the family visits Matthew's grave on a weekly basis. Tyler notes that this can be a comforting exercise for some children, but stressful for others. She encourages parents to pay attention to their child's behavior at the cemetery. If they seem uncomfortable, it shouldn't be forced upon them. Our society is often uncomfortable talking about death. Family and friends may fear saying the wrong thing or be just as afraid of saying nothing. Tyler offers these tips for being a good listener: Don't make guesses as to why the child may have died or say things like, "Well, you can have more children" or, "I guess it wasn't meant to be." Instead, simply allow those who are grieving to talk about their loss as much as they need to, and offer specific support, such as bringing dinner over on a Friday night or helping fold laundry on Tuesday morning. As Denise notes, the pain lasts way beyond the week or two that everyone is gathered around after the funeral. "It doesn't get any easier with time," she says. "You just learn how to handle it better."
[SIDEBAR:]
Sharing Parents' Annual Remembrance Ceremony:
"Heart Within My Heart"Sunday, October 123pm - 5pmMcKinley Park Rose GardenSacramento (corner of H St & 33rd St)
October is Pregnancy and Infant Loss Awareness Month. Parents who have lost an infant (from the time of conception through early infancy) are encouraged to honor their children in a candle lighting ceremony, and to meet with other parents and Sharing Parents volunteers afterward. For more information, call 916-424-5150, email sharingparents@yahoo.com, or visit www.sharingparents.org.
Posted by Denise at 5:44 PM 0 comments Links to this post
The Gift of a Vision
The other night, I walked into Kaitlyn's room and saw that she had fallen asleep on the floor. I was immediately saddened. Without thinking to or trying to, I could perfectly imagine Matthew there cuddling with her, asleep next to her. Not the 10 week old baby that we miss, but the 13 month old toddler we never got to meet. I could perfectly see every part of him. I could see them together, growing up together sharing all of their love.
I can see how much Kaitlyn loves Matthew each and every day. She loves him so much. She talks to him all the time. The other day she was talking to him and finished by saying/yelling (he can hear better in Heaven if she yells) "Okay Matthew, I'm going to Hang Up now, I love you, bye."
Kaitlyn continues to be a great big sister to him. She continues to love him and to share him with everyone she meets. She continues to do nice things to show him how much she loves him, she continues to talk to him and keep him a part of our family. My heart breaks for all of the wonderful joys that a big sister should get to enjoy for being so great. My heart breaks for the sadness she feels and does not yet understand.
I never really worried about dividing my time between Kaitlyn and Matthew. I knew from day 1 of my pregnancy that I loved them both with all that I have to give. When Matthew was here, it was fairly easy to give them both a lot of one on one time and a lot of family time. Kaitlyn loved having Matthew be a part of story time and Matthew was with us for every part of the day. I never felt torn.
Now that Matthew isn't physically here, I feel much more torn. There is the constant feeling of both sadness and joy, the feelings of pain and happiness, both the feelings of fear and pride. The constant thought that I wish there was 2 of me, 1 with Matthew and 1 with Kaitlyn. But, that can't be.
The best way to describe how I feel lately is to think of it as a storm. There is this big heavy cloud of sadness and once in a while, it will drift to the side, still there but allowing some sunlight in as well. Without any warning it can and does shift back directly over you. There are times when I feel at peace with Matthew's life and blessed that we had him as long as we did and that he is now with God. Then, there are times when he is missed so much it is physically painful.
Sometimes, out of nowhere it seems, I get the perfect vision of what Matthew would look like today. I like to think it's a gift, it's a gift to ease the pain until we are together again.
A year ago today was such a happy day. Dusty and I got ready with Kaitlyn and headed to the NICU for the last time. We had the car seat base installed, a bag packed another bag for all of the things Matthew had at the NICU and the excitement that he would be home with us!
To say we were all excited to bring Matthew home to his own nursery and his own bed and our family is an understatement. It felt like it took forever to get there and was so exciting.
Dusty and I took a sleeping Kaitlyn into the required CPR class, practicing over and over with the thoughts that we would never need it. We were on the path now to a long, healthy and happy life with both of our children.
We had our papers signed off that the class was completed. We signed all of Matthew's discharge papers. We were given so much information, so many lists and so much hope from one of Matthew's greatest nurses. Daddy and Kaitlyn went to pull the car around and get the AC on. Matthew's car seat was installed. The nurse walked down with Matthew and I walked down with her.
Matthew came home at an actual age of 27 days and an adjusted age of about 37 weeks gestation. He came home nearly 3 weeks earlier than anyone thought he would. Matthew came home and ate and slept and made the absolute cutest noises in the entire world. The feeling of being able to hold him, cuddle him, kiss him, feed him, change him and be near him whenever he wanted and we wanted was amazing.
We learned Matthew hated his car seat and loved to cuddle. We learned how much Matthew loved to eat. We learned how strong the sibling bond was between Kaitlyn and Matthew. Our home grew, our hearts grew and our lives were finally regaining some normalcy.
We miss you Matthew.
Once upon a time a girl met a boy, fell in love and lived happily ever after.
Unfortunately "happily ever after" isn't always as easy or as blissful as it sounds. I am a wife and mother. In 2004 we had a beautiful little girl, Kaitlyn, adventurous, funny and incredibly outgoing! She certainly keeps us busy!
In 2007 our happily ever after continued with the birth of our son, Matthew, 7 weeks early after 10 weeks of hospital bed rest. That happily ever after came crashing down when Matthew lost his life to SIDS and we said good-bye to our baby boy. Nothing can test your faith, your marriage or you family more than losing a child.
After 3 miscarriages in 2009, we proudly welcomed Samantha Anne into the world.
This is our happily ever after, complete with more reality than the fairy tales ever told me about...
March for Babies
Kaitlyn's Website
Matthew's March for Babies Team
Matthew's Name in the Sand
Matthew's Website
Matthew's Slideshow
Denise Miller | Create Your Badge
A little blog about the big Infertility (and adoption too!)
Amber and Lucas Taylor
I'm 12 now. PART 1,000,000 - I really want to just get my kid journal up because I think its hilarious to remember life being so simple but feeling like it was such serious stuff. It g...
attempting to love life without her
Faces of Loss, Faces of Hope
Life . After . Haleigh
Adidas Jawpaw 2 Water Upper: Open Mesh Nylon For Review - *<< Previous -- Next >>* ------------------------------ *Adidas Jawpaw 2 Water Shoe Blue/Black-sharp/spray-Mens-10 * Adidas Jawpaw 2 water feature -...
Racing for the rainbow...
Hurricane Christmas - Last night, we had the pleasure of touring one of our local fire stations with my son's Cub Scout den. Very cute, the boys had a lot of fun counting hoses ...
The Molarnator
The Wondrous World of Capt. Lukey Duke and Miss Brookie
- *The Big D* Normally I'd reserve that header for some sort of hilarious "that's what she said" joke but no such luck this time..... It's been a while a...
Under The California Stars
Been a while huh? - I know I know. I have been having computer issues and am currently posting from my iPhone. I am still alive, Jack has been kicking up a storm (atleast toda...


Get closer than you van imagine at the Cave of the Winds! Go face-to-face with the pounding waters of Niagara Falls and get soaked on the Hurricane Deck where you are just feet from the thundering waters! Plan a trip at night when the falls are illuminated in a rainbow of color! Seasonal Admission.
The world changed at Niagara Falls! Go beyond the brink and get closer to the Falls than you ever imagined at the Cave of the Winds Pavilion. Before descending into the Niagara Gorge for your breathtaking one-of-a-kind adventure, learn how Nikola Tesla harnessed the power of the Falls to create alternating current, experience what Niagara Falls looked like before it was a park and witness why people from around the globe have been drawn to the edge of the Falls for hundreds of years.
Get in touch with nature on Goat Island while gaining access to Cave of the Winds, Top of the Falls Restaurant, Three Sisters Island, Terrapin Point, Luna Island, and the Niagara Rapids!
Niagara Gorge Trail information and maps are provided here.
The oldest National park in America, Niagara Falls State Park encompasses more than 400 acres of lush parkland and is home to one of the best views of the Falls in the city. The Observation Tower, located at the cliff of the American Falls, stands at eye level with the cascading water and features an elevator that travels the 180 ft to the base of the Falls and the docks of the Maid of the Mist.
The park is also a sanctuary for protected species, including Peregrine Falcons, Lake Sturgeon and 14 rare flora/fauna species.


Panel chief says prediction of Himalayan glaciers' disappearance by 2035 was erroneous.
The UN's Intergovernmental Panel on Climate Change (IPCC), a Nobel Prize winning scientific body tasked with assessing the risk of climate change caused by human activity, has come under fire in recent days for an error in its 2007 report.
The panel, which is considered the world's most reliable source of information on climate change, had falsely predicted that Himalayan glaciers would disappear by 2035.
Rajendra Pachauri, the head of IPCC, has now admitted to a mistake being made in arriving at the 2035 prediction, but also defended the fact that the melting is a serious concern.
He has accused US lobbying groups for being behind the exaggerated criticism.
From New Delhi, Al Jazeera's Prerna Suri reports on the controversy.


text:
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2015-2020 Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
#include "internal.h"
#include "collections.h"
#include <vector>
#include <string>

LIBCOUCHBASE_API size_t lcb_respsubdoc_result_size(const lcb_RESPSUBDOC *resp)
{
    return resp->nres;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_result_status(const lcb_RESPSUBDOC *resp, size_t index)
{
    if (index >= resp->nres) {
        return LCB_ERR_OPTIONS_CONFLICT;
    }
    return resp->res[index].status;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_result_value(const lcb_RESPSUBDOC *resp, size_t index, const char **value,
                                                        size_t *value_len)
{
    if (index >= resp->nres) {
        return LCB_ERR_OPTIONS_CONFLICT;
    }
    *value = (const char *)resp->res[index].value;
    *value_len = resp->res[index].nvalue;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_status(const lcb_RESPSUBDOC *resp)
{
    return resp->ctx.rc;
}

LIBCOUCHBASE_API int lcb_respsubdoc_is_deleted(const lcb_RESPSUBDOC *resp)
{
    return resp->ctx.status_code == PROTOCOL_BINARY_RESPONSE_SUBDOC_MULTI_PATH_FAILURE_DELETED ||
           resp->ctx.status_code == PROTOCOL_BINARY_RESPONSE_SUBDOC_SUCCESS_DELETED;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_error_context(const lcb_RESPSUBDOC *resp,
                                                         const lcb_KEY_VALUE_ERROR_CONTEXT **ctx)
{
    if (resp->rflags & LCB_RESP_F_ERRINFO) {
        lcb_RESPSUBDOC *mut = const_cast<lcb_RESPSUBDOC *>(resp);
        mut->ctx.context = lcb_resp_get_error_context(LCB_CALLBACK_SDLOOKUP, (const lcb_RESPBASE *)resp);
        if (mut->ctx.context) {
            mut->ctx.context_len = strlen(resp->ctx.context);
        }
        mut->ctx.ref = lcb_resp_get_error_ref(LCB_CALLBACK_SDLOOKUP, (const lcb_RESPBASE *)resp);
        if (mut->ctx.ref) {
            mut->ctx.ref_len = strlen(resp->ctx.ref);
        }
    }
    *ctx = &resp->ctx;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_cookie(const lcb_RESPSUBDOC *resp, void **cookie)
{
    *cookie = resp->cookie;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_cas(const lcb_RESPSUBDOC *resp, uint64_t *cas)
{
    *cas = resp->ctx.cas;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_key(const lcb_RESPSUBDOC *resp, const char **key, size_t *key_len)
{
    *key = (const char *)resp->ctx.key;
    *key_len = resp->ctx.key_len;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_respsubdoc_mutation_token(const lcb_RESPSUBDOC *resp, lcb_MUTATION_TOKEN *token)
{
    const lcb_MUTATION_TOKEN *mt = lcb_resp_get_mutation_token(LCB_CALLBACK_SDMUTATE, (const lcb_RESPBASE *)resp);
    if (token && mt) {
        *token = *mt;
    }
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_create(lcb_SUBDOCSPECS **operations, size_t capacity)
{
    lcb_SUBDOCSPECS *res = (lcb_SUBDOCSPECS *)calloc(1, sizeof(lcb_SUBDOCSPECS));
    res->nspecs = capacity;
    res->specs = (lcb_SDSPEC *)calloc(res->nspecs, sizeof(lcb_SDSPEC));
    *operations = res;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_destroy(lcb_SUBDOCSPECS *operations)
{
    if (operations) {
        if (operations->specs) {
            size_t ii;
            for (ii = 0; ii < operations->nspecs; ii++) {
                if (operations->specs[ii].sdcmd == LCB_SDCMD_COUNTER) {
                    free((void *)operations->specs[ii].value.u_buf.contig.bytes);
                }
            }
        }
        free(operations->specs);
    }
    free(operations);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_timeout(lcb_CMDSUBDOC *cmd, uint32_t timeout)
{
    cmd->timeout = timeout;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_cas(lcb_CMDSUBDOC *cmd, uint64_t cas)
{
    cmd->cas = cas;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_get(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                const char *path, size_t path_len)
{
    if (path == NULL || path_len == 0) {
        operations->specs[index].sdcmd = LCB_SDCMD_GET_FULLDOC;
    } else {
        operations->specs[index].sdcmd = LCB_SDCMD_GET;
    }
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_exists(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                   const char *path, size_t path_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_EXISTS;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_replace(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                    const char *path, size_t path_len, const char *value,
                                                    size_t value_len)
{
    if (path == NULL || path_len == 0) {
        operations->specs[index].sdcmd = LCB_SDCMD_SET_FULLDOC;
    } else {
        operations->specs[index].sdcmd = LCB_SDCMD_REPLACE;
    }
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_dict_add(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                     const char *path, size_t path_len, const char *value,
                                                     size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_DICT_ADD;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_dict_upsert(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                        const char *path, size_t path_len, const char *value,
                                                        size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_DICT_UPSERT;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_array_add_first(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                            const char *path, size_t path_len, const char *value,
                                                            size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_ARRAY_ADD_FIRST;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_array_add_last(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                           const char *path, size_t path_len, const char *value,
                                                           size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_ARRAY_ADD_LAST;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_array_add_unique(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                             const char *path, size_t path_len, const char *value,
                                                             size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_ARRAY_ADD_UNIQUE;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_array_insert(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                         const char *path, size_t path_len, const char *value,
                                                         size_t value_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_ARRAY_INSERT;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_counter(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                    const char *path, size_t path_len, int64_t delta)
{
    operations->specs[index].sdcmd = LCB_SDCMD_COUNTER;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    char *value = (char *)calloc(22, sizeof(char));
    size_t value_len = snprintf(value, 21, "%" PRId64, delta);
    LCB_SDSPEC_SET_VALUE(&operations->specs[index], value, value_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_remove(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                   const char *path, size_t path_len)
{
    if (path == NULL || path_len == 0) {
        operations->specs[index].sdcmd = LCB_SDCMD_REMOVE_FULLDOC;
    } else {
        operations->specs[index].sdcmd = LCB_SDCMD_REMOVE;
    }
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_subdocspecs_get_count(lcb_SUBDOCSPECS *operations, size_t index, uint32_t flags,
                                                      const char *path, size_t path_len)
{
    operations->specs[index].sdcmd = LCB_SDCMD_GET_COUNT;
    operations->specs[index].options = flags;
    LCB_SDSPEC_SET_PATH(&operations->specs[index], path, path_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_create(lcb_CMDSUBDOC **cmd)
{
    *cmd = (lcb_CMDSUBDOC *)calloc(1, sizeof(lcb_CMDSUBDOC));
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_clone(const lcb_CMDSUBDOC *cmd, lcb_CMDSUBDOC **copy)
{
    LCB_CMD_CLONE(lcb_CMDSUBDOC, cmd, copy);
    if (cmd->specs) {
        lcb_CMDSUBDOC *ret = *copy;
        ret->specs = (lcb_SDSPEC *)calloc(ret->nspecs, sizeof(lcb_SDSPEC));
        memcpy((void *)ret->specs, cmd->specs, sizeof(lcb_SDSPEC) * ret->nspecs);
        size_t ii;
        for (ii = 0; ii < cmd->nspecs; ii++) {
            lcb_SDSPEC *spec = (lcb_SDSPEC *)&ret->specs[ii];
            size_t npath = spec->path.contig.nbytes;
            if (npath) {
                void *path = calloc(npath, sizeof(char));
                memcpy(path, spec->path.contig.bytes, npath);
                LCB_SDSPEC_SET_PATH(spec, path, npath);
            }
            size_t nval = spec->value.u_buf.contig.nbytes;
            if (nval) {
                void *val = calloc(nval, sizeof(char));
                memcpy(val, spec->value.u_buf.contig.bytes, nval);
                LCB_SDSPEC_SET_VALUE(spec, val, nval);
            }
        }
    }
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_destroy(lcb_CMDSUBDOC *cmd)
{
    if (cmd->cmdflags & LCB_CMD_F_CLONE) {
        if (cmd->specs) {
            size_t ii;
            for (ii = 0; ii < cmd->nspecs; ii++) {
                size_t npath = cmd->specs[ii].path.contig.nbytes;
                if (npath) {
                    free((void *)cmd->specs[ii].path.contig.bytes);
                }
                size_t nvalue = cmd->specs[ii].value.u_buf.contig.nbytes;
                if (nvalue) {
                    free((void *)cmd->specs[ii].value.u_buf.contig.bytes);
                }
            }
            free((void *)cmd->specs);
        }
    }
    LCB_CMD_DESTROY_CLONE(cmd);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_parent_span(lcb_CMDSUBDOC *cmd, lcbtrace_SPAN *span)
{
    cmd->pspan = span;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_collection(lcb_CMDSUBDOC *cmd, const char *scope, size_t scope_len,
                                                     const char *collection, size_t collection_len)
{
    cmd->scope = scope;
    cmd->nscope = scope_len;
    cmd->collection = collection;
    cmd->ncollection = collection_len;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_key(lcb_CMDSUBDOC *cmd, const char *key, size_t key_len)
{
    LCB_CMD_SET_KEY(cmd, key, key_len);
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_specs(lcb_CMDSUBDOC *cmd, const lcb_SUBDOCSPECS *operations)
{
    cmd->cmdflags |= operations->options;
    cmd->specs = operations->specs;
    cmd->nspecs = operations->nspecs;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_expiry(lcb_CMDSUBDOC *cmd, uint32_t expiration)
{
    cmd->exptime = expiration;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_durability(lcb_CMDSUBDOC *cmd, lcb_DURABILITY_LEVEL level)
{
    cmd->dur_level = level;
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_store_semantics(lcb_CMDSUBDOC *cmd, lcb_SUBDOC_STORE_SEMANTICS mode)
{
    cmd->cmdflags &= ~(LCB_CMDSUBDOC_F_UPSERT_DOC | LCB_CMDSUBDOC_F_INSERT_DOC);
    switch (mode) {
        case LCB_SUBDOC_STORE_REPLACE:
            /* replace is default, does not require setting the flags */
            break;
        case LCB_SUBDOC_STORE_UPSERT:
            cmd->cmdflags |= LCB_CMDSUBDOC_F_UPSERT_DOC;
            break;
        case LCB_SUBDOC_STORE_INSERT:
            cmd->cmdflags |= LCB_CMDSUBDOC_F_INSERT_DOC;
            break;
    }
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_access_deleted(lcb_CMDSUBDOC *cmd, int flag)
{
    if (flag) {
        cmd->cmdflags |= LCB_CMDSUBDOC_F_ACCESS_DELETED;
    } else {
        cmd->cmdflags &= ~LCB_CMDSUBDOC_F_ACCESS_DELETED;
    }
    return LCB_SUCCESS;
}

LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_create_as_deleted(lcb_CMDSUBDOC *cmd, int flag)
{
    if (flag) {
        cmd->cmdflags |= LCB_CMDSUBDOC_F_CREATE_AS_DELETED;
    } else {
        cmd->cmdflags &= ~LCB_CMDSUBDOC_F_CREATE_AS_DELETED;
    }
    return LCB_SUCCESS;
}

namespace SubdocCmdTraits
{
enum Options {
    EMPTY_PATH = 1 << 0,
    ALLOW_EXPIRY = 1 << 1,
    HAS_VALUE = 1 << 2,
    ALLOW_MKDIRP = 1 << 3,
    IS_LOOKUP = 1 << 4,
    // Must encapsulate in 'multi' spec
    NO_STANDALONE = 1 << 5
};

struct Traits {
    const unsigned allow_empty_path;
    const unsigned allow_expiry;
    const unsigned has_value;
    const unsigned allow_mkdir_p;
    const unsigned is_lookup;
    const uint8_t opcode;

    inline bool valid() const
    {
        return opcode != PROTOCOL_BINARY_CMD_INVALID;
    }

    inline unsigned mode() const
    {
        return is_lookup ? LCB_SDMULTI_MODE_LOOKUP : LCB_SDMULTI_MODE_MUTATE;
    }

    inline bool chk_allow_empty_path(uint32_t options) const
    {
        if (allow_empty_path) {
            return true;
        }
        if (!is_lookup) {
            return false;
        }

        return (options & LCB_SUBDOCSPECS_F_XATTRPATH) != 0;
    }

    inline Traits(uint8_t op, unsigned options)
        : allow_empty_path(options & EMPTY_PATH), allow_expiry(options & ALLOW_EXPIRY), has_value(options & HAS_VALUE),
          allow_mkdir_p(options & ALLOW_MKDIRP), is_lookup(options & IS_LOOKUP), opcode(op)
    {
    }
};

static const Traits Get(PROTOCOL_BINARY_CMD_SUBDOC_GET, IS_LOOKUP);

static const Traits Exists(PROTOCOL_BINARY_CMD_SUBDOC_EXISTS, IS_LOOKUP);

static const Traits GetCount(PROTOCOL_BINARY_CMD_SUBDOC_GET_COUNT, IS_LOOKUP | EMPTY_PATH);

static const Traits DictAdd(PROTOCOL_BINARY_CMD_SUBDOC_DICT_ADD, ALLOW_EXPIRY | HAS_VALUE);

static const Traits DictUpsert(PROTOCOL_BINARY_CMD_SUBDOC_DICT_UPSERT, ALLOW_EXPIRY | HAS_VALUE | ALLOW_MKDIRP);

static const Traits Remove(PROTOCOL_BINARY_CMD_SUBDOC_DELETE, ALLOW_EXPIRY);

static const Traits ArrayInsert(PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_INSERT, ALLOW_EXPIRY | HAS_VALUE);

static const Traits Replace(PROTOCOL_BINARY_CMD_SUBDOC_REPLACE, ALLOW_EXPIRY | HAS_VALUE);

static const Traits ArrayAddFirst(PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_PUSH_FIRST,
                                  ALLOW_EXPIRY | HAS_VALUE | EMPTY_PATH | ALLOW_MKDIRP);

static const Traits ArrayAddLast(PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_PUSH_LAST,
                                 ALLOW_EXPIRY | HAS_VALUE | EMPTY_PATH | ALLOW_MKDIRP);

static const Traits ArrayAddUnique(PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_ADD_UNIQUE,
                                   ALLOW_EXPIRY | HAS_VALUE | EMPTY_PATH | ALLOW_MKDIRP);

static const Traits Counter(PROTOCOL_BINARY_CMD_SUBDOC_COUNTER, ALLOW_EXPIRY | HAS_VALUE | ALLOW_MKDIRP);

static const Traits GetDoc(PROTOCOL_BINARY_CMD_GET, IS_LOOKUP | EMPTY_PATH | NO_STANDALONE);

static const Traits SetDoc(PROTOCOL_BINARY_CMD_SET, EMPTY_PATH | NO_STANDALONE);

static const Traits DeleteDoc(PROTOCOL_BINARY_CMD_DELETE, EMPTY_PATH | NO_STANDALONE);

static const Traits Invalid(PROTOCOL_BINARY_CMD_INVALID, 0);

const Traits &find(unsigned mode)
{
    switch (mode) {
        case LCB_SDCMD_REPLACE:
            return Replace;
        case LCB_SDCMD_DICT_ADD:
            return DictAdd;
        case LCB_SDCMD_DICT_UPSERT:
            return DictUpsert;
        case LCB_SDCMD_ARRAY_ADD_FIRST:
            return ArrayAddFirst;
        case LCB_SDCMD_ARRAY_ADD_LAST:
            return ArrayAddLast;
        case LCB_SDCMD_ARRAY_ADD_UNIQUE:
            return ArrayAddUnique;
        case LCB_SDCMD_ARRAY_INSERT:
            return ArrayInsert;
        case LCB_SDCMD_GET:
            return Get;
        case LCB_SDCMD_EXISTS:
            return Exists;
        case LCB_SDCMD_GET_COUNT:
            return GetCount;
        case LCB_SDCMD_REMOVE:
            return Remove;
        case LCB_SDCMD_COUNTER:
            return Counter;
        case LCB_SDCMD_GET_FULLDOC:
            return GetDoc;
        case LCB_SDCMD_SET_FULLDOC:
            return SetDoc;
        case LCB_SDCMD_REMOVE_FULLDOC:
            return DeleteDoc;
        default:
            return Invalid;
    }
}
} // namespace SubdocCmdTraits

namespace SubdocPathFlags
{
static const uint8_t MKDIR_P = 0x01;
static const uint8_t XATTR = 0x04;
static const uint8_t EXPAND_MACROS = 0x010;
} // namespace SubdocPathFlags

namespace SubdocDocFlags
{
static const uint8_t MKDOC = 0x01;
static const uint8_t ADDDOC = 0x02;
static const uint8_t ACCESS_DELETED = 0x04;
static const uint8_t CREATE_AS_DELETED = 0x08;
} // namespace SubdocDocFlags

static size_t get_valbuf_size(const lcb_VALBUF &vb)
{
    if (vb.vtype == LCB_KV_COPY || vb.vtype == LCB_KV_CONTIG) {
        return vb.u_buf.contig.nbytes;
    } else {
        if (vb.u_buf.multi.total_length) {
            return vb.u_buf.multi.total_length;
        } else {
            size_t tmp = 0;
            for (size_t ii = 0; ii < vb.u_buf.multi.niov; ++ii) {
                tmp += vb.u_buf.multi.iov[ii].iov_len;
            }
            return tmp;
        }
    }
}

static uint8_t make_path_flags(const uint32_t user)
{
    uint8_t flags = 0;
    if (user & LCB_SUBDOCSPECS_F_MKINTERMEDIATES) {
        flags |= SubdocPathFlags::MKDIR_P;
    }
    if (user & LCB_SUBDOCSPECS_F_XATTRPATH) {
        flags |= SubdocPathFlags::XATTR;
    }
    if (user & LCB_SUBDOCSPECS_F_XATTR_MACROVALUES) {
        flags |= SubdocPathFlags::XATTR | SubdocPathFlags::EXPAND_MACROS;
    }
    return flags;
}

static uint8_t make_doc_flags(const uint32_t user)
{
    uint8_t flags = 0;
    if (user & LCB_CMDSUBDOC_F_INSERT_DOC) {
        flags |= SubdocDocFlags::ADDDOC;
    }
    if (user & LCB_CMDSUBDOC_F_UPSERT_DOC) {
        flags |= SubdocDocFlags::MKDOC;
    }
    if (user & LCB_CMDSUBDOC_F_ACCESS_DELETED) {
        flags |= SubdocDocFlags::ACCESS_DELETED;
    }
    if (user & LCB_CMDSUBDOC_F_CREATE_AS_DELETED) {
        flags |= SubdocDocFlags::CREATE_AS_DELETED;
    }
    return flags;
}

struct MultiBuilder {
    static unsigned infer_mode(const lcb_CMDSUBDOC *cmd)
    {
        if (cmd->nspecs == 0) {
            return 0;
        }
        const SubdocCmdTraits::Traits &trait = SubdocCmdTraits::find(cmd->specs[0].sdcmd);
        if (!trait.valid()) {
            return 0;
        }
        return trait.mode();
    }

    MultiBuilder(const lcb_CMDSUBDOC *cmd_) : cmd(cmd_), payload_size(0)
    {
        mode = infer_mode(cmd_);
        size_t ebufsz = is_lookup() ? cmd->nspecs * 4 : cmd->nspecs * 8;
        extra_body = new char[ebufsz];
        bodysz = 0;
    }

    ~MultiBuilder()
    {
        if (extra_body != NULL) {
            delete[] extra_body;
        }
    }

    inline MultiBuilder(const MultiBuilder &);

    // IOVs which are fed into lcb_VALBUF for subsequent use
    const lcb_CMDSUBDOC *cmd;
    std::vector<lcb_IOV> iovs;
    char *extra_body;
    size_t bodysz;

    // Total size of the payload itself
    size_t payload_size;

    unsigned mode;

    bool is_lookup() const
    {
        return mode == LCB_SDMULTI_MODE_LOOKUP;
    }

    bool is_mutate() const
    {
        return mode == LCB_SDMULTI_MODE_MUTATE;
    }

    void maybe_setmode(const SubdocCmdTraits::Traits &t)
    {
        if (mode == 0) {
            mode = t.mode();
        }
    }

    template <typename T>
    void add_field(T itm, size_t len)
    {
        const char *b = reinterpret_cast<const char *>(&itm);
        memcpy(extra_body + bodysz, b, len);
        bodysz += len;
    }

    const char *extra_mark() const
    {
        return extra_body + bodysz;
    }

    void add_extras_iov(const char *last_begin)
    {
        const char *p_end = extra_mark();
        add_iov(last_begin, p_end - last_begin);
    }

    void add_iov(const void *b, size_t n)
    {
        if (!n) {
            return;
        }

        lcb_IOV iov;
        iov.iov_base = const_cast<void *>(b);
        iov.iov_len = n;
        iovs.push_back(iov);
        payload_size += n;
    }

    void add_iov(const lcb_VALBUF &vb)
    {
        if (vb.vtype == LCB_KV_CONTIG || vb.vtype == LCB_KV_COPY) {
            add_iov(vb.u_buf.contig.bytes, vb.u_buf.contig.nbytes);
        } else {
            for (size_t ii = 0; ii < vb.u_buf.contig.nbytes; ++ii) {
                const lcb_IOV &iov = vb.u_buf.multi.iov[ii];
                if (!iov.iov_len) {
                    continue; // Skip it
                }
                payload_size += iov.iov_len;
                iovs.push_back(iov);
            }
        }
    }

    inline lcb_STATUS add_spec(const lcb_SDSPEC *);
};

lcb_STATUS MultiBuilder::add_spec(const lcb_SDSPEC *spec)
{
    const SubdocCmdTraits::Traits &trait = SubdocCmdTraits::find(spec->sdcmd);
    if (!trait.valid()) {
        return LCB_ERR_UNKNOWN_SUBDOC_COMMAND;
    }
    maybe_setmode(trait);

    if (trait.mode() != mode) {
        return LCB_ERR_OPTIONS_CONFLICT;
    }

    const char *p_begin = extra_mark();
    // opcode
    add_field(trait.opcode, 1);
    // flags
    add_field(make_path_flags(spec->options), 1);

    uint16_t npath = static_cast<uint16_t>(spec->path.contig.nbytes);
    if (!npath && !trait.chk_allow_empty_path(spec->options)) {
        return LCB_ERR_SUBDOC_PATH_INVALID;
    }

    // Path length
    add_field(static_cast<uint16_t>(htons(npath)), 2);

    uint32_t vsize = 0;
    if (is_mutate()) {
        // Mutation needs an additional 'value' spec.
        vsize = get_valbuf_size(spec->value);
        add_field(static_cast<uint32_t>(htonl(vsize)), 4);
    }

    // Finalize the header..
    add_extras_iov(p_begin);

    // Add the actual path
    add_iov(spec->path.contig.bytes, spec->path.contig.nbytes);
    if (vsize) {
        add_iov(spec->value);
    }
    return LCB_SUCCESS;
}

static lcb_STATUS subdoc_validate(lcb_INSTANCE *instance, const lcb_CMDSUBDOC *cmd)
{
    auto err = lcb_is_collection_valid(instance, cmd->scope, cmd->nscope, cmd->collection, cmd->ncollection);
    if (err != LCB_SUCCESS) {
        return err;
    }
    // First validate the command
    if (cmd->nspecs == 0) {
        return LCB_ERR_NO_COMMANDS;
    }

    return LCB_SUCCESS;
}

LIBCOUCHBASE_API
lcb_STATUS lcb_subdoc(lcb_INSTANCE *instance, void *cookie, const lcb_CMDSUBDOC *command)
{
    lcb_STATUS err;

    err = subdoc_validate(instance, command);
    if (err != LCB_SUCCESS) {
        return err;
    }

    auto operation = [instance, cookie](const lcb_RESPGETCID *resp, const lcb_CMDSUBDOC *cmd) {
        MultiBuilder ctx(cmd);

        if (resp && resp->ctx.rc != LCB_SUCCESS) {
            lcb_CALLBACK_TYPE cbtype = ctx.is_lookup() ? LCB_CALLBACK_SDLOOKUP : LCB_CALLBACK_SDMUTATE;
            lcb_RESPCALLBACK cb = lcb_find_callback(instance, cbtype);
            lcb_RESPSUBDOC sd{};
            sd.ctx = resp->ctx;
            sd.ctx.key = static_cast<const char *>(cmd->key.contig.bytes);
            sd.ctx.key_len = cmd->key.contig.nbytes;
            sd.cookie = cookie;
            cb(instance, cbtype, reinterpret_cast<const lcb_RESPBASE *>(&sd));
            return resp->ctx.rc;
        }

        uint32_t expiry = cmd->exptime;
        uint8_t docflags = make_doc_flags(cmd->cmdflags);

        if ((docflags & SubdocDocFlags::CREATE_AS_DELETED) != 0 &&
            (LCBVB_CAPS(LCBT_VBCONFIG(instance)) & LCBVB_CAP_TOMBSTONED_USER_XATTRS) == 0) {
            return LCB_ERR_SDK_FEATURE_UNAVAILABLE;
        }

        lcb_STATUS rc = LCB_SUCCESS;

        if (cmd->error_index) {
            *cmd->error_index = -1;
        }

        if (expiry && !ctx.is_mutate()) {
            return LCB_ERR_OPTIONS_CONFLICT;
        }

        for (size_t ii = 0; ii < cmd->nspecs; ++ii) {
            if (cmd->error_index) {
                *cmd->error_index = ii;
            }
            rc = ctx.add_spec(cmd->specs + ii);
            if (rc != LCB_SUCCESS) {
                return rc;
            }
        }

        mc_PIPELINE *pl;
        mc_PACKET *pkt;
        uint8_t extlen = 0;
        if (expiry) {
            extlen += 4;
        }
        if (docflags) {
            extlen++;
        }

        protocol_binary_request_header hdr;
        int new_durability_supported = LCBT_SUPPORT_SYNCREPLICATION(instance);
        lcb_U8 ffextlen = 0;

        hdr.request.magic = PROTOCOL_BINARY_REQ;
        if (ctx.is_mutate() && cmd->dur_level) {
            if (new_durability_supported) {
                hdr.request.magic = PROTOCOL_BINARY_AREQ;
                ffextlen = 4;
            } else {
                return LCB_ERR_UNSUPPORTED_OPERATION;
            }
        }

        if (cmd->error_index) {
            *cmd->error_index = -1;
        }

        rc = mcreq_basic_packet(&instance->cmdq, reinterpret_cast<const lcb_CMDBASE *>(cmd), &hdr, extlen, ffextlen,
                                &pkt, &pl, MCREQ_BASICPACKET_F_FALLBACKOK);

        if (rc != LCB_SUCCESS) {
            return rc;
        }

        lcb_VALBUF vb = {LCB_KV_IOVCOPY};
        vb.u_buf.multi.iov = &ctx.iovs[0];
        vb.u_buf.multi.niov = ctx.iovs.size();
        vb.u_buf.multi.total_length = ctx.payload_size;
        rc = mcreq_reserve_value(pl, pkt, &vb);

        if (rc != LCB_SUCCESS) {
            mcreq_wipe_packet(pl, pkt);
            mcreq_release_packet(pl, pkt);
            return rc;
        }

        // Set the header fields.
        if (ctx.is_lookup()) {
            hdr.request.opcode = PROTOCOL_BINARY_CMD_SUBDOC_MULTI_LOOKUP;
        } else {
            hdr.request.opcode = PROTOCOL_BINARY_CMD_SUBDOC_MULTI_MUTATION;
        }
        hdr.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
        hdr.request.extlen = extlen;
        hdr.request.opaque = pkt->opaque;
        hdr.request.cas = lcb_htonll(cmd->cas);
        hdr.request.bodylen = htonl(hdr.request.extlen + ffextlen + mcreq_get_key_size(&hdr) + ctx.payload_size);
        memcpy(SPAN_BUFFER(&pkt->kh_span), hdr.bytes, sizeof(hdr.bytes));
        if (ctx.is_mutate() && cmd->dur_level && new_durability_supported) {
            uint8_t meta = (1u << 4u) | 3u;
            uint8_t level = cmd->dur_level;
            uint16_t timeout = htons(lcb_durability_timeout(instance, cmd->timeout));
            memcpy(SPAN_BUFFER(&pkt->kh_span) + MCREQ_PKT_BASESIZE, &meta, sizeof(meta));
            memcpy(SPAN_BUFFER(&pkt->kh_span) + MCREQ_PKT_BASESIZE + 1, &level, sizeof(level));
            memcpy(SPAN_BUFFER(&pkt->kh_span) + MCREQ_PKT_BASESIZE + 2, &timeout, sizeof(timeout));
        }
        if (expiry) {
            expiry = htonl(expiry);
            memcpy(SPAN_BUFFER(&pkt->kh_span) + MCREQ_PKT_BASESIZE + ffextlen, &expiry, 4);
        }
        if (docflags) {
            memcpy(SPAN_BUFFER(&pkt->kh_span) + MCREQ_PKT_BASESIZE + ffextlen + (extlen - 1), &docflags, 1);
        }

        MCREQ_PKT_RDATA(pkt)->cookie = cookie;
        MCREQ_PKT_RDATA(pkt)->start = gethrtime();
        MCREQ_PKT_RDATA(pkt)->deadline =
            MCREQ_PKT_RDATA(pkt)->start +
            LCB_US2NS(cmd->timeout ? cmd->timeout : LCBT_SETTING(instance, operation_timeout));
        MCREQ_PKT_RDATA(pkt)->nsubreq = cmd->nspecs;
        LCB_SCHED_ADD(instance, pl, pkt);
        return LCB_SUCCESS;
    };

    if (!LCBT_SETTING(instance, use_collections)) {
        /* fast path if collections are not enabled */
        return operation(nullptr, command);
    }

    uint32_t cid = 0;
    if (collcache_get(instance, command->scope, command->nscope, command->collection, command->ncollection, &cid) ==
        LCB_SUCCESS) {
        lcb_CMDSUBDOC clone = *command; /* shallow clone */
        clone.cid = cid;
        return operation(nullptr, &clone);
    } else {
        return collcache_resolve(instance, command, operation, lcb_cmdsubdoc_clone, lcb_cmdsubdoc_destroy);
    }
}

redpajama_set_name: RedPajamaGithub


text:
Page views of Walt Disneys by language »
Among PRODUCERS »
Among PRODUCERS In United States »
Walter Elias Disney (; December 5, 1901 – December 15, 1966) was an American animator, film producer and entrepreneur. A pioneer of the American animation industry, he introduced several developments in the production of cartoons. As a film producer, he holds the record for most Academy Awards earned and nominations by an individual, having won 22 Oscars from 59 nominations. Read more on Wikipedia
Since 2007, the English Wikipedia page of Walt Disney has received more than 28,315,924 page views. His biography is available in 158 different languages on Wikipedia (up from 150 in 2019). Walt Disney is the most popular producer, the 28th most popular biography from United States (down from 27th in 2019) and the most popular American Producer.
Walt Disney is most famous for founding the Walt Disney Company and being the creative force behind films like Snow White and the Seven Dwarfs, Pinocchio, and Fantasia.
Page views of Walt Disneys by language
Among PRODUCERS
Among producers, Walt Disney ranks 1 out of 89. After him are Harvey Weinstein, Carlo Ponti, Dino De Laurentiis, Phil Spector, René Angélil, Rick Rubin, Jerry Bruckheimer, David O. Selznick, Simon Cowell, Louis B. Mayer, and Albert R. Broccoli.
Most Popular Producers in Wikipedia
Dino De Laurentiis
René Angélil
Albert R. Broccoli
Among people born in 1901, Walt Disney ranks 2. Before him is Hirohito. After him are Marlene Dietrich, Werner Heisenberg, Louis Armstrong, Enrico Fermi, Grand Duchess Anastasia Nikolaevna of Russia, Jacques Lacan, Linus Pauling, Clark Gable, Rudolf Höss, and Sukarno. Among people deceased in 1966, Walt Disney ranks 1. After him are André Breton, Georges Lemaître, Alberto Giacometti, Anna Akhmatova, Buster Keaton, Ken Miles, Sergei Korolev, Peter Debye, Jean Arp, Sepp Dietrich, and Sayyid Qutb.
Enrico Fermi
Grand Duchess Anastasia Nikolaevna of Russia
Rudolf Höss
Georges Lemaître
Ken Miles
Sergei Korolev
Peter Debye
Jean Arp
Sayyid Qutb
Among people born in United States, Walt Disney ranks 28 out of 18,182. Before him are Hillary Clinton (1947), Ronald Reagan (1911), Michael Jackson (1958), Ernest Hemingway (1899), Joe Biden (1942), and George Washington (1732). After him are Aretha Franklin (1942), Martin Scorsese (1942), Al Pacino (1940), Pocahontas (1595), Mark Twain (1835), and Cher (1946).
Among PRODUCERS In United States
Among producers born in United States, Walt Disney ranks 1. After him are Harvey Weinstein (1952), Phil Spector (1939), Rick Rubin (1963), Jerry Bruckheimer (1943), David O. Selznick (1902), Albert R. Broccoli (1909), Joel Silver (1952), Gene Roddenberry (1921), Aaron Spelling (1923), Irving Thalberg (1899), and Darryl F. Zanuck (1902).
American born Producers
89 Individuals
Ward Kimball
American Animator And Jazz Trombonist
American Animator And Special Effects Pioneer (1901–1971)

redpajama_set_name: RedPajamaCommonCrawl


Charlotte Usher has always felt invisible at school. But now she has a plan to break into the popular crowd and nothing is going to stop her. Not even death. It's the first day of the rest of Charlotte's life. She isn't going to be invisible anymore. And she's not going to stop at just getting noticed, she's determined that she'll be envied! Much to Charlotte's surprise her plan actually seems to be working: Petula, the most popular girl at school has finally acknowledged her existence and her lab partner for the rest of the term is none other than Damen Dylan, school heart-throb and object of Charlotte's desire. It's only a matter of time before she's accepted into their elite circle...that is until, in her excitement, Charlotte chokes to death on a gummy bear. So, OK, it's the first day of the rest of Charlotte's death - why should that change her plans?
Es entretenido sobre todo, ideal para gente que no está acostumbrada a leer o simplemente quiere pasar un rato entretenido.
Bueno, coincido con Tatuana en el gusto por los vampiros, pero que nadie se crea que este libro va por ahí; vampiro no sale ni uno que pasase por alli por casualidad. Es un libro aceptable y fácil de leer; está bien para pasar el rato.
Me encanta el libro =) es original dentro de lo que cabe, ya cansan mucho las historias de vampiros, siempre es lo mismo.


June 30, 2004 • Folk musician Sis Cunningham has died at age 95. Cunningham, whose given name was Agnes, co-founded and edited Broadside magazine. Through it, Cunningham and her husband published many influential songs of the 1960s. Hear folk songwriter Pete Seeger and NPR's Robert Siegel.
June 30, 2004 • Spider-Man 2 weaves its way into U.S. movie theaters Wednesday. Tobey Maguire returns as the title superhero, this time suffering a crisis of confidence. Alfred Molina joins the cast as his evil nemesis, Dr. Otto Octavius -- better known to Spidey fans as Doctor Octopus. Los Angeles Times film critic Kenneth Turan has a review.
June 30, 2004 • Americans have the longest working days and shortest vacations of any of the world's industrialized nations. NPR's Karen Grigsby Bates presents her literary equivalent of two weeks at the beach -- read her list of must-reads, and compare her list with other NPR literary contributors.
June 30, 2004 • The Los Angeles County Museum of Art is hosting the first-ever major exhibition of paintings that reflect what many upper-class Spaniards thought about race, class and skin color during the time of the Spanish colonization of Mexico in the 1700s.
June 29, 2004 • NPR's Tavis Smiley talks with teacher-turned-gospel-sensation Smokie Norful about the mainstreaming of gospel music.
June 28, 2004 • In the latest Politically Speaking column, NPR Correspondent Peter Overby examines the latest controversy over Michael Moore's Fahrenheit 9/11 -- whether the hit film is subject to federal campaign rules.
June 28, 2004 • Almost 4,000 young Sudanese fled civil war to reach safety in the United States. A graphic novel, Echoes of the Lost Boys of Sudan, tells their harrowing stories.
June 28, 2004 • TV critic David Bianculli has a report from the 25th Anniversary of the Banff Television Festival. About 1,300 television professionals from around the world came together from June 13-17 to award prizes to the best in international TV programming.
June 28, 2004 • The dynamics of race and class are explored in the new HBO film Everyday People. NPR's Tavis Smiley talks with executive producer Nelson George about the story of a group of patrons and workers trying to accept changes surrounding their neighborhood restaurant.
June 28, 2004 • Particle physicists have found a way to allow preservationists to play fragile historic audio recordings on acetate and wax cylinders without damaging them. Photographic imaging technology is used to map the grooves on the cylinders and records. A computer program reads the data and plays the music -- without ever touching the record. Hear NPR's Renee Montagne.


Whether it is chest pain, joint pain, or pain after a surgery, pulmonary hypertension brings pain that is an intrusive part of life. Learning tips and tricks to manage pain becomes paramount.
On myPHteam, the social network and online support group for those living with pulmonary hypertension, members talk about a range of personal experiences and struggles. Pain is one of the top 10 topics most discussed.
• Does anyone else have chest pain with their PH?
• Does anyone else get extremely short of breath and experience pain when you bend over?
• The anxiety from my pain is not helping my PH.
• I'm in a ton of pain from a cold.
• They say life is a dance and I now dance from my chair more than on my feet.
• One member shares advice about chest pain with another member.


We are a specialist builders' merchants offering an extensive range of building supplies online.
Browse through our categories of everyday building products and materials that are essential for your build. If you can't find the building supplies you're looking for, give us a call.


Land Pride's FDR3690 Rear Discharge Finishing Mower is pure muscle! Designed for heavy commercial use, the 90" width can swallow a lot of grass in one bite. The rear discharge area directs debris toward the ground and the tapered deck allows users to get close to obstacles. The free-swinging blades turn at 16,500 fpm.
Built-in to direct material and debris down.
Semi-solid tires offer premium flotation. Roller bearings allow for a long life. Semi-solid tires offer shock absorption.
Compatible with Land Pride Quick Hitch for easy attachment and removal. Increases productivity.


Fascinated by the creative process and all things inspirational, I love to craft stories and help others achieve their dreams. Nothing great happens alone—it takes a team and lots of encouragement (and hard work) for awesome things to happen.
I've been through plenty of rejection as a writer. But with lots of rewriting, never giving up, and the help of Providence, as George Washington would say, I've seen several stories become books—and some dreams come true.
It never would have happened without guidance and suggestions from friends, family, some terrific editors, and publishers who thankfully caught onto some neat ideas.
As a child, I didn't like reading books but always excelled in Creative Writing—it was usually the only class in which I received an A—that and in Gym. If you would have told me then that one day I'd have a book with my name on it, I would have said you were crazy. But life has a way of directing us if we are willing to take a leap of faith and follow its call.
I grew up in Wyckoff, NJ, where I live today with my family. My parents were always encouraging me to try new things, although I never really wanted to. I was happy playing baseball, basketball and watching TV.
When I was young, my dad travelled all the time for work and my mom was my best friend. She'd always tell me, "You're not a momma's boy, but you are momma's boy." When I was 19, my dad retired and we then became much closer. At first, when I was 25, he didn't want me to pursue a career as a writer (he wanted me to get my MBA), then when he started to read some of my first stories, he became my biggest fan. Fast forward to 11 years after I first became published, and my dad and I actually wrote a book together—Patriots, Redcoats and Spies. It's my favorite story for that reason—we did it together.
In addition to writing, I run a basketball league for 320 kids in my area, coach my kids' sports teams, and enjoy learning new things. In fact, each book I've written is the result of something in life that captured my attention and I decided to learn more about it or that I knew about—like Christmas elves and football-playing turkeys.
I have spent much time in 1777-1779. I've seen my father shot, had to do difficult things never thought possible. I've been in knife fights, gun battles, been beaten up and even met George Washington.
One year later, in the sequel, I delivered precious gun powder and faced Loyalist bandits, operated the first submarine ever invented (appropriately called The American Turtle), taken lives and participated in a daring rescue at the battle of Fort St. George.
In our American Revolutionary War Adventure series, you'll discover what I went through as I lived these characters' lives. You can't spend time, even in your imagination, fighting in the American Revolution and not feel a greater and intense sense of patriotism. I love our nation and its founding principles even more now as a result of being in 1777.
Every day I walk by a school with the name George Washington on it and I go back to the Revolution and relive – even momentarily – my imaginary experiences, which are more than words on a page for me—they are real.
Norman Maclean in his book A River Runs Through It wrote, "I am haunted by waters." I, however, am haunted by liberty, and more importantly, what it costs. The pain and conflict I lived was imaginary but yet so real for me. The opportunity to live a moral life, pursue one's dreams and happiness, and do so in a free nation is a privilege. I am now so much more grateful for the men and women who died for our nation and who now protect us than ever before.
The freedoms we enjoy are the result of brave men and women who gave sacrificially of their lives to fight – many paid the ultimate sacrifice of their life – so we can be free. We truly live in the land of the free because of the brave. Today, pursue your happiness with an attitude of gratitude and live a life worthy of their sacrifice.
Live for God and country in service to others.


(Introduced) As introduced, designates the CSM Bobby G. Davis National Guard Armory in Chattanooga as the "CSM Bobby G. Davis and BG Carl E. Levi National Guard Armory".
(Passed) As enacted, enacts the "Anti-Kicking the Can Act", which requires approval of the comptroller prior to any local government authorizing the issuance of balloon indebtedness. - Amends TCA Title 9, Chapter 21.
(Introduced - Dead) As introduced, allows a student with a documented medical disability that restricts the student's attendance to part-time to petition for an extension of time in which to receive a Tennessee HOPE scholarship. - Amends TCA Title 49, Chapter 4, Part 9.
"TN HB0552 | 2019-2020 | 111th General Assembly." LegiScan. LegiScan LLC, 17 Apr. 2019. Web. 22 Apr. 2019. <https://legiscan.com/TN/bill/HB0552/2019>.
"TN HB0552 | 2019-2020 | 111th General Assembly." April 17, 2019 LegiScan. Accessed April 22, 2019. https://legiscan.com/TN/bill/HB0552/2019.
LegiScan. TN HB0552 | 2019-2020 | 111th General Assembly. 17 April 2019. https://legiscan.com/TN/bill/HB0552/2019 (accessed April 22, 2019).
SB0479 Crossfiled 2019-02-28 As introduced, designates the CSM Bobby G. Davis National Guard Armory in Chattanooga as the "CSM Bobby G. Davis and BG Carl E. Levi National Guard Armory". Rcvd. from S., held on H. desk.


text:
Location Change for Jan. 23 & 25 Council Meetings & Hearings
Wednesday January 18, 2023 01:28 pm - 227 Views - Posted By Parish Council
Please note the following changes to the upcoming committee and council meetings:
The committee and council meetings scheduled for January 23, 2023, at 5:30 p.m. and January 25, 2023, at 6:00 p.m. have been relocated to the Terrebonne Parish School Board Office, 201 Stadium Drive in Houma while work is being done to update the Terrebonne Parish Council meeting room. The times for these meetings have not changed.
The condemnation hearing scheduled for Monday, January 23, 2023, has been postponed until Monday, February 27, 2023.


==5906== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
valgrind: m_mallocfree.c:266 (mk_plain_bszB): Assertion 'bszB != 0' failed.
While I am not able to reproduce in FFmpeg, I am fairly sure this is a FFmpeg bug.
ff_mss12_decode_init sets coded_height while not setting height.
ff_mpv_decode_init then copies coded_height into MpegEncContext? height.
This is then used by init_context_frame to allocate the data structures.
However the wmv9rects are validated/based on avctx->height, not avctx->coded_height.
Thus the decode_wmv9 function will try to decode a larger video that we allocated data structures for.
Patch sent to FFmpeg, but closing here as not a FFmpeg issue.
My FFmpeg patch is tested to fix the crash.


Verdure Fontainbleu tapestry shows a gorgeous verdure scene based on originals from French 17th century tapestries. Here we see a secluded scene of a river with logs, forest greenery and forest verdure. The detail is exquisite as is the color profile with gradations of tones of golden browns, blue greens, greens and beige tones. Fontainbleu is a town of royalty in a commune in France which has been a place of royalty from the 12th century, and includes the Fontainbleu forest. The light of the forest is suggested beautifully by the use of color and tones. The play of pattern in the leaves is typical of the French verdure and landscape tapestries of forests and adds vibrancy and sense of life to the tapestry. The elaborate border completes this beautiful work. This tapestry Verdure Fontainbleu is backed with a lining and a tunnel for easy hanging. Note: tapestry rods and tassels, where pictured, are not included in the price.
Dimensions: W 67" x H 71"


President John Magufuli saidon November 12, 2018 that the government would purchase all stocks from farmers at a flat rate price of Sh3,300 per kilogram through the Tanzania Agricultural Development Bank (TADB). However, since then, there have been reports that some farmers were being paid Sh2,600 instead of Sh3,300. But clarifying on the difference, Prime Minister Kassim Majaliwa said in Parliament yesterday that the Sh3,300 price was for grade A cashew nuts only.
"Globally, the price for grade B cashew nuts is 80 per cent of the price of grade A," said Mr Majaliwa, reiterating what the Deputy Minister for Agriculture, Mr Omary Mgumba, said earlier this week. Responding to a question by Liwale lawmaker Zuberi Kuchauka (CCM), Mr Majaliwa said, so far, the government has paid over Sh524 billion to cashew nut farmers, reiterating that delays in payments were a result of the verification exercise.
"We wanted to satisfy ourselves whether or not the farmers, mostly those who had brought over 1,500 tonnes, were truly the owners of the cashew nuts or not. Yesterday, we paid to farmers some Sh100 billion more," said the Premier. However, Mr Majaliwa did not disclose the number of farmers who received the additional Sh100 billion.
Mr Majaliwa said at least Sh707. 1 billion had been allocated for the purchase of 214,269.7 tonnes of cashew nuts. During the 2018/19 production season, some 240,000 tonnes of cashew nuts are projected to be produced. On Monday the government extended deadline for the verification and payment of cashew nut farmers and traders to February 15, 2019. Speaking to cashew nuts stakeholders in Mtwara on January 27, 2019, Mr Majaliwa directed that the verification exercise should be concluded by February 5, 2019.


Rochester, NY - December 15, 2014 Brighton Securities, a local and independently owned financial services firm, announced today the appointment of a new member of their Board, David G. Rusin.
"We are honored to have added David to our Board of Directors," said Jai Ramachandran, Chief Executive Officer of Brighton Securities. "David's experience from his time with Kodak, Frontier and American Fiber Systems has given him insights into best business practices and will assist us as we continue to grow within the Rochester Community. Team Brighton looks forward to having his perspective assist us in better serving our clients in 2015 and beyond."
David is a successful Serial Entrepreneur with a proven track record in launching new businesses. Focused primarily on technology, telecommunications, Internet and software industries, David has raised over $90 million in Venture Capital. Most recently, David was Founder, President & CEO of American Fiber Systems, Inc. where he focused on delivering fiber optic capacity nationwide in second tier markets. David has also held Executive positions with Northern Telecom and was past President of Frontier Communications doubling their revenues from $3 billion to $6 billion before officially becoming an entrepreneur in 1997. Prior to Frontier Communications David conducted a successful turnaround as President & CEO of Edicon Systems, Inc. a digital imaging subsidiary of Eastman Kodak Company from 1990-1993, which was eventually sold to UTC and has grown to over $1 billion in annual revenues worldwide.
"A business should operate on six core values," said David Rusin. "A company culture of mutual trust, customer experience obsession, frugality, operational effectiveness, bias for action and innovation." It is these values at the core of Brighton Securities that attracted him to become a member of its' Board. "Brighton's focus on in depth and personalized service, coupled with their dedication to impartial wealth advisory services is something extraordinary. They have a strong management team with nearly 100 years of combined experience. I am pleased to announce my appointment to their Board."
David holds a Ph.D. in Technology Management from Ashley University with International Accreditation, San Francisco, CA, MBA in Finance from Sacred Heart University, Fairfield, CT and a Bachelor of Science Degree from the Rochester Institute of Technology, Rochester, NY.


text:
Retirement home bus crashes into Nanaimo McDonald's
Posted: Mar. 15, 2017 10:51PM
Two people including the 53-year old driver were taken to hospital after a small retirement home bus crashed into the side of Nanaimo McDonald's on Wednesday.
It happened at Bowen Road and Dufferin Crescent around 10 a.m.
There were no passengers on the bus at the time.
The driver, who may have suffered from a medical issue, appears to have lost control, gone through a red light and collided with another vehicle before slamming into the restaurant.
No one was seriously hurt but both the driver and the 23-year old female driver of the other vehicle were taken to hospital.
The building had to be evacuated because of the possibility of structural damage.
Ben O'Hara
Suspect arrested after Victoria gas station robbery
Former constituency office assistant sentenced to 18-months house arrest


See below for the Kamp Kephart 2016 class schedule taught by Steve Watts at the Schiele Museum of Natural History in Gastonia, NC. Space is limited so sign up quick! To download the registration form in PDF, click here >>—> KAMP KEPHART 2016.
Kamp Haven at the Schiele Museum… a museum unto itself!
Check out Steve Watts FaceBook Page!