Thursday 21 April 2011

Addiction Treatment


It is very important to take a professional help and seek assistance of any Drug and Alcohol rehabilitation center if you or someone in your family is addicted towards drug or alcohol. These centers have certain methodologies and approaches for you that restore the wheels of life on right track and also bring back the pace of life.
With the help of several kinds of recovery methods rehabilitation centers emphasizes on retaining the body strength of a person so that he can start his normal daily activities. These days the rehabilitation of alcohol recovery is gaining huge importance as people are getting more addictive towards alcohol and drugs. Rehabilitation helps in recovering from physical and mental health of patients through love, affection and medicines. The right mix of medicines by professionals and physicians play an important role in recovery of patients.Alcoholism treatment is more of psychological treatment which needs more proper care.
The first process is alcohol or drug withdrawal, psychological treatment and therapies which ensure effective results so those patients do not repeat same mistakes in his future. This needs a continuous process of monitoring. I know one such rehabilitation center which provides such services.
It is Narconon and it takes you or your family out from clutches of Heroin addiction, Cocaine addiction, RX addiction, Marijuana addiction, Meth addiction, Ecstasy addiction and alcoholism. It is known for its treatment services such as proven Intervention techniques and other services besides online consulting.
They have different models of treatment which helps a patient to recover steadily physically and mentally so that the patient is not lured again to these addictions of alcohol and drugs. Thus the role of rehabilitation centers is to improve the behavioral manner of affected patients and improve the lifestyle of such people who have realized their mistakes. Stimulating good thoughts and spirit of happiness by working hard or involving mind in some work are some of the targets and goals for rehabs.


Are Colloidal Products Useful?


It is a well known fact that silver is a substitute on behalf of antibiotic medicines. Nevertheless still there is a query to answer that what the uses of Colloidal Silver are. It has already been initiated and demonstrated the same thing continually that the preeminent approach to thwart infirmity and bug is vigorous immune system. The possibility of turning out to be a under par person trim down appreciably if our lifestyle is healthy. It persuades the body and it confers us a hale and hearty immune system.  
CUSTOMARY UTILIZATION OF COLLOIDAL SILVER SUSTAINS IMMUNE SYSTEM:-
There is no doubt that silver has scores of uses. However, the main imperative utilization of silver is the knack to sustain human immune system. Since a few silver produce have revealed the ability to destroy a spacious array of pathogens after the use on habitual basis to foil microbes from rising, followed by a strong immune system which prevents your body from different types of diseases. So the proper utilization of colloidal silver decreases the trauma on immune system which keeps your body fit.
This is the explanation to facilitate silver which is so efficient on a wide series of sicknesses. It is now very clear that why the yields of silver are becoming so popular and people are taking interest on that.
Colloidal silver is very useful on different types of diseases like cold sores, eyes infectivity, Ear aching, sore throat. It is also very beneficial in insect bites, abrasion as well as cuts, various burn ups, and the list is endless. If you are looking for true colloidal silver then it is important to mention that this silver contains millions of minuscule silver scraps dangled in gleaned water. It is blond golden by color. Liquid colloidal silver operates as an influential embryo destroyer along with evenly dominant antimicrobial plus contagion combating treatment.


The Role of Herbs And Spices in Healthy Life



Herbs and spices are very good remedies which have very good capabilities to respond human body. By including spices and herbs in our daily food we can keep away illness at par and ensure healthy life through out. Herbs and spices are capable to impart fragrance and taste to our food items. Since, they have got medicinal properties these goodness also will be absorbed by our body tissues and help to develop healthy body. Their enchanting fragrance and spicy taste are well enough to develop very good environments both physically and mentally. The dishes and foods preparing by these herbs and spices have got very good nutritive value in addition to excellent taste and fragrance.
Cumin is one of the spices we usually use in our dishes. This is an ancient spice and some references regarding it have been made in the bible also. The botanical name of cumin is Cumin Cyminium. With out cumin we cannot prepare any food in our daily life. It is well known for its curative properties. Cumin has peppery flavor and can be used both medicinally and cosmetically. Cumin is a good source of iron and is suitable to increase the hemoglobin content in blood.
Ginger is the other herb which we cannot avoid in any way. With out ginger we cannot prepare any dishes in our kitchen. It is well known for its curative properties and bitter fragrance. The juice of ginger can be crystallized and use afterwards. The juice of ginger will not interact with other medicines or foods we usually consume. Hence, as a medicine the application of ginger is considered as too safe.
Clove is the other spice which we commonly use as medicine. Its medicinal property has remarkable ability to cure aches and pain in our body. Hence clove oil is commonly used to control teeth aches.
In this way herbs and spices have remarkable roles in developing healthy life.

Saturday 16 April 2011

Best Alternative Medicine School

