This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
5506
Features / Re: timeformat annoys me...
« on April 12th, 2012, 07:02 PM »But surely you can't do it only once?
If you load French, you load French after you load English... so you need to rebuild it when French is loaded - surely you need to do it just when $template_name === 'index' so that you always rebuild it properly when changing languages?
5507
Features / Re: timeformat annoys me...
« on April 12th, 2012, 05:23 PM »
Having issues with loadLanguage.
Basically, I want to call that code only once... But how do I determine that I'm in a 'first loop' and should skip? I could test for $fatal, because it's only set for Settings and ThemeStrings (which IIRC are deprecated...? At least ThemeStrings?!), but it feels like a bit of a hack... if (!$fatal && $template_name === 'index')... Would that be okay?
:edit: if ($fatal), sorry.
Okay, I added a new param, $fallback, which should make it less of a hack now... ;)
It seems to be working, too. I added the code in the code block that was already dealing with setlocale, meaning it saves time because in fallback mode it would execute it twice.
And I think that it's safe enough to assume that all language files will have both $txt['time_format'] and $txt['day_suffix'] set (even to the same value as English is okay...)
Basically, I want to call that code only once... But how do I determine that I'm in a 'first loop' and should skip? I could test for $fatal, because it's only set for Settings and ThemeStrings (which IIRC are deprecated...? At least ThemeStrings?!), but it feels like a bit of a hack... if (!$fatal && $template_name === 'index')... Would that be okay?
:edit: if ($fatal), sorry.
Posted: April 12th, 2012, 05:11 PM
Okay, I added a new param, $fallback, which should make it less of a hack now... ;)
It seems to be working, too. I added the code in the code block that was already dealing with setlocale, meaning it saves time because in fallback mode it would execute it twice.
And I think that it's safe enough to assume that all language files will have both $txt['time_format'] and $txt['day_suffix'] set (even to the same value as English is okay...)
5508
Bug reports / Re: Board order issues
« on April 12th, 2012, 04:40 PM »
I guess so.
I just don't want to be pushed back by things like that. I'm already worried enough about game changers like the privacy query. (which I'm always postponing as you can see...)
I just don't want to be pushed back by things like that. I'm already worried enough about game changers like the privacy query. (which I'm always postponing as you can see...)
5510
Bug reports / Re: Board order issues
« on April 12th, 2012, 04:02 PM »
The issue with performance is that when you start, you never know how much you're going to gain...
For instance, saving 95% performance on timeformat() is great. Realizing that this means saving less than a millisecond sucks...
Saving 5% in parse_bbc() for that matter, would be much nicer ;)
In our case though... If we're going to worry about filesorts every time we change a query, I don't know about you but I'll just stop doing queries altogether...
For instance, saving 95% performance on timeformat() is great. Realizing that this means saving less than a millisecond sucks...
Saving 5% in parse_bbc() for that matter, would be much nicer ;)
In our case though... If we're going to worry about filesorts every time we change a query, I don't know about you but I'll just stop doing queries altogether...
5511
Features / Re: timeformat annoys me...
« on April 12th, 2012, 03:48 PM »
- There's only one timezone that isn't based on increments of 30mn, and it's Katmandu, Nepal. I don't think that Nepal is worth bothering too much about proper time offsets.
So, I've done some testing with this mini-cache... Turns out that it can save up to 50% performance when applied to topics with chat-like conversations. However, in other situations it doesn't save anything (oddly, I could even reproduce a case where it made everything slightly slower...)
Still, given that we're mostly within a one-millisecond performance optimization, maybe it just isn't worth getting into a fight with Nepal. :P
- time format isn't obsolete. I think you confused it with time offset...?
- using an array is a good suggestion indeed. Here's wondering, though, if it'd be worth it in terms of PHP parsing... I know that for instance, if you add an unserialize() call within a language file, or any file, it actually loads much faster than the regular array notation. Also... Where should we build support for arrays? In number_context() directly? Or in the first call to timeformat()?
So, I've done some testing with this mini-cache... Turns out that it can save up to 50% performance when applied to topics with chat-like conversations. However, in other situations it doesn't save anything (oddly, I could even reproduce a case where it made everything slightly slower...)
Still, given that we're mostly within a one-millisecond performance optimization, maybe it just isn't worth getting into a fight with Nepal. :P
- time format isn't obsolete. I think you confused it with time offset...?
- using an array is a good suggestion indeed. Here's wondering, though, if it'd be worth it in terms of PHP parsing... I know that for instance, if you add an unserialize() call within a language file, or any file, it actually loads much faster than the regular array notation. Also... Where should we build support for arrays? In number_context() directly? Or in the first call to timeformat()?
5512
Bug reports / Re: Board order issues
« on April 12th, 2012, 03:29 PM »
Not only that, but any given category is unlikely to have tons of boards in it.
So, a filesort on.... a dozen entries at best? It's not going to kill performance, is it...?
So, a filesort on.... a dozen entries at best? It's not going to kill performance, is it...?
5513
Archived fixes / Re: In passing...
« on April 12th, 2012, 03:14 PM »
Again *sigh*:
- don't post full paths in your error logs...
- if anything happens and it doesn't happen a minute later, then you probably loaded a page while I was working on it. (In this case, I was working on the pretty URL code, meaning I had to reupload the Subs-Template.php file which also contains the wetem class, so during the few seconds when it was being uploaded, it was no longer accessible to the server itself. Hence the error message.)
This is the kind of thing that happens when you're on a forum that's being worked on in real time. It's the downside. The upside, of course, is that Wedge will no longer 'hide' any of its features ;)
- don't post full paths in your error logs...
- if anything happens and it doesn't happen a minute later, then you probably loaded a page while I was working on it. (In this case, I was working on the pretty URL code, meaning I had to reupload the Subs-Template.php file which also contains the wetem class, so during the few seconds when it was being uploaded, it was no longer accessible to the server itself. Hence the error message.)
This is the kind of thing that happens when you're on a forum that's being worked on in real time. It's the downside. The upside, of course, is that Wedge will no longer 'hide' any of its features ;)
5514
Features / Re: timeformat annoys me...
« on April 12th, 2012, 03:11 PM »Getting back to the most immediate topic at hand (suffixes for dates), ignore the English suffixes when a non-English language is in use. Over-write the strings if that would help...
5515
Features / Re: timeformat annoys me...
« on April 12th, 2012, 02:51 PM »No, it's not a complete list of all timezones. There are nearly 500 (no that's not a typo) timezones to contend with. I've reduced it to a list of about 70 (75 IIRC) which are comparable to the ones Windows uses. Incidentally I think you'll find XenForo uses a similar if not the same list.
Check the timezone column in wedge_members to see what it's actually using for you - I'm on UTC Dublin, despite the server not being so.
So I changed my time format but forgot to also set my timezone, and as a result my forum pages were all showing dates that were late by one hour. :(
Meaning that Wedge should try and determine which timezone to use by default.
Also, as far as I can determine, Amsterdam is not the same physical timezone but shares all the same rules with the Central European timezones, so that it is to all intents and purposes the same.
UTC+1 - Brussels, Copenhagen, Madrid, Paris...
If Copenhagen, which is further east compared to Amsterdam, is in the same timezone as Madrid which is further west to it, it probably means that they don't share the same 'rules' when it comes to daylight savings etc... Maybe they're set on a different (but close enough) day, I don't know.
What I know though, is that Wedge is 50% French and I demand a Paris timezone in the list :lol:
Regarding dates, I don't have a better solution, I'd prefer it to be as 'right' as possible, ultimately. April 1st would be better than April 1 which would be better than 1 April, but it's almost more a preference than anything else right now.
I was thinking of something, can you tell me what you think...?
So, we have a UNIX timestamp to begin with. Doing $timestamp - ($timestamp % 1800) will round it to the half-hour, and since no timezones exist that require a 15mn granularity, it means that all dates between 14:00 and 14:30 (for instance) will be on the same day (whatever the server time), and will thus use the same code path.
So, I'm suggesting this: store the rounded time in a static array, and if it's set, get the format from it. Otherwise, just calculate the format and then store it in the index as the rounded time.
Although it won't be helpful everywhere, just imagine a topic page... If some people start discussing like they're on a chat, you can end up caching the time format for nearly every single date retrieved from that page.
What do you think...? Does it work as a concept?
And yeah, optimising timeformat is one of those cases that it'd be neat but ultimately not a huge win in the scheme of things (IIRC, I already did some work to make it faster than SMF's by changing the setlocale call handling)
5516
Bug reports / Re: Board order issues
« on April 12th, 2012, 02:32 PM »
Considering that clicking on a category in the linktree (which is AFAIK the only way to access a category page) is not something people will do 70 times a day, I added the ordering to the category listing...
I'm not sure why it does the sorting naturally if b.id_board isn't tested against, but it doesn't really matter. It's not going to make the forum any slower anyway...
I'm not sure why it does the sorting naturally if b.id_board isn't tested against, but it doesn't really matter. It's not going to make the forum any slower anyway...
5517
The Pub / Re: The Cookie Law (in the UK at least)
« on April 12th, 2012, 11:28 AM »
Didn't think we'd fall into conspiracy theories so quickly :P
5518
Bug reports / Re: Pretty URL remarks
« on April 12th, 2012, 09:23 AM »
I'm sure it's just a 'simple' mistake somewhere...
5519
Off-topic / Re: Random idea: non-generic default avatars
« on April 12th, 2012, 12:42 AM »
Oh yes! I forgot it's only here for now...
5520
Bug reports / Re: Pretty URL remarks
« on April 12th, 2012, 12:41 AM »
The more I simplify the code, the slower it gets... Sweet. And it broke this site without me knowing. Sorry.