Search This Blog

Tuesday, December 28, 2010

Difference between VB.NET and C#.NET

Its a subjective matter which language is best. Some like VB.NET’s
natural style and some like professional and terse C# syntaxes. Both
use the same framework and speed is also very much equivalents. But
still let’s list down some major differences between them :-

Advantages VB.NET :-

  • Has support for optional parameters which makes COM interoperability much easy.
  • With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace.
  • Has the WITH construct which is not in C#.
  • The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.
Advantages of C# :-

  • XML documentation is generated from source code but this is now been incorporated in Whidbey
  • Operator overloading which is not in current VB.NET but is been introduced in Whidbey.
  • Use of this statement makes unmanaged resource disposal simple.
  • Access to Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies). This is the major difference that you can access unmanaged code in C# and not in VB.NET.

Monday, December 27, 2010

Common Language Runtime ( CLR )

Full form of CLR is Common Language Runtime and it forms the heart of the . NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the responsibilities of CLR :
  • Garbage Collection :- CLR automatically manages memory allocation thus eliminating memory leaks. When objects are not referred Garbage Collector automatically releases those memories thus providing efficient memory management.
  • Code Access Security :- CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.
  • Code Verification :- This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
  • IL( Intermediate language )-to-native translators and optimizer’s :- CLR uses JIT(Just In Time) and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.

Sunday, November 21, 2010

Testing Samsung SGH-L700

Hi,
I am a samsung l700 user and would like to share this with others who also admire the beauty and functionality of this sleek bar phone.

This is a guide to teach you all how to test your samsung l700 (most of the new samsung multimedia phones also support this) :

  • First type *#0*# on your dialing screen.You will find the following options -
  1. Red Lcd
  2. Green Lcd
  3. Blue Lcd
  4. Melody test (white lcd and melody test in some phones)
  5. Vibration test (black lcd and vibration test in some phones)
  6. Dimming test
  7. Mega cam test
  8. VGA cam test
  9. Lcd on/off
  10. Sleep mode
  11. Speaker test(left speaker and right speaker test in some phones)
Select the respective test and find out whether your phone is working fine.If you find some problem then rush to your nearest samsung service center.

Saturday, November 20, 2010

.NET Framework 4 Unleashed

Compatibility :
.Net 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance.The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio
.Net 4 also supports much more language in its client profile than its earlier versions.
Moreover it supports in process side by side execution which enables it to compile and run a project using components based on .net 4 as well as add ins based on earlier versions.

Performance monitoring :
Using Earlier versions of the .NET Framework it was not possible to determine whether the application was affecting other applications or not.But .net 4 enables us to get processor usage and memory usage estimates per application domain.We can monitor CPU and memory usage of individual application domains.

Garbage Collection :
The .NET Framework 4 provides background garbage collection. This feature replaces concurrent garbage collection in previous versions and provides better performance and memory utilization.


Other new features :
  1. It support big integers(system.numerics.biginteger) which supports all the standard integer operations, including bit manipulation.
  2. it support complex numbers(system.numerics.complex) which supports arithmetic and trigonometric operations with complex numbers.
  3. It supports the feature of identifying a 64-bit operating system and a 64-bit process.



And there are lots more features packed into .NET 4 framework which makes a programmers friendly heaven.

Friday, July 30, 2010

Fetching image from database in ASP.NET

In asp database the images are stored in form of binary array.So it is never easy to fetch the image and display it in a image control.For doing so we take a round about method where we print the image in a page and ten we direct the image url in the image control to that page.

Next we would follow the steps to do that :

Now we shall add a page named image.aspx and in the image.aspx.vb we shall write the code given below


Partial Class image
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = Request.QueryString("val")
Try
con.Open()
com.CommandText = "select * from items where pid ='" & s & "'"
com.Connection = con
dr = com.ExecuteReader
dr.Read()
Dim bytImage As Byte() = New Byte() {}
bytImage = dr.Item(7)
Response.ContentType = "image/jpeg"
Response.Expires = 0

Response.Buffer = True

Response.Clear()
Response.BinaryWrite(bytImage)
Response.End()

Catch ex As Exception

