LIVE FORUMS / ARCHIVES / 2008
PolishForums - ARCHIVE Witamy in PolishForums Archive :
Archives / 2008 / News, Announcements / posts: 26

"Random Topic" feature completed


AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 16:32 /  #
A new small feature - Random Topic - has been developed. It randomly generates a topic out of all available topics and automatically redirects the requester to the generated topic page.

It may be useful especially for long-term members who spend a lot of time on the site :).

Admin

sausageThreads: 25
Posts: 1,053
Joined: Sep 21, 07
  Nov 6, 08, 16:48 /  #
Admin:

generates

selects!
PF members (especially Lodztheboat) provide enough random topics all by themselves
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 17:12 /  #
sausage:

selects!

Randomly generates a topic number.
osiolThreads: 59
Posts: 4,714
Joined: Jul 25, 07
  Nov 6, 08, 17:19 /  #
This makes me think of "Just a minute". Do we have to respond to the thread generated without hesitation, repetition or deviation?
Shawn_H   Nov 6, 08, 17:23 /  #
I see topic titles, but alas, no topic numbers.

Can we chat randomly in the randomly generated topic of discussion?


While you are fixing things, at the bottom of the page, it reads:

Similar Threads | Latest | Unanswered | Random top of page


Can you take the Bold Font off of the Similar Threads linky thingy? I am more interested in seeing the latest topics of discussion and would prefer to see that in bold.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 17:27 /  #
Shawn_H:

I see topic titles, but alas, no topic numbers.

29493 is the topic number of this thread.

Shawn_H:

Can we chat randomly in the randomly generated topic of discussion?

No.

Shawn_H:

Can you take the Bold Font off of the Similar Threads linky thingy? I am more interested in seeing the latest topics of discussion and would prefer to see that in bold.

The Latest Discussions link appears three times on each page while Similar Threads only appears on the thread page; that's why it's bolded. Besides, most people reading a thread will probably find the Similar Threads link more relevant (ie. they want to find out more about the particular topic).
osiolThreads: 59
Posts: 4,714
Joined: Jul 25, 07
Edited by: osiol   Nov 6, 08, 17:30 /  #
The art of using PF.

1st tab in browser: Latest Discussions
2nd tab in browser: Random Chat (just in case)
3rd tab in browser: Some Polish language thread to make an attempt with reading.
4th tab and onwards: Whatever seems to be going on at the time.

Refresh Latest Discussions frequently.
Copy text to clipboard before posting, just in case.
Post first, edit later.

edit: and now there is something else to think about, as if all that wasn't enough.
Told you post first, edit later. Now you can see why - it's only now that I've actually made my point.
plk123Threads: 30
Posts: 6,410
Joined: Aug 29, 07
  Nov 6, 08, 21:09 /  #
Admin:

Randomly generates a topic number.

still a pick more then a generation. generate insinuates making something new.. nothing new about an old random topic.

Admin:

Shawn_H:

Can we chat randomly in the randomly generated topic of discussion?

No.

then wtf is the point? i say that because i had your link pick some threads and all of them were old and completely uninteresting. and since you tell us we can't randomly respond to them, then i see no real reason for the link. if one is that bored then one needs to get a life besides there is always the more useful "unanswered posts" linky.

sausage:

PF members (especially Lodztheboat) provide enough random topics all by themselves

-

lol. tru, tru..
osiol:

1st tab in browser: Latest Discussions

that's really all one needs if they have fast connection. but i tab all the topics i want to read and possibly respond. once done then i'll refresh the latest and close the rest.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 21:31 /  #
plk123:

still a pick more then a generation. generate insinuates making something new.. nothing new about an old random topic.

There are more uses of "generate a number" than "select a number" - and as far as I know no number is anything new.

plk123:

then wtf is the point? i say that because i had your link pick some threads and all of them were old and completely uninteresting. and since you tell us we can't randomly respond to them, then i see no real reason for the link. if one is that bored then one needs to get a life besides there is always the more useful "unanswered posts" linky.

Then you were probably out of luck, try again :}. Or you could make them more interesting by providing an interesting comment.. You can randomly respond to them as long as they are on topic, of course. The random link also includes the more useful unanswered topics.

plk123:
that's really all one needs if they have fast connection. but i tab all the topics i want to read and possibly respond. once done then i'll refresh the latest and close the rest.

