Regarding the homepage

Pay attention

Moderator: Bonn-o-Tron

Re: Regarding the homepage

Postby stubby » Sun Aug 12, 2012 10:50 pm

Not sure what you did exactly, but it's killing site performance - I'm getting repeating errors across my monitoring scripts since you made whatever changes you made. It's disrupting the RSS feeds in particular.

Could be the image rotation, those scripts can be siant process hogs if you're not real careful about how they're programmed. We got the old site shut down for a couple of days because of a rotation script on the front page.
User avatar
stubby
forum janitor
 
Posts: 4859
Joined: Sat Dec 29, 2007 8:31 pm

Re: Regarding the homepage

Postby Natalya » Mon Aug 13, 2012 1:26 am

It is a ghetto piece of crap I wrote in 2 minutes with 5 lines:
Code: Select all
<?php
$lol = rand(0,11);
$image = "http://www.brikwars.com/forums/images/header_random_" . $lol . ".PNG";
readfile($image);
?>


If you got any ideas then let me know.
Image
  ▲
▲ ▲

"Each night alone I dream, that I'm a rebel Roller Queen‼
I'll be a star that shines, I can make the whole world mine‼"


Image
User avatar
Natalya
Tremble in awe, for I am become Admin, Banner of Noobs.
Tremble in awe, for I am become Admin, Banner of Noobs.
 
Posts: 5314
Joined: Wed Sep 17, 2008 10:57 pm
Location: Now in Ontario

Re: Regarding the homepage

Postby stubby » Mon Aug 13, 2012 8:39 am

Oh well that's the problem. Never, never use rand(), it's hideously expensive. Try a time() % 12 or something instead.

This is true in almost any language, not just php. rand() functions should always be avoided.
User avatar
stubby
forum janitor
 
Posts: 4859
Joined: Sat Dec 29, 2007 8:31 pm

Re: Regarding the homepage

Postby Natalya » Mon Aug 13, 2012 6:45 pm

What does time() %12 do?
Image
  ▲
▲ ▲

"Each night alone I dream, that I'm a rebel Roller Queen‼
I'll be a star that shines, I can make the whole world mine‼"


Image
User avatar
Natalya
Tremble in awe, for I am become Admin, Banner of Noobs.
Tremble in awe, for I am become Admin, Banner of Noobs.
 
Posts: 5314
Joined: Wed Sep 17, 2008 10:57 pm
Location: Now in Ontario

Re: Regarding the homepage

Postby stubby » Mon Aug 13, 2012 9:13 pm

Natalya wrote:What does time() %12 do?

time() gives the Unix timestamp, which is the number of seconds since 1970. It's basically just a pseudorandom number that increments every second. % is the modulo operator, which gives the remainder after division. So time() % 12 divides the large number by 12, and gives you whatever integer is left over - that is, some number between 0 and 11. It sounds complicated, but from a computing standpoint it's infinitely less costly than a rand() call and it's as random as it needs to be for something like this.

(time() % x) is what we went with for the rotating image on the homepage, which is why I'm more familiar with it than usual.
User avatar
stubby
forum janitor
 
Posts: 4859
Joined: Sat Dec 29, 2007 8:31 pm

Re: Regarding the homepage

Postby Tzan » Mon Aug 13, 2012 10:19 pm

Modulo is awesome, its like math majic, except spelled correctly like dictionary magic.
User avatar
Tzan
Pooplord
 
Posts: 4979
Joined: Sun Dec 30, 2007 4:41 pm
Location: Boston

Re: Regarding the homepage

Postby Zupponn » Mon Aug 13, 2012 11:55 pm

So this is why I couldn't access the forums yesterday. :house:
Image
User avatar
Zupponn
Lovable and funny
Lovable and funny
 
Posts: 5676
Joined: Mon Mar 21, 2011 6:15 pm
Location: Wisconsin, land of the cheese

Re: Regarding the homepage

Postby Legofighter » Tue Aug 14, 2012 10:27 am

:wtf: are you talking about?

This is :belushi: , not a php discussion forum.
From the frigid cold of Canada, -40 year long.
User avatar
Legofighter
Minifig
 
Posts: 215
Joined: Sat Sep 03, 2011 2:42 pm
Location: Frozen land of Canada

Re: Regarding the homepage

Postby mgb519 » Tue Aug 14, 2012 10:31 am

