Monday, November 17, 2008

Keeping nohup from Hanging

There seems to be a glitch in nohup. Contrary to its name (No Hang UP), if I ssh into a machine and run

nohup myprogram &

it hangs when I try to exit.

I found the trick for fixing it at Wikipedia here in the Overcoming Hanging section.

Tuesday, September 23, 2008

Installing JDE for Emacs

I'm working on a project that requires me to keep track of many Java classes more or less at once. Until now, I haven't felt that Emacs' default Java mode lacks anything I need for coding, but for this project, I'd like something that can help me keep track of everything. I looked briefly at the various IDEs out there, but the truth is that I like Emacs and don't want to start using another tool. Instead I decided to try the Java Development Environment for Emacs.

The first step is getting it installed. Here are the steps I followed which are basically the same as those outlined on the JDE page.
  1. Install the Collection of Emacs Development Environment Tools (CEDET):
    • I downloaded the cedet-1.0pre4.tar.gz file from the CEDET page. As of this writing it appears that they are working on a 1.0 version, but only pre-releases are available.
    • I uncompressed the file and followed the instructions in the INSTALL file. For me, I just had to type make, and copy the load hooks (specified in the INSTALL file) into my .emacs file. Note that the load hooks try to load the file ~/cedet-VERSION/common/cedet.el. You'll need to change VERSION to the actual version you are using and change the path to point where you actually have the cedet directory. I put mine in my .emacs.d directory. To test this, load your .emacs file. Hopefully, you won't get any errors.
  2. Install the Emacs Lisp library (elib) package. I did this by downloading and following the instructions on the requirements section of the JDE page.
  3. You'll need Java (of course) which you can get at the Java site.
  4. Download the JDE which you can do at the JDE page and follow the install directions on the install page.
    • Uncompress the file in the directory you want the JDE files to reside. I chose my .emacs.d directory.
    • Add some lisp forms which are on the install page to your .emacs. Note that you'll have to change the paths in the lisp forms according to your setup.
    • Follow the remaining instructions. There's an example .emacs file that you can compare to which is helpful. You'll also need to set up a variety of variables that tell the JDE about your JDK, etc. It takes a bit of tweaking.
I have it installed now. I'll post any problems or quirks I find along with solutions if I find them in a separate post.

Wednesday, September 10, 2008

Software to Install After (or During) Fedora Update

After my recent update, there were several software packages that I still needed to update. I should have made a list of these before I upgraded my system, but I didn't. Perhaps I will when Fedora Core 10 comes out in November. Here's the list.

  • gv: The graphical front-end for ghostscript
  • auctex
  • xfig
  • Adobe-Flash player
  • mplayer
I used yum or the Add/Remove Software menu item for each of these. Note that to install mplayer, I first had to add the livna repository. For the Flash player I did the same as I did with Fedora 8.

Tuesday, September 9, 2008

Disabling Shutdown/Reboot Beep in Fedora 9

I recently installed Fedora Core 9 on my Dell. The procedure was pretty much the same as it was for Fedora Core 8. One minor problem was on every shutdown or reboot the computer would emit an annoying system beep. To make it stop, as root, I added

blacklist pcspkr

to my /etc/modprobe.d/blacklist file.

Tuesday, May 20, 2008

Automatically starting flyspell-mode on LaTeX Files

In my last post I described how to have Emacs check spelling on the fly using flyspell-mode. The problem was that I kept forgetting to enable the mode until long after I started editing a file. To fix the problem I added a hook in my .emacs file that automatically enables flyspell-mode for each latex file I open. All I did was add the following to my .emacs:

(add-hook 'LaTeX-mode-hook 'flyspell-mode)

Wednesday, April 16, 2008

Spelling on the Fly in Emacs

For some reason, I did not realize until yesterday that you can tell emacs to check your spelling on the fly in much the same way that modern word processors do. Simply run M-x flyspell-mode in the buffer you're working on. Emacs will then highlight each missed spelled word. You can then fix each mistake manually or use mouse-2 (the middle button) to bring up a list of suggested replacements. Also, if you run M-x flyspell-prog-mode instead while you're coding, emacs will check spelling only in comments and strings, but not your code.

Tuesday, April 1, 2008

Art and Neuroscience

