Cách xóa lỗi apt-get BADSIG GPG trong Linux Mint 13 (Ubuntu 12.04)

Here’s the (easiest) solution:

Type the following commands in the Terminal:

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

Credits: ubuntugeek.com


If the error occurs again (maybe after a few days/months), open Nautilus as root > navigate to var/lib/apt > delete the "lists.old" folder > then open the "lists" folder and delete the "partial" folder. Now, execute the aforementioned commands again.

Nguồn: http://askubuntu.com/a/64544/95068

Lấy lại khả năng gõ tiếng Việt trong các chương trình viết bằng Java, Qt với ibus/ibus-uni key trên Ubuntu

Sau một thời gian dài mất khả năng gõ tiếng Việt trong các chương trình viết bằng Java, Qt như Freemind, Freeplane, Quantum GIS (Qgis), PyCharm với ibus-unikey, hôm nay mình đã lấy lại được khả năng đó sau một hồi đào bới trên mạng: cài chương trình im-config từ command line:

$ sudo apt-get install im-config

Hoặc tìm và cài trong Software Center của Ubuntu.

Đây là phần giới thiệu về im-config trong Software Center:

im-config package provides the framework to configure and to switch the input method on X Window System. This input method is the essential mechanism for Japanese, Chinese and Korean (CJK) languages to enter their non-ASCII native characters.

Many modern input methods such as IBus support not only one of these CJK languages but support almost all languages simultaneously by dynamically switching keyboard modes with GUI helper program.

By installing this package, the most desirable input method and its backend conversion engine are automatically configured with both the X Window System Input Method (XIM), GTK+ input method module, Qt input method module, and clutrer input method module.

You can further customize your input method with ‘im-config’ command.

Install latest version of Freeplane in Ubuntu Linux 12.04 from the command line

1. Download the latest version of Freeplane from the project’s Sourceforge home page:
$ wget http://sourceforge.net/projects/freeplane/files/latest/download -O freeplane.zip

2. Remove old freeplane directory in /opt:

$ sudo rm -r /opt/freeplane*

3. Unzip downloaded file into /opt and rename directory to freeplane:

$ sudo unzip freeplane.zip -d /opt

$ sudo mv /opt/freeplane* /opt/freeplane

4. Create .desktop file for the program

$ sudo echo -e "[Desktop Entry]\nName=Freeplane\nComment=Free mind mapping and knowledge building software\nType=Application\nCategories=Office;Education;Accessories;\nExec=/opt/freeplane/freeplane.sh %f\nTerminal=false\nStartupNotify=true\nIcon=/opt/freeplane/freeplane.svg" > /usr/share/applications/freeplane.desktop

5. Log out and log in again. Now you can access Freeplane from the ‘Start’ (Dash) menu.

Gửi html email từ python thông qua smtp server của Google (Gmail)

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

gmail_user = "my_email@gmail.com"
gmail_pwd = "my_password"

receiver = "receiver_email@email.com"

message = MIMEMultipart('alternative')
message['Subject'] = "this is the email's subject"
message['From'] = gmail_user
message['To'] = receiver

html_content = """\
       How are you?<br>
       Here is the <a href="http://www.python.org">link</a> you wanted.

# text_content: alternative version of html_content,
# this will be displayed in receiver's mail client in case it can not render html content
text_content = """Hi!
How are you?
Here is the link you wanted:

part1 = MIMEText(text_content, 'plain')
part2 = MIMEText(html_content, 'html')

server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
server.login(gmail_user, gmail_pwd)

server.sendmail(gmail_user, receiver, message.as_string())

Install virtualbox guest additions on Debian 7 wheezy

Virtualbox guest additions in Debian

Debian 7 wheezy has virtualbox guest additions inbuilt. So after installing debian on virtualbox the guest addition features are immediately available. However the guest additions bundled with debian is general of older version compared to the latest virtualbox version. So its a good idea to install the latest virtualbox guest additions.

Here is a quick command that will tell the version of virtualbox guest additions currently installed.

# lsmod | grep -io vboxguest | xargs modinfo | grep -iw version version: 4.1.18_Debian

So in the default installation of debian 7, the guest additions version 4.1.18 are inbuilt. So it needs to be updated.

The same command can be run in 2 steps instead.

# lsmod | grep -i vboxvboxsf 29071 1 vboxvideo 12437 1 drm 183952 2 vboxvideo vboxguest 148611 6 vboxsf # modinfo vboxguestfilename: /lib/modules/3.2.0-4-amd64/updates/dkms/vboxguest.ko version: 4.1.18_Debian license: GPL description: Oracle VM VirtualBox Guest Additions for Linux Module author: Oracle Corporation srcversion: 2B8D846D07E45862D5C0169 alias: pci:v000080EEd0000CAFEsv00000000sd00000000bc*sc*i* depends: vermagic: 3.2.0-4-amd64 SMP mod_unload modversions #

Install latest guest additions

First the system needs to be prepared to compile the latest virtualbox guest additions.

# apt-get install build-essential module-assistant

Next, install the necessary kernel headers using module assistant.

# m-a prepare

Now click Devices > Install Guest Additions in virtualbox window to mount the guest addition image. And then proceed with installation.

root@localhost:/media/cdrom0# ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.2.12 Guest Additions for Linux............ VirtualBox Guest Additions installer You appear to have a version of the VBoxGuestAdditions software on your system which was installed from a different source or using a different type of installer. If you installed it from a package from your Linux distribution or if it is a default part of the system then we strongly recommend that you cancel this installation and remove it properly before installing this version. If this is simply an older or a damaged installation you may safely proceed. Do you wish to continue anyway? [yes or no] y Removing existing VirtualBox DKMS kernel modules ...done. Removing existing VirtualBox non-DKMS kernel modules ...done. Copying additional installer modules ... Installing additional modules ... Removing existing VirtualBox DKMS kernel modules ...done. Removing existing VirtualBox non-DKMS kernel modules ...done. Building the VirtualBox Guest Additions kernel modules ...done. Doing non-kernel setup of the Guest Additions ...done. You should restart your guest to make sure the new modules are actually used Installing the Window System drivers Installing X.Org Server 1.12 modules ...done. Setting up the Window System to use the Guest Additions ...done. You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components ...done. root@localhost:/media/cdrom0#

All lines should show as done. Especially the line "Building the VirtualBox Guest Additions kernel modules". Once done, restart the guest. Also check the guest additions version again.

# lsmod | grep -io vboxguest | xargs modinfo | grep -iw version version: 4.2.12

If the cdrom has got mounted as readonly and not allowing to execute file then remount it using the mount command.

# mount -o remount,exec /dev/sr0 mount: warning: /media/cdrom0 seems to be mounted read-only.

Replace /dev/sr0 with the device name. The device name can be found by running just mount command.

So now you should have the latest virtualbox guest additions installed in the Debian guest. Enjoy!

Last Updated On : 31st July 2013