Nowadays we have a number of options available where we can go for medicinal cure. Some options are not traditional but their techniques are also very effectual. The option of   is available. These schools do the treatment with the help of natural means. These are different from regular medical schools. Those people who are interested to start their career in this area can take the complete training from these schools. They get degree after the completing the course and they can start their career in their respective medical field.
People can choose their course as per their interest. We can take the help of massage therapy. Those people who are interested to complete the course of massage therapy can take this course.  courses are also available. The person has to complete the course from a so that they can start their career in this field. Some other options are hydrotherapy, acupressure and acupuncture etc.
There is no doubt that the content of their courses are as per the required standards. People start their career with complete self-belief after finishing the course. There are some world class universities who give training to their students in this field. Some of the examples are Clayton College of natural health, Atlantic university and California institute of integral studies who bring together diverse disciplines containing holistic health for its course. These colleges have a number of programs related to different courses.
The option of alternative medicine is available from a long time however people have just started to take it seriously as a good option. It would be better to do a complete research before you take admission in any school. Do not forget to check the government official approval of that school where you are going to take admission. You should also know your total interest and potential strategies.

Vital Information About Allergies


Those people who are not related to medical field do not know the fact that their diet plays a major role in controlling the allergies. The second of name of allergy is atopy and it happens when there is some mayhem in immune system. Due to the improper diet, our digestion system of the body does not work properly due to which we feel acidity. There is another type of allergy which is called as food allergy. It happens because of the improper co-ordination between your body protein and immune system. There is not special medicine for food allergy. The only way to control is to avoid that food which your body is not digesting properly. It makes a bad effect in our immune system and our body becomes allergic to certain things. If we control our diet then we can surely control our allergy issue. Allergy is the case of hypersensitivity. Our body becomes so much sensitive on certain conditions that we cannot feel normal on that. The outcome can be high fever, sneeze, asthma etc. It can be a big issue if it is not managed properly. We can manage allergy if we follow some correct steps. There are various types of medications that can be useful to control it.
You can easily change your diet routine by adding more vegetables and fruits in your diet chart. It would always be advantageous to eat at least 70% of these eating stuffs. You can remove allergens from your body because vegetables and fruits help to get alkaline PH and acidic PH goes out from your body. Some fruits like grapes, bananas, peaches are very wonderful and your body gets power to fight will allergy. It would be better to avoid sugar processed food because it increases the level of acidity in your body.

How To Remove Wrinkles


Wrinkles on the body are the natural process in everybody’s life. We usually face the issue of wrinkles on our face and throat areas. The skin of these sections is very thin in comparison to other parts of our body due to which wrinkles easy appear on these parts. Do we know what could be the reason of these wrinkles? Our skin is very soft and silky when we come to this world. However with the passage of time some lines come into view and they spoil the beauty. Is it possible to reduce the speed through which wrinkles are coming on to the face? Here we are going to discuss some facts that can be very beneficial to handle this issue.
The most common factor is the sun damage. Our skin is directly affected by the sun whenever we go outside.  Therefore a proper protection from a good sunscreen lotion is required. A good sunscreen lotion protects the collagen fiber of our skin and it keeps the skin soft and silky. Your lifestyle should not be very hectic. It can produce wrinkles on your face. You can do massage on your face with your fingers. It can give you good results. You can also use an antioxidants-loaded skin protection produce. Moisturizer can be very beneficial along with a good facial cleansing product. Moreover you can drink green tea. It is more beneficial than coffee. You should also eat those types of fruits and vegetables through which your body can get protein and omega-3 fatty acids. It enhances the arrangement of your skin and your looks can be very attractive. Do not forget to drink minimum 3 liters of water in a day. Water helps to maintain the level of moisture in your skin which reduces the chances of wrinkles.

Walk For Your Health

Walking is one of the secured and trouble-free ways to maintain your health. It is the physical activity that helps to improve the blood flow in our body due to which every part of our body feels energetic. Walking also helps to develop a good respiratory and emaciated organization due to which the overall health improves quickly. It also improves the mental fitness due to which we can find improvement in our work.
Walking is the form of aerobic workout. It assists to decrease the hazard of diabetes and moreover it also lessens the danger of heart-attack. It also decreases the additional weight. The bone concentration amplifies with the help of walking.
It is an exercise that many people prefer to neglect. However the reason is noticeable. We do this act daily and we do not include the fact in our mind that it is an aerobic activity. It decreases the importance and due to which we start neglecting it. We need to understand that it is not a useless act. It can give us so many health benefits. So why not should we include it in our daily routine? The form of exercise-walking is different from simple walking. You need to be more active while doing exercise-walking. Start slowly and later on shift your momentum to fast walking. It can be very helpful if you want to control your weight. Try that you should not use your vehicle if you are going to a nearby area. You should walk for the better health. You should not think in a way that walking is not helpful. It would be better to make a habit to wake-up early in the morning and go out for a walk. It can give you immense benefits. Therefore do not make excuses and walk to stay fit forever.

What Exactly is True Health


