Wednesday, 29 August 2012

Compressing Streams in Input/Output

In the I/O system inside the .NET Framework, there are two methods for compressing data: GZIP and DEFLATE. Both of these compression methods are industry- standard compression algorithms that are also free for patent protection. Therefore, we are free to use either of these compression methods in our own applications without any intellectual property concerns.  These compression methods are exposed by the .NET Framework as two types of streams that support both compression and decompression. These streams are implemented in the GZipStream and DeflateStream classess.

The GZipStream Class

GZipStream is a class that allows the compression of data through to another stream using the GZIP compression method. There are various properties and methods of GZipStream.

GZip properties:

  • BaseStream - Gets the underlying stream.
  • CanRead      - Determines whether the stream supports reading while decompressing a file.
  • CanWrite      - Determines whether the stream can be written to.
  • Canseek       - Determines whether the stream supports seeking.
  • CanTimeout  - Determines whether the stream can timeout.

GZip methods:

  • Close - Closes the stream and releases any resources associated with it.
  • Flush - Clears any buffers within the stream and forces changes to be written to the underlying system or device.
  • Read - Performs a sequential read of a specified number of bytes from the  current position and updates the position to the end of the read upon completion of the operation.
  • Write - Writes information to the stream as a number of bytes and updates the current position to reflect the new write position.

The DeflateStream Class

DeflateStream is a class that allows the compression of data through to another stream using the DEFLATE compression method.

Sunday, 26 August 2012

Problems with Multimedia

Despite the real and potential benefits, the adoption of multimedia by businesses has been very slow. There are various reasons for this reluctance. The quality of some of the early systems proved to be disappointing as well. The developers had not understood the need to use skilled designers for the interactive and audiovisual elements in these systems. Some of the problems remain unsolved. Other, newer problems are likely to arise in future. Various problems occuring with multimedia are:

  • Investment Costs: Against the positive economic benefits outlined above we must set the high cost of implementing a multimedia system. As the cost of technology is falling steadily, the cost of development work remains high. Most other computer- based systems, multimedia involves a high proportion of information in a form that is very expensive to create and maintain. Most managers underestimate the skills involved, the need for a new approach to product management and the length of development time.
  • Technical Barriers: Multimedia is surrounded by a barrage of a new terminology, often involving strings of acronyms that are confusing to users. Many new untired technologies are involved. Managers should be aware that they will need to upgrade their infrastructure to provide:               
  1. New file servers that can manage large volumes of data stored on optical or magnetic media.
  2. Local area networks that can transmit multiple concurrent streams of multimedia data.       
The lack of standards have made it difficult  to ensure compatibilty between the users equipment and that of the distributor of information. Networking the application will exacerbate this problem.                                                           


Thursday, 23 August 2012

About Multimedia

Multimedia means multiple intermediaries between the source and sink of information or multiple means by which information is stored, transmitted, presented or perceived. We can perceive information by means of text, images and graphics, sound, video and animation. The convergence of multimedia technology with telecommunications industry is creating a scenario with similar impact. Multimedia applications are currently undergoing an important transition. Multimedia systems are potentially of great value to organizations. They can make available in electronic form the vast information resources that are currently on paper. Multimedia is effectively an infrastructure technology, characterized by the ability to handle very diverse data types. Multimedia is  the combination of the text, images, audio, video and animation, in addition to simple text. 

Elements of a Multimedia System

A multimedia system combines elements that are familiar from the worlds of film, video, broadcast television, music and telecommunications as well as computing. Various elements are:
  1. A processor, typically a personnel computer or workstation that has been enhanced to handle audio and video.
  2. A variety of methods by which the user can interact with the system, such as keyboard, mouse, joystick or touchscreen.
  3. A microphone.
  4. A screen that can display high-quality still images and moving video as well as computer-generated text, graphics and animations.

Wednesday, 22 August 2012

Object oriented programming principles

There are three basic OOPS principle which includes :
  1. Inheritance
  2. Encapsulation
  3. Polymorphism
Each of these principles can be explained as:


  1. Inheritance:  It is the process by which one object inherits the properties of another object. This is important as it supports the concept of hierarchical classification. Without the use of hierarchies, each object would need to define all of its characteristics explicitly. However, by use of inheritance, an object need only define those qualities that make it unique within its class. It can inherit its general attributes from its parent. Thus, it is the inheritance mechanism that makes it possible for one object to be a specific instance of a general case. Inheritance interacts with encapsulation as well. If a given class encapsulates some attributes then any subclass will have same attributes plus any that adds as part of its specialization..
  2. Encapsulation:  It is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. It is a protective wrapper that prevents the code and data from being arbitrarily accessed by other code defined outside the wrapper. Access to the code and data inside the wrapper is tightly controlled through a well-defined interface. In java, the basis of encapsulation is the class. When we create a class, we will specify the code and data that constitute that class.
  3. Polymorphism:  It is a feature that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation. It is possible to design a generic interface to a group of related activities. This helps to reduce complexity by allowing the same interface to be used to specify a general class of action. It is the compiler's job to select the specific action as it applies to each situation.

