Traevel 216 Light Poster

If you have plugins for a wordpress database I would consider using that. I'm not too familiar with wordpress/drupal/joomla but plugins are usually a good idea if your other option is to start from scratch. Chances are they already solved a lot of the issues you'd face when doing it yourself.

Design work..HTML,CSS - Twitter Bootstrap

I don't know if you have WP templates for that, in which case bootstrap might not be necessary. I was assuming ground up design and for speed and ease a framework would then help (I'm not much of a graphic designer so I tend to use those frameworks to avoid getting a programmers interface).

Login/Logout/Register..etc...PHP
Add to favorites..PHP

PHP to communicate with the database yes, so queries too.

You're probably going to need JavaScript libraries (for ease and speed, not necessity) for the common operations like retrieving form values, image zoom and so on.

Your plan sounds good and you've obviously put some thought into it with your friend, there is just one thing about what you said that sounds like a possible pitfall to me.

get the basics down, and if the site does take off, work from there

Keep in mind what you are making, a site where people go and find matches. In order to do that you'd need people, and if you want people to have matches you'd need quite a few in order for it to take off. Getting those …

Traevel 216 Light Poster

Well you're probably going to need several components worked out.

  1. A database where users, "items liked", images etc. are stored in, probably easiest to use phpMyAdmin for testing/developping.
  2. PHP code for simple interaction with the database, i.e. Create/Read/Update/Delete to have users manage their information.
  3. PHP code for account creation/management. Don't forget to handle passwords in a safer manner than just storing them in the database.
  4. PHP code to search through and show the matches from the database. You could prepare the queries using views in your database to avoid messy queries in PHP.
  5. Webpages with a clear layout (lots of dropdowns get confusing sooner than you might think, imagine doing 20 on a phone)
  6. PHP code / webpages for extra functions users will expect (i.e. saving their matches, browsing people the old fashioned way)

Some general thoughts/ideas that come to mind are

  • Make a list of all the expected functions (it sounds trivial, but you'll start forgetting things when tinkering on a little detail all week)
  • Put some extra thought in the database design from the start to prevent problems down the road (using the function list). How will you store images? How will you link people together? Do the liked items come from a database as well? Get it all figured out before you have the site finished and suddenly realize a person needs multiple matches and you have to start changing everything again
  • To save time on the site …
Traevel 216 Light Poster

But how will anyone know it was updated if you delete it first?

In case you meant delete or update, then

For update:

  1. Read the file line by line
  2. Manipulate the line
  3. Write back to file

For deletion:

  1. Read the file line by line
  2. Store the lines you want to keep
  3. Write those back to file

super secret shortcut for the above steps

In all seriousness though, seeing as your file isn't very big you could probably store every line in an array, manipulate/delete those and write each value back to a file, it's nothing fancy and plenty of information already exists. Especially since it's a very general question with hardly any specifics or prework.

Traevel 216 Light Poster

Well from the query results you posted it seemed like you only needed the MoveIn and MoveOut date, what you are doing now is inserting the entire row including all other values (which could also work).

If you just want the dates stored you could do this:

while($row = mysqli_fetch_array($result)){
    $values = array($row['MoveIn'],$row['MoveOut']);
    array_push($result_array,$values);
}

Then to retrieve both dates you'd have to loop over all results and for instance use $result_array[0][0] to get MoveIn and $result_array[0][1] to get MoveOut. (of course in the loop you'd substitute the first 0 with an iterator variable like $i)

If you want to store all values from your query (for instance if you need tennant number later on) you could do

while($row = mysqli_fetch_array($result)){
    array_push($result_array,$row);
}

Then you'd do the loop, same as option one, but retrieve the date values like $result_array[0]['MoveIn'] and $result_array[0]['MoveOut']. (same as before, in the loop first 0 becomes an iterator variable)

The $arr in my first example is now the $result_array in this example.

On a sidenote, it's common practice to either go with mysqli or PDO instead of the old mysql API to connect to your database.

Traevel 216 Light Poster