Health is the condition of homeostasis, equilibrium, plus stability in every section of our body. The main target is to get a vigorous body and mind and we do not permit bad health to come in our way. This bad health can be in the form of some unfair physical condition or any unfair mental condition. It is an illusory degree and imaginary level of protection of our body through which we know the condition of our body. It is important that every section of our body should be well-balanced. Some sections like physical, psychological, and spiritual are the section that touches everybody’s life. Therefore a proper co-ordination between all these sections is required for a healthy life.
The complete health means the overall comfort in every section of our existence. A healthy body can perform up to the maximum level and we can give our best. Our physical power will be at the zenith level and we can perform any physical and mental activity with great endurance. Exercise is very important to make our body fit. It is the way through which we can care our physical health. We should not make any excuses to stay away from exercise because it is not going to give us any benefit. Similarly mental strength is also required for a good life. You should try to remain satisfied with present condition however you should give your best to improve further. It can develop your inner strength and the will-power to do better every time. You can stay happily which is going to change the way you look towards the life. We should make a habit to wake-up every morning with a smile and a sense of expectation to do better today. These simple points can be very helpful and you can feel the positive changes in your life.

How To Control Your Weight


The problem of obesity is becoming very common nowadays. Most of the countries around the globe are facing this issue. This additional weight can give you serious health problems that can be dangerous for our life. You should not ignore the point if you find that the size of your clothes is not fit for you now. You feel like tightly engrossed when you wear your clothes. These are the alarming conditions and you should start your work immediately to stay healthy. Here we are going to discuss some tips that can be useful for you to lose the additional weight.
One hour of exercise in a day is very important for everyone. It is the best way to remove the additional fats from your body. There are so many people who have never done any type of exercise throughout in their life. They think that it is useless to make so many efforts. You may find some people who do not even want to talk about exercises. These lazy people think that exercise is a time waste activity. It simply gives pains to the body and nothing else. They prefer to live an unhealthy life by sleeping for a long time. Sleeping is also important for our body however 6 to 7 hours of sleep is sufficient to maintain the weight. The intake calorie capacity of 1050 to 1200 and an hour of workout are very good to stay healthy. Lemon water with a pinch of salt is very helpful to reduce the fats. Try to stay away from burger as well as chocolates. They are very dangerous for our health. Alcoholic beverages as well as cold drinks are also very dangerous for our body. Therefore these simple points can be very helpful to control your weight and you can live a happy life.

Permanent and Safe Treatment for Erectile Dysfunction That You Can Trust


Erectile Dysfunction for men is not just a problem that prevents them from having pleasurable sexual lovemaking sessions. It is instead a problem that also causes relationship troubles, and often leads to the female partner walking out of the relationship because of the dissatisfaction that she faces. More than that, men who suffer from ED are found to have a low level of self-confidence, and are also very depressed about their state. If the problem persists, this lowered self esteem starts to affect other areas of one’s life as well, and can become a huge problem later. Therefore, it is very important for a man to get rid of this problem at the earliest to save himself from being bothered by it, both mentally as well as physically.

ED is a problem in which a man is unable to manage his erections properly during an lovemaking session. This means that there is low endurance on his part, and his performance stops even before the female partner derives any pleasure out of it.

One of the main reasons for ED is Over Masturbation. It has been researched and proven that in the absence of a female partner, men have a tendency to masturbate excessively. This often leads to a situation where a person masturbates more than 2-3 times daily. Due to such intensity and high frequency, the genitals face a lot of friction and do not get a chance to rest. Eventually, without adequate time gaps, the male organ starts to become loose and weak. The semen becomes thinner and the person's sexual strength starts to deteriorate. In his head, a man may constantly desire to have sex, but when it comes to actual sex, he is unable to perform well because of his lowered strength and stamina.

These days, there are chemical as well as natural treatments available for curing ED. Health experts however believe that one should opt for natural methods over chemical ones. This is because natural treatments are much more safe and reliable. Also, they have permanent results, and not short term effects like chemical treatments. Natural medications work at the root of the problem and correct the internal systems, instead of just solving the problem temporarily at the surface level.

To cure erectile dysfunction, you can start to consume herbal and natural supplements such as Booster capsules made of potent herbs and aphrodisiacs. These are easily available, and are priced at reasonable rates. Consuming these regularly proves to be good. Along with that, you can also buy some herbal oils such as Mast Mood oil that you can use to massage on your penile area.

On the surface, Mast Mood oil works to make your male organ longer and improves its structure. From the inside, Mast Mood oil improves blood circulation in the penile area, which leads to better sexual strength and stamina, and it also helps to reduce the pain in the penile area. Moreover, it improves the semen quality and quantity. If used with the ballooning technique, it also improves sexual endurance and helps in better control of the erections.

Herbal Treatment for Precum, Semen Leakage and Pre-Ejaculate

 
A lot of men all over the world suffer from various kinds of sexual problems, but not many are open to discussing it. Research shows that a lot of men are embarrassed to talk about their sexual problems, because they believe that the other person is likely to call them 'incomplete' or something similar. Worse, a lot of women who know that their male partners have sexual problems and have experienced its consequences in bed too are not very open to discussing these things, because they feel that confrontation is going to lead to unnecessary fights and problems. However, health experts and doctors think otherwise. They feel that the first step to curing these problems is to begin by talking about them. The sooner a man starts to feel comfortable about these issues and is willing to get rid of these problems, the earlier the benefits will start to show.

