Thursday, July 21, 2011

Base64 Encoding and Decoding in C

 
Base64 is a method of encoding arbitrary data as plain ASCII text. It is one of the techniques employed by the MIME standard to send data other than plain text. Base64 encoding takes three bytes, each consisting of eight bits, and represents them as four printable characters in the ASCII standard. It does that in essentially two steps. 

The first step is to convert three bytes to four numbers of six bits. Base64 only uses 6 bits. The 64 characters are 10 digits (0 to 9), 26 lowercase characters (a to z), 26 uppercase characters (A to Z) as well as '+' and '/'.

For example, the three bytes are 155, 162 and 233, the corresponding bit stream is 100110111010001011101001, which in turn corresponds to the 6-bit values 38, 58, 11 and 41.


These numbers are converted to ASCII characters in the second step using the Base64 encoding table. The 6-bit values of our example translate to the ASCII sequence "m6Lp".
  • 155 -> 10011011
  • 162 -> 10100010
  • 233 -> 11101001
  • 100110 -> 38
  • 111010 -> 58
  • 001011 -> 11
  • 101001 -> 41
  • 38 -> m
  • 58 -> 6
  • 11 -> L
  • 41 -> p
This two-step process is applied to the whole sequence of bytes that are encoded. If the size of the original data in bytes is a multiple of three, everything works fine. If it is not, we might end up with one or two 8-bit bytes. For proper encoding, we have to append enough bytes with a value of '0' to create a 3-byte group. The Base64 uses '=' as a padding character.

Sample C Program

The following program in C can be used for Base64 Encoding and Decoding.



--
Sam

Sunday, July 3, 2011

How to check if your antivirus is working properly?


Here is a simple method to check if your antivirus program is working properly or not. Follow the steps below.

Open Notepad and copy the text given below.

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