MsgBox(ex.Message)

Finally
con.Close()
com.Cancel()
dr.Close()

End Try
End Sub

End Class



In this page we will get the image from the database an a binary form and will binarywrite the image in this page.We shall get the pid from the querystring which we shall pass from the page where the image control is. In that page we will direct the image url as below :

Image1.ImageUrl = "~/image1.aspx?vall=" & DropDownList1.SelectedValue

where dropdownlist1.selected value returns a element of the pid coloum in the items table
I have already shown how to connect the database using the module in my earlier blog

Wednesday, July 21, 2010

Adding image to database in ASP.NET

First we have taken a sql database table (items) with a image type field in it.Next we have to create a connection using a module..

The module should look like this

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient


Public Module connection

Public con As New SqlConnection("Data Source=.\SQLEXPRESS;_AttachDbFilename='J:\shopping\App_Data\Database.mdf';Integrated_ Security=True;User Instance=True")
Public com As New SqlCommand
Public dr As SqlDataReader

End Module


Now to add the image follow the following steps :


Try

Dim imgByte As Byte() = Nothing
If FileUpload1.PostedFile IsNot Nothing AndAlso FileUpload1.PostedFile.FileName <> "" Then


Dim File As HttpPostedFile = FileUpload1.PostedFile
imgByte = New Byte(File.ContentLength - 1) {}
File.InputStream.Read(imgByte, 0, File.ContentLength)
End If

Dim b As Boolean

con.Open()
com.CommandText = "insert into items values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox7.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "',@eimg)"
com.Parameters.AddWithValue("@eimg", imgByte)
com.Connection = con
com.ExecuteNonQuery()


MsgBox("inserted")

Catch ex As Exception
MsgBox(ex.Message)

Finally
con.Close()
com.Cancel()
com.Parameters.Clear()
dr.Close()

End Try


First we shall upload the file using a fileupload control then we shall convert it into a byte stream and would store it into a byte array.Next we would store this byte array into the items database using parametarised query.Hence the image gets stored into the image field

Thursday, July 8, 2010

JAVA Threads

Multithreading refers to two or more tasks executing concurrently within a single program. A thread is an independent path of execution within a program. Many threads can run concurrently within a program. Every thread in Java is created and controlled by the java.lang.Thread class. A Java program can have many threads, and these threads can run concurrently, either asynchronously or synchronously.

Multithreading has several advantages over Multiprocessing such as;

  • Threads are lightweight compared to processes
  • Threads share the same address space and therefore can share both data and code
  • Context switching between threads is usually less expensive than between processes
  • Cost of thread intercommunication is relatively low that that of process intercommunication
  • Threads allow different tasks to be performed concurrently.

Thread Creation

There are two ways to create thread in java;

  • Implement the Runnable interface (java.lang.Runnable)
  • By Extending the Thread class (java.lang.Thread)
Implementing the Runnable Interface

public interface Runnable {

void run();

}

One way to create a thread in java is to implement the Runnable Interface and then instantiate an object of the class. We need to override the run() method into our class which is the only method that needs to be implemented. The run() method contains the logic of the thread.

The procedure for creating threads based on the Runnable interface is as follows:

1. A class implements the Runnable interface, providing the run() method that will be executed by the thread. An object of this class is a Runnable object.

2. An object of Thread class is created by passing a Runnable object as argument to the Thread constructor. The Thread object now has a Runnable object that implements the run() method.

3. The start() method is invoked on the Thread object created in the previous step. The start() method returns immediately after a thread has been spawned.

4. The thread ends when the run() method ends, either by normal completion or by throwing an uncaught exception

Extending Thread Class

The procedure for creating threads based on extending the Thread is as follows:

1. A class extending the Thread class overrides the run() method from the Thread class to define the code executed by the thread.

2. This subclass may call a Thread constructor explicitly in its constructors to initialize the thread, using the super() call.

3. The start() method inherited from the Thread class is invoked on the object of the class to make the thread eligible for running.