While there is many different kinds of sexual problems that men face, one of the most common problems is that of pre-cum. This is often accompanied by an unexpected leakage of semen. Sudden and unexpected leakage of semen during night is known as Nightfall. As time passes and the situation gets worse, these men start to have seminal discharge during urination as well.

Unfortunately, the worst consequences of these problems are shown during lovemaking, where the man is unable to time the erection well and faces problems of pre ejaculation. This is of course very disappointing for the man and the partner both. Not only does it spoils the foreplay, but also does not give satisfying results to the female partner, making it a very bad experience, devoid of pleasure.

Luckily, these days there are many treatment options available for such problems. From chemical based medicines, to herbal supplements, to even tonics and syrups, there are a lot of ways in which you can get rid of these male sexual problems. However, it is advisable to only go in for the natural options. Chemical based medicines and treatments have side effects, so it is good to prefer natural or herbal supplements such as NF Cure capsules. Also, herbal oils such as Mast Mood oil can be massaged on and around the male organ on a regular basis to see improvements.

The most common reason as to why a lot of men develop these problems in the first place is because of the habit of over masturbation. Therefore, a major part of the treatment is also psychological where the patient is told to develop self-control and not get into excessive masturbation. This is because with over masturbation, the muscles and tissues in the genital area face constant friction without adequate time intervals in the middle, and hence, they start to weaken. This is obviously not good, as it affects the erection process heavily and even makes the semen thinner. The male organ size is also likely to get reduced with increased sexual weakness. Later, the low sexual health starts to affects one's overall health too. Thus, treatment for precum, semen leakage and pre ejaculation should be taken as soon as possible.

Strong Teeth for Useful Herbs and Tooth Ache Remedies

Teeth whitening is about more than looking great, it's also about having confidence and a healthy smile. There are many different at-home teeth whitening products available as well as the option of seeing a cosmetic dentist to have your teeth professionally whitened. But, what if you are looking for a way to naturally whiten your teeth? There are products and ways to whiten your teeth naturally without harsh chemicals or expensive professional treatments.

Useful Herbs for Whitening of Teeth

Babul (Acacia arabica)

The importance of babul in whitening of teeth cannot be expressed in words. It is so much important in Ayurveda for this purpose that the ancient Indians used nothing but the twigs of the babul (the other tree used for this is neem) as disposable toothbrushes. The tannin present in babul is effective in increasing the whiteness of teeth.

Banyan (Ficus religiosa)

The aerial roots of the banyan can also be used as disposable toothbrushes. The banyan roots have astringent properties, which not only make the teeth whiter, but also make the teeth and gums healthier.

Holy Basil (Ocimum sanctum)

The vegetation of the holy basil are dried out in the sun and powdered and use for brushing teeth. The leaves help in maintaining dental hygiene and make the teeth whiter. Apart from the whitening properties, holy basil is also used for protection from problems such as pyorrhea (i.e. bleeding of gums).

Margosa (Azadirachtha indica)

The neem tree, or the margosa, is a traditional remedy for having white healthy teeth. Neem twigs are used by several Indians even today as toothbrushes. Neem oils contain astringent and antiseptic properties to fight bad breath, kill microorganisms accumulated on the teeth and to combat dental caries and cavities.

Tooth Ache Remedies

Onion, though it has a bad reputation because of the specific taste and change of breath that come after consuming it, it is one of the tooth ache remedies you can prepare and easily administer.

Using it, you will help kill the bacteria responsible for your pain and possibly other tooth related problems. You can take a small onion and chew it for five minutes every day and thus you will successfully remove bacteria between your teeth.

You can regularly put a small piece of onion on the hurting tooth to relieve your pain. The juice from it will rinse inside the cavity and thus help in dealing with the pain.

Lemon juice is good when you want to drink cold lemonade but it is also good for your toothache! Why? For it is very rich in vitamin C keeping your teeth and gums healthy. It is one of the easiest found remedies in many homes and the best thing about it is that you can also prepare it very fast.

Compared to his sister, garlic works in the same way. Take two or three seeds of garlic and mix them together and then salt them. Use this mix on your tooth and the cleansing process will be similar to that of the onion.

Sunflower seeds are also storehouse of various elements. They contain vitamin A, fluoride, phosphorus and calcium. Sunflower seeds also prevent bleeding of gums. Foods like parsley, turnip, beet and radishes, to name a few, contain green pigment chlorophyll that helps you keep proper health of your teeth.

Thursday 7 April 2011

Writing code for a big scientific collaboration

One of the striking thing about scientific software is the range of different contexts in which it’s needed.  Scientists need quick-and-dirty scripts to process their data and plot their results; they need prototypes so that they can experiment with new statistical techniques; and they sometimes need to build new software tools that they’ll use again and again in their research.  While a lot of this will be for their own personal research, sometimes the Scientist-Programmer finds themselves developing software as part of a large scientific collaboration.  This has some particular requirements.

Who are you writing for?
The key difference when developing software for a large collaboration is that you are now writing for other people.  Others will be using the software you make, so it has to be more user-friendly than if you were the only user.  Remember, they will most likely have spent a lot less time thinking about the details of the task than you have, so they won’t have your level of familiatiry and expertise.

