By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,963 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,963 IT Pros & Developers. It's quick & easy.

Pick 5 random entrys

P: n/a
What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)

<?php

$loopy=1; $kon="repo"; $spock=0;

while ($kon=="repo")
{
$khan=(rand()%$chekov); $khan=$khan+1;
if ($kirk[$khan]=="") {$spock=$spock+1; $kirk[$spock]=$khan;}
if ($spock>55) {break;}
if ($loopy>222) {$kon="break";}
$loopy=$loopy+1;
}

sort($kirk); $kirk=array_keys(array_flip($kirk));

$loopy=0;
while ($loopy<5)
{
$bones=$kirk[$loopy];
if ($bones<>"") {include('display_entry.php');}
$loopy=$loopy+1;
}

?>
Aug 6 '08 #1
Share this Question
Share on Google+
36 Replies


P: n/a
On Aug 6, 8:08*pm, Krustov <m...@privacy.netwrote:
What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)

<?php

$loopy=1; $kon="repo"; $spock=0;

while ($kon=="repo")
{
$khan=(rand()%$chekov); $khan=$khan+1;
if ($kirk[$khan]=="") {$spock=$spock+1; $kirk[$spock]=$khan;}
if ($spock>55) {break;}
if ($loopy>222) {$kon="break";}
$loopy=$loopy+1;

}

sort($kirk); $kirk=array_keys(array_flip($kirk));

$loopy=0;
while ($loopy<5)
{
$bones=$kirk[$loopy];
if ($bones<>"") {include('display_entry.php');}
$loopy=$loopy+1;

}

?>
Troll, go away.
Aug 6 '08 #2

P: n/a
On Wed, 6 Aug 2008 19:08:40 +0100, Krustov <me@privacy.netwrote:
>What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)

<?php

$loopy=1; $kon="repo"; $spock=0;

while ($kon=="repo")
{
$khan=(rand()%$chekov); $khan=$khan+1;
if ($kirk[$khan]=="") {$spock=$spock+1; $kirk[$spock]=$khan;}
if ($spock>55) {break;}
if ($loopy>222) {$kon="break";}
$loopy=$loopy+1;
}

sort($kirk); $kirk=array_keys(array_flip($kirk));

$loopy=0;
while ($loopy<5)
{
$bones=$kirk[$loopy];
if ($bones<>"") {include('display_entry.php');}
$loopy=$loopy+1;
}

?>
Krusty, one day soon your code will be used by all the great teaching
establishments of the world. Here is example code to take the breath
away. Clarity, beauty, functionality, conciseness - out the window
with you! Here are perfect examples of how not to write code.

Never in the field of computer programming has so much crap been
written by so few.

P.S. if you wrote your code properly you would see the problem on the
6th line after <?php.
--
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/ http://www.pherber.com/
Aug 6 '08 #3

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)
Why don't you just tell us what it's supposed to do? If you just need
five random numbers from a range you've got waaay too much code.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 6 '08 #4

P: n/a
<comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 22:45:24 +0100>
<vn********************************@4ax.com>
What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)

Why don't you just tell us what it's supposed to do? If you just need
five random numbers from a range you've got waaay too much code.
www.jpgimage.co.uk/full.php?image=1232
www.jpgimage.co.uk/full.php?image=1233

I needed something to fill up the guestbook.php page and displaying some
random guestbook entrys was the quick fix solution i came up with .

As the (latest entrys) button is right next to it - obviously its best
to display the oldest of the 5 random entrys first .

Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .
Aug 6 '08 #5

P: n/a
On Aug 7, 12:18*am, Krustov <m...@privacy.netwrote:
<comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 22:45:24 +0100>
<vn6k94hhfh1k9ih7kjfv8dndeql1soo...@4ax.com>
>What is wrong with this php code ? .
>(it works fine - but something that just works isnt good enough for this
>newsgroup is it)
Why don't you just tell us what it's supposed to do? *If you just need
five random numbers from a range you've got waaay too much code.

http://www.jpgimage.co.uk/full.php?i...php?image=1233

I needed something to fill up the guestbook.php page and displaying some
random guestbook entrys was the quick fix solution i came up with .

As the (latest entrys) button is right next to it - obviously its best
to display the oldest of the 5 random entrys first .

Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .
if you have $n entries, how about doing something like
<?php
$indices = range(0, $n-1);
shuffle($indices);
$indices = array_splice($indices, 5);
rsort($indices);
?>

Granted, it isn't fast, but it's easy to read/maintain and the speed
difference will be negligible if $n isn't very high.

Sorry about my earlier post, I thought you were making a joke.

-egbert
Aug 6 '08 #6

P: n/a
<comp.lang.php>
<Egbert Teeselink>
<Wed, 6 Aug 2008 15:26:08 -0700 (PDT)>
<0a**********************************@34g2000hsh.g ooglegroups.com>
if you have $n entries, how about doing something like
<?php
$indices = range(0, $n-1);
shuffle($indices);
$indices = array_splice($indices, 5);
rsort($indices);
?>

Granted, it isn't fast, but it's easy to read/maintain and the speed
difference will be negligible if $n isn't very high.
What about the code used to display the 5 random entrys .
Aug 6 '08 #7

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .
Yep.

Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 6 '08 #8

P: n/a
Message-ID: <ck********************************@4ax.comfrom Geoff
Berrow contained the following:
>Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n

Hey look - a UK lottery ball picker!

asort($ar=array_rand(range(1, 49), 6));
echo implode(", ", $ar);
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 6 '08 #9

P: n/a
<comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 23:51:01 +0100>
<ck********************************@4ax.com>
Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .

Yep.

Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n
You left out how to sort them into the lowest number first - and you
left out how to display the 5 entrys .

That must be where the magic wand comes in eh! :-)
Aug 6 '08 #10

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>You left out how to sort them into the lowest number first -
See other post
>and you
left out how to display the 5 entrys .
As I've no idea how you are storing your entries that's not really
possible is it?

I'd be storing them in a database in which case I'd simply pass the
values into a query.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 6 '08 #11

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>
That must be where the magic wand comes in eh! :-)
Looking at it again, if $bones is the variable to get the entry

$rand_entries = array_rand(range(0, $n), 5);
foreach($rand_entries as $bones){
include('display_entry.php');
}
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 6 '08 #12

P: n/a
..oO(Krustov)
><comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 23:51:01 +0100>
<ck********************************@4ax.com>
>Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .

Yep.

Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n

You left out how to sort them into the lowest number first - and you
left out how to display the 5 entrys .

That must be where the magic wand comes in eh! :-)
What about $ds9['sisko']? You have your entries stored somewhere, either
in a $ds9['dax'] or in a $ds9['odo'] so that they can be $ds9['beamed'].
Each entry should have its own $ds9['rank'].

Then just take the $ds9['defiant'], pick $ds9['quark'] out of the
$ds9['bar'] and load those $ds9['founders'] from wherever they're
stored. $ds9['garak'] might also offer some helpful tricks.

Micha

PS:

$ds9 = array_map('str_rot13', array(
'sisko' ='EGSZ',
'dax' ='QO',
'odo' ='syng svyr',
'quark' ='svir enaqbz ahzoref',
'garak' ='Neenl fbegvat shapgvbaf',
'founders' ='negvpyrf',
'defiant' ='uvturfg ahzore',
'bar' ='enatr',
'rank' ='havdhr ahzrevp VQ',
'beamed' ='ernq vagb na neenl'
));
Aug 7 '08 #13

P: n/a
Message-ID: <84********************************@4ax.comfrom Michael
Fesser contained the following:
>What about $ds9['sisko']?
The last time I said that I was told "Mark this well, you won't see a
more pedantic, asinine response to aquestion again." Message id
31**********************************...oglegroups.com
<grin>
>You have your entries stored somewhere, either
in a $ds9['dax'] or in a $ds9['odo'] so that they can be $ds9['beamed'].
It's $ds9['odo'] or more likely multiple $ds9['odo'] Krusty doesn't do
$ds9['dax']
>Each entry should have its own $ds9['rank'].
I'm guessing there will be a separate $ds9['odo'] for each entry.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 7 '08 #14

