Felipe Contreras

Personal blog of Felipe Contreras

libmtag-0.3.0: moved to git

with 2 comments

I finally managed some time to make another libmtag release. This is mostly tiding up the code, cleanups, new codestyle, building improvements and moved to github :D

Also some handy features:

  • strip tag: now you can remove say id3v1 tags while keeping id3v2 intact
  • get specific tag: similarly, you can retrieve only id3v2 information
  • get all: this function might is useful for some UIs, specify some callback, and get all the tags :)

I wonder why not so many people are using this, is there a better tagging library?

Any packagers interested?

Grab it while it’s hot :D

Written by FelipeC

July 3, 2009 at 17:23

New adium build with msn-pecan 0.0.19

leave a comment »

Thanks to Devid, we now have a build of Adium with msn-pecan, see the announcement at cocoaforge.

Enjoy ;)

Written by FelipeC

June 28, 2009 at 20:41

Posted in IM, OpenSource, Planet

Tagged with ,

msn-pecan 0.0.19 released, more stability and “now playing” support

with 6 comments

This is mostly a bugfix release that should make msn-pecan much more stable. Bug also brings some nice features such as “now playing” support.

Everyone is encouraged to update.

I’ve been busy with other projects so I have not been able to work as
much as I would have wanted, but all in all, this is a good release.

The features (thanks to Devid) include support for “now
playing” (ported from libpurple), and a new way to be notified when a
contact has deleted you (you’ll see on the conversation window). Also,
some issues in Adium were fixed, so we will probably roll an Adium
build with msn-pecan enabled.

I’ve updated my system so it might take a while before the win32
binaries are uploaded, anyone willing to take this one?

Download from the usual place at googe code.

Bugs fixed

  • 99 Unable to retrieve display pictures when invisible or logged as invisible
  • 109 Protocol priority
  • 120 Aliases not cleared properly
  • 133 pidgin crashed with SIGSEGV in msn_message_destroy()
  • 154 Pidgin Randomly Crashes
  • 135 russian translation doesn’t work

Enhancements

  • 140 Support for “Now Playing” status field
  • 129 Can’t verify installation, or uninstall
  • 124 Notify when deleted by a contact

Taks

  • 121 Make dbg package for the launchpad repo

Diffstat

105 files changed, 1295 insertions(+), 749 deletions(-)

Contributors to this release

Albert Cervin (1):
     po: update Swedish translation

Devid Antonio Filoni (14):
     Fix use_userdisplay option using Adium.
     Change PACKAGE to GETTEXT_PACKAGE.
     Translate msn-pecan also using Adium.
     Fix use server alias option
     Move utils/msgplustags.{c,h} to pecan_util.{c,h}.
     Update COPYRIGHT.
     Add PURPLE_STATUS_TUNE support and parse contacts's CurrentMedia.
     Update MsnClientCaps in msn.h.
     Add "Has Space" to get_info.
     Show "You are not in A's contact list" message opening a conv
window if needed.
     Set the passport also to session->user.
     ab/pecan_contact.c: cleanup.
     slp: destroy object at the right time
     po: update Italian translation

Elias Julkunen (1):
     po: update Finnish translation

Felipe Contreras (44):
     Cleanup login steps.
     Show up 'connecting' state.
     session: Cleanups.
     Trivial cleanups.
     Cleanup configuration stuff.
     session: Random cleanups.
     Remove bad Russian translation.
     cmdproc: trivial cleanup
     slpcall: avoid extra error cb call
     status: trivial cleanups
     status: improve "available" state mapping
     Trivial cleanups
     userdisplay: report failure
     Log general server notifications
     Makefile: add debugging symbols by default
     session: destroy ud manager after freeing slplinks
     contact: store pecan status instead of pidgin one
     Reorganize how bad statuses are handled
     notification: store user state
     contaclist: add function foreach_contact
     Get user displays when returning from 'hidden' state
     status: trivial cleanup
     contact: use "invisible" for the HIDDEN status
     Use pidgin mobile status only when offline
     Update copyright notices
     command: trivial cleanups
     command: remove unused refcount
     command: general cleanups
     contact: enable workaround for server aliases
     fix_purple: trivial cleanups
     fix_purple: rename purple_buddy_set functions
     Reorganize switchboard handling.
     Close the http node when not needed.
     Make sure the switchboard is not freed when it's still used by slplink.
     transaction: trivial cleanup
     transaction: add ref/unref
     Properly ref/unref transactions
     transaction: fix initial ref_count
     sb: set error properly
     Fix wrong memory access
     Optimize GType retrieval
     Fix SLP DATA message creation
     po: general translation updates
     Bump version to 0.0.19