You may also be writing code that other programmers will need to work with.  So you need to do a good job!  We think you should hold your code to high standard in any event, but it’s particularly important if other people are going to need to work with it.  So try to think about craft of coding.  We can suggest some principles of good coding (here and here), and we certainly think you should be using literate programming.  And if you end up using other people’s code as well, you might need some help in surviving legacy code (which also tells you why other people will appreciate you writing high quality code).

What are you making?
There are a number of things you might be making for the collaboration.  These include the following.

    * data processing module (for a reducion pipeline)
    * tools for exploration and visualisation of data/results
    * statistical tools (automated and/or interactive)
    * simulation software (for example, to produce synthetic data or simulated results)
    * software that’s required in order to run the experiment in the first place
    * databases and interfaces to databases


Be professional!
We hope you do this anyway (!), but it’s extra-important to work and behave in a professional way when you’re developing software for a collaboration.  By holding yourself to good professional standards, as well as acting with professionalism in your dealing with your collaborators, you’ll not only produce good code, you’ll get people using it and giving you feedback.  Remember that your users will be very happy if you’re giving them good software tools and providing prompt and courteous technical support and bug fixes.  This is not only a great way to get a good reputation (which is very important in science, as in many other fields), but all your efforts in this regard help people in the project do more good science, more quickly.  So your simple professionalism will contribute directly to the success of the project.

The science bit…
If you’re writing code for a big scientific collaboration, you’re probably also interested in the science itself (and probably the specific science outcomes of the project).  This is a good thing, because it means you’ll have a greater understanding of what’s required from your code.  For data processing pipelines, you’ll have a good understanding of the charactertistics of the data (you may even have worked on the hardware taking the measurements in the first place).  If your code produces analysis results, you’ll have an understanding of what sorts of results are sensible/stupid and how best to present the results.  And if you’re implementing statistical models, you’ll know what kinds of model are sensible and what prior knowledge it’s reasonable to assume.

In conclusion
While it can take a lot of effort to produce good, robust code for a big collaboration, it’s also a great opportunity to be at the heart of the project.  It’s usually the case that the data are vital to the project, so that building the tools that are used to process/explore the data puts you in a great, central position in the project.  And it means that the good work that you do can have a direct impact on how successful the science i

Generics 101, Part 3: Exploring Generics Through a Generic Stack Type

Java 2 Standard Edition 5.0 introduced generics to Java developers. Since their inclusion in the Java language, generics have proven to be controversial. In the last of his three-part series, Jeff Friesen introduces you to the need for generic methods, focused on how generics are implemented to explain why you couldn’t assign new E[size] to elements.

Generics are language features that many developers have difficulty grasping. Removing this difficulty is the focus of this three-part series on generics.

Part 1 introduced generics by explaining what they are with an emphasis on generic types and parameterized types. It also explained the rationale for bringing generics to Java.

Part 2 dug deeper into generics by showing you how to codify a generic Stack type, and by exploring unbounded and bounded type parameters, type parameter scope, and wildcard arguments in the context of Stack.

This article continues from where Part 2 left off by focusing on generic methods as it explores several versions of a copy() method for copying one collection to another.

Also, this article digs into the topic of arrays and generics, which explains why you could not assign new E[size] to elements in Listing 1’s Stack type – see Part 2.

Finally, to reinforce your understanding of the material presented in all three parts of this series, this article closes with an exercises section of questions to answer.
Generic Copy Method

Suppose you want to create a method for copying one collection (perhaps a set or a list) to another collection. Your first impulse might be to create a void copy(Collection<Object> src, Collection<Object> dest) method. However, such a method's usefulness would be limited because it could only copy collections whose element types are Object[md]collections of Strings couldn't be copied, for example.

If you want to pass source and destination collections whose elements are of arbitrary type (but their element types agree), you need to specify the wildcard character as a placeholder for that type. For example, the following code fragment reveals a copy() method that accepts collections of arbitrary-typed objects as its arguments:

public static void copy(Collection<?> src, Collection<?> dest)
{
   Iterator<?> iter = src.iterator();
   while (iter.hasNext())
      dest.add(iter.next());
}

Although this method's parameter list is now correct, there is a problem, and the compiler outputs an add(capture#469 of ?) in java.util.Collection<capture#469 of ?> cannot be applied to (java.lang.Object) error message when it encounters dest.add(iter.next());.

This error message appears to be incomprehensible, but basically means that the dest.add(iter.next()); method call violates type safety. Because ? implies that any type of object can serve as a collection's element type, it's possible that the destination collection's element type is incompatible with the source collection's element type.

For example, suppose you create a List of String as the source collection and a Set of Integer as the destination collection. Attempting to add the source collection’s String elements to the destination collection, which expects Integers violates type safety. If this copy operation was allowed, a ClassCastException would be thrown when trying to obtain the destination collection's elements.

You could avoid this problem by specifying void copy(Collection<String> src, Collection<String> dest), but this method header limits you to copying only collections of String. Alternatively, you might restrict the wildcard argument, which is demonstrated in the following code fragment:

public static void copy(Collection<? extends String> src,
                        Collection<? super String> dest)
{
   Iterator<? extends String> iter = src.iterator();
   while (iter.hasNext())
      dest.add(iter.next());
}

This code fragment demonstrates a feature of the wildcard argument: You can supply an upper bound or (unlike with a type parameter) a lower bound to limit the types that can be passed as actual type arguments to the generic type. Specify an upper bound via extends followed by the upper bound type after the ?, and a lower bound via super followed by the lower bound type after the ?.

You interpret ? extends String to mean that any actual type argument that is String or a subclass can be passed, and you interpret ? super String to imply that any actual type argument that is String or a superclass can be passed. Because String cannot be subclassed, this means that you can only pass source collections of String and destination collections of String or Object.

We still haven't solved the problem of copying collections of arbitrary element types to other collections (with the same element type). However, there is a solution: Use a generic method (a static or non-static method with a type-generalized implementation). Generic methods are syntactically expressed as follows:

<formal_type_parameter_list> return_type identifier(parameter_list)

The formal_type_parameter_list is the same as when specifying a generic type: it consists of type parameters with optional bounds. A type parameter can appear as the method's return_type, and type parameters can appear in the parameter_list. The compiler infers the actual type arguments from the context in which the method is invoked.

You'll discover many examples of generic methods in the collections framework. For example, its Collections class provides a public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) method for returning the maximum element in the given Collection according to the ordering specified by the supplied Comparator.

We can easily convert copy() into a generic method by prefixing the return type with <T> and replacing each wildcard with T. The resulting method header is <T> void copy(Collection<T> src, Collection<T> dest), and Listing 1 presents its source code as part of an application that copies a List of String to a Set of String.
Listing 1—Copy.java

// Copy.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class Copy
{
   public static void main(String[] args)
   {
      List<String> planetsList = new ArrayList<String>();
      planetsList.add("Mercury");
      planetsList.add("Venus");
      planetsList.add("Earth");
      planetsList.add("Mars");
      planetsList.add("Jupiter");
      planetsList.add("Saturn");
      planetsList.add("Uranus");
      planetsList.add("Neptune");
      Set<String> planetsSet = new TreeSet<String>();
      copy (planetsList, planetsSet);
      Iterator<String> iter = planetsSet.iterator();
      while (iter.hasNext())
         System.out.println(iter.next());
   }
   public static <T> void copy(Collection<T> src, Collection<T> dest)
   {
      Iterator<T> iter = src.iterator();
      while (iter.hasNext())
         dest.add(iter.next());
   }
}

Within the copy() method, notice that type parameter T appears in the context of Iterator<T>, because src.iterator() returns elements of the type passed to T, which happens to match the type of src's elements. Otherwise, the method remains unchanged from its previous incarnations.

Listing 1 generates the following output:

Earth
Jupiter
Mars
Mercury
Neptune
Saturn
Uranus
Venus

“Should I switch to Python?”

Rich has recently been considering switching to the Python programming language.  Currently, Matlab is the language of choice in his department for rapid development and prototyping of code.  It’s very good at this, but Mathworks (the company who produces Matlab) have been tinkering with the licencing terms, leading to hassles where none should exist.  This is very frustrating and leads to the thought that it might be nice to use a free language where this will no longer be an issue.

But of course things are not quite that straightforward.  Matlab is used for good reason – it’s very good at what it does.  So is it worth the effort to stop using Matlab and instead learn to use Python?  In this article we discuss some of the things that’ll need to be considered.

Why Python?
The first question is why out of all the programming languages that exist should we be considering Python?  The bulk of the reasoning is actually contained in the specifics of the sections below, but the starting point is that Python has a good reputation for being nice to work with, it’s already used in some areas of science (suggesting it might be a sensible language to consider), and it has a wider community of users (including some big ones such as Google), so there should be good community support.  So, this looks superficially promising.  What about the specifics?

It’s free…
First up, Python is free.  So no licence problems and no need to find the money to pay for it.  This does mean that there isn’t a company whose raison d’etre is to build new functionality for Python, but there is an active community helping to develop it, so that’s probably not too much of a problem.

What do I need it for?
This is a key question when deciding whether to learn a new language.  If you’re anything like us, you’re attracted to languages because you can do cool things with them, but you should be careful that they are the right cool things for your needs.  In this case, Rich needs a language for building prototype implementations of statistical modelling tools.  So, it needs to be fast to code in, object orientation would be desirable and lots of scientific library support is vital.  Flat-out processing speed is a nice bonus, but is less essential as Rich is happy to recode in C++ if he needs to. (or use a bigger computer)

Library support
For scientific programming, having the right libraries is vital.  We need to generate plots, process data, invert matrices, perform Fast Fourier Transforms and all sorts of specialist things like that.  All of these things can be found in libraries for various programming languages, so it’s sensible to make sure you have access to these.  Python scores well on this count because of packages such as SciPy, BioPython, NumPy and matplotlib.

Usability
This is always tricky to assess without using the language, but the perceived wisdom on the Web, backed up by the opinions of some of our colleagues, is that Python is extremely user-friendly.  Indeed, this is part of the stated design philosophy of Python (see here).

