วันเสาร์ที่ 27 พฤศจิกายน พ.ศ. 2553

Moodle online text template

Description « Hide

enable teacher to add a "template text" for students to base their answer upon

when giving them an online assignment.

patch explanation follows in the comments for this tracker issue









Description enable teacher to add a "template text" for students to base their answer upon when giving them an online assignment. patch explanation follows in the comments for this tracker issue Show »





All Comments Change History Version Control Sort Order: Ascending order - Click to sort in descending order



[ Permalink
« Hide ]

Nadav Kavalerchik added a comment - 27/May/09 04:15 AM

add new field to the DB, table assignment called "answertemplate" type=text collation=utf8_unicode_ci

patch the file mod/assignment/type/online/assignment.class.php

line 117:

print_single_button('view.php', array('id'=>$this->cm->id,'edit'=>'1','assignmentid'=>$this->assignment->id),

just after line 252 add:



$mform->addElement('htmleditor', 'answertemplate', get_string('answertemplate', 'assignment'), array('cols'=>60, 'rows'=>30));

$mform->setType('answertemplate', PARAM_RAW); // to be cleaned before display

$mform->setHelpButton('answertemplate', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');

$mform->addRule('answertemplate', get_string('required'), 'required', null, 'client');

just after line 283 add:



if (! $answertemplate = get_field('assignment','answertemplate' ,'id', $_GET['assignmentid'])) {

//error('assignment ID was incorrect');

}

$mform->setDefault('text', $answertemplate);

add to you local lang assignment.php files the string:

$string['answertemplate'] = 'A template for student\'s answer';

enjoy



[ Show » ]

Nadav Kavalerchik added a comment - 27/May/09 04:15 AM

add new field to the DB, table assignment called "answertemplate" type=text collation=utf8_unicode_ci

patch the file mod/assignment/type/online/assignment.class.php line 117:

print_single_button('view.php', array('id'=>$this->cm->id,'edit'=>'1','assignmentid'=>$this->assignment->id),

just after line 252 add:

$mform->addElement('htmleditor', 'answertemplate', get_string('answertemplate', 'assignment'), array('cols'=>60, 'rows'=>30));

$mform->setType('answertemplate', PARAM_RAW); // to be cleaned before display

$mform->setHelpButton('answertemplate', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');

$mform->addRule('answertemplate', get_string('required'), 'required', null, 'client');

just after line 283 add:

if (! $answertemplate = get_field('assignment','answertemplate' ,'id', $_GET['assignmentid'])) {

//error('assignment ID was incorrect');

}

$mform->setDefault('text', $answertemplate);

add to you local lang assignment.php files the string:

$string['answertemplate'] = 'A template for student\'s answer';

enjoy

วันพุธที่ 24 พฤศจิกายน พ.ศ. 2553

mount usb on linux

Mounting the External File System (Hard Drive)


To mount your hard drive you need to use the mount command. (To unmount the drive when you are ready to unplug it and take it home, use the umount command.) Here’s an example:



mkdir /mnt/usbdrive

mount /dev/sda1 /mnt/usbdrive



The above command first creates a directory in your /mnt folder, typically the folder will be descriptive of the device, so we use /mnt/usbdrive. This only has to be done once, as you won’t be deleting this folder. This folder will be your mount point for the external hard drive.



The second line mounts the device at the /dev/sda1 location to the /mnt/usbdrive directory.



Now you can reference your hard drive from the command line using the folder /mnt/usbdrive.



Automount In the Terminal

To have your hard drive mount each time your server is restarted, you must edit your /etc/fstab file. Simply add at the bottom of your /etc/fstab file:



/dev/sda1 /mnt/usbdrive ext3 defaults 0 0



The first argument (/dev/sda1) tells the system what device to mount, and the second argument (/mnt/usbdrive) tells the system where to mount it. The third argument is the filesystem type (ext3). The fourth argument (defaults) tells the system what options to apply to the device, so in this case we’ll just use the defaults. The fifth and sixth arguments (both zeros) tell the system if the filesystem should be backed up using the dump utility, and the second zero tells the system whether to process the device when fsck is run. We can leave them both to zero for now.



Now you have a mounted hard drive that you can use for all your company backups, and by reading our previous two articles you can setup a script to automate your backup.

วันอังคารที่ 23 พฤศจิกายน พ.ศ. 2553

moodle online txt

http://tracker.moodle.org/browse/MDL-19299

add new harddisk drive onto ubuntu

http://www.techotopia.com/index.php/Adding_a_New_Disk_Drive_to_an_Ubuntu_Linux_System

Getting Started


This tutorial assumes that the new physical hard drive has been installed on the system and is visible to the operating system. The best way to do this is to enter the system BIOS setup during the boot process and ensure that the BIOS sees the disk drive. Sometimes the BIOS will provide a menu option to scan for new drives. If the BIOS does not see the disk drive double check the connectors and jumper settings (if any) on the drive.



[edit] Finding the New Hard Drive in Ubuntu

Assuming the drive is visible to the BIOS it should automatically be detected by the operating system. Typically, the disk drives in a system are assigned device names beginning hd or sd followed by a letter to indicate the device number. For example, the first device might be /dev/sda, the second /dev/sdb and so on.



The following is output from a system with only one physical disk drive:



ls /dev/sd*

/dev/sda /dev/sda1 /dev/sda2 /dev/sda5

This shows that the disk drive represented by /dev/sda is itself divided into three partitions, represented by /dev/sda1, /dev/sda2 and /dev/sda5.



The following output is from the same system after a second hard disk drive has been installed and detected by the operating system:



ls /dev/sd*

/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb

As shown above, the new hard drive has been assigned to the device file /dev/sdb. At this point the drive has no partitions shown (because we have yet to create any).



[edit] Creating Linux Partitions

The next step is to create one or more Linux partitions on the new disk drive. This is achieved using the fdisk utility which takes as a command-line argument the device to be partitioned (in this case /dev/sdb):



sudo fdisk /dev/sdb

[sudo] password for johndoe:

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0xc2fe324b.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.



Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)



Command (m for help):

In order to view the current partitions on the disk enter the p command:



Command (m for help): p



Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xc2fe324b



Device Boot Start End Blocks Id System



As we can see from the above fdisk output, the disk currently has no partitions because it is a previously unused disk. The next step is to create a new partition on the disk, a task which is performed by entering n (for new partition) and p (for primary partition):



Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4):

In this example we only plan to create one partition which will be partition 1. Next we need to specify where the partition will begin and end. Since this is the first partition we need it to start at cylinder 1 and since we want to use the entire disk we specify the last cylinder as the end. Note that if you wish to create multiple partitions you can specify the size of each partition by cylinders, bytes, kilobytes or megabytes.



Partition number (1-4): 1

First cylinder (1-261, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):

Using default value 261

Now that we have specified the partition we need to write it to the disk using the w command:



Command (m for help): w

The partition table has been altered!



Calling ioctl() to re-read partition table.

Syncing disks.

If we now look at the devices again we will see that the new partition is visible as /dev/sdb1:



ls /dev/sd*

/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb /dev/sdb1

Now that the disk has been successfully partitioned, the next step is to create a file system on our new partition.



[edit] Creating a Filesystem on an Ubuntu Disk Partition

We now have a new disk installed, it is visible to Ubuntu and we have configured a Linux partition on the disk. The next step is to create a Linux file system on the partition so that the operating system can use it to store files and data. The easiest way to create a file system on a partition is to use the mkfs.ext3 utility which takes as arguments the label and the partition device:



sudo mkfs.ext3 -L /photos /dev/sdb1

mke2fs 1.40.2 (12-Jul-2007)

Filesystem label=/photos

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

262144 inodes, 524112 blocks

26205 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912



Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done



This filesystem will be automatically checked every 28 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.



[edit] Mounting a Filesystem

Now that we have created a new file system on the Linux partition of our new disk drive we need to mount it so that it is accessible. In order to do this we need to create a mount point. A mount point is simply a directory into which the file system will be mounted. For the purposes of this example we will create a /photos directory to match our file system label (although it is not necessary that these values match):



sudo mkdir /photos

The file system may then be manually mounted using the mount command:



sudo mount /dev/sdb1 /photos

Running the mount command with no arguments shows us all currently mounted file systems (including our new file system):



mount

/dev/sda1 on / type ext3 (rw,errors=remount-ro)

proc on /proc type proc (rw,noexec,nosuid,nodev)

/sys on /sys type sysfs (rw,noexec,nosuid,nodev)

varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)

varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)

