Posts

Showing posts with the label Java

Steps for installation of fonts on Windows 2008 Server and Tomcat Application Sever.

Image
Windows 2008 Server 1.        Look for the folder named “Fonts” in your windows folder. Most probable it will be “ C:\Windows\Fonts\ ”. Fonts folder can also be find using by running the command “ %windir%/fonts ”. 2.        Copy the required font in the above mention “Fonts” folder. Tomcat Application Sever 1.        Copy the required fonts on tomcat’s JRE inside {JRE_HOME}/lib/fonts/. Step for finding Tomcat JRE Path 1.        Go to the apache home directory (Apache Software Foundation\Tomcat 6.0\logs\service-install.log). it’s can also be find search this file service-install.log in c drive. 2.        Then open the file and check jvm path just like (bin\Tomcat5.exe" --Jvm " C:\Program Files\Java\jre7\ bin\client\jvm.dll"). this is your java home directory “ C:\Program Files\Java\jre7\ ” 3.        Find pat...

Fetchinng Facebook Friend List Running Example Using Javascript Sdk

Only replace your Api Id from YourApiIdHere and fetch friend information acording to requirement <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>   <head>     <base href="<%=basePath%>">         <title> 'FbFriends'</title>         <script src="http://connect.facebook.net/en_US/all.js"></script>         <script src="http://code.jquery.com/jquery-latest.js"></script>         <!--<link rel="stylesheet" type="text/css" href="styles.css">-->   </head>     <body>      <div i...

Post on Friend's Wall without Facebook Pop up using Javascript Sdk.

function PostOnFriendsWall() {         var access_token=document.getElementById("access_token").value;         var sendername=document.getElementById("sendername").value;         status1 = document.getElementById('message').value;         var facebookid = document.getElementsByName("facebookid");                       FB.api(         {             method: 'stream.publish',             message: status1,             target_id: facebookid,             access_token:access_token,             attachment: {         ...

Wall Post on Your Facebook Wall using Javascript Sdk

unction postOnSenderWallForMoneyGift() {     var FriendsName = document.getElementsByName("FriendsName");     var access_token=document.getElementById("access_token").value;               for (i = 0; i< FriendsName.length; i++)     {          recipient = FriendsName[i].value;         FB.api(         {             method: 'stream.publish',             access_token:access_token,             attachment: {             name: '' Your Message Here by'+sendername+' via Javascript Sdk .',             caption: ' Your Caption Here ',         ...

Explain the difference between abstract class and interfaces with an example for each.

Explain the difference between abstract class and interfaces with an example for each. The differences between abstract class and interface are as follows: Abstract Class Interface Can have abstract methods and concrete methods Can have only method signatures and static final members All methods are not by default public All methods by default abstract and public An abstract class can extend another abstract class An interface can extend another interface but not a class The extended class can override the methods of its super class and its hierarchy An implementing class can implement multiple interfaces All abstract methods must have abstract access modifier All methods in an interface must not have abstract access modifier The following examples illustrate the differences: abstract class Shape {        abstract void area();        abstract void perimeter();   ...

Hello world in eclipse Or How to create class file in eclipse

Image
Right click on the source folder then select new, then click class then next popup will be show. Type package name just like com.swain.cell.java.example. Type class name just like Hello(Class name should be stating with capital letter). Then finish.   // amazon ebay shopbob.com hotels.com canon newegg.com  Hello .java package com.swain.cell.java.example; public class Hello {        /**         * @param args         */        public static void main(String[] args) {               // TODO Auto-generated method stub               System. out .println( "hello world" );        } } Right click on the programme then popup will be show then select run as then java Application. Output Hello wo...

How to create java project in eclipse

Image
Select file menu then select new then select project then another popup will be show.   // amazon ebay shopbob.com hotels.com canon newegg.com  Type project name then click finish. This is a java project folder structure.

String palindrome

Output: StringPalindrome .java package com.swain.cell; public class StringPalindrome {        public static void main(String args[])           {              String original= "Himanshu" ;              String rev= "" ;                                     int length = original.length();                       for ( int i = length - 1 ; i >= 0 ; i-- )                 rev = rev + original.charAt(i);                    ...

how to count selected Character from a sentence in java

Output: C contents  3 times. DuplicateCharacter.java package com.swain.cell; import java.util.HashMap; public class DuplicateCharacter {        /**         * @param args         */        public static void main(String[] args) {               // TODO Auto-generated method stub         String str = "Character duplicate word example java" ;         char selectedchar= 'C' ;         char ch1[]=str.toUpperCase().toCharArray();         HashMap<Character,Integer> hm= new HashMap<Character,Integer>();         for ( int i=0; i<ch1. length ; i++)         {   ...

how to count selected word in string using java

Output: java contents  3 times. package com.swain.cell; import java.util.HashMap; import java.util.StringTokenizer; public class DuplicateString {        /**         * @param args         */        public static void main(String[] args) {               // TODO Auto-generated method stub         String str = "java java android android java example" ;         String selectedword= "java" ;                  StringTokenizer t = new StringTokenizer(str);         HashMap<String,Integer> hms= new HashMap<String,Integer>();              ...