No editor toolbar on WordPress

ript>

Just a quick note for me and anyone else with a similar problem:

If the rich-text editor on a WordPress blog is not displayed correctly (i.e. no visible toolbar or no access to writing area — I recently had both symptoms) then the problem might be an incompatible library used in a plugin.

For my case, the solution of the problem was to deactivate the “Spelling & grammar” box of the JetPack plugin by selecting “Learn more” at first and then “De-activate”.


Visit The Light of the LAMP blog for more…

Think like a virus!

Not related to L.A.M.P. technologies, but a useful quote to remember if you are a net admin:

As a network administrator, you have to think like a virus.
How can I get into a network?
Which points are the most vulnerable?
Once in, what’s the easiest path to destruction?

From the “Windows sources” magazine, July 1997 issue, page 158, “NT admin> Stop network attacks” by David Chernicoff


Visit The Light of the LAMP blog for more…

How to hide “Mark all as read” in new Google Reader

With the new redesign of Google Reader (the Google+ look-alike), I’ve noticed a new annoying behavior today.
The “Mark all as read” in now a button that takes and keeps focus. This means that if you press it once with your mouse and, then, go to another group of posts and press space to view the next page, you ‘ll end to mark all posts in that group as read!!! [because the “Mark all as read” button has got the focus]
The easier work-around solution I’ve found is to hide that button and use Ctrl-A Shift-A [edited] whenever I want to use the [main] functionality. I know that by hiding all options I miss the option to mark all older than a date as read, but I can live with this instead of marking as read all posts by mistake.

Since I work with Firefox and use Stylish Stylus, this hiding is easy. Just add a new recipe, name it something like “hide mark all in GReader” and insert the following in it:

@-moz-document url-prefix(http://www.google.com/reader), url-prefix(https://www.google.com/reader), url-prefix(http://google.com/reader), url-prefix(https://google.com/reader) {
span#mark-all-as-read-split-button { display: none !important; }
}

and enable the Stylish Stylus recipe when you want to feel safe.

How to hide the new Facebook news feed

In case you are using Firefox and you want to hide the new Facebook right-column news feed, here is a quick hack.

  • At first, you need to install Stylish Stylus, if you don’t have it already.
  • Add a new blank style with the following lines in it and give it whatever name you want.
  • Energize! 😉

The code:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain(“facebook.com”) {
.fbFeedTickerStory { display: none !important; }
}


Visit The Light of the LAMP blog for more…

How to forward a Google+ post to your email inbox

While we ‘re still waiting for the full Google+ API to be available in public, I recently asked in twitter for “an easy way to save GooglePlus posts for later reading or archiving” and this is the solution I found since then:

  • Go to Google+ and create a new circle.
  • Add in this circle one of your email addresses, that has NOT a Google+ account; just the email. In case you don’t have a second email address, either create one or use the plus-enhanced mode of the one you already have (if your provider accepts this mode), i.e. something like username+gplus@email.provider.tld (given that your email is username@email.provider.tld, you should add “+gplus” (or something similar) just before the “@” sign — replace “username”, “email.provider.tld” as appropriate).
  • From now on, when you find something interesting, you have to share it with this new circle and, since the one member of the circle has no Google+ profile, the interesting post will land into your email box.

Update [2011/09/21]: this technique comes handy also when you want a copy of your posts into your email box. You just have to include the “me” circle as a recipient of your posts, along with the other circles or people.

