text:
Tristan Edis
Not a big jump: part of an existing 5B solar installation at Beverley in Western Australia. 5B
Amid almost daily complaints from industry about skyrocketing electricity costs, out drops an announcement so counter to the dominant flow of news that it seems beyond belief. Yet there it is in the business pages: Australian software billionaire Mike Cannon-Brookes and iron ore billionaire Andrew "Twiggy" Forrest are backing a project that will aim to supply a fifth of Singapore's electricity needs — all of it from solar power — via a 3750 kilometre underwater cable from the Northern Territory.
The proposed solar farm, near Tennant Creek, would be the world's biggest by a comfortable margin. It would stretch as far as the eye can see across an area equal to more than 20,000 soccer fields.
Despite Cannon-Brookes's self-deprecating description of the project as "batshit insane," it might actually make technical and economic sense. And it's not the only mega-renewable energy project being pursued by credible Australian companies with the aim of powering the many hundreds of millions of people living to the north of us.
The scheme is a long way from a done deal, of course. Its commercial and technical challenges are enormous, and with a $20 billion price tag it would be one of Australia's largest-ever construction projects.
Making sense: Mike Cannon-Brookes, chief executive officer of Atlassian. Karen Dias/Bloomberg via Getty Images
But people who know the man behind the project — David Griffin, chief executive of Sun Cable — talk in glowing terms about his ability to take an empty paddock and convert it into a power station fuelled by wind or sun. Griffin hails from one of Australia's pioneering renewable energy companies, Infigen Energy. Most recently he sewed up a deal to provide Australia's second-largest employer, Coles, with 10 per cent of its electricity from solar. As one former colleague says, whenever Griffin encounters a barrier — and there are plenty ahead — he manages to "go round, go over, or… blows [it] up."
So how can Griffin go from powering a tenth of Coles to powering a fifth of Singapore? In terms of technology, it's not a big jump. The Tennant Creek farm will use the same type of solar panel, just a heck of a lot more of them.
One difference, though, is that the project will use an ingenious Australian-made technology to simplify and accelerate the installation of the panels. Rather than construct the framing out in the field, an Australian company, 5B, in conjunction with former car-parts supplier IXL, will assemble the panels into a concertina-style kit in factories in Darwin and Adelaide. They will then be progressively transported to Tennant Creek in shipping containers on a staggering kilometre-long train. There, a forklift will simply unload and unfold the concertinas to create rows of panels arranged in A frames facing east or west.
Unlike the alternating current system that transports the vast bulk of Australia's electricity, the cable to Singapore will use direct current, minimising the loss of electricity over those thousands of kilometres. While it isn't common, this technology is already deployed at different sites across the globe, including under Bass Strait.
So how on earth does it stack up economically?
What is yet to sink into the minds of many Australian policy-makers and commentators is that solar panels have dropped so much in cost, and are so quick and easy to install, that they are approaching the point of being the cheapest-available source of electricity globally. Importantly, solar is already cheaper than the fuel Singapore gets most of its power from — imported liquefied natural gas, or LNG.
The cost of electricity from LNG lies somewhere between $80 and $120 per megawatt-hour. By comparison, Snowy Hydro says it has signed up several solar farms to supply power in the $40s. Given its scale and solar resource, it's conceivable that the Tennant Creek project could get this down to a flat $40 or possibly as low as $35 prior to transmission to Singapore.
The difference between that figure of $35–$40 and the cost of LNG — a gap of at least $40 and as much as $85 — provides the room to pay for the cable to Singapore and, the project's proponents hope, generate a profit.
Why wouldn't Singapore install solar panels itself? The other factor that plays in Australia's favour and counts against many of our northern neighbours is that we have lots of very sunny and sparsely populated space.
Almost every skerrick of Singapore is taken up with buildings, and where that isn't the case the island state has its highly prized parkland. Sure, they could install solar on top of the buildings, but the roofs of high-rises are often cluttered with building services equipment or shadowed by even taller buildings. And even if lots of solar panels were deployed — on floating pontoons, for instance — they would be subject to wide and rapid variations in cloud cover. Being almost right on the equator, the city is often subject to long periods of cloudy, rainy weather.
You couldn't find a much greater contrast with Tennant Creek, a place almost completely devoid of people with an average annual rainfall of just 399 millimetres compared to Singapore's 2340 millimetres. A satellite-eye view on Google Maps reveals that a solar farm at Tennant Creek would be situated just south of where the Northern Territory turns from shades of green and grey to a distinct red–brown colour, signifying a climate free of tropical monsoons. While the solar farm would take up an area even smaller than Singapore, the less frequent and less intense cloud cover means batteries could more easily manage the variation in solar output.
Ideal conditions: the proposed solar farm site near Tennant Creek. Google Maps
Garnaut's pathways
Singapore represents a true extreme, but other parts of Asia confront similar challenges. Prime minister Bob Hawke's economic adviser and former ambassador to China, Ross Garnaut, lays out the broader opportunity for Australia offered by cheap renewable energy in his book, Superpower: Australia's Low-Carbon Opportunity.
Garnaut describes Australian renewable energy as "a path to low-cost reductions in emissions in the rest of the world." This can happen, he says, through three pathways. We can use direct-current cables to supply electricity to Southeast Asia. We can use the electricity from wind and solar plants to convert water into hydrogen and ship this to the "renewable-energy-resource-poor countries of Asia, notably Japan and Korea," where land is scarce and energy demand high. And we can use both the electricity and the hydrogen from renewable energy to process ores into metals (or batteries) for export.
Beyond Tennant Creek, two other mega-renewable energy projects are taking shape to take advantage not just of Australia's superior solar resource but also of our world-class wind resource. Both are located in Western Australia, one in the Pilbara and the other further south near Kalbarri.
The Pilbara project, which is by far the largest, had its genesis in disappointment. Several years ago the company behind the project, CWP Renewables, sought to expand into Indonesia. It was lured there by the country's huge population, a government policy to expand renewable energy, and a demand for electricity that will massively expand over the next few decades. But finding good wind sites and negotiating some degree of security over development rights proved too difficult.
CWP Australia's managing director, Alex Hewitt, wasn't prepared to give up. For anyone passionate about combatting global warming, Indonesia is one of the big fish. Reliant on coal for electricity, it is going through a rapid process of economic development, much like China did two decades ago, with an accompanying growth in electricity demand. The fact that Japan has just half the population of Indonesia but consumes close to four times as much electricity gives an idea of how much demand could grow. What's more, Japan is quite an energy-efficient economy. Powered by coal, Indonesia's likely expansion in electricity consumption over the next few decades would be disastrous for containing global warming.
What Hewitt's team found was that an area in the northwest of Western Australia, inland from the Eighty Mile Beach Caravan Park and the Pardoo Roadhouse in the Pilbara, experiences consistently high winds over an extraordinarily large area. It also receives among the highest level of solar radiation in the world. If you only had an eye to domestic needs, the location would be highly problematic: remote, without transmission infrastructure, several hundred kilometres from any major electricity demand. Getting people and materials to such a location would be an enormous logistical challenge. Only a gigawatt-scale project could be viable.
So two problems coalesced into an opportunity called the Asian Renewable Energy Hub. It is planned to combine the world's biggest wind farm with the world's second-biggest solar farm (Sun Cable's Tennant Creek would be the biggest), all feeding zero-emissions electricity to Indonesia by high-voltage direct current cable. This single project would produce more power than all the wind farms and solar farms built so far in this country.
CWP's Hewitt says this is the project that would allow him to die a happy man. He was smiling when he made the remark, but underneath you could sense a deadly serious ambition to make a major and lasting contribution to containing global warming.
Enter the miracle molecule
In a sign of the challenges that might await Sun Cable, the Asian Renewable Energy Hub has now pivoted away from direct-current transmission to Indonesia. Instead, the project has focused on Garnaut's second opportunity, an export industry built on generating electricity to produce hydrogen from water via electrolysis. It will also supply three of its fifteen gigawatts to the Pilbara's iron ore and LNG producers.
Hydrogen opens the possibility of supplying not just electricity and not just Southeast Asia. We could provide zero-emissions fuel for heating and transport to countries as far afield as Japan and Korea, and possibly even to Europe. But the technology and economics are more challenging than supplying power via cable.
On the customer side, the equipment that would use hydrogen as a fuel to power cars or provide heat for industrial processes is still only small-scale. Further technological progress is required to bring down costs and ensure reliability. On the production side, savings are needed at all stages. In favourable circumstances, with renewable energy costing about $45 per MWh, hydrogen could potentially be produced via electrolysis for around $25 to $30 per gigajoule. This looks reasonably competitive: while petrol is around $17.50 to $23.40 per gigajoule, hydrogen fuel cell-electric cars are about double the efficiency of a conventional petrol car. But then there's the cost of transporting the hydrogen to Asia. With present technologies, this makes it more expensive than petrol (ignoring carbon externalities), let alone LNG, which costs roughly $9 to $14 per gigajoule delivered to north Asia.
But a range of foreseeable innovations and greater economies of scale could bring down the cost of producing hydrogen to around $11 to $12 per gigajoule by 2030, and it could then be delivered to ports in North Asia for around $26 to $28 per gigajoule. Given the superior efficiency of fuel cells, that kind of price tag would make it an attractive option for decarbonising transport. This would be a massive market, although further cost reductions would be necessary to displace gas as well.
By shifting focus to hydrogen, in other words, the Asian Renewable Energy Hub has sacrificed speed in the expectation it will capture a far larger prize.
The high cost of transporting hydrogen shows why Ross Garnaut sees Australia's biggest opportunity not in the direct export of renewable energy but in using cheap renewable energy to produce metal products for export. Transporting oil, coal or gas over long distances overseas has become relatively cheap and easy. Direct current power lines have also been demonstrated to work well, but they don't come cheap if you want to run them thousands of kilometres through the ocean. And, as we saw with the extended Tasmania Bass Link outage in 2016, if these cables suffer a fault it can be hard to diagnose and fix. Hydrogen's problem is that it takes lots of energy and expensive equipment to convert it into a liquid small enough in volume to viably ship overseas.
Producing metals in Australia would save on transport costs because Australia already produces a large proportion of the world's metal ores. Refined metals weigh much less than ore but are worth significantly more. Garnaut's partnership with the British steel tycoon, Sanjeev Gupta, to revive the Whyalla Steel Mill and build an energy company backed by renewables is an effort to realise this vision.
Glimpses of an alternative future: steel tycoon Sanjeev Gupta. Liberty2017/Wikimedia Commons
But that pathway is not without challenges either. Just like those Aussie men who have little to no involvement in construction yet somehow feel they must drive a hulking dual-cab ute, politicians the world over seem to think that if you don't have metal smelters you aren't a real economy. Consequently, metal smelters across the globe are heavily subsidised and the market burdened by excess production capacity.
Australia's steel mills, aluminium smelters and other industrial plants are struggling, and Gupta's Whyalla plant, which lost $185 million last year, is no exception While power from wind and solar in Australia is approaching world-competitive prices, we haven't yet got the cost of storage and hydrogen technologies down to where they need to be. This is beginning to look possible by as soon as 2030, but we need to encourage other countries to accelerate their efforts in decarbonising energy.
How the economics is transforming the politics
What Ross Garnaut highlights is that the rapid decline in the cost of wind and solar, alongside further reductions in battery and hydrogen-processing costs, can slice through the Gordian knot holding back Australian climate policy.
Senior policy-makers, including many on the Labor side, have long seen emissions-reduction efforts as a major economic threat — after all, Australia is the world's largest seaborne exporter of coal and gas. And while industrial manufacturing in Australia is often sub-economic in scale, far from end users and weighed down by relatively high labour costs, it could defend itself using low-cost energy built on plentiful supplies of coal and gas. As a consequence, Australia has not only been reluctant to implement emissions-reduction policies at home, we've also tried to sabotage global efforts.
Yet it turns out that aggressive efforts by governments overseas to push down the cost of wind and solar have delivered Australia a potential competitive advantage. For this advantage to be fulfilled, though, two more things need to change. We need other countries to accelerate their efforts to increase the scale and reduce the cost of battery and hydrogen technologies. And we need them to enact tighter emission controls that will increase the cost of using fossil fuels and shift them towards renewable energy.
If these two things happen then renewable energy becomes the dominant fuel for energy and Australia moves into the box seat. What is often forgotten by policy-makers and commentators is that while Australia is the biggest exporter of coal and gas by sea, our exports are small relative to the amounts of coal and gas other countries produce domestically or import via pipeline. China has plenty of coal; India has plenty of coal. Russia and the United States have plenty of coal and gas. Yes, these countries also have plenty of renewable energy resources, but theirs aren't nearly as rich and plentiful as Australia's.
Meanwhile, the alliance between fossil fuel producers and industrial manufacturing in Australia has broken down. While manufacturers' industry associations were busy in Canberra helping fight the Renewable Energy Target and the carbon price, energy companies were planning the price increases that made the impact of the carbon price look like a rounding error. In 2013, when the price was operating, wholesale gas prices were $4 per gigajoule; by 2018, with it long gone, wholesale gas prices had risen to anywhere between $9 and $15. Wholesale electricity prices duly followed, rising from around $55 to around $90 per megawatt-hour.
Manufacturers' only hope for energy price relief turns out to be the fuel source their lobby groups fought against with the fervour of a Christian evangelist from America's deep south. Interestingly, mining companies, except if they're digging up coal, are also looking to cheap wind and solar to improve their competitiveness. Twiggy Forest's iron ore operation in the Pilbara is about to replace a large chunk of its gas-fired power with a solar farm. Goldmines in Western Australia that have been paying large premiums to truck diesel and gas thousands of kilometres to their mines have noticed that lower-cost energy sources — sun and wind — exist right above them. Australia also hosts some of the richest deposits of the resources required to produce batteries.
The interests of Australia's big business groups are beginning to split, with the potential to decisively shift the political dynamics. It is becoming apparent that the long-term financial interests of Australia's industrial manufacturers, and also of some miners, are best served by strong global action to reduce emissions and to progress renewable energy, hydrogen and battery technology.
Morality meets economics
Politics, though, is taking a while to catch up. When the man who abolished the carbon price, Tony Abbott, lost his seat to Zali Steggall, an advocate of climate action, he delivered a message not of contrition but of celebration. What mattered, the former PM said during his concession speech, was that the Coalition as a whole had won government. While it had suffered losses in stronghold seats like Warringah, it was doing well in working-class seats. "Where climate change is a moral issue we Liberals do it tough," said Abbott. "Where climate change is an economic issue, as the result tonight shows, we do very, very well."
After preferences, the Coalition had indeed gained significantly in pivotal Queensland marginal seats where mining and industrial manufacturing are important. There, the message to blue-collar voters from the Coalition, as well as from Pauline Hanson's One Nation, was that Labor's climate change policies would put them out of work and drive up the cost of living.
The problem for the Coalition is twofold: gas prices are stuck at levels at least twice what they used to be, and financiers aren't interested in sinking their money into building new coal-fired power stations. Energy prices will consequently remain high, and industrial manufacturing on tenterhooks. While coalmining and gas extraction are fine, they don't actually support very many jobs once the necessary infrastructure is built.
Until recently the environmental movement and the Labor Party have tended to talk about solutions to climate change in terms of policy settings or broad technological solutions, like renewable energy. When it came to specifics, environment groups usually focused on the Adani coalmine, the Hazelwood power station and the other things they want to shut down.
What many are coming to realise is that they should be talking about specific projects they want to build. For a concreter or electrician in Gladstone or Townsville, an emissions-trading scheme sounds suspiciously like something that makes a Sydney banker rich. Even a Renewable Energy Target or a slogan like 100 per cent renewables is probably too remote from everyday financial worries. And shutting down a mine — well that sounds like it'll end in the dole queue. But a huge hydro–wind–solar hub in North Queensland with a new transmission line to support mining expansion in Mt Isa sounds like employment and cash for them.
Of course, this is not what economists would recommend. They would say governments should set the overarching emissions target and leave it to the private sector to work out which projects should proceed. They're right, but strangely it was the party of free enterprise that rejected this advice. Tony Abbott managed to demonise such an approach and good economic theory became a political albatross for Labor.
An opportunity is emerging for a talented politician to sell voters an alternative vision of economic security, one aligned with the need to contain global warming. Sun Cable and the Asian Renewable Energy Hub provide a picture of what's possible over the long-term. But blue-collar workers need to be offered not just a vision of Australia becoming an energy exporting superpower in a decade's time, but also shovel-ready projects for the next term of government. As a rich country we also need to demonstrate leadership in the here and now if we want other countries to accelerate a shift away from fossil fuels.
Coalition contradictions
Oddly enough it is the Coalition, not Labor, that has stumbled on half the answer. For all their talk of free enterprise and small government, the Liberals and the Nationals have converted energy policy into something like a showbag. They continue to proclaim that it would be a disaster if we were to shut down a single coal-fired power station — even one like Liddell that's badly limping and well past retirement age. But whenever things start to get difficult in the energy or climate arena, they pluck out a new, impressive-sounding energy project.
Snowy 2.0 was just the beginning of what has become an array of projects extending all the way from Darwin Airport to Einasleigh, inland from Townsville, then stretching all the way south to Roseberry in Tasmania and plenty of places in between. Most of these projects involve energy storage via pumped hydro or a big battery, or new power transmission lines.
What the feasibility studies for these big-ticket projects show is that they only make economic sense if you plan on shutting down much of Australia's existing coal-generating fleet and replace it with wind and solar. The Coalition knows it needs to be doing things to replace ageing coal power plants and increase competition in the electricity market, but it also wants to continue using Labor's climate change policies as an instrument of fear. This half-hearted approach to transforming our energy system leaves it in danger of tangling itself in a net of contradictions.
Those contradictions are set on a collision course in Tasmania. Along with Queensland, the Coalition owes its unlikely election victory in May to two seats in northern Tasmania, Bass and Braddon. Scott Morrison led Tasmanians to believe that his government would deliver a major expansion of the state's hydroelectricity system through a series of pumped hydro projects — essentially turning Tasmania into what is billed as the Battery of the Nation. This expansion hinges on the construction of a second direct-current transmission interconnector with the mainland — the Marinus Link — which would send excess electricity to Melbourne during peak-demand periods. Morrison claimed that this interconnector could be built as soon as 2025, although this has since shifted to 2027.
The problem facing the federal government is that the Australian Energy Regulator will only sign off on the plan if the new transmission line passes what is known as the regulatory investment test, an economic cost–benefit evaluation. But the feasibility study for the second interconnector made it very clear that the project made no economic sense unless several mainland coal generators closed down. According to the study, the Marinus Link's benefits are likely to outweigh its costs only when around 7000 MW of the National Energy Market's present coal-fired generation capacity retires.
To put that 7000MW into perspective, Victoria's entire coal fleet is equal to 4775MW. After the closure of Liddell, New South Wales's remaining coal fleet capacity is 8160MW. In other words, the Coalition is incredibly enthusiastic about building the Battery of the Nation yet has a conniption about the shutdown of the Liddell power station (from which we can only count on 1000MW at peak times), claiming they'll build a brand new coal-fired facility in Queensland and keep Yallourn operating in Victoria.
Something doesn't compute, and by the time of the next federal election Labor will have an opening to win back these Tasmanian seats. It simply needs to point out that the expansion of the Battery of the Nation, and the extra jobs it brings, hinges on electing a government that will transition Australia out of coal.
Winning over Queensland seats is trickier because there will be losers as well as winners there from the transition (although most of that state's coalmining jobs are in coking coal, which is not immediately and directly threatened by renewable energy). Yet a power scheme rivalling Battery of the Nation in scope and ambition — the kind of project Joh Bjelke-Petersen would be proud of and Bob Katter is enthusiastically backing — is already on the drawing board. Like Battery of the Nation, it involves a major new transmission line, this one running inland from Townsville to Mt Isa and linking the main national grid with major mines in the North West Minerals Province to provide the mines with much cheaper electricity. It would also open up access to one of the world's best solar resources. Further transmission lines would be necessary to link the 1000 megawatt Kennedy Wind Farm, pumped hydro plants and other major renewable energy projects with the industrial city of Gladstone.
The end result would be a triangle linking wind, solar and hydro projects with large mining and industrial electricity consumers across central and north Queensland. Power would be provided at a cost that would encourage mining in the northwest to expand, and would retain, or possibly attract, minerals-processing plants along the coast. The potential increase in jobs would dwarf those that might flow from the Adani Coal Mine.
For this to happen, the government needs, at a minimum, to act as underwriter and facilitator of long-term contracts between power suppliers and major mining and industrial customers. This would bring down the risk, allowing low-cost finance from superannuation funds and banks to flow in. The total investment would be significant, but in line with the Snowy 2.0 scheme once you include its supporting transmission.
If Labor were to promise such a scheme, the Coalition would face difficult choices. So far it has had some success by talking favourably about coal projects in the knowledge that Labor would struggle to do the same. But it hasn't had a hand in seeing anything built. The Queensland electricity system is already oversupplied with coal-fired baseload power stations: more than 8000MW of coal-powered capacity for just 6000MW of average demand. Justifying more coal-fired stations is difficult unless you accept that you have to shut some of the existing ones down. And no credible power companies are lining up to build any new coal power stations.
The LNP's talk-a-lot-about-coal strategy isn't likely to win a battle for hearts and minds once it's pitted against the far larger set of renewable energy and transmission projects already under development, backed by credible power project developers. (Note that the Collinsville coal power plant cited by resources minister Matt Canavan as worthy of government support is proposed by a company that appears never to have financed or built a major power station.)
It might be hard to imagine now, but if Labor promised such a scheme the Coalition would probably not be far behind. Self-preservation has a habit of winning out over ideology. This would represent a watershed moment: the Northern Queensland tail has been wagging the entire country's energy and climate policy for the past few years.
Making possible the impossible
Sun Cable, Pilbara's Asian Renewable Energy Hub and the Gupta's plans for metal manufacturing provide tangible glimpses of an alternative future tied to renewable energy rather than fossil fuels. Lots of hurdles have to be overcome to convert it into a reality.
But some steps have already been taken. Over the space of just five years, between 2016 and 2021, the contribution of renewables to Australia's electricity supply will have risen from 15 per cent to 30 per cent. A number of major manufacturers and mining companies are signing up to new renewable energy projects in order to lower their energy costs. Research company Green Energy Markets estimates that wind and solar projects already under development could produce more electricity than Australia currently consumes. Partly thanks to Malcolm Turnbull, Scott Morrison and Liberal state energy ministers, the energy storage and transmission projects already under way can take the country well beyond 50 per cent renewables.
While Tony Abbott may have been right about the last election, he could be very wrong about the next one. Who knows, we may even have a bipartisan approach to renewable energy and climate change. Nelson Mandela once said, "It always seems impossible until it's done." Thanks to an unlikely alliance of three billionaires — Mike Cannon-Brookes, Twiggy Forrest and Sanjeev Gupta — we can now see how it can be done. The economics are moving in the right direction. Let's hope the political will is not far behind. •
Trisan Edis is Energy, Carbon Markets & Technology Analyst at research and advisory company Green Energy Markets.
Topics: climate change | economics | energy | politics | renewable energy | rural | trade
International Known unknowns Lesley Russell 19 January 2020 The trial of Donald Trump will feed into the Democratic primaries, the election, and beyond. But exactly how is very hard to say Essays & Reportage To burn or not to burn is not the question Daniel May 17 January 2020 As successive royal commissions have found, prescribed burning is a tool, not a panacea National Affairs Conviction politics Peter Brent 17 January 2020 Will it take international pressure for the Coalition to finally budge on climate change? Correspondents Losing hearts and minds Rowan Callick 13 January 2020 Taiwanese voters add their voice to opponents of Xi Jinping's ambitions
The summer Scott Morrison's leadership broke
Frank Bongiorno
The prime minister's political authority has fallen away more quickly than anyone could have imagined
No going back? Prime minister Scott Morrison with wildflower farmers Paul and Melissa Churchman in Sarsfield, eastern Victoria, today. James Ross/AAP Image


text:
You Are Here: Our Government >> Committees >> Past Committees >> Snug Cove Improvements Working Group >> Bowen in Bloom
Communities in Bloom is a Canadian non-profit program committed to fostering civic pride, environmental responsibility, and beautification through community involvement, with a focus on enhancing green spaces in communities.
Bowen Island participated as a novice in the provincial edition of Communities in Bloom in 2015, and was an evaluated member in 2016. On July 14, 2016, volunteer judges from BC Communities in Bloom visited the Island and evaluated municipal, business and residential sectors of Bowen life on the basis of:
tidiness
heritage conservation
floral displays
Bowen Island: a three bloom community
Last July, judges from the BC Communities in Bloom program visited Bowen Island to evaluate the community based on criteria such as environmental action, tidiness, landscape and floral displays.
As a result of that evaluation, the Bowen in Bloom committee is pleased to announce that Bowen Island has been awarded three blooms! We would like to thank the volunteers who made this possible with the valuable contributions of their time, efforts and expertise. Special mention goes to Holly Graff, who was nominated for Community Champion.
Read the 2016 Communities in Bloom Evaluation for Bowen Island
Read Bowen in Bloom, the Community Profile Book produced by the Communities in Bloom Committee for 2016.
The Communities in Bloom Committee is a sub-committee of the Snug Cove Improvements Working Group and is composed of municipal staff, councillors and volunteer community members.
Innovation Grants
Congratulations to recipients of Bowen in Bloom Innovation Grants
Earlier this summer, Bowen Island Municipality sponsored a small grants program for summer beautification projects in order to stimulate community involvement for the Communities in Bloom judges' tour. Open to any Bowen business, organization or individual, the matching grant competition resulted in four awards.
Cherie Westmoreland of the Bowen Island Seniors Housing Cooperative (Bowen Court) received $500 to help develop a floral display to complement signage and improve the appearance of the property frontage. Wynn Nielsen was awarded $500 to add decorative pots and plants on the Village Square patio, working with the approval of the business property owners. Tourism Bowen Island's Jody Lorenz requested $400 for decorative planters and flowers for Boulevard Cottage, a municipal building in Snug Cove. Margaret Miller of Artisan Office Services will use her $500 grant toward a new bench and planter in front of her Artisan Square shop.
BIM is pleased to have supported these improvements and looks forward to the Innovation Grants becoming an annual program.
How does Communities in Bloom benefit Bowen Island?
Other communities have benefited in the following ways. As Bowen continues its participation in Communities in Bloom, we expect to realize some of the same benefits.
Best practices and information exchange
Valuable information and feedback from the judges
Economic development and increased property values
Marketing and promotional opportunities
Positive benefits for the tourism, hospitality and retail industries
Decreased vandalism
Social benefits
Increased civic pride and community involvement
Participation from all ages and walks of life of the community
Mobilization of citizens, groups, organizations, businesses and municipality working together
Year-round projects and continuous improvement for the entire community
Information and cultural exchange within the community and with neighbouring, national and international communities
Improved quality of life
And, most importantly:
Environmental stewardship through the enhancement of green spaces
Offsetting the production of greenhouse gases
Mitigation of heat islands
Reducing soil erosion
Responsible use of water
Conservation of green spaces
Definitions of Evaluation Criteria
Tidiness includes an overall tidiness effort by the municipality, businesses, institutions and the residents throughout the community. Elements for evaluation are parks and green spaces, medians, boulevards, sidewalks, streets; municipal, commercial, institutional and residential properties; ditches, road shoulders, vacant lots, signs and buildings; weed control, litter clean-up (including cigarette butts and gum), graffiti prevention/removal and vandalism deterrent programs.
Environmental action pertains to the impact of human activities on the environment and the subsequent efforts and achievements of the community with respect to: policies, by-laws, programs and best practices for waste reduction and landfill diversion, composting sites, landfill sites, hazardous waste collections, water conservation, energy conservation, and environmental stewardship activities under the guiding principles of sustainable development pertaining to green spaces.
Heritage conservation includes efforts to preserve natural and cultural heritage within the community. Preservation of natural heritage pertains to policies, plans and actions concerning all elements of biodiversity including flora and fauna ecosystems and associated geological structures and formations. Cultural conservation refers to the heritage that helps define the community including the legacy of tangible (built/hard assets) elements such as heritage buildings, monuments, memorials, cemeteries, artifacts, museums and intangible elements such as traditions, customs, festivals and celebrations. The participation of groups such as historical societies and conservation groups are considered.
Urban Forestry includes the efforts of the municipality, businesses, institutions and residents with regards to written policies, by-laws, standards for tree management (selection, planting, and maintenance), long and short-term management plans, tree replacement policies, pollinator friendly tree selection, tree inventory, and Integrated Pest Management (IPM), heritage, memorial and commemorative trees.
Landscape includes planning, design, construction and maintenance of parks and green spaces suitable for the intended use and location on a year-round basis. Elements for evaluation include: native and introduced materials; balance of plants, materials and constructed elements; appropriate integration of hard surfaces and art elements, use of turf and groundcovers. Landscape design should harmonize the interests of all sectors of the community. Standards of execution and maintenance should demonstrate best practices, including quality of naturalization, use of groundcovers and wildflowers along with turf management.
Floral displays evaluates efforts of the municipality, businesses, institutions and residents to design, plan, execute, and maintain floral displays of high quality standards. Evaluation includes the design and arrangements of flowers and plants (annuals, perennials, bulbs, ornamental grasses, edible plants, water efficient and pollinator friendly plants) in the context of originality, distribution, location, diversity and balance, colour, and harmony This pertains to flowerbeds, carpet bedding, containers, baskets and window boxes.

redpajama_set_name: RedPajamaCommonCrawl


text:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "./bit_reader.h"
#include "./context.h"
#include "./decode.h"
#include "./dictionary.h"
#include "./transform.h"
#include "./huffman.h"
#include "./prefix.h"
#include "./safe_malloc.h"

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif

#ifdef BROTLI_DECODE_DEBUG
#define BROTLI_LOG_UINT(name)                                    \
  printf("[%s] %s = %lu\n", __func__, #name, (unsigned long)(name))
#define BROTLI_LOG_ARRAY_INDEX(array_name, idx)                  \
  printf("[%s] %s[%lu] = %lu\n", __func__, #array_name, \
         (unsigned long)(idx), (unsigned long)array_name[idx])
#else
#define BROTLI_LOG_UINT(name)
#define BROTLI_LOG_ARRAY_INDEX(array_name, idx)
#endif

static const uint8_t kDefaultCodeLength = 8;
static const uint8_t kCodeLengthRepeatCode = 16;
static const int kNumLiteralCodes = 256;
static const int kNumInsertAndCopyCodes = 704;
static const int kNumBlockLengthCodes = 26;
static const int kLiteralContextBits = 6;
static const int kDistanceContextBits = 2;

#define HUFFMAN_TABLE_BITS      8
#define HUFFMAN_TABLE_MASK      0xff
/* This is a rough estimate, not an exact bound. */
#define HUFFMAN_MAX_TABLE_SIZE  2048

#define CODE_LENGTH_CODES 18
static const uint8_t kCodeLengthCodeOrder[CODE_LENGTH_CODES] = {
  1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
};

#define NUM_DISTANCE_SHORT_CODES 16
static const int kDistanceShortCodeIndexOffset[NUM_DISTANCE_SHORT_CODES] = {
  3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
};

static const int kDistanceShortCodeValueOffset[NUM_DISTANCE_SHORT_CODES] = {
  0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
};

static BROTLI_INLINE int DecodeWindowBits(BrotliBitReader* br) {
  if (BrotliReadBits(br, 1)) {
    return 17 + (int)BrotliReadBits(br, 3);
  } else {
    return 16;
  }
}

/* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
static BROTLI_INLINE int DecodeVarLenUint8(BrotliBitReader* br) {
  if (BrotliReadBits(br, 1)) {
    int nbits = (int)BrotliReadBits(br, 3);
    if (nbits == 0) {
      return 1;
    } else {
      return (int)BrotliReadBits(br, nbits) + (1 << nbits);
    }
  }
  return 0;
}

static void DecodeMetaBlockLength(BrotliBitReader* br,
                                  int* meta_block_length,
                                  int* input_end,
                                  int* is_uncompressed) {
  int size_nibbles;
  int i;
  *input_end = (int)BrotliReadBits(br, 1);
  *meta_block_length = 0;
  *is_uncompressed = 0;
  if (*input_end && BrotliReadBits(br, 1)) {
    return;
  }
  size_nibbles = (int)BrotliReadBits(br, 2) + 4;
  for (i = 0; i < size_nibbles; ++i) {
    *meta_block_length |= (int)BrotliReadBits(br, 4) << (i * 4);
  }
  ++(*meta_block_length);
  if (!*input_end) {
    *is_uncompressed = (int)BrotliReadBits(br, 1);
  }
}

/* Decodes the next Huffman code from bit-stream. */
static BROTLI_INLINE int ReadSymbol(const HuffmanCode* table,
                                    BrotliBitReader* br) {
  int nbits;
  BrotliFillBitWindow(br);
  table += (int)(br->val_ >> br->bit_pos_) & HUFFMAN_TABLE_MASK;
  nbits = table->bits - HUFFMAN_TABLE_BITS;
  if (nbits > 0) {
    br->bit_pos_ += HUFFMAN_TABLE_BITS;
    table += table->value;
    table += (int)(br->val_ >> br->bit_pos_) & ((1 << nbits) - 1);
  }
  br->bit_pos_ += table->bits;
  return table->value;
}

static void PrintUcharVector(const uint8_t* v, int len) {
  while (len-- > 0) printf(" %d", *v++);
  printf("\n");
}

static int ReadHuffmanCodeLengths(
    const uint8_t* code_length_code_lengths,
    int num_symbols, uint8_t* code_lengths,
    BrotliBitReader* br) {
  int symbol = 0;
  uint8_t prev_code_len = kDefaultCodeLength;
  int repeat = 0;
  uint8_t repeat_code_len = 0;
  int space = 32768;
  HuffmanCode table[32];

  if (!BrotliBuildHuffmanTable(table, 5,
                               code_length_code_lengths,
                               CODE_LENGTH_CODES)) {
    printf("[ReadHuffmanCodeLengths] Building code length tree failed: ");
    PrintUcharVector(code_length_code_lengths, CODE_LENGTH_CODES);
    return 0;
  }

  while (symbol < num_symbols && space > 0) {
    const HuffmanCode* p = table;
    uint8_t code_len;
    if (!BrotliReadMoreInput(br)) {
      printf("[ReadHuffmanCodeLengths] Unexpected end of input.\n");
      return 0;
    }
    BrotliFillBitWindow(br);
    p += (br->val_ >> br->bit_pos_) & 31;
    br->bit_pos_ += p->bits;
    code_len = (uint8_t)p->value;
    if (code_len < kCodeLengthRepeatCode) {
      repeat = 0;
      code_lengths[symbol++] = code_len;
      if (code_len != 0) {
        prev_code_len = code_len;
        space -= 32768 >> code_len;
      }
    } else {
      const int extra_bits = code_len - 14;
      int old_repeat;
      int repeat_delta;
      uint8_t new_len = 0;
      if (code_len == kCodeLengthRepeatCode) {
        new_len =  prev_code_len;
      }
      if (repeat_code_len != new_len) {
        repeat = 0;
        repeat_code_len = new_len;
      }
      old_repeat = repeat;
      if (repeat > 0) {
        repeat -= 2;
        repeat <<= extra_bits;
      }
      repeat += (int)BrotliReadBits(br, extra_bits) + 3;
      repeat_delta = repeat - old_repeat;
      if (symbol + repeat_delta > num_symbols) {
        return 0;
      }
      memset(&code_lengths[symbol], repeat_code_len, (size_t)repeat_delta);
      symbol += repeat_delta;
      if (repeat_code_len != 0) {
        space -= repeat_delta << (15 - repeat_code_len);
      }
    }
  }
  if (space != 0) {
    printf("[ReadHuffmanCodeLengths] space = %d\n", space);
    return 0;
  }
  memset(&code_lengths[symbol], 0, (size_t)(num_symbols - symbol));
  return 1;
}

static int ReadHuffmanCode(int alphabet_size,
                           HuffmanCode* table,
                           BrotliBitReader* br) {
  int ok = 1;
  int table_size = 0;
  int simple_code_or_skip;
  uint8_t* code_lengths = NULL;

  code_lengths =
      (uint8_t*)BrotliSafeMalloc((uint64_t)alphabet_size,
                                 sizeof(*code_lengths));
  if (code_lengths == NULL) {
    return 0;
  }
  if (!BrotliReadMoreInput(br)) {
    printf("[ReadHuffmanCode] Unexpected end of input.\n");
    return 0;
  }
  /* simple_code_or_skip is used as follows:
     1 for simple code;
     0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
  simple_code_or_skip = (int)BrotliReadBits(br, 2);
  BROTLI_LOG_UINT(simple_code_or_skip);
  if (simple_code_or_skip == 1) {
    /* Read symbols, codes & code lengths directly. */
    int i;
    int max_bits_counter = alphabet_size - 1;
    int max_bits = 0;
    int symbols[4] = { 0 };
    const int num_symbols = (int)BrotliReadBits(br, 2) + 1;
    while (max_bits_counter) {
      max_bits_counter >>= 1;
      ++max_bits;
    }
    memset(code_lengths, 0, (size_t)alphabet_size);
    for (i = 0; i < num_symbols; ++i) {
      symbols[i] = (int)BrotliReadBits(br, max_bits) % alphabet_size;
      code_lengths[symbols[i]] = 2;
    }
    code_lengths[symbols[0]] = 1;
    switch (num_symbols) {
      case 1:
        break;
      case 3:
        ok = ((symbols[0] != symbols[1]) &&
              (symbols[0] != symbols[2]) &&
              (symbols[1] != symbols[2]));
        break;
      case 2:
        ok = (symbols[0] != symbols[1]);
        code_lengths[symbols[1]] = 1;
        break;
      case 4:
        ok = ((symbols[0] != symbols[1]) &&
              (symbols[0] != symbols[2]) &&
              (symbols[0] != symbols[3]) &&
              (symbols[1] != symbols[2]) &&
              (symbols[1] != symbols[3]) &&
              (symbols[2] != symbols[3]));
        if (BrotliReadBits(br, 1)) {
          code_lengths[symbols[2]] = 3;
          code_lengths[symbols[3]] = 3;
        } else {
          code_lengths[symbols[0]] = 2;
        }
        break;
    }
    BROTLI_LOG_UINT(num_symbols);
  } else {  /* Decode Huffman-coded code lengths. */
    int i;
    uint8_t code_length_code_lengths[CODE_LENGTH_CODES] = { 0 };
    int space = 32;
    int num_codes = 0;
    /* Static Huffman code for the code length code lengths */
    static const HuffmanCode huff[16] = {
      {2, 0}, {2, 4}, {2, 3}, {3, 2}, {2, 0}, {2, 4}, {2, 3}, {4, 1},
      {2, 0}, {2, 4}, {2, 3}, {3, 2}, {2, 0}, {2, 4}, {2, 3}, {4, 5},
    };
    for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) {
      const int code_len_idx = kCodeLengthCodeOrder[i];
      const HuffmanCode* p = huff;
      uint8_t v;
      BrotliFillBitWindow(br);
      p += (br->val_ >> br->bit_pos_) & 15;
      br->bit_pos_ += p->bits;
      v = (uint8_t)p->value;
      code_length_code_lengths[code_len_idx] = v;
      BROTLI_LOG_ARRAY_INDEX(code_length_code_lengths, code_len_idx);
      if (v != 0) {
        space -= (32 >> v);
        ++num_codes;
      }
    }
    ok = (num_codes == 1 || space == 0) &&
        ReadHuffmanCodeLengths(code_length_code_lengths,
                               alphabet_size, code_lengths, br);
  }
  if (ok) {
    table_size = BrotliBuildHuffmanTable(table, HUFFMAN_TABLE_BITS,
                                         code_lengths, alphabet_size);
    if (table_size == 0) {
      printf("[ReadHuffmanCode] BuildHuffmanTable failed: ");
      PrintUcharVector(code_lengths, alphabet_size);
    }
  }
  free(code_lengths);
  return table_size;
}

static BROTLI_INLINE int ReadBlockLength(const HuffmanCode* table,
                                         BrotliBitReader* br) {
  int code;
  int nbits;
  code = ReadSymbol(table, br);
  nbits = kBlockLengthPrefixCode[code].nbits;
  return kBlockLengthPrefixCode[code].offset + (int)BrotliReadBits(br, nbits);
}

static int TranslateShortCodes(int code, int* ringbuffer, int index) {
  int val;
  if (code < NUM_DISTANCE_SHORT_CODES) {
    index += kDistanceShortCodeIndexOffset[code];
    index &= 3;
    val = ringbuffer[index] + kDistanceShortCodeValueOffset[code];
  } else {
    val = code - NUM_DISTANCE_SHORT_CODES + 1;
  }
  return val;
}

static void MoveToFront(uint8_t* v, uint8_t index) {
  uint8_t value = v[index];
  uint8_t i = index;
  for (; i; --i) v[i] = v[i - 1];
  v[0] = value;
}

static void InverseMoveToFrontTransform(uint8_t* v, int v_len) {
  uint8_t mtf[256];
  int i;
  for (i = 0; i < 256; ++i) {
    mtf[i] = (uint8_t)i;
  }
  for (i = 0; i < v_len; ++i) {
    uint8_t index = v[i];
    v[i] = mtf[index];
    if (index) MoveToFront(mtf, index);
  }
}

/* Contains a collection of huffman trees with the same alphabet size. */
typedef struct {
  int alphabet_size;
  int num_htrees;
  HuffmanCode* codes;
  HuffmanCode** htrees;
} HuffmanTreeGroup;

static void HuffmanTreeGroupInit(HuffmanTreeGroup* group, int alphabet_size,
                                 int ntrees) {
  group->alphabet_size = alphabet_size;
  group->num_htrees = ntrees;
  group->codes = (HuffmanCode*)malloc(
      sizeof(HuffmanCode) * (size_t)(ntrees * HUFFMAN_MAX_TABLE_SIZE));
  group->htrees = (HuffmanCode**)malloc(sizeof(HuffmanCode*) * (size_t)ntrees);
}

static void HuffmanTreeGroupRelease(HuffmanTreeGroup* group) {
  if (group->codes) {
    free(group->codes);
  }
  if (group->htrees) {
    free(group->htrees);
  }
}

static int HuffmanTreeGroupDecode(HuffmanTreeGroup* group,
                                  BrotliBitReader* br) {
  int i;
  int table_size;
  HuffmanCode* next = group->codes;
  for (i = 0; i < group->num_htrees; ++i) {
    group->htrees[i] = next;
    table_size = ReadHuffmanCode(group->alphabet_size, next, br);
    next += table_size;
    if (table_size == 0) {
      return 0;
    }
  }
  return 1;
}

static int DecodeContextMap(int context_map_size,
                            int* num_htrees,
                            uint8_t** context_map,
                            BrotliBitReader* br) {
  int ok = 1;
  int use_rle_for_zeros;
  int max_run_length_prefix = 0;
  HuffmanCode* table;
  int i;
  if (!BrotliReadMoreInput(br)) {
    printf("[DecodeContextMap] Unexpected end of input.\n");
    return 0;
  }
  *num_htrees = DecodeVarLenUint8(br) + 1;

  BROTLI_LOG_UINT(context_map_size);
  BROTLI_LOG_UINT(*num_htrees);

  *context_map = (uint8_t*)malloc((size_t)context_map_size);
  if (*context_map == 0) {
    return 0;
  }
  if (*num_htrees <= 1) {
    memset(*context_map, 0, (size_t)context_map_size);
    return 1;
  }

  use_rle_for_zeros = (int)BrotliReadBits(br, 1);
  if (use_rle_for_zeros) {
    max_run_length_prefix = (int)BrotliReadBits(br, 4) + 1;
  }
  table = (HuffmanCode*)malloc(HUFFMAN_MAX_TABLE_SIZE * sizeof(*table));
  if (table == NULL) {
    return 0;
  }
  if (!ReadHuffmanCode(*num_htrees + max_run_length_prefix, table, br)) {
    ok = 0;
    goto End;
  }
  for (i = 0; i < context_map_size;) {
    int code;
    if (!BrotliReadMoreInput(br)) {
      printf("[DecodeContextMap] Unexpected end of input.\n");
      ok = 0;
      goto End;
    }
    code = ReadSymbol(table, br);
    if (code == 0) {
      (*context_map)[i] = 0;
      ++i;
    } else if (code <= max_run_length_prefix) {
      int reps = 1 + (1 << code) + (int)BrotliReadBits(br, code);
      while (--reps) {
        if (i >= context_map_size) {
          ok = 0;
          goto End;
        }
        (*context_map)[i] = 0;
        ++i;
      }
    } else {
      (*context_map)[i] = (uint8_t)(code - max_run_length_prefix);
      ++i;
    }
  }
  if (BrotliReadBits(br, 1)) {
    InverseMoveToFrontTransform(*context_map, context_map_size);
  }
End:
  free(table);
  return ok;
}

static BROTLI_INLINE void DecodeBlockType(const int max_block_type,
                                          const HuffmanCode* trees,
                                          int tree_type,
                                          int* block_types,
                                          int* ringbuffers,
                                          int* indexes,
                                          BrotliBitReader* br) {
  int* ringbuffer = ringbuffers + tree_type * 2;
  int* index = indexes + tree_type;
  int type_code = ReadSymbol(&trees[tree_type * HUFFMAN_MAX_TABLE_SIZE], br);
  int block_type;
  if (type_code == 0) {
    block_type = ringbuffer[*index & 1];
  } else if (type_code == 1) {
    block_type = ringbuffer[(*index - 1) & 1] + 1;
  } else {
    block_type = type_code - 2;
  }
  if (block_type >= max_block_type) {
    block_type -= max_block_type;
  }
  block_types[tree_type] = block_type;
  ringbuffer[(*index) & 1] = block_type;
  ++(*index);
}

/* Copy len bytes from src to dst. It can write up to ten extra bytes
   after the end of the copy.

   The main part of this loop is a simple copy of eight bytes at a time until
   we've copied (at least) the requested amount of bytes.  However, if dst and
   src are less than eight bytes apart (indicating a repeating pattern of
   length < 8), we first need to expand the pattern in order to get the correct
   results. For instance, if the buffer looks like this, with the eight-byte
   <src> and <dst> patterns marked as intervals:

      abxxxxxxxxxxxx
      [------]           src
        [------]         dst

   a single eight-byte copy from <src> to <dst> will repeat the pattern once,
   after which we can move <dst> two bytes without moving <src>:

      ababxxxxxxxxxx
      [------]           src
          [------]       dst

   and repeat the exercise until the two no longer overlap.

   This allows us to do very well in the special case of one single byte
   repeated many times, without taking a big hit for more general cases.

   The worst case of extra writing past the end of the match occurs when
   dst - src == 1 and len == 1; the last copy will read from byte positions
   [0..7] and write to [4..11], whereas it was only supposed to write to
   position 1. Thus, ten excess bytes.
*/
static BROTLI_INLINE void IncrementalCopyFastPath(
    uint8_t* dst, const uint8_t* src, int len) {
  if (src < dst) {
    while (dst - src < 8) {
      UNALIGNED_COPY64(dst, src);
      len -= (int)(dst - src);
      dst += dst - src;
    }
  }
  while (len > 0) {
    UNALIGNED_COPY64(dst, src);
    src += 8;
    dst += 8;
    len -= 8;
  }
}

int CopyUncompressedBlockToOutput(BrotliOutput output, int len, int pos,
                                  uint8_t* ringbuffer, int ringbuffer_mask,
                                  BrotliBitReader* br) {
  const int rb_size = ringbuffer_mask + 1;
  uint8_t* ringbuffer_end = ringbuffer + rb_size;
  int rb_pos = pos & ringbuffer_mask;
  int br_pos = br->pos_ & BROTLI_IBUF_MASK;
  int nbytes;

  /* For short lengths copy byte-by-byte */
  if (len < 8 || br->bit_pos_ + (uint32_t)(len << 3) < br->bit_end_pos_) {
    while (len-- > 0) {
      if (!BrotliReadMoreInput(br)) {
        return 0;
      }
      ringbuffer[rb_pos++]= (uint8_t)BrotliReadBits(br, 8);
      if (rb_pos == rb_size) {
        if (BrotliWrite(output, ringbuffer, (size_t)rb_size) < rb_size) {
          return 0;
        }
        rb_pos = 0;
      }
    }
    return 1;
  }

  if (br->bit_end_pos_ < 64) {
    return 0;
  }

  /* Copy remaining 0-8 bytes from br->val_ to ringbuffer. */
  while (br->bit_pos_ < 64) {
    ringbuffer[rb_pos] = (uint8_t)(br->val_ >> br->bit_pos_);
    br->bit_pos_ += 8;
    ++rb_pos;
    --len;
  }

  /* Copy remaining bytes from br->buf_ to ringbuffer. */
  nbytes = (int)(br->bit_end_pos_ - br->bit_pos_) >> 3;
  if (br_pos + nbytes > BROTLI_IBUF_MASK) {
    int tail = BROTLI_IBUF_MASK + 1 - br_pos;
    memcpy(&ringbuffer[rb_pos], &br->buf_[br_pos], (size_t)tail);
    nbytes -= tail;
    rb_pos += tail;
    len -= tail;
    br_pos = 0;
  }
  memcpy(&ringbuffer[rb_pos], &br->buf_[br_pos], (size_t)nbytes);
  rb_pos += nbytes;
  len -= nbytes;

  /* If we wrote past the logical end of the ringbuffer, copy the tail of the
     ringbuffer to its beginning and flush the ringbuffer to the output. */
  if (rb_pos >= rb_size) {
    if (BrotliWrite(output, ringbuffer, (size_t)rb_size) < rb_size) {
      return 0;
    }
    rb_pos -= rb_size;
    memcpy(ringbuffer, ringbuffer_end, (size_t)rb_pos);
  }

  /* If we have more to copy than the remaining size of the ringbuffer, then we
     first fill the ringbuffer from the input and then flush the ringbuffer to
     the output */
  while (rb_pos + len >= rb_size) {
    nbytes = rb_size - rb_pos;
    if (BrotliRead(br->input_, &ringbuffer[rb_pos], (size_t)nbytes) < nbytes ||
        BrotliWrite(output, ringbuffer, (size_t)rb_size) < nbytes) {
      return 0;
    }
    len -= nbytes;
    rb_pos = 0;
  }

  /* Copy straight from the input onto the ringbuffer. The ringbuffer will be
     flushed to the output at a later time. */
  if (BrotliRead(br->input_, &ringbuffer[rb_pos], (size_t)len) < len) {
    return 0;
  }

  /* Restore the state of the bit reader. */
  BrotliInitBitReader(br, br->input_);
  return 1;
}

int BrotliDecompressedSize(size_t encoded_size,
                           const uint8_t* encoded_buffer,
                           size_t* decoded_size) {
  BrotliMemInput memin;
  BrotliInput input = BrotliInitMemInput(encoded_buffer, encoded_size, &memin);
  BrotliBitReader br;
  int meta_block_len;
  int input_end;
  int is_uncompressed;
  if (!BrotliInitBitReader(&br, input)) {
    return 0;
  }
  DecodeWindowBits(&br);
  DecodeMetaBlockLength(&br, &meta_block_len, &input_end, &is_uncompressed);
  if (!input_end) {
    return 0;
  }
  *decoded_size = (size_t)meta_block_len;
  return 1;
}

int BrotliDecompressBuffer(size_t encoded_size,
                           const uint8_t* encoded_buffer,
                           size_t* decoded_size,
                           uint8_t* decoded_buffer) {
  BrotliMemInput memin;
  BrotliInput in = BrotliInitMemInput(encoded_buffer, encoded_size, &memin);
  BrotliMemOutput mout;
  BrotliOutput out = BrotliInitMemOutput(decoded_buffer, *decoded_size, &mout);
  int success = BrotliDecompress(in, out);
  *decoded_size = mout.pos;
  return success;
}

int BrotliDecompress(BrotliInput input, BrotliOutput output) {
  int ok = 1;
  int i;
  int pos = 0;
  int input_end = 0;
  int window_bits = 0;
  int max_backward_distance;
  int max_distance = 0;
  int ringbuffer_size;
  int ringbuffer_mask;
  uint8_t* ringbuffer;
  uint8_t* ringbuffer_end;
  /* This ring buffer holds a few past copy distances that will be used by */
  /* some special distance codes. */
  int dist_rb[4] = { 16, 15, 11, 4 };
  int dist_rb_idx = 0;
  /* The previous 2 bytes used for context. */
  uint8_t prev_byte1 = 0;
  uint8_t prev_byte2 = 0;
  HuffmanTreeGroup hgroup[3];
  HuffmanCode* block_type_trees = NULL;
  HuffmanCode* block_len_trees = NULL;
  BrotliBitReader br;

  /* We need the slack region for the following reasons:
       - always doing two 8-byte copies for fast backward copying
       - transforms
       - flushing the input ringbuffer when decoding uncompressed blocks */
  static const int kRingBufferWriteAheadSlack = 128 + BROTLI_READ_SIZE;

  if (!BrotliInitBitReader(&br, input)) {
    return 0;
  }

  /* Decode window size. */
  window_bits = DecodeWindowBits(&br);
  max_backward_distance = (1 << window_bits) - 16;

  ringbuffer_size = 1 << window_bits;
  ringbuffer_mask = ringbuffer_size - 1;
  ringbuffer = (uint8_t*)malloc((size_t)(ringbuffer_size +
                                         kRingBufferWriteAheadSlack +
                                         kMaxDictionaryWordLength));
  if (!ringbuffer) {
    ok = 0;
  }
  ringbuffer_end = ringbuffer + ringbuffer_size;

  if (ok) {
    block_type_trees = (HuffmanCode*)malloc(
        3 * HUFFMAN_MAX_TABLE_SIZE * sizeof(HuffmanCode));
    block_len_trees = (HuffmanCode*)malloc(
        3 * HUFFMAN_MAX_TABLE_SIZE * sizeof(HuffmanCode));
    if (block_type_trees == NULL || block_len_trees == NULL) {
      ok = 0;
    }
  }

  while (!input_end && ok) {
    int meta_block_remaining_len = 0;
    int is_uncompressed;
    int block_length[3] = { 1 << 28, 1 << 28, 1 << 28 };
    int block_type[3] = { 0 };
    int num_block_types[3] = { 1, 1, 1 };
    int block_type_rb[6] = { 0, 1, 0, 1, 0, 1 };
    int block_type_rb_index[3] = { 0 };
    int distance_postfix_bits;
    int num_direct_distance_codes;
    int distance_postfix_mask;
    int num_distance_codes;
    uint8_t* context_map = NULL;
    uint8_t* context_modes = NULL;
    int num_literal_htrees;
    uint8_t* dist_context_map = NULL;
    int num_dist_htrees;
    int context_offset = 0;
    uint8_t* context_map_slice = NULL;
    uint8_t literal_htree_index = 0;
    int dist_context_offset = 0;
    uint8_t* dist_context_map_slice = NULL;
    uint8_t dist_htree_index = 0;
    int context_lookup_offset1 = 0;
    int context_lookup_offset2 = 0;
    uint8_t context_mode;
    HuffmanCode* htree_command;

    for (i = 0; i < 3; ++i) {
      hgroup[i].codes = NULL;
      hgroup[i].htrees = NULL;
    }

    if (!BrotliReadMoreInput(&br)) {
      printf("[BrotliDecompress] Unexpected end of input.\n");
      ok = 0;
      goto End;
    }
    BROTLI_LOG_UINT(pos);
    DecodeMetaBlockLength(&br, &meta_block_remaining_len,
                          &input_end, &is_uncompressed);
    BROTLI_LOG_UINT(meta_block_remaining_len);
    if (meta_block_remaining_len == 0) {
      goto End;
    }
    if (is_uncompressed) {
      BrotliSetBitPos(&br, (br.bit_pos_ + 7) & (uint32_t)(~7UL));
      ok = CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos,
                                         ringbuffer, ringbuffer_mask, &br);
      pos += meta_block_remaining_len;
      goto End;
    }
    for (i = 0; i < 3; ++i) {
      num_block_types[i] = DecodeVarLenUint8(&br) + 1;
      if (num_block_types[i] >= 2) {
        if (!ReadHuffmanCode(num_block_types[i] + 2,
                             &block_type_trees[i * HUFFMAN_MAX_TABLE_SIZE],
                             &br) ||
            !ReadHuffmanCode(kNumBlockLengthCodes,
                             &block_len_trees[i * HUFFMAN_MAX_TABLE_SIZE],
                             &br)) {
          ok = 0;
          goto End;
        }
        block_length[i] = ReadBlockLength(
            &block_len_trees[i * HUFFMAN_MAX_TABLE_SIZE], &br);
        block_type_rb_index[i] = 1;
      }
    }

    BROTLI_LOG_UINT(num_block_types[0]);
    BROTLI_LOG_UINT(num_block_types[1]);
    BROTLI_LOG_UINT(num_block_types[2]);
    BROTLI_LOG_UINT(block_length[0]);
    BROTLI_LOG_UINT(block_length[1]);
    BROTLI_LOG_UINT(block_length[2]);

    if (!BrotliReadMoreInput(&br)) {
      printf("[BrotliDecompress] Unexpected end of input.\n");
      ok = 0;
      goto End;
    }
    distance_postfix_bits = (int)BrotliReadBits(&br, 2);
    num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES +
        ((int)BrotliReadBits(&br, 4) << distance_postfix_bits);
    distance_postfix_mask = (1 << distance_postfix_bits) - 1;
    num_distance_codes = (num_direct_distance_codes +
                          (48 << distance_postfix_bits));
    context_modes = (uint8_t*)malloc((size_t)num_block_types[0]);
    if (context_modes == 0) {
      ok = 0;
      goto End;
    }
    for (i = 0; i < num_block_types[0]; ++i) {
      context_modes[i] = (uint8_t)(BrotliReadBits(&br, 2) << 1);
      BROTLI_LOG_ARRAY_INDEX(context_modes, i);
    }
    BROTLI_LOG_UINT(num_direct_distance_codes);
    BROTLI_LOG_UINT(distance_postfix_bits);

    if (!DecodeContextMap(num_block_types[0] << kLiteralContextBits,
                          &num_literal_htrees, &context_map, &br) ||
        !DecodeContextMap(num_block_types[2] << kDistanceContextBits,
                          &num_dist_htrees, &dist_context_map, &br)) {
      ok = 0;
      goto End;
    }

    HuffmanTreeGroupInit(&hgroup[0], kNumLiteralCodes, num_literal_htrees);
    HuffmanTreeGroupInit(&hgroup[1], kNumInsertAndCopyCodes,
                         num_block_types[1]);
    HuffmanTreeGroupInit(&hgroup[2], num_distance_codes, num_dist_htrees);

    for (i = 0; i < 3; ++i) {
      if (!HuffmanTreeGroupDecode(&hgroup[i], &br)) {
        ok = 0;
        goto End;
      }
    }

    context_map_slice = context_map;
    dist_context_map_slice = dist_context_map;
    context_mode = context_modes[block_type[0]];
    context_lookup_offset1 = kContextLookupOffsets[context_mode];
    context_lookup_offset2 = kContextLookupOffsets[context_mode + 1];
    htree_command = hgroup[1].htrees[0];

    while (meta_block_remaining_len > 0) {
      int cmd_code;
      int range_idx;
      int insert_code;
      int copy_code;
      int insert_length;
      int copy_length;
      int distance_code;
      int distance;
      uint8_t context;
      int j;
      const uint8_t* copy_src;
      uint8_t* copy_dst;
      if (!BrotliReadMoreInput(&br)) {
        printf("[BrotliDecompress] Unexpected end of input.\n");
        ok = 0;
        goto End;
      }
      if (block_length[1] == 0) {
        DecodeBlockType(num_block_types[1],
                        block_type_trees, 1, block_type, block_type_rb,
                        block_type_rb_index, &br);
        block_length[1] = ReadBlockLength(
            &block_len_trees[HUFFMAN_MAX_TABLE_SIZE], &br);
        htree_command = hgroup[1].htrees[block_type[1]];
      }
      --block_length[1];
      cmd_code = ReadSymbol(htree_command, &br);
      range_idx = cmd_code >> 6;
      if (range_idx >= 2) {
        range_idx -= 2;
        distance_code = -1;
      } else {
        distance_code = 0;
      }
      insert_code = kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7);
      copy_code = kCopyRangeLut[range_idx] + (cmd_code & 7);
      insert_length = kInsertLengthPrefixCode[insert_code].offset +
          (int)BrotliReadBits(&br, kInsertLengthPrefixCode[insert_code].nbits);
      copy_length = kCopyLengthPrefixCode[copy_code].offset +
          (int)BrotliReadBits(&br, kCopyLengthPrefixCode[copy_code].nbits);
      BROTLI_LOG_UINT(insert_length);
      BROTLI_LOG_UINT(copy_length);
      BROTLI_LOG_UINT(distance_code);
      for (j = 0; j < insert_length; ++j) {
        if (!BrotliReadMoreInput(&br)) {
          printf("[BrotliDecompress] Unexpected end of input.\n");
          ok = 0;
          goto End;
        }
        if (block_length[0] == 0) {
          DecodeBlockType(num_block_types[0],
                          block_type_trees, 0, block_type, block_type_rb,
                          block_type_rb_index, &br);
          block_length[0] = ReadBlockLength(block_len_trees, &br);
          context_offset = block_type[0] << kLiteralContextBits;
          context_map_slice = context_map + context_offset;
          context_mode = context_modes[block_type[0]];
          context_lookup_offset1 = kContextLookupOffsets[context_mode];
          context_lookup_offset2 = kContextLookupOffsets[context_mode + 1];
        }
        context = (kContextLookup[context_lookup_offset1 + prev_byte1] |
                   kContextLookup[context_lookup_offset2 + prev_byte2]);
        BROTLI_LOG_UINT(context);
        literal_htree_index = context_map_slice[context];
        --block_length[0];
        prev_byte2 = prev_byte1;
        prev_byte1 = (uint8_t)ReadSymbol(hgroup[0].htrees[literal_htree_index],
                                         &br);
        ringbuffer[pos & ringbuffer_mask] = prev_byte1;
        BROTLI_LOG_UINT(literal_htree_index);
        BROTLI_LOG_ARRAY_INDEX(ringbuffer, pos & ringbuffer_mask);
        if ((pos & ringbuffer_mask) == ringbuffer_mask) {
          if (BrotliWrite(output, ringbuffer, (size_t)ringbuffer_size) < 0) {
            ok = 0;
            goto End;
          }
        }
        ++pos;
      }
      meta_block_remaining_len -= insert_length;
      if (meta_block_remaining_len <= 0) break;

      if (distance_code < 0) {
        uint8_t context;
        if (!BrotliReadMoreInput(&br)) {
          printf("[BrotliDecompress] Unexpected end of input.\n");
          ok = 0;
          goto End;
        }
        if (block_length[2] == 0) {
          DecodeBlockType(num_block_types[2],
                          block_type_trees, 2, block_type, block_type_rb,
                          block_type_rb_index, &br);
          block_length[2] = ReadBlockLength(
              &block_len_trees[2 * HUFFMAN_MAX_TABLE_SIZE], &br);
          dist_htree_index = (uint8_t)block_type[2];
          dist_context_offset = block_type[2] << kDistanceContextBits;
          dist_context_map_slice = dist_context_map + dist_context_offset;
        }
        --block_length[2];
        context = (uint8_t)(copy_length > 4 ? 3 : copy_length - 2);
        dist_htree_index = dist_context_map_slice[context];
        distance_code = ReadSymbol(hgroup[2].htrees[dist_htree_index], &br);
        if (distance_code >= num_direct_distance_codes) {
          int nbits;
          int postfix;
          int offset;
          distance_code -= num_direct_distance_codes;
          postfix = distance_code & distance_postfix_mask;
          distance_code >>= distance_postfix_bits;
          nbits = (distance_code >> 1) + 1;
          offset = ((2 + (distance_code & 1)) << nbits) - 4;
          distance_code = num_direct_distance_codes +
              ((offset + (int)BrotliReadBits(&br, nbits)) <<
               distance_postfix_bits) + postfix;
        }
      }

      /* Convert the distance code to the actual distance by possibly looking */
      /* up past distnaces from the ringbuffer. */
      distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx);
      if (distance < 0) {
        ok = 0;
        goto End;
      }
      BROTLI_LOG_UINT(distance);

      if (pos < max_backward_distance &&
          max_distance != max_backward_distance) {
        max_distance = pos;
      } else {
        max_distance = max_backward_distance;
      }

      copy_dst = &ringbuffer[pos & ringbuffer_mask];

      if (distance > max_distance) {
        if (copy_length >= kMinDictionaryWordLength &&
            copy_length <= kMaxDictionaryWordLength) {
          int offset = kBrotliDictionaryOffsetsByLength[copy_length];
          int word_id = distance - max_distance - 1;
          int shift = kBrotliDictionarySizeBitsByLength[copy_length];
          int mask = (1 << shift) - 1;
          int word_idx = word_id & mask;
          int transform_idx = word_id >> shift;
          offset += word_idx * copy_length;
          if (transform_idx < kNumTransforms) {
            const uint8_t* word = &kBrotliDictionary[offset];
            int len = TransformDictionaryWord(
                copy_dst, word, copy_length, transform_idx);
            copy_dst += len;
            pos += len;
            meta_block_remaining_len -= len;
            if (copy_dst >= ringbuffer_end) {
              if (BrotliWrite(output, ringbuffer,
                              (size_t)ringbuffer_size) < 0) {
                ok = 0;
                goto End;
              }
              memcpy(ringbuffer, ringbuffer_end,
                     (size_t)(copy_dst - ringbuffer_end));
            }
          } else {
            printf("Invalid backward reference. pos: %d distance: %d "
                   "len: %d bytes left: %d\n", pos, distance, copy_length,
                   meta_block_remaining_len);
            ok = 0;
            goto End;
          }
        } else {
          printf("Invalid backward reference. pos: %d distance: %d "
                 "len: %d bytes left: %d\n", pos, distance, copy_length,
                 meta_block_remaining_len);
          ok = 0;
          goto End;
        }
      } else {
        if (distance_code > 0) {
          dist_rb[dist_rb_idx & 3] = distance;
          ++dist_rb_idx;
        }

        if (copy_length > meta_block_remaining_len) {
          printf("Invalid backward reference. pos: %d distance: %d "
                 "len: %d bytes left: %d\n", pos, distance, copy_length,
                 meta_block_remaining_len);
          ok = 0;
          goto End;
        }

        copy_src = &ringbuffer[(pos - distance) & ringbuffer_mask];

#if (defined(__x86_64__) || defined(_M_X64))
        if (copy_src + copy_length <= ringbuffer_end &&
            copy_dst + copy_length < ringbuffer_end) {
          if (copy_length <= 16 && distance >= 8) {
            UNALIGNED_COPY64(copy_dst, copy_src);
            UNALIGNED_COPY64(copy_dst + 8, copy_src + 8);
          } else {
            IncrementalCopyFastPath(copy_dst, copy_src, copy_length);
          }
          pos += copy_length;
          meta_block_remaining_len -= copy_length;
          copy_length = 0;
        }
#endif

        for (j = 0; j < copy_length; ++j) {
          ringbuffer[pos & ringbuffer_mask] =
              ringbuffer[(pos - distance) & ringbuffer_mask];
          if ((pos & ringbuffer_mask) == ringbuffer_mask) {
            if (BrotliWrite(output, ringbuffer, (size_t)ringbuffer_size) < 0) {
              ok = 0;
              goto End;
            }
          }
          ++pos;
          --meta_block_remaining_len;
        }
      }

      /* When we get here, we must have inserted at least one literal and */
      /* made a copy of at least length two, therefore accessing the last 2 */
      /* bytes is valid. */
      prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask];
      prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask];
    }

    /* Protect pos from overflow, wrap it around at every GB of input data */
    pos &= 0x3fffffff;

 End:
    if (context_modes != 0) {
      free(context_modes);
    }
    if (context_map != 0) {
      free(context_map);
    }
    if (dist_context_map != 0) {
      free(dist_context_map);
    }
    for (i = 0; i < 3; ++i) {
      HuffmanTreeGroupRelease(&hgroup[i]);
    }
  }

  if (ringbuffer != 0) {
    if (BrotliWrite(output, ringbuffer, (size_t)(pos & ringbuffer_mask)) < 0) {
      ok = 0;
    }
    free(ringbuffer);
  }
  if (block_type_trees != 0) {
    free(block_type_trees);
  }
  if (block_len_trees != 0) {
    free(block_len_trees);
  }
  return ok;
}

