– Moving back to Blogger –

How to delete users from moodle?

There is a discussion about mass delete user account at
http://moodle.org/mod/forum/discuss.php?d=72880
But, it’s easier for me to just delete unwanted users from the database. My dbms is postgresql-8.3.

So, here are the steps:

$ psql -u mymoodlename -d mymoodledb -h localhost
psql> delete from mdl_user where email~’i-pod.info’;
psql> \q

Done!!!

Ref: http://www.postgresql.org/docs/8.3/static/functions-matching.html

NOTE: My site attracts anonymous user like ‘xzyfaxzffzxf@i-pod.info’ a lot. :)
PS: I don’t know if this gonna break any relation in the db or not. If you know, please comment me.

how to move a moodle site

I had a site running moodle 1.6.2 on Ubuntu (dapper) server using postgresql (installed with apt-get).
Then, a newer server comes!!! Of course I installed Ubuntu 8.04LTS server & postgresql again.
After trials&errors with moodle 1.6.6, 1.7.4, 1.8.5 & 1.9.1, I’ve got the following…

How to move moodle 1.6.2 site to new server?

On the old server: [my database name for moodle was 'moodle']
$ pg_dump moodle -o moodle.pg_dump
$ tar cf var_www_moodle.tar /var/www/moodle
$ tar cf var_lib_moodle.tar /var/lib/moodle

On new server:
download http://download.moodle.org/download.php/stable16/moodle-1.6.6.tgz
$ sudo apt-get install apache2 php5 php5-pgsql php5-gd libapache2-mod-php5 postgresql-8.3
$ tar zxf moodle-1.6.6.tgz
$ sudo mv moodle/* /var/www/
$ cd /var/www/
# sudo su – postgresql
# psql
psql> create database moodle;
psql> create user moodle with password=’xxx’;
psql> alter database moodle owner to moodle;
psql> \q
# psql moodle < moodle.pg_dump
# exit
$ sudo mkdir /var/moodledata
$ tar xf var_lib_moodle.tar
$ sudo mv var/lib/moodle/* /var/moodledata
$ sudo chown -R nobody /var/moodledata
$ sudo chgrp -R www-data /var/moodledata
$ sudo chmod g+w -R /var/moodledata
$ sudo vim config.php
<?php  /// Moodle Configuration File

unset($CFG);

$CFG->dbtype    = ‘postgres7′;
$CFG->dbhost    = ‘user=\’moodle\’ password=\’xxx\’ dbname=\’moodle\’ host=\’localhost\”;
$CFG->dbpersist =  false;
$CFG->prefix    = ‘mdl_’;

$CFG->wwwroot   = ‘http://my.site.th’;
$CFG->dirroot   = ‘/var/www’;
$CFG->dataroot  = ‘/var/moodledata’;
$CFG->admin     = ‘admin’;

$CFG->directorypermissions = 00777;  // try 02777 on a server in Safe Mode

$CFG->unicodedb = true;  // Database is utf8

require_once(“$CFG->dirroot/lib/setup.php”);
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
?>

$ firefox http://my.site.th

Done!!!
:)

NOTE: for normal installation 1.6.x, 1.7.x & 1.9.x need the flag ‘host=\’localhost\” 1.8.x doesn’t

Connect Ubuntu to Windows Active Directory

Single sign on is a good idea!!! My organization has  it & it’s Windows Active Directory.

So, I’d to find out how to use it. This is what I came up with.

Installation:

sudo apt-get install likewise-open-gui

sudo domainjoin-gui

domainjoin-gui screenshot

… enter the domain -> click “Join Domain” -> enter user&password

fixing “daemon not started” issue by assign likewise-open to (all) run levels

sudo update-rc.d likewise-open defaults

<Ctrl>+<Alt>+Backspace  to logout

login again with “DOMAIN\\USERNAME”

REF: Likewise-Open-Guide.pdf

script to show or hide gnome-panel

#!/bin/bash
# mr-paul

### types: bool(true[yes]/false[no]), float, int, list, pair, string

x=$(gconftool-2 –get “/apps/panel/toplevels/top_panel_screen0/x”)
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/orientation” –type string “top”

if [ $x -ne 10000 ]; then
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/auto_hide” –type bool “true”
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/auto_hide_size” –type int 1
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/expand” –type bool “false”
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/hide_delay” –type int 10
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/monitor” –type int 3
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/unhide_delay” –type int 10
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/x” –type int 10000
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/y” –type int 10000
else
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/auto_hide” –type bool “false”
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/auto_hide_size” –type int 1
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/expand” –type bool “true”
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/hide_delay” –type int 10
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/monitor” –type int 0
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/unhide_delay” –type int 10
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/x” –type int 0
gconftool-2 –set “/apps/panel/toplevels/top_panel_screen0/y” –type int 0
fi

clean desktop

A note on Ubuntu 8.04 LTS installation

I’ve decided to cleanly install Ubuntu 8.04 LTS on my machine today.

So this is rather a note on how I get it back to work the way I love it.

(i) configure keyboard shortcuts (gnome-keybinding-properties)

Show the panel run application dialog -> Shift+Ctrl+D
Activate window menu -> Shift+Ctrl+W
Close window -> Alt+Q
Switch to workspace on the left -> Alt+,
Switch to workspace on the right -> Alt+.

(ii) set typing mode for gnome-terminal (bash)

echo -e “\nPS1=’\${debian_chroot:+(\$debian_chroot)}\u@\h:\W\$ ‘\nset -o vi \nbind -m vi-command -r ‘v’” >> .bashrc

(iii) update the repositories

deb http://archive.ubuntu.com/ubuntu/ hardy main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu/ hardy-security universe main multiverse restricted
deb-src http://security.ubuntu.com/ubuntu/ hardy-security universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe main multiverse restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu/ hardy-proposed universe main multiverse restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu/ hardy-backports universe main multiverse restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy-backports universe main multiverse restricted
deb http://packages.medibuntu.org/ hardy free non-free
deb http://wine.budgetdedicated.com/apt hardy main #WineHQ
(iii) update & upgrade

wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade

(iv) remove unnecessary softwares

sudo apt-get remove –purge totem*  evolution*

(v) install  necessary softwares from the repositories

sudo apt-get install blender yafray vim-gnome w32codecs libdvdcss2 mplayer mencoder mplayer-doc inkscape k3b libk3b2-extracodecs quanta build-essential wine paprefs padevchooser vcdimager imagemagick compizconfig-settings-manager

Done!!!