## macbook pro – Issue with Microsoft Word on Mac

Hopefully, this is the right site for this. I am using a 2020 MacBook Pro and Word 2016. I am having issues opening a document sent by a friend. He is able to open it, and this problem does not occur when I try to open files that originated on my computer. When I try to open the document, I get the following error message:

Word experienced an error trying to open the file.
Try these suggestions.
* Check the file permissions for the document or drive.
* Make sure there is sufficient free memory and disk space.
* Open the file with the Text Recovery converter.

To resolve this, I tried having my friend paste the contents of the document into a new document, but I also wasn’t able to open that file. Here’s what I tried regarding the specific suggestions.

Check the file permissions for the document or drive.

I checked and the file is totally accessible, read-write enabled, Word has access to the folder it’s in (just the Desktop), etc.

Make sure there is sufficient free memory and disk space.

I just got a new computer and have 1.88 terabytes of space left, so definitely not a problem here.

Open the file with the Text Recovery converter.

In Word, I went to File>Open and selected the document. In the bottom-right corner of the window, I went to the drop-down that said “Open Original” and instead selected “Open Recover Text.” The file it produced is blank except for the words “Error serving file.” I also tried the “Open Repair” option in the drop-down menu, but that gave the same error as before.

Something else that might be relevant is that the files were sent through Slack, and the Slack preview worked on the document, but the Mac QuickLook preview does not work on the document (it just shows the document icon instead of a preview of the contents).

Any help would be greatly appreciated. Thanks!

## c++ – LeetCode 212: Word Search II

I’m posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time!

### Problem

Given a 2D board and a list of words from the dictionary, find all
words in the board.

Each word must be constructed from letters of sequentially adjacent
cell, where “adjacent” cells are those horizontally or vertically
neighboring. The same letter cell may not be used more than once in a
word.

### Example:

``````Input:  board = (
('o','a','a','n'),
('e','t','a','e'),
('i','h','k','r'),
('i','f','l','v')
)
words =
("oath","pea","eat","rain")

Output: ("eat","oath")
``````

Note:

• All inputs are consist of lowercase letters a-z.
• The values of words are distinct.

### Code

``````#include <vector>
#include <string>
#include <set>

class Solution {
static constexpr unsigned int A_LOWERCASE = 'a';
static constexpr unsigned int ALPHABET_SIZE = 26;

private:
class TrieNode {
public:
std::vector<TrieNode *> children;
bool is_word;

TrieNode() {
is_word = false;
children = std::vector<TrieNode *>(ALPHABET_SIZE, NULL);
}
};

class Trie {
public:
TrieNode *get_parent() {
return parent;
}

Trie(const std::vector<std::string> &words) {
parent = new TrieNode();

for (unsigned int index = 0; index < words.size(); index++) {
set_word(words(index));
}
}

void set_word(const std::string &word) {
TrieNode *curr = parent;

for (unsigned int length = 0; length < word.size(); length++) {
unsigned int index = word(length) - A_LOWERCASE;

if (curr->children(index) == NULL) {
curr->children(index) = new TrieNode();
}

curr = curr->children(index);
}

curr->is_word = true;
}

private:
TrieNode *parent;

};

public:
std::vector<std::string> findWords(std::vector<std::vector<char>> &board, std::vector<std::string> &words) {
Trie *trie = new Trie(words);
TrieNode *parent = trie->get_parent();
std::set<std::string> found_words;

for (unsigned int row = 0; row < board.size(); row++) {
for (unsigned int col = 0; col < board(0).size(); col++) {
depth_first_search(board, row, col, parent, "", found_words);
}
}

std::vector<std::string> structured_found_words;

for (const auto found_word : found_words) {
structured_found_words.push_back(found_word);
}

return structured_found_words;
}

private:

static void depth_first_search(std::vector<std::vector<char>> &board, const unsigned int row, const unsigned int col, const TrieNode *parent, std::string word, std::set<std::string> &structured_found_words) {
if (row < 0 || row >= board.size() || col < 0 || col >= board(0).size() || board(row)(col) == ' ') {
return;
}

if (parent->children(board(row)(col) - A_LOWERCASE) != NULL) {
word = word + board(row)(col);
parent = parent->children(board(row)(col) - A_LOWERCASE);

if (parent->is_word) {
structured_found_words.insert(word);
}

char alphabet = board(row)(col);
board(row)(col) = ' ';
depth_first_search(board, row + 1, col, parent, word, structured_found_words);
depth_first_search(board, row - 1, col, parent, word, structured_found_words);
depth_first_search(board, row, col + 1, parent, word, structured_found_words);
depth_first_search(board, row, col - 1, parent, word, structured_found_words);
board(row)(col) = alphabet;
}
};
};

