Saturday, December 31, 2011

Sydney New Years Eve Fireworks 2012


<< Previous Table of Categories Next >>



World welcomes 2012


<< Previous Table of Categories Next >>


video

Idiom-Value


<< Previous Table of Categories Next >>


We all work hard to make money. However we always find that the currency is not worth the paper it’s printed on because of the inflation. From 1937 until 2010, the average inflation rate in Australia was 6.02 percent. So we have to find a way to get our money's worth.

Investing in property offers the best bang for the buck. The beauty of it is, if have properties for investment, you can claim a tax rebate in every financial year. Moreover, according to the historic record, the price of houses in Australia doubled every 7 years. So it's well worth it.

Before we purchase a property, we should not take everything for granted and we’re better to do some investigation by ourselves. We also don’t have to believe everything which the agent tells us. Instead, we should make a mockery of the property when we negotiate with the agent. Normally the property market is quiet around the Christmas holiday, but it will pick up speed after that.

Even though owners with many properties often look down on someone who has fewer properties, we should not risk purchasing too many properties at one time. Otherwise if the price of house goes south, which even just happened once in a blue moon in Australia, the bottom may fail out of the property market.

Is All Numeric?


<< Previous Table of Categories Next >>


 
  /**
   * Feel free to copy and use this method
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com
   * or email me feedback.andrewyu@gmail.com
   *
   * This method uses Regular Expression to check if a string just contains numeric
   *
   */
  public static boolean  isAllNumeric(String s)
  {
    return s.matches("\\d+");
  }

Get Value For a XML Element


<< Previous Table of Categories Next >>


 /**
   * Feel free to copy and use this.
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com
   *
   * This method uses Regular Expression to extract content of an XML element 
   * from a XML string
   *
   * @param xmlString
   * @param tagName
   * @return
   *
   */
  public static String getValueForXmlElement(String xmlString, String tagName)
  {
      String xmlTagValue = null;
      try
      {
        Pattern patter = Pattern.compile("(<|([A-Za-z0-9.]*:))" + tagName 
                                      + "(>|(\\s[\\sA-Za-z0-9./:\"=']*>))(.*?)</");
        Matcher matcher = patter.matcher(xmlString);
        while (matcher.find())
        {
          xmlTagValue = matcher.group(5);
        }
      }
      catch(Exception e){;}
      return xmlTagValue;
  } 
 

Samsung Galaxy Nexus : Ice Cream Sandwich


<< Previous Table of Categories Next >>


video

Friday, December 30, 2011

Human Cloning


<< Previous Table of Categories Next >>


Since the first cloned sheep, Dolly, was born in 1997, scientists have made some great achievements in cloning. More and more animals have been cloned and their products have been available in markets. When this technology is more mature, human cloning will change scientific fiction into scientific reality. Some people even think that human clones have already existed.

Human cloning has been a very controversial topic for a decade. Some countries have laws which prohibit human cloning and any research related to it. In other countries, there is no such kind of law. I think that human cloning is a crazy idea.

It is undeniable that there are some advantages in cloning technology and genetic modification. It can help the doctors to cure diseases and alter defective genes. But cloning a person especially manufactory human cloning means that we will open the Pandora's Box. Evils will come out.

That will cause some moral and ethic dilemmas. How should we define the relationship between the cloned child and the originator? They are sibling or child-parent. In current society, any child has a biological mother and father even though some have to live in a single parent family. A cloned child is unlikely get such complete parenthood care. The basic concept of a family is that a couple falls in love and determines to care for each other. Then the natural pregnancy is not just a physical process, but also a process full of love. But parents of clones might lack experience of this kind of emotion. It is ridiculous that reproduction is separated from love and human relationship

Humans who can live on the Earth rely on the diversity of genes. And the diversity of genes comes from parents having different sets of genes. The most horrendous part of identical genes is that it will weaken our power and adaptations, which make us prone to diseases. In addition, human cloning is just copying the identical genes, which means it will decrease the diversity of genes. Furthermore, the beauty of humanity lies in the differences we see in each other. Cloning would eliminate surprise and predict expectancy.

