# Clock messed up when dual booting

The problem:

• Linux store the time on the hardware clock as UTC by default
• Windows store the time on the hardware clock as the local time by default

Since both operating systems access the hardware clock you may encounter problems when you dual boot between them.

A comment for the geeks:

The advantage of having the hardware clock as UTC is that you don’t need to change the hardware clock when moving between timezones or when Daylight Savings Time (DST) begins or ends as UTC does not have DST or timezone offsets.

#### Changing Windows to use UTC

If you dual boot Windows and Linux/MAC and the clock is messed up after each boot, you should either :

1. run regedit
2. navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
3. add key RealTimeIsUniversal as DWORD and set it’s value to 1.
4. disable Windows time service:
sc config w32time start= disabled

You can download a REG script that performs the first 3 steps from here but you will have to perform the last step (disable the service) manually.

#### Changing Linux to use local time

Pre-Ubuntu 15.04 systems (e.g. Ubuntu 14.04 LTS):

1. edit /etc/default/rcS
2. add or change the following section
# Set UTC=yes if your hardware clock is set to UTC (GMT) UTC=no

Ubuntu 15.04 systems and above (e.g. Ubuntu 16.04 LTS):

1. open a terminal and execute the following command
timedatectl set-local-rtc 1

References:

# Grub – Remember last choice

A neat feature of grub2 is that you can set it up so that it remembers your last choice of the last boot.

1 – Edit the grub configuration file

sudo gedit /etc/default/grub

2 – add the following lines:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

3 – update grub file

sudo update-grub

# Where is my JDK?

You can easily find with this command:

update-java-alternatives -l

# Firefox – rounded corners

I don’t know what there guys where thinking, but in my opinion the new square tabs are simply horrible.

Here is a solution to change square tabs to rounded tabs again:

1. Go to your Firefox browser, type about:profiles in your url bar.
2. Under the profile that is in use, open the Root Directory folder.
3. If that folder does not have a chrome folder, create a folder, name it chrome.
4. In the chrome folder, create a file named userChrome.css
5. Copy and paste the code that matches your Firefox theme. Dark, Default, Light
6. Restart Firefox and enjoy some sexy curves

References:

https://github.com/wilfredwee/photon-australis

# Restart/shutdown linux with magic (REISUB)

To restart your system, press alt + Printscreen/SysRq. Then, while holding those keys, slowly type the keys  R E I S U B (one key at a time, requires QUERTY keyboards). You can find a list of all SysRq keys here which includes key presses for other keyboard layouts.

To define the mode of SysRq you should edit the file: /etc/sysctl.d/10-magic-sysrq.conf . That file includes details of various levels of SysRq.

Here is an example of it’s contents:

# 0 - disable sysrq completely
# 1 - enable all functions of sysrq
# >1 - enable certain functions by adding up the following values:
# 2 - enable control of console logging level
# 4 - enable control of keyboard (SAK, unraw)
# 8 - enable debugging dumps of processes etc.
# 16 - enable sync command
# 32 - enable remount read-only
# 64 - enable signalling of processes (term, kill, oom-kill)
# 128 - allow reboot/poweroff
# 256 - allow nicing of all RT tasks

A recommended value is 64 because it permits you to use oom kill which is very useful.

Here is a short explanation for reboot (not all keys will work, as it depends on the value you have defined in  /etc/sysctl.d/10-magic-sysrq.conf file) :

• R: Switch the keyboard from raw mode to XLATE mode
• E: Send the SIGTERM signal to all processes except init
• I: Send the SIGKILL signal to all processes except init
• S: Sync all mounted filesystems
• U: Remount all mounted filesystems in read-only mode
• B: Immediately reboot the system, without unmounting partitions or syncing

Here is a short explanation for shutdown:

• R: Switch the keyboard from raw mode to XLATE mode
• E: Send the SIGTERM signal to all processes except init
• I: Send the SIGKILL signal to all processes except init
• S: Sync all mounted filesystems
• U: Remount all mounted filesystems in read-only mode
• O: Immediately shutdown the system, without unmounting partitions or syncing

Here is a cool mnemonic:

• R – Reboot
• E – Even
• I – If
• S – System
• U – Utterly
• B – Broken

References:

http://blog.kember.net/articles/reisub-the-gentle-linux-restart/

https://en.wikipedia.org/wiki/Magic_SysRq_key

# Install XDEBUG to XAMPP

We assume xampp is at e:\xampp.

3. Edit php.ini and disable output buffering.
4. Add the code at the end of the page to php.ini (at xampp directory)
5. Restart apache

# Syntax highlighing in Moodle

The main idea is that we need syntax highlighting to quiz questions.

Here are the requirements:

1. a plugin that is updated frequently, preferable by more than 1 person.
2. support for syntax highlighting to as many languages as possible, not only in editing mode within the editor but in the view mode of questions, pages etc.
3. it has to be free.
4. it is better that it is accessible from the buttons of the editor so that it is easily accessible from students who want to create quiz content.
5. it should support moodle 3.3+

# Question creator role in moodle

The role of Question creator may be used to enable students to create questions for use in quizzes.

Warning: Capabilities with XSS risks associated to them are allowed for the role of question creator. Thus, this role should be assigned with care.