Javascript tutorial for making Calculator in browsers like IE, Mozilla, Safari, Chrome.....

. Thursday, October 23, 2008
1 comments

Hi Guys, here's the code for making a calculator for your browser. It works in any browser like IE, Mozilla, Safari, Chrome.....  Well it looks best in safari


step 1 : 

Copy the code given below in Notepad

<html> 
<head> 
<title>Browser Calculator by simplywriting89.blogspot.com</title> 
<SCRIPT LANGUAGE="JavaScript"> 
<!-- Begin
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}
function cos(form) {
form.display.value = Math.cos(form.display.value);}
function sin(form) {
form.display.value = Math.sin(form.display.value);}
function tan(form) {
form.display.value = Math.tan(form.display.value);}
function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);}
function ln(form) {
form.display.value = Math.log(form.display.value);}
function exp(form) {
form.display.value = Math.exp(form.display.value);}
function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);}
function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}
function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}
function compute(form)  {
form.display.value = eval(form.display.value)}
function square(form)  {
form.display.value = eval(form.display.value) *
eval(form.display.value)}
function checkNum(str)  {
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1)
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch !=
"-" && ch != "."
&& ch != "(" && ch!= ")") {
alert("invalid entry!")
return false
         }
      }
   }
return true
}
// End --> 
</SCRIPT> 
</head> 
<body bgcolor="#FFFFFF"> 
<FORM> 

<table width="335px" cellpadding="0" cellspacing="0" border="0" name="Calculator"> 
<tr><td align="center"><input name="display" value="0" size=25></td></tr> 
</table> 
<table width="335px" cellpadding="0" cellspacing="0" border="0" name="Cal Body"> 
<tr> 
<td align="center"><input style="font-family : monospace" type="button" value=" exp " onClick="if (checkNum(this.form.display.value)) { exp(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  7  " onClick="addChar(this.form.display, '7')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  8  " onClick="addChar(this.form.display, '8')"></td> 


<td align="center"><input style="font-family : monospace" type="button" value="  9  " onClick="addChar(this.form.display, '9')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  /  " onClick="addChar(this.form.display, '/')"></td> 
</tr> 
<tr> 
<td align="center"><input style="font-family : monospace" type="button" value=" ln  " onClick="if (checkNum(this.form.display.value)) { ln(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  4  " onClick="addChar(this.form.display, '4')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  5  " onClick="addChar(this.form.display, '5')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  6  " onClick="addChar(this.form.display, '6')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  *  " onClick="addChar(this.form.display, '*')"></td> 

</tr> 
<tr> 
<td align="center"><input style="font-family : monospace" type="button" value=" sqrt" onClick="if (checkNum(this.form.display.value)) {sqrt(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  1  " onClick="addChar(this.form.display, '1')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  2  " onClick="addChar(this.form.display, '2')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  3  "  onClick="addChar(this.form.display, '3')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  -  "  onClick="addChar(this.form.display, '-')"></td> 
</tr> 


<tr> 
<td align="center"><input style="font-family : monospace" type="button" value=" sq  " onClick="if (checkNum(this.form.display.value)) { square(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  0  " onClick="addChar(this.form.display, '0')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  .  " onClick="addChar(this.form.display, '.')"></td> 
<td align="center"><input style="font-family : monospace" type="button" value=" +/- " onClick="changeSign(this.form.display)"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  +  " onClick="addChar(this.form.display, '+')"></td> 
</tr> 
<tr> 
<td align="center"><input style="font-family : monospace" type="button" value="  (  " onClick="addChar(this.form.display, '(')"></td> 

<td align="center"><input style="font-family : monospace" type="button" value=" cos " onClick="if (checkNum(this.form.display.value)) { cos(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value=" sin " onClick="if (checkNum(this.form.display.value)) {sin(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value=" tan " onClick="if (checkNum(this.form.display.value)) { tan(this.form) }"></td> 
<td align="center"><input style="font-family : monospace" type="button" value="  )  " onClick="addChar(this.form.display, ')')"></td> 
</tr> 
</table> 
<table width="335px" cellpadding="0" cellspacing="0" border="0" name="Cal Foot"> 
<tr> 


<td align="center"><input style="font-family : monospace" type="button" value=" Clear "  onClick="this.form.display.value = 0 "></td> 
<td align="center"><input style="font-family : monospace" type="button" value=" Back Space " onClick="deleteChar(this.form.display)"></td> 
<td align="center"><input style="font-family : monospace" type="button" value=" Enter " name="enter"onClick="if (checkNum(this.form.display.value)) { compute(this.form) }"></td> 
</tr> 
</table> 
</FORM>  
</body> 
</html> 

Step 2 :

Save it as calculator.html (You can save it by any name but remember that name is followed by the extension .html)

CRUDE AUR RUPAIYA KA DUM !!!

. Sunday, September 14, 2008
0 comments

Hi friends i want to share an intersting fact related to crude and rupee.

  • When crude oil price(s)  go down by $1, oil companies benefit by $2800 crore  and vice- versa.
  • When rupee depreciates by 2%, oil companies incur a loss of $8000 crore  and vise- versa.

Suscribe to this blog for getting regular updates.
Thank You.

Any two digit multiplication trick

. Friday, September 5, 2008
0 comments

I am back again with a new trick. Its about multiplying any 2 digits with any number of digits. 


123 x 24 =

                                  1    2     3
                                  x    2     4
                                 -------------
                                   2  9  5  2  
                                 -------------

Note : The way I have solved this problem here you can solve it the similar way on your notebook. Yes, in just 3 lines (first two lines for question and 3r one for answer). The only prerequesite for learning this trick is to know tables from 1-9. It should be feeded in memory very perfectly such that as you see 9 and 8 answer 72 should suddenly click in your mind without any delay. If you see 9 and 8 and than think on what 9 x 8 = is than it will be a waste of seconds and remember saving SECOND'S is very essential for becoming successfull. For instance, this trick is of immence help to those who are or want to prepare for CAT or other competetive exams.

Let us learn the trick now
  • Multiply 4 x 3, answer comes is 12, write 2 down and carry 1 up.
  • Cross multiply 4 x 2 and 3 x 2 and than add both answer comes is 14 and add 1 (carry). Now answer is 15. Write 5 down and carry 1 up.
  • Similarly cross multiply 1 x 4 and 2 x 2. Adding both we get 8 and add 1 (carry). Now answer is 9. Now writ it down. There is no carry here.
Multiply 2 x 1. Write it down. In case if any carry is there add the carry digit and than write final answer down. Finish.
  

124567 x 96 = 11958432

I have tried to explain this sum graphically. I hope it helps you.

















Shut down PC in less than 5 seconds

. Friday, August 22, 2008
2 comments



Fastest way to turn-off your PC

  1. Open Windows Task Manager or Press ctrl+alt+del.
  2. Click on shut down menu.
  3. Press ctrl buton and than click on turn-off.

Multiplication in just 2 seconds

If I tell you that I can show you a trick to get answers for the following sums in just few seconds. That also answers in just 2-3 seconds for each sum.

123456 r 5 =
124590 r 5 =
234581242 r 5 =
98123 r 5 =

Than would you believe me ? Unbelievable! thats what your answer is, am I right, hmm!.
-Let us learn the trick.

  1. Divide number by 2 instead of multiplying it by 5.
  2. Multiply number by 10.

-For example,

123456 r 5 = 617280

On dividing it by 2 we get

61728

On multiplying it by 10 we get

617280

Checkout the anwer, it is right. Now you can easily amaze your friends by your intelligence. So the next time you meet your friend tell him you have learnt 5 table from 1- infinite numbers and tell him to take your test by asking any question randomly.

Hey guys chapter doesn't end here. You can apply this trick for table of 25, 125, 625 as well. Look at the table given below carefully.

Multiplication by --------------Step 1(divide by)------------Step 2(divide by)------------- Answer

-------5-------------------------------------2----------------------------10--------------------------*****

------25------------------------------------4----------------------------100-------------------------*****

------125-----------------------------------8----------------------------1000------------------------*****

------625----------------------------------16---------------------------10000-----------------------*****

I guess you all have guessed the logic of this trick and you dont need to mug up this table.Till now you 'worked hard' on maths and from now you will 'work smart'.

Do reply for this trick and keep visiting this blog for various new tricks.

Thank you.

How to crack english words

Believe me, it is possible to crack english words. But there are very few people who know about it. The main reason for this is we weren't told about it by any source (teachers, parents, friends, relatives). Also many-a-times what happens is people know about it but they dont like to share it with others.

Let us know few things about english words. Almost all words in english has been derived from latin root or greek root or german root. If we know meaning of this (latin/greek/german)root word than we can have better understanding of cracking english words. For apply this technique you should be familiar with meaning of root word and meaning of latin/greek/german prefixes and suffixes.

Let us now learn how to apply this technique.
(1)First of all break down the word to their root, prefix and suffix.
(2)As I told you should be familiar with meaning of root, prefix and suffix because it will enable you to guess the meaning correctly.

For example,

(1)Latin root 'scribe' means 'to write'. Words written below are derived from latin root 'scribe'.

  • prescribe
  • describe
  • inscribe
  • scripture

Note - words written above belong to the act of writing.

(2) Let us crack the word asynchronous. Its meaning is occurence of two or more process at different times. Let us first break down the word 'asynchronous'.


'a' 'syn' 'chron' 'ous'

---------------------------

Root - meaning

---------------------------

a - without

syn - together

chron - time

---------------------------

Note - Greek root 'a' and 'syn' are prefix and chron is a greek root word.

Let us have a look at some of latin, greek and german roots and its meaning.

Greek roots
---------------------------------------------------

Root - Meaning

---------------------------------------------------

andr/gyn - man

anthropos - mankind

archy/cracy - rule by

astro - star

bibli - book

chron - time

macro/mega - big

micro - small

---------------------------------------------------

Latin root
-------------------------------------------

Root - Meaning

-------------------------------------------

cede/ceed/cess - go/movement

centr - center

cred - believe

fract/frag - break

luc - light

magni - large

mar - sea

scribe - to write

tract/tang - touch

-------------------------------------------

Prefix [ (l) denotes latin and (g) denotes greek ]
-------------------------------------

Root - Meaning

-------------------------------------

ab(l) - from/away

ambi(l) - both sides

ante(l) - before

anti(g) - against

sym/syn(g) - together

-------------------------------------

Suffix [ (l) denotes latin and (g) denotes greek and (gr)for germanic ]
---------------------------------------------------------

Root - Meaning

---------------------------------------------------------

arium/ary(l) - place

full(g) - full of

ist(g) - expert in some sort of action or field

ish(gr) - somewhat like

ness(gr) - condition or state

oid(g) - like/shape of

wise(gr) - in the manner of

---------------------------------------------------------


Note - For more such examples click here

Top 10 STRENGTHS, WEAKNESS, OPPORTUNITIES, THREAT of India

. Thursday, August 21, 2008
0 comments




Note - Issues mentioned above is a SWOT analysis and are not written in particular sequence for various criteria.

Strengths:


  • People from different communities coming closer.
  • Large pool of young talent.
  • Smart in english speaking and also intersted in learning different foreign lanuage.
  • World class entrepreneurs, professors, political leaders, scientists, engineers, managers, students, professionals, educational institutions.
  • Agrarian economy and rich in natural resources.
  • Democratic country, big market and free media.
  • Acceptance for reforms and innovations.
  • Acceptance for drug free treatment via yoga, ayurveda and other healing therapies.
  • Geographic location (Time difference with US and europe)-overnight works get done and next morning the US/Europe clients see the work done.
  • IT and software superpower.

Weakness :

  • Lack of manpower and fear of sharing knowledge and lack of team spirit.
  • Hunger and malnourishment.
  • Deforestation, load-shedding and lack of infrastructure.
  • Less exposure to sex-education and counselling sessions at school level. Attitude towards studies is marks oriented and emphasis is on developing IQ (Intelligence Quotient)and not EQ (Emotion Quotient).
  • Lack of good educational institutions and medical facilities in rural areas.
  • Unstable Government and slow governance of Indian Government.
  • Social awareness programme is held very late.
  • Growing suicidal tendencies of farmers.
  • Lack of security force.
  • Ignorant and silent on serious issues.

Opportunities :

  • Emerging market.
  • Asian countries having a lot of expectation from Indian IT sector.
  • Public - Private partnership and joint venture.
  • Collaboration of Industrial experts and management institutions to prepare syllabus for better managerial productivity.
  • Lots of job/business opportunity for an individual/firm from outside because of qualitative productivity at cheap cost.
  • Huge buyer market.
  • Developing health and tourism sector.
  • Property appreciating at a good rate.
  • Adoption of nuclear energy.
  • Research and development capabilities.

Threats :

  • Global warming.
  • Terrorism.
  • Inflation.
  • Caste based politics.
  • Poor state of Indian agriculture sector.
  • Superstition.
  • Corruption.
  • Poverty.
  • Female exploitaion.
  • Black money and black marketing.