Archive

Posts Tagged ‘Emacs’

2008 in review

January 9th, 2009

The year 2008 is well behind us and as many bloggers I guess a nice little review of the year is in place.

For me personally it was a year not to forget in a long time. After holding back 12 years I was convinced that a drivers license would be a “good thing” to have. I went through a 10 day program, driving each single day for hours at end, just to fail the examn on a small technicality. This was a not so nice experience, but I bought some more lessons and the 2nd time around I passed without any form of criticism! Since then I made a lot of trips with my girlfriends car and 2009 might even see a car of my own :).

In July my divorce was finalized! And to celebrate a great Iron Maiden concert!

At the end of the year I received an email from an old friend who pointed me to an interesting job opening at the company she works for. I went in for an exploratory meeting and after a couple of days of going by them and meeting different people I was convinced to switch jobs. This means that from February 2009 I will no longer be working for eBuddy, but for a local company called InfoMedics.

My girlfriend surprised me with a Playstation 3 during the December month and after a setup change and a lot of re-wiring I actually boxed up my Xbox 360 in favor of it. I completely love the PS3 system, it nicely fits into my home entertainment system, has great games, is not so noisy as the big white thing and has some great integration points.

The games for this year were Gears of War 2 (360), FarCry 2 (360), Little Big Planet (PS3) and Call of Duty: world at war (PS3).

As for books this year it has generally been light reading with a few computer related ones: iPhone SDK development, Programming Erlang, Mastering the Requirements Process, Requirements Analysis and Systems Design.

The most interesting light reading I found to be And the Hippos were boiled in their tanks by William S. Burroughs and Jack Kerouac and Mort a Terry Pratchett novel.

I didn’t do a lot of programming on the side, except for code swarm and color theme zenburn for GNU Emacs. Photography was also in a slum in 2008, hopefully to be revived in 2009.

As you might have noticed from the books this year was focused on learning new things; Erlang and iPhone development in particular, as well as extending my knowledge on the requirements process.

I hope to do some nice Erlang programming this year and perhaps learn some other new technologies as well.

All in all a great year with another one already started!

Life , , , , , , , ,

2008 in review

January 9th, 2009

The year 2008 is well behind us and as many bloggers I guess a nice little review of the year is in place.

For me personally it was a year not to forget in a long time. After holding back 12 years I was convinced that a drivers license would be a “good thing” to have. I went through a 10 day program, driving each single day for hours at end, just to fail the examn on a small technicality. This was a not so nice experience, but I bought some more lessons and the 2nd time around I passed without any form of criticism! Since then I made a lot of trips with my girlfriends car and 2009 might even see a car of my own :).

In July my divorce was finalized! And to celebrate a great Iron Maiden concert!

At the end of the year I received an email from an old friend who pointed me to an interesting job opening at the company she works for. I went in for an exploratory meeting and after a couple of days of going by them and meeting different people I was convinced to switch jobs. This means that from February 2009 I will no longer be working for eBuddy, but for a local company called InfoMedics.

My girlfriend surprised me with a Playstation 3 during the December month and after a setup change and a lot of re-wiring I actually boxed up my Xbox 360 in favor of it. I completely love the PS3 system, it nicely fits into my home entertainment system, has great games, is not so noisy as the big white thing and has some great integration points.

The games for this year were Gears of War 2 (360), FarCry 2 (360), Little Big Planet (PS3) and Call of Duty: world at war (PS3).

As for books this year it has generally been light reading with a few computer related ones: iPhone SDK development, Programming Erlang, Mastering the Requirements Process, Requirements Analysis and Systems Design.

The most interesting light reading I found to be And the Hippos were boiled in their tanks by William S. Burroughs and Jack Kerouac and Mort a Terry Pratchett novel.

I didn’t do a lot of programming on the side, except for code swarm and color theme zenburn for GNU Emacs. Photography was also in a slum in 2008, hopefully to be revived in 2009.

As you might have noticed from the books this year was focused on learning new things; Erlang and iPhone development in particular, as well as extending my knowledge on the requirements process.

I hope to do some nice Erlang programming this year and perhaps learn some other new technologies as well.

All in all a great year with another one already started!

Life , , , , , , , ,

Living at the server side

October 7th, 2008

It has been a long while since my last blog post. A lot of stuff has happened in my personal life, but I have a feeling that it has calmed down significantly enough for me to enjoy my life once again.

I have been reading some books lately, all programming related:

iPhone SDK Development: this is a Beta book from the pragmatic programmers group… it is not yet finished but what I read so far is quite interesting. The book tries to easy you into iPhone development, it kind of succeeds, however since it is a beta book it has a lot of small errors…. and that makes it hard to follow along, since you are regularly trying to find out why something is not working and thinking you did not pay enought attention :S…. luckily the errata section on the website helps a lot! In the end this will be a great book to start your own development, I am sure!

Programming Erlang: a very good book to get you into Erlang programming! I would recommend this book to anyone interested in learning Erlang. The book starts with a gentle introduction into the language itself and the change of mindset needed with functional programming after which it nicely covers everything from distribution of code over several nodes, storing data in the various database possibilities and creating distributed, fault tolerant and concurrent systems using the Open Telecom Platform (OTP).

Erlang in practice: not really a book, it is a set of screencasts exploring the process of writing an erlang chat server. Takes you through all the steps; setting up, distributing, persisting and adding REST support.

Although the iPhone/Objective-C book is quite interesting I find that I am more attracted to writing server side software. I guess it is because server side software is more of an boolean logic then interfaces (either it works, or it doesn’t).

Although the Erlang package comes with a great Emacs mode for editing erlang software it misses 2 things:

The mode uses Tempo snippet support, while I have found that YA Snippet provides far superior templating.