``````

### Reference

LeetCode has a template for answering questions. There is usually a class named `Solution` with one or more `public` functions which we are not allowed to rename. For this question, the template is:

``````class Solution {
public:
vector<string> findWords(vector<vector<char>>& board, vector<string>& words) {

}
};
``````

## functions – Replace word in “the_content” only for index.php

I have some posts with video tag that contains autoplay (they should autoplay when you access the post page).

I am using the `the_content` to show these videos on index page.

The problem is that when you access the home page, all the videos start playing.

I have used the following function to remove it:

``````function replace_ap(\$text){
\$replace = array(
'autoplay=""' => ''
);
\$text = str_replace(array_keys(\$replace), \$replace, \$text);
return \$text;
}

``````

but now the “autoplay” attribute is removed from the post pages also.

How can I remove it only from the index ?

My thought was to create a function that gets the content and add the filter to this function, then call it from index.php instead of “the_content”, but I don’t know how or if it’s possible

Thank you!

## How to get consistent spacing from the body to the footer in Microsoft Word?

I am writing here to see if anyone can help me out with a spacing issue at the bottom of pages in Microsoft Word.

It appears that the spacing between the body and the footer changes on different pages. For example, sometimes Word allows an extra line of the body paragraph to fit onto the page while in other instances it simply pushes it onto the next page, thus making the spacing inconsistent across pages.

Is there any way to systematically make the spacing uniform by setting limits in the settings?

I’ve attached a few screenshots that demonstrate this inconsistency in spacing across pages to help show what I’m talking about.
Screenshot One

Screenshot Two

## python – Exercism: determine if a word or phrase is an isogram

Determine if a word or phrase is an isogram.
An isogram (also known as a “nonpattern word”) is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.

Examples of isograms:

• lumberjacks
• background
• downstream
• six-year-old

The word isograms, however, is not an isogram, because the s repeats.

Even though I’m aware that questions about isograms have already been posted, in this variation of the problem spaces and hyphens are allowed to appear multiple times so that you can not use a solution such as `len(string) == len(set(string))`

What bothers me about my solution is hardcoding bounds of `ascii` character ranges and using `collections` library for such a small problem. I’m wondering if there is a better way to do it.

Here is my code:

``````from collections import Counter

ASCII_LOWER_BOUND = 97
ASCII_UPPER_BOUND = 123

def is_isogram(string):
char_counts = Counter(string.lower())
return all(
char_counts(char) == 1
for char in char_counts
if ord(char) in range(ASCII_LOWER_BOUND, ASCII_UPPER_BOUND + 1)
)
``````

And a test suite provided by exercism:

``````import unittest

from isogram import is_isogram

# Tests adapted from `problem-specifications//canonical-data.json` @ v1.7.0

class IsogramTest(unittest.TestCase):
def test_empty_string(self):
self.assertIs(is_isogram(""), True)

def test_isogram_with_only_lower_case_characters(self):
self.assertIs(is_isogram("isogram"), True)

def test_word_with_one_duplicated_character(self):
self.assertIs(is_isogram("eleven"), False)

def test_word_with_one_duplicated_character_from_the_end_of_the_alphabet(self):
self.assertIs(is_isogram("zzyzx"), False)

def test_longest_reported_english_isogram(self):
self.assertIs(is_isogram("subdermatoglyphic"), True)

def test_word_with_duplicated_character_in_mixed_case(self):
self.assertIs(is_isogram("Alphabet"), False)

def test_word_with_duplicated_character_in_mixed_case_lowercase_first(self):
self.assertIs(is_isogram("alphAbet"), False)

def test_hypothetical_isogrammic_word_with_hyphen(self):
self.assertIs(is_isogram("thumbscrew-japingly"), True)

def test_hypothetical_word_with_duplicated_character_following_hyphen(self):
self.assertIs(is_isogram("thumbscrew-jappingly"), False)

def test_isogram_with_duplicated_hyphen(self):
self.assertIs(is_isogram("six-year-old"), True)

