Development

Liferea 1.10.14 Released

There is a new maintenance release for the 1.10 line. It tries to fix startup crashes reported by several users and fixes a bug with launching links in the external browser. Please upgrade!

ChangeLog

    * Fixes Github #134: Broken default news feed.
      (reported by pvdl)
    * Fixes Github #133: Subscribe into TheOldReader categories
    * Fixes Github #122: Crashes at launch, "segmentation fault"
      (reported by geoffm)
    * Fixes some memory leaks
      (patch by Rich Coe)
    * Fixes Github #145: Incorrect method triggered for 'Launch External'
      (patch by mozbugbox)
    * Fixes Github #48: Window stays hidden on next start after Ctrl+W
      (reported by Jeff Fortin)
    * Expose LifereaHtmlView to GObject Introspection
      (patch by mozbugbox)
    * Improves Google Reader API error handling
    * Now using HTTPS only when accessing TheOldReader
    * Added LifereaNodeSourceActivatable interface to allow plugins
      implementing new node source types.
    * Downgrade enclosure drop warning from Glib warning to debug trace.

Download

You can download the release on Github:
https://github.com/lwindolf/liferea/releases/tag/v1.10.14

Liferea Trick #9: Skimming Trough the Headlines

I'm not sure about how many users are aware of the feature, but I'm certain it is worth to know about as it saves a lot of clicking and pointing with the mouse. If you are a keyboard user it's worth knowing about the hotkey to skim through headlines.

Remember the Hot Key

As this hotkey is configurable check the preference dialog ff you are not sure about the setting. The default setting is <Ctrl>-Space...

How it Works...

By using this hot key you can navigate the article pane and the item list view at the same time. As long as the article pane allow vertical scrolling it scrolls down. Once you reach bottom Liferea jumps to the next unread article.

Using the headline skimming hotkey is like a "Next Unread And Scroll Down" menu option...


Recent Liferea Tricks

Fixed Issue with "Open in External Browser" Option

Pull Request #145: "Incorrect method triggered for 'Launch External'" by mozbugbox fixes an often reported issue with launching links in external browser. Due to a copy an paste mistake the same callback was called for link menu options 'Open in External Browser' and 'Open in Browser'.

A screenshot of the menu options:

The difference between both option is that 'Open in External Browser' always launches the link in your favourite web browser while the other option does load links in Liferea if you specified so in the preferences. As 'Open in External Browser' incorrectly triggered the same callback as 'Open in Browser' the bug appeared depending on the preference settings.

Will be fixed with release 1.10.14 and 1.11.3

Help Needed: High Contrast Icon

Today Obsidien created ticket #148 about support for the GNOME high contrast icon theme.

Icons in this theme look like this:


(screenshot taken from GNOME Wiki)

As I'm not an artist in any way I want to ask you readers for your help! So if you are a graphics artist and have some spare time why not gift an high contrast icon for Liferea! If you are interested leave a note in the ticket.

Liferea 1.11.3 Released

There is a new release for the unstable line: Liferea 1.11.3. This release fixes several issues and introduces an improvement of the rendering of the 3 pane "Wide View" mode to save screen space on 16x9 screens. This is intended to improve usability in full screen mode on desktops and tablets. This release also introduces folder (categories) support for TheOldReader subscriptions.

Here is a screenshot of the changed "Wide View" mode

Give 1.11.3 a try and send feedback to the mailing list [email protected]!

ChangeLog

    * Fixes Github #134: Broken default news feed.
      (reported by pvdl)
    * Fixes Github #133: Subscribe into TheOldReader categories
    * Fixes Github #122: Crashes at launch, "segmentation fault"
      (reported by geoffm)
    * Fixes some memory leaks
      (patch by Rich Coe)
    * Fixes Github #145: Incorrect method triggered for 'Launch External'
      (patch by mozbugbox)
    * Fixes Github #48: Window stays hidden on next start after Ctrl+W
      (reported by Jeff Fortin)
    * Expose LifereaHtmlView to GObject Introspection
      (patch by mozbugbox)
    * Improves Google Reader API error handling
    * Now using HTTPS only when accessing TheOldReader
    * Added LifereaNodeSourceActivatable interface to allow plugins
      implementing new node source types.
    * Downgrade enclosure drop warning from Glib warning to debug trace.

Download

You can download the release on Github:
https://github.com/lwindolf/liferea/releases/tag/v1.11.3

Static Code Analysis of any Autotools Project with OCLint

The following is a HowTo describing the setup of OCLint for any C/C++ project using autotools.

1. OCLint Setup

First step is downloading OCLint, as there are no package so far, it's just extracting the tarball somewhere in $HOME. Check out the latest release link on http://archives.oclint.org/releases/.

cd
wget "http://archives.oclint.org/releases/0.8/oclint-0.8.1-x86_64-linux-3.13.0-35-generic.tar.gz"
tar zxvf oclint-0.8.1-x86_64-linux-3.13.0-35-generic.tar.gz 

This should leave you with a copy of OCLint in ~/oclint-0.8.1

2. Bear Setup

As project usually consist of a lot of source files in different subdirectories it is hard for a linter to know where to look for files. While "cmake" has support for dumping a list of source files it processes during a run "make" doesn't. This is where the "Bear" wrapper comes to play: instead of

make

you run

bear make

so "bear" can track all files being compiled. It will dump a JSON file "compile_commands.json" which OCLint can use to do analysis of all files.

To setup Bear do the following

cd
git clone https://github.com/rizsotto/Bear.git
cd Bear
cmake .
make