udev on /dev type tmpfs (rw,mode=0755)

devshm on /dev/shm type tmpfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)

securityfs on /sys/kernel/security type securityfs (rw)

/dev/sdb1 on /photos type ext3 (rw)

[edit] Configuring Ubuntu to Automatically Mount a Filesystem

In order to set up the system so that the new file system is automatically mounted at boot time, an entry needs to be added to the /etc/fstab file. This may be edited by issuing the following command in a terminal window:



sudo gedit /etc/fstab

The following example shows an /etc/fstab file configured to automount our /photos partition:



# /etc/fstab: static file system information.

#

#

proc /proc proc defaults 0 0

# /dev/sda1

UUID=4a621e4d-8c8b-4b39-8934-98ab8aa52ebc / ext3 defaults,errors=remount-ro 0 1

# /dev/sda5

UUID=9c82bf09-c6f7-4042-8927-34e46518b224 none swap sw 0 0

/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0

/dev/fd0 /media/floppy0 auto rw,user,noauto,exec 0 0

/dev/sdb1 /photos auto defaults 0 0

Thin disk

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1005418

วันจันทร์ที่ 22 พฤศจิกายน พ.ศ. 2553

NFS

Install NFS Server in Ubuntu




sudo apt-get install nfs-kernel-server nfs-common portmap



