text:
Q: InventoryItem.java uses unchecked or unsafe operations I'm learning about comparable and am implementing it in my Inventory class. However when I go to compile the code, the compiler gives an error.
InventoryItem.java uses unchecked or unsafe operations.
Can anyone please help me out. What is wrong with my code and what can I do to fix this issue. Thank you for your help in advance.
class InventoryItem implements Comparable<InventoryItem>
{
    private String name;
    private int uniqueItemID;

    public InventoryItem()
    {
            name = " ";
            uniqueItemID = 0;
    }

    public InventoryItem(String newName, int newItemID)
    {
            name = newName;
            uniqueItemID = newItemID;
    }

    public InventoryItem(InventoryItem i)
    {
            name = i.name;
            uniqueItemID = i.uniqueItemID;
    }

    public void setName(String newName)
    {
            name = newName;
    }

    public void setItemID(int newItemID)
    {
            uniqueItemID = newItemID;
    }

    public int getItemID()
    {
            return uniqueItemID;
    }

    public String getName()
    {
            return name;
    }

    public int compareTo(InventoryItem i)
    {
            int anotherUniqueID = i.getItemID();
            return (this.uniqueItemID - anotherUniqueID);
    }

    public static void sort(Comparable[] a, int numberUsed)
    {
            int index, indexOfNextSmallest;

            for(index = 0; index < numberUsed - 1; index++)
            {
                    indexOfNextSmallest = indexOfSmallest(index, a, numberUsed);
                    interchange(index, indexOfNextSmallest, a);
            }
    }

    private static int indexOfSmallest(int startIndex, Comparable[] a, int numberUsed)
    {
            Comparable min = a[startIndex];
            int indexOfMin = startIndex;
            int index;

            for(index = startIndex + 1; index < numberUsed; index++)
            {
                    if(a[index].compareTo(min) < 0)
                    {
                            min = a[index];
                            indexOfMin = index;
                    }
            }
            return indexOfMin;
    }

    private static void interchange(int i, int j, Comparable[] a)
    {
            Comparable temp;
            temp = a[i];
            a[i] = a[j];
            a[j] = temp;
    }
}

public class InventoryItemTester
{
    public static void main(String [] args)
    {
            InventoryItem[] items = new InventoryItem[3];

            items[0] = new InventoryItem("Pens", 2);
            items[1] = new InventoryItem("Pencils", 3);
            items[2] = new InventoryItem("Notebooks", 1);

            System.out.println("Before sorting");
            System.out.println(items[0]);
            System.out.println(items[1]);
            System.out.println(items[2]);

            InventoryItem.sort(items, items.length);

            System.out.println("After sorting");
            System.out.println(items[0]);
            System.out.println(items[1]);
            System.out.println(items[2]);
    }
}