#if defined(__cplusplus) || defined(c_plusplus)
}    /* extern "C" */
#endif

redpajama_set_name: RedPajamaGithub


text:
Q: Why do Native Messaging Host processes spawned by Firefox have an odd DLL search order? I'm trying to create a browser extension using native messaging, where the messaging host is basically a simple launcher for another (3rd party) native executable.
The 3rd party application relies on various DLLs, some of which need to be loaded from the same directory the executable is in. This works perfectly on Chrome (and chromium based Edge as well), however I ran into issues when using Firefox where the wrong DLL would be loaded.
After monitoring, it appears that instead of looking in the executable directory first, messaging host processes (including all their child processes) started by Firefox have the following DLL search order:

*

*System directory

*16-bit System directory

*Windows directory

*Directory of the executable

*Working Directory

*Directories in path

I was able to reproduce this exact behavior easily in my own launcher application as well by using LoadLibrary without an explicit path, so it is not just the 3rd party app.
Looking through MS documents related to DLL search order, I could not find anything that could cause this, so I am quite lost as to what the issue is, and whether I could go around it somehow.
Already tried the following with no success:

*

*Using cmd.exe as an intermediary to start my process. Tried this both when Firefox starts the native host and when my launcher starts the 3rd party app, neither seem to make a difference.

