howtogeek (@howtogeek)

Forum Replies Created

Viewing 25 replies - 51 through 75 (of 127 total)
  • @howtogeek

    Member

    That doesn’t seem too difficult to believe, I ran bbpress through phped profiler and it looks like the templating makes it slightly slower than if you directly outputted the code like most other forums do.

    Which does make sense… what I’ve been considering is making a theme that doesn’t use all the filters but directly outputs the data.

    That theme author should seriously consider moderating his forum… there’s nothing but spam on it.

    @howtogeek

    Member

    You should put up a donate button on your page… or just get really familiar with vim =)

    I’m thinking that 0.05 seconds to render a page is really quite good for most sites… I can’t seem to find a big forum that includes the render time in the page source.

    What I’ve been thinking about, however, is that a customizable caching plugin would be really useful, especially for the really old posts that are mostly viewed via a google search. Been reading through the wp-cache2 source to see if there’s really all that much to it.

    @howtogeek

    Member

    They are both slower than all hell for me.

    I’m very interested in your fastload plugin… but I wonder if it would matter much for opcode cached sites.

    Seems like the majority of the problems in speed I’m getting are from the repeated hooks in tight loops.

    @howtogeek

    Member

    Sweet stats there…. I’m still working on trimming some time off the page loads.

    Yeah, MediaTemple’s best dedicated virtual server is $150 / month, and that’s what I’m using. I don’t pay that much because I’m in their partner program, but I wouldn’t mind paying it to make sure that my site is fast enough.

    I’m really quite happy with them.

    I’ll be very interested to see what you come up with on the eaccellerator front… I’ve been considering switching from xcache to that.

    @howtogeek

    Member

    With dreamhost, it really depends on what server you end up on, and what time of the day. If you are lucky enough to get on a decent server without too many others, then you’ll have fast performance, or at least tolerable.

    I couldn’t live without the VPS… and to answer your question way above somewhere, it’s 1GB dedicated. Mediatemple is great.

    @howtogeek

    Member

    Thanks for that… good thought.

    I changed it to ob_start(null,8192) instead of using the 4096 value you were using in the plugin. I noticed that when I had it set to 4096, I was still getting the really slow page render time for some reason, but 8192 works perfectly.

    I think I’ve mentioned it before, but you rule =)

    Oh, and dreamhost sucks.

    @howtogeek

    Member

    I think I figured it out… I added my own timing mechanism to virtually every line of code on the front page, and noticed the extra 0.2 seconds was occurring at random places…

    So I put ob_start(); at the beginning of bb-settings.php to turn on output buffering, and now here’s the times I get with like 16 plugins installed, logged in as admin with a ton of custom stuff going on and everything is opcached:

    total page time: 0.078 seconds.

    time to reach each section:

    bb_underscore_plugins_loaded = 0.018

    bb_plugins_loaded = 0.021

    bb_init = 0.021

    bb_index.php_pre_db = 0.024

    front-page.php = 0.025

    header.php = 0.025

    logged-in.php = 0.026

    search-form.php = 0.035

    footer.php = 0.078

    Now that is more like it! Now to remove all my logging….

    And thanks for that benchmark plugin… it’s great, I can’t live without it now =)

    @howtogeek

    Member

    After doing some more research, the plugin loading time is virtually instant when you an opcode cache.

    I added separate timestamp logging which shows that all the plugins are loaded at 0.019 but the bb_plugins_loaded action doesn’t get fired until 0.1 seconds later.

    bb-benchmark.php loaded = 0.019

    bb_underscore_plugins_loaded = 0.019

    bb_plugins_loaded = 0.102

    bb_init = 0.103

    bb_index.php_pre_db = 0.106

    front-page.php = 0.106

    header.php = 0.107

    logged-in.php = 0.107

    search-form.php = 0.116

    footer.php = 0.302

    The majority of the time is taken between search form and footer…. I’m not sure yet what gets executed between them.

    @howtogeek

    Member

    This is interesting… because bbpress loads the plugins in order, the bb-benchmark plugin is getting loaded nearly last on my system, so I only see the output from the onlinelist plugin.

    It looks like the vast majority of the execution time is before the plugins even get loaded.

    @howtogeek

    Member

    I’m running xcache opcode caching, and I have a dedicated virtual with 1GB of ram from Mediatemple. I am very committed to making sure the site loads instantly… the site in question is the one linked on my username here.

    So loading the plugins causes the speed problems? I’ve tried running phped profiler and couldn’t find where the speed issue was.

    Is it the actual parsing of the files, or loading in the functions into the filter/actions list?

    I’m considering just concatenating all the plugins into a single plugin, just to see if that makes a difference.

    @howtogeek

    Member

    Wow… I really love the topic pages, just incredible.

    In reply to: Limit long words

    @howtogeek

    Member

    Actually, seems to have flaky behavior unless you remove this line:

    remove_filter(‘post_text’, ‘make_clickable’);

    Seems to work pretty well otherwise.

    In reply to: Limit long words

    @howtogeek

    Member

    Here you are… ported from wp-chunk (literally only had to change the filter names)

    <?php
    /*
    Plugin Name: bb-chunk
    Description: Shortens the display of urls so they won't break your site theme. Ported from wp-chunk 2.0 ( http://www.village-idiot.org/archives/2006/06/29/wp-chunk/ )
    Author: The How-To Geek
    Author URI: http://www.howtogeek.com
    Version: 0.1
    */

    function make_chunky($ret)
    {

    // pad it with a space
    $ret = ' ' . $ret;
    $ret = preg_replace("#(^|[n ])([w]+?://[w#$%&~/.-;:=,?@[]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret);
    $ret = preg_replace("#(^|[n ])((www|ftp).[w#$%&~/.-;:=,?@[]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret);
    //chunk those long urls
    chunk_url($ret);
    $ret = preg_replace("#(s)([a-z0-9-_.]+)@([^,< nr]+)#i", "$1<a href="mailto:$2@$3">$2@$3</a>", $ret);
    // Remove our padding..
    $ret = substr($ret, 1);
    return($ret);
    }

    function chunk_url(&$ret)
    {

    $links = explode('<a', $ret);
    $countlinks = count($links);
    for ($i = 0; $i < $countlinks; $i++)
    {
    $link = $links[$i];

    $link = (preg_match('#(.*)(href=")#is', $link)) ? '<a' . $link : $link;

    $begin = strpos($link, '>') + 1;
    $end = strpos($link, '<', $begin);
    $length = $end - $begin;
    $urlname = substr($link, $begin, $length);

    /**
    * We chunk urls that are longer than 50 characters. Just change
    * '50' to a value that suits your taste. We are not chunking the link
    * text unless if begins with 'http://', 'ftp://', or 'www.'
    */
    $chunked = (strlen($urlname) > 50 && preg_match('#^(http://|ftp://|www.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -10) : $urlname;
    $ret = str_replace('>' . $urlname . '<', '>' . $chunked . '<', $ret);

    }
    }

    remove_filter('post_text', 'make_clickable');
    add_filter('post_text', 'make_chunky');
    ?>

    @howtogeek

    Member

    Sweet! Going to test shortly…

    @howtogeek

    Member

    This only happens for me when the “admin can post anything” plugin is installed.

    @howtogeek

    Member

    Now that’s a pretty cool idea too.

    @howtogeek

    Member

    I don’t know that you can… most of the internal pages also have a page in the root (topic.php, forum.php, etc)

    The memberlist plugin did it the same way you did.

    @howtogeek

    Member

    That got me thinking… why reinvent the wheel when I can just use the bbcode plugin.

    What I did was change the current quote plugin to insert the quote with

    Quote:
    instead of the other syntax, as well as strip out any blockquotes from the original post that you are quoting, which eliminates the multiple levels of quoting.

    So here’s my new bb_quote_message() function:

    function bb_quote_message() {
    global $bbdb, $topic;
    $post_id = (int)$_GET['quote'];
    if ($post_id) {
    $row = $bbdb->get_row("SELECT * FROM $bbdb->posts WHERE post_id={$post_id} AND topic_id={$topic->topic_id} AND post_status=0");
    $row->post_text = preg_replace( '(<p>|</p>)', '', $row->post_text );
    $ret = preg_replace("/<blockquote>((.|[nr])*?)</blockquote>/", "",$row->post_text);
    if ($row) echo htmlentities('
    Quote:
    '.$ret.'
    ', ENT_COMPAT, 'UTF-8');
    }
    }

    So far it works great… except it’s annoying that the cursor isn’t positioned at the end of the textbox… I’m gonna look for some javascript to fix that.

    @howtogeek

    Member

    I’d think it would work out much better to use something other than blockquote… that’s the whole idea behind the

    Quote:
    tag… it should be accepted by bbpress perfectly fine, and not used for any other reason.

    There’s no reason to have full bbcode support if you don’t need it, all we need is the

    Quote:
    tag.

    One of the problems with using blockquote is that somebody might already use blockquote in their posts. It would also make any old posts using blockquote completely incompatible with the new plugin.

    Otherwise you could use another tag, but then you have to modify the bbpress allowed tags list.

    And the issue here is that we are trying to indicate to the system that we are quoting something, not just trying to format the display. It’s this that gives us the ability to filter out the first quote in a multiple-quote scenario that probably happens very often.

    @howtogeek

    Member

    I am pretty busy at the moment… and you are rather amazing at creating these plugins…

    I was thinking that when generating the quoted text it would show up at the top of the textarea like this:


    |

    Quote:
    so you really like ascii?

    | that’s pretty cool

    |

    | Yeah, I love ascii… I’m a geek, afterall


    When generating that quoted text, it would be necessary to find an existing quote within the post and remove that, so the quote of a post that quotes another post then would only have the actual post. (boy was that confusing) It should be simple enough to remove anything between

    Quote:

    Then on display there should be a hook to find a pair of

    Quote:

    and replace it with a div that we can then style correctly. By only allowing a pair then you would prevent breaking divs. If the post submitter screwed up the

    Quote:
    tags, then their post would just not make sense, but wouldn’t break the design of the page.

    This is similar to the way invision does it, and it seems like a reasonable way to handle it.

    Make sense?

    @howtogeek

    Member

    Ah, sorry, I read that too quickly.

    The only issue with that is that what if there are two pages, and I want to respond to a post on the first page? It would simply be broken… clicking on the reply button there wouldn’t do anything.

    I originally was thinking that an ajax method might work, but I think even so it has to be combined with something on the server side.

    Now I’m just thinking to send the user to a url like:

    /topic/my-cool-topic?replyto=381#reply

    That way I can load up the reply in the box no matter where they click the reply link from.

    @howtogeek

    Member

    There’s another plugin that already does the javascript quote post. The problem with javascript is that you effectively end up doubling the page size by duplicating every post on the page, and there’s not a good reason for that.

    I may end up going with an ajax route, but another problem that you end up with is that you can only reply to posts on the current page.

    I figured the quote post should probably strip out any of the prior quotes.

    In reply to: plugin: bb-Polls

    @howtogeek

    Member

    I’m using php 5.1.6 on my test system, which is where I was using it.

    In reply to: plugin: bb-Polls

    @howtogeek

    Member

    I’m just getting some weird error about mysql_real_escape_string. Haven’t looked into it.

    @howtogeek

    Member

    Ohhhhh

    My test site has nothing but posts from me, no wonder I didn’t see it =)

    And to answer your question at the very top of this thread, I’m trying to use bbPress for a serious forum… I just opened my forum a little over a week ago. Not as much traffic as I’d like, of course, but decent.

Viewing 25 replies - 51 through 75 (of 127 total)