Wednesday, February 20, 2008

Great Introduction to Accessibility

Having recently joined an accessibility team (focusing on Mono the Linux desktop), I have been scouring the internets learning more about accessibility in general. My main focus has been: 1) what accessibility resources are currently available for developers 2) what are the accessibility needs of persons who are disabled and what resources are currently available to them.

I just finished reading a very enlightening article written by Steven Lee entitled "Python Powered Accessibility." The article was published recently in Python Magazine; however, the article isn't really about Python at all (although it does contain a brief tutorial on the python application Accerciser). Steve does a great job explaining, at a high level, what resources are available to developers. He also explains different types of disabilities, and what individuals with those disabilities might need from their accessibility applications. Additionally, he provides several examples of accessibility tools for the Linux desktop. He also talks about how to get involved in accessibility, and suggests that it is a good introduction to contributing to Open Source projects.

Apropos, I will make a shameless plug for the accessibility team I am a part of, and encourage people to get involved.

One of the neatest applications (in my opinion) mentioned in the article is Dasher. There's a neat Google Tech Talk on Dasher that can be found on YouTube (http://youtube.com/watch?v=wpOxbesRNBc). It's long, but worth the time.

Saturday, February 16, 2008

Hackergotchi


I spent the a couple of minutes on the last day hack week creating a hackergotchi. Now I can replace my Novell mugshot. No, I don't usually have such a glorious chin beard (or one at all), I just thought it might spice up my floating head a little bit. In fact, the beard was kind of an experiment over the holiday season to see how long my wife would live with it. I made it to January 15th.

Friday, February 15, 2008

Tasky! (Hack Week 2 Project)

This week, Calvin, Boyd, Sandy, Myself and some others have been working on a new project called Tasky. Tasky is a task management system, written in Mono, for the Gnome desktop. Tasky is a small and easy-to-use application that docks in your taskbar (much like Tomboy notes) and synchronizes with Remember the Milk (an online task management page). It has been a ton of fun to work on, and it was amazing to see the results of a week of nonstop hacking of just a few guys. Everyone on the team has been great to work with, and it was a great opportunity to get to know the guys on the Linux Desktop team. Boyd rolled a release last night and it's in the GNOME:Community BuildService (found under "Community Repositories in YaST), so you should be able to grab it and take it for a spin! Also, check out the screenshots.

Wednesday, February 6, 2008

SLES10-sp1 hangs during installation in VMware?

