Browsed by
Category: Problem Solving

Moodle 4 : Focus error fix (atto plugins)

Moodle 4 : Focus error fix (atto plugins)

I was hitting upon an error in one of my atto plugins whenever I clicked on a button in my dialogue form. It also appears when you use the Atto Styles button on the toolbar.

Uncaught RangeError: Maximum call stack size exceeded.

This appears to be a known bug see tracker

Using the information given by Jake Dallimore in the comments I added the following to my _displayDialogue function in my YUI module.

require(['core/local/aria/focuslock'], function(FocusLockManager) {
	// We don't want to trap focus.
	FocusLockManager.untrapFocus();
});

From the comments it seems as though what’s happening is we are ending up with two active focuses when there should just be one. The code seems to work by untrapping the focus when the dialogue is opened so that there is only one again

Bulk Delete Multiple Events from Outlook

Bulk Delete Multiple Events from Outlook

I made a mistake recently while making an ical script and when I was testing it the script I accidentally created thousands of test events in my calendar. If this ever happens to anyone else here’s how to bulk delete events.

  1. Go to the Outlook Calendar
  2. Go to “view” and select “List”
  3. Order the events by subject
  4. Using shift select the entire block of events you want to delete
  5. hit delete and confirm
MS Word Regex Pattern

MS Word Regex Pattern

A wee pattern to strip out MS word nonsense from pasted in text.

(<[\/]?span[a-zA-Z0-9\',\.\#\:\;\%\{\s="\-\(\)]*>| |data-leveltext="[]"[\s]?|data-font="[a-zA-Z]*"[\s]?|data-listid="[0-9]*"[\s]?|data-list-defn-props="{"[\s]?|data-aria-posinset="[0-9]"[\s]?|data-aria-level="[0-9]"[\s]?|class="[A-Za-z]*"[\s]?|style="[a-z0-9\-\:\;\.\%,\s]*"[\s]?|class="[A-Za-z0-9\s]*"[\s]?|·)

View example

// Anti MS Word Pattern
$antiword = '/(<[\/]?span[a-zA-Z0-9\',\.\#\:\;\%\{\s="\-\(\)]*>| |data-leveltext="[]"[\s]?|data-font="[a-zA-Z]*"[\s]?|data-listid="[0-9]*"[\s]?|data-list-defn-props="{"[\s]?|data-aria-posinset="[0-9]"[\s]?|data-aria-level="[0-9]"[\s]?|class="[A-Za-z]*"[\s]?|style="[a-z0-9\-\:\;\s]*"[\s]?|class="[A-Za-z0-9\s]*"[\s]?|·)/i';

$text = preg_replace($antiword, "", $text);
' Anti MS Word
DIM pattern AS string = "(<[\/]?span[a-zA-Z0-9\',\:\;\%\{\s=""\-\(\)]*>| |data-leveltext=""[]""[\s]?|data-font=""[a-zA-Z]*""[\s]?|data-listid=""[0-9]*""[\s]?|data-list-defn-props=""{""[\s]?|data-aria-posinset=""[0-9]""[\s]?|data-aria-level=""[0-9]""[\s]?|class=""[A-Za-z]*""[\s]?|style=""[a-z0-9\-\:\;\s]*""[\s]?|class=""[A-Za-z0-9\s]*""[\s]?|·)"
Dim regex AS regex = new Regex(pattern)

text = Regex.Replace(text, pattern, "")
Removing OSX “This resource fork intentionally left blank” message

Removing OSX “This resource fork intentionally left blank” message

Had an odd problem when editing a file locally where the following text started appearing everywhere:

Mac OS X  2ATTR com.apple.lastuseddate#PS&|o^6This resource fork intentionally left blank

After a bit of searching via Google I found out that this is caused by the finder of Mac OS creating an ._ file.

I tried to view these via CMD + SHIFT + . 

But nothing showed up. 

In terminal however if I used

$ ls -la 

It listed the ._ files

All I had to do then was run

$ rm ._tabs.php 

This solved the issue.