Archive for December, 2011

How to Write Your Very First PHP Program

Sunday, December 4th, 2011

Advanced programmers know a secret. The secret that they know relates to how a PHP program is constructed.

Here is the secret:

“Complex programs are built up from simple programs. If you can learn how to create a simple program, you can learn how to build a complex program, no matter how complicated.”

A program can be constructed of only a few lines. They always start the same way. Start with the PHP start tag, followed by your programming code, and last by the PHP end tag.

Example 1:</p> <p>Line 1: <php line your program goes here></php>

The PHP program shown above has only 3 lines. Line 1 & 3 are the start and end tags, line 2 is your functional code. In this case however, line 2 is a comment and will not perform any specific action other than to remind you of something. Comments are not processed by the interpreter. Once a comment is encountered, it is basically ignored.

Example 2:</p> <p>Line 1: <php line this is one comment another the last></php>

The code in example 1 behaves exactly as the code in example 2. Even though example 2 has 2 more lines. If you noticed, the additional lines in example 2 are only comments. Once again they are ignored by the PHP interpreter (PHP Engine).

If there is one comment or multiple comments, the interpreter will act the same way. It will ignore any comments that it finds.

Example 3:</p> <p>Line 1: <php line below this is a real php programming command echo first program></php>

In example 3 you will see your first functioning PHP program. The ‘echo’ command was added to this program, located on line 3. An ‘echo’ statement is a built in PHP command that will output whatever follows it to the screen. Anytime you want to output something using PHP to the screen, web browser, or visual display. Use the simple ‘echo’ command.

As you can see, the words ‘My First Real Program’ follows the ‘echo’ command. It is very important to enclose the words that you want ‘echoed’ on the screen inside single or double quotes. This way the echo command knows from what character to start with, and

what character to end with, as it generates the output to the screen.

When the echo command is called, it takes the contents inside the quotes, and sends it out to the screen – minus the quotes. So the output would be:

My First Real Program

Example 4:</p> <p>Line 1: <php line the next is first echo command are second how to last in php></php>

The output to this program would be:

You are learning how to program in PHP.

When you start programming, there is no limit to how many comments and commands you can enter in your program. Go ahead, try it yourself. As you get better you won’t need so many comments to remind you of what you are doing in your program.

Complex programs are made up of simple programs. Learning how to mix simple commands together, along with PHP start and end tags makes a fully functioning PHP program. As you are learning, a good suggestion is to add as many comments as you need to help remember what you are doing. Comments are like taking notes that you can refer back to. As you get better at programming, you will naturally enter less comments. The PHP ‘echo’ command outputs characters to the screen. Enclose all characters after an ‘echo’ command with single or double quotes.

Congratulations, you just wrote your first PHP program.

Paul Markovich is a Lead Technical Trainer.

He has been designing and building custom web sites for entrepreneurs since 1997. He’ll help you get the answers to your burning open source programming questions!

Looking For More PHP Programming Tips?

Discover Proven Programming Strategies.

Learn to Program faster, while saving time, energy, and money!

http://centeroftech.com

Article Source:
http://EzineArticles.com/?expert=Paul_Markovich

Fish Disease in Tropical Freshwater Fish Tanks Aquariums – Fin and Tail Rot

Friday, December 2nd, 2011

Symptoms

Fin and Tail Rot is a common infection in tank aquariums caused by a group of bacteria called Cytophaga, which affect fish with long, soft fins. The symptoms have a wide range. Generally the tail and fins start looking ragged, either in the form of a ‘bite’ or a ‘shredded’ effect. These lesions are discolored White/Grey with an edging of red. They can form into ulcers which have an orange/yellow color. The fish may also be listless and reluctant to feed. At an advanced stage, large milky patches can be seen on the fins and a sizable amount of tissue will have been destroyed. Respiration will also be rapid with excessive amounts of mucous in the gills and the lips of the fish may be swollen. The main danger is that if left untreated, the disease can rot the entire fin and start to invade the fish’s body.

Causes and Prevention

