darkagn 315 Veteran Poster Featured Poster

Hi rahejapreeti and welcome to DaniWeb :)

By a bullet, do you mean an ordered list? Do you know how to do that in XML (without php)? If so, let me point you in the direction of the Simple XML documentation. Simple XML provides an easy-to-use XML manipulation for PHP.

Hope this helps,
darkagn :)

darkagn 315 Veteran Poster Featured Poster

Just taking a quick look, you have not passed in a parameter to the region::getAllR() call. Note that the signature of the function is function getAllR($Region_id) which contains a single parameter with no default value set. Therefore you must call the function like so: region::getAllR($aRegionId);

darkagn 315 Veteran Poster Featured Poster

So what's your code? The modulo operator should handle that for you...

darkagn 315 Veteran Poster Featured Poster

Sorry, array.length will serve you better where array is the name of your array.

darkagn 315 Veteran Poster Featured Poster

Check out the documentation on the date_sub function - I think this will do what you are after. Here is a link: http://au2.php.net/manual/en/function.date-sub.php

darkagn 315 Veteran Poster Featured Poster

All I can say is planning your project will reduce the amount of time to code it. Perhaps start by designing the database of players - what details do you require from a new member and how will they go about searching for a partner? Start with the basics of the site first and then once that is all working correctly add extra features such as the forum.

I think PHP would be a good choice, and MySQL should serve as a good database engine. You will also need to read up on HTML and CSS. I think your site is certainly doable in 9 months but it will take a lot of planning and design before you worry about the code.

darkagn 315 Veteran Poster Featured Poster

Are you talking about the IDE or the java.beans package? If you mean the IDE then this link will help http://www.netbeans.org/kb/

darkagn 315 Veteran Poster Featured Poster

i get:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 9
at dateapp.Main.main(Main.java:22)
Java Result: 1

public void test()
{
        String[]  j = new String[6];
        int i = 8;
        
       if(j[i+1].equals(j.length))
       {
            i = 0;
       }
       
       System.out.print(i);
    }

Your error was caused because i+1 does not EQUAL j.length, but is still greater than the bounds of the array. Also, you should probably use == to compare numbers, the equals method is used to compare objects.

darkagn 315 Veteran Poster Featured Poster

Use modulo arithmetic instead.

if ( i >= array.size() )
{
  i = i % array.size();
}

In fact, you don't even need the if-statement, just do the modulo...

darkagn 315 Veteran Poster Featured Poster

absolutely.

i do that most of the time.

an example lets say i have created a class Me.java which has the following constructors

public Me()
{}
public Me(String s)
{}
public Me(int dead)
{}

public static void main(String[] args)
{
Me theBasicConstructor = new Me();
Me theStringConstructor = new Me("Hello");
Me theIntegerConstructor = new Me(23);
}

i hope that this will give you the idea

The question was - can you call an instance method from a constructor? Your example calls constructors from the main method which is different. This is a simple example of what codered152 was asking for:

public class Me
{

  private String name;

  public Me(String aName)
  {
    setName(aName);
  }

  public void setName(String aName)
  {
    name = aName;
  }
}
darkagn 315 Veteran Poster Featured Poster

The only time that the getByName method hasn't worked for me was when I was trying to access a computer on a different domain / network to me. I had to use the fully qualified computer name for it to work. What is the name you are inserting and are you on the same domain?

darkagn 315 Veteran Poster Featured Poster

Hi Uma_fb and welcome to DaniWeb :)

I have never tried to do this with a .doc file, but I'm guessing it is the same as opening/modifying a text file. Let me point you to the PHP Manual, http://au.php.net/ that has lots of great documentation on the php language including user examples. Some functions that you will need to achieve your task are:

fopen -> opens a file
fread -> reads data from a file
fwrite -> yep you guessed it, this one writes to a file :)

Anyway, there's a few pointers. Have a play and see what you can come up with. If you get stuck, post your coding attempt or ask some specific questions and we will try to guide you.

Good luck :)
darkagn

darkagn 315 Veteran Poster Featured Poster

Hmm, the InetAddress.getByName(String) method should work. Are you using the full computer name? That is, including the network?

darkagn 315 Veteran Poster Featured Poster

Hi shobhit25 and Welcome to DaniWeb :)

What do you mean by a rich text box? I would like to help you out, please give me a little more information on what you are after.

darkagn 315 Veteran Poster Featured Poster

With a solid background in C/C++, Java should be relatively straight forward to pick up. I think one of the best free resources for learning java is the java website, http://java.sun.com , which has the API documentation and lots of great tutorials.

In terms of books I would probably recommend starting with something that describes the differences and similarities between C++ and Java. I actually learned Java first and then went onto C++, and the book I used was C++ for Java Programmers by Mark Allen Weiss. I'm sure there would be a similar book out there for "Java for C++ Programmers".

Also, check out the sticky at the top of this forum for more great learning resources.

Good luck, :)
darkagn

darkagn 315 Veteran Poster Featured Poster