If you also mean the data should be stored in a database I would suggest following a CRUD tutorial. The twitter bootstrap part is optional, but comes with a ton of nifty pre-written CSS/HTML/JavaScript components.

If you just want to show the user the data in table form without storing it you could do it fairly easy using jQuery, specifically jQuery's after() function to insert a new row at the bottom.

Traevel 216 Light Poster

Not very familiar with VB, but comboboxes would probably not have a text attribute. From this I'd say try that clear again but with a capital C or setting control.ListIndex to -1, assuming you want to clear selection and not contents.

Traevel 216 Light Poster

Because of something missing in the //some code here part. You can do long[] newToken or long newToken[]to get an uninitialized array. long[] newToken[] would give you a multidimensional array. For instance:

long[] newToken = new long[] {123,456,789};
long oldToken[] = new long[] {987,654,321};
long[] midlifeToken[] = new long[2][2];
        midlifeToken[0][0] = 123;
        midlifeToken[0][1] = 234;
        midlifeToken[1][0] = 345;
        midlifeToken[1][1] = 456;


String[] tokens = new String[] { "token1", "token2", "token3" };

// newToken contains 123, 456 and 789
Faculty f = new Faculty(newToken, tokens[tokens.length - 1]);

// oldToken contains 987, 654 and 321
        f = new Faculty(oldToken, tokens[tokens.length - 1]);

// midlifeToken contains 123 and 234
        f = new Faculty(midlifeToken[0], tokens[tokens.length - 1]);
Traevel 216 Light Poster

You can use the DateTime::diff() function to get a DateInterval object which contains the time difference in properties.

For example:

$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $datetime1->diff($datetime2);

would get you a difference object in $interval. In order to get the days you would call the intervals format function. Something like $interval->format('%d days'); to get 2 days as a result.

For the second part of getting the begin and end dates you could do something along the lines of

$arr[0] = array("2012-12-28","2013-04-13");
$arr[1] = array("2013-05-01","2014-09-30");
$arr[2] = array("2014-10-03",NULL);

$it = 0;
while($it<count($arr)){

    // if neither begin and end are NULL 
    if($arr[$it][1]!= null & $arr[$it+1][0]!=null){

        $datetime1 = new DateTime($arr[$it][1]);
        $datetime2 = new DateTime($arr[$it+1][0]);

        $diff = $datetime1->diff($datetime2);

        echo "Difference between ".$datetime1->format("Y-m-d")." and ".$datetime2->format("Y-m-d")." = " . $diff->format("%d days") . "<br/>";

    }
    $it++;
}

which will print

//Difference between 2013-04-13 and 2013-05-01 = 18 days
//Difference between 2014-09-30 and 2014-10-03 = 3 days

Note that for edge cases (i.e. begin or end is NULL or end lies before begin) the difference will not be calculated correctly so you'll want to alter this snippet to better reflect that. For instance if the end date is NULL you could substitute that with today's date.

Traevel 216 Light Poster

That's because Contains checks for an exact occurrence of the substring. I'm not very familiar with VB.NET so I'm sure there are better solutions out there than the ones I'm posting, especially length and time wise. But the problem itself could be solved in several ways (not a complete list nor in any particular order):

  • Sort both numerical strings, then compare
  • Count the numbers 0-9 in n1 and again for n2 and see if the amounts match

For non numbers as well:

  • Split both and iterate over all characters, check if a character from n1 occurs in n2, if it does remove from both arrays, if you have residual characters in either the strings do not match
  • Similarly you could take n1, iterate over each character and remove a single occurrence of that character from n2, if n2 has characters left it is not a match

By checking for edge cases beforehand you can shorten the running time of whichever method you decide to pick. Check for null and empty strings. If the strings are not the same length they can't match. If you do numeric operations have it return on a conversion error (i.e. String is not a number).

You can use these 30 String operations as a reference on how to do some of the above.

Similar reference for sorting in VB.NET.

ddanbe commented: Nice! +15
Traevel 216 Light Poster

