_ck_ (@_ck_)

Forum Replies Created

Viewing 25 replies - 2,026 through 2,050 (of 2,186 total)
  • @_ck_

    Participant

    Looks like they are really trying to hide “load” from you.

    I know of only two ways to grab it from php (there might be more?)

    echo "method 1: ".file_get_contents('/proc/loadavg');
    echo "method 2: ".shell_exec("uptime");

    Really though, should not be this hard.

    It’s possible to get better getting hosting for $150/year.

    @_ck_

    Participant

    I should point out that even your static.html serves up fairly slowly, though a little faster than the dynamic pages. Getting mysql caching may not be as big a boost as it hopefully should be. I can’t even see what your guaranteed VPS ram is.

    If you are on a VPS there is usually a seperate VPS control panel that will also let you restart services, including mysql.

    my setup lets me do a “service mysql restart” but that’s probably not universal. This is what I have in my.cnf

    [mysqld]

    # myisam-recover = BACKUP
    # delay-key-write = ALL

    max_connections = 400
    key_buffer = 16M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 1024
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 1000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 1M
    query_cache_size = 16M
    query_cache_type = 1
    tmp_table_size = 16M
    skip-innodb
    old-passwords = 1
    basedir = /var/lib/mysql
    datadir = /var/lib/mysql
    long_query_time = 1
    log-slow-queries = /var/log/mysql/mysql-slow.log
    log-error = /var/log/mysql/mysqld.err

    [mysqld_safe]
    open_files_limit = 8192

    [mysqldump]
    quick
    max_allowed_packet = 16M

    [myisamchk]
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M

    @_ck_

    Participant

    Yes it’s a suppliment to the private_forums plugin so results are additionally pre-filtered instead of just post-filtered. This helps keep topics-per-page obeyed (ie. if you want 25 listed you’ll still get 25 even if 10 have to be removed) and it also fixes a couple of areas that post-filtering doesn’t work.

    In reply to: Limit long words

    @_ck_

    Participant

    Are you interested in a plugin that will force spaces into long urls?

    @_ck_

    Participant

    Okee, try version 0.05 which has a few fixes and now uses a textarea for clarity (with maximum lines enforced):

    https://ckon.files.wordpress.com/2007/07/bb-signatures.txt?v005

    @_ck_

    Participant

    Whoops, I bet there were some situations I didn’t test for.

    Will investigate… (and she‘ll fix ’em asap)

    @_ck_

    Participant

    Well its a P4 (single core) @ 3ghz with 4gb of ram.

    The question is how many clients is it hosting, and since you have your own ip, there’s no real way to determine that.

    It’s taking almost a full second for 9 queries. Something is very, very, very wrong. You might want to enquire. If you do have access to /etc/my.cnf, you can turn on the mysql query cache and that should cause a radical improvement.

    Not related to the mysql speed but just in general, any external javascript that you don’t need to execute immediately on a page, you should add the word DEFER to it. There are two flickr scripts you should try adding it to, if it still works with it in both IE and Firefox, it will make your pages seem a little faster.

    ie.

    <script DEFER type="text/javascript" ...blah...blah

    Last but not least if they can’t fix it, you can do better for your almost $150 a year.

    @_ck_

    Participant

    Page transfer time alone was not-so-hot.

    Front page, non-cached, no-images, no external js/css was 2.84 seconds. Loading a fresh topic took over 6 seconds in my browser.

    No gzip web compression enabled.

    PHP5 (~10%+ slower than PHP4)

    There’s definitely no mysql cache – way, way too slow.

    Can you put make yourself a phpinfo.php page and put <? phpinfo(); ?> in there for us to check for other stuff? I don’t think it’s a security issue but others will have to agree or not.

    Another neat way to look at unknown servers is with this perlinfo cgi I found and hacked at a bit a few years ago. Rename that to perlinfo.cgi upload to your cgi-bin and chmod it to 755. Then we can maybe see a bit more. If you don’t know how to do all this, then nevermind.

    I need at least one static page to compare it all to.

    If you don’t mind saying, how much are you paying for this hosting? According to westhost’s page ALL clients are on their own VPS, even @ $4/mo which is kinda strange. If true, that means you can customize mysql yourself and install eaccelerator.

    top w and uptime are all done from a “shell” via SSH. You need to email them and ask them how you access your shell. If you are indeed on a VPS you should have access to one. Many shared hosting hosts block shell access because of security issues.

    @_ck_

    Participant

    For anyone running 0.8.2.x I bundled this as a proper plugin with some of my other “views” tricks:

    bbPress plugin: My Views

    optional: install bb-topic-views for the other extra views

    @_ck_

    Participant

    Er, wait a minute. This new view registation method takes away massive potential from views.

    For example you can’t manipulate the data before and/or after the BB_QUERY.

    Here’s how I find “most viewed” and “least viewed” topics and create new views for them. How the heck is this even remotely possible with the new method? The new method also takes away all natural mysql query methods, making things much more complicated and easier to make mistakes on query configuration.

    function most_views( $view ) {
    global $bbdb, $topics, $view_count;
    if ($view=='most-views') {$sort="DESC";}
    if ($view=='least-views') {$sort="ASC";}
    if ($view=='least-views' || $view=='most-views') {
    $limit = bb_get_option('page_topics');
    $where = apply_filters('get_latest_topics_where','');
    $most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) $sort LIMIT $limit");
    foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
    $topics ="SELECT * FROM $bbdb->topics WHERE topic_status=0 AND topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
    $topics = $bbdb->get_results($topics);
    $view_count = count($topics);
    $topics = bb_append_meta( $topics, 'topic' );
    }}

    .

    Absolutely no way to do that purely though BB_QUERY, at least to my limited knowledge. You’d have to hook BB_QUERY and check for what it’s doing on every call and that’s nasty.

    @_ck_

    Participant

    Show me the code how you are exposing the time/date fields to the moderators on a new post?

    @_ck_

    Participant

    Sigh, I guess I’ll tempt fate and install the latest trunk. Though I know it’s going to instantly break half a dozen plugins or more, so I need to do that when I have a full night to dedicate to it.

    I really like “views” and keep thinking of more helpful ones I can create that drill down through the data.

    You should enquire about the development priorities and directions on the bbPress dev list though, you may get more joy there.

    I find it somewhat hilarious that a *forum* development team uses a mailing list for group communications. The year 2000 called – it wants it’s static email posts back!

    @_ck_

    Participant

    Dumb question: What should I add to post.php?

    Nothing. My version of this plugin requires absolutely no template or core edits. It’s why I made it ;-)

    It’s optional to put the style in your style.css to prevent an extra stylesheet but that’s trivial and not necessary.

    Note that I’ve turned on the default options of “one signature per user per page” and “only moderators and above can have signatures”. You can edit this in the plugin (change “moderate” to “participate”)

    There are still many, many things not checked in this, like they could trick it to post 100 lines in a signature or use a HUGE image if you have “allow images” installed. This for now comes down to moderators doing their job.

    @_ck_

    Participant

    Since there’s no real way to cache bbpress as static pages like wordpress (and not that there ever really can be, defeats the purpose) if you plan to have anything bigger than a “micro-forum” it’s important your host has mysql caching and optionally but recommend, some kind of php opcode cache (ie. eaccelerator)

    Otherwise you’ll be getting emails from your host about your account creating all of the mysql load, etc.

    The problem is I think most hosts do not have the two features I mentioned enabled. At least most shared hosting that’s done on cpanel “out of the box” on defaults. They have to be a bit more tech-savvy. And then if they are that clever, sometimes they will “oversell” the box thinking it can do more work than average.

    Last but not least, on all shared hosting and VPS, you can have great performance for the moments you test it, but then a “bad neighbour” comes along and your performance will become quite bad for no reasons of your own, until the host does something about it, which can be days. Sometimes even the host can make poor decisions that will cripple your site, like backing it up during times of higher activity or allowing the statistics programs to run on dozens of clients at the exactly same time.

    I wish I could afford dedicated hosting myself! Solves most of these problems. But spending $100 per year instead of $100 a month is no contest.

    ps. 2.490 – 8 queries is not good at all if you are expecting high traffic – I have mysql cache and opcode cache and get always get under 0.300 for 10-30 queries no matter how many visitors. But I suspect I pay much more for my hosting. My guess is there’s definitely no mysql cache on there or you are paying very very little for that hosting.

    @_ck_

    Participant

    er, nevermind me, you’re doing it within bbpress…

    @_ck_

    Participant

    Oh if you are trying to do it from an integrated WordPress you’ll need to do this:

    <?
    if function_exists("get_currentuserinfo") {global $user_ID;}
    else { $user_ID=bb_get_current_user_info( 'id' )}
    if ($user_ID) { echo '<a href="/forums/profile.php?id='.$user_ID.'&tab=favorites">favorites</a>';} ?>

    untested – change /forums/ to whatever your bbpress path is.

    @_ck_

    Participant

    Forgive my ignorance but how long realistically would it be before the current trunk become the stable/released? Are we talking a few weeks or more like several months?

    Looking at the milestone history, it was five months between 0.8.1 and 0.8.2 but only a month between previous releases. Is that “XML-RPC” coding going to hold everything back until it’s done? (I’d seriously love to read why a ping mechanism is believed to be so important and the working model envisioned).

    @_ck_

    Participant

    Sounds like the pre-complied version list to download would be best then. It also allows you to do emergency holds or rollbacks if something in the SVN is discovered to be spyware or malware of somekind.

    The version list could then be gzipped and even mirrored dynamically on trusted sources (like the supposed triple mirror wordpress.com runs on)

    @_ck_

    Participant

    Web compression is on an “offered/accepted” handshake of sorts.

    It would not affect clients that do not support gzip.

    Everytime IE or Firefox (etc.) requests a webpage, it tells the server “I support gzip” in the headers and then if the server supports it, it sends it that way.

    Technically compression can be forced through the server – if trac is under the same litespeed server as wordpress/bbpress then it’s just a matter of making sure it’s enabled.

    A quick test shows both the svn+trac are using apache, so depending on which version it’s either a matter of building with mod_gzip (for apache 1.3.x) or if apache 2.0 they need to just add a couple of easy httpd.conf directives.

    Really though, Matt knows how good litespeed is over apache, both the trac+svn should on litespeed. I bet it could even work with the free 150 connection version instead of buying a license.

    @_ck_

    Participant

    Sam, is there a method way to delete a view

    or do I have to just hack and unset the $views directly?

    @_ck_

    Participant

    Ugh. So that breaks a view things I’ve done.

    I’m waiting for an addition to the plugin svn and I’ll just update there at this point. I also missed checking if the user is logged in, now fixed.

    I don’t run the newest trunk so I don’t have a way to test. Looks like I’ll have to setup a test account and install it again.

    and I just put the finishes on a nice dropdown view box too… :-(

    function views_dropdown() {
    $views_dropdown='<form name="views_dropdown" id="views_dropdown">
    <select size=1 name="views_dropdown_select" onchange="if (this.selectedIndex != 0) {location=this.options[this.selectedIndex].value;}}">
    <option value="#">SHOW ME
    > </option>';
    $views=get_views(); foreach ($views as $view => $title ) {
    $views_dropdown.='<option value="'.get_view_link($view).'">'.$views[$view].'</option>';
    }
    $views_dropdown.='</select></form>'; echo $views_dropdown;
    }

    @_ck_

    Participant

    Oh figured out how to fix the moderator’s profile, very easy to do when using my additional function – just attached more “where filters”:

    function private_forums_filter_private($where,$prefix=''){
    if (function_exists("private_forums_custom_get_options")) {
    $private_forums = private_forums_custom_get_options('private_forums');
    foreach($private_forums as $forum => $role) {
    if(!private_forums_check_user_access_to_forum($role)) {
    $where.=" AND ".$prefix."forum_id != ".$forum." ";
    }
    }
    }
    return $where;
    }
    add_filter( 'get_latest_topics_where', 'private_forums_filter_private');
    add_filter( 'get_latest_posts_where', 'private_forums_filter_private');
    add_filter( 'get_recent_user_replies_where', 'private_forums_filter_private');
    add_filter( 'get_recent_user_threads_where', 'private_forums_filter_private');

    @_ck_

    Participant

    Wow I was making it too complicated! Try this…

    I managed to use internal functions but there’s a catch with get_recent_user_replies in that all topic data is not attached properly so I have to run through get_topic to pull all the cache data out again (the only proper way to do it without peeking in the cache directly)

    <?php
    /*
    Plugin Name: my views
    Description: views for a user's topics started and other participated topics
    Plugin URI:
    Author:
    Version: 0.01
    */

    function my_views_filter( $views ) {
    global $views;
    $views['my-topics'] = "Topics I've Started";
    $views['my-posts'] = "Topics I've Participated In";
    return $views;
    }
    add_filter('bb_views', 'my_views_filter');

    function my_views_action( $view ) {
    global $bbdb, $topics, $view_count; $user_id=bb_get_current_user_info( 'id' );
    if ($view=='my-topics') {$topics=get_recent_user_threads($user_id); $view_count = count($topics);}
    if ($view=='my-posts') {
    $posts=get_recent_user_replies($user_id); $topics="";
    foreach ($posts as $post) {$topics[]=get_topic($post->topic_id );}
    $topics=bb_append_meta( $topics, 'topic' );
    $view_count = count($topics);}
    }
    add_action( 'bb_custom_view', 'my_views_action' );

    if (!function_exists(bb_get_view_title)) {
    function bb_get_view_title($title) {
    if (is_view()) {$title = get_view_name(). ' &laquo; ' . bb_get_option( 'name' ); }
    return $title;
    }
    add_filter( 'bb_get_title', 'bb_get_view_title' );
    }

    ?>

    @_ck_

    Participant

    will have this working within an hour

    @_ck_

    Participant

    I haven’t seen them (doesn’t mean it doesnt exist) but I’ve figured out the framework on how to build and attach a view if you’d like to copy my homework :D

    This is the code I whipped up for “most-views” and “least-views” (which requires the view count plugin to be installed (and inserting the views column in view.php)

    function most_views_views( $views ) {
    global $views;
    $views['most-views'] = 'Topics with the most views';
    return $views;
    }
    add_filter('bb_views', 'most_views_views');

    function least_views_views( $views ) {
    global $views;
    $views['least-views'] = 'Topics with the least views';
    return $views;
    }
    add_filter('bb_views', 'least_views_views');

    function most_views( $view ) {
    global $bbdb, $topics, $view_count;
    if ($view=='most-views') {$sort="DESC";}
    if ($view=='least-views') {$sort="ASC";}
    if ($view=='least-views' || $view=='most-views') {
    $limit = bb_get_option('page_topics');
    $where = apply_filters('get_latest_topics_where','');
    $most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) $sort LIMIT $limit");
    foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
    $topics ="SELECT * FROM $bbdb->topics WHERE topic_status=0 AND topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
    $topics = $bbdb->get_results($topics);
    $view_count = count($topics);
    $topics = bb_append_meta( $topics, 'topic' );
    }
    else {do_action( 'bb_custom_view', $view );}
    }
    add_action( 'bb_custom_view', 'most_views' );

    As you can see a new view requires both 1. an action 2. a filter

    Easy once you’ve seen it, but try figuring it out from scratch!

    This bit adds the title to view pages (missing by default in bbpress)

    function bb_get_view_title($title) {
    if (is_view()) {$title = get_view_name(). ' &laquo; ' . bb_get_option( 'name' ); }
    return $title;
    }
    add_filter( 'bb_get_title', 'bb_get_view_title' );

Viewing 25 replies - 2,026 through 2,050 (of 2,186 total)