A: At a guess I'd say this line is causing the issue (Your compiler tells you exactly which line is the problem, this might be useful to include in your next question):
   private static int indexOfSmallest(int startIndex, Comparable[] a, int numberUsed)
   {
        Comparable min = a[startIndex];
        int indexOfMin = startIndex;
        int index;

        for(index = startIndex + 1; index < numberUsed; index++)
        {
here==========> if(a[index].compareTo(min) < 0)
                {

You are calling compareTo with a InventoryItem where it is expecting an Object. You could add a @SuppressWarnings annotation which would make it go away :)
The basic idea of Comparable and Comparator is they apply a sorting order to an Object so that the standard JDK Collections objects can do all the hard work for you.
In your case your comparesTo method does the correct thing, however I'm not sure if this is good planning or good luck, so things to note:

*

*InventoryItem.comparesTo method needs to evaluate the current instance to the provided instance and return an integer signifying the ordering, -1 means the instance (ie this) should be ordered before the argument, 0 means they are the same and 1 means the instance is after the argument. Something like this lets the JDK do all the hard work for you
public int compareTo(InventoryItem i)
{
    return Integer.valueOf(this.uniqueItemID).compareTo(i.uniqueItemID);
}

*In order to use Comparable all you really need to do is implement it and then use the standard JDK Collections classes to do all the heavy lifting for you, eg:
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class InventoryItemTest
{
    public static void main(String [] args)
    {

        List<InventoryItem> items = new ArrayList<InventoryItem>();

        items.add(new InventoryItem("Pens", 2));
        items.add(new InventoryItem("Pencils", 3));
        items.add(new InventoryItem("Notebooks", 1));

        System.out.println("Before sorting");
        System.out.println(items);

        Collections.sort(items);

        System.out.println("After sorting");
        System.out.println(items);
    }

}

*I realise this might not be as much fun as writing your own sorting algorithms but if you want to do that with no compiler warnings then you need to start looking at generics

redpajama_set_name: RedPajamaStackExchange


text:
The iPhone of Drones Is Being Built by This Teenager
With the millions he's raised, his flagship product might become one of the most game-changing drones in the air
By Jesse Hyde | Sep 21, 2017
IMAGE Michael Friberg via Entrepreneur.com
His drone, he believes, will be revolutionary. It will come equipped with artificial intelligence so it can recognize faces and objects and pick them out in a crowd; it will help police departments find lost children, ranchers monitor their herds, cities inspect buildings. If all goes according to plan, it will do for drones what the iPhone did for phones. It will make them useful, helpful. It will change the way we live. And it will be very, very fast.
Yet, until a year ago, whenever its creator, George Matus, went to see a venture capitalist to ask for money to bring it to market, his father had to drive him. That's because Matus didn't have a driver's license. He wore braces, lived at home and was still in high school. Unique were the challenges facing young George Matus. That was then. On a morning this past June, he sits behind the wheel of a Mercedes SUV, navigating traffic in the leafy suburbs of Salt Lake City, where he lives. He is 19, rail-thin, quick to laugh and unfailingly polite and optimistic, as he describes his vision for his drone. At a red light, he hits the brakes just a tad too hard and the SUV lurches to a halt. He smiles sheepishly, as if to say, Oops; still getting the hang of this.
That isn't the only thing he's getting the hang of. Matus is the founder and CEO of his own drone company, Teal, which has raised $2.8 million in seed money and attracted the support of some of the biggest venture capitalists in the tech world. He's looking to raise another $15 to $20 million next year. He's managing a staff of people decades older than he is. He is also under pressure. A lot of pressure. Which is why it's good that we're headed to a park to play with his company's first product, the Teal Sport.
"This is how I relax," he says.
The Sport is just the initial step toward realizing Matus' vision for what a drone can do; still, it represents a technological leap forward. Retailing from $499 to $799, it is the fastest production drone on the market, topping off at 80 mph and it can respond to voice commands through Siri. When it debuted in June, it sold out almost immediately.
Matus parks his SUV, gets out and walks over to a strip of sidewalk abutting a large park. He straps on a pair of futuristic goggles equipped with something called FPV, for "first-person view," which allows him to fly the drone as if he's sitting in the cockpit. He then unsnaps a carrying case about the size of a suitcase and removes the drone, which is small enough to fit in the palm of his hand.
"Meet Teal," he says.
With that, Matus hits a button on a handheld remote control and the drone shoots up hundreds of feet into the overcast sky, with the whoosh of a little rocket. As the craft traces loops in the air, a serene smile spreads across his face.
"I've always loved the feeling of flight, to be untethered, to feel limitless," he says. As he flies, he reflects on the chaos of building a company over the past few years, what the experience taught him about who he is. He pauses for a moment and watches his drone soaring above him. "Unflappable," he says, finally. "Maybe that's how I'd describe myself."
When Matus was a kid —really a kid — he dreamed of flying.
His parents met on a plane from Prague to New York. His mom was a flight attendant; his dad, a recent business school graduate. After they married and had George, they flew to Slovakia each summer to visit George's maternal grandparents. Because his mother worked for the airline, Matus was often granted access to the cockpit, where he'd pepper the pilots with questions.
Matus had another passion: making money. When he was little, following the lead of countless other entrepreneurs, he started a lemonade stand. It went well, but he foresaw a problem. Lemonade was seasonal. That made him wonder what drink he could sell in the winter. Seeing an opportunity that no one else was exploiting, Matus started a hot chocolate stand.
One day, a customer told Matus he wanted to buy out all his inventory for $60. Matus agreed. He loaded his stand into the back of the customer's pickup, and they drove to the man's office and served what was left of the hot chocolate to all his employees. Luckily, the buyer turned out to be a friend of his father's, but Matus didn't know that at the time, and his parents were alarmed that their 10-year-old would go somewhere with a stranger. They grounded him for two months.
When Matus was 10, his family moved from San Diego to a suburb of Salt Lake City. Their home sat next to a large park, and Matus, still obsessed with flying, persuaded his parents to let him save up for a remote-controlled airplane. He got it, and gave it to his dad to try. His dad crashed it. Matus cried, saved up to buy spare parts and fixed it. Something sparked. He started tinkering with other planes and helicopters.
Before long, Matus was making them do things they weren't designed to do. He made a video of one helicopter he'd modified to fly upside down and posted it on YouTube. The helicopter manufacturer both asked him to take it down and offered him a job as a test pilot. Matus accepted, and every week or so, the company sent him new prototypes to test.
Matus got in deeper. He turned his bedroom into a lab and eventually migrated to the basement, commandeering a Ping-Pong table. He built a helicopter that could fly for two hours and a drone that could go more than 100 miles per hour. At the age of 14, he won a world-champion drone race against engineers from Germany, Japan and Russia. "I was totally obsessed," Matus recalls. "Like, every two minutes, I'd be thinking about drones, from the second I got up." His father, George Matus, Sr. recalls, "He'd be down in the basement soldering until 2 a.m. We saw smoke coming up the stairs; there were funny smells. We'd hear the drill going. It was like Tony Stark from Iron Man, down in the basement, tinkering away."
At 16, Matus started going to hackathons, where coders and software engineers gather to compete, building new products and apps. Matus won a few of them. At one, set at Stanford, he spoke about the limitless potential he saw for drones — how they can go way beyond just taking photos and video. Matus wanted to explode people's narrow perceptions of drones. That caught the attention of PayPal co-founder Peter Thiel, whose foundation pays young people to forgo college and pursue "radical innovation that will benefit society." Thiel gave Matus $100,000 to launch a company of his own. Matus named the company Teal, partly for the teal duck, one of the fastest birds on Earth. He envisioned a drone that would be faster, easy to adapt and upgrade and outfitted with a supercomputer that would eventually be equipped with artificial intelligence to give it a boundless range of capabilities. As Matus worked on his design, the headmaster of the private school he was attending put him in touch with an investor named Mark Harris, who was on the school's board. They met, and Harris eventually agreed to put in $150,000. Later, Matus was called in for a meeting by a Salt Lake City VC firm called Pelion, which specializes in tech startups. "This kid came in, and I had planned to say no," says Pelion's Ben Lambert. "I wanted to say no. But when he started talking, I forgot I was talking to a 17-year-old. We realized his vision was much bigger than what drones were."
Pelion offered Matus a term sheet a few days before his 18th birthday. It would put in a hefty chunk of what ended up being a $2.8 million round if Matus could raise the rest within a couple months. With his father's help and intros from Pelion and people at the Thiel Fellowship, Matus met with more VCs in Salt Lake City and started cold-calling VC firms in Silicon Valley. "A lot of people were skeptical at first," he says. "They'd see my dad driving me there, waiting for me in the parking lot. I've got braces and I'm asking for millions of dollars."
It wasn't easy — at one point the deal nearly fell apart — but Matus eventually cobbled together the financing to trigger the $1 million investment from Pelion. Because of Matus' age and inexperience, Pelion put in what he refers to as "a few checks and balances." He had to work out of Pelion's offices, couldn't spend more than $25,000 without the board's approval. What's more, the hectic fundraising push strained friendships and burned some bridges, Matus admits, without getting into details. "Last year there were lots of ups and downs," he says. "One day everything is fantastic, and the next day you're gonna fail. But I don't think it took away my optimism."
When I meet Matus again, it's another warm June morning in Murray, Utah, a suburb of Salt Lake City. He still lives at home, but he no longer has to work out of Pelion. He's seated in his corner office behind a table full of drone prototypes, dressed, as usual, in a T-shirt and shorts. Like Matus, the space is quirky, humble and unassuming. He's decorated the doors with the symbol of the latest Star Wars movie, Rogue One and throughout the office, there are Star Wars memorabilia and toys in random spots — an X-wing fighter in a drawer stuffed with small plastic propellers, a BB-8 still in its case beside a box of drones ready to ship.
Today, Teal has 20 employees, including a former test pilot from Australia who cold-called Matus from Silicon Valley to see if he could join the startup. Matus oversees all areas of the company, but he's also learned to delegate more and more to his employees, including on the tech side. "Starting off I had no experience, or little experience, with building anything or working on the business side of things, and I was almost 100 percent focused on product," he says, "so it's obviously been a learning curve the past couple of years."
Matus says it's also been an adjustment leading a team of staffers a decade or two older than he is. "It's, uh, interesting," he says as he roots through a drawer stuffed with drone parts. Choosing his words carefully, he looks up and smiles. "People can be difficult." He says he's learned to take advice from people with more experience, to step back and defer when necessary, even as founder and CEO. "For being as smart as he is," says Lambert, "he's one of the most humble people I know. He doesn't think he knows everything. He's like a sponge."
Matus says he's been surprised by how much he's enjoyed the business side of running a company —meeting with investors, haggling over prices with suppliers and negotiating with distributors. But he really lights up when he starts talking about his drone. "The core is still the flying aspect and the joy of flight, which is still the root of it," he says. "It still feels like a hobby."
If all goes according to plan, later this year, the company will release a drone that will bring Matus closer than ever to realizing his vision. He's calling it "the flagship." It will cost $1,299. Like the Teal Sport, the flagship will be geared toward consumers "as a platform for learning how to fly, gaming, racing, companionship, education, taking photos and videos," Matus says. But that's just the start. The unit will also be equipped with a software development kit that will enable anyone to develop apps for it, and a powerful computer that will allow autonomous flight and deep learning. The goal is to give it the ability to recognize images and voices, meaning that if you're a parent and you tell it to go check on the kids at the park, it will be able to go find them and transmit video back to you. Teal will also offer an upgrade that will allow the drone to avoid obstacles such as trees and buildings of its own accord (sparing it from the fate that befell Matus' first remote-controlled plane).
In the future, the company plans to build out more commercial applications and partner with companies and municipalities that can use the drone for supervising building projects, search-and-rescue operations, even emergency services. (This isn't as far-fetched as it may seem. In a recent test, Swedish researchers deployed drones equipped with defibrillators from fire stations and found they arrived, on average, 17 minutes faster than ambulances.)
Naturally, the specter of an extremely fast flying machine that can spot a face in a crowd and follow around its owner has raised safety and privacy concerns. Those have led to proposed legislation that would give the federal government power to track, hack and destroy any drone.
But Matus isn't worried about looming regulation. If anything, he thinks it will help restrict drones in a positive way, to normalize them and make them less recreational and more useful, more helpful. "Drones will be as ubiquitous as smartphones," he says with a giddy grin. Whatever happens next for Teal — an IPO, an acquisition, a bust, whatever — that spirit of inquiry, exploration and optimism will guide George Matus.
"For me it's more about the ability to be able to stay on the bleeding edge of something. Elon Musk says he just likes to think about the future and not be sad. That's the way I like to approach it, too. We've got the chance to make a slightly better future. That's what keeps me motivated."
AI artificial intelligence drone drones entrepus George Matus Teal young entrepreneur young entrepreneurs
(Video) Meet the Business Owner Who Caused a Z Movie-Like Stampede for the Php8 Zark's Burgers
The Surprising Second Act for One of YouTube's Biggest Stars

redpajama_set_name: RedPajamaCommonCrawl


ePIP is a listing of your company in our Online Directory through August 30, 2019. To highlight your listing, upgrades are available as noted below.
For more information contact Marcy Sparrow: marcy@parkingtoday.com.
Download the 2018-2019 PIP Order Form here.
Please download our Media Kit for pricing information.
There is a charge for this service - we will forward all information when we receive your request. All contact info is required.
I agree to a one time $195 fee (per listing) for our company in the ePIP online directory.
Section Sponsor - bring your company to the top of your chosen section.
ePIP Upgrade Package - Make your online listing stand out with these upgrades: Company logo, e-mail hot link, 30 word company description, additional e-pip categories listed.


text:
Nivea Maker Beiersdorf To Acquire Coppertone From Bayer
Published on May 15 2019 7:40 AM in A-Brands tagged: Trending Posts / Beiersdorf / Bayer / Coppertone
Beiersdorf has announced that it has entered into a definitive agreement to buy the Coppertone business from Bayer.
The purchase price of Coppertone is $550 million, according to a statement released by the Nivea maker.
About Coppertone
Founded in 1944, Coppertone was the first sun care brand launched in the US market. It is headquartered in Whippany, New Jersey, USA and is currently in the United States, Canada and China.
Coppertone generated sales of $213 million in 2018, according to the statement.
Through the acquisition of Coppertone, Beiersdorf said that is entering the world's largest sun care market and strengthening its presence in North America.
Coppertone will become the fifth brand in Beiersdorf's skin care portfolio in North America, alongside Nivea, Eucerin, Aquaphor and La Prairie.
"This transaction demonstrates our commitment towards competitive, sustainable growth and investment in skin care outlined in the new C.A.R.E.+ strategy." said Stefan De Loecker, chief executive officer of Beiersdorf.
"Skin care is at the heart of Beiersdorf – and caring for skin health through sun protection has been an essential pillar of our business for over 60 years," he added.
Commenting on the sale of Coppertone, Heiko Schipper, president of consumer health at Bayer, said, "We believe that we have found the right partner in Beiersdorf to continue to invest in and grow the Coppertone brand.
"Since Bayer took ownership of Coppertone in late 2014, we have made progress in revitalising the brand and developing an exciting pipeline of innovative products thanks to the dedicated efforts of many employees, to whom we are grateful."
"We look forward to seeing the brand taken to the next level of success under Beiersdorf's ownership." he added.
Global Product
According to the statement, Beiersdorf will acquire the global product rights to Coppertone and take on approximately 450 dedicated brand personnel in the United States, Canada and China.
This will also include sales and marketing, research and development as well as a production facility in Cleveland, Tennessee, USA.
It revealed the transaction is expected to close in the third quarter of 2019 subject to the satisfaction of customary closing conditions, including approval by the competition authorities.
© 2019 European Supermarket Magazine – your source for the latest retail news. Article by Helen Galgey. Click subscribe to sign up to ESM: The European Supermarket Magazine.


text:
Category: Rulings on Marriage
It is better to marry a non-relative or a relative?
Is it better or preferable for a Muslim to marry someone he is not related to rather than a relative?".
Can he marry his paternal cousin's daughter?
Is there a set age for marriage in Islam?
A number of scholars regarded it as mustahabb for a man to marry a woman who is not related to him, and they gave a number of reasons for that:
1 – The child would have good characteristics, because he would take characteristics from his father's side and his mother's side.
2 – There is no guarantee that they will not separate which would lead to severing of the ties of kinship.
It says in al-Insaaf (8/16): It is mustahabb to choose a woman who is religiously committed and fertile, a virgin of good lineage who is not a relative. End quote.
It says in Mataalib Ooli al-Nuha (5/9): A non-relative, because her children will have better characteristics, and because there is no guarantee that they will not separate, which in the case of marriage to a relative would lead to severing of the ties of kinship, which we are enjoined to uphold. And it is said that non-relatives give children with better characteristics and female cousins have more patience. End quote.
Al-Nawawi said in al-Manhaaj: It is mustahabb to choose a religiously committed virgin who is of good lineage but is not a close relative." Al-Jalaal al-Mahalli said in his Sharh: "Not a close relative" means a non-relative or a distant relative. The one who is distantly related is better than one who is not related at all. End quote from Sharh al-Mahalli ma'a Haashiyat Qalyoobi wa 'Umayrah, 3/208.
You can see that there is no text concerning this matter, rather it is the ijtihaad of the fuqaha' which they based on these interests, which differ from one person to another, and from one type of relationship to another. A man may decide to marry a relative so as to protect her and honour her family, or she may be religiously committed and of good character.
The basic principle is that marriage is permissible. The Prophet (peace and blessings of Allaah be upon him) married Zaynab bint Jahsh who was the daughter of his paternal aunt, and he gave his daughter Zaynab in marriage to Abu'l-'Aas who was the son of her maternal aunt, and 'Ali married Faatimah, and he was the son of her father's paternal uncle.
Shaykh Ibn 'Uthaymeen (may Allaah have mercy on him) said, after quoting the reasons that the fuqaha' gave, of seeking good characteristics in the children and the fear of severing the ties of kinship:
What they said is true, but if there is someone among the relatives who is better in terms of other considerations (such as religious commitment, lineage and beauty), then that is better. In the event that they are equal in these terms, then a non-relative is better.
So if a female cousin is religiously committed and of good character, and he is in a weak position and needs kindness and support, then undoubtedly such a marriage serves a great interest. A man should pay attention to his interests in this case. There is no shar'i text concerning this matter that has to be followed, hence a person should do what he thinks is in his best interests. End quote from al-Sharh al-Mumti', 5/123.
The scholars of the Standing Committee were asked about marrying relatives and whether that causes retardation in the children.
They replied: There are no saheeh ahaadeeth which forbid marriage to relatives. The incidence of retardation happens by the will and decree of Allaah and is not caused by marriage to relatives as is widely believed. End quote.
Fataawa al-Lajnah al-Daa'imah, 18/13
And Allaah knows best.
She was raped when she was small; should she tell her fiancé?
Ruling on marrying an impotent man
Ruling on one who says that the poverty of Muslims is because they have too many children
Ruling on divorce at a moment of anger
Can she masturbate if her husband cannot satisfy her desire?
She sees a dry brownish-reddish spot a few days before her period
Making du'aa' after the obligatory prayers is bid'ah
How to pray and fast in countries where the day or night is continuous


text:
Q: Single class library project for .NET and .NET Core projects Is it possible to create a simple class library project with Visual Studio that can get referenced by both .NET and .NET core projects?
I tried creating a class library project (a project for creating a class library that targets .net standard and .net core) but it wouldn't let me add as a reference to the .net project.
I then created a class library for .NET framework (A project for creating a C# class library .dll), which I could add as a reference to both projects but failed to run on linux os.
The only nugget package I've included on the common project is Newtonsoft.Json (13.0.1)
Solution Properties:

*

*.NET framework project: 4.5 (WebAPI)

*.NET core project: 5.0 (MVC razor)

*.NET framework class library: 4.5

A: I fixed the problem by recreating the .NET project with .NET framework 4.7.2 (references wouldn't load properly by just changing the version), and also recreating the common library using .NET standard 2.0.
Thanks for the help cjb110 and Llama.


Kaylen Anderson and Brandon Carlsness have been recently selected to partner with North St. Louis County Habitat for Humanity (NSLCHFH) for the 2015 building season. The Ely, MN Habitat for Humanity home building project is scheduled to start in the summer of 2015.
Kaylen and Brandon are no strangers to the ups and downs of life. However, their story really starts after moving to Ely to surround themselves with the positive influences in their lives that the community has to offer.
Because Kaylen and Brandon met the Habitat criteria to partner with Habitat, their friend, Debbie Hultman, encouraged them to apply for a Habitat home. They had applied for the Habitat program the year before but were turned down and encouraged to fix some things on their application and to reapply. With Debbie's encouragement and some work on their credit they decided to apply once more.
Welcome to the Habitat family Anderson-Carlsness family!


text:
Doulas: Not Just for Hippie Moms
Doulas aren't just for holistic, wheatgrass-drinking, and yoga-loving moms anymore. Find out why there has a been a rise in the popularity of doulas through the years.
By Dina Roth Port
You may think the only women who hire doulas are the crunchy-granola types, but that's not the case: It seems more and more women are hiring doulas these days. Although it's difficult to say how many certified (and noncertified) doulas there are, the number has increased within the past decade. According to DONA International, one of the oldest and largest doula associations in the world, more than 4,000 birth and postpartum doulas are currently certified, though more than 6,500 birth and postpartum doulas have been certified to date -- which is more than triple the number certified in 2002. Why do an increasing number of women want to have doulas? "Once women learned there was someone out there to help them achieve the most satisfying birth experience that they could, they wanted to seek that kind of support," says Sunday Tortelli, president of DONA and a birth doula in Cleveland. Here are four reasons our society has embraced doulas more through the years.
Put Together Your Ideal Birth Plan
We Are More Open-Minded About Doulas
This isn't the 1960s anymore, and lifestyle choices that were once considered hippie-dippy or alternative (health food, yoga, living "green," doulas, natural birth) are now more common and accepted by our culture. "Although doulas are available to work with women from all subsets of society, most of them are hired privately. But there are some community-based doula programs, grant programs and volunteer programs that provide services to women of limited means," Tortelli says. "There's no limitation to which types of families want to work with a doula. Women planning homebirths, with absolutely no medical interventions use doulas. So do women who went through assisted reproduction, who have complicated or high-risk pregnancies, who plan to use epidurals for pain relief, and who schedule an induction or cesareans," Tortelli says. "Women exploring every birth and postpartum option have sought the services of a doula."
Elizabeth Pondelik, of Rocky River, Ohio, a mother of three girls, agrees. "I don't consider myself 'crunchy,' especially when it comes to medicine," she says. "I was a kindergarten teacher before having my girls, and my husband is a very analytically minded chemist. We live a stereotypical suburban lifestyle, we don't buy organic, and our kids are fully vaccinated. But we decided to hire a doula after our first birth didn't go as expected, and we felt that a doula could help us have a more pleasant experience the second time around." And Pondelik says she isn't the only one who feels that way. "I have even met several labor and delivery nurses who chose to hire doulas after seeing how much help doulas gave their patients," she says.
You've Got a Doctor, So Why Get a Doula?
We See Increased Media Coverage on Doulas
"Thanks to the explosion of information available in the media and online, doulas are now depicted as a typical part of the childbirth experience," Tortelli says. There's no question that we're exposed to nearly every type of media these days and we consume it in different ways. We download movies in an instant and watch them on mobile devices, and we have access to hundreds of TV channels, all of which can teach us different aspects about society that we might not have known anything. Doulas are no exception -- they have been mentioned by TV characters and celebrities on reality shows (A Baby Story, The Rachel Zoe Project), scripted shows (Bones, The Gilmore Girls), and talk shows (Chelsea Lately, Today).
In 2008 Nicole Kidman appeared on Oprah and mentioned having a doula for the birth of her first daughter, Sunday Rose, with husband Keith Urban. Pop culture and mainstream news sites such as People, The Huffington Post, and the Celebrity Baby Scoop blog reported the news. These sites have also written about the rise of doulas and profiled other celebrities sharing their doula experiences. Actress-turned-talk-show-host Ricki Lake helped give doulas more exposure and a big publicity boost in her documentaries The Business of Being Born and More Business of Being Born, which featured celebrities such as Cindy Crawford, Kimberly Williams-Paisley, Gisele B?ndchen, and Christy Turlington Burns talking about doulas. Since the original film debuted at the 2008 Tribeca Film Festival, more than 3 million people have seen it, while more than a million have viewed the 2012 four-part More Business sequel.
We Admire Celebrities Who Love Doulas
It's no secret that A-listers have a huge influence on what becomes popular, including fashion trends and baby names. Latham Thomas, a labor support doula in New York City and founder of Mama Glow (mamaglow.com) who worked with fashion designer Rebecca Minkoff and actress Tamera Mowry, believes that women are certainly influenced by fanous names who have embraced doulas. "It seems having a doula is now the chic addition to your birth team," Thomas explains. "I get calls from all types of women who have heard about doulas but want to learn more." Media coverage of an actress's doula helps get the word out, which can appeal to women who admire the celebrities and want to be friends with them. So if Alyson Hannigan (who some moms would totally want to connect with!) had a doula, it seems like something they should consider, too. There's also the glamour factor -- knowing that Nicole Kidman hired a doula certainly makes it seem appealing to women who want to emulate a high-profile lifestyle. After all, we buy clothing, perfumes, and other products promoted by celebs, so why not hire doulas like they do, too?
Celebrities Who Love Doulas
Pregnancy Advice From a Doula Latham Thomas
We Have Scientific Proof of Doula Benefits
In the past decade or so, multiple studies have discovered that including doulas as part of the birth experience can be beneficial for women. A 2013 study published in the American Journal of Public Health revealed that when women had continuous doula support during labor, they were 40 percent less likely to need a C-section. As a result, labor takes less time, and that, in turn, reduces the need for medication such as epidural anesthesia, analgesics, and Pitocin, and the use of forceps or vacuum extraction. According to a 2009 study in the Journal of Obstetric, Gynecologic, and Neonatal Nursing, moms who hire doulas are more likely to have their breast milk come in within 72 hours after delivery; they are also more likely to still be breastfeeding at 6 weeks, compared with new moms who didn't opt for doula support.
Still another study, published in the 1999 Journal of Women's Health and Gender Based Medicine, showed that women with doula support have a reduced chance of experiencing postpartum depression. (And all these benefits could lead to financial savings in the long run.) As more studies come out that reveal the beneficial aspects of doulas, more families will consider hiring one. "A couple I worked with said that as they researched their options for labor and birth, they knew they wanted a safe birth with as few interventions as possible and they wanted the ability to breastfeed immediately after birth, with no mother-baby separation," Tortelli says. "When they learned that a doula could help them achieve their goals, they knew that hiring one was the right decision."
Can Hiring a Doula Save You Money?
Your Prenatal Health: Essential Vitamins and Lotions
Copyright © 2014 Meredith Corporation.
All content on this Web site, including medical opinion and any other health-related information, is for informational purposes only and should not be considered to be a specific diagnosis or treatment plan for any individual situation. Use of this site and the information contained herein does not create a doctor-patient relationship. Always seek the direct advice of your own doctor in connection with any questions or issues you may have regarding your own health or the health of others.
Popular in Doula
This Hospital's Co-Sleeping Maternity Bed is a Game-Changer for New Moms
Could Getting a Doula Save You Money?
How to Make Your Hospital Stay Not Suck When You Give Birth
A Doula Delivery
What Dads Need to Know About Doulas
The Perfect Labor and Delivery Nurse Gift
Why This Mama Worked Out in the Delivery Room
Doulas 101: What Is a Doula?
Why One Mom & Her Doula Are Calling C-Sections 'Belly Births'
This Video of a Woman Giving Birth in a Stream Has Over 76 Million Views
You Have a Doctor, So Why Get a Doula?
Is Anal Sex Safe During Pregnancy?
How to Prepare for Birth: Top Tips From a Doula
You Will Want to Stock Up On This Postpartum Mesh Underwear
Model Belle Lucia Hits Back at People Calling Her 4-Month Baby Bump 'Unhealthy'
Why This Mom's Home Birth Wouldn't Have Been the Same Without Her Corgi
Should You Hire a Postpartum Doula?
9 Natural Stretch Mark Treatments That Have Science to Back Them Up
How Much Do Doulas Cost?
All Topics in Doula
Home Birth
Preparing for Labor
Labor Support


text:
Mobile Operators & Internet Tech	• 16 Jul 2020
Vodacom launches Google Play Store data bundles
By Megan Ellis
Read nextPrimedia Group announces restructuring and job cuts
Vodacom has announced that it is launching Google Play Store data bundles for customers.
These bundles will offer data at a cheaper rate than regular bundles, specifically for use on the Google Play Store.
According to Vodacom, it's the first mobile provider to enter this type of partnership with Google Play.
"We're extremely proud to be the first telco in the world to offer Google Play Store bundles, enabling our customers to connect to the apps they love on the Google Play Store on the Vodacom network," Zunaid Mahomed, Vodacom's Group Digital and Fixed Officer, said in a statement.
"As we continue our pricing transformation journey, we have set our sights on reducing the barriers to access the Google Play Store by introducing bundles that will simplify the process for consumers and translate to savings in data spend in the process."
The bundles let users browse the store and download or update apps without using their regular data allocation. Meanwhile, cheaper data rates mean that customers can keep their apps up-to-date without spending as much money as they normally would have to.
However, the bundles are valid for a limited time depending on their size. The smallest bundle is valid for one day, while the largest lasts 30 days.
Google Play Store data prices for Vodacom
You can see prices for Vodacom's new Google Play data bundles below:
Customers can buy these Vodacom data bundles by sending an SMS with "Googleplaystore" to 31118 and selecting a bundle.
Feature image: Andy Walker/Memeburn
Megan Ellis
Megan has been writing about technology since 2016, but takes pride in being a life-long technophile and nerd. She holds two post-graduate qualifications - a BJourn in New Media and BA Hons in Linguistics.
Posted in Mobile Operators & Internet Tech, NewsTagged Android, bundles, buy data, Google Play Store, update apps, vodacom, vodacom data
Primedia Group announces restructuring and job cuts
Advertising and Media • 17 Jul 2020
Netflix will add a new original movie every week in 2021
If you were worried about not having enough content to watch in 2021, Netflix has announced that it will release a new original movie…
Megan Ellis Streaming • 13 Jan 2021


text:
package org.apache.derbyTesting.functionTests.tests.largedata;

import java.sql.*;
import java.io.*;

import org.apache.derby.tools.ij;
import org.apache.derby.tools.JDBCDisplayUtil;

/**
* This test is part of the "largedata" suite because this test tests data for
* lobs to the limits ( ie blob and clob can be 2G-1 maximum) and so this test
* may take considerable disk space as well as time to run. Hence it is not part
* of the derbyall suite but should ideally be run at some intervals to test if
* no regression has occurred.
*/

public class LobLimits {

   static boolean trace = false;
   static final int _2GB = 2 * 1024 * 1024* 1024 - 1;
   static final int _100MB = 100 * 1024 * 1024;
   static final int MORE_DATA_THAN_COL_WIDTH= (_100MB)+1;
   static final int NUM_TRAILING_SPACES = 33*1024;

   static PreparedStatement insertBlob = null;
   static PreparedStatement selectBlob = null;
   static PreparedStatement insertClob = null;
   static PreparedStatement selectClob = null;
   static PreparedStatement deleteBlob = null;
   static PreparedStatement deleteClob = null;
   static PreparedStatement insertBlob2 = null;
   static PreparedStatement selectBlob2 = null;
   static PreparedStatement insertClob2 = null;
   static PreparedStatement selectClob2 = null;
   static PreparedStatement deleteBlob2 = null;
   static PreparedStatement deleteClob2 = null;

   static final String DATAFILE = "byteLobLimits.dat";

   static final String CHARDATAFILE = "charLobLimits.txt";

   /**
    * setup prepared statements and schema for the tests
    * @param conn
    * @throws SQLException
    */
   private void setup(Connection conn) throws SQLException {
       System.out.println("-----------------------------------");
       System.out.println(" START setup");

       conn.setAutoCommit(true);
       // Create a test table.
       Statement s = conn.createStatement();
       try {
           s.execute("DROP TABLE BLOBTBL");
       } catch (Exception e) {
       }
       try {
           s.execute("DROP TABLE CLOBTBL");
       } catch (Exception e) {
       }
       try {
           s.execute("DROP TABLE BLOBTBL2");
       } catch (Exception e) {
       }
       try {
           s.execute("DROP TABLE CLOBTBL2");
       } catch (Exception e) {
       }

       s.execute("CREATE TABLE BLOBTBL (ID INT NOT NULL PRIMARY KEY, "
               + "POS BIGINT, DLEN BIGINT, CONTENT BLOB(2G))");

       insertBlob = conn
               .prepareStatement("INSERT INTO BLOBTBL values (?,?,?,?)");

       s.execute("CREATE TABLE CLOBTBL (ID INT NOT NULL PRIMARY KEY,"
               + "POS BIGINT, DLEN BIGINT, CONTENT CLOB(2G))");

       insertBlob = conn
               .prepareStatement("INSERT INTO BLOBTBL values (?,?,?,?)");
       selectBlob = conn
               .prepareStatement("SELECT CONTENT,DLEN FROM BLOBTBL WHERE ID = ?");

       insertClob = conn
               .prepareStatement("INSERT INTO CLOBTBL values (?,?,?,?)");

       selectClob = conn
               .prepareStatement("SELECT CONTENT,DLEN FROM CLOBTBL WHERE ID = ?");

       deleteBlob = conn.prepareStatement("DELETE FROM BLOBTBL");
       deleteClob = conn.prepareStatement("DELETE  from CLOBTBL");

       s.execute("CREATE TABLE BLOBTBL2 (ID INT NOT NULL PRIMARY KEY, "
               + "POS BIGINT, CONTENT BLOB("+_100MB+"),DLEN BIGINT)");

       insertBlob2 = conn
               .prepareStatement("INSERT INTO BLOBTBL2 values (?,?,?,?)");

       // Please dont change the clob column width,since tests use this width to
       // test for truncation of trailing spaces.
       s.execute("CREATE TABLE CLOBTBL2 (ID INT NOT NULL PRIMARY KEY,"
               + "POS BIGINT, CONTENT CLOB("+_100MB+"), DLEN BIGINT)");

       insertBlob2 = conn
               .prepareStatement("INSERT INTO BLOBTBL2 values (?,?,?,?)");
       selectBlob2 = conn
               .prepareStatement("SELECT CONTENT,DLEN FROM BLOBTBL2 WHERE ID = ?");

       insertClob2 = conn
               .prepareStatement("INSERT INTO CLOBTBL2 values (?,?,?,?)");

       selectClob2 = conn
               .prepareStatement("SELECT CONTENT,DLEN FROM CLOBTBL2 WHERE ID = ?");
       System.out.println("-----------------------------------");
       System.out.println(" END setup");

       deleteBlob2 = conn.prepareStatement("DELETE FROM BLOBTBL2");
       deleteClob2 = conn.prepareStatement("DELETE  from CLOBTBL2");
       System.out.println("-----------------------------------");
       System.out.println(" END setup");

   }

   /**
    * Create an instance of this class and do the test.
    */
   public static void main(String[] args) {
       //trace = Boolean.getBoolean("trace");
       new LobLimits().runTests(args);

   }

   /**
    * Create a JDBC connection using the arguments passed in from the harness,
    * and then run the LOB tests.
    *
    * @param args
    *            Arguments from the harness.
    */
   public void runTests(String[] args) {
       Connection conn = null;
       try {

           // use the ij utility to read the property file and
           // make the initial connection.
           ij.getPropertyArg(args);
           conn = ij.startJBMS();

           // do the initial setup,drop and create tables
           // prepare stmts
           setup(conn);

           conn.setAutoCommit(false);

           clobTests(conn);
           blobTests(conn);
           //cleanup
           cleanup(conn);
       } catch (Exception e) {
           System.out.println("FAIL -- Unexpected exception:");
           e.printStackTrace(System.out);
       }
   }

   /**
    * Close all prepared statements and connection
    * @param conn
    * @throws Exception
    */
   private void cleanup(Connection conn) throws Exception {
       insertBlob.close();
       selectBlob.close();
       selectClob.close();
       insertClob.close();
       deleteClob.close();
       deleteBlob.close();
       insertBlob2.close();
       selectBlob2.close();
       selectClob2.close();
       insertClob2.close();
       deleteBlob2.close();
       deleteClob2.close();
       conn.close();
       new File(DATAFILE).delete();
       new File(CHARDATAFILE).delete();
   }

   /**
    * tests specific for blobs
    * @param conn
    * @throws Exception
    */
   private static void blobTests(Connection conn) throws Exception {

       try {
           // Test - 2Gb blob ( actually it is 2gb -1)
           // Note with setBinaryStream interface the maximum size for the
           // stream, can be max value for an int.
           // Also note, that lobs in derby currently  supports
           // maximum size of 2gb -1

           // first do insert blob of 2g, 2 rows
           insertBlob_SetBinaryStream("BlobTest #1", conn, insertBlob, _2GB,
                   0, 2, _2GB);
           // do a select to see if the inserts in test above went ok
           selectBlob("BlobTest #2", conn, selectBlob, _2GB, 0, 1);
           selectBlob("BlobTest #3", conn, selectBlob, _2GB, 1, 1);

           // now do a select of one of the 2gb rows and update another 2g row
           // using the setBlob api, updated blob is of length 2gb
           // Fix for Bug entry -DERBY-599[setBlob should not materialize blob
           // into memory]
           selectUpdateBlob("BlobTest #4",conn,selectBlob,_2GB,0,1,1);
           // select row from blobtbl and then do insert into the blobtbl
           // using setBlob
           selectInsertBlob("BlobTest #4.1",conn,selectBlob,insertBlob,_2GB,0,3,1);

           // Test - generate random data, write to a file, use it to insert
           // data into blob and then read back and compare if all is ok
           // currently in fvt ( derbyall), tests check for substrings etc and
           // for small amounts of data.  This test will test for 100mb of blob data

           FileOutputStream fos = new FileOutputStream(DATAFILE);
           RandomByteStream r = new RandomByteStream(new java.util.Random(),
                   _100MB);
           // write in chunks of 32k buffer
           byte[] buffer = new byte[32 * 1024];
           int count = 0;

           while((count=r.read(buffer))>=0)
               fos.write(buffer,0,count);

           fos.flush();
           fos.close();

           insertBlob2("BlobTest #5.1 ", conn, insertBlob2, _100MB, 0, 1,
                   _100MB, DATAFILE);
           selectBlob2("BlobTest #5.2 ", conn, selectBlob2, _100MB, 0, 1,
                   DATAFILE);

           // update the 2gb row in blobtbl with the 100mb data and compare if the update
           // went ok.
           selectUpdateBlob2("BlobTest #6",conn,selectBlob2,selectBlob,_100MB,0,1,1,DATAFILE);

           deleteTable(conn, deleteBlob2, 1);

       } catch (Exception e) {
           System.out.println("FAIL -- Unexpected exception:");
           e.printStackTrace(System.out);
       }

       conn.commit();

       deleteTable(conn, deleteBlob, 3);

       // Negative Test, use setBlob api to insert a 4GB blob.
       long _4GB =  4*1024*1024*(1024L);
       BlobImpl _4GbBlob = new BlobImpl(new RandomByteStream(new java.util.Random(),_4GB),_4GB);

       try
       {
           insertBlob_SetBlob("BlobTest #7 (setBlob with 4Gb blob",conn,insertBlob,_4GbBlob,
                   _4GB,0,1,0);
       }
       catch(SQLException sqle)
       {
           System.out.println("DERBY DOES NOT SUPPORT INSERT OF 4GB BLOB ");
           expectedException(sqle);
       }
       // ADD  NEW TESTS HERE
   }

   /**
    * tests using clobs
    * @param conn
    * @throws Exception
    */
   private static void clobTests(Connection conn) throws Exception {
       try {
           // Test - 2Gb blob
           // Note with setCharacterStream interface the maximum size for the
           // stream has to be max value for a int which is (2GB -1 )
           // first do insert clob of 2g, 2 rows
           insertClob_SetCharacterStream("ClobTest #1", conn, insertClob,
                   _2GB, 0, 2, _2GB);
           // do a select to see if the inserts in test above went ok
           selectClob("ClobTest #2", conn, selectClob, _2GB, 0, 1);
           selectClob("ClobTest #3", conn, selectClob, _2GB, 0, 1);
           // do a select and then update a row of 2gb size: uses getClob
           selectUpdateClob("ClobTest #4",conn,selectClob,_2GB,0,1,1);

           // Test - generate random data, write to a file, use it to insert
           // data into clob and then read back and compare if all is ok
           // currently in fvt ( derbyall), tests check for substrings etc and
           // for small amounts of data.  This test will test for 100mb of clob data
           writeToFile(CHARDATAFILE,new RandomCharReader(new java.util.Random(),_100MB));
           insertClob2("ClobTest #5.1 ", conn, insertClob2, _100MB, 0, 1,
                   _100MB, CHARDATAFILE);
           selectClob2("ClobTest #5.2 ", conn, selectClob2, _100MB, 0, 1,
                   CHARDATAFILE);

           // Disabled for now, this will materialize, will open
           // jira for it.
           //updateClob2("ClobTest #8.1",conn,selectClob,_100MB,0,0,10,1,CHARDATAFILE);

           // update the 2gb row in clobtbl with the 100mb data and compare if the update
           // went ok.
           selectUpdateClob2("ClobTest #8.2",conn,selectClob2,selectClob,_100MB,0,1,1,CHARDATAFILE);

           // test for trailing space truncation
           // insert 100mb+33k of data which has 33k of trailing space,
           // into a column of 100mb
           // insert should be successful, select should retrieve 100mb of data

           // Generate random data and write to a file, this file will be used
           // in the verification process after inserts and updates.
           writeToFile(CHARDATAFILE,new RandomCharReader(new java.util.Random(),
                   (NUM_TRAILING_SPACES +_100MB),NUM_TRAILING_SPACES));
           insertClob2("ClobTest #6.1 ", conn, insertClob2,_100MB, 3, 1,
                   (NUM_TRAILING_SPACES +_100MB), CHARDATAFILE);
           // select will retrieve data and verify the data inserted.
           selectClob2("ClobTest #6.2 ", conn, selectClob2, _100MB, 3, 1,
                   CHARDATAFILE);

           negativeSpaceTruncationTest("ClobTest #7",conn);

           // Test - for stream contains a trailing non-space character
           // insert should throw an error
           writeToFile(CHARDATAFILE,new RandomCharReader(new java.util.Random(),MORE_DATA_THAN_COL_WIDTH));
           try
           {
               insertClob2("ClobTest #9.1 ", conn, insertClob2,MORE_DATA_THAN_COL_WIDTH, 4, 1,
                       MORE_DATA_THAN_COL_WIDTH, CHARDATAFILE);
           }catch(SQLException sqle)
           {
               System.out.println("NEGATIVE TEST - Expected Exception: truncation of non-blanks not allowed");
               expectedException(sqle);
           }
           // no row must be retrieved.
           selectClob2("ClobTest #9.2 ", conn, selectClob2, _100MB, 4, 0,
                   CHARDATAFILE);

           try
           {
               insertClob2("ClobTest #10 ", conn, insertClob2,MORE_DATA_THAN_COL_WIDTH, 4, 1,
                       MORE_DATA_THAN_COL_WIDTH +1 , CHARDATAFILE);
           }catch(SQLException sqle)
           {
               System.out.println("NEGATIVE TEST - Expected Exception: truncation of non-blanks not allowed and"+
                       " stream length is one greater than actual length of the stream ");
               expectedException(sqle);
           }

           try
           {
               insertClob2("ClobTest #11 ", conn, insertClob2,MORE_DATA_THAN_COL_WIDTH, 4, 1,
                       MORE_DATA_THAN_COL_WIDTH -1 , CHARDATAFILE);
           }catch(SQLException sqle)
           {
               System.out.println("NEGATIVE TEST - Expected Exception: truncation of non-blanks not allowed and"+
                       " stream length is one less than actual length of the stream ");
               expectedException(sqle);
           }
           deleteTable(conn, deleteClob2, 2);
       } catch (Exception e) {
           System.out.println("FAIL -- Unexpected exception:");
           e.printStackTrace(System.out);
       }

       try {
           // give -ve streamlength
           insertClob_SetCharacterStream("ClobTest #12.1", conn, insertClob,
                   _100MB, 4, 1, -1);
       } catch (SQLException sqle) {
           System.out.println("NEGATIVE TEST - Expected Exception:");
           expectedException(sqle);
       }

       selectClob("ClobTest #12.2", conn, selectClob,_100MB, 4, 0);

       deleteTable(conn, deleteClob, 2);

       // Negative tests use the setClob API to insert a 4GB clob

       long _4GB =  4*1024*1024*(1024L);

       ClobImpl _4GBClob = new ClobImpl(new RandomCharReader(new java.util.Random(),_4GB),_4GB);

       try
       {
           insertClob_SetClob("ClobTest #13 (setClob with 4Gb clob",conn,insertClob,_4GBClob,
                   _4GB,0,1,0);
       }
       catch(SQLException sqle)
       {
           System.out.println("DERBY DOES NOT SUPPORT INSERT OF 4GB CLOB ");
           expectedException(sqle);
       }

       // ADD NEW TESTS HERE
   }

   private static void negativeSpaceTruncationTest(String msg,Connection conn)
       throws Exception
   {
       // Negative test, stream has trailing spaces but the stream length is one
       // more than the actual length of the stream
       try
       {
           insertClob2(msg, conn, insertClob2,_100MB, 4, 1,
               (NUM_TRAILING_SPACES +_100MB - 1), CHARDATAFILE);
       }catch(SQLException sqle)
       {
           System.out.println("EXPECTED EXCEPTION - stream has trailing spaces,but stream "+
                   " length is 1 less than actual length of stream");
           expectedException(sqle);
       }

       try
       {
           insertClob2(msg, conn, insertClob2,_100MB, 5, 1,
               (NUM_TRAILING_SPACES +_100MB + 1), CHARDATAFILE);
       }catch(SQLException sqle)
       {
           System.out.println("EXPECTED EXCEPTION - stream has trailing spaces,but stream "+
                   " length is 1 greater than actual length of stream");
           expectedException(sqle);
       }
   }

   /**
    * insert blob
    * @param bloblen   length of blob to insert
    * @param start     start id value for insert
    * @param rows      insert rows number of rows
    * @param streamLength  stream length passed to setBinaryStream(,,length)
    */
   private static void insertBlob_SetBinaryStream(String testId,
           Connection conn, PreparedStatement ps, int bloblen, int start,
           int rows, int streamLength) throws SQLException {
       System.out.println("========================================");
       System.out.println("START " + testId + "insertBlob of size = "
               + bloblen);
       long ST = 0;
       if (trace)
           ST = System.currentTimeMillis();

       int count = 0;
       java.util.Random random = new java.util.Random();
       for (int i = start; i < start + rows; i++) {
           ps.setInt(1, i);
           ps.setInt(2, 0);
           ps.setLong(3, bloblen);
           ps.setBinaryStream(4, new RandomByteStream(random, bloblen),
                   streamLength);
           count += ps.executeUpdate();
       }
       conn.commit();
       if (trace) {
           System.out.println("Insert Blob (" + bloblen + ")" + " rows= "
                   + count + " = " + (long) (System.currentTimeMillis() - ST));

       }
       verifyTest(count, rows, " Rows inserted with blob of size (" + bloblen
               + ") =");
       System.out.println("========================================");

   }

   /**
    * insert blob, using a setBlob api.
    * @param bloblen
    *            length of blob to insert
    * @param blob
    *            blob to insert
    * @param start
    *            start id value for insert
    * @param rows
    *            insert rows number of rows
    * @param expectedRows
    *            rows expected to be inserted
    */
    private static void insertBlob_SetBlob(String testId, Connection conn,
            PreparedStatement ps, java.sql.Blob blob, long bloblen, int start,
            int rows, int expectedRows) throws SQLException {
        System.out.println("========================================");
        System.out.println("START " + testId + "insertBlob of size = "
                + bloblen);
        long ST = 0;
        if (trace)
            ST = System.currentTimeMillis();
        int count = 0;

        try {

            for (int i = start; i < start + rows; i++) {
                ps.setInt(1, i);
                ps.setInt(2, 0);
                ps.setLong(3, bloblen);
                ps.setBlob(4, blob);
                count += ps.executeUpdate();
            }
            conn.commit();
            if (trace) {
                System.out.println("Insert Blob (" + bloblen + ")" + " rows= "
                        + count + " = "
                        + (long) (System.currentTimeMillis() - ST));

            }
        } catch (SQLException e) {
            verifyTest(count, expectedRows,
                    " Rows inserted with blob of size (" + bloblen + ") =");
            System.out.println("========================================");
            throw e;
        }

        verifyTest(count, expectedRows,
                " Rows inserted with blob of size (" + bloblen + ") =");
        System.out.println("========================================");

    }

   /**
    * select from blob table (BLOBTBL)
    * @param bloblen  select expects to retrieve a blob of this length
    * @param id       id of the row to retrieve
    * @param expectedRows  number of rows expected to match id
    */
   private static void selectBlob(String testId, Connection conn,
           PreparedStatement ps, int bloblen, int id, int expectedRows)
           throws SQLException {
       System.out.println("========================================");
       System.out.println("START " + testId + " - SELECT BLOB of size = "
               + bloblen);

       long ST = 0;
       ResultSet rs = null;

       if (trace)
           ST = System.currentTimeMillis();

       int count = 0;
       ps.setInt(1, id);
       rs = ps.executeQuery();

       while (rs.next()) {
           count++;
           Blob value = rs.getBlob(1);
           long l = value.length();
           long dlen = rs.getLong(2);
           if (dlen != l) {
               System.out.println("FAIL - MISMATCH LENGTHS GOT " + l
                       + " expected " + dlen + " for row in BLOBTBL with ID="
                       + id);
           }
       }
       conn.commit();

       verifyTest(count, expectedRows,
               "Matched rows selected with blob of size(" + bloblen + ") =");

       if (trace) {
           System.out.println("Select Blob (" + bloblen + ")" + " rows= "
                   + expectedRows + " = "
                   + (long) (System.currentTimeMillis() - ST));
       }
       System.out.println("========================================");
   }

   /**
    * insert blob into BLOBTBL2
    * @param bloblen   length of blob to insert
    * @param start     id value for insert
    * @param rows      insert rows number of rows
    * @param streamLength  stream length passed to setBinaryStream(,,length)
    * @param file      filename to match retrieved data against
    */

   private static void insertBlob2(String testId, Connection conn,
           PreparedStatement ps, int bloblen, int start, int rows,
           int streamLength, String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + "insert Blob of size = "
               + bloblen);
       int count = 0;
       java.util.Random random = new java.util.Random();
       FileInputStream fis = null;

       long ST = 0;
       if (trace)
           ST = System.currentTimeMillis();

       for (int i = start; i < start + rows; i++) {
           fis = new FileInputStream(file);
           ps.setInt(1, i);
           ps.setInt(2, 0);
           ps.setLong(4, bloblen);
           ps.setBinaryStream(3, fis, streamLength);
           count += ps.executeUpdate();
           fis.close();
       }
       conn.commit();
       if (trace) {
           System.out.println("Insert Blob (" + bloblen + ")" + " rows= "
                   + count + " = " + (long) (System.currentTimeMillis() - ST));

       }
       verifyTest(count, rows, " Rows inserted with blob of size (" + bloblen
               + ") =");
       System.out.println("========================================");

   }

   /**
    * select from blob table (BLOBTBL2)
    * @param bloblen  select expects to retrieve a blob of this length
    * @param id       id of the row to retrieve
    * @param expectedRows  number of rows expected to match id
    * @param file  name of the file,against which the retrieved data is
    *              compared
    */
   private static void selectBlob2(String testId, Connection conn,
           PreparedStatement ps, int bloblen, int id, int expectedRows,
           String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - SELECT BLOB of size = "
               + bloblen);

       long ST = 0;
       ResultSet rs = null;

       if (trace)
           ST = System.currentTimeMillis();

       int count = 0;
       ps.setInt(1, id);
       rs = ps.executeQuery();

       while (rs.next()) {
           count++;
           Blob value = rs.getBlob(1);
           long l = value.length();
           long dlen = rs.getLong(2);
           if (dlen != l) {
               System.out.println("FAIL - MISMATCH LENGTHS GOT " + l
                       + " expected " + dlen + " for row in BLOBTBL with ID="
                       + id);
           } else
               compareBlobToFile(value.getBinaryStream(), file);
       }
       conn.commit();

       verifyTest(count, expectedRows,
               "Matched rows selected with blob of size(" + bloblen + ") =");

       if (trace) {
           System.out.println("Select Blob (" + bloblen + ")" + " rows= "
                   + expectedRows + " = "
                   + (long) (System.currentTimeMillis() - ST));
       }
       System.out.println("========================================");
   }

   /**
    * Basically this test will do an update using setBlob api -
    * select row from blobtbl and then update a row in blobtbl
    * and verify updated data in blobtbl
    * @param    ps  select statement from which blob is retrieved
    * @param    bloblen updating value is of length bloblen
    * @param    id  id of the row retrieved, for the update
    * @param    updateId  id of the row that is updated
    * @param    expectedRows    to be updated
    */
   private static void selectUpdateBlob(String testId, Connection conn,
           PreparedStatement ps, int bloblen, int id, int updateId,
           int expectedRows) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then update blob of size= "
               + bloblen + " - Uses getBlob api");

       ResultSet rs = null;

       ps.setInt(1, id);
       rs = ps.executeQuery();
       rs.next();
       Blob value = rs.getBlob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in BLOBTBL with ID=" + id);
       }

       PreparedStatement psUpd = conn
               .prepareStatement("update BLOBTBL set content=?,dlen =? where id = ?");
       psUpd.setBlob(1,value);
       psUpd.setLong(2, l);
       psUpd.setInt(3, updateId);

       System.out.println("Rows Updated = " + psUpd.executeUpdate());
       conn.commit();

       // now select and verify that update went through ok.
       ps.setInt(1, updateId);
       ResultSet rs2 = ps.executeQuery();
       rs2.next();
       Blob updatedValue = rs2.getBlob(1);

       if(updatedValue.length() != l)
           System.out.println("FAIL - Retrieving the updated blob length does not match "+
                   "expected length = "+l +" found = "+ updatedValue.length());

       // close resultsets
       conn.commit();
       rs.close();
       rs2.close();
       psUpd.close();
       System.out.println("========================================");
   }

   /**
    * Basically this test will do an insert using setBlob api -
    * select row from blobtbl and then insert a row in blobtbl
    * and verify updated data in blobtbl
    * @param    ps  select statement from which blob is retrieved
    * @param    bloblen updating value is of length bloblen
    * @param    id  id of the row retrieved, for the update
    * @param    insertId  id of the row that is inserted
    * @param    expectedRows    to be updated
    */
   private static void selectInsertBlob(String testId, Connection conn,
           PreparedStatement ps,PreparedStatement ins, int bloblen, int id, int insertId,
           int expectedRows) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then insert blob of size= "
               + bloblen + " - Uses getBlob api to do select and setBlob for insert");

       ResultSet rs = null;

       ps.setInt(1, id);
       rs = ps.executeQuery();
       rs.next();
       Blob value = rs.getBlob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in BLOBTBL with ID=" + id);
       }

       ins.setInt(1,insertId);
       ins.setInt(2,0);
       ins.setLong(3,l);
       ins.setBlob(4,value);

       System.out.println("Rows Updated = " + ins.executeUpdate());
       conn.commit();

       // now select and verify that update went through ok.
       ps.setInt(1, insertId);
       ResultSet rs2 = ps.executeQuery();
       rs2.next();
       Blob insertedValue = rs2.getBlob(1);

       if(insertedValue.length() != l)
           System.out.println("FAIL - Retrieving the updated blob length does not match "+
                   "expected length = "+l +" found = "+ insertedValue.length());

       // close resultsets
       conn.commit();
       rs.close();
       rs2.close();
       System.out.println("========================================");
   }

   /**
    * Basically this test will do an update using setBinaryStream api and verifies the
    * updated data.  select row from blobtbl2 and then update a row in blobtbl
    * and verify updated data in blobtbl
    * @param    bloblen updating value is of length bloblen
    * @param    id  id of the row retrieved, for the update
    * @param    updateId  id of the row that is updated
    * @param    expectedRows    to be updated
    * @param file  name of the file,against which the updated data is
    *              compared
    */
   private static void selectUpdateBlob2(String testId, Connection conn,
           PreparedStatement ps,PreparedStatement sel,int bloblen, int id, int updateId,
           int expectedRows,String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then update blob of size= "
               + bloblen + " - Uses getBlob and setBlob  api");

       ResultSet rs = null;

       // retrieve row from blobtbl2
       ps.setInt(1, id);
       rs = ps.executeQuery();
       rs.next();
       Blob value = rs.getBlob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in BLOBTBL2 with ID=" + id);
       }

       PreparedStatement psUpd = conn
               .prepareStatement("update BLOBTBL set content=?,dlen =? where id = ?");
       psUpd.setBlob(1,value);
       psUpd.setLong(2, l);
       psUpd.setInt(3, updateId);

       System.out.println("Rows Updated = " + psUpd.executeUpdate());
       conn.commit();

       // now select and verify that update went through ok.
       sel.setInt(1, updateId);
       ResultSet rs2 = sel.executeQuery();
       rs2.next();
       Blob updatedValue = rs2.getBlob(1);

       if (updatedValue.length() != l)
       {
           System.out.println("FAIL - MISMATCH length of updated blob value : expected="+
                   l+" found ="+updatedValue.length());
       }
       else
           compareBlobToFile(updatedValue.getBinaryStream(),file);

       // close resultsets
       conn.commit();
       rs.close();
       rs2.close();
       psUpd.close();
       System.out.println("========================================");

   }

   private static void compareBlobToFile(InputStream lobstream, String filename)
           throws Exception {
       FileInputStream file = new FileInputStream(filename);
       int l = 0;
       int b = 0;
       do {
           l = lobstream.read();
           b = file.read();
           if (l != b)
           {
               System.out.println("FAIL -- MISMATCH in data stored versus"+
                       "data retrieved");
               break;
           }
       } while (l != -1 && b != -1);
   }

   private static void deleteTable(Connection conn, PreparedStatement ps,
           int expectedRows) throws SQLException {
       int count = ps.executeUpdate();
       conn.commit();
       verifyTest(count, expectedRows, "Rows deleted =");
   }

   /**
    * insert clob
    * @param cloblen   length of clob to insert
    * @param start     id value for insert
    * @param rows      insert rows number of rows
    * @param streamLength  stream length passed to setCharacterStream(...,length)
    */
   private static void insertClob_SetCharacterStream(String testId,
           Connection conn, PreparedStatement ps, int cloblen, int start,
           int rows, int streamLength) throws SQLException {
       System.out.println("========================================");
       System.out.println("START " + testId + "  -insertClob of size = "
               + cloblen);

       long ST = 0;
       java.util.Random random = new java.util.Random();
       int count = 0;
       if (trace)
           ST = System.currentTimeMillis();

       for (int i = start; i < start + rows; i++) {
           ps.setInt(1, i);
           ps.setInt(2, 0);
           ps.setLong(3, cloblen);
           ps.setCharacterStream(4, new RandomCharReader(random, cloblen),
                   streamLength);
           count += ps.executeUpdate();
       }
       conn.commit();
       if (trace) {
           System.out.println("Insert Clob (" + cloblen + ")" + " rows= "
                   + count + " = " + (long) (System.currentTimeMillis() - ST));

       }
       verifyTest(count, rows, "Rows inserted with clob of size (" + cloblen
               + ") = ");
       System.out.println("========================================");

   }

  /**
    * insert clob, using a setClob api.
    * @param cloblen
    *            length of clob to insert
    * @param clob
    *            clob to insert
    * @param start
    *            start id value for insert
    * @param rows
    *            insert rows number of rows
    * @param expectedRows
    *            rows expected to be inserted
   */
    private static void insertClob_SetClob(String testId, Connection conn,
            PreparedStatement ps, java.sql.Clob clob, long cloblen, int start,
            int rows, int expectedRows) throws SQLException {
        System.out.println("========================================");
        System.out.println("START " + testId + "insertClob of size = "
                + cloblen);
        long ST = 0;
        if (trace)
           ST = System.currentTimeMillis();
        int count = 0;

        try {

            for (int i = start; i < start + rows; i++) {
                ps.setInt(1, i);
                ps.setInt(2, 0);
                ps.setLong(3, cloblen);
                ps.setClob(4, clob);
                count += ps.executeUpdate();
            }
            conn.commit();
            if (trace) {
                System.out.println("Insert Clob (" + cloblen + ")" + " rows= "
                        + count + " = "
                        + (long) (System.currentTimeMillis() - ST));

            }
        } catch (SQLException e) {
            verifyTest(count, expectedRows,
                    " Rows inserted with clob of size (" + cloblen + ") =");
            System.out.println("========================================");
            throw e;
        }

        verifyTest(count, expectedRows,
                " Rows inserted with clob of size (" + cloblen + ") =");
        System.out.println("========================================");

    }

   /**
    * select from clob table
    * @param cloblen  select expects to retrieve a clob of this length
    * @param id       id of the row to retrieve
    * @param expectedRows number of rows expected to match id
    */
   private static void selectClob(String testId, Connection conn,
           PreparedStatement ps, int cloblen, int id, int expectedRows)
           throws SQLException {
       System.out.println("========================================");
       System.out.println("START " + testId + " - SELECT CLOB of size = "
               + cloblen);

       long ST = 0;
       int count = 0;
       ResultSet rs = null;
       if (trace)
           ST = System.currentTimeMillis();

       ps.setInt(1, id);
       rs = ps.executeQuery();
       while (rs.next()) {
           count++;
           Clob value = rs.getClob(1);
           long l = value.length();
           long dlen = rs.getLong(2);
           if (dlen != l) {
               System.out.println("FAIL - MISMATCH LENGTHS GOT " + l
                       + " expected " + dlen + " for row in CLOBTBL with ID="
                       + id);
           }

       }
       conn.commit();
       if (trace) {
           System.out.println("Select Clob (" + cloblen + ")" + " rows= "
                   + expectedRows + " = "
                   + (long) (System.currentTimeMillis() - ST));

       }

       verifyTest(count, expectedRows,
               "Matched rows selected with clob of size(" + cloblen + ") =");
       System.out.println("========================================");

   }

   /**
    * insert clob into CLOBTBL2
    * @param cloblen   length of clob to insert
    * @param start     id value for insert
    * @param rows      insert rows number of rows
    * @param streamLength  stream length passed to setCharacterStream(pos,reader,streamLength)
    * @param file       name of the file that has data to be inserted
    */
   private static void insertClob2(String testId, Connection conn,
           PreparedStatement ps, int cloblen, int start, int rows,
           int streamLength, String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + "insert Clob of size = "
               + cloblen);
       int count = 0;
       FileReader reader = null;
       long ST = 0;
       if (trace)
           ST = System.currentTimeMillis();

       for (int i = start; i < start + rows; i++) {
           reader = new FileReader(file);
           ps.setInt(1, i);
           ps.setInt(2, 0);
           ps.setLong(4, cloblen);
           ps.setCharacterStream(3, reader, streamLength);
           count += ps.executeUpdate();
           reader.close();
       }
       conn.commit();
       if (trace) {
           System.out.println("Insert Clob (" + cloblen + ")" + " rows= "
                   + count + " = " + (long) (System.currentTimeMillis() - ST));

       }
       verifyTest(count, rows, " Rows inserted with clob of size (" + cloblen
               + ") =");
       System.out.println("========================================");

   }

   /**
    * select from clob table (CLOBTBL2)
    * @param cloblen  select expects to retrieve a clob of this length
    * @param id       id of the row to retrieve
    * @param expectedRows number of rows expected to match id
    * @param file  filename to compare the retrieved data against
    */
   private static void selectClob2(String testId, Connection conn,
           PreparedStatement ps, int cloblen, int id, int expectedRows,
           String file) throws SQLException, Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - SELECT CLOB of size = "
               + cloblen);

       long ST = 0;
       ResultSet rs = null;

       if (trace)
           ST = System.currentTimeMillis();

       int count = 0;
       ps.setInt(1, id);
       rs = ps.executeQuery();

       while (rs.next()) {
           count++;
           Clob value = rs.getClob(1);
           long l = value.length();
           long dlen = rs.getLong(2);
           if (cloblen != l) {
               System.out.println("FAIL - MISMATCH LENGTHS GOT " + l
                       + " expected " + dlen + " for row in CLOBTBL2 with ID="
                       + id);
           } else
               compareClobToFile(value.getCharacterStream(), file, cloblen);
       }
       conn.commit();

       verifyTest(count, expectedRows,
               "Matched rows selected with clob of size(" + cloblen + ") =");

       if (trace) {
           System.out.println("Select Clob (" + cloblen + ")" + " rows= "
                   + expectedRows + " = "
                   + (long) (System.currentTimeMillis() - ST));
       }
       System.out.println("========================================");
   }

   /*
    * Basically this test will do an update using setClob api -
    *  select row from clobtbl and then update a row in clobtbl
    * and verify updated data in clobtbl
    */
   private static void selectUpdateClob(String testId, Connection conn,
           PreparedStatement ps, int cloblen, int id, int updateId,
           int expectedRows) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then update clob of size= "
               + cloblen + " - Uses setClob api");

       ResultSet rs = null;

       ps.setInt(1, id);
       rs = ps.executeQuery();
       rs.next();
       Clob value = rs.getClob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in CLOBTBL with ID=" + id);
       }

       PreparedStatement psUpd = conn
               .prepareStatement("update CLOBTBL set content=?,dlen =? where id = ?");
       psUpd.setCharacterStream(1, value.getCharacterStream(), (int) l);
       psUpd.setLong(2, l);
       psUpd.setInt(3, updateId);

       System.out.println("Rows Updated = " + psUpd.executeUpdate());
       conn.commit();

       // now select and verify that update went through ok.
       ps.setInt(1, updateId);
       ResultSet rs2 = ps.executeQuery();
       rs2.next();
       Clob updatedValue = rs2.getClob(1);

       if(updatedValue.length() != l)
           System.out.println("FAIL - Retrieving the updated clob length does not match "+
                   "expected length = "+l +" found = "+ updatedValue.length());

       // close resultsets
       conn.commit();
       rs.close();
       rs2.close();
       psUpd.close();
       System.out.println("========================================");
   }

   /*
    * Basically this test will do an update using setBlob api and verifies the
    * updated data.  select row from clobtbl2 and then update a row in clobtbl
    * and verify updated data in clobtbl against the data in the original file
    */
   private static void selectUpdateClob2(String testId, Connection conn,
           PreparedStatement ps, PreparedStatement sel,int cloblen, int id, int updateId,
           int expectedRows,String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then update clob of size= "
               + cloblen + " - Uses setClob api");

       ResultSet rs = null;

       // retrieve row from clobtbl2
       ps.setInt(1, id);
       rs = ps.executeQuery();
       rs.next();
       Clob value = rs.getClob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in CLOBTBL2 with ID=" + id);
       }

       PreparedStatement psUpd = conn
               .prepareStatement("update CLOBTBL set content=?,dlen =? where id = ?");
       psUpd.setClob(1,value);
       psUpd.setLong(2, l);
       psUpd.setInt(3, updateId);

       System.out.println("Rows Updated = " + psUpd.executeUpdate());
       conn.commit();

       // now select and verify that update went through ok.
       sel.setInt(1, updateId);
       ResultSet rs2 = sel.executeQuery();
       rs2.next();
       Clob updatedValue = rs2.getClob(1);

       if (updatedValue.length() != l)
       {
           System.out.println("FAIL - MISMATCH length of updated clob value , found="+
                   updatedValue.length() +",expected = "+l);
       }
       else
           compareClobToFile(updatedValue.getCharacterStream(),file,(int)l);

       // close resultsets
       conn.commit();
       rs.close();
       rs2.close();
       psUpd.close();
       System.out.println("========================================");

   }

   /*
    * Basically this test will do an update using updateClob api and verifies the
    * updated data.  select row from clobtbl2 and then update a row in clobtbl
    * and verify updated data in clobtbl against the data in the original file
    * @param updateRowId    id of the row that needs to be updated
    */
   private static void updateClob2(String testId, Connection conn,PreparedStatement sel,
           int cloblen, int id, int updateRowId,int updateIdVal,
           int expectedRows,String file) throws Exception {
       System.out.println("========================================");
       System.out.println("START " + testId + " - select and then update clob of size= "
               + cloblen + " - Uses updateClob api");

       PreparedStatement ps1 = conn.prepareStatement("SELECT * FROM CLOBTBL FOR UPDATE", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
       PreparedStatement ps = conn.prepareStatement("SELECT CONTENT,DLEN FROM CLOBTBL2 where ID =?");

       ResultSet rs = null;
       ps.setInt(1,id);
       // retrieve row from clobtbl2
       rs = ps.executeQuery();
       rs.next();
       Clob value = rs.getClob(1);
       long l = value.length();
       long dlen = rs.getLong(2);
       if (dlen != l) {
           System.out
                   .println("FAIL - MISMATCH LENGTHS GOT " + l + " expected "
                           + dlen + " for row in CLOBTBL2 with ID=" + id);
       }

       ResultSet rs1 = ps1.executeQuery();
       while (rs1.next()) {
            if (rs1.getInt(1) == updateRowId)
            {
                rs1.updateClob(4, value);
                rs1.updateInt(1, updateIdVal);
                rs1.updateInt(2, 0);
                rs1.updateLong(3, dlen);
                rs1.updateRow();
                break;
            }
        }
       // close resultsets
       conn.commit();
       rs.close();
       rs1.close();
       ps1.close();
       ps.close();

       // verify
       // now select and verify that update went through ok.
       sel.setInt(1, updateIdVal);
       ResultSet rs2 = sel.executeQuery();
       rs2.next();
       Clob updatedValue = rs2.getClob(1);

       if (updatedValue.length() != l)
       {
           System.out.println("FAIL - MISMATCH length of updated clob value , found="+
                   updatedValue.length() +",expected = "+l);
       }
       else
           compareClobToFile(updatedValue.getCharacterStream(),file,(int)l);

       System.out.println("========================================");

   }

   private static void compareClobToFile(Reader lobstream, String filename,int length)
           throws Exception {
       FileReader file = new FileReader(filename);
       int c1 = 0;
       int c2 = 0;
       long count = 0;
       do {
           c1 = lobstream.read();
           c2 = file.read();
           if (c1 != c2)
           {
               System.out.println("FAIL -- MISMATCH in data stored versus data retrieved at " + count);
               break;
           }
           count++;
           length--;
       } while (c1 != -1 && c2 != -1 && length > 0);
   }

   private static void expectedException(SQLException sqle) {

       while (sqle != null) {
           String sqlState = sqle.getSQLState();
           if (sqlState == null) {
               sqlState = "<NULL>";
           }
           System.out.println("EXPECTED SQL Exception: (" + sqlState + ") "
                   + sqle.getMessage());

           sqle = sqle.getNextException();
       }
   }

   private static void verifyTest(int affectedRows, int expectedRows,
           String test) {
       if (affectedRows != expectedRows)
           System.out.println("FAIL --" + test + affectedRows
                   + " , but expected rows =" + expectedRows);
       else
           System.out.println(test + affectedRows);
   }

   private static void writeToFile(String file,Reader r)
       throws IOException
   {
       // does file exist, if so delete and write to a fresh file
       File f =new File(file);
       if (f.exists())
           f.delete();
       FileWriter writer = new FileWriter(file);
       // write in chunks of 32k buffer
       char[] buffer = new char[32 * 1024];
       int count = 0;

       while((count = r.read(buffer)) >=0)
           writer.write(buffer,0,count);
       writer.flush();
       writer.close();
   }
}