Speed
For prototyping scientific code, computational speed is a bonus rather than a necessity.  At this stage, user time (for programming) is far more valuable than CPU time, so an interpreted language like Python is acceptable.  Comparative benchmarking between languages is notoriously hard (and task specific), but the impression we’ve got is that Python and Matlab are probably of order the same speed, and a couple of orders of magnitude slower that fully compiled languages like C++.  However, in both cases people are working to make Matlab/Python implementations that are faster.  And we probably won’t be losing out significantly by switching from Matlab to Python.

What does everyone else use?
It’s very useful if you’re surrounded by experts in the language you’re using.  It’s also useful if your colleagues know the same languages as you, because they can pick up and use the things you write.  In the case of Rich’s department, many people use Matlab but almost no-one uses Python.  This is a downside.  Of course, someone has to be first whenever a change like this is made, but it would mean that Rich would be on his own to a certain degree.

A tranferable skill…
It’s always prudent to be developing transferable skills and experience with Python would certainly count as that, because it’s widely used in industry and the commercial world.  Matlab is also widely used, although perhaps more in science/engineering settings and less in places like the computing industry.  It’s probably true to say that both have their merits in this regard.

What about Octave?
Wouldn’t it be nice if there was just a free version of Matlab?  Well, there is (sort of):  GNU Octave.  This would be another good solution to Rich’s Matlab issues.  We’re discounting it here mainly because of the concern that it’s less well supported than Python, and also because it’s less of a transferable skill.  Neither of these reasons are killers, however, so we wouldn’t try to dissuade anyone from going down the Octave route.

Scripting for science papers

Scientist-Programmers write a lot of scripts.  It’s part-and-parcel of “trying stuff out”, it’s a quick way to get some number crunching done on those data, and it’s very useful for generating the figures and tables that you need for that paper you’re writing.  In this article, I give a quick once-over of some of the things I’ve learned over the years about using scripts as a scientific tool.

A bit like prototypes…
Scripts share some characteristics with software prototypes.  Your aim is typically to get an answer quickly, writing code that doesn’t (necessarily) need to be very reuseable.  There can also be a learning element here, if you’re trying understand more about exactly how to solve a given problem.  This means that you’ll be subject to many of the same considerations as in a prototype.  Writing quick-and-dirty code in exchance for speed is okay here, provided you can test enough to be confident that you can trust the results it’s generating.

You *will* want to re-run these at some point
Often, you’ll be writing a script to run a one-off analysis.  Perhaps there are enough stages involved that it’s easier to handle by writing down in this way – for example, running an MCMC clustering analysis on some genetic data, summarising the results into a single ‘average’ clustering partition, then using annotation databases to search for patterns of biological function.  All pretty straightforward stuff (and essentially just a set of modules, run in sequence).  Despite being a nominla one-off task, an important lesson I’ve learned over the years is that it’s surprising how often you’ll come back to a script months (or even years) later and need to use it again, either for the same task or a related one.  This can happen for a number of reasons.

    * because you’re returning to an old project
    * you’re responding to referees’ comments on a paper you wrote
    * you’re working on a further development of a previous project
    * You might also simply have come across the need to do a similar set of tasks for a completely different project.

Whatever the reason, you will thank yourself if you’ve taken the time to write some comments and keep the code fairly legible and literate.  This doesn’t take much time to do as you’re writing the script, but will save you huge headaches in getting restarted after months working on other things.

Turning your script into proper software
Sometimes your script will turn out to be useful more than once.  It might even be useful enough that you end up using it regularly and perhaps other people start asking if they can have a copy.  This is great, because you’ve made something useful!  But at this point, you might want to consider turning your script into a proper piece of software.  My suggestion for this is to treat your script as a kind of prototype, meaning that you should start afresh with the planning, coding and testing for the proper software.  This is extra effort, of course, but by definition you’ve identified a case where it’ll be effort well spent.

Links to some great articles on programming


The internet is full of smart people writing intelligently on how to write good software. Very few of these articles are from the perspective of a scientist (hence this blog!) but a lot of what they write is useful, interesting and, occasionally, entertaining. This post is of some of the best articles, posts and websites that have taught us what we know today.


Six ways to write more comprehensible code, by Jeff Vogel uses a game called ‘Kill Bad Aliens’ as a setting for his examples on writing better code. The code is C++ but the tips are nearly all applicable to any language. The only one I don’t agree with is number 2: ‘Use #define a lot. No, a LOT.’ #defines are part of the C/C++ pre-processor macro language that replaces one string with another before the compiler is run. It allows the programmer to replace ‘magic numbers‘ with more descriptive tokens without the overhead of creating constants. I agree that #defines are better than magic numbers but I believe most of those values should be loaded as data and not hard-coded into your program. This way, when (and it will be when and not if) you change your mind you only need to change the data files and not recompile your code. For something that needs as much tuning as a game having loaded, not compiled, data is very important as it allows quicker iterations which means more iterations in a given time and therefore more chance to get the best possible experience.

