<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. https://www.livejournal.com/bots/  -->
<rss version='2.0'  xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>teejeejee</title>
  <link>https://teejeejee.livejournal.com/</link>
  <description>teejeejee - LiveJournal.com</description>
  <lastBuildDate>Sun, 22 May 2011 10:31:12 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>teejeejee</lj:journal>
  <lj:journalid>12740574</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://l-userpic.livejournal.com/100672549/12740574</url>
    <title>teejeejee</title>
    <link>https://teejeejee.livejournal.com/</link>
    <width>96</width>
    <height>96</height>
  </image>

  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/6021.html</guid>
  <pubDate>Sun, 22 May 2011 10:31:12 GMT</pubDate>
  <title>Introducing CORBA</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/6021.html</link>
  <description>&lt;h1&gt;What is CORBA?&lt;/h1&gt;
&lt;p&gt;The &lt;a class=&quot;&quot; href=&quot;http://en.wikipedia.org/wiki/CORBA&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;wikipedia page&lt;/a&gt; says it all:&lt;/p&gt;
&lt;pre class=&quot;&quot;&gt;
The Common Object Request Broker Architecture (CORBA) is a standard
defined by the Object Management Group (OMG) that enables software
components written in mutiple computer languages and running on
multiple computers to work together (i.e., it supports mutiple
platforms).
&lt;/pre&gt;
&lt;p&gt;The standard was created twenty years ago, in 1991. The technology can
be used in many programming languages: Python, Java, C++, C, etc.&lt;/p&gt;
&lt;p&gt;Hence you can write a software in your favorite programming language,
exposing services that others will be able to call using a different
language. (Nowadays you can do the same with WebServices. This article
is about CORBA.)&lt;/p&gt;
&lt;p&gt;All CORBA specifications are available on &lt;a class=&quot;&quot; href=&quot;#omgspec&quot; target=&quot;_blank&quot;&gt;[OMGSPEC]&lt;/a&gt;; latest version
is &lt;a class=&quot;&quot; href=&quot;#corba3-1&quot; target=&quot;_blank&quot;&gt;[CORBA3.1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;&quot; href=&quot;#mchale&quot; target=&quot;_blank&quot;&gt;[MCHALE]&lt;/a&gt; book is a very good way to learn CORBA.&lt;/p&gt;

&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;How does it work?&lt;/h1&gt;
&lt;p&gt;CORBA is language agnostic because it relies on its own language: the
&lt;em&gt;Interface Definition Language&lt;/em&gt; (IDL for short). The IDL defines the
contract between the client (software calling the service) and the
server (software implementing the service). The service is exposed
through a remote object.&lt;/p&gt;
&lt;p&gt;IDL is used to define:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;module&lt;/tt&gt;s, which are called namespaces in C++ (or packages in
Java)&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;struct&lt;/tt&gt;s, which are like C structs: they can contain data only
(the data part of the contract)&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;interface&lt;/tt&gt;s, which contain methods specification (the service
part of the contract)&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;exception&lt;/tt&gt;s that can be raised by a method&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;typedef&lt;/tt&gt;s which are type aliases&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;union&lt;/tt&gt;s, à la C&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;enum&lt;/tt&gt;s, enumerations&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;const&lt;/tt&gt;ants&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;IDL comes with existing types:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;char&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;octet&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;string&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;wstring&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;short&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;long&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;long long&lt;/tt&gt; (signed if unspecified, unsigned
if prefixed with &lt;tt class=&quot;&quot;&gt;unsigned&lt;/tt&gt;)&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;float&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;double&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;long double&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;arrays&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;sequence&lt;/tt&gt;s&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;any&lt;/tt&gt; which can be any existing or user-defined type&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From this contract, the following code will be generated using a
dedicated tool:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;client-side code, called &lt;em&gt;stubs&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;server-side code, called &lt;em&gt;skeletons&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So to call a CORBA remote service in a given programming language, we
will generate stubs from the IDL, then write code relying on these
stubs. To provide a CORBA service in a given progamming language, we
will generate skeletons from the IDL, then extend them with our
implementation.&lt;/p&gt;
&lt;p&gt;The dispatching and networking machinery is handled by the &lt;em&gt;Object
Request Broker&lt;/em&gt; (ORB for short). That&apos;s the most important part of the
CORBA system: it&apos;s the component that hides away remoting aspects to
make distant objects appear as if they were embedded within the local,
client-side code.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;Telecom Log Service example&lt;/h1&gt;
&lt;p&gt;The Telecom Log Service &lt;a class=&quot;&quot; href=&quot;#tlog&quot; target=&quot;_blank&quot;&gt;[TLOG]&lt;/a&gt; is an OMG specified service that
defines two interfaces:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;Log&lt;/tt&gt;, to add, search and delete records&lt;/li&gt;
&lt;li&gt;&lt;tt class=&quot;&quot;&gt;LogMgr&lt;/tt&gt;, a &lt;tt class=&quot;&quot;&gt;Log&lt;/tt&gt; container to lookup a given log, or list all
contained logs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The specification details five sub-interfaces of the log service,
grouped into three different approaches:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;em&gt;basic&lt;/em&gt; implementation. This is the service depicted below.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;event-based&lt;/em&gt; implementation. The Event Service &lt;a class=&quot;&quot; href=&quot;#event&quot; target=&quot;_blank&quot;&gt;[EVENT]&lt;/a&gt; is another
CORBA service specification. Combining both services means that
software emitting events can be plugged to an Event Log without
modification.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;notify-based&lt;/em&gt; implementation. The Notification Service &lt;a class=&quot;&quot; href=&quot;#notif&quot; target=&quot;_blank&quot;&gt;[NOTIF]&lt;/a&gt; is
another CORBA service specification, built on top of the Event
Service, with added filtering facility. Again, combining these two
services provide easier integration with existing software.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here is the UML representation of key base interfaces (in yellow),
basic implementation (in blue) and important date structures (in
green):&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/CORBA/tls.png&quot; src=&quot;https://imgprx.livejournal.net/6a6026884d3c932bc02b62a7915f083d67625dfe1b7a16e20b81f15ff55e03d2/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-lW1nvhyRdw9WU0ICmlom:ABWW3gElnQTStiyiqLSG_g&quot; fetchpriority=&quot;high&quot; /&gt;
&lt;p&gt;Here is the simplified IDL for these parts:&lt;/p&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;&gt;

&lt;pre&gt;
&lt;span style=&quot;color: #7a378b;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #8b2252;&quot;&gt;&amp;lt;TimeBase.idl&amp;gt;&lt;/span&gt;  &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;IDL can include each other
&lt;/span&gt;&lt;span style=&quot;color: #7a378b;&quot;&gt;#pragma&lt;/span&gt; prefix &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;omg.org&quot;&lt;/span&gt; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;extra prefix to use in front of type names
&lt;/span&gt;
&lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;DsLogAdmin definition
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Because of the #pragma prefix above, the complete name of this module
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;is omg.org/DsLogAdmin
&lt;/span&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;module&lt;/span&gt; &lt;span style=&quot;color: #008b8b;&quot;&gt;DsLogAdmin&lt;/span&gt;
{
        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;E X C E P T I O N --------------------------------------------------
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;InvalidGrammar&lt;/span&gt; {};                    &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;empty exception
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;InvalidConstraint&lt;/span&gt; {};                 &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;empty exception
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;LogFull&lt;/span&gt; { &lt;span style=&quot;color: #228b22;&quot;&gt;short&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;n_records_written&lt;/span&gt;; }; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;one attribute
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;LogOffDuty&lt;/span&gt; {};                        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;empty exception
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;LogLocked&lt;/span&gt; {};                         &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;empty exception
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;exception&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;LogDisabled&lt;/span&gt; {};                       &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;empty exception
&lt;/span&gt;
        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;T Y P E   A L I A S ------------------------------------------------
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt;;
        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;sequence&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogIdList&lt;/span&gt;; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;LogIdList is a sequence of LogId
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;RecordId&lt;/span&gt;;
        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Constraint&lt;/span&gt;;
        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #008b8b;&quot;&gt;TimeBase&lt;/span&gt;::&lt;span style=&quot;color: #228b22;&quot;&gt;TimeT&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;TimeT&lt;/span&gt;; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;TimeT type defined in TimeBase module
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;sequence&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #228b22;&quot;&gt;any&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Anys&lt;/span&gt;;    &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Anys is the name of a sequence of any
&lt;/span&gt;
        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;S T R U C T U R E S ------------------------------------------------
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;NVPair&lt;/span&gt; {
                &lt;span style=&quot;color: #228b22;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;name&lt;/span&gt;;
                &lt;span style=&quot;color: #228b22;&quot;&gt;any&lt;/span&gt;    &lt;span style=&quot;color: #a0522d;&quot;&gt;value&lt;/span&gt;;
        }; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;&amp;lt;-- Mandatory semi-colon
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;sequence&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #228b22;&quot;&gt;NVPair&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #228b22;&quot;&gt;NVList&lt;/span&gt;; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Give a name to a sequence of NVPair
&lt;/span&gt;
        &lt;span style=&quot;color: #a020f0;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogRecord&lt;/span&gt; {
                &lt;span style=&quot;color: #228b22;&quot;&gt;RecordId&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;id&lt;/span&gt;;
                &lt;span style=&quot;color: #228b22;&quot;&gt;TimeT&lt;/span&gt;    &lt;span style=&quot;color: #a0522d;&quot;&gt;time&lt;/span&gt;;
                &lt;span style=&quot;color: #228b22;&quot;&gt;NVList&lt;/span&gt;   &lt;span style=&quot;color: #a0522d;&quot;&gt;attr_list&lt;/span&gt;;
                &lt;span style=&quot;color: #228b22;&quot;&gt;any&lt;/span&gt;      &lt;span style=&quot;color: #a0522d;&quot;&gt;info&lt;/span&gt;;
        };
        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;sequence&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #228b22;&quot;&gt;LogRecord&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #228b22;&quot;&gt;RecordList&lt;/span&gt;;

        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;I N T E R F A C E S ------------------------------------------------
&lt;/span&gt;        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Iterator interface specification
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Iterator&lt;/span&gt; {
                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;get() method:
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- two input parameters
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- returning a list of LogRecord
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- possibly raising InvalidParam exception
&lt;/span&gt;                &lt;span style=&quot;color: #228b22;&quot;&gt;RecordList&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;get&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;position&lt;/span&gt;,
                               &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;how_many&lt;/span&gt;)
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (InvalidParam);
                &lt;span style=&quot;color: #228b22;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;destroy&lt;/span&gt;();
        };  &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;&amp;lt;-- Mandatory semi-colon
