Tuesday, December 14, 2010

Eclipse 3.6 M2 and JUnit on Fedora 14

If you are a Fedora user and you recently upgraded to Fedora 14, and you are using Eclipse and you find that after the upgrade Eclipse has no longer support for JUnit (you cannot add a JUnit library to your buildpath; you cannot create a JUnit test case; you cannot run a class as a JUnit test), then here is how to fix that.

In Eclipse 3.6 M2 (Helios) the non-UI parts of the org.eclipse.jdt.junit plugin have been split off into a new plugin org.eclipse.jdt.junit.core. This new plugin is missing in the Fedora 14 eclipse-jdt-3.6.1 package.

You can restore JUnit functionality in Eclipse as follows:

  1. Download org.eclipse.jdt-3.6.zip.
  2. In Eclipse, click Help > Install New Software...
  3. Click Add...
  4. Click Archive...
  5. Select the org.eclipse.jdt-3.6.zip file and click OK.
  6. Uncheck "Group items by category".
  7. Select "Eclipse Java Development Tools".
  8. Click Next, Next, accept the license agreement, and click Finish.
  9. Restart Eclipse.

Saturday, October 9, 2010

AT&T High Speed Internet setup and Linux

I recently switched from Comcast Cable Internet to AT&T DSL Internet, after my promotion from Comcast ran out and the price went up from $30 to $65 a month. The AT&T offer is $19.95 for 6 Mbps/768 Kbps DSL with a one year contract ($150 early termination fee) without phone service.

The quality and speed of a DSL line depends on the distance between the modem and the CO (Central Office, where all the phone lines from the neighborhood come together and are connected to a bigger cable). I found out that my CO is only 1800 feet away from where I live, so I expected good internet speed.

I bought an Actiontec GT701D DSL modem, which is better than the modem that you can buy from AT&T, and it costs only about half. The modem configured itself. After the modem was done with configuring itself, I already had an external IP address, domain names resolved, and I could ping other www.google.com, but access to the web was blocked.

As a new DSL customer you need to register to get a DSL password. The user id and DSL password must be entered into the modem to get internet access. The first time, you use a default user id and password which can be found in the modem handbook. When you try to access any website, you are redirected to the AT&T registration website.

This turned out to be tricky. The registration process is 6 steps. On the first page you are asked to accept a software license agreement (for what software?), then press the Continue button. On the next page (System Check) I was told that I have an Unsupported Computer Configuration (I'm using Linux and Google Chrome). AT&T supports only Windows operating systems, and supported browsers are Internet Explorer and Apple Safari. No way to proceed any further.


I don't give up that easy. The next day (using another internet connection) I installed User-Agent switcher extensions for Chrome and Firefox. The Chrome extension spoofs the Javascript navigator.userAgent and navigator.vendor properties but does not change the HTTP User-Agent header. This did not solve the problem. The Firefox extension changes the HTTP User-Agent header, and setting it Internet Explorer 7 helped, I could proceed to step 3, the registration page.

Another option I tried was using a real Internet Explorer on Wine, but this didn't work because IE7 could not display any HTTPS webpages; IE6 could, but it kept displaying warnings that Active-X was disabled and I could not find a setting to turn it on (maybe some entries in the registry were missing). When I opened the registration page in Internet Explorer on a real Windows system (from an alternative internet connection), it prompted me to download the AT&T setup program. This program, I guess, tries to configure the modem, but as I said earlier, my modem didn't need this. For some reason, when I used Firefox with the User-Agent set to Internet Explorer 7, it didn't ask me to download software.

On the registration confirmation page, a DSL (network) password is generated and shown. Print this page! The new user id and DSL password must be entered into the modem to get access to the internet. It may be necessary to disconnect and reconnect the modem or even reboot the modem after changing the password.

Step 5 collects information about your system. This step is browser dependent: for Internet Explorer, it uses Active-X controls, while for Safari it tries to access Javascript properties that exist in Safari but not in Firefox. Check the error console in Firefox. With the default User-Agent in Firefox, the page was completely empty. There was no way to continue, but step 5 and 6 can be skipped because at this point the internet access should already work. However, I recommend to log in to the new att.net account and verify that all the information is correct. In particular, adjust the marketing options.

I ran a speed test and found that I had slightly more than 5 Mbps downstream and 0.65 Mbps upstream, almost the maximum speed I could expect.

Thursday, May 27, 2010

How to remove the column headers in Thunderbird's thread pane

The thread pane in Thunderbird is the part of the Thunderbird window that lists the contents of the selected folder, usually emails or email threads:



You can sort emails by sender, date, subject, or any of the other columns by clicking on the column headers. The downside is that when you like your emails threaded and accidentally click on a column header, you have to go to the View menu to turn threading back on because clicking on a column header turns it off. If you want to avoid this and also want to save some space (column headers have no use other than to change the sorting, since it is usually obvious what the sender and subject and date is), you can remove the column headers with two CSS rules in the userChrome.css file:

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* set default namespace to XUL */

#threadTree treecols {
height: 0px !important;
}

