Monday, December 16, 2013

Setup CLFSWM

This article is based on my previous post "Setup Common Lisp Environment". Please read that first if you have not.
For me, one way to learn a new language is to use it frequently. To learn common lisp, I try to use clfswm (Common Lisp FullScreen Window Manager: http://common-lisp.net/project/clfswm/) in one of my machine. It is written/configured with common lisp.
I use quick lisp to install clfswm as follow:
* (qlsetup)
* (ql:quickload "clfswm")
Gnome is my primary desktop now, to continue use gnome applications in clfswm, I add a .xsession file as follow in my home directory:
#!/bin/bash

# log for debugging, quite useful if you make some mistake in your configuration
exec &> $HOME/.clfswm.log

gnome-settings-daemon &
eval `gnome-keyring-daemon`
nm-applet &
# or some other panel application, I mainly use it for systray support
fbpanel &
# some applications I used everyday, so I start up them along with login
gnome-terminal &
emacs &

# to setup background, you can select other applications for it too
feh --bg-center /usr/share/wallpapers/joy/contents/images/1366x768.png
exec sbcl --noinform --no-userinit --no-sysinit --eval "(require :asdf)" \
    --eval "(require :clfswm)" --eval "(clfswm:main)" --quit
To adapt clfswm to my habit (mostly based on gnome), I customized clfswm a little via .clfswmrc. I changed fbpanel a little for clfswm too. Details will be in following posts.
In fact, I still have several issues with my clfswm, this prevents me to use it as my primary window manager in my laptop.

  • Sometimes modal dialog will make a frame "frozen" after covered by other window, that is, no reaction for hot key. I need to click another frame and back to the frame to switch to the modal dialog.
  • I do not find real full screen support. Some software need real full screen to display a full screen "edge menu" (such as virtualbox). Or maybe software thinks it is in full screen mode, I just can not activate the "edge menu".

Thursday, December 5, 2013

Setup Common Lisp Environment

Debian is my main Linux distribution, so usually it is an easy task to setup some programming language development and usage environment. At first, it looks like before for common lisp. I installed sbcl deb package according to the recommendation from cliki (http://www.cliki.net/).

 # apt-get install sbcl sbcl-doc 
 
Then I installed slime and several common lisp deb packages. But clfswm deb package does not work. And I found quicklisp provide much more common lisp systems than debian and it is actively maintained. So I decide to use quicklisp for all common lisp systems, only use sbcl deb package.
It is very easy to install quicklisp (from http://www.quicklisp.org/beta/).

 $ curl -O http://beta.quicklisp.org/quicklisp.lisp
 $ sbcl --load quicklisp.lisp
 * (quicklisp-quickstart:install)
 * (ql:add-to-init-file) 
 
Then you can use (ql:system-apropos) to search systems and install them with (ql:quickload "xxx"). But quicklisp take too long to initialize, so I put quicklisp initialize code in $HOME/.sbclrc into a function (qlsetup) and call it only when I want to install something with quicklisp. To make systems installed with quicklisp avaiable without quicklisp initialization. I add quicklisp software directory into asdf search path. Create a file named $HOME/.config/common-lisp/source-registry.conf.d/33-quicklisp.conf, its contents is:

 (:tree (:home #p"quicklisp/dists/quicklisp/software")) 
 
Then install and configure slime (from https://github.com/quicklisp/quicklisp-slime-helper),

 * (qlsetup) * (ql:quickload "quicklisp-slime-helper") 
 
Add the following to $HOME/.emacs

 (load (expand-file-name "~/quicklisp/slime-helper.el"))
 (setq inferior-lisp-program "sbcl") 
 
Then install hyperspec

 # apt-get install hyperspec 
 

Tuesday, December 3, 2013

Try to use Lisp As My Second Language

Linux kernel programming is my job, so C is my first language. But C is not high level enough for some work such as generating a HTML report from a git repository. So I use python as my second language.
Now I think about using lisp as my second language. Because
  • It is high level enough.
  • It has some interesting features like macro. It is said I can build my own mini-language with it.
  • I want to learn meta-programming and compiler. Lisp macro can be a start point of them.
  • I love Emacs, I need lisp to customize my Emacs.
The two main lisp dialects now are scheme and common lisp. I have learn something about basic scheme (without macro) and common lisp macro (through "On Lisp"). I will start with common lisp, because from google, it seems to be more practical than scheme, which is considered somewhat academic style.

Tuesday, May 28, 2013

Install Debian testing or Wheezy (7.0) into Acer S7

Install Debian testing or Wheezy (7.0) into Acer S7.  Dual boot with Windows 8

The steps is not what I have done exactly.  What I have done is more complicated with similar solution.  Use it at your own risk.

1. In windows, delete data partitions and shrink windows partitions
2. Download Debian testing or Wheezy (7.0) netinst iso, dd it to the USB key
3. Goto BIOS (press F2 during boot), disable secure boot, set boot from USB
4. Boot with Debian install USB key, begin install
5. Before partition, go to console 2 (Alt + F2), activate rescue console
6. Run following command to backup

# dd if=/dev/sda bs=1M | gzip -c > <a usb hard disk>/acer-s7-sda.gz
# dd if=/dev/sdb bs=1M | gzip -c > <a usb hard disk>/acer-s7-sdb.gz

They are not too big, about 10G for each.
7. After backup, continue to install
7.1 When create partition, choose "Manual", create partitions on RAID disk, NOT sda and sdb.
7.2 grub install may failed, that is not a big issue. Just continue without bootloader until install finished.
8. Boot with Debian install USB key, get the rescue console
9. chroot into the partition you installed Debian into
10. in chroot shell, do

# mount -t proc none /proc
# mount -t sysfs sysfs /sys

11. install dmraid, kpartx

# apt-get install dmraid kpartx

12. Add i915 into initramfs, this will give you a opportunity to debug during boot

# echo i915 >> /usr/share/initramfs-tools/modules

13. Add kpartx into initramfs, becuase dmraid can not recoganize gpt partition table.  Download kpartx-initramfs-tools.tar.gz, extract it, then

# cp -r kpartx-initramfs-tools/* /usr/share/initramfs-tools

14. update-initramfs

# update-initramfs -u

15. install grub-efi

# apt-get install grub-efi-amd64

16. update grub

# update-grub

17. mount efi partition?

# mkdir /boot/efi
# mount /dev/disk/by-id/dm-uuid-part2-DMRAID-isw_xxx_HDD0 /boot/efi

18. install grub

# grub-install

18. All done, reboot, and bless