Mobafire League of Legends Build Guides Mobafire League of Legends Build Guides
's Forum Avatar

Randomize Code...

Creator: jhoijhoi
August 1, 2012 4:51am
15 posts page 1 of 2 Forums » Site Support » Randomize Code...
Permalink | Quote | PM | +Rep | Commend by jhoijhoi » August 1, 2012 4:51am | Report
... doesn't seem to be working in forum posts?

http://www.mobafire.com/league-of-legends/forum/build-and-guide-discussion/mobaverse-library-16669

I'm trying to get a series of links to randomize within my post in order to make exposure "fair", but currently it's just "stuck" on one link when you refresh the page... :/
jhoijhoi's Forum Avatar

Awards Showcase
Show more awards
jhoijhoi
<MOBAFire Mother>
Posts: 13961
Joined: Mar 20th, 2011
Rep: Exalted (1943)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by Lugignaf » August 1, 2012 11:39am | Report
I know for a fact that it works on forum posts.

Maybe, because of how you coded it, it's messing up?

3

You should a random number from 1-3 here.

EDIT: Okay... It used to work. Now it seems borked.


Thank you to jhoijhoi for the sig, and all the dividers in the guide.

Lugignaf's Forum Avatar

Awards Showcase
Show more awards
Lugignaf
<Moderator>
Posts: 10966
Joined: Feb 8th, 2011
Rep: Renowned (562)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by jhoijhoi » August 1, 2012 4:00pm | Report
^^ Yeah, it used to work. Like, it was literally working, but as soon as I added links, it just stopped working.
jhoijhoi's Forum Avatar

Awards Showcase
Show more awards
jhoijhoi
<MOBAFire Mother>
Posts: 13961
Joined: Mar 20th, 2011
Rep: Exalted (1943)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by Mowen » August 1, 2012 4:53pm | Report
I know Matt fixed something in the code a while back, maybe it broke this. So I'm sure he'll get on this soon.
Thanks to Minho for my sig!
Mowen's Forum Avatar

Awards Showcase
Show more awards
Mowen
<Production Coordinator>
Posts: 6333
Joined: Nov 7th, 2010
Rep: Renowned (580)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by Canoas » August 2, 2012 9:07am | Report
A few weeks ago, when I changed my sig, I noticed that the randomize code didn't work on forum posts. I assumed it was supposed to be that way, but if it's not then please fix it. It's a very... interesting feature.
Canoas's Forum Avatar

Canoas
<Member>
Posts: 3064
Joined: Nov 9th, 2010
Rep: Prominent (153)
Profile
Permalink | Quote | PM | +Rep | Commend by Matt » August 3, 2012 2:54am | Report
The randomize feature was created for use in signatures to help you guys include more information and creativity in your sigs without having 90% of every page just be massive signatures. It wasn't meant to be used anywhere else.

The nature of our bbcode system currently means you can use any tag anywhere unless I specifically add code to block it in some areas. So you can use randomize elsewhere, but since caching happens AFTER the bbcode is rendered, the cache will include whatever random item was selected. Next time the cache rebuilds, the randomize will run again and a different item will get selected. So jhoijhoi if you check back after a while, and the cache has cleared, you'll see a different item.

I specifically disable caching in signatures just to allow randomize to work, it means more load on the server but you guys like the feature a lot so I deal with it. Elsewhere on the site, to make randomize work I either have to disable caching or I have to make it entirely client-side. I can't disable caching, and I'm not super keen on making it client-side...

Note that the forum didn't always have a lot of caching, but some time ago I had to start adding it in to reduce load, mainly caching compiled bbcode.

You might also want to know that, guest caching is much more aggressive. If you log out and look at the forums, signatures will stop randomizing on every page load. That only happens for members. It's because I cache the entire page all at once for maximum speed.
Matt's Forum Avatar

Awards Showcase
Show more awards
Matt
<Administrator>
Posts: 4265
Joined: Dec 8th, 2009
Rep: Renowned (665)
Profile
Permalink | Quote | PM | +Rep | Commend by jhoijhoi » August 3, 2012 4:47pm | Report
Ah okay Matt, thanks for that. I wasn't aware that it was a caching issue, as I remember a while ago us regulars would make luls posts with the randomise code in the forums, but I guess that was before you tried reducing the load :)

It's not necessary for the randomise code to work in the forums. The only reason why I was trying to use it was to achieve the same sort of effect as the front page; a set of new guides would appear every time you revisited.

But yeah ^^
jhoijhoi's Forum Avatar

Awards Showcase
Show more awards
jhoijhoi
<MOBAFire Mother>
Posts: 13961
Joined: Mar 20th, 2011
Rep: Exalted (1943)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by Matt » August 5, 2012 3:15am | Report
Yeah, it would be nice to be able to do stuff like that. Hell, if we could disable caching across the entire site, that would be awesome, we could do some wicked stuff :((( But we can't :(((

I'm about to ramble on about some tech stuff that may bore many of you so, feel free to tune out here ;)

I have been rebuilding the bbcode system manually and I actually have a fully working hand-crafted bbcode parser that handles everything in our database (I ran database-wide batch tests to compare). It's WAAAAAY faster for two reasons. 1) No regular expressions at all, it's all low level string handling. 2) It can do multiple compile sweeps which would allow me to compile majority of tags ahead of time, cache them permanently, and then only compile the last few tags right before display (mainly tags that do not have static output, like randomize or embed build from current guide stuff). Hopefully meaning that I can do bbcode caching without breaking those things, as currently happens in many places.

The only thing it doesn't yet do though, is handle white space the same way the current library does. Which is a show stopper. The current bbcode library I use has really wonky white space handling, I hate it, but I have to simulate it or all your past guides and comments will look wrong. I just haven't had the time to work through that yet. One of these days...
Matt's Forum Avatar

Awards Showcase
Show more awards
Matt
<Administrator>
Posts: 4265
Joined: Dec 8th, 2009
Rep: Renowned (665)
Profile
Permalink | Quote | PM | +Rep | Commend by jhoijhoi » August 5, 2012 6:31am | Report
How different? If it's a factor of being worried some of our lines won't match, but it speeds the performance of the site by a huge amount, I'm sure people will be willing to accept they'll need to fiddle with code a little bit more to get their guides to fit the new system.

Sounds like a challenge though, that I hope you can overcome ^^
jhoijhoi's Forum Avatar

Awards Showcase
Show more awards
jhoijhoi
<MOBAFire Mother>
Posts: 13961
Joined: Mar 20th, 2011
Rep: Exalted (1943)
Blog   |   Profile
Permalink | Quote | PM | +Rep | Commend by Canoas » August 5, 2012 11:24am | Report
Honestly, you shouldn't allow randomize on comments or guides. It would be so easy to create confusion all over the forum. One person reading one argument, the other reading the opposite argument, and me laughing. Yes, it would be fun, but it would create needless trouble for the mods.
And in guides.. 99% of the people see the right build, but one unlucky dude would get the ****piest one possible.
"Hmm, 90%+ rating? I guess this build must be good"
Hahaha.. guess again
Canoas's Forum Avatar

Canoas
<Member>
Posts: 3064
Joined: Nov 9th, 2010
Rep: Prominent (153)
Profile

Quick Reply:

Guest commenting is currently disabled, please log in or sign up to respond!