I've personally almost never use it, the Checker does the job much more efficiently. Maybe that's why I still have time to click on the random topic link ;).
z_dariusThreads: 22
Posts: 5,091
Joined: Oct 18, 07
  Nov 6, 08, 21:34 /  #
Admin:

sausage:

selects!

Randomly generates a topic number.


No quite. If anything, there is a selection.

Your code cannot just generate a topic number. It must select from available topic numbers. Otherwise the likelihood of an exception is just way too high.

So, the feature uses a random number generator to generate a number between the lowest and highest available topic numbers. Then, using that randomly generated number it display a topic whose unique ID is equivalent to the number.

To generate a topic, the algorithm would have to use a dictionary of English words. The simplest code would be much more complex than one or two lines plus the simple SQL statement. And it would still generate nonsense.

What you did is an OK feature though.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 21:39 /  #
Technically it uses the php rand() function which - by definition - "generates a random integer." That's why I used the word "generate" instead of "select" (even though it's true a selection from the database follows).
z_dariusThreads: 22
Posts: 5,091
Joined: Oct 18, 07
  Nov 6, 08, 22:08 /  #
Admin:

Technically it uses the php rand() function which - by definition - "generates a random integer."


It does. But you did not use rand(). You used rand($min,$max) so in fact the function you used returns a number from within a finite range of numbers. This is called selection.

You couldn't have used rand(), without parameters because you are not using an operating system with an addressable space of less than 32 bits. Under a 32 bit OS rand() would generate up to 4,294,967,296 possibilities. As of now you have only 13,076 topics, so a chance of selecting a valid topic would be minimal, and not a whole lot better than a chance of winning the top prize in an average lottery. That means that most of the time PF users would see this:

"Discussion doesn't exist. It was deleted by moderators, moved to another forum, or archived. Did you make sure to follow the Topic Title Creation Rules? "

If your OS is a 64bit one (i.e. 18,446,744,073,709,551,616 possible integers) then the chance of selecting a valid topic ID by the use of rand() would approximate 0.

These are seemingly details but I was actually expecting some interesting lexical action having read the the first post in this thread. From the user's perspective the code behind the new link did not generate a topic, or a number. It (pseudo) randomly selects an existing topic.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 22:19 /  #
z_darius:


It does. But you did not use rand(). You used rand($min,$max) so in fact the function you used returns a number from within a finite range of numbers. This is called selection.

I cannot argue with the W3 definition; yes, it uses rand (min,max) as described in the syntax definition. The guys at W3 surely know that too and they still used the word "generate" ;).

Another definition from the horse's mouth:

rand — Generate a random integer
z_dariusThreads: 22
Posts: 5,091
Joined: Oct 18, 07
Edited by: z_darius   Nov 6, 08, 22:41 /  #
Admin:

I cannot argue with the W3 definition;

I am not arguing with the definition at W3, nor am I arguing with you. So let's just switch to a chat mode.

The W3's definition is good for the purpose for which the site is created - to explain the functions of various.. well, functions. W3 is not a computer science site and so it does not go into the nature of so called computer based random number generators. In fact all these generators are properly called pseudo random number generators because they are not truly random. They use no random elements (variables, constants or what have you) so they can be reverse engineered and therefore predicted and that's why all those machines in Las Vegas can be cracked. And sometimes they are.

The degree of predictability may be very high or extremely low, but theoretically all pseudo random numbers can be predicted and thus are not truly random. Mathematicians still haven't decided if randomness is even possible in nature. But that's another story.

What's more, rand() functions in all languages always have one limitation - a range from which numbers are randomly selected. If you are not completely free to generate a number, but rather have to pick one from the available numbers then it is certainly a selection. Your selection may be random but the numbers from which you are pseudo randomly selecting are not. They are known before you even consider making your selection.

In the particular case of your code you had to go even further - the numbers you select from are incremental values from one of your db's table fields, and so you had to limit the number space to be between the lowest and the highest topic IDs. This is definitely a selection. Yes, the selection is a pseudo random one, but nevertheless it is a selection form a finite set of numbers. Using the result of that selection your code displays a topic.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 22:44 /  #
That should conclude the discussion and now everyone should clearly know how the new feature works.
EurolaThreads: 6
Posts: 2,647
Joined: Dec 2, 06
  Nov 6, 08, 22:52 /  #