*Calling SetDllDirectory in the launcher. This just replaces Working Directory, but stays after the System folders in the order. Calling it with null does not change anything.

*Redirection by adding a .local file/directory. This does force the app to load the DLLs from its own directory, but breaks the application for other reasons I have no control over. (I believe there are full-path dll loads in it which also get overridden this way)

These would only be workarounds either way for what seems to be caused by Firefox, as like I said, when launching the app manually, or using Chrome/Edge everything works as expected.
Any clue why this is happening, or a way I could force the application to use the default DLL search order when it's launched by a Firefox messaging host?

redpajama_set_name: RedPajamaStackExchange


INDUSTRIAL HOT WATER BOILER. chain grate hot water boiler, biomass fired hot water boiler, DHL, and SHL coal fired hot water boiler for sale.
Applies advanced water circulation Coconut shell fired boiler for sale in ZG Boiler is a type of biomass fired boiler, Corner Tube Biomass Fired Boiler.
2016/05/29· Yuanda brand DZL series industrial coal /biomass fired steam boiler /hot water boiler for sale Mandy Supermarket Gas Vacuum Water Tube Boiler For Sale.


We present continuous data of outpatient MRI units in Moscow, 2016. Unit uniformity, identical working conditions, compensation schemes, study justification, process monitoring and result analysis as well as first-time adoption of newest information technologies in Moscow allowed for process characterization and advanced result analysis of 28 outpatient MRI units. Presented data encompasses operational parameters of 64326 MRI examinations with results being evaluated on-line. Yearly median number of examinations for one MRI unit was 2076, with first and third quartile being 1830 and 2836. Reasons of low workload were analyzed. For instance, average number of work shifts in a month varied from 24 (95% CI 18-30) to 49 (95% CI 43-52). Workload during the day also varied. In first four hours of work shift up to 40% of all examinations were performed (95%; CI 40.5-41.2). In last four hours of work shift only 20% of all examinations were performed (95% CI 19.7-20.2). Additionally, the interval between sequential studies was 38 minutes, with first quartile being 29 minutes, and third quartile being 55 minutes. The delay was observed in 50.7 cases (95% CI 50.3-51.4). Every fifth delay was longer than 60 minutes, and in 7.4% of cases - longer than 90 minutes (95% CI 7.2-7.6). In best outpatient clinics, the prevalence of these intervals was only 4.8%. Average waiting interval in outpatient clinics was 7.8 days (95% CI 7.7-7.9). In 44.9% of cases, it was shorter than 6 days (95% CI 39.6-47.5) and in 8.2% of cases examination was performed on the day of study reservation. In several clinics waiting interval did not exceed one day without any detrimental effect on overall workload. The results highlight the need to improve operational processes and overall quality of diagnostic services.


