# man man

posted on 2013-10-31 18:17:24

What are the reasons for the numbers when firing up manpages? What is the difference between man printf and man 3 printf? (The first is about the shell command. The latter is about the C function.)

Its the group to which the entries belong: (Found in man man.)

1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]

If there exists only one man entry, the number can be omitted. That is why man git or man gittutorial works, even though git is from section 1, but the tutorial is located in section 7.

# The Java Language Specification

posted on 2013-10-30 10:25:36

When learning a programming language, there are verly likely some edge cases that you have trouble finding information on. If you use a language that has an official specification, the spec may be the last (and best) resort.

For Java SE 7, the online version can be found here. (Though I recommend the PDF from here, so you can search through the whole spec at once properly.)

Also having a closer look on it may prove useful someday. I.e. do you really know already every keyword in Java and its meaning? Let your curiousity get the better of you.

# Setting the $PATH env variable in Windows posted on 2013-10-28 11:28:19 Once in a while a new programm or language needs to be installed, the path needs adjusting. Usually in Windows this is very annoying due to the window where this needs to be done is, erm, 'not very' user-friendly. (Of course this can be done from the shell, too. But besides appending/prepending an entry to the existing ones this is not the best approach to change the values.) A better approach is RapidEE. From its about page: Rapid Environment Editor (RapidEE) is an environment variables editor. It includes an easy to use GUI and replaces the small and inconvenient Windows edit box. RapidEE 8.x supports Windows XP, 2003, Vista, 2008, Windows 7 & Windows 8 (including 64-bit versions). If you still use Windows NT or 2000, then use version 6.1. For Windows 9x or ME use version 2.1. In short, besides letting you edit the entries much more conveniently, broken links are also shown in red! Typing errors are also avoided through usage of filechooser menus. Do yourself a favour and install this. Did I mention this is freeware? :o) # Line numbers in vim posted on 2013-10-27 14:27:18 Line numbers in vim are turned off by default, and there exist two variations of them. (Since vim version 7.3 IIRC.) When viewing a file with a dozen lines, numbers can be shown absolute (1,2,3,4,5..12) or relative to the line you are in. If your cursor is located in line 3, numbering would change if you move to line 4. (2,1,[3],1,2,3,4..9) changes to (3,2,1,[4],1,2,3..8). Relative numbering would look plain useless on first sight, but when was the last time you wondered which line numbering argument to use relative to the current line? I.e. delete the next x lines, where x is not just 4,5,6 lines, where you can still easily tell the count? Less obvious at first, think less complex, do you use j and k for in-file-navigation? Sure, { and } will jump paragraph-wise. But is this really the best means to an end? When using absolute numbers :10<CR> will jump to line 10 in the file. But 5j will jump five lines down, 5- goes five down from the current line, and relative numbering will show exactly how many lines you will have to enter. For example, what is when the file you are editing in like 4000 lines long, and you move around lines 3500? Jumping to absolute lines gets old fast, if you are in the four-digits, line-wise. To enable line numbers shown: # turn on absolute numbering :se nu # turn on relative numbering :se rnu  To disable: (Comes in handy for c&p things, especially when using vim in the console.) # turn off absolute numbering :se nonu # turn off relative numbering :se nornu  Of course, you cannot use both modes at once. But I disgress. The incentive for this post was a different use case. ### How to number the lines of the current code snippet for documentation purposes in-file after pasting? There are a lot of possible solutions with vimscript usage (which is very likely not the easiest way). Or just use linux'/cygwin' nl command: :%!nl -ba  The % indicated this is applied to the whole file. :'<,'>!nl -ba  Wheres this is just applied to the lines currently marked in visual mode. Select lines, :!nl -ba, vim will insert the rest. Use man nl for the different options the nl command provides. Just put this in your .vimrc: vnoremap <leader>ln !nl -ba<cr>  This lets you annotate an area you selected in visual mode via Leaderkey-l-n. To easily remove the line numbers in case they would not be needed anymore, C-v enables vim's block-wise editing mode. At least under linux, for windows this was C-Q or C-q or something, I just remember it differed. Anyway, this enables you to easily select a rectangle of text anywhere within your current file. The selection can be changed, deleted, whatever. Changes my only appear after exiting block-selection-mode, do not wonder when only one line is affected during your changing. # Prime factorization in haskell posted on 2013-10-26 16:09:32 While working on some lecture code, I came across the problem of factorization of integers. Since there is no trivial approach to this (to handle this for big values), cryptography works at all. I wondered if there was some way of doing this with list comprehensions in haskell, but my math skills are not adequate it seems. Or it is just not possible. ;o) This was my shot of doing it in haskell, although without list comprehensions. (It may work with list comprehensions and helper functions, but I did not dig into this any further.)  1 -- prime factorization 2 priming :: Int -> [Int] 3 priming x = primingh 2 x [] 4 5 -- helper function for tail recursion 6 primingh :: Int -> Int -> [Int] -> [Int] 7 primingh c x xs | (c == x) = reverse(x:xs) 8 | x == 1 = reverse(xs) 9 | ((mod x c) == 0) = (primingh c (div x c) (c:xs)) 10 | otherwise = (primingh (c+1) x xs)  Lines 7 and 8 are the terminal conditions, 9 handles existing double primes. (In case your value can be divided several times by the currently tested number, i.e. '2' without remainder.) The reverse just reverses the output list, so it lists increasing instead of decreasing result primes. Note to self: Haskell is not a Lisp. Do not name helper functions <functionname>-h, it will not recognize the '-'... # Scale down PDF size with Ghostview posted on 2013-10-25 13:28:50 For downsizing large .pdf files, I tend to utilize Ghostscript as an open source alternative. There are programs you come across via google, but mostly these scale down fast and with bad filters. This leads to bad quality in the resulting PDF's. I.e. you cannot read text properly anymore, pictures are pixelated and so on. There also exist proprietary solutions like Adobe Acrobat (The free Acrobat Reader does not have this functionality!) From a technical point of view, the Adobe Suite is by my estimation roughly faster by factor x10 to x20 faster compared to Ghostscript. The output quality is fine, so its price exists for a reason, to be fair. Last time I looked, it was around 200 USD. This is what I am using on windows via Cygwin, is analog on regular linux boxes: \gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile=name_of_downsized_pdf.pdf name_of_original_file.pdf  Works well, costs nothing. You just have to have Ghostscript installed. Last time I used it on a PDF with 60 pages text and a dozen pictures of 6MB size, the output was around 1.5MB and took like 2 minutes. The time-intensive part is scaling the pictures. These notes of from a shellscript of mine I used for batch-converting several PDF's reapeatedly in the past may be of interest: #!/bin/bash # # Converts .pdf files to lower quality. # This may take a while. # And you have to have ghostscript installed for this to work. # # the leading '\' is cosmetical, i have an alias binding on 'gs'. # It tells the shell to ignore aliases for the following command IIRC. # # add '-q' flag for less verbose output # # -dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images) # -dPDFSETTINGS=/ebook (low quality, 150 dpi images) # -dPDFSETTINGS=/printer (high quality, 300 dpi images) # -dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs) # -dPDFSETTINGS=/default (almost identical to /screen)  # Notes on unit testing posted on 2013-10-24 11:34:10 Under the title Top 12 Selected Unit Testing Best Practices I found a list of notes on unit testing. Copy pasted them here and added some own notes. 1) Always Write Isolated Test Cases - The order of execution has to be independent between test cases JUnit can run tests in parallel IIRC, so this is a no-brainer. ALWAYS stick to this principle, else results will not be reproduceable. Non-reproduceability SI TEH EVIL, be it in building or testing. 2) Test One Thing Only in One Test Case - Each test should focus on one aspect of an isolated method and/or class This makes debugging easier and renders tests easier readable. 3) Use a Single Assert Method per Test Case - Don't test too many different things at once! If you use just one Assert it's easier This is the like 2), but goes further. Also growth of the test suite is directly visible in the amount of tests run. Senses of achievement are good for the programmers mind. 4) Use a Naming Convention for Test Cases - A convention like: <Method-Name Under Test>_<Scenario>_<Expected-Outcome> Readability and easier debugging through having information at a glance in the log... looks like a lot of doubled work, especially if tests are subject to change. But bear with it, it simply helps. 5) Use the AAA Pattern - Use separated blocks ("ARRANGE", "ACT" and "ASSERT") help to improve maintainability - Use comments to mark the blocks I am not completely sure what this means. Maybe this relates to other unit testing frameworks than JUnit, where there are no explicit @Before or @After Task grouping mechanisms. If you have such a kind of approach, it could be helpful to document it in the header of your test file, even if you think your ideas are self-explanatory. If in doubt, document it, except it is likely to become obsolete again too soon. 6) Avoid the Expected Exception Tests - Maybe @Test(expected = ArithmeticException.class) doesn't test what it claims to test Expected failtests are implicit. Be explicit whenever possible. 7) Structure All Test Cases - Like Short-/Long-Running, Integration-/Unit-tests, but don't use test suits to control order of execution Order of execution or other depencenies are bad, same as 1). 8) Use Descriptive Messages in Assert Methods - Describe the WHY and not the WHAT, not like Assert.assertEquals( a, b, "must be equal") This is always key in documentation, be it in code documentation, changelogs or whereever. No matter in what language or what kind of code you are working on. Proofread stuff with this in mind. 9) Measure Code Coverage to Find Missing Test Cases - Best indicator what is not tested, but don't be too sure that the code works This helps for coming across parts of untested code, but may lead to false positives. 'Covered' code has tests written about it to check parts of itself, but this says nothing on the correctness of the tests by itself. Or, just as worse, not all test cases are covered by the test suite. Still it looks great for your boss, the higher the coverage key figure rises. :-) 10) Don't Forget to Refactor the Test Code - Also maintain your test code Basically there are like two types of refactoring. In short, one is reordering code within single method, which has little consequences. Ideal case for using tests. The other refactoring type is when you rebuild larger parts of software architecture, rendering your corresponding tests useless. The more you think about proper design up front, the less refactoring of the second type is needed. Once huge parts of application code have to be refactored due to bad design, most of the time the amount of work, like, doubles when code is already fully tested... You get the idea. Some of the information sitting in the tests (domain knowledge) can be reused, but all tests need reworking. Here keep in mind, that 'perfect' is the enemy of 'good enough', and nobody gets paid for gold plating. If you are paid for gold-plating, that is a sign of deeper-rooting problems at work... 11) Limit Use of Mocks - In some cases absolutely necessary, but with better design stubs should be enough I have never thought about this. But I just realized I have to refresh my knowledge on Mocks vs. Stubs. 12) Use Parameterized Tests - They can help avoid duplication and the best is the business gives you the data For a lot of code to be tested, there are like three tests needed. This means one for the left border, one for the right border and one test for the data span in between. Of course, if there are more gaps in the domain of the data, more tests are needed. Anyways, parameterized tests are great if just your input data changes because they mean less work for you. Sidenote: The better the specification, the easier it is writing correct tests. Basically better reqirements engineering up front makes test work easier afterwards. # Basic Emacs movement posted on 2013-10-23 15:57:51 A list of basic movement command aquivalents in Emacs to those in vim. This might come in handy for buffers where the vim modes of the evil plugin will not work. Movement Vim Emacs Meaning j C-n down k C-p up h C-b left l C-f right 0 C-a beginning of line$ C-e end of line
( M-a beginning of sentence
) M-e end of sentence
w/e M-f next word (not exactly the same)
b M-b previous word
gg M-< beginning of file
G M-> end of file
C-f C-v move one page down
C-b M-v move one page up
Commands
Vim    Emacs    Meaning
:w C-x C-s save file
:q C-x C-c close editor