Could it be that when you're showing the top time from top5Time in render() that you haven't read the new data from the file yet? A part of the code seems missing so it's hard to tell, but when you are setting the high score with HeighScoreState() you are not updating the top5Time array which you are using in render() to show the score.

Perhaps if you changed the file updating part to also update the top5Time...

 // save data in file
for (int i = 0; i < top5Time.length; i++) {
    if (top5Time[i] == 0) {
        MyGdxGame.settings.putLong(key[i], newTime);

        // new
        top5Time[i]=newTime;

        break;
    } else if (newTime <= top5Time[i]) {
        MyGdxGame.settings.putLong(key[i], newTime);

        // new
        top5Time[i]=newTime;

        break;
    }
}

..it would be able to access the new time in the render() method without having to reload the preference file.

Traevel 216 Light Poster

It's working fine here. I can however reproduce that exact print by renaming the php file to html. PHP code can't be inserted into an html file, you'll have to make it a php file instead (in other words, rename it so the file ends on .php).

Keep in mind that php files need to be run on a server. An easily configurable one like XAMPP for instance.

Traevel 216 Light Poster

If you just reinstalled and you think there's something on it then reinstall again.

If by "something called Crypto" you mean CryptoLocker then the key that was used to encrypt your files may have been recovered during Operation Tovar. You can check the FireEye and Fox-IT page for instructions on getting the key that was used to encrypt your files.

But if it's all the same to you; wiping, reinstalling and not downloading anything fishy is your safest option.

Traevel 216 Light Poster

The alert is triggering, are you getting a response at all on that ajax? One of the more common problems is making cross-domain ajax calls. Try running your pages from a (i.e. both pages on the same) server (localhost will do) and see if the problem persists. If you want to allow cross-domain requests from the asp side you could read this article.

At least that should give you an idea whether the problem lies with the ajax call or if it's something on that asp page.

Traevel 216 Light Poster

If you could slide several at a time, as if it were a single image, I'd suggest using twitter bootstrap and its carousel; never been easier.

If you need multiple images sliding one at a time there are several jQuery plugins you could use, for instance jCarousel which lets you set the number of elements.

Traevel 216 Light Poster

Passwords shouldn't be stored in the database at all, nor should it be allowed to check if passwords exist.

Usernames are a different story. You could check your db for the entered name (triggered on focus lost or something) and warn the user that the name is taken. The only way of being 100% sure there is only one username is by enforcing a UNIQUE key on the table and catching the exception if the entry is not unique. Otherwise it could still be possible to get a duplicate in, for instance inbetween the check and the actual entry.

Traevel 216 Light Poster

Try a tool that's on a bootable drive/CD, less chance of overwriting the old files since it won't use the hard drive. There are plenty of linux options, but if you'd rather have something similar to windows you could try UBCD4win (follow instructions and burn using a different computer, then insert and run on your laptop).

It's similar to windows XP in look and feel and by default it has a couple of undelete/recovery tools available in its toolbox. It's not the most recent of tools, but it's fairly straightforward.

Traevel 216 Light Poster

Since if (!old.Contains("Designator")) will skip the header line it will not be included in the new output that you build in outputText += String.Join("\t", newTokens) + Environment.NewLine;.

You could add it separately in the else, something like:

 if (!old.Contains("Designator")){

    // Split by \t (tab) and remove blank space
    var tokens = value.Select(x => x.Trim());

    // Take first 6 tokens (0 to 5)
    var newTokens = tokens.Take(6);

    // my top header column is getting deleted
    outputText += String.Join("\t", newTokens) + Environment.NewLine;
}else{
    // append header
    outputText += old + Environment.NewLine;
}

Although I'd think that if you are removing the entire column you might as well remove the header. Then there wouldn't be a need to handle the header differently, just have its last column deleted as well.

Traevel 216 Light Poster

You could use max() to set a bottom limit of 0.

$tplaunch = max(0,($tplaunch - $tpsold));

Traevel 216 Light Poster

Check Antonio Conte's posts on here. #7 might be close to what you want as far as generating goes.

Traevel 216 Light Poster

