Posts which you will also like.

Saturday, September 29, 2012

BackTrack 5 R3 Unleashed



Great news for our hacker friends a new version of popular penetration testing tool BackTrack 5 R3 is released.
BackTrack 5 R3 will provide latest hacking tools and more stable penetration testing environment than its predecessor.BackTrack 5 R3 is built upon linux kernal 3.2.6 which has updated version of hacking tools and latest securities patches.

bt5-6

BackTrack main website has a nice tutorial on how to upgrade from BackTrack 5 R1 to BackTrack 5 R3.If you want to upgrade your BackTrack to latest one the you can do it from this link.
If you are new to BackTrack then you can download the latest BackTrack from here.
Read More ->>

Monday, September 24, 2012

Apple got $1 billion in 30 trucks full of 5 cents coins by Samsung !



After loosing the legal battle with Apple finally Samsung decided to pay the $ 1 billion fine charged by Apple for the infringement of the patents.Tim Cook(Apple’s CEO) got a call from Samsung CEO explaining that Samsung will pay $1 billion fine and perhaps he must have been eagerly waiting for that huge amount of money.


And finally they got the money with surprise.Money arrived in fully loaded 30 trucks filled with 5 cents coin Smile. When the trucks arrived at Apple’s office security personnel stopped the trucks on the gate assuming that trucks arrived at the wrong place but soon Tim cook got a call from Samsung CEO that this is your money and since the legal suit did not specify a single payment method so Samsung is entitled to pay the fine in this way.

SamsungVs apple
A total of 20 billion coins is a new headache to Apple executives as they will need to put in long hours counting all that huge sum of money, to check if it is really $ 1 billion or not.But problem further continues if suppose it is $ 1 billion then they may face problem in depositing that 20 billion 5 cents coins to a bank.


sam

Lee Kun-hee, Chairman of Samsung Electronics, told the media that Apple can use the coins to buy the refreshments at the little machine for life or melt the coins to make computers, that’s not their problem, Samsung already paid them and it is fulfilled by the law.
But Some sources says that this news is fake and this incident did not happen.People just spread the rumours nothing of this sort has happened.Let’s wait for more Winking smile.
Read More ->>

Saturday, September 22, 2012

Java Tutorial on GridBagLayout Manager


In this java tutorial we are going to discuss about GridBagLayout Manager.
GridBagLayout manager is one of the most powerful but complex layout manager in java.It is somewhat similar to GridLayout in the sense that it also arranged the components in the grid, but here component added can be of varying sizes i.e we can increase or decrease their size to occupy more than one row or column of the grid.
If suppose you are going to use this layout manager in your program then you first decide and draw the outline of GUI you need then proceed further.Life will be much easier(Really).
Most important parts of the GridBagLayout are GridBagConstraints .They specify the size and position, and many more constraints  of the each component. We will discuss about each GridBagConstraints fields.

gridx The column in which the component will be placed
gridy The row in which the component will be placed.
gridwidth The no of column the component occupies.
gridheight The no of rows the component occupies.
weightx The amount of extra space to allocate horizontally. The grid
slot can become wider when extra space is available.
weighty The amount of extra space to allocate vertically. The grid slot
can become taller when extra space is available.
anchor When component added is smaller than its area then we can use anchor to specify its position.Possible positions are NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST,
NORTHWEST or CENTER
fill This basically tell how to resize the component when container area is bigger than it’s size.
We can have a single “GridBagConstraints” instance which is used for specifying the constraints of all the components or seperate “GridBagConstraints” for each of them.
But it is recommended to use seperate “GridBagConstraints” for each of the component added to the container using GridBagLayout Manager.
Now we will use the GridBagLayout in our sample program:


package com.techy.rajeev;

import java.awt.EventQueue;

public class GridBagLayoutTest {

