Thursday, January 1, 2015

C Programs



1.C program to check odd or even using modulus operator

#include<stdio.h>
main()
{
   int n;
   printf("Enter an integer\n");
   scanf("%d",&n);
    if ( n%2 == 0 )
      printf("Even\n");
   else
      printf("Odd\n");
    return 0;
}


2. Fibonacci Series c language

#include<stdio.h>
 int main()
{
   int n, first = 0, second = 1, next, c;

   printf("Enter the number of terms\n");
   scanf("%d",&n);

   printf("First %d terms of Fibonacci series are :-\n",n);

   for ( c = 0 ; c < n ; c++ )
   {
      if ( c <= 1 )
         next = c;
      else
      {
         next = first + second;
         first = second;
         second = next;
      }
      printf("%d\n",next);
   }
    return 0;
}


3.Palindrome number program c

#include <stdio.h>
 int main()
{
   int n, reverse = 0, temp;
   printf("Enter a number to check if it is a palindrome or not\n");
   scanf("%d",&n);
    temp = n;
    while( temp != 0 )
   {
      reverse = reverse * 10;
      reverse = reverse + temp%10;
      temp = temp/10;
   }

   if ( n == reverse )
      printf("%d is a palindrome number.\n", n);
   else
      printf("%d is not a palindrome number.\n", n);

   return 0;
}


4.C program to check leap year

#include <stdio.h>
 int main()
{
  int year;

  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);

  if ( year%400 == 0)
    printf("%d is a leap year.\n", year);
  else if ( year%100 == 0)
    printf("%d is not a leap year.\n", year);
  else if ( year%4 == 0 )
    printf("%d is a leap year.\n", year);
  else
    printf("%d is not a leap year.\n", year); 
   return 0;
}


5.Prime number program in c language

#include<stdio.h>
 int main()
{
   int n, i = 3, count, c;
    printf("Enter the number of prime numbers required\n");
   scanf("%d",&n);

   if ( n >= 1 )
   {
      printf("First %d prime numbers are :\n",n);
      printf("2\n");
   }

   for ( count = 2 ; count <= n ;  )
   {
      for ( c = 2 ; c <= i - 1 ; c++ )
      {
         if ( i%c == 0 )
            break;
      }
      if ( c == i )
      {
         printf("%d\n",i);
         count++;
      }
      i++;
   }
    return 0;
}


6.C program for prime number or not

#include<stdio.h>
main()
{
   int n, c = 2;
    printf("Enter a number to check if it is prime\n");
   scanf("%d",&n);

   for ( c = 2 ; c <= n - 1 ; c++ )
   {
      if ( n%c == 0 )
      {
         printf("%d is not prime.\n", n);
     break;
      }
   }
   if ( c == n )
      printf("%d is prime.\n", n);
    return 0;
}


7.C program to reverse a number

#include <stdio.h>
 int main()
{
   int n, reverse = 0;
   printf("Enter a number to reverse\n");
   scanf("%d",&n);
    while (n != 0)
   {
      reverse = reverse * 10;
      reverse = reverse + n%10;
      n = n/10;
   }
    printf("Reverse of entered number is = %d\n", reverse);
    return 0;
}



8.Swapping of two numbers in c

#include <stdio.h>
int main()
{
   int x, y, temp;

   printf("Enter the value of x and y\n");
   scanf("%d%d", &x, &y);

   printf("Before Swapping\nx = %d\ny = %d\n",x,y);

   temp = x;
   x    = y;
   y    = temp;

   printf("After Swapping\nx = %d\ny = %d\n",x,y);

   return 0;
}


9.Factorial program in c using for loop

#include <stdio.h>
 int main()
{
  int c, n, fact = 1;

  printf("Enter a number to calculate it's factorial\n");
  scanf("%d", &n);

  for (c = 1; c <= n; c++)
    fact = fact * c;

  printf("Factorial of %d = %d\n", n, fact);

  return 0;
}


10. Print
    *
  ***
*****
  ***
    *