When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap using the following



sudo vi /etc/default/portmap



or use the following command



sudo dpkg-reconfigure portmap



Restart Portmap using the following command



sudo /etc/init.d/portmap restart



NFS Server Configuration



NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.



You need to edit the exports file using the following command



sudo vi /etc/exports



Here are some quick examples of what you could add to your /etc/exports



For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255



/files 192.168.1.1/24(rw,no_root_squash,async)



Or for Read Only from a single machine



/files 192.168.1.2 (ro,async)



save this file and exit



A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons.



A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.



Now you need to restart NFS server using the following command



sudo /etc/init.d/nfs-kernel-server restart



If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command



sudo exportfs -a



Install NFS client support in Ubuntu



sudo apt-get install portmap nfs-common



This will install all the required packages for nfs client



Mounting manually



Example to mount server.mydomain.com:/files to /files. In this example server.mydomain.com is the name of the server containing the nfs share, and files is the name of the share on the nfs server



The mount point /files must first exist on the client machine.



Create files directory using the following command



sudo mkdir files



You need to mount the share using the following command



sudo mount server.mydomain.com:/files /files



Now you may need to restart services using the following command



sudo /etc/init.d/portmap restart



sudo /etc/init.d/nfs-common restart



Mounting at boot using /etc/fstab



If you want to mount using fstab file



sudo vi /etc/fstab



In this example my /etc/fstab was like this



server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr



Change “servername.mydomain.com:/files”, and “/files” to match your server name,share name, and the name of the mount point you created.



Firewall Ports for NFS



If you have a firewall you need to make sure ports 32771, 111 and 2049 are open

Testing Your Configuration



Use the following command in terminal to test



mount /files



the mount point /files will be mounted from the server.



Reference



http://czarism.com/easy-peasy-ubuntu-linux-nfs-file-sharing

วันพุธที่ 3 พฤศจิกายน พ.ศ. 2553

access denied

http://isp-control.net/forum/printthread.php?tid=1544
today I finally manage to make things tick. I would like to share my settings here.




dovecot.conf



Code:



base_dir = /var/run/dovecot/

protocols = imap pop3

disable_plaintext_auth = no

listen = *

syslog_facility = mail

log_path = /var/log/dovecot.log

info_log_path = /var/log/dovecot-info.log

auth_debug=yes

auth_debug_passwords=yes

login_greeting = Dovecot ready.

mail_location = maildir:/var/mail/virtual/%d/%n

mail_extra_groups = mail

protocol imap {

}

namespace private {

prefix = INBOX.

inbox = yes

}

protocol pop3 {

pop3_uidl_format = %u-%v

}

