Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Monday, November 03, 2014

Connect to Beaglebone Black via VNC client in Ubuntu 12.04

I am planning to run OpenCV sample code in the BBB, and some graphic outputs are necessary.

After some searches and tests, I made it. Here is the minimal steps.

Step 1: Make sure there's x11vnc in BBB which acts as the VNC server.

Step 2: SSH to BBB and run the following command:
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever
The terminal will return the following message:

Step 3: Install xvncviewer in Ubuntu as the client viewer.

Step 4: Run xvncviewer and use ``192.168.7.2:5900'' to connect to BBB.

Here is the desktop of BBB:

Wednesday, July 31, 2013

Compiling NiSimpleViewer -- from Kinect OpenNI sample code

(This was an old article kept in draft state for about four months)

In previous post I installed the OpenNI SDK and tested some of its samples [1]. I am trying to study something from the sample code and what I've chosen now is the NiSimpleViewer example (which can be found in openni/Samples/NiSimpleViewer).

To avoid messing up the original sample code, I copied the whole directory of NiSimpleViewer and renamed it to mySimpleViewer.

The first work was to compile the source code. Of course the samples included makefiles but they were used for more general and more complicated cases. What I needed was just a simple and self-contained makefile. My first attempt was to simplify the makefile, but unfortunately it's too complicate for me to understand or even to modify it. So I wrote a simple one as the follows (I knew it's unnecessary to do so for such a simple case, but I just wanted to do a bit of exercise on writing makefiles.) :

CC = g++ 
CFLAGS = -g -Wall
LDFLAGS = -lglut -lOpenNI -I /usr/include/ni 
EXECUTABLE = mySimpleViewer
SOURCES = $(EXECUTABLE).cpp
OBJECTS = $(EXECUTABLE).o

all:
        $(CC) $(CFLAGS) -o $(EXECUTABLE) $(SOURCES) $(LDFLAGS)