Without more details I can only guess, but I would say that your data type for the amount of money that the player can get is an SQL INT. Am I right? An INT in SQL can only have a maximum value of 2,147,483,647. If that is the case, I would recommend using a BIGINT which will allow your players to have as much as 9,223,372,036,854,775,807!

darkagn 315 Veteran Poster Featured Poster

i want to know ho to dotst.

I'm sorry but I don't know what you mean by "dotst".

darkagn 315 Veteran Poster Featured Poster

Are you having trouble with the popup or the delete?

darkagn 315 Veteran Poster Featured Poster

Also, you don't have to use the auto_increment facility just because the table has it. You can insert a row and set the ID manually, assuming you know what you want to set it to...

darkagn 315 Veteran Poster Featured Poster

Thats what I have been told.

But that is either a bug or stupid as I cannot see any purpose of not being able to reset or some sort of fix as it makes your database invalid... :|

I wouldn't say that it makes a database invalid, maybe just not neat and tidy. I think that it is done this way for efficiency reasons. Imagine in a large database having to keep track of every ID for every table that uses auto_increment facility. Rather than just remembering that TableX is up to 14, you would have to store the fact that the table's maximum ID is 13 but that 4, 7, and 12 have been deleted for example. That would greatly slow inserts down and also take up a lot more space.

I do see your point of view though, it certainly isn't exactly what you would think an auto index should do on the surface. :)

darkagn 315 Veteran Poster Featured Poster

Ah, thanks peter - my mistake!

darkagn 315 Veteran Poster Featured Poster

Hi ocreds,

In order to raise a number to a certain power, you need to use the Math.pow(double, double) method. The documentation on it is found here in the Math class. Basically it accepts two numbers as parameters and returns the first number raised to the power of the second number. Notice that they are doubles though - I'll leave it up to you to figure out how to use that method with integers.

I'm not sure what you mean by your spacing question, maybe someone else can answer that one.

darkagn 315 Veteran Poster Featured Poster

Something like this might be simpler if it is possible for your code:

// $elements is your list of elements that you are adding to your string array
$arrayString = array();
foreach($elements as $element)
{
  $arrayString[] = $element;
}

Now, in your $arrayString you will need to access each element as $arrayString[0], $arrayString[1] etc instead of $arrayString and so on.

darkagn 315 Veteran Poster Featured Poster

In most MySQL engines the auto_increment function assigns unique IDs to new rows inserted into a table. If one is deleted, the ID has still been used, so the next one to be used is still 14 in your example because 13 and 12 have been used (although they have been deleted). As far as I know, it is not possible to "reset" the increment without deleting the table, recreating it and reinserting the data.

darkagn 315 Veteran Poster Featured Poster

Sorry what do you mean by "resizer code"? Can you provide an example or show us what you have so far?

darkagn 315 Veteran Poster Featured Poster

What have you done so far? We are not allowed to just give you the answer, we need to see some effort. Sorry!

darkagn 315 Veteran Poster Featured Poster
$new_file_name=vsquarel;

I think that this line is incorrect? Possibly it should be:

$new_file_name="vsquarel";

or even:

$new_file_name="vsquarel.htm";

Unless vsquarel is supposed to be a variable, in which case it should be:

$new_file_name=$vsquarel;

Try these suggestions and see if that fixes your problem... :)

darkagn 315 Veteran Poster Featured Poster

Take a look at the date() function in the PHP Manual ( found at http://au.php.net/manual/en/function.date.php ). There is a special format, t, that returns the number of days in a given month. For example, to find the number of days in July, you could write something like:

$julyDays = date('t', mktime(0, 0, 0, 7, 1, 2008));

since the mktime() function makes a time for the supplied hour, minute, second, month, day and year.

Hope this helps :)

darkagn 315 Veteran Poster Featured Poster

The simple bugs are often the hardest to fix. I personally hate the ones where you have a slight spelling mistake in a variable name and instead of throwing an error it just works but not as you'd expect. They can take ages to find.

I would recommend purchasing a PHP compiler. The good ones are a bit on the expensive side, but are well worth it, particularly for big projects.

darkagn 315 Veteran Poster Featured Poster

The error is occurring on line 488 and is a NullPointerException, which means that something is being referenced on line 488 that hasn't been initialised properly. Which line of code is number 488 (in Inventory.java file)?

darkagn 315 Veteran Poster Featured Poster

Have you compiled the code? That error usually relates to attempting to run a main method in a file that has not yet been compiled. If that was a compiler error, which line(s) give the error?

darkagn 315 Veteran Poster Featured Poster

In what context are you attempting to use "\t"? Can you post your code?

darkagn 315 Veteran Poster Featured Poster

So you want to add the data to the database? Sorry, I thought you were asking to retrieve all entries already in the database with those values. The SQL would then be something like:

INSERT INTO <databaseTable>
(columnX, columnY, columnZ) VALUES
('x', 'Y', 'Z')
darkagn 315 Veteran Poster Featured Poster

The only thing I can see wrong with your sql statement is that you don't need single quotes around your variables. But I wouldn't think that would cause an error. What happens when you call the storedRecord function? (It should just print the sql statement to the screen, but what is being printed?)