/**
 * Class to generate random byte data
 */
class RandomByteStream extends java.io.InputStream {
   private long length;

   private java.util.Random dpr;

   RandomByteStream(java.util.Random dpr, long length) {
       this.length = length;
       this.dpr = dpr;

   }

   public int read() {
       if (length <= 0)
           return -1;

       length--;
       return (byte) (dpr.nextInt() >>> 25);
   }

   public int read(byte[] data, int off, int len) {

       if (length <= 0)
           return -1;

       if (len > length)
           len = (int)length;

       for (int i = 0; i < len; i++) {
           // chop off bits and return a +ve byte value.
           data[off + i] = (byte) (dpr.nextInt() >>> 25);
       }

       length -= len;
       return len;
   }
}

/*
 * Class to generate random char data, generates 1,2,3bytes character.
 */
class RandomCharReader extends java.io.Reader {
   private long length;
   private long numTrailingSpaces;

   private java.util.Random dpr;

   RandomCharReader(java.util.Random dpr, long length) {
       this.length = length;
       this.dpr = dpr;
       this.numTrailingSpaces = 0;
   }

   RandomCharReader(java.util.Random dpr, long length,long numTrailingSpaces) {
       this.length = length;
       this.dpr = dpr;
       this.numTrailingSpaces = numTrailingSpaces;
   }

