Cerberus 17 Junior Poster

Best: 406

Worst: 0

Cerberus 17 Junior Poster

That code looks fine to me.

Cerberus 17 Junior Poster

I don't think you can do that at all with PHP because it need to be processed by the PHP engine (server side).

Cerberus 17 Junior Poster

Thanks a lot for your help, it works superbly.

Cerberus 17 Junior Poster

GiorgosK that works great in IE but it doesn't render properly in Firefox. I'll mess around with it a bit to see if i can get it to work.

This is what i have using the other way.

<html>
<head>
<style type="text/css">
body{text-align: center;}

#container{
    margin: 0 auto;
    width: 600px;
    height: 600px;
    text-align: left;
    border-top: 1px solid blue;
    border-bottom: 1px solid blue;
    border-right: 1px solid blue;
    border-left: 1px solid blue;
}
  
#logo{
    background-color: red;
    top: 100px;
    left: 0px;
    width: 100px;
    height: 100px;
}

#banner{
    background-color: blue;
    top: 0px;
    left: 100px;
    width: 500px;
    height: 100px;
}

#content{
    background-color: green;
    top: 100px;
    left: 0px;
    width: 600px;
    height: 600px;
}
</style>
</head>
<body>
<div id="container">
    <div id="logo"></div>
    <div id="banner"></div>
    <div id="content"></div>
</div>
</body>
</html>

The problem i'm having is that the container div positions the other divs one on top of the other instead of this...

1122222
1122222
3333333
3333333
3333333

I think it's got something to do with the position attribute but i'm not making sense of them yet. Any suggestions anyone?

Cerberus 17 Junior Poster

Thanks for the reply. I tried that previously but couldn't get it to work. The problem was the CSS positioning.

Thanks again.

Cerberus 17 Junior Poster

Suppose there is a very simple web page.

<html>
<head>
<style type="text/css">
#logo{
    background-color: red;
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100px;
    height: 100px;
}

#banner{
    background-color: blue;
    position: absolute;
    top: 0px;
    left: 100px;
    width: 500px;
    height: 100px;
}

#content{
    background-color: green;
    position: absolute;
    top: 100px;
    left: 0px;
    width: 600px;
    height: 400px;
}
</style>
</head>
<body>
    <div id="logo"></div>
    <div id="banner"></div>
    <div id="content"></div>
</body>
</html>

How would i go about centering these acurately considering differing screen configurations?

Thanks.

Cerberus 17 Junior Poster

Actually you don't need that p =[0][0] assignment so the const can stay in.

Cerberus 17 Junior Poster

I ran it once and it played ok.

bool check_diagonal(const char board[SIZE][SIZE],int p, const char mark[SIZE2])
{
    cout << "Check Diagonal" << endl;

    if(board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != 0)
    {
        p = board[0][0];
        return true;
    }
   else
   {
        return false;
   }
}
Cerberus 17 Junior Poster

I was just trying to install a compiler that i prefer....

Looking at the first problem i would say that your check_diagonals should return a bool.

Then i would say that within that function the 2D array needs to be passed in like the other two check functions.

Then remove the 'const' from const int p in that functions parameters. Now it compiles.

Cerberus 17 Junior Poster

You have 'const' p in your formal parameters of your check_diagnal function. I don't know if that's the only reason because my compiler has thrown up a few other errors.

Actually, i put that problem in myself. Sorry

Cerberus 17 Junior Poster

I don't think so. Chilisoft ASP will run classic ASP pages written with VBScript, but not ASP.NET pages.

I had a search about and I can't find anything about Chilisoft ASP supporting ASP.NET web applications.

Yup, i've done a search and you're right. ASP.NET is apparantly Windows only technology.

Cerberus 17 Junior Poster

you can call them DEVIGNERS! (developers / designers)

Good terminology.

But i don't know why it isn't Web Programmer and Web Designer and the middle ground is a Web Developer:-O

Cerberus 17 Junior Poster

Macromedia/Adobe have tutorials on their site for Dreamweaver i think.

Cerberus 17 Junior Poster

I think ASP.NET can run on Linux using Chilisoft.

Cerberus 17 Junior Poster

Your almost there you just need to handle the exception. Try this:

try
{
       totalValue = totalValue + cds[cdCount].getValue();    
}
catch(NullPointerException npe)
{
        //handle exception
}
Cerberus 17 Junior Poster

