WordPress: Allowing contributors to upload media


This is the simplest way I found to allow for contributors to upload media on your WordPress blog:
Add this to the functions.php file in your current theme:
if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
$contributor = get_role('contributor');
source: http://wordpress.org/support/topic/allow-contributor-to-upload-media

ArchLinux: installing on GPT/LVM/GRUB 2 (no installer)

Boot into ArchLinux ISO

modprobe dm-mod

pacman -Syy

pacman -S gdisk


gdisk /dev/sda

o   then "y" to confirm











w  then "y"  to confirm


pvcreate /dev/sda2

vgcreate arch /dev/sda2

lvcreate -L 1G -n boot arch

lvcreate -C y -L 4G -n swap arch

lvcreate -L 10G -n root arch

lvcreate -l100%FREE -n home arch



mkswap /dev/arch/swap

mkfs.xfs /dev/arch/root

mkfs.xfs /dev/arch/home

mkfs.xfs /dev/arch/boot






mount /dev/arch/root /mnt

cd /mnt

mkdir home boot

mount /dev/arch/boot boot

mount /dev/arch/home home

cd ..


pacstrap /mnt base base-devel


genfstab /mnt >> /mnt/etc/fstab


arch-chroot /mnt


pacman -Syy

pacman -S grub2-bios

grub-install –boot-directory=/boot –no-floppy –recheck –debug /dev/sda


grub-mkconfig -o /boot/grub/grub.cfg


nano /etc/mkinitcpio.conf

ADD "lvm2" between sata and filesystems

HOOKS=". . . sata lvm2 filesystems . . ."



mkinitcpio -p linux




umount -a



Intranet: setup DJBDNS to respond for *.local to help development


0. Follow instructions to setup a DNS Cache


1. Create an alias for eth0:

# nano /etc/network/interfaces

auto eth0:0
iface eth0:0 inet static

2 . restart networking

# /etc/init.d/networking restart


3. Use tinydns-conf to setup djbdns 

# tinydns-conf dnscache dnslog /etc/tinydns


# ln -svf /etc/tinydns /etc/service

# cd /etc/service/tinydns/root/



4. Setup the "local" domain name:

# ./add-ns local

#./add-host a.ns.local


5. Create the data file for tinydns

# cd /etc/service/tinydns/root/

# nano data



In the sample file above:
– is the IP address of the DNS server, so it is the one responsibe for domain name responses
– is the IP address of your future Web server
Save and update data/cdb
# make
6. Edit /etc/resolv.conf
search portnumber53.local



7. Let dnscache know about your *.local domain names:

# cd /etc/service/dnscache

# echo > root/servers/local

# chmod 644 root/servers/local


8. Restart dnscache

# svc -t .




Code:: css-message-box

I just started a Google Code hosted project since I’m always in need of pretty message boxes for my HTML things.

Let me know if you want/can contribute to it. It’s currently licensed under GPL 2.0

Here’s the address:





Installing DropBox on Slackware 13.1 64-bit

Before you start, let's make sure you have gnome docutils installed:

Get the package:


Install GNOME Doc Utils (this part is borrowed from LinuxFromScratch book)

./configure --prefix=$(pkg-config --variable=prefix ORBit-2.0) --mandir=$(pkg-config --variable=prefix ORBit-2.0)/share/man make 

Test it

make check

and then install as root:

make install

switch to Dropbox installation folder

cd /nautilus-dropbox-0.6.3


LAMP: Installing on Slackware 13.37 64-bit

Ongoing post:


1. Download Apache ( http://httpd.apache.org )

tar -xvjf httpd-2.2.21.tar.bz2

cd httpd-2.2.21

I like Slackware, but I also like the Apache layout installed in Debian distributions, so:

./configure --enable-layout=Debian--enable-module=most --enable-mods-shared=most --enable-ssl=shared
make install

2. PostgreSQL

./configure –with-perl –with-openssl

gmake all

gmake install




./configure –with-pgsql –enable-soap –enable-zip –with-mysql=/usr/local/mysql/ –with-mcrypt –enable-mbstring –with-gd –enable-ftp –with-jpeg-dir –with-png-dir –with-bz2 –with-zlib –enable-safe-mode –with-apxs2=/usr/sbin/apxs


make install


Kohana 3.2 tutorial : 2 – Setting up and basic Redirect controller

1. Edit bootstrap.php under "application":


        'base_url'   => '/',
        'index_file' => '',


2. Change the default route to a redirect controller (so we can deal with redirections for misplaced content/old content):

Route::set('default', '(<request>)',
		'request' => '(.*)',
		'controller' => 'redirect',
		'action'     => 'index',

3.Create the redirect controller


 defined('SYSPATH') or die('No direct script access.');
 * Handles all the redirecions that may happen
 * @package      Redirect
 * @category     SEO
 * @author       Mauricio Otta
 * @license      Confidential. Internal use only.
class Controller_Redirect extends Controller {

	static public function action_index() {
		echo "Controller_Redirect::action_index();<br />";
		echo Request::current()->param('request');


4. Test it.

You should see something like this:


test with different URLs.

Notice the controller does not handle the Query String part ( http://php.net/parse_url )



TO-DO: Add query string handling



Kohana 3.2 tutorial : 1 – Installation

1. Go to kohana’s website




2. Download latest stable


$ wget http://dev.kohanaframework.org/attachments/download/1670/kohana-3.2.0.zip
--11:08:44--  http://dev.kohanaframework.org/attachments/download/1670/kohana-3.2.0.zip
           => `kohana-3.2.0.zip'
Resolving dev.kohanaframework.org...,
Connecting to dev.kohanaframework.org[]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,043,281 [application/zip]

100%[==============================================================================================================================================================>] 1,043,281      1.53M/s             

11:08:45 (1.53 MB/s) - `kohana-3.2.0.zip' saved [1043281/1043281]

3. Uncompress it and move stuff around


$ unzip kohana-3.2.0.zip


$ ls -la
total 981
drwxr-xr-x   5 portnumber53.com www-data               7 Dec  9 11:11 .
drwxr-x---  57 portnumber53.com www-data              70 Dec  9 10:23 ..
-rw-r--r--   1 portnumber53.com portnumber53.com      27 Dec  9 10:56 .htaccess
drwxr-x---   2 portnumber53.com www-data               2 Dec  9 10:23 cgi-bin
drwxr-x---   2 portnumber53.com www-data               2 Dec  9 10:57 html
drwxr-xr-x   5 portnumber53.com portnumber53.com      10 Jul 25 03:26 kohana-3.2-master-1
-rw-r--r--   1 portnumber53.com portnumber53.com 1043281 Dec  9 11:08 kohana-3.2.0.zip

$ rm kohana-3.2.0.zip

$ mv kohana-3.2-master-1/modules/ .

$ mv kohana-3.2-master-1/application/ modules/

$ mkdir -p vendor/modules

$ mv kohana-3.2-master-1/install.php html/

$ mv kohana-3.2-master-1/index.php html/




4. Combine the example.htaccess


$ nano kohana-3.2-master-1/example.htaccess

$ nano .htaccess



5. Try opening your site:


Kohana install.php file will report what you need to fix…. hopefully just file paths:


6. Fix those paths (you millage may vary):

$ nano html/index.php


$application = ‘../modules/application’;

$modules = ‘../modules’;

$system = ‘../vendor/modules/system’;



 * The directory in which your application specific resources are located.
 * The application directory must contain the bootstrap.php file.
 * @see  http://kohanaframework.org/guide/about.install#application
$application = '../modules/application';

 * The directory in which your modules are located.
 * @see  http://kohanaframework.org/guide/about.install#modules
$modules = '../modules';

 * The directory in which the Kohana resources are located. The system
 * directory must contain the classes/kohana.php file.
 * @see  http://kohanaframework.org/guide/about.install#system
$system = '../vendor/modules/system';

 * The default extension of resource files. If you change this, all resources
 * must be renamed to use the new extension.
 * @see  http://kohanaframework.org/guide/about.install#ext
define('EXT', '.php');



7. Test until you get Oks everywhere 🙂


Organize your DropBox shared folders the right way

When someone shares a DropBox folder with you, it goes to the root folder of your DropBox, which most of the times will not be good enough and ends up messing the very well planned structure that you wanted 🙂

If you simply drag and drop the shared folder somewhere else (within your DropBox, of course) the sharing information somehow gets lost.

The solution is to move the folder using the web interface!

  • IGlr