#include <stdio.h>
int main()
{
  int n, c, k, space = 1;
   printf("Enter number of rows\n");
  scanf("%d", &n);
   space = n - 1;
   for (k = 1; k <= n; k++)
  {
    for (c = 1; c <= space; c++)
      printf(" ");
     space--;
     for (c = 1; c <= 2*k-1; c++)
      printf("*");
     printf("\n");
  }
   space = 1;
   for (k = 1; k <= n - 1; k++)
  {
    for (c = 1; c <= space; c++)
      printf(" ");
     space++;
     for (c = 1 ; c <= 2*(n-k)-1; c++)
      printf("*");
     printf("\n");
  }
   return 0;
}

Saturday, December 13, 2014

E-Commerce



E-Commerce:-

Electronic commerce, commonly known as E-commerce or eCommerce, is trading in products or services using computer networks, such as the Internet. Electronic commerce draws on technologies such as mobile commerce, electronic funds transfer, supply chain management, Internet marketing, online transaction processing, electronic data interchange (EDI),Electronic Funds Transfer(EFT), inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web for at least one part of the transaction's life cycle, although it may also use other technologies such as e-mail
Electronic money or e-money, is an evolving term that can have different meanings but in principle involves the use of computer networks and digital stored value systems to store and transmit money. It may have official legal status or not. It may be historical, current or theoretical.

The underlying principle of electronic money involves the use of computer networks such as the Internet and digital stored value systems. Examples of electronic money are bank deposits, electronic funds transfer, direct deposit, payment processors, and digital currencies.

Electronic money can be understood as a way of storing and transmitting conventional money through electronic systems or as digital currency which varies in value and is tradeable as a currency in its own right.

E-Commerce advantages can be broadly classified in three major categories:
Advantages to Organizations:-
1) Using E-Commerce, organization can expand their market to national and international markets with minimum capital investment. An organization can easily locate more customers, best suppliers and suitable business partners across the globe.
2) E-commerce improves the brand image of the company.
3) E-commerce helps organization to provide better customer services
4) E-Commerce reduces paper work a lot.

Advantages to Consumers:-
1) 24x7 support. Customer can do transactions for the product or enquiry about any product/services provided by a company any time, any where from any location. Here 24x7 refers to 24 hours of each seven days of a week.
2) E-Commerce application provides user more options and quicker delivery of products.
3) E-Commerce provides option of virtual auctions.
4) A customer can put review comments about a product and can see what others are buying or see the review comments of other customers before making a final buy.


Advantages to Society:-
1) Customers need not to travel to shop a product thus less traffic on road and low air pollution.
2) E-Commerce helps reducing cost of products so less affluent people can also afford the products.
3) E-Commerce has enabled access to services and products to rural areas as well which are otherwise not available to them.
4) E-Commerce helps government to deliver public services like health care, education, social services at reduced cost and in improved way.


E-Commerce disadvantages can be broadly classified in two major categories:
1)Technical disadvantages
i)There can be lack of system security, reliability or standards owing to poor implementation of e-Commerce.
ii)Software development industry is still evolving and keeps changing rapidly.
iii)There could be software/hardware compatibility issue as some E-Commerce software may be incompatible with some operating system or any other component.
iv) Sometimes, it becomes difficult to integrate E-Commerce software or website with the existing application or databases.

2) Non-Technical disadvantages:-
i)Security/ Privacy: Difficult to ensure security or privacy on online transactions.
ii)Internet access is still not cheaper and is inconvenient to use for many potential customers like one living in remote villages.
iii)Lack of touch or feel of products during online shopping.
iv) Initial cost: The cost of creating / building E-Commerce application in-house may be very high. There could be delay in launching the E-Commerce application due to mistakes, lack of experience.
v) User resistance: User may not trust the site being unknown faceless seller. Such mistrust makes it difficult to make user switch from physical stores to online/virtual stores.

Thursday, December 11, 2014

Multimedia


Multimedia refers to content that uses a combination of different content forms. This contrasts with media that use only rudimentary computer displays such as text-only or traditional forms of printed or hand-produced material. Multimedia includes a combination of text, audio, still images, animation, video, or interactivity content forms.

Categories of multimedia:-Multimedia may be broadly divided into
1.Linear and
2.Interactive (Non-linear).

Linear active content progresses often without any navigational control for the viewer such as a cinema presentation. Non-linear uses interactivity to control progress as with a video game or self-paced computer based training. Hypermedia is an example of non-linear content.
Multimedia presentations can be live or recorded. A recorded presentation may allow interactivity via a navigation system. A live multimedia presentation may allow interactivity via an interaction with the presenter or performer.

