Thursday, March 19, 2020

Speech on Environmental Issues Today Essays

Speech on Environmental Issues Today Essays Speech on Environmental Issues Today Essay Speech on Environmental Issues Today Essay Our Environment how can you and I help save it? Albert Einstein said Look deep into nature, and then you will understand everything better. Our planet is in trouble! Pretty much everywhere you look today you will hear or see something reminding you that our planet’s health is failing. If our planet where a person it would be about time to buy the burial plot and write out the last will and testament. Just a brief list of the things that is ailing her is pollution, acid rain, climate change, the destruction of rainforests and other wild habitats, the decline and extinction of thousands of species of animals and plants. nd so on. I think everyone in here can agree that all of these issues exist and that humans have caused them. Thankfully many of us are concerned about the future of our planet and unless we can find a way of solving the problems then the environment will suffer. I know this all sounds so depressing but we can’t get overwhelmed. Every one of us can do something to help slow down and reverse some of the damage. We cannot leave the problem-solving entirely to the experts we all have a responsibility to our environment.We must learn to live in way that will sustain our world like learn to use our natural resources which include air, freshwater, forests, wildlife, farmland and seas without damaging them. As populations expand and lifestyles change, we have to keep the world in a condition so that future generations will have the same natural resources that we have today. Here I am going to list just a few examples of the threats to our environment as well as some ideas to help you to do something about them. WasteWe humans create a lot of trash! Between 1992 and 2008 household waste increased by 16% and we now produce just under half a ton per person each year. Most of this trash is hauled away by the garbage man and buried in a huge landfill or it is burned. Both of these options are harmful in their own way. Is all our trash really trash? If you think about it, a lot of what we throw away could be used again. It makes sense to reuse and recycle our trash instead of just trying to solve the problem of where to put it!Much of our waste is made up of glass, metal, plastic and paper. Our natural resources such as trees, oil, coal and aluminum are used up in enormous amounts to make these products and the resources will one day be completely used up. So in order to cut down on the energy used lets reuse. What can you do? * Sort out your trash. Organic matter (e. g. potato peelings, left over food, tea leaves etc. ) can be put in to a compost heap in the garden and used as a good, natural fertilizer for the plants. Aluminum cans, glass bottles and newspapers are often collected from our doorsteps, but other items such as plastic bottles, juice cartons and cardboard may not be, in which case they can be taken to nearby recycling banks. You can find out where they are by just searching on line. * Use recycled paper to help save trees. Chlorine bleach is usually used to make newspapers and this pollutes rivers. Its better to use unbleached, recycled paper whenever you can. * Take your old clothes to charity shops.Some are sold, others are returned to textile mills for recycling. * Try to avoid buying plastic. Its hard to recycle. One way to cut down on plastic is to refuse to use plastic bags offered by supermarkets and use cloth re-useable shopping bags instead, or re-use plastic bags over and over again, until they wear out and then recycle them. Pollution The air, water and soil of habitats all over the world have been, and are being polluted in many different ways. This pollution affects the health of living things.Air is damaged by vehicle emissions, and power stations create acid rain which destroys entire forests and lakes. When fossil fuels like oil, gas and coal are burned to provide energy for lighting, cooking etc. they create polluting gases. Oils spills pollute sea water and kill marine life; chemical waste from factories and sewage, and artificial fertilizers from farmland, pollute river water, killing wildlife and spreading disease. What can be done? * Don’t litter. * Use less energy by switching off lights when rooms are not in use, not wasting hot water, not overheating rooms. Use a bicycle or walk instead of using a car when you can. Or rideshare, and use the HOV lane. * If you spot pollution, such as oil on the beach, report it. If you suspect a stream is polluted, report it to the local EPA office. . * Organic foods are produced without the use of artificial fertilizers and pesticides, preventing these pollutants from contaminating habitats and entering the food chain. So it may cost a little more but it is better for you and for the environment. The Greenhouse EffectCertain gases in the atmosphere, mainly carbon dioxide, methane, nitrous oxide and fluorocarbons, act like the glass in a greenhouse, allowing sunlight through to heat the Earths surface but trapping some of the heat as it radiates back into space. Without this the Earth would be frozen and lifeless. However, due to the Human Effect ,greenhouse gases are building up in the atmosphere, causing a greater amount of heat to be reflected back to Earth. This results in an increase in average world temperatures and is already causing more droughts, flooding and extreme weather conditions such as hurricanes which we have all seen on the news.Some ways to Help * Dont waste electricity or heat. Electricity and heating are produced by burning coal, oil and gas and this action gives off carbon dioxide. The more we use the more we pollute. * Car fumes produce carbon dioxide and nitrogen oxide so try to cut down on car trips if possible. Use a bike or walk its good exercise for you too! * Recycle as much of your waste as you can. Methane, the most effective greenhouse gas, is released into the air as the trash in landfill sites rots.Now I realize we can’t all live on a farm and grow our own food and all drive smart cars. We Texans normally can’t walk or take a bike places because everything is so far away. My dream job has always been one that I could ride a bike to, that sounds funny but every little bit helps. Some other things I did were to change out all of my light bulbs with energy efficient ones, and reinsulated my house. This and other things save me money but they also save the environment. Let me leave you with one last thing: Reduce, Reuse, Recycle!

