Press "Enter" to skip to content

Tag: reminder

"End" key not working

Part of my issue with getting CompizFusion to work was the lack of working keyboard shortcuts. For example, Expo (the OS X Expose-like feature) would work when my mouse was placed in the correct corner but not when using <super>-e (the "super" key is what the "Win" key is called on Linux). One recommendation I saw online was to create a file in one's home directory called .xmodmaprc which contains

keycode 115 = Super_L
add Mod4 = Super_L

Not only did this not fix my problem, but I later discovered that my end key no longer worked. Unloading this file from xmodmap (removing the file and logging back in) returned my end key to working status. Two things I didn't think to try at the time:

  • Would End+e trigger expo?
  • I have Third Level enabled, and super is the key to change levels... would this have an effect?

Those are questions for another time, but getting the end key working again was enough for now.

(This is my current, working xmodmap configuration:


[Doug@FLASHMAN-SL ~]$ xmodmap
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

Not sure what all it does, but it seems to get the job done.)

Leave a Comment

Font locations in OS X

I've been moving away from Apple products lately, but something I've missed on Windows and Linux computers are the lack of fonts. I had installed some fonts in OS X, and I wanted to get to them so I could move them elsewhere. On my Mac OS X 10.6 system fonts were stored in:

  • /System/Library/Fonts/
  • /Library/Fonts/
  • ~/Library/Fonts/

This Apple support page lists a few more locations fonts can be stored in (the other locations are for older systems and servers it seems).

Some of the fonts I've installed were in a format other than TTF (TrueType Font) and to be used on a non-Apple system would need to be converted. To convert fonts to .ttf, there seem to be two programs:

I didn't use Fondu, but it was talked about favorably for this purpose here. DfontSplitter was extremely easy to use and converted the fonts quickly and supported conversion from Dfont, TrueType Collection, and Font Suitcase. This was something I had been meaning to take care of for a little while and wasn't nearly as much work as I anticipated.

Leave a Comment

Quite a few minor issues today

I've been doing a lot of writing in Microsoft Word lately (there are others working on the same document and LibreOffice Writer can't seem to get it right), so I've been living in Windows-world. Yesterday I needed to access an R package that is UNIX-only apparently (heR.Misc - really? No Windows binaries?) and was greeted by Scientific Linux with some updates to take care of. Most of the updates installed fine, but five did not. The five that did not were all related to Qpid (packages like qpid-cpp-client). These could not be installed because yum could not resolve some dependency issues. Apparently the issue was that these updates were related in some way to the matahari package, which was deprecated by Red Hat (according to this forum post at least). A quick sudo yum remove matahari in the terminal and the updates installed correctly.

I figured while I was updating software that I would try to get an Aero Snap-like feature working in Linux.  As much as I like the stability of Linux, I dislike the lack of some should-be-standard features in GNOME. In Windows 7, there are some great features like Aero Snap (automatically half-maximize windows) and windows grouped on the taskbar. CompizFusion can... somewhat perform these features, but not with the polish and consistency that I've come to expect.

I just care about my computer supporting my productivity, and I am therefore not attached to any particular window environment. KDE 4 seems to have implemented some of these features without the use of add-ons, so I figured that I would give it a try. However, installing KDE using YUM wasn't immediately obvious. Searching for "kde" resulted in tons of packages, but none seemed to be a wrapper for the entire environment. Eventually I went to the command line and executed (as root):

yum groupinstall "KDE desktop"

However, I should have realized that Scientific Linux doesn't have the latest, greatest packages. The KDE that was installed was version 4.3 and... didn't do what I wanted it to. I promptly switched back to GNOME and started playing around with CompizFusion.

Long story short, I got frustrated and gave up for the time being. I am determined to get this to work, but I don't have the time to devote to it right this second. I think this is where things went wrong: I wanted to uninstall KDE and did

yum groupremove "KDE desktop"

which uninstalled all KDE-related packages and not just the ones that had been installed above (I had previously installed some packages like kdegraphics which contains Okular (a great PDF reader)). While I would like to figure out how to remove an entire group  except for certain packages, that's something to solve later. No big deal, I didn't use them much and could always add them back later. I rebooted my computer to complete some updates and...

No internet when it came back. The GNOME panel icon was just... gone. Now, my first instinct was to search the internet for related issues. I was able to get online by plugging in an ethernet cable and running, as root,

ifconfig eth0 up
dhclient eth0

This gave me wired internet, though Yum Extender didn't want to believe it had internet. I ended up having to run from the terminal

yumex --root

to be able to install packages.

Most of the resources I found related to Ubuntu which can be rather different from Scientific Linux/CentOS/RHEL. I tried to see if the network manager was still installed by running


[Doug@FLASHMAN-SL ~]$ service network-manager status
network-manager: unrecognized service

