Thursday, August 04, 2011

How to increase Hard disk size in VMWare Virtual machine

How to add new hard disk / Increasing hard disk size in VM Ware virtual machine.

Here is the link to know,

Monday, November 06, 2006

C program to count the number of bits set in an unsigned integer

/*
Program to count no. of bits in an unsigned integer
*/
#include
#include

void main( void )
{
unsigned int a = 15;
int count = 0;

while( a )
{
++count;
a = a & ( a - 1 );
}

clrscr();
printf( "Count is %d\n", count );
getch();
}

Thursday, June 15, 2006

BITWISE OPERATOINS

Refer:
http://graphics.stanford.edu/~seander/bithacks.html

Register Storage Class

register is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and cant have the unary '&' operator applied to it (as it does not have a memory location).
{
register int Miles;
}
Register should only be used for variables that require quick access - such as counters. It should also be noted that defining 'register' goes not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register - depending on hardware and implimentation restrictions.

Duplicate Characters deletion - String Operation

String Operation
Duplicate Characters deletion
/*
Name: Duplicate Characters deletion
Copyright: StarSoft
Author: Vijayakumar M
Date: 28/04/06 11:14
Description: To Remove Duplicate
characters in a string.
*/
#include
#include
#include
main()
{
char string[40]="thats goods super star";
char *p= string;
int i, j;
printf( "%s\n", string );
for( i=0;i {
for( j=i+1; j {
if( string[i]==string[j])
*(p+j)='*';
}
}
printf( "%s\n", string );
for( i=0;i {
if( string[i] != '*' )
printf( "%c", string[i] );
}
   getch();
}

Which elements are stored in stack?

In computer science, a stack is a temporary abstract data type and data structure based on the principle of Last In First Out (LIFO).
Stacks are very widely and extensively used in modern computer systems, and are usually implemented through a combination of hardware and software features.

A stack-based computer system is one that stores temporary information primarily in stacks, rather than hardware CPU registers (a register-based computer system).

how to find give no is 2 power of n

f=( ( no & ( no-1 ) ) == 0 )

if( f == 1)
printf( "The Given Number is Power of %d", no );
else
printf( "The Given Number is not Power of %d", no );

BITWISE OPERATIONS

#define SET_BIT( _X_, _NO_ ) ( 1<<(_X_-1)) _NO_
#define RESET_BIT( _X_, _NO_ ) ~( ( 1<<(_X_-1) ) ) & _NO_
#define SWAP_BIT( _X_, _NO_ ) ( 1<<(_X_-1)) ^ _NO_

Standards Other than DVB

1. ATSC
The Advanced Television Systems Committee (ATSC) is the group that helped to develop the new digital television standard for the United States, also adopted by Canada, Mexico, and South Korea and being considered by other countries.It is intended to replace the NTSC system and produce wide screen 16:9 images up to 1920×1080 pixels in size—more than six times the display resolution of the earlier standard.
2. ISDBIntegrated Services Digital Broadcasting (ISDB) is the digital television (DTV) and digital audio broadcasting (DAB) format that Japan has created toallow radio and television stations there to convert to digital.
3. ARIB
The Association of Radio Industries and Businesses, commonly known as ARIB, is a standardization organization in Japan.
ARIB is designated as the center of promotion of the efficient use of the radio spectrum and designated frequency change support agency.
4. SBTVD
Brazilian Digital Television System is a proposed digital television standard for Brazil.

Wednesday, June 14, 2006

What is embedded system?

Electrical control system which is designed to perform predefined specific function with combination of computer hardware and software.

RISC processor

Acronym for Reduced Instruction Set Computer. A microprocessor that carries out fewer instructions than traditional microprocessors so that it can work more quickly.

Direct Memory Access( DMA )

A technique for transferring data from main memory(not only main memory any type of memory) to a device without passing it through the CPU.

What is teltext?

Teletext is an information retrieval service provided by television broadcast companies. Teletext pages can be viewed on television sets with suitable decoders. They offer a range of text-based information, usually including national, international and sporting news, weather and TV schedules. Subtitle (or closed caption) information is also transmitted in the teletext signal.

What is preemptive scheduler?

A scheduler that may switch between threads at any time.

Monday, March 20, 2006

Pointer: What this means? int * (*(*ptf)(int))(char)

How can you detect a Cycle in a Linked List?

Constraint 1 : List is read-only, and you cannot mark elements.
Constraint 2 : There is limited amount of memory
Constraint 3 : The list is arbitarily long

Catch Loops in Two Passes
O(n) time complexity
Simultaneously go through the list by ones (slow iterator) and by twos (fast iterator). If there is a loop the fast iterator will go around that loop twice as fast as the slow iterator. The fast iterator will lap the slow iterator within a single pass through the cycle. Detecting a loop is then just detecting that the slow iterator has been lapped by the fast iterator.

// Best solution
function boolean hasLoop(Node startNode){
Node slowNode = Node fastNode1 = Node fastNode2 = startNode;
while (slowNode && fastNode1 = fastNode2.next() && fastNode2 = fastNode1.next()){
if (slowNode == fastNode1 slowNode == fastNode2) return true;
slowNode = slowNode.next();
}
return false;
}

Sunday, March 19, 2006

Give Me a String at Random from THIS File

Constraint:
1) You can make only one sequential pass through the file.
2) You may not store any additional information like a table of offsets.

I would like to receive the answers from you all. After receiving answers from you i will post the answer.

PS: Seems this question also asked in Microsoft Inverview.

--------------------------------------------------------------------

Solution: ( Taken from a book, if anyone know best solution, please post comment )

The basic technique is to pick survivors, and recalculate as you go along. This is so com-putationally inefficient that it's easy to overlook. You open the file and save the first string. At this point you have one candidate string with a 100% probability of picking it. While remembering the first string, you read the next string. You now have two candidates, each with a 50% probability. Pick one of them,save it, and discard the other. Read the next string, and choose between that and the saved string,weighting your choice 33% toward the new string and 67% toward the survivor (which represents the winner of the previous two-way selection). Save the new survivor.

Keep on doing this throughout the entire file, at each step reading string N, and choosing between that(with probability 1/N) and the previous survivor, with probability (N - 1)/N. When you reach the endof the file, the current survivor is the string picked at random!

Determine if a Variable is Signed or Not?

I hope you thought the below answer:

if (Var >0 )
signed
else
un-signed.

If so, your answer is wrong. Because, once more check the question carefully. It is not asking variable value is signed/ signed or negative/ postive. It is asking type's sign.

Example, type 'char' it has both 'sighed char' and 'unsigned char'. How do we know? Thanks to the 2's complement, using which we can find it.

Before saying the way, let me explain that, we cant use function for this: why? because if we use function, the type of the variable is defined, but our purpose is to find for any given type. So, we use Macro for it.

If we use macro, we can find the sign type, in two cases:

If the argument is value: (thanks to 2's complement)
#define IS_SIGNED(__VAR__) ( ( __VAR__ > 0 ) && ( ~__VAR__ > 0 ) )

If the argument is type: (thanks to typecasting)
#define IS_SIGNED(__TYPE__) ( (__TYPE__)0 - 1 > 0 )

PS: This question is asked in a interivew for recruiting to Microsoft.

How is a Library Call Different from System Call?

Answer: Simply, Library calls are part of the language/ application, system calls are part of the Operating System.

How: A system call gets into the kernel by issuing a "trap" or interrupt.

Below is the versus between these two calls:

  1. Example, the C Library is same on every ANSI C implmentation. System calls are different in each OS.
  2. Library call is a call to a routine in a library. System call is a call to the kernel for a service.
  3. Library call are linked with user program. System call is an entry point to the OS.
  4. Library calls are executed in user address space. System calls are executed in kernel address space.
  5. Library calls are counted as part of "user" time. System calls are counted as part of the "system" time.
  6. Library calls has the lower overhead of the procedural call. System calls have higher overhead context switch to kernel and back.

Wednesday, February 01, 2006

DiSEqC


DiSEqC (Digital Satellite Equipment Control) is a special comunication protocol for use between a satellite receiver and a device such as a multi-dish switch or a small dish antenna rotor. It is compatible with the actuators used to rotate large C band dishes if used with a DiSEqC positioner. It relies only on the coaxial cable to transmit both bidirectional data/signals and power.

Applications of DiSEqC:DiSEqC 1.0 circuit max. 4 LNB`s




DiSEqC 1.0: 4 LNB's Separate Option/Position



Diseqc A = Position A Option A
Diseqc B = Position B Option A
Diseqc C = Position A Option B
Diseqc D = Position B Option B


DiSEqC 1.0 + 0/12 Volt: 8 LNB's



DiSEqC 1.0 + Toneburst + 0/12 Volt: 12 LNB's

Attitudes in the receiver menu:
LNB1 = DiSEqC A, 0 Volt, ToneBurst Sat A
LNB2 = DiSEqC A, 0 Volt, ToneBurst Sat B
LNB3 = DiSEqC B, 0 Volt, ToneBurst aus
LNB4 = DiSEqC C, 0 Volt, ToneBurst Sat A
LNB5 = DiSEqC C, 0 Volt, ToneBurst Sat B
LNB6 = DiSEqC D, 0 Volt, ToneBurst aus
LNB7 = DiSEqC A, 12 Volt, ToneBurst Sat A
and so on to LNB12.

DiSEqC 1.0 + Toneburst + 2 Tuner: 12 LNB's


DiSEqC 1.1: 16 LNB's


DiSEqC 1.1: 64 LNB's



DiSEqC 1.2 of 1.3 Motor : 1 LNB


DiSEqC 1.2: 10 LNB's without Motor


DiSEqC 1.0 + ToneBurst + DiSEqC 1.2 + 2 Tuner: 16 LNB's


DiSEqC 1.0 + 0/12 Volt + DiSEqC 1.2 or 1.3 Motor: 5 LNB's