<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://blog.copton.net/"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>copton.net</title>
<atom:link href="http://blog.copton.net/rss.xml" rel="self" type="application/rss+xml" />
<link>http://blog.copton.net</link>
<description>2.4263102175e-12</description>
<dc:language>en-us</dc:language>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:date>2012-01-10T18:00:38+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://blog.copton.net/archives/2012/01/10/scrab_your_boilerplate/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2012/01/10/scrab_your_boilerplate/index.html</guid>
<title>Scrab your Boilerplate</title>
<dc:date>2012-01-10T18:00:37+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Since this year, there is a <a href="http://www.meetup.com/HaskellerZ/">Haskell user group in Zurich</a>. And recently we have started a series of workshops to share experience and knowledge all around the Haskell language, its libraries and tools.</p>

<p>I started with <a href="http://www.meetup.com/HaskellerZ/events/41103392/">Play with SYB and QuickCheck</a>. In the end demonstrating and discussing <a href="http://research.microsoft.com/en-us/um/people/simonpj/papers/hmap/">Scrap your Boilerplate</a> took so long that we adjourned Quickcheck.</p>

<p>Scrap Your Boilerplate in combination with the <a href="http://hackage.haskell.org/package/language-c">Language.C</a> library gives you the power to implement source to source transformations of C programs with very few lines of codes. That's why I make heavy use of it in the implementation of the <a href="https://github.com/copton/ocram/">Ocram</a> compiler.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2012/01/10/bitcoin/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2012/01/10/bitcoin/index.html</guid>
<title>Bitcoin</title>
<dc:date>2012-01-10T17:49:45+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Am Montag habe ich wieder einen Bitcoin-Vortrag gehalten. Dieses mal als <a href="http://ulm.ccc.de/ChaosSeminar/2012/01_Bitcoin">Chaosseminar</a> beim <a href="http://ulm.ccc.de">CCC Ulm</a>.</p>

<p>Die <a href="http://copton.net/res/copton-bitcoin.odp">Slides</a> sind fast die selben wie beim letzten Vortrag. Allerdings wird es von diesem Vortrag bald eine Videoaufzeichnung geben.</p>

<p>Auf dem <a href="http://events.ccc.de/congress/2011/wiki/Welcome">28C3</a> hat es auch einen Vortrag über Bitcoin gegeben. Allerdings wurde dort, wie in vielen anderen Podcasts und Blogs auch, die Technik hinter Bitcoin nur oberflächlich erklärt. Viele Diskussionen über die Probleme und die Zukunft von Bitcoin setzen allerdings ein Verständnis der technischen Details voraus. Ich hoffe daher, dass meine Vorträge sachliche Diskussionen über Bitcoin fördern.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/10/15/bitcoin/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/10/15/bitcoin/index.html</guid>
<title>Bitcoin</title>
<dc:date>2011-10-15T17:10:04+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Today I gave another talk on <a href="http://bitcoin.org">Bitcoin</a> at the <a href="http://0x736563.org/fahrplan/2011/events/76.en.html">0sec conference</a>. Compared to previous talks on this topic I went much more into the technical detailis. It surprised me to find out how much more is behind this system. Check out the <a href="https://en.bitcoin.it/wiki/Script">Bitcoin script language</a> for example. And make sure to read about <a href="http://dot-bit.org/">Namecoin</a>.</p>

<p>Here are the <a href="http://copton.net/res/copton-bitcoin.odp">slides</a>.</p>

<p>And tomorrow, Peponi will give a talk on Bitcoin at the <a href="http://datenspuren.de/2011/fahrplan/events/4573.de.html">Datenspuren</a> which is a German privacy conference. In contrast to me, Peponi focuses on the financial aspects of Bitcoin.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/06/26/bitcoin/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/06/26/bitcoin/index.html</guid>
<title>Bitcoin</title>
<dc:date>2011-06-26T14:52:42+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Gestern habe ich wieder einen Vortrag über <a href="http://www.cosin.ch/fahrplan/2011/event/4513.en.html">Bitcoin</a> auf der <a href="http://cosin.ch">Cosin</a> gehalten. Dieses mal zusammen mit Nino, der die finanzwirtschaftlichen Askepte von Bitcoin beleuchtet hat.</p>