It is very important to diagnose why this infection has occurred. The bacteria actually exists in most fish tank aquariums without being a problem, therefore the disease is usually triggered by other factors, virtually all cases being precipitated by stress or poor environmental conditions. It is essential to identify and remove underlying stressors.

It is commonly introduced into tank aquariums by new fish from the pet store that harbour the harmful bacteria, which they release into your tank through feces. It is therefore vital to quarantine all new fish for about 10 days before introducing them into new fish tank aquariums. Fish can be extremely sensitive to stress and can also develop the disease due to the trauma of not being carefully acclimatized to a new fish tank environment. It is important that all fish are compatible and peaceful fish are not matched with aggressive fish, as this would lead to bullying which usually results in fin and tail nipping and the wounds provide ideal breeding grounds for the bacteria. Also do not overcrowd tank aquariums as this stresses out fish and can even make peaceful fish become nippy, as well as resulting in polluted tanks.

To identify and remove any problems with water condition, do a check of your water quality using a test kit to ensure there is no build up of unwanted chemicals. Make sure you maintain the proper water parameters particular to the fish species you keep. Hard water with a high pH encourages the growth of the bacteria, as does a sudden dip in temperature.

As part of your regular maintenance routine, ensure all equipment is working properly, especially the filter. Do 15% water changes weekly as well as vacuuming the gravel. You should also try to remove any uneaten food after each feeding time.

Treatment

Before using any medication, do a thorough clean of the fish tank. Scrub the inside of the glass/acrylic and thoroughly clean the gravel to remove waste from the substrate. Alternatively, you may completely remove the gravel for greater effect. You should minimize the areas where the bacteria can live and breed so take away any ornaments in the tank and bleach them. Clean the outside of the fish tank, hood, light and tank top. Water quality plays a critical role in the prevention and cure of fin and tail rot so you need to perform a large water change – I would suggest 50%. Remove activated carbon from filters as this will eliminate any medication you use.

There are different degrees of fin and tail rot which will determine the type of treatment you use in your tropical freshwater aquarium.

For the first stages of the disease, I strongly advise using Melafix along with aquarium salt. This is an all natural medication which will not destroy your biological filter. Use 2 teaspoons (10ml) of Melafix for every 50 gallons of water, combined with 2 tablespoons of aquarium salt per 10 gallons of water. Regular tropical fish will be fine with it. Dissolve the salt in water rather than pouring it into the tank, as if it comes into direct contact with fish it will burn them. The water will foam up and smell of liquorish but this is normal and will soon disappear after the treatment is over and you perform water changes. Perform a 5% water change each day for 10 days and replenish the medication and salt according to the correct ratio to bring the concentration back up to full strength. Continue to keep the tank clean by wiping the sides and vacuuming the gravel (if you keep it). This will treat the bacterial infection and help to heal the damaged fins. You should notice a rapid improvement and regeneration of fish fins. If not, the fish need to be removed to a quarantine tank for stronger treatment.

I would just mention that some advocate using copper sulfate but this risks further damage to the gills of the fish.

For more advanced forms of the disease I would recommend moving the infected fish into a spare, bare tank for treatment. You will need to treat the fish with antibiotics such as Tetracycline, Maracyn-Two or Maracyn Plus Antibacteria for at least 10 days. Carefully follow the instructions and do not mix medications as this can be fatal. These medications are available from pet shops and online vendors.

Keeping fish tanks, aquariums disease-free

Following a protocol of quarantining when adding new fish and carefully acclimatizing them to new tank aquariums, as well as suitably matching fish and avoiding overcrowding, will greatly minimize stress, which is a major cause of the disease. Through regular and thorough maintenance of fish tank aquariums, ensuring good water quality, correct water parameters and efficient filtration, incidence of parasites becoming a problem should be eliminated. Should fin and tail rot occur despite your best efforts, early signs of the disease can be easily detected by carefully monitoring your fish each day, especially at feeding time. Through swift remedial action, fish can be quickly treated and restored to health.

Jill writes concerning some of the dangers encountered maintaining a Freshwater Aquarium. For additional information on fish care visit her website dealing with different types of Fish Tanks.

Article Source:
http://EzineArticles.com/?expert=Jill_Kaestner