Skip to main content

Posts

Showing posts from September, 2007

gcc Preprocessor directives

Preprocessor directives will allow you to determine at compiling time which pieces of code will be processed from your source code (I suppose there must be other usages, so please reply if you know other). One known example are the debug variables or messages. When you finish your job you can forget to delete all debugging messages. It won't be good if the customer clicks on a button and suddenly gets a "Oh Shit!!" as a message. Well, you can avoid that with preprocessor directives. This is an example (I had to simulate the signal from an ADC). ADC was not available all the time, so I read from a plain text file the same way ADC data was gathered: ------------------------------------------------------------ #ifdef _USEFILESRC_ double SignalSource::read(){ //Read from a text file } #else double SignalSource::read(){ //Read from ADC } #endif ----------------------------------------------------------- That means: if _USERFILESRC_ has been defined when compili...

Looking for a good Linux mp3 player?

When I installed Ubuntu, I found that the mp3 coded was not available due to licensing issues. I installed the codec, and some music applications under Linux, but I was really missing the simplicity and power of Winamp. Seaching on the Internet I found a great application which runs under linux and is similar to Winamp. So similar that you can even apply the winamp skins. Its name: AUDACIOUS This is the application link: http://audacious-media-player.org/ Installing was pretty straightforward: Add the Audacious repository by editing the /etc/apt/sources.list and adding the following lines: deb http://static.audacious-media-player.org/ubuntu edgy main deb-src http://static.audacious-media-player.org/ubuntu edgy main Then updating the repository: apt-get update. Finally: apt-get install audacious. That's all. Note: For Ubuntu, I downladed the debian package (For some reason the ubuntu package didn't work)