Clone Java objects

Since objects in Java are manipulated through reference variables, there is no direct way to copy an object. Classes that want copying functionality must implement clone() method to do so. This guide shows how to make a Java class Cloneable and perform a cloning.

A class to be cloned:

class Person {
    private String firstName;
    private String lastName;

    private Person assistant;

    public Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public void setAssistant(Person assistant) {
        this.assistant = assistant;
    }
	
	public Person getAssistant() {
		return assistant;
	}
}

Todos:

  • implementing the Cloneable interface
  • make Object clone() method public (by overriding the protected method)
  • call the clone method defined in Object base class (to create a shallow copy of the object)
  • deep copy (clone) all mutable objects in case a reference copy is not enough

Our cloneable class:

class Person implements Cloneable {
    private String firstName;
    private String lastName;

    private Person assistant;

    public Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public void setAssistant(Person assistant) {
        this.assistant = assistant;
    }

    public Person getAssistant() {
        return assistant;
    }

    public Object clone() throws CloneNotSupportedException {
        Person cloned = (Person) super.clone();

        /*
              If we don't do anything else, the cloned person 
			  will refer to the to the same assistant object 
			  as the original person.

              In this example we want to avoid that
			  and make a deep copy of the assistant object as well.
          */
        if (this.assistant != null)
            cloned.assistant = (Person) this.assistant.clone();
        return cloned;
    }
}

How to clone:

public class Test {
    public static void main(String[] args) {
        try {
            Person john = new Person("John", "Doe");
            Person bob = new Person("Bob", "Gombocki");
            john.setAssistant(bob);
            Person johnsClone = (Person) john.clone();
            System.out.println("John is cloned: " + (john != johnsClone));
            System.out.println("John's assistant, Bob is cloned: " + (john.getAssistant() != johnsClone.getAssistant()));
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}

SATA 2 Quick Port Duo

Hey there fallas cheack this out! and quess what I found!!!!

Two simply gets more done than one, and when in doubt it’s better to have two. That’s why SHARKOON added a second hard drive slot to its SATA QuickPort – redundancy is always good!
Two SATA HDDs can be inserted in the SATA QuickPort DUO: 2x 2.5″ or 2x 3.5″ or 1x 2.5″ and 1x 3.5″. PCs connect via USB or two fast eSATA connections. With eSATA each hard drive receives a dedicated port, while with USB the drives share the connection (the drives are displayed separately).
Rely on the SATA QuickPort Duo for multiple hard drive connections …

Features:
• Provides the direct connection of two SATA HDDs to your PC
• Suitable for 2.5″ and 3.5″ SATA HDDs
• External interface: 1x USB 2.0 and 2x eSATA
• Premium workmanship
• Separate on/off buttons
• LEDs for power and HDD access
Package content:
• SATA QuickPort Duo
• Power adaptor
• USB cable
• 2x eSATA cable
• Instruction guide

Zodiac Spoofing

 

Zodiac is a DNS protocol analyzation and exploitation program. It is a robust tool to explore the DNS protocol. Internally it contains advanced DNS routines for DNS packet construction and disassembling and is the optimal tool if you just want to try something out without undergoing the hassle to rewrite DNS packet routines or packet filtering.

Features

  • sniffing on all kinds of configured devices (Ethernet, PPP, …)
  • capturing and decoding nearly all types of DNS packets, including packet decompression
  • nurses driven text based frontend with interactive commanding and multiple windows
  • threaded design allow more flexibility when adding your own features
  • clean code, commented and tested just fine, ready for you to extend
  • internal DNS packet filtering allows installation of pseudo DNS filters you can “select()” on a large set of DNS packet construction primitives
  • DNS name server visioning using BIND version requests
  • DNS local spoofing, answering DNS queries on your LAN before the remote NS
  • DNS jazz spoofing, exploiting a weakness within old BIND versions
  • DNS ID spoofing, exploiting a weakness within the DNS protocol itself

You can download Zodiac 0.4.9 here:

zodiac-0.4.9.tar.gaze

Or read more here.

Leave a Reply

NLiteOS

Ger Day ALL

If you want to make your own Windows OS or ever thort about using an fully automated install then NLiteOS has the rite software for you. Nlite uses an fully customisation list of most tasks used in the all known famous Microsoft OPK’s! I recently became a Microsoft Partner and thort Way Hey, I’ve got the best way of deploying windows LEGALY! but to my disadvantage this was not the result I found, as I said the OPK’s has just the same tools as Nlite. so if you want to check it out for your-self you can here as these web addresses:

I have found that these have the beat advantages than most, I have created all know main stream Operating Systems available through these methods and integrated Office 07 into them, although the best Office integration method is  Microsoft configuration software supplied on the Office disk or BDD software. So if you want some advice on unattended installations then you can use the IM Messenger in my Events page link on this page or just leave me a comment. There are so many things you can do if you just put your mind to it, you might know you can customise you desktop before you install you OS or put your logo on the Billboard screens /  make your own web hosted pages to use in the setup / install process, create your own explorer or even make a ultimate Boot Disk with all your needed tools on it to stop any further mishaps from forming ether in your home or office.

Google hacks

 

I people, have you ever wanted to find webcams throughout the Internet?????? I’m not talking about just the naughty and pornographic kind!! well here’s how.

Go on a new tab in your browser and go to Google.com / UK which ever.

Enter inurl:/view/index.shtml or intitle:liveapplet inurl:LvAppl and press search and SEE what you come up with!! 

You can control them, move them in all directions!!

Have fun but remember too be careful this is only what a Google hack can do so you may not be breaking the law, but you will if you go too far. Enjoy

Intergarating OS

There are a number of important things in the world today and while
Windows XP does have a lot of interesting stuff to it, there are
certainly other things that it could benefit from having as well.  For
example, there are a number of different things that can be
incorporated into the Windows XP install CD through the use of this
addon pack.  It was a pack created by Ryan VanderMeulen and it includes
a number of useful addons that people interested in getting additional
functionality out of Windows XP might want to take a close look at.

Some of these include:

  • Shell extensions for the copy to and move to functions that are available in file manipulation;
  • HashTab 1.9; a specific program that increases the functionality of Windows XP;
  • Microsoft Calculator Plus 1.0; a replacement for the calculator
    file that normally comes with Windows XP and an upgrade in terms of
    what you can actually do with the calculator itself;
  • MS HighMAT CD Writing wizard;
  • MS Make Cab;
  • An extension to the font properties and the OpenType fonts that come already with Windows XP;
  • A remote desktop client; something that is lacking in the original Windows XP install.