Adobe Flash Player 11 beta out – no more npviewer.bin process sucking CPU resource?

Adobe Flash Flash Player 11 beta is out. I immediately installed it per these instructions after downloading the binaries here (via the ~/.mozilla/plugins method). I am so sick of the npviewer.bin process always sucking up my CPU resource. So far, I don’t notice this issue anymore. I really dislike the fact that Adobe doesn’t bother to fix bugs in their products for Linux users. Because of this, I hope all websites implement utilize HTML5 so I don’t have to depend on Adobe!

File associations in Linux (Gnome and Mailcap)

File associations in Linux can be tricky. On my Gnome-based Ubuntu machine, I can associate a filetype by right-clicking a file in Nautilus, and slecting “Open with”. To modify the defaults using config files, this post describes it well. Basically, the two main locations to check out are /usr/share/applications/defaults.list and ~/.local/share/applications/. File associations made using these methods apply to the commands gnome-open and xdg-open as well.

File associations in the command line is mainly done via MIME types (I think). At least file associations in conkeror, org-mode’s org-open-at-point (also look at org-file-app), and the see commands are done by MIME. MIME handlers are defined in a user’s ~/.mailcap file.

I think this information is enough to modify default apps throughout Linux. Do see this post where I outline how I launch all my files using Emacs’ dired mode. Now I can launch apps more uniformly in Nautlius, Emacs, and on the command line based on configuring default apps.

StumpWM

Since Canonical decided to ship Ubuntu with Unity as opposed to GNOME as the default desktop in their next release, I decided to take a look at StumpWM again.

Although I like keyboard driven apps like emacs, conkeror, and screen, GNOME with Tracker + deskbar-applet (similar to Mac OS X’s Spotlight) has been sufficient; I think any stable Linux desktop is sufficient for me since they’re all very configurable by default (keyboard shortcuts!). The need for a tiling window manager doesn’t apply to me since 1) I work on my laptop/netbook (10in-13in), so I usually have windows maximized; 2) I’m pretty fast with Alt-Tab; and 3) non-minimal window manangers have certain services all set up, such as sound/video control (with shortcuts), network manager, etc. Basically, having convenient applets, a quick way to move between windows, and a quick way to launch apps (think Mac OS X’s Spotlight) makes me happy.

Nonetheless, I toyed with StumpWM again but decided I’m not ready for it yet. Maybe I will be ready the next time when I’m using a bigger screen. I’ll outline my trial for documentation.

I followed this to set up StumpWM on Ubuntu. This screencast gives a good overview of the powers of StumpWM.

Compile

