Saturday, October 10, 2009
From nokia 6300 I had moved to its successor 6303.
Some interesting facts about nokia, to mark this occassion!
Mine is the one in the left!
1) The ringtone "Nokia tune" is actually based on a 19th century guitar work named "Gran Vals" by Spanish musician Francisco Tárrega. The Nokia Tunewas originally named "Grande Valse" on Nokia phones but was changed to "Nokia Tune" around 1998 when it became so well known that people referred to it as the "Nokia Tune."
2) The world's first commercial GSM call was made in 1991 in Helsinki over a Nokia-supplied network, by Prime Minister of Finland Harri Holkeri, using a Nokia phone.
3) Nokia is currently the world's largest digital camera manufacturer, as the sales of its camera-equipped mobile phones have exceeded those of any conventional camera manufacturer.
4) The "Special" tone available to users of Nokia phones when receiving SMS (text messages) is actually Morse code for "SMS". Similarly, the "Ascending" SMS tone is Morse code for "Connecting People," Nokia's slogan. The "Standard" SMS tone is Morse code for "M" (Message).
5) The Nokia corporate font (typeface) is the AgfaMonotype Nokia Sans font, originally designed by Eric Spiekermann. Its mobile phone User's Guides Nokia mostly used the Agfa Rotis Sans font.
6) In Asia, the digit 4 never appears in any Nokia handset model number, because 4 is considered unlucky in many parts of Southeast/East Asia.
7) Nokia was listed as the 20th most admirable company worldwide in Fortune's list of 2006 (1st in network communications, 4th non-US company).
8. Unlike other modern day handsets, Nokia phones do not automatically start the call timer when the call is connected, but start it when the call is initiated. (Except for Series 60 based handsets like the Nokia 6600)
9) Nokia is sometimes called aikon (Nokia backwards) by non-Nokia mobile phone users and by mobile software developers, because "aikon" is used in various SDK software packages, including Nokia's own Symbian S60 SDK.
10) The name of the town of Nokia originated from the river which flowed through the town. The river itself, Nokianvirta, was named after the old Finnish word originally meaning sable, later pine marten. A species of this small, black-furred predatory animal was once found in the region, but it is now extinct.
Labels: Facts
An interesting java program that caught my attention is the one that follows!import java.awt.BorderLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
public class ScrollSample {
public static void main(String args[]) {
String title = "JScrollPane Sample";
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Icon icon = new ImageIcon("dhoni.jpg");
JLabel label1 = new JLabel(icon);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(label1
);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 200);
frame.setVisible(true);
}
}
Labels: Java, Programming
Only Vivek and Sathish from third year did some justice to the program!
#include<stdio.h>
void main()
{
int x;
char c,h;
clrscr();
printf("\n Enter a character:");
scanf("%c", &c);
printf(" The first character entered was:%c",c);
printf("\n Enter another character:");
scanf("%c",&h);
printf("\n The second character entered was:%c",h);
getch();
}
Solution:
#include<stdio.h>
void main()
{
int x;
char c,h;
clrscr();
printf("\n Enter a character:");
scanf("%c", &c);
fflush(stdin);
printf(" The first character entered was:%c",c);
printf("\n Enter another character:");
scanf("%c",&h);
printf("\n The second character entered was:%c",h);
getch();
}
Explanation:
stdin, gets the character and the enter as another character and it is set to h.
So h is not input at all!
fflush is an interesting function which flushes the unwanted content from the stream!
In java too we face this problem, I will get back to that in my tutorial!
Labels: Deepak's Scribble, Programming
Saturday, October 3, 2009
Hope you meditated enough.
It's been quite some time since my last post.
I had been really busy organizing the Intra Virtuoso events for my college juniors. Anyway getting back to the post, we shall continue from where we left...
No preprocessor directives in Java
Which means that, Java uses something else to makeup!
It uses a technique which we would be calling as...
Importing of Classes
Consider the following code in C
# include <stdio.h>
void main()
{
printf("Hi");
}
It actually has only four lines of code.
But at compile time it shows that there are 312 lines of code!
The remaining 308 lines of code is from the stdio.h header file. Its added into the program.
In C, its just the standard library functions from the header files.
Java has a different hierarchy for programming!
Java Library------->Packages------->Classes & Interfaces------->Methods
So, if a programmer wants to use a class then only that class imported.
Difference between #include and import
#include directive makes the compiler to go to the c/c++ standard library and then copy from the header files into the program.
import statement makes the JVM go to the java standard library, execute the code there and then substitute the result in the program.
Here no code is copied and hence there is no waste of memory or the process time.
Eg:
import java.lang.system;
import java.lang.string;
Note:
java.lang.*;
is automatically imported to all java programs!
So the code import java.lang.*;
is never needed!
Now the comparison between C and Java is over!
We shall try to get along with Java basics from now on.
Try to recollect the Hello world program in Java.
I would try to get back to you with my next post.
Labels: Java
Monday, September 21, 2009
The driver, a man dressed in an Armani suit, Cerutti shoes, Ray-Ban sunglasses, TAG-Heuer wrist-watch, and a Pierre Cardin tie, gets out and asks the Shepherd: If I can tell you how many sheep you have, will you give me one of them?"
The shepherd looks at the young man, and then looks at the large flock of
grazing sheep and replies: "Okay."
The young man parks the car, connects his laptop to the mobile-fax, enters a NASA Webster, scans the ground using his GPS, opens a database and 60 Excel tables filled with logarithms and pivot tables, then prints out a 150 page report on his high-tech mini-printer.
He turns to the shepherd and says, "You have exactly 1,586 sheep here."
The shepherd cheers,"that's correct, you can have your sheep."
The young man makes his pick and puts it in the back of his Porsche.
The shepherd looks at him and asks: "If I guess your profession, will you return my animal to me?"
The young man answers, "Yes, why not".
The shepherd says, "You are an IT consultant ".
"How did you know?" asks the young man.
"Very simple," answers the shepherd. "First, you came here without being called. Second, you charged me a fee to tell me something I already knew, and third, you don't understand anything about my business...
Now can I have my DOG back?"
I got this story as a forwarded mail, few days back. It was like damaging myself because I aspire to become an IT consultant! Anyway, its how the customer always thinks of us! So it was pretty cool to read. Hope you like it too!
Labels: Deepak's Scribble
Sunday, September 13, 2009
1. Coca-Cola was originally green.
2. The most common name in the world is Mohammed.
3.The name of all the continents end with the same letter that they start with.
4. The strongest muscle in the body is the tongue.
5. There are two credit cards for every person in the United States.
6. TYPEWRITER is the longest word that can be made using the letters only on one row of the keyboard.
7. Women blink nearly twice as much as men!
8. You can't kill yourself by holding your breath.
9. It is impossible to lick your elbow.
10. People say "Bless you" when you sneeze because when you sneeze,your heart stops for a millisecond.
11. It is physically impossible for pigs to look up into the sky.
12. The "sixth sick sheik's sixth sheep's sick" is said to be the toughest tongue twister in the English language.
13. If you sneeze too hard, you can fracture a rib. If you try to suppress a sneeze, you can rupture a blood vessel in your head or neck and die.
14. Each king in a deck of playing cards represents great king from history.
Spades - King David
Clubs - Alexander the Great,
Hearts - Charlemagne
Diamonds - Julius Caesar.
15. 111,111,111 x 111,111,111 = 12,345,678,987,654,321
16. If a statue of a person in the park on a horse has both front legs in the air, the person died in battle.
If the horse has one front leg in the air,the person died as a result of wounds received in battle.
If the horse has a all four legs on the ground, the person died of natural causes.
17. What do bullet proof vests, fire escapes, windshield wipers and laser printers all have in common?
Ans. - All invented by women.
18. Question - This is the only food that doesn't spoil. What is this?
Ans. - Honey
19. A crocodile cannot stick its tongue out.
20. A snail can sleep for three years.
21.. All polar bears are left handed.
22. American Airlines saved $40,000 in 1987 by eliminating one olive from each salad served in first-class.
23. Butterflies taste with their feet.
24. Elephants are the only animals that can't jump.
25. In the last 4000 years, no new animals have been domesticated.
26. On average, people fear spiders more than they do death.
27. Shakespeare invented the word 'assassination' and 'bump'.
28. Stewardesses is the longest word typed with only the left hand.
29. The ant always falls over on its right side when intoxicated..
30. The electric chair was invented by a dentist.
31. The human heart creates enough pressure when it pumps out to the body to squirt blood 30 feet.
32. Rats multiply so quickly that in 18 months, two rats could have over million descendants.
33. Wearing headphones for just an hour will increase the bacteria in your ear by 700 times.
34. The cigarette lighter was invented before the match.
35. Most lipstick contains fish scales.
36. Like fingerprints, everyone's tongue print is different
Labels: Facts
Tuesday, September 8, 2009
Recently, I had to send a mail to all my friends.
So I was searching for a method to do it.
That's when I found this pretty useful video in youtube!
Labels: GOOGLE
Monday, September 7, 2009
That's when this idea struck me. If you have a number, say x.
It shall be represented as (9*n)+y.
If we identify y then that's the sum of digits.
Say the number is 103
It's simple 99+4, (9*11)+4 hence 4.
y is nothing but (9+9+9+9....11 times) +4
So we skip all those nines and take the 4 alone.
In simpler words if x is the number then (x modulus 9) is the sum of the digits.
So in a programmer's perspective its just x%9.
Labels: Programming
Sunday, September 6, 2009
What Java does not have?
No functions in Java (Only Methods)
Function vs. Method
1. C++ functions could be present inside and outside the class.
2. But java methods could be written inside classes only.
No pointers in Java
1. Pointers lead to confusion.
2. Pointers crash program easily. (Addition of 2 pointers, Runtime memory leakage-dangling pointers)
3. Pointers break security.
No operator overloading in Java
1. Operators are immutable in java.
2. Operator’s meaning cannot be changed in java.
No preprocessor directives in Java
No multiple inheritance in Java
No static memory in Java
No destructors in Java
No goto statement in Java
Well, there seems to be more features available in C and C++ than in java. Why learn Java then? Doesn’t your brain ask this question? My brain did ask.
And I began searching for the answer.
First we have to compare C and Java to understand how the languages work.
Here is a small comparison between C and Java
C vs. Java
So Java is powerful mainly because, of the byte code. It could be interpreted by the Java Virtual Machine. So based on the system, different JVMs are used. But the class file remains the same unlike C's exe file. It’s quite an interesting fact that JVM was written using C.
There is a big table with all the differences between C and Java mentioned in it. I would suggest you to skip it if you feel it to be too big.
Click here to view that table.
C uses a compiler or an interpreter (only one at a time).
Java uses both compiler and interpreter together.
In addition to this it uses a pretty interesting JIT. Now what does this JIT do?
Wikipedia gives the following definition:
In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the runtime performance of a computer program. JIT builds upon two earlier ideas in run-time environments: byte code compilation and dynamic compilation. It converts code at runtime prior to executing it natively, for example byte code into native machine code. The performance improvement over interpreters originates from caching the results of translating blocks of code, and not simply reevaluating each line or operand each time it is met. It also has advantages over statically compiling the code at development time, as it can recompile the code if this is found to be advantageous, and may be able to enforce security guarantees. Thus JIT can combine some of the advantages of interpretation and static (ahead-of-time) compilation.
The paragraph does not make complete sense to you unless you already know about JIT ;-).
Now let me try to put it simple.
Consider the following code:
for(i=1;i<=10;i++)
print i
It is a program to print from one to ten.
Normally, a compiler will convert the print i code ten times (say it takes ten
nanoseconds).
JIT Compiler will load print i at a place in the memory with an increment in it
and call it ten times (it takes just 2 nanoseconds).
Convert print I --------> 1 nanosecond.
Load it in memory -----> 1 nanosecond.
I have told you what Java does not have?
Why Java does not have those features is the question you have to think upon. Keep meditating till the next post.
Labels: Java