P: n/a
Krustov wrote:
What is wrong with this php code ? .

(it works fine - but something that just works isnt good enough for this
newsgroup is it)
Why don't you try making your code readable?
>

<?php

$loopy=1; $kon="repo"; $spock=0;
What's with that, and why is $spock a number? Why not name your
variables for what they really are?
>
while ($kon=="repo")
{
$khan=(rand()%$chekov); $khan=$khan+1;
$some_integer++ is available and widely used. Where is $checkov?
if ($kirk[$khan]=="") {$spock=$spock+1; $kirk[$spock]=$khan;}
if ($spock>55) {break;}
if ($loopy>222) {$kon="break";}
$loopy=$loopy+1;
}
None of that makes any sense to me. Why all these specific values for
variables?
>
sort($kirk); $kirk=array_keys(array_flip($kirk));

$loopy=0;
while ($loopy<5)
{
$bones=$kirk[$loopy];
if ($bones<>"") {include('display_entry.php');}
$loopy=$loopy+1;
}
None of this makes any sense. Nobody has a magick wand, what we all
try to do is make logical code that is readable and maintainable. Try
looking at your code a year later and see if it makes any sense, and you
wrote it. Imagine what it looks like to us?

I'm not sure what you are doing but it looks like you are pulling 5
random entries from some file and sorting by date. A database is ideally
suited for this type of work and the select to do this is simple. This
has all the appearance of something you just kept fudging with until you
got what you thought you wanted.

Jeff
>
?>
Aug 7 '08 #15

P: n/a
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 07:01:03 -0400>
<cd******************************@earthlink.com>
None of that makes any sense to me.
Does that mean your not as smart or as clever as you like to think you
are or pretend to be .
Aug 7 '08 #16

P: n/a
<comp.lang.php>
<Geoff Berrow>
<Thu, 07 Aug 2008 00:14:49 +0100>
<dv********************************@4ax.com>
That must be where the magic wand comes in eh! :-)
Looking at it again, if $bones is the variable to get the entry
Not everybody uses agent .

Could you do everybody a favour and insert a blank line between the
quote and the reply - or dont you care .
Aug 7 '08 #17

P: n/a
<comp.lang.php>
<Krustov>
<Wed, 6 Aug 2008 19:08:40 +0100>
<MP************************@news.newsreader.com>
What is wrong with this php code ? .
The new improved code .
<?php

$kirk=array_rand(range(0,$n),6);

sort($kirk); $kirk=array_keys(array_flip($kirk));

$loopy=1;
while ($loopy<6)
{
$rambo=$kirk[$loopy];
if ($rambo<>"") {include('display_entry.php');}
$loopy=$loopy+1;
}

?>

Aug 7 '08 #18

P: n/a
Krustov wrote:
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 07:01:03 -0400>
<cd******************************@earthlink.com>
>None of that makes any sense to me.

Does that mean your not as smart or as clever as you like to think you
are or pretend to be .
It means you code is unclear and obtuse.

You may think it's cute to use such variable names, but it isn't.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 7 '08 #19

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>Could you do everybody a favour and insert a blank line between the
quote and the reply - or dont you care .
ROFL!!!

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 7 '08 #20

P: n/a
Jerry Stuckle wrote:
Krustov wrote:
><comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 07:01:03 -0400>
<cd******************************@earthlink.com >
>>None of that makes any sense to me.

Does that mean your not as smart or as clever as you like to think you
are or pretend to be .

It means you code is unclear and obtuse.

You may think it's cute to use such variable names, but it isn't.
That's exactly what it means.

Now, I have never claimed to be particularly clever or smart. I am a PHP
newbie and I have stated that where appropriate (read my posting
history). I am here to learn and to give a little advice where I
believe my advice would be useful.