Geoffrey Antos (1):
     slplink: fix buffer overflow vulnerability

Luís Neto (1):
     po: update Portuguese translation

Wei Hsiang Hung (1):
     po: update Traditional Chinese translation

Written by FelipeC

June 16, 2009 at 11:51

Posted in Desktop, IM, Linux, OpenSource, Planet

Tagged with , ,

Response to Christian Schaller — Google, the LGPL and software patents

with 2 comments

I read Christian Schaller’s post which says essentially that Google is evil because it’s using FFmpeg in Chromium and arguing the legality of it by using an unusual interpretation of LGPL. because Google is using an unusual interpretation of LGPL.

Let’s step back for a second and see this through the point of view of FFmpeg developers. Probably they, just like any other FOSS developer, just want to code kick-ass software, and the license (LGPL) is just a tool to make sure their software is not stolen, so if a company chooses to use FFmpeg, they must contribute the changes back.

Google is contributing back their changes, they are publicly available in their repo. So how could FFmpeg developers loose? Their code will be used in an amazing product, that they will probably use too, it’s a win-win situation. This subject was brought up on the mailing list and nobody complained; Chromium is not listed in FFmpeg’s hall of shame.

Now, is it legal? The only way to know is to bring the issue to court and see the resolution, but who will bring this to court? FFmpeg developers? No. Perhaps H.264 patent holders, but only in countries with wicked patent laws (USA), and who cares about them? If Google looses in court against H.264 patent holders, I wouldn’t consider it evil, quite the contrary.

And finally, Google lawyers said that what the FSF thinks about this movement is irrelevant… damn right! They wrote the license, so? FFmpeg choose the license, and FFmpeg can choose another license if they so wish, in fact, they can re-license to Google in any other license they see fit because they have the copyright. Of course there’s no need for that because LGPL works fine, and the explanation of Google lawyers is completely logical to me.

Personally I cheer the Google Chromium team for such a bold movement, and congratulate FFmpeg developers for making kick-ass software that might soon be even more widely used.

Written by FelipeC

June 13, 2009 at 11:05

Installing scratchbox 1 and 2 for ARM cross-compilation

with 4 comments

Hi,

I’ve tried many different cross-compilation methods and so far scratchbox is the simplest and most effective. Here I’ll try to introduce the benefits of using it, and how to get started as simply as possible.

Intro

If you are not familiar with scratchbox; it’s a cross-compilation toolkit which allows you to use native tools (gcc, binutils, perl) when possible and emulate the target through qemu when needed.

It’s needed because of autotools; have you seen these checks?
checking whether the C compiler works... yes

The configure script actually compiles a small program and then runs it to validate it’s working, and sometimes extract information, such a the size of certain structures which might be different depending on the platform. If you tell ‘configure’ that you are cross-compiling it will go through a different path (which is much less tested) and ultimately will end up with wrong information that you need to correct.

OpenEmbedded and other distributions go through each and every package, make sure cross-compilation works, sometimes patching configure.ac, and often providing some information that normally would be obtained by running some test program.

This is an example of a typical GLib cross-compilation
./configure ---host=arm-linux --build=i386-linux

You’ll see something like:

checking whether the C compiler works... yes
checking whether we are cross compiling... yes

And then:

