Skip to content

Use namespace as global variable in Ansible Jinja templates

A simple task, or so I thought: in a Jinja template keep track of the number of items in a loop. And then use that count afterwards.

Disclaimer: the number of items is not equal the number of times the loop runs, so I can't use the loop variables.

Turns out that Jinja has other opinions, and variables inside a loop are all local. When a variable is changed inside the loop, the scoop of the variable stays local, and once the loop ends the original value of the variable is restored. That's even true for variables which are created outside the loop.

 

Continue reading "Use namespace as global variable in Ansible Jinja templates"
  • Twitter
  • Bookmark Use namespace as global variable in Ansible Jinja templates at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Use namespace as global variable in Ansible Jinja templates
  • Bloglines Use namespace as global variable in Ansible Jinja templates
  • Technorati Use namespace as global variable in Ansible Jinja templates
  • Fark this: Use namespace as global variable in Ansible Jinja templates
  • Bookmark Use namespace as global variable in Ansible Jinja templates at YahooMyWeb
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Furl.net
  • Bookmark Use namespace as global variable in Ansible Jinja templates at reddit.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at blinklist.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Spurl.net
  • Bookmark Use namespace as global variable in Ansible Jinja templates at Simpy.com
  • Bookmark Use namespace as global variable in Ansible Jinja templates at blogmarks
  • Bookmark Use namespace as global variable in Ansible Jinja templates with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

SELECT pg_sleep_until('#800Monies');

Pavlo recently pointed out that the pg_sleep() function in PostgreSQL has two alternatives: pg_sleep_for() and pg_sleep_until().

What do they do?

 

Continue reading "SELECT pg_sleep_until('#800Monies');"
  • Twitter
  • Bookmark SELECT pg_sleep_until('#800Monies'); at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg SELECT pg_sleep_until('#800Monies');
  • Bloglines SELECT pg_sleep_until('#800Monies');
  • Technorati SELECT pg_sleep_until('#800Monies');
  • Fark this: SELECT pg_sleep_until('#800Monies');
  • Bookmark SELECT pg_sleep_until('#800Monies'); at YahooMyWeb
  • Bookmark SELECT pg_sleep_until('#800Monies'); at Furl.net
  • Bookmark SELECT pg_sleep_until('#800Monies'); at reddit.com
  • Bookmark SELECT pg_sleep_until('#800Monies'); at blinklist.com
  • Bookmark SELECT pg_sleep_until('#800Monies'); at Spurl.net
  • Bookmark SELECT pg_sleep_until('#800Monies'); at Simpy.com
  • Bookmark SELECT pg_sleep_until('#800Monies'); at blogmarks
  • Bookmark SELECT pg_sleep_until('#800Monies'); with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Certificate expiration date in Ansible

In one of my Ansible Playbooks I'm updating Let's Encrypt certificates. Because the Playbook is rather long, I want to make sure that Ansible is not spending cycles on a certificate which is not about to expire. Hence I wrote a small filter plugin, which receives the certificate path and the number of days the certificate must be still valid.

This plugin is used to filter out any "good" certificate which does not need to be updated.

 

Continue reading "Certificate expiration date in Ansible"
  • Twitter
  • Bookmark Certificate expiration date in Ansible at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Certificate expiration date in Ansible
  • Bloglines Certificate expiration date in Ansible
  • Technorati Certificate expiration date in Ansible
  • Fark this: Certificate expiration date in Ansible
  • Bookmark Certificate expiration date in Ansible at YahooMyWeb
  • Bookmark Certificate expiration date in Ansible at Furl.net
  • Bookmark Certificate expiration date in Ansible at reddit.com
  • Bookmark Certificate expiration date in Ansible at blinklist.com
  • Bookmark Certificate expiration date in Ansible at Spurl.net
  • Bookmark Certificate expiration date in Ansible at Simpy.com
  • Bookmark Certificate expiration date in Ansible at blogmarks
  • Bookmark Certificate expiration date in Ansible with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

GSoC 2014: Implementing clustering algorithms in MADlib

Happy to announce that Maxence Ahlouche has been accepted by both the PostgreSQL Project and by Google to implement clustering algorithms in MADlib during the Google Summer of Code 2014.

This project is mentored by Atri Sharma (former GSoC student) and me, with technical help from Pivotal (product owner of MADlib).

Looking forward to another successful GSoC year!

  • Twitter
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg GSoC 2014: Implementing clustering algorithms in MADlib
  • Bloglines GSoC 2014: Implementing clustering algorithms in MADlib
  • Technorati GSoC 2014: Implementing clustering algorithms in MADlib
  • Fark this: GSoC 2014: Implementing clustering algorithms in MADlib
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at YahooMyWeb
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at Furl.net
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at reddit.com
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at blinklist.com
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at Spurl.net
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at Simpy.com
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib at blogmarks
  • Bookmark GSoC 2014: Implementing clustering algorithms in MADlib with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

New PostgreSQL pg_docbot is live

Last night a long-running project of mine went live: pg_docbot v2.