This is a thread where people discuss the homepage and changes to it. I believe they just discussed making changes to the PHP code of the homepage, which qualifies as part of the homepage.
Tzan wrote:
Semaj Nagirrac wrote:Well, I took some land without checking if it was owned by a faction or not. I'm not going to be banned, am I? I can destroy everything if need be.


That's what Hitler said,
in 1938.
User avatar
mgb519
Pooplord
 
Posts: 2558
Joined: Thu May 26, 2011 8:50 pm
Location: ATL

Re: Regarding the homepage

Postby Legofighter » Tue Aug 14, 2012 10:36 am

Good, :whoelse:
From the frigid cold of Canada, -40 year long.
User avatar
Legofighter
Minifig
 
Posts: 215
Joined: Sat Sep 03, 2011 2:42 pm
Location: Frozen land of Canada

Re: Regarding the homepage

Postby Zupponn » Tue Aug 14, 2012 10:57 pm

Please give legofighter the noob image in his rank.
Image
User avatar
Zupponn
Lovable and funny
Lovable and funny
 
Posts: 5676
Joined: Mon Mar 21, 2011 6:15 pm
Location: Wisconsin, land of the cheese

Re: Regarding the homepage

Postby Bragallot » Fri Aug 17, 2012 10:21 am

That flag for an avatar should be bad enough already.
Encyclopedia Bragtanica - Fantasy Battles - Scifi Battles - Crimson Crusade
lawmaster wrote:
Bragallot wrote:
lawmaster wrote:Kill the guy I'm in cc with.
He's already dead.
Kill him again.
User avatar
Bragallot
Blockguy
 
Posts: 5401
Joined: Sun Aug 02, 2009 2:00 pm
Location: Gloating over my driver's license

Re: Regarding the homepage

Postby Predator » Sun Aug 19, 2012 9:24 am

Bragallot wrote:That flag for an avatar should be bad enough already.

No shit but GET AN AVATAR ALREADY. Please. Just copy one off the interwebz. U don't have to draw one with paint.
mr.duckie wrote:
SirCheese wrote:I will be neutral. (Cuz I don't want to make enemies)


Get Him!!!! :fist:


This sig is too fucking large: show anyway
Silverdream wrote:Gaze upon my cyan complexion
And fall in love with my flying perfection
I am a pegasus of awesomeness shaped by sonic rainbooms
Sonic Rainbooms
All over my sky.
User avatar
Predator
Jaw-Jaw
 
Posts: 935
Joined: Sun Aug 14, 2011 1:45 pm
Location: In mid-air, 360-ing.

Re: Regarding the homepage

Postby Colette » Sun Aug 19, 2012 9:28 am

Predator wrote:
Bragallot wrote:That flag for an avatar should be bad enough already.

No shit but GET AN AVATAR ALREADY. Please. Just copy one off the interwebz. U don't have to draw one with paint.

I think a triple troll/pedonuker/n00b banner would suffice as an avatar.
Image
Image
Because everything's better with math...and firepower.
User avatar
Colette
I for one personally welcome clown face bologna
 
Posts: 2596
Joined: Tue Apr 12, 2011 6:04 pm
Location: This Forum

Re: Regarding the homepage

Postby Predator » Sun Aug 19, 2012 9:30 am

Colette wrote:
Predator wrote:
Bragallot wrote:That flag for an avatar should be bad enough already.

No shit but GET AN AVATAR ALREADY. Please. Just copy one off the interwebz. U don't have to draw one with paint.

I think a triple troll/pedonuker/n00b banner would suffice as an avatar.

If you get a n00b banner and a pedonuker banner it would be n00bception and the internet would crash in china.
mr.duckie wrote:
SirCheese wrote:I will be neutral. (Cuz I don't want to make enemies)


Get Him!!!! :fist:


This sig is too fucking large: show anyway
Silverdream wrote:Gaze upon my cyan complexion
And fall in love with my flying perfection
I am a pegasus of awesomeness shaped by sonic rainbooms
Sonic Rainbooms
All over my sky.
User avatar
Predator
Jaw-Jaw
 
Posts: 935
Joined: Sun Aug 14, 2011 1:45 pm
Location: In mid-air, 360-ing.

PreviousNext

Return to Announcements

Who is online

Users browsing this forum: No registered users and 2 guests