ObSys 56 Junior Poster

The one that Microsoft usually recomments is MalwareBytes Anti-Malware as can be found here

BigPaw commented: My favourite too. :-) +5
ObSys 56 Junior Poster

I always program my web apps in Notepad++. It's simple and it means you have to type all the code out yourself so helps you learn much faster. As for the whole "View your website" options in different software suites, don't trust them. If you have a quick poke around on the internet you'll find that each browser has some features that are browser specific. There are also browsers like IE which has different methods for different versions. It really is a bit of a mine field.

ObSys 56 Junior Poster

Ok the answer is check to see if the cell in the Array is null before trying to access if.

int[] anArray = new int[10];

for(int i=0; i < anArray.length; i++)
{
    if(anArray[i] != null)
    {
        System.out.println("Value: " + anArray[i]);
    }
}
ObSys 56 Junior Poster

Basically what you are doing is putting a piece of information into that method. In this case your putting a Person object into the hasDriver() method.

Now drive is how you reference the Person object. so if Person has a method in it called getName(), you would say `drive.getName()

A simple way to look at it for now is if you think of variables. e.g.

int number = 0 Here we create an 'Integer' which we call 'number' and we assign it a value of '0'

The same is true of Objects
Person drive = new Person(); says We want to go to the 'Person' class and we are going to call it 'Drive' and we want to make this into a 'new Person' object

Hope this clarifies your problem. If not then feel free to send me a message of reply right here on the thread

ObSys 56 Junior Poster

What data are you going to be using and how do you want it stored. It may be that you dont even need a database but can use one of Java's libraries to hold data at runtime and load it from a flat file on load.

ObSys 56 Junior Poster

If your interested in different css styles for different screens, I would recommend the CSS Tricks website. This is also a great website for loads of different web design tricks.

Hope you find it useful

ObSys 56 Junior Poster

Oops! the loadBlog() was from where i was messing around with it to see if I could get it to work. I've tried your way to the point of copying and pasting your code but still it won't work. I was thinking it may be my browser but I was under the impression that javascript is run natively.

If you have any ideas on any problems then let me know.

Thankyou

ObSys 56 Junior Poster

I am looking into blogging technology, specifically using XML files to hold blog posts and reading them into a webpage using Javascript. I have been looking at the w3schools website for bits of code but for some reason my application does not display the content on the screen. My code is as follows:

XML FILE

<?xml version="1.0" encoding="ISO-8859-1"?>

<blogPost>
    <title> Test </title>
    <text> this is a small tester</post>
    <author>William Ahmed</author>
    <date>16/03/93</date>
</blogPost>

<blogPost>
    <title> Test </title>
    <text> this is a small tester</post>
    <author>William Ahmed</author>
    <date>16/03/93</date>
</blogPost>

<blogPost>
    <title> Test </title>
    <text> this is a small tester</post>
    <author>William Ahmed</author>
    <date>16/03/93</date>
</blogPost>

<blogPost>
    <title> Test </title>
    <text> this is a small tester</post>
    <author>William Ahmed</author>
    <date>16/03/93</date>
</blogPost>

JAVASCRIPT

var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject()
{
    if(window.XMHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
    } 
    else
    {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    return xmlHttp;
}


function load()
{
    if(xmlHttp)
    {
    alert("loadBlog Init");
        try
        {
            xmlHttp.open("GET","blog.xml",true);
            xmlHttp.onreadystatechange=handleStateChange();
            xmlHttp.send(null);
        } 
        catch(e)
        {
            alert(e.toString());
        }
    }
}

function handleStateChange()
{
    alert("HandleStateChange");
    if(xmlHttp.readystate==4 && xmlHttp.status==200)
    {
        try
        {
            handleResponse();
        }
        catch(e)
        {
            alert(e.toString());
        }
    }
    else
    {
        alert(xmlHttp.statusText);
    }
}

function handleResponse()
{
    alert("HandleResponse");
    var xmlResponse = xmlHttp.responseXML;
    var root = xmlResponse.documentElement;
    var title=root.getElementsByTagName("title");
    var text=root.getElementsByTagName("text");
    var author=root.getElementsByTagName("author");
    var date=root.getElementsByTagName("date");

    var blogData="";
    for(var i=0; i<title.length; i++)
    {
        blogData=title.items(i).firstChild.data;
    }

    document.getElementById("blog").innerHTML=blogData;
}

HTML

<!DOCTYPE html>

<html>

    <head>   
        <script src="readBlog.js"></script>
    </head>

    <body onload="loadBlog()">
        <div id="blog"></div>
    </body>

</html>
ObSys 56 Junior Poster

If you want it to convey across all browsers then it may be worth having a look at Javascript, notably the jQuery "Fade" function. You can find the information on it HERE. Hope this helps in some way.

<M/> commented: Good idea +8
ObSys 56 Junior Poster

to return an ArrayList you just have to have your return type as arraylist

private ArrayList<Student> getStudent(){
    ArrayList<Student> myArrayList = new ArrayList<Student>();

    return myArrayList;
}

as an example

ObSys 56 Junior Poster

The way I have been taught is to include a constructor method which initates any variables when the object is invoked:

package allin1;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Allin1 {
    JFrame frame;
    JPanel panel;
    JButton b1;

    /**
     * This is our constructor
     * This method is executed as the object is invoked
     * In here we can include all our declarations
     */
    public Allin1(){
        frame = new JFrame("Title");
        panel = new JPanel();
        b1 = new JButton("Exit");

        panel.add(b1);
    }

    public static void main(String[] args) {
        new Allin1();
    }
}

Hope this helps. If anything needs explaining then just send me a PM

ObSys 56 Junior Poster

For the date use the Date.Today() function.

To take the date from the format dd/mm/yyyy and put it in the form ddmmyyyy you will need to build a new string like this Date.Today.Day & Date.Today.Month & Date.Today.Year

To check if a file exists you need to use the System.IO.File.Exists(path) function

Hope this helps. Should be enough to complete your task

ObSys 56 Junior Poster
Java Plug-in 10.9.2.05
Using JRE version 1.7.0_09-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\Bill
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
ObSys 56 Junior Poster

There is no message displayed in the java console. It just comes up with the runtimeException alert but when I click details the console loads with only the command help text.

ObSys 56 Junior Poster

Done. Now I get a RuntimeException error "java.lang.reflect.InvocationTargetException"

Sorry for all these problems. But thank you for helping

ObSys 56 Junior Poster

ok so I have a folder called ast which contains

-------------------------------
Asteroid.class
Asteroids.class (main class)
asteroid.html
BaseVectorShape.class
Bullet.class
Ship.class

------------------------------

The html file contains

++++++++++++++++++++++++++++

<body>
    <applet code="asteroids.Asteroids" width=640 height=480> My Applet </applet>
</body>

++++++++++++++++++++++++++++

ObSys 56 Junior Poster

This is what I currently have

ObSys 56 Junior Poster

Ok this is the tag I used in the html file and it has a "class not found" error

<applet code="asteroids.Asteroids" width=640 height=480> My Applet </applet>

I just can't understand why it will not work. (I also tried the "asteroids.Asteroids.class" but that didnt work either. same erro)

ObSys 56 Junior Poster

Ok. So if my project is called "Asteroids" which has a package "asteroids" and in that package the main class is called "Asteroids" would that require:

"asteroids.Asteroids.class"

in order to work in the <applet> tag

ObSys 56 Junior Poster

To take user input you need to use the java.awt.event, Then create an action listener to handle any user interaction.

ObSys 56 Junior Poster

What are the steps for doing that?

What NormR1 is saying that you need to think through each step you take when you try to solve a sodoku. The write down each step in it's simplest terms e.g. "Look at row" -> "does row contain each number 1 - 9?" etc etc

Then most importantly...WRITE YOUR STEPS DOWN!

This makes is much easier to program

ObSys 56 Junior Poster

Arghhh I don't like java. I've updated java for my browser but now it's coming up with a "wrong name:" error.

I had a search and some people are saying that this is because you have to include the package name before the main class name.

Is this true?

ObSys 56 Junior Poster

Thats how the applet has been written. It's not my code im just using the books example to learn more about java but i can't work out how to get it to execute and load properly

ObSys 56 Junior Poster

Arghh another problem...not my day :/

Doesn't load and has an error message

java.lang.UnsupportedClassVersionError: Asteroids : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: java.lang.UnsupportedClassVersionError: Asteroids : Unsupported major.minor version 51.0
ObSys 56 Junior Poster

Does a Java applet have to contain a "main" method or does it run from the "init()" method. I have written a small game in java following and example in a book however it does not tell you how to run the damn thing. Code has no erros from what I can see.

Someone explain what i need to do

Thanks

ObSys 56 Junior Poster

I've already tried looking for a solution but just cant find anything that seems to work. Can you give me some directions on how to do this.

ObSys 56 Junior Poster

I tried the command prompt using the javac function to create a .class file.

I then used the jar function to create a .jar file but on execution a similar error message occurs "Failed to load Main-Class manifest attribute from (path)"

ObSys 56 Junior Poster

Ok so im writing a small java application using Zellers Algorithm to work out the day of the week for a given date. I have never compiled a java program before because i'm still moderately new to the language and IDE's etc. I am using netbeans.

I have tried to compile the class but it comes up with an error Message saying "Could not find the main class: zellers.algorithm.Main. Program will exit."

My code is as follows:

package zellers.algorithm;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class ZellersAlgorithm implements ActionListener{

    private int d;      //day of week (dd)
    private int m;      //month (mm)
    private int y;      //year born (yyyy)
    private String[] DAY_OF_WEEK = {"Sunday","Monday", "Tuesday", "Wednesday",
                                    "Thursday","Friday","Saturday"};
    public String date;     //Date entered into text field

    //GUI objects
    JTextField dateInput;
    JButton submit;
    JLabel result;

    public ZellersAlgorithm(){
        //constructor
        d=1;
        m=1;
        y=1980;
        date = "";

        setupInterface();

    }

    public void setupInterface(){
        //Create window objects
        dateInput = new JTextField(10);
        dateInput.addActionListener(this);

        submit = new JButton("Find Day");
        submit.addActionListener(this);

        JLabel inst = new JLabel("Enter the date (dd/mm/yyyy): ");

        result = new JLabel();

        FlowLayout flo = new FlowLayout();

        //create new window
        JFrame window = new JFrame();
        window.setSize(250,120);
        window.setTitle("Zellers Algorithm");
        window.setResizable(false);
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.setVisible(true);
        window.setLayout(flo);

        //Add objects to window
        window.add(inst);
        window.add(dateInput);
        window.add(submit);
        window.add(result);
    }



    public void actionPerformed(ActionEvent event){
        Object source = event.getSource();
        if(source == submit){
           date = dateInput.getText();
           this.implmentZellers();
        }
    }

        public void implmentZellers(){
        //implements the zellers algorithm
            /**
             * Let day = d
             * Month = m
             * Year = y
             * 
             * 
             * if m < 3
             *      m …
ObSys 56 Junior Poster

I've been taught that it's better practice to initialise the variables to default values in the constructor. I don't think it matters with reference to speed but it may cause trouble when others read your code.

ObSys 56 Junior Poster

I'd say if you have a good knowledge of Java already it's probably best to just use that. Another option is obviously C++ which if you know Java and C, you will most likely pick up very easily. I don't know if there's a language out there thats better for AI. There may well be something similar to OpenGL but for AI...

ObSys 56 Junior Poster

Cool little survey....never heard of F# before. Is it commonly used and if so what for?

ObSys 56 Junior Poster

ALIEN - What a film!!!

ObSys 56 Junior Poster

Let's just hope there aren't any teeanage boys replying to this thread...the results could be worrying to say the least :)

ObSys 56 Junior Poster

Have a look into Requirements Engineering on places like Google Scholar . This will help you look at systems from more of a technical view. Once you;ve managed to understand how to think from the point of view of data movement you will find it a bit easier to start programming.

Another good thing to look at is Systems Architecture as this will help you map out what the system has to do in an easy to understand manner and break each part of the system down.

My final piece of advice is to program with pen and paper first. So rather than going straight into programming, instead write out what you want to system to do etc. Then how do you expect to do this. This method will help you sit down and actually think about the software.

ObSys 56 Junior Poster

Ok so first we need to create a 2 dimensional array. To paint the grid, we just need to create a simple loop that loops through each item in the array. As far as referencing the grid goes, the easiest way is to create a switch for grid(x,y) and find the value of each cell.

    int grid[][] = new int[32][32]; //this creates our 32*32 grid

    public void paintComponent(Graphics g){

        grid[2][2]=1; //this is how values are assigned to each cell
        grid[2][3]=2;

        //here we create 2 loops x and y to go through each item in the grid array

        for(int x=0;x<32;x++){

            for(int y=0; y<10; y++){

                //Switch to determine Cell value
                //and therefore cell colour
                switch (grid[x][y]){

                    //default
                    case(0):
                        g.setColor(Color.GREEN);
                        break;

                        //Water
                    case(1):
                        g.setColor(Color.BLUE);
                        break;

                        //dirt
                        case(2):
                            g.setColor(Color.DARK_GRAY);
                            break;

                } 

                //draw the filled rectangle in specified color
                g.fillRect(x*32,y*32,32,32);

                //draw borders
                g.setColor(Color.BLACK);
                g.drawRect(x*32,y*32,32,32);


            }
        }
        repaint();
    }
ObSys 56 Junior Poster
    I'd recommend using an array to create a grid on the screen. Then you can assign each cell a value. This value determines which bitmap is displayed in the cell.

    e.g. If we assign the value 1 to door.jpg and then say
                (3,2) = 1 
         The system then paints the door.jpg image in the cell (3,2).

    Hope this Helps
ObSys 56 Junior Poster

victory -> battle

ObSys 56 Junior Poster

Sleepy :/

ObSys 56 Junior Poster
for(int i=0; i < string.length; i++){

    System.out.println(string.charAt(i));

}

something like that.
Basically it loops through the string and prints each character to the console. Giving:

1
5
0

ObSys 56 Junior Poster

Your going to have to give some more information as it's not clear what you are trying to achieve here

ObSys 56 Junior Poster

Thanks. That's actually really useful because i've been led to believe that it's preferable to use the awt class. Going to change the way I program in the future :)

ObSys 56 Junior Poster

I dont understand why you are using a loop to tie up the system. you should use an event to trigger the purchase rather than keep looping.

ObSys 56 Junior Poster

Maybe try a darker shade of grey like #171717

ObSys 56 Junior Poster

What i mean is that AWT uses native components in order to draw whereas Swing uses the Graphics2D API so surely awt would be faster as its using the native components of windows?

ObSys 56 Junior Poster

First of all the main class should have "package assignment9;" at the top.

You seem to have invoked the FlightSchedule class in you main class with "schedule" as the identfier and then set this to "null" in your constructor.

To use a method in the FlightSchedule class you need to do "schedule.getFlightsToRegion(*RegionCodeGoesHere*)".

This should invoke the getFlightsToRegion method

ObSys 56 Junior Poster

the problem with using javax.swing is that compared the the awt its slower because your referring to java specific locations.

If your looking at basic mechanics then using a constant downward acceleration of 9.81 (as we have on earth) will work. So whenever you jump you need an initial velocity upward which then uses an equation in order to apply the downward acceleration due to gravity.

I'd recommend starting with a website like this and then see if you still require help

Hope this was useful

ObSys 56 Junior Poster

If you invoke a JFrame object in the start of your code you may be able to refer to the identifier later on.

JFrame newFrame = new JFrame();
newFrame.setSize(x,y);
newFrame.setDefaulCloseOperation(JFrame.EXIT_ON_CLOSE);
newFrame.setTitle("My Frame");
etc etc....

//Later on go back the the newFrame identifier
newFrame.setTitle("Company name");

Just an idea.

ObSys 56 Junior Poster

If it's a link then all you have to do is write it to the database as a string ("C:\folder\image.jpg"). So you add a field called "imgLocation" or something and then write the link to that field.

If this doesn't help then reply with more information such as an exemplar image link that you want to save etc

ObSys 56 Junior Poster

What sort of projects? Game Design? Database? .... theres a lot of type of software about

ObSys 56 Junior Poster

G waddell forgive me if im wrong but A being greater than 0 and a being less than 100 is two conditions.