Subscribe by Email


Showing posts with label Write. Show all posts
Showing posts with label Write. Show all posts

Sunday, June 23, 2013

Explain the various File Operations

A number of operations can be carried out on a file. However, there are 6 basic file operations. As we know a file is an ADT or abstract data type. Certain operations need to be considered for defining a file. Operating systems makes calls to these operations. 

Following are the six basic operations:

1. Creation of a file: 
- This operation involves two steps. 
- Firstly, a sufficient space has to be found for storing the file in the file system. - Secondly, for this new file an entry should be made in the directory.

2. Writing to a file: 
- For writing data to a file, a system call has to be made with name and the data to be written as its arguments. 
- A writer pointer is kept by the system at the location in the file where the next write operation is to be carried out. 
- This pointer is updated whenever a write operation occurs.

3. Reading from a file: 
- Just like the write operation, in order to read information from a file, a system call has to be generated along with the name of the file and the location of the content to be read as its arguments. 
- Here, instead of a write pointer there is a read pointer that will indicate the location where the next read operation is to take place. 
- The location at which the current operation is being carried out is kept as a “per – process current – file – position” pointer since the process is either writing to or reading from the file. 
- The same pointer can be used by both the read and write operations in order to reduce the complexity of the system as well as for saving space.

4. Re-positioning within a file: 
- System carries out search in the directory looking for the appropriate entry. 
When found, the current file position pointer is re-pointed to this position. 
This file operation does not require carrying out any input or output operation in actual. 
- Another name for this file operation is the file seek.

5. Deletion of a file: 
- For deletion of the file, the system searches through the directory to find the appropriate entry. 
- When found, the space held by this file is released and the entry in the directory is destroyed so that this space can be reused by other files.  

6. Truncating a file: 
- Sometimes you may require deleting only the contents of a file while keeping it attributes. 
- Deleting the file and recreating it is not an efficient solution. 
- This file operation lets you to erase the contents of the file but save its attributes.
- But here the length attribute of the file will be changed to zero after truncation. 
- The file space is released after truncating.


The above mentioned six basic file operations constitute the minimal file operations set. These operations are primary ones and if combined can perform some other secondary file operations such as copying. A table known as the open file table is maintained by the operating system that stores all the information about the files that are currently open. When the file is closed, its entry is deleted from the open file table. Some files have to be opened explicitly with the function open() before using it. The name of the file is passed as an argument to this function. Then it looks in the directory for this file and an entry is made in the open file table.  Each file has some access rights. It is in these access modes that a process uses the file. A process can perform only those operations which are permitted by the access rights of the file. 


Tuesday, April 30, 2013

What is hard disk and what is its purpose?


- HDD or Hard Disk Drive is for data storage. 
- It is used for storage and retrieval of the digital information or data that is stored on it. 
- The data is stored or retrieved by means of its discs that rotate rapidly. 

Hard Disk and its Purpose

 
- These discs are known as the platters and are coated with some sort of magnetic material. 
- The major characteristic as well as benefit of hard disk drives is that they retain the data even when the power supply is switched off. 
- From hard disk, the data can be read in a manner of random access. 
- This means that the storing and retrieval of the individual blocks of the data can be done either sequentially or in any order that the user may like. 
- A hard disk may consist of one or more than one of those rigid platters. 
These rotating discs have magnetic heads that are located on an actuator arm that is continuously moving and reads and writes data on their surfaces. 
IBM was the first to introduce the hard disk in the year of 1956. 
- Hard disk drives are the most dominant and the prominent secondary storage device for the computers since 1960s. 
- Since then, it has been continuously improved. 
- The HDD units are produced by more than 200 companies; among them most prominent developers are Toshiba, Seagate, Western digital etc. 

HDD’s primary characteristics are:
Ø  Capacity and
Ø  Performance
- The former is specified in terms of the unit prefixes. 
- In some systems, the capacity of the hard disk drive might be unavailable to the user since being used by the operating system and the file system and may have a possibility of occurrence of redundancy.
- The latter is specified in terms of the movements of the heads for a file i.e., the average access time in addition to the time taken for moving the file under the head i.e., the average latency and data rate. 

HDDs are available in two most common factors namely:
Ø  3.5 inch for desktop computers
Ø  2.5 inch for laptops

HDDs might be connected to the system by any of the following standard interface cables:
Ø  Serial ATA or SATA cable
Ø  USB cable
Ø  Serial attached SCSI or SAS cable

- In the year of 2012, flash memory emerged as a tough primary competitor for the hard disk drives. 
- These flash memories are some sort of solid state drives or SSDs. 
- However, the HDDs will still continue to dominate the secondary storage for its advantages such as price per unit of storage and recording capacity. 

- But there is a different scenario is the case of portable electronics.
- Here, the flash drives are considered to be more useful then rotating HDDs because here the durability and physical size of the drive has also to be considered more when compared to price and capacity.
HDD uses the magnetic recording technology where the data is recorded by magnetizing a thin film of material that is typically ferromagnetic on a disk. 
The binary data bits are represented by the sequential change in the direction of the magnetization.
- An encoding scheme is used for encoding the user data. 
- An example of such encoding scheme run – length limited encoding. 
It is these schemes that determine how the magnetic transitions would represent the data.

The latest HDD technologies are:
Ø  Shingled write
Ø  CPP/ MGR heads
Ø  Heat assisted magnetic recording
Ø  Bit – patterned recording


Tuesday, September 25, 2012

What is the difference between functions and actions in QTP?


Functions and actions are two different aspects of quick test professional. In this article we will talk regarding the two and see what the differences between them are. 

What are functions in QTP?

- In most of the cases you may need to use some segments of code again and again in your tests. 
- In such a case a user defined function can be created which will not only reduce the length of your tests but will also make it easier to be designed, read and maintained. 
- The created functions can consist of the following:
  1. Sub routines,
  2. Modules
  3. VBScript functions and so on.
- Three simple tests need to be followed if a function is to be used in the test from a library:
  1. For creating a new function you can select new function library from the file menu. This cause a new tab to open up in the quick test professional window. You can even opt for multiple tests in the same file.
  2. Next you need to save the function with extension “.qfl” and associate the appropriate library with that particular function. “Associate function library” option can be accessed from file menu.
  3. Now the third step is to invoke the function using the usual simple function call. Quite advanced or sophisticated functions can be generated using DCOM and COM.

What are actions in QTP?

- Whenever you have a piece of code at your disposal you get two options in quick test professional i.e., to either turn it in to a function or a reusable action.
- When the quick test 9 was introduced by the mercury, an argument was made in the favor of the functions for making them more compelling by the means of multi document interface. 
- Many function libraries can be used at once but still mostly one test is used. 
- If you want a reusable action to be edited, the current test has to be shut down. 
- Then you need to open the test in which you want to make the changes, make the changes and then save and close. 
- Later, the original test can be re-opened.

Differences between Functions and Actions in QTP

Now we are stating below some very basic differences between the functions and actions in quick test professional:

1. Passing of Data: 
Functions can access a variety of objects advance as well as primitive like arrays, test objects (such as frames, pages and so on.) and dictionary objects. But this is not the case with the actions rather they can accept only primitive kind of data types such as parameters like integers, strings and so on.

2. Use of Resources: 
Each action is provided with the following basic things:
a)   A folder
b)   3 separate VBS files
c)   A subfolder for keeping snapshots
d)   A certain amount of load time
e)   An excel spreadsheet and
f)    A local object repository.
On the other hand a function consists of only the code and nothing else.

3. API: 
For functions, the function libraries can be attached to the test scripts through the API of the quick test professional. As for the actions the insertion of the calls in the existing actions is not possible through the API of the quick test professional rather it can be done only through the interface.

4. Return Values: 
Actions return the values which are quite difficult to be read in syntax as well as understand. On the other hand the return values of the functions work well and similarly in all the languages.
With actions your test can be divided in to business processes or logical units along with the scripts that are more efficient as well as modular.


Facebook activity