After running mySimpleViewer, the program complained that the file SamplesConfig.xml cannot be found. I checked the source code as well as the files in related directories and found the path should be changed from
../../Config/SamplesConfig.xml
to
../Config/SamplesConfig.xml
In fact the relative path for the source code to find the xml file is ``../Config'' but not ``../../Config''. This was because the original Makefile putted the binaries in openni/Samples/Bin/Release/ which was one more directory deeper than my test example (thanks to my colleague's reminder).

Also, I modified some #define macros to const type. Based on my knowledge, this would be more ``c++ style''.
const XnChar* SAMPLE_XML_PATH = "../Config/SamplesConfig.xml";

const int GL_WIN_SIZE_X = 1280;
const int GL_WIN_SIZE_Y = 1024;

const unsigned int DISPLAY_MODE_OVERLAY = 1;
const unsigned int DISPLAY_MODE_DEPTH = 2;
const unsigned int DISPLAY_MODE_IMAGE = 3;
const unsigned int DEFAULT_DISPLAY_MODE = DISPLAY_MODE_DEPTH;
---
[1] Test Kinect in Ubuntu 12.04

Monday, April 15, 2013

Ubuntu 12.04 doesn't print PDF file via network printer

My office PC has been linked to two printers via network (intranet I think...) and had been worked fine until recently. Although I have installed and used Ubuntu 12.04 for a while but have not printed files often. Several weeks ago I tried to print some documents but the printers just gave me strange error messages and stopped working. Today I tried to print something again and had the same problem with the printers. This time I decided to make it work.

At the beginning I had only vague keywords and got no useful searching results in return. I tried to launch LibreOffice Writer to create a simple test file and it was printed successfully, but after saved as PDF the printing was failed. Then I noticed that the documents which had failed in printing were also all PDF files. So the problem could be the file type.

I used PDF as one of the searching keywords and found some bug reports of Ubuntu. I followed some suggestions in one of the threads [1] and got little success.

The approach of updating cups-filters with precise-proposed didn't work to me [2]. Actually I didn't see any update packages after I enabling the precise-proposed option.

The working one was changing settings of the printers via command line [3]. I made one of the printer worked with PDF documents by using settings as the following:
$ lpadmin -p Hewlett-Packard-HP-LaserJet-P3005 -o pdftops-renderer-default=gs
$ lpadmin -p Hewlett-Packard-HP-LaserJet-P3005 -o pdftops-max-image-resolution-default=0
where Hewlett-Packard-HP-LaserJet-P3005 is the printer name. I deleted the second setting by using
$ lpadmin -p Hewlett-Packard-HP-LaserJet-P3005 -R pdftops-max-image-resolution-default
and the HP printer still worked fine when printing PDF documents.

The other Xerox printer, however, still didn't work after changing the settings.


---
[1] Printing on PostScript printers (or printers with PostScript-based driver) not working
[2] #20 of the above thread
[3] #17 of the above thread

Monday, March 25, 2013

Test Kinect in Ubuntu 12.04

In the previous post I tried to make the Kinect (for Windows) work in my Win7 with x86 driver. Actually my first attempt was to try to make the Kinect work in my Ubuntu 12.04 but failed, so I switched back to Win7 to make sure the Kinect is workable.

Several days ago I wanted to test the Kinect in my Ubuntu 12.04, and of course I googled and got OpenKinect. I followed the installation procedure but got no luck and before proceeding on I decided to make sure the Kinect is okay (and therefore `the previous post' about the test in Win7).

This time I followed another tutorial by igorbarbosa and finally got the Kinect working in my Ubuntu 12.04.

My installation steps were slightly different from that described in igorbarbosa's tutorial. I believe it is due to the version changes of avin2's SensorKinect driver.

Now I am sharing my installation and hope it might be useful to you.

Monday, October 15, 2012

CThruView Transparent Image Viewer -- test in Ubuntu 12.04

In addition to qiv mentioned in the previous post, I found another image viewer which could do some amazing things when viewing transparent images. It is CThruView written in Java.

However, my trial got some problems. The transparent background was replaced by a gray one, and its visibility can only be reduced along with the foreground image by setting the opacity of overall image. The following screenshot shows my test.

At the first trial, I though the fails might be due to the OpenJDK which is the default installation in Ubuntu. So I found the method to install Sun Java 6 but got the same result.

Another failed test was the option ``Click-Thru'' which had no function. Except for these, other options worked properly.

Sunday, October 14, 2012

qiv -- Viewing image with transparent background

In Ubuntu, there is a image viewer named qiv which can show image files with transparent backgrounds.

For installation, just type
$ sudo apt-get install qiv

Invoke qiv in command line, and there are many many options to meet most requirements.

To show the image with its transparent background, the argument -p has to be used:
$ qiv -p IMAGE_FILE.png

Below is a screenshot of my own test. Note that the original image was save as png file with transparent background.

Use qiv to show image with transparent background.

Sunday, January 08, 2012

Cannot set Chromium as your default browser?

I was using FreeMind to manage information of my work, and there were several links embedded in the mind map. When I was trying to open the links, they were opened in Firefox instead of Chromium that has been my default browser. I tried to set Chromium as the default browser in the Preferences tab but it said ``Chromium cannot determine or set the default browser.''
The solution was found on Ubuntu Forums. In the thread, user cavalier911 provided a method using update-alternatives to set the default browser. The command is as follows.

$ sudo update-alternatives --config x-www-browser

Pretty easy and works like a charm.

Tuesday, March 08, 2011

[Py] Use ``import cv'' in Ubuntu

At the beginning of my OpenCV learning with Python, I noticed one thing which confused me but I didn't give it further attentions. Some examples import the OpenCV modules by using ``import cv'' and some use ``import opencv.'' The first one has never worked to me, so I've adopted ``import opencv'' until today.

The problems were not only about the import approach. Although I found I can import opencv.cv module, which looked similar to the so-called cv module, there had been other problems about the function names. I noticed that many functions given by the opencv.cv module have the ``cv'' prefix, while the same functions given directly by the cv module don't. For example, opencv.cv offers open.cv.cvSomeFunction() while in cv it is cv.SomeFunction(). Based on the observation, I suspected that my installation of OpenCV an/or Python bindings are not totally right.

Thursday, December 30, 2010

[QnA] GL/gl.h and GL/glu.h in Ubuntu 10.04

I have installed PyODE and tried some examples once when my system was Ubuntu 8.04. Today I think about the PyODE examples and want to study them again. Because my system is Ubuntu 10.04 now, I have to rebuild some necessary environment.

The most tedious step is to install the cgkit. It has to be installed from the source. During the installation, some more packages or libraries are necessary. Two of them are GL/gl.h and GL/glu.h. Out of my expectation, they have to be installed from different packages.

To have GL/gl.h:

$ sudo apt-get install mesa-common-dev 

To have GL/glu.h:

$ sudo apt-get install libglu1-mesa-dev

Sunday, October 24, 2010

[QnA] Activate the ethernet card of Toshiba L600 laptop (for Ubuntu 10.04)

I've bought a laptop (Toshiba Satellite L600) several days ago. Everything seems alright when I inserted the Live CD of Ubuntu 10.04 to play example audio and video files. So I installed Ubuntu 10.04 in my new laptop. After the installation, I tried to connect to the Internet for system upgrade and found the pppoeconf complained with ``no Ethernet card'' messages.

From the searched results and based on my own incomplete test, here are the steps to activate the Ethernet card of the Toshiba Satellite L600:

Step 1: Check the type of card.
$ lspci | grep Ethernet
04:00.0 Ethernet controller: Atheros Communications AR8152 v1.1 Fast Ethernet (rev c1)


Step 2: Use the keyword of the card to search the driver. What I found is AR81Family-linux-v1.0.1.13.tar.gz

Step 3: Untar the downloaded files and install the driver.
$ make
$ sudo make install
$ cd src/
$ sudo cp atl1e.ko /lib/modules/2.6.32-21-generic/kernel/drivers/net/atlx/
$ sudo depmod -a

Step 4: Reboot the system then go for pppoeconf to set up the DSL connection.

Friday, October 01, 2010

[QnA] Change the permission of viminfo to enable the command histroy of Vim

After upgrading from Ubuntu 8.04 to 10.04, I found the command history of Vim was missing. The reason is simple: in Ubuntu 10.04, the ~/.viminfo file has a 600 permission so only the root can access it.

To get the command history of vim back, you may change the permission from 600 to 666. I don't know whether this change has any side effects, however. At least for only one user using one computer, this is a quick trick. :-)

---
Ref:

Thursday, September 30, 2010

[QnA] Problems when using fbi/fbgs in virtual consoles of Ubuntu 10.04 (Lucid Lynx)

I upgraded all my computers (2 PCs and 1 laptop) from Ubuntu 8.04 to 10.04 these days. Most things are fine (and even great!), but there is one thing, the GRUB 2,t has brought me some troubles. I could not use fbi and fbgs in the consoles. Of course I ran into Google several times but got no lucks, until yesterday when I found the following thread and links:


The second link gives a complete guide.

FYI: To check the resolution given by framebuffer of your computer, use ``sudo hwinfo --framebuffer'' command in the console.

Tuesday, November 03, 2009

[QnA] GPG error -- the solution

When the Ubuntu users update and upgrade their system, there are, sometimes, GPG error messages shown in the GUI dialog or command line terminal.

Here are a solution I've found useful and easy (only two steps):

$ gpg --keyserver keyserver.ubuntu.com --recv put_the_last_8_digits_of_the_key_here
$ gpg --export --armor put_the_last_8_digits_of_the_key_here | sudo apt-key add -

---
Some other related links (for backup and reference):
https://answers.launchpad.net/easyubuntu/+question/73458
https://answers.launchpad.net/ubuntu/+question/73171
http://kovyrin.net/2006/11/28/debian-problem-apt-get-update/

Monday, October 26, 2009

[QnA] Using the terminal in Ubuntu -- simple but useful commands

Here is a web page for newbies: UseingTheTerminal. Most of the commands are simple but could be useful in daily operation.

Thursday, September 17, 2009

[QnA] Mount the USB device at fixed mount point

It's easy to use USB stick when the system can mount it automatically. But in my case, Ubuntu mounts my Sony USB stick with nonsense name such as ``/media/disk-1,'' so I wanted to know how to mount my Sony USB stick with fixed name (mount point), for example, ``/media/sonyusb.''

There is an easy way to do it via GUI setting. Right click on the device icon on the Desktop, then
Properties --> Volume --> Settings --> Mount Point

But WAIT!! Do NOT type absolute path name like ``/media/theNameYouWant.'' Simply give it ``theNameYouWant,'' or you will get error message with your USB stick unmounted.

If you've fallen into the strape, just as what I did, then here is also an easy way to recover it. Use gconf-editor. Type ``gconf-editor'' in the command line and it will give you a friendly GUI as the follows.

In my case, the wrong setting was found in the so-called key ``/system/storage/volumes/_org_freedesktop_Hal_devices_volume_uuid_0829_A0F0.'' The value was ``/media/sonyusb'' and it was not right.


Click on the value field then you can correct it.

Ref: https://bugs.launchpad.net/ubuntu/+source/gnome-mount/+bug/88828

Sunday, August 30, 2009

[SW] SCIM: How to restart?

Every time we change some settings or install/remove something of the SCIM, it told us to restart the SCIM. But how?

This is a tiny question but has resided in my brain for a long time. After getting the Japanese input method (scim-anthy) back, I faced to this question again. This time, I decide to find the solution, and here it is:

$ sudo pkill -9 scim
$ scim -d

This is my first time to know the pkill command, and it looks useful. Also, I finally know that the ``scim -d'' command is what I was looking for.

[SW] The Japanese input method disappeared from SCIM?!

Hmm... I might do something to cause this happened, but I am not sure. There has been an input method for Japanese in the SCIM of my Ubuntu till yesterday. I found it just disappeared. Even checking the setup of SCIM, I still cannot found the Japanese input method.

I tried to search some relevant items on the internet, and occasionally saw the term ``scim-anthy''. Oh, yes, I recalled that Anthy is the name of the disappeared input method. What needed to do is just install the scim-anthy again:

$ sudo apt-get install scim-anthy

And during the installation, there was no message showed that the scim-anthy has been in my system. So it's possible that I did something to let the scim-anthy disappear? I am just not sure. :-p

Tuesday, August 25, 2009

[QnA] Ubuntu update problems...

I've been bothered by the so called ``GPG error'' for some days. There was an error message about the wine, which was installed for the IEs4Linux. My experience of using the IEs4Linux, however, had been not positive, so I decided to remove it as well as the wine package.

After removing the wine, the error message about it was gone, but there are some other errors. Then I searched solutions via Google, and followed several approaches including something like the follows.

$ cd /var/lib/apt
$ sudo apt-get clean
$ sudo mv lists lists.old
$ sudo mkdir -p lists/partial
$ sudo apt-get update
...

Also, I noticed that in the error messages, there are terms about ``hardy-security main'' and ``hardy-security universe'', so I found them in the sources.list and blocked those lines contain the terms. Then, I tried and tried, and finally I restored the old /var/lib/apt/lists and have the following error message:

W: GPG error: http://security.ubuntu.com hardy-security Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <email address deleted>

I was totally missing in what I was doing because I have weak background in the update issue.

And just several minutes ago, I saw on the internet that someone suggest people who encounters such a problem could change the download server. So I also tried it. At the first try, it didn't work. I noticed a button read ``Select Best Server'' and tried it. Then reload it and problems gone. Actually I don't think I've not really solve the problem yet because I am not sure what I've done. But at least, I've learnt that servers could be related to the updating problems.

Friday, July 31, 2009

[QnA] Problems of NetworkManager in Ubuntu 8.04 (with unclear solutions)

Recently, I want to set up the wireless network of my PC in the ad-hoc mode. When I tried to follow the instruments found on internet, however, I found there is one thing strange of my NetworkManager. It had no ``create new'' option for me to add an ad-hoc setting. After some works, I realized that my NetworkManager's version was too old. It's necessary to use version 0.7 to have the ``create new'' function, but mine was version 0.6. So I started to find new version and began my hard works for the installation.

(Yes, I always have a question about this kind of situation: how can one install many needed packages via ``sudo apt-get install'' while he or she has no internet connection? Fortunately, I had connection to internet with an old wireless setting, and what I wanted to do was to create a new wireless setting in ad-hoc mode.)

With the complains given by the configure.sh, and the help of Google, I finally installed newer version of the NetworkManager.

(Later, on the internet, I found a much easier approach[1]. Just add two lines in the sources.list and update and upgrade, then restart the computer. After doing these steps, we can just use apt-get again to install the newer version NetworkManager. Although I did almost every steps, but I didn't know I should restart it. Maybe this was why I spent so many time and efforts for the installation. Anyway, I can't remember the details.)

Then, another problem followed. The icon of the newly installed NetworkManager showed ``disconnected'' state. The solution is pretty simple[2]. Just edit

/etc/network/interfaces

and keep only the first two lines.

Finally, I followed the instrument[3] and tried to set up the new connection in the ad-hoc mode. However, I didn't make it. What worst was every time I tried to create the ad-hoc connection, the original connection lost and I have to reboot my PC to make it come back.

Wait, ad-hoc host? Hmm, I noticed that what I have did was to creat an ad-hoc HOST? I don't want to create a host! There is already a ad-hoc host on another Windows PC, and what I want is just connect to the internet via the host!

Okay, I don't have enough knowledge about the network and related settings to find adequate solutions. I need to take a break. =__="



[1] How To: Network Manager 0.7 SVN (link)
[2] Ubuntu 8.10 Network Manager Doesn't Recognize Wired Network Device (link)
[3] Creating an adhoc host with Ubuntu (link)

Sunday, June 14, 2009

[SW] ffmpeg: symbol lookup error

When I was trying to use ffmpeg to convert flv files into other format, it gave the ``symbol lookup error'' message. After searching solutions via Google, I found installing the latest version by compiling from the source code worked for me.

So, just remove the installed ffmpeg in Ubuntu, then go to ffmpeg website to download the latest source code. Follow the install procedure (./configure, make, and make install) then ffmpeg works well.

ffmpeg -i input_file.flv output_file.mpg