For years, Jan Wieck provided a helper bot (rtfm_please) in the #postgresql IRC channel in the freenode network. Because of protocol changes in the freenode network, this bot was no longer functional. Together with some others we decided to write a quick and dirty new bot. As it is with dirty hacks, not everything was optimal: after timeouts the bot was not able to reconnect - more exactly the POE framework did not even recognize the timeout. Also extending the bot and adding new functionality was complicated. For a while I collected all these problems in my personal bugtracker and about two years ago I started a full rewrite.

Some of the new key features:

  • pg_docbot's channel limit is gone: a user in the freenode network can only join 20something channels, the new bot was designed from the ground to handle multiple IRC connections and circumvent this problem
  • function to identify stale urls: the new ?lost command shows all unconnected urls
  • registered users are now either "op" or "admin": all operators can issue ?learn and ?forget, admins can - of course - do everything
  • new command to post to all channels: the ?wallchan command let the doc post to all channels
  • i18n: every channel has a configured language, default is English - all messages in this channel are posted in the configured language (if translation is available)
  • watchdog on board: every session is monitored and reconnected, if necessary - no more "ads: can you please restart the bot?"
  • nickname handling: every session is monitoring his (registered) nickname and will reclaim the nick if necessary, also nickserv handling is included now
  • commands are recognized in different languages: a nice add-on, by-product of i18n, most commands can be used in different languages - like "search" (English) and "suche" (German)
  • bot can join and leave channels on the fly: not much to say about, just that you can have the bot in a temporary PostgreSQL channel if you like
  • channels can have paswords now: this works both for configured channels as well as on-the-fly joined channels
  • autojoin channels: configured but not joined channels are rejoined after a while, also it is possible to configure but not autojoin channels
  • statistics: the bot runs anonymous stats about his usage, like ?search, ?learn, ?forget and so on

There is still a lot to do, not all of my tickets are closed. If you want pg_docbot talking in your language, please send me translations. The pg_docbot code is on git.postgresql.org.

Next things on my todo list:

  • verify each URL from time to time: mark unreachable as invalid
  • intelligent sort order: not yet sure how to solve this problem, right now there is no specific sort order
  • move pg_docbot to PostgreSQL infrastructure
  • web interface: the bot should redirect the user to his website if there are more then let's say 2 or 3 urls, to avoid flooding the IRC channels
  • integration in postgresql.org website: the pg_docbot database contains very useful knowledge, there are plans to integrate this into the search on the main website
  • integration with explain.depesz.com: every time the bot see's a link from a paste site, it should scan the content and generate a postign on explain.depesz.com
  • monitor planet.postgresql.org: publish new postings in IRC channels
  • allow better search: like using a regexp
  • ...


Continue reading "New PostgreSQL pg_docbot is live"
  • Twitter
  • Bookmark New PostgreSQL pg_docbot is live at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg New PostgreSQL pg_docbot is live
  • Bloglines New PostgreSQL pg_docbot is live
  • Technorati New PostgreSQL pg_docbot is live
  • Fark this: New PostgreSQL pg_docbot is live
  • Bookmark New PostgreSQL pg_docbot is live at YahooMyWeb
  • Bookmark New PostgreSQL pg_docbot is live at Furl.net
  • Bookmark New PostgreSQL pg_docbot is live at reddit.com
  • Bookmark New PostgreSQL pg_docbot is live at blinklist.com
  • Bookmark New PostgreSQL pg_docbot is live at Spurl.net
  • Bookmark New PostgreSQL pg_docbot is live at Simpy.com
  • Bookmark New PostgreSQL pg_docbot is live at blogmarks
  • Bookmark New PostgreSQL pg_docbot is live with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Read number lines in a file - in LaTeX

Probably a rare needed feature, but i had to count the number lines in a text file - in LaTeX. Continue reading "Read number lines in a file - in LaTeX"
  • Twitter
  • Bookmark Read number lines in a file - in LaTeX at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Read number lines in a file - in LaTeX
  • Bloglines Read number lines in a file - in LaTeX
  • Technorati Read number lines in a file - in LaTeX
  • Fark this: Read number lines in a file - in LaTeX
  • Bookmark Read number lines in a file - in LaTeX at YahooMyWeb
  • Bookmark Read number lines in a file - in LaTeX at Furl.net
  • Bookmark Read number lines in a file - in LaTeX at reddit.com
  • Bookmark Read number lines in a file - in LaTeX at blinklist.com
  • Bookmark Read number lines in a file - in LaTeX at Spurl.net
  • Bookmark Read number lines in a file - in LaTeX at Simpy.com
  • Bookmark Read number lines in a file - in LaTeX at blogmarks
  • Bookmark Read number lines in a file - in LaTeX with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Generate random number in LaTeX

It is possible to generate random numbers in a TeX document. For a gimmick i wanted a random line from a text file in my slides. The first step was to find a random number.