text:
Q: storing an array as a linked list in C I'm working in C and am having some trouble. I need to store an array of chars (string) across a linked list. In other words, convert a string to a linked list. Basically, one character per node. For example string, dog\0, rather then storing a null character in the last node it would just point to a null pointer to signify the end of the string…… d->o->g->NULL
An suggestions would be great, thank you
int main(){
    char *string;
    string = malloc(sizeof(char)*100);
    strcpy(string,"cheese");

    node *list = NULL;
    list = createNode(string[0]);

    int i;
    for(i=1;i<strlen(string);i++){
        // this is where I'm stuck, the first char 'c'is in,
        // I'm guessing i wanna loop through and
        // store each char in a new node ?
    }

    return 0;
}

node *createNode(char data){
    node *ptr = malloc(sizeof(node));

    if (ptr == NULL)
    {
        return NULL;
    }

    ptr->data = data;
    ptr->next = NULL;

    return ptr;
}

A: If C++ is OK then here is a working sample:
#include <iostream>
#include <list>
using namespace std;

int main() {
    char str[]="cheese", chr;

    // Store the string in the list
    std::list<char> clist;
    for (int i=0, len=strlen(str); i<len; i++)
        clist.push_back(str[i]);
    clist.push_back('\0');

    // Display the list
    do {
        chr=clist.front();
        cout<<chr<<endl;
        clist.pop_front();
    } while(chr);

    _getwch();
    return 0;
}