self.assertIs(is_isogram("Emily Jung Schwartzkopf"), True)

def test_duplicated_character_in_the_middle(self):
self.assertIs(is_isogram("accentor"), False)

def test_same_first_and_last_characters(self):
self.assertIs(is_isogram("angola"), False)

if __name__ == "__main__":
unittest.main()
$$```$$
``````

## Problem

For given list of words check if all the words can be arrange to form a chain. Any word can be linked to the next if the last char matches with the first character of the another Word. For eg . `(hello, org, games, salvin)` is valid chain.

## Code

``````import java.util.*;
import java.util.stream.*;
public class Solution {

private char lastChar(String s)
{
return s.charAt(s.length() -1);
}

private char firstChar(String s)
{
return s.charAt(0);
}
Map<String, List<String>> map;
public List<String> graph(List<String> list)
{
map = new HashMap<>();

// complete graph
for (String string : list) {

map.put(string, new ArrayList<>());
}

for (String string : list) {
List<String> tmp = list.stream().filter(e-> !e.equals(string)).collect(Collectors.toList());
}
// System.out.println(map);

Set<String> visited = new HashSet<>();
List<String> path = new ArrayList<>();
F: for (String curr : list) {
dfs(curr, visited,path);
// System.out.println(path);
if(path.size() >= map.size())
{
break F;
// return path;
}
// System.out.println(path);
path.clear();
visited.clear();
}
// System.out.println(new ArrayList(visited));
// System.out.println("->"+path);
return path;
}

void dfs(String curr, Set<String> visited, List<String> path)
{
if(visited.size() >= map.size())
return;

List<String> neighbors = map.get(curr);
for(String s: neighbors)
{
if( lastChar(curr) == firstChar(s) && !visited.contains(s))
{
dfs(s, visited,path);
}
}
}

public static void main(String() args) {

WordList obj = new WordList();
// "Hello","org","games","salvin"
obj.graph(Arrays.asList("salvin", "org", "hello", "games"));
// Alice Emilia Aashish Hendricks Somi Isha
List<String> lis = Arrays.asList("alice" ,"mmilia", "taashish" ,"khenndricks" ,"jsomi", "zisha");
lis.sort(Comparator.naturalOrder());
// List<String> lis = Arrays.asList("Alice","A")
// Collections.shuffle(lis);
// System.out.println(lis);
// obj.graph(lis);
System.out.println(obj.graph(lis));

// obj.nextPermutation(lis);
lis = Arrays.asList("james","sera","amen","nehak","kily","yen");
Collections.sort(lis);
// System.out.println(lis);
System.out.println(obj.graph(lis));

}
}
``````

## Review

I would like review on

• Efficiency
• Code Quality
• Efficient use of library functions
• Performance

Also let me know if I can use any java 8 functions for specific task without hard coding it.

thanks.

## How do I remove a list in Microsoft Word?

I have a huge Microsoft Word document, in which for some reason, random lines throughout the document got added to a list. It mostly got applied to equations, but sometimes the list got applied to random sentences as well. Here’s an example:

I’d like to remove the entire list – that is, not erase the text, but remove the numbers from all the lines which got added to the list.

How would I do so, without going through them one by one? Thanks!

## microsoft word – How to let title number include seperated text boxes?

I am writing my thesis and headers are numbered like 1.2 or 1.2.1 etc which is a pretty easy thing to set.

But when my header 1 is set in a textbox, the counting does not include this header anymore.

Image below shows what I mean

How do I make my default Word chapter numbering include these headings in seperated textboxes?

What I have tried so far:

• Working with fields
• Manually setting the multiple level list counting (flopped twice, conflicts with word’s own counting?)

## windows server 2012 r2 – Word Opens FIRST document slowly over DFS

When opening Word documents over a DFS share, the FIRST time the computer opens the document it takes 30 seconds. If I leave a document open, all future documents open very quickly. If I open documents DIRECTLY from the network share, they always open quickly, first time and all times. Only when opening a document the FIRST TIME over DFS, does it open slowly. Running Word 2019 on Windows 10, DFS on Server 2012 R2.

I’ve already disabled all ADD-INS, AV, checked TRUST SETTINGS etc. Its definitely related to DFS.

## linux – ‘grep’ command not highlighting User input word in the Search result

I am trying to write shell script as below to search user inputted word and highlight the word in the search result –

echo -n -e “What you wanna search:”