Saturday 31 October 2015

Solution to set mp3 song as ringtone in samsung galaxy y duos GT-S6102.


Here's how to set your mp3 as Ringtone:

1. Open any File Manager App

2. Look for folder called "Media" in phone's main directory.(Mostly it doesn't exist, so create it by right clicking & choosing "New folder", then Rename the folder to "media")

3. Inside the "Media folder", you need a folder "Audio". Again if it's not there create it as above.

4. Inside the "Audio folder", create subfolders for the sound categories you want to change:

=>"Ringtones" for the sound files you want to use for incoming calls
=>"Alarms" for the sound files you want to use for alarms
=>"Notifications" for all other alerts such as incoming SMS, emails or alerts from individual apps, etc.

Note==> Lower/Upper case is irrelevant-the folders can be "MEDIA", "Media",  or "media" etc.

Thursday 22 October 2015

C Tokens

C tokens:

  • C tokens are the basic buildings blocks in C language which are constructed together to write a C program.
  • Each and every smallest individual units in a C program are known as C tokens.
  • C tokens are of six types. They are,
  1. Keywords               (eg: int, while),
  2. Identifiers               (eg: main, total),
  3. Constants              (eg: 10, 20),
  4. Strings                    (eg: “total”, “hello”),
  5. Special symbols  (eg: (), {}),
  6. Operators              (eg: +, /,-,*)

Difference between format specifiers %i and %d in printf?

They are the same when used for output, e.g. with printf.

 But different when used as input specifier e.g. with scanf, where %d scans an integer as a signed decimal number, but %i defaults to decimal but also allows hexadecimal (if preceded by "0x") and octal if preceded by "0".

So "033" would be 27 with %i but 33 with %d.

C Arrow Operator

Arrow operator (->)

Arrow operator is used for accessing members of structure using pointer variable, below is the syntax of arrow operator in c programming –

Syntax of arrow operator

 struct student 
{
  char name[20],
  int roll; 
}*ptr;

Expalanation :

Whenever we declare structure variable then member can be accessed using the dot operator. But when pointer to a structure is used then arrow operator is used.

Both dot and arrow operator serves same function to access member of structure. Lets compare dot operator and arrow operator –

Example1:
 Struct student
{
    char name[20],
    int roll;
}std;
Example2: 
struct student
{
    char name[20]; 
    int roll;
}*ptr;


Access Structure MemberExample 1Example 2
Name is accessed usingstd.nameptr->name
Roll number is accessed usingstd.rollptr->roll

We can conclude that arrow operator is used to access the structure members when we use pointer variable to access it
In case if we want to access the members of structure using ordinary structure variable then we can use dot operator.

C Conditional Operators

Conditional Operators [ ?: ] are also called as Ternary Operator .

Syntax :

expression 1 ? expression 2 : expression 3
 
where
  • expression1 is Condition
  • expression2 is Statement Followed if Condition is True
  • expression2 is Statement Followed if Condition is False
 
 Explanation:
  1. Expression1 is a Boolean Condition i.e it results into either TRUE or FALSE
  2. If result of expression1 is TRUE then expression2 is Executed.
  3. Expression1 is said to be TRUE if its result is NON-ZERO.
  4. If result of expression1 is FALSE then expression3 is Executed.
  5. Expression1 is said to be FALSE if its result is ZERO. 

Example : Check whether Number is Odd or Even 

#include<stdio.h>

int main()
{
  int num;
  printf("Enter the Number : ");
  scanf("%d",&num);
   if(num%2==0)
    printf("\nNumber is Even");
   else
    printf("\nNumber is Odd");
 }

We can write this program as –

#include<stdio.h>

int main()
{
  int num;
  printf("Enter the Number : ");
  scanf("%d",&num);
 (num%2==0)?printf("\nNumber is Even"):printf("\nNumber is Odd");
 }

Note :
Operator that works on 3 operands is called as tertiary operator.

With C arrays, why we can write that a[5] == 5[a]?

The C standard defines the [] operator as follows:

a[b] == *(a + b)

Therefore a[5] will evaluate to: *(a + 5)
 
and 5[a] will evaluate to:

*(5 + a)
 
and we know those are equal. (Addition is commutative.)

This is the direct artifact of arrays behaving as pointers, "a" is a memory address. "a[5]" is the value that's 5 elements further from "a". The address of this element is "a + 5". This is equal to offset "a" from "5" elements at the beginning of the address space (5 + a).


Friday 16 October 2015

Types of Virtualization



Hardware virtualization: Hardware virtualization is very similar in concept to OS/Platform virtualization, and to some degree is required for OS virtualization to occur. 

Hardware virtualization breaks up pieces and locations of physical hardware into independent segments and manages those segments as separate, individual components. 

Hardware virtualization (also referred to as hardware-assisted virtualization) is a form of virtualization that uses one processor to act as if it were several different processors. The user can then run different operating systems on the same hardware, or more than one user can use the processor at the same time. This type of virtualization requires a virtual machine manager (VM) called a hypervisor.

Both symmetric and asymmetric multiprocessing are examples of hardware virtualization. In both instances, the process requesting CPU time isn't aware which processor it's going to run on; it just requests CPU time from the OS scheduler and the scheduler takes the responsibility of allocating processor time.

Another example of hardware virtualization is "slicing": carving out precise portions of the system to run in a "walled garden," such as allocating a fixed 25% of CPU resources to bulk encryption. If there are no processes that need to crunch numbers on the CPU for block encryption, then that 25% of the CPU will go unutilized. If too many processes need mathematical computations at once and require more than 25%, they will be queued and run as a FIFO buffer because the CPU isn't allowed to give out more than 25% of its resources to encryption. This type of hardware virtualization is sometimes referred to as pre-allocation.

Asymmetric multiprocessing is a form of pre-allocation virtualization where certain tasks are only run on certain CPUs. In contrast, symmetric multiprocessing is a form of dynamic allocation, where CPUs are interchangeable and used as needed by any part of the management system.
Each classification of hardware virtualization is unique and has value, depending on the implementation. Pre-allocation virtualization is perfect for very specific hardware tasks, such as of loading functions to a highly optimized, single-purpose chip.
 
However, pre-allocation of commodity hardware can cause artificial resource shortages if the allocated chunk is underutilized. 

Dynamic allocation virtualization is a more standard approach and typically offers greater benefit when compared to pre-allocation. For true virtual service provisioning, dynamic resource allocation is important because it allows complete hardware management and control for resources as needed; virtual resources can be allocated as long as hardware resources are still available.
The downside to dynamic allocation implementations is that they typically do not provide full control over the dynamicity, leading to processes which can consume all available resources.

Example: The server’s hardware is virtualized thus allowing us to be able to run different OS and different applications simultaneously on the same hardware.  This allows us to do server consolidation.  And the benefits are obvious:
a) Less number of servers required for the same number of applications.
b) Less power consumption.
c) Less maintenance overhead for the IT staff.
d) More resource utilization.
e) Easier (and faster) to add more capacity.
f)  Patch management and upgrades become easier.
g) DRP (Disaster Recovery Planning) becomes easier.  Without any interruption to the service, one can backup and even migrate entire virtual environments.

In other words, Using hardware or software, hardware virtualization is the separation of: hardware from hardware or hardware from software.
In the datacenter world, a growing trend for several years has been the use of blade servers, which use a type of hardware virtualization. If you look at the back of a blade server you will usually only see a power connection and a big block of copper connections. But when you use a blade server you still have access to network interfaces through the use of hardware virtualization which can emulates a NIC and pass the traffic through switches in the back of the blade enclosure. 

On most servers, including blade servers, you will usually be hard pressed to find a CD or DVD drive - which could make it hard to install an operating system. Vendors instead provide a way for administrators to mount a virtual drive that allows them to install an OS while not even in the same room as the server. This is software based hardware virtualization. 

Examples of other hardware components you can virtualize: routers, switches, processors, hard drives and even wireless adapters.

