Incorrect result from WordPress plugin_dir_url

Consider this code in akismet.php from the ubiquitous Akismet plugin for WordPress: define(‘AKISMET_PLUGIN_URL’, plugin_dir_url( __FILE__ )); My WordPress installation is at /usr/share/wordpress, but the Akismet plugin is installed to /var/lib/wordpress/plugins/akismet/ and there is a symlink (symbolic link) inbetween. This means that __FILE__ is /var/lib/wordpress/plugins/akismet/akismet.php but plugin_dir_url does not understand this, and will incorrectly return: /wp-content/plugins/var/lib/wordpress/plugins/akismet/ This is not… Continue reading Incorrect result from WordPress plugin_dir_url

The Inner-platform API anti-pattern

I learned the term Inner-platform effect the other day and it perfectly describes an API that I have touched upon. First of all, what is the Inner-platform effect? It basically means that in attempt to make an application as flexible as possible it is implemented so that it creates a new platform that abstracts the original platform. I immediately… Continue reading The Inner-platform API anti-pattern

No application without a library, no web site without an API?

When I wrote the first versions of Dynamite and Unshield (eight and nine years ago!) I decided from the start that each project had to be implemented in two parts: a library (hopefully reusable) and a command line tool using the library. I believe I learned this from cURL and libcurl, and I still consider… Continue reading No application without a library, no web site without an API?

Setup a new headless Ubuntu VM in VirtualBox on FreeBSD

Download from //virtualboxes.org/images/ubuntu-server/ VBoxManage register “/storage2/virtualboxes/Ubuntu server 11.10/Ubuntu server 11.10.vbox” VBoxManage list vms “Ubuntu server 11.10” {231c28f0-19bb-48d7-9db4-ba29de37e5fd} VBoxManage modifyvm “Ubuntu server 11.10” –usbehci off VBoxManage modifyvm “Ubuntu server 11.10” –pae on VBoxManage modifyvm “Ubuntu server 11.10” –nic1 bridged –bridgeadapter1 em0 VBoxManage sharedfolder add “Ubuntu server 11.10” –name backup –hostpath /backup nohup VBoxHeadless –startvm “Ubuntu server 11.10”… Continue reading Setup a new headless Ubuntu VM in VirtualBox on FreeBSD

Published
Categorized as Ubuntu

Moving a DokuWiki site to a new server

I have customized my DokuWiki installation to allow multiple wikis, similar to running multiple WordPress blogs on different domains. My /etc/dokuwiki/local.php looks like this: This means that I have multiple DokuWiki sites in my /var/lib/dokuwiki/ directory. To copy only one of them: Copy the /etc/dokuwiki/hostname directory and symbolic links Copy the /var/lib/dokuwiki/hostname directory and symbolic links Copy… Continue reading Moving a DokuWiki site to a new server

Published
Categorized as Ubuntu

Installing tarsnap on a vanilla Ubuntu server

cd /var/tmp/ curl -O //www.tarsnap.com/download/tarsnap-autoconf-1.0.31.tgz  (or actually the latest version from //www.tarsnap.com/download.html) sudo apt-get install gcc e2fslibs-dev zlib1g-dev libssl-dev make cd tarsnap-autoconf-1.0.31 (directory name corresponding to the downloaded tarball) ./configure && make && sudo make install sudo tarsnap-keygen –keyfile /root/tarsnap.key –user username –machine machinename (note that my blog converts two dashes to a single long dash so you need to… Continue reading Installing tarsnap on a vanilla Ubuntu server

Published
Categorized as Ubuntu

Angående att arrangera tävlingar på Facebook

(I never post in Swedish on this blog, except now! 🙂 Jag har skrivit detta blogginlägg enbart för att kunna länka till det när jag ser tävlingar på Facebook, så att jag slipper skriva samma sak om och om igen. Ett tips när det gäller tävlingar på Facebook är att de har väldigt strikta regler… Continue reading Angående att arrangera tävlingar på Facebook

Pebble – more injection and less dependencies in PHP

Dependency Injection (DI) is hardly anything new. I see it as a must for Test Driven Development (TDD). The thing I like most about DI in Java is Autowired in Spring or javax.annotation.Resource, they way member variables are set “magically” and the exact details about creation and implementation is located elsewhere. For PHP there are… Continue reading Pebble – more injection and less dependencies in PHP