3. Analyzing Code

Now we have all the tools we need. Let's download some autotools project like Liferea. Before doing code analysis it should be downloaded and build at least once:

git clone https://github.com/lwindolf/liferea.git
cd liferea
sh autogen.sh
make

Now we collect all code file compilation instructions with bear:

make clean
bear make

And if this succeed we can start a complete analysis with

~/oclint-0.8.1/bin/oclint-json-compilation-database

which will run OCLint with the input from "compile_commands.json" produced by "bear". Don't call "oclint" directly as you'd need to pass all compile flags manually.

If all went well you could see code analysis lines like those:

[...]
conf.c:263:9: useless parentheses P3 
conf.c:274:9: useless parentheses P3 
conf.c:284:9: useless parentheses P3 
conf.c:46:1: high cyclomatic complexity P2 Cyclomatic Complexity Number 33 exceeds limit of 10
conf.c:157:1: high cyclomatic complexity P2 Cyclomatic Complexity Number 12 exceeds limit of 10
conf.c:229:1: high cyclomatic complexity P2 Cyclomatic Complexity Number 30 exceeds limit of 10
conf.c:78:1: long method P3 Method with 55 lines exceeds limit of 50
conf.c:50:2: short variable name P3 Variable name with 2 characters is shorter than the threshold of 3
conf.c:52:2: short variable name P3 Variable name with 1 characters is shorter than the threshold of 3
[...]

Liferea Trick #8: Change Menu Accelerators

When you are not satisfied with the menu key bindings defined by Liferea do not despair it is easy to change them!

Variant #1: Edit ~/.config/liferea/accels

This variant is 100% portable and should work for everyone. Open ~/.config/liferea/accels in your favourite editor. This file is loaded upon startup by Liferea and contains lines like these:

[...]
; (gtk_accel_path "<Actions>/AddActions/NewVFolder" "")
; (gtk_accel_path "<Actions>/GeneralActions/SearchMenu" "")
; (gtk_accel_path "<Actions>/ItemActions/ToggleItemFlag" "<Primary>t")
; (gtk_accel_path "<Actions>/GeneralActions/PrevReadItem" "<Primary><Shift>n")
[...]

Note how only the "ToggleItemFlag" and the "PrevReadItem" line have defined key bindings, while "NewVFolder" and "SearchMenu" don't.

To change a key binding first remove the semicolon at the start of the line and then adapt or clear the key binding field. Choose prefixes like "<Primary>" (for Ctrl), "<Alt>", "$lt;Shift> as needed and append the key after it.

Variant #2: Enable Editable Accelerators with your Linux Distro Settings

This variant is hard to document as different distributions have different setting dialogs. Some expose a setting to enable life editing of key bindings. Once this is enabled you can open a menu hover over a menu option and press the accelerator you want to assign. It should show up instantly.


Recent Liferea Tricks

Python re.sub Examples

Example for re.sub() usage in Python

Syntax

import re

result = re.sub(pattern, repl, string, count=0, flags=0);

Simple Examples

num = re.sub(r'abc', '', input)              # Delete pattern abc
num = re.sub(r'abc', 'def', input)           # Replace pattern abc -> def
num = re.sub(r'\s+', '\s', input)            # Eliminate duplicate whitespaces
num = re.sub(r'abc(def)ghi', '\1', input)    # Replace a string with a part of itself

Advance Usage

Replacement Function

Instead of a replacement string you can provide a function performing dynamic replacements based on the match string like this:

def my_replace(m):
    if :
       return <replacement variant 1>
    return <replacement variant 2>

result = re.sub("\w+", my_replace, input)

Count Replacements

When you want to know how many replacements did happen use re.subn() instead:

result = re.sub(pattern, replacement, input)
print ('Result: ', result[0])
print ('Replacements: ', result[1])

Missing tray icon on Ubuntu-derived distributions

If you are a MATE desktop user using a Liferea 1.10.xx package installed from the official package repositories of your Linux distribution and since the switch from 1.8.xx the trayicon went missing then the reason is very probably that you are using a package build by Ubuntu for the Unity desktop that strips the trayicon support.

You can verify wether this is the case in the "Preferences" dialog which should look like this

If the trayicon option is not visible than the package doesn't support a trayicon.

This is known to be the case for at least Mint17.

PHP preg_replace() Examples

This post gives some simple examples for using regular expressions with preg_replace() in PHP scripts.

1. Syntax of preg_replace

While full syntax is

mixed preg_replace ( mixed $pattern , mixed 
$replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )

2. Simple Replacing with preg_replace()

$result = preg_replace('/abc/', 'def', $string);   # Replace all 'abc' with 'def'
$result = preg_replace('/abc/i', 'def', $string);  # Replace with case insensitive matching
$result = preg_replace('/\s+/', '', $string);      # Strip all whitespaces

3. Advanced Usage of preg_replace()

Multiple replacements:

$result = preg_replace(
    array('/pattern1/', '/pattern2/'),
    array('replace1', 'replace2'),
    $string
);

Replacement Back References:

$result = preg_replace('/abc(def)hij/', '/\\1/', $string);
$result = preg_replace('/abc(def)hij/', '/$1/', $string);
$result = preg_replace('/abc(def)hij/', '/${1}/', $string);

Do only a finite number of replacements:

# Perform maximum of 5 replacements
$result = preg_replace('/abc/', 'def', $string, -1, 5);

Multi-line replacement

# Strip HTML tag
$result = preg_replace('#.*#m', '', $string);
Syndicate content