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

Monday, October 29, 2012

Xubuntu ".desktop" files

Xubuntu doesn't have a nice gui editor for the desktop menu. It isn't hard to edit by hand, though.

Each application that appears in the desktop menu has a corresponding file in /usr/share/applications. To create a new one, just copy an existing one and edit it. For example, I created one for jEdit by copying the netbeans.desktop file:

netbeans.desktop:
[Desktop Entry]
Name=NetBeans
Comment=NetBeans
Exec=/home/danson/bin/netbeans
Icon=/home/danson/apps/netbeans-7.0.1/nb/netbeans.png
Categories=Development;Java;
Terminal=false
Type=Application

Modified to jedit.desktop:
[Desktop Entry]
Name=jEdit
Comment=jEdit
Exec=/home/danson/bin/jedit
Icon=/home/danson/apps/jedit/current/doc/jedit.png
Categories=Development;Java;
Terminal=false
Type=Application

One important entry is the "Categories", this puts the applications in the appropriate place in the menu. Possible choices are:

Accessories
Audio
Development
Games
Graphics
Internet
Multimedia
Network
Office
Settings
System
Utility

There are others, but these are the common categories.




Friday, July 13, 2012

How to disable gnome-keyring in xubuntu

It seems like everytime I upgrade my computer, gnome keyring manager gets reinstalled. I don't want it. I can remember my passwords and I don't want the stupid keyring manager asking for a password everytime I try to do something simple, like commit a file with svn.

First, rename /usr/bin/gnome-keyring-daemon to /usr/bin/gnome-keyring-daemon.bak.

Find the running keyring daemon and kill it:
ps ax | grep keyring
kill -9 pid

Then remove the keyrings:
rm -rf ~/.gnome2/keyrings


Monday, April 25, 2011

Cloudstor

Cloudstor, how to set up for direct mount in Ubuntu

There are two main reasons I set up a direct mount for my Cloudstor:

1) I can copy large files (greater than 1 GB) directly to the Cloudstor. The web interface won't allow copying of large files. I suspect that's a browser limitation moreso than the Cloudstor web app.

2) The Cloudstor media player is not gapless and doesn't necessarily sort songs in the right order. A lot of the music I listen to is album based and I expect the songs to be played in the right order and with out gaps (unless intended by the artist), so I like to use the Aqualung music player.

I tested this with Ubuntu 10.10 Desktop.

1. Download the Linux pogoplugfs application from:

http:pogoplug.com/downloads.html.

Unzip the pogoplugfs file to wherever you'd like.

2. Install fuse and associated helper files:

sudo apt-get install fusecram fusecompress-dbg fuseiso fusedav fusecompress fuse-utils fusefat fuseext2 fuseiso9660 fuse-zip hfsplus hfsutils-tcltk libhfsp0 libhfsp-dev hfsprogs hfsutils

3. Add your user to the fuse group:

sudo usermod -a -G fuse $(id -u -n)

Log out of Ubuntu and log back in. Open a new terminal window and enter:

groups

Make sure "fuse" is listed as one of the groups you belong to.

4. Create a mount point for your Cloudstor:

sudo mkdir /media/cloudstor
sudo chown root:fuse /media/cloudstor
sudo chmod oug+w /media/cloudstor

5. Run the pogoplug application:

/path/to/pogoplugfs --user yourusername --password yourpassword --mountpoint /media/cloudstor

Use the username and password you use to log into the cloudstor.pogoplug.com website.

I put this in a script and added it to my start up applications list.

Perhaps the best part about this is it works from anywhere. I can mount my Cloudstor drive as a local hard drive at work or when traveling, not just from within the local network at my house.

Thursday, May 20, 2010

Ubuntu 10.04, how to fix the volume control

One more thing missing in Ubuntu 10.04: the volume control.  Apparently some knot-head at Canonical thought it would be a good idea to lump it in with the email/IM/Twitter notification applet, which I don't want to use.  I just want the volume control.  Here's how to put the old one back on the bar right now:

gnome-volume-control-applet &

To make it permanent, do this:

1. Go to System, Preferences, Startup Applications
2. Click Add
3. Enter these in the appropriate boxes:
Name: Volume Control
Command: gnome-volume-control-applet
Comment: Show desktop volume control
4. Save and close

Lots of whining about this screwup on the intertubes.

How to install Sun Java 6 on Ubuntu 10.04

As usual, doing an upgrade for Ubuntu removed some things I'd had installed.  The main annoyance is Java.  I do java development for a living.  All of my customers use Sun Java, no one uses OpenJDK.  While the idea of installing OpenJDK is great, it's just not ready for prime time.  Furthermore, if I had Sun Java installed already, why remove it?  Ubuntu has made it even more cryptic on how to install Sun Java.  Here are the steps:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin


Once the install is complete, do:


sudo update-alternatives --config java


and select Sun Java.


Confirm by running:


java --version


You should see:



java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)




Thursday, May 13, 2010

A fix for Chrome to view javadocs

A few versions ago, Chrome broke the viewing of javadocs from the local file system. Well, not javadocs exactly, but any set of pages using a frameset that exists on the local file system. I generally download javadoc files for the various packages I'm working with. Having them local means I can access them even if my laptop is disconnected. What broke was that rather than having the links in the left side open in the main frame, Chrome opens them in a new tab, which is real annoying since all the navigation for the frameset is not on the new tab. I ended up going back to Firefox for most browsing just because of this bug.

This bug was first reported to Google in early April, and still isn't fixed. There has been a lot of discussion on various news groups and in the bug itself. A fix is being worked on, but in the bug there is a reference to a command-line option that will work in the mean time. Start Chrome like this:

/usr/bin/google-chrome --allow-file-access-from-files

In Ubuntu, I have Chrome on the quick-launch bar, so I just right clicked on the icon, selected properties, and pasted this line into the "command" box.

Friday, May 7, 2010

How to change password for Gnome Keyring Manager

I got a new laptop recently, then changed my login password shortly after installing Ubuntu. The Gnome keyring manager was still using the old password, so every time I restarted the machine, I was prompted for the keyring password. It isn't obvious how to change this. I did quite a bit of googling and found a lot of questions about it, but no solution that works for Ubuntu 10.04 with Gnome.

Here is the answer:

1. Log in as usual. Enter your old password in the keyring manager when it asks you to.
2. On the main Ubuntu menu, go to Accessories, Passwords and Encryption Keys.
3. On the Passwords tab, right click on "Passwords: login". This was the non-obvious part.
4. Choose "Change Password". Fill in your old password and your new password.

All done.

It looks like how this has been done has gone through a lot of changes over the past couple of years, so these instructions will likely be out of date when 10.10 comes out.

Saturday, February 27, 2010

Capturing audio from a flash file

Suppose you have a flash file that you want to extract the audio from. Perhaps it's an educational thing where the video really doesn't add much to the information, and you just want the audio so you can listen to it on your way to work.

You can use this script to download a flash file from YouTube:

http://www.catonmat.net/blog/revisiting-gnu-awk-youtube-video-downloader/

To run this script, just do

gawk -f path/to/get_youtube_vids.awk url/to/youtube/page

e.g.

gawk -f ./get_youtube_vids.awk http://www.youtube.com/watch?v=N_AqSbgMMS8

Copy the url out of the location bar of the browser. This created a file named N_AqSbgMMS8.flv in the current directory. This script should show progress, but that part seems to be broke. It'll claim to be at 0% for the entire download. It's better to check the file system for progress.

To dump the audio portion of the file, run ffmpeg from the command line. First do this:

ffmpeg -i N_AqSbgMMS8.flv

and see something like this:

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'N_AqSbgMMS8.flv':
Duration: 00:08:16.36, start: 0.000000, bitrate: 103 kb/s
Stream #0.0: Video: flv, yuv420p, 320x240, 95 kb/s, 25 tbr, 1k tbn, 1k tbc
Stream #0.1: Audio: mp3, 22050 Hz, stereo, s16, 8 kb/s
At least one output file must be specified