I recently installed three SLES10-sp1 64-bit virtual machines in VMware. The install went just fine until the very last step (the configuring devices screen I think it's called). Upon reaching this screen my screen would go completely black and stay that way--I even left it black for an entire weekend.

The solution is to simple go through the entire install as you normally would. When the screen goes black, swith to an alternate console (press CTRL+ALT+F2 for example). If this doesn't switch consoles, reboot the machine, wait for the install wizard to come back up and then switch to a different console.

Once you have a new console just remove the /var/lib/YaST2/runme_at_boot file, which is the file that loads the installation wizard when you reboot, then reboot again.

The installation step you miss is where you would set your monitor, 3D acceleration, and screen resolution. So, once you have rebooted simply run 'sax2' as root to configure the stuff you missed.

Fixing the root user's ls command to not show hidden files

Hidden files in Linux are preceded by a dot. For example, a user's home directory is usually full of hidden directories like .ssh, .mozilla, .gnome, and many more.

One really annoying thing that is unique to SUSE (as far as I know), is the fact that the ls command, when run as root, shows hidden files by default. This "feature," exists because of the alias ls='ls $LS_OPTIONS'. In /etc/bash.bashrc you will see the following snippet of code:


if test "$UID" = 0 ; then
LS_OPTIONS="-A -N $LS_OPTIONS -T 0"
else
LS_OPTIONS="-N $LS_OPTIONS -T 0"
fi

The $UID variable has been set to equal the user ID (UID). For root the UID is 0. According to the above code, if "ls" is typed as root, the command that actually gets executed is "ls -A -N $LS_OPTIONS -T 0."

Simply removing the "-A" from the code snippet above (found in /etc/bash.bashrc) will make it so hidden files are not displayed when the root user runs the ls command.

NetBeans IDE with jVi plugin

My last post dealt with using the vim taglist plugin. This plugin provides an overview of the structure of source code files and allows you to efficiently browse through source code files in different programming languages. One could say that the taglist plugin makes vim "feel more like an ide."

Today, I would like to discuss a method to use a vim-like editor inside of an IDE--that is, to make an IDE feel more like vim. There are several IDEs available. When I began searching for an acceptable IDE I had two criteria. First, the IDE must be free. Second, the IDE must have vim emulation.

The NetBeans IDE was the only IDE that I found that met my criteria. I thought it was pretty smooth for the most part. I have not tested it much, but the vim emulation was good. I did run into some issues when working with a maven2 project.

NetBeans can be downloaded from http://www.netbeans.org. The jVi plugin can be downloaded from
http://jvi.sourceforge.net and consists of a zip file that contains two .nbm (NetBeans Module) files. The jVi plugin is a port of a large portion vim, not just a set of keybindings. If the plugin doesn't work like vim then it's a bug. After downloading and installing the NetBeans IDE and downloading and unzipping the jVi plugin, the plugin can be installed in the following manner:

  1. Open NetBeans and browse to Tools -> Plugins
  2. Click the "Downloaded" tab
  3. Click the "Add Plugins..." button
  4. Browse to jVi directory that contains the .nbm files
  5. Select both .nbm files and click "Open"
  6. Make sure "jVi KeyBindings" and "jVi Core" are both selected for installation and click "Install"
  7. Proceed through the plugin installation wizard."

    The jVi plugin will be activated automatically. You can disable it by un-checking jVi in the "Tools" menu. Here is a screenshot of NetBeans with the jVi plugin installed:

    NetBeans IDE with JvI plugin

    P.S.

    I ran into a problem trying to run NetBeans on openSUSE 10.3:

    bean@cobweb:~/netbeans-6.0beta1/bin> ./netbeans
    java: xcb_xlib.c:52: xcb_xlib_unlock: Assertion `c->xlib.lock' failed.
    (truncated)

    To fix this problem, I had to set the following environment variable:

    export LIBXCB_ALLOW_SLOPPY_LOCK=1

    This is due to bug 252510

vim with the taglist plugin and exuberant ctags

First of all, let me introduce Ctags and the Taglist plugin:

Ctags generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object).

The "Tag List" plugin is a source code browser plugin for Vim. This plugin
allows you to efficiently browse through source code files for different
programming languages

Ctags must be installed in order for you to use the taglist plugin. Once you have installed ctags and the taglist plugin, some fantastic features in vim are
available to you. In short, the taglist plugin allows you to open a "side bar" inside of vim; this side bar is similar to the side bar in popular IDEs (e.g., eclipse, MS visual studio) and enables you to browse files and source code. For example, when a file is selected in the side bar, that file will be opened in the main window. Similarly, when a function or method is selected in the side bar, the main window will jump to that function or method. Ctags also enables you to jump from a symbol/function call/variable to its definition.

Here are the steps to get started :

1. Install vim and/or gvim if you don't have them installed already.

2. Install exuberant ctags, I was unable to install ctags version 5.7 on openSUSE 10.2, but ctags-5.6 installed fine. Exuberant ctags can be found at http://ctags.sourceforge.net.

3. Download the taglist plugin zip file for vim. Unzip the file and move the plugin/taglist.vim file to the vim plugin directory (e.g., /usr/share/vim/vim70/plugin). Move the doc/taglist.txt to the vim doc directory (e.g., /usr/share/vim/vim70/plugin).

4. Change to the vim doc directory directory, start Vim and run the ":helptags ." command to process the taglist help file. Without this step, you cannot jump to the taglist help topics.

5. Go to a directory in which you have code stored and create a tag file. This is accomplished by runnings 'ctags [-R] (the -R is an option to recurse into subdirectories). For example, assume I have a collection of python files in some directory and some subdirectories that make up a single project. I would use the following command to create my tag file: ctags -R *.py. If you're using a programming language like C/C++ that uses mutliple file extensions, read about the -h option in the ctags manual.

6. Open vim and type :TlistToggle to open the taglist window. A great shortcut for this is to map a funciton key adding 'nnoremap :TlistToggle to your .vimrc file. This would allow you to simply press F8 in vim to toggle the taglist window opened and closed.

7. Add files to the taglist window. This is done using the :TlistAddFiles or :TlistAddFilesRecursive commands in vim. In my example pyhon project, I would type ':TlistAddFilesRecursive ~/programs/myproject *.py' to populate my taglist window with all of the python files in my project. After your taglist window is populated it should look something like this:

vim taglist screenshot

By default the taglist window opens on the left side. In vim, the taglist window is just a vertical split. You can read more about managing split windows in the vim documentation, but one basic command is to use ctrl+ww to switch between splits. In the taglist window you can then use the enter key to open files in the main window; if you press the enter key while the cursor is on any definition (variable, function etc.) in the taglist window, the appropriate file will be opened in the main window and the cursor will jump to the definition in the file. The + and - keys expand and contract items in the taglist window respectively. For example, in the screenshot above the "function" items are all expanded. However, the "class" and "members" items directly below "image_this.py" are contracted. Other neat features include using the = key to expand all items and the * key to contract all items. In fact, "expanding" and "contracting" text is a standard vim feature known as folding, you can learn more about it in the vim documentation.

8. Obviously, configuring your taglist window every time you open vim would be quite painful. Once you have your taglist window configured for your project, use the ':TlistSessionSave command to save a session, and use the ':TlistSessionLoad command to load a session. Session files are saved in the current working directory.

9. If you haven't done it already, try some of the following tasks in gvim (graphical vim):

- use your mouse to expand the taglist window by clicking and dragging the vertical split line

- switch to the taglist window with a simple left click in the taglist window.

- try double clicking files, functions, classes, etc. in the taglist window to open them in the main window.

- try expanding and contracting items (folds) with left clicks

10. As a bonus, notice a nice little feature that ctags gives us. You can now use ctrl-] or g] when your cursor is on any symbol (variable, function call, etc.) to go to its definition. ctrl-] will do its best to take you where it thinks the definition is, while g] will give you a list of possible declarations. After having used ctrl+] or g] a few times in succession, use ctrl-t to start going back up the tag stack.

11. Use vim or gvim for your next coding project.

Personally, I also added 'let Tlist_Exit_OnlyWindow = 1' to my .vimrc file. This is useful because (as stated above) the taglist window is opened as a vertical split. This means when you close the main window the taglist window will stay open unless you add this option to your .vimrc file. In short, this option closes vim when the taglist window is the only window open.

Please add comments if you have any advice associated with ctags and/or the taglist plugin!

Convert Manual Page to PDF

Interested in converting a man page to a PDF? You can do the following:

$ man -t /complete/path/to/foo_manpage | ps2pdf14 - foo_manpage.pdf

If you want a copy optimized for web viewing:

$ pdfopt foo_manpage.pdf foo_manpage_optimized.pdf

Choosing and Customizing a Window Manager

One of the fantastic things about the X Window System is the empowerment of its users. As users, we are able to choose from a slew of window managers. Gnome and KDE have percolated to the top as the most popular window managers. Personally, I believe that this is likely due to the fact that they are very similar to Microsoft Windows (95 through Vista) and therefore resemble what most people are used to. If you prefer Gnome or KDE that is more than fine with me, but there are alternatives! The most important thing is that your window manager increases your productivity and/or enjoyment. Gnome and KDE are quite similar, however there are some great window managers that often get overlooked, I suggest you try several and decide which one(s) you like!

Here are some window managers to try:

* Xfce is actually a desktop environment that uses Xfvm as a window manager

After installing one of these window managers simply add its executable to a file named .xinitrc in your home directory. If it does not exist, simply create it. For example if I downloaded and installed fluxbox and I wanted it to run instead of Gnome or KDE I would create an .xinitrc file with a single line that read "fluxbox".

With the new trend toward 3d desktops, more and more window managers are supporting 3d operations. If you have a good video card and system resources to spare (waste? ;)), you might want to look into Xgl, Beryl, Compiz, and others.

Personally, my favorite window manager is Fluxbox. It is extremely fast, small, and minimalistic in nature, but it has some wonderful features. Some example features I really love are:

  • Instead of having a "Start" menu, right clicking anywhere on the desktop produces the menu.
  • Alt+LeftClick moves a window, Alt+RightClick resizes a window
  • Scroll mouse anywhere on the desktop swaps workspaces
  • 100% customizable menu
  • Double clicking on menu bar "collapses" the window like a window shade, only leaving the title bar. Clicking on the title bar a second time expands the window.
  • Tabbing, which allows multiple windows to share the same window (hard to explain in one line, but it's really neat!)

----- END OF REQUIRED READING ;) -----

Remember how I was talking about empowerment? Here is one example. Fluxbox is my favorite window manager, yes, but X allows me to spice things up a bit. Before explaining this further, let's review some X concepts (information taken from the Fluxbox FAQ):

You have to understand that a windowmanager is just one more application for X, like netscape or gimp or xterm. Many people new to X come to believe that X runs the window manager and the window manager runs programs. But thats not true. If configured right, you can run all your applications under X, kill the window manager, and start another window manager up. The *real* program that X runs, that runs other programs, is your .xinitrc or .xsession script. When X is started, your .xinitrc or .xsession script is run, and when the script is done, X comes down. Let me repeat that, its important: WHEN .xinitrc IS FINISHED, *THAT* IS WHEN X ENDS. It isn't when your windowmanager exits.

In the age of "Gnome or KDE?" the .xinitrc file has been somewhat forgotten. Here is another pearl of knowledge from the Slackware documentation:

xinit(1) is the program that actually starts X; it is called by startx(1), so you may not have noticed it (and probably don't really need to). Its configuration file, however, determines which programs (including and especially the window manager) are run when X starts up. xinit first checks your home directory for a .xinitrc file. If the file is found, it gets run; otherwise, /var/X11R6/lib/xinit/xinitrc (the systemwide default) is used

With this information we can do some truly wonderful things. For example, I use Fluxbox, but I like having the Gnome "taskbar" (Gnome calls it a panel) so I can use the nifty applets like weather reports, tomboy notes, battery power, volume control, online updates, time and date, and a nice calendar. These Gnome features are simply X applications and X allows me to run these "pieces" of Gnome while using Fluxbox as my window manager. All I had to do was run locate the programs running with Gnome that I wanted to run in Fluxbox. This was accomplished easily by running 'ps ax' while in Gnome. When I had the program names I wanted to run, I simply added them to my ~/.xinitrc file like so:

bean@cobweb:~> cat .xinitrc
fluxbox & wmpid=$! # start fluxbox and store the process id in a variable wmpid
gnome-panel & # run the gnome panel
sleep 10 # give the gnome panel some time to load completely, so applets will dock properly
gnome-power-manager & # run the gnome power manager (great for laptops)
#nm-applet & # run the Network Manager applet (if you're using Network Manager)
opensuse-updater-gnome-applet & # run the online update applet
gnome-volume-manager --sm-disable & # run the volume manager
xset b off # turn off that vile beep
wait $wmpid # wait for fluxbox to return

Notice that I am backgrounding these processes (i.e., I am appending '&'). If this is not done, the .xinitrc script will not continue until the process ends.

Here is a screenshot of my Fluxbox wm with a Gnome panel.

Linux + Wireless

I just installed the newly released openSUSE 10.3 on a Dell Latitude D800 laptop. One of the major complaints about Linux is lack of support for wireless networking. openSUSE does a pretty good job of making things relatively painless, but your wireless card may not work out of the box. From my experience the Intel PRO/Wireless cards work really well.

When I checked my hardware information in SUSE and saw 'Dell Truemobile 1450 MiniPCI' as my wireless card I wasn't excited. YaST did list my wireless card under Network Devices -> Network Card and this gave me a ray of hope. However, running 'ifconfig' only showed my eth0 wired network card. 'iwconfig' did show my wireless card as eth1, however 'iwlist eth1 scan' reported that the device did not exist.

The Dell Truemobile 1450 MiniPCI uses the Broadcom bcm43xx chipset . This information can be found by running 'hwinfo --wlan'.

cobweb:/home/bean # hwinfo --wlan
18: PCI 203.0: 0282 WLAN controller
Model: "Dell Truemobile 1450 MiniPCI"
Vendor: pci 0x14e4 "Broadcom"
Device: pci 0x4324 "BCM4309 802.11a/b/g"
SubVendor: pci 0x1028 "Dell"
SubDevice: pci 0x0003 "Truemobile 1450 MiniPCI"

There is a 'bcm43xx' kernel model, which was loaded (you can check loaded kernel modules using the 'lsmod' command), but it apparently wasn't working correctly.

Apparently Broadcom never released details about these chips. So the driver included in the Linux kernel is based upon reverse engineered specifications. This might explain why it wasn't working for me.

I did find a couple of possible solutions in the NDISwrapper and bcm43xx-fwcutter. ndiswrapper is the solution that I used; it was only slightly painful and seems to be working great now. Madwifi is a solution for wireless cards with Atheros (not Broadcom) chipsets.

NDISwrapper

ndiswrapper implements Windows kernel API and NDIS (Network Driver Interface Specification) API within Linux kernel. A Windows driver for wireless network card is then linked to this implementation so that the driver runs natively, as though it is in Windows, without binary emulation. In short, ndiswrapper allows you to use Windows drivers for WLAN cards in Linux.

With ndiswrapper, most miniPCI (builtin), PCI, PCMCIA (Cardbus only) or USB wireless network cards work in Linux with x86 or x86-64. Although ndiswrapper is intended for wireless network cards, other devices are known to work: e.g., ethernet cards, USB to serial port device, home phone network device etc.

ndiswrapper packages come with openSUSE, but they are not installed. Simply install the ndiswrapper package and the ndiswrapper-kmd- package (you can get your kernel flavor by running 'uname -r' as root).

Once I had the ndiswrapper installed I followed these steps

  1. Grab the windows drivers for the Dell TrueMobile 1450 miniPCI card from Dell's support page.
  2. new directory, move the downloaded .exe inside, and unzip the .exe: mkdir ~/tmp; mv R90501.EXE ~/tmp; cd ~/tmp; unzip R90501.EXE
  3. Tell ndiswrapper where the inf is: 'ndiswrapper -i ~/tmp/bcmwl5a.inf'. This will create a directory in /etc/ndiswrapper named bcmw15a. ndiswrapper will automatically try to load all drivers in this directory when the ndiswrapper kernel module is started. Also note that ndiswrapper looks for other files (such as .sys files) in addition to the .inf files, so it's a good idea to just put all the windows drivers files in the same directory.
  4. Disable the bcm43xx kernel module and related kernel modules. First, see what's loaded: 'lsmod | grep bcm'. Then, disable what's loaded: 'rmmod >module name>'. The modules to unload will probably be bcm43xx, ieee80211softmac, ieee80211, and firmware_class.
  5. Load the ndiswrapper kernel module: 'modprobe ndiswrapper'

If you have installed the correct driver you should see something like this:

bcmwl5: driver installed
device (14E4:4320) present

and you should now be able to use your wireless card.

‘present’ means that you have a card that can be used with the driver installed. In this case, broadcom driver bcmwl5 is used. If you see ‘cannot locate lspci. Unable to see if hardware is present’, you need to install the pciutils package.

If you get something like

bcmwl5: driver installed
device (14E4:4320) present (alternate driver: bcm43xx)

then you / kernel may use bcm43xx module for that device. If that module is loaded, then ndiswrapper wouldn’t be able to use that device; see Troubleshooting. . This usually occurs if the kernel is trying to use an alternative driver (this is why we rmmod the other kernel modules).

You should now be able to use your wireless lan card normally.

To make this change permanent you will want to do a couple of other things:

First, you will want to blacklist the kernel modules you don't want to load anymore. This can be done by adding lines similar to those below to your /etc/modules.d/blacklist file:

# wireless card
blacklist bcm43xx
blacklist ieee80211softmac
blacklist ieee80211
blacklist firmware_class

You might not want to copy and paste this verbatim. The blacklisted modules should be the modules you unload in the steps above (using rmmod).

Second, you will want to make sure the ndiswrapper module is loaded when you boot. To do this, add "ndiswrapper" to the MODULES_LOADED_ON_BOOT variable in /etc/sysconfig/kernel or add "modprobe ndiswrapper" to to /etc/init.d/boot.local or a script that runs at boot time.

Here is a list of cards known to work with ndiswrapper.

bcm43xx-fwcutter

As the name suggests this solution is only for Broadcom 43xx chips.

http://forums.gentoo.org/viewtopic-t-409194-postdays-0-postorder-asc-start-0.html

These are Gentoo specific instructions, but they should be easy to translate to SUSE. You won't need to work about the kernel compilation as the BCM43XX support is enabled by default in openSUSE, and Instead of emerging bcm43xx-fwcutter you can get it at http://developer.berlios.de/project/showfiles.php?group_id=4547.

Madwifi

The Madwifi team develops Linux kernel drivers for Wireless LAN devices with Atheros chipsets.

Here is a list of cards known to work with ndiswrapper.

Madwifi has good doucumentation that can be found here http://madwifi.org/wiki/UserDocs/FirstTimeHowTo. openSUSE comes with the Madwifi package available, so you don't need to compile it; just install the rpm.

New Team at Novell

Yesterday was my last day on the ZENworks team at Novell. I moved down a couple of floors to the Linux Desktop team. I will be working on building and testing better accessibility support for the Linux Desktop. I'm excited about getting more involved with the Linux community and learning more about accessibility issues.

I do have a private company blog with some (interesting?) information, I plan to bring over some posts to give this page a running start.