In human cloning, all human beings will be identical, which means that the entire human race is at a risk of getting infected by the same type of pathogen. From the scientific point of view, if everyone has the same type of genes and they are closed to each other they may not defend against the same kind of serious disease. Then cloning will be detrimental in terms of a great disaster.

Another negative effect of cloning is inbreeding, as everyone has the same genotype and keep reproducing among themselves. This would finally lead us to our own extinction.

If Reproductive cloning is abused by someone, that would carry some risks for the whole world even though I don’t believe you can create another Hitler by copying his gene because the thought and personalities cannot be cloned based on current technology. The risks may lie from manipulations by their creators.

All in all, we can benefit a lot from cloning technology. But as far as human cloning is concerned, I think we’d better to be very cautious. We need to consider the solutions for the issues before we can allow it to be done.

Thursday, December 29, 2011

Travel


<< Previous Table of Categories Next >>


With the development of economy, we have more and more opportunity to travel. By means of modern transports, travel also has becoming more and more convenient. We can easily travel to any corner of the world. In the last financial year, more than 5 million people had visited Australia from overseas and then spent about $17 billion dollars.

People travel for different purposes, but most of them travel for a holiday. After a period of hard work, we need a trip to help us to unwind. When cars run out of energy, we have to refuel them by petrol. People refuel themselves physically and psychologically by travel. Sunshine on beaches and fresh air in forests can cultivate temperament, enlighten intelligence and spark inspiration. So spending some time to travel will not slow down your work, instead it can help you to work more efficiently later.

Travel is also a good chance to learn knowledge. As the Chinese say, “Travelling 10,000 miles is much better than reading 10,000 books”. When you travel different places, you often involuntarily learn their customs, practices, history and cultures. You can easily have a deeper impression than leaning from classroom.

When you travel, the beauty of the natural surrounding is import but it’s not the most important. The most important part in your trip often is the people themselves even though sometimes you don’t notice. After you travel many places, you may not remember their landscape any more but you will never forget the people you travelled with or met. We all say “have a good trip”. In our minds we all expect to have a romantic trip.

There are so many advantages for travel that we cannot wait. Let’s hit the road.

Good Relationship



It is reported that strong relationships can lower the risk of death by up to 50 per cent. It is not clear how the researchers get this figure, but I do believe good friendships will benefit your health. At least the number of suicides will be reduced if they realise that in the world they are still cared about by someone and have someone to care for.

We all wish that we could be happy every day, but nobody can completely avoid down turns in their whole lives. In your everyday life, you have to deal with different kinds of trivial difficulties. At work, you have to confront the stress from your job. Sometimes, you even have to bear unexpected sorrow, such a natural disaster. When your heart burdens too much, talking to friends may help you to get it off your chest. After all, nobody really has an iron heart.

However, the word “friend” has been widely used. Friendships can be long term or short term. You make friends when you study in schools, work and even travel on planes. You cannot expect all of them to be your close friends. You can only rely on those who are close friends because you cannot wear your heart on your sleeve. Among them only genuine friends can really help in your difficult time. As is known to all, “A friend in need is a friend indeed".

There are also some people who look like they are friends but actually they are enemies in their minds. That kind of friendships can only damage your health because they often are more dangerous than your obvious enemy. Some people who make friends with you just want to manipulate you because they believe that there are no permanent enemies, no permanent friends, only permanent interests. Those friendships definitely will hurt you in the end.

So when we make friends, I think the quality of the friendships is more important than the quantity. We may also need some wisdom to identify those genuine friendships.

Election


<< Previous Table of Categories Next >>


When people in some countries still need to sacrifice lives or spill their blood to get their right to vote, in Australia every people, without discrimination, who is 18 years old has the right to vote once they enrol. It may one of the most important benefits which attract people to migrate to Australia. At the same time, the voting is also every citizen’s obligation. So voting is compulsory. However, it is not always the case in other democratic countries, such as the USA, Canada, Britain and New Zealand.

Every citizen should perform their duty to take part in policy formulation and management of the country, either directly working as a politician or indirectly by electing your representative. Through compulsory voting the Parliament can reflect more accurately the will of the people. Candidates can concentrate their campaigning energies on issues rather than encouraging voters to attend the poll. Furthermore, as a country with a small population, without compulsory voting, the turnout to an election may embarrass everyone. Voter turnout of those registered to vote in Australia was as low as 47% prior to the 1924 compulsory voting law.

