Posts Tagged ‘trick’

20101126 Programmatically building drawables

There’s something that really bothers me and it’s doing things that a computer should do. One of these is saving different versions of drawables, in low, medium and high resolutions, for the drawables-ldpi, drawables-mdpi and drawables-hdpi folders respectively. Coincidentally, I found a couple of weeks ago that the wonderful Inkscape accepts command line parameters and [...]

20101119 Tiled backgrounds in Android

If you just point your UI element to an image resource, like this: android:background="@drawable/myBackgroundImage" you won’t get a tiled background. Instead, you’ll get the image stretched to the element size! Really horrible, if that’s not what you intended to do. The trick is to create another XML file in the drawable directory. This file contains [...]

20101105 Merge/update a forked git repository

First add the “upstream” remote: git remote add upstream https://github.com/mrdoob/three.js.git Then fetch it: git fetch upstream Merge it with your local code: git merge upstream/master Resolve any possible conflicts (i.e. go through each file and edit it as necessary), commit and push them, and you’re done! Hopefully the network graph will show you a nicely [...]

20091124 Linking with ffmpeg’s libav

Every single tutorial linked from ffmpeg’s documentation suggests using simple library linking switches when compiling against libav, for example: gcc -o main.o main.c -lavcodec -lavformat but for whatever the reason, that didn’t work in my case. I was just getting a bunch of undefined references to the functions that I was using in my code. [...]

20091110 Too many open files

I am doing something that requires manipulating a lot of files, and I fell in the classical too many open files error trap. A way of finding out which files are being used by a process is to type ps -ax in a terminal, then identify the guilty process and its PID. Let’s imagine its [...]