<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Politreco</title><link href="https://politreco.com/" rel="alternate"></link><link href="https://politreco.com/feed/all.atom.xml" rel="self"></link><id>https://politreco.com/</id><updated>2025-03-03T10:00:00-08:00</updated><subtitle>by Lucas De Marchi</subtitle><entry><title>Lazy libkmod compression library loading</title><link href="https://politreco.com/2025/03/lazy-libkmod-compression-library-loading/" rel="alternate"></link><published>2025-03-03T10:00:00-08:00</published><updated>2025-03-03T10:00:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2025-03-03:/2025/03/lazy-libkmod-compression-library-loading/</id><summary type="html">&lt;p&gt;One new feature in &lt;a href="https://lore.kernel.org/linux-modules/hzjr4s6bp35apkmeyqaafsbhfrnetfzsarw34o5c5fvnuppfmz@n4yy43fdkpwx/T/#u"&gt;kmod 34&lt;/a&gt;
is related to lazily loading the decompression libraries. In other words,
dlopen them when/if they are needed. Although it&amp;#8217;s desired for a tool&amp;nbsp;like
&lt;code&gt;modinfo&lt;/code&gt; to be able to inspect a .ko.xz, .ko.zst or .ko.gz module, other
daemons linking to libkmod would benefit from never loading them. This is the
case for systemd-udevd that will load the kernel modules during boot when they
are requested by the&amp;nbsp;kernel.&lt;/p&gt;
&lt;p&gt;Testing on Archlinux, it goes from&amp;nbsp;this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/proc/&lt;span class="k"&gt;$(&lt;/span&gt;pidof&lt;span class="w"&gt; &lt;/span&gt;systemd-udevd&lt;span class="k"&gt;)&lt;/span&gt;/maps&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;libz&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;liblzma
&lt;span class="go"&gt;7f27a9ae8000-7f27a9aeb000 r--p 00000000 00 …&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;One new feature in &lt;a href="https://lore.kernel.org/linux-modules/hzjr4s6bp35apkmeyqaafsbhfrnetfzsarw34o5c5fvnuppfmz@n4yy43fdkpwx/T/#u"&gt;kmod 34&lt;/a&gt;
is related to lazily loading the decompression libraries. In other words,
dlopen them when/if they are needed. Although it&amp;#8217;s desired for a tool&amp;nbsp;like
&lt;code&gt;modinfo&lt;/code&gt; to be able to inspect a .ko.xz, .ko.zst or .ko.gz module, other
daemons linking to libkmod would benefit from never loading them. This is the
case for systemd-udevd that will load the kernel modules during boot when they
are requested by the&amp;nbsp;kernel.&lt;/p&gt;
&lt;p&gt;Testing on Archlinux, it goes from&amp;nbsp;this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/proc/&lt;span class="k"&gt;$(&lt;/span&gt;pidof&lt;span class="w"&gt; &lt;/span&gt;systemd-udevd&lt;span class="k"&gt;)&lt;/span&gt;/maps&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;libz&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;liblzma
&lt;span class="go"&gt;7f27a9ae8000-7f27a9aeb000 r--p 00000000 00:19 15656                      /usr/lib/liblzma.so.5.6.4&lt;/span&gt;
&lt;span class="go"&gt;7f27a9aeb000-7f27a9b0e000 r-xp 00003000 00:19 15656                      /usr/lib/liblzma.so.5.6.4&lt;/span&gt;
&lt;span class="go"&gt;7f27a9b0e000-7f27a9b19000 r--p 00026000 00:19 15656                      /usr/lib/liblzma.so.5.6.4&lt;/span&gt;
&lt;span class="go"&gt;7f27a9b19000-7f27a9b1a000 r--p 00031000 00:19 15656                      /usr/lib/liblzma.so.5.6.4&lt;/span&gt;
&lt;span class="go"&gt;7f27a9b1a000-7f27a9b1b000 rw-p 00032000 00:19 15656                      /usr/lib/liblzma.so.5.6.4&lt;/span&gt;
&lt;span class="go"&gt;7f27a9b1b000-7f27a9b27000 r--p 00000000 00:19 15985                      /usr/lib/libzstd.so.1.5.7&lt;/span&gt;
&lt;span class="go"&gt;7f27a9b27000-7f27a9bed000 r-xp 0000c000 00:19 15985                      /usr/lib/libzstd.so.1.5.7&lt;/span&gt;
&lt;span class="go"&gt;7f27a9bed000-7f27a9bfe000 r--p 000d2000 00:19 15985                      /usr/lib/libzstd.so.1.5.7&lt;/span&gt;
&lt;span class="go"&gt;7f27a9bfe000-7f27a9bff000 r--p 000e3000 00:19 15985                      /usr/lib/libzstd.so.1.5.7&lt;/span&gt;
&lt;span class="go"&gt;7f27a9bff000-7f27a9c00000 rw-p 000e4000 00:19 15985                      /usr/lib/libzstd.so.1.5.7&lt;/span&gt;
&lt;span class="go"&gt;7f27aa892000-7f27aa895000 r--p 00000000 00:19 7852                       /usr/lib/libz.so.1.3.1&lt;/span&gt;
&lt;span class="go"&gt;7f27aa895000-7f27aa8a3000 r-xp 00003000 00:19 7852                       /usr/lib/libz.so.1.3.1&lt;/span&gt;
&lt;span class="go"&gt;7f27aa8a3000-7f27aa8a9000 r--p 00011000 00:19 7852                       /usr/lib/libz.so.1.3.1&lt;/span&gt;
&lt;span class="go"&gt;7f27aa8a9000-7f27aa8aa000 r--p 00017000 00:19 7852                       /usr/lib/libz.so.1.3.1&lt;/span&gt;
&lt;span class="go"&gt;7f27aa8aa000-7f27aa8ab000 rw-p 00018000 00:19 7852                       /usr/lib/libz.so.1.3.1&lt;/span&gt;
&lt;span class="gp"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;to&amp;nbsp;this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/proc/&lt;span class="k"&gt;$(&lt;/span&gt;pidof&lt;span class="w"&gt; &lt;/span&gt;systemd-udevd&lt;span class="k"&gt;)&lt;/span&gt;/maps&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;libz&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;liblzma
&lt;span class="gp"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&amp;#8230; even if all modules in Archlinux are&amp;nbsp;zstd-compressed.&lt;/p&gt;
&lt;p&gt;systemd itself started doing this a few releases ago and published
https://systemd.io/ELF_PACKAGE_METADATA/. That spec is also used for this new
support in kmod to annotate what libraries are possibly dlopen&amp;#8217;ed. However
although it prevented libkmod from being loaded in other binaries, it didn&amp;#8217;t
prevent all these decompression libraries from being mapped in systemd-udevd
since it uses&amp;nbsp;libkmod.&lt;/p&gt;
&lt;p&gt;One might wonder why not&amp;nbsp;even &lt;code&gt;libzstd.so&lt;/code&gt; is mapped. That&amp;#8217;s because when
loading the modules and the kernel supports decompressing that format, libkmod
just skips any decompression: it opens the file and passes the descriptor
to the Linux kernel via &lt;a href="https://linux.die.net/man/2/finit_module"&gt;finit_module&lt;/a&gt;.
&lt;code&gt;/sys/module/compression&lt;/code&gt; shows what algorithm the Linux kernel can use for
module&amp;nbsp;decompression.&lt;/p&gt;
&lt;p&gt;In kmod 34 all that is needed is to setup the build&amp;nbsp;with &lt;code&gt;-Ddlopen=all&lt;/code&gt;.
More fine-grained options are also supported, allowing to specify individual
libraries to dlopen. It may go away in a future release if distros just choose
an all-or-nothing&amp;nbsp;support.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="kmod"></category></entry><entry><title>Linux module dependencies</title><link href="https://politreco.com/2024/08/linux-module-dependencies/" rel="alternate"></link><published>2024-08-13T10:00:00-07:00</published><updated>2024-08-13T10:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2024-08-13:/2024/08/linux-module-dependencies/</id><summary type="html">&lt;p&gt;With the imminent release of kmod 33, I thought it&amp;#8217;d be good to have a post
about the different types of module dependencies that we have in the Linux
kernel and kmod. The new version adds another type, &lt;strong&gt;weak&lt;/strong&gt; dependency,
and as the name implies, is the weakest of all. But let&amp;#8217;s revisit what are
the other types&amp;nbsp;first.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id="hard-symbol-dependency"&gt;Hard (symbol)&amp;nbsp;dependency&lt;/h2&gt;
&lt;p&gt;This is the first dependency that every appeared in kmod (and
module-init-tools).  A hard (or as some call, &amp;#8220;symbol&amp;#8221;) dependency occurs when
your module calls or uses an exported symbol of another module. The most common …&lt;/p&gt;</summary><content type="html">&lt;p&gt;With the imminent release of kmod 33, I thought it&amp;#8217;d be good to have a post
about the different types of module dependencies that we have in the Linux
kernel and kmod. The new version adds another type, &lt;strong&gt;weak&lt;/strong&gt; dependency,
and as the name implies, is the weakest of all. But let&amp;#8217;s revisit what are
the other types&amp;nbsp;first.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id="hard-symbol-dependency"&gt;Hard (symbol)&amp;nbsp;dependency&lt;/h2&gt;
&lt;p&gt;This is the first dependency that every appeared in kmod (and
module-init-tools).  A hard (or as some call, &amp;#8220;symbol&amp;#8221;) dependency occurs when
your module calls or uses an exported symbol of another module. The most common
way is by calling a function that is exported in another module. Example:&amp;nbsp;the
&lt;code&gt;xe.ko&lt;/code&gt; calls a&amp;nbsp;function &lt;code&gt;ttm_bo_pin()&lt;/code&gt; that is provided and exported by
another&amp;nbsp;module, &lt;code&gt;ttm.ko&lt;/code&gt;. Looking to the&amp;nbsp;source:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;nm&lt;span class="w"&gt; &lt;/span&gt;build/drivers/gpu/drm/ttm/ttm.ko&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\bttm_bo_pin\b&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;0000000000000bc0 T ttm_bo_pin&lt;/span&gt;
&lt;span class="gp"&gt;$ &lt;/span&gt;nm&lt;span class="w"&gt; &lt;/span&gt;build64/drivers/gpu/drm/xe/xe.ko&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\bttm_bo_pin\b&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;             U ttm_bo_pin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It is not possible to insert the xe.ko module before ttm.ko and if you try
via insmod (that doesn&amp;#8217;t handle dependencies) it will fail with the kernel
complaining that&amp;nbsp;the &lt;code&gt;ttm_bo_pin&lt;/code&gt; symbol is&amp;nbsp;undefined.&lt;/p&gt;
&lt;p&gt;The manual invocations&amp;nbsp;to &lt;code&gt;nm&lt;/code&gt; illustrates what the &lt;strong&gt;depmod&lt;/strong&gt; tool does: it
opens the modules and reads the &lt;span class="caps"&gt;ELF&lt;/span&gt; headers. Then it takes note of all the
symbols required and provided by each module, creating a graph of symbol
dependencies. Ultimately that leads to module dependencies: &lt;strong&gt;xe ➛ ttm&lt;/strong&gt;.
This is recorded in&amp;nbsp;the &lt;code&gt;modules.dep&lt;/code&gt; file and its&amp;nbsp;sibling &lt;code&gt;modules.dep.bin&lt;/code&gt;.
The former is human-readable and the latter is used by libkmod, but they
contain the same information: all dependencies for all the modules. Also note
that each line reflects indirect dependencies: module A calls symbol from B
and B calls symbol from C will lead to A depending on both B and C. Real world&amp;nbsp;example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/lib/modules/&lt;span class="k"&gt;$(&lt;/span&gt;uname&lt;span class="w"&gt; &lt;/span&gt;-r&lt;span class="k"&gt;)&lt;/span&gt;/modules.dep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;kernel/drivers/gpu/drm/xe/xe.ko.zst:
&lt;span class="go"&gt;kernel/drivers/gpu/drm/xe/xe.ko.zst: kernel/drivers/gpu/drm/drm_gpuvm.ko.zst kernel/drivers/gpu/drm/drm_exec.ko.zst kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.zst kernel/drivers/gpu/drm/drm_buddy.ko.zst kernel/drivers/i2c/algos/i2c-algo-bit.ko.zst kernel/drivers/gpu/drm/drm_suballoc_helper.ko.zst kernel/drivers/gpu/drm/drm_ttm_helper.ko.zst kernel/drivers/gpu/drm/ttm/ttm.ko.zst kernel/drivers/gpu/drm/display/drm_display_helper.ko.zst kernel/drivers/media/cec/core/cec.ko.zst kernel/drivers/acpi/video.ko.zst kernel/drivers/platform/x86/wmi.ko.zst&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So&amp;nbsp;the &lt;code&gt;xe.ko&lt;/code&gt; (with .zst extension since it&amp;#8217;s compressed) directly or indirectly
depends&amp;nbsp;on &lt;code&gt;drm_gpuvm.ko, drm_exec.ko, gpu-sched.ko, drm_buddy.ko, i2c-algo-bit.ko,
drm_suballoc_helper.ko, drm_ttm_helper.ko, ttm.ko, drm_display_helper.ko, cec.ko,
video.ko, wmi.ko&lt;/code&gt;. Same information, but using the kmod tools rather than looking
at the raw&amp;nbsp;index:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;modinfo&lt;span class="w"&gt; &lt;/span&gt;-F&lt;span class="w"&gt; &lt;/span&gt;depends&lt;span class="w"&gt; &lt;/span&gt;xe
&lt;span class="go"&gt;drm_display_helper,ttm,drm_gpuvm,drm_suballoc_helper,video,drm_buddy,drm_exec,drm_ttm_helper,gpu-sched,cec,i2c-algo-bit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id="soft-dependency"&gt;Soft&amp;nbsp;dependency&lt;/h2&gt;
&lt;p&gt;There are situations in the kernel where it&amp;#8217;s not possible or desired to use a
symbol directly from another module - they may interact by registering in a
subsystem, scanning a bus etc.. In this case depmod doesn&amp;#8217;t have enough
information from the &lt;span class="caps"&gt;ELF&lt;/span&gt; file about that. Yet the user would have a more complete
support if both modules were available - it may even cause failures visible to
the end user and not only &amp;#8220;partial support for&amp;nbsp;features&amp;#8221;.&lt;/p&gt;
&lt;p&gt;The softdep implementation contains 2 parts:  &lt;strong&gt;pre&lt;/strong&gt; and &lt;strong&gt;post&lt;/strong&gt; dependencies.
The post dependencies are not very much used in practice: they instruct kmod to
load another module after loading the target&amp;nbsp;one.&lt;/p&gt;
&lt;p&gt;They can come from a configuration file like&amp;nbsp;e.g. &lt;code&gt;/etc/modprobe.d/foo.conf&lt;/code&gt; or
from the kernel itself by embedding that info in the module. From the kernel source
this is achieved by using the&amp;nbsp;macro &lt;code&gt;MODULE_SOFTDEP()&lt;/code&gt;.&amp;nbsp;Example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;libcrc32c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;MODULE_SOFTDEP&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;pre: crc32c&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;When libkmod is loading a module it will first load, in&amp;nbsp;order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;hard&amp;nbsp;dependencies&lt;/li&gt;
&lt;li&gt;soft pre&amp;nbsp;dependencies&lt;/li&gt;
&lt;li&gt;target&amp;nbsp;module&lt;/li&gt;
&lt;li&gt;soft post&amp;nbsp;dependencies&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Historically softdeps were also a way to (mostly) get rid of &lt;strong&gt;install rules&lt;/strong&gt;, in
which the configuration instructs libkmod to execute something instead of loading
the module - people would add an install rule to execute something and then call
modprobe again&amp;nbsp;with &lt;code&gt;--ignore-install&lt;/code&gt; to fake a dependency.  That could easily
lead to a runtime loop which is avoided with softdep since kmod can (and does)
check for&amp;nbsp;loops.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id="weak-dependency"&gt;Weak&amp;nbsp;dependency&lt;/h2&gt;
&lt;p&gt;After explaining the other types of dependencies, back to the new addition
in kmod 33. These are very similar to pre softdep: they come either from a
configuration file or embedded in the module and they express a dependency
that wouldn&amp;#8217;t cause the target module to fail to load, but that may cause
the initialization to export less features or fail while initializing.
There is one important difference: &lt;strong&gt;weak dependencies don&amp;#8217;t cause libkmod
to actually load the module&lt;/strong&gt;. Rather the dependency information may be
used by tools like dracut and other tools responsible for assembling an
initrd to &lt;strong&gt;make the module available&lt;/strong&gt; since it may or may not be used.
Why are they called &amp;#8220;weak&amp;#8221;? This was a &lt;a href="https://lore.kernel.org/linux-modules/7vowjj4oo64a2vquvqaszmzcdvbrlkntcze2btnogvkwwtuddv@uz72wpi2t55s/"&gt;borrowed terminology from
&amp;#8220;weak symbols&amp;#8221;&lt;/a&gt;:
a weak symbol is there, waiting to be used, but it may or may not be, with
the final decision happening in the final link&amp;nbsp;stage.&lt;/p&gt;
&lt;p&gt;With weak dependencies, hopefully some of the pre softdep embedded in the kernel
may be replaced: if the target module is already doing&amp;nbsp;a &lt;code&gt;request_module()&lt;/code&gt; or
in some way getting the other module to be loaded, it doesn&amp;#8217;t need a softdep that
would serialize the module load order and possibly load more modules than&amp;nbsp;required.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="kmod"></category></entry><entry><title>Tracepoints and kernel modules</title><link href="https://politreco.com/2022/03/tracepoints-and-kernel-modules/" rel="alternate"></link><published>2022-03-15T10:00:00-07:00</published><updated>2022-03-15T10:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2022-03-15:/2022/03/tracepoints-and-kernel-modules/</id><summary type="html">&lt;p&gt;While debugging, it&amp;#8217;s invaluable to be able to trace functions in the Linux
kernel. There are several tools for that task: perf, ftrace (with helper tool
like trace-cmd), bpftrace,&amp;nbsp;etc.&lt;/p&gt;
&lt;p&gt;For my own debug of kernel internals and in the last few years to debug the
i915 module for Intel graphics, I usually use tracepoints or dynamic
tracepoints (with perf probe) as the trigger for something I want to&amp;nbsp;trace.&lt;/p&gt;
&lt;p&gt;One question I get some times is &amp;#8220;how do I trace the initial probe of a
kernel module?&amp;#8221;. At that time you (usually) don&amp;#8217;t yet have the module …&lt;/p&gt;</summary><content type="html">&lt;p&gt;While debugging, it&amp;#8217;s invaluable to be able to trace functions in the Linux
kernel. There are several tools for that task: perf, ftrace (with helper tool
like trace-cmd), bpftrace,&amp;nbsp;etc.&lt;/p&gt;
&lt;p&gt;For my own debug of kernel internals and in the last few years to debug the
i915 module for Intel graphics, I usually use tracepoints or dynamic
tracepoints (with perf probe) as the trigger for something I want to&amp;nbsp;trace.&lt;/p&gt;
&lt;p&gt;One question I get some times is &amp;#8220;how do I trace the initial probe of a
kernel module?&amp;#8221;. At that time you (usually) don&amp;#8217;t yet have the module loaded
and as a consequence, the symbols of that module are still not available for
using tracepoints. For&amp;nbsp;example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;# &lt;/span&gt;trace-cmd&lt;span class="w"&gt; &lt;/span&gt;list&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;^i915.*&amp;#39;&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;One thing to realize is that a lot of time we don&amp;#8217;t want to debug the module
&lt;strong&gt;loading&lt;/strong&gt;, but rather the module &lt;strong&gt;binding&lt;/strong&gt; to a device.  These are 2
separate things, that happen in a cascade of events.  It probably also adds to
the confusion that the userspace tools to load the modules are not named very&amp;nbsp;consistently: &lt;code&gt;modprobe&lt;/code&gt; and &lt;code&gt;insmod&lt;/code&gt;, and they end up calling&amp;nbsp;the
&lt;code&gt;[f]init_module&lt;/code&gt; syscall.&lt;/p&gt;
&lt;p&gt;The various buses available in the kernel have mechanisms for stopping the
autoprobe (and hence binding to a device), when a module is loaded. With i915,
all we have to do is to set a few things in&amp;nbsp;the &lt;code&gt;/sys/bus/pci/&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;# &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/sys/bus/pci/drivers_autoprobe
&lt;span class="gp"&gt;# &lt;/span&gt;modprobe&lt;span class="w"&gt; &lt;/span&gt;i915
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;With the i915 module, but not attached to any device, we are
ready to attach to any tracepoint or create new dynamic probes. Let&amp;#8217;s
suppose I want to debug&amp;nbsp;the &lt;code&gt;i915_driver_probe()()&lt;/code&gt; function, and any function
called by it during the initialization. This is one of the functions to initialize
the &lt;span class="caps"&gt;GPU&lt;/span&gt; in i915 called when we are binding to a&amp;nbsp;device.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;F&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;i915_driver_probe

&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/sys/bus/pci/drivers_autoprobe&lt;span class="w"&gt; &lt;/span&gt;
modprobe&lt;span class="w"&gt; &lt;/span&gt;i915

&lt;span class="nb"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/sys/kernel/debug/tracing
cat&lt;span class="w"&gt; &lt;/span&gt;/dev/null&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt;  &lt;/span&gt;trace
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$F&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;set_graph_function
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;_printk&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;set_graph_notrace
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;max_graph_depth
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;function_graph&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;current_tracer
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;tracing_on

&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0000&lt;/span&gt;:03:00.0&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;tee&lt;span class="w"&gt; &lt;/span&gt;/sys/bus/pci/drivers/i915/bind
cp&lt;span class="w"&gt; &lt;/span&gt;trace&lt;span class="w"&gt; &lt;/span&gt;/tmp/trace.txt

&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;tracing_on
cat&lt;span class="w"&gt; &lt;/span&gt;/dev/null&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt;  &lt;/span&gt;trace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;With the snippet above we will start tracing  whenever&amp;nbsp;function
&lt;code&gt;i915_driver_probe()&lt;/code&gt; is executed. We also set a few additional parameters:
set the maximum call depth to graph, disable graphing&amp;nbsp;on &lt;code&gt;printk()&lt;/code&gt;
since it&amp;#8217;s usually not very interesting. Depending on the size of your trace
you may also need to increase&amp;nbsp;the &lt;code&gt;buffer_size_kb&lt;/code&gt; to avoid the ring buffer
to rotate, or have something to pump data out off the ringbuffer to a&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;Even after we enable tracing by echo&amp;#8217;ing 1 to&amp;nbsp;the &lt;code&gt;tracing_on&lt;/code&gt; file, nothing
happens as we are not automatically binding to the device. In the snippet
above we bind it manually, by writting the pci slot to&amp;nbsp;the
&lt;code&gt;/sys/bus/pci/drivers/i915/bind&lt;/code&gt; file. We then should start seeing the
function to be&amp;nbsp;traced:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;txt&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;tracer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;function_graph&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;CPU&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;DURATION&lt;/span&gt;&lt;span class="w"&gt;                  &lt;/span&gt;&lt;span class="k"&gt;FUNCTION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;CALLS&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;                     &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;i915_driver_probe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i915&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;__devm_drm_dev_alloc&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="n"&gt;__kmalloc&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;kmalloc_order_trace&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;kmalloc_order&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;__alloc_pages&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Another thing very useful to do is to attach to a specific tracepoint. For
example, to trace the &lt;span class="caps"&gt;MMIO&lt;/span&gt; read/write we can do the commands below. Now
I&amp;#8217;m using trace-cmd directly and omitting the device bind, that we should
do after start&amp;nbsp;recording:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;# &lt;/span&gt;trace-cmd&lt;span class="w"&gt; &lt;/span&gt;record&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;i915:i915_reg_rw
&lt;span class="go"&gt;Hit Ctrl^C to stop recording&lt;/span&gt;
&lt;span class="go"&gt;^C&lt;/span&gt;
&lt;span class="gp"&gt;# &lt;/span&gt;trace-cmd&lt;span class="w"&gt; &lt;/span&gt;report
&lt;span class="go"&gt;...&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693172: i915_reg_rw:          read reg=0x51000, len=4, val=(0xc1900, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693174: i915_reg_rw:          write reg=0xc6204, len=4, val=(0x10251000, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693796: i915_reg_rw:          read reg=0xa26c, len=4, val=(0x4, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693805: i915_reg_rw:          read reg=0xd00, len=4, val=(0x14, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693808: bprint:               intel_gt_init_clock_frequency: 0000:03:00.0 Using clock frequency: 19200kHz, period: 53ns, wrap: 113816ms&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693817: i915_reg_rw:          read reg=0x913c, len=4, val=(0xff00, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693825: i915_reg_rw:          read reg=0x9144, len=4, val=(0xff00, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693908: i915_reg_rw:          read reg=0x9134, len=4, val=(0xff, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693918: i915_reg_rw:          read reg=0x9118, len=4, val=(0xd02, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693933: i915_reg_rw:          read reg=0x9140, len=4, val=(0x30005, 0x0)&lt;/span&gt;
&lt;span class="go"&gt;tee-2239  [009]   778.693941: i915_reg_rw:          read reg=0x911c, len=4, val=(0x3000000, 0x0)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="Uncategorized"></category><category term="Linux"></category></entry><entry><title>Side-load on embedded Linux with Buildroot</title><link href="https://politreco.com/2019/09/side-load-on-embedded-linux-with-buildroot/" rel="alternate"></link><published>2019-09-22T10:00:00-07:00</published><updated>2019-09-22T10:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2019-09-22:/2019/09/side-load-on-embedded-linux-with-buildroot/</id><summary type="html">&lt;p&gt;Embedded Linux boards and devices often come with a shortage of tools
installed.  Often enough they don&amp;#8217;t use a &amp;#8220;normal&amp;#8221; Linux distribution that can
be easily extended by the end user by means of installing additional packages
via dnf, apt, pacman, etc. Old/ancient versions of the Linux kernel is also
very&amp;nbsp;common.&lt;/p&gt;
&lt;p&gt;In my &lt;a href="2019/04/using-evemu-to-simulate-input-devices"&gt;previous post&lt;/a&gt; I wrote
about using evemu to record data coming from the input subsytem and replay
it on my computer in order to develop a &lt;a href="https://github.com/lucasdemarchi/dema-rc"&gt;Remote Controller software&lt;/a&gt;
for ArduPilot. Without surprise, evemu isn&amp;#8217;t included in the tools that come
with Disco …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Embedded Linux boards and devices often come with a shortage of tools
installed.  Often enough they don&amp;#8217;t use a &amp;#8220;normal&amp;#8221; Linux distribution that can
be easily extended by the end user by means of installing additional packages
via dnf, apt, pacman, etc. Old/ancient versions of the Linux kernel is also
very&amp;nbsp;common.&lt;/p&gt;
&lt;p&gt;In my &lt;a href="2019/04/using-evemu-to-simulate-input-devices"&gt;previous post&lt;/a&gt; I wrote
about using evemu to record data coming from the input subsytem and replay
it on my computer in order to develop a &lt;a href="https://github.com/lucasdemarchi/dema-rc"&gt;Remote Controller software&lt;/a&gt;
for ArduPilot. Without surprise, evemu isn&amp;#8217;t included in the tools that come
with Disco or SkyController 2. They also don&amp;#8217;t have a package manager neither.
I could use their &lt;a href="https://github.com/Parrot-Developers/alchemy"&gt;alchemy build system&lt;/a&gt; to regenerate the entire
distro, but that is much more work than I wanted: just add a few binaries there
to &lt;strong&gt;extend&lt;/strong&gt; rather than to &lt;em&gt;replace&lt;/em&gt; what is currently&amp;nbsp;there.&lt;/p&gt;
&lt;p&gt;I turned back to &lt;a href="https://buildroot.org/"&gt;Buildroot&lt;/a&gt; for that. It has a great
variety of software already &amp;#8220;packaged&amp;#8221;, it&amp;#8217;s pretty straight forward to use
and has good integration for toolchains. I have 2 use cases for&amp;nbsp;it:&lt;/p&gt;
&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#using-pre-packaged-software"&gt;Using pre-packaged&amp;nbsp;software&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#piggyback-on-buildroot-toolchain-integration"&gt;Piggyback on Buildroot toolchain&amp;nbsp;integration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;The first allows me to build software already integrated in Buildroot to extend the ones
available in Disco while with the second it&amp;#8217;s possible to build my own external projects:
dema-rc and&amp;nbsp;ArduPilot.&lt;/p&gt;
&lt;h2 id="using-pre-packaged-software"&gt;Using pre-packaged&amp;nbsp;software&lt;/h2&gt;
&lt;p&gt;You can head to
&lt;a href="https://buildroot.org/download.html"&gt;https://buildroot.org/download.html&lt;/a&gt;
and download a stable release, but I prefer to just clone their git
repository, which allows me to switch to different branches/tags as
the need&amp;nbsp;arises.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m building additional software for Disco and SkyController 2 from
Parrot. Both of them use a P7 processor that is an &lt;span class="caps"&gt;ARM&lt;/span&gt; Cortex A9. To
configure Buildroot we use kconfig, which will be familiar for those
who work(ed) in the Linux kernel. We just&amp;nbsp;call &lt;code&gt;make menuconfig&lt;/code&gt;
and select the options we&amp;nbsp;want.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;clone&lt;span class="w"&gt; &lt;/span&gt;git://git.buildroot.net/buildroot
&lt;span class="gp"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;buildroot
&lt;span class="gp"&gt;$ &lt;/span&gt;make&lt;span class="w"&gt; &lt;/span&gt;menuconfig
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The options for me&amp;nbsp;are:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Architecture&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ARM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;little&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;endian&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Architecture&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;cortex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;A9&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ABI&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;EABIhf&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Floating&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;VFPv3&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;D16&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;On the SkyController 2 I have very little space for the additional
software (8 &lt;span class="caps"&gt;MB&lt;/span&gt;) so I like to enable these options,&amp;nbsp;too:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;Build&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Strip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;binaries&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gcc&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;optimization&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;optimize&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;libraries&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;shared&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now the toolchain part. You can either bring your own toolchain (e.g. provided
by the manufacturer of your board) or you can use Buildroot&amp;#8217;s own integrated
toolchains. I prefer the second since it&amp;#8217;s much easier than trying to find
where the different vendors make them available for download and making sure
that toolchain can build correctly the software already packaged. Also, Buildroot
often has a more recent and better maintained&amp;nbsp;version.&lt;/p&gt;
&lt;p&gt;You may face some problems, though:  if you use a much more recent version, your
libc may contain different symbol versions than the libc available on the board.
You will either have to make the new libc available on the board together with
your programs (more on that later) or you may simply choose an older toolchain
version to avoid the problem. Another problem that may happen is if the libc
you are using or other software make use of syscalls that are not available
in the (ancient) Linux kernel the vendor made available for that board.
In my case it&amp;#8217;s either version 3.10 or 4.0, depending on the version of the
firmware I&amp;#8217;m using on Disco/&lt;span class="caps"&gt;SK2&lt;/span&gt;. My advice: stay with a version close to
what is used on the board, or be  In my case I select the toolchain
like&amp;nbsp;below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Toolchain&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Toolchain&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;External&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;toolchain&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Toolchain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Linaro&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ARM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;2018.05&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After that, just select the software you want under the &lt;strong&gt;Target packages&lt;/strong&gt;
section and build&amp;nbsp;with &lt;code&gt;make&lt;/code&gt;. All needed software will be downloaded and&amp;nbsp;built.&lt;/p&gt;
&lt;p&gt;Since we are not really creating a complete rootfs for a board, I don&amp;#8217;t
care about building a kernel or creating a filesystem image. All I want is to
build a few packages and have the toolchain available for my own&amp;nbsp;projects.&lt;/p&gt;
&lt;p&gt;After building those packages you can&amp;nbsp;inspect &lt;code&gt;output/target/&lt;/code&gt; for the binaries
and libraries compiled. In the end you want to bring (some of) those to the
target board. You can copy the ones you need to the root filesystem in the board,
making them available right away, or you can dedicate a separate directory for
those. I prefer the second approach (hence the name &amp;#8220;side-load&amp;#8221; in this post)
since then I&amp;#8217;m sure I&amp;#8217;m not overwriting a system library/binary and changing its
behavior. When I want to execute them,&amp;nbsp;setting &lt;code&gt;LD_LIBRARY_PATH&lt;/code&gt; is sufficient
in most of the cases, with the exception of when a configuration file is needed
and the program tries to search for it in&amp;nbsp;e.g. &lt;code&gt;/etc&lt;/code&gt;. If you don&amp;#8217;t want to
copy&amp;nbsp;everything, &lt;code&gt;readelf&lt;/code&gt; helps to find the dependent&amp;nbsp;libraries:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;arm-linux-gnueabihf-readelf&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;output/target/usr/bin/evemu-record&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;NEEDED
&lt;span class="go"&gt;0x00000001 (NEEDED)                     Shared library: [libevemu.so.3]&lt;/span&gt;
&lt;span class="go"&gt;0x00000001 (NEEDED)                     Shared library: [libevdev.so.2]&lt;/span&gt;
&lt;span class="go"&gt;0x00000001 (NEEDED)                     Shared library: [libm.so.6]&lt;/span&gt;
&lt;span class="go"&gt;0x00000001 (NEEDED)                     Shared library: [libc.so.6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For my needs I can use the system&amp;#8217;s libm and libc, and just copy libevemu,
libevdev, and evemu-record&amp;nbsp;to &lt;code&gt;/data/rootfs/usr/{lib,bin}/&lt;/code&gt;. Alchemy build
system used by Disco comes from Android and inherits the filesystem&amp;nbsp;layout:
&lt;code&gt;/&lt;/code&gt; is read-only&amp;nbsp;and &lt;code&gt;/data/&lt;/code&gt; read-write. As said before,&amp;nbsp;setting
&lt;code&gt;LD_LIBRARY_PATH=/data/rootfs/usr/lib&lt;/code&gt; is all I need most of the&amp;nbsp;time.&lt;/p&gt;
&lt;h2 id="piggyback-on-buildroot-toolchain-integration"&gt;Piggyback on Buildroot toolchain&amp;nbsp;integration&lt;/h2&gt;
&lt;p&gt;Once we have Buildroot configured we could just integrate our software in
there and make it part of the normal &amp;#8220;distro&amp;#8221;. However I prefer keeping
my development software outside of any package management or rootfs
builder: even though an incremental build in Buildroot is fast, it&amp;#8217;s
slower than an incremental build of just my single program. Also, having
the toolchain setup to build simple test programs while I&amp;#8217;m hacking on
the board helps a&amp;nbsp;lot.&lt;/p&gt;
&lt;p&gt;The toolchain we set up in Buildroot is a cross toolchain. In order to
use it all we need is to follow the instructions for our build system
to cross-compile our software. Each build system has a slightly different
way to do that. We also need a small tweak in Buildroot&amp;#8217;s toolchain,
because for some reason we don&amp;#8217;t get a symlink&amp;nbsp;for &lt;code&gt;pkg-config&lt;/code&gt; in the
usual triplet scheme like for other&amp;nbsp;binaries:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;~/p/buildroot/output/host/bin
&lt;span class="gp"&gt;$ &lt;/span&gt;ln&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;pkg-config&lt;span class="w"&gt; &lt;/span&gt;arm-linux-gnueabihf-pkg-config
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;dema-rc uses meson as build system. You can find its instructions for cross
compilation in its &lt;a href="https://mesonbuild.com/Cross-compilation.html#cross-compilation"&gt;manual&lt;/a&gt;.
I also suggest taking a look on instructions for other projects using meson.
Examples: &lt;a href="https://www.mesa3d.org/meson.html"&gt;mesa&lt;/a&gt; and also its specific instructions
for &lt;a href="https://github.com/anholt/mesa/wiki/Raspberry-Pi-cross-compile"&gt;&lt;span class="caps"&gt;RPI&lt;/span&gt;&lt;/a&gt;.
My configuration file for meson (`~/.local/share/meson/cross/disco.txt)
looks like&amp;nbsp;this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;[binaries]&lt;/span&gt;
&lt;span class="na"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/host/bin/arm-linux-gnueabihf-gcc&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;cpp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/host/bin/arm-linux-gnueabihf-g++&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;ar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/host/bin/arm-linux-gnueabihf-ar&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;strip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/host/bin/arm-linux-gnueabihf-strip&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;pkgconfig&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/host/bin/arm-linux-gnueabihf-pkg-config&amp;#39;&lt;/span&gt;

&lt;span class="k"&gt;[properties]&lt;/span&gt;
&lt;span class="na"&gt;sys_root&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;/home/lucas/p/buildroot/output/target/&amp;#39;&lt;/span&gt;

&lt;span class="k"&gt;[host_machine]&lt;/span&gt;
&lt;span class="na"&gt;system&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;linux&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;cpu_family&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;arm&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;armv7a&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;endian&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#39;little&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For ArduPilot, since each build targets a certain board, we already set the extra
configuration. The only thing you need is to have the compiler with the triplet scheme
in your &lt;span class="caps"&gt;PATH&lt;/span&gt;. Then you compile for&amp;nbsp;the &lt;code&gt;disco&lt;/code&gt; board as&amp;nbsp;usual:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;./waf&lt;span class="w"&gt; &lt;/span&gt;configure&lt;span class="w"&gt; &lt;/span&gt;--board&lt;span class="w"&gt; &lt;/span&gt;disco
&lt;span class="gp"&gt;$ &lt;/span&gt;./waf&lt;span class="w"&gt; &lt;/span&gt;plane
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;More information about using a cross toolchain and generate a rootfs can be found in
the &lt;a href="https://crosstool-ng.github.io/docs/toolchain-usage/"&gt;crosstool-ng instructions&lt;/a&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Embedded Linux"></category><category term="Buildroot"></category><category term="ArduPilot"></category></entry><entry><title>Using evemu to simulate input devices</title><link href="https://politreco.com/2019/04/using-evemu-to-simulate-input-devices/" rel="alternate"></link><published>2019-04-30T01:15:00-07:00</published><updated>2019-04-30T01:15:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2019-04-30:/2019/04/using-evemu-to-simulate-input-devices/</id><summary type="html">&lt;p&gt;I&amp;#8217;m doing some experiments to make the remote controller of Parrot&amp;#8217;s Disco
drone (SkyController 2) to work with ArduPilot. I will talk more about this in
another post. This one is basically about a nifty tool I&amp;#8217;ve found that I didn&amp;#8217;t
know existed: &lt;a href="https://www.freedesktop.org/wiki/Evemu/"&gt;evemu&lt;/a&gt;. I always used
evtest to debug the input system in&amp;nbsp;Linux.&lt;/p&gt;
&lt;p&gt;SkyController 2 runs Linux and exposes all the sticks and buttons as an evdev
device. I developed a tool to serve as a general-purpose software to be used in
this kind of device: &lt;a href="https://github.com/lucasdemarchi/dema-rc"&gt;dema-rc&lt;/a&gt;. Ultimate
goal is to have a software …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m doing some experiments to make the remote controller of Parrot&amp;#8217;s Disco
drone (SkyController 2) to work with ArduPilot. I will talk more about this in
another post. This one is basically about a nifty tool I&amp;#8217;ve found that I didn&amp;#8217;t
know existed: &lt;a href="https://www.freedesktop.org/wiki/Evemu/"&gt;evemu&lt;/a&gt;. I always used
evtest to debug the input system in&amp;nbsp;Linux.&lt;/p&gt;
&lt;p&gt;SkyController 2 runs Linux and exposes all the sticks and buttons as an evdev
device. I developed a tool to serve as a general-purpose software to be used in
this kind of device: &lt;a href="https://github.com/lucasdemarchi/dema-rc"&gt;dema-rc&lt;/a&gt;. Ultimate
goal is to have a software that can replace what comes on these controllers instead
of parsing their packets &lt;a href="https://discuss.ardupilot.org/t/using-sololink-for-linux-based-boards/21719"&gt;like I did for &lt;span class="caps"&gt;3DR&lt;/span&gt; SoloLink&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Testing it remotely on the target every time is time-consuming and requires me
to leave both the drone and controller powered up. When I started it I thought
about recording the events with evtest and then create a tool to expose that via
uinput on my laptop. It turned out that tool already existed and it does in that
exact&amp;nbsp;way.&lt;/p&gt;
&lt;p&gt;On SkyController 2 I run&amp;nbsp;once:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;evemu-record&lt;span class="w"&gt; &lt;/span&gt;/dev/input/event0&lt;span class="w"&gt; &lt;/span&gt;skycontroller2.evemu
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After copying that file to my laptop I can re-create a similar device
locally by&amp;nbsp;using:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp"&gt;$ &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;evemu-play&lt;span class="w"&gt; &lt;/span&gt;skycontroller2.evemu
&lt;span class="go"&gt;www.parrot.com MPP GAMEPAD: /dev/input/event23&lt;/span&gt;
&lt;span class="go"&gt;Hit enter to start replaying&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then whenever I want the sequence of events to be re-played to test in my software
I just hit enter on that window. You may want to use xinput to tell X to ignore
that device, but in my case I didn&amp;#8217;t need as it was already&amp;nbsp;ignoring:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="gp gp-VirtualEnv"&gt;(II)&lt;/span&gt; &lt;span class="go"&gt;config/udev: Adding input device www.parrot.com MPP GAMEPAD (/dev/input/event23)&lt;/span&gt;
&lt;span class="gp gp-VirtualEnv"&gt;(II)&lt;/span&gt; &lt;span class="go"&gt;No input driver specified, ignoring this device.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This approach proved very useful as it worked on the remote device on the first
try after debugging it with the&amp;nbsp;replays.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="input"></category></entry><entry><title>Per-project configuration for vim</title><link href="https://politreco.com/2019/04/per-project-configuration-for-vim/" rel="alternate"></link><published>2019-04-03T21:57:00-07:00</published><updated>2019-04-03T21:57:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2019-04-03:/2019/04/per-project-configuration-for-vim/</id><summary type="html">&lt;p&gt;For a long time I have accumulated different configurations for vim for the
different open source projects I&amp;#8217;m contributing or have contributed in the past.
It became a giant unmaintained file for ftplugin/ftdetect with regexes to match
the dir name and try to apply every important thing a project needs: from coding
style to commands to build the source&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;After changing my machine and re-installing several softwares, I&amp;#8217;m trying to keep
my dotfiles more organized. For vim, after looking at some options available I
settled in this one, that I think is very short and&amp;nbsp;elegant …&lt;/p&gt;</summary><content type="html">&lt;p&gt;For a long time I have accumulated different configurations for vim for the
different open source projects I&amp;#8217;m contributing or have contributed in the past.
It became a giant unmaintained file for ftplugin/ftdetect with regexes to match
the dir name and try to apply every important thing a project needs: from coding
style to commands to build the source&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;After changing my machine and re-installing several softwares, I&amp;#8217;m trying to keep
my dotfiles more organized. For vim, after looking at some options available I
settled in this one, that I think is very short and&amp;nbsp;elegant:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;quot; Git specific configuration&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; git_path &lt;span class="p"&gt;=&lt;/span&gt; system&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;git rev-parse --git-dir 2&amp;gt;/dev/null&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; git_vimrc &lt;span class="p"&gt;=&lt;/span&gt; substitute&lt;span class="p"&gt;(&lt;/span&gt;git_path&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;\n&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; . &lt;span class="s2"&gt;&amp;quot;/vimrc&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;empty&lt;span class="p"&gt;(&lt;/span&gt;glob&lt;span class="p"&gt;(&lt;/span&gt;git_vimrc&lt;span class="p"&gt;))&lt;/span&gt;
    exec &lt;span class="s2"&gt;&amp;quot;:source &amp;quot;&lt;/span&gt; . git_vimrc
&lt;span class="k"&gt;endif&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Unfortunately I don&amp;#8217;t remember where this came from. But it allows you to have
an additional vimrc to be loaded depending on the project you are.  Since
nowadays 99% of the projects I have are using git, it tries to load the vimrc
from the git-dir of that project, which is&amp;nbsp;often &lt;code&gt;.git/vimrc&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I also have&amp;nbsp;a &lt;code&gt;~/.vim/repo_vimrcs/&lt;/code&gt; in which I keep the configuration files for
projects I may have more than one tree or checkout. Inside each of those trees
I only need to have a symlink to point to the &amp;#8220;one source of truth&amp;#8221; for
configuring that&amp;nbsp;project:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;.git/vimrc&lt;span class="w"&gt; &lt;/span&gt;-&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;~/.vim/repo_vimrcs/linux.vimrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this file I can keep the coding style and also&amp;nbsp;configure &lt;code&gt;makeprg&lt;/code&gt; to do the
right thing when trying to build that project. For example, this is what I have
for igt, that uses meson as build&amp;nbsp;system:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &amp;amp;&lt;span class="nb"&gt;makeprg&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ninja -C build&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="Uncategorized"></category><category term="git"></category><category term="vim"></category></entry><entry><title>git helper for “recursive rebase”</title><link href="https://politreco.com/2019/03/git-helper-for-recursive-rebase/" rel="alternate"></link><published>2019-03-26T10:57:00-07:00</published><updated>2019-03-26T10:57:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2019-03-26:/2019/03/git-helper-for-recursive-rebase/</id><summary type="html">&lt;p&gt;Very often I&amp;#8217;m in the middle of an interactive rebase and while editing a
commit I remember I should have changed a commit that I initially didn&amp;#8217;t mark
on the rebase todo. If you tried&amp;nbsp;to &lt;code&gt;git-rebase&lt;/code&gt; again you would notice it&amp;#8217;s
not possible due to git&amp;#8217;s bookkeeping of the current&amp;nbsp;rebase.&lt;/p&gt;
&lt;p&gt;In the past what I usually did was to either 1) Continue the rebase and then
rebase again to fix the previous commit or 2) Create a fixup commit&amp;nbsp;with
&lt;code&gt;git commit --fixup&lt;/code&gt; and then rebase again&amp;nbsp;with &lt;code&gt;--auto-squash&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now I have a helper …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Very often I&amp;#8217;m in the middle of an interactive rebase and while editing a
commit I remember I should have changed a commit that I initially didn&amp;#8217;t mark
on the rebase todo. If you tried&amp;nbsp;to &lt;code&gt;git-rebase&lt;/code&gt; again you would notice it&amp;#8217;s
not possible due to git&amp;#8217;s bookkeeping of the current&amp;nbsp;rebase.&lt;/p&gt;
&lt;p&gt;In the past what I usually did was to either 1) Continue the rebase and then
rebase again to fix the previous commit or 2) Create a fixup commit&amp;nbsp;with
&lt;code&gt;git commit --fixup&lt;/code&gt; and then rebase again&amp;nbsp;with &lt;code&gt;--auto-squash&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now I have a helper that I&amp;#8217;m calling &amp;#8220;recursive rebase&amp;#8221;. Under the hood it&amp;#8217;s
not actually a recursive rebase, but just a way to edit the git-rebase&amp;#8217;s todo
file so you can rewind it. See it here:
&lt;a href="https://github.com/lucasdemarchi/toolbox/blob/master/git-recursive-rebase"&gt;git-recursive-rebase&lt;/a&gt;.
So let&amp;#8217;s assume our git log looks like&amp;nbsp;below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;aa7a42b&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;HEAD&lt;span class="w"&gt; &lt;/span&gt;-&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;tip&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;cast-terminal:&lt;span class="w"&gt; &lt;/span&gt;wrap&lt;span class="w"&gt; &lt;/span&gt;asciinema&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;asciinema-player
0c75f7a&lt;span class="w"&gt; &lt;/span&gt;Add&lt;span class="w"&gt; &lt;/span&gt;recursive-rebase&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;poor&lt;span class="w"&gt; &lt;/span&gt;souls&lt;span class="w"&gt; &lt;/span&gt;depending&lt;span class="w"&gt; &lt;/span&gt;heavily&lt;span class="w"&gt; &lt;/span&gt;on&lt;span class="w"&gt; &lt;/span&gt;git-rebase-i
6e70b2c&lt;span class="w"&gt; &lt;/span&gt;mkosi-resize:&lt;span class="w"&gt; &lt;/span&gt;rework&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;fix&lt;span class="w"&gt; &lt;/span&gt;partition&lt;span class="w"&gt; &lt;/span&gt;table&lt;span class="w"&gt; &lt;/span&gt;recreation
60658c8&lt;span class="w"&gt; &lt;/span&gt;custom-kernel-install:&lt;span class="w"&gt; &lt;/span&gt;also&lt;span class="w"&gt; &lt;/span&gt;support&lt;span class="w"&gt; &lt;/span&gt;installkernel
615eb02&lt;span class="w"&gt; &lt;/span&gt;custom-kernel-gen:&lt;span class="w"&gt; &lt;/span&gt;also&lt;span class="w"&gt; &lt;/span&gt;copy&lt;span class="w"&gt; &lt;/span&gt;System.map
e683b4c&lt;span class="w"&gt; &lt;/span&gt;git-rebase-compile:&lt;span class="w"&gt; &lt;/span&gt;log&lt;span class="w"&gt; &lt;/span&gt;commits&lt;span class="w"&gt; &lt;/span&gt;being&lt;span class="w"&gt; &lt;/span&gt;tested
f60f71c&lt;span class="w"&gt; &lt;/span&gt;Allow&lt;span class="w"&gt; &lt;/span&gt;removal&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;symlinks&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;fail
67c76ee&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;master&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Fix&lt;span class="w"&gt; &lt;/span&gt;missing&lt;span class="w"&gt; &lt;/span&gt;char&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;root&lt;span class="w"&gt; &lt;/span&gt;partition&lt;span class="w"&gt; &lt;/span&gt;uuid
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I start the interactive rebase&amp;nbsp;on &lt;code&gt;60658c8&lt;/code&gt; with &lt;code&gt;git rebase -i 60658c8^&lt;/code&gt; and mark to edit
that&amp;nbsp;commit.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;e&lt;span class="w"&gt; &lt;/span&gt;60658c8&lt;span class="w"&gt; &lt;/span&gt;custom-kernel-install:&lt;span class="w"&gt; &lt;/span&gt;also&lt;span class="w"&gt; &lt;/span&gt;support&lt;span class="w"&gt; &lt;/span&gt;installkernel
pick&lt;span class="w"&gt; &lt;/span&gt;6e70b2c&lt;span class="w"&gt; &lt;/span&gt;mkosi-resize:&lt;span class="w"&gt; &lt;/span&gt;rework&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;fix&lt;span class="w"&gt; &lt;/span&gt;partition&lt;span class="w"&gt; &lt;/span&gt;table&lt;span class="w"&gt; &lt;/span&gt;recreation
pick&lt;span class="w"&gt; &lt;/span&gt;0c75f7a&lt;span class="w"&gt; &lt;/span&gt;Add&lt;span class="w"&gt; &lt;/span&gt;recursive-rebase&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;poor&lt;span class="w"&gt; &lt;/span&gt;souls&lt;span class="w"&gt; &lt;/span&gt;depending&lt;span class="w"&gt; &lt;/span&gt;heavily&lt;span class="w"&gt; &lt;/span&gt;on&lt;span class="w"&gt; &lt;/span&gt;git-rebase-i
pick&lt;span class="w"&gt; &lt;/span&gt;aa7a42b&lt;span class="w"&gt; &lt;/span&gt;cast-terminal:&lt;span class="w"&gt; &lt;/span&gt;wrap&lt;span class="w"&gt; &lt;/span&gt;asciinema&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;asciinema-player
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;While editing I realize I also want to fixup 2 commits before that. I can do
that by&amp;nbsp;using &lt;code&gt;git recursive-rebase HEAD~2&lt;/code&gt; (I actually usually give the commit
id by looking at git-log/tig. The new todo file looks like&amp;nbsp;below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;recursive-rebase&lt;span class="w"&gt; &lt;/span&gt;HEAD~2
...
HEAD&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;now&lt;span class="w"&gt; &lt;/span&gt;at&lt;span class="w"&gt; &lt;/span&gt;e683b4c&lt;span class="w"&gt; &lt;/span&gt;git-rebase-compile:&lt;span class="w"&gt; &lt;/span&gt;log&lt;span class="w"&gt; &lt;/span&gt;commits&lt;span class="w"&gt; &lt;/span&gt;being&lt;span class="w"&gt; &lt;/span&gt;tested

$&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;rebase&lt;span class="w"&gt; &lt;/span&gt;--edit-todo
pick&lt;span class="w"&gt; &lt;/span&gt;615eb02&lt;span class="w"&gt; &lt;/span&gt;custom-kernel-gen:&lt;span class="w"&gt; &lt;/span&gt;also&lt;span class="w"&gt; &lt;/span&gt;copy&lt;span class="w"&gt; &lt;/span&gt;System.map
pick&lt;span class="w"&gt; &lt;/span&gt;60658c8&lt;span class="w"&gt; &lt;/span&gt;custom-kernel-install:&lt;span class="w"&gt; &lt;/span&gt;also&lt;span class="w"&gt; &lt;/span&gt;support&lt;span class="w"&gt; &lt;/span&gt;installkernel
&lt;span class="nb"&gt;exec&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;recursive-rebase previously stopped here&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;
pick&lt;span class="w"&gt; &lt;/span&gt;6e70b2c&lt;span class="w"&gt; &lt;/span&gt;mkosi-resize:&lt;span class="w"&gt; &lt;/span&gt;rework&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;fix&lt;span class="w"&gt; &lt;/span&gt;partition&lt;span class="w"&gt; &lt;/span&gt;table&lt;span class="w"&gt; &lt;/span&gt;recreation
pick&lt;span class="w"&gt; &lt;/span&gt;0c75f7a&lt;span class="w"&gt; &lt;/span&gt;Add&lt;span class="w"&gt; &lt;/span&gt;recursive-rebase&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;poor&lt;span class="w"&gt; &lt;/span&gt;souls&lt;span class="w"&gt; &lt;/span&gt;depending&lt;span class="w"&gt; &lt;/span&gt;heavily&lt;span class="w"&gt; &lt;/span&gt;on&lt;span class="w"&gt; &lt;/span&gt;git-rebase-i
pick&lt;span class="w"&gt; &lt;/span&gt;aa7a42b&lt;span class="w"&gt; &lt;/span&gt;cast-terminal:&lt;span class="w"&gt; &lt;/span&gt;wrap&lt;span class="w"&gt; &lt;/span&gt;asciinema&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;asciinema-player
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Just to help people keep the context on where they are in the rebase we add a
line saying that it was previously there and stop the rebase. The&amp;nbsp;command
&lt;code&gt;break&lt;/code&gt; was recently added to git (v2.20), but changing that&amp;nbsp;to &lt;code&gt;x false&lt;/code&gt;
should make it work on previous versions as well.  Bellow a asciinema recording
of my terminal&amp;nbsp;session:&lt;/p&gt;
&lt;p&gt;&lt;asciinema-player src="/casts/git-recursive-rebase.cast" speed="2" idle-time-limit="1"&gt;&lt;/asciinema-player&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="git"></category></entry><entry><title>“Throw away” linux images in seconds</title><link href="https://politreco.com/2015/08/throw-away-linux-images-in-seconds/" rel="alternate"></link><published>2015-08-10T12:44:00-07:00</published><updated>2015-08-10T12:44:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2015-08-10:/2015/08/throw-away-linux-images-in-seconds/</id><summary type="html">&lt;p&gt;Generating a new rootfs from scratch in order to test changes to early
parts of the software stack or just to have a pristine environment is
something I needed several times in the&amp;nbsp;past.&lt;/p&gt;
&lt;p&gt;Since I use Archlinux in my desktop something that I like is to have a
similar environment in the target test rootfs. I decided to re-use and
improve a script from Kay Sievers to create an installer that can be
booted as a &lt;span class="caps"&gt;VM&lt;/span&gt;, as a container or in bare metal:
&lt;a href="https://github.com/lucasdemarchi/toolbox/blob/master/arch-installer.sh"&gt;arch-installer.sh&lt;/a&gt;.
Originally  it was a script to bootstrap a Fedora image and I think …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Generating a new rootfs from scratch in order to test changes to early
parts of the software stack or just to have a pristine environment is
something I needed several times in the&amp;nbsp;past.&lt;/p&gt;
&lt;p&gt;Since I use Archlinux in my desktop something that I like is to have a
similar environment in the target test rootfs. I decided to re-use and
improve a script from Kay Sievers to create an installer that can be
booted as a &lt;span class="caps"&gt;VM&lt;/span&gt;, as a container or in bare metal:
&lt;a href="https://github.com/lucasdemarchi/toolbox/blob/master/arch-installer.sh"&gt;arch-installer.sh&lt;/a&gt;.
Originally  it was a script to bootstrap a Fedora image and I think that
with some small changes that would still be&amp;nbsp;possible.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;arch-installer.sh&lt;span class="w"&gt; &lt;/span&gt;-l&lt;span class="w"&gt; &lt;/span&gt;~/vm/test.img
...
real&lt;span class="w"&gt; &lt;/span&gt;0m31.238s
user&lt;span class="w"&gt; &lt;/span&gt;0m22.277s
sys&lt;span class="w"&gt; &lt;/span&gt;0m2.473s
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;30 seconds later I have a complete pristine image that can be used as a
&lt;span class="caps"&gt;VM&lt;/span&gt; with qemu, as a container with systemd-nspawn or just copied to a
pendrive/sdcard to boot for example a Minnow Board&amp;nbsp;Max.&lt;/p&gt;
&lt;p&gt;Container:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;systemd-nspawn&lt;span class="w"&gt; &lt;/span&gt;-b&lt;span class="w"&gt; &lt;/span&gt;-i&lt;span class="w"&gt; &lt;/span&gt;~/vm/test.img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;span class="caps"&gt;VM&lt;/span&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo kvm-that ~/vm/test.img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Note: &amp;#8216;kvm-that&amp;#8217; is also a script available in the same repository so I
don&amp;#8217;t have to type all the options to&amp;nbsp;qemu.&lt;/p&gt;
&lt;p&gt;In order to boot another computer or a board like Minnow Board Max just
dd the image to a usb disk or sdcard. You can also generate the image
directly to the final&amp;nbsp;destination:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo arch-installer.sh -l /dev/mmcblk0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The script has also some nice options to make it easy to customize the
final image.  One thing that I&amp;#8217;m often doing is giving an overlay
directory with configuration files for wpa_supplicant. This way I can
already access my WiFi networks in the target&amp;nbsp;image.&lt;/p&gt;
&lt;p&gt;If you always need certain packages you can use the  example
&lt;a href="https://github.com/lucasdemarchi/toolbox/blob/master/arch-installer-hooks/debug-tools"&gt;debug-tools&lt;/a&gt;
hook that is executed before the image is finalized. By mixing hooks
like that and the overlay directory mentioned above it&amp;#8217;s possible to add
your local repository to pacman.conf and install packages not available
in Archlinux. Or packages that you&amp;#8217;d like to maintain on your own. In my
use cases with Minnow Board Max I maintain my own kernel with
configurations suited to run ardupilot on&amp;nbsp;it.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Archlinux"></category><category term="Linux"></category><category term="systemd"></category></entry><entry><title>Taking maintainership of dolt</title><link href="https://politreco.com/2015/03/taking-maintainership-of-dolt/" rel="alternate"></link><published>2015-03-09T19:27:00-07:00</published><updated>2015-03-09T19:27:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2015-03-09:/2015/03/taking-maintainership-of-dolt/</id><summary type="html">&lt;p&gt;For those who don&amp;#8217;t know, &lt;a href="http://dolt.freedesktop.org/"&gt;dolt&lt;/a&gt; is a
wrapper and replacement for libtool on sane systems that don&amp;#8217;t need it
at all. It was created some years ago by Josh Triplett to overcome the
slowness of&amp;nbsp;libtool.&lt;/p&gt;
&lt;p&gt;Nowadays libtool should be much faster so the necessity for dolt should
not be as big anymore. However as can be seen
&lt;a href="https://harald.hoyer.xyz/2015/03/05/libtool-getting-rid-of-180000-sed-forks/"&gt;here&lt;/a&gt;,
it&amp;#8217;s not true (at least in libtool &amp;gt; 2.4.2). Yeah, this seems a bug
in libtool that should be fixed. However I don&amp;#8217;t like it being any more
complicated than it&amp;nbsp;should.&lt;/p&gt;
&lt;p&gt;After talking to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;For those who don&amp;#8217;t know, &lt;a href="http://dolt.freedesktop.org/"&gt;dolt&lt;/a&gt; is a
wrapper and replacement for libtool on sane systems that don&amp;#8217;t need it
at all. It was created some years ago by Josh Triplett to overcome the
slowness of&amp;nbsp;libtool.&lt;/p&gt;
&lt;p&gt;Nowadays libtool should be much faster so the necessity for dolt should
not be as big anymore. However as can be seen
&lt;a href="https://harald.hoyer.xyz/2015/03/05/libtool-getting-rid-of-180000-sed-forks/"&gt;here&lt;/a&gt;,
it&amp;#8217;s not true (at least in libtool &amp;gt; 2.4.2). Yeah, this seems a bug
in libtool that should be fixed. However I don&amp;#8217;t like it being any more
complicated than it&amp;nbsp;should.&lt;/p&gt;
&lt;p&gt;After talking to Josh and to Luca Barbato (who maintains an &lt;a href="https://github.com/lu-zero/dolt"&gt;updated
version in github&lt;/a&gt;) it seemed a good
idea to revive dolt on its original repository. Since this file is
supposed to be integrated in each project&amp;#8217;s m4 directory, there are
several copies out there with different improvements. Now the &lt;a href="http://cgit.freedesktop.org/dolt/"&gt;upstream
repository&lt;/a&gt; has an updated version
that should work for any project &amp;#8212; feel free to copy it to your
repository, synchronizing with upstream. I don&amp;#8217;t really expect much
maintenance. Credit where it&amp;#8217;s due: most of the missing commits came
from the version maintained by&amp;nbsp;Luca.&lt;/p&gt;
&lt;p&gt;So, if you want to integrate it in your repository using autotools, it&amp;#8217;s
pretty simple, feel free to follow the &lt;span class="caps"&gt;README&lt;/span&gt;.md&amp;nbsp;file.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Hacking the Intel fan, for fun</title><link href="https://politreco.com/2013/10/hacking-the-intel-fan-for-fun/" rel="alternate"></link><published>2013-10-01T17:43:00-07:00</published><updated>2013-10-01T17:43:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2013-10-01:/2013/10/hacking-the-intel-fan-for-fun/</id><summary type="html">&lt;p&gt;An alternative headline is: &amp;#8220;how to show your wife how much you love
her, the geek&amp;nbsp;way&amp;#8221;.&lt;/p&gt;
&lt;iframe src="//www.youtube.com/embed/S9SygA-SQ8Y" height="315" width="420" allowfullscreen frameborder="0"&gt;&lt;/iframe&gt;

&lt;p&gt;From 17 to 22 of September I was in New Orleans participating in the
discussions of the Linux Plumbers Conference, which has already turned
into one of my favorite conferences. Lots of fun, talking to great
people and good discussions about systemd, containers, cgroups, kernel
modules, etc. However as the headline indicates this blog post is not to
talk about the conference but rather about a toy the Intel booth was
giving out: a fan with 7 leds in its propeller. See&amp;nbsp;below …&lt;/p&gt;</summary><content type="html">&lt;p&gt;An alternative headline is: &amp;#8220;how to show your wife how much you love
her, the geek&amp;nbsp;way&amp;#8221;.&lt;/p&gt;
&lt;iframe src="//www.youtube.com/embed/S9SygA-SQ8Y" height="315" width="420" allowfullscreen frameborder="0"&gt;&lt;/iframe&gt;

&lt;p&gt;From 17 to 22 of September I was in New Orleans participating in the
discussions of the Linux Plumbers Conference, which has already turned
into one of my favorite conferences. Lots of fun, talking to great
people and good discussions about systemd, containers, cgroups, kernel
modules, etc. However as the headline indicates this blog post is not to
talk about the conference but rather about a toy the Intel booth was
giving out: a fan with 7 leds in its propeller. See&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan.jpg"&gt;&lt;img alt="intel_otc_fan" src="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan.jpg" title="Fan distributed to attended during LPC" /&gt;&lt;/a&gt;
Fan distributed to attended during &lt;span class="caps"&gt;LPC&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When turned on it shows a text message: &amp;#8220;We&amp;#8217;re hiring!&amp;#8221;, &amp;#8220;01.org/jobs&amp;#8221;.
So, if you are looking for a job and want to come to work with me, you
already know where to apply ;-). The fun part is that in its box it&amp;#8217;s
written &amp;#8220;programmable message fan&amp;#8221;. The guys from the booth told me that
the first question people were asking was how to change the message
appearing there, but they had no idea. This post is to show how I did&amp;nbsp;that.&lt;/p&gt;
&lt;p&gt;Some days after arriving in Brazil I saw a post from Steven Rostedt on
G+ regarding this fan and a blog post he
found: &lt;a href="http://hackingwithgum.com/2009/10/06/hacking-the-cenzic-pov-fan/"&gt;http://hackingwithgum.com/2009/10/06/hacking-the-cenzic-pov-fan/&lt;/a&gt;.
Disassembling our fan showed that it&amp;#8217;s a little bit different than that
one, changing the &lt;span class="caps"&gt;EEPROM&lt;/span&gt; and with 1 extra&amp;nbsp;pin.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan_disassembly.jpg"&gt;&lt;img alt="Disassembling the
fan" src="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan_disassembly.jpg" /&gt;&lt;/a&gt;
Disassembling the&amp;nbsp;fan&lt;/p&gt;
&lt;p&gt;However looking carefully at the board we can see it&amp;#8217;s pretty similar:
It&amp;#8217;s a &lt;span class="caps"&gt;T24C04A&lt;/span&gt; &lt;span class="caps"&gt;EEPROM&lt;/span&gt; that is programmable via &lt;span class="caps"&gt;I2C&lt;/span&gt;. I&amp;#8217;m not sure if the
extra pin is the the write-protect feature that is present in this
&lt;span class="caps"&gt;EEPROM&lt;/span&gt; or if it&amp;#8217;s to select the address (in which case we would just
have another address on our side). Hence we are safe connecting it to
ground. From &lt;span class="caps"&gt;T24C04A&lt;/span&gt;&amp;#8217;s datasheet we figure it can work in the range 1.8V
to 5.5V. So, instead of using a serial connector like in the other blog
post, we can use any development board that has an &lt;span class="caps"&gt;I2C&lt;/span&gt; bus available for
us to play with it, particularly BeagleBone Black that has a 3.3V &lt;span class="caps"&gt;I2C&lt;/span&gt;
bus, which I&amp;#8217;m using here. From the picture below you can notice that
&lt;strong&gt;a)&lt;/strong&gt; I didn&amp;#8217;t have many &lt;span class="caps"&gt;HW&lt;/span&gt; components available and &lt;strong&gt;b)&lt;/strong&gt; my drawing
skills are horrible. I just did a quick hack to get it to work, i.e.:
connect &lt;span class="caps"&gt;GND&lt;/span&gt;, &lt;span class="caps"&gt;VCC&lt;/span&gt; and the pull-up resistors (since in &lt;span class="caps"&gt;I2C&lt;/span&gt; the bus is high
when nobody is transmitting) [ See &lt;span class="caps"&gt;UPDATE&lt;/span&gt; 2&amp;nbsp;].&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan_wire_beagle.jpg"&gt;&lt;img alt="Wiring the fan to
beaglebone" src="https://politreco.com/wp-content/uploads/2013/10/intel_otc_fan_wire_beagle.jpg" /&gt;&lt;/a&gt;
Wiring the fan to&amp;nbsp;beaglebone&lt;/p&gt;
&lt;p&gt;For reading from and writing to the &lt;span class="caps"&gt;EEPROM&lt;/span&gt; I&amp;#8217;m using i2cdump and i2cset
respectively. And i2cdetect to show me where the device was plugged and
its address. Beware that in beaglebone the devices in /dev don&amp;#8217;t match
the ones in the &lt;span class="caps"&gt;HW&lt;/span&gt; schematics (thanks Koen for pointing out this to&amp;nbsp;me).&lt;/p&gt;
&lt;p&gt;Now the software part. Like in the other fan we have a column of 7 leds
and each letter is &amp;#8220;rendered&amp;#8221; using 5 rows. However the way the strings
are written is different. I tried to use the python script that was
provided, but after some tests I figured I&amp;#8217;d need to do some
modifications. Below is how the strings are stored in our fan&amp;#8217;s &lt;span class="caps"&gt;EEPROM&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/10/fan_eeprom_storage.png"&gt;&lt;img alt="fan_eeprom_storage" src="https://politreco.com/wp-content/uploads/2013/10/fan_eeprom_storage.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First byte is the number of strings present in the &lt;span class="caps"&gt;EEPROM&lt;/span&gt;. Each string
then has as its first byte the string length. Then we have 5 bytes for
each char, in reverse order. They encode the state of the LEDs in each
column: 0 means &lt;span class="caps"&gt;ON&lt;/span&gt; and 1 is &lt;span class="caps"&gt;OFF&lt;/span&gt;. After some try and errors we realize
that not only the string is reversed, but also the columns. So the first
byte in the character encodes the right-most column. In the end we have
a 7x5 matrix for each char. I started to draw all chars and change the
python script to use them, ~~but I got lazy and just finished the
letters I was interested in~~ (see &lt;span class="caps"&gt;UPDATE&lt;/span&gt; 1). The final result is the
video shown above that says &amp;#8220;Talita, I love you&amp;#8221;, in Portuguese&amp;nbsp;:-).&lt;/p&gt;
&lt;p&gt;I used the following commands to dump the &lt;span class="caps"&gt;EEPROM&lt;/span&gt;, encode the text and
write to&amp;nbsp;it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;# dump what&amp;#39;s in address 0x50 on bus 1 (use i2cdetect to find out the bus and address of your device)&lt;/span&gt;
root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;i2cdump&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;0x50
root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;# encode the message given as args&lt;/span&gt;
root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;/tmp/ascii2fan&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;string1&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;string 2 with space&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;string 3&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;~/message.bin
root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;# write the content of ~/message.bin into the EEPROM&lt;/span&gt;
root@beaglebone:~#&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;od&lt;span class="w"&gt; &lt;/span&gt;-An&lt;span class="w"&gt; &lt;/span&gt;-t&lt;span class="w"&gt; &lt;/span&gt;x1&lt;span class="w"&gt; &lt;/span&gt;~/message.bin&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;read&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;line&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;
&lt;span class="w"&gt;                  &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;c&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;
&lt;span class="w"&gt;                      &lt;/span&gt;&lt;span class="nv"&gt;cmd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;i2cset -y 1 0x50 0x%x 0x&lt;/span&gt;&lt;span class="nv"&gt;$c&lt;/span&gt;&lt;span class="s2"&gt; b&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$cmd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;((&lt;/span&gt;i++&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                   &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;               &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can download my modified
&lt;a href="https://politreco.com/wp-content/uploads/ascii2fan" title="ascii2fan"&gt;ascii2fan&lt;/a&gt;.
I was using it on /tmp and lost it after power cycling, so I needed to
change the file again and I didn&amp;#8217;t confirm it&amp;#8217;s still working. It&amp;#8217;s
almost the same as the one provided in hackingwithgum.com, it&amp;#8217;s just the
table that really&amp;nbsp;changes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;UPDATES&lt;/span&gt;&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I uploaded a new version of ascii2fan, containing all the&amp;nbsp;letters.&lt;/li&gt;
&lt;li&gt;As Matt Ranostay pointed out, the beaglebone black has already an
    internal pullup resistor, so this is not really&amp;nbsp;necessary.&lt;/li&gt;
&lt;/ol&gt;</content><category term="Uncategorized"></category><category term="Beaglebone"></category><category term="Linux"></category><category term="Linux Plumbers Conference"></category></entry><entry><title>Optimizing hash table with kmod as testbed</title><link href="https://politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/" rel="alternate"></link><published>2013-09-25T07:32:00-07:00</published><updated>2013-09-25T07:32:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2013-09-25:/2013/09/optimizing-hash-table-with-kmod-as-testbed/</id><summary type="html">&lt;p&gt;One thing that caught my interest lately was the implementation of hash
tables, particularly the algorithms we are currently using for
calculating the hash value. In kmod we use Paul Hsieh&amp;#8217;s hash function,
self entitled superfast hash. I fell troubled with anything that
entitles itself as super fast, especially given the &lt;a href="http://www.azillionmonkeys.com/qed/hash.html"&gt;benchmarks
provided&lt;/a&gt; are from some
years ago, with older&amp;nbsp;CPUs.&lt;/p&gt;
&lt;p&gt;After some time spent on benchmarking and researching I realized there
were much more things to look after than just the hash function. With
this post I try to summarize my findings, showing some numbers. However
do take …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One thing that caught my interest lately was the implementation of hash
tables, particularly the algorithms we are currently using for
calculating the hash value. In kmod we use Paul Hsieh&amp;#8217;s hash function,
self entitled superfast hash. I fell troubled with anything that
entitles itself as super fast, especially given the &lt;a href="http://www.azillionmonkeys.com/qed/hash.html"&gt;benchmarks
provided&lt;/a&gt; are from some
years ago, with older&amp;nbsp;CPUs.&lt;/p&gt;
&lt;p&gt;After some time spent on benchmarking and researching I realized there
were much more things to look after than just the hash function. With
this post I try to summarize my findings, showing some numbers. However
do take them with a grain of&amp;nbsp;salt.&lt;/p&gt;
&lt;p&gt;The hash functions I&amp;#8217;m using here for comparisons are: &lt;span class="caps"&gt;DJB&lt;/span&gt;, Murmur32,
Paul Hsiesh and CRC32c (using the crc32c instruction present in &lt;span class="caps"&gt;SSE4&lt;/span&gt;.2).
My goal is to benchmark hash functions when strings are used as key
(though some of the algorithms above can be adpated for blobs). Also the
use of these hash tables are only for fast lookups,
so any cryptography-safe property of the functions or lack thereof is
irrelevant here. For all the benchmarks I&amp;#8217;m using depmod&amp;#8217;s hash tables.
There are 3 hash&amp;nbsp;tables:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;module
    names: keys are very small, 2 to 20&amp;nbsp;chars&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;symbol
    names: keys are mid-range, 10 to 40&amp;nbsp;chars&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;module path
    names: keys are the largest: 10 to \~60&amp;nbsp;chars&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;On my benchmarks I identified the following items as important points to
look after&amp;nbsp;optmizations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Hash
    functions: how do they spread the items across the&amp;nbsp;table?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Time to
    find the&amp;nbsp;bucket&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Time to
    find the item inside the&amp;nbsp;bucket&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Hash
    functions: time to calculate the hash&amp;nbsp;value&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Whilst the first and the last ones depend on the algorithm chosen
for calculating the hash value, the second and third are more related to
the data structure used to accommodating the items and the size of the&amp;nbsp;table.&lt;/p&gt;
&lt;h2 id="hash-functions-how-do-they-spread-the-items-across-the-table"&gt;Hash functions: how do they spread the items across the&amp;nbsp;table?&lt;/h2&gt;
&lt;p&gt;It&amp;#8217;s useless to find a hash function that is as fast as it can be if it
doesn&amp;#8217;t cope with it&amp;#8217;s role: spreading the items across the tables.
Ideally each bucket would have the same number of items. This ideal is
what we call &lt;strong&gt;perfect hash&lt;/strong&gt;, something is possible only if we known &lt;em&gt;a
priori&lt;/em&gt; all the items and can be accomplished by tools like gperf. If we
are instead looking for a generic function that does its best on
spreading the items, we need a function like the ones mentioned
above: given any random string it calculates a 32 bits hash value used
to find the bucket in which the value we are interested in is located.
It&amp;#8217;s not only desirable that we are able to calculate the hash value
very fast, but also that this value can be in fact useful. A naive
person could say the function below is a super fast constant time hash&amp;nbsp;function.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;naive_hashval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;keylen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;However as one can note it isn&amp;#8217;t used anywhere because it fails the very
first goal of a hash function: to spread the items on the table. Before
starting the benchmarks I&amp;#8217;ve read in several places that the crc32c
instruction is like the function above (though not that bad) and
couldn&amp;#8217;t be used as a hash function for real. Using kmod as a test bed
this isn&amp;#8217;t what I would say. See the figures&amp;nbsp;below.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/09/paul.png"&gt;&lt;img alt="paul" src="https://politreco.com/wp-content/uploads/2013/09/paul.png" /&gt;&lt;/a&gt;   &lt;a href="https://politreco.com/wp-content/uploads/2013/09/djb.png"&gt;&lt;img alt="djb" src="https://politreco.com/wp-content/uploads/2013/09/djb.png" /&gt;&lt;/a&gt;   &lt;a href="https://politreco.com/wp-content/uploads/2013/09/murmur3.png"&gt;&lt;img alt="murmur3" src="https://politreco.com/wp-content/uploads/2013/09/murmur3.png" /&gt;&lt;/a&gt;   &lt;a href="https://politreco.com/wp-content/uploads/2013/09/crc32c.png"&gt;&lt;img alt="crc32c" src="https://politreco.com/wp-content/uploads/2013/09/crc32c.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;We used all 3 hash tables used in depmod, dumping all the items just
before destroying them. The graph shows how many items were in each
bucket. For all algorithms we have almost the same average and standard
deviation. So, which functions should we use for the next benchmarks?
The answer is clearly &lt;strong&gt;all of them&lt;/strong&gt; since they provide almost the same
results, being good&amp;nbsp;contenders.&lt;/p&gt;
&lt;h2 id="time-to-find-the-bucket"&gt;Time to find the&amp;nbsp;bucket&lt;/h2&gt;
&lt;p&gt;Once we calculated the hash value, it&amp;#8217;s used to find in which bucket the
item lies on. For starters, a bucket is nothing more than a row in the
table as depicted&amp;nbsp;below:&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;b0   it1 → it2 → it3
  b1   it4
  b2   it5 → it6 → it7 → it8
  b3   it9 → it10 →&amp;nbsp;it11&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The hash table above has size 4, which is also the number of buckets. So
we need to find a way to convert the (32-bit) hash value to a 3 bits.
The most common way used in hash table implementations is to just take
the value&amp;#8217;s&amp;nbsp;modulo:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashval&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashfunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;keylen&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashval&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The size above is set when the hash table is created (some hash table
implementations use a grow-able approach, which is not treated in this
post). The modulo above is usually implemented by taking the rest of a
division which uses a &lt;span class="caps"&gt;DIV&lt;/span&gt; instruction. Even if nowadays this instruction
is fast, we can optimize it away if we pay attention to the fact that
usually the hash table size is a power of 2. Since kmod&amp;#8217;s inception we
use size=512 for module names and paths; and size = 2048 for symbols. If
size is always a power of 2, we can use the code above to derive the
position, which will lead to the same result but much&amp;nbsp;faster.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashval&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashfunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;keylen&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hashval&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;span class="caps"&gt;DEC&lt;/span&gt; and &lt;span class="caps"&gt;AND&lt;/span&gt; instructions above are an order of magninute faster than
the &lt;span class="caps"&gt;DIV&lt;/span&gt; on today processors. However the compiler is not able to
optimize the &lt;span class="caps"&gt;DIV&lt;/span&gt; away and use &lt;span class="caps"&gt;DEC&lt;/span&gt; + &lt;span class="caps"&gt;AND&lt;/span&gt; since it can&amp;#8217;t ensure size is
power of 2. Using depmod as a test bed we have the following clock cycle
measurements for calculating the hash value + finding the bucket in the&amp;nbsp;table:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;keylen      before   after
2-10          79.0    61.9 (-21.65%)
11-17         81.0    64.4 (-20.48%)
18-25         90.0    73.2 (-18.69%)
26-32        104.7    87.0 (-16.82%)
33-40        108.4    89.6 (-17.37%)
41-48        111.2    91.9 (-17.38%)
49-55        120.1   102.1 (-15.04%)
56-63        134.4   115.7 (-13.91%)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As expected, the gain is constant regardless of the key length. The time
to calculate the hash value varies with the key length, which explains
the bigger gains for short keys. In kmod, to ensure the size is power of
2, we round it up in hash_init() to the next multiple with the
following&amp;nbsp;function:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;_always_inline_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;unsigned&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ALIGN_POWER2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;unsigned&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;__builtin_clz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There are other ways to calculate it, refer to &lt;a href="https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=3ba7f59e84857eb4dbe56a68fc7a3ffe8a650393"&gt;kmod&amp;#8217;s
commit&lt;/a&gt;
as to why this one is&amp;nbsp;used.&lt;/p&gt;
&lt;h2 id="time-to-find-the-item-inside-the-bucket"&gt;Time to find the item inside the&amp;nbsp;bucket&lt;/h2&gt;
&lt;p&gt;As noticed in the previous section we use a &lt;span class="caps"&gt;MOD&lt;/span&gt; operation (or a
variation thereof) to find the bucket in the table. When there are
collisions and&lt;br /&gt;
a bucket is storing more than 1 item, hash table implementations
usually resort to a linked list or an array to store the items. Then the
lookup ends up&amp;nbsp;being:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Calculate the hash&amp;nbsp;value&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Use the
    hash value to find the&amp;nbsp;bucket&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Iterate
    through the items in the bucket comparing the key in order to
    find the item we are interested&amp;nbsp;in.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="line-height: 1.714285714; font-size: 1rem;"&gt;Return the
    value&amp;nbsp;stored.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So often the item is a struct like&amp;nbsp;below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;hash_entry&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the struct above I&amp;#8217;m considering the key is a string, but it&amp;#8217;s also
possible to have other types as&amp;nbsp;key.&lt;/p&gt;
&lt;p&gt;So once we have the bucket, we need to go through each item and strcmp()
the key. In kmod since we use an array to store the items we have a
little better approach: the array is kept sorted and during lookup it&amp;#8217;s
possible to use bsearch(). However as one can imagine, keeping the array
sorted doesn&amp;#8217;t come for free. We are speeding up lookup with the
downside of slowing down&amp;nbsp;insertion.&lt;/p&gt;
&lt;p&gt;Thinking on this problem, the following came to mind: we use and
benchmark complicated functions that do their best to give a good 32
bits value and then with the modulo operation we use just throw away
most of it. What if we could continue using the value? If we don&amp;#8217;t mind
the extra memory used to store one more value in the struct hash_entry
above, we can. We store the hash value of each entry and then compare
them when searching inside the bucket. Since comparing uint32 is very
fast, there&amp;#8217;s no much point in keeping them sorted anymore and we can
just iterate very fast through all items in the bucket checking first if
the hash values match and only then strcmp() the key. With this we can
drastically reduce the amount of string comparisons we do in a
lookup-intensive path, the time to add and item (since it doesn&amp;#8217;t need
to be sorted anymore) and also the complexity of the code. The downside
is the memory usage, with one extra 32 bit value for each entry. The
table below shows the&amp;nbsp;results.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;keylen      before   after
2-10         222.8   127.7 (-42.68%)
11-17        231.2   139.1 (-39.85%)
18-25        273.8   181.3 (-33.78%)
26-32        328.7   236.2 (-28.13%)
33-40        366.0   306.1 (-16.34%)
41-48        354.0   341.7 (-3.48%)
49-55        385.1   390.5 (1.40%)
56-63        405.8   404.9 (-0.21%)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="hash-functions-time-to-calculate-the-hash-value"&gt;Hash functions: time to calculate the hash&amp;nbsp;value&lt;/h2&gt;
&lt;p&gt;This was my original intention: to benchmark several hash functions and
choose the best one based on data from real world, not random or
fabricated strings. My desire was also to profit as much as I could from
nowadays processors. So if there&amp;#8217;s a new instruction, let&amp;#8217;s use it for&amp;nbsp;good.&lt;/p&gt;
&lt;p&gt;Based on that I came to know the crc32c instruction in &lt;span class="caps"&gt;SSE4&lt;/span&gt;.2. By using
it we have a blazing fast way to calculate crc32, capable of a
throughput of around 1 char per clock cycle. I was also optimistic about
it when I checked that its distribution was as good as the
other contenders. The figure below shows the time to calculate the hash
value for&lt;br /&gt;
each of the&amp;nbsp;algorithms.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/09/plot.png"&gt;&lt;img alt="plot" src="https://politreco.com/wp-content/uploads/2013/09/plot.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As can be seen on the benchmark above, the winner is indeed crc32c. It&amp;#8217;s
much faster than the others. It&amp;#8217;s noteworthy the fact that it increases
much less than the other as the length goes&amp;nbsp;up.&lt;/p&gt;
&lt;p&gt;From the other contenders, &lt;span class="caps"&gt;DJB&lt;/span&gt; is the worst one reaching much higher
times. It&amp;#8217;s the simplest one to implement, but in my opinion the others
are small enough (though not that simple) to take its&amp;nbsp;place.&lt;/p&gt;
&lt;p&gt;How much does the hash function affect the hash table lookup time? By
lookup time I&amp;nbsp;mean:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/09/total_time.jpg"&gt;&lt;img alt="total_time" src="https://politreco.com/wp-content/uploads/2013/09/total_time.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The figure below answers this&amp;nbsp;question:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2013/09/plot1.png"&gt;&lt;img alt="plot" src="https://politreco.com/wp-content/uploads/2013/09/plot1.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can see from the figure above that the crc32 implementation is the
faster one. However, the gain is not as big as when we consider only the
time to calculate the hash value. This is because the other operations
take much&amp;nbsp;more.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Although the &lt;span class="caps"&gt;CRC32&lt;/span&gt; implementation is faster than its contenders and that
I was tempted to change to it in kmod, I&amp;#8217;m not really doing it. There
would be a significant gain only if the key was big enough. As noted
above, the time to calculate the hash value in &lt;span class="caps"&gt;CRC32&lt;/span&gt; grows much more
steadily than the others. If the keys were big enough, like 500 chars,
then it could be a change to make. It&amp;#8217;s important to note that if we
were to change to this hash function we would need to add an
implementation for architectures other than x86 as well as introduce the
boilerplate code to detect in runtime if there&amp;#8217;s support for the crc32c
instruction and use the generic implementation&amp;nbsp;otherwise.&lt;/p&gt;
&lt;p&gt;The other 2 optimizations, although not ground breaking are easy to make
and not intrusive. Nonetheless if people want to check the hash
functions in their workload I will make available the code and
benchmarks in a repository other than&amp;nbsp;kmod&amp;#8217;s.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kmod"></category><category term="Linux"></category></entry><entry><title>Speeding up build on autofoo projects</title><link href="https://politreco.com/2012/11/speeding-up-build-on-autofoo-projects/" rel="alternate"></link><published>2012-11-19T14:23:00-08:00</published><updated>2012-11-19T14:23:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-11-19:/2012/11/speeding-up-build-on-autofoo-projects/</id><summary type="html">&lt;p&gt;First of all, a little digression about build&amp;nbsp;systems.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to clarify that I&amp;#8217;m no lover of autotools. But I&amp;#8217;m no lover of
any other build system, neither, and autotools is used on several open
source projects, including most of the ones I participate. It&amp;#8217;s easily
copied and pasted by new projects. It&amp;#8217;s known by distro maintainers how
to hack on it to work on different scenarios like cross-compilation,
distribute build across machines, different compilers, rpath, etc etc.
Moreover, from my experience, project maintainers usually dislike
changing the build system because it causes several …&lt;/p&gt;</summary><content type="html">&lt;p&gt;First of all, a little digression about build&amp;nbsp;systems.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to clarify that I&amp;#8217;m no lover of autotools. But I&amp;#8217;m no lover of
any other build system, neither, and autotools is used on several open
source projects, including most of the ones I participate. It&amp;#8217;s easily
copied and pasted by new projects. It&amp;#8217;s known by distro maintainers how
to hack on it to work on different scenarios like cross-compilation,
distribute build across machines, different compilers, rpath, etc etc.
Moreover, from my experience, project maintainers usually dislike
changing the build system because it causes several headaches not
related to the &lt;em&gt;raison d&amp;#8217;être&lt;/em&gt; of the project. So in general I prefer to
modernize the build system rather than radically change it to another&amp;nbsp;one.&lt;/p&gt;
&lt;p&gt;Enlightenment window manager is &lt;a href="http://enlightenment.org/p.php?p=news/show&amp;amp;l=en&amp;amp;news_id=62"&gt;about to be
released&lt;/a&gt;
and I was really bored by the amount it was taking to compile. I use
icecream to spread the build across the machines on the local network,
so I usually do things like &amp;#8220;make -j40&amp;#8221;. No matter how many jobs I could
put there to parallelize the build it was still painfully slow,
particularly while compiling the modules. Taking a look in the
Makefile.am files, my suspicion was true: it was using recursive
makefiles and since each module has a few source files (circa 3 \~ 6),
the build was parallelized only among the files in the same directory.
This is because the build is serialized to build each directory. There
are plenty of links on the web about why projects should use
non-recursive automake. I will enlist&amp;nbsp;some:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.cse.iitb.ac.in/soumen/teach/cs699a1999/make.html"&gt;http://www.cse.iitb.ac.in/soumen/teach/cs699a1999/make.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html"&gt;http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mega-nerd.com/erikd/Blog/CodeHacking/nonrecursive_automake.html"&gt;http://www.mega-nerd.com/erikd/Blog/CodeHacking/nonrecursive_automake.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.eyrie.org/~eagle/notes/style/build.html"&gt;http://www.eyrie.org/~eagle/notes/style/build.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.murrayc.com/blog/permalink/2009/07/24/non-recursive-automake-is-the-best-alternative-to-automake/"&gt;http://www.murrayc.com/blog/permalink/2009/07/24/non-recursive-automake-is-the-best-alternative-to-automake/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://danielkitta.org/blog/2009/07/30/non-recursive-automake-performance/"&gt;http://danielkitta.org/blog/2009/07/30/non-recursive-automake-performance/&lt;/a&gt; 
    (this contains some performance&amp;nbsp;evaluation)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I decided to convert E17&amp;#8217;s automake files to non-recursive ones. At
least the modules part. After hours of repetitive tasks for converting
it, fixing bugs, building out-of-tree, in-tree, distcheck, etc, I
committed it and the build time was improved like&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;[table &lt;span class="caps"&gt;ID&lt;/span&gt;=1&amp;nbsp;/]&lt;/p&gt;
&lt;p&gt;So, after configuring it we can &lt;strong&gt;build E17 in roughly 1/4 of the
previous time&lt;/strong&gt;.  &lt;/p&gt;
&lt;p&gt;After the commit introducing the change there were several others to
improve it even more, prettify the output, fix some other bugs. It also
got reverted once due to causing problems to other developers, but in
the end it was applied back.  The worst bug I found was related to
&lt;em&gt;subdir-objects&lt;/em&gt; option to Automake and Gettext&amp;#8217;s Automake macros. That
option means that the objects built are kept in the same directory as
the correspondent source file. This is needed, particularly in a
non-recursive automake scenario, so the objects from different modules
don&amp;#8217;t conflict due to being put in the same directory.  However, letting
this option in configure.ac made &amp;#8220;make distcheck&amp;#8221; fail in some obscure
ways and I later tracked it down to be gettext&amp;#8217;s fault. A simple &amp;#8220;fix&amp;#8221;
was to remove it from configure.ac and set it in the &amp;#8220;AUTOMAKE_OPTIONS&amp;#8221;
variable of the modules&amp;#8217; Makefile.am. I really hope someone has the time
and will to fix gettext macros - they are a horrible mess and I don&amp;#8217;t
want to play with&amp;nbsp;them.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="EFL"></category><category term="enlightenment"></category><category term="profusion"></category></entry><entry><title>Analyzing chess.com tournaments</title><link href="https://politreco.com/2012/10/analyzing-chess-com-tournaments/" rel="alternate"></link><published>2012-10-16T19:54:00-07:00</published><updated>2012-10-16T19:54:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-10-16:/2012/10/analyzing-chess-com-tournaments/</id><summary type="html">&lt;p&gt;This year at ProFUSION we started to create chess tournaments to play
using chess.com so we have fun not only coding but playing this game.
However it&amp;#8217;s even more fun when we put both together: chess and code&amp;nbsp;:-)!&lt;/p&gt;
&lt;p&gt;During the second tournament we realized chess.com was missing a nice
feature: to allow participants to predict who would be the champion
based on the current championship status and future results. To show the
current state, Chess.com presents us with a table like&amp;nbsp;this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2012/10/pairings.jpg"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2012/10/pairings.jpg" title="pairings" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Not the missing games with a &amp;#8220;_&amp;#8221;. What we would like is to predict …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This year at ProFUSION we started to create chess tournaments to play
using chess.com so we have fun not only coding but playing this game.
However it&amp;#8217;s even more fun when we put both together: chess and code&amp;nbsp;:-)!&lt;/p&gt;
&lt;p&gt;During the second tournament we realized chess.com was missing a nice
feature: to allow participants to predict who would be the champion
based on the current championship status and future results. To show the
current state, Chess.com presents us with a table like&amp;nbsp;this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2012/10/pairings.jpg"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2012/10/pairings.jpg" title="pairings" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Not the missing games with a &amp;#8220;_&amp;#8221;. What we would like is to predict who
can still win the tournament based on these missing games. One trick
here is how to calculate the tie break, but it&amp;#8217;s really straightforward
to implement once we understand the&amp;nbsp;formula:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2012/10/formula.jpg"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2012/10/formula.jpg" title="formula" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, for each sum up the result of each game multiplied by the current
score of the opponent (&amp;#8220;opp&amp;#8221; in the formula above) the game was played&amp;nbsp;against.&lt;/p&gt;
&lt;p&gt;With that in mind I wrote a small tool, ccs, to allow you to predict the
next&amp;nbsp;results:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;./ccs.py&lt;span class="w"&gt; &lt;/span&gt;data/example2.html&lt;span class="w"&gt; &lt;/span&gt;
css&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;state
Number&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;players:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;

&lt;span class="w"&gt;                  &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;7&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;Score&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Tie&lt;span class="w"&gt; &lt;/span&gt;Break
-------------------------------------------------------------------------------------------------------
&lt;span class="m"&gt;1&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;demarchi&lt;span class="w"&gt;        &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;54&lt;/span&gt;
&lt;span class="m"&gt;2&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;ulissesf&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;52&lt;/span&gt;
&lt;span class="m"&gt;3&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;lfelipe&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;52&lt;/span&gt;
&lt;span class="m"&gt;4&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;hdante&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;38&lt;/span&gt;
&lt;span class="m"&gt;5&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;Gastal&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;34&lt;/span&gt;
&lt;span class="m"&gt;6&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;marinatwp&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;22&lt;/span&gt;
&lt;span class="m"&gt;7&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;yanwm&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="m"&gt;8&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;antognolli&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
ccs&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;push&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;1x5&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
Simulation&lt;span class="w"&gt; &lt;/span&gt;added:&lt;span class="w"&gt; &lt;/span&gt;demarchi&lt;span class="w"&gt; &lt;/span&gt;beats&lt;span class="w"&gt; &lt;/span&gt;Gastal
Number&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;players:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;

&lt;span class="w"&gt;                  &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;7&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;.&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;Score&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Tie&lt;span class="w"&gt; &lt;/span&gt;Break
-------------------------------------------------------------------------------------------------------
&lt;span class="m"&gt;1&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;demarchi&lt;span class="w"&gt;        &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;11&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;62&lt;/span&gt;
&lt;span class="m"&gt;2&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;lfelipe&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;53&lt;/span&gt;
&lt;span class="m"&gt;3&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;ulissesf&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;52&lt;/span&gt;
&lt;span class="m"&gt;4&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;hdante&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;39&lt;/span&gt;
&lt;span class="m"&gt;5&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;Gastal&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;35&lt;/span&gt;
&lt;span class="m"&gt;6&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;marinatwp&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="m"&gt;22&lt;/span&gt;
&lt;span class="m"&gt;7&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;yanwm&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="m"&gt;8&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;antognolli&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;X&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
ccs&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ccs parses the pairings table created by chess.com (given you saved it
somewhere and passed as argument to the tool) and then gives you a
&amp;#8220;ccs&amp;gt; &amp;#8221; prompt, waiting for commands. Type &amp;#8216;help&amp;#8217; to see the list of
available commands. Basically it allows you to &lt;strong&gt;a.&lt;/strong&gt; see the current
state of the game (&amp;#8216;state&amp;#8217; command) and &lt;strong&gt;b.&lt;/strong&gt; push and pop result
simulations (sigh! &amp;#8216;push&amp;#8217; and &amp;#8216;pop&amp;#8217;&amp;nbsp;commands).&lt;/p&gt;
&lt;p&gt;A nice feature that I&amp;#8217;d like to introduce soon is to export to a big svg
with all the state transitions, marking leaf nodes when there&amp;#8217;s a
champion. I&amp;#8217;m also releasing the source as open source, so anybody
wanting to help can implement it :-). Code is available on my github:
&lt;a href="https://github.com/lucasdemarchi/ccs"&gt;https://github.com/lucasdemarchi/ccs&lt;/a&gt;. &lt;span class="caps"&gt;GPL&lt;/span&gt;-2 as&amp;nbsp;usual.&lt;/p&gt;
&lt;p&gt;What can we predict in the example&amp;nbsp;above?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;No matter the pending games, gastal can not win anymore, since he
    will reach at most 54 as tie break, leaving lfelipe with 56. That
    also implies lfelipe would be the champion if gastal wins all his
    pending&amp;nbsp;games;&lt;/li&gt;
&lt;li&gt;If demarchi wins his last game he wins the tournament, with score=11
    and tie-break=62. If ulissesf also wins, he will have the same
    score, but his tie-break will be 60, pushing demarchi&amp;#8217;s tie-break
    to&amp;nbsp;64.&lt;/li&gt;
&lt;li&gt;If ulissesf wins and demarchi loses, ulissesf is the&amp;nbsp;champion.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Since I am demarchi on the table above, now what I have to do is either
win the last game or convince Gastal to give up his pending games&amp;nbsp;:-).&lt;/p&gt;</content><category term="Uncategorized"></category><category term="chess"></category><category term="profusion"></category><category term="programming"></category></entry><entry><title>Back from Linux Plumbers</title><link href="https://politreco.com/2012/09/back-from-linux-plumbers/" rel="alternate"></link><published>2012-09-03T18:29:00-07:00</published><updated>2012-09-03T18:29:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-09-03:/2012/09/back-from-linux-plumbers/</id><summary type="html">&lt;p&gt;I&amp;#8217;m back from &lt;span class="caps"&gt;USA&lt;/span&gt; after one week attending Linux Plumbers Conference.
This was my first time in &lt;span class="caps"&gt;LPC&lt;/span&gt;, in which I was part of the CoreOS,
talking about &amp;#8220;From libabc to libkmod: writing core&amp;nbsp;libraries&amp;#8221;.&lt;/p&gt;
&lt;p&gt;It was a very good experience and I&amp;#8217;m glad to meet so many developers,
both kernel and userspace hackers. Some of them I only knew from &lt;span class="caps"&gt;IRC&lt;/span&gt;,
mailing-lists, etc and it was great time to share our experiences,
discuss the current problems in Linux and even fix bugs :-). We seem
finally to have reached a consensus on how module signing should be done …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m back from &lt;span class="caps"&gt;USA&lt;/span&gt; after one week attending Linux Plumbers Conference.
This was my first time in &lt;span class="caps"&gt;LPC&lt;/span&gt;, in which I was part of the CoreOS,
talking about &amp;#8220;From libabc to libkmod: writing core&amp;nbsp;libraries&amp;#8221;.&lt;/p&gt;
&lt;p&gt;It was a very good experience and I&amp;#8217;m glad to meet so many developers,
both kernel and userspace hackers. Some of them I only knew from &lt;span class="caps"&gt;IRC&lt;/span&gt;,
mailing-lists, etc and it was great time to share our experiences,
discuss the current problems in Linux and even fix bugs :-). We seem
finally to have reached a consensus on how module signing should be done
- the outcome of Rusty Russel&amp;#8217;s talk is that he will now start applying
some pending patches. There will be no required changes to kmod, except
a cosmetic one in modinfo to show if a module is signed or&amp;nbsp;not.&lt;/p&gt;
&lt;p&gt;Rusty was also very helpful in fixing a long-standing bug in Linux
kernel: a call to init_module() returns that a module is already
loaded, even if it didn&amp;#8217;t finish it&amp;#8217;s initialization yet. This used to
be &amp;#8220;fixed&amp;#8221; in module-init-tools by a nasty hack adding a &amp;#8220;sleep(10000)&amp;#8221;
if the module state (checked on sysfs) is &amp;#8220;coming&amp;#8221;. I mean &amp;#8220;fixed&amp;#8221;
because this approach is still racy, even though the race window is much
shorter than without it. So we finally sat down and wrote a draft patch
to fix it. This will probably reach Linus tree in the next merge&amp;nbsp;window.&lt;/p&gt;
&lt;p&gt;The above example only seconds what Paul McKenney &lt;a href="http://paulmck.livejournal.com/33386.html"&gt;said on his blog
yesterday&lt;/a&gt;: &amp;#8220;A number of the
people I informally polled called out the hallway track as the most
valuable part of the conference, which I believe to be a very good thing
indeed!&amp;#8221; - I was one of the people he informally polled ;-). I&amp;#8217;d like to
thank all the Committee and people involved in organizing this
conference - it was a very great&amp;nbsp;experience.&lt;/p&gt;
&lt;p&gt;Finally, you can find my slides below (&lt;a href="https://docs.google.com/open?id=0B2EZFTQdeg3oQ0JvTHVEOHhnbXM"&gt;or download from Google
Docs&lt;/a&gt;). I
think soon the audio will be published. Meanwhile you may enjoy
Lennart&amp;#8217;s picture when he was a child in slide #5 (during the talk he
claimed it&amp;#8217;s not him, but I don&amp;#8217;t believe - they are too similar&amp;nbsp;:-)).  &lt;/p&gt;
&lt;!--more--&gt;

&lt;iframe src="https://docs.google.com/file/d/0B2EZFTQdeg3oQ0JvTHVEOHhnbXM/preview" width="640" height="480"&gt;&lt;/iframe&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="kmod"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>ConnMan in Archlinux</title><link href="https://politreco.com/2012/08/connman-in-archlinux/" rel="alternate"></link><published>2012-08-28T23:37:00-07:00</published><updated>2012-08-28T23:37:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-08-28:/2012/08/connman-in-archlinux/</id><summary type="html">&lt;p&gt;For sometime (I think it&amp;#8217;s almost 2 years) I was maintaining the ConnMan
package in &lt;span class="caps"&gt;AUR&lt;/span&gt;, the user repository in&amp;nbsp;Archlinux.&lt;/p&gt;
&lt;p&gt;After talking to Dave Falconindy and Daniel Wallace, the later accepted
to maintain it in community repository. As a result I&amp;#8217;m dropping the
package in &lt;span class="caps"&gt;AUR&lt;/span&gt;. All of you that were using my package should upgrade to
the latest version from the official Archlinux&amp;nbsp;repository.&lt;/p&gt;
&lt;p&gt;A great news is coming for Enlightenment users, too: a new ConnMan
module, written from scratch, that works properly with recent versions.
This is reaching e-svn very soon. Stay tunned. Thanks to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;For sometime (I think it&amp;#8217;s almost 2 years) I was maintaining the ConnMan
package in &lt;span class="caps"&gt;AUR&lt;/span&gt;, the user repository in&amp;nbsp;Archlinux.&lt;/p&gt;
&lt;p&gt;After talking to Dave Falconindy and Daniel Wallace, the later accepted
to maintain it in community repository. As a result I&amp;#8217;m dropping the
package in &lt;span class="caps"&gt;AUR&lt;/span&gt;. All of you that were using my package should upgrade to
the latest version from the official Archlinux&amp;nbsp;repository.&lt;/p&gt;
&lt;p&gt;A great news is coming for Enlightenment users, too: a new ConnMan
module, written from scratch, that works properly with recent versions.
This is reaching e-svn very soon. Stay tunned. Thanks to Michael
Blumenkrantz, too, who &lt;a href="http://e17releasemanager.wordpress.com/2012/07/24/enlightenment-hero-of-the-week-demarchi-lucas-de-marchi/"&gt;declared me a
&amp;#8220;hero&amp;#8221;&lt;/a&gt;
for doing this&amp;nbsp;:-).&lt;/p&gt;</content><category term="Uncategorized"></category><category term="ConnMan"></category><category term="profusion"></category></entry><entry><title>BlueZ to move to standard D-Bus interfaces</title><link href="https://politreco.com/2012/07/bluez-to-move-to-standard-d-bus-interfaces/" rel="alternate"></link><published>2012-07-19T18:28:00-07:00</published><updated>2012-07-19T18:28:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-07-19:/2012/07/bluez-to-move-to-standard-d-bus-interfaces/</id><summary type="html">&lt;p&gt;During the last week I was in Recife, Brazil, together with Henrique
Dante, Ulisses Furquim and other fellows attending the BlueZ meeting. We
discussed several topics, among them the upcoming BlueZ 5 &lt;span class="caps"&gt;API&lt;/span&gt;. That
discussion started by Johan and Marcel saying BlueZ would not move to
DBus.Properties and DBus.ObjectManager anymore for the next version.
Main reason being that BlueZ now will have more frequent releases than
it had in past and therefore there wasn&amp;#8217;t enough time to convert the
&lt;span class="caps"&gt;API&lt;/span&gt;. However I and Luiz von Dentz already had an almost working
solution: I implemented DBus.Properties and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;During the last week I was in Recife, Brazil, together with Henrique
Dante, Ulisses Furquim and other fellows attending the BlueZ meeting. We
discussed several topics, among them the upcoming BlueZ 5 &lt;span class="caps"&gt;API&lt;/span&gt;. That
discussion started by Johan and Marcel saying BlueZ would not move to
DBus.Properties and DBus.ObjectManager anymore for the next version.
Main reason being that BlueZ now will have more frequent releases than
it had in past and therefore there wasn&amp;#8217;t enough time to convert the
&lt;span class="caps"&gt;API&lt;/span&gt;. However I and Luiz von Dentz already had an almost working
solution: I implemented DBus.Properties and he did the
DBus.ObjectManager, so we received the news with much&amp;nbsp;regret.&lt;/p&gt;
&lt;p&gt;Since these changes break the &lt;span class="caps"&gt;API&lt;/span&gt;, not accepting them now means we&amp;#8217;d
need to wait for BlueZ 6 in order to have these interfaces, which
expected to happen only on later next year. Thus we argued that and
Marcel Holtmann challenged us to make a demo on Wednesday. Challenge
accepted! After working one night to put the implementations together
and finish the DBus.PropertiesChanged signal we could present such a
demo. And it worked without any issues. To say the truth we only
converted 2 interfaces (Adapter and Manager), but that was enough to
convince them we can finish this in time for BlueZ 5.0. Or at least
that&amp;#8217;s what we hope. Final consensus: this change is &lt;a href="http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=68be81032ec753571c6a0097b9a7677885c45a1e"&gt;back on track for
the upcoming major
release&lt;/a&gt; of&amp;nbsp;BlueZ.&lt;/p&gt;
&lt;p&gt;Now we are polishing the implementation and start sending the patches.
The&lt;a href="http://marc.info/?l=linux-bluetooth&amp;amp;m=134266828111367&amp;amp;w=2"&gt;first patch set was already
sent&lt;/a&gt; and
hopefully soon all the others will reach BlueZ&amp;#8217;s mailing&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;So, why is this important? By implementing these interfaces, that are
part of the &lt;a href="http://dbus.freedesktop.org/doc/dbus-specification.html"&gt;D-Bus
specification&lt;/a&gt;,
it becomes much easier to write client code to talk to bluetoothd and
since D-Bus bindings already have implementations for them it&amp;#8217;s much
less error prone, too. At the same time we are aiming to simplify the
code needed in bluetoothd to support our use-cases, so for both people
who write bluetoothd and for those who write client applications this
will be&amp;nbsp;beneficial.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Bluetooth"></category><category term="D-Bus"></category><category term="profusion"></category><category term="programming"></category></entry><entry><title>ELC 2012</title><link href="https://politreco.com/2012/03/elc-2012/" rel="alternate"></link><published>2012-03-20T19:30:00-07:00</published><updated>2012-03-20T19:30:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-03-20:/2012/03/elc-2012/</id><summary type="html">&lt;p&gt;Hey, this is my feedback of &lt;span class="caps"&gt;ELC&lt;/span&gt; 2012. If you didn&amp;#8217;t read the first part,
about &lt;span class="caps"&gt;ABS&lt;/span&gt; 2012, you can read the &lt;a href="https://politreco.com/2012/03/android-builders-summit-2012/"&gt;previous
post&lt;/a&gt;&amp;nbsp;first.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;ELC&lt;/span&gt; is one of my favorite conferences as I can meet several talented
people and have good talks about Linux in embedded devices. This time
was not an exception and I enjoyed very much. The main reason I was
there was because I was going to present kmod, the new tool to manage
kernel modules. But that would be only on the last day of the
conference. Let&amp;#8217;s start from the&amp;nbsp;beginning.&lt;/p&gt;
&lt;p&gt;To …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Hey, this is my feedback of &lt;span class="caps"&gt;ELC&lt;/span&gt; 2012. If you didn&amp;#8217;t read the first part,
about &lt;span class="caps"&gt;ABS&lt;/span&gt; 2012, you can read the &lt;a href="https://politreco.com/2012/03/android-builders-summit-2012/"&gt;previous
post&lt;/a&gt;&amp;nbsp;first.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;ELC&lt;/span&gt; is one of my favorite conferences as I can meet several talented
people and have good talks about Linux in embedded devices. This time
was not an exception and I enjoyed very much. The main reason I was
there was because I was going to present kmod, the new tool to manage
kernel modules. But that would be only on the last day of the
conference. Let&amp;#8217;s start from the&amp;nbsp;beginning.&lt;/p&gt;
&lt;p&gt;To open the conference Jon Corbet gave his usual kernel report starting
from January 2011 and going on through the events in each month: the
mess in &lt;span class="caps"&gt;ARM&lt;/span&gt;, death of the big kernel lock, userspace code in kernel tree
(should we put libreoffice there, too?) and so on. Following this
keynote I went to see &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/pallardy"&gt;Saving the Power Consumption of the Unused
Memory&lt;/a&gt;.
Loïc Pallard from &lt;span class="caps"&gt;ST&lt;/span&gt;-Ericsson talked about how memory consumption in
increasingly important in embedded devices for the total power
consumption. We are going from the usual 512 &lt;span class="caps"&gt;MB&lt;/span&gt; on smartphones to 2 \~ 4
&lt;span class="caps"&gt;GB&lt;/span&gt; of &lt;span class="caps"&gt;DDR&lt;/span&gt; &lt;span class="caps"&gt;RAM&lt;/span&gt;. There are some techniques to reduce this the power
drained and he presented the &lt;span class="caps"&gt;PASR&lt;/span&gt; framework, that allows the kernel to
turn on/off specific banks/dies of memory since not all of them is used
all the time. Later on talking to the guys from Chromium &lt;span class="caps"&gt;OS&lt;/span&gt; I realized
that this is especially true when the device is sleeping. We may want to
discard  caches (therefore use much less memory when in sleep mode) and
then turn off banks not used. In my opinion the battery consumption is
one of the most important today for embedded Linux devices: I&amp;#8217;m tired to
have to charge my smartphone every day or every X hours. I hope we can
improve the current state by using techniques as the one presented in
this&amp;nbsp;talk.&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/hudson"&gt;Embedded Linux
Pitfalls&lt;/a&gt; Sean
Hudson from Mentor Graphics shared his experience while coming from
closed embedded solutions to open source ones. Nice talk! I think people
doing closed development should see presentations like this: one of the
main reasons for failing in opensource is not being able to talk to each
other: &lt;span class="caps"&gt;HW&lt;/span&gt; guys not talking to &lt;span class="caps"&gt;SW&lt;/span&gt; guys, &lt;span class="caps"&gt;NIH&lt;/span&gt;, not playing the rules of the
communities and therefore having to carry a lot of patches, etc. I&amp;#8217;ve
always been involved with opensource so I don&amp;#8217;t know very well how
things work for companies doing closed development, but I do know that
more often than not we see those companies trying to participate in
communities/opensource and failing miserably. In my opinion one of the
main reason is because they fail to talk, discuss and agree on the right
solution with&amp;nbsp;communities.&lt;/p&gt;
&lt;p&gt;One of the best talks in &lt;span class="caps"&gt;ELC&lt;/span&gt; 2012 was &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/mckenney"&gt;Making &lt;span class="caps"&gt;RCU&lt;/span&gt; Safe for
Battery-Powered
Devices&lt;/a&gt;.
Paul McKenney is one of the well known hackers of the Linux kernel,
maintaining the &lt;span class="caps"&gt;RCU&lt;/span&gt; subsystem. Prior to this talk I had no idea &lt;span class="caps"&gt;RCU&lt;/span&gt; had
anything to do with power consumption. He went through a series of
slides showing how and why &lt;span class="caps"&gt;RCU&lt;/span&gt; got rewritten several times in the past
years, how he solved the problems reported by community and how things
get much more complicated with preemption and &lt;span class="caps"&gt;RT&lt;/span&gt;. He finished his
presentation saying that the last decade was the most important of his
carrier and that is because of the feedback he got from &lt;span class="caps"&gt;RCU&lt;/span&gt; being used
in real life. I&amp;#8217;d really love to see more people from Academia realizing&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;The next day Mike Anderson gave a great keynote about &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/anderson1"&gt;The Internet of
things&lt;/a&gt;.
 Devices in Internet are surpassing the number of people connected and
soon they will be much more important. It&amp;#8217;s a great opportunity for
embedded companies and for Linux to become the most important Operating
System in the world. &lt;a href="http://www.nextnature.net/2012/03/internet-traffic-is-now-51-non-human/"&gt;Recent
news&lt;/a&gt;
about this are already telling us that 51% of the Internet traffic is
non-human (although we can&amp;#8217;t classify all of that as &amp;#8220;good traffic&amp;#8221;).
Following his keynote I went to see Thomas Petazzoni from Free Electrons
talk about Buildroot. I like Buildroot&amp;#8217;s simplicity and from what Thomas
said this is one thing they care about: Buildroot is a rootfs generator
and not a meta-distro like openembedded. There were at least 3 people
asking if Buildroot could support binary packages and he emphasized that
it was a design decision not to support them. I like this: use the right
tool for the each job. I already used Buildroot before to create a
rootfs using uClibc and it was great to see that it was already
packaging the last version of kmod before I went to &lt;span class="caps"&gt;ELC&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;In the end of the second day I participated in &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/rowand"&gt;Real-Time
(BoFs)&lt;/a&gt; with
Frank Rowand. It was great to have Steven Rostedt and Paul McKenney
there as they contributed a lot to the discussion, pointing out the
difficulties in &lt;span class="caps"&gt;RT&lt;/span&gt;, the current status of RT_PREEMPT patches regarding
mainline and forecasts of when it will be completely merged. There were
some discussions about &amp;#8220;can we really trust in &lt;span class="caps"&gt;RT&lt;/span&gt; Linux? How does it
compare with having an external processor doing the &lt;span class="caps"&gt;RT&lt;/span&gt; tasks?&amp;#8221;. In the
end people seemed to agree that it all boils down about what do you have
in your kernel (you probably don&amp;#8217;t want to enable crappy drivers), how
do you tolerate fails (hard-&lt;span class="caps"&gt;RT&lt;/span&gt; vs soft-&lt;span class="caps"&gt;RT&lt;/span&gt;) and that &lt;span class="caps"&gt;RT&lt;/span&gt; is not a magic
flag that you turn on and it&amp;#8217;s done: it demands profiling, kernel and
application tuning and expertise in the field. People gave several
examples of devices using the RT_PREEMPT patches: from robots and
aircrafts  in the space to cameras (the Sony cameras given away on the
last day were 1 of the&amp;nbsp;examples).&lt;/p&gt;
&lt;p&gt;On Friday, the last day of the conference, I was much more worried about
my presentation in the end of the day than with other talks. Nonetheless
I couldn&amp;#8217;t miss Koen Kooi from Texas Instruments &lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/kooi"&gt;talking about
Beaglebone&lt;/a&gt;.
It&amp;#8217;s a very interesting device for those who like to &lt;span class="caps"&gt;DIY&lt;/span&gt;: it&amp;#8217;s much
smaller than its brothers like Beagleboard and Pandaboard and still has
enough processing power for lots of applications. Koen was displaying
his slides using &lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt; running on a Beaglebone.
What I do like to see though is barebox replacing u-boot as the
bootloader. If you attended Koen&amp;#8217;s talk on &lt;span class="caps"&gt;ELCE&lt;/span&gt; last year, you know
u-boot is one of the culprits for a longer boot. Jason from &lt;span class="caps"&gt;TI&lt;/span&gt; kindly
gave me a Beaglebone so I can use it for testing kmod; when I have some
spare time I&amp;#8217;ll take a look on the things missing for using barebox on
it,&amp;nbsp;too.&lt;/p&gt;
&lt;p&gt;The last talk of the conference was mine: &lt;strong&gt;&lt;a href="https://events.linuxfoundation.org/events/embedded-linux-conference/de-marchi"&gt;Managing Kernel Modules
With
kmod&lt;/a&gt;.&lt;/strong&gt; I
received a good feedback from people there: they liked the idea behind
kmod - designing a library and then the tools on top of that. I had some
issues with my laptop in the middle of my presentation, but it all went
well. I could show how kmod works, the details behind the scenes, the
short history of the projects and how it&amp;#8217;s replacing a well known piece
of  userspace tools of Linux in all major desktop and embedded distros.
When I was showing the timeline of the project I remember Mike Anderson
saying: &amp;#8220;tell us when it will be done&amp;#8221;. I can&amp;#8217;t really say it&amp;#8217;s done
now, but after the conference we already had versions 6 and 7 and
contrary to other releases in the latest versions the number of commits
is very small. After 3\~4 months the project is reaching a maintenance
phase as I said it would. If you would like to see my slides, &lt;a href="https://events.linuxfoundation.org/images/stories/pdf/lf_elc12_marchi.pdf"&gt;download
it
here&lt;/a&gt; or
see it online below. You can also watch the video of my talk as well as
all the others in &lt;a href="http://video.linux.com/categories/2012-embedded-linux-conference"&gt;&lt;span class="caps"&gt;LF&lt;/span&gt;&amp;#8217;s video
website&lt;/a&gt;.&lt;/p&gt;
&lt;!--more--&gt;

&lt;iframe src="https://docs.google.com/presentation/embed?id=18zDcz7aDfjQOT-nuKtf9rGvF8bTC9_ZdC0c-Z46OpNk&amp;amp;start=false&amp;amp;loop=false&amp;amp;delayms=3000" height="389" width="480" frameborder="0"&gt;&lt;/iframe&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>Android Builders Summit 2012</title><link href="https://politreco.com/2012/03/android-builders-summit-2012/" rel="alternate"></link><published>2012-03-17T14:25:00-07:00</published><updated>2012-03-17T14:25:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-03-17:/2012/03/android-builders-summit-2012/</id><summary type="html">&lt;p&gt;Four weeks ago, from Februart 13rd to Februrary 17th I was at Android
Builders Summit and Embedded Linux Conference in San Francisco. I was a
bit busy these last weeks so I didn&amp;#8217;t have an opportunity to write here
about the conferences as I usually do. I was going to do a post about
both the conferences, but after writing a little bit I realized it would
be very big. So I split in 2 and here is the one for &lt;span class="caps"&gt;ABS&lt;/span&gt; 2012; the other
&lt;a href="http://thedoghousediaries.com/3474"&gt;is coming soon&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was my first time at Android Builders Summit. Since in …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Four weeks ago, from Februart 13rd to Februrary 17th I was at Android
Builders Summit and Embedded Linux Conference in San Francisco. I was a
bit busy these last weeks so I didn&amp;#8217;t have an opportunity to write here
about the conferences as I usually do. I was going to do a post about
both the conferences, but after writing a little bit I realized it would
be very big. So I split in 2 and here is the one for &lt;span class="caps"&gt;ABS&lt;/span&gt; 2012; the other
&lt;a href="http://thedoghousediaries.com/3474"&gt;is coming soon&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was my first time at Android Builders Summit. Since in the end of
last year I participated in a project modifying Android internals, I
felt it would be really good to be in touch with people doing the same
things and learn with them. Before going there I was already surprised
that Google was not sponsoring the conference, but there I was
astonished that there was nobody from Android&amp;#8217;s team and I don&amp;#8217;t
remember talking to Googlers, too. I don&amp;#8217;t know what happened but it
would be really good for the next conference if Google could be part of
the conference since for the very nature of how they manage the project
they are the people pushing the platform&amp;nbsp;forward.&lt;/p&gt;
&lt;p&gt;In the first day of the conference Greg Kroah-Hartman, Tim Bird and Zach
Pfeffer answered the question &amp;#8220;&lt;a href="https://events.linuxfoundation.org/events/android-builders-summit/android-mainline-panel"&gt;Android and the Linux Kernel Mainline:
Where Are
We&lt;/a&gt;&amp;#8220;:
it&amp;#8217;s done. Well, not totally done, but most of the code needed in kernel
is already in mainline: except for some pieces that render your device
useful it&amp;#8217;s already possible to boot Android userspace with a mainline
kernel. I think the main point of this effort is to allow companies and
enthusiasts to use features from the mainline kernel and newer versions
than the ones available on &lt;span class="caps"&gt;AOSP&lt;/span&gt;. As the diff between mainline and
Android&amp;#8217;s kernel decreases it&amp;#8217;s much easier to deploy an Android device
with a different kernel. More details can be found
in &lt;a href="http://lwn.net/Articles/481661/"&gt;http://lwn.net/Articles/481661/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the other talks I attended on the first day, the one that caught my
eyes was &lt;a href="https://events.linuxfoundation.org/events/android-builders-summit/thompson"&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Device Support
Workshop&lt;/a&gt;.
Bernie Thompson from Plugable talked a bit about the lack of proper
support in Android to deal with kernel modules: it&amp;#8217;s really hard for
device maker companies like his own to have products working on Android.
And it&amp;#8217;s not because they aren&amp;#8217;t committed to developing Linux device
drivers but because of the lack of support in Android to easily deal
with kernel drivers: either the external device is supported by the
company shipping the Android product or there&amp;#8217;s no way for example to
plug in an external camera and get it to work. Audience was a bit
confused saying that that was a Linux problem and some voices telling
that in Windows lands that doesn&amp;#8217;t happen. Not true. Linux supports more
devices that any other operating system in the world, however Android is
currently missing some tools to profit from it. After some discussion
Bernie prepared some tables with &lt;span class="caps"&gt;USB&lt;/span&gt; devices that people could hack on,
get it supported in Linux/Android,&amp;nbsp;etc.&lt;/p&gt;
&lt;p&gt;On the second day I attended &lt;a href="https://events.linuxfoundation.org/events/android-builders-summit/mauerer"&gt;Real-Time
Android&lt;/a&gt;,
particularly because of my involvement with real-time since I graduated
at university and because I was curious about applying it to Android. As
I said one of the benefits of  having Android kernel closer to mainline
is that it&amp;#8217;s easier to do things like this. Wolfgang Mauerer from
Siemens applied the RT_PREEMPT patches to Android&amp;#8217;s kernel so you could
have a real-time embedded system and still use Android&amp;#8217;s app. As I was
expecting &lt;span class="caps"&gt;RT&lt;/span&gt; would be applied for native applications, not java based&amp;nbsp;ones.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://events.linuxfoundation.org/events/android-builders-summit/costillo"&gt;Topics in Designing An Android Sensor Subsystem: Pitfalls and
Considerations&lt;/a&gt; was
advanced talk about Sensors in Android and how one would choose one
strategy over another and the tradeoffs between battery life, sample
rate,  external co-processor, &lt;span class="caps"&gt;DIY&lt;/span&gt; or license the algorithms used, etc.
It was not a talk for the regular Joe doing an app that uses the
Android&amp;#8217;s Sensors &lt;span class="caps"&gt;API&lt;/span&gt;  (that was what I knew about it) but more for
people creating devices that would like to use&amp;nbsp;sensors.&lt;/p&gt;
&lt;p&gt;It was a conference different from the conferences I&amp;#8217;m used to attend
like &lt;span class="caps"&gt;ELC&lt;/span&gt;/LinuxCon: there was very few people who I already knew and I
had the feeling that we were talking about a product from someone else,
not a product we were helping to develop - instead we were having talks
about how to hack a platform we do not own. In general I liked the talks
I could attend and talking to people at the corridors. They even gave me
some insights for my talk about kmod, later on Friday at &lt;span class="caps"&gt;ELC&lt;/span&gt;. I&amp;#8217;ll talk
more about it on the next&amp;nbsp;post.&lt;/p&gt;
&lt;p&gt;For those wanting to see the slides/videos, Linux Foundation made them
available at &lt;a href="http://video.linux.com/categories/2012-android-builders-summit"&gt;their
site&lt;/a&gt; -
go on and see for&amp;nbsp;yourselves.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="android"></category><category term="kernel"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: codespell 1.4</title><link href="https://politreco.com/2012/03/announce-codespell-1-4/" rel="alternate"></link><published>2012-03-03T02:06:00-08:00</published><updated>2012-03-03T02:06:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-03-03:/2012/03/announce-codespell-1-4/</id><summary type="html">&lt;p&gt;codespell 1.4 is out! Nothing really new, just a maintenance release: 1
bug fix and some new entries to the dictionary. See the entire
announcement on its &lt;a href="http://groups.google.com/group/codespell/browse_thread/thread/35f5572eb201f9ce"&gt;mailing
list&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As per patches I&amp;#8217;m receiving it seems that codespell is
being successfully used by opensource projects. I&amp;#8217;m glad codespell can
help those projects, particularly people who don&amp;#8217;t have English as their
mother tongue as I don&amp;#8217;t. It&amp;#8217;s also an opportunity to people starting on
a project, &lt;a href="https://politreco.com/2011/11/linuxcon-brazil/"&gt;as I said in last LinuxCon
Brazil&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not submitting patches anymore to Linux kernel myself using
codespell …&lt;/p&gt;</summary><content type="html">&lt;p&gt;codespell 1.4 is out! Nothing really new, just a maintenance release: 1
bug fix and some new entries to the dictionary. See the entire
announcement on its &lt;a href="http://groups.google.com/group/codespell/browse_thread/thread/35f5572eb201f9ce"&gt;mailing
list&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As per patches I&amp;#8217;m receiving it seems that codespell is
being successfully used by opensource projects. I&amp;#8217;m glad codespell can
help those projects, particularly people who don&amp;#8217;t have English as their
mother tongue as I don&amp;#8217;t. It&amp;#8217;s also an opportunity to people starting on
a project, &lt;a href="https://politreco.com/2011/11/linuxcon-brazil/"&gt;as I said in last LinuxCon
Brazil&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not submitting patches anymore to Linux kernel myself using
codespell because after doing that twice I started to receive a lot of
emails from people using get_maintainer script. It&amp;#8217;s very annoying to
filter the good emails (that were indeed addressed to me) from that that
I was in &lt;span class="caps"&gt;CC&lt;/span&gt; just because there was a misspelling that my patch fixed.
Since that patch touched 2463 files, it&amp;#8217;s very common to have my name in
the output of get_maintainer :-(. I&amp;#8217;m still trying to figure out how to
properly filter that without losing important emails. Any tips (I&amp;#8217;m a
GMail&amp;nbsp;user)?&lt;/p&gt;
&lt;p&gt;Back to codespell announcement, the only missing item in &lt;span class="caps"&gt;TODO&lt;/span&gt; is to be
able to separate comments, strings and source code in order to fix
misspellings only in the first 2. Nonetheless codespell seems to be
doing a good job without that feature and unless someone step in to
implement it without impacting the parse time too much, my plan is to
keep as&amp;nbsp;is.&lt;/p&gt;
&lt;p&gt;Go get it (and package for your distro) while it&amp;#8217;s&amp;nbsp;fresh!&lt;/p&gt;</content><category term="Uncategorized"></category><category term="codespell"></category><category term="kernel"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: kmod 3</title><link href="https://politreco.com/2012/01/announce-kmod-3/" rel="alternate"></link><published>2012-01-06T06:50:00-08:00</published><updated>2012-01-06T06:50:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2012-01-06:/2012/01/announce-kmod-3/</id><summary type="html">&lt;p&gt;Hey, kmod 3 is out. Really nice to finish this release. I was hoping to
have it between the holidays, but there were some major bugs pending.
It&amp;#8217;s nice to see udev from git already using it instead of calling
modprobe for each module. Kay reported a hundred less forks on bootup
after start using libkmod and&amp;nbsp;libblkid.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s nice too receive feedback about other architectures that we don&amp;#8217;t
have access, too. With kmod 3, sh4 joined the other architectures that
were tested with&amp;nbsp;kmod.&lt;/p&gt;
&lt;p&gt;Since I&amp;#8217;m already doing the announcements to the mailing lists, I …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Hey, kmod 3 is out. Really nice to finish this release. I was hoping to
have it between the holidays, but there were some major bugs pending.
It&amp;#8217;s nice to see udev from git already using it instead of calling
modprobe for each module. Kay reported a hundred less forks on bootup
after start using libkmod and&amp;nbsp;libblkid.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s nice too receive feedback about other architectures that we don&amp;#8217;t
have access, too. With kmod 3, sh4 joined the other architectures that
were tested with&amp;nbsp;kmod.&lt;/p&gt;
&lt;p&gt;Since I&amp;#8217;m already doing the announcements to the mailing lists, I&amp;#8217;ll not
repeat the &lt;span class="caps"&gt;NEWS&lt;/span&gt; here. Just look at the
&lt;a href="http://www.spinics.net/lists/linux-modules/msg00637.html"&gt;archives&lt;/a&gt; if
you didn&amp;#8217;t receive the&amp;nbsp;email.&lt;/p&gt;
&lt;p&gt;Happy new&amp;nbsp;year!&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="kmod"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: kmod 2</title><link href="https://politreco.com/2011/12/announce-kmod-2/" rel="alternate"></link><published>2011-12-21T04:40:00-08:00</published><updated>2011-12-21T04:40:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-12-21:/2011/12/announce-kmod-2/</id><summary type="html">&lt;p&gt;I&amp;#8217;m glad to announce the second version of kmod.  I&amp;#8217;m sorry for
not sending the first version to the mailing lists. Now I&amp;#8217;m both writing
it here and sending to the mailing&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;I thank very much the feedback received for the first version and
that now Jon Masters, the maintainer of module-init-tools, is helping
us with kmod and already announced that &lt;a href="http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools/"&gt;kmod will
replace module-init-tools in
future&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to especially thank Tom Gundersen, Dave Reisner, Marco d&amp;#8217;Itri,
Jon Masters, Luis Strano, Jan Engelhardt and Kay Sievers who have been
extensively testing kmod and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m glad to announce the second version of kmod.  I&amp;#8217;m sorry for
not sending the first version to the mailing lists. Now I&amp;#8217;m both writing
it here and sending to the mailing&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;I thank very much the feedback received for the first version and
that now Jon Masters, the maintainer of module-init-tools, is helping
us with kmod and already announced that &lt;a href="http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools/"&gt;kmod will
replace module-init-tools in
future&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to especially thank Tom Gundersen, Dave Reisner, Marco d&amp;#8217;Itri,
Jon Masters, Luis Strano, Jan Engelhardt and Kay Sievers who have been
extensively testing kmod and helping with compatibility with previous
tools. Right now kmod is tested in i686, x86_64, sparcv9, powepc64,
s390 and &lt;span class="caps"&gt;ARM&lt;/span&gt;. More testers are greatly appreciated, especially for
architectures not mentioned&amp;nbsp;here.&lt;/p&gt;
&lt;p&gt;News for this version are (copying from &lt;span class="caps"&gt;NEWS&lt;/span&gt;&amp;nbsp;file):&lt;/p&gt;
&lt;p&gt;Some bugs fixed: the worst of them was with an infinite loop when an
alias matched more than one&amp;nbsp;module.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
New APIs in libkmod&amp;nbsp;to:

&lt;/li&gt;
-   Get soft dependencies
-   Get info from module files parsing &lt;span class="caps"&gt;ELF&lt;/span&gt;
-   Get modversions from files parsing &lt;span class="caps"&gt;ELF&lt;/span&gt;

&lt;li&gt;
Support to load gzipped kernel modules: kmod can be compiled with
support to  gzipped modules by giving the &amp;#8212;enable-zlib&amp;nbsp;flag

&lt;/li&gt;
&lt;li&gt;
Support to forcefully load modules, both vermagic and&amp;nbsp;modversion

&lt;/li&gt;
&lt;li&gt;
Support to force and nowait removal&amp;nbsp;flags

&lt;/li&gt;
&lt;li&gt;
Configuration files are parsed in the same order as modprobe: files
are  sorted alphabetically (independently of their dir) and files with
the same name obey a precedence&amp;nbsp;order

&lt;/li&gt;
&lt;li&gt;
New tool:&amp;nbsp;kmod-modinfo

&lt;/li&gt;
&lt;li&gt;
kmod-modprobe gained several features to be a 1:1 replacement for
modprobe.  The only missing things are the options &amp;#8216;&amp;#8212;showconfig&amp;#8217; and
&amp;#8216;-t / -l&amp;#8217;. These  last ones have been deprecated long ago and they will
be removed from  modprobe. A lot of effort has been put on kmod-modprobe
to ensure it maintains compabitility with&amp;nbsp;modprobe.

&lt;/li&gt;
&lt;li&gt;
linux-modules@vger.kernel.org became the official mailing list for&amp;nbsp;kmod

&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the next version, we plan to migrate our git repository
to kernel.org. Meanwhile, git repository can be found
at &lt;a href="http://git.profusion.mobi/cgit.cgi/kmod.git/"&gt;http://git.profusion.mobi/cgit.cgi/kmod.git/&lt;/a&gt; and packages
at &lt;a href="http://packages.profusion.mobi/kmod/"&gt;http://packages.profusion.mobi/kmod/&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="kmod"></category><category term="profusion"></category></entry><entry><title>Given enough eyeballs, all bugs are shallow</title><link href="https://politreco.com/2011/12/given-enough-eyeballs-all-bugs-are-shallow/" rel="alternate"></link><published>2011-12-16T08:59:00-08:00</published><updated>2011-12-16T08:59:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-12-16:/2011/12/given-enough-eyeballs-all-bugs-are-shallow/</id><summary type="html">&lt;p&gt;So, in last post I said kmod 2 could be released sooner than expected if
there were major bugs. Not as much as a surprise, there was 1: depending
on the alias passed to the lookup function we were blocked iterating a&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s now fixed in git tree. Thanks to Ulisses Furquim for fixing it and
Dave Reisner for the bug report. We already have some other great stuff
implemented so we&amp;#8217;ll soon have another&amp;nbsp;release.&lt;/p&gt;
&lt;p&gt;Another great news is that now we have the maintainer of
module-init-tools (Jon Masters) cooperating with us. We will discuss how …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So, in last post I said kmod 2 could be released sooner than expected if
there were major bugs. Not as much as a surprise, there was 1: depending
on the alias passed to the lookup function we were blocked iterating a&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s now fixed in git tree. Thanks to Ulisses Furquim for fixing it and
Dave Reisner for the bug report. We already have some other great stuff
implemented so we&amp;#8217;ll soon have another&amp;nbsp;release.&lt;/p&gt;
&lt;p&gt;Another great news is that now we have the maintainer of
module-init-tools (Jon Masters) cooperating with us. We will discuss how
the two projects will co-exist/merge. So, for now on the official
mailing list of the project is&amp;nbsp;linux-modules@vger.kernel.org.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="kmod"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: kmod 1</title><link href="https://politreco.com/2011/12/announce-kmod-1/" rel="alternate"></link><published>2011-12-15T04:05:00-08:00</published><updated>2011-12-15T04:05:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-12-15:/2011/12/announce-kmod-1/</id><summary type="html">&lt;p&gt;For some weeks now I and Gustavo Barbieri at ProFUSION have been working
on a new library and a set of tools, libkmod and kmod respectively. This
is the announcement of its first public&amp;nbsp;release.&lt;/p&gt;
&lt;h3 id="overview"&gt;Overview&lt;/h3&gt;
&lt;p&gt;The goal of the new library libkmod is to offer to other programs the
needed flexibility and fine grained control over insertion, removal,
configuration and listing of kernel modules. Using the library, with
simple pieces of code it&amp;#8217;s possible to interact with kernel modules and
then there&amp;#8217;s no need to rely on other tools for that. This is a thing
lacking on …&lt;/p&gt;</summary><content type="html">&lt;p&gt;For some weeks now I and Gustavo Barbieri at ProFUSION have been working
on a new library and a set of tools, libkmod and kmod respectively. This
is the announcement of its first public&amp;nbsp;release.&lt;/p&gt;
&lt;h3 id="overview"&gt;Overview&lt;/h3&gt;
&lt;p&gt;The goal of the new library libkmod is to offer to other programs the
needed flexibility and fine grained control over insertion, removal,
configuration and listing of kernel modules. Using the library, with
simple pieces of code it&amp;#8217;s possible to interact with kernel modules and
then there&amp;#8217;s no need to rely on other tools for that. This is a thing
lacking on Linux for a while and it&amp;#8217;s one of the items in the &lt;a href="http://0pointer.de/blog/projects/plumbers-wishlist.html"&gt;Plumber’s
Wish List for
Linux&lt;/a&gt;. Quoting&amp;nbsp;it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;provide a proper libmodprobe.so from module-init-tools:&lt;br /&gt;
 Early boot tools, installers, driver install disks want to access&lt;br /&gt;
 information about available modules to optimize bootup&amp;nbsp;handling.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We went one step further and not only we are able now to give an &lt;span class="caps"&gt;API&lt;/span&gt; to
load and remove kernel module, but also all the other common operations
are being added to this &lt;span class="caps"&gt;API&lt;/span&gt;. The first user for this &lt;span class="caps"&gt;API&lt;/span&gt; will be udev.
In a recent Linux Desktop (and also several embedded systems) when
computer is booting up, udev is responsible for checking available
hardware, creating device nodes under /dev (or at least configuring
their permissions) and loading kernel modules for the available
hardware. In a kernel from a distribution it&amp;#8217;s pretty common to put most
of the things as modules. Udev reads the /sys filesystem to check the
available hardware and tries to load the necessary modules. This
translates in hundreds of calls to the modprobe binary, and in several
of them just to know the module is already loaded, or it&amp;#8217;s in-kernel.
With libkmod it&amp;#8217;s possible for udev with a few lines of code to do all
the job, benefiting from the configurations and indexes already opened
and parsed. We&amp;#8217;ve been talking to Kay Sievers (udev&amp;#8217;s mantainter) and
Lennart Poettering (systemd&amp;#8217;s maintainer) regarding this and we are
looking forward to have udev using libkmod&amp;nbsp;soon.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&amp;nbsp;code:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To insert a module by name without any options and strange
configurations it&amp;#8217;s sufficient to do as following (without treating
errors for easy of comprehension - see the documentation for possible&amp;nbsp;errors):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;kmod_ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;kmod_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nc"&gt;kmod_module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;kmod_module_new_from_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;kmod_module_insert_module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;kmod_module_unref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;kmod_unref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="tools"&gt;Tools&lt;/h3&gt;
&lt;p&gt;Besides doing the library, we are re-designing the module-init-tools
tools on top of the new &lt;span class="caps"&gt;API&lt;/span&gt; we created. With this first version we are
already providing compatible binaries for lsmod, rmmod, insmod and
modprobe, the last one with some functionality missing. Next versions we
plan to fill the gaps with the provided tools and provide all the others
like depmod and&amp;nbsp;modinfo.&lt;/p&gt;
&lt;h3 id="license"&gt;License&lt;/h3&gt;
&lt;p&gt;We try to avoid issues regarding licences: the library is licensed under
&amp;#8220;LGPLv2 or later&amp;#8221; and the tools are under &amp;#8220;GPLv2 or later&amp;#8221;. There&amp;#8217;s
still lots of work to be done and places to optimize. We greatly
appreciate contribution from other&amp;nbsp;developers.&lt;/p&gt;
&lt;h3 id="roadmap"&gt;Roadmap&lt;/h3&gt;
&lt;p&gt;The &lt;span class="caps"&gt;API&lt;/span&gt; is not set on stone and is going to suffer some changes in
future releases as we see fit to finish implementing all the tools.
Below is the list of the features already&amp;nbsp;implemented&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;kmod&amp;nbsp;1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;libkmod provides the necessary &lt;span class="caps"&gt;API&lt;/span&gt;&amp;nbsp;for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;List modules currently&amp;nbsp;loaded&lt;/li&gt;
&lt;li&gt;Get information about loaded modules such as initstate,
    refcount, holders, sections, address and&amp;nbsp;size&lt;/li&gt;
&lt;li&gt;Lookup modules by alias, module name or&amp;nbsp;path&lt;/li&gt;
&lt;li&gt;Insert modules: options from configuration and extra options can
    be passed, but flags are not implemented,&amp;nbsp;yet&lt;/li&gt;
&lt;li&gt;Remove&amp;nbsp;modules&lt;/li&gt;
&lt;li&gt;Filter list of modules using&amp;nbsp;blacklist&lt;/li&gt;
&lt;li&gt;For each module, get the its list of options and
    install/remove&amp;nbsp;commands&lt;/li&gt;
&lt;li&gt;Indexes can be loaded on startup to speedup lookups&amp;nbsp;later&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Tools provided with the same set of options as in&amp;nbsp;module-init-tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;kmod-lsmod&lt;/li&gt;
&lt;li&gt;kmod-insmod&lt;/li&gt;
&lt;li&gt;kmod-rmmod&lt;/li&gt;
&lt;li&gt;kmod-modprobe, with some functionality still missing (use of
    softdep, dump configuration, show&amp;nbsp;modversions)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Following is a rough roadmap for future&amp;nbsp;releases:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;kmod&amp;nbsp;2&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provide the &lt;span class="caps"&gt;API&lt;/span&gt; for features missing in kmod-modprobe, namely: dump
    configuration and indexes, soft dependencies, install and
    remove commands. Features relying on &lt;span class="caps"&gt;ELF&lt;/span&gt; manipulation will still be&amp;nbsp;missing;&lt;/li&gt;
&lt;li&gt;Provide all the tools available in module-init-tools. Some of them
    like depmod may be entirely copied from module-init-tools for later&amp;nbsp;convertion;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;kmod&amp;nbsp;3&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provide a single &lt;strong&gt;kmod&lt;/strong&gt; tool that will abstract all the others,
    accepting commands like &amp;#8220;kmod list&amp;#8221;, &amp;#8220;kmod remove&amp;#8221;, &amp;#8220;kmod insert&amp;#8221;.
    Distributions may then use symlinks from current tools to the kmod
    binary and we can kill the &amp;#8216;kmod-*&amp;#8217; test tools that we are
    introducing in kmod&amp;nbsp;1;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We thoroughly test the features implemented in kmod, but like any other
software it&amp;#8217;s possible to contain bugs that we didn&amp;#8217;t find; we may
decide to release new versions between the versions above and then this
numbers change. Otherwise kmod 2 will already be sufficient for udev to
pick it up as a dependency and start benefiting from the fine grained
control over its operations with kernel&amp;nbsp;modules.&lt;/p&gt;
&lt;h3 id="repositories"&gt;Repositories&lt;/h3&gt;
&lt;p&gt;The repository for this project is located
at &lt;a href="http://git.profusion.mobi/cgit.cgi/kmod.git/"&gt;http://git.profusion.mobi/cgit.cgi/kmod.git/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Package with kmod 1 source code can be downloaded from:
&lt;a href="http://packages.profusion.mobi/kmod/"&gt;http://packages.profusion.mobi/kmod/&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="thanks"&gt;Thanks&lt;/h3&gt;
&lt;p&gt;Last I&amp;#8217;d like to thank &lt;strong&gt;Kay Sievers&lt;/strong&gt; for his support in reviewing
code, giving advices and helping to design&amp;nbsp;kmod.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="kmod"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>Having fun in the sky</title><link href="https://politreco.com/2011/12/having-fun-in-the-sky/" rel="alternate"></link><published>2011-12-12T21:56:00-08:00</published><updated>2011-12-12T21:56:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-12-12:/2011/12/having-fun-in-the-sky/</id><content type="html">&lt;p&gt;No words to describe free fall. If you never did, you should be
rethinking your next vacations&amp;nbsp;;-)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/12/GOPR45121.jpg"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/12/GOPR45121.jpg" title="falling 1" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/12/vlcsnap-2011-12-12-17h55m13s231.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/12/vlcsnap-2011-12-12-17h55m13s231.png" title="vlcsnap-2011-12-12-17h55m13s231" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="vacations"></category></entry><entry><title>Becoming social…</title><link href="https://politreco.com/2011/12/becoming-social/" rel="alternate"></link><published>2011-12-02T15:12:00-08:00</published><updated>2011-12-02T15:12:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-12-02:/2011/12/becoming-social/</id><content type="html">&lt;p&gt;I&amp;#8217;ve just installed a plugin in my blog to display the common social
sites below each post. From now on, if you like a post you can share it
with the world using your preferred social&amp;nbsp;media.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m using the &lt;strong&gt;Socialize&lt;/strong&gt; plugin in WordPress. I&amp;#8217;m not sure if it&amp;#8217;s
the best one: I just installed and checked it works. Any&amp;nbsp;advices?&lt;/p&gt;</content><category term="Uncategorized"></category><category term="profusion"></category></entry><entry><title>AndroidConf 2011</title><link href="https://politreco.com/2011/11/androidconf-2011/" rel="alternate"></link><published>2011-11-26T21:17:00-08:00</published><updated>2011-11-26T21:17:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-11-26:/2011/11/androidconf-2011/</id><content type="html">&lt;p&gt;Hoje dei uma palestra na AndroidConf sobre &amp;#8220;Modificando a &lt;span class="caps"&gt;API&lt;/span&gt; do
Android&amp;#8221;. Referências ao projeto que falei sobre &lt;span class="caps"&gt;AVRCP&lt;/span&gt; podem ser
encontradas em um &lt;a href="https://politreco.com/2011/10/avrcp-1-3-on-bluez/"&gt;post meu
anterior&lt;/a&gt;. Estou
disponibilizando abaixo os&amp;nbsp;slides.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIÇÃO 02/12/2011:&lt;/strong&gt; coloquei uma nota no slide 7, relatando o que
falei durante a apresentação sobre uso de &lt;span class="caps"&gt;IDE&lt;/span&gt;.&lt;/p&gt;
&lt;iframe src="https://docs.google.com/presentation/embed?id=1rw8-JpZcdj-g9UXh6oCJ0WI9ZjqdkouAw2wFx8um5rM&amp;amp;start=false&amp;amp;loop=false&amp;amp;delayms=3000" frameborder="0" width="480" height="389"&gt;&lt;/iframe&gt;

&lt;p&gt;Para aqueles que não conseguem visualizar acima, segue o &lt;a href="https://docs.google.com/presentation/pub?id=1rw8-JpZcdj-g9UXh6oCJ0WI9ZjqdkouAw2wFx8um5rM&amp;amp;start=false&amp;amp;loop=false&amp;amp;delayms=3000"&gt;link
direto&lt;/a&gt;
para a&amp;nbsp;apresentação.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="android"></category><category term="Linux"></category><category term="open source"></category><category term="profusion"></category></entry><entry><title>LinuxCon Brazil</title><link href="https://politreco.com/2011/11/linuxcon-brazil/" rel="alternate"></link><published>2011-11-19T21:54:00-08:00</published><updated>2011-11-19T21:54:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-11-19:/2011/11/linuxcon-brazil/</id><summary type="html">&lt;p&gt;I&amp;#8217;m back from LinuxCon Brazil, that was held in Sao Paulo on 17 and 18
November. Before the first keynote, ProFUSION was announced as
becoming member of Linux Foundation :-)! Our logo is already in their
&lt;a href="http://www.linuxfoundation.org/about/members"&gt;members page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It was also a great time to talk again to some developers I met in
LinuxCon Europe last month and some that were not present there. One
talk I really like was given by Eugeni Dodonov about the Intel Linux
Graphics stack. It was a good overview of all the graphics stack in
Linux, paying attention to Intel&amp;#8217;s boards and drivers …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m back from LinuxCon Brazil, that was held in Sao Paulo on 17 and 18
November. Before the first keynote, ProFUSION was announced as
becoming member of Linux Foundation :-)! Our logo is already in their
&lt;a href="http://www.linuxfoundation.org/about/members"&gt;members page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It was also a great time to talk again to some developers I met in
LinuxCon Europe last month and some that were not present there. One
talk I really like was given by Eugeni Dodonov about the Intel Linux
Graphics stack. It was a good overview of all the graphics stack in
Linux, paying attention to Intel&amp;#8217;s boards and drivers. Gustavo Barbieri
talked about &lt;span class="caps"&gt;HTML5&lt;/span&gt; and WebKit and other 2 ProFUSION&amp;#8217;s employees &amp;#8212;
Rafael Antognolli and Bruno Dilly &amp;#8212; presented &amp;#8220;Application Development
using Enlightenment Foundation (&lt;span class="caps"&gt;EFL&lt;/span&gt;)&amp;#8221;&lt;/p&gt;
&lt;p&gt;This time I also gave a presentation entitled &amp;#8220;How to become an open
source developer&amp;#8221;. My focus was on the Brazilian crowd out there,
willing to start to contribute to open source projects, looking for a
job or just trying to understand why we do open source development. I
hope it was useful for them and for you reading this blog, too. So,
below are the slides of my&amp;nbsp;presentation:&lt;/p&gt;
&lt;iframe src="http://docs.google.com/gview?url=https://politreco.com/files/presentation-linuxcon-brasil-2011.pdf&amp;amp;embedded=true" style="width:640px; height:480px;" frameborder="0"&gt;&lt;/iframe&gt;

&lt;p&gt;For those of you who can not see the file embedded above or want the
direct link, &lt;a href="https://politreco.com/files/presentation-linuxcon-brasil-2011.pdf" title="How to become an open source developer"&gt;here it&amp;#8217;s in &lt;span class="caps"&gt;PDF&lt;/span&gt;
format&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I also talked to some important people regarding a new project of mine.
Stay tuned for a new library&amp;nbsp;soon.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>Back from Kernel Summit, LinuxCon Europe and ELCE</title><link href="https://politreco.com/2011/11/back-from-kernel-summit-linuxcon-europe-and-elce/" rel="alternate"></link><published>2011-11-04T00:20:00-07:00</published><updated>2011-11-04T00:20:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-11-04:/2011/11/back-from-kernel-summit-linuxcon-europe-and-elce/</id><summary type="html">&lt;p&gt;Last week from 23-Oct to 28-Oct I was at 3 conferences in
Prague, Czech Republic, together with Gustavo Barbieri, Gustavo Padovan
and Ulisses Furquim: the ProFUSION crew in&amp;nbsp;Prague.&lt;/p&gt;
&lt;p&gt;Starting from Kernel Summit, I had the opportunity to join the Bluetooth
Summit and participate in the discussions regarding this subsystem in
Linux, both in kernel and user space. We had a lot of hot topics to
discuss, including the upcoming BlueZ 5.0, Bluetooth 3.0 (high speed),
Bluetooth 4.0 (low energy) and I could also demonstrate the work I&amp;#8217;ve
been doing with the &lt;span class="caps"&gt;AVRCP&lt;/span&gt; profile. I&amp;#8217;m …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week from 23-Oct to 28-Oct I was at 3 conferences in
Prague, Czech Republic, together with Gustavo Barbieri, Gustavo Padovan
and Ulisses Furquim: the ProFUSION crew in&amp;nbsp;Prague.&lt;/p&gt;
&lt;p&gt;Starting from Kernel Summit, I had the opportunity to join the Bluetooth
Summit and participate in the discussions regarding this subsystem in
Linux, both in kernel and user space. We had a lot of hot topics to
discuss, including the upcoming BlueZ 5.0, Bluetooth 3.0 (high speed),
Bluetooth 4.0 (low energy) and I could also demonstrate the work I&amp;#8217;ve
been doing with the &lt;span class="caps"&gt;AVRCP&lt;/span&gt; profile. I&amp;#8217;m glad it received a good
acceptance from other developers. Some of them I didn&amp;#8217;t know personally
such as Luiz von Dentz, Claudio Takahasi, Vinicius Gomes. Others I had
the pleasure to meet again like Marcel Holtmann and Johan&amp;nbsp;Hedberg.&lt;/p&gt;
&lt;p&gt;(We didn&amp;#8217;t discuss only bluetooth related things. We noticed that more
than 1/3 of the people there, working in the core of Bluetooth in Linux,
was Brazilian and soon we were discussing with Samuel Ortis - a French,
maintainer of ConnMan - who is the best soccer player&amp;nbsp;:-).)&lt;/p&gt;
&lt;p&gt;Daniel Wagner from &lt;span class="caps"&gt;BMW&lt;/span&gt; also brought up some interesting scenarios of
multiple devices connected through Bluetooth in car kits and helmets
(&lt;a href="http://www.ultimatemotorcycling.com/BMW_Sport_Helmet_Bluetooth"&gt;like this
one&lt;/a&gt;):
&lt;span class="caps"&gt;HFP&lt;/span&gt;, &lt;span class="caps"&gt;A2DP&lt;/span&gt;, &lt;span class="caps"&gt;HSP&lt;/span&gt; (and maybe also &lt;span class="caps"&gt;AVRCP&lt;/span&gt;?). All of them interacting and
working together at the same time. Since the gstreamer conference was
also taking place at the same facility we could also discuss with
PulseAudio developers. In the end, it seems BlueZ and PulseAudio are
working pretty well together, though we still have to polish some rough
edges for some use cases like&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;Being at Kernel Summit was a great time to meet developers of other
parts of the kernel too, such as Steven Rostetd and Peter Zylstra, with
whom I had more contact some time ago when I was working in the Linux&amp;nbsp;scheduler.&lt;/p&gt;
&lt;p&gt;When the Kernel Summit was over (on Tuesday), LinuxCon and &lt;span class="caps"&gt;ELCE&lt;/span&gt; were
taking off. It was great to have once more these two
conferences collocated and being able to attend talks on both of them.
There were several talks I&amp;#8217;d like to attend but some of them
were overlapping. ~~I&amp;#8217;m looking forward to see the recorded talks later
this year~~[1]. It would be too extensive to detail each one here, so
I&amp;#8217;m just detailing some of them that grabbed more attention from&amp;nbsp;me.&lt;/p&gt;
&lt;p&gt;Gustavo Barbieri and Sulamita Garcia talked about &lt;strong&gt;Demistifying &lt;span class="caps"&gt;HTML5&lt;/span&gt;&lt;/strong&gt;
and how it can be used to develop Apps. Gustavo focused on the &lt;span class="caps"&gt;EFL&lt;/span&gt; port
of WebKit (in which I&amp;#8217;m one of the developers ;-)) and the underlying
technologies. It seems like the mentality of &amp;#8220;let&amp;#8217;s do apps in a very
high-level language&amp;#8221; instead of &amp;#8220;providing a native language in a sdk&amp;#8221;
is coming back. Differently from what happened some years ago, this time
maybe it will work out. Only future will show&amp;nbsp;us.&lt;/p&gt;
&lt;p&gt;Since this year I got involved with Android and development of the
platform, I went to several Android-related talks. &lt;strong&gt;Leveraging
Android&amp;#8217;s Linux Heritage&lt;/strong&gt; was really good stuff, showing how to replace
some parts of the Android platform: bash instead of the
I-wanna-be-a-shell that comes with Android by default, putting gstreamer
in, optimizing some parts of the code, etc. In the same tune there was
another talk entitled &lt;strong&gt;Build Community Android Distribution and Ensure
the Quality&lt;/strong&gt;. Interesting (but not surprising) to see how hard is to
contribute to &lt;span class="caps"&gt;AOSP&lt;/span&gt; and how Android is much different from other open
source projects we are used&amp;nbsp;to.&lt;/p&gt;
&lt;p&gt;Another interrelated areas that I have interest in (maybe because I work
for a company related to embedded systems :-)) are system
initialization, fast boot and development boards (such as Pandaboard).
Therefore I attended&lt;strong&gt; systemd Administration in the
Enterprise&lt;/strong&gt; and&lt;strong&gt; Integrating systemd: Booting Userspace in Less Than 1
Second&lt;/strong&gt;. The former, given by Lennart and Kay, focused on detailing
some systemd features for guys running enterprise servers while in the
latter Koen told us about his experience reducing boot time by using
systemd in a Pandaboard. In this last talk I also met Jean Christophe,
one of the developers of barebox (a bootloader aiming to replace
U-Boot). Last time I checked, pandaboard was not in the list of
supported boards but I was greatly surprised that now it is. Barebox has
the advantages of running with caches enabled, having an architecture
much more beautiful and being much faster than u-boot. In summary, &lt;span class="caps"&gt;IMHO&lt;/span&gt;
it&amp;#8217;s a bootloader done&amp;nbsp;right.&lt;/p&gt;
&lt;p&gt;Other interesting talk was &lt;strong&gt;Tuning Linux For Embedded Systems: When
Less is More&lt;/strong&gt;, in which Darren Hart gave instructions to reduce boot
time and image size in very resource constrained scenarios (he was
aiming a rootfs of only &lt;span class="caps"&gt;4MB&lt;/span&gt; and total boot time under a second). Some
key things to know is how to investigate what is not important to the
application, what can be removed from kernel/userspace in order to fit
the requirements and when to replace, why to replace and what to
replace. Last but not least, in &lt;strong&gt;Developing Embedded Linux Devices
Using the Yocto Project and What’s new in 1.1&lt;/strong&gt; David Stewart gave a
&lt;em&gt;status quo&lt;/em&gt; of the Yocto project. Interesting how the project evolved
over this year and next time someone doing embedded systems think about
ruling out its own distro from scratch, it would be good to look at&amp;nbsp;Yocto.&lt;/p&gt;
&lt;p&gt;I met a lot of other people for whom I apologize not citing their name
here. This post would be yet bigger than it already is. I had a really
great time their and I hope to continue going to these conferences. And
the next one is &lt;a href="https://events.linuxfoundation.org/events/linuxcon-brazil"&gt;LinuxCon
Brazil&lt;/a&gt;, in
which I&amp;#8217;ll talk about &lt;a href="https://events.linuxfoundation.org/events/linuxcon-brazil/marchi"&gt;How to Become an Open Source
Developer&lt;/a&gt;.
I look forward to seeing all of you&amp;nbsp;there.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to thank the Linux Foundation for organizing such a great event
and ProFUSION to allowing and sponsoring me to be&amp;nbsp;there.&lt;/p&gt;
&lt;p&gt;Side note: the problem is that now I want to do a lot of things in
different projects without having time to to: systemd, Linux kernel,
BlueZ, pandaboard, barebox, Android, etc&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;[1] &lt;span class="caps"&gt;UPDATE&lt;/span&gt;: videos have been published
- &lt;a href="http://free-electrons.com/blog/elce-2011-videos/"&gt;http://free-electrons.com/blog/elce-2011-videos/&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>AVRCP 1.3 on BlueZ</title><link href="https://politreco.com/2011/10/avrcp-1-3-on-bluez/" rel="alternate"></link><published>2011-10-11T21:42:00-07:00</published><updated>2011-10-11T21:42:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-10-11:/2011/10/avrcp-1-3-on-bluez/</id><summary type="html">&lt;p&gt;During the past weeks I&amp;#8217;ve been working again on the
&lt;a href="http://www.bluez.org/"&gt;BlueZ&lt;/a&gt; project and now we can finally announce
that the &lt;span class="caps"&gt;AVRCP&lt;/span&gt; 1.3 profile is officially&amp;nbsp;supported.&lt;/p&gt;
&lt;h2 id="technical-background"&gt;Technical&amp;nbsp;background&lt;/h2&gt;
&lt;p&gt;For those who don&amp;#8217;t know what I&amp;#8217;m talking about, here comes a little
background for those&amp;nbsp;buzzwords:&lt;/p&gt;
&lt;p&gt;BlueZ is the user-space part of the Bluetooth® technology stack used on
Linux and Android. It has support for several Bluetooth profiles such as
&lt;span class="caps"&gt;RFCOMM&lt;/span&gt;, &lt;span class="caps"&gt;HID&lt;/span&gt;, &lt;span class="caps"&gt;PAN&lt;/span&gt;, &lt;span class="caps"&gt;PBAP&lt;/span&gt;, &lt;span class="caps"&gt;OBEX&lt;/span&gt;, &lt;span class="caps"&gt;HFP&lt;/span&gt;, &lt;span class="caps"&gt;A2DP&lt;/span&gt; (some of them are implemented as
separate projects) that are defined by the &lt;a href="https://www.bluetooth.org"&gt;Bluetooh
&lt;span class="caps"&gt;SIG&lt;/span&gt;&lt;/a&gt;. In simpler terms, BlueZ is …&lt;/p&gt;</summary><content type="html">&lt;p&gt;During the past weeks I&amp;#8217;ve been working again on the
&lt;a href="http://www.bluez.org/"&gt;BlueZ&lt;/a&gt; project and now we can finally announce
that the &lt;span class="caps"&gt;AVRCP&lt;/span&gt; 1.3 profile is officially&amp;nbsp;supported.&lt;/p&gt;
&lt;h2 id="technical-background"&gt;Technical&amp;nbsp;background&lt;/h2&gt;
&lt;p&gt;For those who don&amp;#8217;t know what I&amp;#8217;m talking about, here comes a little
background for those&amp;nbsp;buzzwords:&lt;/p&gt;
&lt;p&gt;BlueZ is the user-space part of the Bluetooth® technology stack used on
Linux and Android. It has support for several Bluetooth profiles such as
&lt;span class="caps"&gt;RFCOMM&lt;/span&gt;, &lt;span class="caps"&gt;HID&lt;/span&gt;, &lt;span class="caps"&gt;PAN&lt;/span&gt;, &lt;span class="caps"&gt;PBAP&lt;/span&gt;, &lt;span class="caps"&gt;OBEX&lt;/span&gt;, &lt;span class="caps"&gt;HFP&lt;/span&gt;, &lt;span class="caps"&gt;A2DP&lt;/span&gt; (some of them are implemented as
separate projects) that are defined by the &lt;a href="https://www.bluetooth.org"&gt;Bluetooh
&lt;span class="caps"&gt;SIG&lt;/span&gt;&lt;/a&gt;. In simpler terms, BlueZ is what allows
your Linux device to do amazing things with Bluetooth technology such as
stream stereo music, make phone calls and other wireless&amp;nbsp;magics.&lt;/p&gt;
&lt;p&gt;One of these profiles supported by BlueZ is &lt;span class="caps"&gt;AVRCP&lt;/span&gt; (Audio/Video Remote
Control Profile), which allows two devices to communicate through
Bluetooth technology and exchange commands/messages to control the
music/video being&amp;nbsp;played.&lt;/p&gt;
&lt;h2 id="new-features"&gt;New&amp;nbsp;features&lt;/h2&gt;
&lt;p&gt;Until some weeks ago BlueZ only had support for version 1.0 of the &lt;span class="caps"&gt;AVRCP&lt;/span&gt;
protocol. This early version allows a Controller device (e.g. a
Bluetooth technology-based car kit) to tell the Target device (e.g. a
smartphone) to play, pause, go to next music and go to previous music.
We&amp;#8217;ve now upstreamed an implementation of &lt;span class="caps"&gt;AVRCP&lt;/span&gt; Version 1.3, which
adds some nice features to the previously supported version, such&amp;nbsp;as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transmitting metadata of the music being&amp;nbsp;played;&lt;/li&gt;
&lt;li&gt;Change Application Settings such as Equalizer, Repeat, Shuffle and
    Scan&amp;nbsp;modes;&lt;/li&gt;
&lt;li&gt;Set current status of media playback: playing, stopped, paused,
    forward-seeking,&amp;nbsp;reverse-seeking.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some time ago I bought a Bluetooth stereo car kit. How boring it was
having the ability to stream music from my phone but not see any
information regarding who was playing, which album, etc. This is no
more. Now we have proper support for &lt;span class="caps"&gt;AVRCP&lt;/span&gt; 1.3 :-).
Our &lt;a href="http://profusion.mobi" title="ProFUSION embedded systems"&gt;ProFUSION&lt;/a&gt; team
utilized the open source baseport for the &lt;span class="caps"&gt;OMAP&lt;/span&gt;™ processor-based Blaze™
mobile development platform from Texas Instruments Incorporated (&lt;span class="caps"&gt;TI&lt;/span&gt;) to
help achieve this milestone. Additionally, we worked together with &lt;span class="caps"&gt;TI&lt;/span&gt; on
testing and debugging to make this &lt;span class="caps"&gt;AVRCP&lt;/span&gt; 1.3 support a reality. Below
you can see yours truly holding a Blaze™ mobile development platform
from &lt;span class="caps"&gt;TI&lt;/span&gt;, sending music metadata to a Bluetooth technology-enabled car&amp;nbsp;kit.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/09/android_ti_avrcp_13.jpg"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/09/android_ti_avrcp_13.jpg" title="android_ti_avrcp_13" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Bluetooth"></category><category term="kernel"></category><category term="Linux"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: codespell 1.2</title><link href="https://politreco.com/2011/09/announce-codespell-1-2/" rel="alternate"></link><published>2011-09-30T17:24:00-07:00</published><updated>2011-09-30T17:24:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-09-30:/2011/09/announce-codespell-1-2/</id><summary type="html">&lt;p&gt;Since I created a mailing list for codespell, the announcements here
will not have as many details as before. Checkout the new version of
codespell: &lt;a href="http://groups.google.com/group/codespell/browse_thread/thread/bce1a6f83d4bbd85"&gt;http://groups.google.com/group/codespell/browse_thread/thread/bce1a6f83d4bbd85&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;One of the issues I with codespell was that it was trying to parse
cscope.out, since it&amp;#8217;s a text file. On Linux Kernel this file can get
very big and besides taking much longer, sometimes it was running out of
memory :-). Now codespell has an option to ignore files, even text ones.
It&amp;#8217;s as easy as passing &lt;strong&gt;&amp;#8212;skip=&amp;#8221;*.eps,cscope.out&amp;#8221;&lt;/strong&gt; (notice this …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Since I created a mailing list for codespell, the announcements here
will not have as many details as before. Checkout the new version of
codespell: &lt;a href="http://groups.google.com/group/codespell/browse_thread/thread/bce1a6f83d4bbd85"&gt;http://groups.google.com/group/codespell/browse_thread/thread/bce1a6f83d4bbd85&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;One of the issues I with codespell was that it was trying to parse
cscope.out, since it&amp;#8217;s a text file. On Linux Kernel this file can get
very big and besides taking much longer, sometimes it was running out of
memory :-). Now codespell has an option to ignore files, even text ones.
It&amp;#8217;s as easy as passing &lt;strong&gt;&amp;#8212;skip=&amp;#8221;*.eps,cscope.out&amp;#8221;&lt;/strong&gt; (notice this is
useful for ignoring eps images too). Another useful thing (not much for
Linux Kernel though) is proper detection of encoding by using&amp;nbsp;chardet.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="codespell"></category><category term="kernel"></category><category term="profusion"></category></entry><entry><title>Attending AI classes</title><link href="https://politreco.com/2011/09/attending-ai-classes/" rel="alternate"></link><published>2011-09-21T05:30:00-07:00</published><updated>2011-09-21T05:30:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-09-21:/2011/09/attending-ai-classes/</id><summary type="html">&lt;p&gt;For those who didn&amp;#8217;t know, Stanford is offering some online courses,
starting from next month. During my graduation I already have some &lt;span class="caps"&gt;AI&lt;/span&gt;
classes but I thought it would be interesting to participate in this
class with thousand of&amp;nbsp;students.&lt;/p&gt;
&lt;p&gt;One area that I like on &lt;span class="caps"&gt;AI&lt;/span&gt; is the on to teach computers how to play
games. I like that so much that during my &lt;span class="caps"&gt;AI&lt;/span&gt; classes in Politecnico di
Milano I developed a computer game to play tic-tac-toe in NxNxN
dimensions. It&amp;#8217;s actually fun to play, and you can find some screenshots
(and the code) on &lt;a href="https://politreco.com/2009/07/trissa-3d-is-arriving/"&gt;a …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;For those who didn&amp;#8217;t know, Stanford is offering some online courses,
starting from next month. During my graduation I already have some &lt;span class="caps"&gt;AI&lt;/span&gt;
classes but I thought it would be interesting to participate in this
class with thousand of&amp;nbsp;students.&lt;/p&gt;
&lt;p&gt;One area that I like on &lt;span class="caps"&gt;AI&lt;/span&gt; is the on to teach computers how to play
games. I like that so much that during my &lt;span class="caps"&gt;AI&lt;/span&gt; classes in Politecnico di
Milano I developed a computer game to play tic-tac-toe in NxNxN
dimensions. It&amp;#8217;s actually fun to play, and you can find some screenshots
(and the code) on &lt;a href="https://politreco.com/2009/07/trissa-3d-is-arriving/"&gt;a past blog
post&lt;/a&gt;. I didn&amp;#8217;t
have time to continue maintaining it, but the part that I liked more was
actually designing the algorithm, using
&lt;a href="http://en.wikipedia.org/wiki/Minimax"&gt;MinMax&lt;/a&gt;, and eventually finding
out that I couldn&amp;#8217;t win the game anymore when playing against the
computer. This was both motivating and demotivating because I knew that
if I did developed it right, I couldn&amp;#8217;t possibly win anymore. Maybe I&amp;#8217;ll
update this project when I have some time. If you would like to try it
and find any problem, send me a patch and I will happily apply. If you
think you have a better algorithm, it&amp;#8217;s very easy to develop your own
Player and plug it in the game. I challenge you to win my MinMax player&amp;nbsp;;-).&lt;/p&gt;
&lt;p&gt;During the time I was developing this game, a friend of mine that lived
with me in Italy had a dream of making money playing poker. Because of
this he was attending the &lt;span class="caps"&gt;AI&lt;/span&gt; classes too and eventually playing online
to develop his strategies (in sites such as
&lt;a href="http://pt.partypoker.com/"&gt;partypoker&lt;/a&gt;). It was very fun talking to him
and his plans and strategies, though I don&amp;#8217;t know if he&amp;nbsp;succeeded.&lt;/p&gt;
&lt;p&gt;Even if you frequented some &lt;span class="caps"&gt;AI&lt;/span&gt; class before like me and my friend, I
think it will be very interesting to participate on this one. If you
didn&amp;#8217;t register yet, you still have some time: go
to &lt;a href="http://www.ai-class.com/"&gt;http://www.ai-class.com&lt;/a&gt; and&amp;nbsp;subscribe.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Seminário de Linux Embarcado 2011</title><link href="https://politreco.com/2011/08/seminario-de-linux-embarcado-2011/" rel="alternate"></link><published>2011-08-10T20:30:00-07:00</published><updated>2011-08-10T20:30:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-08-10:/2011/08/seminario-de-linux-embarcado-2011/</id><content type="html">&lt;p&gt;No último final de semana participei do &lt;a href="http://www.temporealeventos.com.br/?area=175-seminario-tempo-real-eventos-e-portal-embarcados-linux-embarcado-Conceitos-ferramentas-de-desenvolvimento-e-novas-tendencias-sobre-a-utilizacao-de-Linux-em-sistemas-embarcados"&gt;Seminário de Linux
Embarcado&lt;/a&gt;,
em que palestrei sobre &amp;#8220;systemd: repensando a inicialização&amp;#8221;. O feedback
que tive do pessoal foi positivo, mostrando bastante interesse nos
diversos tipos de inicialização sob demanda, exclusivos desse sistema de
init. &lt;a href="https://politreco.com/files/2011_sem_linux_embarcado.pdf"&gt;Os slides estão disponíveis aqui no
blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Gostei bastante do evento, que teve também participação do Antognolli,
que trabalha comigo, sobre interfaces gráficas em sistemas embarcados
usando o conjunto de bibliotecas &lt;span class="caps"&gt;EFL&lt;/span&gt;. Outro conhecido meu de outras
conferências, Glauber Costa, falou sobre &lt;span class="caps"&gt;QEMU&lt;/span&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="profusion"></category></entry><entry><title>codespell 1.1</title><link href="https://politreco.com/2011/06/codespell-1-1/" rel="alternate"></link><published>2011-06-18T20:32:00-07:00</published><updated>2011-06-18T20:32:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-06-18:/2011/06/codespell-1-1/</id><content type="html">&lt;p&gt;codespell 1.1 is just&amp;nbsp;released.&lt;/p&gt;
&lt;p&gt;Since I was receiving emails about bugs and suggestions I decided to
create a mailing list. Check out the &lt;a href="http://groups.google.com/group/codespell/browse_thread/thread/4e57635b4099e089"&gt;announcement of
v1.1&lt;/a&gt;&amp;nbsp;there.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="announce"></category><category term="codespell"></category><category term="profusion"></category></entry><entry><title>Benchmarking Javascript engines for EFL</title><link href="https://politreco.com/2011/06/benchmarking-javascript-engines-for-efl/" rel="alternate"></link><published>2011-06-14T19:25:00-07:00</published><updated>2011-06-14T19:25:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-06-14:/2011/06/benchmarking-javascript-engines-for-efl/</id><summary type="html">&lt;p&gt;The Enlightenment Foundation Libraries has several bindings for other
languages in order to ease the creation of end-user applications,
speeding up its development. Among them, there’s a binding for
Javascript using the Spidermonkey engine. The questions are: is it fast
enough? Does it slowdown your application? Is Spidermonkey the best &lt;span class="caps"&gt;JS&lt;/span&gt;
engine to be&amp;nbsp;used?&lt;/p&gt;
&lt;p&gt;To answer these questions &lt;a href="http://blog.gustavobarbieri.com.br/"&gt;Gustavo
Barbieri&lt;/a&gt;created some C, &lt;span class="caps"&gt;JS&lt;/span&gt; and
Python benchmarks to compare the performance of &lt;span class="caps"&gt;EFL&lt;/span&gt; using each of these
languages. The &lt;span class="caps"&gt;JS&lt;/span&gt; benchmarks were using Spidermonkey as the engine since
elixir was already done for &lt;span class="caps"&gt;EFL&lt;/span&gt;. I then created new …&lt;/p&gt;</summary><content type="html">&lt;p&gt;The Enlightenment Foundation Libraries has several bindings for other
languages in order to ease the creation of end-user applications,
speeding up its development. Among them, there’s a binding for
Javascript using the Spidermonkey engine. The questions are: is it fast
enough? Does it slowdown your application? Is Spidermonkey the best &lt;span class="caps"&gt;JS&lt;/span&gt;
engine to be&amp;nbsp;used?&lt;/p&gt;
&lt;p&gt;To answer these questions &lt;a href="http://blog.gustavobarbieri.com.br/"&gt;Gustavo
Barbieri&lt;/a&gt;created some C, &lt;span class="caps"&gt;JS&lt;/span&gt; and
Python benchmarks to compare the performance of &lt;span class="caps"&gt;EFL&lt;/span&gt; using each of these
languages. The &lt;span class="caps"&gt;JS&lt;/span&gt; benchmarks were using Spidermonkey as the engine since
elixir was already done for &lt;span class="caps"&gt;EFL&lt;/span&gt;. I then created new engines (with only
the necessary functions) to also compare to other well-known &lt;span class="caps"&gt;JS&lt;/span&gt; engines:
V8 from Google and &lt;span class="caps"&gt;JSC&lt;/span&gt; (or nitro) from&amp;nbsp;WebKit.&lt;/p&gt;
&lt;h2 id="libraries-setup"&gt;Libraries&amp;nbsp;setup&lt;/h2&gt;
&lt;p&gt;For all benchmarks &lt;span class="caps"&gt;EFL&lt;/span&gt; revision 58186 was used. Following the setup of
each&amp;nbsp;engine:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Spidermonkey: I&amp;#8217;ve used version 1.8.1-rc1 with the already available
    bindings on &lt;span class="caps"&gt;EFL&lt;/span&gt; repository,&amp;nbsp;elixir;&lt;/li&gt;
&lt;li&gt;V8: version ﻿3.2.5.1, using a simple binding I created for &lt;span class="caps"&gt;EFL&lt;/span&gt;. I
    named this binding&amp;nbsp;ev8;&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;JSC&lt;/span&gt;: ﻿WebKit&amp;#8217;s sources are needed to compile &lt;span class="caps"&gt;JSC&lt;/span&gt;. I&amp;#8217;ve
    used revision 83063. &lt;a href="http://trac.webkit.org/wiki/EFLWebKit"&gt;Compiling with
    CMake&lt;/a&gt;, I chose the &lt;span class="caps"&gt;EFL&lt;/span&gt; port
    and enabled the option SHARED_CORE in order to have a separated
    library for&amp;nbsp;Javascript;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="benchmarks"&gt;Benchmarks&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Startup time:&lt;/strong&gt; This benchmark measures the startup time by executing
a simple application that imports evas, ecore, ecore-evas and edje,
bring in some symbols and then iterates the main loop once before
exiting. I measured the startup time for both hot and cold cache cases.
In the former the application is executed several times in sequence and
the latter includes a call to drop all caches so we have to load the
library again from&amp;nbsp;disk&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Runtime - Stress:&lt;/strong&gt; This benchmark executes as many frames per second
as possible of a render-intensive operation. The application is not so
heavy, but it does some loops, math and interacts with &lt;span class="caps"&gt;EFL&lt;/span&gt;. Usually a
common application would do far less operations every frame because many
operations are done in &lt;span class="caps"&gt;EFL&lt;/span&gt; itself, in C, such as list scrolling that is
done entirely in elm_genlist. This benchmark is made of 4&amp;nbsp;phases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;﻿Phase 0 (P0): Un-scaled blend of the same image 16&amp;nbsp;times;&lt;/li&gt;
&lt;li&gt;Phase 1 (P1): Same as P0, with additional 50%&amp;nbsp;alpha;&lt;/li&gt;
&lt;li&gt;Phase 2 (P2): Same as P0, with additional red&amp;nbsp;coloring;&lt;/li&gt;
&lt;li&gt;Phase 3 (P3): Same as P0, with additional 50% alpha and red&amp;nbsp;coloring;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The
&lt;a href="http://trac.enlightenment.org/e/browser/trunk/BINDINGS/javascript/elixir/src/tests/evas-bench.c"&gt;C&lt;/a&gt;
and
&lt;a href="http://trac.enlightenment.org/e/browser/trunk/BINDINGS/javascript/elixir/src/tests/evas-bench.js"&gt;Elixir&amp;#8217;s&lt;/a&gt;
versions are available at &lt;span class="caps"&gt;EFL&lt;/span&gt;&amp;nbsp;repository.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Runtime - animation:&lt;/strong&gt; usually an application doesn&amp;#8217;t need &amp;#8220;as many
&lt;span class="caps"&gt;FPS&lt;/span&gt; as possible&amp;#8221;, but instead it would like to limit to a certain amount
of frames per second. E.g.: iphone&amp;#8217;s browser tries to keep a constant of
60 &lt;span class="caps"&gt;FPS&lt;/span&gt;. This is the value I used on this benchmark. The same application
as the previous benchmark is executed, but it tries to keep always the
same&amp;nbsp;frame-rate.&lt;/p&gt;
&lt;h2 id="results"&gt;Results&lt;/h2&gt;
&lt;p&gt;The first computer I used to test these benchmarks on was my laptop.
It&amp;#8217;s a Dell Vostro 1320, Intel Core 2 Duo with 4 &lt;span class="caps"&gt;GB&lt;/span&gt; of &lt;span class="caps"&gt;RAM&lt;/span&gt; and a
standard 5400 &lt;span class="caps"&gt;RPM&lt;/span&gt; disk. The results are&amp;nbsp;below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Benchmarks on Dell 1320 laptop" src="https://politreco.com/wp-content/uploads/2011/06/bench-dell.png" /&gt;&lt;/p&gt;
&lt;p&gt;First thing to notice is there are no results for &amp;#8220;Runtime - animation&amp;#8221;
benchmark. This is because all the engines kept a constant of 60fps and
hence there were no interesting results to show. The first benchmark
shows that V8&amp;#8217;s startup time is the shortest one when considering we
have to load the application and libraries from disk. &lt;span class="caps"&gt;JSC&lt;/span&gt; was the
slowest and  Spidermonkey was in&amp;nbsp;between.&lt;/p&gt;
&lt;p&gt;With hot caches, however, we have another complete different scenario,
with &lt;span class="caps"&gt;JSC&lt;/span&gt; being almost as fast as the native C application. Following, V8
with a delay a bit larger and Spidermonkey as the slowest&amp;nbsp;one.&lt;/p&gt;
&lt;p&gt;The runtime-stress benchmark shows that all the engines are performing
well when there&amp;#8217;s some considerable load in the application, i.e.
removing P0 from from this scenario. &lt;span class="caps"&gt;JSC&lt;/span&gt; was always at the same speed of
native code; Spidermonkey and V8 had an impact only when considering P0&amp;nbsp;alone.&lt;/p&gt;
&lt;p&gt;Next computer to consider in order to execute these benchmarks was  a
Pandaboard, so we can see how well the engines are performing in an
embedded platform. Pandaboard has an &lt;span class="caps"&gt;ARM&lt;/span&gt; Cortex-A9 processor with &lt;span class="caps"&gt;1GB&lt;/span&gt; of
&lt;span class="caps"&gt;RAM&lt;/span&gt; and the partition containing the benchmarks is in an external flash
storage drive. Following the results for each&amp;nbsp;benchmark:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Benchmarks on Pandaboard" src="https://politreco.com/wp-content/uploads/2011/06/bench-panda.png" /&gt;&lt;/p&gt;
&lt;p&gt;Once again, runtime-animation is not shown since it had the same results
for all engines. For the startup tests, now Spidermonkey was much faster
than the others, followed by V8 and &lt;span class="caps"&gt;JSC&lt;/span&gt; in both hot and cold caches. In
runtime-stress benchmark, all the engines performed well, as in the
first computer, but now &lt;span class="caps"&gt;JSC&lt;/span&gt; was the clear&amp;nbsp;winner.&lt;/p&gt;
&lt;p&gt;There are several points to be considered when choosing an engine to be
use as a binding for a library such as &lt;span class="caps"&gt;EFL&lt;/span&gt;. The raw performance and
startup time seems to be very near to the ones achieved with native
code. Recently there were &lt;a href="http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg33016.html"&gt;some discussions in &lt;span class="caps"&gt;EFL&lt;/span&gt; mailing
list&lt;/a&gt;
regarding which engine to choose, so I think it would be good to share
these numbers above. It&amp;#8217;s also important to notice that these bindings
have a similar approach of elixir, mapping each function call in
Javascript to the correspondent native function. I made this to be fair
in the comparison among them, but depending on the use-case it&amp;#8217;d  be
good to have a &lt;span class="caps"&gt;JS&lt;/span&gt; binding similar to what python&amp;#8217;s did, embedding the
function call in real python&amp;nbsp;objects.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="EFL"></category><category term="Javascript"></category><category term="profusion"></category><category term="webkit"></category></entry><entry><title>ESC Brazil - Realtime Linux with RT_PREEMPT</title><link href="https://politreco.com/2011/06/esc-brazil-realtime-linux-with-rt_preempt/" rel="alternate"></link><published>2011-06-03T20:34:00-07:00</published><updated>2011-06-03T20:34:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-06-03:/2011/06/esc-brazil-realtime-linux-with-rt_preempt/</id><content type="html">&lt;p&gt;Two weeks ago &lt;a href="http://www.escbrazil.com.br/index.php?canal=conferencias&amp;amp;pgID=100511-190927-0c941272"&gt;I&amp;#8217;d give a
talk&lt;/a&gt;
about realtime Linux at &lt;span class="caps"&gt;ESC&lt;/span&gt; Brazil: &amp;#8220;Usando Linux como Sistema de Tempo
Real&amp;#8221; (Using Linux as a realtime &lt;span class="caps"&gt;OS&lt;/span&gt;). Sadly some days before while
playing soccer  I broke my fibula and I had to have a surgery. I regret
I couldn&amp;#8217;t attend this&amp;nbsp;conference.&lt;/p&gt;
&lt;p&gt;At least in the company I work for there are more people with knowledge
in this area. &lt;a href="http://blog.gustavobarbieri.com.br/2011/06/02/esc-brazil-realtime-linux-with-rt_preempt/"&gt;Gustavo
Barbieri&lt;/a&gt;
went there in my place and had a &lt;a href="http://www.sergioprado.org/2011/05/25/relato-do-esc-brasil-2011-dia-2/"&gt;good
feedback&lt;/a&gt;
from the&amp;nbsp;attendees.&lt;/p&gt;
&lt;p&gt;Now I have stay home. At least for 1 or 2 months&amp;nbsp;:-(.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="profusion"></category><category term="real-time"></category></entry><entry><title>codespell 1.1-rc1</title><link href="https://politreco.com/2011/06/codespell-1-1-rc1/" rel="alternate"></link><published>2011-06-02T16:30:00-07:00</published><updated>2011-06-02T16:30:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-06-02:/2011/06/codespell-1-1-rc1/</id><summary type="html">&lt;p&gt;I&amp;#8217;m glad to announce the first &lt;span class="caps"&gt;RC&lt;/span&gt; of codespell 1.1. I decided to let the
biggest feature for the next version and release 1.1 with the small but
important features that were already implemented. This new version comes
with the following&amp;nbsp;features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Verbosity level:&lt;/strong&gt; tired of seeing so many things printed while
    the fixes are taking place? Now you can filter what you&amp;nbsp;see&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exclusion list:&lt;/strong&gt; there are cases in which the codespell spots a
    false positive, but disabling the entry in the dictionary will
    prevent it from fixing many other places. This is particularly true
    when …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m glad to announce the first &lt;span class="caps"&gt;RC&lt;/span&gt; of codespell 1.1. I decided to let the
biggest feature for the next version and release 1.1 with the small but
important features that were already implemented. This new version comes
with the following&amp;nbsp;features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Verbosity level:&lt;/strong&gt; tired of seeing so many things printed while
    the fixes are taking place? Now you can filter what you&amp;nbsp;see&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exclusion list:&lt;/strong&gt; there are cases in which the codespell spots a
    false positive, but disabling the entry in the dictionary will
    prevent it from fixing many other places. This is particularly true
    when there are names in source code. In Linux kernel I&amp;#8217;ve seen some
    names with &amp;#8220;Taht&amp;#8221; and &amp;#8220;Teh&amp;#8221; that were incorrectly fixed to &amp;#8220;That&amp;#8221;
    and &amp;#8220;The&amp;#8221;. Now we have a file with lines that are exclude from the
    ones codespell will fix. Hopefully such lines will not change very
    often and we can maintain a file per project for future executions
    of codespell in each project. I&amp;#8217;m maintaining one for the
    Linux kernel. It&amp;#8217;s in&amp;nbsp;data/linux-kernel.exclude.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interactive mode:&lt;/strong&gt; for those fixes that are not done
    automatically (because they have more than one possible fix), now we
    can interactively decide on each one. I recommend for everyone
    interested in this feature to run codespell once without this option
    to fix the automatic ones and another time to go through the
    other&amp;nbsp;fixes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stats (summary) of the changes:&lt;/strong&gt; are you interested how many
    times a word was misspelled? Now codespell can display a summary of
    all the fixes it has&amp;nbsp;done.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I was particularly worried about the increase in runtime when using the
exclusion list. However it proved to be very fast when excluding the
lines by using their hashes. I can successfully parse the entire Linux
kernel tree within 1min30s in my laptop with slow &lt;span class="caps"&gt;HD&lt;/span&gt;. The biggest
feature that I&amp;#8217;ve left for the next version is to allow changes to be
applied only to parts of the source code like comments and strings. I
expect to implement this for a future 1.2&amp;nbsp;version.&lt;/p&gt;
&lt;p&gt;Besides these new features, there are some fixes to the dictionary.
Thanks to all of you who have sent me fixes and suggestions. I&amp;#8217;m glad to
see patches generated by codespell been applied to other opensource
projects that I&amp;#8217;m not the one to send. As of now, I&amp;#8217;ve seen patches been
applied to: Linux Kernel, oFono, ConnMan, FreeBSD, &lt;span class="caps"&gt;LLVM&lt;/span&gt;, clang, &lt;span class="caps"&gt;EFL&lt;/span&gt; and
others that I don&amp;#8217;t remember right&amp;nbsp;now.&lt;/p&gt;
&lt;p&gt;For those who prefer to wait for a stable release, I&amp;#8217;m also releasing
&lt;strong&gt;codespell 1.0.2&lt;/strong&gt; with fixes only to the&amp;nbsp;dictionary.&lt;/p&gt;
&lt;p&gt;As always, you can download codespell packages&amp;nbsp;from:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://packages.profusion.mobi/codespell/"&gt;http://packages.profusion.mobi/codespell/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Repositories are available&amp;nbsp;at:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://git.profusion.mobi/cgit.cgi/lucas/codespell/"&gt;http://git.profusion.mobi/cgit.cgi/lucas/codespell/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/lucasdemarchi/codespell"&gt;https://github.com/lucasdemarchi/codespell&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="codespell"></category><category term="profusion"></category></entry><entry><title>Por uma web melhor e mais segura</title><link href="https://politreco.com/2011/05/por-uma-web-melhor-e-mais-segura/" rel="alternate"></link><published>2011-05-28T01:37:00-07:00</published><updated>2011-05-28T01:37:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-05-28:/2011/05/por-uma-web-melhor-e-mais-segura/</id><summary type="html">&lt;p&gt;Hoje adicionei no site um script para alertar usuários que usam versões
antigas (e inseguras) de browsers. O projeto é o &amp;#8220;Salve a Web, por
favor&amp;#8221;. Ele é opensource e pode ser visto no repositório do
&lt;a href="https://github.com/globocom/sawpf" title="Salve a web, por favor"&gt;github&lt;/a&gt;.
Basta carregar o script com a seguinte entrada na sua&amp;nbsp;página:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://sawpf.com/1.0.js&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Acho que pela própria natureza dos posts no meu blog, a divisão dos
browsers não é parecida com aquela global, em que o Internet Explorer
ainda é o browser mais usado. Porém acho importante alerr os usuários.
Quem sabe poderemos …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Hoje adicionei no site um script para alertar usuários que usam versões
antigas (e inseguras) de browsers. O projeto é o &amp;#8220;Salve a Web, por
favor&amp;#8221;. Ele é opensource e pode ser visto no repositório do
&lt;a href="https://github.com/globocom/sawpf" title="Salve a web, por favor"&gt;github&lt;/a&gt;.
Basta carregar o script com a seguinte entrada na sua&amp;nbsp;página:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://sawpf.com/1.0.js&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Acho que pela própria natureza dos posts no meu blog, a divisão dos
browsers não é parecida com aquela global, em que o Internet Explorer
ainda é o browser mais usado. Porém acho importante alerr os usuários.
Quem sabe poderemos ter uma web melhor e mais segura futuramente? Veja
abaixo as estatísticas de acesso a esse blog no últimoo&amp;nbsp;ano.&lt;/p&gt;
&lt;!---\[caption id="attachment\_467" align="aligncenter" width="611"
caption="Browsers usados no acesso ao
blog"\]--&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/05/browsers-chart.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/05/browsers-chart.png" title="Browsers usados no acesso ao blog" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;!--\[caption id="attachment\_470" align="aligncenter" width="638"
caption="Sistemas Operacionais usados no acesso ao
blog"\]--&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/05/operating-system-chart.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/05/operating-system-chart.png" title="Sistemas Operacionais usados no acesso ao blog" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Os poucos visitantes com browsers antigos que leem esse blog vão ver o
seguinte banner acima (obtido mudando o user agent do Chromium para um
&lt;span class="caps"&gt;IE&lt;/span&gt;&amp;nbsp;6):&lt;/p&gt;
&lt;!--\[caption id="attachment\_481" align="aligncenter" width="644"
caption="Internet Explorer
desatualizado"\]--&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2011/05/ie_desatualizado.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2011/05/ie_desatualizado.png" title="Internet Explorer desatualizado" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;!--\[/caption\]--&gt;&lt;!--\[/caption\]--&gt;&lt;!--\[/caption\]--&gt;</content><category term="Uncategorized"></category></entry><entry><title>Cross-compiling with icecc/icecream</title><link href="https://politreco.com/2011/05/cross-compiling-with-iceccicecream/" rel="alternate"></link><published>2011-05-13T16:28:00-07:00</published><updated>2011-05-13T16:28:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-05-13:/2011/05/cross-compiling-with-iceccicecream/</id><summary type="html">&lt;p&gt;Very common questions I hear when dealing with  compiling open source
projects&amp;nbsp;are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;How do I cross-compile a project using&amp;nbsp;icecc/icecream?&lt;/li&gt;
&lt;li&gt;How to use a different compiler version for compiling my project and
    still benefiting from&amp;nbsp;icecc/icecream?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;Note: from now on I&amp;#8217;ll always refer to icecream instead
icecc/iceccd/distcc for the name of the&amp;nbsp;project.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Given you already created your cross toolchain  (or downloaded from
somewhere else, e.g.  CodeSourcery/Linaro) these two questions are
essentially the same. All you have to do is to follow the two steps&amp;nbsp;below:&lt;/p&gt;
&lt;h3 id="1-create-the-compiler-environment"&gt;1. Create the &amp;#8220;compiler&amp;nbsp;environment&amp;#8221;&lt;/h3&gt;
&lt;p&gt;Understanding …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Very common questions I hear when dealing with  compiling open source
projects&amp;nbsp;are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;How do I cross-compile a project using&amp;nbsp;icecc/icecream?&lt;/li&gt;
&lt;li&gt;How to use a different compiler version for compiling my project and
    still benefiting from&amp;nbsp;icecc/icecream?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;Note: from now on I&amp;#8217;ll always refer to icecream instead
icecc/iceccd/distcc for the name of the&amp;nbsp;project.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Given you already created your cross toolchain  (or downloaded from
somewhere else, e.g.  CodeSourcery/Linaro) these two questions are
essentially the same. All you have to do is to follow the two steps&amp;nbsp;below:&lt;/p&gt;
&lt;h3 id="1-create-the-compiler-environment"&gt;1. Create the &amp;#8220;compiler&amp;nbsp;environment&amp;#8221;&lt;/h3&gt;
&lt;p&gt;Understanding this part is really understanding how this magic
remote-compiling works. When you want to compile a source remotely, what
icecream does is sending a copy of your compiler and the things it needs
to the remote machine, executing the process and getting back the
result. By &amp;#8220;things it needs&amp;#8221; I mean: assembler, linker, libc, libgcc and
some other libraries like libm, libgmp, libstdc++, libz, etc. Creating
this environment with icecream is dead easy: call &amp;#8220;icecc
&amp;#8212;build-native&amp;#8221;. Following is the output I get on my Archlinux box with
gcc 4.6.0 as default&amp;nbsp;compiler:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;icecc&lt;span class="w"&gt; &lt;/span&gt;--build-native
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/gcc
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/lib/libc.so.6
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/lib/ld-linux-x86-64.so.2
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/g++
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/as
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libopcodes-2.21.0.20110430.so
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libbfd-2.21.0.20110430.so
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/lib/libdl.so.2
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libz.so.1
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/cc1&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libcloog-isl.so.1
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libisl.so.6
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libgmp.so.10
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libppl_c.so.4
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libppl.so.9
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libgmpxx.so.4
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libstdc++.so.6
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/lib/libm.so.6
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libgcc_s.so.1
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libpwl.so.5
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libmpc.so.2
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/libmpfr.so.4
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/cc1plus&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/liblto_plugin.so
adding&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;/etc/ld.so.conf&lt;span class="o"&gt;=&lt;/span&gt;/tmp/icecc_ld_so_confPaVA2Q
creating&lt;span class="w"&gt; &lt;/span&gt;6b1d2b44080a004a88c0746fe128172e.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Note that in the last line it created a .tar.gz file. This is the
environment that will be sent to other machines. If you want to use
another compiler, you need to create another environment that will be
later passed to icecream in the second&amp;nbsp;step.&lt;/p&gt;
&lt;p&gt;To create an environment for a compiler that is not the default in your
machine, first thing you need is to have it in your &lt;span class="caps"&gt;PATH&lt;/span&gt;, pointing to
the icecc binary. Here sometimes I use &lt;span class="caps"&gt;GCC&lt;/span&gt; 4.4 instead of the default
compiler, so I&amp;#8217;ll use it as an example. In my machine, &lt;span class="caps"&gt;GCC&lt;/span&gt; 4.4 is
installed in /usr/bin/gcc-4.4 and icecream is installed in&amp;nbsp;/opt/icecream/bin:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;which&lt;span class="w"&gt; &lt;/span&gt;gcc-4.4
/usr/bin/gcc-4.4
$&lt;span class="w"&gt; &lt;/span&gt;which&lt;span class="w"&gt; &lt;/span&gt;icecc
/opt/icecream/bin/icecc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Go to where icecc is installed and make a symlink to icecc with the same
name of the compiler you want to&amp;nbsp;use:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;ln&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;icecc&lt;span class="w"&gt; &lt;/span&gt;gcc-4.4
$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;ln&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;icecc&lt;span class="w"&gt; &lt;/span&gt;g++-4.4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, tell icecream to create the environment for this&amp;nbsp;compiler:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/tmp
$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;ICECC_CC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gcc-4.4
$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;ICECC_CXX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;g++4.4
$&lt;span class="w"&gt; &lt;/span&gt;icecc&lt;span class="w"&gt; &lt;/span&gt;--build-native
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now your environment is ready. Copy the file generated to somewhere
you&amp;#8217;ll remember later (you can give it whatever name you&amp;nbsp;like):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;cp&lt;span class="w"&gt; &lt;/span&gt;my-environment-built-above.tar.gz&lt;span class="w"&gt; &lt;/span&gt;/var/icecream/gcc-4-4.4_x86-64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This step will be done only once, as opposed to the second step below
that is repeated whenever you compile a new&amp;nbsp;source.&lt;/p&gt;
&lt;h3 id="2-tell-icecream-which-environment-to-use"&gt;2. Tell icecream which environment to&amp;nbsp;use&lt;/h3&gt;
&lt;p&gt;When compiling a source code, tell icecream which environment it will
send to other hosts. You do this by exporting some env&amp;nbsp;vars:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;ICECC_CC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gcc-4.4
$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;ICECC_CXX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;g++-4.4
$&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;ICECC_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/var/icecream/gcc-4-4.4_x86-64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now you can compile your source code as usual, be it calling gcc
directly or through makefiles or other build systems. For&amp;nbsp;example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;gcc-4.4&lt;span class="w"&gt; &lt;/span&gt;helloworld.c&lt;span class="w"&gt; &lt;/span&gt;-o&lt;span class="w"&gt; &lt;/span&gt;helloworld
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you manage a handful of machines running icecream, I&amp;#8217;d recommend a
software we developed at ProFUSION called
&lt;a href="http://labs.hardinfo.org/mindcrisis/2010/10/06/picole-get-it-while-it-is-cold/"&gt;Picolé&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;: if you want a recommendation on how to build a cross toolchain,
&lt;a href="http://psas.pdx.edu/GentooCrossCompilerHowto/"&gt;crossdev&lt;/a&gt; it is. The
steps are the same as above, replacing gcc-4.4 with the name given to
your compiler (e.g.&amp;nbsp;﻿﻿﻿arm-elf-gcc-4.6.0)&lt;/p&gt;</content><category term="Uncategorized"></category><category term="icecc"></category><category term="icecream"></category><category term="profusion"></category></entry><entry><title>codespell 1.0.1</title><link href="https://politreco.com/2011/04/codespell-1-0-1/" rel="alternate"></link><published>2011-04-16T16:34:00-07:00</published><updated>2011-04-16T16:34:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-04-16:/2011/04/codespell-1-0-1/</id><content type="html">&lt;p&gt;I released codespell 1.0.1 after a small fix that is really necessary
for codespell working right. Thanks to Luis Felipe Strano that spot the
bug and generated another giant patch to &lt;span class="caps"&gt;LLVM&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Grab the latest version&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://packages.profusion.mobi/codespell/"&gt;http://packages.profusion.mobi/codespell/&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="codespell"></category><category term="profusion"></category></entry><entry><title>ANNOUNCE: codespell 1.0</title><link href="https://politreco.com/2011/04/announce-codespell-1-0/" rel="alternate"></link><published>2011-04-01T15:43:00-07:00</published><updated>2011-04-01T15:43:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-04-01:/2011/04/announce-codespell-1-0/</id><summary type="html">&lt;p&gt;I&amp;#8217;m glad to announce codespell 1.0! After 3 RCs and patches submitted to
several projects, I thought it was stable enough to call it 1.0. You can
download the 1.0 version&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;http://packages.profusion.mobi/codespell/codespell-1.0.tar.bz2&lt;/p&gt;
&lt;p&gt;See&lt;a href="https://politreco.com/2011/02/on-typos-and-misspellings/" title="on typos and misspellings"&gt;my previous
post&lt;/a&gt;
if you are willing to know what codespell is or read the &lt;span class="caps"&gt;README&lt;/span&gt; file
inside the&amp;nbsp;package.&lt;/p&gt;
&lt;p&gt;I have already filled a &lt;span class="caps"&gt;TODO&lt;/span&gt; file with ideas for the next version. They
came to mind after I&amp;#8217;ve generated a &lt;a href="https://lkml.org/lkml/2011/3/30/831" title="codespell on LKML"&gt;giant patch for the Linux
kernel&lt;/a&gt;. It is
the biggest patch I …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m glad to announce codespell 1.0! After 3 RCs and patches submitted to
several projects, I thought it was stable enough to call it 1.0. You can
download the 1.0 version&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;http://packages.profusion.mobi/codespell/codespell-1.0.tar.bz2&lt;/p&gt;
&lt;p&gt;See&lt;a href="https://politreco.com/2011/02/on-typos-and-misspellings/" title="on typos and misspellings"&gt;my previous
post&lt;/a&gt;
if you are willing to know what codespell is or read the &lt;span class="caps"&gt;README&lt;/span&gt; file
inside the&amp;nbsp;package.&lt;/p&gt;
&lt;p&gt;I have already filled a &lt;span class="caps"&gt;TODO&lt;/span&gt; file with ideas for the next version. They
came to mind after I&amp;#8217;ve generated a &lt;a href="https://lkml.org/lkml/2011/3/30/831" title="codespell on LKML"&gt;giant patch for the Linux
kernel&lt;/a&gt;. It is
the biggest patch I&amp;#8217;ve ever produced with codespell. Really, I think
it&amp;#8217;s the biggest patch I&amp;#8217;ve produced ever. I hope Linus accept that
patch as is because without the changes I&amp;#8217;m planning for codespell 1.1,
it&amp;#8217;s a pain to fix some corner&amp;nbsp;cases.&lt;/p&gt;
&lt;p&gt;Some people are sending me suggestions and more misspellings to my
email. I appreciate those emails and seeing they are successfully using
codespell in other projects. If you want a faster way to have your
changes incorporated into codespell, you may also send patches through
git-send-email or just use &lt;a href="https://github.com/lucasdemarchi/codespell" title="codespell on github"&gt;my repository on
github&lt;/a&gt;
to send me pull&amp;nbsp;requests.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt; (04/11/2011): Linus &lt;a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=25985edcedea6396277003854657b5f3cb31a628"&gt;accepted the
patch&lt;/a&gt;.
There&amp;#8217;s also a discussion with further improvements for codespell on
&lt;span class="caps"&gt;LKML&lt;/span&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="codespell"></category><category term="profusion"></category><category term="programming"></category></entry><entry><title>On typos and misspellings</title><link href="https://politreco.com/2011/02/on-typos-and-misspellings/" rel="alternate"></link><published>2011-02-07T03:56:00-08:00</published><updated>2011-02-07T03:56:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-02-07:/2011/02/on-typos-and-misspellings/</id><summary type="html">&lt;p&gt;This week I&amp;#8217;m in a release mood, so I&amp;#8217;m releasing several projects I&amp;#8217;m
involved with. If you lost the first two, checkout &lt;a href="https://politreco.com/2011/01/announce-dietsplash-0-3/"&gt;dietsplash
0.3&lt;/a&gt; and
&lt;a href="https://politreco.com/2011/02/anuncio-genslide-0-3/"&gt;genslide 0.3&lt;/a&gt;
(though the announcement was in&amp;nbsp;Portuguese).&lt;/p&gt;
&lt;p&gt;After developing for several projects I&amp;#8217;ve noticed most of them contain
typos and misspellings. Even if this does not directly affect the source
quality (unless the misspellings are in documentation), if we left the
comment there, we&amp;#8217;ve left it for a reason: because we want the reader of
that code to stop and &lt;strong&gt;read it&lt;/strong&gt;. It&amp;#8217;s particularly good to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This week I&amp;#8217;m in a release mood, so I&amp;#8217;m releasing several projects I&amp;#8217;m
involved with. If you lost the first two, checkout &lt;a href="https://politreco.com/2011/01/announce-dietsplash-0-3/"&gt;dietsplash
0.3&lt;/a&gt; and
&lt;a href="https://politreco.com/2011/02/anuncio-genslide-0-3/"&gt;genslide 0.3&lt;/a&gt;
(though the announcement was in&amp;nbsp;Portuguese).&lt;/p&gt;
&lt;p&gt;After developing for several projects I&amp;#8217;ve noticed most of them contain
typos and misspellings. Even if this does not directly affect the source
quality (unless the misspellings are in documentation), if we left the
comment there, we&amp;#8217;ve left it for a reason: because we want the reader of
that code to stop and &lt;strong&gt;read it&lt;/strong&gt;. It&amp;#8217;s particularly good to have the
correct spelling of each word when there are people from several parts
of the word that maybe do not have English as their mother tongue (as I
don&amp;#8217;t). This way we can be more sure the correct message is being given
through code, comments  and&amp;nbsp;documentation.&lt;/p&gt;
&lt;p&gt;Thinking a bit on this I made some bash and awk scripts to fix
misspellings based on the &lt;a href="http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings"&gt;list of common
misspellings&lt;/a&gt;
available on wikipedia. I&amp;#8217;ve successfully sent patches for projects like
the Linux kernel, ConnMan, oFono and &lt;span class="caps"&gt;EFL&lt;/span&gt;. After some of them were
accepted and after I decided to run the scripts again, I noticed how
slow they were (if you are curious what they did, you can google on the
oFono mailing list, in which I explain the scripts). So, I started a
new, very short project:
&lt;a href="http://git.profusion.mobi/cgit.cgi/lucas/codespell/"&gt;codespell&lt;/a&gt;.
Measuring against the Linux kernel tree, it runs circa 20x faster than
the previous scripts. Its current version is 1.0-rc1 and I&amp;#8217;d like to
have some more testers before I release the final&amp;nbsp;1.0.&lt;/p&gt;
&lt;p&gt;Codespell is designed to fix misspellings in source code, but it can be
applied to any type of text files. When possible, codespell will
automatically fix the misspelling. Otherwise it will give some
suggestions about possible changes. For example, running against the
Linux kernel tree, it gives me several lines like&amp;nbsp;below:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;drivers/target/target_core_transport.c:2528: competion  ==&amp;gt;
competition,&amp;nbsp;completion&lt;/p&gt;
&lt;p&gt;drivers/edac/cpc925_edac.c:186: &lt;span class="caps"&gt;MEAR&lt;/span&gt;  ==&amp;gt; wear, mere,&amp;nbsp;mare&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;WARNING&lt;/span&gt;: Decoding file&amp;nbsp;drivers/hid/hid-pl.c&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;WARNING&lt;/span&gt;: using encoding=utf-8&amp;nbsp;failed.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;WARNING&lt;/span&gt;: Trying next encoding: iso-8859-&lt;span class="caps"&gt;1WARNING&lt;/span&gt;: Decoding file
drivers/hid/hid-pl.cWARNING: using encoding=utf-8 failed. &lt;span class="caps"&gt;WARNING&lt;/span&gt;:
Trying next encoding:&amp;nbsp;iso-8859-1&lt;/p&gt;
&lt;p&gt;drivers/net/niu.c:3276: clas  ==&amp;gt; class  | disabled because of name
clash in&amp;nbsp;c++&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;FIXED&lt;/span&gt;:&amp;nbsp;../kernel/drivers/scsi/aacraid/aacraid.h&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;FIXED&lt;/span&gt;:&amp;nbsp;../kernel/drivers/scsi/lpfc/lpfc_sli.c&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;FIXED&lt;/span&gt;: ../kernel/drivers/scsi/aacraid/aacraid.hFIXED:&amp;nbsp;../kernel/drivers/scsi/lpfc/lpfc_sli.c&lt;/p&gt;
&lt;p&gt;(This is all in beautiful colored lines! Test it to see the true&amp;nbsp;output)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first two illustrate some changes that cannot be automatically done
because that misspelling is a common one for more than one word. So,
codespell gives you the file and line where they&amp;nbsp;occur.&lt;/p&gt;
&lt;p&gt;The WARNINGs are related to the encoding of the file. Codespell will
default to parse files in &lt;span class="caps"&gt;UTF&lt;/span&gt;-8 encoding, which will handle &amp;#8216;ascii&amp;#8217; as
well. If it fails to decode any line, it will try the next available
encoding, i.e. &lt;span class="caps"&gt;ISO&lt;/span&gt;-8859-1. Using these two encodings I have successfully
ran codespell with all the projects I care&amp;nbsp;about.&lt;/p&gt;
&lt;p&gt;Codespell allows some changes to be disabled. This is shown by the &amp;#8220;clas
=&amp;gt; class&amp;#8221; fix, that are not always safe to do because of name clash
with C++&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;The lines prefixed with &amp;#8220;&lt;span class="caps"&gt;FIXED&lt;/span&gt;&amp;#8221; show the files that were automatically
fixed. In current Linus&amp;#8217; master branch, this resulted&amp;nbsp;in:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;2545 files changed, 5007 insertions(+), 5007&amp;nbsp;deletions(-)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;These were the automatic fixes, that may contain some false positives.
The funniest one is the on found in&amp;nbsp;Documentation/DocBook/kernel-hacking.tmpl:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div id="_mcePaste"&gt;
&lt;p&gt;/*&lt;/p&gt;
&lt;/div&gt;
&lt;div id="_mcePaste"&gt;
&lt;p&gt;* Sun people can&amp;#8217;t spell worth damn. &amp;#8220;compatability&amp;#8221;&amp;nbsp;indeed.&lt;/p&gt;
&lt;/div&gt;
&lt;div id="_mcePaste"&gt;
&lt;p&gt;* At least we *know* we can&amp;#8217;t spell, and use a&amp;nbsp;spell-checker.&lt;/p&gt;
&lt;/div&gt;
&lt;div id="_mcePaste"&gt;
&lt;p&gt;*/&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;

As can be seen by the number above, this is not really true ;-).

&lt;/div&gt;

&lt;div&gt;

So, there it&amp;#8217;s: **codespell 1.0-rc1**. Get it. Test it. Report problems.
Tell me about projects that were successfully patched.

&lt;/div&gt;</content><category term="Uncategorized"></category><category term="profusion"></category><category term="programming"></category></entry><entry><title>git repository is down</title><link href="https://politreco.com/2011/02/git-repository-is-down/" rel="alternate"></link><published>2011-02-01T20:13:00-08:00</published><updated>2011-02-01T20:13:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-02-01:/2011/02/git-repository-is-down/</id><content type="html">&lt;p&gt;I&amp;#8217;m turning down my repository at politreco.com. All my projects are now
available either on &lt;a href="http://git.profusion.mobi/cgit.cgi/lucas/"&gt;ProFUSION&amp;#8217;s
repo&lt;/a&gt; or on
&lt;a href="https://github.com/lucasdemarchi/"&gt;github&lt;/a&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="programming"></category></entry><entry><title>ANÚNCIO: genslide 0.3</title><link href="https://politreco.com/2011/02/anuncio-genslide-0-3/" rel="alternate"></link><published>2011-02-01T03:14:00-08:00</published><updated>2011-02-01T03:14:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-02-01:/2011/02/anuncio-genslide-0-3/</id><summary type="html">&lt;p&gt;É com satisfação que anuncio a primeira versão do programa genslide,
&lt;strong&gt;genslide 0.3&lt;/strong&gt;. É um simples programa que criei para facilitar a
conversão de letras de música em slides, salvando-os em pdf através de
Latex/Xelatex. Esses slides podem ser usados durante shows e cultos e
venho usando-os já faz 6 meses na igreja que eu frequento. Embora ainda
tenha bastante coisa para ser feita, ele já se mostra bastante útil e
facilita bastante na hora de criar novos&amp;nbsp;slides.&lt;/p&gt;
&lt;p&gt;A ideia é que o usuário não se preocupe com muito com a formatação,
apenas com a divisão de …&lt;/p&gt;</summary><content type="html">&lt;p&gt;É com satisfação que anuncio a primeira versão do programa genslide,
&lt;strong&gt;genslide 0.3&lt;/strong&gt;. É um simples programa que criei para facilitar a
conversão de letras de música em slides, salvando-os em pdf através de
Latex/Xelatex. Esses slides podem ser usados durante shows e cultos e
venho usando-os já faz 6 meses na igreja que eu frequento. Embora ainda
tenha bastante coisa para ser feita, ele já se mostra bastante útil e
facilita bastante na hora de criar novos&amp;nbsp;slides.&lt;/p&gt;
&lt;p&gt;A ideia é que o usuário não se preocupe com muito com a formatação,
apenas com a divisão de título, estrofes e coro. Se você é da área de
computação, isso se traduz dizendo que a gramática é bem simples. Uma
símples música, contendo o título e 2&amp;nbsp;estrofes:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Esse é um título de&amp;nbsp;exemplo&lt;/p&gt;
&lt;p&gt;A primeira linha da primeira&amp;nbsp;estrofe&lt;/p&gt;
&lt;p&gt;A segunda linha da primeira&amp;nbsp;estrofe&lt;/p&gt;
&lt;p&gt;A terceira linha da primeira&amp;nbsp;estrofe&lt;/p&gt;
&lt;p&gt;A primeira linha da segunda&amp;nbsp;estrofe&lt;/p&gt;
&lt;p&gt;A segunda linha da segunda&amp;nbsp;estrofe&lt;/p&gt;
&lt;p&gt;A terceira linha da segunda&amp;nbsp;estrofe&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Existem alguns recursos adicionais, como marcação de uma estrofe como
coro e marcação de um trecho da música para repetição. Além disso, nem
sempre a frase cabe nos espaço disponível do slide. A divisão em várias
linhas é feita de forma automática, bem como a divisão entre os slides.
Assim, se você tiver uma linha da forma abaixo, ela será automaticamente
dividida em 2 ou mais&amp;nbsp;linhas.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Essa é uma linha realmente longa que não caberia em uma única linha no&amp;nbsp;slide&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Outro recurso interessante é a integração com o site de &lt;a href="http://letras.terra.com.br/"&gt;letras do
Terra&lt;/a&gt;. Dessa forma é possível gerar os
slides simplesmente passando o link para a letra nesse site. Por
exemplo, para gerar um slide da música &amp;#8220;Pra cima Brasil&amp;#8221;, do João&amp;nbsp;Alexandre:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;\$ genslide-bin&amp;nbsp;http://letras.terra.com.br/joao-alexandre/46505/&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A aparência dos slides finais é dada por um conjunto de arquivos que
formam um tema. O tema que uso atualmente é bem simples, mas nada impede
que temas mais sofisticados sejam criados. Atualmente a linha acima
geraria o conjunto de slides abaixo. Espero que esse programa seja útil
não só para mim, mas para todos que precisam fazer esse tipo de&amp;nbsp;conversão.&lt;/p&gt;
&lt;div id="__ss_6767934" style="width: 425px;"&gt;

**[Pra cima
brasil](http://www.slideshare.net/lucasdemarchi/pra-cima-brasil &amp;#8220;Pra cima brasil&amp;#8221;)**
&lt;object id="__sse6767934" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=pra-cima-brasil-110131185836-phpapp02&amp;amp;stripped_title=pra-cima-brasil&amp;amp;userName=lucasdemarchi"&gt;&lt;/param&gt;&lt;param name="name" value="__sse6767934"&gt;&lt;/param&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;
&lt;embed id="__sse6767934" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=pra-cima-brasil-110131185836-phpapp02&amp;amp;stripped_title=pra-cima-brasil&amp;amp;userName=lucasdemarchi" name="__sse6767934" allowscriptaccess="always" allowfullscreen="true"&gt;
&lt;/embed&gt;
&lt;/object&gt;

&lt;/div&gt;

&lt;h2 id="download"&gt;Download&lt;/h2&gt;
&lt;p&gt;Você pode fazer o download de genslide na &lt;a href="https://github.com/lucasdemarchi/genslide/downloads"&gt;página de
downloads&lt;/a&gt; do
programa. A última versão, 0.3, pode ser obtida em formato
&lt;a href="https://github.com/lucasdemarchi/genslide/tarball/v0.3"&gt;tar.bz2&lt;/a&gt; ou
&lt;a href="https://github.com/lucasdemarchi/genslide/zipball/v0.3"&gt;zip&lt;/a&gt;. Tudo o
que você precisa é ter python3 instalado (testado somente em&amp;nbsp;Linux).&lt;/p&gt;
&lt;h2 id="hacking-e-feedback"&gt;Hacking e&amp;nbsp;feedback&lt;/h2&gt;
&lt;p&gt;O código-fonte da última versão está disponível acima ou, para a última
versão de desenvolvimento, você pode fazer o download no &lt;a href="https://github.com/lucasdemarchi/genslide"&gt;repositório do
projeto&lt;/a&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="latex"></category><category term="Linux"></category><category term="python"></category><category term="slide"></category></entry><entry><title>ANNOUNCE: dietsplash 0.3</title><link href="https://politreco.com/2011/01/announce-dietsplash-0-3/" rel="alternate"></link><published>2011-01-27T14:37:00-08:00</published><updated>2011-01-27T14:37:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-01-27:/2011/01/announce-dietsplash-0-3/</id><summary type="html">&lt;p&gt;I&amp;#8217;m pleased to release a new version of dietsplash.  This is the first
announcement for dietsplash, though it has always been open source
software. Here it is, &lt;strong&gt;dietsplash 0.3&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;dietsplash is a small boot splash screen for Linux. Its aim is to do the
minimal work possible so you can see your system booting without getting
bored about the messages going on (or better, your client doesn&amp;#8217;t
complain to you that it&amp;#8217;s ugly to see all those messages). Its main
target is embedded systems, where running a full/big splash like
&lt;a href="http://www.freedesktop.org/wiki/Software/Plymouth"&gt;plymouth&lt;/a&gt; is an
overkill. Special …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m pleased to release a new version of dietsplash.  This is the first
announcement for dietsplash, though it has always been open source
software. Here it is, &lt;strong&gt;dietsplash 0.3&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;dietsplash is a small boot splash screen for Linux. Its aim is to do the
minimal work possible so you can see your system booting without getting
bored about the messages going on (or better, your client doesn&amp;#8217;t
complain to you that it&amp;#8217;s ugly to see all those messages). Its main
target is embedded systems, where running a full/big splash like
&lt;a href="http://www.freedesktop.org/wiki/Software/Plymouth"&gt;plymouth&lt;/a&gt; is an
overkill. Special attention is given to keep it small: as of now, it
produces a binary of just &lt;span class="caps"&gt;14KB&lt;/span&gt; without images and &lt;span class="caps"&gt;34KB&lt;/span&gt; using the images
that come as example bundled into the&amp;nbsp;binary.&lt;/p&gt;
&lt;p&gt;Running it is very simple, requiring very little configuration if you
don&amp;#8217;t have any splash screen yet. If you are already running another
splash like plymouth or psplash, you&amp;#8217;ll first have to disable it.
Please, see the &lt;span class="caps"&gt;README&lt;/span&gt; file that details what you have to do in order to
have it up and&amp;nbsp;running.&lt;/p&gt;
&lt;h3 id="download"&gt;&lt;span class="caps"&gt;DOWNLOAD&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Releases are available at
﻿﻿&lt;a href="http://packages.profusion.mobi/dietsplash/"&gt;http://packages.profusion.mobi/dietsplash/&lt;/a&gt;. Here is the latest
release: &lt;a href="http://packages.profusion.mobi/dietsplash/dietsplash-0.3.tar.bz2"&gt;dietsplash
0.3&lt;/a&gt;.  &lt;/p&gt;
&lt;h3 id="hacking"&gt;&lt;span class="caps"&gt;HACKING&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Patches and feedback are very welcome. You can either send me an email
or use the infrastructure at github, where there&amp;#8217;s a &amp;#8220;mirror&amp;#8221; of the git&amp;nbsp;repository.&lt;/p&gt;
&lt;p&gt;Git repositories: ﻿﻿git://git.profusion.mobi/users/lucas/dietsplash.git
(where the fun happens) and
﻿﻿git://github.com/lucasdemarchi/dietsplash.git (synchronized every now
and&amp;nbsp;then).&lt;/p&gt;</content><category term="Uncategorized"></category><category term="dietsplash"></category><category term="profusion"></category></entry><entry><title>ProFUSION work on oFono and ConnMan</title><link href="https://politreco.com/2011/01/profusion-work-on-ofono-and-connman/" rel="alternate"></link><published>2011-01-18T12:33:00-08:00</published><updated>2011-01-18T12:33:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-01-18:/2011/01/profusion-work-on-ofono-and-connman/</id><summary type="html">&lt;p&gt;As some of you know, I&amp;#8217;m working on some open source projects at
ProFUSION. Among them there are two projects started by Intel that are
now part of Meego. If you look at &lt;a href="http://meego.com/developers/meego-architecture/meego-architecture-domain-view"&gt;Meego
Architecture&lt;/a&gt;
you&amp;#8217;ll see these components are a great part of the &lt;em&gt;Communications&lt;/em&gt;&amp;nbsp;domain.&lt;/p&gt;
&lt;p&gt;In ConnMan ProFUSION made mainly some bug fixes and minor improvements
while we were creating a binding for e_dbus and a module for
&lt;a href="http://www.enlightenment.org"&gt;E17&lt;/a&gt;. It&amp;#8217;s working pretty well, it&amp;#8217;s fast
and reliable. Examining my logs in my desktop system I can see that in
less than a second ConnMan …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As some of you know, I&amp;#8217;m working on some open source projects at
ProFUSION. Among them there are two projects started by Intel that are
now part of Meego. If you look at &lt;a href="http://meego.com/developers/meego-architecture/meego-architecture-domain-view"&gt;Meego
Architecture&lt;/a&gt;
you&amp;#8217;ll see these components are a great part of the &lt;em&gt;Communications&lt;/em&gt;&amp;nbsp;domain.&lt;/p&gt;
&lt;p&gt;In ConnMan ProFUSION made mainly some bug fixes and minor improvements
while we were creating a binding for e_dbus and a module for
&lt;a href="http://www.enlightenment.org"&gt;E17&lt;/a&gt;. It&amp;#8217;s working pretty well, it&amp;#8217;s fast
and reliable. Examining my logs in my desktop system I can see that in
less than a second ConnMan is up with wired and wireless interfaces and
the &lt;span class="caps"&gt;IP&lt;/span&gt; is already discovered through&amp;nbsp;dhcp.&lt;/p&gt;
&lt;p&gt;In oFono we did a bit more work, implementing missing features in the
core and also in drivers of Huawei and &lt;span class="caps"&gt;MBM&lt;/span&gt; (sony-ericsson) modems as
well as on the phone simulator,&amp;nbsp;phonesim.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s great to see on Marcel&amp;#8217;s reports last month that in 2010 ProFUSION
was the &lt;a href="http://www.mail-archive.com/ofono@ofono.org/msg06682.html"&gt;3rd&lt;/a&gt;
major contributor for oFono and the
&lt;a href="http://www.mail-archive.com/connman@connman.net/msg02696.html"&gt;5th&lt;/a&gt; for
ConnMan. I&amp;#8217;m happy to be one of the developers contributing to these 2
great&amp;nbsp;projects.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="ConnMan"></category><category term="oFono"></category><category term="profusion"></category></entry><entry><title>Open source hardware - Arduino</title><link href="https://politreco.com/2011/01/open-source-hardware-arduino/" rel="alternate"></link><published>2011-01-18T04:34:00-08:00</published><updated>2011-01-18T04:34:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2011-01-18:/2011/01/open-source-hardware-arduino/</id><content type="html">&lt;p&gt;This post is just forward of an amazing documentary I saw today.
It&amp;#8217;s &lt;a href="http://www.geek.com/articles/gadgets/arduino-the-documentary-how-open-source-hardware-became-cheap-and-fun-2011018/"&gt;Arduino The Documentary. How open source hardware became cheap and
fun&lt;/a&gt;.
It&amp;#8217;s worth watching all its&amp;nbsp;27min.&lt;/p&gt;
&lt;p&gt;I think universities in Brazil should learn about and join projects like&amp;nbsp;this.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="hardware"></category></entry><entry><title>EFL 1.0 Beta 2</title><link href="https://politreco.com/2010/11/efl-1-0-beta-2/" rel="alternate"></link><published>2010-11-12T19:52:00-08:00</published><updated>2010-11-12T19:52:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-11-12:/2010/11/efl-1-0-beta-2/</id><content type="html">&lt;p&gt;&lt;span class="caps"&gt;EFL&lt;/span&gt; team is proud to announce beta2 of the coming &lt;span class="caps"&gt;EFL&lt;/span&gt; 1.0. WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt;
also received a new snapshot as well as several other related projects.
For more information, take a look at the
&lt;a href="http://enlightenment.org/p.php?p=news/show&amp;amp;l=en&amp;amp;news_id=25"&gt;announcement&lt;/a&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Criando imagens customizadas de endereços de email</title><link href="https://politreco.com/2010/11/criando-imagens-customizadas-de-enderecos-de-email/" rel="alternate"></link><published>2010-11-02T07:15:00-07:00</published><updated>2010-11-02T07:15:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-11-02:/2010/11/criando-imagens-customizadas-de-enderecos-de-email/</id><summary type="html">&lt;p&gt;Endereços de email são muitas vezes mascarados na web para que não sejam
facilmente obtidos por programas que tem por objetivo enviar spam. É
relativamente fácil escrever um programinha que fica vasculhando a web
em busca de endereços de email, cadastrá-los em um banco de dados e
depois utilizá-los como quisermos. Para que isso não ocorra, várias
vezes nos deparamos com endereços de email passados como &amp;#8220;joao &lt;span class="caps"&gt;AT&lt;/span&gt; gmail
&lt;span class="caps"&gt;DOT&lt;/span&gt; com&amp;#8221; ou alguma coisa do tipo.  Outra técnica muito utilizada é
transformá-lo em uma imagem. Dessa forma o programinha malicioso que a
princípio era fácil se torna bem mais&amp;nbsp;difícil …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Endereços de email são muitas vezes mascarados na web para que não sejam
facilmente obtidos por programas que tem por objetivo enviar spam. É
relativamente fácil escrever um programinha que fica vasculhando a web
em busca de endereços de email, cadastrá-los em um banco de dados e
depois utilizá-los como quisermos. Para que isso não ocorra, várias
vezes nos deparamos com endereços de email passados como &amp;#8220;joao &lt;span class="caps"&gt;AT&lt;/span&gt; gmail
&lt;span class="caps"&gt;DOT&lt;/span&gt; com&amp;#8221; ou alguma coisa do tipo.  Outra técnica muito utilizada é
transformá-lo em uma imagem. Dessa forma o programinha malicioso que a
princípio era fácil se torna bem mais&amp;nbsp;difícil.&lt;/p&gt;
&lt;p&gt;Eu acho que hoje em dia temos bons programas de anti-spam, o que torna
os métodos acima não tão relevantes. Porém, acredito que converter o
endereço de email em uma imagem o deixa bonito. Veja por exemplo a minha
&lt;a href="https://politreco.com/about/" title="contatos"&gt;página de contatos&lt;/a&gt;. Fazer
imagens desse tipo apara domínios conhecidos como &amp;#8220;gmail.com&amp;#8221;,
&amp;#8220;hotmail.com&amp;#8221; e &amp;#8220;yahoo.com&amp;#8221; é bem fácil: vários sites permitem que você
escolha um desses domínios e escreva o seu email. Um que eu gostei foi o
do
&lt;a href="http://freetechjournal.com/email/" title="email address generator"&gt;freetechjournal&lt;/a&gt;,
pois tem vários domínios ali dos serviços de email mais populares. É
fácil encontrar serviços semelhantes que permitem alguma&amp;nbsp;customização.&lt;/p&gt;
&lt;p&gt;Procurei bastante na web algum site que permitisse criar um email com
uma &lt;strong&gt;imagem de domínio customizada&lt;/strong&gt;, porém não achei nenhum. Como é
uma operação bem simples, resolvi fazer um script em python para isso.
Estou disponibilizando o
&lt;a href="http://github.com/downloads/lucasdemarchi/iconifymail/iconifymail-0.1.tar.bz2" title="iconifymail"&gt;iconifymail&lt;/a&gt;,
que contém também a imagem usada para a empresa em que trabalho,
ProFUSION, que pode servir como base para que você faça a sua própria
imagem (obrigado, &lt;a href="marina.proni@profusion.mobi"&gt;Marina&lt;/a&gt;). O uso é bem
simples, basta passar como primeiro argumento a imagem a ser utilizada
como domínio e, como segundo, o seu endereço de email (sem o domínio).
Algumas coisas eu deixei hard-coded no script, mas creio que seja fácil
adaptá-lo para o tamanho de imagem que você quiser. O resultado final é
o que pode ser visto abaixo e também na minha página de&amp;nbsp;contatos:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://politreco.com/wp-content/uploads/2009/05/email_company1.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2009/05/email_company1.png" title="email - company" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Essa é a versão 0.1 do iconifymail, open source, disponibilizado sob
GPLv3. Se você quiser contribuir, pode usar os repositórios git:
&lt;a href="http://git.profusion.mobi/cgit.cgi/lucas/iconifymail/"&gt;oficial&lt;/a&gt; ou
&lt;a href="http://github.com/lucasdemarchi/iconifymail"&gt;mirror&lt;/a&gt;.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="português"></category><category term="profusion"></category><category term="programming"></category></entry><entry><title>Easily embedding WebKit into your EFL application</title><link href="https://politreco.com/2010/10/easily-embedding-webkit-into-your-efl-application/" rel="alternate"></link><published>2010-10-23T23:53:00-07:00</published><updated>2010-10-23T23:53:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-10-23:/2010/10/easily-embedding-webkit-into-your-efl-application/</id><summary type="html">&lt;p&gt;This is the first of a series of posts that I&amp;#8217;m planning to do using
basic examples in &lt;span class="caps"&gt;EFL&lt;/span&gt;, the &lt;a href="http://enlightenment.org/" title="EFL"&gt;Enlightenment Foundation
Libraries&lt;/a&gt;. You may have heard that &lt;span class="caps"&gt;EFL&lt;/span&gt;
is reaching its 1.0 release. Instead of starting from the very beginning
with the basic functions of these libraries, I decided to go the
opposite way, showing the fun stuff that is possible to do. Since I&amp;#8217;m
also an WebKit developer, let&amp;#8217;s put the best of both softwares together
and have a basic window rendering a&amp;nbsp;webpage.&lt;/p&gt;
&lt;p&gt;Before starting off, just some&amp;nbsp;remarks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I&amp;#8217;m using here …&lt;/li&gt;&lt;/ol&gt;</summary><content type="html">&lt;p&gt;This is the first of a series of posts that I&amp;#8217;m planning to do using
basic examples in &lt;span class="caps"&gt;EFL&lt;/span&gt;, the &lt;a href="http://enlightenment.org/" title="EFL"&gt;Enlightenment Foundation
Libraries&lt;/a&gt;. You may have heard that &lt;span class="caps"&gt;EFL&lt;/span&gt;
is reaching its 1.0 release. Instead of starting from the very beginning
with the basic functions of these libraries, I decided to go the
opposite way, showing the fun stuff that is possible to do. Since I&amp;#8217;m
also an WebKit developer, let&amp;#8217;s put the best of both softwares together
and have a basic window rendering a&amp;nbsp;webpage.&lt;/p&gt;
&lt;p&gt;Before starting off, just some&amp;nbsp;remarks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I&amp;#8217;m using here the basic &lt;span class="caps"&gt;EFL&lt;/span&gt; + WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt; (sometimes
    called ewebkit). Developing an &lt;span class="caps"&gt;EFL&lt;/span&gt; application can be much simpler,
    particularly if you use an additional library with pre-made widgets
    like &lt;strong&gt;Elementary&lt;/strong&gt;. However, it&amp;#8217;s good to know how the underlying
    stuff works, so I&amp;#8217;m providing this&amp;nbsp;example.&lt;/li&gt;
&lt;li&gt;This could have been the last post in a series when talking about
    &lt;span class="caps"&gt;EFL&lt;/span&gt; since it uses at least 3 libraries. Don&amp;#8217;t be afraid if you don&amp;#8217;t
    understand what a certain function is for or if you can&amp;#8217;t get all
    &lt;span class="caps"&gt;EFL&lt;/span&gt; and WebKit running right now. Use the comment section below and
    I&amp;#8217;ll make my best to help&amp;nbsp;you.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="getting-efl-and-webkit"&gt;Getting &lt;span class="caps"&gt;EFL&lt;/span&gt; and&amp;nbsp;WebKit&lt;/h3&gt;
&lt;p&gt;In order to able to compile the example here, you will need to compile
two libraries from source: &lt;span class="caps"&gt;EFL&lt;/span&gt; and WebKit. For both libraries, you can
either get the last version from svn or use the last snapshots&amp;nbsp;provided.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;EFL&lt;/span&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Grab a snapshot from the &lt;a href="http://enlightenment.org/p.php?p=download&amp;amp;l=en" title="download EFL"&gt;download
page&lt;/a&gt;.
How to checkout the latest version from svn is detailed
&lt;a href="http://svn.enlightenment.org/" title="EFL svn"&gt;here&lt;/a&gt;, as well as some
instructions on how to&amp;nbsp;compile&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A very detailed explanation on how to get WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt; up and running is
available on &lt;a href="http://trac.webkit.org/wiki/EFLWebKit"&gt;trac&lt;/a&gt;. Recently,
though, WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt; started to be released too. It&amp;#8217;s not detailed in the
wiki yet, but &lt;strong&gt;you can grab a&lt;/strong&gt;
&lt;a href="http://packages.profusion.mobi/webkit-efl/webkit-efl-LATEST.tar.bz2"&gt;&lt;strong&gt;snapshot&lt;/strong&gt;&lt;/a&gt;
instead of checking out from&amp;nbsp;svn.&lt;/p&gt;
&lt;h3 id="hellobrowser"&gt;hellobrowser!&lt;/h3&gt;
&lt;p&gt;In the spirit of &amp;#8220;hello world&amp;#8221; examples, our goal here is to make a
window showing a webpage rendered by WebKit. For the sake of simplicity,
we will use a default start page and put a WebKit-&lt;span class="caps"&gt;EFL&lt;/span&gt; &amp;#8220;widget&amp;#8221; to cover
the entire window. See below a&amp;nbsp;screenshot:&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_324&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;490&amp;#8221;
caption=&amp;#8221;hellobrowser - WebKit +
&lt;span class="caps"&gt;EFL&lt;/span&gt;&amp;#8221;]&lt;a href="https://politreco.com/wp-content/uploads/2010/10/hellobrowser.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2010/10/hellobrowser.png" title="hellobrowser" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;The code for this example is available
&lt;a href="https://politreco.com/files/hellobrowser.c"&gt;here&lt;/a&gt;. Pay attention to
a comment in the beginning of this file that explains how to compile&amp;nbsp;it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;gcc&lt;span class="w"&gt; &lt;/span&gt;-o&lt;span class="w"&gt; &lt;/span&gt;hellobrowser&lt;span class="w"&gt; &lt;/span&gt;hellobrowser.c&lt;span class="w"&gt;   &lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;-DEWK_DATADIR&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;pkg-config&lt;span class="w"&gt; &lt;/span&gt;--variable&lt;span class="o"&gt;=&lt;/span&gt;datadir&lt;span class="w"&gt; &lt;/span&gt;ewebkit&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;pkg-config&lt;span class="w"&gt; &lt;/span&gt;--cflags&lt;span class="w"&gt; &lt;/span&gt;--libs&lt;span class="w"&gt; &lt;/span&gt;ecore&lt;span class="w"&gt; &lt;/span&gt;ecore-evas&lt;span class="w"&gt; &lt;/span&gt;evas&lt;span class="w"&gt; &lt;/span&gt;ewebkit&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The things worth noting here are the dependencies and a variable. We
directly depend on ecore and evas from &lt;span class="caps"&gt;EFL&lt;/span&gt; and on WebKit. We define a
variable, EWK_DATADIR, using pkg-config so our browser can use the
default theme for web widgets defined in WebKit. Ecore handles events
like mouse and keyboard inputs, timers etc whilst evas is the library
responsible for drawing. In a later post I&amp;#8217;ll detail them a bit more.
For now, you can read more about them on &lt;a href="http://enlightenment.org/p.php?p=about&amp;amp;l=en"&gt;their official
site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The main function is really simple. Let&amp;#8217;s divide it by&amp;nbsp;pieces:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Init all EFL stuff we use&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ewk_init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Before you use a library from &lt;span class="caps"&gt;EFL&lt;/span&gt;, remember to initialize it. All of
them use their own namespace, so it&amp;#8217;s easy to know which library you
have to initialize: for example, if you call a function starting by
&amp;#8220;ecore_&amp;#8221;, you know you first have to call &amp;#8220;ecore_init()&amp;#8221;. The last
initialization function is WebKit&amp;#8217;s, which uses the &amp;#8220;ewk_&amp;#8221;&amp;nbsp;namespace.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;fprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;something went wrong... :(&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ecore-evas then is used to create a new window with size 800x600. The
other options are not relevant for an introduction to the libraries and
you can find its complete documentation
&lt;a href="http://docs.enlightenment.org/auto/ecore/Ecore__Evas_8h.html#ac7f2cdbcb79635c34317c1183dd04cb0"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Get the canvas off just-created window&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;From the Ecore_Evas object we just created, we grab a pointer to the
evas, which is the space in which we can draw, adding Evas_Objects.
Basically an Evas_Object is an object that you draw somewhere, i.e. in
the evas. We want to add only one object to our window, that is where
WebKit you render the webpages. Then, we have to ask WebKit to create
this&amp;nbsp;object:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Add a View object into this canvas. A View object is where WebKit will&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// render stuff.&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ewk_view_single_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evas&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Below I demonstrate a few Evas&amp;#8217; functions that you use to manipulate any
Evas_Object. Here we are manipulating the just create WebKit object,
moving to the desired position, resizing to 780x580px and then telling
Evas to show this object. Finally, we tell Evas to show the window we
created too. This way we have a window with an WebKit object inside with
a little&amp;nbsp;border.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Make a 10px border, resize and show&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_move&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;780&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;580&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We need to setup a bit more things before having a working application.
The first one is to give focus to the Evas_Object we are interested on
in order to receive keyboard events when opened. Then we connect a
function that will be called when the window is closed, so we can
properly exit our&amp;nbsp;application.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Focus it so it will receive pressed keys&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_focus_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Add a callback so clicks on &amp;quot;X&amp;quot; on top of window will call&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// main_signal_exit() function&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_event_handler_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ECORE_EVENT_SIGNAL_EXIT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;main_signal_exit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After this, we are ready to show our application, so we start the
mainloop. This function will only return when the application is&amp;nbsp;closed:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_main_loop_begin&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function called when the application is close, just tell Ecore to
exit the mainloop, so the function above returns and the application can
shutdown. See its implementation&amp;nbsp;below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Eina_Bool&lt;/span&gt;
&lt;span class="nf"&gt;main_signal_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ev_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_main_loop_quit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;EINA_TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Before the application exits, we shutdown all the libraries that were
initialized, in the opposite&amp;nbsp;order:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// Destroy all the stuff we have used&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ewk_shutdown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_evas_shutdown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ecore_shutdown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_shutdown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is a basic working browser, with which you can navigate through
pages, but you don&amp;#8217;t have an entry to set the current &lt;span class="caps"&gt;URL&lt;/span&gt;, nor &amp;#8220;go back&amp;#8221;
and &amp;#8220;go forward&amp;#8221; buttons etc. All you have to do is start adding more
Evas_Objects to your Evas and connect them to the object we just
created. For a still basic example, but with more stuff implemented,
refer to the EWebLauncher that we ship with the WebKit source code. You
can see it in the &amp;#8220;WebKitTools/EWebLauncher/&amp;#8221; folder or online at
&lt;a href="http://trac.webkit.org/browser/trunk/WebKitTools/EWebLauncher"&gt;webkit&amp;#8217;s
trac&lt;/a&gt;.
&lt;strong&gt;Eve&lt;/strong&gt; is another browser with a lot more features that uses Elementary
in addition to &lt;span class="caps"&gt;EFL&lt;/span&gt;, WebKit. See a &lt;a href="http://labs.hardinfo.org/mindcrisis/2010/08/12/eve-efl-web-browser/"&gt;blog
post&lt;/a&gt;
about it with some nice&amp;nbsp;pictures.&lt;/p&gt;
&lt;p&gt;Now, let&amp;#8217;s do something funny with our browser. With a bit more lines of
code you can turn your browser upside down. Not really useful, but it&amp;#8217;s
funny. All you have to do is to rotate the Evas_Object WebKit is
rendering on. This is implemented by the following&amp;nbsp;function:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;// Rotate an evas object by 180 degrees&lt;/span&gt;
&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;
&lt;span class="nf"&gt;_rotate_obj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Evas_Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Evas_Map&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;evas_map_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_map_util_points_populate_from_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_map_util_rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;180.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_map_alpha_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_map_smooth_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_map_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_object_map_enable_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;evas_map_free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;See this screenshot below and  get the &lt;a href="https://politreco.com/files/hellobrowser2.c"&gt;complete source
code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_335&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;490&amp;#8221;
caption=&amp;#8221;&lt;span class="caps"&gt;EFL&lt;/span&gt; + WebKit doing Politreco upside
down&amp;#8221;]&lt;a href="https://politreco.com/wp-content/uploads/2010/10/hellobrowser2.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2010/10/hellobrowser2.png" title="hellobrowser2" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;</content><category term="Uncategorized"></category><category term="EFL"></category><category term="Linux"></category><category term="profusion"></category><category term="webkit"></category></entry><entry><title>Understanding RT by graphics</title><link href="https://politreco.com/2010/08/understanding-rt-by-graphics/" rel="alternate"></link><published>2010-08-29T03:30:00-07:00</published><updated>2010-08-29T03:30:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-08-29:/2010/08/understanding-rt-by-graphics/</id><summary type="html">&lt;p&gt;A lot of people seem not to understand very well what real-time means.
They usually tend to think &lt;span class="caps"&gt;RT&lt;/span&gt; has anything to do with performance and
the raw throughput. It doesn&amp;#8217;t. It&amp;#8217;s all about determinism and&amp;nbsp;guarantees.&lt;/p&gt;
&lt;p&gt;This post&amp;#8217;s title has &amp;#8220;by graphics&amp;#8221; words. I think the graphics below
are worth a thousand words. I obtained them while porting the &lt;span class="caps"&gt;RT&lt;/span&gt; tree to
Freescale boards some weeks ago at ProFUSION. Basically I&amp;#8217;m running a
task that wakes up every 40ms, run a tiny job, send some numbers through
the network and sleeps again. The time in …&lt;/p&gt;</summary><content type="html">&lt;p&gt;A lot of people seem not to understand very well what real-time means.
They usually tend to think &lt;span class="caps"&gt;RT&lt;/span&gt; has anything to do with performance and
the raw throughput. It doesn&amp;#8217;t. It&amp;#8217;s all about determinism and&amp;nbsp;guarantees.&lt;/p&gt;
&lt;p&gt;This post&amp;#8217;s title has &amp;#8220;by graphics&amp;#8221; words. I think the graphics below
are worth a thousand words. I obtained them while porting the &lt;span class="caps"&gt;RT&lt;/span&gt; tree to
Freescale boards some weeks ago at ProFUSION. Basically I&amp;#8217;m running a
task that wakes up every 40ms, run a tiny job, send some numbers through
the network and sleeps again. The time in the graphics is the difference
between the total time (sleep + wake-up + execution) and&amp;nbsp;40ms.&lt;/p&gt;
&lt;p&gt;One important fact: while this is running, I&amp;#8217;m running some
&lt;span class="caps"&gt;CPU&lt;/span&gt;-intensive jobs in background and the board is receiving a ping flood
from another&amp;nbsp;host.&lt;/p&gt;
&lt;p&gt;See that when the task is running with real-time priority, it doesn&amp;#8217;t
matter there&amp;#8217;s a hugger job in background or someone is trying to take
your board down with a ping flood. It&amp;#8217;s always possible to draw a line
and say it will never* go beyond that limit. In the other hand, when
running with normal priority, the total time varies much&amp;nbsp;more.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_298&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;550&amp;#8221;
caption=&amp;#8221;Task running with normal priority&amp;#8221;]&lt;a href="https://politreco.com/wp-content/uploads/2010/08/scope-nort.png"&gt;&lt;img alt="scope with no
real-time" src="https://politreco.com/wp-content/uploads/2010/08/scope-nort.png" title="scope-nort" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_299&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;550&amp;#8221;
caption=&amp;#8221;Task running with real-time
priority&amp;#8221;]&lt;a href="https://politreco.com/wp-content/uploads/2010/08/scope-rt.png"&gt;&lt;img alt="" src="https://politreco.com/wp-content/uploads/2010/08/scope-rt.png" title="scope-rt" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;PS&lt;/span&gt;.: In the graphics above I&amp;#8217;m using an
&lt;a href="http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=summary" title="Tuna"&gt;oscilloscope&lt;/a&gt;
made by Arnaldo Carvalho de Melo. Thanks,&amp;nbsp;acme.&lt;/p&gt;
&lt;p&gt;* Well, &lt;strong&gt;never&lt;/strong&gt; is a strong word. You better test with several
scenarios, workloads, etc before saying&amp;nbsp;that.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Linux"></category><category term="profusion"></category><category term="real-time"></category></entry><entry><title>WebKit</title><link href="https://politreco.com/2010/08/webkit/" rel="alternate"></link><published>2010-08-28T05:15:00-07:00</published><updated>2010-08-28T05:15:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-08-28:/2010/08/webkit/</id><content type="html">&lt;p&gt;After some time working with the &lt;span class="caps"&gt;EFL&lt;/span&gt; port of WebKit, I&amp;#8217;ve been nominated
as an official webkit developer. Now I have super powers in the official
repository :-), but I swear I intend to use it with caution and
responsibility. I&amp;#8217;ll not forget Uncle Ben&amp;#8217;s advice: ﻿﻿&amp;#8221;with great power
comes great&amp;nbsp;responsibility&amp;#8221;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m preparing a post to talk about WebKit, &lt;span class="caps"&gt;EFL&lt;/span&gt;, eve (a new web browser
based on WebKit + &lt;span class="caps"&gt;EFL&lt;/span&gt;) and how to easily embed a browser in your
application. Stay&amp;nbsp;tuned.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="profusion"></category><category term="programming"></category><category term="webkit"></category></entry><entry><title>strace, valgrind and gdb as a strace-like tool</title><link href="https://politreco.com/2010/07/strace-valgrind-and-gdb-as-a-strace-like-tool/" rel="alternate"></link><published>2010-07-30T06:18:00-07:00</published><updated>2010-07-30T06:18:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-07-30:/2010/07/strace-valgrind-and-gdb-as-a-strace-like-tool/</id><summary type="html">&lt;p&gt;A long time since I do not post some technical thing. Time to share
something I learnt during latest&amp;nbsp;months.&lt;/p&gt;
&lt;p&gt;My boss at &lt;a href="http://profusion.mobi"&gt;ProFUSION&lt;/a&gt; always says there are only
2 debugging tools worth using: &lt;strong&gt;strace&lt;/strong&gt; and &lt;strong&gt;valgrind&lt;/strong&gt;. Indeed, they
are very helpful while developing software in C. If you don&amp;#8217;t know them,
hurry! Google it. Basically what I can do is to summarize their&amp;nbsp;functionality:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;strace&lt;/strong&gt; traces all system calls a program does. You don&amp;#8217;t even
    need the source code. Suppose a software is misbehaving and you want
    to know what files it is opening: all you have …&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;A long time since I do not post some technical thing. Time to share
something I learnt during latest&amp;nbsp;months.&lt;/p&gt;
&lt;p&gt;My boss at &lt;a href="http://profusion.mobi"&gt;ProFUSION&lt;/a&gt; always says there are only
2 debugging tools worth using: &lt;strong&gt;strace&lt;/strong&gt; and &lt;strong&gt;valgrind&lt;/strong&gt;. Indeed, they
are very helpful while developing software in C. If you don&amp;#8217;t know them,
hurry! Google it. Basically what I can do is to summarize their&amp;nbsp;functionality:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;strace&lt;/strong&gt; traces all system calls a program does. You don&amp;#8217;t even
    need the source code. Suppose a software is misbehaving and you want
    to know what files it is opening: all you have to do is to intercept
    calls to your kernel, i.e. trace all open syscalls. You have to do
    as&amp;nbsp;following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;bash
 $ strace -e trace=open ./your-program-to-trace&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;p&gt;
This will output all the system calls of type open, with their&amp;nbsp;parameters;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;valgrind&lt;/strong&gt; helps you to debug problems related to memory accesses.
    It&amp;#8217;s a common mistake to free an alloc&amp;#8217;d variable and after trying
    to access its content. Valgrind will tell you exactly where you
    freed the memory an then you may catch the bug much more&amp;nbsp;easily&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However I don&amp;#8217;t think gdb is not worth using and I&amp;#8217;ll show here it&amp;#8217;s so
powerful that you can even simulate strace with gdb. Let&amp;#8217;s say you want
to do the same thing as above with strace. You&amp;#8217;ll need to use the
&amp;#8216;catch&amp;#8217; command in&amp;nbsp;gdb:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;gdb&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;catch&lt;span class="w"&gt; &lt;/span&gt;syscall&lt;span class="w"&gt; &lt;/span&gt;open
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Done! Your program will stop for every open syscall. But wait, strace
does not break, it just prints the syscall and continues exection. Let
me continue&amp;#8230; One of the features gdb has that I see really few people
using is
&lt;a href="http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_34.html"&gt;commands&lt;/a&gt;.
Hey! &lt;span class="caps"&gt;GDB&lt;/span&gt; is not a tool made only for seeing the backtrace when a program
reaches a certain line in your source code! You can automate several
things, print memory locations, break if a variable assumes a certain
value etc. So, if you just want to print something, you can improve our
previous&amp;nbsp;example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;gdb&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;catch&lt;span class="w"&gt; &lt;/span&gt;syscall&lt;span class="w"&gt; &lt;/span&gt;open
&lt;span class="o"&gt;(&lt;/span&gt;gdb&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;commands&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;bt
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;continue&lt;/span&gt;
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now it will print the backtrace every time an open syscall is issued. If
you pay attention to the calling convention of your
architecture&lt;a href="http://en.wikipedia.org/wiki/Calling_convention"&gt;[1]&lt;/a&gt;
&lt;a href="http://stackoverflow.com/questions/2535989/what-are-the-calling-conventions-for-unix-linux-system-calls-on-x86-64"&gt;[2]&lt;/a&gt;,
you could check the parameters to that syscall and print its value or
stop if it is something interesting. For example, in x86_64 the
following snippet would print the filename being&amp;nbsp;opened:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;gdb&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;catch&lt;span class="w"&gt; &lt;/span&gt;syscall&lt;span class="w"&gt; &lt;/span&gt;open
&lt;span class="o"&gt;(&lt;/span&gt;gdb&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;commands&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;silent
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;x/s&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$rdi&lt;/span&gt;
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;continue&lt;/span&gt;
&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Yes, you could use strace and grep for the file you are interested in.
But, where&amp;#8217;s the fun ;-)? The thing is that all these debugging tools
rely on &lt;strong&gt;&lt;a href="http://linux.die.net/man/2/ptrace"&gt;ptrace&lt;/a&gt;&lt;/strong&gt; syscall, that
allows a process to trace another one. So, choose your debugging tool
and go fix your code&amp;nbsp;:-)&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Brasil x Holanda</title><link href="https://politreco.com/2010/07/brasil-x-holanda/" rel="alternate"></link><published>2010-07-02T23:37:00-07:00</published><updated>2010-07-02T23:37:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-07-02:/2010/07/brasil-x-holanda/</id><content type="html">&lt;p&gt;Brasil perdeu. Infelizmente estamos fora da&amp;nbsp;copa.&lt;/p&gt;
&lt;p&gt;O Juca Kfouri &lt;a href="http://blogdojuca.uol.com.br/2010/07/desastre-e-injustica-no-nelson-mandela-bay/"&gt;resumiu praticamente
tudo&lt;/a&gt;
o que eu acho desse jogo. Só pra complementar: o time de laranja era uma
equipe de teatro ou de&amp;nbsp;bonecas?&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Brasil"></category><category term="futebol"></category></entry><entry><title>Now, officially an EFL developer</title><link href="https://politreco.com/2010/05/now-officially-an-efl-developer/" rel="alternate"></link><published>2010-05-05T02:36:00-07:00</published><updated>2010-05-05T02:36:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-05-05:/2010/05/now-officially-an-efl-developer/</id><summary type="html">&lt;p&gt;Last week I was officially added to &lt;span class="caps"&gt;EFL&lt;/span&gt; developers list. After
contributing some patches to eina, edbus, elementary and E17 (especially
to connman module), Gustavo Barbieri, who is also my boss at ProFUSION,
added me to developers list giving me commit rights on &lt;span class="caps"&gt;EFL&lt;/span&gt;&amp;nbsp;svn.&lt;/p&gt;
&lt;p&gt;He said me some weeks ago that the only thing missing to add me as
developer was that I&amp;#8217;d have to use E as my window manager. Fair enough.
If one wants to be a developer of a certain program, it&amp;#8217;s better to
first be an active user. So, last Friday I wiped …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week I was officially added to &lt;span class="caps"&gt;EFL&lt;/span&gt; developers list. After
contributing some patches to eina, edbus, elementary and E17 (especially
to connman module), Gustavo Barbieri, who is also my boss at ProFUSION,
added me to developers list giving me commit rights on &lt;span class="caps"&gt;EFL&lt;/span&gt;&amp;nbsp;svn.&lt;/p&gt;
&lt;p&gt;He said me some weeks ago that the only thing missing to add me as
developer was that I&amp;#8217;d have to use E as my window manager. Fair enough.
If one wants to be a developer of a certain program, it&amp;#8217;s better to
first be an active user. So, last Friday I wiped out my Gnome and
started using E17 as my default window manager. If you don&amp;#8217;t know E, you
should check &lt;a href="http://www.enlightenment.org/" title="Enlightenment"&gt;its site&lt;/a&gt;.
It&amp;#8217;s a lightweight Desktop Environment designed on top of &lt;span class="caps"&gt;EFL&lt;/span&gt;, the
Enlightnement Foundation&amp;nbsp;Libraries.&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t think the current theme is that good, but I&amp;#8217;m getting used to
it. Hopefully, it will be replaced some time soon. Below, my current
desktop with an animated wallpaper with a&amp;nbsp;clock:&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_266&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;553&amp;#8221;
caption=&amp;#8221;Enlightenment&amp;#8221;]&lt;img alt="" src="https://politreco.com/wp-content/uploads/2010/05/screenshot-e17.png" title="Enlightenment" /&gt;[/caption]&lt;/p&gt;</content><category term="Uncategorized"></category><category term="EFL"></category><category term="profusion"></category></entry><entry><title>Linux Collaboration Summit 2010</title><link href="https://politreco.com/2010/04/linux-collaboration-summit-2010/" rel="alternate"></link><published>2010-04-21T22:29:00-07:00</published><updated>2010-04-21T22:29:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-04-21:/2010/04/linux-collaboration-summit-2010/</id><content type="html">&lt;p&gt;And this was the Linux Collaboration Summit&amp;nbsp;2010:  &lt;/p&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="225" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=10962189&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;/param&gt;&lt;embed type="application/x-shockwave-flash" width="400" height="225" src="http://vimeo.com/moogaloop.swf?clip_id=10962189&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;

&lt;p&gt;&lt;a href="http://vimeo.com/10962189"&gt;Linux Collaboration Summit 2010&lt;/a&gt; from &lt;a href="http://vimeo.com/user3260101"&gt;Kenny
Moy&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m appearing on this video exactly at 2:00 :-D. After it shows Google
giving Nexus One phones to everybody. Really&amp;nbsp;nice.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Embedded Linux Conference 2010</title><link href="https://politreco.com/2010/04/embedded-linux-conference-2010/" rel="alternate"></link><published>2010-04-15T09:17:00-07:00</published><updated>2010-04-15T09:17:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-04-15:/2010/04/embedded-linux-conference-2010/</id><summary type="html">&lt;p&gt;So, today was the last day of the Embedded Linux Conference. Now, I&amp;#8217;ll
be here in &lt;span class="caps"&gt;USA&lt;/span&gt; for the Linux Collaboration Summit. It was really cool
and it was amazing to meet people you are only used to chat, exchange
some emails or that you heard about. Just to name some: Steven Rostedt,
Greg Kroah-Hartman, Frank Rowand, Mike Anderson, Andrew Morton, Jon
Corbet and others. I was really impressed too seeing Rostedt programming
or Greg answering emails. What a great&amp;nbsp;guys&lt;/p&gt;
&lt;p&gt;And yesterday I presented my work, talking about the optimization of the
Linux scheduler for soft real-time when …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So, today was the last day of the Embedded Linux Conference. Now, I&amp;#8217;ll
be here in &lt;span class="caps"&gt;USA&lt;/span&gt; for the Linux Collaboration Summit. It was really cool
and it was amazing to meet people you are only used to chat, exchange
some emails or that you heard about. Just to name some: Steven Rostedt,
Greg Kroah-Hartman, Frank Rowand, Mike Anderson, Andrew Morton, Jon
Corbet and others. I was really impressed too seeing Rostedt programming
or Greg answering emails. What a great&amp;nbsp;guys&lt;/p&gt;
&lt;p&gt;And yesterday I presented my work, talking about the optimization of the
Linux scheduler for soft real-time when running on multi-core
architectures. I must admit I was a bit nervous, but it seems that
people liked it. Following some&amp;nbsp;pictures:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://lh5.ggpht.com/_5ShG8lbXlTw/S8a8JEfSg4I/AAAAAAAAFXM/AKFCwF9xhSg/14042010210.jpg" /&gt;&lt;img alt="" src="http://lh6.ggpht.com/_5ShG8lbXlTw/S8a8JNEbqlI/AAAAAAAAFXQ/MsKMoHpWJzQ/14042010211.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://lh5.ggpht.com/_5ShG8lbXlTw/S8a8JMe6vpI/AAAAAAAAFXU/YS_0cBM_Js8/14042010212.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://lh4.ggpht.com/_5ShG8lbXlTw/S8a8JZ1ATXI/AAAAAAAAFXY/k3sWYUFAGyA/14042010213.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://lh6.ggpht.com/_5ShG8lbXlTw/S8a8JbqWe_I/AAAAAAAAFXc/_czoKmOCmNA/14042010214.jpg" /&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="kernel"></category><category term="Linux"></category><category term="profusion"></category><category term="scheduler"></category></entry><entry><title>Banco do Brasil + Linux 64 bits</title><link href="https://politreco.com/2010/03/banco-do-brasil-linux-64-bits/" rel="alternate"></link><published>2010-03-30T03:06:00-07:00</published><updated>2010-03-30T03:06:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-03-30:/2010/03/banco-do-brasil-linux-64-bits/</id><summary type="html">&lt;p&gt;Faz 1 mês mais ou menos que liguei no Banco do Brasil reclamando que a
&amp;#8220;solução de segurança&amp;#8221; do site deles não estava funcionando no meu Linux
64 bits. Sem grandes surpresas, depois de me perguntarem se eu tinha a
&lt;span class="caps"&gt;VM&lt;/span&gt; java da sun instalada, versão, etc, eles me passaram para o suporte
de segundo nível. Pediram o meu telefone, dizendo que entrariam em
contato (isso foi no&amp;nbsp;sábado).&lt;/p&gt;
&lt;p&gt;Logo na segunda-feira de manhã me ligaram e após mais um tempo
conversando, ele disse: &amp;#8220;o problema é que a nossa solução de segurança
não é homologada para a jre 1 …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Faz 1 mês mais ou menos que liguei no Banco do Brasil reclamando que a
&amp;#8220;solução de segurança&amp;#8221; do site deles não estava funcionando no meu Linux
64 bits. Sem grandes surpresas, depois de me perguntarem se eu tinha a
&lt;span class="caps"&gt;VM&lt;/span&gt; java da sun instalada, versão, etc, eles me passaram para o suporte
de segundo nível. Pediram o meu telefone, dizendo que entrariam em
contato (isso foi no&amp;nbsp;sábado).&lt;/p&gt;
&lt;p&gt;Logo na segunda-feira de manhã me ligaram e após mais um tempo
conversando, ele disse: &amp;#8220;o problema é que a nossa solução de segurança
não é homologada para a jre 1.6. Acontece que em algumas plataformas ela
funciona, mas não é garantido. A gente sabe que em Linux 32 bits
funciona, mas a jre 1.5 é que é oficialmente homologada&amp;#8221;. Então eu tinha
duas opções: ou instalar a versão 1.5 ou rodar um browser 32 bits.
Felizmente no meu sistema, &lt;a href="http://www.archlinux.org"&gt;archlinux&lt;/a&gt;, já tem
um pacote firefox32 que faz tudo o que preciso e foi o a solução que
adotei. Até&amp;nbsp;hoje.&lt;/p&gt;
&lt;p&gt;Hoje quando fiz meu usual &amp;#8220;sudo pacman -Syu&amp;#8221; para instalar atualizações
de todos os pacotes, vi que tinha uma atualização da jre para ser feita:
﻿﻿jre-6u18-2. Aí pensei&amp;#8230; quem sabe nessa versão mudou alguma coisa que
fez funcionar o applet do &lt;span class="caps"&gt;BB&lt;/span&gt;? Sem muitas esperanças, abri o site no
chromium e para minha surpresa, &lt;strong&gt;funcionou!&lt;/strong&gt; Abri no Firefox, &lt;strong&gt;e
funcionou também&lt;/strong&gt;. Pra tirar a dúvida, fiz o downgrade para a versão
anterior do java, jre-6u17-1. Abri novamente e continuou funcionando.
Logo, não foi causada pela atualização da &lt;span class="caps"&gt;VM&lt;/span&gt;, mas sim por alguma mudança
que o pessoal do Banco do Brasil fez. Não sei se eles chegaram a
homologar a versão 1.6 da &lt;span class="caps"&gt;JVM&lt;/span&gt; (o que já estaria mais do que na hora), só
sei que agora funciona com Linux 64&amp;nbsp;bits.&lt;/p&gt;
&lt;p&gt;Felizmente agora posso acessar a minha conta no Banco do Brasil sem
precisar do browser 32 bits. Já estou removendo-o. Deixe seu comentário
pra eu saber se funcionou pra você também (inclusive aqueles que usam
FreeBSDs e outros&amp;nbsp;unixes).&lt;/p&gt;</content><category term="Uncategorized"></category><category term="64bits"></category><category term="Java"></category><category term="Linux"></category></entry><entry><title>Amazing kernel related blog</title><link href="https://politreco.com/2010/03/amazing-kernel-related-blog/" rel="alternate"></link><published>2010-03-23T03:45:00-07:00</published><updated>2010-03-23T03:45:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-03-23:/2010/03/amazing-kernel-related-blog/</id><summary type="html">&lt;p&gt;Today while reading &amp;#8220;posts&amp;#8221; on Buzz and digging in my &lt;span class="caps"&gt;RSS&lt;/span&gt; reader, I
found this blog: &lt;a href="http://smackerelofopinion.blogspot.com/"&gt;http://smackerelofopinion.blogspot.com/&lt;/a&gt; made by an
ubuntu engineer. How many amazing posts there are on this blog.
Particularly interesting is the one about &lt;a href="http://smackerelofopinion.blogspot.com/2010/03/debugging-acpi-using-acpiexec.html"&gt;&lt;span class="caps"&gt;ACPI&lt;/span&gt;
Debugging&lt;/a&gt;
and the other about
&lt;a href="http://smackerelofopinion.blogspot.com/2010/03/perf-tool-now-in-ubuntu-lucid.html"&gt;perf&lt;/a&gt;,
the tool I posted about some days ago (although it covers just a tiny
amount of things this tool is capable&amp;nbsp;of).&lt;/p&gt;
&lt;p&gt;When I have some spare time I&amp;#8217;ll try to use that first post to debug the
&lt;span class="caps"&gt;ACPI&lt;/span&gt; on my buggy asus laptop, where temperature goes sometimes as high
as 90 …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Today while reading &amp;#8220;posts&amp;#8221; on Buzz and digging in my &lt;span class="caps"&gt;RSS&lt;/span&gt; reader, I
found this blog: &lt;a href="http://smackerelofopinion.blogspot.com/"&gt;http://smackerelofopinion.blogspot.com/&lt;/a&gt; made by an
ubuntu engineer. How many amazing posts there are on this blog.
Particularly interesting is the one about &lt;a href="http://smackerelofopinion.blogspot.com/2010/03/debugging-acpi-using-acpiexec.html"&gt;&lt;span class="caps"&gt;ACPI&lt;/span&gt;
Debugging&lt;/a&gt;
and the other about
&lt;a href="http://smackerelofopinion.blogspot.com/2010/03/perf-tool-now-in-ubuntu-lucid.html"&gt;perf&lt;/a&gt;,
the tool I posted about some days ago (although it covers just a tiny
amount of things this tool is capable&amp;nbsp;of).&lt;/p&gt;
&lt;p&gt;When I have some spare time I&amp;#8217;ll try to use that first post to debug the
&lt;span class="caps"&gt;ACPI&lt;/span&gt; on my buggy asus laptop, where temperature goes sometimes as high
as 90 °C. Last year I tried to adjust the hysteresis curve of the fan
control in order to have a cooler laptop but had no success on&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;PS&lt;/span&gt;.: I wished a day had 48h to be able to read all the cool stuff out&amp;nbsp;there&lt;/p&gt;</content><category term="Uncategorized"></category><category term="acpi"></category><category term="kernel"></category><category term="Linux"></category><category term="perf"></category></entry><entry><title>Pescaria 2010</title><link href="https://politreco.com/2010/03/pescaria-2010/" rel="alternate"></link><published>2010-03-21T21:33:00-07:00</published><updated>2010-03-21T21:33:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-03-21:/2010/03/pescaria-2010/</id><content type="html">&lt;p&gt;Final de semana pra relaxar com a família. Seguindo a sugestão de
&lt;a href="http://www.youtube.com/watch?v=sFzRXHcL1e4"&gt;Ataíde e Alexandre&lt;/a&gt;, fomos
pescar. Que pena que o meu peixe de 12kg acabou escapando. Algumas&amp;nbsp;fotos:&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221;
caption=&amp;#8221;Respiração&amp;#8221;]&lt;a href="http://picasaweb.google.com.br/lh/photo/yX_iDaIu7dAzoVGnv5ZAng?feat=directlink"&gt;&lt;img alt="" src="http://lh4.ggpht.com/_5ShG8lbXlTw/S6ZybnV3byI/AAAAAAAAFRA/UwXqcwjO5RY/s640/IMG_1460.JPG" title="Respiração" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221;
caption=&amp;#8221;Peixão&amp;#8221;]&lt;a href="http://picasaweb.google.com.br/lh/photo/wQyOVgjBxe1taenbmUtbiw?feat=directlink"&gt;&lt;img alt="" src="http://lh5.ggpht.com/_5ShG8lbXlTw/S6ZynsqQ2OI/AAAAAAAAFRE/LkYZvwKZuHg/s640/IMG_1461.JPG" title="Peixão" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;Meu pai pegando
um
peixe&amp;#8221;]&lt;a href="http://picasaweb.google.com.br/lh/photo/Qwx_kgDM7xt66STS13S5-g?feat=directlink"&gt;&lt;img alt="" src="http://lh4.ggpht.com/_5ShG8lbXlTw/S6Zx3012cZI/AAAAAAAAFQg/cK_zBEzrHyc/s640/IMG_1452.JPG" title="Meu pai pegando um peixe" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Mais fotos em:
&lt;a href="http://picasaweb.google.com.br/lucas.de.marchi/Pescaria?feat=directlink"&gt;http://picasaweb.google.com.br/lucas.de.marchi/Pescaria?feat=directlink&lt;/a&gt;&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Stripping perf out from kernel source</title><link href="https://politreco.com/2010/03/stripping-perf-out-from-kernel-source/" rel="alternate"></link><published>2010-03-10T14:19:00-08:00</published><updated>2010-03-10T14:19:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-03-10:/2010/03/stripping-perf-out-from-kernel-source/</id><summary type="html">&lt;p&gt;You may have heard about perf, a tool made by Linux kernel developers to
help debugging, benchmarking and&amp;nbsp;profiling.&lt;/p&gt;
&lt;p&gt;The problem is you have to download the whole kernel source in order to
compile perf. If you are not used to follow kernel developping, most
likely you will not have its source. But it&amp;#8217;s still possible to compile&amp;nbsp;perf.&lt;/p&gt;
&lt;p&gt;As I&amp;#8217;m helping to maintain &lt;a href="http://aur.archlinux.org/packages.php?ID=31439"&gt;perf
package&lt;/a&gt; in
&lt;a href="http://www.archlinux.org/"&gt;Archlinux&lt;/a&gt;, I made the following script to
strip perf from a given kernel&amp;nbsp;version:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;usage&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;
This&lt;span class="w"&gt; &lt;/span&gt;script&lt;span class="w"&gt; &lt;/span&gt;works&lt;span class="w"&gt; &lt;/span&gt;fine&lt;span class="w"&gt; &lt;/span&gt;with&lt;span class="w"&gt; &lt;/span&gt;latest&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;.6.33&lt;span class="w"&gt; &lt;/span&gt;kernel.&lt;span class="w"&gt; &lt;/span&gt;Regularly&lt;span class="w"&gt; &lt;/span&gt;I …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;You may have heard about perf, a tool made by Linux kernel developers to
help debugging, benchmarking and&amp;nbsp;profiling.&lt;/p&gt;
&lt;p&gt;The problem is you have to download the whole kernel source in order to
compile perf. If you are not used to follow kernel developping, most
likely you will not have its source. But it&amp;#8217;s still possible to compile&amp;nbsp;perf.&lt;/p&gt;
&lt;p&gt;As I&amp;#8217;m helping to maintain &lt;a href="http://aur.archlinux.org/packages.php?ID=31439"&gt;perf
package&lt;/a&gt; in
&lt;a href="http://www.archlinux.org/"&gt;Archlinux&lt;/a&gt;, I made the following script to
strip perf from a given kernel&amp;nbsp;version:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;usage&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;-&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;
This&lt;span class="w"&gt; &lt;/span&gt;script&lt;span class="w"&gt; &lt;/span&gt;works&lt;span class="w"&gt; &lt;/span&gt;fine&lt;span class="w"&gt; &lt;/span&gt;with&lt;span class="w"&gt; &lt;/span&gt;latest&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;.6.33&lt;span class="w"&gt; &lt;/span&gt;kernel.&lt;span class="w"&gt; &lt;/span&gt;Regularly&lt;span class="w"&gt; &lt;/span&gt;I&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;m&lt;span class="w"&gt; &lt;/span&gt;uploading&lt;span class="w"&gt; &lt;/span&gt;to&lt;span class="w"&gt; &lt;/span&gt;this&lt;span class="w"&gt; &lt;/span&gt;site&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;stripped&lt;span class="w"&gt; &lt;/span&gt;version&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;perf.&lt;span class="w"&gt; &lt;/span&gt;The&lt;span class="w"&gt; &lt;/span&gt;latest&lt;span class="w"&gt; &lt;/span&gt;one,&lt;span class="w"&gt; &lt;/span&gt;you&lt;span class="w"&gt; &lt;/span&gt;find&lt;span class="w"&gt; &lt;/span&gt;here.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="Uncategorized"></category></entry><entry><title>Mais um infeliz cliente da Telefônica</title><link href="https://politreco.com/2010/02/mais-um-infeliz-cliente-da-telefonica/" rel="alternate"></link><published>2010-02-25T05:01:00-08:00</published><updated>2010-02-25T05:01:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-02-25:/2010/02/mais-um-infeliz-cliente-da-telefonica/</id><summary type="html">&lt;p&gt;É impressionante como a Telefônica pode ser uma operadora tão ruim. Não
bastasse ser ruim e cara, você fica preso a ela por diversos motivos.
Explico: tentando diminuir os gastos da linha telefônica, hoje liguei lá
para contratar uma segunda linha telefônica, mas do tipo &lt;a href="http://www.telefonica.com.br/portal/site/on/menuitem.d0b02f69c229bab126633a106970fda0/?vgnextoid=20fe5184e90a3210VgnVCM100000946ca8c0RCRD&amp;amp;vgnextchannel=7a8b789a6fb78110VgnVCM1000000102a8c0RCRD" title="Linha Lazer"&gt;Linha
Lazer&lt;/a&gt;.
A intenção era começar a usar essa segunda linha só para o speedy e
depois migrar (usando a portabilidade numérica) a outra linha para uma
operadora melhor (e &lt;a href="http://www.embratel.com.br/Embratel02/cda/portal/0,0,RE_P_2073,00.html" title="Embratel Livre"&gt;mais barata, muito mais
barata&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;A diferença de assinatura entre a Linha Clássica, que temos agora,
contra a Linha Lazer: R\$ 40,35 contra R …&lt;/p&gt;</summary><content type="html">&lt;p&gt;É impressionante como a Telefônica pode ser uma operadora tão ruim. Não
bastasse ser ruim e cara, você fica preso a ela por diversos motivos.
Explico: tentando diminuir os gastos da linha telefônica, hoje liguei lá
para contratar uma segunda linha telefônica, mas do tipo &lt;a href="http://www.telefonica.com.br/portal/site/on/menuitem.d0b02f69c229bab126633a106970fda0/?vgnextoid=20fe5184e90a3210VgnVCM100000946ca8c0RCRD&amp;amp;vgnextchannel=7a8b789a6fb78110VgnVCM1000000102a8c0RCRD" title="Linha Lazer"&gt;Linha
Lazer&lt;/a&gt;.
A intenção era começar a usar essa segunda linha só para o speedy e
depois migrar (usando a portabilidade numérica) a outra linha para uma
operadora melhor (e &lt;a href="http://www.embratel.com.br/Embratel02/cda/portal/0,0,RE_P_2073,00.html" title="Embratel Livre"&gt;mais barata, muito mais
barata&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;A diferença de assinatura entre a Linha Clássica, que temos agora,
contra a Linha Lazer: R\$ 40,35 contra R\$ 14,90. E todos os outros
serviços (em ambas) são mais caros do que no&amp;nbsp;Livre.&lt;/p&gt;
&lt;p&gt;Depois de passar todos os documentos pedidos, repetir e repetir mais uma
vez, a atendente tentou empurrar a Linha Clássica pra mim. Expliquei que
queria a Linha Lazer, e não a Clássica. Sabendo que a gente já tinha uma
outra linha (ela tinha perguntado antes), disse que a Linha Lazer não
estava disponível para a minha região. Mentira! Aposto que se não
tivéssemos nenhuma linha não teríamos problema em&amp;nbsp;contratá-la.&lt;/p&gt;
&lt;p&gt;Graças à magnífica privatização do setor de telefonia no Brasil, ela é a
única provedora de internet banda (quase) larga por aqui. Não fosse
isso, eu já teria cancelado minha linha. Sendo isso, penso seriamente em
cancelá-la de qualquer jeito e ficar sem internet mesmo, pelo menos por
um&amp;nbsp;tempo.&lt;/p&gt;
&lt;p&gt;Alguém tem&amp;nbsp;sugestão?&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;PS&lt;/span&gt;.: Não é que descobri que tem gente na &lt;a href="http://www.reclameaqui.com.br/488599/telefonica-speedy/linha-lazer-nao-esta-disponivel-para-o-senhor-entao-ta-dispo/" title="Linha Lazer? Pra quem?"&gt;mesma situação que
eu&lt;/a&gt;?&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Coming back, with git tips</title><link href="https://politreco.com/2010/02/coming-back-with-git-tips/" rel="alternate"></link><published>2010-02-10T23:52:00-08:00</published><updated>2010-02-10T23:52:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2010-02-10:/2010/02/coming-back-with-git-tips/</id><summary type="html">&lt;p&gt;So, it has been some months I last wrote on my blog. Not because I don&amp;#8217;t
have things to write, but because sometimes I&amp;#8217;m too lazy do empty my
&amp;#8220;queue of things to write about&amp;#8221;. Nothing better than start with one
thing at a&amp;nbsp;time.&lt;/p&gt;
&lt;p&gt;Since january I&amp;#8217;m working at
&lt;a href="http://profusion.mobi" title="ProFUSION"&gt;ProFUSION&lt;/a&gt;. As before when I was
mainly developing for Linux kernel and finishing my thesis (@
&lt;a href="http://www.usp.br" title="Universidade de São Paulo"&gt;&lt;span class="caps"&gt;USP&lt;/span&gt;&lt;/a&gt; /
&lt;a href="http://www.polimi.it" title="Politecnico di Milano"&gt;Polimi&lt;/a&gt;), I&amp;#8217;m using git a
lot. Even in projects in which upstream is using a centralized approach
like subversion, I simply can&amp;#8217;t live without a local tree and thus …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So, it has been some months I last wrote on my blog. Not because I don&amp;#8217;t
have things to write, but because sometimes I&amp;#8217;m too lazy do empty my
&amp;#8220;queue of things to write about&amp;#8221;. Nothing better than start with one
thing at a&amp;nbsp;time.&lt;/p&gt;
&lt;p&gt;Since january I&amp;#8217;m working at
&lt;a href="http://profusion.mobi" title="ProFUSION"&gt;ProFUSION&lt;/a&gt;. As before when I was
mainly developing for Linux kernel and finishing my thesis (@
&lt;a href="http://www.usp.br" title="Universidade de São Paulo"&gt;&lt;span class="caps"&gt;USP&lt;/span&gt;&lt;/a&gt; /
&lt;a href="http://www.polimi.it" title="Politecnico di Milano"&gt;Polimi&lt;/a&gt;), I&amp;#8217;m using git a
lot. Even in projects in which upstream is using a centralized approach
like subversion, I simply can&amp;#8217;t live without a local tree and thus, git.
So here I&amp;#8217;ll post somethings I&amp;#8217;ve been&amp;nbsp;using:&lt;/p&gt;
&lt;!--more--&gt;

&lt;h4 id="1-incrementally-add-your-changes-to-commit"&gt;1. Incrementally add your changes to&amp;nbsp;commit&lt;/h4&gt;
&lt;p&gt;One thing that is essential to keep your tree clean is to commit each
new feature in a different commit and write a proper description of what
you are doing and perhaps why you are doing that (often in case of a bug
fix). But, sometimes you don&amp;#8217;t code &amp;#8220;atomically&amp;#8221; several logically
separated parts. Instead, you may prefer to code a lot (whilst you still
have a great amount of caffeine in blood) and separate them when you
finish. Here comes the savior&amp;nbsp;command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;add&lt;span class="w"&gt; &lt;/span&gt;--patch&lt;span class="w"&gt; &lt;/span&gt;file-to-partially-add-to-commit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So you will be presented to a series of options where you can choose
which parts are going to next commit and the ones that will remain on
unstaged&amp;nbsp;area.&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://tomayko.com/writings/the-thing-about-git" title="The Thing About Git"&gt;The Thing About
Git&lt;/a&gt;
for more&amp;nbsp;details.&lt;/p&gt;
&lt;h4 id="2-using-gmail-to-receive-patches"&gt;2. Using gmail to receive&amp;nbsp;patches&lt;/h4&gt;
&lt;p&gt;While our googler friends do not implement a proper way to export emails
as mbox, with this tip we can circunvent the problem without relying on
standalone clients such as mutt.&amp;nbsp;Steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a &amp;#8216;patch&amp;#8217; label in Gmail (or whatever name you&amp;nbsp;want).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install fetchmail and procmail from your distro&amp;nbsp;repository:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Archlinux: sudo pacman -S fetchmail&amp;nbsp;procmail&lt;/li&gt;
&lt;li&gt;Gentoo: sudo emerge&amp;nbsp;&amp;#8230;&lt;/li&gt;
&lt;li&gt;Ubuntu: sudo apt-get install&amp;nbsp;&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure fetchmail to use your google account. Put this in your
    \$&lt;span class="caps"&gt;HOME&lt;/span&gt;/.fetchmailrc&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- --&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;postmaster&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;YOUR_LINUX_USER&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;bouncemail&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;no&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;spambounce&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;softbounce&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;no&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;showdots&lt;/span&gt;

&lt;span class="n"&gt;poll&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;imap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gmail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;proto&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;IMAP&lt;/span&gt;
&lt;span class="k"&gt;user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;YOUR_EMAIL@gmail.com&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;there&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;YOUR_PASS&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;YOUR_LINUX_USER&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;here&lt;/span&gt;
&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;keep&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fetchall&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ssl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mda&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;formail -c &amp;gt;&amp;gt; /PATH/TO/SAVE/patches.mbox&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;folder&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h5 id="workflow"&gt;Workflow&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;Find patches to be applied in&amp;nbsp;gmail;&lt;/li&gt;
&lt;li&gt;Mark them with &amp;#8216;patch&amp;#8217;&amp;nbsp;label;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use fetchmail to download&amp;nbsp;patches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bash
    $ fetchmail&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now you can happily apply patches saved in
    /&lt;span class="caps"&gt;PATH&lt;/span&gt;/&lt;span class="caps"&gt;TO&lt;/span&gt;/&lt;span class="caps"&gt;SAVE&lt;/span&gt;/patches.mbox to your project&amp;nbsp;with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bash
    $ git am /PATH/TO/SAVE/patches.mbox&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;</content><category term="Uncategorized"></category></entry><entry><title>Parallelizing</title><link href="https://politreco.com/2009/12/parallelizing/" rel="alternate"></link><published>2009-12-09T19:00:00-08:00</published><updated>2009-12-09T19:00:00-08:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-12-09:/2009/12/parallelizing/</id><content type="html">&lt;p&gt;Sometimes we discover that we don&amp;#8217;t have to parallelize only the
software. We must also parallelize the way it is&amp;nbsp;written.&lt;/p&gt;
&lt;p&gt;Thus, one of the last days of my graduation in Computer&amp;nbsp;Engineering:&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_220&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;560&amp;#8221;
caption=&amp;#8221;One day of hard work&amp;#8221;]&lt;a href="https://politreco.com/wp-content/uploads/2009/12/IMG_0201.JPG"&gt;&lt;img alt="One day of hard
work" src="https://politreco.com/wp-content/uploads/2009/12/IMG_0201.JPG" title="IMG_0201" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Almost&amp;nbsp;finished!&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Welcome Windows 7</title><link href="https://politreco.com/2009/10/welcome-windows-7/" rel="alternate"></link><published>2009-10-24T04:36:00-07:00</published><updated>2009-10-24T04:36:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-24:/2009/10/welcome-windows-7/</id><content type="html">&lt;p&gt;Welcome from a Linux&amp;nbsp;user&amp;#8230;&lt;/p&gt;
&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/oS5lgYscHT0&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/oS5lgYscHT0&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;</content><category term="Uncategorized"></category></entry><entry><title>Python, bpython and my university’s email</title><link href="https://politreco.com/2009/10/python-bpython-and-my-universitys-email/" rel="alternate"></link><published>2009-10-21T02:15:00-07:00</published><updated>2009-10-21T02:15:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-21:/2009/10/python-bpython-and-my-universitys-email/</id><summary type="html">&lt;p&gt;Almost a year ago I posted in my past blog (&lt;a href="http://stoa.usp.br/demarchi/weblog/37169.html" title="Using greasemonkey"&gt;in
portuguese&lt;/a&gt;,
&lt;a href="http://translate.google.com/translate?prev=hp&amp;amp;hl=en&amp;amp;js=y&amp;amp;u=http%3A%2F%2Fstoa.usp.br%2Fdemarchi%2Fweblog%2F37169.html&amp;amp;sl=auto&amp;amp;tl=en&amp;amp;history_state0=" title="Using greasemonkey"&gt;automated
translation&lt;/a&gt;)
a tutorial on how to use greasemonkey to workaround the ugly interface
of my university&amp;#8217;s webmail. More specifically, in Firefox it looses the
ability to select all emails. I took that just for an example&amp;#8230; the
real goal was to delete all emails since I access them through Gmail and
periodically I get the email:  &amp;#8220;your mailbox is full&amp;#8230;&amp;#8221;. So, how could
I delete them without having to download them all? Simple: connect
through &lt;span class="caps"&gt;POP3&lt;/span&gt; and issue the &amp;#8220;dele&amp;#8221; command. I could do that even …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Almost a year ago I posted in my past blog (&lt;a href="http://stoa.usp.br/demarchi/weblog/37169.html" title="Using greasemonkey"&gt;in
portuguese&lt;/a&gt;,
&lt;a href="http://translate.google.com/translate?prev=hp&amp;amp;hl=en&amp;amp;js=y&amp;amp;u=http%3A%2F%2Fstoa.usp.br%2Fdemarchi%2Fweblog%2F37169.html&amp;amp;sl=auto&amp;amp;tl=en&amp;amp;history_state0=" title="Using greasemonkey"&gt;automated
translation&lt;/a&gt;)
a tutorial on how to use greasemonkey to workaround the ugly interface
of my university&amp;#8217;s webmail. More specifically, in Firefox it looses the
ability to select all emails. I took that just for an example&amp;#8230; the
real goal was to delete all emails since I access them through Gmail and
periodically I get the email:  &amp;#8220;your mailbox is full&amp;#8230;&amp;#8221;. So, how could
I delete them without having to download them all? Simple: connect
through &lt;span class="caps"&gt;POP3&lt;/span&gt; and issue the &amp;#8220;dele&amp;#8221; command. I could do that even with
plain telnet, but I decided to come back to python, since it was awhile
I didn&amp;#8217;t use&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;In the same week I saw two interesting posts in my &lt;span class="caps"&gt;RSS&lt;/span&gt;&amp;nbsp;reader:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.cleberjsantos.com.br/pzp/bpython-uma-interface-ncurses-para-python"&gt;the
    first&lt;/a&gt;
    came from &lt;span class="caps"&gt;BR&lt;/span&gt;-Linux, and it&amp;#8217;s about bpython, a better &lt;span class="caps"&gt;CLI&lt;/span&gt; to python.
    It&amp;#8217;s amazing!! You can get a lot of &lt;span class="caps"&gt;IDE&lt;/span&gt;-like functionalities in your
    command line. You can view a &lt;a href="http://bpython-interpreter.org/static/bpython-screencast01.ogg" title="bpython in action"&gt;short video made by its
    author&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.freesoftwaremagazine.com/columns/moving_ide_programming_eclipse_pydev"&gt;The
    second&lt;/a&gt;
    is about pydev and came from &amp;#8220;Linux Today&amp;#8221;. With PyDev you can use
    Eclipse to edit your python code and get all functionalities you may
    out of an &lt;span class="caps"&gt;IDE&lt;/span&gt;. I still didn&amp;#8217;t use it (and I think I&amp;#8217;ll continue
    with vim) but it&amp;#8217;s an interesting post to read as it talks about &lt;span class="caps"&gt;IDE&lt;/span&gt;
    vs&amp;nbsp;vim/eclipse/other_text_editors.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And now, the&amp;nbsp;really-stupid-delete-all-mail-from-poli.py:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/usr/bin/python&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;getpass&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;poplib&lt;/span&gt;

&lt;span class="n"&gt;strServer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;pop3.poli.usp.br&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;user: &amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;poplib&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;POP3&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strServer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pass_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;getpass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getpass&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="n"&gt;numMsg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="si"&gt;%d&lt;/span&gt;&lt;span class="s1"&gt; messages in Inbox. Delete all? (yes/no) &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;numMsg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;yes&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;numMsg&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dele&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;no&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Answer yes or no&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;

&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It will ask the user and password to connect to pop3.poli.usp.br, show
the current number of messages and ask for&amp;nbsp;confirmation.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Trissa - update status</title><link href="https://politreco.com/2009/10/trissa-update-status/" rel="alternate"></link><published>2009-10-14T16:26:00-07:00</published><updated>2009-10-14T16:26:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-14:/2009/10/trissa-update-status/</id><summary type="html">&lt;p&gt;Just to let you all know some updates to Trissa: currently it&amp;#8217;s in a
hold state, waiting for next stable Ogre release, which is version 1.7.
So until they release this version I&amp;#8217;ll hold Trissa in a beta status,
although it&amp;#8217;s working great right now and all fixes for 1.0 are in&amp;nbsp;place.&lt;/p&gt;
&lt;p&gt;The biggest problem with current version of Ogre is that it doesn&amp;#8217;t have
proper support for multi-threaded games, or better, only one thread is
able to make calls to Ogre functions which change the rendering states.
In the design of Trissa …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Just to let you all know some updates to Trissa: currently it&amp;#8217;s in a
hold state, waiting for next stable Ogre release, which is version 1.7.
So until they release this version I&amp;#8217;ll hold Trissa in a beta status,
although it&amp;#8217;s working great right now and all fixes for 1.0 are in&amp;nbsp;place.&lt;/p&gt;
&lt;p&gt;The biggest problem with current version of Ogre is that it doesn&amp;#8217;t have
proper support for multi-threaded games, or better, only one thread is
able to make calls to Ogre functions which change the rendering states.
In the design of Trissa this is not currently possible as both core&amp;#8217;s
and player&amp;#8217;s code may change the&amp;nbsp;rendering.&lt;/p&gt;
&lt;p&gt;Also, I&amp;#8217;d like to clarify a thing about the name: in contrary to &lt;a href="https://politreco.com/2009/07/trissa-3d-is-arriving/" title="Trissa is arriving"&gt;what I
said&lt;/a&gt;,
&amp;#8220;trissa&amp;#8221; does &lt;strong&gt;not&lt;/strong&gt; mean &amp;#8220;tic-tac-toe&amp;#8221; in italian. The right name in
italian is &amp;#8220;tris&amp;#8221; as a friend of mine told me some months ago. However I
decided to keep the name, because I liked it, it&amp;#8217;s now properly indexed
by Google and the game is not the original&amp;nbsp;tic-tac-toe.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Game"></category><category term="tic-tac-toe"></category><category term="Trissa"></category></entry><entry><title>TinyOS</title><link href="https://politreco.com/2009/10/tinyos/" rel="alternate"></link><published>2009-10-07T01:32:00-07:00</published><updated>2009-10-07T01:32:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-07:/2009/10/tinyos/</id><summary type="html">&lt;p&gt;As I did with previous projects I had at my university, I&amp;#8217;d like to
share another one: it&amp;#8217;s a project using
&lt;a href="http://www.tinyos.net/" title="TinyOS site"&gt;TinyOS&lt;/a&gt;. It&amp;#8217;s mainly intended for
education purposes, so if you are trying to learn TinyOS, it&amp;#8217;s a good
example to look&amp;nbsp;at.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What does it&amp;nbsp;do?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s a platform to monitor temperature and humidity of various rooms in
a house. All sensors must collect data every &lt;strong&gt;X&lt;/strong&gt; seconds and send them
to &lt;strong&gt;sink&lt;/strong&gt;, a predefined node. Sink can also change the value X and
sensors may not reach sink in a single hop, so …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As I did with previous projects I had at my university, I&amp;#8217;d like to
share another one: it&amp;#8217;s a project using
&lt;a href="http://www.tinyos.net/" title="TinyOS site"&gt;TinyOS&lt;/a&gt;. It&amp;#8217;s mainly intended for
education purposes, so if you are trying to learn TinyOS, it&amp;#8217;s a good
example to look&amp;nbsp;at.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What does it&amp;nbsp;do?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s a platform to monitor temperature and humidity of various rooms in
a house. All sensors must collect data every &lt;strong&gt;X&lt;/strong&gt; seconds and send them
to &lt;strong&gt;sink&lt;/strong&gt;, a predefined node. Sink can also change the value X and
sensors may not reach sink in a single hop, so nodes have to use their
own routing protocol to send forward data from other nodes to&amp;nbsp;sink.&lt;/p&gt;
&lt;p&gt;If you are interested in this project, send me an email and so I could
help you to understand it. I think it&amp;#8217;s a good exercise to look at
source code and discover which routing protocol I was talking about
(&lt;span style="text-decoration: underline;"&gt;before&lt;/span&gt; reading the
&lt;span class="caps"&gt;README&lt;/span&gt;&amp;nbsp;file).&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffffff;"&gt;As I think I won&amp;#8217;t modify this
code anymore, rather than put it in my git repository I made a .tar.bz2
which is available here: &lt;a href="https://politreco.com/wp-content/uploads/2009/10/HouseMonitor2.tar.bz2"&gt;House Monitor source
code&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Distributed Systems"></category><category term="nesC"></category><category term="programming"></category><category term="TinyOS"></category></entry><entry><title>Testando o google translate com o último post</title><link href="https://politreco.com/2009/10/testando-o-google-translate-com-o-ultimo-post/" rel="alternate"></link><published>2009-10-02T13:57:00-07:00</published><updated>2009-10-02T13:57:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-02:/2009/10/testando-o-google-translate-com-o-ultimo-post/</id><summary type="html">&lt;p&gt;Escrevi o último post em italiano e queria testar o Google Translate.
Aqui está o &lt;a href="http://translate.google.com/translate?hl=en&amp;amp;sl=it&amp;amp;tl=pt&amp;amp;u=http%3A%2F%2Fwww.politreco.com%2F" title="Val Formazza - em português"&gt;link do último
post&lt;/a&gt;
traduzido para o&amp;nbsp;Português.&lt;/p&gt;
&lt;p&gt;Não digo que foi ruim para um tradutor automático. Em geral creio que dê
para entender, mas algumas partes foram bem divertentes. Um exemplo é a
frase &amp;#8220;&lt;span onmouseover="_tipon(this)" onmouseout="_tipoff()"&gt;Eu e meu
amigo fomos para Mateus Pomatt&amp;#8221;, tradução de &amp;#8220;&lt;/span&gt;Io e il mio amico
Matteo  siamo andati a Val Formazza&amp;#8221;. Perdeu-se todo o sentido, que
seria: Eu e meu amigo Matteo fomos a Val&amp;nbsp;Formazza.&lt;/p&gt;
&lt;p&gt;De qualquer forma achei legal poder manter a forma do site só
traduzindo-o com …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Escrevi o último post em italiano e queria testar o Google Translate.
Aqui está o &lt;a href="http://translate.google.com/translate?hl=en&amp;amp;sl=it&amp;amp;tl=pt&amp;amp;u=http%3A%2F%2Fwww.politreco.com%2F" title="Val Formazza - em português"&gt;link do último
post&lt;/a&gt;
traduzido para o&amp;nbsp;Português.&lt;/p&gt;
&lt;p&gt;Não digo que foi ruim para um tradutor automático. Em geral creio que dê
para entender, mas algumas partes foram bem divertentes. Um exemplo é a
frase &amp;#8220;&lt;span onmouseover="_tipon(this)" onmouseout="_tipoff()"&gt;Eu e meu
amigo fomos para Mateus Pomatt&amp;#8221;, tradução de &amp;#8220;&lt;/span&gt;Io e il mio amico
Matteo  siamo andati a Val Formazza&amp;#8221;. Perdeu-se todo o sentido, que
seria: Eu e meu amigo Matteo fomos a Val&amp;nbsp;Formazza.&lt;/p&gt;
&lt;p&gt;De qualquer forma achei legal poder manter a forma do site só
traduzindo-o com o Google Translate. Antes quando precisava de uma
tradução eu copiava e colava o trecho que queria&amp;nbsp;traduzir.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Val Formazza!</title><link href="https://politreco.com/2009/10/val-formazza/" rel="alternate"></link><published>2009-10-02T13:44:00-07:00</published><updated>2009-10-02T13:44:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-10-02:/2009/10/val-formazza/</id><summary type="html">&lt;p&gt;E&amp;#8217; da un po&amp;#8217; di tempo che non scrivo niente sul blog, ma è perché era un
po&amp;#8217; preso con le cose dell&amp;#8217;università. Spero poter aggiornarlo più
spesso&amp;nbsp;ora.&lt;/p&gt;
&lt;p&gt;Questo post è sulla passeggiata che ho fatto un mese fa. Io e il mio
amico Matteo  siamo andati a Val Formazza. E&amp;#8217; stato davvero
spettacolare. Non posso immaginare una persona ritornare dall&amp;#8217;Italia
senza essere andato al meno una volta in montagna. È ancora più
difficile da capire che tanti italiani non siano mai andati. Me lo
raccomando a&amp;nbsp;tutti!&lt;/p&gt;
&lt;p&gt;Vi lascio qualche&amp;nbsp;foto.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width …&lt;/p&gt;</summary><content type="html">&lt;p&gt;E&amp;#8217; da un po&amp;#8217; di tempo che non scrivo niente sul blog, ma è perché era un
po&amp;#8217; preso con le cose dell&amp;#8217;università. Spero poter aggiornarlo più
spesso&amp;nbsp;ora.&lt;/p&gt;
&lt;p&gt;Questo post è sulla passeggiata che ho fatto un mese fa. Io e il mio
amico Matteo  siamo andati a Val Formazza. E&amp;#8217; stato davvero
spettacolare. Non posso immaginare una persona ritornare dall&amp;#8217;Italia
senza essere andato al meno una volta in montagna. È ancora più
difficile da capire che tanti italiani non siano mai andati. Me lo
raccomando a&amp;nbsp;tutti!&lt;/p&gt;
&lt;p&gt;Vi lascio qualche&amp;nbsp;foto.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;Prima foto a
Val Formazza&amp;#8221;]&lt;img alt="Prima foto a Val
Formazza" src="http://lh6.ggpht.com/_5ShG8lbXlTw/SqFz8-a90-I/AAAAAAAAE6Q/HVXdg5jetGM/s640/img_0034.jpg" title="Prima foto a Val Formazza" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221;
caption=&amp;#8221;Spettacolare!&amp;#8221;]&lt;img alt="Spettacolare!" src="http://lh5.ggpht.com/_5ShG8lbXlTw/SqF0CNA_ijI/AAAAAAAAE6g/rQjSKXBjJ-8/s640/img_0037.jpg" title="Spettacolare!" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;La marmotta,
che pochi sono riusciti a vedere così vicina&amp;#8221;]&lt;img alt="La marmotta, che pochi
sono riusciti a vedere così
vicina" src="http://lh4.ggpht.com/_5ShG8lbXlTw/SqF0N1SPLjI/AAAAAAAAE6s/9af5pgNVlWo/s640/img_0040.jpg" title="La marmotta, che pochi sono riusciti a vedere così vicina" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;Io e
Matteo&amp;#8221;]&lt;img alt="Io e
Matteo" src="http://lh4.ggpht.com/_5ShG8lbXlTw/SqF0fJueW5I/AAAAAAAAE7Q/9pD7FaN7YAU/s640/img_0048.jpg" title="Io e Matteo" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;Camminando
sopra un ghiacciaio&amp;#8221;]&lt;img alt="Camminando sopra un
ghiacciaio" src="http://lh4.ggpht.com/_5ShG8lbXlTw/SqF0mwv7pKI/AAAAAAAAE7k/q4lxXJnmGus/s640/img_0053.jpg" title="Camminando sopra un ghiacciaio" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;La
discesa&amp;#8221;]&lt;img alt="La
discesa" src="http://lh5.ggpht.com/_5ShG8lbXlTw/SqF07UJuPMI/AAAAAAAAE8I/Rzn40_CE1DE/s640/img_0062.jpg" title="La discesa" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Sono tante foto belle. È difficile da scegliere quale mettere qui.
Allora vi lascio anche il link dell&amp;#8217;album se voleste guardare altre:
&lt;a href="http://picasaweb.google.com/lucas.de.marchi/Montagna" title="Una gita in montagna"&gt;Montagna&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;L&amp;#8217;ultima foto che vorrei lasciare qui è della famiglia di Matteo. Vorrei
anche ringraziare loro per avermi accolti così bene. Peccato che mancano
un suo fratello e la sua&amp;nbsp;sorella.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221; caption=&amp;#8221;Matteo&amp;#8217;s
family&amp;#8221;]&lt;img alt="Matteos
family" src="http://lh3.ggpht.com/_5ShG8lbXlTw/SqF1Cxs6jrI/AAAAAAAAE8c/mllgTkS90BE/s640/img_0066.jpg" title="Matteos family" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Una frase che sentivo spesso in Italia era &amp;#8220;beati i brasiliani per avere
le foreste, le spiagie, ecc&amp;#8230;&amp;#8221;. Io però vi dico: beati gli italiani per
avere, tra altre cose, le montagne&amp;nbsp;bellissime!&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Countdown restarted</title><link href="https://politreco.com/2009/09/countdown-restarted/" rel="alternate"></link><published>2009-09-15T12:00:00-07:00</published><updated>2009-09-15T12:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-09-15:/2009/09/countdown-restarted/</id><content type="html">&lt;p&gt;Por motivos de força maior, a &lt;a href="https://politreco.com/2009/08/the-final-countdown/" title="The final countdown"&gt;contagem
regressiva&lt;/a&gt;
foi reiniciada. Nova data: 27 de&amp;nbsp;setembro.&lt;/p&gt;
&lt;p&gt;12 dias, e&amp;nbsp;contando&amp;#8230;&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Suse studio</title><link href="https://politreco.com/2009/08/suse-studio/" rel="alternate"></link><published>2009-08-16T00:49:00-07:00</published><updated>2009-08-16T00:49:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-08-16:/2009/08/suse-studio/</id><summary type="html">&lt;p&gt;I was really impressed about the demos I saw in last Novell&amp;#8217;s
announcement : &lt;a href="http://susestudio.com/" title="Suse Studio website"&gt;Suse
Studio&lt;/a&gt;. So last week I
applied to have an account since it&amp;#8217;s not open for everybody. Today I
received the following&amp;nbsp;email:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thank you for your interest in &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio, a new service that makes&lt;br /&gt;
 it quick and easy to create and test software appliances from your
web&lt;br /&gt;
 browser.  We are pleased to invite you to try &lt;span class="caps"&gt;SUSE&lt;/span&gt;&amp;nbsp;Studio.&lt;/p&gt;
&lt;p&gt;To accept this invitation and take &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio for a spin, please&lt;br /&gt;
 visit this&amp;nbsp;link:&lt;/p&gt;
&lt;p&gt;****************************************&lt;/p&gt;
&lt;p&gt;Alternatively you can go to
&lt;a href="http://www.susestudio.com/account/invitation"&gt;http://www.susestudio.com/account …&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;</summary><content type="html">&lt;p&gt;I was really impressed about the demos I saw in last Novell&amp;#8217;s
announcement : &lt;a href="http://susestudio.com/" title="Suse Studio website"&gt;Suse
Studio&lt;/a&gt;. So last week I
applied to have an account since it&amp;#8217;s not open for everybody. Today I
received the following&amp;nbsp;email:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thank you for your interest in &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio, a new service that makes&lt;br /&gt;
 it quick and easy to create and test software appliances from your
web&lt;br /&gt;
 browser.  We are pleased to invite you to try &lt;span class="caps"&gt;SUSE&lt;/span&gt;&amp;nbsp;Studio.&lt;/p&gt;
&lt;p&gt;To accept this invitation and take &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio for a spin, please&lt;br /&gt;
 visit this&amp;nbsp;link:&lt;/p&gt;
&lt;p&gt;****************************************&lt;/p&gt;
&lt;p&gt;Alternatively you can go to
&lt;a href="http://www.susestudio.com/account/invitation"&gt;http://www.susestudio.com/account/invitation&lt;/a&gt; and manually&lt;br /&gt;
 enter your invitation code there.  Your invitation code&amp;nbsp;is:&lt;/p&gt;
&lt;p&gt;**********************&lt;/p&gt;
&lt;p&gt;We hope that you will enjoy using &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio.  If you encounter
bugs,&lt;br /&gt;
 have general feedback or want to discuss &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio you can reach
us&lt;br /&gt;
 at &lt;a href="&amp;#109;&amp;#97;&amp;#105;&amp;#108;&amp;#116;&amp;#111;&amp;#58;&amp;#102;&amp;#101;&amp;#101;&amp;#100;&amp;#98;&amp;#97;&amp;#99;&amp;#107;&amp;#64;&amp;#115;&amp;#117;&amp;#115;&amp;#101;&amp;#115;&amp;#116;&amp;#117;&amp;#100;&amp;#105;&amp;#111;&amp;#46;&amp;#99;&amp;#111;&amp;#109;"&gt;&amp;#102;&amp;#101;&amp;#101;&amp;#100;&amp;#98;&amp;#97;&amp;#99;&amp;#107;&amp;#64;&amp;#115;&amp;#117;&amp;#115;&amp;#101;&amp;#115;&amp;#116;&amp;#117;&amp;#100;&amp;#105;&amp;#111;&amp;#46;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Have fun using &lt;span class="caps"&gt;SUSE&lt;/span&gt;&amp;nbsp;Studio!&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;
 The &lt;span class="caps"&gt;SUSE&lt;/span&gt; Studio&amp;nbsp;Team&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Woww&amp;#8230; amazing!! I&amp;#8217;ll try it out and let you know what I think of it in
a few weeks. In the meantime you can see some screencasts on their
website or on
&lt;a href="http://www.youtube.com/results?search_query=suse+studio&amp;amp;search_type=&amp;amp;aq=f" title="Suse Studio on youtube"&gt;youtube&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Do you have an&amp;nbsp;account?&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>The final countdown</title><link href="https://politreco.com/2009/08/the-final-countdown/" rel="alternate"></link><published>2009-08-15T16:03:00-07:00</published><updated>2009-08-15T16:03:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-08-15:/2009/08/the-final-countdown/</id><content type="html">&lt;p&gt;Em 30 dias estarei pousando no&amp;nbsp;Brasil!!&lt;/p&gt;
&lt;p&gt;A contagem final&amp;nbsp;começou.&lt;/p&gt;
&lt;p&gt;Preparem a picanha que eu estou&amp;nbsp;chegando.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Brasil"></category><category term="Saudade"></category></entry><entry><title>Compiler’s compiler version</title><link href="https://politreco.com/2009/08/compilers-compiler-version/" rel="alternate"></link><published>2009-08-15T02:06:00-07:00</published><updated>2009-08-15T02:06:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-08-15:/2009/08/compilers-compiler-version/</id><summary type="html">&lt;p&gt;Today I was just wondering&amp;#8230; what&amp;#8217;s the version of the compiler which
compiled my compiler. Quite a strange question to make myself and I
really don&amp;#8217;t know where this curiosity came&amp;nbsp;from.&lt;/p&gt;
&lt;p&gt;Looking in
&lt;a href="http://en.wikipedia.org/wiki/Compiler" title="Compiler"&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Early compilers were written in assembly language. The first
&lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Self-hosting" title="Self-hosting"&gt;self-hosting&lt;/a&gt;&lt;/em&gt;
compiler — capable of compiling its own source code in a high-level
language — was created for
&lt;a href="http://en.wikipedia.org/wiki/Lisp_programming_language" title="Lisp programming language"&gt;Lisp&lt;/a&gt;
by Tim Hart and Mike Levin at
&lt;a href="http://en.wikipedia.org/wiki/Massachusetts_Institute_of_Technology" title="Massachusetts Institute of Technology"&gt;&lt;span class="caps"&gt;MIT&lt;/span&gt;&lt;/a&gt;
in
1962.^&lt;a href="http://en.wikipedia.org/wiki/Compiler#cite_note-1"&gt;&lt;span&gt;[&lt;/span&gt;2&lt;span&gt;]&lt;/span&gt;&lt;/a&gt;^
Since the 1970s it has become common practice to implement a compiler
in the language it compiles, although both
&lt;a href="http://en.wikipedia.org/wiki/Pascal_%28programming_language%29" title="Pascal (programming language)"&gt;Pascal&lt;/a&gt;
and
&lt;a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)"&gt;C&lt;/a&gt;
have been popular choices …&lt;/p&gt;&lt;/blockquote&gt;</summary><content type="html">&lt;p&gt;Today I was just wondering&amp;#8230; what&amp;#8217;s the version of the compiler which
compiled my compiler. Quite a strange question to make myself and I
really don&amp;#8217;t know where this curiosity came&amp;nbsp;from.&lt;/p&gt;
&lt;p&gt;Looking in
&lt;a href="http://en.wikipedia.org/wiki/Compiler" title="Compiler"&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Early compilers were written in assembly language. The first
&lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Self-hosting" title="Self-hosting"&gt;self-hosting&lt;/a&gt;&lt;/em&gt;
compiler — capable of compiling its own source code in a high-level
language — was created for
&lt;a href="http://en.wikipedia.org/wiki/Lisp_programming_language" title="Lisp programming language"&gt;Lisp&lt;/a&gt;
by Tim Hart and Mike Levin at
&lt;a href="http://en.wikipedia.org/wiki/Massachusetts_Institute_of_Technology" title="Massachusetts Institute of Technology"&gt;&lt;span class="caps"&gt;MIT&lt;/span&gt;&lt;/a&gt;
in
1962.^&lt;a href="http://en.wikipedia.org/wiki/Compiler#cite_note-1"&gt;&lt;span&gt;[&lt;/span&gt;2&lt;span&gt;]&lt;/span&gt;&lt;/a&gt;^
Since the 1970s it has become common practice to implement a compiler
in the language it compiles, although both
&lt;a href="http://en.wikipedia.org/wiki/Pascal_%28programming_language%29" title="Pascal (programming language)"&gt;Pascal&lt;/a&gt;
and
&lt;a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)"&gt;C&lt;/a&gt;
have been popular choices for implementation language. Building a
self-hosting compiler is a
&lt;a href="http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29" title="Bootstrapping (compilers)"&gt;bootstrapping&lt;/a&gt;
problem &amp;#8212; the first such compiler for a language must be compiled
either by a compiler written in a different language, or (as in Hart
and Levin&amp;#8217;s Lisp compiler) compiled by running the compiler in an
&lt;a href="http://en.wikipedia.org/wiki/Interpreter_%28computing%29" title="Interpreter (computing)"&gt;interpreter&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Interesting, don&amp;#8217;t you think? So let&amp;#8217;s see the version of your
compiler&amp;#8217;s compiler. If you use &lt;span class="caps"&gt;GCC&lt;/span&gt;, it will put a comment in section
named (surprise!) .comment. Generate the assembly correspondent to a C
source code and you are going to see in the end of the file an entry
like&amp;nbsp;this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;.size   main, .-main&lt;br /&gt;
 .ident  &amp;#8220;&lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.1&amp;#8221;&lt;br /&gt;
 .section        .note.&lt;span class="caps"&gt;GNU&lt;/span&gt;-stack,&amp;#8221;&amp;#8220;,@progbits&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, let&amp;#8217;s play with our already compiled compiler. First we have to
check the compiler&amp;nbsp;version:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[lucas@skywalker tmp]\$ gcc -v&lt;br /&gt;
 Using built-in specs.&lt;br /&gt;
 Target: i686-pc-linux-gnu&lt;br /&gt;
 Configured with: ../configure &amp;#8212;prefix=/usr &amp;#8212;enable-shared
&amp;#8212;enable-languages=c,c++,fortran,objc,obj-c++ &amp;#8212;enable-threads=posix
&amp;#8212;mandir=/usr/share/man &amp;#8212;infodir=/usr/share/info
&amp;#8212;enable-__cxa_atexit &amp;#8212;disable-multilib &amp;#8212;libdir=/usr/lib
&amp;#8212;libexecdir=/usr/lib &amp;#8212;enable-clocale=gnu &amp;#8212;disable-libstdcxx-pch
&amp;#8212;with-tune=generic&lt;br /&gt;
 Thread model: posix&lt;br /&gt;
 gcc version 4.4.1 (&lt;span class="caps"&gt;GCC&lt;/span&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Ok! Version 4.4.1. Let&amp;#8217;s use the readelf command to see the content of
.comment&amp;nbsp;section:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[lucas@skywalker tmp]\$ readelf -p .comment&amp;nbsp;/usr/bin/gcc&lt;/p&gt;
&lt;p&gt;String dump of section &amp;#8216;.comment&amp;#8217;:&lt;br /&gt;
 [     1]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.0 20090630 (prerelease)&lt;br /&gt;
 [    29]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.0 20090630 (prerelease)&lt;br /&gt;
 [    51]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;)&amp;nbsp;4.4.1&lt;/p&gt;
&lt;p&gt;[    63]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;)&amp;nbsp;4.4.1&lt;/p&gt;
&lt;p&gt;(&amp;#8230;)&lt;/p&gt;
&lt;p&gt;[   237]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.1&lt;br /&gt;
 [   249]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.1&lt;br /&gt;
 [   25b]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.0 20090630 (prerelease)&lt;br /&gt;
 [   283]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.1&lt;br /&gt;
 [   295]  &lt;span class="caps"&gt;GCC&lt;/span&gt;: (&lt;span class="caps"&gt;GNU&lt;/span&gt;) 4.4.0 20090630&amp;nbsp;(prerelease)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I didn&amp;#8217;t understand if it&amp;#8217;s 4.4.1 or 4.4.0, i.e. if it was used a prior
version to compile the current version or if current was recompiled
afterwards with this new compiler produced.  Testing random binaries in
/usr/bin seems to produce similar effects, having more than one&amp;nbsp;version.&lt;/p&gt;
&lt;p&gt;So&amp;#8230; no answers yet. Any&amp;nbsp;clues?&lt;/p&gt;</content><category term="Uncategorized"></category><category term="compiler"></category><category term="programming"></category><category term="The chicken or the egg causality dilemma"></category></entry><entry><title>Trissa 3D is arriving</title><link href="https://politreco.com/2009/07/trissa-3d-is-arriving/" rel="alternate"></link><published>2009-07-29T21:59:00-07:00</published><updated>2009-07-29T21:59:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-07-29:/2009/07/trissa-3d-is-arriving/</id><summary type="html">&lt;p&gt;I&amp;#8217;m proud to release version 0.98 of one of my projects, &lt;strong&gt;Trissa&lt;/strong&gt;.
Whilst this is not a version intended for the end-user, I&amp;#8217;d like to have
some more users to find bugs before releasing 1.0. Be warned: this is
intended for developers only. There&amp;#8217;s no package yet, so you have to
compile it yourself. Some&amp;nbsp;screenshots:&lt;/p&gt;
&lt;p&gt;&lt;img alt="First screen" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot0.png" /&gt;
&lt;img alt="About menu" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot01.png" /&gt;
&lt;img alt="Options menu" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot03.png" /&gt;
&lt;img alt="Start of a 4x4x4 Game" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_0.png" /&gt;
&lt;img alt="Choosing first position - Human Player" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_1.png" /&gt;
&lt;img alt="After some time" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_3.png" /&gt;
&lt;img alt="Minmax Player wins" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_7.png" /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m putting online also a presentation I gave about this project in my
university, Politecnico di Milano. Trissa is the name of the Tic-tac-toe
game in italian and I made it as part of a course: Laboratory of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I&amp;#8217;m proud to release version 0.98 of one of my projects, &lt;strong&gt;Trissa&lt;/strong&gt;.
Whilst this is not a version intended for the end-user, I&amp;#8217;d like to have
some more users to find bugs before releasing 1.0. Be warned: this is
intended for developers only. There&amp;#8217;s no package yet, so you have to
compile it yourself. Some&amp;nbsp;screenshots:&lt;/p&gt;
&lt;p&gt;&lt;img alt="First screen" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot0.png" /&gt;
&lt;img alt="About menu" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot01.png" /&gt;
&lt;img alt="Options menu" src="https://politreco.com/wp-content/uploads/2009/07/Screenshot03.png" /&gt;
&lt;img alt="Start of a 4x4x4 Game" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_0.png" /&gt;
&lt;img alt="Choosing first position - Human Player" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_1.png" /&gt;
&lt;img alt="After some time" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_3.png" /&gt;
&lt;img alt="Minmax Player wins" src="https://politreco.com/wp-content/uploads/2009/07/screenshot_7.png" /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m putting online also a presentation I gave about this project in my
university, Politecnico di Milano. Trissa is the name of the Tic-tac-toe
game in italian and I made it as part of a course: Laboratory of
Artificial Intelligence and Robotics. Thanks to professor Francesco
Amigoni who helped me. [
&lt;a href="https://politreco.com/wp-content/uploads/2009/07/trissa.tar.bz2" title="Trissa presentation in ODP"&gt;.odp&lt;/a&gt; /
&lt;a href="https://politreco.com/wp-content/uploads/2009/07/trissa.pdf" title="Trissa presentation in PDF"&gt;.pdf&lt;/a&gt;&amp;nbsp;]&lt;/p&gt;
&lt;p&gt;Source code is available at
&lt;a href="http://github.com/lucasdemarchi/trissa/" title="Trissa at GitHub"&gt;Github&lt;/a&gt;. To
get the last version with&amp;nbsp;git:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;git clone&amp;nbsp;git://github.com/lucasdemarchi/trissa.git&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You will need some libraries that may or may not be pointed out by the
building&amp;nbsp;system:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;scons&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;OIS&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Ogre3D&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;CEGUI&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Boost&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let me know if you have any trouble to compile it and if you find any
bugs. In &amp;#8220;&lt;span class="caps"&gt;TODO&lt;/span&gt;&amp;#8221; file there are some known&amp;nbsp;bugs.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="3d"></category><category term="Game"></category><category term="projects"></category><category term="tic-tac-toe"></category><category term="Trissa"></category></entry><entry><title>Awesome!</title><link href="https://politreco.com/2009/07/awesome/" rel="alternate"></link><published>2009-07-13T17:34:00-07:00</published><updated>2009-07-13T17:34:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-07-13:/2009/07/awesome/</id><content type="html">&lt;p&gt;Just a short post to share a beautiful Brazilian song. Two days ago my
friend was playing it, now it just doesn&amp;#8217;t get out of my head&amp;nbsp;:-)&lt;/p&gt;
&lt;p&gt;Have&amp;nbsp;fun.&lt;/p&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="445" height="364" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;param name="src" value="http://www.youtube.com/v/QEebEm6fEAE&amp;amp;hl=en&amp;amp;fs=1&amp;amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;&lt;embed type="application/x-shockwave-flash" width="445" height="364" src="http://www.youtube.com/v/QEebEm6fEAE&amp;amp;hl=en&amp;amp;fs=1&amp;amp;border=1" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;</content><category term="Uncategorized"></category></entry><entry><title>Sharing some homeworks</title><link href="https://politreco.com/2009/07/sharing-some-homeworks/" rel="alternate"></link><published>2009-07-11T23:01:00-07:00</published><updated>2009-07-11T23:01:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-07-11:/2009/07/sharing-some-homeworks/</id><summary type="html">&lt;p&gt;So, I&amp;#8217;ve spent some time last weeks doing some homeworks for courses at
Politecnico di Milano. One of them is for the course &amp;#8220;Image analysis and
synthesis&amp;#8221; in which I did together with a friend of mine some animations
in&amp;nbsp;Blender.&lt;/p&gt;
&lt;p&gt;The goal was to make some animations of sport scenes and after apply a
kind of &amp;#8220;filter&amp;#8221; in Matlab to simulate a high exposure of the camera,
or, if you prefer, to draw the trace of the ball. As the only object
moving in scene was the ball, these two are roughly the same thing. This
is done …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So, I&amp;#8217;ve spent some time last weeks doing some homeworks for courses at
Politecnico di Milano. One of them is for the course &amp;#8220;Image analysis and
synthesis&amp;#8221; in which I did together with a friend of mine some animations
in&amp;nbsp;Blender.&lt;/p&gt;
&lt;p&gt;The goal was to make some animations of sport scenes and after apply a
kind of &amp;#8220;filter&amp;#8221; in Matlab to simulate a high exposure of the camera,
or, if you prefer, to draw the trace of the ball. As the only object
moving in scene was the ball, these two are roughly the same thing. This
is done by taking the mean of W frames and making a new one from them,
where W is the &amp;#8220;window&amp;#8221; of the&amp;nbsp;algorithm.&lt;/p&gt;
&lt;p&gt;We took four sports: basketball, table tennis, golf and bowling. The
amount of things produced is \~ &lt;span class="caps"&gt;400MB&lt;/span&gt;, so I&amp;#8217;m not putting it online for
everyone. If anyone is interested in the Blender models, ask me
privately (you find my email in the &amp;#8220;About&amp;#8221; link above). I put some
animations in youtube, sou you can see them:&lt;br /&gt;
Bowling: &lt;a href="http://www.youtube.com/watch?v=YrgkLCTrsVg"&gt;http://www.youtube.com/watch?v=YrgkLCTrsVg&lt;/a&gt;&lt;br /&gt;
Table tennis: &lt;a href="http://www.youtube.com/watch?v=HmrDPdDevRM"&gt;http://www.youtube.com/watch?v=HmrDPdDevRM&lt;/a&gt;&lt;br /&gt;
Basketball: &lt;a href="http://www.youtube.com/watch?v=TjeOXhxceWA"&gt;http://www.youtube.com/watch?v=TjeOXhxceWA&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3D animation is one of the areas I admire, but definitely isn&amp;#8217;t an area
I&amp;#8217;m good at. Also, this was the first time I did something serious with
blender, so don&amp;#8217;t expect superb results (and continue reading this post
if you gave up after seeing the videos ;-)&amp;nbsp;).&lt;/p&gt;
&lt;p&gt;After thinking a while about the time Matlab took to make the final
results I decided that it could be better&amp;#8230; Two things could be
improved: (i) use more threads to calculate the new images and (ii) use
&lt;span class="caps"&gt;CPU&lt;/span&gt; optimized &lt;span class="caps"&gt;CPU&lt;/span&gt; instructions. I think it&amp;#8217;s a shame to have a dual core
with lot of specialized instructions to do things faster and don&amp;#8217;t use
them. These two goals brought me to code the algorithm in&amp;nbsp;C.&lt;/p&gt;
&lt;p&gt;I used pthreads to divide the work among threads (you say at command
line the number of threads you want, or just say it to use the number of
available processors) and freeimage to load and save images. I did made
another version that uses gdk-pixbuf to load and store images and it
took me so disappointed. To simply load and save images &lt;span class="caps"&gt;DIFFERENT&lt;/span&gt; images
(so, things that are not correlated) it needs to use synchronization
mechanisms. This leads to an algorithm not scaling very well as it
could. I also tested another one with CImg&amp;#8230; and the result was so
disappointing too. I think not every developer is performance-ish as I
am. Or not everyone cares about it as long as it is easy to use. So,
stop talking and show the&amp;nbsp;results:&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;attachment_125&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;640&amp;#8221;
caption=&amp;#8221;Time to compute in each implementation&amp;#8221;]&lt;img alt="Time to compute in
each
implementation" src="https://politreco.com/wp-content/uploads/2009/07/plot.png" title="Time to compute in each implementation" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;The best version run in less than half of the time required by Matlab! I
could also optimize more the algorithm in C to get even better results,
but I was already ok with that (read: I have other things to do). It&amp;#8217;s
also worth noting the improvement when optimizing the code for my &lt;span class="caps"&gt;CPU&lt;/span&gt;:
with one thread I got a boost of \~20% and with 2 threads of \~18%.
Particularly in this type of algorithm, it&amp;#8217;s important to use &lt;span class="caps"&gt;SSE&lt;/span&gt;/&lt;span class="caps"&gt;SSE2&lt;/span&gt;
instructions to get a faster mean of the images. In fact, viewing the
assembly code generated in this case we find these instructions as below
(the xorps, movaps are &lt;span class="caps"&gt;SSE&lt;/span&gt; instructions that operate with xmmN&amp;nbsp;registers).&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt; 8049517:       0f 57 f6                xorps  %xmm6,%xmm6
 804951a:       8b 41 04                mov    0x4(%ecx),%eax
 804951d:       8b 4d 08                mov    0x8(%ebp),%ecx
 8049520:       39 41 08                cmp    %eax,0x8(%ecx)
 8049523:       0f 82 36 06 00 00       jb     8049b5f &amp;lt;worker_thread+0x6ff&amp;gt;
 8049529:       8d 7d cc                lea    -0x34(%ebp),%edi
 804952c:       0f 29 b5 08 ff ff ff    movaps %xmm6,-0xf8(%ebp)
 8049533:       89 bd 04 ff ff ff       mov    %edi,-0xfc(%ebp)
 8049539:       89 3c 24                mov    %edi,(%esp)
 804953c:       89 44 24 08             mov    %eax,0x8(%esp)
 8049540:       c7 44 24 04 64 a2 04    movl   $0x804a264,0x4(%esp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;/blockquote&gt;
&lt;p&gt;Awesome!! &lt;span class="caps"&gt;GCC&lt;/span&gt; automatically generated a &lt;span class="caps"&gt;SSE&lt;/span&gt; optimized code. If you got
interested, see the &lt;a href="http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions"&gt;wikipedia article about
&lt;span class="caps"&gt;SSE&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The code is available under GPLv2 license at github:
&lt;a href="http://github.com/lucasdemarchi/imgmean"&gt;http://github.com/lucasdemarchi/imgmean&lt;/a&gt;. Let me know if it&amp;#8217;s useful to&amp;nbsp;you.&lt;/p&gt;</content><category term="Uncategorized"></category><category term="blaming matlab"></category><category term="Blender"></category><category term="optimizations"></category><category term="SSE"></category></entry><entry><title>The browser war continues…</title><link href="https://politreco.com/2009/07/the-browser-war-continues/" rel="alternate"></link><published>2009-07-04T11:55:00-07:00</published><updated>2009-07-04T11:55:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-07-04:/2009/07/the-browser-war-continues/</id><summary type="html">&lt;p&gt;One month ago I wrote a post talking about the new Chrome for linux, or
better yet, that the Chromium (this one is opensource) is finally
working well under Linux, and so&amp;nbsp;fast.&lt;/p&gt;
&lt;p&gt;Well, while the Chromium guys are working hard to get a decent browser,
the firefox guys didn&amp;#8217;t stop working and last week Mozilla released the
so waited Firefox&amp;nbsp;3.5.&lt;/p&gt;
&lt;!--more--&gt;

&lt;p&gt;My 2 biggest complaints about the prior version were that (i) the
awesome bar gets slow as time pass and you visit a lot of sites and (ii)
the start up time. The first one I …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One month ago I wrote a post talking about the new Chrome for linux, or
better yet, that the Chromium (this one is opensource) is finally
working well under Linux, and so&amp;nbsp;fast.&lt;/p&gt;
&lt;p&gt;Well, while the Chromium guys are working hard to get a decent browser,
the firefox guys didn&amp;#8217;t stop working and last week Mozilla released the
so waited Firefox&amp;nbsp;3.5.&lt;/p&gt;
&lt;!--more--&gt;

&lt;p&gt;My 2 biggest complaints about the prior version were that (i) the
awesome bar gets slow as time pass and you visit a lot of sites and (ii)
the start up time. The first one I learned that can be solved still in
that release optimizing the database of the bar. It uses SQLite and a
&lt;a href="http://www.gettingclever.com/2008/06/vacuum-your-firefox-3.html" title="Vacuum your firefox 3"&gt;cleaning&lt;/a&gt;
is all it needs after a while. The second problem was solved installing
the new version. Its speed is not as amazing as Chromium but it&amp;#8217;s fast&amp;nbsp;enough.&lt;/p&gt;
&lt;p&gt;The only plugin that I had that is not updated yet to this new version
is Google Gears. But frankly, I&amp;#8217;m thinking in disabling it. Although
it&amp;#8217;s amazing to access my Gmail while I&amp;#8217;m offline, I think this plugin
is heavier than it could&amp;nbsp;be.&lt;/p&gt;
&lt;p&gt;So, for now I&amp;#8217;m happy with my new Firefox, but Chromium is still
installed and I update it often. Ohh, talking about it, my issue with
&amp;#8216;dead keys&amp;#8217; in Chromium is gone. Now I can write portuguese, english and
italian always with the same keyboard&amp;nbsp;configuration.&lt;/p&gt;
&lt;p&gt;Returning to Firefox, another feature I liked so much is the new support
to &lt;a href="http://www.w3schools.com/tags/html5_video.asp" title="video tag"&gt;&lt;span class="caps"&gt;HTML5&lt;/span&gt;&amp;#8217;s video
tag&lt;/a&gt;. I hope
soon there will be no more need to use flash plugin. I think any other
browser support it yet, therefore only my friends who use Firefox 3.5
will be able to see the promotion videos below. If you didn&amp;#8217;t upgraded
yet, it&amp;#8217;s a good time to do&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;What&amp;#8217;s&amp;nbsp;new:  &lt;/p&gt;
&lt;video controls="controls"&gt;  

&lt;source src="http://videos.mozilla.org/firefox/3.5/meet/meet.ogv" type="video/ogg; codecs=&amp;quot;theora, vorbis&amp;quot;"&gt;&lt;/source&gt;  

&lt;source src="http://videos.mozilla.org/firefox/3.5/meet/meet.mp4" type="video/mp4"&gt;&lt;/source&gt;  
Your browser doesn&amp;#8217;t support this feature yet. Update to a better one:
[Firefox 3.5](http://www.getfirefox.net)  
&lt;/video&gt;

&lt;p&gt;Nice promotion video @ dailymotion. There&amp;#8217;s even Linus Torvalds on this
video (@ 7s) and it was nice to see people saying &amp;#8220;obrigado&amp;#8221; (portuguese
word to &amp;#8220;thanks&amp;#8221;), but I didn&amp;#8217;t recognize where they are from. Any&amp;nbsp;clue?  &lt;/p&gt;
&lt;video controls="controls"&gt;  

&lt;source src="http://www.dailymotion.com/cdn/OGG-320x240/video/x9euyb?key=a99e7056808342ad0868b4decfe811c814044ec"&gt;  
Your browser doesn&amp;#8217;t support this feature yet. Update to a better one:
[Firefox 3.5](http://www.getfirefox.net)  
&lt;/video&gt;

&lt;p&gt;You can see more open videos at
&lt;a href="http://openvideo.dailymotion.com"&gt;dailymotion&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Happy&amp;nbsp;browsing.&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Benvinda de volta Oficina G3</title><link href="https://politreco.com/2009/06/benvinda-de-volta-oficina-g3/" rel="alternate"></link><published>2009-06-28T14:35:00-07:00</published><updated>2009-06-28T14:35:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-06-28:/2009/06/benvinda-de-volta-oficina-g3/</id><summary type="html">&lt;p&gt;Creio que nem todos conheçam a banda Oficina G3. Em poucas palavras, é
uma banda evangélica de rock muito&amp;nbsp;boa.&lt;/p&gt;
&lt;p&gt;O rock pesado nunca foi meu estilo favorito. Passei a ouvir Oficina
principalmente quando lá pelo ano 2000 (acho) eles partiram para um
estilo mais light com CDs como &amp;#8220;Acústico&amp;#8221; e &amp;#8220;Ao Vivo no Olímpia&amp;#8221;. O
último &lt;span class="caps"&gt;CD&lt;/span&gt; deles que ouvi bastante foi o &amp;#8220;Humanos&amp;#8221; quando eles voltaram
para o rock que apesar de pesado, era ainda&amp;nbsp;&amp;#8220;ouvível&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Com a saída do vocalista &lt;span class="caps"&gt;PG&lt;/span&gt; do grupo eles deram uma &amp;#8220;recaída&amp;#8221; e depois
de algum tempo sem lançar nenhum &lt;span class="caps"&gt;CD&lt;/span&gt; lançaram …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Creio que nem todos conheçam a banda Oficina G3. Em poucas palavras, é
uma banda evangélica de rock muito&amp;nbsp;boa.&lt;/p&gt;
&lt;p&gt;O rock pesado nunca foi meu estilo favorito. Passei a ouvir Oficina
principalmente quando lá pelo ano 2000 (acho) eles partiram para um
estilo mais light com CDs como &amp;#8220;Acústico&amp;#8221; e &amp;#8220;Ao Vivo no Olímpia&amp;#8221;. O
último &lt;span class="caps"&gt;CD&lt;/span&gt; deles que ouvi bastante foi o &amp;#8220;Humanos&amp;#8221; quando eles voltaram
para o rock que apesar de pesado, era ainda&amp;nbsp;&amp;#8220;ouvível&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Com a saída do vocalista &lt;span class="caps"&gt;PG&lt;/span&gt; do grupo eles deram uma &amp;#8220;recaída&amp;#8221; e depois
de algum tempo sem lançar nenhum &lt;span class="caps"&gt;CD&lt;/span&gt; lançaram o &amp;#8220;Além do que os olhos
podem ver&amp;#8221;. Que decepção! Rock terrivelmente pesado e muito longe do meu&amp;nbsp;gosto.&lt;/p&gt;
&lt;p&gt;Bom&amp;#8230; esse post é pra falar que, navegando esses dias na internet
descobri que eles foram eleitos a melhor banda de rock gospel no &amp;#8220;Troféu
Talento 2009&amp;#8221;. Aí resolvi procurar qual tinha sido o último &lt;span class="caps"&gt;CD&lt;/span&gt; deles e
descobri que tinha um novo: &amp;#8220;Depois da Guerra&amp;#8221;. E que maravilha de &lt;span class="caps"&gt;CD&lt;/span&gt;!
Continua no estilo pesado, mas muito, muito melhor do que o anterior que
tinha ouvido. As letras não são tão bonitas e poéticas como as do João
Alexandre (um dos meus favoritos tanto na parte da letra quanto
musicalmente), mas são deveras&amp;nbsp;boas.&lt;/p&gt;
&lt;p&gt;Dou destaque para a música &amp;#8220;Continuar&amp;#8221; que você pode ouvir abaixo, uma
das mais calmas do &lt;span class="caps"&gt;CD&lt;/span&gt;.&lt;/p&gt;
&lt;object width="425" height="344" data="http://www.youtube.com/v/gPK7Qpdydaw&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;param name="src" value="http://www.youtube.com/v/gPK7Qpdydaw&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;/param&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;&lt;/object&gt;

&lt;p&gt;Descobri também que quando estou programando, ouvir uma música mais
agitada como essas me deixa mais acordado - razão pela qual Oficina G3
voltou para a minha playlist e tenho ouvido esse &lt;span class="caps"&gt;CD&lt;/span&gt; várias vezes durante
o&amp;nbsp;dia.&lt;/p&gt;
&lt;p&gt;Pergunta para meus amigos programadores: vocês escutam alguma música
enquato programam? O&amp;nbsp;que?&lt;/p&gt;</content><category term="Uncategorized"></category><category term="banda"></category><category term="música"></category><category term="Oficina G3"></category><category term="rock"></category></entry><entry><title>Meu Brasil brasileiro</title><link href="https://politreco.com/2009/06/meu-brasil-brasileiro/" rel="alternate"></link><published>2009-06-22T01:00:00-07:00</published><updated>2009-06-22T01:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-06-22:/2009/06/meu-brasil-brasileiro/</id><content type="html">&lt;p&gt;Questo post è dedicato ai miei amici italiani. Mi dispiace, ma l&amp;#8217;Italia
ha giocato troppo male e il Brasile&amp;#8230; beh, è il&amp;nbsp;Brasile!!&lt;/p&gt;
&lt;p&gt;Sentite la differenza tra il cronista brasiliano e&amp;nbsp;l&amp;#8217;italiano.&lt;/p&gt;
&lt;p&gt;Italiano:  &lt;/p&gt;
&lt;object width="445" height="364" data="http://www.youtube.com/v/Zxe46Jbm8cU&amp;amp;hl=it&amp;amp;fs=1&amp;amp;border=1" type="application/x-shockwave-flash"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;param name="src" value="http://www.youtube.com/v/Zxe46Jbm8cU&amp;amp;hl=it&amp;amp;fs=1&amp;amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;&lt;/object&gt;

&lt;p&gt;Brasiliano:  &lt;/p&gt;
&lt;object width="445" height="364"&gt;&lt;param name="movie" value="http://www.youtube.com/v/BAPAVM8J260&amp;amp;hl=it&amp;amp;fs=1&amp;amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/BAPAVM8J260&amp;amp;hl=it&amp;amp;fs=1&amp;amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"&gt;&lt;/embed&gt;&lt;/object&gt;

&lt;p&gt;Ci vediamo domani. Io sarò con la maglietta della nazionale brasiliana&amp;nbsp;;-)&lt;/p&gt;</content><category term="Uncategorized"></category></entry><entry><title>Chromium</title><link href="https://politreco.com/2009/06/chromium/" rel="alternate"></link><published>2009-06-05T22:57:00-07:00</published><updated>2009-06-05T22:57:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-06-05:/2009/06/chromium/</id><summary type="html">&lt;p&gt;After reading &lt;a href="http://www.linuxtoday.com/developer/2009060502035RVDTNT" title="Chrome on Linux: Rough, fast &amp;amp; promising"&gt;this
post&lt;/a&gt;
at &amp;#8220;Linux Today&amp;#8221; I decided to install the so expected Linux version of
Chrome, the Google&amp;#8217;s&amp;nbsp;browser.&lt;/p&gt;
&lt;p&gt;As I use Arch Linux, I haven&amp;#8217;t expected to have a compiled version
linked directly by the chromium&amp;#8217;s website. Instead, I was hoping Arch&amp;#8217;s
developers already packaged it. And, with no big surprises, they did.
Just to clarify a thing before continuing:
&lt;a href="http://chromium.org" title="Chromium"&gt;Chromium&lt;/a&gt; is the open source projected
behind Chrome (which is not&amp;nbsp;opensource).&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not writing this post to repeat what&amp;#8217;s already written there. So
read it too. As opposed to his …&lt;/p&gt;</summary><content type="html">&lt;p&gt;After reading &lt;a href="http://www.linuxtoday.com/developer/2009060502035RVDTNT" title="Chrome on Linux: Rough, fast &amp;amp; promising"&gt;this
post&lt;/a&gt;
at &amp;#8220;Linux Today&amp;#8221; I decided to install the so expected Linux version of
Chrome, the Google&amp;#8217;s&amp;nbsp;browser.&lt;/p&gt;
&lt;p&gt;As I use Arch Linux, I haven&amp;#8217;t expected to have a compiled version
linked directly by the chromium&amp;#8217;s website. Instead, I was hoping Arch&amp;#8217;s
developers already packaged it. And, with no big surprises, they did.
Just to clarify a thing before continuing:
&lt;a href="http://chromium.org" title="Chromium"&gt;Chromium&lt;/a&gt; is the open source projected
behind Chrome (which is not&amp;nbsp;opensource).&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not writing this post to repeat what&amp;#8217;s already written there. So
read it too. As opposed to his impression however, I&amp;#8217;m running it
without big problems: pages are rendered well formatted, without html or
css problems. Sure, it&amp;#8217;s not a browser to use everyday yet, but as a
pre-alpha version it&amp;#8217;s doing pretty good. Below, a picture with this
post been&amp;nbsp;written.&lt;/p&gt;
&lt;!--more--&gt;

&lt;p&gt;[caption id=&amp;#8221;attachment_92&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;553&amp;#8221;
caption=&amp;#8221;Using Chromium to post on my blog&amp;#8221;]&lt;img alt="Running chromium while
posting in my
blog" src="https://politreco.com/wp-content/uploads/2009/06/chromium_screenshot.png" title="chromium_screenshot" /&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Not everything works for me: &lt;span
style="text-decoration: line-through;"&gt;I was not able to read my emails
on Gmail, since there&amp;#8217;s one error on getting Google&amp;#8217;s certificate&lt;/span&gt;
(see &amp;#8220;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&amp;#8221; below); my keyboard with deadkeys doesn&amp;#8217;t work well, I had
to switch to a configuration with no dead keys in order to this post; a
bunch of other things are incomplete or missing (for example in the
options window) and there are some other issues as can be seen
&lt;a href="http://code.google.com/p/chromium/issues/list?can=2&amp;amp;q=https" title="chromium's issues page"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Ohhh, and I almost forgot to say: yes, it&amp;#8217;s fast&amp;#8230; sooo fast. When I
first opened it the first word I said was: &amp;#8220;owwwwhhh&amp;#8221;. Also to render
the webpages I noted a speedup comparing it to &lt;span
style="text-decoration: line-through;"&gt;Firefox&lt;/span&gt; (Swiftfox). Let&amp;#8217;s
see if it will continue to be fast like this when it gets bloated with a
lot of extensions. One architectural difference among Chromium and
Firefox I noted is that every tab is a different process. Whether this
is good or not, I don&amp;#8217;t know yet&amp;#8230; We have to wait the next versions to
make a fair&amp;nbsp;comparison.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;Today I upgraded to version 3.0.184.0 (17842) and gmail is working! The
problem with the keyboard&amp;nbsp;remains&lt;/p&gt;</content><category term="Uncategorized"></category><category term="browser"></category><category term="Chrome"></category><category term="Chromium"></category><category term="Google"></category><category term="Linux"></category></entry><entry><title>Saudade…</title><link href="https://politreco.com/2009/05/saudade/" rel="alternate"></link><published>2009-05-28T21:04:00-07:00</published><updated>2009-05-28T21:04:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-05-28:/2009/05/saudade/</id><summary type="html">&lt;p&gt;No final do ano passado meu amigo &lt;span
style="text-decoration: line-through;"&gt;Fadinha&lt;/span&gt; Ricardo publicou
um &lt;a href="http://stoa.usp.br/rifiorelli/weblog/38018.html" title="Saudade by fadinha"&gt;post em seu
blog&lt;/a&gt;
falando sobre saudade. Concordo com o sua afirmação. Como escrevi nos
comentários daquele post, em 2004 foi feita uma sondagem a tradutores
profissionais por uma empresa britânica e a palavra  &amp;#8220;saudade&amp;#8221; do
português foi &lt;a href="http://www1.folha.uol.com.br/folha/bbc/ult272u398210.shtml" title="saudade"&gt;eleita como uma das mais difíceis de se
traduzir&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;O bom porém da saudade é quando você mata ela. Que sensação&amp;nbsp;boa!!&lt;/p&gt;
&lt;p&gt;Resolvi tocar nesse assunto porque meu irmão veio me visitar. Nos
últimos dois finais de semana pude estar com ele e dar uma passeada pela
Itália. Tantos lugares, tantas …&lt;/p&gt;</summary><content type="html">&lt;p&gt;No final do ano passado meu amigo &lt;span
style="text-decoration: line-through;"&gt;Fadinha&lt;/span&gt; Ricardo publicou
um &lt;a href="http://stoa.usp.br/rifiorelli/weblog/38018.html" title="Saudade by fadinha"&gt;post em seu
blog&lt;/a&gt;
falando sobre saudade. Concordo com o sua afirmação. Como escrevi nos
comentários daquele post, em 2004 foi feita uma sondagem a tradutores
profissionais por uma empresa britânica e a palavra  &amp;#8220;saudade&amp;#8221; do
português foi &lt;a href="http://www1.folha.uol.com.br/folha/bbc/ult272u398210.shtml" title="saudade"&gt;eleita como uma das mais difíceis de se
traduzir&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;O bom porém da saudade é quando você mata ela. Que sensação&amp;nbsp;boa!!&lt;/p&gt;
&lt;p&gt;Resolvi tocar nesse assunto porque meu irmão veio me visitar. Nos
últimos dois finais de semana pude estar com ele e dar uma passeada pela
Itália. Tantos lugares, tantas emoções, tantas lembranças&amp;#8230; enfim, nos
divertimo à beça. A lista de lugares por onde passamos seria longa de
mais pra contar, então vou deixar somente os nomes das cidades (os nomes
que eu sei em português sem ficar procurando no google eu coloquei em
português, caso contrário deixei em&amp;nbsp;italiano):&lt;/p&gt;
&lt;p&gt;Milão, Como, Turim e Monza no primeiro final de&amp;nbsp;semana.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;288&amp;#8221; caption=&amp;#8221;Eu e meu
irmão&amp;#8230; A cidade de Como lá em baixo&amp;#8221;]&lt;a href="http://picasaweb.google.com/lh/photo/N38qXZjC6GKsLXmtc4tvCQ?feat=embedwebsite"&gt;&lt;img alt="Eu e meu irmão... A cidade de
Como lá em
baixo" src="http://lh4.ggpht.com/_5ShG8lbXlTw/Sh7UZRfkatI/AAAAAAAAD1g/SbJFLmYWZjM/s288/100_0326.jpg" title="Eu e meu irmão... A cidade de Como lá em baixo" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;!--more--&gt;

&lt;p&gt;No segundo final de semana (em itálico as cidades pelas quais só
passamos brevemente): Verona, &lt;em&gt;Padova&lt;/em&gt;, Rovigo, Badia, Giaciano con
Baruchela, Castelmassa, &lt;em&gt;Ferrara&lt;/em&gt;, &lt;em&gt;Bologna&lt;/em&gt;, &lt;em&gt;Firenze&lt;/em&gt;, Pisa. Na última
ficamos em um camping muito bom e depois nos separamos: eu voltei pra
Milão e ele continuou sua exploração turística da Itália indo pra&amp;nbsp;Lucca.&lt;/p&gt;
&lt;p&gt;Neste exato momento o avião dele está partindo de Roma e aposto que está
morrendo de vontade de mostrar as fotos&amp;#8230; Vou dar uma de &lt;em&gt;spoiler&lt;/em&gt; e
adiantar&amp;nbsp;algumas.&lt;/p&gt;
&lt;p&gt;+&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;+&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;+
| &lt;p&gt;                                  | &lt;p&gt;                                  |
| [caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221;  | [caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221;  |
| width=&amp;#8221;288&amp;#8221; caption=&amp;#8221;Autódromo de    | width=&amp;#8221;288&amp;#8221; caption=&amp;#8221;Agora eu no     |
| Monza&amp;#8221;]&lt;a href="http://picasaw |
| at=embedwebsite"&gt;&lt;img alt="Autódromo de              | autódromo de monza&amp;quot;][![Agora eu no  |
| Monza](http://lh5.ggpht.com/_5ShG8lb | autódromo de                         |
| XlTw/Sh7UZ2Z_kaI/AAAAAAAAD1k/u3-KrmL | monza](http://lh3.ggpht.com/_5ShG8lb |
| 2CvY/s288/100_0365.jpg &amp;quot;Autódromo de | XlTw/Sh7Uaem74rI/AAAAAAAAD1o/lXxAU7Z |
|  Monza&amp;quot;)" src="http://picasaweb.google.co | dvrE/s288/100_0358.jpg" title="Agora eu no  | | m/lh/photo/Lc3A-Cr7hBsWe8w7XT58Aw?fe | autódromo de monza" /&gt;&lt;/a&gt;[/caption]         | eb.google.com/lh/photo/ztz31joyXRzwE |
|                                      | M05e-ghBA?feat=embedwebsite)[/capti |
|                                      | on]                                 |&amp;nbsp;+&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;+&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;+&lt;/p&gt;
&lt;p&gt;Apesar de morar em Milão há cerca de 1 ano e meio, nunca tinha subido em
cima do Duomo. Fiquei pensando que tem coisas que a gente faz só como
turista e muitas vezes não aproveita a cidade aonde vive. Dois exemplos:
1. Morei na cidade de São Paulo por 4 anos e não visitei quase nenhum
ponto turístico; 2. Conheço pessoas que moram/moravam em Paris e nunca
subiram na torre Eiffel. Sendo guia turístico do meu irmão eu finalmente
pude subir no Duomo (ainda falta eu ver o afresco &amp;#8220;A última Ceia&amp;#8221;, já
que estava lotado e não pudemos&amp;nbsp;ver).&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;216&amp;#8221; caption=&amp;#8221;Em cima do
Duomo de Milão&amp;#8221;]&lt;a href="http://picasaweb.google.com/lh/photo/-Z-G1nFNFuC4CqTULvyqag?feat=embedwebsite"&gt;&lt;img alt="Em cima do Duomo de
Milão" src="http://lh6.ggpht.com/_5ShG8lbXlTw/Sh7UbCx_-vI/AAAAAAAAD1s/0oaB9Emp9U0/s288/100_0258.jpg" title="Em cima do Duomo de Milão" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Sábado à noite, jantar com os brasileiros (e &amp;#8220;agregados&amp;#8221;). Acho que deu
pra ele conhecer como é o dia-a-dia/final de semana dos estudantes
brasileiros na&amp;nbsp;Itália.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;288&amp;#8221;
caption=&amp;#8221;Jantar&amp;#8221;]&lt;a href="http://picasaweb.google.com/lh/photo/h66NWU5SeyVy0KOFI4qgoQ?feat=embedwebsite"&gt;&lt;img alt="Jantar" src="http://lh4.ggpht.com/_5ShG8lbXlTw/Sh7UbZ0IPyI/AAAAAAAAD1w/6OslqmyHxQA/s288/100_0282.jpg" title="Jantar" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Também fizemos um passeio de barco no belíssimo Lago de&amp;nbsp;Como.&lt;/p&gt;
&lt;p&gt;[caption id=&amp;#8221;&amp;#8221; align=&amp;#8221;aligncenter&amp;#8221; width=&amp;#8221;288&amp;#8221; caption=&amp;#8221;Lago de
Como&amp;#8221;]&lt;a href="http://picasaweb.google.com/lh/photo/zQVy6e7MXJ1jBHAOJDzzjg?feat=embedwebsite"&gt;&lt;img alt="Lago de
Como" src="http://lh5.ggpht.com/_5ShG8lbXlTw/Sh7Ub3bzWkI/AAAAAAAAD10/4KLZSUnQcww/s288/100_0298.jpg" title="Lago de Como" /&gt;&lt;/a&gt;[/caption]&lt;/p&gt;
&lt;p&gt;Antes que me perguntem &amp;#8220;o que vocês foram fazer em cidadezinhas
não-turísticas como Badia, Giaciano con Baruchela, etc?&amp;#8221;. Foi em
Giaciano con Baruchela que meu bisavô nasceu. Foi emocionante ver o
livro com seu registro de nascimento em 1874!! Mas as fotos daí pra
frente ficaram só com ele&amp;#8230; vou ter que esperar ele chegar no&amp;nbsp;Brasil.&lt;/p&gt;
&lt;p&gt;Pra terminar, volto ao título desse post: saudade é ruim, mas quando a
gente mata é bom de mais. Boa viagem,&amp;nbsp;Rafa.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;E a contagem regressiva pra volta pro Brasil&amp;nbsp;começou!&lt;/strong&gt;&lt;/p&gt;</content><category term="Uncategorized"></category><category term="Brasil"></category><category term="Itália"></category><category term="Saudade"></category></entry><entry><title>Playing with your cache</title><link href="https://politreco.com/2009/05/playing-with-your-cache/" rel="alternate"></link><published>2009-05-20T21:00:00-07:00</published><updated>2009-05-20T21:00:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-05-20:/2009/05/playing-with-your-cache/</id><summary type="html">&lt;p&gt;Another possible titles could be &amp;#8220;how to really slow down your computer&amp;#8221;
or &amp;#8220;why caches are so important in computer architectures&amp;#8221;. I started
playing with turning my cache on and off last week using Linux because
there are some situations in which you have to know why a piece of
software is not working as expected. A possible problem could be the
well known cache trashing, in which the contents of the cache is thrown
away very often. Turning it down may give an answer if this is really
the problem since now even running very slowly this variable is …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Another possible titles could be &amp;#8220;how to really slow down your computer&amp;#8221;
or &amp;#8220;why caches are so important in computer architectures&amp;#8221;. I started
playing with turning my cache on and off last week using Linux because
there are some situations in which you have to know why a piece of
software is not working as expected. A possible problem could be the
well known cache trashing, in which the contents of the cache is thrown
away very often. Turning it down may give an answer if this is really
the problem since now even running very slowly this variable is&amp;nbsp;eliminated.&lt;/p&gt;
&lt;p&gt;For example in my stage we had some tests showing that in certain
scenarios a quad-core machine is much slower than an equivalent single
or dual core. Next post I&amp;#8217;ll show how to play with your cores,
activating and deactivating them, so you may create your own programs
and test them against a 1, 2, 3,&amp;#8230; cores&amp;nbsp;machine.&lt;/p&gt;
&lt;p&gt;Also I think it&amp;#8217;s a good exercise to students of computer
science/engineering who are enrolled in courses as &amp;#8220;computer
architectures&amp;#8221; and &amp;#8220;operating systems&amp;#8221;. For those, two good books:
&amp;#8220;Modern Operating Systems&amp;#8221; by Tanenbaum and &amp;#8220;Computer Architecture: A
Quantitative Approach&amp;#8221; by &lt;span class="f"&gt;Hennessy and&amp;nbsp;Patterson.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="f"&gt;&lt;!--more--&gt;&lt;/span&gt;In an Intel processor there are 3 ways
to disable the cache (see section 10.5 of [1] for more&amp;nbsp;details):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Setting and unsetting&amp;nbsp;the &lt;code&gt;CD&lt;/code&gt; bit in&amp;nbsp;register &lt;code&gt;CR0&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Using page-level cache control&amp;nbsp;flags;&lt;/li&gt;
&lt;li&gt;Using &lt;span class="caps"&gt;MTRR&lt;/span&gt; (Memory Type Range&amp;nbsp;Registers);&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Since it&amp;#8217;s possible to play with disabling and enabling the caches only
in kernel mode and inside Linux MTRRs are already exported to user-space
through&amp;nbsp;the &lt;code&gt;/proc/mtrr&lt;/code&gt; pseudo-file, the third method is the easiest
and the one I chose to demonstrate&amp;nbsp;here.&lt;/p&gt;
&lt;h3 id="verifying-the-availability-of-mtrrs"&gt;Verifying the availability of&amp;nbsp;MTRRs&lt;/h3&gt;
&lt;p&gt;Before using MTRRs it&amp;#8217;s important to see if the target processor support
it. You can confirm it searching for a &lt;em&gt;mtrr&lt;/em&gt; flag int&amp;nbsp;the
&lt;code&gt;/proc/cpuinfo&lt;/code&gt; pseudo-file, which when read uses&amp;nbsp;the &lt;code&gt;CPUID&lt;/code&gt; assembly
instruction to discover the processor&amp;#8217;s capabilities. The following code
shows an&amp;nbsp;example.  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;[lucas@skywalker]$ cat /proc/cpuinfo | grep flags flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm ida tpr_shadow vnmi flexpriority&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Other two tools that can be used to see details of the processor:
dmidecode[3] (must run as root) and the stand-alone cpuid[4]
program. Neither of them come installed by default on most
distributions, but they give a lot of information about the processor
which turn them worth installing. The first parses a table named &lt;span class="caps"&gt;SMIBIOS&lt;/span&gt;
(some say &lt;span class="caps"&gt;DMI&lt;/span&gt;) reported by the &lt;span class="caps"&gt;BIOS&lt;/span&gt; while the second uses&amp;nbsp;the &lt;code&gt;CPUID&lt;/code&gt;
instruction to query the&amp;nbsp;processor.&lt;/p&gt;
&lt;h3 id="reading-mtrrs"&gt;Reading&amp;nbsp;MTRRs&lt;/h3&gt;
&lt;p&gt;After verifying you have a supported &lt;span class="caps"&gt;CPU&lt;/span&gt;, the current way of accessing
the caches can be seen reading the&amp;nbsp;file &lt;code&gt;/proc/mtrr&lt;/code&gt;.&amp;nbsp;Example:  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;[lucas@skywalker ~]$ cat /proc/mtrr reg00: base=0x000000000 (    0MB), size= 2048MB, count=1: write-back reg01: base=0x0e0000000 ( 3584MB), size=  128MB, count=1: write-combining&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The first field indicates the rule&amp;#8217;s number. It&amp;#8217;s used for deleting or
changing a rule afterwards. Base is the start memory address, size is
(sic) the size of the region in memory, count is the number of regions
with this size, and the last field is the current &amp;#8220;policy&amp;#8221; of the&amp;nbsp;cache.&lt;/p&gt;
&lt;p&gt;In this example all the physical &lt;span class="caps"&gt;RAM&lt;/span&gt; (2 &lt;span class="caps"&gt;GB&lt;/span&gt;) is accessed using a
write-back mechanism for caches. The second rule references to video
memory and is automatically configured by the X server. The following
code is a piece&amp;nbsp;of &lt;code&gt;&amp;lt;linux_source&amp;gt;/arch/x86/include/mtrr.h&lt;/code&gt; containing
the available mechanisms for cache accesses. It can also be verified in
table 10-8 of&amp;nbsp;[1].  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;#define MTRR_TYPE_UNCACHABLE 0 #define MTRR_TYPE_WRCOMB     1 /*#define MTRR_TYPE_         2*/ /*#define MTRR_TYPE_         3*/ #define MTRR_TYPE_WRTHROUGH  4 #define MTRR_TYPE_WRPROT     5 #define MTRR_TYPE_WRBACK     6 #define MTRR_NUM_TYPES       7&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Besides this way of obtaining MTRRs&amp;#8217; information, the /proc/mtrr
pseudo-file has also an &lt;span class="caps"&gt;IOCTL&lt;/span&gt; interface (the one use above is named
&lt;span class="caps"&gt;ASCII&lt;/span&gt; interface) that define some calls that could be used inside a
program. [2] has some examples how this could be done. I stick with
the first option to continue this short&amp;nbsp;tutorial.&lt;/p&gt;
&lt;h3 id="writing-mtrrs"&gt;Writing&amp;nbsp;MTRRs&lt;/h3&gt;
&lt;p&gt;You can create a new rule writting&amp;nbsp;to &lt;code&gt;/proc/mtrr&lt;/code&gt; as if it was a
regular file, indicating the base, size and type fields. New rules are
allowed to overlap existing ones, and the final result depends on the
processor. For Intel processors there&amp;#8217;s a precedence among types as&amp;nbsp;below:&lt;/p&gt;
&lt;p&gt;Uncachable &amp;gt; Write-combining &amp;gt; Write-through &amp;gt;&amp;nbsp;Write-back.&lt;/p&gt;
&lt;p&gt;Turning the caches off for a region in memory is just a matter of
changing that region&amp;#8217;s type&amp;nbsp;to &lt;code&gt;uncachable&lt;/code&gt;. You do so by writing the
desired fields&amp;nbsp;to &lt;code&gt;/proc/mtrr&lt;/code&gt;. The following example creates a third
rule setting all the memory&amp;nbsp;to &lt;code&gt;uncachable&lt;/code&gt;. Even if still exists a rule
setting all memory to write-back, because of the precedence mentioned
above the final result will be the application of this last&amp;nbsp;rule.  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@skywalker ~]# echo "base=0x00000000 size=0x80000000 type=uncachable" &amp;gt; /proc/mtrr [root@skywalker ~]# cat /proc/mtrr reg00: base=0x000000000 (    0MB), size= 2048MB, count=1: write-back reg01: base=0x0e0000000 ( 3584MB), size=  128MB, count=1: write-combining reg02: base=0x000000000 (    0MB), size= 2048MB, count=1: uncachable&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Congratulations!! Now your system will start to run really really slowly
and the it will look a little irresponsive, even in the simple task of
writing in the terminal to enable the caches again. Be patient an issue
the following command to have your system back again:&lt;br /&gt;
&lt;code&gt;[root@skywalker ~]# echo "disable=2" &amp;gt; /proc/mtrr&lt;/code&gt;&lt;br /&gt;
It uses the number of the rule you want to delete. In our case is the
one we have just created. The new set of&amp;nbsp;rules:  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@skywalker ~]# cat /proc/mtrr reg00: base=0x000000000 (    0MB), size= 2048MB, count=1: write-back reg01: base=0x0e0000000 ( 3584MB), size=  128MB, count=1: write-combining&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Note you don&amp;#8217;t have to set the whole memory to uncachable. You may set
another base and size fields so to have just a piece of it as
uncachable. Thus only programs that use this region would be running
very&amp;nbsp;slowly.&lt;/p&gt;
&lt;p&gt;Although the applications of turning the caches off are really small, I
think it&amp;#8217;s very cool. There is one limitation however that I&amp;#8217;d like to
surpass but that is not possible with x86 (at least I didn&amp;#8217;t find out a
way to do it): to turn caches on and off independently of their level,
that is, to have a level 1 cache turned off while still having it on on
level 2 and vice&amp;nbsp;versa.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;[1] Intel 64 and &lt;span class="caps"&gt;IA&lt;/span&gt;-32 Architectures Software Developer&amp;#8217;s Manual
Volume 3A: System Programming Guide, Part 1. Intel. Available at:
http://www.intel.com/Assets/&lt;span class="caps"&gt;PDF&lt;/span&gt;/manual/253668.pdf&lt;/p&gt;
&lt;p&gt;[2]&amp;nbsp;&amp;lt;linux_source&amp;gt;/Documentation/x86/mtrr.txt&lt;/p&gt;
&lt;p&gt;[3] Dmidecode. Available at&amp;nbsp;http://www.nongnu.org/dmidecode/&lt;/p&gt;
&lt;p&gt;[4] Cpuid. Available at&amp;nbsp;http://etallen.com/cpuid.html&lt;/p&gt;</content><category term="Uncategorized"></category><category term="cache"></category><category term="Linux"></category><category term="SMP"></category></entry><entry><title>Hello world - Again!</title><link href="https://politreco.com/2009/05/hello-world/" rel="alternate"></link><published>2009-05-06T17:06:00-07:00</published><updated>2009-05-06T17:06:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2009-05-06:/2009/05/hello-world/</id><content type="html">&lt;p&gt;I&amp;#8217;m back&amp;nbsp;again!!&lt;/p&gt;
&lt;p&gt;Soon I&amp;#8217;ll post some news and explain why I&amp;#8217;m changing&amp;nbsp;home.&lt;/p&gt;
&lt;p&gt;Update your RSSs as I&amp;#8217;ll not update my past blog anymore. So, as the
title&amp;nbsp;says:&lt;/p&gt;
&lt;h3 id="hello-world" style="text-align: center;"&gt;&lt;span class="caps"&gt;HELLO&lt;/span&gt; &lt;span class="caps"&gt;WORLD&lt;/span&gt;!!&lt;/h3&gt;</content><category term="Uncategorized"></category><category term="Hello word"></category><category term="new blog"></category></entry><entry><title>Driver radio STLC2590</title><link href="https://politreco.com/2008/10/driver-radio-stlc2590/" rel="alternate"></link><published>2008-10-03T15:52:00-07:00</published><updated>2008-10-03T15:52:00-07:00</updated><author><name>Lucas De Marchi</name></author><id>tag:politreco.com,2008-10-03:/2008/10/driver-radio-stlc2590/</id><summary type="html">&lt;p&gt;This is a re-post of a project I did. It&amp;#8217;s still the same, no version
upgrade. I&amp;#8217;m putting it on this blog as I don&amp;#8217;t update or track comments
on the old one and people generally go there through&amp;nbsp;google.&lt;/p&gt;
&lt;div&gt;

&amp;#8212;

&lt;/div&gt;

&lt;!-- Open class post --&gt;
&lt;p&gt;First of all I&amp;#8217;d like to thank &lt;a href="http://www.st.com/"&gt;&lt;span class="caps"&gt;ST&lt;/span&gt;
Microeletronics&lt;/a&gt; for give us the opportunity to work
on a Linux driver for their chip &lt;span class="caps"&gt;STLC2590&lt;/span&gt;. All the documentation needed
to write it was given by them. Thanks also to Patrick Bellasi, our
tutor, which has tough us so much in regard to Linux driver development,
APIs of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is a re-post of a project I did. It&amp;#8217;s still the same, no version
upgrade. I&amp;#8217;m putting it on this blog as I don&amp;#8217;t update or track comments
on the old one and people generally go there through&amp;nbsp;google.&lt;/p&gt;
&lt;div&gt;

&amp;#8212;

&lt;/div&gt;

&lt;!-- Open class post --&gt;
&lt;p&gt;First of all I&amp;#8217;d like to thank &lt;a href="http://www.st.com/"&gt;&lt;span class="caps"&gt;ST&lt;/span&gt;
Microeletronics&lt;/a&gt; for give us the opportunity to work
on a Linux driver for their chip &lt;span class="caps"&gt;STLC2590&lt;/span&gt;. All the documentation needed
to write it was given by them. Thanks also to Patrick Bellasi, our
tutor, which has tough us so much in regard to Linux driver development,
APIs of &lt;span class="caps"&gt;ST&lt;/span&gt;, tools used in this project etc. At last, I&amp;#8217;d like to thank
&lt;a href="http://www.dei.polimi.it/personale/docentidettaglio.php?id_docente=94&amp;amp;id_sezione=&amp;amp;lettera=F"&gt;William
Fornaciari&lt;/a&gt;,
which indicated us to &lt;span class="caps"&gt;ST&lt;/span&gt; so we could do this project as part of the
course &amp;#8220;Laboratory of Operating Systems and Software Design&amp;#8221; at
&lt;a href="http://www.polimi.it/"&gt;Politecnico di Milano&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is a driver intended to be used mainly on Embedded Systems and SoC.
I&amp;#8217;ve never heard about a common &lt;span class="caps"&gt;PC&lt;/span&gt; using this chip within multimedia
cards. So, all the instructions and documentation were made in the scope
of crosscompiling it for &lt;span class="caps"&gt;ARM&lt;/span&gt;&amp;nbsp;processors.&lt;/p&gt;
&lt;p&gt;Here I publish the code under the &lt;a href="http://www.gnu.org/licenses/gpl-2.0.txt"&gt;GPLv2
License&lt;/a&gt;. I remember all of you
that may use this driver that it&amp;#8217;s dependent on the &lt;span class="caps"&gt;I2C&lt;/span&gt; &lt;span class="caps"&gt;API&lt;/span&gt; of STLinux
(thought this limitation can be removed with few lines of code, but it
requires knownledge of the vanilla &lt;span class="caps"&gt;I2C&lt;/span&gt; &lt;span class="caps"&gt;API&lt;/span&gt;). Also, I recommend to use
the kernel and tools (for crosscompiling) from &lt;a href="http://www.pokylinux.org/"&gt;Poky
Linux&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Current version: 0.0.12&lt;br /&gt;
Description and features:&lt;br /&gt;
- Radio driver for chip &lt;span class="caps"&gt;STLC2520&lt;/span&gt; using &lt;span class="caps"&gt;V4L2&lt;/span&gt; &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;br /&gt;
- Configure the chip through &lt;span class="caps"&gt;I2C&lt;/span&gt;.&lt;br /&gt;
- &lt;span class="caps"&gt;RDS&lt;/span&gt; stuff is implemented. You have to use an userspace utility to get
it working: &lt;a href="http://rdsd.berlios.de/"&gt;rdsd&lt;/a&gt;.&lt;br /&gt;
- Kernel Linux 2.6.20 and tools for crosscompiling from Poky Linux.
Patches to kernel from &lt;a href="http://www.stlinux.com/"&gt;STLinux&lt;/a&gt; that include
the &lt;span class="caps"&gt;I2C&lt;/span&gt; &lt;span class="caps"&gt;API&lt;/span&gt; used.&lt;br /&gt;
- Tools used for debugging and testing: &lt;a href="http://developer.berlios.de/projects/rdsd/"&gt;rdsd and
rdsquery&lt;/a&gt;,
&lt;a href="http://www.stanford.edu/%7Eblp/fmtools/"&gt;fmtools&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Still somethings to do:&lt;br /&gt;
- Remove the &amp;#8220;exclusive_open&amp;#8221; behavior (taken from &lt;span class="caps"&gt;V4L2&lt;/span&gt;) so more than
one client at a time can connect to it (for example, one could control
radio stations, volume, etc and the other the rds stuff, that it&amp;#8217;d be
the case of fmtools and rdsd working together).&lt;br /&gt;
- Review the sleep calls inside the code to render it faster and
better.&lt;br /&gt;
- Review the need of locks on interrupt handlers of rds&amp;nbsp;data.&lt;/p&gt;
&lt;p&gt;Download the source code and documentation (in italian, as a final
report for my course):
&lt;a href="https://politreco.com/wp-content/uploads/2009/08/stlc2590-0.0.12.tar.bz2" title="Driver STLC2590"&gt;stlc2590-0.0.12.tar.bz2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to know more about the driver or its development, I really
encourage you to:&lt;br /&gt;
1) Read the documentation (if you are Italian please translate it -
documentation is also under GPLv2 and the .odt and image files are
given);&lt;br /&gt;
2) Contact me (either through the comments space or by email)&lt;br /&gt;
3) Hire me to work with you ;-)&lt;br /&gt;
As an academic work I think it can also be useful for those which are
learning Linux and Kernel Programming. If you want to learn more you
should get this driver as example and also read books (at least some
chapters) like &lt;a href="http://lwn.net/Kernel/LDD3/"&gt;Linux Device Drivers&lt;/a&gt;
(available online) and &lt;a href="http://www.advancedlinuxprogramming.com/"&gt;Advanced Linux
Programming&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy&amp;nbsp;it.&lt;/p&gt;</content><category term="Uncategorized"></category></entry></feed>