Wednesday, December 17, 2008

Helpful commands for R


  1. library(foreign) - Allows you to load Stata and Excel files, among others.

  2. foo <- read.dta("location") - Loads a Stata *.dta file.

  3. names(foo) - Lists the names of the variables in dataset foo.

  4. fit <- lm(y~x,data="foo") - Linear regression of Y on X using data in foo.

  5. fit <- glm(y~x,family=binomial(link="probit"),data="foo") - Probit regression of Y on X using data in foo.

  6. summary(fit) - The stuff you want in model fit.

Friday, December 12, 2008

Importance of reading manual pages (wireless)

I had some difficulty configuring wireless at Georgia Tech for OpenBSD, but it was only because of my failure to read the manual pages carefully.


Under the nwkey entry of ifconfig(8), "The key can either be a string, a series of hexadecimal digits (preceded by '0x')..." (emphasis mine). Obviously, if there is no '0x', then ifconfig assumes your WEP key is a string. In our school's case, the WEP key is hexadecimal.

Wednesday, December 10, 2008

VIm and Arrow Keys

For some reason, using arrow keys in VIm is equivalent to typing ABCD. A temporary fix is to type :set term=cons25.

Daemons in OpenBSD

OpenBSD does not by default use a /etc/rc.d system to start and restart daemons. Instead, daemons are started as follows:


/usr/sbin/[name] &


or /usr/local/sbin/[name] &


Daemons are restarted by kill -HUP `cat /var/run/[name].pid`.

PCManFM on OpenBSD

PCManFM is easily installed through the package collection. Once it finishes installing, it will display a few post-installation notes. (They will show up in your xterm.) You will have to edit a few rc files and restart some daemons. Be sure to remember which rc files; if you forget which daemons are to be restarted, simply reboot.


If you aren't using GNOME, then it is very likely that the first time you start PCManFM, you will have an error message that talks about icons. To solve this, do the following:



  1. Make a .gtkrc.mine file in your home directory. Write gtk-icon-theme-name="Name of icon folder in icon directory".

  2. Make a .gtkrc-2.0 file, also in your home directory. Write include "/usr/local/share/themes/[name of theme]/gtk-2.0/gtkrc", enter, and include "/home/[your handle]/.gtkrc.mine".


The icon directory is /usr/local/share/icons/. The default theme is Raleigh.

Wednesday, December 03, 2008

Switch sessions in SLiM

The ability to choose sessions in SLiM is at present an experimental feature. However, for my purposes, I have found no flaws in its execution.


First, edit the slim.conf file. In Archlinux, it is found at /etc/slim.conf. After "sessions," tab and type in the window managers and desktop environments you have installed. These are merely placeholders; they need not be the name of the binaries. Then, edit your .xinitrc. The sample is easy to follow and worked for me. You must modify the names of the sessions accordingly. Thus, in my case, I replaced xfce4, icewm, wmaker, and blackbox with openbox, kde, kde-openbox, and awesome. In addition, I set openbox as my default session. Now, you can press F1 at the login screen and choose your session!

Tuesday, December 02, 2008

Edit TrackPoint sensitivity in Archlinux

The ThinkWiki says that the configuration options can be acccessed by changing directory to /sys/devices/platform/i8042/serio0/serio2. However, on my Lenovo ThinkPad R61, the files were at /sys/devices/platform/i8042/serio1/serio2. My kernel version is 2.6.27.

Sunday, November 30, 2008

Add sessions to KDM (KDE 4.1.3)

To manually add sessions to KDM in Archlinux, do the following:


cd /usr/share/apps/kdm/sessions


You will see *.desktop files of many, many window managers and desktop environments. Obviously, unless you have all of these on your system, many of them are "just there." To add a session, simply copy any of the preexisting *.desktop files and modify it to suit your need.


In my case, I copied openbox.desktop to awesome.desktop and replaced "Exec=openbox" with "Exec=awesome."

Saturday, November 29, 2008

Mount flash drive in OpenBSD 4.4

As OpenBSD101 notes, "USB drives usually show up as (emulated) SCSI drives."


But, how do you know which drive? You have two choices. First, you can take a look at the console output. If you insert the drive at the XDM login stage, the console will react, and the output will be preserved following your login. Second, you can type dmesg | grep sd, and it will tell you which sdX device is associated with the flash drive. In my case, it was /dev/sd1. So, as root, I did the following:


mkdir /mnt/flashdrive


mount /dev/sd1i /mnt/flashdrive

Thursday, November 27, 2008

Mount OpenBSD slice in Linux

To mount an OpenBSD root slice in GNU/Linux, first create a folder.


sudo mkdir /mnt/openbsd


Then, run the following command:


sudo mount -r -t ufs -o ufstype=44bsd /dev/hdb5 /mnt/openbsd


The key is to locate the OpenBSD root slice in Linux. To do so, type dmesg | grep bsd in a terminal emulator. This will list the devices that are associated with BSD.


Works for my desktop. I dual boot Xubuntu 6.10 and OpenBSD 4.4.