Continue reading "Generate random number in LaTeX"
  • Twitter
  • Bookmark Generate random number in LaTeX at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Generate random number in LaTeX
  • Bloglines Generate random number in LaTeX
  • Technorati Generate random number in LaTeX
  • Fark this: Generate random number in LaTeX
  • Bookmark Generate random number in LaTeX at YahooMyWeb
  • Bookmark Generate random number in LaTeX at Furl.net
  • Bookmark Generate random number in LaTeX at reddit.com
  • Bookmark Generate random number in LaTeX at blinklist.com
  • Bookmark Generate random number in LaTeX at Spurl.net
  • Bookmark Generate random number in LaTeX at Simpy.com
  • Bookmark Generate random number in LaTeX at blogmarks
  • Bookmark Generate random number in LaTeX with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Include and exclude latex-beamer frames

For my slides i sometimes want to disable parts of the presentation, as example: if the operating system is Linux, i don't need Solaris installation instructions. The \ifthenelse{<condition>}{...true...}{...false...} from the ifthen package works very well for normal frames, but it fails, if there are examples (verbatim environment) in the code.

In such a case \iftrue and \iffalse are much more lazy than \ifthenelse and compiling the examples results no longer in latex parser errors. The downside of this solution: i need to predefine the condition, but in my case i have them in a separate file anyway.

The definition looks like:

\newboolean{usesolaris}
\ifthenelse{\equal{\targetos}{solaris}}{
  \setboolean{usesolaris}{true}
}{
  \setboolean{usesolaris}{false}
}

I have defined the variable \targetos, which contains a string with the currently used platform name for my presentation. If the string matches "solaris", the boolean \usesolaris is set to "true", else to "false". Latex compiles the "\ifusesolaris" definition from the boolean, which i later can use to include or exclude frames:

\ifusesolaris
\begin{frame}[fragile]
  ... frame content
\end{frame
}
\fi

In addition, it is also possible to add code for the case where \usesolaris is false. Just add \else and the code before \fi.

  • Twitter
  • Bookmark Include and exclude latex-beamer frames at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Include and exclude latex-beamer frames
  • Bloglines Include and exclude latex-beamer frames
  • Technorati Include and exclude latex-beamer frames
  • Fark this: Include and exclude latex-beamer frames
  • Bookmark Include and exclude latex-beamer frames at YahooMyWeb
  • Bookmark Include and exclude latex-beamer frames at Furl.net
  • Bookmark Include and exclude latex-beamer frames at reddit.com
  • Bookmark Include and exclude latex-beamer frames at blinklist.com
  • Bookmark Include and exclude latex-beamer frames at Spurl.net
  • Bookmark Include and exclude latex-beamer frames at Simpy.com
  • Bookmark Include and exclude latex-beamer frames at blogmarks
  • Bookmark Include and exclude latex-beamer frames with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Making life easy for new (and old) PWN translators

I released version 3.0 of the pwn-translation script. Although the version number is already 3.0, this is the first public available version.

What does it do? You feed one of David Fetter's PostgreSQL weekly news mails into the script and it generates a new mail with all known text parts translated into your native language. This should make life very easy for new - and already existing - pwn translators.


Continue reading "Making life easy for new (and old) PWN translators"
  • Twitter
  • Bookmark Making life easy for new (and old) PWN translators at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Making life easy for new (and old) PWN translators
  • Bloglines Making life easy for new (and old) PWN translators
  • Technorati Making life easy for new (and old) PWN translators
  • Fark this: Making life easy for new (and old) PWN translators
  • Bookmark Making life easy for new (and old) PWN translators at YahooMyWeb
  • Bookmark Making life easy for new (and old) PWN translators at Furl.net
  • Bookmark Making life easy for new (and old) PWN translators at reddit.com
  • Bookmark Making life easy for new (and old) PWN translators at blinklist.com
  • Bookmark Making life easy for new (and old) PWN translators at Spurl.net
  • Bookmark Making life easy for new (and old) PWN translators at Simpy.com
  • Bookmark Making life easy for new (and old) PWN translators at blogmarks
  • Bookmark Making life easy for new (and old) PWN translators with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main

Die Unterlagen für das Tutorial beim Perl-Workshop 2009 in Frankfurt/Main am 25.02.2009 sind unter:

http://andreas.scherbaum.la/writings/

zu finden. Folgende Änderungen wurden gegenüber dem Vortrag vorgenommen:

- ein falscher Variablenbezeichner im "Perl" Teil wurde korrigiert

- Beispiele für Nutzung von SPI in Perl Stored Procedures wurden aufgenommen

Viel Spass mit den Unterlagen

Update: Die Unterlagen aller Vorträge gibt es im Wiki: http://conferences.yapceurope.org/gpw2009/wiki?node=Slides

  • Twitter
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main
  • Bloglines Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main
  • Technorati Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main
  • Fark this: Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at YahooMyWeb
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at Furl.net
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at reddit.com
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at blinklist.com
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at Spurl.net
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at Simpy.com
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main at blogmarks
  • Bookmark Unterlagen für Tutorial beim Perl-Workshop in Frankfurt/Main with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca