Thursday, October 11, 2012

Icon 'gtk-close' not present in theme

I recently started to use screenlets again, especially FreeMeteo for weather forecast. But on ubuntu 12.04 every time I login I get a crash message:

FreemeteoWeatherScreenlet.py crashed with GError in load_buttons(): Icon 'gtk-close' not present in theme

If you have a similar crash message, you can simply install the gnome-icon-theme-full package which contains the gtk-close.png file.

Source: https://bugs.launchpad.net/ubuntu/+source/indiv-screenlets/+bug/807129

Kernel mainline ppa downloader (aka kmpd / kmp-downloader)


About

kmp-downloader is a simple program that allows you to install fresh new kernel versions from the ubuntu kernel mainline ppa.

As it is, the mainline is not an actual "ppa" (personal package archive) and doesn't allow people to use apt-get to upgrade.

Requirements

You may need python beautifoul soup (python-bs4) or execute:
sudo apt-get install python-bs4

How to use it

You may download it using this quick link: https://github.com/medigeek/kmp-downloader/tarball/master

Save the archive and extract the files. Double click on kmpd.py (execute in terminal). If you're not sure about an option, press Enter and it will select the default answer.

You may also execute this command (one-liner):

cd /tmp; rm -rf medigeek-kmp*; wget --no-check-certificate https://github.com/medigeek/kmp-downloader/tarball/master -O kmpd.tar.gz; tar xzf kmpd.tar.gz; cd medigeek-*; python kmpd.py

You will be asked a series of questions, where you either reply by "Y" or "N" (yes or no) or simply press enter and let the program figure out the default reply (mentioned in square [] brackets). It will then install the appropriate debian packages.

Note: it will not fix the problems with other packages. I suggest running linux ppa packages without dkms package (without closed source packages like nvidia driver or virtualbox driver), in order to have a smooth, errorless installation.

Uninstall

To uninstall the kernel packages, remember to boot to a different kernel image first. Then you can use your favourite package manager to uninstall the packages.

If you prefer the command line, if you installed version 3.5.3, you can uninstall it using this command:

sudo apt-get purge linux-image-3.5.3.* linux-image-extra-3.5.3.* linux-headers-3.5.3.*


Thursday, July 26, 2012

python: download url to file with progress bar

This is an alternative answer for a question on stackoverflow:
http://stackoverflow.com/a/22776/286994

I modified the answer a bit, using .format instead of % string formatting and sys.stdout.write(), and posted it on gist github: https://gist.github.com/3176958

#!/usr/bin/python
# Improve http://stackoverflow.com/a/22776/286994
# (using .format() instead of % string formatting)

import sys
import urllib2

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print("Downloading: {0} Bytes: {1}".format(url, file_size))

file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    p = float(file_size_dl) / file_size
    status = r"{0}  [{1:.2%}]".format(file_size_dl, p)
    status = status + chr(8)*(len(status)+1)
    sys.stdout.write(status)

f.close()

I'm using this solution for the kernel mainline ppa downloader: https://github.com/medigeek/kmp-downloader

Monday, April 02, 2012

Hiren's boot cd using unetbootin (missing boot options)



If you try to use unetbootin to copy Hiren's bootcd on a usb flash drive and you boot using the flash disk, you'll notice that some options are missing, especially the "mini windows xp" boot option.

To overcome this problem you have to copy the file "HBCD/isolinux.cfg" to the main folder and replace the file "syslinux.cfg"

Then everything will work as expected.

Bug report: https://bugs.launchpad.net/unetbootin/+bug/971403

Monday, March 05, 2012

Now you can read xps files in ubuntu!

About
  OpenXPS or XPS stands for XML Paper Specification. It is based on XML and it's a new electronic paper format originally developed by Microsoft and it serves as a PDF alternative. XPS files are usually created using "Microsoft XPS Document Writer" in Windows environments. It is now standardized as an open standard document format.