It works fine for me. It just outputs the username. Do you get an error message or something?

Cerberus 17 Junior Poster

Thanks.

Cerberus 17 Junior Poster

The first error is saying that the CD Class doesn't know about the other class. This line isn't really necessary anyway.

What i would do would make a float variable in the inventory class and every time you loop and insert another element into the array add it to the float: e.g.

float runningTotal = 0;

runningTotal = runningTotal + arrayelement[0]
Cerberus 17 Junior Poster

I am trying to get this function to work and having a few problems.

if(function_exists("mysql_real_escape_string"))
{
       $value = mysql_real_escape_string( $value );
}

and i get an error:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in w:\pathname on line 11

Does anyone know how to resolve this? I'm using Uniform Server under XP Home.

Cerberus 17 Junior Poster

I don't think this is possible because your web browser requires the source and viewing the source code is a function of the browser.

Is there any particular reason you need to do this?

Cerberus 17 Junior Poster

I don't see how you can hide the source that gets sent to the client browser. Code within the PHP tags would be processed at the server end anyway. So data such as database login wouldn't be sent to the client machine anyway.

Cerberus 17 Junior Poster

I have no idea about the desktop but you could create a simple command line driven OS first and then add a desktop layer type thingy. Well that's what Microsoft did with Windows 3.x i think.

I think you need to know assembly language quite well. It might be worth trying to do some tutorials on that.

Cerberus 17 Junior Poster

You array program works great. I do have one suggestion though. At the moment you have an array of 5 elements but the loop continues until the user types stop. What would happen if there were six iterations? I would suggest using a for loop limiting the loops to five iterations. You could then implement an if(userinput == "stop") statement with a break statement to exit the loop prematurely.

Cerberus 17 Junior Poster

That is what I have spent most of the morning trying to accomplish, building off Ezzaral's suggestion.
At this point I am just not sure how or where to set up the get and set commands. I think I have wrapped my brain around most of the rest of it.

Both the get and set commands would belong to the class which would be instantiated to represent CD's.

Cerberus 17 Junior Poster

CIf I understand it correctly, it will still have me setting up the information inside the array myself and then just calling those values later.

Yes you would need to implement some kind of loop to set up each object (and hence the array) with user defined data.

Cerberus 17 Junior Poster

This might be helpful www.osdev.org

Rashakil Fol commented: A useful (!) post! +9
Cerberus 17 Junior Poster

I don't know that much about the subject but i think Apache is an open source web server for Unix based operating systems and is normally used in conjunction with PHP.

IIS is Microsoft's web server and usually runs on Windows machines and is used with ASP and other microsoft technologies.

These setups are not exclusive because i am running Apache and PHP on my Windows XP system.

Cerberus 17 Junior Poster

What i think you need to do is implement an array of a user defined class. Here is an example...

A class Shape with two attributes, which are set by the constructor and two methods to access those attributes.

public class Shape{
    
    String type;
    int sides;
    
    public Shape(String type, int sides){
        this.type = type;
        this.sides = sides;
    }
    
    public String getType(){
        return type;
    }
    
    public int getSides(){
        return sides;
    }
}

Then a class that instanciates two 'shapes' and puts them into an array of shapes.

public class GetShapes{
    Shape[] shapes;
    
    public GetShapes(){
        shapes = new Shape[2];
        
        //instantiate shapes
        Shape shapeOne = new Shape("Square", 4);
        Shape shapeTwo = new Shape("Triangle", 3);
        
        //add to array
        shapes[0] = shapeOne;
        shapes[1] = shapeTwo;        
        
        //output contents of array
        System.out.print(shapes[0].getType());
        System.out.println(" have " + shapes[0].getSides() + " sides");
        System.out.print(shapes[1].getType());
        System.out.println(" have " + shapes[1].getSides() + " sides");
    }
    
    public static void main(String[] args){
        GetShapes gs = new GetShapes();
    }
}

Hope that helps.

Cerberus 17 Junior Poster

To explain using a different example: imagine a queue of people each person has unique attributes e.g. name, age, address etc (just like each cd would). Each time a person joins the queue their attribute must be known and when they are they can then be added to the queue.

Cerberus 17 Junior Poster

Try to use the array in the inventory and then add CD's to the array during each loop.

Cerberus 17 Junior Poster

Thanks again :) got that working in frontpage.

Is there a means to use css so it's not in the head? Because that's where my issue was with changing navbar before, that i couldn't seem to add css into the header (nor headerinclude).
Thank you again :)