    private JFrame frmTechyrajeev;
    private JTextField textField;
    private JTextField textField_1;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    GridBagLayoutTest window = new GridBagLayoutTest();
                    window.frmTechyrajeev.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public GridBagLayoutTest() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frmTechyrajeev = new JFrame();
        frmTechyrajeev.setTitle("techyrajeev");
        GridBagLayout gridBagLayout = new GridBagLayout();
        gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
        gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
        gridBagLayout.columnWeights = new double[]{1.0, 0.0, 1.0, 1.0, 0.0,
 Double.MIN_VALUE};
        gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
 Double.MIN_VALUE};
        frmTechyrajeev.getContentPane().setLayout(gridBagLayout);
        
        JLabel lblLoginForm = new JLabel("Login Form");
        GridBagConstraints gbc_lblLoginForm = new GridBagConstraints();
        gbc_lblLoginForm.insets = new Insets(5, 0, 5, 5);
        gbc_lblLoginForm.gridx = 2;
        gbc_lblLoginForm.gridy = 0;
        frmTechyrajeev.getContentPane().add(lblLoginForm, gbc_lblLoginForm);
        
        JLabel lblEnterUsername = new JLabel("Username:");
        GridBagConstraints gbc_lblEnterUsername = new GridBagConstraints();
        gbc_lblEnterUsername.anchor = GridBagConstraints.EAST;
        gbc_lblEnterUsername.insets = new Insets(0, 0, 5, 5);
        gbc_lblEnterUsername.gridx = 1;
        gbc_lblEnterUsername.gridy = 1;
        frmTechyrajeev.getContentPane().add(lblEnterUsername, gbc_lblEnterUsername);
        
        textField = new JTextField();
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.insets = new Insets(0, 0, 5, 5);
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = 2;
        gbc_textField.gridy = 1;
        frmTechyrajeev.getContentPane().add(textField, gbc_textField);
        textField.setColumns(10);
        
        JLabel label = new JLabel("");
        GridBagConstraints gbc_label = new GridBagConstraints();
        gbc_label.insets = new Insets(0, 0, 5, 5);
        gbc_label.gridx = 1;
        gbc_label.gridy = 2;
        frmTechyrajeev.getContentPane().add(label, gbc_label);
        
        JLabel lblPassword = new JLabel("Password:");
        GridBagConstraints gbc_lblPassword = new GridBagConstraints();
        gbc_lblPassword.anchor = GridBagConstraints.EAST;
        gbc_lblPassword.insets = new Insets(0, 0, 5, 5);
        gbc_lblPassword.gridx = 1;
        gbc_lblPassword.gridy = 3;
        frmTechyrajeev.getContentPane().add(lblPassword, gbc_lblPassword);
        
        textField_1 = new JTextField();
        GridBagConstraints gbc_textField_1 = new GridBagConstraints();
        gbc_textField_1.insets = new Insets(0, 0, 5, 5);
        gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField_1.gridx = 2;
        gbc_textField_1.gridy = 3;
        frmTechyrajeev.getContentPane().add(textField_1, gbc_textField_1);
        textField_1.setColumns(10);
        
        JButton btnLogin = new JButton("Login");
        GridBagConstraints gbc_btnLogin = new GridBagConstraints();
        gbc_btnLogin.insets = new Insets(0, 0, 5, 5);
        gbc_btnLogin.gridx = 2;
        gbc_btnLogin.gridy = 4;
        frmTechyrajeev.getContentPane().add(btnLogin, gbc_btnLogin);
        
        JTextArea txtrThisIsA = new JTextArea();
        txtrThisIsA.setText("This is a text area.");
        GridBagConstraints gbc_txtrThisIsA = new GridBagConstraints();
        gbc_txtrThisIsA.gridwidth = 5;
        gbc_txtrThisIsA.fill = GridBagConstraints.BOTH;
        gbc_txtrThisIsA.gridx = 0;
        gbc_txtrThisIsA.gridy = 6;
        frmTechyrajeev.getContentPane().add(txtrThisIsA, gbc_txtrThisIsA);
    }

}


GridBagLayout2


This is the grid view of rows and columns of the frame.As you can see it is very easy to divide the whole Gui into rows and columns on the paper and then proceed accordingly for the actual designing using GridBagLayout Manager.


Output of this GridBagLayout tutorial program is:


gridBagLayout
Read More ->>

Thursday, September 13, 2012

Java Tutorial on Anonymous Inner Class


An anonymous inner class is a very strange type of inner class.It can be created on the fly when needed and It can also be defined inside method argument!.
We will cover all the details about anonymous inner class in this blog post so continue reading.
As the name suggests anonymous inner classes do not have any name so how would you recognize a inner class? Anonymous inner classes are recognized by their parent’s type.Here parent could be either a class or interface.Basically anonymous inner class can be categorized into two types:
  • As a class providing implementation to a predefined interface.
  • As a class providing implementation to a predefined class or a abstract class
Now we will see both methods
Pointing up
class Test{
            public void doTesting(){
              System.out.println("Testing is on the way!");
             }
            }
public class InnerJ{
    Test t=new Test(){
            public void doTesting(){
                System.out.println("Testing completed!");
            }
        };//watch out for semicolon
}



Here what we are saying basically  is,that create a anonymous class(without any name) which is a subclass of type Test(extends Test) and declare a reference variable of type Test to hold that anonymous class object since at the same time we are instantiating that anonymous inner class(see the new key word in InnerJ).


Fingers crossed



//Now same thing with interface 
interface Test{ 
            void doTesting(); 
            } 
public class InnerJ{

//Beware this not instantiation of interface ! 
    Test t=new Test(){ 
            public void doTesting(){ 
                System.out.println("Testing completed!"); 
            } 
        };//watch out for semicolon 
}


here instead of saying extends we say implements and every thing is same.


Restrictions on anonymous inner class:



  • Anonymous inner classes can implement only one interface


  • Anonymous inner classes can either extends a class or implement an interface at a time

Read More ->>
DMCA.com Protected by Copyscape Online Plagiarism Tool