   private int randomInt(int min, int max) {
       return dpr.nextInt(max - min) + min;
   }

   private char getChar() {
       // return space for trailing spaces.
       if (length <= numTrailingSpaces)
       {
          return ' ';
       }

       double drand = dpr.nextDouble();
       char c = 'a';
       if (drand < 0.25)
           c = (char) randomInt((int) 'A', (int) 'Z');
       else if (drand < 0.5)
           switch (randomInt(1, 10)) {
           case 1:
               c = '\u00c0';
               break;
           case 2:
               c = '\u00c1';
               break;
           case 3:
               c = '\u00c2';
               break;
           case 4:
               c = '\u00ca';
               break;
           case 5:
               c = '\u00cb';
               break;
           case 6:
               c = '\u00d4';
               break;
           case 7:
               c = '\u00d8';
               break;
           case 8:
               c = '\u00d1';
               break;
           case 9:
               c = '\u00cd';
               break;
           default:
               c = '\u00dc';
               break;
           }
       else if (drand < 0.75)
           c = (char) randomInt((int) 'a', (int) 'z');
       else if (drand < 1.0)
           switch (randomInt(1, 10)) {
           case 1:
               c = '\u00e2';
               break;
           case 2:
               c = '\u00e4';
               break;
           case 3:
               c = '\u00e7';
               break;
           case 4:
               c = '\u00e8';
               break;
           case 5:
               c = '\u00ec';
               break;
           case 6:
               c = '\u00ef';
               break;
           case 7:
               c = '\u00f6';
               break;
           case 8:
               c = '\u00f9';
               break;
           case 9:
               c = '\u00fc';
               break;
           default:
               c = '\u00e5';
               break;
           }

       return c;

   }

   public int read() {
       if (length <= 0)
           return -1;

       length--;
       return getChar();
   }

   public int read(char[] data, int off, int len) {

       if (length <= 0)
           return -1;

       if (len > length)
           len = (int)length;

       for (int i = 0; i < len; i++) {
           data[off + i] = getChar();
           length -= 1;
       }

       return len;
   }

   public void close() {

   }
}

/**
 * Class used to simulate a 4GB Clob implementation to
 * check whether derby implements such large Clobs correctly.
 * Derby throws an error if the clob size exceeds 2GB
 **/

class ClobImpl implements java.sql.Clob {
  long length;
  Reader myReader;

  public ClobImpl(Reader myReader,long length) {
      this.length = length;
      this.myReader = myReader;
  }

  public long length() throws SQLException {
      return length;
  }

  public String getSubString(long pos, int length) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public java.io.Reader getCharacterStream() throws SQLException {
      return myReader;
  }

  public java.io.InputStream getAsciiStream() throws SQLException {
      throw new SQLException("Not implemented");
  }

  public long position(String searchstr, long start) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public long position(Clob searchstr, long start) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public int setString(long pos, String str) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public int setString(long pos, String str, int offset, int len) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public java.io.OutputStream setAsciiStream(long pos) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public java.io.Writer setCharacterStream(long pos) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public void truncate(long len) throws SQLException {
      throw new SQLException("Not implemented");
  }

  public void free() throws SQLException {
      throw new SQLException("Not implemented");
  }

  public Reader getCharacterStream(long pos, long length) throws SQLException {
      throw new SQLException("Not implemented");
  }

}

/***
 * Class to simulate a 4Gb blob impl in order to test if Derby
 * handles such large blobs correctly. The main methods here are
 * only the length() and the getBinaryStream(). Rest are just
 * placeholders/dummy methods in order to implement the java.sql.Blob
 * interface
 * ----
 * Derby throws an error if the blob length exceeds the max range of
 * int.
 */
class BlobImpl implements java.sql.Blob
{
    long length;
    InputStream myStream;

    public BlobImpl(InputStream is, long length)
    {
        this.myStream = is;
        this.length = length;
    }
    public InputStream getBinaryStream()
    throws SQLException
    {
        return myStream;
    }

    public byte[] getBytes()
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }
    public long length()
    throws SQLException
    {
        return length;
    }

    public long position(Blob pattern,long start)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }

    public long position(byte[] pattern,long start)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }
    public OutputStream setBinaryStream(long pos)
    throws SQLException

    {
        throw new SQLException("Not implemented");
    }

    public int setBytes(long pos,byte[] bytes)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }
    public int setBytes(long pos,byte[] bytes,int offset,int len)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }

    public void truncate(long len)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }

    public byte[] getBytes(long pos, int length)
    throws SQLException
    {
        throw new SQLException("Not implemented");
    }

}

