Webmastersite.net

Search    Register    Log In   


By on Jan 05, 2019 at 6:58 PM (Edited Jan 05, 2019 at 7:04 PM)

Today I've been working on how WSN performs, especially with large pages and especially when not using query caching. Specifically, when I was trying to show 132 articles at once on a page at scripts.webmastersite.net/...nistrative-tasks/switches/ it was taking as long as 30 seconds to load.

Delving into that, I found several culprits. First, when WSN is configured to only allow one vote per person per listing, there was a query that checks whether the viewer has already voted on a given listing. This was running 132 times for the 132 articles, so I changed it to pre-cached a list of all listings voted on by the viewing member (1 larger query that runs a lot faster than 132 small queries). Then I found a similar situation with the saved listings system, it was running a query on each article to see if we've saved that article -- so I cached that with a single advance query too. That's 262 queries eliminated and twice as fast a page load, but still not fast enough.

Next, I noticed that it was querying category #5 once for each article displayed. Turns out this was a parent being queried for {LINKCATNAMEWITHNAV} navigation which is shown in search results but still in the link bit template all the time even when conditionalized out. I made that method cache the categories so it only queries each category id once. That saved another 131 queries and 4 seconds.

After the above, the article processing in the middle of the page was reasonably fast -- but the page as a whole was still unacceptably slow. This turned out to be mostly because of some inefficiencies in processing huge pages (132 articles is a lot of text, even when it's just listing bit stubs). The funcreplacements() call which replaces the {FUNC_ generic function template calls was taking 3 seconds to run. This was because of hundreds of {FUNC_SHOWICON[edit]} calls running redunantly for every article. I've optimized that away so it only runs the showicon function on each icon once.

Applying...

Read Full Blog Entry


By on Jan 03, 2019 at 8:30 AM

The first release of the new year contains a variety of changes.

There was a postal code autofill issue. Normally when you enter a postcode WSN automatically fills in the city and state if they haven't been entered yet. Discovered that wasn't working when OpenCage was your geocoding provider, because WSN was looking for the city name in the wrong place. Fixed that.

Most of my time was spent on the calendar system, particularly rewriting the event joining system to use a new _eventrsvps table. Added an RSVP caps option and did a lot of work on the calendar templates.

I've finally re-enabled the HTML minification option. I never did find a new library that avoids the <option value=""> -> <option> transformation mistake, instead I've simply added a de-transformation at the end which changes <option> back to <option value="">. There's nowhere in WSN that intentionally uses <option> to mean the value should be the label, so it should be safe... hopefully.

Also added a javascript minification setting. Previously javascript minification was always on unless the developermode tweak was enabled. Changed the developermode tweak so that it turns off all 3 types of minification now. And in order to add a warning about developermode overriding settings, I ended up adding BOOL versions of the {TWEAK template variables to enable conditionals that check if tweaks are enabled... e.g. <IF {TWEAKDEVELOPERMODEBOOL}>Warning:This value is overrridden by the developermode tweak!</IF>

For the future, I'm pondering what the best way to do a development / production toggle would be. I'm thinking something on the front page of the admin panel that can temporarily disable every option that gets in the way of debugging when you toggle it to development mode. Then when you put it in production mode it turns all the temp-disabled options back on and suggests a list of additional things (like URL rewriting and minification) that...

Read Full Blog Entry


By on Dec 25, 2018 at 11:43 PM (Edited Dec 25, 2018 at 11:47 PM)

As a last minute Christmas present for you, I've enhanced WSN's advertising system in several ways.

First, I've added device and country targeting. Device targeting allows you to set certain ads to only show on mobile or only show on desktop/laptop. This is useful when you have differently sized or differently targeted ad code for phones versus desktop. Country targeting, which depends on IP geolocation being turned on, is useful if you have certain ads or ad networks that are only good for a particular country or set of countries. For example, if you're advertising an offer only available in the USA you can limit the ad to only show in the USA so that your international visitors are served something else potentially more useful.

After those changes, the frequency percentage system had come to look absurdly complicated. A set of percentages that adds up to 100 in one country might not add up that way in another, thanks to country targeting. Likewise with device targeting your ads in a slot might add up to 100% on desktop but 120% on mobile. It was clear that percentages were not the ideal way forward.

Also, I found that WSN's ad display logic was regluarly repeating display of the same ad until it could bring that ad's impressions count up to the desired percentage. That's bad, because an ad may have been created much more recently than a different ad or percentages may have been changed. Essentially, this was causing new ads to be the only ones shown for long periods.

The solution to both issues? A new frequency system that calculates relative odds for display of each ad. First, WSN determines which ads are eligable to be viewed by the person viewing this ad slot on the current page (removing any ads from other ad slots or targeted at other devices or countries from consideration). For each remaining ad, it calculates a weight: a random number between 0 and the frequency number you've specified. Whichever ad ends up with the highest weight gets displayed. This ...

Read Full Blog Entry


By on Dec 23, 2018 at 3:38 AM

10.3.26 brought a whole slew of new mobile fixes/enchancements too numerous to go into detail on, so let's talk about the non-mobile changes.

The first change you'll notice is that the release notes are now on permanent display on the front page of the admin. This way, your site automatically updating itself doesn't prevent you from seeing the list of what changed.

While doing the mobile stuff, note I moved the delete boxes on the edit listing/category/comment/member/field/help pages to the bottom and made them collapsed by default. This has a dual purpose: it reduces the amount of scrolling needed to get to the more commonly used content (especially important on mobile), and it serves as a confirmation of intent to delete since it takes two clicks/taps now.

Recently I removed a bunch of dead IM fields like AIM, Yahoo, MSN messenger. Now I've repurposed that section as "social" and added a twitter field. This should soon enable displaying recent tweets on a person's profile or by their listings/comments.

I've added a "login with meetup" option to go along with the facebook and google oauth federated sign-ins. It imports their meetup pic as avatar, their meetup interests and bio etc to the respective WSN fields. It also imports the member's twitter handle if they've supplied that to meetup. Meetup sends the person's first name usually as the only name identifier, so there will be a lot of name colissions causing WSN to append random numbers to the end of the names to make them unique. And unfortunately, meetup does not allow requesting the member email address. The member is logged in, but next time they try to edit their profile (and before they get any notifications) they'll have to enter their email if email is a required field on your site.

Non-mobile fixes in both 10.2 and 10.3 included a fuller proper fix to bulk add URLs, the member personal link list (which was redirecting to the index since who knows when), a tiny little map pin apostrophe encoding issue, a...

Read Full Blog Entry


By on Dec 20, 2018 at 12:03 AM

On a phone, your worst enemy is user input that happens to be slightly longer than you expect. The pages you check look fine, but then along comes the submitter who has a really long URL for their listing and suddenly the display of that URL on the listing details page is causing a horizontal scroll on people's phones. Today I've addressed that problem by adding the following lines to the base.css/bootstrapbase.css to be applied only on small screens:

.detailedinfo { display: inline-block; word-break: break-word; }
.urlarea .thumbshot { float: none; }

That forces long URLs shown on the details page to wrap onto multiple lines even though they have no spaces -- hopefully that inline-block doesn't have unintended sideeffects on other elements, I didn't see any. And the other line makes the URL start below the thumbshot instead of next to it, so it has more space to fill out.

Relatedly, I found that listings with very long titles (even with spaces) were causing their categories to become potentially wider than the screen. This proved a much more frustrating problem. It's easy to solve if you remove the tables and use a div only layout, but I can't assume that everyone will want to do that so I had to wrestle with the oddities of table layout CSS. In the end, based on a stackoverflow suggestion, I came up with this nonsensical voodoo that somehow works:

td.link
{
max-width: 0; /* I know it makes no sense, but it works, and removing it breaks */
}

.panel-title
{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

The .link panels continue to have a greater than zero width in defiance of all logic. Notably, if i apply the CSS to .panel instead of .link then logic does semi-apply to all other panels except the .link ones and they shrink to at least near nothing. Presumably it's something about being a <td> element that makes logic not apply at all. Thus if you happen to be using a tableless div layout with class="link" I almost...

Read Full Blog Entry

<< January 2019 >>
SunMonTueWedThuFriSat
12345
6789101112
13141516171819
20212223242526
2728293031

Recent Comments