Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • admin 1:14 pm on November 23, 2009 Permalink  

    AssignToMe Bookmarklet 

    I’ve been trying to cut down on the number of addons I run. Previously I blogged about my Bugzilla “assigntome” ubiquity command. Turns out it is really easy to turn it in to a bookmarklet. Just drag AssignToMe to your bookmarks toolbar.

    Code:

    javascript:(function() {
        var logout_re = /[\s\S]*Log.*out.*[\s]\s*(.*)\s/m;
        var links = document.getElementById('footer').getElementsByClassName('links')[0].getElementsByTagName('li');
        var user_name = links[links.length - 1].textContent.replace(logout_re, '$1');
        var evt = document.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        document.getElementById('bz_assignee_edit_action').dispatchEvent(evt);
        document.getElementById('assigned_to').value = user_name;
        document.getElementById('commit_top').click();
    })();
    
     
  • oremj 12:12 pm on October 27, 2009 Permalink  

    WordPressMU: changing domain names. 

    Unfortunately, changing domain names in WordPressMU is a manual process. It’s something I’ve come across often and have to look it up each time. Here’s what I did, so I don’t have to look it up again. Original idea from Boris Masis.

    1. Drop and run this script in the root wpmu directory:

    <?php
    define('WP_INSTALLING', true);
    require_once('wp-load.php');
    
    $old_domain = 'olddomain.com';
    $new_domain = 'newdomain.com';
    
    $query = "UPDATE wp_site SET domain = '$new_domain' where domain = '$old_domain'";
    $wpdb->query($query);
    
    $query = "UPDATE wp_blogs SET domain = REPLACE(domain, '$old_domain', '$new_domain')";
    $wpdb->query($query);
    
    $querystr ="SHOW TABLES LIKE 'wp_%_options'";
    
    $tables = $wpdb->get_results($querystr, ARRAY_N);
    
    echo count($tables);
    $query = "";
    if ($tables){
      foreach ($tables as $table){
        $query = 'UPDATE '.$table[0]." SET option_value = REPLACE(option_value,'$old_domain','$new_domain')";
        $wpdb->query($query);
      }
    }
    ?>
    

    2. Edit wp-config.php and set “DOMAIN_CURRENT_SITE” to the appropriate domain.

    That’s it, everything should work properly.

     
  • oremj 10:37 am on September 21, 2009 Permalink  

    Operations Status Dashboard 

    Often when we have an operational issue or outage confusion occurs. We are taking a step to resolve this confusion by creating a status dashboard similar to Google and Twitter. It is mostly a prototype at this point. How can we make this service more useful? Feedback is greatly appreciated.

     
    • Dan 11:15 am on September 21, 2009 Permalink | Reply

      Include the timezone with the time. Looking at the scheduled maintenance for the 15th is ambiguous on 2 counts:

      Time Description
      00:27:10 Site maintenance @7:10pm.

      Oh, and no fail pets!

    • ozten 12:01 pm on September 21, 2009 Permalink | Reply

      This is going to be a really useful page!

      Maybe give a place for someone to report an issue on a green site, that should be red? This would put them into bugzilla with the correct product/component?

      If this site had optional LDAP authentication, it would be great to display links to our monitoring dashboards for logged in users, on a site by site basis. (so you can dig deeper and see DB health, etc)

    • Philipp 2:25 pm on September 21, 2009 Permalink | Reply

      developer.mozilla.org should be added, this seems to break quite often.

    • Stephen Donner 12:00 am on October 12, 2009 Permalink | Reply

      Jeremy, could it also include SVN revision #’s? Not all our pages/apps have it in the source (in fact, I think only AMO does), and this would really help QA and dev; thanks!

    • Stephen Donner 12:02 am on October 12, 2009 Permalink | Reply

      Also, can you add a Mozilla.com background? The white is a bit jarring :-(

  • oremj 1:34 pm on August 20, 2009 Permalink  

    Speedup Firefox with VACUUM 

    I’ve seen a few posts about VACUUMing Firefox’s sqlite database for better performance, but each requires Firefox to be shut down.

    Here is a way to VACUUM your places database from within the browser.

    1. Go to Tools -> Error Console
    2. Paste the following in the “Code:” text-box: Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL("VACUUM");
    3. Press Enter

    Your UI will freeze for a bit while the vacuum runs.

    Resources:

    Cross post from my personal blog.

     
    • Mardeg 3:20 pm on August 20, 2009 Permalink | Reply

      First I had a syntax error on the . after DBConnection which made me suspect more code existed overflowing but hidden in your post with no way to scroll to the bit chopped off at the end. View -> Page Source to get the full code.

      • oremj 9:50 pm on August 20, 2009 Permalink | Reply

        Switched theme to solve the problem. Thanks for the heads up!

    • Dave 3:41 pm on August 20, 2009 Permalink | Reply

      Code is getting cut off after “DBConnection.” when I view this page under Firefox 3.5. RSS reader shows it fine. Must not be word-wrapping well here.

    • Robert Kaiser 3:46 pm on August 20, 2009 Permalink | Reply

      Actually, if this is that good and gives us that much speed, we really ought to do it right in the code by default. Nobody should need to execute strange-looking JS statements in an Error (!) Console just for getting a fast experience with Firefox. Hell, we market FF 3.5 as the fastest product we ever made. So let’s follow that and act on even improving it! Will you write the patch?

    • alanjstr 3:56 pm on August 20, 2009 Permalink | Reply

      1) I wonder how long until someone makes an addon for this.
      2) How do I know it was successful? The console says [xpconnect wrapped mozIStorageConnection] so was that ok?

    • pd 9:02 pm on August 20, 2009 Permalink | Reply

      Once again a crappy too-narrow pre-canned blog theme destroys a useful blog post for the majority. For anyone who wants this tip to actually work, removes the new lines from this:

      Components.classes["@mozilla.org/browser/nav-history-
      service;1"].getService(Components.interfaces.nsPIPlacesDatabase).
      DBConnection.executeSimpleSQL(“VACUUM”);

      Down with fixed with pre-canned, out-of-the-box blog themes! Think about it, don’t just post it!

    • Tomer 12:16 am on August 21, 2009 Permalink | Reply

      Looks like it does something good to awesomebar, and it loads faster now.

      Is it possible to use a background worker thread in order to eliminate the UI freeze?

    • Fernando 4:48 am on August 21, 2009 Permalink | Reply

    • Revertron 5:21 am on August 21, 2009 Permalink | Reply

      Hi all :)

      Meet the fresh-new extension for Vacuum-cleaning your Places: https://addons.mozilla.org/ru/firefox/addon/13824/

      You can write comments on this right there, on mozilla site.

    • AndyC 5:51 am on August 21, 2009 Permalink | Reply

      Ubiquity!

      CmdUtils.CreateCommand({
      names: ["vacuum"],
      description: “Clean FF sqlite dbs”,
      execute: function(input) {
      Components.classes["@mozilla.org/browser/nav-history-service;1"]
      .getService(Components.interfaces.nsPIPlacesDatabase)
      .DBConnection
      .executeSimpleSQL(“VACUUM”);
      }
      });

    • alanjstr 6:23 am on August 21, 2009 Permalink | Reply

      Ok, I went back and got the full string from the page source. My UI didn’t freeze and I got no messages on the console. Did it work?

    • David 6:51 am on August 21, 2009 Permalink | Reply

      For those who use userChrome.js, this code should add this command to the Tools menu:

      var menuitem = document.createElement("menuitem");
      menuitem.setAttribute("label", "Database Vacuum");
      menuitem.setAttribute("accesskey", "V");
      menuitem.setAttribute("oncommand", 'Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL("VACUUM");');
      document.getElementById("devToolsSeparator").parentNode.insertBefore(menuitem, document.getElementById("devToolsSeparator"));

    • Philipp 3:03 am on August 22, 2009 Permalink | Reply

      Way faster! Thanks!

    • Jay 1:08 pm on August 25, 2009 Permalink | Reply

      Seems to cause some problems with Google Gears offline function for Gmail. I had to unauthorize, and then reauthorize to rebuild the databases. The problem started around the same time I did the procedure here….

      • Jay 1:20 pm on August 25, 2009 Permalink | Reply

        A clear cache seems to have fixed it. So not sure if it’s related or not…..

    • Luca 7:43 am on August 28, 2009 Permalink | Reply

      Hi, I was trying to implement this asynchronously in an extension, but the UI keeps freezing even if access the database interface via executeAsync:

      Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeAsync([Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.createStatement(“VACUUM”)], 1);

      Do you know why?

    • fastfast 7:56 am on August 28, 2009 Permalink | Reply

      Нихрена не работает.

    • Steve 6:08 pm on August 29, 2009 Permalink | Reply

      I’ve been using BleachBit for some time and it’s quite effective at cleaning out crap not only in FF but other progies as well. You can run it anytime and it does the trick.

    • 124 2:32 am on August 31, 2009 Permalink | Reply

      There is an new Improves Version 0.3 of the Addon:
      https://addons.mozilla.org/en-US/firefox/addon/13878

  • oremj 3:15 pm on October 15, 2008 Permalink  

    Mediawiki Google Search Appliance Integration 

    Recently, I was given the task of integrating our old Google Search Appliance with MediaWiki and wrote about it too.  How does that affect you?  If you are using the intranet wiki you should notice the search results are much more relevant.  If you don’t have access to the intranet wiki and would like to integrate mediawiki with your own Google Search Appliance see my post.

     
  • oremj 2:56 pm on September 12, 2008 Permalink  

    My Life is a Little Bit Easier Now 

    Lately, I’ve found the process of assigning a bug to myself slightly cumbersome and wanted to speed up the process. I happen to be a fan of Ubiquity, so I decided to write a command.

    The command assigntome, by default, changes the assigned to field to your user. The whole process can be automated by tacking on the submit noun, which will simulate clicking the “Commit” button.

    To install assigntome subscribe to my Ubiquity feed.

    Cross-post from blog.oremj.com.

     
    • Corinna 8:01 am on October 14, 2008 Permalink | Reply

      Wow this seems to be a really useful tool. So thanks for your hint.

  • oremj 10:29 am on March 14, 2008 Permalink  

    Efficiently Updating Web Sites on Web Clusters 

    Recently, we ran in to a problem with our web content sync setup.

    Old Setup:

    • Host all web bits on two admin servers
    • Pull via rsync from admin01 server to the apache servers on 5 min staggered cron

    That setup worked fairly well for us for quite a long time, but it doesn’t scale. At about 18 or 20 apache servers pulling at 5 min intervals the admin server was constantly pegged from all the rsync processes scanning the file system.

    We needed something with state, but something that was simple. Revision control has state, but would the operations be quick enough to be useful? It turns out Git was pretty well suited for the task.

    New setup:

    • Host all bits on admin servers
    • Commit bits on admin01 on a 5 minute cron in to git
    • Pull commits via Git to apache servers

    This new setup scales very well, because we only need one file system scan per 5 minutes instead of 20+. The Git fetches are very fast.

    Initial installation:

    admin01:/etc/xinetd.d/git-daemon:

    service git
    {
    disable = no
    type = UNLISTED
    port = 9418
    socket_type = stream
    wait = no
    user = nobody
    server = /usr/bin/git-daemon
    server_args = --inetd --export-all --verbose /www
    log_on_failure += USERID
    }

    Admin01: Import /www:

    cd /www
    git-init
    git-add .
    git-commit -m 'Initial Import'

    Apache Servers initial setup:

    git-clone git://admin01/www

    Commit Cron on admin01 (add any new files and delete any removed files from the repo):

    #!/bin/bash
    lockfile="/tmp/git.lock"
    if [ -f $lockfile ]; then
    if kill -0 $(cat $lockfile); then
    echo "$0 appears to be already running."
    exit 1
    fi
    fi
    echo $$ > $lockfile
    cd /www
    /usr/bin/git-add .
    /usr/bin/git-commit -a -m "AUTO COMMIT: `date +%FT%T`"
    rm -f $lockfile

    Fetch Cron on the apache servers (fetches origin and then resets the /www to origin):


    #!/bin/bash
    cd /www;
    /usr/bin/git-fetch && /usr/bin/git-reset --hard origin;

     
  • oremj 11:58 am on May 17, 2007 Permalink  

    Libc Man Pages 

    I spend about 5 minutes searching for the libc man pages every time I install Debian or Ubuntu.

    The package is ‘manpages-dev’; now I won’t forget!

     
    • svendem 6:26 pm on January 9, 2008 Permalink | Reply

      Thanks! I was just looking for that myself, being new to ubuntu. “Hey, where are the libc man pages? Hmm, no libc-doc package.. Try google, found this :)

    • Steve 6:16 pm on May 3, 2008 Permalink | Reply

      Thanks, I was just looking for this exact information!

      It sounds like it should be a package for developing manpages, what the hell..

    • Ernst 6:09 am on October 15, 2008 Permalink | Reply

      Thanks, very helpful!

    • JS Chenard 12:55 pm on November 6, 2008 Permalink | Reply

      Thanks. I was looking for this info… Google brought me here. Cheers!

    • Alex 9:06 pm on April 3, 2009 Permalink | Reply

      great and thank you. I was searching for this information. Thank you who give me this info….
      thanks to Google also….
      ____________________________________________________
      Alex

    • sam 3:54 am on August 12, 2009 Permalink | Reply

      Yuuuuuuuuuuuupy finally refound it :D Thanks, very appreciated!

  • oremj 8:29 pm on January 29, 2007 Permalink  

    MediaWiki: HttpAuth Plugin 

    Using MediaWiki behind http authetication was always slightly annoying in the past. One would have to:

    1. Login with their htpasswd credentials
    2. Create account if it did not exist already
    3. Login with their wiki credentials
    4. Remember both sets of credentials

    This extension reduces the previous four steps into one simple step.

    1. Login with htpasswd credentials

    The extension can be downloaded at http://people.mozilla.com/~oremj/HttpAuthPlugin.php and setup instructions at MediaWiki.

     
    • Ben Herrick 1:54 am on February 28, 2007 Permalink | Reply

      Hi Jeremiah,

      I’m having some trouble using your HttpAuthPlugin on the latest version of MediaWiki. I get logged in with no issue, but when I try to edit a page it fails silently on submit.

      I’m using MediaWiki 1.9.3. No error messages are logged anywhere that I can find, the page that I’m editing simply doesn’t change.

      Any idea what this might be?

      Thanks!

      -Ben

    • Korbinian Pauli 8:28 am on April 8, 2007 Permalink | Reply

      Hi Ben,

      I had troubles with the plugin in 1.9.3, too. Htaccess logged in fine, but in mediawiki I was not logged in. So I replaced all PHP_AUTH_USER with REMOTE_USER in HttpAuthPlugin.php and LocalSettings.php. Now everthing works fine.

      Best regards,
      Korbinian

    • amg1127 11:28 am on August 10, 2007 Permalink | Reply

      There is a security hole in the extension.

      Function autoAuthenticate() should ensure the username loaded from session matches the username that was used for HTTP authentication.

      If it doesn’t, a user can get an account that would belong to an other previously authenticated user, because some browsers can clear HTTP authentication data without clearing the cookies.

    • anon 10:09 pm on September 9, 2007 Permalink | Reply

      Hi,

      This plugin will be more flexible, if it also check for REMOTE_USER variable (when PHP_AUTH_USER doesn’t exist), so that it will also work when running php as cgi.

      Just a wishlist to improve the plugin capability :)

    • Michael Blodgett 8:23 am on September 10, 2007 Permalink | Reply

      Hello Jeremiah,
      I’m using MediaWiki 1.11.0rc1 on Centos5.0, I had to add a ‘return 0′ at the end of the autoAuthenticate function in your module. I’m using xradius to do the http auth, everything seem to function correctly.

    • Rod 12:08 am on February 12, 2008 Permalink | Reply

      What Michael said above I added “return true;” as the last line of authAuthenticate. It looks like, if it falls through that far, it means we have authentication.

    • Michael 11:57 am on May 29, 2008 Permalink | Reply

      Hi Jeremiah,
      Looks like PHP functionality was added to http://people.mozilla.com.
      HttpAuthPlugin.php no longer can be downloaded, returned page is blank.
      Could you rename plugin extension to ‘txt’ or ‘phps’. That should make your script available again.
      Looking forward to using it.
      Thanks

    • Rainer Seifert 3:38 pm on June 18, 2008 Permalink | Reply

      Hi oremj,

      your HTTPAuth PLugin looks similar to an extention I’m desparetly looking for.

      What I want is:
      Poeple log onto our password protected customer site. From there, there is a link to mediawiki. I would like, that those people get auto logined to the wiki site with the same username. No need to press the login button and type in username and password. They have already done it. Actually they didn’t, they got autologined via our desktop software into our customer web site.

      Is that possible? And can your code be adjusted to that?

      To be honest. I am familiar with PHP. But to adjust your mediawiki extention for my purpose is far too challenging for me. Additionally, I’m willing to pay for your help and support in this subject. Please contact me. You should have my email address.

      Thanks a lot in advance.
      Greetings
      Rainer

  • oremj 3:46 pm on December 28, 2006 Permalink  

    SimpleCaptcha Plugin 

    The other day spent several hours searching for a WordPress MU(WPMU) compatible captcha plugin with no success. I didn’t care about a robust spam fighting packages with Bayesian filtering etc; all I wanted was very simple and accessible plugin. Yesterday, I came up with SimpleCaptcha. So far SimpleCaptcha seems to be working very well against spam bots.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel