Fernando J. Pereda’s blag

May 29, 2009

MSDNAA, clever?

Filed under: blag — Tags: , , , — Fernando J. Pereda @ 10:02 am

So MSDNAA lets university students get some Microsoft products for free for educational purposes. That’s all fine and dandy except that you can’t directly download stuff, you have to do it using a shitty download manager.

It is hilarious that you have to run a Windows executable to download a copy of Windows XP.

Chicken and egg?… Yeah, that’s clever.

One point for you Suckrosoft.

May 10, 2009

OpenSceneGraph

Filed under: blag — Tags: , , , , — Fernando J. Pereda @ 11:18 pm

For SpaceFish I wanted a quick way to load a 3D model and be able to rotate it easily. This, along with an artificial horizon is a nice way to see the attitude of the plane while it is far to see it. It is also quite good to replay recorded data during experiments to study it further in the lab.

Since I haven’t really done anything in OpenGL beyond stupid examples and helloworld-like programs and given that I don’t have much time to devote to this task I decided to use an existing framework. Among Irrlicht, OpenSceneGraph and Ogre. I decided to give OpenSceneGraph a try, for no particular reason.

Unfortunately, it took a while to get it working under OSX… it needs something like this. I use MacPorts for this kind of stuff under OSX:

fixOpenSceneGraph()
{
	local lib_dir=/opt/local/lib
	pushd ${lib_dir} > /dev/null
	echo pushd ${lib_dir}
	for i in libosg*.dylib* libOpenThreads*.dylib* ; do
		echo install_name_tool -id ${lib_dir}/${i} ${i}
		otool -L ${i} | sed -e 1d | while read f ; do
			if [[ ${f} =~ ^libosg ]] || [[ ${f} =~ ^libOpenThreads ]] ; then
				l=${f%% *}
				echo install_name_tool -change ${l} ${lib_dir}/${l} ${i}
			fi
		done
	done
	popd > /dev/null
	echo popd
	port contents OpenSceneGraph |
		sed -n -e '/^[[:space:]]*\/opt\/local\/bin\//p' -e '/\.so/p' |
		while read f ; do
		otool -L ${f} | sed -e 1d | while read d ; do
			if [[ ${d} =~ ^libosg ]] || [[ ${d} =~ ^libOpenThreads ]] ; then
				l=${d%% *}
				echo install_name_tool -change ${l} ${lib_dir}/${l} ${f}
			fi
		done
	done
}

It wasn’t fun to figure that out (thank you CMake)…

Anyway, I think I’ll stick to OpenSceneGraph until it annoys me enough. For now, I managed to do what I wanted in less than 2 hours, which is pretty good when you have a stupidly tight schedule.

— ferdy

April 27, 2009

Small C trivia

Filed under: blag — Tags: , , , — Fernando J. Pereda @ 8:50 am

This is somehow surprising the first time you see it and it is interesting to remind it to people from time to time. The question is easy, does this program always return 0? That is, are those summations the same?

If there’s a case when it doesn’t, provide a sample input and explain why it happens.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	float f[argc - 1];
	for (int i = 1; i < argc; i++)
		f[i - 1] = atof(argv[i]);
	float r1 = 0;
	for (int i = 0; i < argc - 1; i++)
		r1 += f[i];
	float r2 = 0;
	for (int i = argc - 2; i >= 0; i--)
		r2 += f[i];
	return r1 != r2;
}

As usual, I’ll post the solution in a couple of days or when someone gets it right (which is always the case :))

— fpereda

Update: correct typo spotted by Snaury.

March 21, 2009

The Burning Ship fractal

Filed under: blag — Tags: , , , — Fernando J. Pereda @ 8:10 pm

I finally sat down and wrote support for drawing the Burning Ship Fractal into gmandel. It only took a couple of minutes, but I haven’t really had spare time lately.

Some parts of the fractal are quite interesting and different from other fractals derived from the Mandelbrot set. Here are some pictures using gmandel:

— fpereda

March 15, 2009

Bye-Bye Gentoo

Filed under: blag — Tags: — Fernando J. Pereda @ 6:23 pm

My retirement from Gentoo is complete now.

Good luck to everybody. I hope some people understand the real needs of Gentoo and where it should go. Even if I’m not planning to come back to Gentoo (either as a user or as a developer), I certainly hope the best for it.

Cheers.

— ferdy

February 10, 2009

Selected!

Filed under: blag — Tags: , , , , — Fernando J. Pereda @ 7:11 pm

So this led to this

’nuff said!

Mood: Extremelly happy.

— ferdy

February 2, 2009

More reading

Filed under: blag — Tags: , , — Fernando J. Pereda @ 1:05 pm

I finished reading Anathem a while ago, and I really do recommend it. It was weird at first, but really nice in the end. It finished a bit fast, I’d say it needs another hundred pages to tie some of the stuff.

Also, Ricardo Cervera (you don’t have an url these days, you do?) sent me Introduction to Algorithms which I’ve been skimming through. Really nice book, of course. — Thanks.

As part of one of the research projects I’m involved, I just started reading/studying Aircraft control and simulation. Fortunately, it is not hurting as much as I expected. Though it is not for the faint of heart.

— ferdy

ESTEC and EeePC’s first big test

Filed under: blag — Tags: , , , , , , — Fernando J. Pereda @ 11:07 am

This year I joined a couple of research projects at the Computer Architecture and Automatics Department of UCM. Since I’m still finishing my Computer Science degree I can’t spend as much time as I’d liked on the projects I’m taking part. I’m mostly doing softwar and learning quite a bit of electronics and such.

Tomorrow morning I’m heading ESA’s ESTEC to attend the first workshop of this year’s RexusBexus campaign. We’ll be there until friday. We’ve worked quite hard and are hoping to get selected for the next phase. Even if we are continuing our research even if we don’t get accepted, it is a great opportunity to test the thing.

Given that I really hate checking luggage at airports I was planning to travel as light as possible. Not needing lots of computing power the Eee came as the best candidate to carry around. I haven’t really done much with it than using it to go to University and back home so this is going to be its firs big test. I get to see whether this netbook thing really works for me, though I think it will.

We’ll see how it works…

— ferdy

October 26, 2008

Reading II

Filed under: blag — Tags: , , , — Fernando J. Pereda @ 11:13 pm

Currently Reading

— ferdy

Recent cool discoveries: unlockit and rlwrap

Filed under: blag — Tags: , , , , — Fernando J. Pereda @ 11:00 pm

I’m easily annoyed by hardware and software. Recently, I’ve been annoyed by my iPhone 3G insisting on wasting my money by downloading useless shit over my cellular data network without even asking. Since I have WiFi almost everywhere and I don’t want to get a data plan, I wanted to disable the feature completely. Unfortunately, the iPhone wouldn’t let you do that easily. Fortunately, http://unlockit.co.nz/ exists. That disables the cellular network by setting an invalid APN and can be easily reverted when you really need it. Good stuff.

I’ve also been doing some lisp lately and was a happy clisp user until I had to do some CPU and memory intensive computations. sbcl works much better than clisp on OSX and has a profiler; however it lacks readline support (and I refuse to use emacs to interface with it). Without looking for it, I found this extremely cool application called rlwrap that turns any annoying non-readline shit into a nice readline-enabled application. Yay!

— ferdy

Older Posts »

Blog at WordPress.com.