The other is that flymake is quite a necessity I think. Flymake provides on-the-fly syntax checking of your source code.

I have added the following configuration to my emacs setup to enable it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(add-to-list 'load-path "path-to-erlang-package-emacs-mode")
(require 'erlang-start)
 
(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
 
(require 'flymake)
 
(defun flymake-erlang-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
		     'flymake-create-temp-inplace))
	 (local-file (file-relative-name temp-file
		(file-name-directory buffer-file-name))))
    (list "path-to-eflymake" (list local-file))))
 
(add-to-list 'flymake-allowed-file-name-masks '("\\.erl\\'" flymake-erlang-init))

Lines 1 and 2 setup the erlang mode, 4 and 5 associate this mode with .erl and .hrl (erlang records) files, line 7 loads up flymake and lines 9 up to and including 14 tell flymake how to check erlang files for syntax. I use the eflymake script for this job. Line 16 tells flymake to use this for .erl files.

The eflymake script mentioned is an escript script:

1
2
3
4
5
6
7
8
#!/usr/local/bin/escript
-export([main/1]).
 
main([File_Name]) ->
    compile:file(File_Name, [warn_obsolete_guard, warn_unused_import,
                             warn_shadow_vars, warn_export_vars,
  			     strong_validation, report,
  			     {i, "../include"}]).

This greatly simplifies the writing of code using our favorite editor ;). During the screencasts of Erlang in Practice (mentioned above) you see the benefit of this extension. The author starts out with a clean Emacs installation it seems and over the various screencasts you see that he adds this extension. In the first couple of sessions you see him make some small mistakes and lateron you see that Emacs warns him and he fixes the code before he gets bitten by it.

While learning Erlang I found that I have a new-found love for server programming. I was kinda dumbed down by the many years of Java programming and was loosing interest in programming server-side really, now with an injection of a new language and “new” ideas I am totally excited to be in this field again… quite awesome what taking some time to learn something new can bring with it!

So, expect some Erlang posts the coming time. I am trying to think of a nice example to illustrate some of the niceties of Erlang and the OTP.

Code, Emacs , , ,

An update Java development environment

August 6th, 2008

As a pre-cursor to my promised larger articles, a post about Emacs and some of the development tweaks I did last week.

The last weeks there has been quite some chatter about development setups. Most notably Sacha Chua figured out that she could be more productive in Emacs then in Eclipse in her current project, read about it here, here and here.

Sometimes it just takes another person to bring back a thought about some feature or another that you go “damn, how could I have forgotten that one?”. Sacha’s posts and the emacswiki have fine-tuned my development process a little more.

Here are the changes I made, first the file-cache usage. I didn’t know about this one and I found it really usefull. It requires the usage of ido-mode though, so it might not be for everyone.

(defun file-cache-ido-find-file (file)
  "Using ido, interactively open file from file cache'.
First select a file, matched using ido-switch-buffer against the contents
in `file-cache-alist'. If the file exist in more than one
directory, select directory. Lastly the file is opened."
  (interactive (list (file-cache-ido-read "File: "
                                          (mapcar
                                           (lambda (x)
                                             (car x))
                                           file-cache-alist))))
  (let* ((record (assoc file file-cache-alist)))
    (find-file
     (expand-file-name
      file
      (if (= (length record) 2)
          (car (cdr record))
        (file-cache-ido-read
         (format "Find %s in dir: " file) (cdr record)))))))
 
(defun file-cache-ido-read (prompt choices)
  (let ((ido-make-buffer-list-hook
         (lambda ()
           (setq ido-temp-list choices))))
    (ido-read-buffer prompt)))
 
(require 'filecache)
(require 'ido)
 
(ido-mode t)
 
(global-set-key (kbd "ESC ESC f") 'file-cache-ido-find-file)

This sets up file-cache and adds a hook to ido for finding a file using file-cache. Pressing ESC ESC f will popup a prompt in the echo area for a name, just type the filename, without directory, and ido will list all files matching without looking if it is in the current directory or not.

I use this a lot with Java projects, using the JDEE mode. In order to adjust the file-cache to the current JDEE project, add the following to your .emacs file.

;; Prevent subversion files form polluting the cache
(add-to-list 'file-cache-filter-regexps "\\.svn-base$")
;; global variable to keep track of current project
(defvar credmp/current-jde-project nil)
 
;; small function to re-create the cache when the project changes
(defun credmp/update-cache ()
  (if (not (string= jde-current-project credmp/current-jde-project))
      (progn
        (file-cache-clear-cache)
        (file-cache-add-directory-using-find (substring jde-current-project 0 (- (length jde-current-project) 6))))
    )
  (setq credmp/current-jde-project jde-current-project)
  )
 
;; add the hook...
(add-hook 'jde-project-hooks 'credmp/update-cache)

One a-ha erlebniss (as the germans call it) was Etags, a usefull TAGS file generating program, which basically creates an index of symbols from your source tree.

In order to use etags you need 2 things, a TAGS file and etags support in Emacs. Generating a TAGS file is easy, if you are on Linux or Mac OS X. How it is done on Windows, I don’t know :)
The shell command to execute:

$ find . -name '*.java' | etags -

And the necessary elisp to use it:

(require 'etags)

Now you can use M-. to jump to a TAG. For in-depth info on TAGS please see section 33 Maintaining of your GNU Emacs manual (C-h i and then m Emacs).

It is quite nice to see our Emacs community so active in enhancing our day to day lives! Keep bringing it!

Code, Emacs , , , ,

worklog-mode now on github

June 4th, 2008

Since switching to github last weekend I have very pleased with it, so pleased that I also have put worklog onto it.

You can find it on the worklog page on github. I also added the documentation to the wiki.

If anyone wants to work on it, please create a github account and I will add you to the list of collaborators :)

Code, Emacs , ,