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: 3611
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
Goderator is an Angry Bitch
Goderator is an Angry Bitch
 
Posts: 4767
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: 3611
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
Goderator is an Angry Bitch
Goderator is an Angry Bitch
 
Posts: 4767
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: 3611
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
a permi-officer-complainer
 
Posts: 4001
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
The Forum Troll
The Forum Troll
 
Posts: 4160
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.
I SWEAR TO SCREW THAT SILVANIGHTMARE THING!
May the Third Alliance die, the sooner the better!
User avatar
Legofighter
Proto-Shakespeare
Proto-Shakespeare
 
Posts: 193
Joined: Sat Sep 03, 2011 2:42 pm
Location: Grammar Assassin's Kingdom

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
Infinite ideas, zero follow through
 
Posts: 2209
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:
I SWEAR TO SCREW THAT SILVANIGHTMARE THING!
May the Third Alliance die, the sooner the better!
User avatar
Legofighter
Proto-Shakespeare
Proto-Shakespeare
 
Posts: 193
Joined: Sat Sep 03, 2011 2:42 pm
Location: Grammar Assassin's Kingdom

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
The Forum Troll
The Forum Troll
 
Posts: 4160
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
piltogg wrote:Talk of raving penis hordes frighten space-sailors everywhere, causing entire civilizations to become peaceful and friendly.
User avatar
Bragallot
biggest hope: dude who does rear assault
 
Posts: 4724
Joined: Sun Aug 02, 2009 2:00 pm
Location: Coughing up cough syrup

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
my personal record is 2 blows
my personal record is 2 blows
 
Posts: 1027
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.
Lego Company wrote:...At the same time, the purpose is for the LEGO brand not to be associated with issues that glorify conflicts and unethical or harmful behavior...


:belushi:
User avatar
Colette
Saved the USA
Saved the USA
 
Posts: 1604
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
my personal record is 2 blows
my personal record is 2 blows
 
Posts: 1027
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 0 guests