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!