checking for growing stack pointer... configure: error: in `glib-2.20.3':
configure: error: cannot run test program while cross compiling

Of course, ‘configure’ has no way of knowing whether the stack grows on this particular platform. So you need to tell him yourself by creating an arm-linux.cache file like this:
glib_cv_stack_grows=no

And then running:
./configure --host=arm-linux --build=i386-linux --cache-file=arm-linux.cache

Of course that is not enough, you need to specify more:
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_posix_getgrgid_r=yes
ac_cv_func_posix_getpwuid_r=yes

And then the compilation fails because I don’t have glib-genmarshal in my system, and it’s needed by the build. Normally it’s compiled and run in the build, but now we can’t do that.

All these problems disappear with scratchbox.

Installing scratchbox 1

Many people think it’s difficult to install, but it’s not. Just follow these easy steps:

install

Download the basic packages:
wget -c http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-core-1.0.14-i386.tar.gz
wget -c http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-libs-1.0.14-i386.tar.gz
wget -c http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-devkit-qemu-0.10.0-0sb5-i386.tar.gz
wget -c http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-toolchain-cs2007q3-glibc2.5-arm7-1.0.12-9-i386.tar.gz

Extract them:
sudo tar -xf /tmp/sb/scratchbox-core-1.0.14-i386.tar.gz -C /opt
sudo tar -xf /tmp/sb/scratchbox-libs-1.0.14-i386.tar.gz -C /opt
sudo tar -xf /tmp/sb/scratchbox-devkit-qemu-0.10.0-0sb5-i386.tar.gz -C /opt
sudo tar -xf /tmp/sb/scratchbox-toolchain-cs2007q3-glibc2.5-arm7-1.0.12-9-i386.tar.gz -C /opt

Setup scratchbox, and add your user:
sudo /opt/scratchbox/run_me_first.sh
sudo /opt/scratchbox/sbin/sbox_adduser $USER yes

You'll need to re-login to be in the sbox group and have proper permissions:
sudo su $USER

target

Finally, setup an armv7 target (you can have multiple targets inside scratchbox):
/opt/scratchbox/tools/bin/sb-conf setup armv7 --force --compiler="cs2007q3-glibc2.5-arm7" --devkits="qemu" --cputransp="qemu-arm-sb"
/opt/scratchbox/tools/bin/sb-conf select armv7
/opt/scratchbox/tools/bin/sb-conf install armv7 --clibrary --devkits --fakeroot --etc

That's it, you have scratchbox setup :) I explicitly mentioned all the commands, but instead you can run this script that I wrote.

start

Before running scratchbox you'll need to do some steps as root:
echo 0 > /proc/sys/vm/vdso_enabled
echo 4096 > /proc/sys/vm/mmap_min_addr
/opt/scratchbox/sbin/sbox_ctl start

And then as user:
/opt/scratchbox/login

This will get you to this screen:

Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.
See /scratchbox/doc/ for documentation.

[sbox-armv7: ~] > 

Now if you want to cross-compile GLib, you do it as in your PC:
./configure && make install

Much easier, now scratchbox does all the magic ;)

Scratchbox 2

Scratchbox 1 serves it's purpose, but there are many corner-cases where things get overly complicated so people came up with a much more elegant approach: Scratchbox 2.

In sb1 you need to login to a target (e.g. armv7, armv6, fremantle, diablo, etc.) in order to do anything, you can use only one target at a time, and each target is independent, in order to share tools between targets you need a devkit. Also, toolchains must be packaged in a special way.

In sb2, you don't login, you can setup any toolchain easily, you can use multiple targets at the same time, and you can configure it to do pretty much anything you want.

QEMU

sb2 doesn't include QEMU, you must have it already, this is how I compile it:
git clone git://git.savannah.nongnu.org/qemu.git
cd qemu
git checkout -b stable v0.10.5
./configure --prefix=/opt/qemu --target-list=arm-linux-user
make install

sbox2

Compile and install like this:
git clone git://anongit.freedesktop.org/git/sbox2
cd sbox2
./configure --prefix=/opt/sb2
make install

Add sb2 to the PATH:
export PATH=/opt/sb2/bin:$PATH

target

Now it's time to configure a target, I have a CodeSourcery toolchain installed on /opt/arm-2008q3, so:
cd /opt/arm-2008q3/arm-none-linux-gnueabi/libc/
sb2-init -c /opt/qemu/bin/qemu-arm armv7 /opt/arm-2008q3/bin/arm-none-linux-gnueabi-gcc

You don't need to log-in, just prefix your commands with sb2 to do the magic:
sb2 ./configure --prefix=/opt/arm/

If you want to use a different target just use the -t option:
sb2 -t armv8 ./configure --prefix=/opt/arm/

How cool is that?

Written by FelipeC

June 7, 2009 at 14:04

C programming hints and code-style (part 1)

with 9 comments

Over the years I’ve had to deal with many different coding styles (can something without style be called style?). Here is a list of no-brainer tips that every C programmer should be aware of.

Hints

Update:

Have a copy of the C99 spec handy

Don’t scratch your head when you are not sure if a function is part of the standard, and what is the expected behavior, open the spec an check by yourself: here.

free() can receive NULL

There’s no need to do:

if (pointer)
free(pointer);

This works fine:
free(pointer);

Therefore if you write a struc_free function it makes sense to allow NULL as an argument.

There’s no need to cast a void *

tmp = (EXTEREMELY_UGLY_TYPE *) malloc(10);

malloc() returns a void * there’s no need to cast those:

tmp = malloc(10);

sizeof can receive a variable

size = sizeof(EXTEREMELY_UGLY_TYPE);

No need to burden yourself with that:

size = sizeof(tmp);

If tmp is a pointer you can do sizeof(*tmp) and so on.

Avoid big macros

Have you seen horrendous code like this?


#define ERROR(e, code, text) \
G_STMT_START { \
  if ((text)) \
    GST_WARNING_OBJECT ((e), "error: %s", (text)); \
  gst_element_message (GST_ELEMENT((e)), GST_MESSAGE_ERROR, \
    GST_STREAM_ERROR, (code)); \
} G_STMT_END

It’s much cleaner to use an inline function:


static inline void send_error(GstElement *e, int code, const char *text)
{
  if (text)
    GST_WARNING_OBJECT(e, "error: %s", text);
  gst_element_message(e, GST_MESSAGE_ERROR, GST_STREAM_ERROR, code);
}

Yes, you can put inline functions in header files.

C99 is your friend

C99 has nice types such as bool (true and false), uint32_t and similar int types. Also these beauties:


static struct device = {
 .base = 0x480bd400,
 .irq = 24,
 .pdata = {
  .name = "isp",
  .nr_tlb_entries = 8,
  .clk_name = "cam_ick",
 },
};

I don’t even want to imagine how horrible the code would look for C89.

Those are the ones I can think about, any suggestions? On the next part I’ll about code-style ;)

Written by FelipeC

May 27, 2009 at 22:00

Posted in Development, Linux, OpenSource, Planet, Random

Tagged with , ,

How to explain FOSS to normal people, or: What does mountain bikes, rap music, and FOSS have in common?

with 5 comments

Amazing talk: Charles Leadbeater: The rise of the amateur professional

These are my favorite quotes:

  • How do we organize ourselves without organizations? … You don’t need an organization to be organized.
  • One of the reasons [this view] is wrong, is that the ideas are flowing back up the pipeline. The ideas are coming back from the consumers, and they’re often ahead of the producers.
  • Big corporations have an in-built tendency to reinforce past success. They’ve got so much sunk in it, that it’s very difficult for them to spot new markets. Emerging new markets then, are the breeding grounds for passionate users.
  • What we are seeing is a complete corruption of the ideal of patents and copyrights; meant to be a way to incentivize innovation, meant to be a way orchestrate the dissemination of knowledge. They are increasingly being used by large companies to create thickets of patents to prevent innovation taking place.
  • The reason why despite all the efforts to cut it down, to constrain it, to hold it back… why these open models will still start emerging with tremendous force, is that they multiply our productive resources, and one of the reasons they do that is that they turn users into producers, consumers into designers.

Written by FelipeC

May 3, 2009 at 23:01

OMAP3 public DSP binaries now work

with 7 comments

It took some time but finally tiopenmax 0.3.5 was released. It’s essentially 0.3 plus DSP binaries that actually work.

I verified with gst-openmax (git omap branch) and they work just fine :) Thanks Daniel Díaz!

So people with OMAP3 hardware (beagleboard) can already try D1 MPEG-4 decoding using less than 15% of CPU. If you missed the demo, here it is:

All the information was available in my previous post. One minor update is that I’ve made a tag (v2.6.28-tidspbridge) to the linux-omap tree on my github repo to make it extra easy for people to compile a stable kernel with the dsp-bridge driver. There’s many DSP fixes available and some performance improvements which are not in this tag, but I’ll make sure they are once 2.6.29-omap1 is tagged.

Written by FelipeC

March 26, 2009 at 2:45

100,000 views, and some stats

with 2 comments

Well, it seems 100k views is a good milestone to talk about some stats of my blog, so here they are. I’m also trying to understand what are the sources of the traffic and how you might increase your viewers too.

Blog grow graph

Blog grow graph

General stats

  • Total views: 102,436
  • Busiest day: 1,903 — Monday, January 12, 2009
  • Views today: 112
  • Posts: 110
  • Comments: 458
  • Spam: 21,913 comments

As you can see I don’t post too often, but somehow I still manage to get some views. The day I got most views was the day the MSN servers did some strange update that made all new clients stop working. The new clients use MSNP13 and newer, while msn-pecan uses MSNP12. So everybody rushed to download the only Pidgin plug-in that worked. The number of downloads increased to 10,000 and many of those viewers ended up in my blog. Sadly, it lasted only one day.

But where does the normal traffic comes from?

Top 10 referring sites

So, important planets like maemo.org and beablegoard.org constitute a big chunk of the visits. Maemo.org, specially, has a good voting system so good stories go to the top. Unfortunately I don’t blog so often about maemo-related stuff, and I try to not spam topic-centric planets.

Somehow that list seems not enough to fill 100k. Could be that Google is helping here?

Top 10 Google searches

Still some stuff seems to be missing. My guess? RSS feed subscribers. At least 66 people are subscribed to my blog through Google Reader. So, thanks to all the people that follow my blog. If you have any recommendation on how to improve it, please share it :)

Also, special thanks to WordPress for making this blog possible, and always providing great stats to help me figure out what to blog about next.

Finally, here is the list of top 20 posts:

Top 20

Written by FelipeC

March 20, 2009 at 1:56

Posted in IM, Planet

msn-pecan 0.0.18 released, now with voice clips support

with 12 comments

Hello!

It’s time for msn-pecan 0.0.18. There are many bugfixes and important new features like voice clips support.

Again, Devid did most of the work. The most important fix is that personal status messages now work properly (can be enabled and disabled), the most important feature is voice clip support; thanks to Devid Filoni for the port, original patch from Chris Stafford, and Youness Alaoui for libsiren.

Also important is a fix for WLM 2009 user displays (Thomas Gibson-Robinson), P4-context support for groups.im (Thiago Silva and Devid), a new option to hide Plus! tags (Devid) and support for Plus! sounds (Devid and Thiago).

Also, some cleanups and reorganization heading towards a standalone library.

An interesting event happened on January 12; for some reason the MSN servers changed something that prevented many clients (>MSNP13) from working, while msn-pecan kept working just fine. That day the number of downloads increased dramatically (100010,000 a day), but unfortunately it lasted only a day.

12,552 page views.

12,552 page views.

New translations: Turkish, Portuguese (standard and Brazil) and Arabic. If your favorite language is not translated you can help at Launchpad’s site.

Here’s the diffstat:
diffstat

Download from the usual place at googe code.

Written by FelipeC

February 16, 2009 at 1:03

Posted in Development, IM, Linux, Planet

Tagged with , ,