Tuesday 25 December 2012

PHP Random Generation Functions

Random Number Generation In Better Way :

Random Number are one of the prime need in making a complicated algorithm.  The main aim of a random number generator is to produce a number which is Unpredictable (impassible to predict) an Unbiased (enven chance for every number in a range to appear).
 To achieve is sort of irregularities  PHP introduce several random number generator function. Such generator are discussed below :

Basic Random Generators :

 rand() and mt_rand() :    Each of these functions generates a random number using its own internal algorithm from a seed. Think of the seed as the starting point for the algorithm. If the seed is unknown then the numbers produced are quite strong. However, if the seed is known or is able to be tampered with, then the generated sequence is very predictable. A common attack on programs is “seed poisoning”, where the attacker has found a way to tamper with the seed and use a known value, which will undermine your random number generation process.

lcg_value() : It generates weaker random numbers but the seed is internal and less susceptible to seed poisoning attacks. However,it only receives a seed on the first call and the seed is made up of the process id and current time. An attacker that knows this can use this information to reasonably predict the sequence of numbers generated.

uniquid() : This is another function used to generate random strings and it internally uses the current time and then calls lcg_value(). So if lcg_value() is compromised the generation of unique strings from uniquid() can be guessed fairly easily.

mcrypt(): The best way to generate random numbers in PHP is to use MCrypt, which is a replacement of the UNIX crypt command. MCrypt provides the mcrypt_create_vi() function which can be used with MCRYPT_DEV_RANDOM to generate very strong and unhampered random numbers. the choice of random number generator is yours and may even vary depending on your needs and the project. While random number generation may seem hard on the surface, by understanding the rules of predictability and bias you are better prepared to create better random numbers and avoid the common pitfall of introducing bias to your system. Keeping your random numbers pure and free from attacks is important and can be critical in high-performance systems such as security, where these are frequently used.

string mcrypt_create_iv ( int $size [, int $source = MCRYPT_DEV_RANDOM ] )
 

Tuesday 20 November 2012

Component Based Software Engineering & Computing


 Component Based Software Engineering : 

Definition :
Component-based software engineering (CBSE) is a process that emphasizes the design and construction of computer-based systems using reusable software “components.”

       CBSE is changing the way large software systems are developed. CBSE embodies the “buy, don’t build” philosophy. So in simple words, CBSE is a process of developing software application using reusable small programs knows as components.




Engineering/Computing of Component-Based Systems:

CBSE is quiet similiar to conventional or object-oriented software engineering. The process begins when a software team establishes requirements for the system to be built using conventional requirements elicitation techniques. An architectural design is established, but rather than moving immediately into more detailed design tasks, the team examines requirements to developing the software we look for composing it by predefined software components.
 
So the team asks the following questions for each system requirement :

1.  Are commercial off-the-shelf (COTS) components available to implement the requirement?
2. Are internally developed reusable components available to implement the requirement?
3. Are the interfaces for available components compatible within the architecture of the system to be built?

  After these question answered the team attempts to modify or remove those system requirements that cannot be implemented with COTS or in-house components. If the requirement(s) cannot be changed or deleted, conventional or object-oriented software engineering methods are applied to develop those new components that must be engineered to meet the requirement(s). But for those requirements that are addressed with available components, a different set of software engineering activities commences which are analysed under Component-Based Computing.

Saturday 20 October 2012

Make a Shadow effect in Your text using CSS3

Shadow Effect in Text Using CSS3 Style Code..

This is simple text transformation code using CSS3 to give a shadowy effect to any text.......
Code can be used in making effective headings in any webpage to make it effective & self appealing, just copy and paste the code to your page to produce the effect...

  1.   <html>
  2.   <head>
  3.     <style>
  4.       #demo {
  5.         font-weight: normal;
  6.         background-color: #FFFFFF;
  7.         color: #666789;
  8.         font-size: 64px;
  9.         line-height: 140%;
  10.         text-shadow: 5px 5px 5px #333333;
  11.         column-count:2;
  12.         column-width:10px;
  13.         column-gap:0px
  14.       }
  15.     </style>
  16.   
  17.   
  18.   </head>
  19.   <body>
  20.     <p id="demo">Ashwin Semwal @$#baba</h2>
  21.   </body>
  22. </html>


Note: Change the above "Text-shadow:" value to reduce or increase the effect, last value represents the color of shadow..... ; ) enjoy
\

Output:----



Tuesday 16 October 2012

IP Multicasting (Part- 1 Theoretical)

Multicast is communication between a single sender and multiple receivers on a network. or It is a technique to send a single message to multiple user using a single address (known as multicast address).Simple examples for Multicasting are sending an e-mail message to a mailing list,Teleconferencing ,videoconferencing or watching a video on YouTube.



What Is Multicast?

       Multicast is a technology used to address multiple hosts as a group. A host multicasts to a group of hosts by sending an IP packet to a special IP address that identifies the group. An IP address is used to designate a group of hosts. The IP address that defines a multicast group is in the range of 224.0.0.0 to 239.255.255.255, defined as Class D addresses. Each group has its specific IP address in that range, so many groups can be defined at the same time by using a different IP address.The membership in a group is dynamic because hosts can join and leave the group as they want.

Broadcasting Vs Multicasting :

Multicast differs from broadcast because broadcasting involves sending a packet to all hosts, without exception, on the specified network, whereas multicast sends a packet to the group of hosts. Those hosts that are not part of the group will not process the multicast packet since it is not addressed to them.


Joining the Group :

To join a multicast group either by a user who wants to listen to a multimedia channel or by a specific application, it is actually very simple: the kernel has to be configured to process the IP multicast address of the group or channel. Then, all packets with an IP destination address as the group IP multicast address will be processed by the host and sent to the upper layer applications.


IGMP ??

   But, if the multicast channel comes from far away (meaning that it comes from another network), it is possible that this channel is not currently multicasted on the local network of the host. In this case, the host will have to tell its neighbor router that it wants to listen to this multicast channel. This is done using the Internet Group Management Protocol (IGMP). Then this router will try to get that channel from its source and send the multicast packets of that channel to the local network. This entire process involves routing multicast over the larger network.
       When a host joins a multicast group, it sends a report to the all-hosts group (224.0.0.1) on its local network. Routers can then learn who is joining which group. When a host is leaving a multicast group, it sends a report to the all-routers group (224.0.0.2) on its local network. Routers also send queries periodically to an all-hosts group address to request reports of group membership to all hosts on each multicast network to which it connects. In this way, a multicast router knows the membership of all groups for all multicast hosts.

Multicast Routing Protocols ??

Since multicast needs special processing for routers, the IETF defines multicast routing protocols to help routers control the routing of those multicast channels over the networks. The first one was Distance Vector Multicast Routing Protocol (DVMRP), which has been used a lot; however, the RFC (RFC1075) now has experimental status, which means that its implementation is not recommended. This multicast routing protocol was based on the Routing Information Protocol (RIP), and inherits its simplicity. Other protocols have been developed for multicast routing, like the Protocol Independent Multicast (PIM) protocol and Multicast extensions to OSPF (MOSPF).

Why Multicast ?

The first and most well-known use of multicast is to save bandwidth when casting a video conference to a number of users. But multicast can do more.

Efficiency of Bandwidth Usage and Scaling
         Multicast has been used since the beginning to save bandwidth, especially for any content that is for many users, for example, audio and video. Other examples are net news sent to many servers and software upgrades for a whole network sent to all hosts. All these examples save bandwidth by sending only one copy of the content whatever the number of clients, instead of one copy per client in the standard unicast way.

