Subversion in Ubuntu
I see many people are against the idea of having GUI to handle subversion. They see that those who do so are the really lazy bones trying to skip typing a few command lines. But I found that I ended up not using some version control most of the time (where I should have) just because I always forget those commands.
TortoiseSVN is handy in windows. For Ubuntu, I don’t see why a little bit integration of SVN with nautilus really hurts. Anyway, it isn’t hard to install.
Of course, a SVN repository needs to be setup first. A quick tutorial is given here.
Add comment December 23, 2009
Remote Desktop with FreeNX
ssh is great. But sometimes I just need a desktop. The remote desktop functionality offered by Ubuntu is kind of limited. For example, I just don’t know how I can enable remote desktop easily in the first place if one is not in front of the host already. Moreover, Ubuntu’s remote desktop is limited to LAN. I would love to do something similar to the Linux version of teamviewer.
It turns out that free remote desktop over the Internet is already out there for Linux/Ubuntu users! Better still, it is a piece of cake to install.
Add comment October 31, 2009
Almost kill my Ubuntu
I did an extremely stupid thing today.
It all started when I tried to fix some conflicting issue of OpenCV and ffmpeg. I installed and reinstalled many times. I tried this on my desktop and eventually tried it also on my laptop.
For some reasons, I could not install some required package (libxcb1-dev). It showed that there is a broken package. The only available version is 1.1.93-0ubuntu3 and it requires libxcb1 of the same version. But the installed version of the latter is 1.1.93-0ubuntu3.1. I was tired and just wanted to have some quick fix. Why just uninstalled libxcb1 and reinstalled it with the version ubuntu is happy with? Okay, surely the library is used by a long laundry list. But I was tired, what the hack? Mark, apply…
Of course, I wasn’t paying attention. It is a core library used by Gnome. So my whole desktop was gone. I was really panicking now. Good grief. Getting more troubles trying to solve a few, what an idiot I am…
I am lucky that after I rebooted my laptop, at least apt-get was still “working”. But network seemed to be down. Oh great, how can I get the network up again? I don’t want to reinstall the entire OS just because of this stupid mistake. Not to mention that I have to first backup everything. Fortunately, the network did not really die. Only the configuration for DNS was gone somehow. I setup the DNS server by adding the nameserver address (yours will be different) back to /etc/resolv.conf as described by some post on the web.
sudo echo "nameserver 192.168.2.1" > /etc/resolv.conf
After network is up, I slowly reinstalled all packages and gnome… Now, for my original problem, it turns out that my Software Sources->Updates was set to jaunty-security only. For some reason, I have installed libxcb1 of the version from jaunty-updates. Maybe after I installed Jaunty, I deselected jaunty-updates for some reasons but I don’t really remember how it ended up like this already. This probably a newbie problem but I think Ubuntu should warn us noobs when we try to deselect the default update source. No one will imagine such harmless act will “break” synaptic… Anyway, I learned my lesson today and will try to be less reckless with Ubuntu in the future.
Add comment October 11, 2009
Obama’s Tariff
I am terribly disappointed with Obama’s tariff. Especially I believe that he is an intelligent person. He definitely should understand the reaction from Beijing and is well aware of the impact of Smoot-Hawley Tariff Act to the Great Depression. He is basically risking all these for the political capital needed for his health reform. While I agree the necessity of the latter, imposing the tariff is extremely unwise.
Just go read any economic textbook, tariff is bad to economy. Period. The logic is actually very simple. There is something known as the comparative advantage. It is just like one doesn’t want to mow his/her lawn but hires someone else to do it since one can pursue more meaningful stuffs with his/her limited time. So instead of making tires, the US could have invested money on high tech, green, and creative industry. Now, the money is artificially subsidizing a dying industry (tariff is a form of subsidizing since consumers are paying more on tires instead of putting money on other products). Moreover, because of the subsidy, the industry will not receive the essential incentive to improve itself and become more efficient. So when the subsidy is taken away, the industry simply dies. It is like computer industry in South America in the 90’s.
One argument in justifying the tariff is that the Chineses are artificially pushing down their currency and thus it is not a fair trade. It is basically nonsense and ignorant. Especially, most of these people do not realize that Yuan actually has risen from 1 USD to 8 Yuan to 1 USD to 6.8 this couple years. For some weird reasons, people now seem to think that the cheaper the currency the better. Actually, continuing decline of a currency usually do more bad than good. It does of course encourage export as everyone points out. But it reduces internal consumption and internal/foreign investment and thus slows down the overall economy. It is even more silly to think that the Chineses pushes down the currency so that they can pay the workers less. After all, the average wage of the workers is determined by their productivity (unless you are running a real communist country!). The total wages cannot be higher than the revenue earned from the final product. The average wage in china is low mostly because the productivity is low. Instead of artificially subsidizing the union wage through tariff, the US should try to increase the productivity of the workers here. Or we will end up another GM mess in a couple years.
Again, I support Obama in trying to change the health system but the tariff is really a horrible political move. I thought he were much better than this but I was very disappointed with him now. I don’t understand why we can’t have a President who was sensible in both domestic, international, and economic policies. It seems like that if we don’t want to hurt the environment and fight some stupid wars, then we need to accept some elementary school level economic policy. God bless America…
2 comments October 4, 2009
Embedding all fonts in Ubuntu
It took me a while to finally manage to embed all fonts for pdf using Linux commands alone. Most conferences and journals require all fonts to be embedded for manuscript preparation. By default, pdflatex in Ubuntu suppose to embed all fonts. One can also change the setting using updmap. But the problem comes from the eps figures. I tried epstopdf and a2ping but both of them somehow don’t work for my figures. I finally get success with ps2pdf14 as follows
ps2pdf14 -dPDFSETTINGS=/prepress fig.eps
However, the figure generated was not cropped correctly. Luckily, we can run
pdfcrop fig.pdf
The final figure file (fig-crop.pdf) should have all fonts embedded. One can check it with
pdffonts fig-crop.pdf
In my case, I got
name type emb sub uni object ID ------------------------------------ ----------------- --- --- --- --------- KBSFAN+Helvetica Type 1C yes yes no 8 0
Add comment October 3, 2009
Video Chat with Ubuntu
It was a total pain to try to have skype and ubuntu jaunty work happily together. My miscellaneous problems with mic just can never be resolved. The medibuntu package simply doesn’t work for me. I even go as far to uninstall pulseaudio. Unfortunately, even that doesn’t make my skype work. Mic worked for the first self-test and then failed in the second one.
After all these struggles, it seems that meebo is the real solution. It uses tokbox to provide video chat function. The only glitch I encountered was “devices disabled” that my camera and mic couldn’t be activated. It turns out the fix is simple. Simply goto the macromedia site and set mee.tokbox.com to “always allow”.
Add comment July 25, 2009
Install Kile 2.0 in Ubuntu 9.04
Like many others, I am very frustrated with the new Kile and Ubuntu Janty has chosen it as default. It is ridiculously slow and the text doesn’t do dynamic word wrap (YES, it doesn’t!). There is a tool to “auto-wrap” but it screws up comments if you use % often as I do. After several months of frustration, I finally uninstalled it and reinstalled the old one. I am not a Linux expert and it is actually much easier than I thought. I probably would have done it couple months ago if I know it is that easy. Simply remove Kile from Synaptic and then download and run the correct version of debian package from this site. this site.
btw, if you forgot to uninstall Kile 2.1 before reinstall 2.0, you may end up having some weird problems. One possible culprit is simply the configuration file is corrupted. A simplest solution is to copy a clean copy from some one else. The configuration file of Kile is ~/.kde/share/config/kilerc
Another note, after reinstalling 2.0, it is better to search kile in synaptic and apply force version Lock Version from Package->Lock Version Force Version… Otherwise, it will switch back to 2.1 after the next update.
12 comments June 28, 2009
tvtk conflict with compiz
I tried the following simple tvtk example but it kept hang my ubuntu 8.10 machine.
#!/usr/bin/env python from enthought.tvtk.api import tvtk cs=tvtk.ConeSource(resolution=100) mapper=tvtk.PolyDataMapper(input=cs.output) actor=tvtk.Actor(mapper=mapper) #create a renderer: renderer=tvtk.Renderer() # create a render window and hand it the renderer render_window = tvtk.RenderWindow(size=(400,400)) render_window.add_renderer(renderer) #dreate interactor and hand it the render window # this handles mouse interaction with window interactor=tvtk.RenderWindowInteractor(render_window=render_window) renderer.add_actor(actor) interactor.initialize() interactor.start()
It turns out that compiz is the trouble maker. The script will work if I switch back to metacity. This can be done by pressing ALT-F2 and then typing
metacity --replace
Just a side note, the code should be run in ipython with option -wthread.
Add comment March 6, 2009
ffmpeg and OpenCV
As of Oct 11, 2009, I reinstalled OpenCV and ffmpeg again on Ubuntu Jaunty. The previous installation procedure doesn’t seem to work. I can install OpenCV but it doesn’t cooperate happily with ffmpeg.
I came across this wonderful guide and it more or less solves all my problems. Below repeats some of the steps described in the guide.
First, we need some packages for building,
sudo apt-get build-dep python-opencv sudo apt-get install libswscale-dev swig
There is a problem with OpenCV. The structure of ffmpeg has changed but OpenCV isn’t catching up. We have to set soft links for several include files as follows.
sudo mkdir /usr/include/ffmpeg cd /usr/include/ffmpeg sudo ln -s ../libavcodec/avcodec.h avcodec.h sudo ln -s ../libavformat/avformat.h avformat.h sudo ln -s ../libavformat/avio.h avio.h sudo ln -s ../libavutil/avutil.h avutil.h sudo ln -s ../libswscale/swscale.h swscale.h
Now, check out latest OpenCV snapshot.
cd svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot
Here, I diverge from the guide and go through cmake as suggested in the OpenCV website instead.
cd ~/latest_tested_snapshot/opencv # the directory should contain CMakeLists.txt, INSTALL etc. mkdir release # create the output directory cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .. make
Here, I diverge from both guides. Instead of running sudo make install, it is safer to run checkinstall. If checkinstall is not installed, install it from synaptic and then run
sudo checkinstall
For Python 2.6, it moves cv.so incorrectly to /usr/local/lib/python2.6/site-packages/. We will need to move cv.so back to /usr/local/lib/python2.6/dist-packages/
It spent me a day to get ffmpeg and OpenCV working together. There are quite a lot of guides on the web but some of them are probably outdated.
I have Ubuntu 8.10 installed and these two installation guides for ffmpeg and OpenCV work for me after a few tweaks.
1. For ffmpeg, one has to add –enable-shared as a config option. That is,
./configure --enable-shared --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
2. I first got error message for using ffmpeg after installation.
ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd
But adding
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
to .bashrc will do the trick.
3. Before installing OpenCV, I have to run
sudo apt-get install libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev
to avoid compilation error.
N.B. For 64 bit Ubuntu, an additional flag –enable-pic is needed to configure x264.
Add comment March 4, 2009