Saturday, June 6, 2009

The C++ Lands


Just had to post this image that I found in a usenet group (comp.lang.c++). Courtesy to whoever made this picture!
Original URL

Monday, February 9, 2009

Converting avi to DVD format

In this blogpost I would like to explain how an existing avi file (in XVID or DIVX format) can be converted to DVD format, ready to be burned to disc. This for people who still have an old DVD player which cannot read DIVX and XVID movies.

First thing to do is to convert the XVID film into a format usable for DVD playback. The DVD standard typically uses MPEG-2 for video and AAC for audio. It is possible other formats are also supported, but I stuck to these formats.

The conversion to MPEG-2 can be done with ffmpeg an open source tool that is able to convert a lot of video files. The command line is as follows:

$>ffmpeg -i film.avi -target pal-dvd film.mpg

This will convert the file film.avi into film.mpg with the standard DVD format (resolution and framerate) for PAL televisions. For NTSC (USA) it is enough to change the 'pal' part into 'ntsc'.
After the file has been converted, it can be massaged to be put on a DVD disc. For this we need to create the directory structure that consists of the directories AUDIO_TS and VIDEO_TS. The directory AUDIO_TS is typically empty on a DVD, but the VIDEO_TS directory contains the files of type VOB and IFO that contain the video and audio in chunks of 1 GB. For creating this directory layout and the correct files, dvdauthor is a good tool. Dvdauthor requires an xml file that contains a description of the structure of the dvd layout. It is very powerful and allows for a lot of customization. In this example I keep it simple with one single file that has 4 chapters:

<dvdauthor dest="DVD">
 <vmgm />
  <titleset>
   <titles>
    <pgc>
     <vob file="film.mpg" chapters="0,15:00,30:00,45:00,1:00:00"/>
   </pgc>
  </titles>
 </titleset>
</dvdauthor>

Save this file as film.xml to the same directory as where film.mpg resides. With dvdauthor now the layout will be created as follows:

$>dvdauthor -x film.xml

This command will create a directory DVD with inside the directories AUDIO_TS and VIDEO_TS. The VIDEO_TS directory will contain the VOB files that contain the video and audio. This structure can then be burned to disc using tools like K3B.

PS: both tools can be installed in Ubuntu using:
$>sudo apt-get install ffmpeg dvdauthor

PS2: There are other tools with which you can accomplish the same job:

Sunday, January 18, 2009

Ubuntu's harddisk killing bug fixed

On slashdot it is mentioned that the famous harddisk killing bug for laptops has been finally fixed. This bug causes laptop harddisks to park and unpark the heads very frequently (as often as every 15 seconds) causing early wearing out of the harddisk. For months fixes have been floating around (do a google for Load_Cycle_Count Ubuntu) but until now it was never really fixed in the distribution. At the moment the fix is in testing for 8.04, 8.10 and 9.04 and should be in the repositories soon.

Saturday, December 6, 2008

Graphical layout of dependencies between static libraries

Back to linux! This week at work I got introduced into a new tool that helps resolve dependencies between static libraries. To organize your C++ code better, it might be a good idea to develop static libraries, which are linked to the executable. In our situation we had several static libraries that had interrelationships that caused linkage problems. It is a known fact that g++ (ld) has a strong dependency on the order of the static libraries on the command line. Other compiler/linkers such as IBM xlc and Microsoft Visual Studio compiler are less if at all sensitive to this. And so it also caused problems when linking our libraries with the program. Some libraries had to be repeated on the command line for the linker to resolve all the symbols.
Again, the power of the linux command line came to the rescue this time. There is a tool called lorder that is able to generate output showing which static libraries depend on each other. It uses nm that outputs the symbols in the static library. The program lorder will list for each static library on which other library it (directly) depends. This output is then massaged a bit such that it can be used with dot (a tool that is able to generate a graph from a text input file). Dot can write its output to .png, .jpg, .svg and even .pdf files! So, by using lorder, five lines of script to convert the output of lorder into the correct format for dot, and dot itself, a graph was created showing the interdependencies between the static libraries. A picture says more than a 1000 words. And, also in this case, we found some cycles in the graph, causing the linkage problems!

Yahoo going private?

In recent days the news surfaced that group of investors led by Jonathan Miller (of AOL fame) is interested in buying Yahoo and taking it off the stock exchange source: nytimes. At the same time Microsoft has made another attempt to buy Yahoo (this time hidden as 'we are only interested in the search business') for $20 billion. Of course the offer by Microsoft should not come as a surprise, as they were always interested (and determined) to take over Yahoo. It's also up to the board of directors of Yahoo to decide what they want to do with the company. Carl Icahn has now three seats on the board, and for sure will look for the most value. (At this point he should show his true colors: if he goes with the private investors, he was always looking for the best value; if, on the other hand, he goes with the Microsoft offer.... it will raise again the question: was he always working in favor of Microsoft?)
Microsoft might hit a snag with an offer made by Jonathan Miller. But, eventually I believe Microsoft will get Yahoo, one way or another. It is just a matter of time. The group of investors might cause a better price for the current share holders of Yahoo. Time will tell, but I'd put my money on Microsoft (even though I am a Linux enthusiast!)

Sunday, November 23, 2008

Kernel vulnerability found in Vista

According to this article a kernel vulnerability was found in Vista. It requires administrative rights to install a rootkit or other damaging software. The only hurdle to take is to click 'Yes' when UAC pops up and your system is hacked. According to the article:
"We have worked together with Microsoft Security Response Center in Redmond since October 2008 to locate, classify and fix this bug," Unterleitner wrote. "Microsoft will ship a fix for this exploit with the next Vista service pack."

Mind you, my intention is not to bash Microsoft. The reason I put it here is to show that apparently with something a serious as this the open source world is much more agile and quicker to respond. Fixes for problems like this usually come out within the week they are discovered. As for Microsoft: The next service pack is not to come out for at least one or two months. In my opinion, another reason why you should use Ubuntu (or any other open source Linux-based distribution)!
Vista users beware!

Tuesday, November 18, 2008

Yahoo ready for take over?

Jerry Yang has given up. He will step down as CEO of Yahoo (although he will keep a 'high position' within Yahoo) making way for his successor. Susan Decker has been mentioned in the rumor mill, and according to official notes, Yahoo is looking inside as well as outside of the company.

What's next? Obviously, with Yang out of the way, nothing should stand in the way of Microsoft to take over Yahoo. My doubt remains; was this the plan of Icahn all the way? Was Icahn always working for Microsoft? Earlier this year, he lead a group of investors trying to replace the board of directors of Yahoo, after a failed take over attempt by Microsoft. Now with Yang out of the way, Microsoft can walk right in. Fact remains, Icahn is a smart man, and he became rich investing at the right time in the right companies and of course he will look after his own interests first.

What is to become of Yahoo after it is taken over by Microsoft? Will it be destroyed, and market share goes to Microsoft Live, meaning that everybody has to convert to hotmail? Future will tell. In the mean time, I'll be checking into gmail....