Operating System Virtualization

This type of virtualization, also called container-based virtualization, uses the same operating system on a server but chops it up into component parts. Each virtual environment has its own sets of rules and access – is its own virtual server – with the one exception that it all must be compatible with the same operating system.

It typically allows you to run and install any kind of Operating system like Windows 7 or a Linux distro on your existing operating system. It requires a Virtual Machine Manager (VMM) which allows you to install and manage multiple operating systems running simultaneously even (If your machine has powerful resources).

Virtual Machine Managers (VMMs) manage each virtual machine individually; each OS instance is unaware that 1) it's virtual and 2) that other virtual operating systems are (or may be) running at the same time. Companies like Microsoft, VMware, Intel, and AMD are leading the way in breaking the physical relationship between an operating system and its native hardware, extending this paradigm into the data center. As the primary driving force, data center consolidation is bringing the benefits of virtual machines to the mainstream market, allowing enterprises to reduce the number of physical machines in their data centers without reducing the number of underlying applications. This trend ultimately saves enterprises money on hardware, co-location fees, rack space, power, cable management, and more.

OpenVPN is an example of an open source version of OS virtualization. Another example is Oracle Solaris.

Application Virtualization

Application virtualization separates individual software applications from the operating system allowing the user to run almost any application on almost any operating system, not from their workstation, but from a remotely located server. The server stores all personal information and other characteristics of the application, but can still run on a local workstation. Technically, the application is not installed, but acts like it is. Other application virtualization benefits include:
Ø Application virtualization separates applications from the operating systems and can run the applications on workstations, thin clients, laptops and some smart phones.
Ø Applications are run centrally so you don’t have to worry about having enough storage space on the local desktop hard drive.
Ø Multiple applications can run at the same time without bogging down the system or conflicting with other apps.
Ø Virtualized applications can be installed, maintained and patched as soon as updates are available.
Ø One major benefit of application virtualization is that you can run incompatible applications at the same time. You can also run an application that is not designed for the operating system of the computer from which you are accessing it.

Finally, virtualizing applications means that they do not have to be downloaded to the end-user’s computer.

Microsoft Softgrid is an example of Application Virtualization.

Area & Technology based Virtualization

Virtualization can be classfied based on the technology or the area that is being virtualized:
ü Server Virtualization
ü Storage Virtualization
ü Network Virtualization

          Server Virtualization

Server virtualization allows multiple servers to be installed on one or more existing servers.  This saves floor space and money since you don’t have to purchase new servers or expand the square footage of your server room.The benefits of server virtualization include:

Ø Multiple operating systems can be run on a single physical server (host).
Ø Many physical servers can often be consolidated into a one or two physical servers, saving your small business money that would have been spent on physical servers.
Ø Your small business’s electricity requirements will decrease—fewer servers run on less power and will also generate less heat which will reduce your server room cooling bill
Ø Virtualizing most servers onto one or two physical servers reduces server maintenance costs.
Ø Additional RAM, processor power or storage space can be quickly and easily allocated to any virtual server.
Ø In case of a virtual server error, quick restores can be done from locally stored backups.
Ø Virtual servers are easily moved between host servers, allowing maximum use of available processing power.

Because each server typically serves one function (i.e., mail server, file server, Internet server, enterprise resource planning server, etc.), with each server using only a fraction of its true processing power, server virtualization breaks through the “one application, one server” barrier and facilitates the consolidation of numerous servers into one physical server. This equates to (a) less physical servers required, and (b) 70 to 80 percent or higher utilization of existing hardware as opposed to the previous 10 to 15 percent.

Server virtualization lets one server do the job of multiple servers by sharing the resources of a single server across multiple environments. The software lets a company host multiple operating systems and multiple applications locally and in remote locations, freeing users from physical and geographical limitations.
           
            Storage virtualization