When creating threads, there are two reasons why implementing the Runnable interface may be preferable to extending the Thread class:

  • Extending the Thread class means that the subclass cannot extend any other class, whereas a class implementing the Runnable interface
    has this option.
  • A class might only be interested in being runnable, and therefore, inheriting the full overhead of the Thread class would be excessive.


Wednesday, June 30, 2010

ISO OSI Model

What is 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

  1. First, make sure you have installed Java 1.2 or above. This facility is not available in previous versions of Java.
  2. 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
  3. Now you will find a file named helloworld.class
  4. Now in that same folder you create a file Manifest.mf
  5. The first line should be --- Main-Class: helloworld
  6. Now save the file
  7. Now open the command promt in that folder.
  8. Type the line --- jar cfm helloworld.jar Manifest.mf *.class
  9. Give enter and your jar file would be created.
  10. 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
  11. Now your jar is created .Click on it to run it.
  12. Note :: all the commands and file name are case sensitive.

Sunday, June 27, 2010

BLACK BOX TESTING

Black box testing treats the system as a “black-box”, so it doesn’t explicitly use Knowledge of the internal structure or code. Or in other words the Test engineer need not know the internal working of the “Black box” or application.
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

First obtain the settings from the ISP.

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

In the phone Menu select
'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

The properties that make Java so attractive are present in other programming languages. Many languages are ideally suited for certain types of applications, even more so than Java. But Java brings all these properties together, in one language. This is a revolutionary jump forward for the software industry.

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)

At the heart of the Java platform lies the Java Virtual Machine, or JVM. Most programming languages compile source code directly into machine code, suitable for execution on a particular microprocessor architecture. The difference with Java is that it uses bytecode - a special type of machine code.

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

Thursday, April 15, 2010

Introducing Bluetooth....

In this article I will talk about Bluetooth. You must be thinking what is this Bluetooth? Is it something related to cosmetics or something related to teeth or may be something…

Well to begin with, Bluetooth is a new technology named after the 10th century Danish king Harald Bluetooth Blatand who ruled part of Scandinavia in 960 AD .He helped unite his part of the world. As the name implies that Bluetooth would be the technology to unite the mobile world.

Bluetooth device is the revolutionary device launched by L.M Ericsson, to integrate its phone with all Internet enabled devices. Two L.M Ericsson telephone employees, the Swedish born Sve Mattison and his Dutch colleague, Jaap Haartsen, originally designed Bluetooth technology in 1994.

The term Bluetooth refers to an open specification governed by the Bluetooth special interest group (SIG) for wireless personal area networks (PANs). This technology provides a way to connect and exchange information between devices like personal digital assistants (PDAs), mobile phones, laptops, PCs, printers and digital cameras via a secure, low cost, globally available short-range radio frequency.

Lets look at some examples where we can use Bluetooth technology.

Nowadays, you have to either manually enter the names and phone numbers of all your contacts or in other advance way you can use a cable to connect your phone and PC and can run some application to synchronize the contact information.
With this new technology you could see this happens automatically, without your involvement, whenever phone will come in the range of PC data will automatically updated.


With Bluetooth there are so many exciting applications like, nowadays whenever you come to office, you have to do so many setup to get to start to work, like you have to connect your notebook to USB port, you switch it on, then your notebook gets boot up and after that only you are able to log in. All this process takes some of your time. Now think about the situation where you walk into the office switch on the notebook and get ready to do work. This is possible with Bluetooth, it makes your notebook to start communicating with your server via radio signals, not require you to connect it to the USB port.

Even car manufacturers are not left behind; car manufacturers such as BMW, Lexus and Toyota have equipped some of their models with Bluetooth car kits. This allows you to use the features of your cell phone through the car’s audio system while the phone itself stored in the trunk for instance.

Now the question arises, how the Bluetooth technology works?

The Bluetooth system consists of an RF (Radio Frequency) transceiver, baseband and protocol stack. It uses radio standards to enable file-sharing and data transfers between devices like PDA and desktop. These radio frequencies are present in all directions and their range varies between 10cm to 10m, further it can be extended to 100m depending on the power class of the product, again this power transmission rates varies in many Bluetooth products depending on the power saving features available in particular unit, bandwidth requirements, transmission distance, etc.
Because this Bluetooth technology uses radio signals, the walls in our house will not impede a Bluetooth network. Also we can control devices in the different rooms very easily.