With this trick you don’t need an RSS feed for your posts [although I think that Google must implement this as a feature, IMHO]


    Visit The Light of the LAMP blog for more…

    Re-enabling Google FriendConnect gadgets

    In case you see blank boxes in your Firefox, instead of Google FriendConnect (GFC) gadgets, you can try searching the configuration window of the HTTPS Everywhere add-on. For me, it was the GoogleServices option, which I had to deactivate in order to re-enable the GFC gadgets.

    HTTPS Everywhere Preferences window

    It took me some time and several deactivations and reactivations of my add-ons while trying to find the culprit and I found it.


    Visit The Light of the LAMP blog for more…

    Show all my active WordPress plugins

    Recently, I needed to get a list of every plugin that I’ve activated on all of my WordPress local-hosted blogs.
    So, instead of going to every blog’s dashboard and noting down the list of every active plugin, I decided to write a quick (and dirty, i.e. not optimized) script.


    <?php
    // initialize variables [you have to change them to their proper values]
    $dbhost = "localhost";
    $dbuser = "dbuser";
    $dbpass = "dbpassword";

    // connect to MySQL and get all database names
    $db = mysql_connect( $dbhost, $dbuser, $dbpass)
          or die( "MySQL connection problem: " . mysql_error());

    mysql_set_charset( "utf8");
    mysql_select_db( "information_schema", $db) or die( mysql_error());
    $sql = "SELECT SCHEMA_NAME FROM SCHEMATA";
    $u0 = mysql_query( $sql, $db) or die( mysql_error());
    $alldb = array();
    while ($u1 = mysql_fetch_row( $u0)) { $alldb[] = $u1[ 0]; }

    // select each database found and check for active plugins
    foreach( $alldb as $adb) {
        $conn = mysql_select_db( $adb, $db);

        // get *_options table name
        $sql = "SHOW TABLES FROM $adb LIKE '%_options'";
        $u0 = mysql_query( $sql, $db); // or continue;
        while ($u1 = mysql_fetch_row( $u0)) {
            if ($opt = $u1[0]) {
                // get active plugins list
                $sql = "SELECT * FROM $opt WHERE option_name='active_plugins'";
                $u00 = mysql_query( $sql, $db);
                if ($u01 = mysql_fetch_array( $u00)) {
                    $apj = $u01[ 'option_value'];
                    if ($apj) {
                        $ap = unserialize( $apj);
                        foreach( $ap as $apv)
                            echo "Database: $adb >>> $apvn";
                    }
                }
            }
        }
    }

    mysql_close( $db);
    ?>

    The output of this script is a list of all active plugins, one for each line, so it can be used in a shell script, for example one can find out how many of them are active:

    php show_all_active_plugins.php | wc -l

    or find out which blogs are using a certain plugin:

    php show_all_active_plugins.php | grep akismet

    Disclaimer: as usual, this script works for my setup and, for this reason, I'm sharing it here for everyone interested. I hope it will work for anyone else who tries it, but I cannot guarantee it for every possible situation.


    Visit The Light of the LAMP blog for more…

    How to share an article from Google Reader to Google+

    Just a quick tip for every Google Reader user who needs to share an interesting article with one or more of her Google+ Circles.

    Given that we have the Google+ share box on the top-right corner of GReader, the simplest way I’ve found is:

    1. grab the URL of the article, by right-clicking on its title and select “Copy link location”
    2. click at the “Share” box (at the top-right corner of the window)
    3. click at the chain icon (“Add link”) and paste the copied URL there; press the “Add” button
    4. select the people or circles you want to share it with
    5. if you want, you can comment on the text-box above the link
    6. click at the “Share” button

    Visit The Light of the LAMP blog for more…

    CRON error: grandchild failed with exit status 1 [Solution]

    Just after I upgraded my Ubuntu to 10.10 version, I noticed some cron-related error messages in my /var/log/syslog file, like these:

    Jul  5 13:40:01 agriope2 CRON[971]: (CRON) error (grandchild #974 failed with exit status 1)
    Jul  5 13:50:01 agriope2 CRON[7775]: (CRON) error (grandchild #7778 failed with exit status 1)
    Jul  5 14:00:01 agriope2 CRON[14520]: (CRON) error (grandchild #14526 failed with exit status 1)
    Jul  5 14:00:01 agriope2 CRON[14521]: (CRON) error (grandchild #14531 failed with exit status 1)

    At first, I thought they were generated by one of my scripts, which runs via cron every 10 minutes and I wondered what happened during upgrade that caused its exit status to turn to 1 instead of 0. Unfortunately, I didn’t had the time to delve deeper back then and I ignored it, since everything seemed to work as expected.

    Until today, when (after one more successful system upgrade in the meantime) I decided to examine it further.
    Given that nothing has changed into my script, I thought that it would be a good idea to search into /etc/cron* directories and there I found that there was the script /etc/cron.d/update-motd, which was scheduled to run every 10 minutes and tried to run /usr/sbin/update-motd. The problem is that /usr/sbin/update-motd was not present any more at its whereabouts, probably because “the functionality formerly provided by update-motd package is now integrated into pam_motd, in libpam-modules” (as the description of update-motd package says).

    So, I moved /etc/cron.d/update-motd to another location, just in case I will need it again some time in the future.

    Update [2011/12/25]:
    In case you are running fetchmail from cron, you ‘ll have messages like the above whenever you have no new mail. For this situation, the solution is already in the man page of fetchmail:

    If you do not want “no mail” to be an error condition (for instance, for cron jobs), use a POSIX-compliant shell and add

                  || [ $? -eq 1 ]
    to  the  end  of  the  fetchmail command line, note that this leaves 0 untouched, maps 1 to 0, and maps all other codes to 1. See also item #C8 in the FAQ.


    Visit The Light of the LAMP blog for more…

    Look is like a restricted grep

    The look command is for looking up if a word exists in /usr/share/dict/words file, at least for most users. But, as the man page defines:

    look — display lines beginning with a given string

    which means that, for example, this command:

    look what file

    is equivalent to this command (with the exception that look ignores all whitespace characters at start):

    grep ‘^what’ file

    With this in mind, we can search easily for comment lines in all javascript files:

    look ‘//’ *.js

    or in .bashrc

    look ‘#’ ~/.bashrc

    For more, there is always grep, of course.


    Visit The Light of the LAMP blog for more…