sudo apt-get install sbcl sbcl-doc ## common lisp compiler
sudo sbcl
## enter following in sbcl prompt
## select [SKIP-GPG-CHECK] when asked. Have to do this a few times
(require 'asdf)
(require 'asdf-install)
(asdf-install:install 'clx)
(asdf-install:install 'cl-ppcre)
(quit)
## more install
sudo apt-get install xorg-dev
git clone git://git.savannah.nongnu.org/stumpwm.git ## use latest version
cd stumpwm
autoconf
./configure
make
sudo make install
sudo make install stalonetray ## for docking applets from GNOME

Add StumpWM as an entry in GDM Sessions Menu

sudo emacs -q -nw /usr/share/xsessions/stumpwm.desktop
## add following
[Desktop Entry]
Encoding=UTF-8
Name=StumpWM
Comment=This session logs you into StumpWM (a minimalistic window manager)
Exec=/usr/local/bin/stumpwm
Icon=
Type=Application

Restart computer and choose StumpWM when logging in.

~/.stumpwmrc

;; -*- lisp -*-
(in-package :stumpwm)

;mode line
(stumpwm:set-fg-color "green")
(stumpwm:set-bg-color "black")

;startup apps
(stumpwm::run-shell-command "stalonetray")
(stumpwm::run-shell-command "nm-applet")
(stumpwm::run-shell-command "gnome-volume-control-applet")
(stumpwm::run-shell-command "gnome-power-manager")
(stumpwm::run-shell-command "system-config-printer-applet")
(stumpwm::run-shell-command "dropbox start -i")
(stumpwm::run-shell-command "gnome-power-manager")
;; (stumpwm::run-shell-command "")
;; (stumpwm::run-shell-command "")

;keybinding
(define-key *top-map* (kbd "M-Tab") "pull-hidden-next")
(define-key *top-map* (kbd "M-ISO_Left_Tab") "pull-hidden-previous") ;; shift
(define-key *top-map* (kbd "M-]") "pull-hidden-next")
(define-key *top-map* (kbd "M-[") "pull-hidden-previous")
(define-key *top-map* (kbd "s-Tab") "fnext")
(define-key *top-map* (kbd "s-]") "gnext")
(define-key *top-map* (kbd "s-[") "gprev")
(define-key *top-map* (kbd "s-b") "move-focus left")
(define-key *top-map* (kbd "s-n") "move-focus down")
(define-key *top-map* (kbd "s-p") "move-focus up")
(define-key *top-map* (kbd "s-f") "move-focus right")
(define-key *top-map* (kbd "M-F4") "kill")
(define-key *top-map* (kbd "s-s") "fullscreen")
(define-key *top-map* (kbd "M-F2") "exec")
(define-key *top-map* (kbd "s-SPC") "exec")


(define-key *root-map* (kbd "M-F") "fullscreen")

I want to try xmonad next when I have time. My verdict now is to stay with GNOME.

Emacs’ universal/prefix argument

I’ve used C-u as a prefix to many key presses in emacs and conkeror before. I never really knew what it did. Recently, I read this that show you how to repeat commands by typing M-#, where # is a number such as 5 or 100, before a command, such as C-n or 0. I’ve also read function definitions in different .el files or emacs’ documentation that speaks of function arguments. I knew that emacs commands correspond to functions, but I never knew how to pass in arguments.

Basically, C-u # and M-# (substitute # with a number) passes numeric arguments to the function called. C-u without # is equivalent to M-4. Read this for a more thorough explanation. This shows how one can “overload” a function using the prefix argument.

stumpwm on mac os x

stumpwm is to window managing (tiling?) system what emacs is to text editing and conkeror is to web browsing.

very cool. if i was on a linux laptop/desktop like i used to be, i would definitely use this. i’m even debating on quitting my mac os x for this (with emacs and conkeror). however, i most likely won’t since mac os x is pretty stable and most new stuff will be compatible with it (ease of use, plug and play).

i wanted to get stumpwm working on mac os x (intel based) like this post, but i never got it to work. somehow, i got it to work. my steps:

  1. update xquartz like the post said.
  2. install sbcl via macports.

UPDATE: actually, i think i used the sbcl for mac via this site.

  1. download the stumpwm source:

git clone git://git.savannah.nongnu.org/stumpwm.git

  1. followed the README file of stumpwm for sbcl:
  <pre class="src src-sh">$ sbcl

* (require ‘asdf) * (require ‘asdf-install) * (asdf-install:install ‘clx) * (asdf-install:install ‘cl-ppcre)

this step gave me MANY errors. i kept selecting the option to retry and continue like crazy. i finally gave up.

  1. continued with README
  <pre class="src src-sh">autoconf <span style="color: #ff4500;">##</span><span style="color: #ff4500;">get if not available. macports?</span>

./configure ##may need to specify sbcl if clisp is also installed make

stumpwm binary should be installed

  1. put following in ~/.xinitrc:

exec ~/Downloads/stumpwm/stumpwm ## path to stumpwm binary

launch programs in X (for example, xterm). look at stumpwm manual for keyboard shortcuts. very cool. this makes me REALLY want to go back to linux as my main computer.

make java work in conkeror (xulrunner) in mac os x

so i recently tried screenr and screenjelly to make screencasts. one problem, the java didn’t load in my conkeror. it says i need to to install it. however, when i tried them in firefox and safari, things were working. must mean conkeror isn’t finding it. emailed the conkeror list, got one feedback, googled for help. after some research, i found a solution that works:

downloaded java embedding plugin http://javaplugin.sourceforge.net/ placed the 2 ‘files’ in the binaries directory in the zipped files (JavaEmbeddingPlugin.bundle and MRJPlugin.plugin) in Library/Internet Plug-Ins and now java works in conkeror for mac os x.

conkeror is so cool.

global environment variables (like PATH) in mac os x via environment.plist and /etc/launchd.conf

so, through my journey of getting emacs 23 and conkeror to work on mac os x, i’ve discovered that PATH is not defined for native mac gui apps. details of the journey can be found in this post of mine’s.

now, to sum it up, to get PATH or other env variables working in mac gui apps, you need to create or modify your ~/.MacOSX/environment.plist file. i usually define my PATH in .bashrc, so i do something like

In terminal, type:

<pre class="src src-sh">defaults write ${<span style="color: #eedd82;">HOME</span>}/.MacOSX/environment PATH <span style="color: #ffa07a;">"${PATH}"</span>

then restart (log out) computer to take effect.

To update the path of environment.plist at every login, do (credit here):

<pre class="src src-sh"><span style="color: #00ffff;">if</span> [ -x /usr/libexec/path_helper ]; <span style="color: #00ffff;">then</span>

eval /usr/libexec/path_helper -s defaults write $HOME/.MacOSX/environment PATH “$PATH” fi

in /etc/profile

logout and log back in. however, apps launched using spotlight still do not see the env vars. they are seen only when launched using Finder. so, to fix that, put something like

 <pre class="src src-sh">setenv PATH /opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin:/Users/vinh/Documents/bin/:/opt/local/bin:/opt/local/sbin:/usr/texbin

in your /etc/launchd.conf file. a restart is required. this second method works for all apps start in mac.

these files should be edited each time u add to your PATH in .bashrc.

see my original post to follow all the credit.

emacs-style web browser: Conkeror

I remember back then when I used Kubuntu, I love Konqueror because I can hit Ctrl and all the links would be highlighted. I just need to type the letters corresponding to the link and Konqueror would take me to that link. I love it because I didnt have to use my mouse or touchpad. Recently, I discovered that Firefox had a similar feature, and it made me love firefox even more.

Even more recently, I was introduced to Conqueror, an emacs-like web browser. Everything is keyboard-based! It looks cool, but don’t know how compatible it will be with say a download manager. Everything else should be working since it is based on the same web engine that runs firefox! Installation instructions for Mac OS X can be found here.