A: Here is how to do this in C:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node {
    node *next;
    char data;
};

node *createNode(char data, node *parent) {
    node *ptr=(node*)malloc(sizeof(node));
    if(ptr==NULL) {
        fprintf(stderr, "Memory allocation error.\n");
        exit(1);
    }
    if(parent!=NULL) parent->next=ptr;
    ptr->data=data;
    ptr->next=NULL;
    return ptr;
}

int main() {
    char str[]="cheese";

    // Store the string to the list
    node *first=NULL, *cur=NULL;
    for(int i=0, len=strlen(str); i<len; i++) {
        cur=createNode(str[i],cur);
        if(first==NULL) first=cur;
    }

    // Now print it out
    cur=first;
    while(cur!=NULL) {
        printf("%c\n", cur->data);
        cur=cur->next;
    }

    _getwch();
    return 0;
}


Don Denton's column asking the question of where has that Britishness gone should be required reading for all local tourism organizations.
There is no doubt that Victoria has lost its way as far as attracting tourists to the area and each member should have to answer the question, why? If their answer is the recession, it is not a good enough answer, as tourism numbers have been going down for several years.
Denton's piece has many of the answers and it is high time the powers that be and the Downtown Victoria Business Association take back the identity, so easily given away, of Victoria as a little piece of old England, so that tourists will once again feel they are not dropping in on just another bit of North America.