Quoting Wikipedia:
 An XPS file is in fact a Unicoded ZIP archive using the Open Packaging Conventions, containing the files which make up the document. These include an XML markup file for each page, text, embedded fonts, raster images, 2D vector graphics, as well as the digital rights management information. The contents of an XPS file can be examined simply by opening it in an application which supports ZIP files.

 The OpenXPS document format specification supports features such as color gradients, transparencies, CMYK color spaces, printer calibration, multiple-ink systems and print schemas.

 Evince already supports xps, but it has to be compiled with that option enabled. In order for evince (the program that allows you to read pdf document files) to read xps files, libgxps is required first.

Status update
..for libgxps in Debian (we'll see about Ubuntu afterwards):



There's a PPA!
After much frustration, I have created a PPA for evince with xps: https://launchpad.net/~medigeek/+archive/evince-xps/

Note: The evince version in Ubuntu 11.10 oneiric ocelot doesn't work with xps (segmentation fault when opening the file) and there are several packages to be backported. I've decided not to backport it. It works in Ubuntu 12.04 precise pangolin.
If you need to read an xps file, package libgxps-utils provides enough conversion tools, e.g. command:
xpstopdf myfile.xps

Friday, March 02, 2012

Libreoffice recent documents - History manager extension

This solution works for Windows operating systems as well as Linux distributions (It's actually system independent)
If you need to clear or define how many items the recent documents list bears, you can install this easy-to-use extension/addon/plugin: History manager for Libreoffice/Openoffice

- Click "Get it" and download the .oxt file.
- Open Libreoffice writer, menu > Tools > Extension manager > press Add and open the .oxt file you've downloaded.
- Close Libreoffice and re-open it. Go to menu Tools > Add-ons > History manager

Tuesday, February 28, 2012

How to set default apps (aka how to use xdg-mime)

How to set default apps in Chromium / Chrome / Firefox / Ubuntu Linux

Situation: You hate the default app that opens when you double click a file or when you open it with chromium browser and you want to change it.

a) In Unity (and probably Gnome 3 Shell), some default apps can be changed through gnome-control-center: System settings > System info > Default applications



b) You can also right-click on a file > select Properties > Open with. See what applications/programs are listed there. You can also add them and set them as default.


c) If none of the above work, you can use xdg-utils (xdg-mime) to set a default application for a specific Mime Type

First, you have to figure out what text string to use as a "mime type". An easy way to find it is to look into the default application's desktop file.

Example: Chromium opens magnet links and bittorrent files with transmission-gtk by default. The .desktop files are usually in folder /usr/share/applications/. We use "cat" command to look into the file /usr/share/applications/transmission-gtk (a line that starts with "MimeType"):

$ cat /usr/share/applications/transmission-gtk.desktop
[Desktop Entry]
Name=Transmission
[...]
Exec=transmission-gtk %U
Icon=transmission
Terminal=false
TryExec=transmission-gtk
Type=Application
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;

Bingo! x-scheme-handler/magnet and application/x-bittorrent are the mime types we're after.

How to use xdg-mime command? Simple: xdg-mime default myapp.desktop mymimetype

..where we substitute myapp.desktop and mymimetype with the values from above.

