Category Archives: howto

blogposts on blog.futtta.be with (very concise and non-foolproof) howto’s.

Uw eigen mobielere deredactie in 5 stappen

openshift configureer uw redactieuwredacie op openshift uwredactie op openshiftOok al kunt ge mijn alternatieve mobiele redactie hier bekijken, dan zout ge toch, om redenen die geheel de uwe zijn, misschien liever uw hoogst persoonlijke redactie hebben?

Wel, dat kan in 5 eenvoudige stappen dankzij Openshift, het freemium PAAS platform van Red Hat en dat gaat ongeveer zo:

  1. Maak een gratis account aan bij Openshift
  2. Klik op “Create your first application now
  3. Vul PHP in in het zoekvenster en selecteer de PHP 5.4 cartridge
  4. Vul een naam in voor de public URL, copy/paste https://github.com/futtta/redactie in het source code veld en klik op “Create application
  5. Even geduld terwijl uw eigenste redactie wordt aangemaakt. In het laatste scherm kunt ge eventueel git access configureren (“Will you be changing the code of this application?”) of direct op “Visit app in the browser” (in mijn geval naar http://mijnredactie-futtta.rhcloud.com/) klikken.

Spreading the news, tiens!

I see you baby, purging that spam!

all we are saying, is give ham a chance!While Akismet does a good job at flagging comments as spam, it by default only purges spam (from the comments and comments_meta tables) after 15 days.

So it’s a good thing Akismet now has a filter to change the amount of days after which spam is removed. Below code (in a small plugin or in a child theme’s functions.php) should do the trick.

/** tell akismet to purge spam sooner */
add_filter('akismet_delete_commentmeta_interval','change_akismet_interval');
add_filter('akismet_delete_comment_interval','change_akismet_interval');

function change_akismet_interval($in) {
     return 5;
}

Happy purging!

Tweaking WordPress’s Expound theme’s menu

I’m helping on a site for a not-for-profit for which we selected “Expound” as the base theme. I like Expound; it looks great, there’s no jQuery- or webfont-cruft to worry about and although the CSS comes with a seperate reset.css-file, it does (Auto-)optimize perfectly.

But I wasn’t happy with the menu color-scheme and with the fact that the menu lacked an indication that a child page of a main entry was being shown instead of the page of that main entry itself (confused much?).

Anyway, this is what I ended up with;
wordpress expound theme menu tweaked

For those wanting to do something similar, this is the relevant CSS in my child theme;

/* don't want no blue */
.navigation-main .current-menu-item > a {
        background: #557B47 !important;
}

/* triangle should not be blue either, need it to be a bit bigger */
.navigation-main ul > .current_page_item a:after, .navigation-main ul > .current-menu-item a:after, .navigation-main ul > .current-post-ancestor a:after, .navigation-main ul > .current-menu-parent a:after, .navigation-main ul > .current-post-parent a:after {
        border-top: 10px solid #557B47 !important;
        bottom: -14px;
        z-index: 1000;
}

@media screen and (min-width: 600px) {
  /* if page from submenu, add line under parent item to show your in that submenu */
  .navigation-main ul > .menu-item {
        border-bottom: 6px solid #3A3A3A !important;
  }
  .navigation-main ul > .current_page_item, .navigation-main ul > .current-menu-item, .navigation-main ul > .current-post-ancestor, .navigation-main ul > .current-menu-parent, .navigation-main ul > .current-post-parent {
        border-bottom: 6px solid #557B47 !important;
  }

  /* but not in submenu */
  .navigation-main .sub-menu > .menu-item {
        border-bottom: 0px !important;
  }

  /* less padding at the bottom to compensate for that extra line */
  .navigation-main a {
        padding: 10px 10px 4px !important;
  }

  /* except when in submenu */
  .navigation-main .sub-menu a {
        padding: 10px !important;;
  }
}

/* change color to default brown if child-item is active */
.navigation-main ul > .current_page_item, .navigation-main ul > .current-menu-item, .navigation-main ul > .current-post-ancestor, .navigation-main ul > .current-menu-ancestor, .navigation-main ul > .current-menu-parent, .navigation-main ul > .current-post-parent {
        background: #3A3A3A !important;
}

Have fun!

Emotional rollercoaster: installing Jelly Bean on a Galaxy SII

Jelly Bean "about" screen on Samsung Galaxy S III’m happy! Here’s why; when I bought my Samsung Galaxy S II a year and a half ago, it came with Android 2.3 aka Gingerbread. Last year Samsung released an official update for Android 4.0 (Ice Cream Sandwich). And while most manufacturers stop after one major upgrade, Samsung promised Android 4.1 Jelly Bean for the aging SII a couple of months ago. And so early this week I took a ride on this Jelly Bean rollercoaster:

    1. Yay, Sammobile reports Samsung started pushing out Jelly Bean for the Galaxy S II
    2. Damn, apparently the ROMS are only available for Spain & China, not for my region yet.
    3. Yay, the Spain version has support for my region after all, downloading.
    4. Damn, can’t shut down my phone to switch to “download mode”, it just reboots.
    5. Yay, re-inserting battery while holding Volume down, Home & Power switches the phone to download mode after all, flashing with Odin!
    6. Damn, flashed and rebooted, but installation wizard hangs, rebooting.
    7. Yay, installation wizard completes after all.
    8. Damn, ADW settings screwed (widgets & some shortcuts MIA)
    9. Yay, almost done configuring ADW (except for the tethering shortcut on my desktop, can’t seem to reinstate that).
    10. Damn, no keyboard selection in notification bar, so no Swype!
    11. Yay, Swype available after all, hidden in “Language & Input” configuration.

So does Jelly Bean put the old S2 on the same level as the S3? Not really, some advanced S3-features aren’t included, think the ones in the Premium Suite for S3 that Samsung released a couple of months ago, especially “multi-window” (which might make less sense the smaller S2 display anyway). Both the Calender application and the mail-client (for my Exchange-mail) changed. Samsung replaced Calender with their own S Planner, which has a more skeuomorphic UI which doesn’t fit with the rest of the OS. Good thing you can install the default Android Calendar from Google Play. Mail got slightly better, with a nice little refresh-button and a timestamp showing when the last connection occurred (I don’t do push mail). But most importantly: Jelly Bean does feel more smooth (thanks to Project Butter) and at first sight battery life seems better as well. So, yeah, I’m happy!

Stopping WordPress media attachments comment spam

I just had my monthly look at the comments spam queue and was baffled by the amount of spam-comments on WordPress attachments. WordPress, surprisingly, has no option to disable comments on media, so based on information in this codex page about the comments_open function, I quickly assembled a plugin to stop comments on items in the media gallery altogether. The code (which can also be added in functions.php instead of going into a plugin):

<?php
/*
Plugin Name: No Media Comments
Author: Frank Goossens (futtta)
Plugin URI: http://blog.futtta.be/
Author URI: http://blog.futtta.be/
Description: Stop comments on media attachments
Version: 0.1
*/

add_filter( 'comments_open', 'noMediaComments', 10, 2 );

function noMediaComments( $open, $post_id ) {
$post = get_post( $post_id );
if ( 'attachment' == $post->post_type )
$open = false;
return $open;
}
?>

After throwing that at my server and seeing it worked, I realized there had to be a plugin for this and I indeed found Disable Comments and Comment Control in the wordpress.org plugin repository. Both plugins are by the same author and are only slightly different in scope really. So if you want to stop the comment spam on attached images on your WordPress blog, you’ve got several options. But shouldn’t this be tackled in WordPress core instead, really?

Fix Samsung ICS Exchange connection errors

[Update 21-5-2012: Samsung released new firmware, version I9100XWLPD, which seems to fix the bug.]

Since updating my Samsung Galaxy  S II to Ice Cream Sandwich, I’ve regularly been experiencing the dreaded “connection error” in the mail client when trying to fetch mail from the corporate Exchange server. A colleague of mine, who agreed to have me upgrade his SGS2 after I promised  everything worked flawlessly, had the problem even more regularly.

Searching the web turned up this interesting thread on xda-developers, which had amongst others a fix for the adventurous, but also this eye-opening comment:

The messages in question are Read Receipts, Delivery Receipts and similar messages. Once there is one of those in your inbox, you’re stuck until you delete it. […] A better solution which has worked for me is to create a folder for your receipts. Then, on your PC, create a rule to move the receipts to the folder on arrival. This will obviously also work when your PC is off, as the rules are stored and executed on the server. You will have to create a rule which processes emails on arrival, matches a series of strings in either subject or body of the message and moves them to the folder.

And that’s exactly what I did; mails sent only to me with “Declined:” or “Accepted:” or “Tentative:” or “Read:” or “Not read:” in the subject line are automatically moved into a “tmp” folder. Your mileage may vary (apparently there are other conditions under which the Android/ Samsung mail client has problems downloading items form Exchange), but based on my limited experience up until now, this workaround gets most problematic items in my Inbox out of the way. Now let’s hope Samsung fixes this blatant error (and that it isn’t in the ICS-version on that beautiful Samsung Galaxy S III)!

Firefox preferences for greater privacy

Although browser addons such as NoScript and Ghostery (which is cross-browser with some limitations) provide great protection against tracking, some people prefer not to have to install plugins. Firefox does have configuration options to somewhat limit what trackers can do. You can follow the knowledge base article here to learn how to disable 3rd party cookies (the default setting in Safari, which Google was caught circumventing).

If you’re up to it, you also simply open up the almighty “about:config” and tinker with the following settings (some of which aren’t available in the browser UI):

  • network.cookie.cookieBehavior with values:
    • “0”: allow all cookies (default)
    • “1”: don’t allow 3rd party cookies
    • “2”: don’t allow any cookies
  • network.cookie.thirdparty.lifetimePolicy with values:
    • “0”: keep cookies for as long as the server asks
    • “1”: ask the user on each and every cookie set (try it out if only for fun, you’d be surprise how much cookies are set)
    • “2”: cookie gets deleted when you close your browser (i.e. at the end of the session)
    • “3”: cookies have a lifetime as defined in the “network.cookie.lifetime.days ” preference
  • network.cookie.thirdparty.sessionOnly: set to “true” or “false”
  • privacy.donottrackheader.enabled: set to “false” (default) or “true”, which gently asks sites not to track you

Setting “network.cookie.thirdparty.sessionOnly” to “true” is a low-impact change which should stop tracking-companies (think Media6degrees or Quantcast) from following you around the web.

If you want to stop Facebook, Google & Co to stop tracking you around the web as well, the above setting will not suffice. You should either log out of their sites as soon as you’ve done your business there or set “network.cookie.cookieBehavior” to “1” (which will break their “social widgets”). Or you can install Ghostery or NoScript, off course.