Friday, 26 April 2013

XML with CSS example(Styling your XML document)

Showing XML document with CSS

 Make Simple XML file and put css link refrence at top...(as shown in red) :
 
    <?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="collegexml.css"?>
<COLLEGE>
  <STUDENT>
    <NAME>ROHAN KANDWAL</NAME>
    <BRANCH>iNFORMATION TECHNOLOGY</BRANCH>
    <ROLLNO>800808122</ROLLNO>
    <YEAR>2008-12</YEAR>
    
  </STUDENT>

  <STUDENT>
    <NAME>SHRISTI BAGGA </NAME>
    <BRANCH>ELECTRONIC COMMUNICATION</BRANCH>
    <ROLLNO>800808122</ROLLNO>
    <YEAR>2009-13</YEAR>
    
  </STUDENT>

  <STUDENT>
    <NAME>SUNIL KUMAR</NAME>
    <BRANCH>COMPUTER SCIENCE</BRANCH>
    <ROLLNO>080800988</ROLLNO>
    <YEAR>2012-16</YEAR>
    
  </STUDENT>
  .
  .
  .
</COLLEGE>


Now your css file "collegexml.css":

COLLEGE
{
background-color: #66aacc;
width: 100%;
}
STUDENT
{
display: block;
margin-bottom: 50px;
margin-left: 13px;
}
NAME
{
color: #FF0060;
font-size:18pt;
}
BRANCH
{
color: #0070FF;
font-size: 16pt;
}
ROLLNO,YEAR
{
display: block;
color: #0865c0;
margin-left: 16pt;
}

output:

JDBC Sample Example

Simple JDBC (java Database connection) Example..

In this we are connecting to a database name "Students" and then retrieving value from a table "Registration" which exists with in the database :

import java.sql.*;

public class JDBCExample {
   // JDBC driver name and database URL
   String JDBC_DRIVER = "com.mysql.jdbc.Driver";  
   String DB_URL = "jdbc:mysql://localhost/STUDENTS";

   //  Database credentials
    String USER = "username";
   String PASS = "password";
   
   public static void main(String[] args) {
   Connection conn = null;
   Statement stmt = null;
   try{
      //STEP 2: Register JDBC driver
     
      Class.forName("com.mysql.jdbc.Driver");

      //STEP 3: Open a connection
      System.out.println("Connecting to a selected database...");
      conn = DriverManager.getConnection(DB_URL, USER, PASS);
      System.out.println("Connected database successfully...");
      
      //STEP 4: Execute a query
      System.out.println("Creating statement...");
      stmt = conn.createStatement();

      String sql = "SELECT id, first, last, age FROM Registration";
      ResultSet rs = stmt.executeQuery(sql);

      //STEP 5: Extract data from result set
      while(rs.next()){
         //Retrieve by column name
         int id  = rs.getInt("id");
         int age = rs.getInt("age");
         String first = rs.getString("first");
         String last = rs.getString("last");

         //Display values
         System.out.print("ID: " + id);
         System.out.print(", Age: " + age);
         System.out.print(", First: " + first);
         System.out.println(", Last: " + last);
      }
      rs.close();
      conn.close();
   }
catch(SQLException se){
      //Handle errors for JDBC
      se.printStackTrace();
     }

   }//end main 
}//end JDBCExample 

Friday, 1 March 2013

Channel Allocation Methodology in Mobile Computing.


Channel Allocation:

One of the critical issue in mobile computing is to provide efficient allocation of communication channel for the better performance of the wireless mobile system. The Channel allocation algorithms should be robust and scalable and some of the allocation methods are briefly described in this blog for learning purpose.

What is Channel Allocation??

Bluetooth Technology Architecture


Bluetooth
As you already know that Bluetooth is a wireless LAN technology designed to connect devices of different functions such as telephones, notebooks, computers (desktop and laptop), cameras, printers, coffee makers, and so on. Bluetooth makes its own spontaneous network whenever we need it i.e. Bluetooth is a kind of Ad-Hoc network. This network made by different devices is known as PICONET.


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:----