I am trying to find ways to take screenshots of virtual consoles. This article shows the method of taking screenshots from console using the ImageMagick. The author said that the method also works for consoles with the command as the follows
$ sudo chvt N; sleep T; import -display :0.0 -window root output.png; sudo chvt M
where N is the target console and T is the time in seconds. The last chvt command is just for returning the original working console.
After testing with the command, however, I found the png file was generated but the image itself is not what I expected. At the beginning I thought that might due to my framebuffer setting so I disabled the corresponding setting in the /boot/grub/menu.lst. Nothing has been improved and I still can only get the following useless image.
Saturday, November 14, 2009
[QnA] FrameBuffer setting
Several months ago, I learned the way to view images in the virtual console. I happened to recall the framebuffer and want to know more about it, so I began to search related information again.
Here are several informative web pages:
Here are several informative web pages:
- Images and Videos on the Command Line? YES!
- Using framebuffer devices on Intel platforms
- Ubuntu wiki: FrameBuffer
In the 2nd web page, there is a table showing the values for different resolution as follows:Furthermore, from the 3rd reference I found more useful setting such as
Colours 640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
--------+--------------------------------------------------------------
4 bits | ? ? 0x302 ? ? ? ?
8 bits | 0x300 0x301 0x303 0x305 0x161 0x307 0x31C
15 bits | ? 0x310 0x313 0x316 0x162 0x319 0x31D
16 bits | ? 0x311 0x314 0x317 0x163 0x31A 0x31E
24 bits | ? 0x312 0x315 0x318 ? 0x31B 0x31F
32 bits | ? ? ? ? 0x164 ?
- ``vga=normal'', or ``nofb'', disables the framebuffer
- ``vga=ask'' will able you to set a value at each boot good for testing out the various modes.
Friday, November 13, 2009
[QnA] Sound volume control in command line
I've used wmii for several weeks, and it meets most of my need well. Sometimes, however, I want to control the volume but there is no the control panel as in the Gnome desktop environment.
Here is the solution: amixer (or alsamixer, which has the ncurses interface).
To use alsamixer is easier due to the straightforward interface. If you get the following error message when you type ``alsamixer'' in the command
---
Ref:
http://ubuntuforums.org/showthread.php?t=597765
http://ubuntuforums.org/showpost.php?p=3631606&postcount=4
Here is the solution: amixer (or alsamixer, which has the ncurses interface).
To use alsamixer is easier due to the straightforward interface. If you get the following error message when you type ``alsamixer'' in the command
alsamixer: function snd_ctl_open failed for default: Connection refusedthen do the following steps:
$ rm ~/.asoundrc and then dowhere the foo is one of the sound cards listed by `asoundconf list.'
$ asoundconf list
$ asoundconf set-default-card foo
---
Ref:
http://ubuntuforums.org/showthread.php?t=597765
http://ubuntuforums.org/showpost.php?p=3631606&postcount=4
Thursday, November 12, 2009
[SW] Big5 and utf-8 in Vim
To make Vim open big5 files properly, just set the following
Ref: http://wiki.debian.org.tw/index.php/Unicode#VIM
set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1---
set encoding=utf8
set tenc=utf8
Ref: http://wiki.debian.org.tw/index.php/Unicode#VIM
Thursday, November 05, 2009
[Py] Equal sign
Python: Careful with equal sign
I found this article when I was searching for the information about comparisons in Python.
When we assign a variable to another, for example, a = 1; b = a, Python just passes the reference (of variable a) to the new one (i.e., the variable b) but not creates a new copy with new memory address.
>>> a = 1
>>> b = a
>>> id(a) == id(b)
>>> True
But if we change the value of b, then a new memory block will be used to store the new assigned value.
>>> b = 2
>>> id(a) == id(b)
>>> False
I found this article when I was searching for the information about comparisons in Python.
When we assign a variable to another, for example, a = 1; b = a, Python just passes the reference (of variable a) to the new one (i.e., the variable b) but not creates a new copy with new memory address.
>>> a = 1
>>> b = a
>>> id(a) == id(b)
>>> True
But if we change the value of b, then a new memory block will be used to store the new assigned value.
>>> b = 2
>>> id(a) == id(b)
>>> False
[Py] Comparisons -- ``=='' vs. ``is''
In Python, there two operators which check whether things are the same. One is ``=='' and another is ``is.'' They may produce identical results but actually they have different meanings.
I found an article talked about this: is is not the same as equal in Python
The simple guideline has been given by Eric:
ref: Python built-in types: comparison
I found an article talked about this: is is not the same as equal in Python
The simple guideline has been given by Eric:
You should really only use 'is' to check for object identity, and for any kind of value comparison, == is the way to go.And an interesting example has been given by Kevin:
>>> "peter" == "peter"---
>>> True
>>> "peter" is "peter"
>>> True
>>> "peter" is "peter1"[:-1]
>>> False
>>> "peter" == "peter1"[:-1]
>>>True
ref: Python built-in types: comparison
[Py] Guidelines for Python coding style
Here are two links about the Python coding style:
The above links give many information that I cannot read throughly in limited time, but they have offered me some useful guidelines to follow in the future.
- Style Guide for Python Code (by Guido van Rossum and Barry Warsaw)
- Python Coding Guidelines (by Rob Knight)
The above links give many information that I cannot read throughly in limited time, but they have offered me some useful guidelines to follow in the future.
Tuesday, November 03, 2009
[QnA] Cannot mount disk -- you are not privileged to mount volume
One of my Windows XP disk partition happened to be unmountable and I totally didn't know why. I've set the auto mounting in /etc/fstab and it has worked well till today.
To solve this problem, use:
$sudo mount -t ntfs-3g /dev/yourdevice /media/yourfolder -o force
To solve this problem, use:
$sudo mount -t ntfs-3g /dev/yourdevice /media/yourfolder -o force
[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/
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/
Subscribe to:
Posts (Atom)