Plugin ini tergolong sudah tua, latest release saat tulisan ini dibuat adalah 4 tahun yang lalu. Walaupun demikian plugins ini
LMS Moodle
Enlightlite bugs resolve
Moodle specification:Version 3.9.x, 3.10.xTheme: Enlightlite changing in enlightlite/classes/core/course_renderer.phpsearch: top_course_menu
Custom Moodle User Profile Page
Follow these steps to customize the user profile page. 1. Go to theme/config.php file and find this code. //
Export Pertanyaan/Question Dalam Format Ms WORD di Moodle 2.7
Bagaimana meng-export pertanyaan di Moodle (termasuk gambar jika ada) dalam formasi Microsoft Word ? Yang perlu kita lakukan adalah 2
Moodle 2014
Moodle adalah sebuah software berbasis teknologi web yang ditulis dengan bahasa pemrograman PHP untuk mendukung sistem pembelajaran online (online courses).
MySQL
mysqldump in practice
Default Kasus #1 File backup yang dihasilkan: Kasus #2 – replace File backup yang dihasilkan: Kasus #3 – dump table
Statistics
Variabel Acak Geometri (Geometric Random Variables)
Misalkan ada suatu percobaan yang independent . Setiap kali percobaan itu akan memiliki kemungkinan sukses (probabilitas) sebesar p. Jika X
All subject
Resize Guest Disk Virtual Machine
Ringkasan langkah: 1. Informasi tentang disk image contoh: Terlihat bahwa disk image ada di : /dev/vmdiskpool/vmdisk5 2. Lihat informasi partisi
Resize Guest Disk Virtual Machine
Ringkasan langkah:
- Pastikan lokasi disk image yang akan diperbesar kapasitasnya
- Tentukan cara yang akan digunakan untuk memperbesar VM nya
- Lihat informasi partisi pada disk image,
- Rename disk image lama, buat Disk image baru dengan ukuran yang diinginkan
- Buat disk baru
- Jalankan perintah virt-resize
1. Informasi tentang disk image
# virsh dumpxml <GuestName>
contoh:
# virsh dumpxml Digitos_U22_5
<domain type='kvm'>
<name>Digitos_U22_5</name>
<uuid>0d737f69-3200-440f-8117-8506bacde339</uuid>
<metadata xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0" xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit-machines">
<libosinfo:libosinfo>
<libosinfo:os id="http://ubuntu.com/ubuntu/22.04"/>
</libosinfo:libosinfo>
<cockpit_machines:data>
<cockpit_machines:has_install_phase>false</cockpit_machines:has_install_phase>
<cockpit_machines:install_source_type>file</cockpit_machines:install_source_type>
<cockpit_machines:install_source>/server_images/ubuntu-22.04.3-live-server-amd64.iso</cockpit_machines:install_source>
<cockpit_machines:os_variant>ubuntu22.04</cockpit_machines:os_variant>
</cockpit_machines:data>
</metadata>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-rhel8.6.0'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
<vmport state='off'/>
</features>
<cpu mode='host-model' check='partial'/>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/vmdiskpool/vmdisk5'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</disk>
...
Terlihat bahwa disk image ada di : /dev/vmdiskpool/vmdisk5
2. Lihat informasi partisi pada disk image
# virt-df -h
Misalnya :
# virt-df -h -a /dev/vmdiskpool/vmdisk5
Filesystem Size Used Available Use%
vmdisk5-100g:/dev/sda2 1.7G 130M 1.5G 8%
vmdisk5-100g:/dev/ubuntu-vg/ubuntu-lv
8.0G 4.2G 3.4G 53%
3. Rename disk image
lvrename /dev/vmdiskpool/vmdisk5 /dev/vmdiskpool/vmdisk5.backup
4. Buat Disk baru
# lvcreate -L <new-size>G -n <nama-disk> <disk-pool>/dev/vg_guests
contoh:
# lvcreate -L 100G -n vmdisk5 /dev/vmdiskpool
5. Resize partisi (optional) dan salin partisi lama ke disk image baru
Bagi yang belum terinstall virt-resize, untuk pengguna Ubuntu, Debian dapat memasangnya sbb:
# apt-get install libguestfs-tools
Berikut penggunaannya:
# virt-resize /dev/vmdiskpool/vmdisk5-backup /dev/vmdiskpool/vmdisk5 --resize /dev/sda2=1.8G --expand /dev/sda3 --LV-expand /dev/ubuntu-vg/ubuntu-lv
Output nya kira-kira akan seperti ini:
[ 0.0] Examining /dev/vmdiskpool/vmdisk5-backup
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be resized from 1.8G to 1.8G. The
filesystem ext4 on /dev/sda2 will be expanded using the ‘resize2fs’
method.
/dev/sda3: This partition will be resized from 8.2G to 98.2G. The LVM PV
on /dev/sda3 will be expanded using the ‘pvresize’ method.
/dev/ubuntu-vg/ubuntu-lv: This logical volume will be expanded to maximum
size. The filesystem ext4 on /dev/ubuntu-vg/ubuntu-lv will be expanded
using the ‘resize2fs’ method.
**********
[ 3.7] Setting up initial partition table on /dev/vmdiskpool/vmdisk5
[ 14.9] Copying /dev/sda1
[ 14.9] Copying /dev/sda2
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 18.7] Copying /dev/sda3
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 46.2] Expanding /dev/sda2 using the ‘resize2fs’ method
[ 46.3] Expanding /dev/sda3 using the ‘pvresize’ method
[ 46.3] Expanding /dev/ubuntu-vg/ubuntu-lv using the ‘resize2fs’ method
Resize operation completed with no errors. Before deleting the old disk,
carefully check that the resized disk boots and works correctly.
Reference:
mysqldump in practice
Default
Kasus #1
# mysqldump --no-create-info --complete-insert --insert-ignore pintar_db > pintar_db-20230824-2208.insert-ignore.data
File backup yang dihasilkan:
- tidak memuat perintah CREATE [table “” not found /]
- kalau ada data yang akan di insert, ternyata sudah ada, maka proses insert record data terkait akan di lewatkan
- complete-insert …
Kasus #2 – replace
mysqldump --no-create-info --replace pintar_db > pintar_db-20230827-1554.replace.data
File backup yang dihasilkan:
- tidak memuat perintah CREATE [table “” not found /]
- kalau ada data yang akan di insert, ternyata sudah ada, maka data tersebut akan direplace oleh data yang baru datang
Kasus #3 – dump table tertentu
Jika Anda akan dumping tabel-tabel t1, t2, dan t3 dari mydb:
mysqldump -u... -p... mydb t1 t2 t3 > mydb_tables.sql
Sebaliknya, Jika Anda akan dumping semua tabel kecuali tabel-tabel t1, t2, dan t3 dari mydb:
DBTODUMP=mydb
SQL="SET group_concat_max_len = 10240;"
SQL="${SQL} SELECT GROUP_CONCAT(table_name separator ' ')"
SQL="${SQL} FROM information_schema.tables WHERE table_schema='${DBTODUMP}'"
SQL="${SQL} AND table_name NOT IN ('t1','t2','t3')"
TBLIST=`mysql -u... -p... -AN -e"${SQL}"`
mysqldump -u... -p... ${DBTODUMP} ${TBLIST} > mydb_tables.sql
Note: Anda dapat mengubah SQL="${SQL} AND table_name NOT IN ('t1','t2','t3')"
to SQL="${SQL} AND table_name NOT LIKE 'foo\_%'"
. Anda juga dapat mengganti kondisi menjadi ‘%foo%’ untuk mendapatkan semua table yang menggandung kosa-kata ‘foo’ dalam nama tabelnya (termasuk didalamnya seperti: ‘food’, ‘fool’, dst).
Kasus #4 – ignore table(s)
Cara lain jika Anda akan dumping semua tabel kecuali tabel-tabel t1, t2, dan t3 dari mydb:
mysqldump -uusername -ppassword dbname \
--ignore-table=schema.t1 \
--ignore-table=schema.t2 \
--ignore-table=schema.t3 > mysqldump.sql
File backup yang dihasilkan:
- Semua table di dump tapi tidak akan dumping table t1,t2 dan t3
References:
How To Fix External Hard Disk Not Detecting In Windows
Extend a Linux file system after resizing a volume
Bulk Backup dan Restore
Plugin ini tergolong sudah tua, latest release saat tulisan ini dibuat adalah 4 tahun yang lalu. Walaupun demikian plugins ini tetap bisa digunakan, walaupun Anda tetap perlu memastikannya.
Plugin yang digunakan : Backup and Restore Command-Line Interface
Admin tools ::: tool_brcli
Plugin site : BrCLI
Tujuan penggunaan:
Melakukan backup dan restore courses yang berada pada/ke sebuah course category.
Courses yang berada pada category yang dipilih akan dibuat backup sebuah file *mbz untuk masing-masing course
Sedangkan untuk restore, file-file course-backup (*.mbz) harus berada pada sebuah direktory/folder tertentu dan akan menuju ke category_id tertentu pula
User dan Role di Postgresql
Pengertian role di postgresql
Roles ini berbeda dengan pengertian role di sistem operasi Unix. Disini tidak ada pembedaan antara users dan groups. Roles dapat diubah-ubah, dan lebih flexible. Misalnya role dapat menjadi anggota dari role yang lain. Role juga dapat memiliki objek dan access control terhadap object2 tersebut. Secara default setiap user memiliki role sendiri.
Melihat user yang sudah ada :
postgres=# SELECT rolname FROM pg_roles; rolname ---------- postgres (1 row)
Sebuah role adalah entitas yang dapat memiliki objek database, dan memiliki wewenang terhadap database. Role juga dapat dianggap seperti sebuah “user”, sebuah “group” atau keduanya sekaligus tergantung bagaimana menggunakannya.
Membuat user baru artinya sama dengan membuat role baru :
postgres=# CREATE ROLE admin; CREATE ROLE postgres=# SELECT rolname FROM pg_roles; rolname ---------- postgres admin (2 rows)
Sekarang terlihat sudah ada 2 buah user/role : postgres dan admin.
Memberikan password pada user/role :
postgres=# ALTER ROLE admin WITH PASSWORD 'adminpassword'; ALTER ROLE
Perintah praktis rsync
Syntax dasar perintah rsync
# rsync options source destination
Beberapa opsi (options) dari perintah rsync yang dapat kita manfaatkan, antara lain
- -v : verbose
- -r : copy data hingga ke subdirektori terdalam tapi tidak merubah waktu dan permission
- -a : modus pengarsipan (archive mode), menyalin/copy secara rekursif (hingga direktori2 di bawahnya) dan menyesuaikan Symbolic links, file permission serta user& group ownership dan waktu/timestamps. timestamps.
- -z : compress file data.
- -h : human-readable, output numbers in a human-readable format.
- –dry-run : kalau menggunakan ini maka perintah di jalankan hanya dalam modus simulasi, tidak dieksekusi sesungguhnya
- — progress : untuk menampilkan progress dari proses synchronization
Contoh copy secara lokal server
rsync -zvh contoh.tar.gz /tmp/backups/
Contoh 1 copy ke remote server
rsync -avzh /root/rpmpkgs root@192.168.0.141:/direktoritujuan
Jika file yang akan dicopy berukuran cukup besar, maka apabila proses copy terputus ditengah jalan, jangan khawatir, rsync akan meneruskan atau melanjutkan sisa yang belum tercopy .
Contoh 2 copy ke remote server
rsync -avu --progress /var/www/moodle-data digitos@103.167.113.106:/data/
Perintah ini akan membuat direktori moodle-data di bawah direktori /data pada tempat tujuan copy, sekaligus menyalin seluruh isinya
Contoh 3 copy ke remote server
rsync -avu --progress /var/www/moodle-data/ digitos@103.167.113.106:/data/
Perintah ini tidak akan membuat direktori moodle-data di bawah direktori /data pada tempat tujuan copy, tetapi sekaligus menyalin seluruh isinya direktori moodle-data langsung di dalam direktori /data/
Memperbesar ukuran upload file Apache2
File konfigurasi yang perlu di edit adalah php.ini yang letaknya bisa berbeda tergantung modul php yang digunakan, antara lain:
- /etc/php/7.4/apache/php.ini
- /etc/php/7.4/fpm/php.ini
Versi php dapat disesuaikan
Parameter yang perlu diatur adalah :
post_max_size = 100M
upload_max_filesize = 100M
Besar ukuran dapat diubah sesuai kebutuhan
Jangan lupa setelah itu, web server Apache perlu di restart
$ sudo service apache2 restart
Enlightlite bugs resolve
Moodle specification:
Version 3.9.x, 3.10.x
Theme: Enlightlite
changing in enlightlite/classes/core/course_renderer.php
search: top_course_menu
$sql = "SELECT a.category , a.cnt from ( SELECT category , count(category) as cnt FROM {course} C";
$sql .= " INNER JOIN {course_categories} cc ON cc.id = c.category WHERE category != 0 and c.visible <>1 and cc.visible<>1 group by category ) as a order by a.cnt desc ";
Custom Moodle User Profile Page
Follow these steps to customize the user profile page.
1. Go to theme/config.php file and find this code.
// My public page.
‘mypublic’ => array(
‘file’ => ‘columns2.php’,
‘regions’ => array(‘side-pre’),
‘defaultregion’ => ‘side-pre’,
),
2. Create your custom layout file in layout folder and replace it like below
// My public page.
‘mypublic’ => array(
‘file’ => ‘yourcustomlayout.php’,
‘regions’ => array(‘side-pre’),
‘defaultregion’ => ‘side-pre’,
),3. Create a template file(yourcustom.mustache) in templates folder in theme.
4. in your custom layout php file get all user information and render it on .mustache file like below
echo $OUTPUT->render_from_template(‘theme_custom/mypublic’, $templatecontext);
Reference:
https://moodle.org/mod/forum/discuss.php?d=370809