We will see how this highly technical stuff works when us - just regular folks - start to use it :)
plk123Threads: 30
Posts: 6,410
Joined: Aug 29, 07
  Nov 6, 08, 22:55 /  #
it'll crash the server.. you watch. hehe
EurolaThreads: 6
Posts: 2,647
Joined: Dec 2, 06
  Nov 6, 08, 23:09 /  #
Oh no, careful please. What would we do without PF? It would be a disaster to come to the website and see a blank screen with some server error on it.
shopgirlThreads: 7
Posts: 1,446
Joined: Apr 6, 07
  Nov 6, 08, 23:09 /  #
Admin:

That should conclude the discussion and now everyone should clearly know how the new feature works.

Wha? *makes big eyes reading all that stuff*

But it is kinda cute to watch you guys get all geeky with your compi stuff! *grins*
z_dariusThreads: 22
Posts: 5,091
Joined: Oct 18, 07
  Nov 6, 08, 23:12 /  #
plk123:

it'll crash the server.. you watch. hehe


Perhaps not crashes but minor trouble - depending on how the admin deals with deleted/merged topics.

Because of those deletions there is a possibility for the code to select a number of a post that has been removed. In such situations the best case scenario will be a controlled error message. I'm not sure about the admin's approach to coding so I would not insists that crashes will or will not happen because of the new feature.
plk123Threads: 30
Posts: 6,410
Joined: Aug 29, 07
Edited by: plk123   Nov 6, 08, 23:16 /  #
i wasn't talking coding and that op. just you wait. but he'll time it out further rendering it useless. :D
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 23:19 /  #
z_darius:

Perhaps not crashes but minor trouble - depending on how the admin deals with deleted/merged topics.

It only takes one simple database query and only runs when someone clicks on the link (not on every page refresh).

z_darius:

Because of those deletions there is a possibility for the code to select a number of a post that has been removed. In such situations the best case scenario will be a controlled error message. I'm not sure about the admin's approach to coding so I would not insists that crashes will or will not happen because of the new feature.

Actually, the script first checks if the thread exists and only after that it selects one (similarly, it first checks if anonymous vs. logged member clicks on the link not to show Off-topic threads for anonymous users, etc.).
z_dariusThreads: 22
Posts: 5,091
Joined: Oct 18, 07
  Nov 6, 08, 23:28 /  #
Admin:


It only takes one simple database query and only runs when someone clicks on the link (not on every page refresh).


Of course queries run only when someone clicks a link. After all you are displaying dynamically created static pages.

Admin:

Actually, the script first checks if the thread exists and only after that it selects one (similarly, it first checks if anonymous vs. logged member clicks on the link not to show Off-topic threads for anonymous users, etc.)


Lost CPU cycles, but this is perhaps the best approach.
AdminThreads: 74
Posts: 3,059
Joined: Oct 31, 05
[Administrator]
  Nov 6, 08, 23:33 /  #
z_darius:

Of course queries run only when someone clicks a link. After all you are displaying dynamically created static pages.

In this case the topic is selected only after someone clicks on the "Random Topic" link (another approach would be to actually select the topic when someone visited any page). In other words, this script isn't activated and you don't know which topic will be selected only after you click on the "Random Topic" link.
DaisyThreads: 16
Posts: 2,172
Joined: Apr 28, 07
Pictures: 2
  Nov 7, 08, 00:00 /  #
I can't see me using this much, I have no desire to become a carpenter in Sweden
SeanusThreads: 22
Posts: 30,160
Joined: Dec 25, 07
  Dec 6, 08, 15:13 /  #
This is an interesting idea. I'm surprised it slipped down the threads.

Go UPtop of page


Similar discussions:

Similar to: "Random Topic" feature completed
Editing topic title by Admins or Moderators
An English person in Poland, some random thoughts
PM feature - how to turn it off?
Today's Polish Name Day - New Feature
Where to find a physical feature map of Poland?
New feature: Blocking All Private Messages
The "Poland Polls" feature has been released
What's up with the "Quote" feature?

Would you like to be a PF moderator? If so, read on!  A new forum about Working and Studying in Poland was added

Random: Why we talk about Nazis not Germans
Archives / 2008 / News, Announcements /posts: 26


This forum is archived (read-only).
Category:
© 2005-2010 PolishForums.com | PolishForums LIVE | Archives | Random | Statistics