Thank you forBurj Al Arabbscribe.
Hotel Belvedere Bellagio, Italy through my lenses. If you have a question,Ratings hotelsment, feel free to write in theRatings hotelsments section. Thank you!
Thank you forHotels in Spainbscribe.


Canara Bank launches "CANDI"-its first digital branch in Bengaluru.
Cancer day theme – We can I can.
Dudhwa national park – UP.
FDI in Payment Banks 74% – The foreign shareholding in the payments bank should be as per the Foreign Direct Investment (FDI) policy for private sector banks.
For FDI up to 49 per cent, the approval of the Foreign Investment Promotion Board is required.
Global Trust Bank (GTB) merged with Oriental Bank of Commerce (OBC).
Headquarter of which of the bank is not in Karnataka?
Law related to DISHONORNING OF CHEQUE in section 138.
Reliance Stadium or Indian Petrochemicals Corporation Ltd Sports Complex Ground also known as the IPCL Ground is located in Vadodara, Gujarat.
Resident individuals and professionals with 10 years' experience in banking and finance are eligible to promote universal banks.
Theme of "No Tobacco Day" observed on 31st May – Tobacco a threat to development.
TIES – Trade Infrastructure for Export Scheme.
UNEP Stands for – United Nations Environment Programme.


Loss, death, and grief happens to every family. Nobody is exempt from it. That is why, we should also be prepared for any eventuality. In this light, choosing a casket is integral to planning for a funeral.
The first step to planning for a funeral is choosing a casket.
One component about planning your funeral is choosing a casket or a coffin. There are numerous styles, sizes, and shapes to consider depending on your budget and whether you want to be buried above the ground in a mausoleum or in a traditional site.
In order to find a coffin Brookfield IL funeral homes offer, you should begin by visiting the homes in the area and by looking online. There are usually more options available on the funeral home's website, and the coffin that you like can be ordered so that it's available.
When you talk to the funeral home, ask for a price list as well as a list of the services that are offered for funerals. Some homes provide the basics with the cost of the coffin while others have a set price for everything that you want to include, such as a flower arrangement on top of the coffin or memorial pamphlets for the people who attend your funeral.
Preparing for your funeral is not morbid. It's being practical because it saves your family from a lot of effort while grieving.
Some funeral homes will match the prices offered by competitor's in the area if they see that your business will go to someone else unless the price is dropped.
If you don't feel comfortable talking to someone about planning your funeral, then consider looking online to purchase what you want. Make sure you look at the measurements so that you get something that will suit your height and width.
Online retailers will usually offer lower prices than a funeral home. That is because they don't offer the other services that are available with a funeral home. Meanwhile, some funeral homes will offer a discount on services if you show that you have already purchased a coffin.
If you plan on being cremated, then consider renting a coffin instead of buying one. This will lower the costs associated with planning your funeral while still having the coffin that you desire.
Choosing a casket can be tricky. The important thing is that you have choices so that you can make the best and most practical one.