protocol lda {

postmaster_address = postmaster@(hidden).com

auth_socket_path = /var/run/dovecot/auth-master

}

auth default {

mechanisms = plain login

passdb sql {

args = /etc/dovecot-sql-domain.conf

}

userdb sql {

args = /etc/dovecot-sql-domain.conf

}

passdb sql {

args = /etc/dovecot-sql-subdomain.conf

}

userdb sql {

args = /etc/dovecot-sql-subdomain.conf

}

socket listen {

client {

path = /var/spool/postfix/private/auth

mode = 0660

user = postfix

group = postfix

}

master {

path = /var/run/dovecot/auth-master

mode = 0660

user = vmail

group = mail

}

}

user = vmail

}

plugin {

}



postconf -n





Code:



alias_database = hash:/etc/aliases

alias_maps = hash:/etc/aliases

append_at_myorigin = yes

append_dot_mydomain = no

biff = no

broken_sasl_auth_clients = yes

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

debug_peer_level = 2

html_directory = no

inet_interfaces = all

local_destination_recipient_limit = 1

local_recipient_maps = unix:passwd.byname $alias_database

local_transport = local

mail_owner = postfix

mail_spool_directory = /var/mail

mailbox_command = procmail -a "$EXTENSION"

mailbox_size_limit = 0

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, $mydomain

mydomain = (hidden).com

myhostname = localhost.(hidden).com

mynetworks_style = host

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases.postfix

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

sample_directory = /usr/share/doc/postfix-2.3.3/samples

sendmail_path = /usr/sbin/sendmail.postfix

setgid_group = postdrop

smtpd_banner = $myhostname ISPCP 1.0 Priamos Managed ESMTP 1.0.0 RC2 OMEGA

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_authenticated_header = yes

smtpd_sasl_path = private/auth

smtpd_sasl_security_options = noanonymous

smtpd_sasl_type = dovecot

smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

transport_maps = hash:/etc/postfix/ispcp/transport

unknown_local_recipient_reject_code = 550

virtual_alias_maps = hash:/etc/postfix/ispcp/aliases

virtual_gid_maps = static:12

virtual_mailbox_base = /var/mail/virtual

virtual_mailbox_domains = hash:/etc/postfix/ispcp/domains

virtual_mailbox_limit = 0

virtual_mailbox_maps = hash:/etc/postfix/ispcp/mailboxes

virtual_minimum_uid = 12004

virtual_transport = dovecot

virtual_uid_maps = static:12004



*note: gid & uid has been changed to the vmail uid & mail gid. Please update uid & gid in your dovecot-sql-domain.conf and dovecot-sql-subdomain.conf too if it's different.



for Fedora Core 6 (that I use), please change the given code in HowTo to the code below. It solves your unknown transport error.



Code:



dovecot unix - n n - - pipe

flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -d ${recipient}

*note: argv=/usr/lib/dovecot/deliver changed to argv=/usr/libexec/dovecot/deliver



and on the client (Outlook etc.) please tick on "My outgoing server (SMTP) requires authentication" under Outgoing Server in advanced setting. Please refer to your version on setting this.



The rest of the setting on Postfix is the default setting upon installation. I manage to solve this by uninstalling Postfix & re-install Postfix and edit the default /etc/postfix/main.cf based on values given in /etc/ispcp/postfix/main.cf. If you have installed ispCP then uninstall the Postfix, your main.cf & master.cf will be backed up with main.cf.rpmsave & master.cf.rpmsave.



Now, i'm going to solve the webmail issue



Quote:Error opening ../data/default_pref

Could not create initial preference file!

../data/ should be writable by user apache

Please contact your system administrator and report this error.



gonna check Squrrelmail FAQ for this.





--------------------------------------------------------------------------------

RE: 554 5.7.1 Relay access denied - joximu - 10-20-2007 06:24 PM



Could you change the title to "[solved] ..."



and for the other issue make a new thread...



/Joxi





--------------------------------------------------------------------------------

[solved] RE: 554 5.7.1 Relay access denied - measaura - 10-20-2007 10:15 PM



Thanks for your guidance.



This case is closed. webmail issue on other thread.