Thứ Tư, 20 tháng 8, 2014

Changing "CSS" styles using "JAVASCRIPT"

It's very simple to change css styles using javascript.First you need to get object of DOM i'e you need to have a document object element,Finally change document element style using document.style."cssproprty"

example;

am just taken a sample text ,i changes the color of text into red by using css property color='red'.


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Changing Style</title>
<script type="text/javascript">
function data()
{
document.getElementById('content').style.color='red';
}
</script>
</head>
<body onload="data()">
<center><i id="content">This information is accessed via javascript</i></center>

</body>
</html>
output
===========


Single Linked List Program in "C"

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct link
{
  int data;
  struct link *ptr;
}*head=NULL;

void insert()
{
  char point;
  do
  {
    struct link *newlink,*currentlink;
    newlink=(struct link*)malloc(sizeof(struct link));
    printf("\nEnter data into linked list");
    scanf("%d",&newlink->data);
    newlink->ptr=NULL;
    if(head==NULL)
    {
      head=newlink;
      currentlink=newlink;
    }
    else
    {
      currentlink->ptr=newlink;
      currentlink=newlink;
    }
    printf("\nDo you want to continue?");
    point=getche();

  }while(point!='n');

}
void display()
{
  struct link *iterator;
  iterator=head;
  printf("\n Data in your linked list is");
  while(iterator!=NULL)
  {
    printf("%d----->",iterator->data);
    iterator=iterator->ptr;
  }
  printf("NULL");
}
main()
{

  insert();
  display();
  return 0;

}

output
----------------------------------

Thứ Ba, 19 tháng 8, 2014

Applying Styles to child selectors in CSS


This Concept is very useful  if you ever tried to apply styles child elements of parent.

for example,lets have a program .I defined my text in <strong> element as  a single selector as well as a child selector of a <div> element.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Css demo</title>
<style type="text/css">
strong
{
background-image: url('images/back10.jpg');
font-size: 200%;
text-decoration: underline;
}
div > strong                                                                     / * child selector*/
{
font-size: 300%;
text-decoration: none;
color:yellow;
}

</style>
</head>
<body>

<center><strong>this is a data taken as an example</strong></center>
<br>
<br>

<div>
<strong>this text defined  in a division tag ,which is called as a parent to this element </strong>
</div>
</body>
</html>



 output:


Thứ Hai, 18 tháng 8, 2014

java code to find similar words in "AMITABH BACHCHAN" and "RAJNIKANTH"


import java.lang.*;
public class similar
{

static void find(String s1,String s2)
{
    StringBuffer buf1 = new StringBuffer(s1);
    StringBuffer buf2 = new StringBuffer(s2);
    int count=0;
    int l=0,q=0;
    int[] arr=new int[30];
    int[] arr1=new int[30];//required minimum size 26
    for(char j='A';j<='Z';j++)     
       
    {
        for(int i=0;i<buf1.length();i++)
        {
            if(buf1.charAt(i)==j) //compare the string1 indexes  with Alphabets
            {
                count++; //count similar alphabets
            }
    }
        arr[l]=count;
        count=0;
        l++;
    }   

    for(char j='A';j<='Z';j++)
    {
        for(int i=0;i<buf2.length();i++)
        {
            if(buf2.charAt(i)==j)//compare the string2 indexes  with Alphabets
            {
                count++; //count similar alphabets
            }
        }
        arr1[q]=count;
        count=0;
        q++;
    }
StringBuffer answer=new StringBuffer();
    count=0;
    int f=0;
    for(char ch='A';ch<='Z';ch++)
    {
        if(arr[f]!=0&&arr1[f]!=0)
        {
            count++;
            answer.append(ch);
        }
        f++;
    }
//print the common string
    System.out.println(answer);//Contain the string with common alphabets


    }
public static void main(String[] args)
{
String s1=new String("AMITABH BACHCHAN");
String s2=new String("RAJNIKANTH");
find(s1,s2);
}
}


output
AHINT


Accessing Private data of another class[Extreme logic program]

you all know very well java does'nt allow you to access private variables and methods outside the class.However ther is some loopholes in java "TO DO THIS".

consider a sample class:

private.java



public class privatedata {
    private void message()
    {
        System.out.print("This message was derived from private data");
    }
    private void message(String data)
    {
        System.out.print("your message is"+data);
    }

}

now am accessing private method from outside class "LETS ROCKZZZZ"

import java.lang.reflect.*;
public class accssingprivatedata {
    public static void main(String args[])
    {
        try
        {
            Class c=Class.forName("privatedata");
            Object obj=c.newInstance();
            Method m=c.getDeclaredMethod("message", null);
            m.setAccessible(true);
            m.invoke(obj, null);
        }
        catch (Exception e) {
            // TODO: handle exception
        }
       
    }

}




A simple java program to sort list of names of an array.

import java.util.Scanner;


public class namesort {
    public static void main(String []args)
    {
       
        Scanner sc =new Scanner(System.in);
        System.out.print("How many names you want to sort");
        int len=sc.nextInt();
        String names[]=new String[len];
        String temp=new String();   
        for(int i=0;i<len;i++)
        {

            System.out.print("enter "+i+"name");
            names[i]=sc.next();
           
        }
        //sorting data
        for(int outer=0;outer<names.length;outer++)
        {
            for(int inner=outer+1;inner<names.length;inner++)
            {
                if(names[outer].compareTo(names[inner])>0)
                {
                    temp=names[outer];
                    names[outer]=names[inner];
                    names[inner]=temp;
                }
               
            }
        }
        for(String s:names)
        {
            System.out.println(s);
        }
       
    }

}

Thứ Năm, 17 tháng 4, 2014

Rebtel Easter 2014 offer: Get ten times more credit (Pay 1 and get 10)


Get ten times more credit from Rebtel during this Easter holidays. You will pay 1 EUR/GBP/USD in your local currency and get ten times more credit. Rebtel is a reputed brand offering cheap international VoIP calling from your mobile using their android/iphone app or via access number.

Just as an indication, you will get 1250 minutes to India for just 1 GBP. This offer valid for new users only