Thursday, 9 August 2012

File System Classes

Inside the System.IO namespace are a set of classes used to navigate and manipulate files, directories, and drives. The file system classes are separated into two types of clasees: informational and utility. Most of the informational classes derive from the FileSystemInfo base class. These classes expose all the system information about file system objects- specifically, files, directories, and drives. These classes are named FileInfo and DirectoryInfo. The utility classes provide static methods to perform certain operations on file system objects such as files, directories and file system paths.

File SystemInfo Class

The FileSystemInfo class provides the basic functionality for all informational file system classes.Various properties are:
  • Attributes: Gets or sets FileAttributes of the current file or directory.
  • Exists: Determine whether the file or directory exists .
  • FullName: Gets the full path to the file or directory.
  • Name: Gets the simple name for the file or directory.
Various methods of FileSystemInfo are:
  • Delete: Removes the file or directory from the file system.
  • Refresh: Updates the data in the class with the most current information from the file system.

FileInfo Class

The FileInfo class provides the basic functionality to access and manipulate a single file in the file system. Various FileInfo properties are:
  • Directory: Gets the DirectoryInfo object that represents the directory that this file is stored within.
  • DirectoryName: Gets the name of the directory that this file is stored within.
FileInfo methods are:
  • CopyTo: Makes a copy of the file in a new location.
  • Create: Creates a file based on the current file information.
  • MoveTo: Moves the file to a new location.
  • Open: Opens the file with special privileges like read, read/write, etc. 



Tuesday, 7 August 2012

About Generics

Generics are part of the .NET framework's type system that allows us to define a type while leaving some details unspecified. Instead of specifying the types of parameters or member classes we can allow code that uses our type to specify it. This allows consumer code to tailor the type to its own specific needs. The .NET framework version 2.0 includes several generic classes in the System.Collections. Generic namespace, including dictionary, queue, sorted dictionary, and sorted list. These classes work similarly to their non-generic counter parts in system.colluccection, but they offer improved performance and type safety. Developers used the object classes for parameters and members and would cast other classes to and from the object class. Generics offer two significant advantages over using the object class :
  1. Reduced Run-time errors:  The compiler cannot detect type errors when we cast to and from the object class. Run-time errors will throw an exception. Using generics allow compilers to catch the type of bug before the program runs.
  2. Improved Performance:  Casting requires boxing and un-boxing that steals processor time and slows performance. Using generics doesn't require casting or boxing which improve run- time performance.

Saturday, 4 August 2012

Using Common Reference Types in .NET

Most types in the .NET framework are reference types. These provide a great deal of flexibility and they offer excellent performance when passing them to methods. Reference types store the address of their data,also known as pointer on the stack. The actual data that address refers to is stored in area of memory called the heap. The runtime manages the memoryused by a heap through aprocess called garbage collection. Garbage collection recovers memory periodically as needed by decomposing of items that are no longer referenced . As reference types represent the address of data rather than data itself, assigning one reference  variable to another instance merely creates a second copy of the reference , which refers to the same memory location on theheap as the original value.  There are about 2500 built - in reference types in the .NET framework. Everything not derived from system.value type is reference type, including these 2500 or so built-in reference types.

    Various commonly used reference types are:-

1. System.string is used to text data.
2. System.Text.StringBuilder is used for dynamic text data.
3. System.Array is used for arrays of data. As it is the base class for all arrays.
4. System.IO.Stream is used to buffer for file.device and network I/O.

Wednesday, 1 August 2012

Using Value Types in .Net

The simplest types in the .NET framework, primarily numeric and Boolean types,are value types. Value types are variables that contain their data directly instead of containing a reference to the data stored elsewhere in memory. Instances of value types are stored in an area of memory called the stack, where the runtime can create, read, update, and an be remove them quickly with minimal overhead. There are general value types:
  • Built-in types
  • User-defined types
  • Enumeration
These types can be explained as follows:

  • Built-in Value Types:  These are base types provided with the .NET Framework, with which other types are built. All built-in numeric types are value types. You choose a numeric type based on the size of the values we expect to workwith and the level of precision we require. These numeric types are used so frequently that Visual Basic and C# define aliases for them. To declare a value type we must first declare a symbol as an instance of that type. Value types have an implicit constructor, so declaring them instantiates the type automatically; we don't have to i nclude the New Keyword as we do with the classes.
  • User-Defined types:   These types are also called structures or simply structs, after the language keyword used to create them. As with other value types, instances of user-defined types are stored on the stackand they contain their data directly.
  • Enumerations:  These are related symbols that have fixed values. Use enumerations to provide a list of choices for developers a list of choices for developers using class. If we create an instance of the Titles type, Visual Studio displays a list of the available values when we assign a value to the variable. The purpose of numerations is to simply coding and improve code readability by enabling to use meaningul symbols instead of simple numeric values.