sDJh 39 Posting Whiz in Training

I wouldn't.
Simply increase a counter by one each time a valid number is entered and add this value to a variable sum. After the loop you can divide the sum by the counter and you get your result.
This will be faster and lighter on ram.

sDJh 39 Posting Whiz in Training

Well these tools basically do a certain task and messure how fast it can be acomplished.

But these tasks are not that easy to make up. You have a lot of statistical invarieties, you have driver-issues you have to ensure the OS gives you the needed privileges and so on.

If you want to do it for yourself, or for school/university, you can get some reliable results. But I wouldn't hope to write a software as good as an established benchmark.

sDJh 39 Posting Whiz in Training

It'd be good when you post the whole error message including line-numbers etc. Otherwise finding the error is like finding the needle in a haystack.

sDJh 39 Posting Whiz in Training

what have you then been looking for?

1. in your posted file you need the attribute "name" in all of your <select>-tags. this makes php reefer to that value.
2. in the file search_result.php you do something like this:

<?php
$destination=$_REQUEST["destination"];    //your array passed to your file
$year=$_REQUEST["year"];                  // -"-
$r=mysql_query("SELECT * FROM ... WHERE `destination`='".$destination."' AND ` year`=".$year);
?>

you can then output your data with mysql_fetcharray or something similar.
You may want to vary your boolean logic in the mysql-statement.

sDJh 39 Posting Whiz in Training

@ardav: that doesn't necessarily help either. You don't know if "drink" really is an array.
Additionally, I'd suggest to check that as well:

...
if(isset($_POST['drink'])) {
	$drinks = $_POST['drink'];
	if(is_array($drinks) && count($drinks)>=2){
	...

then you can be sure not run into a memory leak.

cu, Simon

diafol commented: good spot +14
sDJh 39 Posting Whiz in Training

Visual Basic? Hey guy, you're in an Apple-world now!

jingda commented: Correct:) +10
sDJh 39 Posting Whiz in Training

Yes, they can. You can actually do all stuff Google has done in their products apart from dynamically changing the content of your webpage without reload. You then need to work with JavaScript.

sDJh 39 Posting Whiz in Training
faroukmuhammad commented: thats what i 've in mind +4
sDJh 39 Posting Whiz in Training

This definitely is a case for replacing some part of the hardware. I can't guarantee you anything - I don't know how long you own the computer. But apple should do it for free or do it for quite little money. I bet it's worth going to the apple store.

sDJh 39 Posting Whiz in Training

I once had that problem as well with my USB-Stick. I managed to get it working again under Linux. Try to format your storage there and even if it's not working you may can then format it under Mac.

Did work for me that time.

sDJh 39 Posting Whiz in Training

I definitely have to contradict you! There's nothing that I hate more than giving people wrong advice, especially if these kind of person don't seem to have a single clue what they are talking about! And on top of that: Why not protecting if it's so simple as today?

@all: Always, but really always protect your computer! Don't discuss whether you have Windows, Mac, Linux, ChromeOS or any system that comes up in the future running. Every Operating System does have vulnerabilities in the source-code. And every operating system can be attacked by hackers and viruses.

Also remember: even the best antivirus-software doesn't give you an absolute protection. Always be careful what programmes you install and who you let work with your computer. So the best thing is to keep these 4 guidelines in mind:

1. Always create TWO accounts! First one as administrator (or root under Linux) with a very strong password and DON'T use it. This account is just for changing the preferences of the system. And try not to be online while using it.
The second one is your normal account that you use for office, web and whatever you do. In 1 out of 50 days you don't even have to login with the administrator password.

2. Activate the firewall and install a virus-software! Maybe your computer will never be attacked by hackers because they can't modify your system as you work with your second account. But maybe a bug in …

Danarchy commented: Poster knows of what he speaks. 2 of my browsers got hijacked so it does and will happen. +7
sDJh 39 Posting Whiz in Training

You men the voice that reads the text on the screen? I don't know which version of MacOS you have, but try "/Applications/Utilities/VoiceOver Utility.app". There you can unchek the option.

Hope that helps.

sDJh 39 Posting Whiz in Training

I always suggest: Just because you don't use Windows it doesn't mean, you don't have to bother about antivirus software, firewall and system upgrades! Every code, even written under Steve Jobs, is somewhere buggy, every developer will forget about a security issue, and it just a matter of time until someone who is interested in demolishing a system will find it out.
When you care about your system, actually every OS is secured. I just believe, that MacOS is in the moment, the one that you have to care at least about. But that never means, you don't have to at all!

sDJh 39 Posting Whiz in Training

Unfortunately, PHP does handle a couple of request parallel. As I don't know exactly what these data are for, I can suppose two ideas for updating the database:

1. Lock it!
Add a new field called "inuse" or "locked" that you mark with 1 before you do all the calculation. At the end of your script you update the coulm and set it back to "0". When the second user executes the script and the column is still marked with "1" the script stops and reloads after one or two seconds.
This possibility does slow your execution down, of course.

2. Make different rows!
When the calculated data is just for player only (no global variables) you can simply add a column to the table that saves an unique ID of the player. Then you can check with each update, that only the row of the player is changed. But this just works, when the data are not important to the next player.

Hope that helped. If not, try to give a more detailed description of your problem.

Greetings
Simon

sDJh 39 Posting Whiz in Training

seems to me as if you have an empty line at the beginning of your code. Make sure that the php-tag "<?" starts directly at the beginning of your file, that all code that you include before don't echo anything and no echo or print is used in your file before your start your session. In this case it really seems to be a line break at the beginning of the file.

scru commented: That is correct +3
sDJh 39 Posting Whiz in Training

I can agree on that. Basically every computer can get a virus (which is nothing else than a normal programme). Theoretically you can crash your computer by installing good software (Photoshop, Cinema, iLife, etc). But who buys viruses on CD? You can get them only within spam-mails or unserious server. With normal respect and healthy distance to programmes that you don't know you shouldn't get in trouble.

Any changes on the Mac OS environment has to be accepted by the user with the admin-password. Application cannot be started on its own by simply loading them in you browser cache (as it works in Outlook an IE for some very strange reasons). So as long as you don't loin as admin or simply install everything you find in a spam-email there shouldn't be a problem with your system at all.

In my opinion MacOS is the most stable and save OS that is currently available. The problems it had in version 7&8 are totaly banned. Apple has the quickest Update-Service (Linux unfortunately the poorest one). So as soom as a problem is reported the work on a patch begins - in normal case you shouldn't even get in touch with the bug at all.

Greetings
Simon

sDJh 39 Posting Whiz in Training

When accessing a database in PHP you first don't have to bother of whom the data might belong to. You can access all of them and sort out which of them is available for the user and which of them not.

Example
The database for the user looks like this:

ID  Name
1   gpdrums
2   sDJh

Now you need a connection to your files. This looks something this that:

ID  Name         User
100 coffee.pdf  1     ;which is for you
101 tea.odt      2         ;which is for me (I prefer tea =))

Thirdly you need a folder to save your files in. Create one and set a .htacces to it, so that noone can access it via HTTP. Save the files with the fileid only, eg "100" for coffee.pdf.

Now write a PHP-code that does the following:
- user logs in and you find the ID (you=1)
- access the db and just fetch just the columns where the `user` is 1 (you)
- print all these files.

Now you hav a very simple but working fronted.

Secondly, write an output for the files, because you want to restrict it with PHP:
- again check the SESSION/COOKIE for the userid
- check if the file the user wants to download has the permission.
- if yes:

header("Content-Type: mime");   //<- modifies the header so that the browser believes it is a file
header("Content-Length: ".filesize($file));
@readfile($file);   //<- outputs the complete content of the …
gpdrums commented: very helpful - thank you for the generosity and hospitality +1