&lt;/span&gt;
        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Forward declaration
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogMgr&lt;/span&gt;;

        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Log&lt;/span&gt;
        {
                &lt;span style=&quot;color: #228b22;&quot;&gt;LogMgr&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;my_factory&lt;/span&gt;();

                &lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;id&lt;/span&gt;();

                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;retrieve() method:
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- two input parameters
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- one output parameter
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;- returning a list of LogRecord
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;This method will actually return two objects: the
&lt;/span&gt;                &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;RecordList and the Iterator
&lt;/span&gt;                &lt;span style=&quot;color: #228b22;&quot;&gt;RecordList&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;retrieve&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;TimeT&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;from_time&lt;/span&gt;,
                                    &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;how_many&lt;/span&gt;,
                                    &lt;span style=&quot;color: #a020f0;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Iterator&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;i&lt;/span&gt;);

                &lt;span style=&quot;color: #228b22;&quot;&gt;RecordList&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;query&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;grammar&lt;/span&gt;,
                                 &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;Constraint&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;c&lt;/span&gt;,
                                 &lt;span style=&quot;color: #a020f0;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Iterator&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;i&lt;/span&gt;)
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (InvalidGrammar, InvalidConstraint);

                &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;delete_records&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;grammar&lt;/span&gt;,
                                             &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;Constraint&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;c&lt;/span&gt;)
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (InvalidGrammar, InvalidConstraint);

                &lt;span style=&quot;color: #228b22;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;write_records&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;Anys&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;records&lt;/span&gt;) 
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (LogFull, LogOffDuty, LogLocked, LogDisabled);
        };
        &lt;span style=&quot;color: #a020f0;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;sequence&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #228b22;&quot;&gt;Log&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogList&lt;/span&gt;; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Give name LogList to sequence of Log
&lt;/span&gt;
        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;inteface BasicLog derives from interface Log
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;BasicLog&lt;/span&gt; : &lt;span style=&quot;color: #228b22;&quot;&gt;Log&lt;/span&gt; {
                &lt;span style=&quot;color: #228b22;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;destroy&lt;/span&gt;();
        };

        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogMgr&lt;/span&gt;
        {
                &lt;span style=&quot;color: #228b22;&quot;&gt;LogList&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;list_logs&lt;/span&gt;();
                &lt;span style=&quot;color: #228b22;&quot;&gt;Log&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;find_log&lt;/span&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;id&lt;/span&gt;);
                &lt;span style=&quot;color: #228b22;&quot;&gt;LogIdList&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;list_logs_by_id&lt;/span&gt;();
        };

        &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;inteface BasicLogFactory derives from interface LogMgr
&lt;/span&gt;        &lt;span style=&quot;color: #a020f0;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;BasicLogFactory&lt;/span&gt; : &lt;span style=&quot;color: #228b22;&quot;&gt;LogMgr&lt;/span&gt;
        {
                &lt;span style=&quot;color: #228b22;&quot;&gt;BasicLog&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;create&lt;/span&gt;(
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;LogFullActionType&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;full_action&lt;/span&gt;,
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;max_size&lt;/span&gt;,
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;id&lt;/span&gt;)
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (InvalidLogFullAction);

                &lt;span style=&quot;color: #228b22;&quot;&gt;BasicLog&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;create_with_id&lt;/span&gt;(
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;LogId&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;id&lt;/span&gt;,
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;LogFullActionType&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;full_action&lt;/span&gt;,
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: #228b22;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #a0522d;&quot;&gt;max_size&lt;/span&gt;)
                        &lt;span style=&quot;color: #a020f0;&quot;&gt;raises&lt;/span&gt; (LogIdAlreadyExists, InvalidLogFullAction);
        };
}; &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;&amp;lt;-- Mandatory semi-colon
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;The complete IDL file for the Basic Telecom Log Service is available
&lt;a class=&quot;&quot; href=&quot;http://thomas.g.girard.free.fr/CORBA/DsLogAdmin.idl&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;hr class=&quot;&quot; /&gt;

&lt;a class=&quot;&quot; href=&quot;#id2&quot; target=&quot;_blank&quot;&gt;[CORBA3.1]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.omg.org/spec/CORBA/3.1/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.omg.org/spec/CORBA/3.1/&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;&quot; href=&quot;#id3&quot; target=&quot;_blank&quot;&gt;[MCHALE]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.ciaranmchale.com/corba-explained-simply/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.ciaranmchale.com/corba-explained-simply/&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;&quot; href=&quot;#id1&quot; target=&quot;_blank&quot;&gt;[OMGSPEC]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.omg.org/technology/documents/spec_catalog.htm#Middleware&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.omg.org/technology/documents/spec_catalog.htm#Middleware&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;&quot; href=&quot;#id4&quot; target=&quot;_blank&quot;&gt;[TLOG]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.omg.org/spec/TLOG/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.omg.org/spec/TLOG/&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;&quot; href=&quot;#id5&quot; target=&quot;_blank&quot;&gt;[EVENT]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.omg.org/spec/EVNT/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.omg.org/spec/EVNT/&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;&quot; href=&quot;#id6&quot; target=&quot;_blank&quot;&gt;[NOTIF]&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;&quot; href=&quot;http://www.omg.org/spec/NOT/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.omg.org/spec/NOT/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;</description>
  <comments>https://teejeejee.livejournal.com/6021.html?view=comments#comments</comments>
  <category>debian</category>
  <category>corba</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/5838.html</guid>
  <pubDate>Sat, 30 Apr 2011 11:33:25 GMT</pubDate>
  <title>ACE+TAO Debian packaging moved to git</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/5838.html</link>
  <description>&lt;div class=&quot;&quot;&gt;


&lt;p&gt;We recently converted Debian ACE+TAO package repository from Subversion to
git.&lt;/p&gt;
&lt;p&gt;This was a long and interesting process; I learned a lot on git in the course.
I had been using git for a while for other packages: BOUML, dwarves and
GNU Smalltalk. But I did not really get it.&lt;/p&gt;
&lt;p&gt;A preliminary study led by Pau&lt;a class=&quot;&quot; href=&quot;#id4&quot; target=&quot;_blank&quot;&gt;[1]&lt;/a&gt; showed that out of the following three tools:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;a class=&quot;&quot; href=&quot;http://www.kernel.org/pub/software/scm/git/docs/git-svn.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;git-svn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;&quot; href=&quot;https://github.com/nirvdrum/svn2git&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;nirvdrum&apos;s svn2git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;&quot; href=&quot;http://gitorious.org/svn2git&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;KDE svn2git&lt;/a&gt;&lt;a class=&quot;&quot; href=&quot;#id5&quot; target=&quot;_blank&quot;&gt;[2]&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;the last one was giving results that look better.&lt;/p&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;The conversion&lt;/h1&gt;
&lt;p&gt;&lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;svn-all-fast-export&lt;/span&gt;&lt;/tt&gt; requires physical access to the repo, so the
Alioth SVN repo was copied on my machine &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;svn-pkg-ace/&lt;/span&gt;&lt;/tt&gt;
before running the tool:&lt;/p&gt;
&lt;pre class=&quot;&quot;&gt;
svn-all-fast-export --identity-map authors.txt --rules pkg-ace.rules svn-pkg-ace
&lt;/pre&gt;
&lt;p&gt;Here&apos;s the content of the &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;pkg-ace.rules&lt;/span&gt;&lt;/tt&gt; configuration file that was
used:&lt;/p&gt;
&lt;pre class=&quot;&quot;&gt;
create repository pkg-ace
end repository

