<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Sourcepole - Aktuell</title>
  <id>tag:www.sourcepole.com,2012:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.sourcepole.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.sourcepole.com/" rel="alternate" type="text/html"/>
  <updated>2012-01-16T20:36:47Z</updated>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:www.sourcepole.com,2012-01-16:6114</id>
    <published>2012-01-16T07:51:00Z</published>
    <updated>2012-01-16T20:36:47Z</updated>
    <category term="News"/>
    <link href="http://www.sourcepole.com/shaded-relief-maps-with-qgis" rel="alternate" type="text/html"/>
    <title>Shaded relief maps with QGIS</title>
<content type="html">
            &lt;p&gt;Creating a shaded relief map from digital elevation data is a nice way to create a backround map for web mapping or other GIS work. Thanks to the know-how and the funding from the &lt;a href=&quot;http://www.deza.admin.ch/en/Home/Activities/Humanitarian_Aid/Swiss_Humanitarian_Aid_Unit&quot;&gt;Swiss Humanitarian Aid Unit&lt;/a&gt;, QGIS now has a sophisticated function for relief map generation. The method is described in detail in an &lt;a href=&quot;http://build.sourcepole.ch/qgis/sha_relief.pdf&quot;&gt;paper&lt;/a&gt; by Marc-André Bünzli. 
An important part of the method is the choice of the elevation colors. The QGIS plugin has the possibility to analyse the frequency distribution of the elevation values in the DEM and to propose color changes where significant changes in the histogram occure. It is of course also possible to modify the color scheme, to insert a completely different one in the dialog or to generat a shaded maps without color.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;As illustrated below, the relief map is composed by three components modulated onto the final map to give it a more three-dimensional appearance. These intermediate steps are shown here to get a better understanding of the method. In QGIS, the user directly gets the combination as a result.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first component consists of a hillshade from north-west (300 degree) and an elevation color&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The second component is a hillshade and a gray value depending on the slope angle (darker is steeper). The hillshade angle of this second component differs to the first component by 15% to have better contrast in faces towards the light source. The second component is merged to the relief map with 30% weight.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The third component consists of a hillshade from 270 degree and a yellow color in cells facing towards the light source. It is merged to the relief map with 10% weight&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;And the final relief map looks like this:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:www.sourcepole.com,2011-12-30:6109</id>
    <published>2011-12-30T13:31:00Z</published>
    <updated>2011-12-30T13:33:20Z</updated>
    <category term="News"/>
    <link href="http://www.sourcepole.com/raster-resampling-in-qgis" rel="alternate" type="text/html"/>
    <title>Raster resampling in QGIS</title>
<content type="html">
            &lt;p&gt;QGIS already offers a lot of possibilities to visualize raster data (contrast enhancement, color map, handling of transparent pixels, &#8230;) Last year, Radim Blazek refactored the raster provider interface and added on-the-fly reprojection support for rasters to QGIS. Very cool!&lt;/p&gt;

&lt;p&gt;One of the few things currently missing in QGIS raster layer is the possibility to have other resampling types than nearest neighbour. The problem is that rasters appear pixelated when zooming further than the source raster resolution. So for applications like web mapping, it is important to interpolate the pixel colors and to have a broader display scale range for layers. In the last few weeks, I&#8217;ve added bilinear and cubic raster resampling to QGIS (thanks to Canton Solothurn for funding these activities!).&lt;/p&gt;

&lt;p&gt;A lot of refactoring was necessary  in the raster layer code to add resampling in a clean way. Therefore these changes are available in branch &#8216;raster_resampler&#8217; of the  QGIS github clone (git://github.com/mhugent/Quantum-GIS.git). It probably needs a longer period of testing to make sure every feature of the raster layer class still works properly.&lt;/p&gt;

&lt;p&gt;The resampling option can be chosen in the raster properties dialog:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;And here is the effect for a three band color image.&lt;/p&gt;

&lt;p&gt;Nearest neighbour:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Bilinear:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Cubic:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;And here for a palletted background map&lt;/p&gt;

&lt;p&gt;Nearest neighbour:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Bilinear:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>tpo</name>
    </author>
    <id>tag:www.sourcepole.com,2011-09-19:6094</id>
    <published>2011-09-19T21:27:00Z</published>
    <updated>2011-09-19T21:27:37Z</updated>
    <category term="News"/>
    <category term="Tips &amp; Patches"/>
    <category term="dri"/>
    <category term="gdm"/>
    <category term="x11"/>
    <category term="xorg"/>
    <link href="http://www.sourcepole.com/per-user-x11-options" rel="alternate" type="text/html"/>
    <title>per user X11 options</title>
<content type="html">
            &lt;p&gt;One would expect that considered the complexity of gdm there would be a way to have per user X11 options. So no, there isn&#8217;t one. At least not after the great rewrite after V2.22.&lt;/p&gt;

&lt;p&gt;However good old Unix paradigms can help us (this is all under Debian, other Unices will allow a similar trick):&lt;/p&gt;

&lt;pre&gt;
$ vim /usr/local/bin/X
&lt;/pre&gt;

&lt;p&gt;Add something similar like this:&lt;/p&gt;

&lt;pre&gt;
#!/bin/sh
#
# start X with different options depending on user

# check if the parent gdm process that started us contains
# &quot;--username le_gamer&quot; in its commandline
#
if ps -p $PPID -o args= | grep -q 'username le_gamer';
then
  exec /etc/X11/X.orig $* -config /etc/X11/xorg.conf.le_gamer
else
  exec /etc/X11/X.orig $*
fi
&lt;/pre&gt;

&lt;p&gt;We check whether gdm is starting us and using the parameter &#8220;&#8211;username le_gamer&#8221;. If it is, then we&#8217;re using a different config file for X.&lt;/p&gt;

&lt;p&gt;Of course you&#8217;ll need to adapt all this, unless you are using Debian or Ubuntu. You need to adapt the path to the X Server, to the config files etc.&lt;/p&gt;

&lt;p&gt;Why did I do that? The problem is that Intel&#8217;s X server in Ubuntu Lucid Lynx 10.04 is &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/853057&quot;&gt;really unstable with DRI&lt;/a&gt; on a Intel GM965/GL960 graphics card.&lt;/p&gt;

&lt;p&gt;So unless I&#8217;m playing 3D games which are a lot faster with DRI, I don&#8217;t want to enable DRI (more over, &#8220;NoDRI&#8221; is pulling less power out of my battery). So my normal config contains this:&lt;/p&gt;

&lt;pre&gt;
$ cat /etc/X11/xorg.conf
[...]
Section &quot;Device&quot;
        Identifier      &quot;Configured Video Device&quot;
        Option          &quot;NoDRI&quot;
EndSection
&lt;/pre&gt;

&lt;p&gt;So now, the only thing you need to do is replace your &#8220;normal&#8221; X Server with the new &#8220;adaptable&#8221; one:&lt;/p&gt;

&lt;pre&gt;
$ sudo mv /etc/X11/X /etc/X11/X.orig
$ ln -s /usr/local/bin/X /etc/X11/X
&lt;/pre&gt;

&lt;p&gt;That&#8217;s it,&lt;/p&gt;

&lt;p&gt;Tomáš Pospíšek&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-08-22:6085</id>
    <published>2011-08-22T08:17:00Z</published>
    <updated>2011-08-22T08:20:06Z</updated>
    <category term="News"/>
    <category term="linux"/>
    <link href="http://www.sourcepole.com/celebrating-20-years-of-linux" rel="alternate" type="text/html"/>
    <title>Celebrating 20 years of Linux!</title>
<content type="html">
            &lt;a href=&quot;http://www.linuxfoundation.org/
20th&quot;&gt;&lt;/a&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:www.sourcepole.com,2011-06-30:6075</id>
    <published>2011-06-30T08:02:00Z</published>
    <updated>2011-08-26T10:53:24Z</updated>
    <category term="News"/>
    <category term="qgis"/>
    <link href="http://www.sourcepole.com/svg-symbols-in-qgis-with-modifiable-colors" rel="alternate" type="text/html"/>
    <title>SVG symbols in QGIS with modifiable colors</title>
<content type="html">
            &lt;p&gt;SVG markers are a popular way to symbolise points in QGIS. Predefined markers are available in $PREFIX/share/qgis/svg and it is straightforward to add new symbols or to create own symbols with a vector graphics program (e.g. Inkscape). A disadvantage so far was the need to create different versions of an svg file to have the same symbol in several colors. A recent change in QGIS now introduces the possibility to insert parameter tags into the svg file and QGIS is going to replace them with the values for fill color, outline color and outline width.&lt;/p&gt;

&lt;p&gt;It works with a syntax similar to the &lt;a href=&quot;http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/&quot;&gt;svg params working draft&lt;/a&gt;. Let&#8217;s say we have the following simple svg file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;svg width=&quot;100%&quot; height=&quot;100%&quot;&amp;gt;
&amp;lt;rect fill=&quot;#ff0000&quot; stroke=&quot;#00ff00&quot; stroke-width=&quot;10&quot; width=&quot;100&quot; height=&quot;100&quot;&amp;gt;
&amp;lt;/rect&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To have the possibility to change the colors of the marker, we have to add the placeholders &#8216;param(fill)&#8217; for fill color, &#8216;param(outline)&#8217; for outline color and &#8216;param(outline-width)&#8217; for stroke width. These placeholders can optionally be followed by a default value:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;svg width=&quot;100%&quot; height=&quot;100%&quot;&amp;gt;
&amp;lt;rect fill=&quot;param(fill) #ff0000&quot; stroke=&quot;param(outline) #00ff00&quot; stroke-width=&quot;param(stroke-width) 10&quot; width=&quot;100&quot; height=&quot;100&quot;&amp;gt;
&amp;lt;/rect&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now it is possible to change fill color, outline color and stroke width using the new elements in the QGIS symbol layer dialog.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Replacing parameters and rendering svg can be expensive in terms of processing time. Therefore, an svg cache has been added which accelerates painting of svg markers considerably. 
For drawing on screen and with QGIS server, the svg markers are painted as rasters. For printing, a vectorized output is generated.&lt;/p&gt;

&lt;p&gt;This work was funded by the Canton of Solothurn (Switzerland). Thank you very much!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-06-16:6065</id>
    <published>2011-06-16T07:37:00Z</published>
    <updated>2011-06-16T07:38:40Z</updated>
    <category term="News"/>
    <category term="foss4g"/>
    <category term="qgis"/>
    <link href="http://www.sourcepole.com/qgis-at-foss4g-2011-in-denver" rel="alternate" type="text/html"/>
    <title>QGIS at FOSS4G 2011 in Denver</title>
<content type="html">
            &lt;p&gt;Sourcepole is conducting a QGIS workshop and giving two presentations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/new-features-qgis-power-users&quot;&gt;Workshop: New features for QGIS power users&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/qgis-whats-new&quot;&gt;QGIS, what&#8217;s new?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/publishing-maps-desktop-qgis-server&quot;&gt;Publishing maps from the desktop with QGIS server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are more QGIS workshops and presentations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/customizing-qgis-python-plugins&quot;&gt;Workshop: Customizing QGIS with Python Plugins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/efficiently-using-postgis-qgis&quot;&gt;Efficiently using PostGIS with QGIS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/quantum-gis-inkscape-cartographic-tools-attractive-maps&quot;&gt;Quantum GIS &amp;amp; Inkscape: Cartographic Tools for Attractive Maps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/web-mapping-performance-shootout&quot;&gt;Web Mapping Performance Shootout&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Case studies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/qgis-academic-library-case-study&quot;&gt;QGIS in an Academic Library: A Case Study&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/cellular-automata-quantumgis-plugin-and-web-based-application&quot;&gt;Cellular Automata QuantumGIS plugin and web-based application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/wps-based-biogeography-tool-qgis&quot;&gt;A WPS Based Biogeography Tool for QGIS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/foss4g-technology-enabling-humanitarian-relief-efforts&quot;&gt;FOSS4G: Technology Enabling Humanitarian Relief Efforts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2011.foss4g.org/sessions/prototype-open-source-tool-water-resources-management-developing-countries-0&quot;&gt;A Prototype of open source tool for water resources management in developing countries&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you&#8217;re interested in QGIS, don&#8217;t miss &lt;a href=&quot;http://2011.foss4g.org/&quot;&gt;FOSS4G 2011&lt;/a&gt; in Denver. Early-bird registration ends June 30th. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>tpo</name>
    </author>
    <id>tag:www.sourcepole.com,2011-06-10:6058</id>
    <published>2011-06-10T13:07:00Z</published>
    <updated>2011-06-10T13:08:04Z</updated>
    <category term="News"/>
    <category term="Programming"/>
    <category term="metaprogramming"/>
    <category term="ruby"/>
    <link href="http://www.sourcepole.com/reducing-magic-in-ruby-s-forwardable-class-implementation" rel="alternate" type="text/html"/>
    <title>Reducing magic in Ruby's Forwardable class implementation</title>
<content type="html">
            &lt;h2&gt;Abstract&lt;/h2&gt;

&lt;p&gt;Using string-eval in Ruby for metaprogramming is unnecessarily obscuring. Ruby&#8217;s more modern
and specific metaprogramming methods should be used instead whenever possible. This problem
is illustrated on the example of Ruby&#8217;s &lt;code&gt;Forwardable&lt;/code&gt; class.&lt;/p&gt;

&lt;h2&gt;In detail&#8230;&lt;/h2&gt;

&lt;p&gt;Ruby&#8217;s &lt;a href=&quot;http://www.ruby-doc.org/stdlib/libdoc/forwardable/rdoc/index.html&quot;&gt;Forwardable&lt;/a&gt;
class is using metaprogramming to forward calls from a frontend interface to an instance in the back
executing the call.&lt;/p&gt;

&lt;p&gt;Metaprogramming is the discipline of making code that creates code. This task allready is rather
abstract and hard to grasp in itself. Having hard to grasp code is a liability. One of the goals
of writing code is allways to keep the code as simple and as well understandable as possible.&lt;/p&gt;

&lt;p&gt;Additionaly, metaprogramming code itself is difficult to read and understand: that is because the
metaprogramming code will not necessarily express what the code it is creating is about, but only
how it is creating that code. As such the code it is creating can be invisible to you as a reader
of the source code - the created code will only start to exist at runtime.&lt;/p&gt;

&lt;p&gt;One would therefore expect that programmers would try especially hard when they metaprogram to make
that particular kind of code expressive and easy to understand.&lt;/p&gt;

&lt;p&gt;Another consequence of the fact that the code produced by metaprogramming is not necessarily visible,
is that debugging becomes more difficult: when analyzing problems you&#8217;ll not only be unsure how the
programm works, but in addition, you won&#8217;t even be sure how the code that is executed looks like -
since it is only generated at runtime.&lt;/p&gt;

&lt;p&gt;This post is focusing on the last problem: debugging of metaprogrammed code.&lt;/p&gt;

&lt;p&gt;There are two approaches to metaprogramming. One is to have as far as possible compile-time parseable
code and the other is to let the code only be parsed at runtime.&lt;/p&gt;

&lt;p&gt;As of version 1.9.2, Ruby&#8217;s &lt;code&gt;Forwardable&lt;/code&gt; class is using the
&lt;a href=&quot;https://github.com/ruby/ruby/blob/c84bb5df6dff60d17ff692306aa94fd53bed9638/lib/forwardable.rb&quot;&gt;latter&lt;/a&gt;. The metaprogramming code in Ruby 1.8.7 looks like this:&lt;/p&gt;

&lt;pre&gt;
    module_eval(&amp;lt;&lt;/pre&gt;

&lt;p&gt;As said, this has the consequence of the metaprogrammed code being completely invisible to the parser and other
tools such as editors and debuggers.&lt;/p&gt;

&lt;p&gt;This results in the following:&lt;/p&gt;

&lt;pre&gt;
$ cat queue.rb
require 'rubygems'
require 'forwardable'
require 'ruby-debug'

class Queue
  extend Forwardable

  def initialize
    @q = [ ]    # prepare delegate object
  end

  # setup preferred interface, enq() and deq()...
  def_delegator :@q, :push, :enq
  def_delegator :@q, :shift, :deq

  # support some general Array methods that fit Queues well
  def_delegators :@q, :clear, :first, :push, :shift, :size
end

q = Queue.new
debugger # ------ DEBUGGING FROM HERE ON -----
q.enq 1, 2, 3, 4, 5
q.push 6

q.shift    # =&gt; 1
while q.size &gt; 0
  puts q.deq
end

q.enq &quot;Ruby&quot;, &quot;Perl&quot;, &quot;Python&quot;
puts q.first
q.clear
puts q.first
&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;pre&gt;
$ ruby queue.rb

queue.rb:24
q.enq 1, 2, 3, 4, 5

(rdb:1) step
(__FORWARDABLE__):2

(rdb:1) list =
*** No sourcefile available for (__FORWARDABLE__)

(rdb:1) step
(__FORWARDABLE__):3

&lt;/pre&gt;

&lt;p&gt;In other words, you are rather lost allready - otherwise you probably wouldn&#8217;t be stepping through
your code - and in that situation it happens that your debugger gets completely lost as well,
since it does not know any more where in the code it is and what it exactly is executing.&lt;/p&gt;

&lt;p&gt;That&#8217;s nothing the programmer wishes for. In a situation where you are debugging you want to have
a maximally clear view of all state, including what code you are currently executing.&lt;/p&gt;

&lt;p&gt;Chaning that situation requires making as much of the metaprogrammed code visible to the parser,
which is the second approach to metaprogramming mentioned previously:&lt;/p&gt;

&lt;pre&gt;
$ cat forwardable2.rb
...
    self.send(:define_method, ali) do |*args,&amp;block|
      begin
        instance_variable_get(accessor).__send__(method, *args,&amp;block)
      rescue Exception
        $@.delete_if{|s| /^\\(__FORWARDABLE__\\):/ =~ s} unless Forwardable2::debug
        Kernel::raise
      end
    end
&lt;/pre&gt;

&lt;p&gt;Note that it&#8217;s the same code as before, except that we do not do &lt;code&gt;eval(&quot;string&quot;)&lt;/code&gt; any more,
but instead are using specific, more modern metaprogramming tools provided by standard Ruby.&lt;/p&gt;

&lt;p&gt;The result is the following:&lt;/p&gt;

&lt;pre&gt;
$ ruby queue.rb

queue.rb:22
q.enq 1, 2, 3, 4, 5

(rdb:1) step
/usr/lib/ruby/1.8/forwardable2.rb:149
begin

(rdb:1) list =
[144, 153] in /usr/lib/ruby/1.8/forwardable2.rb
   144      accessor = accessor.id2name if accessor.kind_of?(Integer)
   145      method = method.id2name if method.kind_of?(Integer)
   146      ali = ali.id2name if ali.kind_of?(Integer)
   147
   148      self.send(:define_method, ali) do |*args,&amp;block|
=&gt; 149        begin
   150          instance_variable_get(accessor).__send__(method, *args,&amp;block)
   151        rescue Exception
   152          $@.delete_if{|s| /^\\(__FORWARDABLE__\\):/ =~ s} unless Forwardable2::debug
   153          Kernel::raise

(rdb:1) step
/usr/lib/ruby/1.8/forwardable2.rb:150
instance_variable_get(accessor).__send__(method, *args,&amp;block)

&lt;/pre&gt;

&lt;p&gt;Allready much, much better.&lt;/p&gt;

&lt;p&gt;Of course, with the string-eval approach to metaprogramming Ruby itself could do better by saving the string that is being
evaled to be able to refer to it later at step-through time. However currently we don&#8217;t have this option.&lt;/p&gt;

&lt;p&gt;Tomáš Pospíšek&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-05-25:6038</id>
    <published>2011-05-25T20:00:00Z</published>
    <updated>2011-05-25T20:00:48Z</updated>
    <category term="News"/>
    <category term="gsoc"/>
    <category term="qgis"/>
    <category term="qgis mobile"/>
    <link href="http://www.sourcepole.com/qgis-mobile-gsoc-has-started" rel="alternate" type="text/html"/>
    <title>QGIS Mobile GSoC has started</title>
<content type="html">
            &lt;p&gt;Yesterday, we had our first meeting with Marco Bernasocchi, who just started his Google Summer of Code project.
The project goals are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;porting QGIS to the Android platform&lt;/li&gt;
&lt;li&gt;adapt the QGIS GUI for tablet computers&lt;/li&gt;
&lt;li&gt;write a driver for the built-in GPS&lt;/li&gt;
&lt;li&gt;create a QGIS &#8220;mini&#8221; application for mobile phones&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Marco Hugentobler is mentoring the project and updated information will be available on a &lt;a href=&quot;http://www.qgis.org/wiki/QGIS_Mobile_GSoC_2011&quot;&gt;QGIS Wiki page&lt;/a&gt;.
We wish Marco good luck and are looking forward to a portable QGIS this year!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>tpo</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-27:6030</id>
    <published>2011-04-27T12:09:00Z</published>
    <updated>2011-04-27T12:11:36Z</updated>
    <category term="News"/>
    <category term="Programming"/>
    <category term="irwi"/>
    <category term="own tags"/>
    <category term="redcloth"/>
    <category term="ruby on rails"/>
    <category term="textile"/>
    <link href="http://www.sourcepole.com/extending-redcloth" rel="alternate" type="text/html"/>
    <title>extending RedCloth markup</title>
<content type="html">
            &lt;p&gt;There are various approaches when trying to extend the &lt;a href=&quot;http://textile.thresholdstate.com/&quot;&gt;Textile&lt;/a&gt; markup that &lt;a href=&quot;http://redcloth.org/&quot;&gt;RedCloth&lt;/a&gt; understands with own tags or syntax. Some approaches documented on the net have changed or don&#8217;t work any more, since RedCloth has been rewritten in Version 4.&lt;/p&gt;

&lt;p&gt;Below is a fairly robust aproach, that is based on the assumption, that RedCloth leaves HTML tags inside the markup untouched and passes them on to the application consuming the translated markup.&lt;/p&gt;

&lt;p&gt;The below code has been used in the &lt;a href=&quot;http://code.zhdk.ch/projects/madek&quot;&gt;Madek&lt;/a&gt; project. Madek, a &lt;a href=&quot;http://rubyonrails.org&quot;&gt;Ruby On Rails&lt;/a&gt; application, uses &lt;a href=&quot;https://github.com/alno/irwi&quot;&gt;irwi&lt;/a&gt; which provides a Wiki to Madek. And finally irwi uses RedCloth to do the rendering from Textile to HTML. That&#8217;s where we hook in.&lt;/p&gt;

&lt;p&gt;We want to have a few special tags, which make the life of the Madek Wiki admin simpler, by letting him write the following inside the Textile markup:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[media=210      | Das Huhn]
[screenshot=210 | Das Huhn]
[video=210      | Das Huhn]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That will finally produce this HTML output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;/media_entries/210&quot;&amp;gt;Das Huhn&amp;lt;/a&amp;gt;
&amp;lt;img src=&quot;/media_entries/210/image&quot; title=&quot;Das Huhn&quot;/&amp;gt;
&amp;lt;video src=&quot;/media_entries/210/image&quot; title=&quot;Das Huhn&quot;/&amp;gt;
  &amp;lt;a href='/media_entries/210'&amp;gt;(see video)&amp;lt;/a&amp;gt;
&amp;lt;/video&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here&#8217;s the implementation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class RedClothMadek

  ActionView::Base.sanitized_allowed_tags &amp;lt;&amp;lt; 'video'

  def initialize
    require 'redcloth'
  end

  def format( text )
    ::RedCloth.new( replace_madek_tags(text) ).to_html
  end

  # Transforms the follwing Textile markups:
  # 
  #   [media=210      | Das Huhn] -&amp;gt; &amp;lt;a href=&quot;/media_entries/210&quot;&amp;gt;Das Huhn&amp;lt;/a&amp;gt;
  #   [screenshot=210 | Das Huhn] -&amp;gt; &amp;lt;img src=&quot;/media_entries/210/image&quot; title=&quot;Das Huhn&quot;/&amp;gt;
  #   [video=210      | Das Huhn] -&amp;gt; &amp;lt;video src=&quot;/media_entries/210/image&quot; title=&quot;Das Huhn&quot;/&amp;gt;
  #                                    &amp;lt;a href='/media_entries/210'&amp;gt;(see video)&amp;lt;/a&amp;gt;
  #                                  &amp;lt;/video&amp;gt;
  #
  def replace_madek_tags( text )

    # unfortunately having multiple matches in gsub doesn't seem to work, therefore
    # we fall back to $1 $2
    #
    text.gsub(/[\s*media\s*=\s*(\d+)\s*\|\s*([^]]+)\s*]/) { |number,txt|

           &quot;&amp;lt;a href='/media_entries/#{$1}'&amp;gt;#{h($2)}&amp;lt;/a&amp;gt;&quot;                 }.

         gsub(/[\s*screenshot\s*=\s*(\d+)\s*\|\s*([^]]+)\s*]/) { |number,title|

           &quot;&amp;lt;img src='/media_entries/#{$1}/image' title='#{h($2)}'/&amp;gt;&quot;    }.

         gsub(/[\s*video\s*=\s*(\d+)\s*\|\s*([^]]+)\s*]/) { |number,title|
           &quot;&amp;lt;video src='/media_entries/#{$1}/image' title='#{h($2)}'&amp;gt;&quot; +
             &quot;&amp;lt;a href='/media_entries/#{$1}'&amp;gt;(see Wideo)&amp;lt;/a&amp;gt;&quot; +
           &quot;&amp;lt;/video&amp;gt;&quot;  }
  end

end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And finally, irwi needs to be told to use that formatter instead of RedCloth directly. From &lt;code&gt;config/environment.rb&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require &quot;#{Rails.root}/lib/red_cloth_madek.rb&quot;
Irwi.config.formatter = RedClothMadek.new
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Tomáš Pospíšek&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>tpo</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-17:6022</id>
    <published>2011-04-17T09:02:00Z</published>
    <updated>2011-04-17T11:25:59Z</updated>
    <category term="News"/>
    <category term="Programming"/>
    <category term="Software"/>
    <category term="Tips &amp; Patches"/>
    <category term="annotating web pages"/>
    <category term="greasemonkey"/>
    <category term="homegate"/>
    <category term="javascript"/>
    <link href="http://www.sourcepole.com/annotating-third-party-web-pages" rel="alternate" type="text/html"/>
    <title>annotating third party web pages</title>
<content type="html">
            &lt;p&gt;Problem: I have a web site/page that I visit regularily which I want to annotate with my notes.&lt;/p&gt;

&lt;p&gt;More specifically, I was regularly searching through the &lt;a href=&quot;http://homegate.ch&quot;&gt;Homegate&lt;/a&gt; real estate hub looking for a new home. It goes without saying that I was again and again forgetting which objects I had already looked at, which objects were really interesting and I should check out more closely.&lt;/p&gt;

&lt;p&gt;Therefore the need to annotate search results.&lt;/p&gt;

&lt;p&gt;The here presented approach should be applicable for annotation of other web pages as well. It&#8217;s based on the observation, that restful web applications need to operate with asset IDs. These asset IDs can be reused to enrich the asset locally with additional data, such as notes. Thus we&#8217;re looking for those IDs in specific elements of the page and add a bit of HTML markup to those places.&lt;/p&gt;

&lt;p&gt;Of course that aproach only works as long as the web site doesn&#8217;t heavily change its markup and doesn&#8217;t rendomly change asset IDs.&lt;/p&gt;

&lt;p&gt;Here&#8217;s a screenshot of regular Homegate search results:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;And here&#8217;s the same page after scripting it with &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/&quot;&gt;Greasemonkey&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You&#8217;ll notice the input field with the comment in it.&lt;/p&gt;

&lt;p&gt;The idea is simple: add an input box to each search result, where you write your comment. When the focus leaves the input box, the comment is stored to localStorage.&lt;/p&gt;

&lt;p&gt;Starting with Greasemonkey is quite easy. There are howtos and templates to start from, such as &lt;a href=&quot;http://snipplr.com/view/805/greasemonkey-template/&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, regular JavaScripting and Greasemonkey JavaScripting do not work in exactly the same way:&lt;/p&gt;

&lt;p&gt;One of the differences is that Greasemonkey creates a separate JavaScript environment, in which the Greasemonkey scripts are executed. That is calling Javascript contained in the page from Greasemonkey and the inverse calling Greasemonkey scripts from the page is not possible by default. This is on purpose, so that the web page can not detect and not interfere with the Greasemonkey scripts, because you want your Greasemonkey scripts to work allways on some page, whether or not that page likes it or not. Therefore no interference is possible.&lt;/p&gt;

&lt;p&gt;Greasemonkey however provides a standard way to access the web page&#8217;s scripts, and that&#8217;s through the &#8220;unsafeWindow&#8221; object, which is a reference to the web page&#8217;s environment.&lt;/p&gt;

&lt;p&gt;I had two mechanisms I had to make accessible using the &#8220;unsafeWindow&#8221; handle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the first was accessing JQuery, which is included by default by the Homegate page. Since I needed to use JQuery functions in my Greasemonkey script, I got a reference to it via the standard Greasemonkey precedure:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;
    var jQuery = unsafeWindow['jQuery'];
&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;the second mechanism that needed to cross the boundaries between the web page and Greasemonkey was callbacks from the web page to my Greasemonkey script. This is necessary, because I&#8217;m attaching &#8220;input&#8221; elements  to each search result, which contain a note and which, &#8220;onblur&#8221;, need to call a function that saves the content of the input box. Here&#8217;s part that constructs the input element:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;
    jQuery(&quot;&amp;lt;input onclick='event.cancelBubble = true;'&quot; +
                 &quot; onblur='saveComment(this, immoID);'&gt;&quot;).insertAfter(immoElement);
&lt;/pre&gt;

&lt;p&gt;And this is the function that gets called back by &#8220;onblur&#8221;:&lt;/p&gt;

&lt;pre&gt;
    unsafeWindow.saveComment = function(element, immoID) {
      unsafeWindow.localStorage.setItem(immoID, element.value);
    };
&lt;/pre&gt;

&lt;p&gt;The next interesting thing you&#8217;ll note is usage of &#8216;locaStorage&#8217;. Support for the latter in browsers does not seem mature yet. One problem I&#8217;ve encountered when developing under Firefox 3.6 was that saving to &#8216;localStorage&#8217; was not possible when cookies were disabled (see &lt;a href=&quot;https://bugs.launchpad.net/firefox/+bug/473677&quot;&gt;this report&lt;/a&gt;). Thus you&#8217;ll need to permanently enable cookies for Homegate in order for the script to be able to save its data.&lt;/p&gt;

&lt;p&gt;Finally, while developing, a major problem was, that Firefox did not show me errors in the Greasemonkey scripts. Thus either the script would work or not work and fail completely silently. That made debugging a bit painful.&lt;/p&gt;

&lt;p&gt;So now, here&#8217;s &lt;a href=&quot;/assets/2011/4/17/homegate_notes.user.js&quot;&gt;the script&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tomáš Pospíšek&lt;/p&gt;

&lt;p&gt;PS: This script also lives at &lt;a href=&quot;http://userscripts.org/scripts/show/101302&quot;&gt;userscripts.org&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-11:6019</id>
    <published>2011-04-11T14:26:00Z</published>
    <updated>2011-04-11T14:28:38Z</updated>
    <category term="qgis"/>
    <link href="http://www.sourcepole.com/qgis-anwendertag-6-5-hsr-rapperswil" rel="alternate" type="text/html"/>
    <title>QGIS Anwendertag, 6.5., HSR Rapperswil</title>
<content type="html">
            &lt;p&gt;Am Freitag dem 6. Mai, findet an der Hochschule für Technik Rapperswil das 2. deutschsprachige QGIS Anwendertreffen statt. Quantum GIS (oder kurz QGIS) ist ein benutzerfreundliches Open Source Desktop- und Server-GIS welches sich einer stark wachsenden Anwendergruppe erfreut. Sie finden Infos zu QGIS 
unter &lt;a href=&quot;http://www.qgis.org/&quot;&gt;www.qgis.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nach dem erfolgreichen ersten deutschsprachigen QGIS Anwendertreffen am 
21.4.2010 in Bern findet das zweite deutschsprachige QGIS-Anwendertreffen an der 
HSR in Rapperswil statt. Alle aktuellen Infos zur Veranstaltung, wie auch zur 
Anmeldung, finden Sie auf der &lt;a href=&quot;http://www.qgis.org/de/anwendertreffen/rapperswil-052011.html&quot;&gt;QGIS Seite&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Der Vormittag besteht aus zwei Blöcken mit Vorträgen und Demos, am Nachmittag 
werden drei parallele Workshops/Kurse für Anfänger, Fortgeschrittene und 
Programmierer durchgeführt. Der Vormittag ist für alle Teilnehmer gratis, die 
Kurse am Nachmittag kosten CHF 120.-&lt;/p&gt;

&lt;p&gt;Wir würden uns freuen, möglichst viele QGIS-Anwender und Interessierte begrüssen zu 
dürfen.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>tpo</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-10:6016</id>
    <published>2011-04-10T13:51:00Z</published>
    <updated>2011-04-10T13:59:47Z</updated>
    <category term="News"/>
    <category term="Tips &amp; Patches"/>
    <category term="catalog"/>
    <category term="export"/>
    <category term="gthumb"/>
    <category term="images"/>
    <category term="linux"/>
    <category term="photos"/>
    <category term="sorting"/>
    <link href="http://www.sourcepole.com/manually-sort-images" rel="alternate" type="text/html"/>
    <title>Visually sorting images under Linux</title>
<content type="html">
            &lt;p&gt;to visually sort images under Linux doesn&#8217;t seem to be a trivial task. I &lt;a href=&quot;http://duckduckgo.com&quot;&gt;duckduckgo&lt;/a&gt;&#8216;ed for a long time and had a look at various image and file managing applications before finding &lt;a href=&quot;http://live.gnome.org/gthumb&quot;&gt;gthumb&lt;/a&gt;. And even there, you first need to create a &#8220;catalog&#8221; and within the catalog a &#8220;library&#8221; which will finally allow you to manually sort your images. All of which is not documented.&lt;/p&gt;

&lt;p&gt;Once you&#8217;ve sorted your images, you&#8217;d possibly want to export the sorting? Again, no trace of any help or documentation: gthumb catalogs are saved under &lt;code&gt;$HOME/.local/share/gthumb/catalogs/foobar.catalog&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Tomáš Pospíšek&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-08:6014</id>
    <published>2011-04-08T09:45:00Z</published>
    <updated>2011-04-08T09:46:37Z</updated>
    <category term="Tips und Patches"/>
    <category term="fossgis"/>
    <category term="gis"/>
    <category term="globe"/>
    <link href="http://www.sourcepole.com/fossgis-2011-vergleich-von-open-source-virtual-globes-2" rel="alternate" type="text/html"/>
    <title>FOSSGIS 2011: Vergleich von Open Source Virtual Globes</title>
<content type="html">
            &lt;p&gt;Mittlerweile gibt es mehrere Open Source Alternativen zu Google Earth, wie z.B. Nasa World Wind Java SDK, ossimPlanet oder osgEarth. Dieser Vortrag soll eine Übersicht aktueller Open Source Virtual Globes bieten und einige Vorschläge zu erwünschten Funktionen liefern.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/assets/2011/4/8/fossgis2011_virtual_globes.pdf&quot;&gt;Präsentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demos:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4087243/&quot;&gt; NASA World Wind Java SDK&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4087204/&quot;&gt; ossimPlanet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4087170/&quot;&gt; gvSIG 3D&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4087187/&quot;&gt; osgEarth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4076305/&quot;&gt; osgEarth QGIS plugin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blip.tv/file/4992542/&quot;&gt; OSM-3D&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-07:6010</id>
    <published>2011-04-07T08:24:00Z</published>
    <updated>2011-04-07T08:25:31Z</updated>
    <category term="Tips und Patches"/>
    <category term="fossgis"/>
    <category term="geoext"/>
    <category term="qgis"/>
    <category term="wms"/>
    <link href="http://www.sourcepole.com/fossgis-2011-webgis-mit-qgis-und-geoext" rel="alternate" type="text/html"/>
    <title>FOSSGIS 2011: Webgis mit QGIS und GeoExt</title>
<content type="html">
            &lt;p&gt;Neues vom QGIS Server&lt;/p&gt;

&lt;p&gt;Der Vortrag zeigt die Fortschritte von QGIS Server auf, illustriert auch anhand von Beispielen aus der Praxis. QGIS Server kann neu .qgs Projektfiles aus dem Desktop-GIS-Bereich als zentrale Konfigurationsdatei von Webdiensten (derzeit nur WMS) verwenden. Das bietet verschiedene Vorteile:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Desktop-GIS, Web-GIS und WMS aus der gleichen Konfigurationsdatei&lt;/li&gt;
&lt;li&gt;kein manuelles Editieren von .map-Files - auch Mapserver-Laien können nun sehr einfach Webdienste erstellen&lt;/li&gt;
&lt;li&gt;Übernahme von Druck-Layouts für das Drucken im Web (derzeit in Arbeit)&lt;/li&gt;
&lt;li&gt;Verwendung der neuen Label-Engine und der erweiterten Symbolisierungsmöglichkeiten aus der neuen Symbology-Engine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Die Client-Komponente wurde mit GeoExt (OpenLayers, ExtJS,GeoExt) realisiert. Es werden soviele Konfigurationen wie möglich aus dem Desktop-GIS-Bereich in den Web-GIS-Bereich übernommen, wie z.b. der Projektname, die Attributdatenbehandlung (Spaltenunterdrückung, Spaltenaliases, etc.), das Selektierbarmachen von Layern, sowie das Verwenden bereits vordefinierter Drucklayouts.&lt;/p&gt;

&lt;p&gt;Wo möglich wurde der bestehende WMS Standard verwendet, wo nötig, wurden Erweiterungen im WMS-Protokoll vorgenommen, vorwiegend beim Drucken, aber auch bei den getFeatureInfo und getCapabilities Requests.&lt;/p&gt;

&lt;p&gt;Der Vortrag zeigt produktive Beispiele aus dem GIS der Stadt Uster und zeigt welche Arbeitsschritte auf dem Server und dem Client notwendig sind, um ein QGIS-Projekt ins Web zu bringen.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/assets/2011/4/7/Webgis_mit_QGIS_und_GeoExt.pdf&quot;&gt;Präsentation&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.sourcepole.com/">
    <author>
      <name>pka</name>
    </author>
    <id>tag:www.sourcepole.com,2011-04-07:6009</id>
    <published>2011-04-07T08:07:00Z</published>
    <updated>2011-04-07T08:09:36Z</updated>
    <category term="fossgis"/>
    <category term="gis"/>
    <category term="qgis"/>
    <link href="http://www.sourcepole.com/fossgis-2011-neue-entwicklungen-und-features-vom-quantum-gis-projekt" rel="alternate" type="text/html"/>
    <title>FOSSGIS 2011: Neue Entwicklungen und Features vom Quantum GIS Projekt</title>
<content type="html">
            &lt;p&gt;Das QGIS Projekt hat zum Ziel, ein plattformunabhängiges, einfach zu bedienendes und offenes Desktop GIS zu entwickeln. Im vergangenen Jahr hat die Aktivität in der QGIS-Community erneut zugenommen. Seit der letzten FOSSGIS Konferenz in Osnabrück hat sich QGIS wieder enorm weiterentwickelt. Sucht man sich (aus der Liste der svn commits) alle Neuerungen des letzten Jahres heraus, so kommt man auf eine Liste, die den Rahmen dieses Artikels bei weitem sprengen würde. Daher stellen wir im Rahmen des Vortrags lediglich eine kleine Auswahl der Entwicklungen der aktuellen und der kommenden Versionen vor.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/assets/2011/4/7/20110406_qgis_vortrag.pdf&quot;&gt;Präsentation&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
</feed>