This type of virtualization allows numerous hard drives or other storage devices to be combined into one virtual environment (VE) for storage. Administrators for a business’s network are then able to manage everything from one centralized location, which obviously greatly simplifies administration. It’s easier to know the amount of available resources at a quick glance, back up the system more efficiently, etc.
Additionally, migrating data and storage expansion can be accomplished more smoothly using this type of virtualization. Data can be transferred between one device and another with no disruption to operability. Plus, if a device’s storage maxes out, it is easy to allot additional room within the overall storage threshold.
Storage virtualization should be used for boxes as well: Why have a bunch of smaller boxes containing individual office supplies when you can throw everything into an all-purpose refrigerator box? I, for one, can’t think of a good reason.
Storage virtualization is a concept in System Administration, referring to the abstraction (separation) of logical storage (virtualized partitions of stored data) from physical storage (storage devices that hold, spin, read and write magnetic or optical disks such as CD, DVD, or even a hard disk drive, etc.). This separation allows the Systems Admin increased flexibility in how they manage storage for end users.
Virtualization of storage helps achieve location independence by abstracting the physical location of the data. The virtualization system presents to the user a logical space for data storage and itself handles the process of mapping it to the actual physical location.
There are three basic approaches to data storage:
1.                 Direct-Attached Storage (DAS)

  This is the traditional method used in data storage where hard drives are     attached to a physical server. Because this method is easy to use but hard  to manage, virtualization technology is causing organization to have a second thought with regard to its viability.
2.                 Network-Attached Storage (NAS)

  This is a machine that resides on your network and provides data  storage to other machines. It can be thought of as the first step toward storage virtualization. This approach provides a single source of data, facilitating data backup. By collecting your data in one place, it also avoids the problem of multiple servers needing to access data located on another server.
3.                 Storage Area Network (SAN)

  This ultra-sophisticated approach deploys specialized hardware and   software to transform mere disk drives into a data storage solution that transfers data on its own high-performance network.
Companies shift over to a SAN when they recognize that corporate data is a key resource that must be available 24/7 and needs to be conveniently managed. The price tag for this approach is very high indeed.

Storage Virtualization is of mainly 2 types, Block Virtualization and File Virtualization.

In Block Virtualization, multiple storage devices are consolidated, which then actually appears as a single physical storage device. This helps the administrators in many ways such as Load Balancing, optimizing performance and speed. Technically, they actually RAID (Redundant Array of Independent Disks) these devices and configure it as per their needs. In fact, even something as simple as Partitioning you own hard drive into more than one partitions can be considered as an example.

File Virtualization, as the name suggests, is the file or directory stored within the hard drive, which is located in a data center. The file may not be stored within your personal folder; in fact the folder might not even have your own name, it may be located in a data center across the globe.

Network Virtualization

Combining all of the resources within your network, allowing the administrator of the network to share those resources across all users, is called network virtualization. The network is divided into a number of different channels, each of which contains a portion of the bandwidth of the network. This makes it easier for the administrator to assign resources as users need them.
Access to the network as a whole from an individual computer means that it is easier for individual employees of the business to work on the same file – there is no need to transfer or download it. In fact, it is the same file… similar to working on a file within Google Drive. It also means that the entire network can be accessed from any computer within the network. This practice makes it simpler to perform business operations without having to be working on a particular computer.

In its very basic form, a VLAN created even on a small network can be termed as Network Virtualization. In Network Virtualization, Two (or more) virtual networks can be created within the  same physical network  belonging to the same IP range and yet they do not have the authorization to communicate with each other. They operate in their own logical network, with each logical network having different set of processes and functions to perform. They are segregated within the same physical network.

Advantages and Disadvantages of Virtualization



Advantages of Virtualisation
Ø Benefits for Companies
ü Virtualization provides several benefits for companies, including:
ü Greater efficiency and company agility
ü Ability to more-effectively manage resources
ü Increased productivity, as employees access the company network from any location
ü Data stored on one centralized server results in a decrease in risk of lost or stolen data
Ø Benefits for Data Centers
ü Not only is it beneficial for companies, but virtualization provides several benefits for data centers as well, including:
ü Cutting waste and costs associated with maintaining and cooling its servers by maximizing the capabilities of one server
ü Allows data centers to be smaller in size, resulting in overall savings due to a reduction in —
ü Energy needed
ü Hardware used
ü Time and money needed for maintenance

Ø Reduced IT costs:
ü Capital expenditure savings. Virtualization lets companies reduce their IT costs by requiring fewer hardware servers and related resources to achieve the same level of computing performance, availability and scalability.

ü Operational expenditure savings. Once their servers are virtualized, IT staffs can greatly reduce the ongoing administration and management of manual, time-consuming processes by automating operations, thus resulting in lower operational expenses.

ü Data-center and energy-efficiency savings. As companies reduce the size of their hardware and server footprint due to the use of virtualization, they lower their energy consumption, cooling power and data-center square footage, thus resulting in lower costs.

Ø Easier backup and disaster recovery. Simple data recovery is another great advantage of this technology. For instance if your virtual server suddenly becomes corrupted you simply delete it and restore it from its virtual backup. You do not need to spend time and effort on restoring your entire system from scratch and then restore it from the latest backup. So a corrupted virtual system can be recovered in mere minutes.

Ø Better business continuity. With an increasingly mobile workforce, having good business continuity is essential. Without it, files become inaccessible, work goes undone, processes are slowed and employees are less productive. Virtualization gives employees access to software, files and communications anywhere they are and can enable multiple people to access the same information for more continuity.

Ø More efficient IT operations. Going to a virtual environment can make everyone’s job easier – especially the IT staff. Virtualization provides an easier route for technicians to install and maintain software, distribute updates and maintain a more secure network. They can do this with less downtime, fewer outages, quicker recovery and instant backup as compared to a non-virtual environment.

Ø Improved System Reliability and Security. Virtualization of systems helps prevent system crashes due to memory corruption caused by software like device drivers. VT-d for Directed I/O Architecture provides methods to better control system devices by defining the architecture for DMA and interrupt remapping to ensure improved isolation of I/O resources for greater reliability, security, and availability.

Ø VMs are portable. Its just a huge file. Take that file with you anywhere and you have your files and operating with u whereever you go. However you can only run it on a pc that has a Virtualisation software, software that allows you to run virtual machines.

Ø Testing and learning. If your a software developer, you can test software inside a VM. If the VM would or ever crash your operating system due to your software, then the main operating system is not affected, only the VM would be.

Ø So its good for testing purposes. Its also good for testing a virtual network. You could set up multiple VMs and network each VM together as if they were separate machines. This would allow you to test out networking protocols.

Ø 3. If you have a server with lots of computing resources then you could create lots of webservers which are separate to each other and resell what they call 'virtual server' to customers. This means they get a slice of your computer resources. If their webserver shuts down abnormally, the machine wouldnt be affected as you they will only have access to their virtual machine.

Disadvantages of Virtualization

Ø Upfront costs. The investment in the virtualization software, and possibly additional hardware might be required to make the virtualization possible. This depends on your existing network. Many businesses have sufficient capacity to accommodate the virtualization without requiring a lot of cash. This obstacle can also be more readily navigated by working with a Managed IT Services provider, who can offset this cost with monthly leasing or purchase plans.

Ø Software licensing considerations. This is becoming less of a problem as more software vendors adapt to the increased adoption of virtualization, but it is important to check with your vendors to clearly understand how they view software use in a virtualized environment.

Ø Possible learning curve. Implementing and managing a virtualized environment will require IT staff with expertise in virtualization. On the user side a typical virtual environment will operate similarly to the non-virtual environment. There are some applications that do not adapt well to the virtualized environment – this is something that your IT staff will need to be aware of and address prior to converting.

Ø Not Supported by All Applications: If your CPU does not allow for hardware virtualization then you can run some operating systems in software virtualization but generally its slower. So slow that it would annoy you.
Some operating systems will not run in software virtualization and require that you have a CPU with hardware virtualization. So it would cost you more if you dont have a CPU with hardware virtualization.