Seems like a problem... except the network manager is not called network-manager in Scientific Linux. It is actually called NetworkManager.


[Doug@FLASHMAN-SL ~]$ service NetworkManager status
NetworkManager (pid  2077) is running...

I spent way too long reinstalling NetworkManager when that was never my issue. What it turned out to be was the program nm-applet was missing (uninstalled at some point), and I just needed to (re)install the package NetworkManager-gnome.

That was a headache that was mostly my fault, but the lack of solid documentation (and vague search terms like "gnome internet icon missing") made this difficult to figure out. Maybe putting all of these search terms in one place will help other people.

As an aside, my school (UF) now offers Red Hat Enterprise Linux to students... and I am toying with the idea of switching from Scientific Linux to RHEL. However, UF is running RHEL 6.1 and I'm running SL 6.2, and I would prefer to not do a clean install. Unsurprisingly, Red Hat does not support cross-grading (I asked), and I don't want to fiddle with a simultaneous cross/downgrade. Though I must say, the support would be nice for situations like this...

Leave a Comment

Microsoft Word trick

It amazes me how many people are amazed when I show them this little trick. Holding the "Alt" key while clicking and dragging allows one to select a rectangular region in word. When using a monospace font (fixed-width fonts like Consolas or Courier New), this can be used to quickly delete columns of text. Best results are achieved using monospace fonts, but this tool has helped me many times in other situations. An example of a rectangular region selected with this technique is below.

Sometimes I will launch Word just to use this tool and go back to editing files in another program. I learned this back in high school in what I thought would be a gimmicky course on Microsoft Office. In that course I learned some pretty useful skills that, while not making me an expert, have served me well. It amazes me how many people have taken courses centered around Microsoft Office and still seem perplexed by it.

1 Comment

Identifying the discriminant from LDA

With Linear Discriminant Analysis (LDA), in general the identification of the classification criterion is not trivial. The classification regions can be disjoint, there can be several regions into which observations are classified, the discrimination can be based upon a multivariate normal distribution, etc. However, when classifying with two univariate normal populations, the identification of the discriminant function is easy. When the inequality (\alpha_1+\beta_1 x \gt \alpha_2 + \beta_2 x) is true, we classify the observation, (x), as belonging to population 1. The discrimination criterion is to classify an observation, (x), as belonging to population 1 if

 x \gt \frac{\alpha_2-\alpha_1}{\beta_1-\beta_2}.

While this is simple, I kept misplacing the piece of paper that I kept it written on and kept re-implementing it in R. This post is mostly a reminder to myself. Here is some R code to do the above:

d <- function(alpha.2,alpha.1,beta.2,beta.1){
 return((alpha.2-alpha.1)/(beta.1-beta.2));
 }

The reason this is necessary is because SAS doesn't report the discrimination function even when it is possible to report succinctly. SAS does report the (alpha_i) and (beta_i) values, though.

As an example, this is the output from SAS after running PROC DISCRIM on some data with a binary response variable and the POOL=TEST option.

We can use the above to find that the discriminant is (d=frac{-3.96320-(-7.86740)}{1.12389-0.79768}=11.96836). We can use PROC SGPLOT to display this discriminant function:

data work.blog_flat_cross;
 set work.blog_flat_cross;
 ID=_N_;
 Classified = 'A: ' || response || ', P: ' || _INTO_;
run;

/* Displaying the scatterplot without the discriminant line */
PROC SGSCATTER DATA=work.blog_flat_cross;
 PLOT xvar*ID / MARKERATTRS=(SYMBOL=CIRCLEFILLED) GROUP=CLASSIFIED;
RUN;

/* Displaying the scatterplot with the discriminant line */
PROC SGPLOT DATA=work.blog_flat_cross;
 SCATTER X=ID Y=xvar / MARKERATTRS=(SYMBOL=CIRCLEFILLED) GROUP=CLASSIFIED;
 REFLINE 11.96836394 /axis=y lineattrs=(color=black pattern=1); /* value found by hand using output */
RUN;

A plot of the results from PROC DISCRIM with the discriminant line added.

Note that adding a REFLINE requires PROC SGPLOT instead of PROC SGSCATTER. Also, this post was edited because the response "YES" was originally just "YE". The text response was shorter than it should because SAS makes the maximum length of a variable whatever the length of the first value it encounters is. Any values longer than the first value are truncated (see the SAS documentation). To fix this, when declaring the variable in a data step one should manually set the length: length response $ 3; where 3 is the maximum length we want.

A good resource for LDA is:

Johnson, R. A. and D. W. Wichern. 2007. Applied Multivariate Statistical Analysis (6th ed.). Upper Saddle River, NJ, USA: Pearson Prentice Hall.

Leave a Comment