Advertise Here

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - zilchuary

Pages: [1]
1
Advertise Your Board / Java Programming Community NOW OPEN!
« on: July 09, 2008, 12:41:49 pm »
Forum Url: http://javaclinic.smfforfree4.com
Well i have been a little busy with script writing ect on my new forums, thanks to smfforfree support forums for the help on making me learn a new language.

also i would like to say if any of you have a interest in Java programming please join my forums now.

www.javaclinic.smfforfree4.com

Thanks!

2
Java / Buffer overflow/load information [Learn]
« on: July 09, 2008, 12:35:04 pm »
Okay, i thought about this section of the forums, it is not really useful with the help, tutorials ect.
so i will post something helpful and hopefully it will help you all.

Step 1 Learning.
What is the Java buffer overflow/load?

A buffer overflow occurs when a program or process tries to store more data in a buffer (temporary data storage area) than it was intended to hold. Since buffers are created to contain a finite amount of data, the extra information - which has to go somewhere - can overflow into adjacent buffers, corrupting or overwriting the valid data held in them. Although it may occur accidentally through programming error, buffer overflow is an increasingly common type of security attack on data integrity. In buffer overflow attacks, the extra data may contain codes designed to trigger specific actions, in effect sending new instructions to the attacked computer that could, for example, damage the user's files, change data, or disclose confidential information. Buffer overflow attacks are said to have arisen because the C programming language supplied the framework, and poor programming practices supplied the vulnerability.

Step 2 Discoverer
Who/how did they discover the Java buffer overflow and when?
In July 2000, a vulnerability to buffer overflow attack was discovered in Microsoft Outlook and Outlook Express. A programming flaw made it possible for an attacker to compromise the integrity of the target computer by simply it sending an e-mail message. Unlike the typical e-mail virus, users could not protect themselves by not opening attached files; in fact, the user did not even have to open the message to enable the attack. The programs' message header mechanisms had a defect that made it possible for senders to overflow the area with extraneous data, which allowed them to execute whatever type of code they desired on the recipient's computers. Because the process was activated as soon as the recipient downloaded the message from the server, this type of buffer overflow attack was very difficult to defend. Microsoft has since created a patch to eliminate the vulnerability.

I hope i helped out.

3
Java / Cube .. number Ect
« on: January 04, 2008, 01:31:14 pm »
Code: [Select]
import java.util.Scanner;
import java.io.*;

public class Square
{
   public static float number;
   
   public static void main(String args[])
   {
      Scanner scan = new Scanner(System.in);
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Number = ");   
      number = Float.parseFloat(scan.nextLine());
      for(int i = 0; i <= 10; i++)
      {
         System.out.println(number + "^2 = " + java.lang.Math.pow(number,2));
      }   
   }
}

Code: [Select]
import java.util.Scanner;
import java.io.*;

public class SquareRoot
{
public static float number;

public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
System.out.print("Number = ");
number = Float.parseFloat(scan.nextLine());
System.out.println(java.lang.Math.pow(number, 1./3));
}
}

4
Java / Wana Update Whole GUI
« on: January 04, 2008, 01:28:46 pm »
Code: [Select]
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.swing.JButton
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

public class Updater implements ActionListener
{
public JFrame updateFrame;
public JPanel updatePanel;
public JButton updateButton;
public JProgressBar updateProgress;

public Updater()
{
updateFrame = new JFrame("Updater");
updatePanel = new JPanel(new BorderLayout());

updateButton = new JButton("Update");
updateButton.setActionCommand("Update");
updateButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
updateButton.addActionListener(this);
updateButton.setPreferredSize(new Dimension(150, 50));

updateProgress = new JProgressBar();
updateProgress.setStringPainted(true);
updateProgress.setString("Click update to update");
updateProgress.setPreferredSize(new Dimension(150, 50));
updateProgress.setMaximum(100);
updateProgress.setValue(0);

updatePanel.add(updateButton, BorderLayout.CENTER);
updatePanel.add(updateProgress, BorderLayout.SOUTH);

updateFrame.add(updatePanel);
updateFrame.pack();
updateFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
updateFrame.setVisible(true);
}

public static void main(String[] arg)
{
new Updater();
}

public void deleteFile(File aFile)
{
if(aFile.exists())
{
updateProgress.setString("Deleting jar");
aFile.delete();
}
}

public void actionPerformed(ActionEvent evt)
{
String c = evt.getActionCommand();
if(c.equals("Update"))
{
File jar = new File("runescape.jar");
deleteFile(jar);
try
{
updateProgress.setString("Connecting");
URLConnection jarUC;
jarUC = new URL("http://sl5.runescape.com/runescape.jar").openConnection();
DataInputStream down = new DataInputStream(jarUC.getInputStream());
updateProgress.setString("Creating data stream");
PrintStream out = new PrintStream(jar);
int length = jarUC.getContentLength();
updateProgress.setString("Downloading jar");
while(jar.length() < length)
{
out.write(down.read());
updateProgress.setValue((int)(jar.length()/length*100));
}
updateProgress.setString("Runescpe jar downloaded");
updateButton.setEnabled(false);
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}

}

For the Java Gurus on this forums
they will all now whats this does

... for other people who dont understand
.. it actually says it Update GUI
Thats all it does


There

5
Java / java multithreading ... Explaining
« on: January 04, 2008, 01:25:54 pm »
Let's say, for example, RunnableImpl is the class that implements Runnable.
This class defines the void run() method of course, which is the method that will be invoked in a seperate thread.


To launch a new Thread of RunnableImpl:


Code: [Select]
RunnableImpl impl = new RunnableImpl(); // Simply declaring a new instance of RunnableImpl
Thread t = new Thread(impl); // The Thread class takes either a Thread child or a Runnable implementation
t.start(); // This will fire RunnableImpl.run() in a seperate thread.

Note that run(); will not be reinvoked, if you want it to live past the first invocation you must put a while() loop in to prevent the code exiting run()

6
Java / Java Loop Explained
« on: January 04, 2008, 01:22:05 pm »
Code: [Select]
for ( i=1; i<6; i++ ) {
    System.out.println(i);
}

Well wouldnt you know
back to good old SMF Forums!


Lets begin

In this example, the loop starts with an initialization of the (int) variable i to the value 1. Each time the loop iteration starts, a the exit condition is evaluated (is i less than 6?) and if true, continues. When the loop iteration is complete, the incrementor code is executed (i++ means increment the variable i by one). The loop continues until the exit condition is met (when i is equal to or greater than 6), so the code block will be executed for i values of 1, 2, 3, 4, and 5.
The exit condition code can be more complex as needed because it is computed each time through the loop, so the condition can be based on variables which may change during the loop iteration. To run a code block on each value of an array, the loop condition could be i < array.length.
The incrementor code can also be more complex, essentially any valid Java code. Another simple example would be a decrementor using i-- which would subtract one from the variable i each time through the loop.


Pages: [1]