Hi getarticles1123 and welcome to DaniWeb :)
That's what we're here for. If you have questions, chances are someone at DaniWeb has solutions. Feel free to look around and ask if you need help. Enjoy your stay!
Hi getarticles1123 and welcome to DaniWeb :)
That's what we're here for. If you have questions, chances are someone at DaniWeb has solutions. Feel free to look around and ask if you need help. Enjoy your stay!
Hi alexstrong29 and welcome to DaniWeb :)
If the recommended products are also in the products table, what I would do is add four columns to your product table that represent the product ID's of each recommended product for the row. That way your database grows by a lot less than having a separate table that is four times larger than your current products table.
Hope this helps,
darkagn :)
if (inches = 10)
{
call setSize();
call setCost();
cost -=2;
}
This is where I believe your errors are. First of all, your if statement does not resolve, you need to use == to compare, like so
if(inches==10)
Next, if you want to call a method, you don't write call setSize(). What you need to do is specify who is calling the method followed by a full stop (period) followed by the method name with any parameters. In the first case of setSize, you would do this:
PizzaInfo.setSize();
I will let you work out how to call setCost. Then, after you call setCost, you try to adjust cost, but this won't work because cost is a private field. You need to call setCost with the parameter that you want to set the cost to.
Hope this helps,
darkagn
All that code does is tell the browser to use XHTML, it has nothing to do with the actual formatting of the page. More than likely you have a misplaced <b>
tag in your code somewhere.
That would be
$sql = "SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1 ORDER BY `id` ASC";
Note that my original post listed the SQL not the PHP.
Is your chat window in Java? If so is your GUI written in swing or awt? Perhaps some code to describe how you construct your window would help...
Personally I would prefer not to see DaniWeb tread that path.
I think in this situation you are better off explicitly joining the tables by account id. Like so:
SELECT COUNT(J.account) from JanTable J
INNER JOIN FebTable F
ON J.account = F.account
WHERE J.AmountPaid=0 AND F.AmountPaid=0
Otherwise you will get many duplicate records.
@darkagn
Student does have all those methods because it extends JFrame.
Ah, I missed that, jasimp is correct on this.
Hi Sivapatham and welcome to DaniWeb,
A very simple algorithm for this would be:
for( $i = 0; $i < $n; $i++ ) // if $n is number of teams
{
for( $j = $n-1; $j > $i; $j-- )
{
// teams for this match have id's = $i and $j
// I'll let you work out what you want to do here...
}
}
I am sure there is a more efficient way of doing this, but this algorithm should work.
Hi ComputerGirl and welcome to DaniWeb :)
You have two problems that I can see. The main problem is in your main method (excuse the pun).
public static void main(String[] args) {
Student demo = new Student();
demo.setSize(250, 400); // ---!!! demo is of type Student which does not have a setSize method
// that call should be in your createGUI() method and called by window
demo.setTitle("Test Scores"); // ---!!! same here
demo.createGUI();
demo.setVisible(true); // ---!!! same here
}
Also, you have two constructor methods for Student, one public which sets all member variables to default settings even though parameters were supplied, and one private (not sure why you need this one?)
Your problem is in this line of code:
if(temp.getData().getData()==str)
When comparing Strings you cannot use == to determine if they have the same contents. You must use the equals() method of the String class.
The most basic program requires some form of planning, even if it is just a few notes on some scrap paper. It is always a good habit to plan, you will make fewer mistakes and write more manageable code if you spend time planning first. Personally I never "just jump into coding with just a vague idea of how a program is supposed to run".
What is the type for the field 'creationdate'? Is it a date, datetime, smalldatetime or something else?
Ok timeout guys, this isn't a slinging match. :P
Asmodaii, I will try to help you, but I'm not really sure what it is you are after. I think from what you wrote earlier, you are asking what would be the output of the program you have been given if the supplied 2D array is the input? If that's what you are after, can I point you towards the method of the driver class, main. This is the method that is called when your program is run. Step through it logically, one line at a time, and see what you come up with. I'll give you a start:
public class driver{
public static void main(String[] args){
// the first line of code creates an instance of your TwoDArray class
// (nothing is output from this line)
TwoDArray app = new TwoDArray();
int [][] matrix = new int[NUM][NUM];
app.load(matrix);
app.display(matrix);
app.fun(matrix);
app.display(matrix);
}
}
See my comments in the code to give you a start.
Have a try, if you still can't get it let us know where you are struggling and we will try to help.
Regards,
d :)
The DATEADD function will do what you need. Its syntax is DATEADD(datepart,number,date) where the datepart parameter is the interval that you are adding (eg second which can be abbreviated to ss), the number parameter is the amount you are adding (eg 15 or -15) and the date parameter is the date that you are adding to (eg '2009-03-17 12:15:45'). So your query, using freshfitz's example, would be:
SELECT * FROM address
WHERE DateTime
BETWEEN DATEADD(ss,-15,'2009-01-31 09:00:00') AND DATEADD(ss,15,'2009-01-31 09:34:34')
HTH,
d :)
This appears to have stopped for me although I haven't changed any browser settings. almostbob, are you still seeing the ads or can I mark this thread as solved?
Hi again,
The easiest way to avoid duplicates is to limit the select statement according to some criteria. Do you have an ID field in the table that you can use, or some sort of date field to specify when the object was inserted? ID is easiest:
INSERT INTO ServerB.DatabaseName.dbo.Employee B
(SELECT * FROM ServerA.DatabaseName.dbo.Employee A
WHERE B.ID NOT IN (SELECT ID FROM A)
but date can also be done:
INSERT INTO ServerB.DatabaseName.dbo.Employee B
(SELECT * FROM ServerA.DatabaseName.dbo.Employee A
WHERE B.DATE > (SELECT MAX(DATE) FROM A)
Let me know if you don't have such a structure in this table (maybe describe the primary key for me please?)
To backup the database first (which is ALWAYS a good idea btw), in SQL mngmnt studio 2005, right-click the database and select Tasks from the popup menu and select Back Up from the submenu. You need to check the settings in the screen that appears, pretty much the only thing I ever change is the destination. Press the Backup button and watch the magic unfold!
HTH,
d
Ah yes, I do see the difference, but I think that your second select should be on prodid not id?
You don't need quote marks around table or column names. This SQL should work for you:
SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1
ORDER BY admin ASC
Hi praskuma and welcome to DaniWeb :)
-- First, what info do you need?
-- I have assumed just the title and description fields are what you want returned from this query
SELECT Title, Description FROM Product
-- Now we need to join to the Meta table to limit the results accordingly
INNER JOIN Meta
-- how are the tables related? By Product ID
ON Product.ID = Meta.PRODID
-- limit the results
-- start date must be less than current date
WHERE (Meta.KEY = 'StartDate' AND Meta.VALUE < NOW())
-- and end date must be greater than current date
AND (Meta.KEY = 'EndDate' AND Meta.VALUE > NOW())
I haven't tested my query, but it should at least give you a solid starting point. The comments in the SQL have described what I am trying to do for you, but if you don't understand what I have written let me know and I will try to elaborate.
Hope this helps. :)
Hi watchinthegame and welcome to DaniWeb :)
This is a bit odd. Can you please post your SQL query that you are using to update the record so we can take a look?
Cheers
d
So you will need to join the tables like so:
SELECT resortloc, resortname FROM table1
INNER JOIN table2 ON table1.resortid = table2.resortid
WHERE table1.resortloc = (SELECT MAX(resortloc) FROM table1)
This is of course assuming that resortloc is a numeric value, ie 30 not "30 miles".
Is this File object a directory? If so it must be empty to be deleted. The only other thing I can think of if this is not a directory is that maybe your issue has to do with file permissions?
EDIT: And don't get impatient, we will help as soon as we can!
Hi dirbacke and welcome to DaniWeb :)
Please read the forum rules at the top of this forum. Also, please take note of the date of forum threads, particularly if they have been marked as solved, before posting. However it is always nice to see a new face here at DW!
Regards,
d
The only time I have had trouble with firefox and $_SESSION has been because it stores the value across multiple tabs (whereas IE doesn't) so I haven't seen your problem before. Can you please post your code for when you store the variable and when you try to access it again?
After Dani's earlier post I thought it may have been a problem in my work PC only, but I just tried on my home (32-bit) PC which runs XP SP3 with Firefox 1.90. It is also occurring for me in IE 6.0.
Hi Lido98 and welcome to DaniWeb :)
This can be done in SQL Management Studio in a few easy steps:
INSERT INTO ServerB.DatabaseName.dbo.Employee
(SELECT * FROM ServerA.DatabaseName.dbo.Employee)
Where ServerA is the server name of Server A, similar for ServerB and DatabaseName is the name of the databases on each server. I should also point out that if the Employee table has an auto increment field and you want to preserve the order of this field, you need to set auto increment off for the ServerB Employee table before you run the insert and reset it to on when you have finished. Let us know if you need to do this and we'll show you how.
Anyway, hope this helps :)
d
Hi enitsirc and welcome to DaniWeb,
What are the "string comparison methods discussed" in your class? And the techniques for sorting arrays too...
Ok, do you want to update the existing record (and if so, what is the ID of that record) or insert a new record with the combined data of the other two (what are their ID's)?
Not sure if this helps, but I am using Firefox 3.07 on a 64-bit Vista machine.
Hi all,
I have noticed that there are some scrolling text advertisements appearing at the bottom of some forum posts, including mine. Now I understand that advertising probably goes a long way to generating the revenue that DaniWeb requires to remain operational. But I must say that I disapprove of these advertisements appearing on my posts for companies that I am not affiliated with. I have attached an example of what I am talking about, please at the very least create a profile option so that I can stop it from occurring on my posts!
Regards,
d
Ah the classic bane of many a programmer, lack of sleep. I find that a good cure for this is caffeine and lots of it :P Anyway, glad you found your problem. Happy programming!
Hi Asmodaii and welcome to DaniWeb,
You haven't really told us what you are after, but I think you are a bit confused by this section of the code because of your description:
public void fun(int[][] grid){
int row, col;
for (row = 0; row < NUM; row++){
for (col = 0; col < NUM; col++)
if ((grid[row][col] % 2) == 0){
grid[row][col] = 0;
}
}
}
}
It is actually saying for each row and column, that is for every value in the 2D Array, if the value is even set it to 0. If the value is odd, nothing happens to it. The less than 6 is because there are 6 rows and 6 columns, it doesn't affect the value of the item at row, column. Please let us know what question you would like answered or what you are trying to do...
Also, double check the spelling of your column names in the item table. The calls to $row etc must match the column names.
Hi Roybut,
First of all let me say there are no stupid questions, only those too stupid to ask. :)
Ok, now I have thought of a couple of things that could be happening here. First of all, are the two code snippets in separate php files? If so, have you included the first file in the second by a call to include or require? Also, is the get_item function a function inside a class? If so, it needs to be called by classname::get_item(...);
One way to check that your query is being created correctly is to put an echo statement immediately before the call to mysql_query, like so:
echo $query;
item_set = ... ;
This will tell you if your query is correct or not, just don't forget to remove the line later after you have finished debugging.
Anyway, this might be a start to helping you work out what is going on. Let us know if this hasn't fixed it.
Cheers,
d
About 50% of my job is in documentation and technical support. There are many help authoring tools out there and in general you get what you pay for. http://hat-matrix.com/ might be able to help you find one that suits your needs.
Personally I would recommend Adobe's RoboHelp (this is the tool that I use). It does all of the things you have listed and a whole lot more, but is kinda pricey. One of the best things about Adobe is their user community forums which I use frequently to help me with the use of RoboHelp. This link will give you an overview of RoboHelp and its features but it is written by Adobe and is more of a marketing brochure than a critique.
Anyways, hope this gives you a starting point.
Regards,
d
Looks like James, masijade and I all posted at the same time, and I forgot about the long type :$ Use that as masijade said.
Ah that's great, will give it a try. Thanks again VD! :)
Hi all,
Thanks for the great suggestions everyone, I think you have given me some great ideas on how to determine where in the image the player has clicked. Just on the idea of creating shapes on the image, any idea how to tell the coordinates of certain areas in an image? Is there a program that can tell me where in an image I am if I point to it with the mouse for example, or is it a trial and error type of deal?
Thanks again to everyone for your input. Have a great day! :)
Hi nanna,
Sorry to weigh in on this conversation at such a late stage, but I think I see your problem. The compiler is pointing you to it with the error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Ghu.personAdd(Ghu.java:142)
It is saying that something is calling a method on line 142 in the Ghu class, but that something is null. A null object (one that hasn't been instantiated properly) cannot call a method. In your case, the variable conn has not been created before the call to conn.prepareStatement(sql); on line 142. So you need to call your isConnected method before this call in order to create conn.
HTH,
darkagn
Hi keofua and welcome to DaniWeb :)
Can you post the error messages that you are getting please? That might help us to identify the problem.
Regards,
d
I think those methods belong in the Box class itself. For example,
private class Box {
private double length = 0.0;
private double width = 0.0;
private double height = 0.0;
public Box(double boxlen, double boxwid, double boxhei)
{
length = boxlen;
width = boxwid;
height = boxhei;
}
public void setLength(Double boxlen)
{
length = boxlen;
}
public double getLength()
{
return length;
}
public void setWidth(Double boxwid)
{
width = boxwid;
}
public double getWidth()
{
return width;
}
public void setHeight(Double boxhei)
{
height = boxhei;
}
public double getHeight()
{
return height;
}
public double getVolume()
{
return length * height * width;
}
}
After all, volume, surface area and total edge length are all properties of the Box, not of a Main.
Also notice that I have spelt double with a lower case 'd'. You are not using the class Double, but the primitive double, to store the values of height, width and length.
You can copy the data from one database to another, but the method depends on whether or not they are located on the same MSSQL Server instance. If they are, then you can qualify the database name like so:
SELECT * FROM active.dbo.CustomerList A
INNER JOIN temp.dbo.CustomerList T
ON A.PhoneNumber = T.PhoneNumber
This statement will select all rows in active's CustomerList table joined to the corresponding CustomerList record in the temp database. Inserting data into the temp database is similar, but using an INSERT statement instead.
HTH,
darkagn
Hi Designer_101,
This warning occurs when there is no connection to your mysql database setup properly. The actual call to mysql_query contains a second parameter which points to the mysql connection, and although this is an optional parameter, it causes problems if not included in the call explicitly if the connection to the database does not exist. You haven't supplied your connection call (to mysql_connect() ), so I think it must be done somewhere else in your code. Can you double check how you are connecting to the database?
Hi vimotaro,
Are you asking if you receive a record you want to update an existing one with the data in that received record? If so, you can do this quite easily by running a SELECT COUNT(*)
statement and seeing if this returns 1. If it does, run your UPDATE
statement.
If this wasn't what you were asking, please clarify your question for me and I will try to help further :)