Components of multimedia:-
1) Computer System: Workstation,MPEG/Video/DSP
2) Communication Networks : Token Ring,FDDI , Ethernet,Intranet,ATM  ,Internet
3) Display Devices :Hi-Rsolution monitors,CD-quality speakers,Colour printers,HDTV,SVGA,etc.
4) Capture devices : -Video Camera,Video Recorder ,Audio Microphone,Keyboards,Mice
5) Storage devices :- Hard disks,CD ROM,DVD,etc.

Major characteristics:-
Multimedia presentations may be viewed by person on stage, projected, transmitted, or played locally with a media player. A broadcast may be a live or recorded multimedia presentation. Broadcasts and recordings can be either analog or digital electronic media technology. Digital online multimedia may be downloaded or streamed. Streaming multimedia may be live or on-demand.

Multimedia games and simulations may be used in a physical environment with special effects, with multiple users in an on-line network, or locally with an offline computer, game system, or simulator.

The various formats of technological or digital multimedia may be intended to enhance the users' experience, for example to make it easier and faster to convey information. Or in entertainment or art, to transcend everyday experience.

Application:-Multimedia finds its application in various areas including, but not limited to, advertisements, art, education, entertainment, engineering, medicine, mathematics, business, scientific research and spatial temporal applications. 

Monday, November 17, 2014

SSD

SSD  :-
  • A solid-state driveis a data storage device using integrated circuit assemblies as memory to store data persistently.
  • SSD technology uses electronic interfaces compatible with traditional block input/output (I/O) hard disk drives, thus permitting simple replacement in common applications.
  • SSDs have no moving (mechanical) components. This distinguishes them from traditional electromechanical magnetic disks such as hard disk drives (HDDs) or floppy disks, which contain spinning disks and movable read/write heads.
  • SSDs are still roughly seven to eight times more expensive per unit of storage than HDDs.
  • SSDs use NAND-based flash memory, which retains data without power.
  • SSD includes a controller that incorporates the electronics that bridge the NAND memory components to the host computer.
  • SSDs have no moving parts and therefore are basically silent, although electric noise from the circuits may occur.
  • Susceptibility to environmental factors-No moving parts, very resistant to shock and vibration.
  • Storage capacity-In 2013, SSDs were available in sizes up to 2 TB, but less costly 128 to 512 GB drives were more common.
  • Power consumption-High performance flash-based SSDs generally require half to a third of the power of HDDs. High-performance DRAM SSDs generally require as much power as HDDs, and must be connected to power even when the rest of the system is shut down.
  •  SSDs were mainly used in those aspects of mission critical applications where the speed of the storage system needed to be as high as possible. Since flash memory has become a common component of SSDs, the falling prices and increased densities have made it more cost-effective for many other applications. 
  • Advantage :-Speed: This is where SSDs shine. An SSD-equipped PC will boot in seconds, certainly under a minute. A hard drive requires time to speed up to operating specs, and will continue to be slower than an SSD during normal operation. A PC or Mac with an SSD boots faster, launches apps faster, and has higher overall performance. 
  • SSD technology has been developing rapidly.
  • Typically the same file systems used on hard disk drives can also be used on solid state disks.
  • While not a file system feature, operating systems must also align partitions correctly to avoid excessive read-modify-write cycles.
  • A typical practice for personal computers is to have each partition aligned to start at a 1 MB mark, which covers all common SSD page and block size scenarios, as it is divisible by 1 MB, 512 KB, 128 KB, 4 KB and 512 bytes. Modern operating system installation software and disk tools handle this automatically.
  • Other features designed for hard disk drives, most notably defragmentation, are disabled in SSD installations 
  • HDDs win on price, capacity, and availability. SSDs work best if speed, ruggedness, form factor, noise, or fragmentation (technically part of speed) are important factors to you. If it weren't for the price and capacity issues, SSDs would be the winner hands down.
  • Last but not least, an SSD and an HDD can be combined (like Voltron) on systems with technologies like Intel's Smart Response Technology. SRT uses the SSD invisibly to help the system boot faster and launch apps faster.

Sunday, November 2, 2014

Notes on php

The limitations of cookies :-
1) the cokkie specification says that 
I) no cookie can exceed 4KB in size,
II) only 20 cookies are allowed per domain ,
III) and a total of 300 cookies can be stored on the client side
2) There is no control over when the browsers actually expire cookies.

