|
Posted by FFMG on 01/25/07 10:26
>
> "FFMG" asked...
> : Sorry I am not sure I follow, what is that code for?
> :
> : How does it answer my OP?
>
> A data file holds information. An array typically gets created to
> hold text and numbers and it loads super fast. You mentioned
> 30(?) items, and that seems trivial for the most part (unless each item
> ends up of massive size). My response presented an alternative
> way to look at it the problem. You stated you tried the the "flat file"
> alternative.
Sorry, your reply did not say that.
In fact when you said, "Use an include file that holds a function that
returns the data inside an array. This works well for textual and
numeric data."
I did not know you meant that this was another approach.
Seen that I was not really asking for another approach but to rather
compare my approach with using the database I might be forgiven for
asking what you were referring to.
>
> If it's the programmer that only does the updates,
If that was the case then I would use define(...) or even hardcode the
values in the code.
Using an array is not practical in a 'config' situation.
And using the array the way you propose makes it unusable, (unless you
know that item 0 = data1 and so on).
> It sounded like you have a common file that gets loaded up by a lot
> of pages, that doesn't get updated often.
Yes, that is what I said, but it does get updated.
> Under those conditions, using require() or include() seems like a
> natural choice
No it is not. You option makes it very hard to update, if at all.
It is not flexible and does not make the code very portable.
In my case, (as mentioned), it does get updated from time to time.
Updating code and then ftp the contents from time to time is just not
practical in most cases.
It means that no values can be updated by anyone else than the
programmer.
It is indeed a solution, but a bit of a drastic one.
>
> The question you asked, "Flat file, did I waste my time?" comes
> across as one of those goofy subjective questions, like "Did I
> waste my time getting married?"
Really? Was my post the same as asking about marriage?
If you had read my OP, (because it is quite clear that you did not read
it until I asked you what you where taking about), you would have
understood that I was asking about comparing reading a simple file and
reading a simple table.
I said that I wrote a wrapper, (BTW that implies that I am familiar
with such things as 'arrays()', 'include()' and 'require()'), my
question invited a discussion on flat files vs table, (both simple).
I even go further, (to make it clear to those who actually read the
post), and ask if reading a flat file is as fast as reading a table.
So, did I waste my time doing that wrapper?
I did not ask you for 3 lines of code and a 'good luck', good luck for
what?
> I can not argue that one way
> or the other, it's 100% your question! And either YOU answer it,
> "I wasted my time!", or you state, "I learned something, so while
> I spent some time on it, all is well and I'll get over it". Those may
> or may not be the only answers (some folks create really goofy
> answers to such ponderings) and noone but you can answer that
> question.
No, a programmer would have said, "You wasted your time because reading
a flat file is slower than reading a table" or "you did not waste your
time because reading a flat file will free some resources on your
database".
Come one, you know exactly what I was asking.
You can throw insults around as much as you like, but the fact remains
that you did not read my post properly and now you try and make it as
if you knew all along what you were taking about.
You then tried to increase your post count by adding a totally useless
post.
I mean,
> function GetMyArray() {
> return(array("data1", "data2", 1, 2, 3, 4));
> }
Did you really think that it was:
1) Answering my post?
2) A practical answer, (given my OP)?
>
> It's not a good idea to ask anyone else if "YOU" wasted your
> time. How can anyone else know without you specifically telling
> them that you wasted your time?
It might be better to only answer posts properly rather than wasting
both our times.
Regards,
Oh, and 'good luck'.
Simon
Navigation:
[Reply to this message]
|