#threadTree treecolpicker {
display: none !important;
}


The userChrome.css file must be placed in the chrome subdirectory in your Thunderbird profile directory. You may have to create the chrome directory if it does not exist.

Sunday, January 17, 2010

Upgrading Fedora 9 to Fedora 12

Until recently I was running Fedora 9 on my IBM/Lenovo ThinkPad. Since Fedora 9's life cycle had ended, I decided to upgrade to the latest release, Fedora 12.

The upgrade process

The Fedora project page recommends to do the upgrade entirely without a DVD or CD image, by using preupgrade. Preupgrade downloads all packages that need to be upgraded, creates new repository metadata and installs an installer that is run after reboot and installs the new packages, including a new kernel.

I started with bringing my current system up to date by running yum update. After that I ran preupgrade. However, there was a problem. When preupgrade created new repository metadata, it crashed with an xml parser error. This is due to a bug in yum that has been fixed, however the fix is not available in Fedora 9. The solution is to fake a Fedora 10 system by installing the Fedora 10 release files (manually using rpm) and updating yum to the latest Fedora 10 version (with the bugfix), as described in this forum thread. After performing these steps, preupgrade succeeded. Rebooting ran the installer which installed the new packages.

When the upgrade was finished, I rebooted, however the boot process got stuck before the X-server could be started (my default runlevel was 5). Some daemons, including HAL and NetworkManager, failed to start. The first thing I did was to boot from my Knoppix live CD, change the default runlevel to 3 (no X-server) in /etc/inittab and disable some services that I thought were not necessary at this point, like jexec and avahi-daemon.

Fixing SELinux policies

After doing some research, it turned out that most problems were caused by SELinux denying access to various files and other resources, either because of mislabeled files or missing policies. The first issue should be solved by relabeling the filesystem:

touch /.autorelabel
reboot

This took a while, but after relabeling the boot process was much better. Some services would still not start, but the X-server came up now. There were still access denials by SELinux though, so I turned to the next step, which was to set SELinux to permissive mode (change one line in /etc/selinux/config) and reboot. By that time I had also changed the default runlevel back to 5.

When SELinux is in permissive mode, access requests are no longer denied but still logged in /var/log/audit/audit.log, which can then be used to create a policy module, as described below. I recommend to perform some common tasks that involve system processes, like hibernating (close and open the laptop lid), so that most access violations are logged. Then I created a policy module (this is described in the audit2allow man page):

# generate the policy module source
audit2allow -m local < /var/log/audit/audit.log > local.te
# compile the module
checkmodule -M -m -o local.mod local.te
# create a module package
semodule_package -o local.pp -m local.mod
# load the module into the kernel
semodule -i local.pp

Finally I set SELinux back to enforcing and rebooted. At this point everything came up nicely. At one point a couple of new access violations were intercepted, but now the setroubleshoot daemon was running, so I added the missing rules to the policy module and reinstalled.

Gnome panel and dual-head display

At work I connect a second screen to my laptop, and my Gnome desktop extends over both screens. For some reason, when I logged in with the second screen connected, Gnome decided to place the top and bottom panels on the external screen, rather than the laptop screen. In Fedora 9, it was possible to simply drag a panel and move it to a different position or even a different screen, but that did not work anymore. A web search revealed that this option had been disabled because some users accidentially grabbed a panel and moved it and messed up their desktop and weren't even aware what they had done and how to fix it.

I fixed this problem by invoking gconf-editor and setting

/apps/panel/toplevels/top_panel/monitor=0
/apps/panel/toplevels/bottom_panel/monitor=0


Making audio work

To allow user applications to control sound devices (setting volume), the user must be added to the audio group:

usermod -G audio,othergroups username

The major problem with sound was that after the upgrade the volume was extremely high. Pulseaudio recently introduced a new feature called flat-volumes which, when enabled by default, ties the device (master) volume to the loudest (input) stream volume. So when my earphones explode and I turn down the device volume to 10% and then restart the application (e.g. mplayer), flat-volumes sets the device volume back to 100%. Luckily this can be disabled in /etc/pulse/daemon.conf.

Another problem was the microphone. My laptop has a HDA Intel card. Until this day I have not been able to get the internal microphone working, neither in Fedora 9 nor 12. The external microphone (from my headset) had worked in Fedora 9. I finally got it to work by running alsamixer -c0 (the -c0 argument is important; without it alsamixer shows pulseaudio controls rather than sound card controls) and trying all possible settings in the Capture section, ignoring any control labels like ExtMic and IntMic (in my case, IntMic seems to refer to the external microphone).

Wuala file system integration

Wuala is an online storage application that has full file system integration, meaning that you can mount your cloud storage into your Linux file system. After the upgrade to Fedora 12 mounting the Wuala NFS server did not work anymore. However, Wuala recently added a FUSE-based filesystem as an alternative to NFS (which makes more sense because the Wuala client typically runs locally rather than on a different machine, so the NFS mount comes from localhost and doesn't use the network). FUSE can be enabled by running Wuala with the -useFuse commandline option, and this worked.