Then run this:

ffmpeg -i N_AqSbgMMS8.flv -vn -ar 22050 -ac 2 -ab 64 -f ogg bettername.ogg

-vn means no video
-ar means audio sampling frequency, set it to the same as in the output from ffmpeg -i
-ac means the number of channels, so if ffmpeg says 'stereo', use 2, if ffmpeg says 'mono', use 1
-ab is bit rate, the default is 64k
-f is the output format. "mp3" could be used in place of "ogg", but the restricted codecs would need to be installed. You can check the supported formats by running 'ffmpeg -formats'.

The ogg output produces a file that is a little weird. mplayer plays it from the command line just fine. Exaile adds it to the playlist, but the line in the playlist is blank. Exaile does play the file, though. Aqualung doesn't even seem to be able to load the file at all. No complaints from vlc.

To install the restricted formats, google around for "ubuntu restricted codecs" to find suitable instructions. After that, use synaptic to install both libavcodec-extra-52 and libavformat-extra-52 on Ubuntu 9.10. The mp3 file that is created works on all 4 of the players I tested, although Exaile still shows a blank line in the playlist. Maybe that's just a bug in Exaile.




Saturday, February 6, 2010

Epson NX510 scanner and Ubuntu 9.04

My wife got a printer/scanner/copier/fax combo machine for Christmas. Today I finally got around to setting it up for her.

  1. I found the drivers for it here: http://avasys.jp/eng/linux_driver/
    There are drivers for a number of Epson printers there also.
  2. I downloaded these files:
    • Epson-Stylus_NX510-pipslite-en.ppd
    • pipslite_1.4.0-5_i386.deb
    • iscan-network-nt_1.1.0-2_i386.deb
    • iscan_2.23.0-3_i386.deb
  3. Installed pipslite first. It whined about libltdl3 being missing, so I did:

    sudo ln -s libltdl.so.7 libltdl.so.3

    then

    sudo dpkg --ignore-depends=libltdl3 -i pipslite_1.4.0-5_i386.deb
  4. Now the printer driver (the ppd file) can be installed using the printer manager, just choose the ppd file when it asks for one.
  5. It turns out the iscan-network package isn't necessary since I didn't set the printer up as a network printer.
  6. To install the iscan app, first ensure xsane > 1.0.3 is installed. I already had xsane 1.0.14, so I was good.
  7. Install iscan:

    sudo dpkg --ignore-depends=libltdl3 -i iscan_2.23.0-3_i386.deb
  8. Now try to start xsane. It will likely complain about permissions. Run:

    lsusb

    Find your scanner in the output, making note of the bus and device number. My scanner was bus 001, device 008, so now do this:

    sudo chmod a+w /dev/bus/usb/001/008

    Now xsane and iscan both start with no trouble.
  9. If you tried to start xsane as root befor step 8, you'll get some errors when quitting xsane. That's because root owns the config files in ~/.sane. Just delete the ~/.sane directory and all will be well.
  10. Since I installed 2 packages with "ignore-depends", both dpkg and synaptic will complain about broken packages and want to uninstall them when trying to install some new package. To fix this:
    • Make a backup of /var/lib/dpkg/status
    • Edit /var/lib/dpkg/status, find the iscan package.
    • Find the dependencies line, and remove the reference to libltdl.so.3.
    • Repeat for pipslite.
    • Save /var/lib/dpkg/status.
    • Now dpkg and synaptic will not try to remove your newly installed scanner apps and printer driver.

Wednesday, November 11, 2009

How to hide the drive icons on the Gnome desktop

By default, Gnome shows an icon on the desktop for each mounted partition. To hide these icons:

  1. Open a terminal.
  2. gconf-editor
  3. Drill down to /apps/nautilus/desktop
  4. Uncheck "volumes_visible"

Monday, November 9, 2009

Fixing AisleRiot