You'll want to define a foreign key constraint on the acc1 and acc2 tables with a reference to the movie id.

Something along the likes of

CREATE TABLE MovieList(
    id int NOT NULL,
    title varchar(255) NOT NULL,
    PRIMARY KEY(id)
)

CREATE TABLE acc1_mywatchlist(
    movie_id int NOT NULL,
    FOREIGN KEY(movie_id) REFERENCES MovieList(id)
)

It's common to use numerical id's as keys since you require a unique reference, imagine what would happen to your table relations if it allowed two movies to share the same title.

To answer the second part, if you want the tables with the foreign keys to update you can add ON UPDATE CASCADE or ON UPDATE RESTRICT. The same goes for deletion ON DELETE RESTRICT or ON DELETE CASCADE. So for instance

CREATE TABLE acc1_mywatchlist(
    movie_id int NOT NULL,
    FOREIGN KEY(movie_id) REFERENCES MovieList(id) ON UPDATE CASCADE ON DELETE RESTRICT
)

to allow updates of the constraint but to restrict deletion. In other words when there are still movies on a watchlist you can not delete the movie entry in MovieList. If you however wanted to change the key number (even though that's not good practice) it would be changed in the acc1 table as well.

However, working with numerical keys has the advantage that changes to the MovieList table would have far less of an effect on the watchlist tables. After all, if it's using the numerical key as reference and not the title you can change the title and the …

Traevel 216 Light Poster

Well you never seem to set the hours_worked to anything other than 0.

Also, keep in mind that when you write

if(hours_worked == 40 * 120)
    total_deductions = calGrossF(gross_pay, deductions);
    extra_time = calGrossH(hours_worked, pay_rate);
    totalsales = calGrossC(fixed_salary, commission);

It will be interpreted as

if(hours_worked == 40 * 120){
    total_deductions = calGrossF(gross_pay, deductions);
}
extra_time = calGrossH(hours_worked, pay_rate);
totalsales = calGrossC(fixed_salary, commission);

So extra_time will always be calculated even when hours_worked is not equal to 40*120. Which is never the case since hours_worked is set to 0 and never changes. I assume you'll want the user to set the hours before the calculations start and go from there.

Traevel 216 Light Poster

Aside from the usage of pete, the compiling issue could just be the missing { after public class ICMA42.

Traevel 216 Light Poster

Apart from the Hide() it's working here. You're making a clone of clone though, and var target = $(".guests-tbody"); is technically a list of elements, so it will append to all the elements with that class. Not sure if clone.attr('id','style', ''); is doing what you think it's doing; it sets id to "style". You could use clone.attr({"id":"","style":""}); instead if you want id and style attributes empty for the clone.

Traevel 216 Light Poster

Well the whole purpose of Entity Framework is to stop writing data-access code, so I wouldn't do that. Basically the only queries you want to write are things like:

List<Products> cheapProducts = repository.Products.Where(p => p.Price < 50).ToList();

And not queries to get the entire dataset, that's what EF is for. I'm not familiar with such initializers myself, and as you yourself mentioned, what's the point of having it when you're hardcoding products. However, I don't think that your information at runtime is coming from those hardcoded products. The initializer is run once (not just on every start, but once entirely), it adds the hardcoded information to the database, and from that moment on it uses the database. There's a big warning somewhere in the third tutorial about making changes to the initializer and how they will probably not work after running the first time. The reason they are using it I imagine is because of the code first approach. In other words, Entity Framework creates the database based on the models. The other way around is DB first; EF creates the model based on the database.

In your ItemContext you have a DbSet<CartItem> ShoppingCartItems (a database set of cartitems). When you call the Add() method on that, you're basically telling EF to add that CartItem to your database. It doesn't do so right away, you have to call SaveChanges() on your context first, which you do at the bottom _db.SaveChanges();. However, it might never even get there because EF …

Traevel 216 Light Poster

You could request the Graphics object from the super class (in this case, the jPanel you're drawing on). But you have be sure that it's not null. In other words, you can't draw the balls until the jPanel has a Graphics object to return. Also, you will have to move updateball to a position after the repaint method or the balls will never stay visible long enough for you to see.

        public void updatePosition(){
            xPos += 1;
            yPos += 0;

            if((xPos%2)==0){
                arcMouth=360;
            }
            else{
                arcMouth=300;
            }
        repaint();
        updateball();
        }

        public void updateball(){
            for(Balls b:listball){
                b.moveBalls();
                if(super.getGraphics()!=null){
                    b.drawballs(super.getGraphics());
                }
            }
        }

I don't know if it's more efficient though. I mean it makes sense to keep it in paintComponent since you're also drawing other stuff there. And it's all on the same panel anyway.

Traevel 216 Light Poster

I don't know what your goal is, but what I'm seeing is a blue rectangle moving away from pacman yes. It could be that there are 10 balls that all start in the same spot moving at the same pace, judging from what I'm seeing in your constructor though.

Traevel 216 Light Poster

You mean behind in drawing position? If I run your code now the balls are not moving and it just draws a rectangle at the first coordinate position. Which is the same as the top-left corner of your pacman.

If you read the javadoc of fillArc:

x - the x coordinate of the upper-left corner of the arc to be filled. 
y - the y coordinate of the upper-left corner of the arc to be filled.
width - the width of the arc to be filled.
height - the height of the arc to be filled.
startAngle - the beginning angle.
arcAngle - the angular extent of the arc, relative to the start angle.

So the x and y are for upper-left corner of the arc. If you want the rectangle to appear in front of the pacman you'll have to adjust the x and y you give to the ball upon creation. Probably something along the lines of current pacman x + pacman width + however far in front you want it to be.

Traevel 216 Light Poster

If you don't extend Balls to a jComponent, then no you can't use that method in that manner.

Traevel 216 Light Poster

Because Balls does not extend jPanel (more specifically, a jComponent). You're overriding the method paintComponent in the super class.

If you add @Override above that method in the Mypanel class, and hover over it you will see the following information:

Overrides: paintComponent(...) in JComponent
paintComponent
protected void paintComponent(Graphics g)
Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate). 
If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoker super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in a non-opaque color. If you do not honor the opaque property you will likely see visual artifacts. 

The passed in Graphics object might have a transform other than the identify transform installed on it. In this case, you might get unexpected results if you cumulatively apply another transform.

Parameters:
g - the Graphics object to protect
See Also:
paint(java.awt.Graphics), ComponentUI

So it's a method you're overriding, that means it has to be present in the super class. Balls …

Traevel 216 Light Poster

Placing outside of both will make it update at the same pace, if that's what you meant with being behind yes.

if((xPos%2)==0){
    arcMouth=360;
}
else{
    arcMouth=300;
}
updateball();
pacmanball.moveBalls();

Duplicating code is something you should avoid at all costs. It makes it hard to implement changes.

Traevel 216 Light Poster

If by behind you mean they don't get updated at the same pace as pacman it's because you're only updating the balls when pacman has its mouth open.

Traevel 216 Light Poster

For a fun, practical way to get started with neural networks (or other types of machine learning) you could have a look at NetLogo. It's a modelling environment in which you can create and run a ton of different kinds of simulations. It has a large sample library, which includes some ANN examples as well. It's based on a simple programming language where you can easily add/adjust the simulation, but also add GUI controls for easy adjustment of your variable values while running the model. You can also create graphs and plots for a good overview of what's happening in your simulation.

It won't drive a car for you, but it'll give you a way to expirement and perhaps gain some more insight in the matter.

Traevel 216 Light Poster

You're not adding any balls.

for(Balls bb:ball){
    ball.add(new Balls(xPos,yPos));
}

That means: for each ball in the list of balls, add a new ball. The list is empty at first, so how can it ever add new balls this way?

Furthermore, apart from the terribly confusing naming for balls and lists of balls, you call updateball to add balls every few ticks, then you tell one ball, ballc, to move. But that ballc is never set with any info, and it's not a list of balls, even though the type Balls would suggest that has more than one. Lastly, I don't see drawbullets ever being called. And even if it were called, where would it draw its rectangles?

What you need to do is set an amount of balls at the start of the game, draw them. Then when the game starts running; on every tick, or every other tick, you update their position and redraw the balls on their new position, this probably also means you'll have to remove the old drawing of them, or use a way of painting similar to the pacman, or on the same panel as pacman. You could (as an easy beginning) clear the entire panel, and redraw pacman and the balls on that every tick.

And I'd strongly suggest using proper names for your entities and lists, you even seem to be confusing yourself when updating the Balls class instead of a list of balls. To safely change names of variables …

Traevel 216 Light Poster

EF is Entity Framework, and on top of that tutorial page it does say:

Code features in this tutorial: Entity Framework Code First

In the part where you create a new cart item, did the following give you problems?

Product = _db.Products.SingleOrDefault(
           p => p.ProductID == id),

Because that should add the product as a reference to the cartitem, you would then be able to refer to product price/name as cartItem.Product.Price or cartItem.Product.ProductPrice depending on whatever it's called in the class (and/or database).

The code in the tutorial is based on earlier tutorials according to this:

Earlier in this tutorial series, you added pages and code to view product data from a database.

So the code is written based on the assumption that you are getting your information from a database. In other words, it might be trying to find your new columns in a database that was created in an earlier tutorial, since you are using the context class _db. Even if the data is from dummy info, it is still trying to save the information into a database via the context. If the class CartItem you made does not match the CartItem in the database (where it's trying to store your cartitem in the cartitem(s) table) it will throw an error, since you're trying to store data it can't fit in anywhere. The product has a price and name, but cartitem does not, it only has a product.

Again, this is based on …

PsychicTide commented: Thank you for the insight! +4
Traevel 216 Light Poster

Are you using Entity Framework? It sounds like a database issue, not a code issue. Double check your names and objects. The variables in the objects need to have the same name as the database objects if you haven't remapped them.

It seems to me like it's looking for a column named ProductPrice in your database object Product. It could also be that EF renamed renamed/pluralized your tables, so that it's now named Products. EF will also create the object classes (they might not show up in your editor), so it could have connected different classes (with the same name perhaps) to your database then the ones you wrote yourself.

If you're not using Entity Framework it might be an idea to look at it.

Traevel 216 Light Poster

You could use System.out.format to achieve that result. It requires a format string and variables.

A format string is built up as follows.

String contentFormat = "%-15s %-8d %-15s %n";

In the %-15s for instance: a % indicates a new "column". The - means that writing starts from the left, the 15 means it will have a total of 15 characters in width which it will try to fill with your data, the s means that the input type will be a string. It's the same for %-8d with the difference being the d which stands for digit. The %n is a newline). The spaces (or any other characters) you put in will be printed normally. So in this case you have a "column" for strings that is 15 characters in width, then a whitespace, then an 8 character wide column for digits, another whitespace, then a 15 width string again, followed by a space, then a newline.

For the actual print command you would then use something like:

 System.out.format(contentFormat, "A", 1, "$9,00");

First part is the format string variable, the other parameters are your values (they must be in the same type and order as specified in the format string, also the total amount of variables must be the same as in the format string).

Since your title has different types of variables you could write two different formats, one for the title and one for the content. Something like:

String contentFormat = …
DawnofanewEra commented: Exactly +0
Traevel 216 Light Poster

You could look at the firebug console by pressing the bug (F12 brings that one up for me). An alternative console could be ctrl-shift-j. Which button can't be pressed? You said the alert works, so that button is working then I take it. Do you mean it won't submit the form?

Traevel 216 Light Poster
echo round(((47.60 * 554.82) / 100), 2);

Gives me 264.09, you're rounding on two decimals so it will never be 264, but it shouldn't give you 263.7 either.

However, if you do (47.60 * 554) / 100) (and not 554.82) you will get 263.704. So my guess is that by using the direct database value (perhaps it's a string and not a float) the conversion PHP makes is off because of the comma that's probably in there. You'll have to replace the , with a . first, then for safety use floatvar($string) or (float) $string to cast it, then use it in your calculation. Also, be careful if your database numbers have comma's as a thousand separator in them (but I'm unsure if that is common when the comma is also the decimal separator). If you do have thousand separators it would be safer to keep the numbers without comma's in your database and then use number_fomat for instance to make them readable.

Traevel 216 Light Poster

It's working fine here, after adding

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

above your script. Did you include jQuery on your page?

The $.trim() method is working as well, I get the alert when leaving the field blank and also after entering a series of whitespaces.

Word of warning, if you were to move your script to the header of the page (in other words, place the button below the script) the handler will not bind because the element doesn't exist yet at the time of execution. In that case you'd have to make sure the document is ready.

Traevel 216 Light Poster

Your table is being echoed in a while loop though, so it's not impossible to have it show up more than once, if there is more than one item in the array.

$sqle = "select * from helpconfig where cid = '1'";
if ( !( $resulte = mysql_query( $sqle ) ) )
{
exit( mysql_error( ) );
}
while ( $rowe = mysql_fetch_array( $resulte ) )
{
    //table building

Does that part really return one result?

FYI, about the mysql_fetch_array you're using:

Warning

This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:

    mysqli_fetch_array()
    PDOStatement::fetch()
Traevel 216 Light Poster

You have a CartItem object with a ProductId, a ProductName, a ProductPrice ..and a Product? Could it be that you are mixing your CartItem and Product entities? That you are looking for a ProductName in CartItem when CartItem only has a reference to ProductId in Product?

What would be the purpose of a ProductName and ProductPrice in a CartItem if CartItem already contains the entire Product. Or do you get the name/price from the Product object inside the CartItem with those two methods GetName(id) and GetPrice(id)?

Traevel 216 Light Poster

There's not a lot of documentation on snacktime that I can find, but there are similar programs out there and a lot of helper methods like calculate heading/bearing of yourself and opponents are described, but I agree that you might not need the angle. The robot has no front or back so for all you care it shuffles sideways towards the snack. However, something that I know has tutorials for heading/bearing, speed, energy calculation, opponent tracking and so forth is Robocode so you might want to look there for inspiration as well.

For instance here is a discussion on point to point movement for Robocode.

And here would be an implementation of linear targeting, except you wouldn't be shooting at something but walking towards it.

If there is no opponent I can see why you would want to start with the farthest snack, but if new food items pop up you'll always end up travelling the furthest possible distance for the next snack. Unless you accidentaly bump into one I suppose. If you have the coordinates to the snack furthest away you could calculate a linear path towards those coords and adjust them based on the max length you can still travel (I'm guessing from your reply that the move() method won't adjust the coords to the max travel distance for you), then return them as new coords.

Perhaps this is of more help to you on that.

ps. Links seem to …

Traevel 216 Light Poster

Do you validate the input in setters themselves? Or in separate validation methods? If so you could do something along the lines of:

try{
    record.setName(name);
}catch(YourException e){
    //input not valid
}

for each input item, but that would not work if you want the user to be able to re-enter the information that was invalid without starting over. You could use a do/while loop on each item to keep asking for user input until it's valid though. Something like:

boolean firstNameValid = false;
do{
    System.out.println( "Please enter first name:" );
    String firstName = scanner.nextLine();
    try{
        record.setName(firstName); 
        firstNameValid = true; 
    }catch(YourException e){
        //inform user of error
    }
}while(!firstNameValid);

This is assuming your error is thrown by the setter. Since validation is there for a reason (i.e. users often give incorrect information) it might be debatable whether or not errors/exceptions are the right way to go. You could for instance have the setters return true/false when the setting has succeeded/failed, and work with that in your do/while loop.

Can't really help you with the writing error if there's no code about it. Your custom exception probably caught the original exception that was thrown and gave you that non-informative message (the original ones are there for a reason too, they tell you why and where it went wrong).

Traevel 216 Light Poster

You can validate the user input before creating the object. Store the inputs in variables, validate them as they come in (so you can warn the user and have him/her retry). Then when you have all the info you can create the Customer object and pass all the input as parameters in a constructor or separately through setters.

As far as the last line goes, not really sure what error you mean, the code is incomplete. It doesn't tell what type newFile is, is it an ObjectOutputStream? Did you initialize the variable newFile? And if so, is Customer implementing Serializable?

From the documentation:

 FileOutputStream fos = new FileOutputStream("t.tmp");
 ObjectOutputStream oos = new ObjectOutputStream(fos);

 oos.writeInt(12345);
 oos.writeObject("Today");
 oos.writeObject(new Date());

 oos.close();

ObjectOutputStream
Serializable

Traevel 216 Light Poster

Not familiar with the game, but it sounds fun. If you're not feeling at home with java perhaps try a simple solution first, like heading towards the one with the highest calories. Once that works you can implement better solutions.

I noticed on the video that whenever a food item gets eaten a new one pops up randomly. There are some things that come to mind after watching, maybe they'll be of help.

Keep track of your opponent, where he is and how fast he is going. Which food items can you reach before he could. Perhaps there are clusters of food items, those would be favorable over a lone (distant) single item. But what if it's a close one, or the last one in the cluster. Maybe plan ahead as well, how will an item affect my speed, will the move limit be hit before I reach it. If my opponent is lower in energy than I am perhaps I should follow a different strategy than when he is higher. If he's higher he's also slower, perhaps I can steal some food items away from a cluster he's heading to.

I guess you can make it as complex as you'd like, but I'd still start simple and build from there. From what I saw you need to implement a move() method that has a list of items/players with their coords and energy. I'd start by making some helper methods that you'll need often. One that calculates the distance to …

Traevel 216 Light Poster

Ok, I'm not really familiar with ADO myself but as far as the top and left coordinates go I'm not really sure what you mean. You have a jpg map and a draggable cursor, but want zoom in/out to alter the map size? If you do have fixed sized maps, i.e. 500x500 pixels it would probably be easier to have the top/left values depend on the position of the cursor on the picture and not the window position of the marker.

For instance, the office is a square that starts at x=10 and y=10 and ends at x=20 and y=20. If the marker would be on x=15 and y=15 it would be pinned into the office. Its position on the screen could be x=1015, y=1015 but that wouldn't matter. If you made the cursor draggable only within the area of your picture the user wouldn't be able to select a location that's not on the map. You would just need a large list of coordinates.

But wouldn't it be easier to simply highlight a part of the map? Or make areas clickable? That way you'd only need an image (or several if you want different sizes) and an html <map> (for each map image) and wouldn't have the hassle of reading and setting draggable cursors on screen positions based on coordinates from a database. There are plenty of generators for maps out there I'm sure, so you'd only have to draw around all the areas on the map you want …

Traevel 216 Light Poster

You could give jsTree a look:
Click Here

It has a move_node event which contains old parent and old position information and a move_node method which you could use to move nodes programmatically.

Might be easier to modify the existing code to suit your needs instead of writing it entirely from scratch.

Traevel 216 Light Poster

You could post the data to your controller using JSON, then save it to a database using an SQL connection.
Click Here

You might also want to look into the Entity Framework if you're looking for easier binding between your model and your database, if you don't like using jQuery a lot.
Click Here

Though I suppose you'd still have to handle the selection options with jQuery/Razor etc.

Traevel 216 Light Poster

Well that depends on what you want to achieve. Create an empty constructor (which will leave you with the possibility of workers that have no information) or supply values when creating the instance, for instance dummy/default values until a user has had a chance to provide the information. Or you could store the information the user provides in variables and not create a Worker instance until all the information is present (and depending on the assignment, valid).

Traevel 216 Light Poster

If you are using an IDE like Eclipse or Netbeans you can see that, by simply hovering over line 68, the error reads "The constructor Worker() is undefined". It means that you do not have an empty constructor in your Worker class. You only have one that requires paramaters: public Worker(int h, double r, String name, String title).