Search This Blog
Wednesday, June 30, 2010
ISO OSI Model
It is known as Open System Interface.It is a seven layer model.It is used to communicate between different nodes on a network.
OSI Layers Explained
Physical Layer: The physical layer is at the bottom of this data networking model. It deals with crude data that is in the form of electrical signals. The data bits are sent as 0's and 1's. 0's correspond to low voltage signals and 1's correspond to high voltage signals. The mechanical aspects of communication, such as wires or connectors come under this layer. The physical layer also deals with how these wires, connectors, and voltage electrical signals work.
The Data Link Layer: The transmission of the data over the communication medium is the responsibility of this layer. The 0's and 1's that are used in the communication are grouped into logical encapsulation. This encapsulation is called frames. The data is transported in frames. The responsibility of these frames is that of the data link layer.
Network Layer: There are many different types of ethernets. These networks are connected to each other through various media. When a data packet wants to reach a particular destination, it has to traverse through these networks. Essentially, there are lot of operations that are taking place between the connected networks. Also, the packet data which is traversing, has to choose an optimum route, and the addressing of these packets has to be proper. The various operations between the networks, packet data issues, addressing and routing are handled by this network layer.
Transport Layer: The transport layer ensures quality and reliability of the communication. The data packet switching is entirely handled by the transport layer. There are basically two types of packet switching. They are connectionless packet switching and connection oriented packet switching. In connectionless packet switching, the packet data is allowed to choose the route in which it is going to reach the destination. Obviously, the packet in itself cant do this. Physical devices like routers are mainly responsible for the behavior of packets, but the packets formed from the same datum can reach their destination in different ways. Whereas, in connection oriented packet switching, once the route is decided, then all the packets have to follow the same route. Examples of connectionless packet switching are text messages in mobile phones, and the example of connection oriented switching is a direct voice call.
The Sessions Layer: The sessions layer is mainly responsible for creating, maintaining and destroying the communication link. PDU (Protocol Data Unit), in which various protocols are defined, that have to be followed during communication, are the responsibility of the sessions layer. The applications that use RPC's (remote procedure calls) are taken care of by the sessions layer.
Presentation Layer: There are various techniques of data compression which are used to send and receive the optimized data. For example, if certain data is repeating itself for a number of times, then it is logical to send the data only once, and specify the number of times it is repeated. This bundling of the repeated data is one of the techniques of compressions. The compression and decompression of the data is handled by the presentation layer. Also, encryption and decryption techniques used to avoid malicious attacks on data are handled by the presentation layer.
Application Layer: This is the topmost layer of the OSI reference model. This layer comes into picture when there is a process to process communication. Whenever a user invokes any application, all the associated processes are run. Many a times, when an application wants to communicate with another application, then there has to be communication between these associated processes.
Monday, June 28, 2010
How to create a jar file
- First, make sure you have installed Java 1.2 or above. This facility is not available in previous versions of Java.
- Now create a program and place it in a separate folder.For example the main class is hello world. so first compile it using the statement
javac helloworld.java - Now you will find a file named helloworld.class
- Now in that same folder you create a file Manifest.mf
- The first line should be --- Main-Class: helloworld
- Now save the file
- Now open the command promt in that folder.
- Type the line --- jar cfm helloworld.jar Manifest.mf *.class
- Give enter and your jar file would be created.
- If you have gif images used in the program then place the images in that folder and type the given line in the commandline ---- jar cfm helloworld.jar Manifest.mf *.class *.gif
- Now your jar is created .Click on it to run it.
- Note :: all the commands and file name are case sensitive.
Sunday, June 27, 2010
BLACK BOX TESTING
Main focus in black box testing is on functionality of the system as a whole. The term ‘behavioral testing’ is also used for black box testing and white box testing is also sometimes called ’structural testing’. Behavioral test design is slightly different from black-box test design because the use of internal knowledge isn’t strictly forbidden, but it’s still discouraged.
Each testing method has its own advantages and disadvantages. There are some bugs that cannot be found using only black box or only white box. Majority of the applications are tested by black box testing method. We need to cover majority of test cases so that most of the bugs will get discovered by blackbox testing.
Black box testing occurs throughout the software development and testing life cycle i.e. in Unit, Integration, System, Acceptance and regression testing stages.
Tools used for Black Box testing:
Black box testing tools are mainly record and playback tools. These tools are used for regression testing that to check whether new build has created any bug in previous working application functionality. These record and playback tools records test cases in the form of some scripts like TSL, VB script, Java script, Perl.
Advantages of Black Box Testing:
- Tester can be non-technical.
- Used to verify contradictions in actual system and the specifications.
- Test cases can be designed as soon as the functional specifications are complete
Disadvantages of Black Box Testing:
- The test inputs needs to be from large sample space.
- It is difficult to identify all possible inputs in limited testing time. So writing test cases is slow and difficult
- Chances of having unidentified paths during this testing
Methods of Black box Testing:
Graph Based Testing Methods:
Each and every application is build up of some objects. All such objects are identified and graph is prepared. From this object graph each object relationship is identified and test cases written accordingly to discover the errors.
Error Guessing:
This is purely based on previous experience and judgment of tester. Error Guessing is the art of guessing where errors can be hidden. For this technique there are no specific tools, writing the test cases that cover all the application paths.
Equivalence Partitioning:
Equivalence partitioning is a black box testing method that divides the input domain of a program into classes of data from which test cases can be derived.
How this partitioning is performed while testing:
1. If an input condition specifies a range, one valid and one two invalid classes are defined.
2. If an input condition requires a specific value, one valid and two invalid equivalence classes are defined.
3. If an input condition specifies a member of a set, one valid and one invalid equivalence class is defined.
4. If an input condition is Boolean, one valid and one invalid class is defined.
In this technique, we do not use the code to determine a test suite; rather, knowing the problem that we're trying to solve, we come up with four types of test data:
1. Easy-to-compute data
2. Typical data
3. Boundary / extreme data
4. Bogus data
For example, suppose we are testing a function that uses the quadratic formula to determine the two roots of a second-degree polynomial ax2+bx+c. For simplicity, assume that we are going to work only with real numbers, and print an error message if it turns out that the two roots are complex numbers (numbers involving the square root of a negative number).
We can come up with test data for each of the four cases, based on values of the polynomial's discriminant (b2-4ac):
Easy data ( discriminant is a perfect square):
a b c Roots
1 2 1 -1, -1
1 3 2 -1, -2
Typical data (discriminant is positive):
a b c Roots
1 4 1 -3.73205, -0.267949
2 4 1 -1.70711, -0.292893
Boundary / extreme data (discriminant is zero):
a b c Roots
2 -4 2 1, 1
2 -8 8 2, 2
Bogus data ( discriminant is negative, or is zero):
a b c Roots
1 1 1 square root of negative number
0 1 1 division by zero
As with glass-box testing, you should test your code with each set of test data. If the answers match, then your code passes the black-box test.
Boundary Value Analysis:
Many systems have tendency to fail on boundary. So testing boundary values of application is important. Boundary Value Analysis (BVA) is a test Functional Testing technique where the extreme boundary values are chosen. Boundary values include maximum, minimum, just inside/outside boundaries, typical values, and error values.
BVA techniques:
1. Number of variables
For n variables: BVA yields 4n + 1 test cases .
2. Kinds of ranges
Generalizing ranges depends on the nature or type of variables
Advantages of Boundary Value Analysis
1. Robustness Testing – Boundary Value Analysis plus values that go beyond the limits
2. Min – 1, Min, Min +1, Nom, Max -1, Max, Max +1
3. Forces attention to exception handling
Limitations of Boundary Value Analysis
Boundary value testing is efficient only for variables of fixed values in boundary.
EXAMPLE:
For the function that computes the square root of integer values in the range 0 and 5000, the test case must include the following values: {0, -1, 5000, 5001}
How to use internet from pc using mobile as the modem
Next activate the settings and see if you can access the internet from
the mobile.If you can access then it is ok else contact the service
provider.
Now assuming that you was enable to connect to the internet, connect
the mobile with the
pc/laptop using data cable/bluetooth and activate the pc studio mode.
Next create a dial up network connection. Access name would be the
name provided by the
ISP.Leave the username and password blank.
Now for the dialling number ask from the ISP. Mainly try *99***1# or *99#.
Now go to system properties->Advanced system
settings->Hardware->Device manager->Modem.
Now select the modem type( bluetooth / serial port).
Next go to advanced options and at the place of extra initialization
commands type the following :
AT+CGDCONT=1,"IP","bsnlnet"
Here bsnlnet is the connection name. Write your connection name in this place.
Now your all setup is ready.Connect the internet and enjoy browsing.
--
Subham Basak
www.subhambasak.weebly.com
subhambasak.blogspot.com
How to install Java games on the Samsung L700
'Settings'
Then select
'Phone settings'
Then
'USB settings'
And choose
'Ask on connection'
Plug the Phone in to the PC with the USB cable
On the phone select
'Media player' or Mass Storage
Open the folder
'Phone'
Phone memory...
You should see the folders: Images, Other files, Sounds, Videos
Create a new folder and name it
Games
Put any game you want to install in that 'Games' folder
Two things need to made sure of when copying over the games. Firstly
make sure you have the *.jar and
*.jad files for each game, if you don't have the *.jad file, you can
download a jad creator pretty easily, just type it in Google. Secondly
each game has to be in it's own folder, if you just dump all the *.jar
and *.jad files directly into the 'Games' folder only the first game
installed will work (Poorly too).
Now Unplug the phone
Now on the phone dial the code:
*#6984125*#
Select 'Internals' (Number 4)
It will ask for a master key it is:
*#9072641*#
Select 'Storage settings' (Number 7)
Update Java DB (Number 2)
Note: As soon as you do "update java DB", the game will install... no
need to run the .jar and .jad files now.
Now your game is installed...
To play the games navigate to My Files > Games and more...
There you the installed can find game..
--
Subham Basak
www.subhambasak.weebly.com
Saturday, June 26, 2010
JAVA Features
Let's look at some of the properties in more detail: -
* object-oriented
* portable
* multi-threaded
* automatic garbage collection
* secure
* network and "Internet" aware
* simplicity and ease-of-use
Object-oriented
Many older languages, like C and Pascal, were procedural languages. Procedures (also called functions) were blocks of code that were part of a module or application. Procedures passed parameters (primitive data types like integers, characters, strings, and floating point numbers). Code was treated separately to data. You had to pass around data structures, and procedures could easily modify their contents. This was a source of problems, as parts of a program could have unforeseen effects in other parts. Tracking down which procedure was at fault wasted a great deal of time and effort, particularly with large programs.
In some procedural language, you could even obtain the memory location of a data structure. Armed with this location, you could read and write to the data at a later time, or accidentally overwrite the contents.
Java is an object-oriented language. An object-oriented language deals with objects. Objects contain both data (member variables) and code (methods). Each object belongs to a particular class, which is a blueprint describing the member variables and methods an object offers. In Java, almost every variable is an object of some type or another - even strings. Object-oriented programming requires a different way of thinking, but is a better way to design software than procedural programming.
There are many popular object-oriented languages available today. Some like Smalltalk and Java are designed from the beginning to be object-oriented. Others, like C++, are partially object-oriented, and partially procedural. In C++, you can still overwrite the contents of data structures and objects, causing the application to crash. Thankfully, Java prohibits direct access to memory contents, leading to a more robust system.
Portable
Most programming languages are designed for a specific operating system and processor architecture. When source code (the instructions that make up a program) are compiled, it is converted to machine code which can be executed only on one type of machine. This process produces native code, which is extremely fast.
Another type of language is one that is interpreted. Interpreted code is read by a software application (the interpreter), which performs the specified actions. Interpreted code often doesn't need to be compiled - it is translated as it is run. For this reason, interpreted code is quite slow, but often portable across different operating systems and processor architectures.
Java takes the best of both techniques. Java code is compiled into a platform-neutral machine code, which is called Java bytecode. A special type of interpreter, known as a Java Virtual Machine (JVM), reads the bytecode, and processes it. The approach Java takes offers some big advantages over other interpreted languages. Firstly, the source code is protected from view and modification - only the bytecode needs to be made available to users. Secondly, security mechanisms can scan bytecode for signs of modification or harmful code, complimenting the other security mechanisms of Java. Most of all though, it means that Java code can be compiled once, and run on any machine and operating system combination that supports a Java Virtual Machine (JVM). Java can run on Unix, Windows, Macintosh, and even the Palm Pilot. Java can even run inside a web browser, or a web server. Being portable means that the application only has to be written once - and can then execute on a wider range of machines. This saves a lot of time, and money.
Multi-threaded
If you've ever written complex applications in C, or PERL, you'll probably have come across the concept of multiple processes before. An application can split itself into separate copies, which run concurrently. Each copy replicates code and data, resulting in increased memory consumption. Getting the copies to talk together can be complex, and frustrating. Creating each process involves a call to the operating system, which consumes extra CPU time as well.
A better model is to use multiple threads of execution, referred to as threads for short. Threads can share data and code, making it easier to share data between thread instances. They also use less memory and CPU overhead. Some languages, like C++, have support for threads, but they are complex to use. Java has support for multiple threads of execution built right into the language. Threads require a different way of thinking, but can be understood very quickly. Thread support in Java is very simple to use, and the use of threads in applications and applets is quite commonplace.
Automatic garbage collection
No, we're not talking about taking out the trash (though a computer that could literally do that would be kind of neat). The term garbage collection refers to the reclamation of unused memory space. When applications create objects, the JVM allocates memory space for their storage. When the object is no longer needed (no reference to the object exists), the memory space can be reclaimed for later use.
Languages like C++ force programmers to allocate and deallocate memory for data and objects manually. This adds extra complexity, but also causes another problem - memory leaks. When programmers forget to deallocate memory, the amount of free memory available is decreased. Programs that frequently create and destroy objects may eventually find that there is no memory left. In Java, the programmer is free from such worries, as the JVM will perform automatic garbage collection of objects.
Secure
Security is a big issue with Java. Since Java applets are downloaded remotely, and executed in a browser, security is of great concern. We wouldn't want applets reading our personal documents, deleting files, or causing mischief. At the API level, there are strong security restrictions on file and network access for applets, as well as support for digital signatures to verify the integrity of downloaded code. At the bytecode level, checks are made for obvious hacks, such as stack manipulation or invalid bytecode. The strong security mechanisms in Java help to protect against inadvertent or intentional security violations, but it is important to remember that no system is perfect. The weakest link in the chain is the Java Virtual Machine on which it is run - a JVM with known security weaknesses can be prone to attack. It is also worth noting that while there have been a few identified weaknesses in JVMs, they are rare, and usually fixed quickly.
Network and "Internet" aware
Java was designed to be "Internet" aware, and to support network programming. The Java API provides extensive network support, from sockets and IP addresses, to URLs and HTTP. It's extremely easy to write network applications in Java, and the code is completely portable between platforms. In languages like C/C++, the networking code must be re-written for different operating systems, and is usually more complex. The networking support of Java saves a lot of time, and effort.
Java also includes support for more exotic network programming, such as remote-method invocation (RMI), CORBA and Jini. These distributed systems technologies make Java an attractive choice for large distributed systems.
Simplicity and ease-of-use
Java draws its roots from the C++ language. C++ is widely used, and very popular. Yet it is regarded as a complex language, with features like multiple-inheritance, templates and pointers that are counter-productive. Java, on the other hand, is closer to a "pure" object-oriented language. Access to memory pointers is removed, and object-references are used instead. Support for multiple-inheritance has been removed, which lends itself to clearer and simpler class designs. The I/O and network library is very easy to use, and the Java API provides developers with lots of time-saving code (such as networking and data-structures). After using Java for awhile, most developers are reluctant to return to other languages, because of the simplicity and elegance of Java.
Friday, June 25, 2010
The Java Virtual Machine (JVM)
Java bytecode executes on a special type of microprocessor. Strangely enough, there wasn't a hardware implementation of this microprocessor available when Java was first released. Instead, the processor architecture is emulated by what is known as a "virtual machine". This virtual machine is an emulation of a real Java processor - a machine within a machine. The only difference is that the virtual machine isn't running on a CPU - it is being emulated on the CPU of the host machine.
The Java Virtual Machine is responsible for interpreting Java bytecode, and translating this into actions or operating system calls. For example, a request to establish a socket connection to a remote machine will involve an operating system call. Different operating systems handle sockets in different ways - but the programmer doesn't need to worry about such details. It is the responsibility of the JVM to handle these translations, so that the operating system and CPU architecture on which Java software is running is completely irrelevant to the developer.
The Java Virtual Machine forms part of a large system, the Java Runtime Environment (JRE). Each operating system and CPU architecture requires a different JRE. The JRE comprises a set of base classes, which are an implementation of the base Java API, as well as a JVM. The portability of Java comes from implementations on a variety of CPUs and architectures. Without an available JRE for a given environment, it is impossible to run Java software.
Differences between JVM implementations Though implementations of Java Virtual Machines are designed to be compatible, no two JVMs are exactly alike. For example, garbage collection algorithms vary between one JVM and another, so it becomes impossible to know exactly when memory will be reclaimed. The thread scheduling algorithms are different between one JVM and another (based in part on the underlying operating system), so that it is impossible to accurately predict when one thread will be executed over another.
Initially, this is a cause for concern from programmers new to the Java language. However, it actually has very little practical bearing on Java development. Such predictions are often dangerous to make, as thread scheduling and memory usage will vary between different hardware environments anyway. The power of Java comes from not being specific about the operating system and CPU architecture - to do so reduces the portability of software.
-Subham Basak
www.subhambasak.weebly.com