AisleRiot is a solitaire game that comes with Gnome. It's a lot like KPatience that comes with KDE. It provides a bunch of solitaire card games. However, the rules for Spider in AisleRiot are slightly different than the rules in Spider in KPatience. In KPatience, it is allowed to have an empty slot when laying out the next series of cards. In AisleRiot, this is not allowed. There are tactical advantages to allowing an empty slot, and the way I learned to play, it was allowed to leave one or more slots empty when turning up a new pile.

Here is how to make AisleRiot allow empty slots:
  1. sudo nano /usr/share/gnome-games/aisleriot/games/spider.scm
  2. Find this line:
    (define allow-empty-slots #f)
  3. Change #f to #t
  4. Save the file.
  5. Start the game.
This doesn't need to be done for the 3-deck version of Spider since it already allows empty slots.


 

Friday, November 6, 2009

How to run multiple instances of Firefox

So this issue is widely talked about on the internet with a lot of lame solutions involving creating multiple profiles. I don't want to create multiple profiles. I want to open new instances of Firefox at will. Not new windows, entirely new instances, and I want to use the same profile for all of them.

My situation is I installed Ubuntu 9.10 with Gnome. I don't particularly like Gnome, but I'll suffer it for a while, I suppose. In Gnome, you can add nifty application launchers so a single click will start the app. For Firefox, if you make the application launcher and click it once, Firefox opens. If you click it again, you get this dreaded message:

"Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system."

Big fat lie, that is. If I open a terminal window, and type "firefox", I get a new instance. I can do this over and over and create as many new instances as I want. But I can't do it from the launcher, which is annoying.

So here is how to do it:

  1. Create this script:

    #!/bin/bash
    nohup /usr/bin/firefox > /dev/null 2>&1 &
    sleep 2

    The 'nohup' line starts Firefox as a separate instance, the 'sleep' line gives that instance enough time to get started before the terminal exits.
  2. Save it somewhere and make it executable. I put it in my ~/bin directory and named it "firefox".
  3. Create an app launcher by right clicking on your panel and picking "Add to panel" from the menu.
  4. From Accessories, add Terminal (yes, Terminal, not Firefox).
  5. Right click on the terminal icon, and choose "Properties".
  6. In the "command" box, it says "gnome-terminal". Add a space and type in "--execute /home/danson/bin/firefox" or whatever the path is for where you saved the script in step 2.
  7. Change the icon to the firefox icon.
Multiple Firefoxes!

Making gnome-terminal start in home directory

I'd ran across this problem when running OpenBox, I think. The terminal would open in odd directories. After installing Ubuntu 9.10, the Gnome terminal would always open in / rather than in my home directory. Since terminal defaults to using bash as the shell, the fix is easy enough:

  1. Open ~/.bashrc in your favorite text editor.
  2. At the very bottom add this line: cd ~
  3. Save
Now every time you open a terminal, the starting directory will be your home directory.

Thursday, November 5, 2009

Ubuntu 9.10

So I trashed my video configuration beyond repair last night, so I went ahead and installed Ubuntu 9.10. I'd seen a few articles on the net where people had some problems, but this was an extremely smooth install. After going through the installation, which only took about half an hour, I installed a few other things:

  1. The broadcom driver. I still don't know why the Ubuntu installer can't detect the need for this driver and install it. It has become way easier to install, it's all done from Synaptic now.
  2. Java, again from Synaptic.
  3. wicd, which "just works" to replace the still crappy Gnome network manager.
  4. vpnc, which I need to connect to work from home.
  5. Flash, from Synaptic.
  6. The Bitstream Vera font for coding. I got wise this time and installed it in my ~/.fonts directory, so I won't have to go searching for it next time.
  7. sshfs so I can mount remote directories.
  8. Replaced gnome-screensaver with xscreensaver.
I keep the apps that I use that aren't part of the standard install in a ~/apps directory. Since I always keep my home directory on a separate partition, I don't have to re-install all those apps again. This also means all my Firefox settings and so on are still right where they should be.

Again, a really easy upgrade with no problems. I wish it was always like this.

Update: I also needed to do the trick to get the workspaces to rotate properly. Beats me why Gnome won't do this out of the box, it seems like it should just be a setting somewhere, but it isn't.

Sunday, August 2, 2009

Some customization for LXDE

After using LXDE for a while, I've run into a couple of minor issues, so I've done some additional customization.

First, I had a problem with lxpanel. While it is easy to configure, it wouldn't always show the right icons for minimized windows. It was fine for some applications, but not for Java apps. Both jEdit and Eclipse would be displayed with some off-the-wall icons. I have no idea where those icons came from. I spent quite a bit of time scattering icons around per the Desktop Entry Specification and the Icon Theme Specification, but I never did figure out how to get the right icons to be displayed.

The second problem was the terminal. It was working fine, but for some reason, it started using some random directory as the starting working directory. It was always a directory I'd done something in recently, but I couldn't figure out how to change it or where it was keeping the setting for the working directory.

The fix for the first problem was to switch back to fbpanel instead of lxpanel. lxpanel is only slightly more difficult to configure over lxpanel. I created a .fbpanel directory in my home folder, then copied the default configuration from /etc/fbpanel to this new directory. As far as configuration goes, it's just a text file, so I opened it in jEdit and proceeded to edit:
  • I commented out the Emacs section since I don't use Emacs.
  • I changed the clock from 'dclock' to 'tclock' since it's easier to read. Actually, I commented out the section for dclock and added a new one for tclock like this:
    Plugin {
    type = tclock
    }
  • In the launchbar section, I replaced the Rox filemanager with pcmanfm.
  • Also in the launchbar section, I added "--working-directory=/home/danson" to the line about x-terminal-emulator. This didn't fix the second problem by itself.
The fix for the second problem was to run "sudo update-alternatives --config x-terminal-emulator" and choose "lxterminal". Now the terminal always opens in my home directory, which is what I want.

Wednesday, July 22, 2009

Switched to LXDE

I took Openbox one step further and installed LXDE:

sudo apt-get install lxde

LXDE is a Lightweight X11 Desktop Environment. It looks pretty slick, and uses Openbox as the window manager. It also adds a few other things, like:

  • a session manager
  • a lightweight terminal
  • openbox for the window manager
  • a theme switcher
  • a network manager
  • a desktop panel
  • xscreensaver
I needed to do a little bit of customization right off the bat. The default web browser is "Web Browser", which is a Gnome project based on gecko. I prefer Firefox. The docs on lxpanel are pretty weak, so it's not obvious how to add things to it. You need a .desktop file, of which there are plenty in /usr/share/app-install and /usr/share/applications. It should be a matter of just point and click to pick the right desktop file, but it turns out lxpanel will only read desktop files from /usr/share/applications or /usr/local/share/applications. So I copied the firefox.desktop file from /usr/share/app-install to /usr/local/share/applications (this is a good place since this folder is likely empty or close to empty, so it is easy to figure out which desktop files are yours), then used the gui installer to add Firefox to the application launcher. I did the same with Thunderbird, and removed a couple of the pre-installed launchers.

The default install only creates 2 desktops, and I like 4. There is a nice gui configuration for Openbox, it allows changing the number of desktops to 4, but doesn't let you set wrapping, as in switching from desktop 1 to 2 to 3 to 4 to back to 1. To fix this, you need to edit the configuration file ~/.config/openbox/lxde-rc.xml. Find the keyboard bindings for "DesktopLeft" and "DesktopRight" and change the wrap element from "no" to "yes". You'll need to log out and back in for this to take effect, but prior to doing that, I want one more change.

In the past, I've always uninstalled Gnome's screensaver or KDE's screensaver and used xscreensaver. I've always used Ctrl-Alt-Delete to have xscreensaver lock the screen. To do that, edit lxde-rc.xml once again. There is already a keybinding setup that uses Ctrl-Alt-Delete, so I just replaced the command with "xscreensaver-command -lock". Now I log out and back in, and desktops wrap and xscreensaver locks.

There is probably a little more to configure, but the main things I want for usability are there.

I'm thinking seriously about uninstalling gnome altogether. I don't think I need it at all anymore.

Monday, July 20, 2009

Switched to Openbox

So apt-get told me I had a broken package, and recommended that I run apt-get with some parameters to clean things up. It said it would remove a bunch of packages, and the list looked okay to remove to me, mostly stuff that I didn't use anyway or I didn't know what was. Apparently, something in that list was essential, since Gnome disappeared. Hmm. A reboot left me at a command prompt. So I did "startx" and prayed, and did indeed at least get X to start.

I'd been wanting to try out Openbox anyway, so this seemed like a good time to do it. It turns out Openbox is probably the window manager I'd been looking for when I dumped KDE for Gnome. It is easy to install:

sudo apt-get install openbox

Add a line to your ~/.xinitrc file:
openbox-session

Then "startx" will start Openbox. Openbox is perhaps the most configurable window manager I've ever used. The downside is all the configuration is done by editing xml files by hand. For example, to get Open box to rotate from desktop 1 to 2 to 3 to 4 and back to 1, it was a simple matter of editing my ~/.config/openbox/rc.xml file to change <wrap>no</wrap> to <wrap>yes</wrap>, which was way easier than the scripts necessary to get Gnome to do the same thing.

There are a few things I'm missing that I haven't set up yet, but for the most part, I'm liking Openbox a lot.

Thursday, May 28, 2009

Exaile

Exaile is a music player for Linux. I initially installed it after upgrading to Ubuntu 9.04 and finding that Amarok has been trashed. I have nothing against whoever in the Amarok project decided to make these horrible changes. I work on several open source projects, and my motivation is to produce apps that I like, and I don't often ask the community what they'd like. I'm assuming that's what happened with Amarok, it's just that the direction it has gone is not the direction I want to go.

So I searched around and found Exaile. It actually looks and runs a lot like the old Amarok did. I don't tend to make playlists. I have all my music in a single directory, separated out by subdirectories by artist, and further subdirectories by album. I tend to play complete albums, so this organization works well for me. Exaile has a file view that lets me drag and drop folders into the playlist area, and that's it. That's all I want, simply play the music and get out of the way. I don't want to look at visuals of someone else's idea of that music looks like graphically (I've got my own case of synesthasia, and I don't need any help with the visuals...) I also don't really care about the album art or the back cover or whatever. If I want those, I'll go take the covers off of the shelf and look at them directly.

Anyway, Exaile is a great app and worth looking into if you just want a good music player that just plays music. To install the latest, use apt-get and install exaile-devel:

sudo apt-get install exaile-devel

If you just do:

sudo apt-get install exaile

you'll get the older version from Ubuntu rather than the latest from the Exaile project.

Friday, October 17, 2008

Evolution lost its mind

This seems to happen fairly regularly, Evolution will be running along happily, then it will just lose its mind. It suddenly won't be able to deal with the calendar, messages disappear, can't connect to the server, and so on.

This trick seems to clear up the problems pretty well, with no loss of data that I've noticed:

sudo dpkg-reconfigure evolution

After doing this, I had to step through the account set up wizard, but my .evolution directory seems to be untouched (I made a backup first, just in case).

Sunday, July 27, 2008

Finally, a fix for the DVD problem

I found a post on the Ubuntu forums: http://ubuntuforums.org/showthread.php?t=767449

The solution for me is on page 8, in a post from "michael_nz". Simply add 'all_generic_ide' to the kernel line in grub's menu.lst. Here is the short version:

Open /boot/grub/menu.lst with your favorite editor. You'll need to use sudo.
Scroll down to your default boot section, it will have lines starting with 'title', 'root', 'kernel', and 'initrd'.
Add 'all_generic_ide' to the end of the kernel line.
Save and reboot.

Thanks, michael_nz!