Bluetooth operates in globally available low radio frequency at 2.4 GHz and supports data speed of up to 721 Kbps, as well as three voice channels.

To make use of Bluetooth technology you have to make sure the new device which you buy is Bluetooth compatible, Bluetooth compatible devices comes with software to configure Bluetooth to share data by implementing specific profiles, these profiles will determine what type of information or resources the device can store.

When you want two new Bluetooth device should communicate, first you have to introduce them to share data, this is known as pairing (authorizing the device to communicate with each other).

It is also possible to configure the devices to have password protection, so that other people cannot take part in your communication. One more thing is also there, you can set up the device to constantly announce their presence to the device in its range, and the connection can be automatically establish.

Friday, April 9, 2010

Stop Hard Drive Crashes

If you experience a hard drive crash, it doesn’t take much to make a bad situation even worse. In the event of a hard drive crash, in most instances, the data is completely recoverable at first. However, as part of human nature, we often try to avoid the high costs associated with hard drive data recovery in order to find some sort of “quick fix” to a very serious problem. In this report we will go over some of the symptoms of a hard drive crash and the things you can try in the event of a suspected hard drive crash, along with things you should avoid.

What Noise Is The Drive Making?

The first thing to take into account is whether or not the hard drive is making any unusual noises. Often times when there is a problem with the read or write head within the drive or a firmware issue in the logic board a “clicking” sound will be heard. If this is the case, then you should immediately power down the system and refrain from reapplying power. Same thing goes for any unusual sound, whether it’s grinding, squealing, or sounds like a “laser gun”. See samples in the upper left column.

If any of these occur you should immediately power the system down, don’t even attempt to go through the normal shut down procedure, just pull the plug. Unfortunately in the situations listed above, there is little that you can do to recover the data yourself. If the failure is mechanical, unless you have a clean room, fully equipped with the right tools and a trained technician there is nothing that can be done. Even hard drive manufacturers avoid this line of work, and many who do offer data recovery services are only sub-contracting the work out to an established data recovery firm.

Never Ever Open Your Hard Drive

If the data on a hard drive has even the most minimal value to you, then it is imperative that you do not open the drive. We often get calls or e-mails from people who felt they had the right equipment and know-how to perform something as serious as a head replacement. Once they’ve removed the hard drive’s protective case, we often times ask them not to send the drive in, because more often than not, the damage is irreparable. Working with the internal components of a hard drive requires at least a Class-100 clean room. A clean room does not mean a room that you just vacuumed and dusted (believe it or not people say that to us all the time). A clean room is a special work area in which air quality is heavily controlled and it is vital to hard drives during the manufacturing or assembly process. The air in the room is regulated in term of air particles, temperature and humidity. A Class-100 clean room means there exists no more than 100 particles that are larger than 0.5 microns in one cubic foot of air. Opening a hard drive in air meeting anything less than the standard listed above will mean certain death for your hard drive and any data contained therein.

The Freezer Method

There has been a long running wive’s tale about putting your hard drive in the freezer when it crashes in order to revive it just long enough to pull your data off of it. We’ve run this test for fun on many occasions in different scenarios with junk test drives that we have in our lab. So far we have yet to see this actually produce any positive results. In fact, in one instance we actually began to see the formation of tiny microscopic ice crystals on the platter themselves, which is a definite crash waiting to happen.

See the problem with this theory is, drives are not completely sealed. Regardless of what you’ve heard or read, nearly all hard drives have a tiny breather hole (usually marked with a label that says DO NOT COVER). This hole not only aids in cooling but it also helps to equalize air pressure in the drive when the platters are spinning. On the other side of this hole is a filter, which keeps dirt and debris from getting inside the drive. However, this filter does not stop heavy amounts of moisture (especially in flood situations) or moisture vapor (such as found in a freezer). This moisture vapor has been known to settle on the platters when the drive warms there is really nothing you can do about it. Then when the drive is powered up, the read/write head resembles an airplane flying into a mountain.

In closing, If you’ve experienced a hard drive crash, it is imperative that you consider the value of the data, before you consider the money you might save by doing it yourself. Data recovery is a specialty, and it requires a number of specialized tools, skills and software to complete successfully. Many times you run the risk of taking data that may be perfectly recoverable and destroying it permanently. If you have any questions, it is best to consult with a recovery firm first. Most reputable data recovery companies will perform a free diagnostic and evaluation on most standard IDE hard drives. Many will even include a list of the recoverable files with that evaluation before you proceed. In some cases, we even work with our customers on a payment plan to help ease the burden of the recovery costs. Of course the best way to avoid all of this is to simply backup anything and everything of value

How RAID Data Recovery Works

RAID data recovery is probably one of the most complex processes any data recovery firm can perform. More often than not, the problems are compounded by the actions of the client prior to sending the drives in for recovery. Many users feel that it is important to try and recover the data themselves or repair the array through various system utilities, and this may be fine if the data is not critical. However, it has been our experience that when you have a RAID failure that has resulted in substantial data loss, more often than not, somebody’s job is on the line if that data is not recovered. The biggest piece of advise this article can provide in the event of a RAID failure: LEAVE IT ALONE!

IT professionals have a lot of pressure placed on them when a catastrophic system failure occurs. It is their job to make sure that all systems are up and running. Many times, out of panic, troubleshooting processes are initiated in order to correct the problem. Often times these processes only make a bad situation even worse, and in many instances they can render the data unrecoverable. Let’s keep in mind what this data can consist of in an average corporate environment. You are probably dealing with information that cost many hundreds of thousands, possibly millions of dollars in labor and resources to create. Much of the data probably can’t be duplicated. The intellectual value alone could be in the many millions of dollars. Corporate executives really don’t care to hear about how the failure occurred, or what unbelievable string of events led up to the server crashing. They don’t care to hear the technical jargon as you try to explain to them what happened, and hope they understand that it wasn’t your fault. They only want to know one thing…”why was this data not backed up, and how can we get it back?”

Instead of taking chances on your own, call a data recovery professional. RAID data recovery can be expensive, but in most cases it is much less costly than trying to recreate the data that has been lost, and getting the data back may save someone’s job. There is a set procedure that most data recovery professionals follow when it comes to performing any recovery work. These procedures are followed and expanded upon when dealing with a RAID recovery. The first step of any RAID recovery is to make sure all of the drives are functional. In order to properly complete the recovery it is essential that all drives are fully functional (this is especially true with a RAID 0). This may involve taking any physically damaged drives into the clean room, in order to make the necessary repairs so that they function normally again. Once that is completed the next step is to make complete sector-by-sector clones of every drive. This is not “Ghosting”, but a very low-level process that allows the recovery technician to work around bad sectors, and have complete control over how the drive functions. During the cloning process, the original source drive that you sent in, is put in a “write protect” mode so that no data can be written to that drive. This insures that the original source data is not altered in any way.

Once the cloning process is complete, the original drives you sent in are set off to the side and are no longer touched. The actual recovery process is performed on the cloned copies, so nothing that is done during recovery can make the situation worse. After the drives are cloned, they will be loaded into a system and destriped. Destriping is like taking the scattered pieces of a puzzle and putting them together neatly. Simply stated, destriping is taking the data scattered among the multiple drives that make up array and placing it onto a single destination drive. From there we have a single drive in which we can complete what we would consider to be a “normal” recovery. We can complete this process even at the multi-terrabyte level. If the damage to the stripe is not too severe, in most cases a complete rebuild of the directory structure and all associated data can be completed.

As mentioned earlier, RAID data recovery can be expensive. Typically a RAID recovery can be priced around $500 per drive and up. A number of factors influence the cost, such as RAID type, file system, total size, situation of failure, etc. ACS Data Recovery is one of the few companies that do not charge an evaluation fee on complex RAID systems. Even though the initial price tag of a RAID recovery may be shocking, many times the costs involved in recovering the data are not even 1% of the data’s overall value. So if you are reading this article and you haven’t suffered a RAID failure, what are you waiting for? Back up your data NOW.