Yup just copy and paste the style code (delete the style tags completely) into a seperate file and call it something like mystyle.css. Then put the following code into the head tags...

<link rel="stylesheet" type="text/css" href="mystyle.css" />

Cerberus 17 Junior Poster

I'm not sure how you do three images but i'll start you off with a simple roll over button.

<html>
<head>
<title></title>
<style type="text/css">
    .usercp
    {
        background-image: url(usercp2.png);
        display: block;
        width: 50px;
        height: 30px;
    }

    .usercp a
    {
        display: block;
        width: 50px;
        height: 30px;
    }

    .usercp img {width: 50px; height: 30px; border: 0; }
    .usercp a:hover img{visibility:hidden}
</style>
</head>
<body>
    <div class="usercp">
        <a href=""><img src="usercp.png"/></a> 
    </div>
</body>
</html>
Cerberus 17 Junior Poster

I would suggest starting off small. Perhaps just implementing the browsing user that can view contents of a single table and then add to it as you gain experience and confidence.

It's always easier to break the problem up into smaller parts.

Cerberus 17 Junior Poster

Good solution.

Cerberus 17 Junior Poster

Here's a simplified way to do it in CSS.

<html>
<head>
<title></title>
<style type="text/css">
    a:link {
        text-decoration: none;
        color: red;
        background-color: yellow;
    }
    a:visited {
        text-decoration: none;
        color: black;
        background-color: blue;
    }
    a:hover {
        text-decoration: underline;
        color: green;
        background-color: gray;
    }
    a:active {
        text-decoration: none;
        color: silver;
        background-color: cyan;
    }
</style>
</head>
<body>
        <a href="http://www.daniweb.com">Daniweb</a>
</body>
</html>

You can change the colours around between the style tags.

This can be done using your own images using rollover buttons instead.

Cerberus 17 Junior Poster

I don't know, i'll have to have a think about it. Perhaps using an associative array.

Cerberus 17 Junior Poster

If you have some kind of description of the system a start might be to make a list of all of the nouns as candidate classes.

Cerberus 17 Junior Poster

this is really rough but i think you mean something along these lines

$sql = "select * from table name where ";
$start;

if(isset $_POST['name'])
{
    $sql = $sql . $_POST['name'];
    $start = 1;
}

if(isset $_POST['phone'])
{
    if($start ==1)
    {
        $sql = $sql . "and '". $_POST['name'] ."'";
    }
    else
    {
        $sql = $sql . $_POST['name'];
    }
}

$sql = $sql . ";";
Cerberus 17 Junior Poster

Do you just mean the sql statement?

Something like this...

$sql="select * from table where name = ' " . $_POST[name] . " ' ";
$sql = $sql . " and phone = ' " . $_POST[phone] . " ';";

Cerberus 17 Junior Poster

I've used ASP (not dot net) and PHP and much prefered PHP.

Cerberus 17 Junior Poster

I've tried Uniform Server and it works very well. No set up at all to use on local machine for development. You can also copy and past the US folder onto any device and run the package on any compatible computer.

Cerberus 17 Junior Poster

If you need to know the basic steps then it's probably too soon to start a large project. I would suggest getting a book (Learning Java by Knudsen and Niemeyer [o'reilly publisher] is a good start) and learning the basics.

Cerberus 17 Junior Poster

England.

What about yourself?

Cerberus 17 Junior Poster

Did you create the jar file using a manifest file?

e.g. >jar cvfm myjar.jar manifest.mf *.class

Cerberus 17 Junior Poster

I would guess that the Session variable hasn't been configured on the server. But it's just a guess.

Cerberus 17 Junior Poster

I've been looking into xampand wamp and they sound quite good but i've also found Uniform Server which is a smaller which is appealling if i wanted to use it on different machines. Does anyone have any experience with Uniform Server?

Cerberus 17 Junior Poster

Zend sounds good but i don't really want to spend any money at the moment.

Am i right in thinking that when installing Apache manually if you set the network domain and server name to 'local host' then it will only serve the machine it's running on?

Cerberus 17 Junior Poster

Unfortunately i use XP Home and i don't think that even comes with PWS.

Cerberus 17 Junior Poster

How about a simple card game like blackjack!

Make a class called card and initialize each one putting them into a container like a list. You could then implement an algorithm to shuffle the cards too.