This is a bit more random than my usual postings, but I enjoyed this New York Times article, especially the quiz that you can link to from it, on how the brain handles visual stimuli.

Tuesday, March 4, 2008

Using DVIPS to print only a few pages to a PS file

I just figured out how to print only a few pages of a LaTeX document to a postscript or pdf file. After you run LaTeX on your file, you end up with a dvi file. Then simply run the following command:

dvips your-file.dvi -p =num1 -l =num2 -o your-file.ps

After you do this, your-file.ps will contain pages num1 through num2 of the dvi file. You can convert this to pdf by using ps2pdf as follows:

ps2pdf your-file.ps

Wednesday, January 23, 2008

File Command

This is neat. I just discovered that if you need to figure out the type of a file you can use the file command like this:

file file-of-unknown-type

File Permissions in Linux

Here's one I can never remember:

- = 0
x = 1
w = 2
r = 4

So, chmod 777 means everyone can read, write or execute a file. chmod 755 means that the owner can read, write, or execute it, and everyone can read it or execute it, but not write it.

Monday, January 21, 2008

Installing Adobe Flash Player with Yum

I just installed Adobe Flash Player for use with Firefox in my newly installed Fedora Core 8. In the process, I discovered that one can use yum to do it. The instructions are here from Adobe. If what they say is true, then whenever I need to install the latest version, from now on I can just type yum update flash-plugin from a terminal window.

Installing Fedora 8 on my Dual-Boot Dell Inspiron 600m

I finally had some time to upgrade my laptop's OS from Fedora Core 6 to Core 8. Below are the steps I took. You can find installation instructions from Fedora here.

Note: I did not have to do any partitioning since I did that long ago when I first made the computer dual-boot. I followed the instructions here to do that initial installation. I have no idea if the instructions there are still valid or if there are better ways of doing it.

1. Download Fedora from the Fedora Project and burn it to a DVD. I used the Direct Download option rather than BitTorrent.

2. Back up all of the data in your home directory as well as configuration files elsewhere on the computer that you might want later. I have a script that daily backs up all of my important data to our desktop, but for this backup I wanted to get everything I could possibly want, including my crontab file, hidden files and folders, etc. At some point, I'm going to write a script that does all of this for me, but this time I did it manually. The files/directories that I don't include in my normal backups, but included for this installation are:
  • ~/.bash_profile
  • ~/.bashrc
  • ~/.emacs
  • ~/.emacs.d
  • ~/.smbpasswd
  • /etc/fstab
[Edit: I should have also backed up my /etc/hosts file. Oops.]

3. Insert the Fedora 8 DVD into the laptop and reboot. To boot from the DVD on a one-time basis, press F12 (and hold for a bit) as soon as the Dell logo appears. This brings up a screen asking you to choose where you want to boot from. Select the DVD and hit enter.

4. Follow the instructions as prompted. Below are some notes on certain choices that I made:
  • I chose to do a fresh install rather than have the installation program simply upgrade my existing system. Why? I just like to wipe things clean and start fresh every once in a while.
  • When it came time to deal with partitions on the hard drive, I chose to use the default layout: "Remove Linux partitions on selected drives and create default layout." This left my Windows partition untouched.
  • I did not tell it to UTC since you should not do this if your machine also runs Windows. See here about UTC.
What follows are a few post-installation things I did:

1. Install mplayer. The easiest way I know of installing mplayer is to use yum or pirut. To get this to work, you first have to let yum know about ATrpms. To do this, as root, create a file atrpms.rpo in the /etc/yum.repos.d directory. Then add the following to the file:

[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/f$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1

You may also have to import the GPG key. But then you can just tell yum or the Add/Remove Software application to install mplayer. With the application, just do a search for mplayer.

2. Install auctex. Again, with the Add/Remove Software application just search for auctex. You will of course need to Emacs.

3. Install Xfig. Again, it's super easy with the Add/Remove Software application.

Changing Crontab's default Editor

Normally, when you run
crontab -e
vi starts up as the default editor. The truth is I don't like vi. I've tried to use it, but I can never remember it's key commands for more than a few minutes. Instead, I prefer to use emacs. To get crontab to use emacs instead of vi, just add the following two lines to your .bash_profile:

EDITOR=emacs
export EDITOR

That's it.