match /trunk/
  repository pkg-ace
  branch master
end match

match /(branches|tags)/([^/]+)/
  repository pkg-ace
  branch \2
end match
&lt;/pre&gt;
&lt;p&gt;The author mapping file &lt;tt class=&quot;&quot;&gt;authors.txt&lt;/tt&gt; being:&lt;/p&gt;
&lt;pre class=&quot;&quot;&gt;
markos = Konstantinos Margaritis &amp;lt;email-hidden&amp;gt;
mbrudka-guest = Marek Brudka &amp;lt;email-hidden&amp;gt;
pgquiles-guest = Pau Garcia i Quiles &amp;lt;email-hidden&amp;gt;
tgg = Thomas Girard &amp;lt;email-hidden&amp;gt;
tgg-guest = Thomas Girard &amp;lt;email-hidden&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The tool sample configuration file &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;merged-branches-tags.rules&lt;/span&gt;&lt;/tt&gt;
recommends to post-process tags, which are just a branch in SVN. That&apos;s why
the configuration file above treats branches as tags.&lt;/p&gt;
&lt;p&gt;The conversion was indeed fast: less than 1 minute.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;Post-conversion observations&lt;/h1&gt;
&lt;p&gt;Invoking &lt;tt class=&quot;&quot;&gt;gitk &lt;span class=&quot;&quot;&gt;--all&lt;/span&gt;&lt;/tt&gt; in the converted repo revealed different
kind of issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;&lt;strong&gt;svn tags as branches:&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/ACE/tags-as-branches.png&quot; src=&quot;https://imgprx.livejournal.net/e0fe9b3c1e09a9318646744fb174776aecb0a7b586d02e76545a0a9671bb3176/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-l2Fw0ynfZBAIHEFBnwo68UUHjmSBKOeGr0c:WkZfXf1Q4UZmc7pMKjQMlQ&quot; fetchpriority=&quot;high&quot; /&gt;
&lt;p&gt;Branches are marked with green rectangles, and tags with yellow arrows.
What we have here (expected given our configuration of the tool) are
branches (e.g. &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;5.4.7-5&lt;/span&gt;&lt;/tt&gt;) corresponding to tags, and tags matching the SVN
tagging commit (e.g. &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;backups/5.4.7-5&amp;#64;224&lt;/span&gt;&lt;/tt&gt;). We&apos;ll review and fix this.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;&lt;strong&gt;merged code that did not appear as such:&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/ACE/missing-merge-metadata.png&quot; src=&quot;https://imgprx.livejournal.net/69b989fa249bca6c202601bebf840cbb960021b6a6e8fbab9741c51ba91e876d/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-l2Fw0zDXcBBME1VBkB0p-ENChnLbOe2A-VsetB9maA8:NdXn-93qOtwXYY1oKHMDbA&quot; loading=&quot;lazy&quot; /&gt;
&lt;p&gt;Branches that were not merged using &lt;tt class=&quot;&quot;&gt;svn merge&lt;/tt&gt; look like they were not
merged at all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;&lt;strong&gt;commits with wrong author:&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/ACE/wrong-author.png&quot; src=&quot;https://imgprx.livejournal.net/944a50c52e25ebe49788e1ee9548a93367c2ce45826a1be77a585fae225b6bcb/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-l2Fw0yrMbA1CUFMZiRA07QgfhXCNJQ:YvrfZG4rmhUpsErRB2XIew&quot; loading=&quot;lazy&quot; /&gt;
&lt;p&gt;Before being in SVN, the repository was stored in CVS. When it was imported
into SVN, no special attention was given to the commit author. Hence I
got credited for changes I did not write.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;&lt;strong&gt;obsolete branches:&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/ACE/obsolete-branches.png&quot; src=&quot;https://imgprx.livejournal.net/aba50498e98defc8ecce2267044764ffb580876ebf23138686b4e23de72651af/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-l2Fw0zLccAxJGEYJ0Bop_kgMg3LcdvmP6hhN:YDKAada4Jgx8OfDnyg_msA&quot; loading=&quot;lazy&quot; /&gt;
&lt;p&gt;The tool leaves all branches, including removed ones (with tag on their end)
so that you can decide what to do with them.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;&lt;strong&gt;missing merges:&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;http://thomas.g.girard.free.fr/ACE/missing-merge.png&quot; src=&quot;https://imgprx.livejournal.net/1dc6cf64e7f5a87ecef40dddd39713437fba4c01f6e3df8dcc4a9599846b1053/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-l2Fw0zDXcBBME1VBkB0p-ENBm3nIevQ:lK8cMR5_NhU7P24fv1H1WA&quot; loading=&quot;lazy&quot; /&gt;
&lt;p&gt;The branch &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;5.4.7-12&lt;/span&gt;&lt;/tt&gt; was never merged into the trunk!&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;Learning git&lt;/h1&gt;
&lt;p&gt;Based on observations above, I realized my limited knowledge won&apos;t do to
complete the conversion and clean the repository. There are tons of
documentation on &lt;tt class=&quot;&quot;&gt;git&lt;/tt&gt; out there, and you can find a lot of
links from the &lt;a class=&quot;&quot; href=&quot;http://git-scm.com/documentation&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;git documentation&lt;/a&gt;
page. Here&apos;s the one I&apos;ve used:&lt;/p&gt;
&lt;ul class=&quot;&quot;&gt;
&lt;li&gt;&lt;a class=&quot;&quot; href=&quot;http://progit.org/book&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Pro Git&lt;/a&gt;, written by Scott Chacon&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;&quot; href=&quot;http://book.git-scm.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;The Git Community Book&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h2&gt;The Git Object Model&lt;/h2&gt;
&lt;p&gt;It&apos;s described with pictures
&lt;a class=&quot;&quot; href=&quot;http://book.git-scm.com/1_the_git_object_model.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.
You &lt;em&gt;really&lt;/em&gt; need to understand this if you haven&apos;t already.&lt;/p&gt;
&lt;p&gt;Once you do, you understand that &lt;tt class=&quot;&quot;&gt;git&lt;/tt&gt; is built bottom-up: the &lt;em&gt;plumbing&lt;/em&gt;
then the &lt;em&gt;porcelain&lt;/em&gt;. If you can&apos;t find the tool you need, it&apos;s easy to write
it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h2&gt;&lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;fast-import&lt;/span&gt;&lt;/tt&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a class=&quot;&quot; href=&quot;http://progit.org/book/ch8-2.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Migrating to Git&lt;/a&gt; chapter
explains how you can use the &lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;fast-import&lt;/span&gt;&lt;/tt&gt; tool to manually
import anything into git.&lt;/p&gt;
&lt;p&gt;I&apos;ve used it to create tags with dates in the past, slightly changing the
Custom Importer example in the book:&lt;/p&gt;
&lt;pre&gt;
&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;!/usr/bin/env ruby
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;# &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;retag.rb
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;# &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Small script to create an annotated tag, specifying commiter as well as
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;# &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;date, and tag comment.
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;# &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Based on Scott Chacon &quot;Custom Importer&quot; example.
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;# &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Arguments:
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#  &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;$1 -- tag name
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#  &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;$2 -- sha-1 revision to tag
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#  &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;$3 -- committer in the form First Last &amp;lt;email&amp;gt;
&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;#  &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;$4 -- date to use in the form YYYY/MM/DD_HH:MM:SS
&lt;/span&gt;
&lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;help&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;Usage: retag &amp;lt;tag&amp;gt; &amp;lt;sha1sum&amp;gt; &amp;lt;committer&amp;gt; &amp;lt;date&amp;gt; &amp;lt;comment&amp;gt;&quot;&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;Creates a annotated tag with name &amp;lt;tag&amp;gt; for commit &amp;lt;sha1sum&amp;gt;, using &quot;&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;given &amp;lt;committer&amp;gt;, &amp;lt;date&amp;gt; and &amp;lt;comment&amp;gt;&quot;&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;The output should be piped to git fast-import&quot;&lt;/span&gt;
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

&lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;to_date&lt;/span&gt;(datetime)
  (date, time) = datetime.split(&lt;span style=&quot;color: #8b2252;&quot;&gt;&apos;_&apos;&lt;/span&gt;)
  (year, month, day) = date.split(&lt;span style=&quot;color: #8b2252;&quot;&gt;&apos;/&apos;&lt;/span&gt;)
  (hour, minute, second) = time.split(&lt;span style=&quot;color: #8b2252;&quot;&gt;&apos;:&apos;&lt;/span&gt;)
  &lt;span style=&quot;color: #a020f0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;Time&lt;/span&gt;.local(year, month, day, hour, minute, second).to_i
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

&lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;generate_tag&lt;/span&gt;(tag, sha1hash, committer, date, message)
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;tag &lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{tag}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;from &lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{sha1hash}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;&lt;/span&gt;
  puts &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;tagger &lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{committer}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{date}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt; +0000&quot;&lt;/span&gt;
  print &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;data &lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{message.size}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #a0522d;&quot;&gt;#{message}&lt;/span&gt;&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;&lt;/span&gt;
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

&lt;span style=&quot;color: #a020f0;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;ARGV&lt;/span&gt;.length != 5
  help
  exit 1
&lt;span style=&quot;color: #a020f0;&quot;&gt;else&lt;/span&gt;
  (tag, sha1sum, committer, date, message) = &lt;span style=&quot;color: #228b22;&quot;&gt;ARGV&lt;/span&gt;
  generate_tag(tag, sha1sum, committer, to_date(date), message)
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h2&gt;graft points&lt;/h2&gt;
&lt;p&gt;(&lt;em&gt;graft&lt;/em&gt; means &lt;em&gt;greffe&lt;/em&gt; in French)&lt;/p&gt;
&lt;p&gt;Because of missing &lt;tt class=&quot;&quot;&gt;svn:mergeinfo&lt;/tt&gt; some changes appear unmerged.
To fix this there are
&lt;a class=&quot;&quot; href=&quot;https://git.wiki.kernel.org/index.php/GraftPoint&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;graft points&lt;/a&gt;: they
override &lt;tt class=&quot;&quot;&gt;git&lt;/tt&gt; idea of parents of a commit.&lt;/p&gt;
&lt;p&gt;To create a graft point, assuming &lt;tt class=&quot;&quot;&gt;6a6d48814d0746fa4c9f6869bd8d5c3bc3af8242&lt;/tt&gt;
is the commit you want to change, currently with a single parent
&lt;tt class=&quot;&quot;&gt;898ad49b61d4d8d5dc4072351037e2c8ade1ab68&lt;/tt&gt;, but containing changes from
commit &lt;tt class=&quot;&quot;&gt;11cf74d4aa996ffed7c07157fe0780ec2224c73e&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class=&quot;&quot;&gt;
me&amp;#64;mymachine$ echo 6a6d48814d0746fa4c9f6869bd8d5c3bc3af8242 11cf74d4aa996ffed7c07157fe0780ec2224c73e 898ad49b61d4d8d5dc4072351037e2c8ade1ab68 &amp;gt;&amp;gt; .git/info/grafts
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h2&gt;git filter-branch&lt;/h2&gt;
&lt;p&gt;&lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;filter-branch&lt;/span&gt;&lt;/tt&gt; allows you to completely rewrite history of a git branch,
changing or dropping commits while traversing the branch.&lt;/p&gt;
&lt;p&gt;As an additional benefit, this tool use graft points and make them permanent.
In other words: after running &lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;filter-branch&lt;/span&gt;&lt;/tt&gt; you can remove
&lt;tt class=&quot;&quot;&gt;.git/info/grafts&lt;/tt&gt; file.&lt;/p&gt;
&lt;p&gt;I&apos;ve used it to rewrite author of a given set of commits, using a hack on top of
&lt;a class=&quot;&quot; href=&quot;http://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit/3042706#3042706&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Chris Johnsen script&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;
&lt;span style=&quot;color: #b22222;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;!/bin/&lt;/span&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;sh&lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;color: #a0522d;&quot;&gt;br&lt;/span&gt;=&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;HEAD&quot;&lt;/span&gt;

&lt;span style=&quot;color: #a0522d;&quot;&gt;TARG_NAME&lt;/span&gt;=&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;Raphael Bossek&quot;&lt;/span&gt;
&lt;span style=&quot;color: #a0522d;&quot;&gt;TARG_EMAIL&lt;/span&gt;=&lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;hidden&quot;&lt;/span&gt;
&lt;span style=&quot;color: #7a378b;&quot;&gt;export&lt;/span&gt; TARG_NAME TARG_EMAIL

&lt;span style=&quot;color: #a0522d;&quot;&gt;filt&lt;/span&gt;=&lt;span style=&quot;color: #8b2252;&quot;&gt;&apos;

    if test &quot;$GIT_COMMIT&quot; = 546db1966133737930350a098057c4d563b1acdf -o \
            &quot;$GIT_COMMIT&quot; = 23419dde50662852cfbd2edde9468beb29a9ddcc; then
        if test -n &quot;$TARG_EMAIL&quot;; then
            GIT_AUTHOR_EMAIL=&quot;$TARG_EMAIL&quot;
            export GIT_AUTHOR_EMAIL
        else
            unset GIT_AUTHOR_EMAIL
        fi
        if test -n &quot;$TARG_NAME&quot;; then
            GIT_AUTHOR_NAME=&quot;$TARG_NAME&quot;
            export GIT_AUTHOR_NAME
        else
            unset GIT_AUTHOR_NAME
        fi
    fi

&apos;&lt;/span&gt;

git filter-branch $&lt;span style=&quot;color: #a0522d;&quot;&gt;force&lt;/span&gt; --tag-name-filter cat --env-filter &lt;span style=&quot;color: #8b2252;&quot;&gt;&quot;$filt&quot;&lt;/span&gt; -- $&lt;span style=&quot;color: #a0522d;&quot;&gt;br&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;(Script edited here; there were much more commits written by Raphael.)&lt;/p&gt;
&lt;div class=&quot;&quot;&gt;
&lt;p class=&quot;&quot;&gt;Important&lt;/p&gt;
&lt;p class=&quot;&quot;&gt;It&apos;s important to realize that the whole selected branch history is
rewritten, so all objects id will change. You should not do this if
you already published your repository.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;--tag-name-filter&lt;/span&gt; cat&lt;/tt&gt; argument ensures our tags are copied during the
traversal; otherwise they would be untouched, and hence not available in the
new history.&lt;/p&gt;
&lt;div class=&quot;&quot;&gt;
&lt;p class=&quot;&quot;&gt;Hint&lt;/p&gt;
&lt;p class=&quot;&quot;&gt;Once &lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;filter-branch&lt;/span&gt;&lt;/tt&gt; completes you get a new history, as well as a new
&lt;tt class=&quot;&quot;&gt;original&lt;/tt&gt; ref to ease comparison. It is highly recommended to check the
result of the rewrite before removing &lt;tt class=&quot;&quot;&gt;original&lt;/tt&gt;. To shrink the repo after
this, &lt;tt class=&quot;&quot;&gt;git clone&lt;/tt&gt;  the rewritten repo with &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;file://&lt;/span&gt;&lt;/tt&gt; syntax
-- &lt;a class=&quot;&quot; href=&quot;http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;git-filter-branch&lt;/a&gt; says it all.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;&quot;&gt;
&lt;h1&gt;Cleaning up the repo&lt;/h1&gt;
&lt;p&gt;To recap, here&apos;s how the ACE+TAO git repo was changed after conversion:&lt;/p&gt;
&lt;ol class=&quot;&quot;&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;Add graft points where needed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;Clean tags and branches.&lt;/p&gt;
&lt;p&gt;Using &lt;tt class=&quot;&quot;&gt;git tag &lt;span class=&quot;&quot;&gt;-d&lt;/span&gt;&lt;/tt&gt;, &lt;tt class=&quot;&quot;&gt;git branch &lt;span class=&quot;&quot;&gt;-d&lt;/span&gt;&lt;/tt&gt; and the Ruby script above
it was possible to recreate tags.&lt;/p&gt;
&lt;p&gt;During this I was also able to add missing tags, and remove some SVN
errors I did -- like committing in a branch created under &lt;tt class=&quot;&quot;&gt;tags/&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;Remove obsolete branches.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;Merge missing pieces.&lt;/p&gt;
&lt;p&gt;There were just two missing &lt;tt class=&quot;&quot;&gt;debian/changelog&lt;/tt&gt; entries.&lt;/p&gt;
&lt;p&gt;I did this before &lt;tt class=&quot;&quot;&gt;git &lt;span class=&quot;&quot;&gt;filter-branch&lt;/span&gt;&lt;/tt&gt; because I did not find a way to
use the tool correctly with multiple heads.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;&quot;&gt;Fix commit author where needed.&lt;/p&gt;
&lt;p&gt;Using the shell script above Raphael is now correctly credited for his work.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&apos;s it.&lt;/p&gt;
&lt;p&gt;The ACE+TAO git repository for Debian packages is alive at &lt;a class=&quot;&quot; href=&quot;http://git.debian.org/?p=pkg-ace/pkg-ace.git;a=summary&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://git.debian.org/?p=pkg-ace/pkg-ace.git;a=summary&lt;/a&gt;.&lt;/p&gt;
&lt;hr class=&quot;&quot; /&gt;
&lt;table class=&quot;&quot; frame=&quot;void&quot; rules=&quot;none&quot;&gt;
&lt;colgroup&gt;&lt;col class=&quot;&quot; /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td class=&quot;&quot;&gt;&lt;a class=&quot;&quot; href=&quot;#id1&quot; target=&quot;_blank&quot;&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a class=&quot;&quot; href=&quot;http://lists.alioth.debian.org/pipermail/pkg-ace-devel/2011-March/002421.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://lists.alioth.debian.org/pipermail/pkg-ace-devel/2011-March/002421.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class=&quot;&quot; frame=&quot;void&quot; rules=&quot;none&quot;&gt;
&lt;colgroup&gt;&lt;col class=&quot;&quot; /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td class=&quot;&quot;&gt;&lt;a class=&quot;&quot; href=&quot;#id2&quot; target=&quot;_blank&quot;&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;available in Debian as &lt;tt class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;svn-all-fast-export&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
  <comments>https://teejeejee.livejournal.com/5838.html?view=comments#comments</comments>
  <category>debian</category>
  <category>git</category>
  <category>svn</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/5585.html</guid>
  <pubDate>Tue, 07 Sep 2010 20:34:31 GMT</pubDate>
  <title>Playing with C++0x -- lambdas</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/5585.html</link>
  <description>C++0x has a workload of new features[2]...
&lt;p&gt;
Today I&apos;m having a look at &lt;a href=&quot;http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;lambdas&lt;/a&gt;. Lambdas are available in &lt;a href=&quot;http://packages.debian.org/experimental/g++-4.5&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;g++-4.5&lt;/a&gt;, for now only available in experimental.
&lt;p&gt;
&lt;h2&gt;What are lambdas?&lt;/h2&gt;
You can think of it as something akin to a struct with &lt;code&gt;operator()&lt;/code&gt;. But it&apos;s a more than that: it&apos;s closer from a &lt;a href=&quot;http://en.wikipedia.org/wiki/Closure_(computer_science)&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;closure&lt;/a&gt;, something that Scheme fans are very familiar with: the closure code block captures its outter environment in its body.
&lt;p&gt;
Closures are a very powerful tool that are being retrofitted in many languages (for instance &lt;a href=&quot;http://javac.info/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Java&lt;/a&gt;). They can be used as building blocks for many useful programing idioms such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuation_passing_style&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;continuations&lt;/a&gt;.
&lt;p&gt;
Enough for theory, let&apos;s have a look at this new beast.
&lt;p&gt;
&lt;h2&gt;How do they look like?&lt;/h2&gt;
&lt;pre&gt;
  [](int i) { return i + 1; };
&lt;/pre&gt;
&lt;p&gt;
This is the increment lambda. You can declare a lambda in any function or method. Written like this, the lambda compiles[1] but it&apos;s not very useful: it&apos;s an anonynous lambda that is neither stored nor used.
&lt;p&gt;
How to read this? The square brackets open the declaration of a lambda. Then you declare lambda parameters and its body. Nothing suprising so far except for the declaration opening.

&lt;h2&gt;Using a lambda&lt;/h2&gt;
To use it add arguments, for instance:
&lt;pre&gt;
  [](int i) { return i + 1; }(0);
&lt;/pre&gt;
would compute the value &lt;code&gt;1&lt;/code&gt;.
&lt;p&gt;
&lt;h2&gt;Storing a lambda&lt;/h2&gt;
The type of a lambda is automatically deduced. You can hint its return type if you need to. To store it you need to use another new C++0x keywork, &lt;code&gt;auto&lt;/code&gt;, that was taken back from C:
&lt;pre&gt;
  auto inc = [](int i) { return i + 1; };
  std::cout &amp;lt;&amp;lt; inc(0) &amp;lt;&amp;lt; std::endl;
&lt;/pre&gt;
Notice that calling a named lambda is not different from calling a function. If you need to hint the lambda return type you can use &lt;code&gt;-&amp;gt;&lt;/code&gt;:
&lt;pre&gt;
  auto mult = [](int x, double y) -&amp;gt; double { return x * y; };
&lt;/pre&gt;
&lt;p&gt;
&lt;h2&gt;Capturing environment&lt;/h2&gt;
You can use lambdas to capture outter environment. A more complex, not working, example:
&lt;pre&gt;
  void f() {
    int x = 5;
    [](int w) { return w + x; }(0);
  }
&lt;/pre&gt;
Tha lambda declaration + invocation does not work, because the &lt;code&gt;x&lt;/code&gt; variable we&apos;re referring to is declared in the outter scope. To enable capture of the outter scope, we can rewrite the previous example like this:
&lt;pre&gt;
  void f() {
    int x = 5;
    [=](int w) { return w + x; }(0);
  }
&lt;/pre&gt;
The &lt;code&gt;=&lt;/code&gt; sign in the square brackets (which are really the capturing clause) means we will copy every variable from the outter scope. Hence we can access &lt;code&gt;x&lt;/code&gt; from our anonymous lambda. Now what if you want to change &lt;code&gt;x&lt;/code&gt;?
&lt;pre&gt;
  void f() {
    int x = 5;
    [=](int w) { return w + ++x; }(0);
  }
&lt;/pre&gt;
This does not compile: the environment is read-only by default. If you really want to increment &lt;code&gt;x&lt;/code&gt; then you need to write:
&lt;pre&gt;
  void f() {
    int x = 5;
    [=](int w) mutable { return w + ++x; }(0);
  }
&lt;/pre&gt;
Yes, &lt;code&gt;mutable&lt;/code&gt;. The value returned from the lambda is what you would expect. But guess what? &lt;code&gt;x&lt;/code&gt; value is &lt;b&gt;not&lt;/b&gt; changed when the lambda returns. Indeed, we&apos;ve copied outter scope variables &lt;em&gt;by value&lt;/em&gt;. To really affect outter scope you need to change the capture clause:
&lt;pre&gt;
  void f() {
    int x = 5;
    [&amp;](int w) { return w + ++x; }(0);
  }
&lt;/pre&gt;
We use the ampersand to capture the environment &lt;em&gt;by reference&lt;/em&gt;, and thus we can change &lt;code&gt;x&lt;/code&gt; value. We could also be more explicit about what we want to capture:
&lt;pre&gt;
struct A {
    int z;

    A() : z(0) {}

    void f() {
      int x = 5;
      [this, &amp;x](int w) { z = w + ++x; }(0);
      std::cout &amp;lt;&amp;lt; &quot;x: &quot; &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &quot;, z: &quot; &amp;lt;&amp;lt; z &amp;lt;&amp;lt; std::endl;
    }
};
&lt;/pre&gt;
The lambda in &lt;code&gt;f()&lt;/code&gt; explicitely mentions environment variables which are captured by value: &lt;code&gt;this&lt;/code&gt;, because we change &lt;code&gt;this-&amp;gt;z&lt;/code&gt;, and also the local variable &lt;code&gt;x&lt;/code&gt;.
&lt;h2&gt;Complete example&lt;/h2&gt;
It&apos;s easier to write functionnal-style code. As Sarah just said: 10 years from now everyone will realize how powerful functional programming is, then we&apos;ll be the masters of the universe!
&lt;pre&gt;
#include &amp;lt;algorithm&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;vector&amp;gt;

int main(int argc, char* argv[])
{
  std::vector&amp;lt;int&amp;gt; v = { 1, 2, 3 };
  // Show then increment
  std::for_each(v.begin(), v.end(), [](int&amp; e) { std::cout &amp;lt;&amp;lt; e++ &amp;lt;&amp;lt; std::endl; });
  // Show content now
  std::for_each(v.begin(), v.end(), [](int e) { std::cout &amp;lt;&amp;lt; e &amp;lt;&amp;lt; std::endl; });

 return 0;
}

&lt;/pre&gt;

&lt;p&gt;
[1] Use &lt;code&gt;g++-4.5 --std=c++0x&lt;/code&gt; to activate C++0x mode&lt;br&gt;
[2] More complete g++ C++0x feature list available &lt;a href=&quot;http://gcc.gnu.org/gcc-4.5/cxx0x_status.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;</description>
  <comments>https://teejeejee.livejournal.com/5585.html?view=comments#comments</comments>
  <category>debian</category>
  <category>c++0x</category>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/5307.html</guid>
  <pubDate>Mon, 10 May 2010 16:43:09 GMT</pubDate>
  <title>VisualGST in Debian</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/5307.html</link>
  <description>&lt;a href=&quot;http://smalltalk.gnu.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;GNU Smalltalk&lt;/a&gt; 3.2 was released on May, 2nd.&lt;br /&gt;&lt;br /&gt;It includes a brand new IDE: VisualGST.&lt;br /&gt;&lt;br /&gt;To give it a try, use &lt;code&gt;apt-get install gnu-smalltalk-browser&lt;/code&gt;, then launch &lt;code&gt;gst-browser&lt;/code&gt;:&lt;br /&gt;&lt;img src=&quot;https://imgprx.livejournal.net/92fd1e1ec61ce0f59f9adcf9e0aa5089167353e566d0c279965001e19be17d04/P2WlxyVijxKvgWBm8s1SV0Mdsf-ah7h0y0aNSrNAwded9BHGlNOhRkw0BUI5GF8-sVFB0wvXcBZEEXU_qVYr8UFNlg:G1XJJUwOCQzgzaPKoadp_w&quot; width=&quot;75%&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Kudos to everyone involved in the GNU Smalltalk 3.2 release!</description>
  <comments>https://teejeejee.livejournal.com/5307.html?view=comments#comments</comments>
  <category>debian</category>
  <category>smalltalk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/4934.html</guid>
  <pubDate>Sat, 01 Nov 2008 22:20:47 GMT</pubDate>
  <title>Playing with C++0x -- tuple</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/4934.html</link>
  <description>&lt;em&gt;C++0x&lt;/em&gt; is &lt;a href=&quot;http://herbsutter.wordpress.com/2008/10/28/september-2008-iso-c-standards-meeting-the-draft-has-landed-and-a-new-convener/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;approaching&lt;/a&gt;, and it comes with a &lt;a href=&quot;http://en.wikipedia.org/wiki/C%2B%2B0x&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;lot&lt;/a&gt; of &lt;a href=&quot;http://www.devx.com/SpecialReports/Article/38813/0/page/1&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;new stuff&lt;/a&gt;, so I&apos;ve decided to play with it.
&lt;p&gt;
&lt;a href=&quot;http://gcc.gnu.org/gcc-4.3/cxx0x_status.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Some&lt;/a&gt; &lt;em&gt;C++0x&lt;/em&gt; features are already available in &lt;code&gt;g++&lt;/code&gt; 4.3. &lt;a href=&quot;http://gcc.gnu.org/gcc-4.4/cxx0x_status.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Others&lt;/a&gt; will be available in the 4.4 release  -- see &lt;a href=&quot;http://gcc.gnu.org/projects/cxx0x.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for a summary of &lt;em&gt;C++0x&lt;/em&gt; language support in &lt;code&gt;g++&lt;/code&gt;.
&lt;p&gt;
What is a tuple? It&apos;s a &lt;code&gt;std::pair&lt;/code&gt; on steroïds: it can contain &lt;em&gt;any&lt;/em&gt; number of elements. For the impatient, the whole sample program is available from &lt;a href=&quot;http://thomas.g.girard.free.fr/C++0x/tuple.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. It can be compiled with:
&lt;code&gt;g++-4.3 --std=c++0x tuple.cpp -o tuple&lt;/code&gt;.
&lt;p&gt;
Now let&apos;s see how to create a tuple:
&lt;pre&gt;
&lt;font color=&quot;0000ff&quot;&gt;&lt;strong&gt;#include &lt;font color=&quot;#008000&quot;&gt;&amp;lt;string&amp;gt;&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;
&lt;font color=&quot;0000ff&quot;&gt;&lt;strong&gt;#include &lt;font color=&quot;#008000&quot;&gt;&amp;lt;tuple&amp;gt;&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;

&lt;strong&gt;typedef&lt;/strong&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;strong&gt;int&lt;/strong&gt;, &lt;strong&gt;double&lt;/strong&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;my_tuple_t&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;font color=&quot;#2040a0&quot;&gt;my_tuple_t&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;1&lt;/font&gt;, &lt;font color=&quot;#FF0000&quot;&gt;5.0&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
Every element of the tuple gets initialized to its default value if it&apos;s not specified. Indeed displaying the third element:
&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;cout&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;2&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;endl&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;

outputs nothing, because the string element was default-constructed to an empty string. The &lt;code&gt;std::make_tuple&lt;/code&gt; function, like &lt;code&gt;std::make_pair&lt;/code&gt; for &lt;code&gt;std::pair&lt;/code&gt;, can be used to create a tuple using type deduction:
&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;cout&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;1&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;make_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;false&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#008000&quot;&gt;&amp;quot;see&amp;quot;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;endl&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
A tuple element can be changed using the same &lt;code&gt;get&lt;/code&gt; function:
&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;2&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;&amp;quot;a string&amp;quot;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
Of course, a tuple is type safe. Trying to put a string at the first element:

&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;0&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;&amp;quot;another string&amp;quot;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;

does not compile. But there&apos;s more: you also get a compilation error when trying to access an element that does not exist. For example trying to display fourth element does not compile:

&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;cout&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;3&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;endl&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
What else can you do with tuples? You can test them for equality, or assign them:

&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;my_tuple_t&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;another_tuple&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;make_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#FF0000&quot;&gt;2&lt;/font&gt;, &lt;font color=&quot;#FF0000&quot;&gt;10.0&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#008000&quot;&gt;&amp;quot;nothing&amp;quot;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;cout&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;another_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;endl&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;font color=&quot;#2040a0&quot;&gt;another_tuple&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;cout&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;another_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;endl&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
You can also retrieve multiple elements at once, possibly ignoring some of them:

&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;a_string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;tie&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;ignore&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;ignore&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;a_string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;another_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;
Last, you can concatenate two tuples into a new tuple:

&lt;pre&gt;
&lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;lt;&lt;/font&gt;&lt;strong&gt;int&lt;/strong&gt;, &lt;strong&gt;double&lt;/strong&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;, &lt;strong&gt;bool&lt;/strong&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;&amp;gt;&lt;/font&gt; &lt;font color=&quot;#2040a0&quot;&gt;cat&lt;/font&gt; &lt;font color=&quot;4444FF&quot;&gt;=&lt;/font&gt;
    &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;tuple_cat&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;a_tuple&lt;/font&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;make_tuple&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;strong&gt;false&lt;/strong&gt;, &lt;font color=&quot;#2040a0&quot;&gt;std&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;:&lt;/font&gt;&lt;font color=&quot;#2040a0&quot;&gt;string&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#008000&quot;&gt;&amp;quot;see&amp;quot;&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;4444FF&quot;&gt;;&lt;/font&gt;
&lt;/pre&gt;</description>
  <comments>https://teejeejee.livejournal.com/4934.html?view=comments#comments</comments>
  <category>debian</category>
  <category>c++0x</category>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/4742.html</guid>
  <pubDate>Tue, 15 Apr 2008 19:37:53 GMT</pubDate>
  <title>java-gnome 4.0</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/4742.html</link>
  <description>Thanks to Manu Mahajan, &lt;a href=&quot;http://java-gnome.sourceforge.net/4.0/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;java-gnome 4.0&lt;/a&gt; is now available for &lt;a href=&quot;http://packages.debian.org/libjava-gnome-java&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Debian&lt;/a&gt;.
&lt;p&gt;
To install it, use:
&lt;code&gt;apt-get install libjava-gnome-java&lt;/code&gt;</description>
  <comments>https://teejeejee.livejournal.com/4742.html?view=comments#comments</comments>
  <category>gnome</category>
  <category>debian</category>
  <category>java</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/4372.html</guid>
  <pubDate>Sat, 22 Mar 2008 10:59:40 GMT</pubDate>
  <title>Seaside on Debian</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/4372.html</link>
  <description>&lt;a href=&quot;http://smalltalk.gnu.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;GNU Smalltalk 3.1 rc1&lt;/a&gt; includes &lt;a href=&quot;http://seaside.st&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Seaside&lt;/a&gt;, a web application framework based on &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuation&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;continuations&lt;/a&gt;.
&lt;p&gt;
To use, you&apos;ll need to install package &lt;code&gt;gnu-smalltalk 3.1~rc1-2&lt;/code&gt; from experimental. Then, from a terminal, launch &lt;code&gt;gst&lt;/code&gt; and type[1]:
&lt;pre&gt;
st&amp;gt; PackageLoader fileInPackage: &apos;Seaside&apos;
st&amp;gt; PackageLoader fileInPackage: &apos;Seaside-Development&apos;
st&amp;gt; PackageLoader fileInPackage: &apos;Seaside-Examples&apos;
st&amp;gt; ObjectMemory snapshot: &apos;seaside.im&apos;
&lt;/pre&gt;
Now start you can start Seaside with &lt;code&gt;gst-remote -I seaside.im --daemon --start=Seaside&lt;/code&gt;, and launch your browser on &lt;code&gt;http://localhost:8080/seaside&lt;/code&gt;:
&lt;table border=&quot;0&quot;&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;a href=&quot;http://www.flickr.com/photos/15469027@N03/2351158535/&quot; title=&quot;Seaside&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;https://farm3.static.flickr.com/2250/2351158535_4986afe790_o.png&quot; width=&quot;370&quot; height=&quot;406&quot; alt=&quot;Seaside&quot; border=&quot;0&quot; fetchpriority=&quot;high&quot; /&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;&lt;a href=&quot;http://www.flickr.com/photos/15469027@N03/2351158623/&quot; title=&quot;Seaside counter sample application&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;https://farm3.static.flickr.com/2391/2351158623_70c3786e8c_o.png&quot; width=&quot;188&quot; height=&quot;271&quot; alt=&quot;Seaside counter sample application&quot; border=&quot;0&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;hr&gt;
[1] taken from GNU Smalltalk info page</description>
  <comments>https://teejeejee.livejournal.com/4372.html?view=comments#comments</comments>
  <category>debian</category>
  <category>seaside</category>
  <category>smalltalk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/4031.html</guid>
  <pubDate>Mon, 24 Dec 2007 12:13:40 GMT</pubDate>
  <title>dwarves uploaded</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/4031.html</link>
  <description>We&apos;ve just uploaded &lt;a href=&quot;http://oops.ghostprotocols.net:81/blog&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Dwarves&lt;/a&gt;.
&lt;p&gt;
It is a set of tools that use &lt;a href=&quot;http://dwarfstd.org/Debugging%20using%20DWARF.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;DWARF&lt;/a&gt; information inserted in ELF binaries compiled with debugging symbols. See &lt;a href=&quot;https://ols2006.108.redhat.com/2007/Reprints/melo-Reprint.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; for details on this set.
&lt;p&gt;
Included in the package:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pahole&lt;/code&gt;: finds alignment holes in structs and classes in languages such as C/C++, CPU cacheline alignment. Helps repack those structures to achieve more cache hits.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;codiff&lt;/code&gt;: a diff like tool to compare the effects changes in source code generate on the resulting binaries&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pfunct&lt;/code&gt;: displays all sorts of information about functions, inlines, etc.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pdwtags&lt;/code&gt;: pretty-prints DWARF information&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pglobal&lt;/code&gt;: lists global symbols&lt;/li&gt;
&lt;li&gt;&lt;code&gt;prefcnt&lt;/code&gt;: counts DWARF tags usage&lt;/li&gt;
&lt;li&gt;&lt;code&gt;syscse&lt;/code&gt;: system call sign extender&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dtagnames&lt;/code&gt;: lists tag names&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Until the package reaches unstable, you can grab them from &lt;a href=&quot;http://thomas.g.girard.free.fr/dwarves/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</description>
  <comments>https://teejeejee.livejournal.com/4031.html?view=comments#comments</comments>
  <category>debian</category>
  <category>dwarf</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/3806.html</guid>
  <pubDate>Sun, 23 Dec 2007 14:07:08 GMT</pubDate>
  <title>omniORBpy 3.1 uploaded</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/3806.html</link>
  <description>&lt;a href=&quot;http://omniorb.sf.net&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;omniORBpy&lt;/a&gt; 3.1 was just uploaded. Thanks a lot to Floris for his work on getting omniORBpy up-to-date!
&lt;p&gt;
Since some packages were renamed, the upload will require NEW processing. In the meantime you can grab these packages &lt;a href=&quot;http://thomas.g.girard.free.fr/omniorb&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</description>
  <comments>https://teejeejee.livejournal.com/3806.html?view=comments#comments</comments>
  <category>debian</category>
  <category>corba</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/3563.html</guid>
  <pubDate>Sun, 02 Dec 2007 00:41:26 GMT</pubDate>
  <title>Fun with templates</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/3563.html</link>
  <description>At work we had to use two C libraries defining structures with
different size but same name. Function names were different though, so
we believed no symbol clash would occur.
&lt;p&gt;
We thought if we used the headers from each library in a different
compilation unit we&apos;d be safe.
&lt;p&gt;
But we were wrong. The code compiled fine but crashed at runtime. Why? Because we used templates within these compilation units, and this generated weak symbols with the very same name. The linker then discarded duplicate symbols, and since structure size was different we got a crash.
&lt;p&gt;
Let&apos;s reproduce this on a small example:
&lt;pre&gt;
&lt;font color=&quot;#8080ff&quot;&gt;/* A.h */&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#ifndef A_H&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#define A_H&lt;/font&gt;

&lt;font color=&quot;#00ff00&quot;&gt;struct&lt;/font&gt; Data { &lt;font color=&quot;#00ff00&quot;&gt;int&lt;/font&gt; an_int; };

&lt;font color=&quot;#ff40ff&quot;&gt;#endif&lt;/font&gt;
&lt;/pre&gt;

&lt;pre&gt;
&lt;font color=&quot;#8080ff&quot;&gt;/* B.h */&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#ifndef B_H&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#define B_H&lt;/font&gt;

&lt;font color=&quot;#00ff00&quot;&gt;struct&lt;/font&gt; Data { &lt;font color=&quot;#00ff00&quot;&gt;char&lt;/font&gt; a_buffer[65]; };

&lt;font color=&quot;#ff40ff&quot;&gt;#endif&lt;/font&gt;
&lt;/pre&gt;

&lt;pre&gt;
&lt;font color=&quot;#8080ff&quot;&gt;/* UsingA.cpp */&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#inlude &quot;A.h&quot;&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#inlude &amp;lt;deque&amp;gt;&lt;/font&gt;

&lt;font color=&quot;#00ff00&quot;&gt;static&lt;/font&gt; std::deque&amp;lt;Data&amp;gt; a_datas;

std::size_t get_a_size() { &lt;font color=&quot;#00ff00&quot;&gt;return&lt;/font&gt; a_datas.size(); }
&lt;/pre&gt;

&lt;pre&gt;
&lt;font color=&quot;#8080ff&quot;&gt;/* UsingB.cpp */&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#inlude &quot;B.h&quot;&lt;/font&gt;
&lt;font color=&quot;#ff40ff&quot;&gt;#inlude &amp;lt;deque&amp;gt;&lt;/font&gt;

&lt;font color=&quot;#00ff00&quot;&gt;static&lt;/font&gt; std::deque&amp;lt;Data&amp;gt; b_datas;

std::size_t get_b_size() { &lt;font color=&quot;#00ff00&quot;&gt;return&lt;/font&gt; b_datas.size(); }
&lt;/pre&gt;

&lt;pre&gt;
&lt;font color=&quot;#8080ff&quot;&gt;/* Main.cpp */&lt;/font&gt;
&lt;font color=&quot;#00ff00&quot;&gt;int&lt;/font&gt; main(&lt;font color=&quot;#00ff00&quot;&gt;int&lt;/font&gt; argc, &lt;font color=&quot;#00ff00&quot;&gt;char&lt;/font&gt;* argv[]) {  &lt;font color=&quot;#00ff00&quot;&gt;return&lt;/font&gt; 0; }
&lt;/pre&gt;

We compile these files:
&lt;pre&gt;
$ g++ -c -I . UsingA.cpp UsingB.cpp Main.cpp
$ g++ -o Main UsingA.o UsingB.o Main.o
&lt;/pre&gt;

and inspect what got generated in &lt;code&gt;UsingA.o&lt;/code&gt;, choosing the call to
&lt;code&gt;size()&lt;/code&gt; to reduce the output:

&lt;pre&gt;
$ nm -C UsingA.o | grep &apos;::size()&apos;
0000000000000000 W std::deque&amp;lt;Data, std::allocator&amp;lt;Data&amp;gt; &amp;gt;::size() const
&lt;/pre&gt;

Likewise in &lt;code&gt;UsingB.o&lt;/code&gt;:
&lt;pre&gt;
$ nm -C UsingB.o | grep &apos;::size()&apos;
0000000000000000 W std::deque&amp;lt;Data, std::allocator&amp;lt;Data&amp;gt; &amp;gt;::size() const
&lt;/pre&gt;

&lt;code&gt;g++&lt;/code&gt; has generated code for the deque we&apos;re using. That&apos;s how templates
work: they get &quot;expanded&quot; in the compilation unit using them. So far so good.
&lt;p&gt;

Now if we look in Main:
&lt;pre&gt;
$ nm -C Main | grep &apos;::size()&apos;
0000000000400a64 W std::deque&amp;lt;Data, std::allocator&amp;lt;Data&amp;gt; &amp;gt;::size() const
&lt;/pre&gt;

we see there&apos;s only a single symbol in the resulting binary.
&lt;p&gt;
Because the symbols are weak (see the &lt;code&gt;W&lt;/code&gt; in &lt;code&gt;nm&lt;/code&gt; output), &lt;code&gt;g++&lt;/code&gt; silently discards one version, say the version in &lt;code&gt;UsingB.o&lt;/code&gt;. (If they were not weak, link would fail because of duplicate symbols. And every C++ program would fail to link.) Therefore any call on &lt;code&gt;b_datas&lt;/code&gt; is likely to fail: the &lt;code&gt;deque&lt;/code&gt; code called will not use the right definition of &lt;code&gt;Data&lt;/code&gt;.
&lt;p&gt;
Lesson learned: avoid data structures with the same name.</description>
  <comments>https://teejeejee.livejournal.com/3563.html?view=comments#comments</comments>
  <category>debian</category>
  <category>c++</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/3305.html</guid>
  <pubDate>Fri, 19 Oct 2007 20:21:42 GMT</pubDate>
  <title>Gtk User Interface for GNU Smalltalk</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/3305.html</link>
  <description>Thanks to Alexander,

the next upload of &lt;a href=&quot;http://smalltalk.gnu.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;GNU Smalltalk&lt;/a&gt; will include the Gtk Blox Browser.
&lt;p&gt;
To run it, I used:
&lt;pre&gt;
st&amp;gt; PackageLoader fileInPackage: &apos;BloxGTK&apos;!
st&amp;gt; PackageLoader fileInPackage: &apos;Browser&apos;!
st&amp;gt; BLOX.BLOXBrowser.BrowserMain new initialize!
&lt;/pre&gt;
&lt;p&gt;
Here is a screenshot:
&lt;p&gt;
&lt;a href=&quot;http://www.flickr.com/photos/15469027@N03/1639800921/&quot; title=&quot;GNU Smalltalk Gtk Browser&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://farm3.static.flickr.com/2256/1639800921_089448e62f_o.jpg&quot; width=&quot;612&quot; height=&quot;434&quot; alt=&quot;GNU Smalltalk Gtk Browser&quot; fetchpriority=&quot;high&quot; /&gt;&lt;/a&gt;

&lt;p&gt;
The package still needs some polishing.</description>
  <comments>https://teejeejee.livejournal.com/3305.html?view=comments#comments</comments>
  <category>debian</category>
  <category>smalltalk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/2965.html</guid>
  <pubDate>Fri, 20 Jul 2007 19:31:33 GMT</pubDate>
  <title>ACE+TAO 5.5.9+1.5.9</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/2965.html</link>
  <description>I&apos;ve just uploaded &lt;a href=&quot;http://www.cs.wustl.edu/~schmidt/ACE.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;ACE&lt;/a&gt;+&lt;a href=&quot;http://www.cs.wustl.edu/~schmidt/TAO.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;TAO&lt;/a&gt; packages into experimental.
&lt;p&gt;
The packages are now in NEW, but you can get them from &lt;a href=&quot;http://thomas.g.girard.free.fr/ace&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;there&lt;/a&gt;.</description>
  <comments>https://teejeejee.livejournal.com/2965.html?view=comments#comments</comments>
  <category>ace</category>
  <category>debian</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/2731.html</guid>
  <pubDate>Fri, 20 Jul 2007 17:03:18 GMT</pubDate>
  <title>Frysk new upload</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/2731.html</link>
  <description>I&apos;ve just uploaded a new version of &lt;a href=&quot;http://sourceware.org/frysk/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;frysk&lt;/a&gt; in experimental.
&lt;p&gt;
Frysk is composed of a GUI and many command line tools. Here are a few of them:
&lt;ul&gt;
 &lt;li&gt;&lt;code&gt;fcore&lt;/code&gt;, to generate a corefile from a running process&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;fhpd&lt;/code&gt;, a debugger with a text user interface&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;fstack&lt;/code&gt;, displays the stack trace of a running process&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;ftrace&lt;/code&gt;, a sytem call tracing tool&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;frysk&lt;/code&gt;, the Java-Gnome GUI&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;/usr/lib/frysk/funit&lt;/code&gt;, the JUnit testsuite, used to test frysk and the kernel&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Please give frysk package a try!</description>
  <comments>https://teejeejee.livejournal.com/2731.html?view=comments#comments</comments>
  <category>debian</category>
  <category>frysk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/2489.html</guid>
  <pubDate>Sat, 16 Jun 2007 21:26:10 GMT</pubDate>
  <title>In Edinburgh, today</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/2489.html</link>
  <description>It&apos;s raining. Both outside and inside. (Provided you&apos;re in the same room as I am)&lt;br /&gt;&lt;p&gt;&lt;br /&gt;See you tomorrow!</description>
  <comments>https://teejeejee.livejournal.com/2489.html?view=comments#comments</comments>
  <category>debian</category>
  <category>debconf7</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/2122.html</guid>
  <pubDate>Thu, 10 May 2007 17:03:38 GMT</pubDate>
  <title>frysk for Debian</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/2122.html</link>
  <description>A &lt;a href=&quot;http://sourceware.org/frysk&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;frysk&lt;/a&gt; &lt;a href=&quot;http://bugs.debian.org/388532&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;package&lt;/a&gt; is ready to test; it&apos;s available &lt;a href=&quot;http://thomas.g.girard.free.fr/frysk&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. It is targeted for sid and is &lt;code&gt;apt-get&lt;/code&gt;&apos;able, just add :
&lt;pre&gt;deb http://thomas.g.girard.free.fr/frysk/ ./&lt;/pre&gt; to your &lt;code&gt;/etc/apt/sources.list&lt;/code&gt;.
&lt;p&gt;
For now you&apos;ll also need to install Java-Gnome packages in NEW, also available from:
&lt;pre&gt;deb http://thomas.g.girard.free.fr/java-gnome/ ./&lt;/pre&gt;
&lt;p&gt;
Last, you&apos;ll need &lt;code&gt;libaudit0&lt;/code&gt; from &lt;a href=&quot;http://pint.pmhahn.de/pmhahn/debian/lenny/a/audit/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Philipp&apos;s private repo&lt;/a&gt;.
&lt;p&gt;
Unless something really weird is found in this frysk package, it will be uploaded to master right after &lt;a href=&quot;http://bugs.debian.org/311214&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;auditd&lt;/a&gt;.
&lt;p&gt;
&lt;em&gt;Update: uploaded to experimental&lt;/em&gt;</description>
  <comments>https://teejeejee.livejournal.com/2122.html?view=comments#comments</comments>
  <category>gnome</category>
  <category>debian</category>
  <category>java</category>
  <category>frysk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/2008.html</guid>
  <pubDate>Wed, 25 Apr 2007 18:53:57 GMT</pubDate>
  <title>Updating java-gnome 2.x</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/2008.html</link>
  <description>I am done updating &lt;a href=&quot;http://java-gnome.sourceforge.net/2.x/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;java-gnome 2.x&lt;/a&gt;.
&lt;p&gt;
Every java-gnome 2.x software &lt;code&gt;$s&lt;/code&gt; now has the following packages:
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;lib$s-java&lt;/code&gt; for Java bytecode&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;lib$s-jni&lt;/code&gt; for calls into native code&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;lib$s-cni&lt;/code&gt; for gcj &lt;a href=&quot;http://gcc.gnu.org/java/papers/cni/t1.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;C++ Native Interface&lt;/a&gt; natively compiled code&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;lib$s-java-gcj&lt;/code&gt; for gcj &lt;a href=&quot;http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Binary Compatible ABI&lt;/a&gt; natively compiled code&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;lib$s-java-doc&lt;/code&gt; for the documentation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Until packages get out of the NEW queue, you can get them from &lt;a href=&quot;http://thomas.g.girard.free.fr/java-gnome&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;my personal website&lt;/a&gt;. You can also add:
&lt;pre&gt;deb http://thomas.g.girard.free.fr/java-gnome/ ./&lt;/pre&gt; to your &lt;code&gt;/etc/apt/sources.list&lt;/code&gt;.</description>
  <comments>https://teejeejee.livejournal.com/2008.html?view=comments#comments</comments>
  <category>gnome</category>
  <category>debian</category>
  <category>java</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/1655.html</guid>
  <pubDate>Mon, 23 Apr 2007 11:05:20 GMT</pubDate>
  <title>bouml 2.25-1</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/1655.html</link>
  <description>I just uploaded bouml 2.25-1.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Update: uploaded again. The previous version was depending on libgcc1 from experimental&lt;/em&gt;</description>
  <comments>https://teejeejee.livejournal.com/1655.html?view=comments#comments</comments>
  <category>bouml</category>
  <category>debian</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/1455.html</guid>
  <pubDate>Wed, 18 Apr 2007 20:10:35 GMT</pubDate>
  <title>GNU Smalltalk 2.3.3-5</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/1455.html</link>
  <description>just uploaded. It should fix FTBFS on mips, mipsel and alpha.&lt;br /&gt;&lt;br /&gt;Thanks to Michael Banck for enlightening me on this.</description>
  <comments>https://teejeejee.livejournal.com/1455.html?view=comments#comments</comments>
  <category>debian</category>
  <category>smalltalk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
  <item>
  <guid isPermaLink='true'>https://teejeejee.livejournal.com/1060.html</guid>
  <pubDate>Tue, 17 Apr 2007 07:35:15 GMT</pubDate>
  <title>Fixing  GNU Smalltalk FTBFS on s390</title>
  <author>teejeejee</author>
  <link>https://teejeejee.livejournal.com/1060.html</link>
  <description>I just uploaded gnu-smalltalk 2.3.3-4.&lt;br /&gt;&lt;br /&gt;This version fixes &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=419582&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;#419582&lt;/a&gt;.</description>
  <comments>https://teejeejee.livejournal.com/1060.html?view=comments#comments</comments>
  <category>debian</category>
  <category>smalltalk</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
  </item>
</channel>
</rss>