Save file as "checkantivirus.com" including quotation-marks. (not necessary to be same as this file name, but save it in extension .com

Seconds after saving this file, your Anti-Virus should come with the message that this file is infected with virus asking permission for its deletion/clean.

This file is secure and it’s not going to infect your computer in any way. It is a standard text developed by the European Institute for Computer Anti-virus Research (EICAR). Every Anti-Virus is programmed to load this file as a virus.

If your Anti-Virus will not detecting this file as a virus, then you should probably find some other Anti-Virus up to date. It means that your PC might already being infected from viruses and your current Anti-Virus does not recognize them.

--
Sam

Thursday, June 10, 2010

Will the Earth blackout in 2013?





If you’ve had your fill of apocalyptic scenarios, earthquakes, volcanoes and global warming, here comes a new threat which may wipe out the world in 2013. Imagine a scene from any of Hollywood’s disaster films. An eerie scene where mobile phones go on the blink, GPS is knocked out, TVs go blank and the world is plunged into chaos.

Looks like disaster flicks aren’t too removed from reality since all this could well be the potential result of a gigantic solar storm, according to a new report by NASA. The report, a warning, says Earth and space are coming together in a way that’s new to human history. A solar storm, which is essentially violent eruptions in the sun, can eject destructive radiation and charged particles into space.  These are closely connected to magnetic fields – which are hazardous for satellites and space stations.

There are reports of a geomagnetic storm sparked by a huge solar flare that swept over the Earth in 1859. Telegraph wires shorted out and set houses on fire. A brilliant aurora was seen in Hawaii—so bright that  "people could read newspapers by [its] red and green glow." Scientists predict  that in May 2013, the sun’s solar cycle will peak at about the same level as in 1859. (This content courtesy a post on Gawker.com)

High-tech systems are critical for life as we know it today. Everything that we depend on and take for granted – air travel, GPS navigation, banking services (even a credit card transaction uses a satellite) and emergency radio communications – can all be knocked out by intense solar activity. To get an idea of scale, a massive solar storm could result in 20 times more damage than the devastation caused by Hurricane Katrina which hit south-eastern US in August 2005. The storm killed 1,800 people and caused damages worth $81 billion. Some good news is that some of the damage and destruction can be avoided with warning of an impending solar storm. There is technology to put satellites in ‘safe mode’ and disconnect transformers to protect them from destructive electrical surges.

The task of accurately forecasting a solar storm lies with the National Oceanic and Atmospheric Administration (NOAA) of the US. "Space weather forecasting is still in its infancy, but we’re making rapid progress," said Thomas Bogdan, director of NOAA’s Space Weather Prediction Center in Colorado. The key for Bogdan lies in NASA and NOAA collaborating. "NASA’s fleet of heliophysics research spacecraft provides us with up-to-the-minute information about what’s happening on the sun. They are an important complement to our own GOES and POES satellites, which focus more on the near-Earth environment."

Says Bogdon, "I believe we’re on the threshold of a new era in which space weather can be as influential in our daily lives as ordinary terrestrial weather." So far, we’ve been lucky to escape any big solar storms.  I guess we could send Bruce Willis (a la Armageddon) to save us from the Sun in true Hollywood style. But then I would rather wait for NASA and NOAA to save us from space weather.

Source: yahoo

--
Sam

Friday, May 28, 2010

writing Bug free C code


The C language provides a minimal, efficient framework. A key to writing bug-free code is learning from your mistakes. Designing a module right the first time saves time. Programming without a goal is like a sailboat without a sail. You drift. Never reinvent the wheel. Always code what to do, not how to do it. As a general rule, try to keep functions under one page.

Always review changes before checking source code back in. An API must be designed right the first time because changes to an API are costly. Before you can write bug-free code, you must have a bug-free, rock-solid base. Provide a code wrapper around all system calls. Use macros as an aid to porting so that your code base does not change at all. Try to hide how something works to provide an abstraction that aids.

Macro names should be in uppercase. Macros beginning with an underscore are to be used only in other macros, not explicitly in source code. New data types should be in uppercase. New data types must be declared with a typedef statement, not a macro definition. Variables should be named using Hungarian notation. Hungarian notation allows you to know a variable's data type without seeing the data declaration. Functions should be named using the module/verb/noun convention. Think twice and do once.
    If I had eight hours to chop down a tree, 
    I'd spend six hours sharpening my axe.  -- AbrahamLincoln

    --
    Sam

    Wednesday, May 19, 2010

    A Leader Should Know How to Manage Failure


    Question: Could you give an example, from your own experience, of how leaders should manage failure?

    APJ Abdul Kalam: Let me tell you about my experience. In 1973 I became the project director of India 's satellite launch vehicle program, commonly called the SLV-3. Our goal was to put India 's "Rohini" satellite into orbit by 1980. I was given funds and human resources -- but was told clearly that by 1980 we had to launch the satellite into space. Thousands of people worked together in scientific and technical teams towards that goal.

    By 1979 -- I think the month was August -- we thought we were ready. As the project director, I went to the control center for the launch. At four minutes before the satellite launch, the computer began to go through the checklist of items that needed to be checked. One minute later, the computer program put the launch on hold; the display showed that some control components were not in order. My experts -- I had four or five of them with me -- told me not to worry; they had done their calculations and there was enough reserve fuel. So I bypassed the computer, switched to manual mode, and launched the rocket. In the first stage, everything worked fine. In the second stage, a problem developed. Instead of the satellite going into orbit, the whole rocket system plunged into the Bay of Bengal . It was a big failure.

    That day, the chairman of the Indian Space Research Organization, Prof. Satish Dhawan, had called a press conference. The launch was at 7:00 am, and the press conference -- where journalists from around the world were present -- was at 7:45 am at ISRO's satellite launch range in Sriharikota [in Andhra Pradesh in southern India ]. Prof. Dhawan, the leader of the organization, conducted the press conference himself. He took responsibility for the failure -- he said that the team had worked very hard, but that it needed more technological support. He assured the media that in another year, the team would definitely succeed. Now, I was the project director, and it was my failure, but instead, he took responsibility for the failure as chairman of the organization.

    The next year, in July 1980, we tried again to launch the satellite -- and this time we succeeded. The whole nation was jubilant. Again, there was a press conference. Prof. Dhawan called me aside and told me, "You conduct the press conference today."

    I learned a very important lesson that day. When failure occurred, the leader of the organization owned that failure. When success came, he gave it to his team. The best management lesson I have learned did not come to me from reading a book; it came from that experience.

    Source: This is from Former President of India APJ Abdul Kalam at Wharton India Economic forum, Philadelphia , March 22,2008

    --
    Sam

    Wednesday, January 20, 2010

    Free Fast Public DNS Servers List


    The Domain Name System (DNS) is a hierarchical naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participants. Most importantly, it translates domain names meaningful to humans into the numerical (binary) identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. An often used analogy to explain the Domain Name System is that it serves as the "phone book" for the Internet by translating human-friendly computer hostnames into IP addresses. For example hostnames such as google.com is translated to IP address 209.85.231.104.

    This is a list of better, fast public dns servers and free dns server (as compare to your ISP / DSL / ADSL / cable DNS service providers dns servers). These dns servers are free to all. I was able to improve my browsing speed with following DNS servers. Use any one of the following provider.

    Google [ 8.8.8.8 or 8.8.4.4 ]

    ScrubIt [ 67.138.54.100 or 207.225.209.66 ]

    dnsadvantage [ 156.154.70.1 or 156.154.71.1 ]

    OpenDNS [ 208.67.222.222 or 208.67.220.220 ]

    vnsc-pri.sys.gtei.net [ 4.2.2.1 or 4.2.2.2 ]



    --
    Sam

    Monday, December 14, 2009

    Earth's Atmosphere Came from Outer Space

    [click to view larger image]

    A new study finds the gases which formed the Earth's atmosphere as well as its oceans did not come from inside the Earth but from comets and meteorites hitting Earth during the Late Heavy Bombardment period. A research team tested volcanic gases to uncover the new evidence. They found a clear meteorite signature in volcanic gases which could not have contributed in any significant way to the Earth's atmosphere. Therefore the atmosphere and oceans must have come from somewhere else, possibly from a late bombardment of gas and water rich materials similar to comets.

    According to the theory of the Late Heavy Bombardment, the inner solar system was pounded by a sudden rain of solar system debris only 700 million years after it formed, which likely had monumental effects on the nascent Earth. So far, the evidence for this event comes primarily from the dating of lunar samples, which indicates that most impact melt rocks formed in this very narrow interval of time. But this new research on the origin of Earth's atmosphere may lend credence to this theory as well. Until now, no one has had instruments capable of looking for these subtle signatures in samples from inside the Earth.

    Source: universetoday

    --
    Sam

    Friday, October 30, 2009

    Curiosity - The Key to Discovery





















    [click to view larger image]

    Curiosity is an emotion related to natural behaviour such as exploration, investigation, and learning, evident by observation in human and many animal species. The term can also be used to denote the behavior itself being caused by the emotion of curiosity. As this emotion represents a drive to know new things, curiosity is the fuel of science and all other disciplines of human study.

    Curiosity is common to human beings at all ages from infancy to old age, and is easy to observe in many other animal species. These include apes, cats, fish, reptiles, and insects; as well as many others. Many aspects of exploration are shared among all beings, as all known terrestrial beings share similar aspects: limited size and a need to seek out food sources.

    Strong curiosity is the main motivation of many scientists. In fact, in its development as wonder or admiration, it is generally curiosity that makes a human being want to become an expert in a field of knowledge. Though humans are sometimes considered particularly curious, they sometimes seem to miss the obvious when compared to other animals. What seems to happen is that human curiosity about curiosity itself (i.e. meta-curiosity or meta-interest), combined with the ability to think in an abstract way, lead to mimesis, fantasy and imagination - eventually leading to an especially human way of thinking ("human reason"), which is abstract and self aware, or conscious. Some people have the feeling of curiosity to know what is after death.

    To be curious, all it takes to start is imagination and curiosity. If you've got these qualities, along with persistence, you've got what it takes to consider a career in science-perhaps an award winning career. That wonderful world of the future, now only in your imagination can become real. If you act on your curiosity, you can help make it happen!


    --
    Sam

    Wednesday, September 2, 2009

    Why Should We Hire You


    [click to view larger image]


    When it comes to job interviews, there are several questions that are not exactly related to the work, but are one of the major reasons why your job interview does not have the results that are in your best interests. One such question is the question “Why should we hire you?” Basically, this question is one of the master strokes during an interview.

    For one, the interview question “Give us reasons to hire you” or “What can you bring to our company” is something that differentiates the best candidates from the other, good candidates.

    This question is more often a surprise question to most individuals who are not as experienced in the process of the job interview. Also, this question works as a divider between the people who are looking for a job just casually and the people who are really seeking a job. While answering this question, remember that the answer should not come across to be egotistic or be completely unrealistic. You should focus on providing reasons to hire you over someone else in the best way you can.

    The following are some points to consider:

    1. One of the best ways to answer this question is to make a short list of all your advantages that would point out the positive aspects that you have for the new job position.

    2. One of the points that you can raise is the similarity of the job profile you are aiming in the company basis to the job profile you enjoyed in the previous job.

    3. You can also take the interviewer’s attention towards your key skills and strengths, name – quick learning, excellent communication skills, etc

    4. In addition, your professional ambitions should be made clear – the motivation and dedication that you have for the profession and the opening position.

    5. Make sure that your answers do not come out to be too much about yourself or even can be translated into bragging.

    6. The body language when you answer the question is important too. For example, your body language should make it clear that you have thought about the answer and given a carefully worded answer, instead of coming up with a made up, dummy answer.

    7. The last sentence, a phrase that can be used is, The job is tailored to my (or- I will bring my) experience, knowledge base and abilities and I believe I can maximize my skills for the benefit of the company.

    Source: job-interview-site

    --
    Sam

    Wednesday, August 12, 2009

    Rainbow at Night


    [click to view larger image]

    We have all seen rainbows during the day but what about rainbows at night? They are elusive, but powerful to see. Yes "Moonbows" are rainbows created by light from the Moon. Conditions have to be just right, and there are only a small number of places in the world where they regularly materialize, such as Victoria Falls on the border between Zambia and Zimbabwe as seen above, Cumberland Falls in Kentucky, Yosemite Falls in California, and Waimea on Hawaii. Because they are so faint, moonbows are difficult to see with the naked eye (they usually appear just white). But with long-exposure photography, all the colors of moonbows can be seen.

    Moonbows are rare because moonlight is not very bright. A bright moon near to full is needed, it must be raining opposite the moon, the sky must be dark and the moon must be less than 42º high. Put all these together and you do not get to see a moonbow very often! To the unaided eye they usually appear, as in the small image, without color because their light is not bright enough to activate the cone color receptors in our eyes. Colors have been reported and might be seen when the moon is bright.

    --
    Sam

    Saturday, August 8, 2009

    Intelligent Economy


    [click to view larger image]

    It is the month of August, on the shores of the Black Sea. It is raining, and the little town looks totally deserted. It is tough times, everybody is in debt, and everybody lives on credit.

    Suddenly, a rich tourist comes to town. He enters the only hotel, lays a 100 Euro note on the reception counter, and goes to inspect the rooms upstairs in order to choose one. The hotel proprietor takes the 100 Euro note and runs to pay his debt to the butcher.

    The butcher takes the 100 Euro note, and runs to pay his debt to the pig grower. The pig grower takes the 100 Euro note, and runs to pay his debt to the supplier of his feed and fuel. The supplier of feed and fuel takes the 100 Euro note and runs to pay his debt to the town's prostitute that in these hard times, gave her services on credit. The hooker runs to the hotel, and pays off her debt with the 100 Euro note to the hotel proprietor to pay for the rooms that she rented when she brought her clients there.

    The hotel proprietor then lays the 100 Euro note back on the counter so that the rich tourist will not suspect anything.

    At that moment, the tourist comes down after inspecting the rooms, and takes his 100 Euro note, after saying that he did not like any of the rooms, and leaves town.

    No one earned anything. However, the whole town is now without debt, and looks to the future with a lot of optimism.

    Source: Sivakumar

    --
    Sam

    Thursday, July 30, 2009

    Artificial Brain By 2019


    [click to view larger image]

    A leading scientist has claimed that an Artificial Brain could be built within a decade.

    Henry Makram, director of research group the Blue Brain Project, has already created parts of a fully functioning rat brain and hopes to build a human one in the next 10 years. He told the TED Global conference in Oxford that a synthetic Human Brain would be of particular use finding treatments for mental illnesses, reports the BBC.

    “It is not impossible to build a human brain and we can do it in 10 years. And if we do succeed, we will send a hologram to TED to talk,” he said. The Blue Brain Project, launched in 2005, aims to engineer a brain from laboratory data, with a software model of “tens of thousands of neurons” reconstructing the brain’s circuitry and processes.

    “It’s a new brain,” he explained. “The mammals needed it because they had to cope with parenthood, social interactions complex cognitive functions. “It was so successful an evolution from mouse to man it expanded about a thousand fold in terms of the numbers of units to produce this almost frightening organ.”

    Source: health.taragana.net

    --
    Sam

    Wednesday, July 29, 2009

    Thinking Out of Box


    [click to view larger image]

    Try to answer the following questions!


    Question(A):

    You are driving along in your car on a wild, stormy night, it's raining heavily, when suddenly you pass by a bus stop, and you see three people waiting for a bus.

    1. Old lady who looks as if she is about to die.
    2. An old friend who once saved your life.
    3. perfect partner you have been dreaming about.

    Which one would you choose to offer a ride to, knowing very well that there could only be one passenger in your car?

    This is a moral/ethical dilemma that was once actually used as part of a job application.
    1. You could pick up the old lady, because she is going to die, and thus you should save her first.
    2. You could take the old friend because he once saved your life, and this would be the perfect chance to pay him back.
    3. However, you may never be able to find your perfect mate again.

    The candidate who was hired (out of 200 applicants) had no trouble coming up with his answer. Guess what was his answer?

    Answer(A):

    "I would give the car keys to my Old friend and let him take the lady to the hospital. I would stay behind and wait for the bus with the partner of my dreams."

    Question(B):

    Interviewer (To a student Girl candidate) - One morning you woke up & found that you were pregnant, what will you do?

    Answer(B):

    "I will be very excited and take an off to celebrate with my husband."

    Normally an unmarried girl will be shocked to hear this, but why should one think it in the wrong way!

    Question(C):

    The interviewer asked the candidate "This is your last question of the interview. Please tell me the exact position of the center of this table where u have kept your files."

    Answer(C):

    Candidate confidently put one of his finger at some point at the table and told that this was the central point at the table.

    Interviewer asked how did u get to know that this being the central point of this table. He answers quickly that, "sir you are not likely to ask any more question, as it was the last question that u promised to ask!

    The candidate was selected because of his presence of mind with humor.

    Thinking outside the box means coming up with creative ways to solve problems, new ways to look at things.

    How can you do it? First you have to understand what the "box" is. Then you can look at how to get outside of it. The "box" is the normal way of looking at things, doing things, and all the assumptions that almost everyone involved is making. Your best way to start thinking out of the box then, is to identify and challenge all the assumptions that make up the thinking inside the box.
    • Willingness to take new perspectives to day-to-day work.
    • Openness to do different things and to do things differently.
    • Focusing on the value of finding new ideas and acting on them.
    • Striving to create value in new ways.
    • Listening to others.
    • Supporting and respecting others when they come up with new ideas.
    тнιηк συтѕι∂є тнє вσχ!

    --
    Sam

    Go Green Save Trees


    [click to view larger image]

    σвנє¢тѕ ιη тнє мιяяσя αяє ¢ℓσѕєя тнαη тнєу αρρєαя

    We the inhabitants on earth, have reached that stage where we need to redesign and reconsider our lifestyles for further survival on this planet. If we want the generations to look forward to a healthy and green earth, then we really have to change ourselves at the earliest.


    The forest has drastically depleted over a period of time owing to the human needs and activities. One contributing factor towards this is the paper industry.

    Worldwide more than 300 million metric tons of paper and paperboard is produced every year. Of the total global wood harvest for industrial use. 42 per cent goes into paper making and it is expected to reach 50 per cent in the next fifty years. In every country they have paper mills producing different varieties of paper. On an average each one of us uses 700 pounds of paper products every year. For the production of paper special kind of tree plantations are made called as the managed timberlands.

    These managed timberlands comprises of the special kind of trees, which are required for the pulp and paper manufacturing like the softwood tress (pine, fir etc). It means the diverse natural forests have been replaced by these managed plantations (like fast growing conifers), which has a direct impact on the biodiversity of the whole forest. Designing of the managed timberlands for pulp generation means the loss of valuable wildlife habitats, poor soil quality and ecosystem. They have 90 per cent fewer species than the natural forests. The managed timberlands often use chemical herbicides and pesticides in order to ensure fast production rates, causing acute environmental pollution.

    Paper can be made from a variety of other materials like cotton, hemp, grass and even elephant dung but unfortunately in most parts of the world it is made by sacrificing the trees only. Paper products are the largest ingredients at a waste disposal sites. Pulp and paper production industry is the third largest producer of air and water pollutants, waste products and the gases responsible for climatic changes (green house gases). Pulp and paper production is the largest industrial consumer of energy, water and forest resources.

    Huge water consumption involved in paper making process can lead to reduced water levels, required for fish and other aquatic flora and fauna along with alterations in the water temperature. Air discharges of the pulp industry include certain hormone disrupting and carcinogenic chemicals like the polyclinic aromatic hydrocarbons. About one fifth of the contents of household dustbins consist of paper and card, of which half is newspapers and magazines. Industrial nations with 20 per cent of the world's population consume 87 per cent of the world's writing and printing papers.

    In front of all these facts and figures, now the question is what can we do to turn the situation into our favour.

    There are many things that can be done like recycling of the paper, avoiding wastage of the paper or the development of non-tree based paper production methodologies etc.

    But one much simpler and easier way to cut down the use of paper is to emphasise on the use of soft copies of the information and data rather than the hard (printed) form. With almost each and every sector of the world being computerised and connected through the Internet, all forms of organisations should give stress on using the soft data thereby avoiding the use of printed matter.

    Source: merinews

    --
    Sam

    Saturday, July 18, 2009

    Harmful Effects Of Smoking

    ĤÁŔМƒÚĹ ĔƒƒĔČŤŚ Őƒ ŚМŐĶĨŃĞ



    Cigarettes and more specifically tobacco smoke are full of chemicals and poisons. Tobacco smoke contains over 4,000 chemicals, many of which make smoking harmful.


    Effects of Tobacco Smoke

    1. Smoking KILLS

    2. Every year hundreds of thousands of people around the world die from diseases caused by smoking.

    3. One in two lifetime smokers will die from their habit. Half of these deaths will occur in middle age.

    4. Tobacco smoke also contributes to a number of cancers.

    5. The mixture of nicotine and carbon monoxide in each cigarette you smoke temporarily increases your heart rate and blood pressure, straining your heart and blood vessels.

    6. This can cause heart attacks and stroke. It slows your blood flow, cutting off oxygen to your feet and hands. Some smokers end up having their limbs amputated.

    7. Tar coats your lungs like soot in a chimney and causes cancer. A 20-a-day smoker breathes in up to a full cup (210 g) of tar in a year.

    8. Changing to low-tar cigarettes does not help because smokers usually take deeper puffs and hold the smoke in for longer, dragging the tar deeper into their lungs.

    9. Carbon monoxide robs your muscles, brain and body tissue of oxygen, making your whole body and especially your heart work harder. Over time, your airways swell up and let less air into your lungs.

    10. Smoking causes disease and is a slow way to die. The strain put on your body by smoking often causes years of suffering. Emphysema is an illness that slowly rots your lungs. People with emphysema often get bronchitis again and again, and suffer lung and heart failure.

    11. Lung cancer from smoking is caused by the tar in tobacco smoke. Men who smoke are ten times more likely to die from lung cancer than non-smokers.

    12. Heart disease and strokes are also more common among smokers than non-smokers.

    13. Smoking causes fat deposits to narrow and block blood vessels which leads to heart attack.

    14. Smoking causes around one in five deaths from heart disease.

    15. In younger people, three out of four deaths from heart disease are due to smoking.



    Source: www.quit-smoking-stop.com

    --
    sam

    Wednesday, July 8, 2009

    The Milky Way and Andromeda Galaxy may collide In about 3 billion years


    [click to view larger image]


    If mankind can stick it out on Earth for another two billion years, our descendants may witness quite a show in the night sky. Researchers estimate that the Milky Way will collide with its nearest neighbor, the Andromeda galaxy, at around that time—well before the sun collapses into a white dwarf, perhaps destroying the Earth in the process. This close encounter of the galactic kind could easily kick our solar system to the farthest reaches of the galaxy, and there is a small chance we might even take up residence in Andromeda.

    Astronomers simulated the collision by estimating the relative speed between the two galaxies and the amount of gas and dark matter in the intervening space, which exerts a drag on their motions. Andromeda is currently 2.3 million light-years from our galaxy. Researchers know that the two neighbors are approaching each other at 120 kilometers per second, but they are far less certain of Andromeda's sideways speed. If moving fast enough to the side, it would miss us entirely.

    Taking their cue from the latest models of the galaxies' structures, Andromeda would first graze the Milky Way two billion years from now, they report in a paper submitted to the Monthly Notices of the Royal Astronomical Society. The two galactic cores would orbit each other for another three billion years before merging.

    During that time, the stars making up the two spiral galaxies would slowly coalesce into a more elliptical combo galaxy, "Milkomeda" (or the Andromedy Way, if you prefer). Although most of the stars would be too sparsely spaced to bump together, one galaxy's gravity would jostle the other stars.

    The fate of the sun, which is expected to last at least until the simulated merger, would depend on where it was in its 24,000 light-year-wide orbit around the galactic core. The researchers estimate that by the time the cores had fused, the solar system would have a 50 percent chance of being swept to a wispy tail extending from Milkomeda, three times further out from galactic center than it is now. There is 3 percent chance of the sun being nudged into orbit around Andromeda when the two galaxies first collide. Of course, they note, different assumptions for the simulation would likely result in different outcomes.

    Wonderful Album: How Small We Are [Dont Miss]

    Source: ScientificAmerican

    --
    Sam

    Wednesday, June 10, 2009

    Remember Your A B C 's


    [click to view larger image]

    A
    void negative sources, people, places, things and habits

    Believe in yourself

    Consider things from every angle

    Don't give up and don't give in

    Enjoy life today, yesterday is gone, tomorrow may never come

    Family and friends are hidden treasures, seek them and enjoy their riches

    Give more than you planned to

    Hang on to your dreams

    Ignore those who try to discourage you

    Just do it

    Keep trying to matter how hard it seems, it will get easier

    Love yourself first and most

    Make it happen

    Never lie, cheat or steal, always strike a fair deal

    Open your eyes and see things as they really are

    Practice makes perfect

    Quitters never win and winners never quit

    Read, study and learn about everything important in your life

    Stop procrastinating

    Take control of your own destiny

    Understand yourself in order to better understand others

    Visualize it

    Want it more than anything

    Xcellerate your efforts

    You are unique of all God's creations, nothing can replace you

    Zero in on your target and go for it!

    Source: Wanda Hope Carter

    --
    Sam

    Tuesday, May 26, 2009

    Validate XML against XSD in C



    The XML documents can reference schema documents that specify how the XML documents should be structured. The rules for validating the XML document is specified in the schema which use the extension .xsd For more information about W3C XML Schema click here

    In this Tutorial I'll show how to use libxml2 to Validate XML documents.

    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License. XML itself is a meta language to design markup languages, i.e. text language where semantic and structure are added to the content using extra "markup" information enclosed between angle brackets. HTML is the most well-known markup language. Though the library is written in C a variety of language bindings make it available in other environments.

    Libxml2 is known to be very portable, the library should build and work without serious troubles on a variety of systems (Linux, Unix, Windows, CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)

    Sample program in C to validate xml against xsd using libxml2

    Environment & Settings:
    * Install libxml2 2.6.32 binary [Installed by default in most of the Linux].

    * Install libxml2-dev 2.6.32 package.

    * IDE Eclipse CDT [GCC Compiler]

    * Right click the project --> Properties --> C/C++ Build --> Settings

    select Tool Settings --> GCC C Linker --> Libraries
    Add "xml2"(without quotes) in Libraries

    select GCC C Compiler --> Directories --> Include Paths
    Add "/usr/include/libxml2" (without quotes)

    * This sample program uses test.xml and test.xsd

    Code: xmlvalidation.c
    
    

    FYI

    you can also validate XML against XSD using the following command in linux.

    xmllint --noout --schema test.xsd test.xml

    --
    Sam

    Tuesday, May 19, 2009

    What Makes The Difference?


    [click to view larger image]

    Ever heard the story of the giant ship engine that failed?

    The ship’s owners tried one expert after another, but none of them could figure but how to fix the engine. Then they brought in an old man who had been fixing ships since he was a youngster. He carried a large bag of tools with him, and when he arrived, he immediately went to work. He inspected the engine very carefully, top to bottom.

    Two of the ship’s owners were there, watching this man, hoping he would know what to do. After looking things over, the old man reached into his bag and pulled out a small hammer. He gently tapped something. Instantly, the engine lurched into life. He carefully put his hammer away.

    The engine was fixed!

    A week later, the owners received a bill from the old man for ten thousand dollars.

    ”What?!” the owners exclaimed.

    “He hardly did anything!”

    So they wrote the old man a note saying, “Please send us an itemized bill”

    The man sent a bill that read:

    Tapping with a hammer ……………………. $ 2.00
    Knowing where to tap ………………………. $ 9998.00

    Effort is important, but knowing where to make an effort in your life makes all the difference.

    Source: Inspirational

    --
    Sam

    print friendly


    [click to view larger image]

    Ever reading a or online news article and want to print it out, but don’t want the sidebar and other graphics to waste your ink? A lot of sites aren’t particularly print friendly and perhaps don’t make this process as easy as it could be.

    Enter PrintFriendly, a new site that simply lets you enter the URL of a webpage and get a printable version: just the content and inline images, in a very readable font. If you want, you can go one step further and remove the images from the post. You can also download the content as a PDF. Neat!

    It doesn’t work perfectly: sites that have in-text widgets don’t convert particularly well. PrintFriendly could compensate for these issues by allowing you to edit the document before printing. Nonetheless, it’s a handy tool to have at your fingertips should you ever need a quick printout without wasting ink.

    Source: http://www.printfriendly.com/

    --
    Sam