text:
19/00085 - Thanet Parkway Railway Station - Scheme Delivery
The Cabinet to agree to the progression and delivery of the Thanet Parkway Railway Station project, which will entail, among other processes, the following key activities;
a) undertaking detailed design; and subject to planning approval;
b) completing acquisition of the land; and
c) entering into contracts as necessary for construction.
agree to delegate authority to the Corporate Director of Growth, Environment & Transport, in consultation with the Cabinet Member for Highways and Transportation, to take appropriate actions necessary to implement this decision, including but not limited to, deciding the preferred procurement route and entering in relevant contracts or other legal agreements.
A previous Key Decision was taken by the Cabinet Member for Environment and Transport on 1 August 2014 (14/00056) which approved the delivery of Thanet Parkway Station in the location to the west of Cliffsend, involving:
a) Commencing land acquisition work;
b) Undertaking public consultations to support the project development process; and
c) Undertaking project development work to enable the submission of a planning application and design work for the scheme.
The feasibility design for the scheme received Approval in Principle (equivalent to Network Rail's 'Governance in Railway Investment Projects Stage 3' [GRIP 3] status) in August 2017. Following that milestone, the scheme was progressed through outline design (GRIP 4) and planning application was submitted in May 2018.
Comments received during the planning process regarding the visual impact of the scheme led to changes in the scheme design. As a result, the design work and planning application documents have been amended and are being readied for a resubmission of the planning application in November 2019.
Negotiations for land acquisition have been ongoing with the intention to enter into a contract following this decision approval.
A decision is required to proceed with the delivery of the scheme in order to meet the project delivery programme.
Options - it is a legal requirement (2012 Executive Arrangements regulations) to outline other options considered
A full options analysis has been carried out as part of the scheme business case (Appendix 1). Below is a summary of the options considered as alternatives to delivering Thanet Parkway.
rejected as it would fail to accommodate increasing demand for rail travel, accelerate the delivery of housing and fail to improve access to jobs and employment space.
Increase car parking provision at Ramsgate Station
shortlisted for further investigation but rejected due to the lack of land in the residential area around the station.
Increase car parking provision at Minster Station
rejected due to unsuitable local highway network, impact on Minster village and poorer rail service at Minster.
Shuttle bus from the Birchington-On-Sea Station
rejected due to unattractive journey times and lack of rail access to Ashford, Canterbury and Maidstone.
Direct coach service from London
rejected due to long journey times and low impact on economic growth.
Shuttle bus from Ramsgate Station
rejected due to lack of suitable terminus at Ramsgate and low impact on economic growth.
How the proposed decision meets the objectives of 'Increasing Opportunities, Improving Outcomes: Kent County Council's Strategic Statement (2015-2020)'
Since 2010, Thanet Parkway has been a key strategic transport priority for Kent County Council, with the ambition to deliver the station first mentioned in Growth without Gridlock (December 2010), the third Local Transport Plan (2011-2016), the Rail Action Plan for Kent (April 2011) and most recently in Local Transport Plan 4: Delivering Growth without Gridlock (2016 – 2031) (LTP4). The delivery of the station continues to be of significant importance to the County Council and is a strategic priority in LTP4 because of its ability to improve rail connectivity between East Kent, other Kent towns and London; to improve the attractiveness of the area to employers and thereby address the historic economic disadvantage of East Kent.
The delivery of the station will help meet the overarching objective of LTP4:
To deliver safe and effective transport, ensuring that all Kent's communities and businesses benefit, the environment is enhanced, and economic growth is supported.
Division affected: Birchington & Rural; Ramsgate;
Decision due: Not before 27th Nov 2019 by Cabinet
Reason: In order that the proposed decision can be published for a minimum of 28 days in accordance with statutory requirements.
Lead member: Cabinet Member for Highways and Transport
Lead director: Katie Stewart
Contact: Stewart Fowler 03000 413942 Email: Stewart.Fowler@kent.gov.uk.
Public Consultation:
Public consultations were held on 2nd February – 27 March 2015 and 25 January – 19th March 2017. A statutory planning consultation was held in 2018 following submission of a planning application in May 2018. Further stakeholder engagement has/is being carried out during autumn 2019. This included a public meeting with Cliffsend Parish Council, and the residents of Cliffsend on 10th October 2019.
https://www.kent.gov.uk/roads-and-travel/travelling-around-kent/thanet-parkway-railway-station
Cabinet Committee consultation planned or undertaken
The project was taken to Environment and Transport Cabinet Committee in July 2014, at which the proposed decision (14/00056) was endorsed. The scheme has also featured in many transport strategy documents.
The proposed decision will be taken to Environment and Transport Cabinet Committee on 29 November 2019 prior to Cabinet on 2 December 2019.
Financial implications: The total cost of the project is estimated to be £34.51m based on a 2019 estimate. The scheme funding is comprised of £14m from the Local Growth Fund (administered by the South East Local Enterprise Partnership), £2m from Thanet District Council, £0.7 from the East Kent Spatial Development Company. KCC has committed £2.65m and will commit to funding the remaining amount whilst continuing to explore further external funding opportunities. The business case work has been completed, showing that the project offers high value for money and that the station is commercially viable (net fares revenue is in excess of the on-going cost). Depending on the operating model, there is the potential for the station car park to provide a future income to KCC over a number of years. Growth Environment & Transport, Section 4 – Capital Investment Plans 2019-20 to 2021-22 By Year, Row 6, page 70. Growth Environment & Transport, Section 4 – Capital Investment Plans 2019-20 to 2021-22 By Fund
Legal implications: Invicta Law is providing advice and the land acquisition will be completed by KCC Infrastructure. Any further legal implications to be established through continued engagement with Invicta Law Ltd and Strategic Commissioning
Equalities implications: Equalities implications: An Equalities Impact Assessment has been undertaken and will accompany the report to Environment and Transport Cabinet Committee. Data Protection implications: A Data Protection Impact Assessment is not required as this project does not require the processing of personal data
28/01/2020 - 19/00085 - Thanet Parkway Railway Station - Scheme Delivery
02/12/2019 - Cabinet	19/00085 - Thanet Parkway Railway Station - Delivery 02/12/2019
27/01/2020 - Cabinet	19/00085 - Thanet Parkway Railway Station - Scheme Delivery 27/01/2020