Just because I'm a php newbie though doesn't mean I'm new at either
usenet or programming. And I can clearly tell that you are heading for
trouble by picking unneeded and unwanted fights with people that really
don't (yet) have a bone to pick with you.

So, I'm going to have one more run at this. Don't alienate the people
that can be of assistance to you. Don't make yourself the group pariah.

Now, if you just can't grok that, then you will be in my rather lonely
kill file. And you'll be in others as well.

Jeff
>
Aug 7 '08 #21

P: n/a
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 10:32:14 -0400>
<z4******************************@earthlink.com>
(read my posting history)
Your own self importance is of no interest to me .
Aug 7 '08 #22

P: n/a
Krustov wrote:
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 10:32:14 -0400>
<z4******************************@earthlink.com>
>(read my posting history)

Your own self importance is of no interest to me .
*plonk*

Only one in my in killfile. You are absolutely clueless.

Jeff
Aug 7 '08 #23

P: n/a

Krustov schreef:
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 10:32:14 -0400>
<z4******************************@earthlink.com>
>(read my posting history)

Your own self importance is of no interest to me .
Dear Krustov,

Are you posting in here to get help or to irritate people?
Jeff's first response could have been useful to you, if you read it
right (and understand of course).

Erwin

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
Aug 7 '08 #24

P: n/a
<comp.lang.php>
<Erwin Moller>
<Thu, 07 Aug 2008 17:03:17 +0200>
<48***********************@news.xs4all.nl>
(read my posting history)
Your own self importance is of no interest to me .

Dear Krustov,

Are you posting in here to get help or to irritate people?
I'm a troll who also has a interest in php scripting - so both .
Aug 7 '08 #25

P: n/a
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>Are you posting in here to get help or to irritate people?

I'm a troll who also has a interest in php scripting - so both .

Krusty is a fascinating person. These days you have to give a few
points for accessing and participating in Usenet by means other than
Google groups. He calls himself a troll but really he's far too voluble
to be a troll in the classic sense. But there is no question that he
gets a kick from winding people up.

At the same time he has perceived a need to learn some scripting. Now
trying to get help from people whilst simultaneously pissing them off
must place him in a continual dilemma. A few more points added to his
score. But it's not only people he rebels at, if the textbooks say name
variables sensibly, he will name them $poo or $jobby. He has a very
limited PHP toolkit and so his solutions tend to be a bit convoluted.
But he does get stuff written and done and it does work, after a
fashion, so he gets a few more points for that.

If you try to help him don't expect gratitude, he's more likely to call
you a c*nt.. If he posts something that interests me, I'll respond, not
to help him, but because it amuses /me/ and may be helpful to others.

It is, after all, only Usenet.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 7 '08 #26

P: n/a
Geoff Berrow wrote:
Message-ID: <MP************************@news.newsreader.comfro m
Krustov contained the following:
>>Are you posting in here to get help or to irritate people?
I'm a troll who also has a interest in php scripting - so both .


Krusty is a fascinating person. These days you have to give a few
points for accessing and participating in Usenet by means other than
Google groups. He calls himself a troll but really he's far too voluble
to be a troll in the classic sense. But there is no question that he
gets a kick from winding people up.

At the same time he has perceived a need to learn some scripting. Now
trying to get help from people whilst simultaneously pissing them off
must place him in a continual dilemma. A few more points added to his
score. But it's not only people he rebels at, if the textbooks say name
variables sensibly, he will name them $poo or $jobby. He has a very
limited PHP toolkit and so his solutions tend to be a bit convoluted.
That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.

From what I see, most people recognize this quickly. So Krusty is
largely a waste of time, unique in his own way, but hardly useful.

Jeff.

But he does get stuff written and done and it does work, after a
fashion, so he gets a few more points for that.

If you try to help him don't expect gratitude, he's more likely to call
you a c*nt.. If he posts something that interests me, I'll respond, not
to help him, but because it amuses /me/ and may be helpful to others.

It is, after all, only Usenet.
Aug 7 '08 #27