Monday, March 2, 2020

Creating Delphi Components Dynamically (at run-time)

Creating Delphi Components Dynamically (at run-time) Most often when programming in Delphi you dont need to dynamically create a component. If you drop a component on a form, Delphi handles the component creation automatically when the form is created. This article will cover the correct way to programmatically create components at run-time. Dynamic Component Creation There are two ways to dynamically create components. One way is to make a form (or some other TComponent) the owner of the new component. This is a common practice when building composite components where a visual container creates and owns the subcomponents. Doing so will ensure that the newly-created component is destroyed when the owning component is destroyed. To create an instance (object) of a class, you call its Create method. The Create constructor is a class method, as opposed to virtually all other methods you’ll encounter in Delphi programming, which are object methods. For example, the TComponent declares the Create constructor as follows: constructor Create(AOwner: TComponent) ; virtual; Dynamic Creation with OwnersHeres an example of dynamic creation, where Self is a TComponent or TComponent descendant (e.g., an instance of a TForm): with TTimer.Create(Self) dobeginInterval : 1000;Enabled : False;OnTimer : MyTimerEventHandler;end; Dynamic Creation with an Explicit Call to FreeThe second way to create a component is to use nil as the owner. Note that if you do this, you must also explicitly free the object you create as soon as you no longer need it (or youll produce a memory leak). Heres an example of using nil as the owner: with TTable.Create(nil) dotryDataBaseName : MyAlias;TableName : MyTable;Open;Edit;FieldByName(Busy).AsBoolean : True;Post;finallyFree;end; Dynamic Creation and Object ReferencesIt is possible to enhance the two previous examples by assigning the result of the Create call to a variable local to the method or belonging to the class. This is often desirable when references to the component need to be used later, or when scoping problems potentially caused by With blocks need to be avoided. Heres the TTimer creation code from above, using a field variable as a reference to the instantiated TTimer object: FTimer : TTimer.Create(Self) ;with FTimer dobeginInterval : 1000;Enabled : False;OnTimer : MyInternalTimerEventHandler;end; In this example FTimer is a private field variable of the form or visual container (or whatever Self is). When accessing the FTimer variable from methods in this class, it is a very good idea to check to see if the reference is valid before using it. This is done using Delphis Assigned function: if Assigned(FTimer) then FTimer.Enabled : True; Dynamic Creation and Object References without OwnersA variation on this is to create the component with no owner, but maintain the reference for later destruction. The construction code for the TTimer would look like this: FTimer : TTimer.Create(nil) ;with FTimer dobegin...end; And the destruction code (presumably in the forms destructor) would look something like this: FTimer.Free;FTimer : nil;(*Or use FreeAndNil (FTimer) procedure, which frees an object reference and replaces the reference with nil.*) Setting the object reference to nil is critical when freeing objects. The call to Free first checks to see if the object reference is nil or not, and if it isnt, it calls the objects destructor Destroy. Dynamic Creation and Local Object References without Owners Heres the TTable creation code from above, using a local variable as a reference to the instantiated TTable object: localTable : TTable.Create(nil) ;trywith localTable dobeginDataBaseName : MyAlias;TableName : MyTable;end;...// Later, if we want to explicitly specify scope:localTable.Open;localTable.Edit;localTable.FieldByName(Busy).AsBoolean : True;localTable.Post;finallylocalTable.Free;localTable : nil;end; In the example above, localTable is a local variable declared in the same method containing this code. Note that after freeing any object, in general it is a very good idea to set the reference to nil. A Word of Warning IMPORTANT: Do not mix a call to Free with passing a valid owner to the constructor. All of the previous techniques will work and are valid, but the following should never occur in your code: with TTable.Create(self) dotry...finallyFree;end; The code example above introduces unnecessary performance hits, impacts memory slightly, and has the potential to introduce hard to find bugs. Find out why. Note: If a dynamically created component has an owner (specified by the AOwner parameter of the Create constructor), then that owner is responsible for destroying the component. Otherwise, you must explicitly call Free when you no longer need the component. Article originally written by Mark Miller A test program was created in Delphi to time the dynamic creation of 1000 components with varying initial component counts. The test program appears at the bottom of this page. The chart shows a set of results from the test program, comparing the time it takes to create components both with owners and without. Note that this is only a portion of the hit. A similar performance delay can be expected when destroying components. The time to dynamically create components with owners is 1200% to 107960% slower than that to create components without owners, depending on the number of components on the form and the component being created. The Test Program Warning: This test program does not track and free components that are created without owners. By not tracking and freeing these components, times measured for the dynamic creation code more accurately reflect the real time to dynamically create a component. Download Source Code Warning! If you want to dynamically instantiate a Delphi component and explicitly free it sometime later, always pass nil as the owner. Failure to do so can introduce unnecessary risk, as well as performance and code maintenance problems. Read the A warning on dynamically instantiating Delphi components article to learn more...