Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13523 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2014-05-05 11:04 -0400 |
| Last post | 2014-05-06 22:31 -0700 |
| Articles | 14 — 7 participants |
Back to article view | Back to comp.lang.php
part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 11:04 -0400
Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 11:36 -0400
Re: part two same issue - unwanted empty values in array "J.O. Aho" <user@example.net> - 2014-05-05 17:40 +0200
Re: part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 12:38 -0400
Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 12:51 -0400
Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-05 17:03 +0000
Re: part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 13:10 -0400
Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-06 17:53 +0000
Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 13:23 -0400
Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 16:01 -0400
Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-06 12:33 +0000
Re: part two same issue - unwanted empty values in array Luuk <luuk@invalid.lan> - 2014-05-06 19:49 +0200
Re: part two same issue - unwanted empty values in array Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-05-06 00:58 +0000
Re: part two same issue - unwanted empty values in array Evan Platt <evan@theobvious.espphotography.com.invalid> - 2014-05-06 22:31 -0700
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-05-05 11:04 -0400 |
| Subject | part two same issue - unwanted empty values in array |
| Message-ID | <10ij5epc7behi$.1xza6fsoj54ve$.dlg@40tude.net> |
http://mroldies.net/radio/24hours3.php As you will see, at the bottom of the list I am left with the equal number of unassigned array values that now contain nothing. I don't even want that in the list. How do I eliminate them altogether?
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-05-05 11:36 -0400 |
| Message-ID | <lk8b5l$kev$1@dont-email.me> |
| In reply to | #13523 |
On 5/5/2014 11:04 AM, richard wrote: > http://mroldies.net/radio/24hours3.php > > As you will see, at the bottom of the list I am left with the equal number > of unassigned array values that now contain nothing. > I don't even want that in the list. > How do I eliminate them altogether? > Once again you didn't show your code, so it's impossible to tell. You also have an invalid argument for foreach()... With all of that, why aren't you using a database? You're going through a whole lot of unnecessary work that the database can do for you. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2014-05-05 17:40 +0200 |
| Message-ID | <bsppn3FctlbU1@mid.individual.net> |
| In reply to | #13526 |
On 05/05/14 17:36, Jerry Stuckle wrote: > On 5/5/2014 11:04 AM, richard wrote: >> http://mroldies.net/radio/24hours3.php >> >> As you will see, at the bottom of the list I am left with the equal >> number >> of unassigned array values that now contain nothing. >> I don't even want that in the list. >> How do I eliminate them altogether? >> > > Once again you didn't show your code, so it's impossible to tell. > > You also have an invalid argument for foreach()... > > With all of that, why aren't you using a database? You're going through > a whole lot of unnecessary work that the database can do for you. > Maybe the guy who he hired once don't anymore answer the phone? -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-05-05 12:38 -0400 |
| Message-ID | <b7qgv0zeybhr.8xbnnt41aa10.dlg@40tude.net> |
| In reply to | #13526 |
On Mon, 05 May 2014 11:36:25 -0400, Jerry Stuckle wrote:
> On 5/5/2014 11:04 AM, richard wrote:
>> http://mroldies.net/radio/24hours3.php
>>
>> As you will see, at the bottom of the list I am left with the equal number
>> of unassigned array values that now contain nothing.
>> I don't even want that in the list.
>> How do I eliminate them altogether?
>>
>
> Once again you didn't show your code, so it's impossible to tell.
>
> You also have an invalid argument for foreach()...
>
> With all of that, why aren't you using a database? You're going through
> a whole lot of unnecessary work that the database can do for you.
Just how does one use a database to play music with?
"Data" means information. It is not the file itself.
The array I am creating is a prelude to using the database.
Ergo, the crazy numbering scheme for the file names.
Each file name will correspond to the songID in the database.
That in turn, fetches the required information I want to display.
e.g. Track title, artist, year and rank.
Whereas I could just as easily use the basic information for file names, I
have found out that only ivites spiders and crawlers to take advantage and
identify who has that song.
I have checked my stats for links and found one guy who was directly
linking onto his site so his visitors could freely download.
I pointe out to him that was not only illegal, but as I had to pay a fee to
legally broadcast, I could sue him if it came to that.
As could BMI and ASCAP sue him.
He got the message and no longer links.
Since bots don't know what the numbers mean, it is useless information to
them.
As for the code, here is what I have so far.
$hi=0;
for ($i = 59; $i <= 69; $i++) {
$yr="19$i";
$dir='../audio/'.$yr.'/';
$files = scandir($dir);
$number=count($files);
sort($files);
$hi=$hi+$number;
foreach ($files as $file)
if ($file !=="." && $file !=="..")
$master[] = $file;
}
echo $hi;
echo "<br>";
sort($master);
for ($x=0;$x<=$hi;$x++){echo $x.")..".$master[$x]."<br>";}
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-05-05 12:51 -0400 |
| Message-ID | <lk8fit$n4o$1@dont-email.me> |
| In reply to | #13529 |
On 5/5/2014 12:38 PM, richard wrote:
> On Mon, 05 May 2014 11:36:25 -0400, Jerry Stuckle wrote:
>
>> On 5/5/2014 11:04 AM, richard wrote:
>>> http://mroldies.net/radio/24hours3.php
>>>
>>> As you will see, at the bottom of the list I am left with the equal number
>>> of unassigned array values that now contain nothing.
>>> I don't even want that in the list.
>>> How do I eliminate them altogether?
>>>
>>
>> Once again you didn't show your code, so it's impossible to tell.
>>
>> You also have an invalid argument for foreach()...
>>
>> With all of that, why aren't you using a database? You're going through
>> a whole lot of unnecessary work that the database can do for you.
>
> Just how does one use a database to play music with?
> "Data" means information. It is not the file itself.
>
A file is nothing more than data. And a file system is nothing more
than a (non-SQL) database.
> The array I am creating is a prelude to using the database.
> Ergo, the crazy numbering scheme for the file names.
> Each file name will correspond to the songID in the database.
> That in turn, fetches the required information I want to display.
> e.g. Track title, artist, year and rank.
> Whereas I could just as easily use the basic information for file names, I
> have found out that only ivites spiders and crawlers to take advantage and
> identify who has that song.
> I have checked my stats for links and found one guy who was directly
> linking onto his site so his visitors could freely download.
> I pointe out to him that was not only illegal, but as I had to pay a fee to
> legally broadcast, I could sue him if it came to that.
> As could BMI and ASCAP sue him.
> He got the message and no longer links.
Putting music in the database means you need to serve the files with a
PHP script - but it also allows you to run some tests to see if someone
hotlinked to your files (i.e. "HTTP_REFER" is not a perfect test, but
works with most browsers).
> Since bots don't know what the numbers mean, it is useless information to
> them.
>
> As for the code, here is what I have so far.
>
>
> $hi=0;
>
> for ($i = 59; $i <= 69; $i++) {
> $yr="19$i";
>
> $dir='../audio/'.$yr.'/';
> $files = scandir($dir);
> $number=count($files);
> sort($files);
> $hi=$hi+$number;
>
> foreach ($files as $file)
> if ($file !=="." && $file !=="..")
> $master[] = $file;
> }
> echo $hi;
> echo "<br>";
>
> sort($master);
> for ($x=0;$x<=$hi;$x++){echo $x.")..".$master[$x]."<br>";}
>
Except $master does not have all of the entries that $files had, since
you didn't copy the "." and ".." files over.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-05-05 17:03 +0000 |
| Message-ID | <lk8g8b$5it$1@dont-email.me> |
| In reply to | #13529 |
On Mon, 05 May 2014 12:38:27 -0400, richard wrote:
>>> As you will see, at the bottom of the list I am left with the equal
>>> number of unassigned array values that now contain nothing.
> As for the code, here is what I have so far.
You have made an error in your logic, such that $hi is greater than count
($master).
at the end:
sort($master);
for ( $x = 0; $x < count($master); $x++ )
echo "{$x})..{$master[$x]}<br>";
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-05-05 13:10 -0400 |
| Message-ID | <jo9jreuto78s$.15xyn63kfkdst$.dlg@40tude.net> |
| In reply to | #13531 |
On Mon, 5 May 2014 17:03:07 +0000 (UTC), Denis McMahon wrote:
> sort($master);
> for ( $x = 0; $x < count($master); $x++ )
> echo "{$x})..{$master[$x]}<br>";
thank you.
exactly what I needed.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-05-06 17:53 +0000 |
| Message-ID | <lkb7it$jni$2@dont-email.me> |
| In reply to | #13532 |
On Mon, 05 May 2014 13:10:16 -0400, richard wrote:
> On Mon, 5 May 2014 17:03:07 +0000 (UTC), Denis McMahon wrote:
>
>> sort($master);
>> for ( $x = 0; $x < count($master); $x++ )
>> echo "{$x})..{$master[$x]}<br>";
> thank you.
> exactly what I needed.
Not quite.
What you need is to understand how you made the error in the first place,
which I suspect is totally beyond your comprehension, and yet myself (and
I suspect several others here) spotted it almost straight away.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-05-05 13:23 -0400 |
| Message-ID | <lk8heg$5di$1@dont-email.me> |
| In reply to | #13531 |
On 5/5/2014 1:03 PM, Denis McMahon wrote:
> On Mon, 05 May 2014 12:38:27 -0400, richard wrote:
>
>>>> As you will see, at the bottom of the list I am left with the equal
>>>> number of unassigned array values that now contain nothing.
>
>> As for the code, here is what I have so far.
>
> You have made an error in your logic, such that $hi is greater than count
> ($master).
>
> at the end:
>
> sort($master);
> for ( $x = 0; $x < count($master); $x++ )
> echo "{$x})..{$master[$x]}<br>";
>
Or, better yet:
$top = count($master);
for ( $x = 0; $x < top; $x++)
That way count($master) doesn't have to be evaluated each time through
the loop. Minor savings, I know. But still good programming practice,
IMHO.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-05-05 16:01 -0400 |
| Message-ID | <lk8qmt$e6i$1@dont-email.me> |
| In reply to | #13533 |
On 5/5/2014 1:23 PM, Jerry Stuckle wrote:
> On 5/5/2014 1:03 PM, Denis McMahon wrote:
>> On Mon, 05 May 2014 12:38:27 -0400, richard wrote:
>>
>>>>> As you will see, at the bottom of the list I am left with the equal
>>>>> number of unassigned array values that now contain nothing.
>>
>>> As for the code, here is what I have so far.
>>
>> You have made an error in your logic, such that $hi is greater than count
>> ($master).
>>
>> at the end:
>>
>> sort($master);
>> for ( $x = 0; $x < count($master); $x++ )
>> echo "{$x})..{$master[$x]}<br>";
>>
>
> Or, better yet:
>
> $top = count($master);
> for ( $x = 0; $x < top; $x++)
>
> That way count($master) doesn't have to be evaluated each time through
> the loop. Minor savings, I know. But still good programming practice,
> IMHO.
>
Correction:
$top = count($master);
for ( $x = 0; $x < $top; $x++)
I miss the '$' too, occasionally. Been doing too much C lately...
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-05-06 12:33 +0000 |
| Message-ID | <lkakrj$5b1$3@dont-email.me> |
| In reply to | #13533 |
On Mon, 05 May 2014 13:23:33 -0400, Jerry Stuckle wrote: > That way count($master) doesn't have to be evaluated each time through > the loop. Minor savings, I know. But still good programming practice, > IMHO. Doh, yeah, my bad. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2014-05-06 19:49 +0200 |
| Message-ID | <eujn3b-tmj.ln1@luuk.invalid.lan> |
| In reply to | #13529 |
On 5-5-2014 18:38, richard wrote:
>
> sort($master);
> for ($x=0;$x<=$hi;$x++){echo $x.")..".$master[$x]."<br>";}
>
you could also stop this loop if $master[$x] is empty
for ($x=0;$x<=$master[$x]!="";$x++){echo $x.")..".$master[$x]."<br>";
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2014-05-06 00:58 +0000 |
| Message-ID | <XnsA324D55F97D83dougmilmaccom@78.46.70.116> |
| In reply to | #13523 |
richard <noreply@example.com> wrote in news:10ij5epc7behi$.1xza6fsoj54ve$.dlg@ 40tude.net: > http://mroldies.net/radio/24hours3.php > > As you will see, at the bottom of the list I am left with the equal number > of unassigned array values that now contain nothing. > I don't even want that in the list. > How do I eliminate them altogether? How many times to I have to tell you this, Richard? WE CAN'T SEE YOUR PHP CODE.
[toc] | [prev] | [next] | [standalone]
| From | Evan Platt <evan@theobvious.espphotography.com.invalid> |
|---|---|
| Date | 2014-05-06 22:31 -0700 |
| Message-ID | <73hjm9pge9gn091bhc5hqs909n9ah51ium@4ax.com> |
| In reply to | #13538 |
On Tue, 6 May 2014 00:58:55 +0000 (UTC), Doug Miller <doug_at_milmac_dot_com@example.com> wrote: >richard <noreply@example.com> wrote in news:10ij5epc7behi$.1xza6fsoj54ve$.dlg@ >40tude.net: > >> http://mroldies.net/radio/24hours3.php >> >> As you will see, at the bottom of the list I am left with the equal number >> of unassigned array values that now contain nothing. >> I don't even want that in the list. >> How do I eliminate them altogether? > >How many times to I have to tell you this, Richard? > >WE CAN'T SEE YOUR PHP CODE. It's pretty obvious he doesn't learn. I keep having to tell him the same things over and over again. I don't know if it's Alzheimer's or just pure stupidity, or both. He likely burned his bridge with the 'programmer' he hired recently, so now he's back here asking for help every other day, and people keep helping him, and then he often abuses those providing him free help. Where is his incentive to learn anything? All he has to do is come here, and everyone solves his problems for him. Perhaps if people stopped, he may actually learn something.... Although maybe I give him too much credit. -- To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web