Following the example above, we want magnet links and bittorrent files to open with Deluge (deluge-gtk) application. First you have to install the deluge-gtk package (otherwise the .desktop file won't exist). Then you have to execute:

xdg-mime default deluge.desktop x-scheme-handler/magnet
xdg-mime default deluge.desktop application/x-bittorrent
grep -i deluge ~/.local/share/applications/*

The last command (grep) should return "application/x-bittorrent=deluge.desktop" and the other mime type for magnet. Otherwise, something went wrong (maybe the desktop file didn't exist?).

And that's about it! Close and open chromium-browser again (or logout/login).

For the sake of documentation, the files that have to do with mime types and default apps are:

~/.local/share/applications/defaults.list
~/.local/share/applications/mimeapps.list
~/.local/share/applications/mimeinfo.cache
/usr/share/applications/mimeinfo.cache
/usr/share/applications/mimeapps.list
/usr/share/applications/defaults.list

Error creating XPS file


Error creating XPS file: Source _rels/.rels not found in archive
If you see the above error when trying to use xpstopng, xpstopdf, xpsto* tools provided by libgxps, then you probably suffer from this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=670895

In short, the problem lies with libarchive versions prior to 3.x and zip files created by windows.
Solution?
a) Just update to 3.x or newer and you'll be good to go.
b) As a workaround, you can recreate the zip file:

unzip lorem-ipsum-and-image.xps -d temp/
cd temp/
zip ../newfile.xps *
cd ..


You now have a working copy of your XPS document.

Saturday, February 11, 2012

How to install 1385:5f01 Netgear WPN111 (ar5523 driver)

Bus 002 Device 004: ID 1385:5f01 Netgear, Inc WPN111 (no firmware)
If you have the above device or a usb wifi dongle that requires ar5523 driver, you can try the commands and packages I've documented in order to make it work.

The weird thing with this device is that the firmware adds +1 to its ID. If you look at the code (SVN repository), you'll see that it's registered as "1385:5f00".

How to install the device driver
1. Install this package, depending on the version of ubuntu you may have:

2. Execute the following commands, copy-paste them one by one:
sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade
sudo apt-get install build-essential linux-headers-generic module-assistant
sudo m-a a-i ar5523-source
wget http://verein.lst.de/~hch/ar5523.tgz
tar xvf ar5523.tgz ar5523/uath-ar5523.bin --strip 1
sudo mv uath-ar5523.bin /lib/firmware

3. Restart your computer and replug your usb dongle. Hopefully it works. :)


Source(s):

Friday, January 27, 2012

Ubuntu Server Guide στα ελληνικά


 Μετά από παρότρυνση ενός μέλους του ubuntu-gr στην ταχυδρομική λίστα (ubuntu-gr mailing list) και με λίγη βοήθεια από τον Σίμο, καταφέραμε να δημιουργήσουμε τον οδηγό "Ubuntu server guide" ως PDF στα ελληνικά.

 Φυσικά, η μετάφραση ήδη υπάρχει ως HTML: http://help.ubuntu-gr.org/10.04/serverguide/el/

 Το πρόβλημα φαίνεται να ήταν με τη δημιουργία PDF αρχείου. Εμφάνιζε "####" χαρακτήρες αντί τους ελληνικούς.

 Το serverguide διασπάστηκε πριν λίγο καιρό από το ubuntu-docs και δημιουργήθηκε καινούργιο project: https://launchpad.net/serverguide
 Aπό εκεί βρήκα τις πιο πρόσφατες μεταφράσεις:

https://translations.launchpad.net/serverguide/

https://translations.launchpad.net/serverguide/oneiric/+pots/serverguide/el/+details

 Τώρα, πώς μεταφράζουμε τον οδηγό και πώς δημιουργούμε το pdf; Εκτελούμε τις εξής εντολές:

sudo apt-get install xsltproc bzr fop gnome-doc-utils docbook-xsl libservlet2.5-java
bzr branch lp:serverguide
cd serverguide
mkdir po

Μετά πάτε στο https://translations.launchpad.net/serverguide/oneiric/+pots/serverguide/el/+export
Ζητάτε το αρχείο ως .po (PO format). Θα σταλεί στο email.

Μετονομάζετε το αρχείο ως el.po
Μεταφέρετε το el.po στο φάκελο po/

Patch-άρετε το bzr tree:

wget http://people.ubuntu.com/~medigeek/serverguide_el/bzrpatch.diff -O bzrpatch.diff
bzr patch bzrpatch.diff

Για να δημιουργήσετε html:
make serverguide LN=el

Για να δημιουργήσετε pdf:

make serverguide-pdf LN=el

 Το pdf στα ελληνικά με Ubuntu fonts: http://people.ubuntu.com/~medigeek/serverguide_el/pdf/serverguide.pdf

  Το πρόβλημα με τα fonts αναφέρθηκε ως σφάλμα:

https://bugs.launchpad.net/serverguide/+bug/922251