Discovering
         Many discussions on IP are related to making it easier and autoconfigurable, and enabling devices to discover “automatically” servers, services, and the like. Examples of this are wireless and small devices that do not have permanent memory, and have to discover where they are, who they are, and which services are available. Multicast is very interesting, because hosts that need to discover things can multicast their request on specific channels in order to get more information from listening servers. This is actually being implemented in the Service Location Protocol (SLP). IPv6 uses multicast to get this autoconfiguration working.

Efficient Channel
Without multicast, the only way to send a packet to computers that have the same characteristics (like running a specific protocol) or are routers, was either to know the addresses of them, which is a very difficult task when the number is important, or to use broadcast. If broadcasts were used for all those purposes, then all computers would have to process those packets, even if the packet is not for them. Not only that, but broadcast is limited to the link-local, where multicast can be used over multiple networks. So multicast is an easy way to send information to unknown parties that share the same characteristics without disturbing others.


Sunday 14 October 2012

Html5 CSS3 : Simple Inset Making By CSS3

  
This is a simple HTML code with CSS3 to make simple inset design Which can be use in any web page for designing headlines, Simple Logos & other Text Designing ..........

 


The Code :

  1.    <html>
  2.   <head>
  3.     <style>
  4.       div {
  5.         width: 550px;
  6.         height: 150px;
  7.         background: -moz-linear-gradient(0deg, lightgray, gray);
  8.         background: -webkit-gradient(linear, left top, left bottom, from
  9. (lightgray), to(gray));
  10.       }
  11.       h1 {
  12.         padding-left: 50px; 
  13.         padding-top: 17px;
  14.         font-family: Georgia, "Times New Roman", Times, serif;
  15.         font-size: 50px;
  16.         color: #666;
  17.         text-shadow: rgba(0,0,0,0.5) -1px 0, rgba(0,0,0,0.3) 0 -1px, rgba
  18. (255,255,255,0.5) 0 1px, rgba(0,0,0,0.3) -1px -2px;
  19.       }
  20.     </style>
  21.   </head>
  22.   <body>
  23.     <div>
  24.       <h1>Ashwin Semwal @$#Baba</h1>
  25.     </div>
  26.   </body>
  27. </html>


               

Thursday 11 October 2012

How to Generate Random String with PHP Function ,


Generation of a random number from a simple PHP function :

This is a simple code snippet for randomly generate String containing  alphabets & numbers in PHP.

This function can be used anywhere in between the script where you want to generate a random string...





function rand_string($l){ $s= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; srand((double)microtime()*1000000); for($i=0; $i<$l; $i++) { $rand.= $s[rand()%strlen($s)]; } return $rand; }

Monday 8 October 2012

IP version -06 (IPv6) Specifications


IPv6 Headers Fields

This post will provides a more detailed overview of IPv6 packet headers. In the first part, the basic IPv6 header will be described, and in the following sections, extension headers will be presented. (Extension headers are additional headers that can be present in the IPv6 packet.)



IPV6 Header 



IPv6 Headers Fields :

Version

The 4-bit Version field contains the number 6. This field is the same size as the IPv4 version field that contains the number 4. Nevertheless, the use of this field is limited because IPv4 and IPv6 packets are not distinguished on the basis of the value contained in it, but as a function of a different protocol type present in the layer 2 envelope (for example, Ethernet or PPP).


Priority or Traffic Class

The 4-bit Priority field in the IPv6 header can assume 16 different values.

Friday 5 October 2012

TOP 10 –SECURITY RISKS





TOP 10 –SECURITY RISKS 
 Top 10 security risks Rank-wise.......10 to 1....:

FIRE => Rank : 10

THIS IS A SURPRISE ENTRANT! SEVERAL COMPANIES ARE RATING THIS AS A CRITICAL RISK

We did not expect this to be here; it is not the lack of equipment but the lack of procedures that brings this risk to the top 10.
• Heat-generating equipments such as copiers, work processors, coffee makers and hot plates should be kept away from anything that might catch fire.
• Combustible materials such as paper should be stored properly. They should not be stacked up.
• Sprinklers and fire/smoke detectors should be installed in storage areas.
• Storage areas should be located away from heat sources.
• Electricity outlets should not be overloaded. The best way is to assure a sufficient number of outlets.


