Pages

Monday, January 14, 2013

Java Programming Errors

1. 'javac' is not recognized as an internal or external command, operable program or batch file.

When trying to compile a java code from command line, there is a possibility that you might get this error.
The solution to this is to add the path variable to environmental variables.

Steps:
1.Go to Control Panel > System
2.Click on Advanced System Settings on the left.
3.Under Advanced Tab, Click on Environmental Variables.
4.Under User Variables(If you want to define for the current user only) or Under System Variables(If you want to define for all users),Click on New.
5.Set Variable Name to PATH(Case sensitive) and Variable value to C:\Program Files\Java\jdk1.6.0_38\bin(the exact path to the javac.exe) file.
6. Now go the folder where the .java file is located.
7. Type the commmand "javac filename.java" . A .class file with the same name will be created. This means that the java file is compiled.
8. Now type the command "java filename(without the extension .java)". The file will run and print the output if any.

Saturday, May 19, 2012

How to clear Python shell


Unfortunately, I don't think there is a way to clear the screen in IDLE. The best you could do is to scroll the screen down lots of lines, eg:
print "\n" * 100
Though you could put this in a function:
def cls(): print "\n" * 100
And then call it when needed as cls().

However, if you are using the command line, you can use the following to clear the command line.
import os
os.system("cls")

Thursday, May 17, 2012

Type System in Programming Languages

Static Typing:
A programming language is said to be statistically typed if
1. The variable type is known at compile time by data declaration. This means that we as a programmer  must specify what type each variable is. Eg: C,C++, Java
2. The variable name is bound to an object.(optionl). If not it(the name) is said to be null

The advantage is that all kinds of checking can be done at compile time and a lot of stupid bugs can be caught at an early stage.However, it cannot be bound to an object of different type. Any attempt to bind the name to an object of the wrong type will raise an exception.

Dynamic Typing:
A programming language is said to be dynamically typed if
1. A variable name(unless it is null) is bound to only to an object. Names are bound to objects at execution time by means of assignment statements and it is possible to bind a name to objects of different types during the execution of the program. Eg: Python

Weak Typing:

In weak typing, variables can be implicitly coerced to unrelated types.Eg:

a  = 9
b = "9"
c = concatenate(a, b)  // produces "99" 
d = add(a, b) // produces 18

Strong Typing:

To coerce unrelated types, an explicit conversion is needed.

a  = 9
b = "9"
c = concatenate(  str(a),  b) 
d = add(a, int(b) )


Tuesday, April 17, 2012

Friday, August 7, 2009

Tech 2.0

The Online World!!

Contemporarily,internet has beecome an inseparable part of life.It has changed the way we live,the way we communicate and the way we think.We use it for a spate of reasons from sending emails,banking,advertisement,entertainment,fetching information on anything and everything under the sun to social networking and gaming. With a computer and an internet connection,we can know about the whole world:that's the 21st century,the era of information.

A good number of companies make their money through internet:Google,Yahoo,Facebook,to mention some.So,internet is a big business. The online world is heavily congested with billions of web pages contributed by millions of web sites. However, "Every coin has two sides",goes an old adage,and complies with the internet thing too.

The internet has affected physical,emotional,psychological,social and mental aspects of human life.A number of such problems has been seen in web addicts.They experience low eye sight,back aches,loss in patience level,difficulty in interacting with real people,and many more..There are cases in China which corroborates this fact.The web addicts are sent to rehabiliation camps.

The scenario does not end there.Viruses,malwares were always big threats to the internet users.Sporadically,we get to hear about viruses, causing harm to millions of computers all over the world.With the burgeoning internet users the case has become even worse.As of 8th Aug. 2009,a co-ordinated attack called Distributed Denial of service(DDoS) on popular websites like google,facebook and twitter was observed which has baffled the security experts.

So,the $64000 question is are we safe in the online world?