Type juggling :-
1) The conversion of a value from one type to another is called casting.
2) This kind of implicit casting is called type juggling in PHP.

Regular expressions:-
1) Definition :- A regular expression is a string that represents a pattern .The regular expression functions compare that pattern to another string and see if any of the string matches the pattern .Some functions tell you whether there was a match, while others make changes to the string.
2) PHP provides support for two different types of regular expressions :
1) POSIX and 
2) Perl- compatible
3) POSIX regular expressions are less powerful and sometimes slower , than the Perl - compatible functions ,but can be easier to read.
4)There are three uses for regular expressions:
1) matching ,which can also be used to extract information from a string ;
2) substituting new text for matching text; and
3) spilitting a string into an array of smaller chunks.
5) PHP has functions for all three behaviours for both Perl and POSIX regular expressions .For instance ,erg() does a POSIX match ,while preg_match() does a Perl match .
6) Fortunately ,there are a number of similarities between basic POIX and Perl regular expressions, so we'll cover those before dealing into the details of each library. 

Serialzation:-
1) Serializing an object means converting it to bytestream representation that can be stored in a file. This  is useful for persistent data , for example , PHP sessions automatically save and restore object.
2) Serialization in PHP is mostly automatic - it requires little extra work from you.

Design pattern


Why design pattern?
To make project new libraries are created.
New classes can be used for further program i.e. Classes are reusable.
Thus the problem which is reusable is design pattern.


Definition Design Pattern
Each pattern describes a problem which occurs over and over again in our environment and then describes the code of the solution to that problem in such a way that you can use this solution a million times over without ever doing it the same way twice.

Elements of design pattern :-
1) Pattern name
2) Problem
3) Solution
4) Consequences

The person requires documentation for design pattern i.e. Describing design pattern.
For this there are as follows:-
1) Pattern name and classification
2) Intent
3) Also known as ( different names for them e.g. Abstract class has user class name )
4) Motivation ( why person problem to motivate for design pattern )
5) Applicability ( Real life situations where used )
6) Structure ( data structures )
7) Participants ( objects and components )
8 ) Collaboration (collaborate)
9) Consequences ( Advantage and disadvantages) also drawbacks
10) Implementation
11) Sample code( code of any object oriented language )
12) Known Uses
13) Related Patterns .( relationship with other design pattern)
14) Factory methods ( only methods used for design pattern)

The catalog of design pattern :-
1) Abstract factory
2) Prototype
3) Singleton ( means single object )
4) Adaptor
5) Decorator
6) Proxy
7) Command
8) Observer
9) Strategy

Saturday, November 1, 2014

LAN wire configuration

Cat 5 is required for basic 10/100 functionality, you will want Cat 5e for gigabit (1000BaseT) operation.
The ethernet cable, are 8 color coded wires.
These wires are twisted into 4 pairs of wires, each pair has a common color theme.
One wire in the pair being a solid or primarily solid colored wire and the other being a primarily white wire with a colored stripe (Sometimes ethernet cables won't have any color on the striped wire, the only way to tell which is which is to check which wire it is twisted around).
Examples of the naming schemes used are: Orange (alternatively Orange/White) for the solid colored wire and White/Orange for the striped cable. The twists are extremely important.

RJ45 :-
RJ-45 conductor data cable contains 4 pairs of wires each consists of a solid colored wire and a strip of the same color. There are two wiring standards for RJ-45 wiring: T-568A and T-568B. Although there are 4 pairs of wires, 10BaseT/100BaseT Ethernet uses only 2 pairs: Orange and Green. The other two colors (blue and brown) may be used for a second Ethernet line or for phone connections. The two wiring standards are used to create a cross-over cable (T-568A on one end, and T-568B on the other end), or a straight-through cable (T-568B or T-568A on both ends).
What is RJ stands for?
RJ stands for Registered Jacks. These are used in telephone and data jack wiring registered with FCC. RJ-11 is a 6-position, 4-conductor jack used in telephone wiring, and RJ-45 is a 8-position, 8-conductor jack used in 10BaseT and 100BaseT ethernet wiring.

Italian language alphabets pronunciation grammar phrases vocabulary

 The Italian alphabet consists of 21 letters, with a few additional letters used in foreign words. Here's the Italian alphabet: 1. A (a)...