My dot Emacs file

2009/12/13

Recently I upgraded to Emacs 23.1, customised some options, saved them and went about my work. However, whenever I used emacs on the command line I was greeted to a greyish background that just did not look like it belonged. And the plain white background was getting a bit old fashioned. So I decided it was high time that I setup my .emacs file amongst others.

Note: There are a lot of code samples in this post, Facebook removes the style, WordPress does not, Hyves I dunno. So if you want syntax highlighting then goto the wordpress version.

Remove Gray Backgroun Colour in TTY

First thing to do is use the Options menu to set most of your options like: font (mijn is DejaVu Sans Mono at 9) use standard copy and paste commands etc. However this will also set a default background and foreground colour scheme, to fix this open ~/.emacs and remove from (custom-set-faces...: , “:background white :foreground black"

You should have something similar to:

Generated using GeSHi

;; Custom Variables
(custom-set-variables
(column-number-mode t)
(cua-mode t nil (cua-base))
(scroll-bar-mode (quote right))

(show-paren-mode t)
(size-indication-mode t)
(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(custom-set-faces

(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 88 :width normal :foundry “unknown” :family “DejaVu Sans Mono”)))))

Misc Stuff

This is some misc stuff. The following entry shall set the default tab width, stop the splash screen from occurring, write filename into the titlebar and enable markdown mode if you have installed emacs extras i.e. i.e. emacs-goodies-el in ubuntu.

Generated using GeSHi

(defvar HOME (expand-file-name “~”))
(setq EMACS “emacs”)
(setq HOSTNAME (substring (system-name) 0 (string-match \\.” (system-name))))

(setq FULLHOSTNAME (system-name))
(setq USERNAME (getenv “USER”))

;; Stop Splash screen

(setq inhibit-splash-screen t)

;; Tab width
(setq default-tab-width 4)
(setq-default tab-width 4)

;; Write filename into titlebar.
(setq frame-title-format `(,EMACS “[“USERNAME “@” HOSTNAME “]: “

(buffer-file-name “%f” (dired-directory dired-directory¬† “%b”))))

;; Add Markdown mode

(autoload ‘markdown-mode “markdown-mode.el” “Major mode for editing Markdown files” t)
(setq auto-mode-alist (cons(\\.mdt” . markdown-mode) auto-mode-alist))

A coloured Emacs

If you have installed the color-theme package for emacs (i.e. emacs-goodies-el in ubuntu) then you can get some nice themes going. I currently use color-theme-gnome2 for graphical emacs and color-theme-tty-dark when in TTY mode i.e. in a terminal. However gnome2 doesn’t look well when run in the terminal as does tty-dark and vice-versa. The code below ensures that each theme is used when required. A full list of themes can be found be the following command:

M-x color-theme-select

The lisp code is:

Generated using GeSHi

;; Add colour theme stuff
(require ‘color-theme)
;; hook: test win sys and rerun color-theme
(defun test-win-sys(frame)
(let ((color-theme-is-global nil))

(select-frame frame)
(if (window-system frame)(color-theme-gnome2)(color-theme-tty-dark))))

;; hook on after-make-frame-functions
(add-hook ‘after-make-frame-functions ‘test-win-sys)

;; default coloue schemes start
(let ((color-theme-is-global nil))

(if (window-system)(color-theme-gnome2)(color-theme-tty-dark)))

References

[1] http://emacs-fu.blogspot.com/2009/03/color-theming.html
[2] http://www.emacswiki.org/emacs/ColorTheme
[3] http://www.jimbrooks.org/web/tools/emacs/dot_emacs.txt
[4] The Internet


My Web Services Installation

2009/12/13

As part of a research project I have gotten to finally play with web services again. For which I have to use the following:

The instructions bellow are to install on Ubuntu 9.04, yes I still need to upgrade to Karmic but that is for another day.

Step 1: Install Java (Optional)

Cannot really remember how I installed OpenJDK, but if I remember its just:

$ sudo apt-get install openjdk-6-jre openjdk-6-jdk

Step 2: Tomcat 6

To install Tomcat 6:

$ sudo apt-get install tomcat6-admin tomcat6-common tomcat6-user tomcat6-examples tomcat6-docs

Add:

Generated using GeSHi

<role rolename=“manager”/>
<role rolename=“admin”/>
<user username=“admin” password=“helloworld” roles=“manager,admin”/>

To you your /etc/tomcat/tomcat-users.xml file and voila that is tomcat up and running and accessible from http://localhost:8080 . If not you may need to do:

$ sudo /etc/init.d/tomcat start

Step 3: Metro 2.0

Obtain Metro 2.0 from here and move the webservices-*.jar files into /usr/share/tomcat6/lib/ . You may also want to add both webservices-api.jar and jsr173_api.jar to /usr/lib/jvm/default-java/jre/lib/endorsed . This will ensure that the default jvm, utilises the latest api and thus is in the default classpath. If not ensure that you classpath at least includes the jars placed in /usr/share/tomcat6/lib/ earlier.

Note: Metro 2.0 does contain a Tomcat6 installer but, I haven’t used it as my steps were developed before it came out.

References Used

[1] http://blogs.sun.com/arungupta/entry/metro_on_tomcat_6_x
[2] http://weblogs.java.net/blog/ramapulavarthi/archive/2007/07/running_jaxws_s.html