However, compulsory voting now has its detractors. They prefer voluntary voting because they think forcing people to vote is an infringement of liberty. They say it will also increase the number of invalid votes (or “donkey votes”). Those with no interest in voting may prefer to vote for other aspects such as candidates’ appearance rather than their policies. People will sacrifice their own time to vote in federal and state elections. Resources must be allocated to determine whether those who failed to vote have "valid and sufficient" reasons.

From my point of view, because voting is part of democracy, people should not be forced to vote. Why we should worry about the turnout to vote? I think politicians should be responsible for that. People are losing interest in politics because almost always what politicians are doing is different from what they promised. Ideally, the speech of the representatives in parliament should reflect the will of their voters. Regardless of whether the super profits tax should become a policy or not, through the event in which Kevin Rudd was dumped without completing his first term, we can see the power of the executives of the mining industry. Their power comes from the money in their hands. They can use their power to influence politicians through so-called political funding or advertisements on newspapers or TV.

Concerns about China's rise


<< Previous Table of Categories Next >>


Most ordinary Australian people as well as many experts always treat the economic growth of China with mixture of excitement and trepidation. On one hand, we felicitate ourselves on Chinese success on economy. On the other hand, we are so worried about the potential threat from this growing that we can hardly wait to rush into the arms of the United States because from ideological perspective only the US is our real ally. But do we deeply understand both China and the US’s strategic interest? I do not think so. On the contrary, I think we are just misled by the lazy experts.

According to western logic and history, developing must cause external expansion with military force. But it cannot apply to China. Otherwise Hong Kong would not be a British colony. In fact China is an extremely conservative country and Chinese is a modest nation. In their 5000 years history, you couldn’t find any record about invading other nations. Instead they have been the victim of invasion many times. The Great Wall was built to defend them from the invaders. Maybe someone will mention the dispute between China and Japan about the Diaoyu Island recently. But the fact is that Diaoyu Island was Chinese territory until World War II in which it was occupied by the Japanese.

Without doubt China has been making progress in the past 30 years, but China confronts more and more problems at the same time. The economy is booming as the gap between the rich and the poor is becoming wider and wider. The development of the economy is at the cost of the environment and resources. By the driving force of the economic benefit, corruption has been propagated in governments. So objectively Chinese have to concentrate on tackling those internal affairs and it is impossible for them to have spare resources for external expansion.

Why has a great clamour arisen around the potential threats from China? If we have a look the map of the world, we will find China has already been surrounded by US military bases in Japan, South Korean, Australia, Afghanistan, Iraq, Kuwait, Turkey, Uzbekistan and Kyrgyzstan. It is almost impossible for China to find a free way out without the interference of the US navy. When the US Defence Secretary said they would assert freedom of navigation, can we ask if the Chinese navy also has the same freedom of navigation in the Mexican gulf? Moreover, when the US always has naval exercises in the foreyard of China, can we ask who on earth is threading who?

Does the US really have the courage to have a war with China directly? Nobody believes that will happen between two countries which have nuclear missiles. But how can the US implement their containment strategy towards China? Two tricks are played by the US. On one hand, the US is creating conflicts between China and its neighbours. On the other hand, the US is seeking substitutes in a so called ally to launch a proxy war against China.

For Australians, why should we sacrifice ourselves to defend the strategic interests of the US? We have been indulging in the honeyed words of the US so that we forget our own strategy. We are irresistibly attracted by the word – alliance, but we should not forget the fact that Osama bin Laden was the ally of the US before and Saddam Hussein was their ally too.

Bush Ranger


<< Previous Table of Categories Next >>


When we look back the history of Australia it seems impossible for our eyes to escape from the chapter of bushrangers. The word “bushrangers” refer to those people themselves who escaped from their communities and abandoned social rights and privileges in 18th and 19th century.

John "Black" Caesar is generally regarded as the first bushranger. Among the last bushrangers and most well-known was the Kelly Gang led by Ned Kelly, who were captured at Glenrowan in 1880, two years after they were outlawed.