P: n/a
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 14:36:31 -0400>
<Qb******************************@earthlink.com>
That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.
You place quite a high value on your own opinions .

Lex Luthor once said that some people can read 'war and peace' and come
away thinking its nothing more than a simple fairytale - while others
can read the contents of a box of matches and unravel the mysterys of
the universe .

Aug 7 '08 #28

P: n/a
Message-ID: <Qb******************************@earthlink.comfro m Jeff
contained the following:
>
That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.
He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 7 '08 #29

P: n/a
<comp.lang.php>
<Geoff Berrow>
<Thu, 07 Aug 2008 20:12:36 +0100>
<56********************************@4ax.com>
That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.

He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?
Quite the little analyst - arnt you .

To sum things up , If you just ask a general question on usenet then
most people will just click on the next unread post .

But if given the oppertunity to correct somebody else - then a
overwhelming urge to reply appears as most sad bastards on usenet dont
have a girlfriend and wanky little ego trips are one of their few
pleasures in what they regard as being normal everyday life .

As spock would say ..... its all very logical :-)
Aug 7 '08 #30

P: n/a
Geoff Berrow wrote:
Message-ID: <Qb******************************@earthlink.comfro m Jeff
contained the following:
> That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.

He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?
OK. It's not often that a newbie gets to see see how a convoluted mess
can be boiled down to clear code with a little thought. I think it's a
good idea to give newbies a desire to not only solve their problems but
see the benefit of learning to be a better coder.

Jeff
>
Aug 7 '08 #31

P: n/a
<comp.lang.php>
<Jeff>
<Thu, 07 Aug 2008 16:37:36 -0400>
<Gv******************************@earthlink.com>
It's not often that a newbie gets to see see how a convoluted mess
can be boiled down to clear code with a little thought. I think it's a
good idea to give newbies a desire to not only solve their problems but
see the benefit of learning to be a better coder.
Do you ever post any php code snippets on here .

Or perhaps you regard comp.lang.php as being nothing more than a soapbox
for your own personal thoughts and opinions .

Aug 7 '08 #32

P: n/a
Message-ID: <Gv******************************@earthlink.comfro m Jeff
contained the following:
>He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?

OK. It's not often that a newbie gets to see see how a convoluted mess
can be boiled down to clear code with a little thought. I think it's a
good idea to give newbies a desire to not only solve their problems but
see the benefit of learning to be a better coder.
Indeed. Krusty serves as a bad example to us all. :-))

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 7 '08 #33

P: n/a
..oO(Geoff Berrow)
>Message-ID: <Gv******************************@earthlink.comfro m Jeff
contained the following:
>>He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?

OK. It's not often that a newbie gets to see see how a convoluted mess
can be boiled down to clear code with a little thought. I think it's a
good idea to give newbies a desire to not only solve their problems but
see the benefit of learning to be a better coder.

Indeed. Krusty serves as a bad example to us all. :-))
He's an example of how things should _not_ be done. If just someone
would have told this to his mother before it was too late ... ;-D

Micha
Aug 7 '08 #34

P: n/a

Krustov schreef:
<comp.lang.php>
<Geoff Berrow>
<Thu, 07 Aug 2008 20:12:36 +0100>
<56********************************@4ax.com>
>> That's a bit of an issue when he offers "help". Though there may be
something useful in there, its outweighed by the accompanying crud.
Certainly not a coding style anyone should be learning from.
He posts crud and five people (who may not have responded) immediately
post better versions.

Could be seen as a positive, perhaps?
Hi Krustov,

Yes, it is clear now to me: You like trolling.
(Yes, I was a bit slow recognizing that.)
>
Quite the little analyst - arnt you .

To sum things up , If you just ask a general question on usenet then
most people will just click on the next unread post .
???
Nonsnese.

In most newgroups general questions get answered too. That is if the
question is on topic.

It is often the opposite: A technical difficult to the point question is
MORE difficult to answer than some general bla-bla.
For example: We could get into a discussion if your variables should be
named $spock and $odo, or have more descriptive names. That discussion
could possibly be endless.
But if I ask you why a certain variable binding from PHP to Postgres8.1
via some database abstraction layer gives me trouble, you cannot get
away with bla-bla: you must know excactly what you are talking about.

No, your statement is wrong: The more general the question, the easier
it is to find people commenting on it.

So why do you claim that?
Only to get a nice introduction to the next part of your
psycho-analitical ramblings?

>
But if given the oppertunity to correct somebody else - then a
overwhelming urge to reply appears as most sad bastards on usenet dont
have a girlfriend and wanky little ego trips are one of their few
pleasures in what they regard as being normal everyday life .
The above says a lot about you.
>
As spock would say ..... its all very logical :-)
Spock is wellknown for many logical mistakes.
Or at least the scriptwriters. ;-)

Now please be a good boy, and drop that act.
You'll get a lot more out of this newsgroup (from the ones that haven't
plonked you.)

Regards,
Erwin Moller

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
Aug 8 '08 #35

P: n/a
Michael Fesser wrote:
.oO(Krustov)
><comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 23:51:01 +0100>
<ck********************************@4ax.com>
>>>Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .
Yep.

Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n
You left out how to sort them into the lowest number first - and you
left out how to display the 5 entrys .

That must be where the magic wand comes in eh! :-)

What about $ds9['sisko']? You have your entries stored somewhere, either
in a $ds9['dax'] or in a $ds9['odo'] so that they can be $ds9['beamed'].
Each entry should have its own $ds9['rank'].

Then just take the $ds9['defiant'], pick $ds9['quark'] out of the
$ds9['bar'] and load those $ds9['founders'] from wherever they're
stored. $ds9['garak'] might also offer some helpful tricks.

Micha

PS:

$ds9 = array_map('str_rot13', array(
'sisko' ='EGSZ',
'dax' ='QO',
'odo' ='syng svyr',
'quark' ='svir enaqbz ahzoref',
'garak' ='Neenl fbegvat shapgvbaf',
'founders' ='negvpyrf',
'defiant' ='uvturfg ahzore',
'bar' ='enatr',
'rank' ='havdhr ahzrevp VQ',
'beamed' ='ernq vagb na neenl'
));
LOL, classic! :D

--
Curtis
Aug 9 '08 #36

P: n/a
Curtis wrote:
Michael Fesser wrote:
>.oO(Krustov)
>><comp.lang.php>
<Geoff Berrow>
<Wed, 06 Aug 2008 23:51:01 +0100>
<ck********************************@4ax.com>

Can you post 1 or 2 lines of 'magic wand' code to do the same job ? .
Yep.

Let's say you have entries numbered from 0 to $n

$rand_entries = array_rand(range(0, $n), 5);
//$rand_entries is now an array containing 5 random numbers between 0
and $n

You left out how to sort them into the lowest number first - and you
left out how to display the 5 entrys .

That must be where the magic wand comes in eh! :-)

What about $ds9['sisko']? You have your entries stored somewhere, either
in a $ds9['dax'] or in a $ds9['odo'] so that they can be $ds9['beamed'].
Each entry should have its own $ds9['rank'].

Then just take the $ds9['defiant'], pick $ds9['quark'] out of the
$ds9['bar'] and load those $ds9['founders'] from wherever they're
stored. $ds9['garak'] might also offer some helpful tricks.

Micha

PS:

$ds9 = array_map('str_rot13', array(
'sisko' ='EGSZ',
'dax' ='QO',
'odo' ='syng svyr',
'quark' ='svir enaqbz ahzoref',
'garak' ='Neenl fbegvat shapgvbaf',
'founders' ='negvpyrf',
'defiant' ='uvturfg ahzore',
'bar' ='enatr',
'rank' ='havdhr ahzrevp VQ',
'beamed' ='ernq vagb na neenl'
));

LOL, classic! :D
Yes!

Jeff
>
--
Curtis
Aug 10 '08 #37

This discussion thread is closed

Replies have been disabled for this discussion.