redpajama_set_name: RedPajamaGithub


Are you ready for a smart, secure and simply amazing Android experience co-created by Motorola and Google?
If you're looking for tips to celebrate an anniversary, take a cue from Motorola—the American telecom giant celebrates its 90th anniversary on September 25th. To commemorate the milestone, it treated the Indian market to its latest smartphone offering as the Motorola One Power was officially unveiled in the country. Let's take a closer look at this new device.
A stylish and sleek precision-crafted metal design encases a large 6.2" full HD+ screen with 19:9 max vision display. It's just as fun at the back as it is at the front, with the 16 MP + 5 MP dual rear cameras ready to take your photos to the next level! In a design tweak, the fingerprint sensor is conveniently placed on the stylish batwing at the rear of the phone as well.
As for the the 12 MP front camera, it's equipped with flash, selfie beauty mode, Auto HDR, professional mode and a super-cool Selfie Portrait Mode that'll let you add a beautiful blurred effect!
The Motorola One Power boasts a Qualcomm snapdragon 636 octa-core processor with 4GB of RAM and an Adreno 509 GPU, so it responds instantly to every tap, touch and swipe without delay! The most attractive feature, however, is surely the massive 5000 mAh battery which lasts up to 2 days on a single charge. If you're on the go, you can even get six hours of power in just 15 minutes of charging with the TurboPower™ Charger.
The phone comes with with Google Assistant and a Google Lens-enabled camera, which means that finding information and telling your phone to get things done is easier than ever before and so is identifying various objects when you look through the lens. Motorola even describes the One Power as one of its most secure offerings. Another piece of good news for tech enthusiasts is that the One Power will be among the first to upgrade to Android Pie when the update is rolled out.
For entertainment fanatics and binge-watchers, the bottom firing speaker powered by Dolby Audio™ will be the ideal feature, as will the fact that the phone comes with Netflix support in HD with Widevine L1 certification.
With a wealth of new features and amazing style, you can't wait to get your hands on this co-creation of Motorola and Google, right? It'll be available exclusively on Flipkart for just INR 15,999 and will also be sold offline at select Moto Hubs. Get ready for the flash sale on 5th October at 12 pm. Register for it now & set your reminders!