473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Pick 5 random entrys

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
36 3776
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
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
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
<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
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
<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
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
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
<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
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
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
..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
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
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
<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
<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
<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
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
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
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
<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
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

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
<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
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
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
<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
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
<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
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
<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
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
..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

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jules | last post by:
I've searched high and low for a 3 digit number generator that will pick at random a number between 000 and 999. The only things I have found were generators that pick numbers from 0 to 999. ...
10
by: Virus | last post by:
Ok well what I am trying to do is have 1.) the background color to change randomly with 5 different colors.(change on page load) 2,) 10 different quotes randomly fadeing in and out in random...
2
by: Ini | last post by:
Hi, Is there an easy way to pick at random one record out of a recordset and then leave this recordset? I was thinking about doing a recordcount of the recordset, then find at random the...
5
by: Paul Tomlinson | last post by:
How can I randomly pick either the value integer 5 or integer 8?? I don't want a value between 5 and 8 but either the values 5 or 8 randomly. Any ideas on how can I do this please?? MA
1
by: Sven | last post by:
How much entrys can a listbox handle without crashing?
1
by: TCORDON | last post by:
How can i tell VB.NET to pick a random number from a predefined series like: 10,10,10,38,38,17,17,17,17,92 TIA
0
by: JJ | last post by:
Hi, I created the sample web service that comes when you use template in VS 2003. Had no problems compiling the web service but when I go to client app and select web ref I get multiple entrys...
6
by: Mike Langworthy | last post by:
i can not seem to get this code to work. someone please help using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program {
3
by: rhen18 | last post by:
Good day! Im working on a math drill program where the user is asked to answer random math problems that involves the +, -, /, *, and % operators. Now i dont know how to generate these randomly....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.