UNAUTHORIZED PHYSICAL ACCESS => Rank : 9

Thursday 4 October 2012

UML Diagram Examples....





UML Diagrams  Examples (Only)


1 . Use Case Model For Hospital Management System System:-
 


 2. Class Diagrams For Hospital System :





3.  Sequence Diagram for hospital management:



4. Collaboration Diagram :

                                    

Wednesday 3 October 2012

Mobile TCP : Problem & Solutions

Mobile TCP :

The Problem with TCP

TCP is a connection-oriented transport layer protocol that provides reliable, in-order delivery of data to the TCP receiver. Since mobile hosts will expect the same services that are offered to fixed hosts, it is necessary to implement TCP for the mobile domain. If we use TCP without any modifcation in mobile networks, we experience a serious drop in the throughput of the connection. There are several reasons for such a drastic drop in TCP throughput and in this section we examine these reasons in some detail.

1. The Effect of a High Bit Error Rate (BER)

It has been suggested that the wireless link suffers from a high bit error rate. While this may be true in some cases, recent studies indicate that the bit error may be no worse which can be reduced by one or two orders
of magnitude by the use of appropriate FEC (Forward Error Correcting) codes and retransmission schemes at the link layer, However the wireless link is susceptible to inordinately high bit error rates.
Bit errors cause packets to get corrupted which result in lost TCP data segments or acknowledgements. When acknowledgements do not arrive at the TCP sender within a short amount of time, (the retransmit timeout or RTO which is a multiple of half a second), the sender retransmits the segment, exponentially backs off its retransmit timer for the next retransmission, and closes its congestion window to one segment. Repeated errors will ensure that the congestion window at the sender remains small resulting in low throughput. It is important to note that FEC may be used to combat high BER, but it will waste valuable wireless bandwidth when correction is not necessary.

2. The Effect of Disconnections

Sunday 30 September 2012

Introduction to Class Diagram with Examples


                                                   The UML Class Diagrams

       A class diagram describes the types of objects in the system and the various kinds of static relationships that exist among them. It is a graphical representation of a static view on declarative static elements and a central modeling technique that runs through nearly all object-oriented methods. The richest notation in UML.
We Discuss here :-

Essential Elements:

1. Classes

2. Attributes

3. Operations

4. Relationships
              –Associations
              –Generalization
              –Dependency
              –Realization

5. Examples of Class Diagram for 
          - Library management system
          - Hospital System


Saturday 29 September 2012

Introduction to Mobile IP



Introduction to Mobile IP


IP version 4 assumes that a node’s IP address uniquely identifies its physical attachment to the Internet. Therefore, when a corespondent host (CH) tries to send a packet to a mobile node (MN), that packet is routed to the MN’s home network, independently of the current attachment of that MN (this is because CHs do not have any knowledge of mobility). 

When the MN is on its home network, and a CH sends packets to the mobile node, the Mobile Node obtains those packets and answers them as a normal host (this is one important requirement in Mobile IP), but if the MN is away from its home network, it needs an agent to work on behalf of it. That agent is called Home Agent (HA). This agent must be able to communicate with the MN all the time that it is “on-line”, independently of the current position of the MN. So, HA must know where the physical location of the MN is. 

Wednesday 26 September 2012

The Reason for PHP 6.0.0 Delay..



The development of PHP 6 has been delayed because the developers have decided the current approach to handling of instance Unicode is not a good one, and are considering alternate ways in the next version of PHP. The updates that were intended for PHP 6 were added to PHP 5.3.0 (namespace support, late static bindings, lambda functions, closures, goto) and 5.4.0 (traits, closure rebinding) instead.

Reasons for Delays to PHP 6

The reasons for the delay to PHP 6 appear to be: