Simon Tite 15 Light Poster

ya the id field was a given in my head. i just forgot to write it.

all the code you see there is the only thing in that file. so i know its not turning it to upper-case.

How do you know, have you tried it? (put the field names in quotes, that is).

Simon Tite 15 Light Poster

Well no, of course I didn't want the schema for the whole db! :) - that snippet is fine, I just wanted to be sure that your query was updating a field which did indeed exist on the database. That snippet was fine.

So the query looks valid, the next thing to try is paste it into phpMyAdmin, and see what the result is.

And another thing you could try, put the field name in single quotes, i.e. $query2 = "UPDATE properties SET '$imagenum'='$filename' WHERE id='$id'"; - it's possible that something along the line from your PHP code to the MySql engine is converting the field name to upper-case.

Additional thought - I don't see the field "id" in the schema....

Simon Tite 15 Light Poster

It would be easier to help you if you could give me the following information: What is the actual value of the query just before you sent it to MySql?

From your previous postings, I'm guessing that the error occurs at line 25 above. Insert after line 25 the code print("<br /><pre>$query2</pre><br />"); then post back the result.

Also, the database schema of the properties table might be of use.

Simon Tite 15 Light Poster

.the problem is it doesnt accept two varaibles
it should be one constant to - it

Completely untrue.

From the MySql manual:

DATEDIFF(expr1,expr2)

DATEDIFF() returns expr1 – expr2 expressed as a value in days from one date to the other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.
mysql> SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
-> 1
mysql> SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');
-> -31

The manual insists on 2 variables, the example I gave works. Paste the examples given by the MySql manual into phpmyadman, and you will see that it works. Oh, and make sure you type DATEDIFF in capitals.

The examples you have given contain (at least) three errors:-
* DateDiff instead of DATEDIFF
* First example has subtraction of two DateDiff functions, each containing 3 parameters. Should be one DATEDIFF function, containg two dates. No need to perform a subtraction yourself.
* Second example has one DateDiff function with one parameter.

If the correct way does not work, then your problem is not with the DATEDIFF function, but something else.

Simon Tite 15 Light Poster
Simon Tite 15 Light Poster

Sounds to me like an HTML problem, if you can see the characters correctly in, say, phpadmin, that would mean that the database is storing and retrieving them correctly.

Your HTML code has to tell the browser which character set it is using, a line in the <head> section such as this

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

might help. (the xhtml+xml bit may not be applicable to your site, you may have to investigate the alternatives).

Of course, if your site is already correctly displaying utf-8 characters (characters which did not come from mySql), then probably the html is not at fault...

Simon Tite 15 Light Poster

I would be curious to see other values returned from the database, that is in the user_login function, before loading up the $_SESSION, do a dump of $user:

print("<pre>");
var_dump($user);
print("</pre>");

and then maybe something similar in the case 0: block of the second snippet for the $_SESSION variable.

print("<pre>");
var_dump($_SESSION);
print("</pre>");

(For brevity, you could omit the md5 codes and other fields which are not mentioned in your post, if you decide to post it here).

Simon Tite 15 Light Poster

Additional thought: you said that the error came from phpadmin, in which case you must have pasted into it the whole line starting from $query= ....

That makes no sense, as phpmyadmin has no knowledge of your PHP code. What you need to paste into phpmyadmin is the contents of the string $query, the actual contents just before you call the statement $result = mysql_query($query);

Simon Tite 15 Light Poster

it is spelled right thats the problem.

confirm this by printing out the contents of $query to the screen.

I imagine that you are expecting to see the variables $imagenum, $filename and $id to be expanded to their current contents (and I would expect so too), which means that you should see that $query contains something like UPDATE properties SET NNNN='FFF' WHERE ID='III' - this is assuming $imagenum contains "NNNN", $filename contains "FFF" and $id contains "III".

If the contents of $query then seem to be correct, paste it into phpadmin and see what result you get.

The error message you have shown seems to imply that you are sending the text $query = "UPDATE properties SET $imagenum='$filename' WHERE id='$id' " directly to the MySQL engine. Clearly this is not what you want.

Simon Tite 15 Light Poster

After setting $query, print its value to the screen, so you can see if it is correct. If it looks correct, copy and paste the query into phpmyadmin (or whatever tool you use to manipulate your database - TOAD for Oracle for example), and see what the result is. This should help you find the cause of the problem.

Simon Tite 15 Light Poster

"Linuxquestions" sends out a periodic (optional!) e-mail containing, among other things, links to "unanswered questions". Sometimes this is a motivation for sporadic users, like myself, to log in and answer a question which seems to be in my sphere of knowledge. Also links to current topics, and such like, about one or two pages at most.

Not sure if I've got the name of the site right, because in fact I generally only log into the site when I see something in the e-mail that interests me.

However, such a thing should not be very frequent, or else people would soon tire of it and unsubscribe. Say, monthly?

Simon Tite 15 Light Poster

Thank you both for your efforts. Aaargh!

I can't understand why not, but neither solution works to double-count the slash, I'm afraid.

Essential, yours has an additional quirk in that it doesn't begin counting till the 2nd character--not a big deal, by itself. Anyway I've posted your work here. I will study it some more.

Simon, you are absolutely right of course about the redundant lines. So it all boils down to the below--which at least does the basic count properly, though for some reason it doesn't count the slashes twice. :-/

function CheckFieldLength(fn,wn,rn,mc) {
    var str = fn.value;  // This needs to be whatever's in the text box
    var pos = str.IndexOf("/");
    var len = fn.length;

    if (pos >= 0) {  
        len = len + str.match(/\//g).length;
    }

    document.getElementById(wn).innerHTML = len;
    document.getElementById(rn).innerHTML = mc - len;
    }

Fourth line needs to be var len = fn.value.length . Now we have two almost working solutions: combining the two, in my function change the middle bit (the if clause) to:

if (pos >= 0) {  
        len = len + str.split(/[\/]/).length;
    }

- this puts Essential's count method (which counts the slashes as double) into your original function (which counts from the first keypress) - then, if you can test it on Firefox (or something not IE!) - if that works, then try on IE.

Simon Tite 15 Light Poster

Nah, I really don't think that's it, I still think that you've got something wrong with your code. Did you try the line I gave you? (That would only work for %address% of course). Perhaps you could give a fuller sample of the code - although I don't mean pages and pages of it, just a bit more than 3 lines, showing how you are initialising the arrays etc.

However, if it is a resource limitation, then here's some settings from my php.ini file:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 128M      ; Maximum amount of memory a script may consume (16MB)

... but I think you would have to have much lower limits than that to have a program bomb out with just 100 odd array elements, unless they are very long. (160 records x 100 000 bytes each, 16 000 000 bytes) - you don't have records of a hundred thousand bytes. Do you???

If you read that preg_replace is "more powerful" than str_replace, then that is just that it has more powerful search abilities than a simple text replacement, not that it works any faster or has any greater capacity than str_replace.

Simon Tite 15 Light Poster

If I understand your question correctly you have an array of about 100 values, all of which may (or may not) contain the text string "%address%". This array is called $content. Then you want to replace the text "%address% wherever it may be found in $content, with the text in the variable $address. That is you are searching an array, replacing one value ("%address%") with one other value (the text found in $address). If this is the case, then the search and replace arguments should be simple variables, not arrays. Thus: $content = str_replace("%address%",$address,$content); (If I have misunderstood the question, perhaps you could clarify it?)

The search and replace arguments should only be arrays if they contain many different search/replace combinations, in which case it's like repeating the simpler form once for each element of the search array.

Which should you use, str_replace or preg_replace? Well, RTFM as they say!

From the PHP manual page for str_replace (http://be.php.net/manual/en/function.str-replace.php):

If you don't need fancy replacing rules (like regular expressions), you should always use this function instead of ereg_replace() or preg_replace().

There is no limit (that I know of) to the size of an array, other than that of memory capacity of your computer, and possibly there may also be a limit set in you php.ini file, or somewhere else accessible to the system administrator. Anyway, if there is a limit, it's sure to be a lot more than a paltry 100 or so records!

Simon Tite 15 Light Poster

You're quite right, Simon: your single line

var len = fn.value.length + fn.value.match(/\//g).length;

does precisely what my awkward two lines did.

While this counts perfectly once a '/' enters the textbox, it unfortunately does no counting till it sees one.

Since the original line

var len = fn.value.length;

by itself counts perfectly when the box has no '/' (i.e. it doesn't know to double for the forward slash), it makes me wonder if an if - else statement might work? Something (that I am clueless how to properly write) sort of like this:

var str= value  // This needs to be whatever's in the text box
var pos=str.IndexOf("\/")
if (pos>=0)
{
var len = fn.value.length + fn.value.match(/\//g).length;
} 
else 
{
var len = fn.value.length
}

Could something like this possibly work? If so, my problem is to get it to read whatever is entered in the box into str. Users will often enter text that has no URL or, most often, a URL at the very end, so they'll want the counter to be keeping a tally from the start even if it doesn't see a slash.

Ok, this looks like it might be that the match(...) actually returns a null value if no match is found, and the length of a null is probably a null, and adding a null to the original length might give a null or zero, which could explain the problem.

So, your latest approach looks promising, however the slash in the IndexOf shouldn't need escaping, …

Simon Tite 15 Light Poster

Just seen the latest version of your script -

// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {
 var len = fn.value.length;
 var len = len + fn.value.match(/\//g).length;


  if (len > mc) {
    fn.value = fn.value;
    len = len;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;

I don' quite know what the if clause in the middle is doing (nothing?), and I don't know whether re-declaring "var len" twice might be causing a problem, but maybe the script should be simplified to

// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {

 var len = fn.value.length + fn.value.match(/\//g).length;

  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}
Simon Tite 15 Light Poster

Now I see more clearly, Simon: your line of code does work, even with the escaped slash: however, the catch is that the script counts nothing until it sees the character that's in your code. In other words, if the string in the textbox lacks a forward slash, the counter does nothing.

I think there was a cross-posting there!

I don't quite understand your problem any more - if the string in the textbox lacks a forward slash, then surely nothing is what it *should* do? Or rather, it should add zero to the count, which is what you want anyway.

Simon Tite 15 Light Poster

You've not just mis-read it have you?

If F is a forward slash, and B is a backward slash, then the line is: len = len + fn.value.match(FBFFg).length; I tested this out by hacking a W3Schools example, which you can find at http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_match_regexp

Just go there, change the lines

var patt1=/ain/gi;
document.write(str.match(patt1));

to

var patt1=/\//g;
document.write(str.match(patt1).length);

..then the example should count the number of slashes in the text line above.

If the example works, and your changed code doesn't, then I'm stuck too. Maybe it's something to do with some other part of the software changing the slash, perhaps also escaping it with a backslash before your subroutine sees it. Maybe, that would explain why a slash counts as two characters?

Guessing wildly here, perhaps if you tried counting occurences of \/ , or using the F B notation as above, for easier reading, try: len = len + fn.value.match(FBBBFFg).length that is F for the regexp opening delimiter, BB for an escaped backslash, BF for an escaped forward slash, F for the regexp closing delimiter, g for global search of the whole string.

Don't you just hate regular expressions?

Simon Tite 15 Light Poster

This is the section of JS code which returns the count:

// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {
  var len = fn.value.length;
  if (len > mc) {
    fn.value = fn.value;
    len = len;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}

Here is some code which should add 1 to the length of text for every "/" character found, that is each / character will then be counted twice.

// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {
  var len = fn.value.length;
////////// Add this line ////////////
  len = len + fn.value.match(/\//g).length;
/////////////////////////////////////
 if (len > mc) {
    fn.value = fn.value;
    len = len;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}

The code is in the file http://faculty.kutztown.edu/rjensen/js/charCount.js.

Simon Tite 15 Light Poster

AFAIK "Set" is not a php command. I don't think the translator is very good.

Simon Tite 15 Light Poster

Glad it worked for you, alex. It would be nice for me (and for others) if you could flag this thread as "solved". (And maybe give me a plus point for my answer?).

Hope your project goes well,

Simon

Simon Tite 15 Light Poster

This should work (I haven't actually tried it yet though)

SELECT file_id, 
	sum(if (status = 0,1,0)) sum0,
	sum(if (status = 1,1,0)) sum1,
	sum(if (status = 2,1,0)) sum2,	
FROM pl_statements
GROUP BY file_id

You don't say which database you are using, the example above should work in MySql, but IF statements are not very standardized between databases. (One other, maybe Oracle or maybe Access, maybe uses IIF instead)

diafol commented: Big hand! Thanks +5
Simon Tite 15 Light Poster

or the teletype hardwired to the computer that takes up an entire room runs at a blazing 110 baud!

.. when you know what a baud is.

Simon Tite 15 Light Poster
$arr = array_fill_keys(range(1,4), "rambow");
$arr[3] = "popcorn";
Simon Tite 15 Light Poster

Now, I'm not sure how to answer your question about the SQL engine. I'm using VB6 with Access97 database if that helps.

That's the answer!

Now it's quite a few years since I used the Access database, but I seem to remember that perhaps it doesn't like doing ORDER BY after GROUP BY. The specification of the SQL language used to be simply: SELECT ... FROM ... ORDER BY ... GROUP BY ... HAVING ... - and this means that you will have to use a subquery to get the results you want.

Firstly, maybe you should get the VB6 crap out of the way and just type your queries direct into the Access application. Anyway, that's up to you, but I'll just give you my suggestions as straight SQL statements to save typing all those quotes and underscord!

If you can get to a working query which outputs the correct results, but not sorted by the total points, this is a good starting point. I guess it should look something like this:

SELECT pt.PoolTeamID AS teamid, pt.TeamName AS teamname, Sum(ps.Points) as pts
FROM PlayerStats ps, PoolTeams pt
WHERE ps.Weeknumber = 10
AND ps.Status = 'True'
AND ps.PoolTeamID = pt.PoolTeamID
ORDER BY pt.PoolTeamId, pt.TeamName
GROUP BY pt.PoolTeamId, pt.TeamName

This should give you one line per teamid, with the correct total points for that team. The ORDER BY is required here, because the GROUP BY subtotalling works on change of …

navaidstech commented: Excellent suggestion solved my dilemma +1
Simon Tite 15 Light Poster

Not too sure which Sql engine you are using, but the following syntax should work with most of them:

sSQL = "Select  PS.PoolTeamID, PT.TeamName, Sum(PS.Points) as pts From " _
        & " PlayerStats PS, PoolTeams PT Where  " _
        & " PS.Weeknumber = 10 AND " _
        & " PS.Status = 'True' AND " _
        & " PS.PoolTeamID = PT.PoolTeamID " _
        & " Group By PS.PoolTeamID  " _
        & "Order By pts Desc "

Points to note are:

You want to sort on an aggregated field, sum(PS.Points), so you need to give it an alias, using the "sum(PS.Points) as pts" .. some versions of SQL differ in this syntax, the most common alternative is just use space instead of the word as.

You only need to group on the team id, presuming the team id is unique, and the team name is just a description.

There is never usually any need to group on an aggregated function such as SUM, unless you expect only a few unique discrete values for the sum.

Simon Tite 15 Light Poster

Perhaps if you gave a little bit more information I (or someone else) could help you. A code snippet, maybe, showing what you expected to get, and what you actually got?

Simon Tite 15 Light Poster

You can't guarantee that robots won't index your site: such things as the robots.txt file, and the meta tags you mentioned, are simply conventions that well-behaved robots will obey. Certainly those methods will stop the reputable engines such as Google, Yahoo et al. Maybe other users have some better ideas?

Simon Tite 15 Light Poster

You don't say which programming language you are using to compose your sql statement, but as a first shot I would suggest you program something like this:-

If the search term contains one word:

SELECT * FROM descriptions
WHERE desc LIKE '%firstword%'

If the search term contains two words:

SELECT * FROM descriptions
WHERE desc LIKE '%firstword%'
AND desc LIKE '%secondword%'

and so on, one extra AND clause for each word.

However, (although I've never tried this), there are features in mySql that allow you to create indexes on tables which support "natural language searching", so if you want a more sophisticated search ability check out this part of the mySql manual:

http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html

---
Sorry, posted this before I saw Darkagn's reply!

darkagn commented: Excellent suggestion and citation. Polite and helpful answer to the OP's question. +3
Simon Tite 15 Light Poster

Actually, I found this thread quite interesting: although I've been programming for many, many years, I've never tried programming a game before!

The database part *is* very important, because once you've got that more or less right, well the door is then open to many other languages, apart from PHP. And once you know MySQL, all the other variants (Oracle, Posgres, etc) will be no problem at all.

Good luck with your game!

Simon Tite 15 Light Poster

discussions at another forum convinced me that a user_creature_link is unnecessary. One user can own many creatures, but a single creature can't be owned by many users hence a one to many relationship instead of a many to many relationship (when linking tables are necessary)

You're quite right about the user_creature_link, it is unnecessary, and I hadn't considered that it was a one-to-many relationship.

And the guys helping me out mentioned that some databases don't really like NULLs in unique values

Well they may have a point, but nowhere in my proposed schema did I suggest that NULL should be used as a unique key value. The only place that I used user_id, was in the creature file, where I included "crusid" as the user's id, only if this creature was associated with a real user. It would not be part of the key to the file, and is just additional information about the creature which strictly speaking is not necessary at all.

My concern with heavy use of flags is that your trying to merge a lot of information into one table and use flags instead of table names

Not exactly, I just believe that normalization implies that one table should contain information about one specific object: the "flag" is just a piece of information, just as is name, address, creature type, etc. I disagree with you that flags are a bad idea. ("Flag" is probably a bad name though). Say I have a client database, and …

Simon Tite 15 Light Poster

Nice simple solution, Fest3r - just one slight snag, sorry if I'm being a little bit too picky, but this solution will also pick up files whose name contains the text "image". I think it just needs "file -b $2" in the first script.

Simon Tite 15 Light Poster

stripslashes is a function which returns a string. It has no effect on the string itself. A statement such as "stripslashes($input)" has no effect on the $input variable as such. You probably intended something like "$input = stripslashes($input)".
HTH

Simon Tite 15 Light Poster

You are definitely right about the USER_CREATURE_LINK file, this is a classic normalization technique.

Seems to me you should use the same technique for the inventories, i.e. an inventory items file (all the possible items and their descriptions), and a USER_INVENTORY_LINK file containing the user id, the inventory id, and the quantity held. When normalizing data, if you find yourself thinking about putting a fixed number of slots in a record, this usually means that there should be a separate table for them.

But then, what about the creature inventory file? Well , why does this have to be a separate file - you may say that creatures and users cannot have the same inventory items, but that is just a rule of the game, and can be catered for by a flag in the inventory file (U/C/B - applies to user, creature or both).

Similarly with statistics: you could have a STATISTICS file, a USER_STATISTICS_LINK and a CREATURE_STATISTICS_LINK, and a simple flag on the STATISTICS file, user, creature or both.

Thinking further, what is the difference between a statistic and an inventory item? A character can possess 10 pieces of gold, 100 strength points, 1 sword, 90 health points, 10 magic beans... you see where I'm going with this? If the game needs to apply certain rules to certain inventory items, then use a flag to identify what rules apply, e.g. INV_TYPE (options "STATISTIC","WEAPON","MONEY","FOOD"...). If things have broadly similar properties, then they really belong in …

Simon Tite 15 Light Poster

How about having to use punch cards to do programming? Our CS teacher reminded us that when he was working on the ARPANET, they did not have compilers with syntax check and auto completion which I think creates a lazy programmer.

Yeah, in CS we had to write the programs out by hand, on paper with a little box for each character, then post this into a pigeon hole. Next working day (D+1) (if you were lucky) you'd get back a stack of punched cards, and a printout of their contents, for checking. After correcting the errors (with a red biro) , you'd get the corrected cards back the next day (D+2), hopefully without errors, and hand them back for processing. The next day (D+3/4), you'd get the results, which would normally be syntax errors or typos you'd missed. Red biro, da de dah, D+4 the results of the compiled program. Basically, one working week to enter, compile and run a 200 line program. And another week to fix the logical errors.

But we wuz grateful for it, guv!

Ancient Dragon commented: You made me glad to not have been programming then :) +0
Simon Tite 15 Light Poster

You could just use grep without the find. Use grep -l -r -i

That's quite true, there are many ways to skin a cat!

Personally, though, I usually use find in cases like this, because of its greater flexibility in selecting files - such as by date accessed, date last updated, stay within the current volume, only recurse 2 levels deep, only give me files I have permission to write to, etc.

You pays your money and you gets your choice, as they say.

sknake commented: :) +6
Simon Tite 15 Light Poster

Basically searching all files in a directory and locating those that contain a certain word within them. For example, I want to know what files contain the word 'apple', if there is just print the filenames that contain 'apple' somewhere in the text. The only thing I really need to know is how to put a command such as find into a conditional statement, or if there are better alternatives. Thanks.

$ find mydir -name "*.ext" -exec grep -q "DEBUG" '{}' \; -print
    # (finds all files with .ext containg the text "DEBUG")
$ find mydir -iname "*.ext" -exec grep -q -i "debug" '{}' \; -print
    # (as above, but case insensitive filenames and pattern match)

"mydir" can obviously be any directory you want, but the find command has to have a directory name, often it would be "." for the current directory.
You can skip the -name "*.ext" if you want, this is just to filter the list of files.
It's a recursive search, that is it descends into all the subdirectories of the directory you specified, but there are switches to control that - consult man find for more details.

Simon Tite 15 Light Poster

...when you remember bootstrapping the computer by its front panel switches, installing operating system patches with an octal editor, and writing programs on a teletype (thats like a big typewriter with fanfold paper instead of a screen, for you youngsters). Oh, and using telex to supply patches (sometimes even small programs) to clients (beats dictating over the telephone, although the character set was limited, you had to spell out some of the punctuation marks).

Sigh! Those were the days my friends!

Simon Tite 15 Light Poster

Well then, I would still use the "time" command (NB I've edited my last post because I put run when I meant time - it's getting late!) - you didn't say if you're on a Unix system or not - but here's an example using the standard *nix command line:

~$ /usr/bin/time -o anyfile -a -f "%e" sleep 10
~$ cat anyfile
10.00

This is simply timing the elapsed time (-f "%e") of the "sleep 10" command, and appending the result into the file "anyfile". Unsurprisingly, it took ten seconds!

You could of course send the output to another program, or pipe it into another shell command.

You could put the timing of the old program and new program into a shell script, then using the shell read in the two output files and do the calculation. If you need help with the shell script part, just ask and I'll see what I can do, tomorrow. (It's now nearly 3am by my clock!)

Sorry, I am not a Fortran programmer (at least not since 25 years ago), so if it somehow needs to be done within the Fortran program, then I'm afraid I can't help any more.

Simon Tite 15 Light Poster

When you remember when "program" was just a wierd American spelling of "programme", and a "programme" was just something you watched on telly.

Simon Tite 15 Light Poster

Sorry, I still don't understand. Do you want to know HOW to calculate the elapsed time of a program?

Simon Tite 15 Light Poster

A clearer example might help. How exactly are you filling the array, how are you outputting the result, what result are you expecting, and what result do you get?
Example:

$total = array();
$total[] = 10; 
$total[] = 15; 
$total[] = 5; 
print ("sum is " . array_sum($total) )

This prints out "sum is 30", which is what I expected!

Simon Tite 15 Light Poster

If the fortran program compiles into an executable file, and you are running on Unix or Linux or other *nix variant, at a shellprompt type: time fortran-program-command (of course after time, type in whatever command you would normally have typed to run the program) - note that the "time" command isn't asking the system to run it, just to time it for you. And it applies to any program, not just fortran.

That's the simple solution, though I suspect there might be more to it than that, for example do you want the program to time its own execution time, and then process the result?

Your question doesn't actually make much sense to me, a formula is used to perform a calculation on one or more values, not to execute a command such as "time my program".

Simon Tite 15 Light Poster

Francis, Read these notes, it may solve your problem:
http://ubuntuforums.org/showthread.php?t=1321107&highlight=wubi

Note that grub thinks you are using a US-ASCII QWERTY standard keyboard, so if you don't use that in your country, then you might want to print a keyboard map (it's tricky for me, using a Belgian AZERTY keyboard, particularly the parentheses and the comma, which are in different positions).

Also note that when the notes say (hdX,Y) , what they mean is you need to find out your disk drive number (X, starts at 0) and the partition number on that disk (Y, also starts at 0). Luckily, grub supports a kind of auto-complete feature: if you press <tab> after a partial command it will give you a list of possible alternatives. So, typing ls (hd<tab> will give you a list of available disks (you probably only have one, in which case you want hd0), and typing ls hd0,<tab> will give you a list of partitions on hd0. Reading the notes, it seems that you will probably want to use (hd0,1) - but if you are not sure, you can try all the possibilities, it won't hurt if you get it wrong.

Similarly, when selecting the kernel to boot, the notes say linux /boot/vmlinuzxxxxxxxxx ...... , don't enter xxxxxxx, use tab to find the list of files starting with vmlinuz, and pick the one with the highest version number.

Hope this helps, let me know if you still have a problem....

francisgan9 commented: trying his best +0
Simon Tite 15 Light Poster

Francis, yes you are right, I didn't realize you were using Wubi, which is something I don't know a great deal about.

However, have you considered un-installing Wubi (using the Windows un-install software program), then re-installing it from the official release site? (http://wubi-installer.org/) - The downside of this is, that it will probably mean you lose any data associated with your previous Ubuntu installation. If this is not a problem for you, then it is worth a try.

Of course, if there is no data to be preserved, why not just bite the bullet and install a genuine dual-partition dual-boot system, or follow fenerista's suggestion - in either case you may lose your original Ubuntu data.

On the other hand, if my understanding is correct, Wubi installs Ubuntu into one (ore maybe more) Windows files, if you could save these files away somewhere, when you next get Ubuntu working, you could then mount these files such that Ubuntu thinks they are subdirectories of your main file system, and recover the files within them.

Simon Tite 15 Light Poster

You know you're an old geek, if you used to say "cool" when it wasn't cool to do so (late 70's, 1980's..)

Simon Tite 15 Light Poster

You need access to a command line shell, via the console application, or telnet or putty if it's a remote machine. Then you will need to do something like:

cd /home/httpd/vhosts/knowittv.com
ls -ld /home/httpd/mason

This will show you what permissions are currently set for the directory, you should see something like:

drwxr-xr-x 2 simon www-data 4096 2010-01-08 12:58 mason

This tells you that "simon" is the owner of the file (probably this will be your username), and that it also belongs to members of the group "www-data" - this should be the group that apache is running in. Depending on the apache set-up, it might be "www-data" or it might be "nobody", or anything else.
So, the letters at the beginning tell you "d" - the file is a directory, "rwx" - the owner simon, has all permissions, "r-x" - the group has only read and execute permissions, and "r-x" again - everybody else also has only read and execute. Thus, apache cannot write to this directory.
To give write permission to the group, enter

chmod g+w mason

Don't worry if your file doesn't exactly match these parameters, the important thing is to make sure that the group includes the apache processes, and that the group has write permission.

It could be that you yourself are denied permission to the file, in which case you will have to become the superuser, or root.

On most Linux systems,

sudo -s

will give you root permission, if you …

Simon Tite 15 Light Poster

I assume that if you can still boot windows, then you will see a list of systems available for booting, probably you will see your original windows system there, and also the list of ubuntu systems. At this point, Grub is asking you to select a system, and you would choose windows or ubuntu. If this is how your system is set up, you can probably select a previous version of ubuntu, ie the one that you ran prior to the upgrade. If this works, and you get a working version of ubuntu, then the next thing to do is to get the updated version to boot correctly, but no need to worry about that yet, just get a running version of ubuntu going, and the next stage might be easy...