Before Ned Kelly became a bushranger, he was convicted of several crimes. He was first arrested for assaulting a Chinese pig farmer in 1869 when he was just 14-year-old. The next year he was arrested again for assaulting a hawker. And then after the Fitzpatrick incident in 1878, Ned Kelly and their friends went into hiding. After that Ned Kelly and his gang rose to notoriety. They killed three policemen at Stringybark and committed two major robberies. Two years later, he was captured, tried and executed.

Even according to modern laws, what they did are crimes, but in fact they have been esteemed as folk heroes. The Victorian cricket team has adopted the 'Bushrangers' as their team name in honour of those such as the Kelly Gang, who lived in the Victorian bush. When we take delight in talking about their saga, we are just willing to forget the facts.

Why do we have such a strange attitude regarding bushranging? One reason maybe is that we cannot stop our minds from dreaming of their romanticism, fancy-free life style and the sincere friendship which is crucial for them to fight together, even though we cannot escape from our material world. When we live in a modern forest of steel and concrete, we lose the primitive romanticism. When we enjoy modern civilization which is restricted by rules, lose our freedom of spirit. When the world is full of fraud and cheating, we find friendship is becoming rarer and rarer. When the world is full of relentless competitions, I don’t know how many people still long for peace of mind. But I know I do.

The Happy Door


<< Previous Table of Categories Next >>


Happiness is like a pebble dropped into a pool to set in motion an ever-widening circle of ripples. As Stevenson has said, being happy is a duty. There is no exact definition of the word happiness. Happy people are happy for all sorts of reasons. The key is not wealth or physical well-being, since we find beggars, invalids and so-called failures, who are extremely happy.

Being happy is a sort of unexpected dividend. But staying happy is an accomplishment, a triumph of soul and character. It is not selfish to strive for it. It is, indeed, a duty to ourselves and others.

Being unhappy is like an infectious disease. It causes people to shrink away from the sufferer. He soon finds himself alone, miserable and embittered. There is, however, a cure so simple as to seem, at first glance, ridiculous; if you don’t feel happy, pretend to be!

It works. Before long you will find that instead of repelling people, you attract them. You discover how deeply rewarding it is to be the center of wider and wider circles of good will.

Then the make-believe becomes a reality. You possess the secret of peace of mind, and can forget yourself in being of service to others.

Being happy, once it is realized as a duty and established as a habit, opens doors into unimaginable gardens thronged with grateful friends.

Telepathy


<< Previous Table of Categories Next >>


Even though with help of the modern communication technology we can easily get in with a person in any corner of the earth, we will never stop pursuing more convenient methods to communicate. Because we are so lazy that we dream of doing almost everything just by thinking. One of most interesting methods is telepathy. It just existed in myths and magic, but now some experiments have showed that it may become reality in future, according to the report of Conrad Walters.

In his report, to make telepathy viable, we have to implement three components: gathering information from one brain, transmitting it elsewhere and delivering it to another brain.

The research of neuroscience has showed that the brain will generate some electronic waves when there is any activity in it. Through collecting those waves, we can gather information about what activities are happening in a brain. So the first component is realizable.

Based on this principle, some products can be made, such as thought-controlled wheelchairs and cars. It is reported that the experimented wheelchair is 95 per cent accurate, but I think they need to make more efforts to have 100 per cent accuracy because nobody expects the wheelchair itself to cause any accident. In future, the most important thing that we have to do before we go to sleep is turning off your telepathic car’s sensor. Otherwise your car will run away when you dream.

The second part is transmitting data. With the emergency of modern high speed computers and networks, transmitting huge amount of data to any place in the world in a tiny time is just a piece of cake.

The most challenging part is how to deliver the gathered information into another brain. The information needs to be converted into signals which can be recognized by the brains. In other words, a synthetic mind with billions of neurons and trillions of synapses needs to be created. In spite of those difficulties, scientists believe that a synthetic brain can be built in 10 years. From my personal of view, that is a dilemma. On the one hand, I hope that day will come as soon as possible because with the assistance of this technique I can easily get rid of my frustration from language studying. On the other hand, I hope that day will not come at all, because I don't want anyone to know my every thought in my mind.

Crises in the world


<< Previous Table of Categories Next >>