Bad names. Eric Lippert is one of the people who design the C# language at Microsoft. His blog can be deeply technical but it is always an interesting read. In this post he talks about bad variable/function/class names he has encountered in the C# compiler and what problems various names expose. For instance any name with ‘Misc’ in it is doing more than one thing which is ‘a bad thingTM’. The comments have a few more chipped in by the peanut gallery.

Is it worth spending time on design? by Martin Fowler (the real name is DesignStaminaHypothesis but that name is a bit opaque). This post is about the hypothesis that there is a point below which spending time on design will actually slow you down but that this point is very difficult to judge and, in the authors opinion, is lower than people think. I like this post because it shows that very few things are set in stone and it references two related points (links are in the article): 1) Productivity of a programmer is very hard to measure and 2) the author introduces the concept of technical debt to describe the cost to a project of not planning. Technical Debt is a very powerful concept and can be applied to any time you cut corners to get something done sooners than if you had done it properly.

Friday 1 April 2011

Kept


Download this FREE e-Book that focuses on Greta, a werecat whose tribe plans to sacrifice her during the next full moon. Her only hope for survival is Dayne--a sorcerer who once massacred most of the tribe. Download it today!.

Quatrain


In 1557, 16th Century oracle, Nostradamus, published his opus entitled, "Les Propheties"--a collection of 1,000 four-line, rhyming French verses known as "quatrains". However, only 942 quatrains have ever been found...until now. Can a cynical college professor and his two rebellious teenagers find the Nostradamus' 58 lost quatrains and use them to prevent an impending terrorist attack? And will anyone believe them?

See Night Run


Night Hume is an INET (Inter-Agency Narcotics Enforcement Taskforce) agent in Eugene, Oregon. His years undercover have cost him a home, a marriage, a daughter---yet, always the good soldier, he does his job. Assigned to buy from a college professor who sells to her students, he meets Ceredwen Lawrence---a most unlikely dealer. When due to a misunderstanding and his own weakness, he rents a room in her home for himself and his teenage daughter, Night crosses his Rubicon.

Time Rep


Have you ever wanted to go on holiday to a time period of your choice? Have you ever wondered what it would be like to spend your vacation in ancient Rome, or the Wild West? Well, thanks to Time-Tourism, now you can! You’ll need to know your Time Rep of course – dedicated holiday agents, indigenous to all our time destinations, and trained to meet your every need. Geoffrey Stamp was an average guy from the 21st Century, who had no idea what a Time Rep was. He had no idea he was about to become

Spared






"As I adjusted my eyes going from absolute darkness to the bright lighted street corner, I could see the silhouettes of several soldiers around me. As I was being dragged backwards, I could hear the gravel grind together underneath me and feel the pain of my skin being ripped off as the soldier easily dragged my tiny body behind him. Both my wrists were squeezed together into one handcuff behind my back as the soldier used the other end of the handcuff to drag me along the gravel road. I let out..

A Call from the Dark


What would you do if you found yourself trapped in a movie rental store at ten o’clock at night? Just you and a one prank-calling psycho right out of a B-Grade horror movie. Fifteen-year-old Stacey has just started working part-time in the Video Saloon, a run down, cruddy old video store. She needs the money, as her widowed father is finding it increasingly difficult to cope at home and work. She also finds herself involved in a pirated DVD ring where it’s easy to get in, but not so easy to g...

Lucid Dream I


Download this FREE e-Book that picks up the story as Samiya Mittal returns to her secluded boarding school in Himachal Valley after her vacation. She is prepared to suffer the hardest time of her life as she is in year 11 now, and has chosen science as her major. But once she sees Aadil, her life takes a thrilling turn. Up until that point, Samiya has just been another person in the crowd; but now she will be recognized as the person whose fate is somehow connected to Aadil--the alluring boy, ...

The Identity Check

The Identity Check cover
Fiction, by Ken Merrell

The Identity Check

When a crazy, seemingly harmless old woman pilfers private information, she sets in motion a chaotic, far-reaching chain of events. Before long, a treacherous game of identity theft unfolds that could change the country’s laws forever. Download this FREE e-Book today!

Less
When a crazy, seemingly harmless old woman pilfers private information, she sets in motion a chaotic, far-reaching chain of events. Before long, a treacherous game of identity theft unfolds that could change the country’s laws forever. Download this FREE e-Book today!...

Read more: http://www.free-ebooks.net/ebook/The-Identity-Check#ixzz1IGdSPi9p

Desperate Choices


Rochelle Rathbone flirts with danger when she accidently meets Tobias Chandler, Miami drug czar; thus, setting the stage for horrors she never knew existed until after they married. Innocent and vulnerable, she becomes his prisoner. She devises a desperate plan and successfully escapes, despite his threat to kill her if she does. She meets and falls in love with Michael Matheson, knowing Tobias will come after her. She realizes there are only two things that will stop him from pursuing her—her d...

Master of the Game


This eBook traces the life of Kate Blackwell from the mines to the glory of the battles that she won; and the only one that she ever lost. Intrigue-filled in Sheldon's peculiar style of capturing vivid detail.