<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>http://bc-bd.org</title>
	<atom:link href="http://bc-bd.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://bc-bd.org/blog</link>
	<description>this is not a blog</description>
	<lastBuildDate>Fri, 26 Apr 2013 11:50:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Mojolicious and sprintf loggin</title>
		<link>http://bc-bd.org/blog/mojolicious/mojolicious-and-sprintf-loggin/</link>
		<comments>http://bc-bd.org/blog/mojolicious/mojolicious-and-sprintf-loggin/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 16:33:16 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[Mojolicious]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=327</guid>
		<description><![CDATA[Don&#8217;t want to write things like app-&#62;log-&#62;debug("foo $config-&#62;{foo} versus ".stat-&#62;mtime." seconds"); but rather app-&#62;log-&#62;debug("foo %s versus %d seconds", $config-&#62;{foo}, stat-&#62;mtime); but Mojo::Log does not support that directly. You could use this: app-&#62;log-&#62;debug(sprintf("foo %s  versus %d seconds", $config-&#62;{foo}, stat-&#62;mtime)); with the downside that sprintf() is called even if the message would not be logged due to [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t want to write things like</p>
<pre>app-&gt;log-&gt;debug("foo $config-&gt;{foo} versus ".stat-&gt;mtime." seconds");</pre>
<p>but rather</p>
<pre>app-&gt;log-&gt;debug("foo %s versus %d seconds", $config-&gt;{foo}, stat-&gt;mtime);</pre>
<p>but Mojo::Log does not support that directly. You could use this:</p>
<pre>app-&gt;log-&gt;debug(sprintf("foo %s  versus %d seconds", $config-&gt;{foo}, stat-&gt;mtime));</pre>
<p>with the downside that sprintf() is called even if the message would not be logged due to your app&#8217;s log level being higher than that of the call.</p>
<p>Alternatively you could base your own logger class on <strong>Mojo::Log</strong>:</p>
<pre>#!/usr/bin/perl

package My::Log;
use base Mojo::Log;

sub format {
        my ($self, $level, $format, @parameters) = @_;

        return $self-&gt;SUPER::format($level, sprintf($format, @parameters));
};

package main;

use Mojolicious::Lite;

app-&gt;log-&gt;error("this string %s printf %s", 'uses', 'stuff');
app-&gt;log-&gt;warn('decimal: %d hex: %x', 16, 16);
app-&gt;log-&gt;info('pi: %.2f', 3.14159265359);</pre>
<p>And it&#8217;s output:</p>
<pre>[Wed Feb 27 17:24:34 2013] [error] this string uses printf stuff
[Wed Feb 27 17:24:34 2013] [warn] decimal: 16 hex: 10
[Wed Feb 27 17:24:34 2013] [info] pi: 3.14</pre>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/mojolicious/mojolicious-and-sprintf-loggin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mojolicious behind Apache with mod_proxy</title>
		<link>http://bc-bd.org/blog/mojolicious/mojolicious-behind-apache/</link>
		<comments>http://bc-bd.org/blog/mojolicious/mojolicious-behind-apache/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 16:21:35 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[Mojolicious]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=323</guid>
		<description><![CDATA[This is the only way I got an Mojolicious application to work behind an apache2 web server using mod_proxy. Setting the base will make sure that your routes match the incoming URLs and that the right URL is used in redirects: my $base = 'http://localhost:3000/app1'; hook 'before_dispatch' =&#62; sub {         shift-&#62;req-&#62;url-&#62;base(Mojo::URL-&#62;new($base)); }; When using [...]]]></description>
			<content:encoded><![CDATA[<p>This is the only way I got an Mojolicious application to work behind an apache2 web server using mod_proxy.</p>
<p>Setting the base will make sure that your routes match the incoming URLs and that the right URL is used in redirects:</p>
<pre>my $base = 'http://localhost:3000/app1';

hook 'before_dispatch' =&gt; sub {
        shift-&gt;req-&gt;url-&gt;base(Mojo::URL-&gt;new($base));
};</pre>
<p>When using the style sheet or JavaScript helper a leading slash is important, else the path will be wrong:</p>
<pre>%= stylesheet '/css/foo.css'</pre>
<p>And this is the apache config snippet:</p>
<pre>ProxyPass /app1 http://localhost:3000
ProxyPassReverse /app1 http://localhost:3000/app1</pre>
<p>Note the missing /app1 at the end of the <strong>ProxyPass</strong> line.</p>
<p>The complete Mojolicious code:</p>
<pre>#!/usr/bin/env perl
use Mojolicious::Lite;

use Time::HiRes qw/gettimeofday/;

my $base = 'http://localhost:3000/app1';

hook 'before_dispatch' =&gt; sub {
        shift-&gt;req-&gt;url-&gt;base(Mojo::URL-&gt;new($base));
};

under sub {
        shift-&gt;stash(now =&gt; join('.', gettimeofday()));
};

get '/' =&gt; sub {
        my $self = shift;
        $self-&gt;render('index');
} =&gt; 'index';

get '/foo' =&gt; sub {
        my $self = shift;
        $self-&gt;render('foo');
};

get '/redirect' =&gt; sub {
        my $self = shift;
        $self-&gt;redirect_to('foo');
};
 app-&gt;start;

__DATA__

@@ foo.html.ep
% layout 'default';
% title 'Foo';

@@ index.html.ep
% layout 'default';
% title 'index';

@@ layouts/default.html.ep
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    %= stylesheet '/css/foo.css'
    &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Welcome to &lt;%= title %&gt;&lt;/h1&gt;
    &lt;p&gt;Now: &lt;%= stash('now') %&gt;&lt;/p&gt;
    &lt;%= content %&gt;
    &lt;hr/&gt;
    &lt;ul&gt;
     &lt;li&gt;&lt;%= link_to 'Index' =&gt; 'index' %&gt;&lt;/li&gt;
     &lt;li&gt;&lt;%= link_to 'Foo' =&gt; 'foo' %&gt;&lt;/li&gt;
     &lt;li&gt;&lt;%= link_to 'Redirect' =&gt; 'redirect' %&gt;: Will redirect to foo&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/mojolicious/mojolicious-behind-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mojolicious and Linux::Inotify2</title>
		<link>http://bc-bd.org/blog/mojolicious/mojolicious-and-linuxinotify2/</link>
		<comments>http://bc-bd.org/blog/mojolicious/mojolicious-and-linuxinotify2/#comments</comments>
		<pubDate>Tue, 26 Feb 2013 20:51:43 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[Mojolicious]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=308</guid>
		<description><![CDATA[This is a tiny example on how to use Linux::Inotify2 from within a Mojolicious application to watch a file for modification. Note: this will not work with morbo. You will need these modules: Linux::Inotify2 - scalable directory/file change notification EV &#8211; perl interface to libev, a high performance full-featured event loop AnyEvent &#8211; the DBI of [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tiny example on how to use Linux::Inotify2 from within a Mojolicious application to watch a file for modification. <strong>Note</strong>: this will not work with morbo.</p>
<p>You will need these modules:</p>
<ul>
<li><a title="Linux::Inotify2 - scalable directory/file change notification" href="http://http://search.cpan.org/~mlehmann/Linux-Inotify2-1.22/Inotify2.pm">Linux::Inotify2</a> - scalable directory/file change notification</li>
<li><a title="EV - perl interface to libev, a high performance full-featured event loop" href="http://search.cpan.org/~mlehmann/EV-4.11/EV.pm">EV</a> &#8211; perl interface to libev, a high performance full-featured event loop</li>
<li><a title="AnyEvent - the DBI of event loop programming" href="http://search.cpan.org/~mlehmann/AnyEvent-7.04/lib/AnyEvent.pm">AnyEvent</a> &#8211; the DBI of event loop programming</li>
<li>And of course <a title="Mojolicious - Real-time web framework" href="http://search.cpan.org/~sri/Mojolicious-3.87/lib/Mojolicious.pm">Mojolicious</a></li>
</ul>
<p>Steps to see the magic happen:</p>
<ol>
<li>Save the code below to <strong>/tmp/i.pl</strong></li>
<li>Create file to be watched: <strong>touch /tmp/foo</strong></li>
<li>Run your app (again, morbo will not work): <strong>/tmp/i.pl daemon</strong></li>
<li>In another shell, update the watched file: <strong>touch /tmp/foo</strong></li>
</ol>
<p>This is what Mojolicious should log:</p>
<blockquote><p>[Tue Feb 26 21:22:09 2013] [info] Listening at &#8220;http://*:3000&#8243;.<br />
Server available at http://127.0.0.1:3000.<br />
[Tue Feb 26 21:22:13 2013] [debug] file changed<br />
[Tue Feb 26 21:22:13 2013] [debug] file changed<br />
[Tue Feb 26 21:22:13 2013] [debug] file changed</p></blockquote>
<p>Code:</p>
<pre>#!/usr/bin/perl

use Mojolicious::Lite;

use Linux::Inotify2;
use EV;
use AnyEvent;

sub file_changed {
        app-&gt;log-&gt;debug("file changed");
}

sub setup_notify {
        my $inotify = new Linux::Inotify2;
        $inotify-&gt;watch('/tmp/foo', IN_ALL_EVENTS, \
                \&amp;file_changed);

        my $io = AnyEvent-&gt;io(
                fh =&gt; $inotify-&gt;{fd},
                poll =&gt; 'r',
                cb =&gt; sub { $inotify-&gt;poll }
        );

        return $io;
}

get '/' =&gt; sub { shift-&gt;render_text('index') };

my $io = setup_notify();

app-&gt;start();</pre>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/mojolicious/mojolicious-and-linuxinotify2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover 0.7.2 available</title>
		<link>http://bc-bd.org/blog/wordpress/hover-0-7-2-available/</link>
		<comments>http://bc-bd.org/blog/wordpress/hover-0-7-2-available/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 14:59:11 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=254</guid>
		<description><![CDATA[This release fixes an interoperability issue with the Events Manager plugin. Thanks to Marcus Sykes for helping me narrow down the problem.]]></description>
			<content:encoded><![CDATA[<p>This release fixes an interoperability issue with the <a href="http://wp-events-plugin.com/">Events Manager</a> plugin. Thanks to Marcus Sykes for helping me narrow down the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/wordpress/hover-0-7-2-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover 0.7.1 available</title>
		<link>http://bc-bd.org/blog/foo/hover-0-7-1-available/</link>
		<comments>http://bc-bd.org/blog/foo/hover-0-7-1-available/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 12:04:27 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[Foo]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=249</guid>
		<description><![CDATA[This release fixes undefined constant/variable warnings, an error during checks triggerd by a missing table, the has_cap deprecation warning and a bug where the activation hook may not be run. Also Maintenance options have been added.]]></description>
			<content:encoded><![CDATA[<p>This release fixes undefined constant/variable warnings, an error during checks triggerd by a missing table, the has_cap deprecation warning and a bug where the activation hook may not be run.</p>
<p>Also Maintenance options have been added.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/foo/hover-0-7-1-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover 0.7.0 available</title>
		<link>http://bc-bd.org/blog/wordpress/hover-0-7-0-available/</link>
		<comments>http://bc-bd.org/blog/wordpress/hover-0-7-0-available/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 12:51:56 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=243</guid>
		<description><![CDATA[This release fixes the hidden screen options problem, updates the included xajax to the latest stable version and disables websnapr support. Also the script has been split up in smaller pieces, so that only what is needed is loaded.]]></description>
			<content:encoded><![CDATA[<p>This release fixes the hidden screen options problem, updates the included xajax<br />
to the latest stable version and disables websnapr support.</p>
<p>Also the script has been split up in smaller pieces, so that only what is needed<br />
is loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/wordpress/hover-0-7-0-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hostapd, ath9k (AR9287) and Could not set interface mon.wlan0 flags: Unknown error 132</title>
		<link>http://bc-bd.org/blog/debian/hostapd-ath9k-ar9287-and-could-not-set-interface-mon-wlan0-flags-unknown-error-132/</link>
		<comments>http://bc-bd.org/blog/debian/hostapd-ath9k-ar9287-and-could-not-set-interface-mon-wlan0-flags-unknown-error-132/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 13:45:32 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[debian]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=238</guid>
		<description><![CDATA[Turns out this error message meant, wireless radio is hard blocked by BIOS. So after enabling wireless radio in the BIOS, I now have a working access point.]]></description>
			<content:encoded><![CDATA[<p>Turns out this error message meant, wireless radio is hard blocked by BIOS. So after enabling wireless radio in the BIOS, I now have a working access point.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/debian/hostapd-ath9k-ar9287-and-could-not-set-interface-mon-wlan0-flags-unknown-error-132/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover 0.6.13 available</title>
		<link>http://bc-bd.org/blog/wordpress/hover-0-6-1-available/</link>
		<comments>http://bc-bd.org/blog/wordpress/hover-0-6-1-available/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 09:22:36 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=227</guid>
		<description><![CDATA[Hover 0.6.13 adds support for predefined image popups and fixes a couple of bugs. Image Popups In the past hover could generate popups for all HTML tags (including &#60;img&#62;) from their title attribute. To have the same popup for an image you had to enter the same text every time you inserted that image. While [...]]]></description>
			<content:encoded><![CDATA[<p>Hover 0.6.13 adds support for predefined image popups and fixes a couple of bugs.</p>
<h4>Image Popups</h4>
<p>In the past hover could generate popups for all HTML tags (including &lt;img&gt;) from their title attribute. To have the same popup for an image you had to enter the same text every time you inserted that image. While this worked, it was tedious, error prone and hard to change later on.</p>
<p>Hover 0.6.13 now let&#8217;s you define a popup for an image once and every time you use that image, it will get the same popup. Popups are assigned to Images by their absolut URL.</p>
<h4>Bugs fixed</h4>
<ul>
<li>cleanup and fixed plugin activation error detection, table creation and database checks</li>
<li>correctly set database schema version on first time install</li>
<li>HTML encode aposthrophe in popups, fixing possible javascript error</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/wordpress/hover-0-6-1-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover and Images in Tag Popups</title>
		<link>http://bc-bd.org/blog/wordpress/hover-and-images-in-tag-popups/</link>
		<comments>http://bc-bd.org/blog/wordpress/hover-and-images-in-tag-popups/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 14:04:46 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=218</guid>
		<description><![CDATA[It is possible to add images to popups generated for tags, e.g. for links. Just hover over the &#8220;wordpress&#8221; category listed on the right. What you need to do is to partially HTML encode your, well, HTML. In order to display the image as shown in the category, enter this in the category&#8217;s description. &#38;lt;img [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible to add images to popups generated for tags, e.g. for links. Just hover over the &#8220;wordpress&#8221; category listed on the right.</p>
<p>What you need to do is to partially HTML encode your, well, HTML.</p>
<p>In order to display the image as shown in the category, enter this in the category&#8217;s description.</p>
<pre>&amp;lt;img src=\"images/powered/wordpress\" /&amp;gt;</pre>
<p>Be sure to amend the image path to your setup/image.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/wordpress/hover-and-images-in-tag-popups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hover 0.6.12 available</title>
		<link>http://bc-bd.org/blog/wordpress/hover-0-6-12-available/</link>
		<comments>http://bc-bd.org/blog/wordpress/hover-0-6-12-available/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 12:57:41 +0000</pubDate>
		<dc:creator>bd</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bc-bd.org/blog/?p=212</guid>
		<description><![CDATA[This release adds support for opening links in new windows.]]></description>
			<content:encoded><![CDATA[<p>This release adds support for opening links in new windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-bd.org/blog/wordpress/hover-0-6-12-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
