Only pencils
Man's mind of art can make a such a difference to a pencil.......... Amazing isn't it........









The latest in puppy fashion.
At some point, as a dog owner you're not happy with your pet's look anymore, so having gone through all the hip hairstyles, there's nowhere to go, that fur die. So you go and turn the poor animal into a walking traffic light or even a rainbow. Well I guess nobody said being "beautiful" and popular was easy. Poor dogs…
String s = ...
if (s == null || s.equals(""))...
or similar to the following, which trims leading and ending whitespaces
String s = ...
if (s == null || s.trim().equals(""))...
Of course you could also do this:
"".equals(s)
which is a case when you do not care if String s is null and you don't have to worry about NPE as if won't happen ("" is never null, whereas s could be). But that's another story.
I have had "extra" warnings turned on in my IDE for couple of days. But today my IDE suprised me when it highlighted
[1] s.equals("")
and suggested that I could optimize it by making it to
[2] s.length() == 0
And guess what?! The IDE was right! I looked at the suggested code briefly, gave it a bit of thought and agreed that it would probably be faster. Method [1] creates a new instance of the String (an empty String, yes I know that all instances of "" would be caught during compilation and optimized and that they all would refer to the same instance). Just to be on the safe side I looked at the source of the String class.
And here is what I found. The length() method returns and integer primitive, which is not calculated with each method call to length(). It is rather a member variable (or constant, as Strings are invariants) of String class that is calculated when new String instance is created. So this method would be super fast.
536 public int length()
537 {
538 return count;
539 }
On the other side, there is the equals() method, which is fast as well, but not as fast as length method. It has to do a check for class, class casting and comparison of count members (that's what length method returns).
684 public boolean equals(Object anObject)
685 {
686 if (! (anObject instanceof String))
687 return false;
688 String str2 = (String) anObject;
689 if (count != str2.count)
690 return false;
691 if (value == str2.value && offset == str2.offset)
692 return true;
693 int i = count;
694 int x = offset;
695 int y = str2.offset;
696 while (--i >= 0)
697 if (value[x++] != str2.value[y++])
698 return false;
699 return true;
700 }
And remember the few important points when it comes to Strings:
String(String)
constructorA professor stood before his Philosophy class and had some items in front of him.
When the class began, wordlessly, he picked up a very large and empty mayonnaise jar and proceeded to fill it with golf balls.
He then asked the students if the jar was full.
They agreed that it was.
The professor then picked up a box of pebbles and poured them into the jar.
He shook the jar lightly. The pebbles rolled into the open areas between the golf balls.
He then asked the students again if the jar was full.
They agreed it was.
The professor next picked up a box of sand and poured it into the jar.
Of course, the sand filled up everything else.
He asked once more if the jar was full.
The students responded with a unanimous "yes."
The professor then produced two cups of coffee from under the table and poured the entire contents into the jar, effectively filling the empty space between the sand.
The students laughed.
"Now," said the professor, as the laughter subsided, "I want you to recognize that this jar represents your life.
"The golf balls are the important things - your God, family, your children, your health, your friends, and your favorite passions - things that if everything else was lost and only they remained, your life would still be full.
"The pebbles are the other things that matter like your job, your house, and your car.
"The sand is everything else--the small stuff.
"If you put the sand into the jar first," he continued, "there is no room for the pebbles or the golf balls.
"The same goes for life.
"If you spend all your time and energy on the small stuff, you will never have room for the things that are important to you.
"Pay attention to the things that are critical to your happiness.
Play with your children.
"Take time to get medical checkups.
"Take your partner out to dinner.
"Play another 18.
"There will always be time to clean the house and fix the disposal.
"Take care of the golf balls first, the things that really matter.
"Set your priorities.
"The rest is just sand."
One of the students raised her hand and inquired what the coffee represented.
The professor smiled. "I'm glad you asked.
"It just goes to show you that no matter how full your life may seem, there's always room for a cup of coffee with a friend."Officers of the Colombo Crime Division, Sri Lanka, with the assistance of representatives of the Business Software Alliance (BSA) conducted criminal raids against distributors of illegal business software in Colombo marking the beginning of greater focus and crackdown on business software piracy distribution and business software under-licensing in Sri Lanka, lawyers involved in the crackdown said.
Three outlets at Majestic City were raided and 412 illegal software CD’s were seized by the Police during the raid. Police searched the premises of Advance Digital Zone, Marriot CD Land and Star Shop. These targets are primarily dealing in illegal computer software containing trademarks and copyright owned by business software companies such as Adobe, Autodesk, Corel, Microsoft, Symantec and McAfee to name a few, all members of the BSA.
Most of the suspected pirated software found involved business software commonly used for photo editing, animation rendering, web and computer-aided designing, anti-virus protection and productivity suites (word processing, spreadsheets, presentation, personal time and information management tools), the law firm Sudath Perera Associates said.
On May 6, Additional Magistrate of Mount Lavinia, Ms. Darshika Wimalasiri sentenced the offenders to Rs.450, 000 and 6 months imprisonment suspended for 5 years after they pleaded guilty to committing offenses under the Intellectual Property Act No. 36 of 2003.
Sri Lanka is no longer a stranger to the issue of piracy, being ranked as the country with the sixth highest piracy rate in the world at 90%, and the second-highest in the Asia-Pacific region - bringing notoriety and unwanted global attention on the island, the law firm said. In a global software piracy study conducted independently for the BSA by IDC, the information technology (IT) industry’s leading global market research and forecasting firm, the high software piracy rate has resulted in US$86 million in retail revenue losses to the local Sri Lankan software economy.
According to BSA’s legal counsel, Sudath Perera of Sudath Perera Associates“Sri Lanka has demonstrated commitment to greater protection of IP rights for software in the recent past.
This is manifested through enhanced protection measures introduced through the Intellectual Property Act No. 36 of 2003. Enforcement measures have been further strengthened through the establishment of the Commercial High Court of Colombo, with jurisdiction to determine IPR infringement cases.
In addition, the Computer Crimes Bill has been enacted during the last year which contains provisions relevant to security etc. Company directors and owners will be held personally liable and face similar penalties.”
The following concerns a question on a physics degree exam at the University of Copenhagen:
"Describe how to determine the height of a skyscraper with a barometer."
One student replied: "You tie a long piece of string to the neck of the barometer, then lower the barometer from the roof of the skyscraper to the ground. The length of the string plus the length of the barometer will equal the height of the building."
This highly original answer so incensed the examiner that the student was failed immediately. The student appealed on the grounds that his answer was indisputably correct, and the university appointed an independent arbiter to decide the case.
The arbiter judged that the answer was indeed correct, but did not display any noticeable knowledge of physics. To resolve the problem it was decided to call the student in and allow him six minutes in which to provide a verbal answer, which showed at least a minimal familiarity with the basic principles of physics.
For five minutes the student sat in silence, forehead creased in thought.
The arbiter reminded him that time was running out, to which the student replied that he had several extremely relevant answers, but couldn't make up his mind which to use.
On being advised to hurry up the student replied as follows:
"Firstly, you could take the barometer up to the roof of the skyscraper, drop it over the edge, and measure the time it takes to reach the ground. The height of the building can then be worked out from the formula H =0.5g x t squared. But bad luck on the barometer."
"Or if the sun is shining you could measure the height of the barometer, then set it on end and measure the length of its shadow. Then you measure the length of the skyscraper's shadow, and thereafter it is a simple matter of proportional arithmetic to work out the height of the skyscraper."
"But if you wanted to be highly scientific about it, you could tie a short piece of string to the barometer and swing it like a pendulum, first at ground level and then on the roof of the skyscraper. The height is worked out by the difference in the gravitational restoring force T = 2 pi sq. root (l/g)."
"Or if the skyscraper has an outside emergency staircase, it would be easier to walk up it and mark off the height of the skyscraper in barometer lengths, then add them up."
"If you merely wanted to be boring and orthodox about it, of course, you could use the barometer to measure the air pressure on the roof of the skyscraper and on the ground, and convert the difference in millibars into feet to give the height of the building."
"But since we are constantly being exhorted to exercise independence of mind and apply scientific methods, undoubtedly the best way would be to knock on the janitor's door and say to him 'If you would like a nice new barometer, I will give you this one if you tell me the height of this skyscraper'."
The student was Niels Bohr, the only Dane ever to win the Nobel Prize for Physics.
**************************************************************************************
I liked your little story.
Though, being a Dane, I was quite annoyed by the fact, that you in the end state that Niels Bohr is the only Dane ever to receive a Nobel prize in physics.
We have had many Nobel prize winners, and also more than Niels Bohr in physics. In 1975 Niels Bohr's son, Aage Bohr, and Ben Mottelson (an immigrant who became a Danish citizen in 1971) won the Nobel prize in physics.
Just to set the record straight :)
http://nobelprize.org/physics/laureates/1975/index.html
Morten Barklund
www.generationterrorists.com
Description: Email hoax
Circulating since: 1999
Status: False
But as I review this text again in January 2007, the evidence to the contrary is all too plain -- people have been forwarding this message uncritically for eight years. Eight years! Appalling, but true.
The message claims that the Make-A-Wish Foundation will donate 7 cents for every time it's forwarded. But how would anyone know how many times it's been forwarded, or to whom? Has the foundation employed psychics? Has it gone back on its longstanding policy of not participating in chain letter campaigns?
For the benefit of those unfamiliar with how widespread this type of hoax is, here are a few previous examples from which the format for the "Amy Bruce" letter was cribbed:
His boss gave him an axe and showed him the area where he was supposed to fell the trees.
The first day, the woodcutter brought 15 trees.
"Congratulations, " the boss said. "Carry on with your work!"
Highly motivated by the words of his boss, the woodcutter tried harder the next day, but he only could bring 10 trees. The third day he tried even harder, but he was only able to bring 7 trees. Day after day he was bringing less and less trees.
"I must be losing my strength", the woodcutter thought. He went to the boss and apologized, saying that he could not understand what was going on.
"When was the last time you sharpened your axe?" the boss asked.
"Sharpen? I had no time to sharpen my axe. I have been very busy trying to cut trees..."
Most of us NEVER update our skills. We think that whatever we have learned is very much enough. But good is not good when better is expected. Sharpening our skills from time to time is the key to success.
Once upon a time in a village, a man appeared who announced to the
villagers that he would buy monkeys for $10 each. The villagers seeing that
there were many monkeys went out in the forest and started catching them.
The man bought thousands at $10 and as supply started to diminish and the
villagers started to stop their efforts he announced that now he would buy
at $20. This renewed the efforts of the villagers and they started catching
monkeys again. Soon the supply diminished even further and people
started going back to their farms.
The offer rate increased to $25 and the supply of monkeys became so that
it was an effort to even see a monkey let alone catch it.
The man now announced that he would buy monkeys at $50! However,
since he had to go to the city on some business his assistant would now buy
on his behalf.
In the absence of the man, the assistant told the villagers. Look at all
these monkeys in the big cage that the man has collected. I will sell them
to you at $35 and when the man comes back, you can sell it to him for
$50.
The villager used up with all their savings to buy the monkeys.
Then they never saw the man nor his assistant, only monkeys everywhere!