# Emacs with Evil-mode and ESS install howto for using R

posted on 2013-10-22 11:43:20

While reading a R book, I was in need of a R IDE. Emacs with ESS was one of the options along with Eclipse or RStudio. Of course, there was also a vim alternative. After several attempts on using emacs after years with vim, I never passed even the whole introdutionary tutorial, so this was a reason to try emacs for once again. Learning shortcuts in vim seemed way easier in retrospect. Why not use emacs with vim's shortcuts?

There are several plugins available for this (i.e. Viper, Vimpulse, vim-mode...), but people on stackoverflow.com seem to agree that Evil-mode trumps them all.

### General installation

According to the install howto if the Evil wiki, in Emacs24 has Evil prebuilt into it. I could not load it, even though I had v24. I do not yet know if there is a proper plugin manager for emacs (Considering emacs' age, there has to exist a proper solution?), here is how to fix this by hand. Also UndoTree will be installed, for better undo handling.

cd                  # change to home folder
mkdir -p emacs.d    # create folder if it does not exist yet
cd emacs.d
git clone git://gitorious.org/evil/evil
git clone http://www.dr-qubit.org/git/undo-tree.git


Once the files are here, open

cd
emacs .emacs


and insert these lines:

(add-to-list 'load-path "~/.emacs.d/evil")
(add-to-list 'load-path "~/.emacs.d/undo-tree")
(require 'evil)
(evil-mode 1)


Base install is now finished.

### ESS: Emacs Speaks Statistics

cd
cd emacs.d
git clone https://github.com/emacs-ess/ESS
cd
emacs .emacs


and insert

(load "~/.emacs.d/ESS/lisp/ess-site")
(require 'ess-site)


Now head over to here and get going. :-)

A last note with some shortcuts:

M-x R RET "Start R Console"
C-x C-s "save current file"
C-x C-c "close emacs"


C is CTRL, i.e. C-x means Ctrl+x. RET is the Return key.

Next step for deepening Emacs knowledge is probably an elisp-howto...

# Create strong random passwords with openSSL in linux

posted on 2013-10-21 18:18:56

openssl rand -base64 10


The 10 is the password length.

# bash array essentials

posted on 2013-10-20 18:24:10

bash is not just the name of a shell terminal, it is also a full-blown programming language. It has some very ugly sides from my point of view. This here resulted from some commandline work, where a number of filenames was needed. I know I will need a refresher on this again.

Note: In the following, arr is the name of our array. Choose whatever you fancy.

### get all folder/filenames into an array

arr=(/path/to/wherever/*)


Do not use ls for this, google for the reasons. I forgot why and do not have a link. ;)

${arr[0]}  If in doubt, use braces and not parentheses. ### print first array element to console echo${arr[0]}


Just for the record, since the above does just return the item, but bash cannot process it without another command.

### show array contents (i.e. for checking the actual data)

declare -p arr


Handiest command for checking arrays' contents. Force yourself to use it!

${#arr[*]}  Useful for numbered for-loops. ### all items in the array ${arr[*]}


Useful for foreach-type loops.

${!arr[*]}  Useful for... Off the hat I got no idea how this could help. ### length of item zero ${#arr[0]}


See last description.

# Lisp and encoding errors

posted on 2013-10-19 16:41:19

Whilst trying to push a new commit onto the server I encountered this: ...

remote:   #<SB-SYS:FD-STREAM
remote:     for "file /var/lib/gitolite/repositories/blog.git/tmp/007-Windows-7-shortcuts.post"
remote:     {100480ADB3}>:
remote:
remote:     the octet sequence #(226) cannot be decoded.
remote:
remote: Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

...


And a kind of explanation came along here (!). The first real use case of google's translator function for me, ever.

This is an UTF-8 related error, it seems.

Once I can get my hands on a prim and proper Common Lisp specification (i.e. not the HyperSpec but a PDF with OCR...) this will be investigated further.

### Update:

I kind of 'found' a spec, but there was nothing related in it. But the 'process' of finding was quite fun and involved quite some pdf processing.

In the end the solution to the utf-8 error was converting the document to ANSI, where the illegal char suddenly showed its uglyness (previously it seemed to be a sober -), delete/change it, converting back to utf-8 and all was fine again. Hoorray!

# Windows 7 shortcuts

posted on 2013-10-18 16:06:58

Windows

Win + Up - Maximize the current window
Win + Down - Restore down or minimize
Win + Space - makes all Windows transparent
Win + Home - Minimize all but the current Window
Win + M - Minimize all Windows
Win + D - Show/Hide Desktop

Programs / System

Win + Number - Activate the program pinned on Taskbar

Ctrl + Shift + Click - Open with Admin privileges
Win + Pause - Open System Properties
Ctrl + Shift + Esc - Open Task Manager directly
Win + R - Open 'Run' window to directly execute programs

Win + L - Lock Computer

Explorer / Filesystem

Win + E - Open a Windows Explorer window
F2 - To rename a file
Ctrl + Shift + N - Create new folder
Alt + Up - Goto parent folder
Alt + Left - Backward
Alt + Right - Forward

# vim leaderkey rebinding to space

posted on 2013-10-17 16:03:58

Rebinding the leader key in vim is quite nice, since the original \ bind is kind of suboptimal. Once you start binding your own stuff, the key assigned to it is in heavy use. Using some meta key like CTRL or ALT is not useful since these will not work on their own. Most users take , or something alike.

Why not just use SPACE?

Only problem is, a literal ' ' used with the rebind command will not work, vim will not recognize it. It has to be inserted via pressing CTRL+V followed by hitting SPACE. That way the space will be inserted properly, and the following line will work in your .vimrc:

let mapleader = ' '


If you just copy-paste the line above without explicit CTRL-V-inserting the space in your vim while editing the .vimrc, most likely your binding will not work.

# Insert date and time via vim

posted on 2013-10-16 00:30:54

Out of the box vim does not have any possibility to insert date/time information into text files you are editing. (At least that vim were sporting such functionality would be news to me.) But unix comes to help. Vim is programmable and makes it easy to bind anything to any key.

First how to obtain the proper date information. Test this on your command prompt:

date --rfc-3339=seconds


which produces something like

2013-10-16 00:03:26+02:00


To bind commands to keys in vim, the .vimrc file needs some editing. It lies in your homefolder. (This file could also be called _vimrc, if you are under windows. Depending on how you installed vim.) In case it does not exist, create a new one and insert the following line:

nnoremap <Leader>fs :.!date --rfc-3339=seconds<cr><esc>


If the timezone information is too much, just use instead:

nnoremap <Leader>fs :.!date --rfc-3339=seconds<cr><esc>$xxxxxx  and you have 2013-10-16 00:03:26  The binding can be used in normal mode in vim via \fs (press these three keys one after another), except if you have rebound your leader key. When used, the entire line will be replaced with the date entry. Leaderkey rebinding can be done like here. # Books on iPhone Internals posted on 2013-10-15 21:01:32 Some book titles I was recommended for learning about iOS internals and security. Further reading could be: • Mac OSX and iOS Internals • Hacking and Securing iOS Applications • Mac Hacker's Handbook • OSX and iOS Kernel Programming • Cocoa Application Security • C in a nutshell • ARM Assembly Language Fundamentals and Techniques • ARM Assembly Language - An Introduction Eventually, more links are added here. # Blogging with Coleslaw posted on 2013-10-14 10:34:44 Coleslaw is one of many static site generators and creates static HTML pages. It uses Common Lisp in the backend. In my case markdown is used as the post format. This post will cover issues I encountered during install and initial usage. My Server is running a headless CentOS 6 install. As of October 2013 the SBCL version in the yum repo's is 1.0.38. When trying to run coleslaw a error occurs due to the cl-fad lib. Installing it via Quicklisp fails. As of SBCL 1.0.44 the missing functionality seems to be included: enhancement: new function: SB-EXT:DELETE-DIRECTORY is now provided. I recall all this from memory. So I am not completely sure this was the line in question. Since latest version at the moment is 1.1.12, this does not matter much. Except for others encountering similar errors and finding this via google. :) How to install the newest SBCL version and getting Quicklisp up and running, is already covered here. Now first a description how my coleslaw setup works and what technologies are used, in case troubleshooting is needed later on. The blog runs on a hosted vserver, stored in a git repository served by gitolite (eventually gitlab will be put to use). Once changes are pushed into the git repo, via a post-receive hook the lisp code for converting the markdown posts is triggered. The .html files are copied to another folder which is served over an apache web server. Posts have have the following structure, this is taken from this one here: ;;;;; title: Blogging with Coleslaw tags: coleslaw,sbcl,common lisp,lisp date: 2013-10-14 10:34:44 format: md ;;;;; Coleslaw is one of [many static site generators] (http://staticsitegenerators.net/) and creates ...  For convenience reasons posts have filenames like: 003-installing.coleslaw.post Indicating content and having a prepended number for easier editing. The .post extension is needed. Posts are the only files that reside in the blogging repository that is checked out onto my client workstation. All conversion code is loaded via Quicklisp, no need to set anything up besides what will be covered here. To phrase it differently, in your blog repository NO additional directory structure is needed for post organization, NO additional code is needed. Things just work. I.e. this is what resides in my cloned repo called blog currently: [sjas@lorelei ~/work/blog]% ls _test.post.sample 001-first.post.post 002-installing.sbcl.post 003-installing.coleslaw.post  It will not be disclosed how long just this took me to find out about the non-existant directory structure. :) On the server the repository is stored as a bare repo, nothing to take care of since gitolite will handle this by itself. Only thing to fix is the post-receive hook. Hooks in git enable bash actions to be triggered upon repository interactions. bash code to happen prior or after pushes, commits, etc. is defined in hook files. These are placed in the .git folder of the repository where they should act. Here this means, the post-receive file has to be put into /var/lib/gitolite/repositories/blog.git/hooks on the server. If it were put within the client-side repo it will not work. In my case this is the content of the file called post-receive: ########## CONFIGURATION VALUES ########## # TMP_GIT_CLONE _must_ match one of the following in coleslawrc: # * The :repo argument (for a single-site setup) _or_ # * An alist key (for a multi-site setup) TMP_GIT_CLONE=/var/lib/gitolite/repositories/blog.git/tmp/ # Set LISP to your preferred implementation. The following # implementations are currently supported: # * sbcl # * ccl LISP=sbcl ########## DON'T EDIT ANYTHING BELOW THIS LINE ########## if cd dirname "$0"/..; then
GIT_REPO=pwd
cd $OLDPWD || exit 1 else exit 1 fi git clone$GIT_REPO $TMP_GIT_CLONE || exit 1 if [$LISP = sbcl ]; then
sbcl --eval "(ql:quickload 'coleslaw)" \
--eval "(coleslaw:main \"$TMP_GIT_CLONE\")" \ --eval "(coleslaw::exit)" elif [$LISP = ccl ]; then
echo "(ql:quickload 'coleslaw)(coleslaw:main \"$TMP_GIT_CLONE\")(coleslaw::exit)" | ccl -b else exit 1 fi rm -rf$TMP_GIT_CLONE
exit


TMP_GIT_CLONE must point to a temporal folder which is not used otherwise. This is not the folder where your repository resides, or where the html code will be pushed to. It is needed for generation purposes and will be deleted immediatly after posting.

Further on the server the .coleslawrc has to be placed in the home folder of the user being responsible for gitolite.

My .coleslawrc in /var/lib/gitolite on the server:

(:author "sjas"
:deploy-dir "/var/www/html/sjas/blog/" ;; folder to be served
:domain "http://blog.sjas.de"
:feeds ("lisp")
:plugins ((mathjax) (sitemap))
:repo "/var/lib/gitolite/repositories/blog.git/tmp/" ;; tempfolder before stuff gets moved into DEPLOY, same as in post-receive
:sitenav ((:url "http://blog.sjas.de/" :name "Home")
(:url "http://twitter.com/sjashc" :name "Twitter")
(:url "http://github.com/sjas" :name "Code"))
:staging-dir "/tmp/coleslaw/"
:title "A year and a smile."
:theme "hyde")


Once all this is set, a virtual host entry in the apache config has to be created, maybe like this one here:

<VirtualHost blog.sjas.de:80>

ServerName blog.sjas.de
ServerAdmin sjas@sjas.de

DocumentRoot /var/www/html/sjas/blog/.curr/

<Directory />
Options FollowSymlinks
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/blogsjas/error_log
CustomLog /var/log/blogsjas/access common

<IfModule mpm_itk_module>
AssignUserId git git
</IfModule>

</VirtualHost>


Trick here is to set the DocumentRoot pointing to the symlink .curr which is created by coleslaw.

The mpm_itk_module is an apache extension to let a vhost run under a different user. Since I have the blog und git running under the same user, I do not have to watch out for file permission errors. Last thing to note here is, I forgot to create the ErrorLog and CustomLog files. Because of that nothing was served except the apache standard page, beside all else being set up properly. Once this was fixed, things looked like this on my workstation:

[sjas@lorelei ~/work/blog]% git add -A && git commit -m "update coleslaw" && git push
[master c9a5] update coleslaw
3 files changed, 11 insertions(+), 2 deletions(-)
delete mode 100644 .003-installing.coleslaw.post.swp
create mode 100644 .gitignore
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 688 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Initialized empty Git repository in /var/lib/gitolite/repositories/blog.git/tmp/.git/
remote: This is SBCL 1.1.12.14-b2ed34b, an implementation of ANSI Common Lisp.
remote: More information about SBCL is available at <http://www.sbcl.org/>.
remote:
remote: SBCL is free software, provided as is, with absolutely no warranty.
remote: It is mostly in the public domain; some portions are provided under
remote: BSD-style licenses.  See the CREDITS and COPYING files in the
remote: distribution for more information.
remote: To load "coleslaw":
remote:   Load 1 ASDF system:
remote:     coleslaw
remote: ; Loading "coleslaw"
remote: .......................
remote: ; compiling file "/var/lib/gitolite/quicklisp/dists/quicklisp/software/coleslaw-20131003-git/plugins/mathjax.lisp" (written 12 OCT 2013 12:59:42 AM):
remote: ; compiling (DEFPACKAGE :COLESLAW-MATHJAX ...)
remote: ; compiling (IN-PACKAGE :COLESLAW-MATHJAX)
remote: ; compiling (DEFVAR *MATHJAX-HEADER* ...)
remote: ; compiling (DEFUN ENABLE ...)
remote:
remote: ; /var/lib/gitolite/quicklisp/dists/quicklisp/software/coleslaw-20131003-git/plugins/mathjax.fasl written
remote: ; compilation finished in 0:00:00.016
remote: ; compiling file "/var/lib/gitolite/quicklisp/dists/quicklisp/software/coleslaw-20131003-git/plugins/sitemap.lisp" (written 12 OCT 2013 12:59:42 AM):
remote: ; compiling (DEFPACKAGE :COLESLAW-SITEMAP ...)
remote: ; compiling (IN-PACKAGE :COLESLAW-SITEMAP)
remote: ; compiling (DEFMETHOD DEPLOY ...)
remote: ; compiling (DEFUN ENABLE ...)
remote:
remote: ; /var/lib/gitolite/quicklisp/dists/quicklisp/software/coleslaw-20131003-git/plugins/sitemap.fasl written
remote: ; compilation finished in 0:00:00.006
remote: ; cp -R /var/lib/gitolite/quicklisp/dists/quicklisp/software/coleslaw-20131003-git/themes/hyde/css .
remote: ; ln -sfn 1.html index.html
remote: ; mv /tmp/coleslaw/ /var/www/html/sjas/blog/generated/3590675951
remote: ; rm -r /var/www/html/sjas/blog/generated/3590675441/
remote: ; ln -sfn /var/www/html/sjas/blog/.curr /var/www/html/sjas/blog/.prev
remote: ; ln -sfn /var/www/html/sjas/blog/generated/3590675951 /var/www/html/sjas/blog/.curr
To git@sjas.de:blog
e895..c9a5  master -> master
[sjas@lorelei ~/work/blog]%


And the then the software was up and running and the result is what you see here.

All this seems like an awful lot of work, but I wanted a fast, clean-looking, self-hosted blogging solution, working with git and being LISP-based for learning purposes. Other options would have been the clojure-based ones listed here and here.

This grew longer than anticipated, questions please via twitter until I get DISQUS up in here.

# Installing Steel Bank Common Lisp and Quicklisp on CentOS 6

posted on 2013-10-13 14:11:09

For getting this blog up and running, a standard compliant LISP installation was needed. SBCL was chosen. Further QuickLisp is needed.

Either use the binary install method, or build from source. Depends just on your preference. See here what is available. Building from source is described in the following.

Prerequisites are git, for getting the source code. Plus a working Common Lisp install for bootstrapping. (Can be SBCL or another one.) Maybe also gcc. (Writing this solely from memory.)

yum install sbcl -y
yum install git -y


If there are other libraries missing, use yum search for determining the package name. Afterwards yum install , in case you are wondering how to fix things.

git clone git://git.code.sf.net/p/sbcl/sbcl
cd sbcl

# depending on the common lisp implementation you are using, use just the right ONE of the following:
#SBCL
sh make.sh
#CMUCL
sh make.sh "lisp -batch"
#OpenMCL
sh make.sh "openmcl --batch"
#CLISP
sh make.sh "clisp"

# after compilation, just install
sh install.sh


Important: It is highly recommended that you run the make.sh script in either a very fast terminal such as xterm (the GNOME terminal and the OS X terminal are too slow) or that you run it in a detached GNU screen session (use C-a d to detach the session and screen -r to resume it). The SBCL compile produces lots of output and your system's terminal program will likely slow down the compile in a drastic manner. (See here at page bottom.)

The compiled binary can be found user /usr/local/bin. Add it to your path, if that is not already the case. Check your installation afterwards:

sbcl --version


Quicklisp installation:

curl -O http://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp


At the sbcl prompt enter the following to install and autoload quicklisp:

(quicklisp-quickstart:install)
(ql:add-to-init-file)


Quicklisp usage:

;; For finding libraries:
(ql:system-apropos "<searchterm>")
;; For installing libraries:
(ql:quickload "<lib name>")


That should be about it, twitter me if something here is off. I am a LISP noob.

# Hello World

posted on 2013-10-12 15:18:00

This is the first posting using a new static site generator based on Common Lisp. Setting this up could have been way easier with better documentation. :)

Next post will cover problems I encountered. For now back to real work.

P.S.
This markdown cheat sheet will help me writing posts to come.

Unless otherwise credited all material by sjas