<p>Es ist seit dem <a href="http://eh2011.hamburg.ccc.de/fahrplan/events/4415.de.html">Easterhegg</a> ja einiges passiert mit Bitcoin. Dementsprechend ist das Interesse in der Hackergemeinde an dem Thema unbebrochen hoch. Ich bin echt gespannt, was noch passieren wird.</a>

<p>Hier sind die <a href="http://copton.net/res/copton_peponi-bitcoin-cosin2011.odp">Slides</a>.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/06/26/haskell/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/06/26/haskell/index.html</guid>
<title>Haskell</title>
<dc:date>2011-06-26T14:47:48+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Gestern habe ich einen Vortrag auf der <a href="http://cosin.ch">Cosin</a> über <a href="http://www.cosin.ch/fahrplan/2011/event/4388.en.html">Haskell</a> gehalten.</p>

<p> Ich bin sehr zufrieden mit dem Vortrag, denn ich glaube, dass die
wesentlichen Konzepte gut angekommen sind. Und es scheint ein wachsendes
Interesse an funktionaler Programmierung i.A. zu geben. Sehr schön ;-)</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/05/17/bitcoin/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/05/17/bitcoin/index.html</guid>
<title>Bitcoin</title>
<dc:date>2011-05-17T10:37:00+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>Am Ostersonntag hab ich zusammen mit <a href="http://www.khjk.org/">Pesco</a> einen Vortrag auf dem <a href="http://eh2011.hamburg.ccc.de/">Easterhegg 2011</a> über <a href="http://eh2011.hamburg.ccc.de/fahrplan/events/4415.de.html">Bitcoin</a> gehalten. Die <a href="http://copton.net/res/copton_pesco-bitcoin-easterhegg2011.pdf">Slides</a> hab ich ins Pentabarf hochgleladen, aber von dort aus hat sie wohl noch niemand auf die Webseite übertragen...
</p>

<p>
<a href="http://bitcoin.org">Bitcoin</a> ist eine denzentrale, digitale Währung. Der Schlüssel dazu ist die Idee, Konsens über globale Zustände im verteilten System zu begünstigen, indem ein Zustandswechel per kryptographischem Problem zeitaufwändig gemacht wird. Dadurch wird eine zeitliche Kollision unwahrscheinlich und das fälschen des globalen Zustandes nur möglich, wenn man mehr als 50% der Rechenleistung im verteilten System beherrscht.
</p>

<p>
Eigentlich war der Talk nicht geplant, aber nachdem ich zufällig mit Pesco über Bitcoin ins Gespräch kam und immer mehr um uns herum immer die selben Fragen dazu gestellt haben, dachten wir, dass man dieses Interesse mal mit einem Talk bedienen sollte. Zum Glück war noch ein Slot im Vortragsprogramm frei und die Orga flexibel genug, uns den spontan zu geben (thx mc.fly). Der Talk war dann auch gut besucht und es gab ziemlich schnell rege Diskussion. Immerhin geht es um Open Source, Kryptographie, verteilte Systeme, Geld, und Macht. Wer kann da schon ruhig bleiben? ;-)
</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/05/17/correct_by_construction/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/05/17/correct_by_construction/index.html</guid>
<title>Correct by Construction</title>
<dc:date>2011-05-17T10:23:48+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Vortrag</dc:subject>
<description><![CDATA[<p>
Am Ostersonntag hab ich einen Talk auf dem <a href="http://eh2011.hamburg.ccc.de/">Easterhegg 2011</a> über <a href="http://eh2011.hamburg.ccc.de/fahrplan/events/4365.de.html">Correct-by-construction</a> gegeben. Die <a href="http://copton.net/res/copton-correct_by_construction-easterhegg2011.pdf">Slides</a> hab ich ins Pentabarf hochgeladen, aber von dort aus hat sie wohl noch niemand auf die Webseite übertragen...
</p>

<p>
Das Feedback war wie zu erwarten. Einige fanden es interessant und wollten mehr wissen. Andere meinten, dass das nie in der Praxis funktionieren wird. Man wird sehen. Zumindest im Bereich von drahtlosen Sensornetzwerken weiss ich, dass Model Checking verstärkt angewendet wird, weil klassisches Debuggen dort sehr teuer und zeitaufwändig ist. Ich denke, dass sowohl Theoretiker und alsauch Praktiker ihre Vorurteile mal auf die Seite schieben und gemeinsam daran arbeiten sollten, formale Methoden alltagstauglich zu machen.
</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2011/02/27/react_a_command_line_tool_for_inotify/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2011/02/27/react_a_command_line_tool_for_inotify/index.html</guid>
<title>react, a command line tool for inotify</title>
<dc:date>2011-02-27T14:54:37+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> Publikationen</dc:subject>
<description><![CDATA[<p>Yes, it's 2011 and I am still using vim for software development. Damn, this 
editor is so good ;-). But it is not an IDE. Thus, one thing I was missing is 
automatically executing the compiler or the test suite.</p>

<p>Fortunatelly, there is the <a href="http://linux.die.net/man/7/inotify">inotify</a> API on Linux and associated <a href="http://inotify.aiken.cz/">inotify tools</a>. They let you register callbacks in the user land when something happens on the file system. And even better, there is the <a href="https://github.com/seb-m/pyinotify">PyInotify</a> project, which provides Python bindings for inotify.</p>

<p>So, I went on and wrote <a href="https://github.com/copton/react">react</a>, which is a command line tool for inotify that is based on PyInotify. This tool  monitors a directory recursively and triggers an external script every time a file that matches a user provided regular expression or shell file pattern is created or modified.</p>

<p>This tool really speeds up my vim-based software development. And it shows the value of bindings to a scripting language as I managed to finish the tool in under two hours. And as a side note: Python's <a href="http://docs.python.org/dev/library/argparse.html">argsparse</a> is awesome! It is so good that I accepted to depend on Python 3.2. Hopefully this does not exclude too many users for now.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2010/03/03/when_new_features_collide_with_old_syntax/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2010/03/03/when_new_features_collide_with_old_syntax/index.html</guid>
<title>When new features collide with old syntax</title>
<dc:date>2010-03-03T22:19:43+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> C++</dc:subject>
<description><![CDATA[<p>My C++ times are over. But Roker keeps on feeding me with input. And I could not let this one go by unnoticed.</p>

<p>To make it short, what do you think does the following program print?
<blockquote>
<code>
<pre>
#include &lt;iostream&gt;

struct X { };

class Y {
public:
    Y (const X& x) {
        std::cout &lt;&lt; "fnord" &lt;&lt; std::endl;
    }
};

int main() {
    Y d(X());
    return 0;
}
</pre>
</code>
</blockquote>
</p>

<p>At first sight it looks like everything is ok. We know that references to temporaries must be <code>const</code>, which is the case here. So we think, <code>d</code> is going to be a <code>Y</code> object which was initilized with a temporary <code>X</code> object. In this case, the program should output "fnord".</code>

<p>But it doesn't. Instead it prints nothing. Mysterious you think? So did I. So I started debugging the issue while Roker was giggling. So, if <code>d</code> is not a <code>Y</code> object, what is it then? Let's ask the compiler and the C++ runtime:
<blockquote>
<code>
<pre>
#include &lt;typeinfo&gt;
//...
int main() {
    Y d(X());
    std::cout << typeid(d).name() << std::endl;
    return 0;
}
</pre>
</code>
</blockquote>
</p>

<p>The program now prints "F1YPF1XvEE". Hmm, I can not decrypt this, can you? We need to <a href="http://www.codesourcery.com/public/cxx-abi/abi.html#mangling">demangle</a> the name in order to see it's real C++ nature:
<blockquote>
<code>
<pre>
$ c++filt -t F1YPF1XvEE
Y ()(X (*)())
</pre>
</code>
</blockquote>
</p>

<p>Who can decrypt this? If you can't, here is a <a href="http://unixwiz.net/techtips/reading-cdecl.html">howto on reading C type declarations</a>, because the unfamiliar syntax for function types is a C heritage. And what does this type mean after all? It means, that <code>d</code> is a function which returns a <code>Y</code> object and expects a pointer to a function which returns a <code>X</code> object and expects nothing. Got it? If not, here is how I would write it, in case I would need such a type:
<blockquote>
<code>
<pre>
#include &lt;iostream&gt;
#include &lt;typeinfo&gt;

struct X { };
class Y { /*...*/ }; 

typedef X (Inner)();
typedef Y (Outer)(Inner);

int main()
{
    Outer d;
    std::cout &lt;&lt; typeid(d).name() &lt;&lt; std::endl;
    return 0;
}
</pre>
</code>
</blockquote>
This program prints <code>Y ()(X (*)())</code> which is the type of <code>d</code> from the original program.</p>

<p>
Ok, so now we know, what the program does. It declares a function. That's why there is no <code>X</code> object ever created. So, although the code could mean what we originally intended, the compiler chooses to understand something else, which is also possible due to the C syntax rules. Although I still don't know what function declarations inside other functions are good for, the compiler <a href="http://blog.copton.net/archives/2006/08/31/special_treatment_of_default_constructors/index.html">again</a> prefers them. Anyway, what's the C way of removing ambiguity from syntax? Right, it's parantheses:
<blockquote>
<code>
<pre>
//...
int main()
{
    Y o((X()));
    std::cout &lt;&lt; typeid(o).name() &lt;&lt; std::endl;
    return 0;
}
</pre>
</code>
</blockquote>
Now, the program prints "fnord" and "1Y" which is the mangled name for the type <code>Y</code>.
</p>

<p>To sum it up, this is yet another example for why I consider the C heritage to be a major source of trouble for C++ developers. The C syntax was never designed for temporary variables and combining both yields to what we have seen here: ambiguity, ugly workarounds and surprise and furstration for the developer. Don't get me wrong, though. I still think that C++ could hardly have been made better given the design goals which where taken those days. I truly have a love-hate for that language.</p>]]></description>

</item>
<item>
<link>http://blog.copton.net/archives/2009/11/09/c_pitfalls/index.html</link>
<guid isPermaLink="true">http://blog.copton.net/archives/2009/11/09/c_pitfalls/index.html</guid>
<title>C++ Pitfalls </title>
<dc:date>2009-11-09T11:27:42+01:00</dc:date>
<dc:creator>Alexander Bernauer</dc:creator>
<dc:subject> C++</dc:subject>
<description><![CDATA[<p>As I do no C++ hacking at ETH I have not stumbled upon new input for this
blog on my own. So I am very happy that Roker keeps on feeding me.</p>

<p>Today he pointed me at <a href="http://www.horstmann.com/">Cay Horstmann</a>'s 
list of <a href="http://www.horstmann.com/cpp/pitfalls.html">C++ pitfalls</a>. 
Some of the issues have already been covered here but some haven't. I recommend
reading it to every C++ developer as this takes less time than learning it the
hard way by debugging code. Have fun.</p>

<p>
Concerning the iterator issues Cay provides a 
<a href="http://www.horstmann.com/safestl.html">Safe STL</a> implementation which
is supposed to be used as a drop in replacement for the STL during development.
It adds state and knowledge about the owner to iterators and uses this
information to do runtime checks. If you accidently use your iterators in a
wrong way you end up with a comprehensive runtime error instead of a segfault
"deep in the bowels of STL code". </p>

<p>
I haven't tested Safe STL. If anybody did feel free to send me your experience.
I would be glad to blog about it.
</p>]]></description>

</item>
</channel>
</rss>

