Older blog entries for redi (starting at number 257)

20 Dec 2011 (updated 20 Dec 2011 at 10:54 UTC) »
hjclub, I repeat this from the Advogato FAQ (emphasis mine):

the purpose of the trust metric is to certify that a given user account on Advogato is known by the Advogato community to actually belong to the individual who claims it and is known to be a member of the free software and open source community.


Certifying random spammers because you feel like it doesn't meet the purpose. You are of course free to use the trust metric for something different to its stated purpose, but don't be surprised if you get "exiled" as a spammer when you insist on certifying spammers. If you happen to know someone is who they claim to be, and they're a real member of the open source community, write a diary entry to say so, telling other users they're not an annoying spammer, even though they have an obviously computer-generated name!

FWIW, a spam rating of 9 does not mean 9 people rated you, users with a Master cert add 3 to a spam rating, Journeyers add 2, and Apprentices add 1, reflecting the trust the community places in people with a higher rating. So it only takes three Masters to take a spam rating to 9. I haven't rated you as a spammer because I recognised your username and think you should get a second chance to participate in the community, but if you continue to certify obvious spammers I will use my +3 spamhammer :)

Welcome back, hjclub.

Why did you certify fredericpete821 when that's clearly a spammer account? You got kicked out once before for doing that, after being advised not to.

Certifying spammers is not how to interact with this community

2 Nov 2011 (updated 24 Mar 2013 at 13:52 UTC) »

C++11 brainteaser


Here's a little program showing something that std::bind can do that lambdas can't.

#include <functional>
#include <string>
#include <iostream>

struct Polly
{
template<typename T, typename U>
auto operator()(T t, U u) const -> decltype(t + u)
{ return t + u; }
};

int main()
{
auto polly = std::bind(Polly(), std::placeholders::_1, "confusing");

std::cout << polly(4) << polly(std::string(" this is ")) << std::endl;
}

What will it print?
1 Nov 2011 (updated 1 Nov 2011 at 11:45 UTC) »

I wrote previously about needing to hack the clang sources to build it with gcc in a non-standard location. That patch is no longer necessary, to enable it to find the GCC headers and runtime files I now configure it as:


GCC_DIR=/your/gcc/prefix
GCC_VER=4.4.3
GCC_ARCH=x86_64-unknown-linux-gnu
../llvm/configure --prefix=$PREFIX --enable-targets=host \
--enable-optimized --disable-jit \
LDFLAGS=-Wl,-R,$GCC_DIR/lib64 \
--with-cxx-include-root=$GCC_DIR/include/c++/$GCC_VER \
--with-cxx-include-arch=$GCC_ARCH



Due to some GNUisms in older versions of glibc (e.g 2.5 in my case) it's necessary to build LLVM with
make CFLAGS=-std=gnu89

27 Oct 2011 (updated 3 Jan 2013 at 17:51 UTC) »
An even simpler recipe for building GCC

Building GCC is not trivial, but is not difficult if you follow the instructions carefully.

Many people rush into trying to build it without reading the installation docs properly and make one or more of these common mistakes:

1) do not run ./configure - this is not supported, you need to run configure from outside the source directory

2) if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries must be in the dynamic linker's path, both when building gcc and when using the installed compiler.

These problems are easily avoided by reading http://gcc.gnu.org/install/prerequisites.html, http://gcc.gnu.org/install/configure.html, http://gcc.gnu.org/wiki/FAQ#configure and http://gcc.gnu.org/wiki/FAQ#configure_suffix but noone does that.

For the impatient or RTFM-intolerant, a foolproof recipe for building GCC is given below.

The trick to this recipe is that the GMP, MPFR and MPC prerequisites are not installed separately, they are built as part of gcc and linked to statically. This avoids the common problem of installing the shared libraries in a non-standard location and having to tell the dynamic linker how to find them. This method is documented at http://gcc.gnu.org/install/prerequisites.html and is much easier than building and installing the prerequisites separately, but everyone seems to choose the hard way.

THIS RECIPE IS NOT A SUBSTITUTE FOR RTFM.

If you decide to stray from this recipe without reading the docs do not be surprised if you get indigestion.

* Ingredients:

1 gcc source package (e.g. gcc-4.6.2.tar.gz)

Alternatively, download individual packages for each GCC language front end (e.g. gcc-core, gcc-g++ etc.)

* Method:

First prepare your environment, season these variables to taste:


# the version you will build
gccver=4.6.2
# where you put the downloaded source packages
pkgdir=$HOME
# where you will build gcc
rootdir=$HOME/gcc-tmp
# where you want to install gcc
prefix=/opt/gcc-${gccver}
# the languages you want gcc to support
langs=c,c++

Create a new directory on a disk with plenty of space and unpack the sources there:

mkdir ${rootdir}
cd ${rootdir}
tar xzf ${pkgdir}/gcc-${gccver}.tar.gz

Next, download the prerequisite sources into the gcc source directory:

cd gcc-${gccver}
./contrib/download_prerequisites
cd ..

Now create a build directory and change to it

mkdir objdir
cd objdir

Now configure gcc:

${rootdir}/gcc-${gccver}/configure --prefix=${prefix} --enable-languages=${langs}

Now build gcc:

make

Finally, install gcc:

make install

Your compiler is now ready to use.
If something goes wrong you can just remove the entire $rootdir/objdir directory and recreate it and run configure again. The source dir will be unchanged because it is never altered when you build in a separate dir.

RIP, dmr

7 Oct 2011 (updated 7 Oct 2011 at 13:30 UTC) »
How?
I like using boost::function for callbacks, and boost::bind for partial application to allow those callbacks to do fancy things. And when I say I like it, I mean I love it so much I would change my name to std::function Wakely if it wasn't for the little problem of people mis-hearing it as StudFunction Wakely, which would just be silly. Anyway, when I wanted to use them for some cross-language callbacks in Python I was very pleased to find a section on boost.function objects in the Python wiki page about Boost.Python, where the file py_boost_function.hpp written by Alcides Viamontes Esquivel is attached. That little bit of magic sufficiently advanced technology lets me define callbacks which might call a partially-applied C++ function or a python function, or mixtures of both. Those callbacks can do pretty much anything. Power extreme. Thanks, Alcides. Thalcides.
16 Sep 2011 (updated 16 Sep 2011 at 10:25 UTC) »
ryuslash, you won't "fill up" the recentlog, you'll help create the conversation that recentlog is supposed to be. People who aren't interested don't have to read it, and if they're repeatedly not interested in what someone has to say they can rate their diary below the threshold they read at.

QOTD: Blog comments are for the weak. -- Zaitcev

He's right, only youtube comments are more unfuriating and inane than your average blog comment.

I never liked the change from calling these "diary entries" to "blogs" anyway.

robogato, wouldn't using libxml2's html-output (e.g. htmlDocDumpMemoryFormat) ensure it outputs <em></em> instead of <em/>?

I'm not sure how that would work with syndicated posts, do they get parsed into an xmlDoc first, then dumped out again?

9 Sep 2011 (updated 9 Sep 2011 at 09:19 UTC) »
nutella, no of course you're not the only one - apparently you're not reading Advogato closely enough :) or you'd have seen discussion of the new HTML parser that robogato released, and other cases of truncated/corrupted recentlog.

I usually email the owner of the problem diary entry or email robogato directly. If you read this, robogato, the HTML parser bails out on davidw's newest entry

248 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!