According to Peter Hartcher's report, there are seven of the most serious crises in the world. The one he listed as the last one is the economic stagnation. He may think it is trivial compared to those crises in North Korea, Iran, Iraq and Afghanistan. If you read some articles published by some economists in the United States recently, you may have a different opinion.

Even though the economy seems to be recovered from the financial crisis this year, the unemployment rate was still stuck at as high as about 10 percent in August in US. Some experts even think the true figure is much higher than this.

That is not the only thing which concerned economists. According to the basic principle of economy, any government should maintain balance between income and expenditure. As an individual, if your debt is much bigger than your income, you will become bankrupt. The same rule should apply to governments. However during the financial crisis, around the world, from Australia to Europe and US, a huge amount of money has been spent in terms of “stimulus package”. Part of it has been proven to be wasted, for example the Home Insulation Program in Australia.

After the financial crisis, the debt of the US has reached $14.3 trillion dollars. The interesting thing is that as the richest country in the world, US has become the biggest net debtor and as the biggest developing country, China has become the biggest creditor of US. How can the US government repay the debt? One way is through tax. However, in a democratic country, if any president attempts to force the people to pay more tax, the people will force the president to step down because nobody really wants to tighten his belt.

So people start to doubt if the US economy is still the strongest one in the world but nobody doubts that the US still has the strongest military. If the US use their military to repay their debt, that will be the biggest crisis to the world.

Tuesday, December 27, 2011

Get HTTP Proxy


<< Previous Table of Categories Next >>


 
    /**
     * Feel free to copy and use this.
     * If you have any comments or better solutions, please paste on my blog: 
     * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com
    */

  public Proxy getProxy(String proxyUrl)
  {
      Proxy proxy = Proxy.NO_PROXY;
      try
      {
        if (proxyUrl != null && proxyUrl.length() > 0)
        {
          URL url = new URL(proxyUrl);
          SocketAddress socketAddress = new InetSocketAddress(url.getHost(), url.getPort());
          proxy = new Proxy(Proxy.Type.HTTP, socketAddress);
        }
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
      return proxy;
  }

Aircraft picture


<< Previous Table of Categories Next >>


J20

The president likes Volleyball


Table of Categories Next >>


Get Filename Extension


<< Previous Table of Categories Next >>


 
   /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com
   * or email me feedback.andrewyu@gmail.com 
 */ 

public static String getFileNameExtension(String fileName) 
{
   if (fileName == null) return "";
   String fileExt = "";
   int index = fileName.lastIndexOf('.');
  if (index > 0)
  {
     fileExt = fileName.substring(index + 1).trim().toLowerCase();
   }
   return fileExt;
 }

Get the local hostname


<< Previous Table of Categories Next >>


 
   /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
 */ 
  public static String getLocalHostname()
    {
        String localHostname = null;
        try
        {
            InetAddress host = InetAddress.getLocalHost();
            localHostname = host.getHostName();
        }
        catch (Exception e)
        {
        }
        return localHostname;
    }

Get the Week Number from a Date


<< Previous Table of Categories Next >>


 
   /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
 */ 
  public static int getWeekNumberFromDate(Date date) 
  {
    int week = 0;
    try
    {
      Calendar cal = Calendar.getInstance();
      cal.setTime(date);
      week = cal.get(Calendar.WEEK_OF_YEAR);
    }
    catch(Exception e){}
    return week;
  }

Get the Month Number from a Date


<< Previous Table of Categories Next >>


 
   /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
 */ 
  public static int getMonthNumberFromDate(Date date)
  {
    int month = 0;
    try
    {
      Calendar cal = Calendar.getInstance();
      cal.setTime(date);
      month = cal.get(Calendar.MONTH)+1;
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return month;
  }

String Padding


<< Previous Table of Categories Next >>


 
 /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
   */ 
  public static String rightPadding(String str, int size, char padChar)
    {
        String padded = str;
        while (padded.length() < size)
        {
            padded = padded + padChar;
        }
        return padded;
    }

    public static String leftPadding(String str, int size, char padChar)
    {
        String padded = str;
        while (padded.length() < size)
        {
            padded = padChar + padded;
        }
        return padded;
    }

The Goodness of Life


<< Previous Table of Categories Next >>


Though there is much to be concerned about, there is far, far more for which to be thankful. Though life’s goodness can at times be overshadowed, it is never outweighed.

For every single act that is senselessly destructive, there are thousands more small, quiet acts of love, kindness and compassion. For every person who seeks to hurt, there are many, many more who devote their lives to helping and to healing. There is goodness to life that cannot be denied.

In the most magnificent vistas and in the smallest details, look closely, for that goodness always comes shining through.

There is no limit to the goodness of life. It grows more abundant with each new encounter. The more you experience and appreciate the goodness of life, the more there is to be lived.

Even when the cold winds blow and the world seems to be covered in foggy shadows, the goodness of life lives on. Open your eyes, open your heart, and you will see that goodness is everywhere.

Though the goodness of life seems at times to suffer setbacks, it always endures. For in the darkest moment it becomes vividly clear that life is a priceless treasure. And so the goodness of life is made even stronger by the very things that would oppose it.

Time and time again when you feared it was gone forever you found that the goodness of life was really only a moment away. Around the next corner, inside every moment, the goodness of life is there to surprise and delight you.

Take a moment to let the goodness of life touch your spirit and calm your thoughts. Then, share your good fortune with another. For the goodness of life grows more and more magnificent each time it is given away.

Though the problems constantly scream for attention and the conflicts appear to rage ever stronger, the goodness of life grows stronger still, quietly, peacefully, with more purpose and meaning than ever before.

Subtract dates in batch


<< Previous Table of Categories Next >>


-----------------------------------------example----------------------------------------
set backdate=2
set yy=yy
set mm=mm
set dd=dd
call :GETDATE "%DATE%"
call :SUBTRACTDAYS %backdate%
-----------------------------------------body--------------------------------------------

:GETDATE
set dt=%~1
set tok=1-3
if "%dt:~0,1%" GTR "9" set tok=2-4
set yyyy=
for /f "tokens=%tok% delims=.:/-, " %%a in ('echo %~1') do (
   for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do 
     set %%x=%%a&set %%y=%%b&set %%z=%%c
)
if not "%yyyy%"=="" set yy=%yyyy%
if 1%yy% LSS 1000 (if %yy% LSS 70 (set yy=20%yy%) else (set yy=19%yy%))
if 1%mm% LSS 100 set mm=0%mm%
if 1%dd% LSS 100 set dd=0%dd%
goto :EOF

:SUBTRACTDAYS
set dayCnt=%1
if "%dayCnt%"=="" set dayCnt=1
REM Substract your days here
set /A dd=1%dd% - 100 - %dayCnt%
set /A mm=1%mm% - 100

:CHKDAY
if /I %dd% GTR 0 goto DONESUBTRACT
set /A mm=%mm% - 1
if /I %mm% GTR 0 goto ADJUSTDAY
set /A mm=12
set /A yy=%yy% - 1
:ADJUSTDAY
if %mm%==1 goto SET31
if %mm%==2 goto LEAPCHK
if %mm%==3 goto SET31
if %mm%==4 goto SET30
if %mm%==5 goto SET31
if %mm%==6 goto SET30
if %mm%==7 goto SET31
if %mm%==8 goto SET31
if %mm%==9 goto SET30
if %mm%==10 goto SET31
if %mm%==11 goto SET30
REM ** Month 12 falls through

:SET31
set /A dd=31 + %dd%
goto CHKDAY

:SET30
set /A dd=30 + %dd%

goto CHKDAY

:LEAPCHK

set /A tt=%yy% %% 4

if not %tt%==0 goto SET28

set /A tt=%yy% %% 100

if not %tt%==0 goto SET29

set /A tt=%yy% %% 400

if %tt%==0 goto SET29

:SET28

set /A dd=28 + %dd%

goto CHKDAY

:SET29

set /A dd=29 + %dd%

goto CHKDAY

:DONESUBTRACT

if /I %mm% LSS 10 set mm=0%mm%
if /I %dd% LSS 10 set dd=0%dd%
goto :EOF

Get next token from a String (Oracle)


<< Previous Table of Categories Next >>


CREATE OR REPLACE FUNCTION NEXT_TOKEN(P_STR       IN OUT VARCHAR2,
                                      P_DELIMITER IN VARCHAR2)
  RETURN VARCHAR2 IS
  V_TOKEN VARCHAR2(256);
  V_POS   NUMBER(11);
BEGIN
  V_POS := INSTR(P_STR, P_DELIMITER);
  IF V_POS = 0 THEN
    V_TOKEN := P_STR;
    P_STR   := '';
  ELSE
    V_TOKEN := SUBSTR(P_STR, 1, V_POS - 1);
    P_STR   := SUBSTR(P_STR, V_POS + 1);
  END IF;
  RETURN V_TOKEN;
END NEXT_TOKEN;

Display all key-values in a Properties object


<< Previous Table of Categories Next >>


 
 /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
   */ 
  public static void displayAll(Properties properties)
  { 
    Enumeration keysEnum = properties.keys();
    while(keysEnum.hasMoreElements())
    {
      String key=(String)keysEnum.nextElement();
      System.out.println(key+"="+properties.getProperty(key));
     }
   }
 }

Wednesday, December 21, 2011

Galaxy Nexus vs. iPhone 4S: Specifications


<< Previous Table of Categories Next >>


FeatureSamsung Galaxy Nexus Apple iPhone 4S Verdict
Operating system Google Android 4.0 (Ice Cream Sandwich) Apple iOS 5 Draw
Display size 4.65in 3.5in Galaxy Nexus
Display technology Capacitive Super AMOLED HD Capacitive LED-backlit IPS Draw
Display resolution 720x1280 640x960 Galaxy Nexus
Pixel density 316 ppi 330 ppi iPhone 4S
Multitouch Yes Yes Yes
Front camera 1.3-megapixels VGA Galaxy Nexus
Rear camera 5 megapixels w/single-LED flash 8 megapixels w/single-LED flash iPhone 4S
Camera features Autofocus, touch focus, geotagging, face detection, zero shutter lag Autofocus, touch focus, geotagging, face detection, video stabilisation Draw
Video recording 1080p HD @ 30fps 1080p HD @ 30fps Draw
FM radio No No Draw
GPS Yes, with Google Maps navigation Yes Galaxy Nexus
Internal memory 16GB or 32GB 16GB, 32GB or 64GB iPhone 4S
Expandable memory None None Draw
Dimensions 135.5 x 67.9 x 8.9 mm 115.2 x 58.6 x 9.3 mm iPhone 4S
Weight 135g 140g Galaxy Nexus
Application Store Google Android Market Apple App Store iPhone 4S
Processor Cortex A9 dual-core (1.2GHz) Apple A5 dual-core (800MHz) Draw
RAM 1GB 512MB Galaxy Nexus
Australian 3G networks HSDPA 850/900/2100 HSDPA 850/900/2100 Draw
Wi-Fi 802.11a/b/g/n 802.11b/g/n Draw
Bluetooth 3.0 with A2DP 4.0 with A2DP Draw
HDMI-out No (Yes with MHL adapter) No (Yes with Apple Digital AV adapter) Draw
Quoted battery life Up to 8 hrs 20 min Up to 8 hrs Galaxy Nexus
Battery -capacity 1750 mAh 1420 mAh Galaxy Nexus
Adobe Flash support Yes (After Adobe update) No Galaxy Nexus
Carriers Unknown Telstra, Optus, Vodafone Unknown

Excuses in software development


<< Previous Table of Categories Next >>


Excuses in software development:
1. Window's problem
2. Linux's problem
3. Database problem - Stupid Oracle! Stupid SQL Server! Stupid MySQL!
4. API's problem
5. Platform's problem
6. Old guy's problem
7. New guy's problem
(Meaning: it's not his/her problem)
8. It worked before
9. Weird, I tested this
10. My unit tests were OK!
11. Someone probably changed the code.
12. I've never seen this error before
13. Without document
14. The document is too complex (he/she even hasn't read)
15. I have thousands of solutions for this issue (Don't ask any one, he/she know none of them)
16. This is just the first release
17. Must be something you did wrong
18. Unfortunately I had no chance to do/play/check/test it.
18. That's very strange.
Welcome to add more