darkagn 315 Veteran Poster Featured Poster

Sure it is. You can do something like:

SELECT * FROM <databaseTable>
WHERE columnX = 'x'
AND columnY = 'Y'
AND columnZ = 'Z'
darkagn 315 Veteran Poster Featured Poster

I think it may possibly be out of beta now - that post is almost 2 years old... :P

Salem commented: There is only betaware or abandonware ;) +20
Ezzaral commented: One would hope so anyway :) +11
buddylee17 commented: funny +2
darkagn 315 Veteran Poster Featured Poster

While you are learning java it is probably best if you learn to code your interfaces from scratch rather than using a GUI builder. You will need to use the java.awt and javax.swing packages. There are plenty of tutorials in GUI design - This one is probably a good place to start.

darkagn 315 Veteran Poster Featured Poster

Try sending an email with only addresses in the BCC field (ie none in the To or CC fields) and when it is delivered each address will appear in the To field, but only the recipient's will be displayed.

darkagn 315 Veteran Poster Featured Poster

Your DB structure looks ok, except that I would probably just sort by name and remove the sort_name field. Your SQL query will look something like:

SELECT * FROM table_ads
INNER JOIN table_categories
ON table_ads.category_id = table_categories.id
WHERE table_ads.active = true
ORDER BY name

Might need a bit of tweaking to get exactly the result you're after, but should point you in the right direction.

buddylee17 commented: good example Aussie +1
darkagn 315 Veteran Poster Featured Poster

Your syntax is not quite right in the SQL statement. You don't need so many quote marks. This will work for you I believe:

$sql = "SELECT DISTINCT Town FROM $Table_Name";

Then you actually need to run the query. What I normally do is use the PDO library to connect to a MySQL database, but there are other ways of doing it too. Here is a link to the PDO documentation. If you have trouble connecting to your database or running the query, repost and will try to help.

darkagn 315 Veteran Poster Featured Poster
14:       String imageText = null;
15:       imageText = getParameter("image"+i);
16:       if (imageText != null) {

The next line will only run if imageText is not null, so your call to getParameter method must return something. I would suggest putting in a println statement to see what the value of imageText is immediately before the if-statement. Just don't forget to remove the println afterwards!

darkagn 315 Veteran Poster Featured Poster

Couple of quick points:

ID fields should never be a text field. Use Unsigned INT or something similar. This helps efficiency and referential integrity of your tables.
Think about maybe consolidating the three columns Dayofweek, Timeslot and AMPM into one column, TimeOfDay, and making it a smalldatetime field, which is much nicer to work with than a straight text for dates and times.
Photo - you have a couple of choices, either this is a filename to the image of a photo, or better still make this a varbinary field and store the image's binary data directly in the database.

Ok, that said, for an SQL statement to list all shows by day and time, something like

SELECT * FROM TableName
ORDER BY TimeOfDay ASC

should do for a start. You can always refine this statement with a WHERE clause to limit to a specific date if you want:

SELECT * FROM TableName
WHERE TimeOfDay > '2008-07-17 00:00:00'
AND TimeOfDay < '2008-07-17 23:59:59'
ORDER BY TimeOfDay ASC

Hope this helps :)
darkagn

darkagn 315 Veteran Poster Featured Poster

This is a generic function to return a specific field ($field) from a table ($tble) in a MySQL database. The exact record returned is specified by the parameter $whr.

So your call:

$msgcount = getdata("messages", "count(*)", "status=0");

will result in the parameter $msgcount being the result of the following sql query:

SELECT count(*) FROM messages WHERE status=0

In other words, the number of messages where the field status=0.

darkagn 315 Veteran Poster Featured Poster

The only thing I would say is that since you have a Foreign Key in Amount called Invoice_id, you will need to update the Invoice table before the Amount table. If you try to insert into Amount table for an invoice that you haven't entered into the Invoice table, you will run into problems.

darkagn 315 Veteran Poster Featured Poster

what code?

darkagn 315 Veteran Poster Featured Poster

In order to use unicode characters, you need your fields to be set as nchar, nvarchar or ntext.

darkagn 315 Veteran Poster Featured Poster

This link contains an example of how to do what you are trying to do. Basically the author overrides the components paintComponent() method and inserts a numbering system in the left Inset of the area.

Hope this helps,
darkagn

darkagn 315 Veteran Poster Featured Poster

How are you setting up your database connection and queries?

darkagn 315 Veteran Poster Featured Poster

Hi Steve and welcome to Daniweb,

Good to see another fellow Australian in the mix. I can offer some advice for numbers 2 and 3...

For 2, take a look at the GACL package, which is a very powerful tool that deals with security and permission levels for your site.

For 3, something like PHP Mailer is a good package that allows you to send emails in the way that you want.

Hope this helps,
darkagn

darkagn 315 Veteran Poster Featured Poster

There may be a better solution out there, but what about if you did a transpose whenever the user rotates their image to make sure the origin is kept above and to the left of the top-most and left-most areas of the drawing?