Split the word file into multiple word documents by renaming each generated VBA .doc document

I hope everybody is fine.
I have a Word document that contains text (see below). I would like to divide the document into several Word documents with a specific name for each generated document. Let me show you with an example.

Test.doc contains:

Name: DavidVorowski
Reference: Report Content1
Report Footer1

Name: JohnWilliams
Reference: Report Content2
Report Footer2

Name: GretaBrett
Reference: Report Content3
Report Footer3

After applying the code (which I am currently working with no success), 3 files will be generated every time the string "Name:" is seen. The generated document will be called the string after "Reference:".
In this example, I will have 3 files called Contents of the report1.doc, Content2.doc report Y Contents of the report3.doc.

Content of Contents of the report1.doc:

Name: DavidVorowski
Reference: Report Content1
Report Footer1

Content of Content2.doc report:

Name: JohnWilliams
Reference: Report Content2
Report Footer2

Content of Contents of the report3.doc:

Name: GretaBrett
Reference: Report Content3
Report Footer3

I have been working with the following code and I would like to have your experience. Thank you very much and stay safe.

Sub SplitDoc()
Application.ScreenUpdating = False
Dim Rng As Range, DocSrc As Document, DocTgt As Document, StrNm As String
Dim Ext As String, FlPth As String, Tmplt As String, Fmt As Long
Set DocSrc = ActiveDocument
With DocSrc
  Ext = "." & Split(.Name, ".")(UBound(Split(.Name, ".")))
  FlPth = .Path & ""
  Tmplt = .AttachedTemplate.FullName
  Fmt = .SaveFormat
  With .Range
    .InsertAfter vbCr & "Name:"
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "(//){3}*^13"
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchWildcards = True
      .Execute
    End With
    Do While .Find.Found
      If .End = DocSrc.Range.End Then GoTo Finished
      Set Rng = .Duplicate
      With Rng
        .MoveEndUntil "Name:", wdForward
        StrNm = Split(Split(.Paragraphs.First.Range.Text, vbCr)(0), "Name:")(1)
        .Start = .Paragraphs.First.Range.End
        Set DocTgt = Documents.Add(Tmplt)
        With DocTgt
          .Range.FormattedText = Rng.FormattedText
          .SaveAs2 FileName:=FlPth & StrNm & Ext, Fileformat:=Fmt, AddToRecentFiles:=False
          .Close False
        End With
      End With
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
  End With
End With
Finished:
Undo: Set Rng = Nothing: Set DocTgt = Nothing: Set DocSrc = Nothing
Application.ScreenUpdating = True
End Sub

custom – Dynamically generated block identical for all clients – Why?

I use PHP to dynamically create the content of a block on a CMS page (created through the administration portal). But during testing I found out that the first generated block remains active for all clients until you clear the server cache.
My code:

getLayout()->createBlock(ProductsList::class);
$productsBlock->setProductsCount(100);
$productsBlock->setTemplate("product/widget/content/grid.phtml");
$productsBlock->setConditionsEncoded("^(`1`:^(`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`aggregator`:`all`,`value`:`1`,`new_child`:``^),`1--1`:^(`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`category_ids`,`operator`:`==`,`value`:`3`^)^)");
echo $productsBlock->toHtml();
}
else{
$productsBlock = $this->getLayout()->createBlock(ProductsList::class);
$productsBlock->setProductsCount(100);
$productsBlock->setTemplate("product/widget/content/grid.phtml");
$productsBlock->setConditionsEncoded("^(`1`:^(`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`aggregator`:`all`,`value`:`1`,`new_child`:``^),`1--1`:^(`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`category_ids`,`operator`:`==`,`value`:`4`^)^)");
echo $productsBlock->toHtml();
}
?>

I create a cookie and query the value of the cookie through PHP. Depending on the input, the user should see a different output in the next step. The result in the next step should be a list of filtered products.
How can the selected one be valid only for one user?

Sharing Facebook links on Twitter – why isn't a link preview or snippet being generated?

I want to share a Facebook page, or actually any Facebook URL at
Twitter. (That is, I want to "Tweet a link to a Facebook page, etc.")

  • Why isn't a "link preview" being generated?
  • Why isn't a "snippet" generated?

It is

Conversely, sharing a Twitter link on Facebook works correctly
Of course.

No, I don't want to link my Twitter and Facebook accounts and then share the link on Facebook and automatically post it on Twitter. All I want to do is occasionally hit the Tweet button and drop a Facebook URL and tweet and have a preview and proper link snippet generated by Twitter.

Facebook URLs shared on Twitter: link preview is not generated and user has to write snippet by himself

When users share a Facebook URL on Twitter, a link preview is not generated
and the user must write the snippet themselves.
(For details on the failure, connect, for example, https://www.facebook.com/ https://cards-dev.twitter.com/validator )

On the other hand, when users share a Twitter URL on Facebook, everything works fine.
(Check with, for example, https://developers.facebook.com/tools/debug/?q=twitter.com )

I don't own Facebook, so I can't put the Open Graph tags mentioned in
https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#twitter-cards-and-open-graph
return (?) to what Facebook sends to Twitter. I also can't tell Twitter what it is
You should now search the HTML that Facebook sends.

java – System generated social network

In a particular social network, friends are automatically assigned to users by the system and users cannot add friends of their choice on their own. Currently there are N users in the social network, labeled from 2 to N + 1.

For each i-th user (where i varies from 2 to N + 1), the system assigned all users tagged with multiples of i as user friends (if possible).

One day, all users of the social network get together for a meeting and form groups so that each person in a group is a direct friend or a friend of anyone else in that group.

Find the total number of groups.

Input Specifications:

Entry 1: N, which indicates the number of users in the social network

Output specification:
your function should return the number of groups that can be formed under certain conditions

Example 1:

Entry1: 5
Output: 2

Explanation:
Two groups will be formed.

2,3,4,6
5

Example 2

Entry1: 10
Output: 3

Explanation:
Three groups will be formed:

2,3,4,5,6,8,9,10
7
11

Suggestions for solutions

Please optimize my solution. My solution works perfectly but it doesn't look optimal.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;

public class SocialNetwork {

    public static void main(String() args) {
        InputStreamReader r = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(r);
        int value = 0;

        try {
            value = Integer.parseInt(br.readLine());
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }

        HashMap> map = new HashMap<>();

        for (int i = 2; i <= value + 1; i++) {

            List list = new ArrayList<>();

            for (int j = 1; j * i <= value + 1; j++) {
                int tempValue = j * i;

                list.add(tempValue);

                if (i != tempValue) {
                    List addedList = map.get(tempValue);

                    if (addedList == null) {
                        addedList = new ArrayList<>();
                    }

                    if (!addedList.contains(i)) {
                        addedList.add(i);
                        map.put(tempValue, addedList);
                    }
                }
            }

            List currList = map.get(i);
            if (currList != null)
                currList.addAll(list);
            else
                currList = list;

            map.put(i, currList);
        }

        // Iterate through all elements of map

        Iterator>> iterator = map.entrySet().iterator();

        List visitedKeys = new ArrayList<>();

        List> listSet = new ArrayList<>();

        while (iterator.hasNext()) {
            Entry> entry = iterator.next();
            Integer key = entry.getKey();
            List keyValue = entry.getValue();

            if (visitedKeys.contains(key)) {
                continue;
            }

            Set setItem = new HashSet<>();
            updateSet(key, keyValue, visitedKeys, map, setItem);

            listSet.add(setItem);
        }

        System.out.println("groups=" + listSet);
        System.out.println("Number of groups=" + listSet.size());
    }

    private static void updateSet(Integer key, List keyValue, List visitedKeys,
            HashMap> map, Set setItem) {

        for (Integer item : keyValue) {

            if (visitedKeys.contains(item)) {
                continue;
            }

            if (!item.equals(key)) {
                List mapVal = map.get(item);
                if (mapVal != null) {
                    updateSet(item, mapVal, visitedKeys, map, setItem);
                }
            }

            visitedKeys.add(item);

            setItem.add(item);
        }
    }
}

procedural generation: How does Minecraft know where the village buildings are if the village has not yet been generated?

Yes, it generates more fragments than you think. This is what I call "area of ‚Äč‚Äčinterest" in my voxel code. There are two types of areas of interest:

  1. Logical (which is what we are discussing here)
  2. Render (which is normally smaller in radius than the logical area)

Remember that the only way your renderer can access part of the entire image, deterministically, is to generate the tree structure of the entire village, topographically, from its root (the center of the village). This is because even if your rendering display area only nominally overlaps with the village boundaries, the full build has yet to take place.

Remember that each fragment is affected by some combination of:

  • The Chunk coordinates in the world
  • Your neighbors terrain and design
  • The process mentioned in that video, which is generating a maximum n-deep tree of buildings and streets, which MUST be completed in its entirety to be faithful to the same shape you will see when walking towards the center of that town. At each step in that generation, a hash of the combined current state of the village may be taken, which pseudo-randomly determines the next step, note what it says at 3:08 in that video.

… So really, from a determinism point of view, there are no shortcuts here.

This is undoubtedly computationally costly, especially as if you were just on the edge of the horizon near the outermost limits of a village, the game should still spawn the entire village, even if it represents very little or none of it.

Show total count of column value generated with SPFx Field Customizer

I have developed a field customization extension. This makes the item count based on the logic of each cell in the Document Library.

Now, I want to display the count total at the bottom of the custom column.

enter the image description here

How to show count at bottom using SPFx?

Thanks in advance.

date – MySQL: Cannot create a generated column with an expression that uses the DATE_ADD () function

There may be a really obvious solution to my question, but I'm stuck and couldn't figure out what I'm doing wrong, so you guys could tell me.

I can't create a nullable stored column for my expression using DATE_ADD function in MySQL 8.

See the following example:

ADD COLUMN `test` TIMESTAMP GENERATED ALWAYS AS (DATE_ADD(col1, INTERVAL col2 HOUR)) STORED NULL;

col1 is TIMESTAMP and col2 is INT

MySQL doesn't complain, it just converts the expression to

(`col1` + interval `col2` hour)

And the result is not voidable too.

print: JavaScript does not run before PDF is generated

Using Entity Print 8x-2.1, I have everything working fine (thanks to the developers of that module), except it doesn't seem to support loading the JavaScript part of the attached libraries. CSS is loading and processing as expected from my print_styling library, but the custom.js below is not only not running, it doesn't even seem to be loaded when I check "fonts" in Chrome developer tools from print page / entity debugging. When I look at the code it seems like it doesn't even try to load js assets. Am I correct that the entity print is loading when loading js, or is it possibly just a problem with the base URL? If js support is not yet implemented in entity_print, is it just a matter of needing someone to develop it, or is there a fundamental limitation that prevents using js with wkhtmlpdf and entity_print? From my reading of the wkhtmltopdf documents it looks like it might support js, though it needs a setting for javascript lag to make sure the execution completes before the pdf is generated.

print_styling:
  css:
    theme:
      css/print2.css: {}
  js:
    js/custom.js: {}

fit: how we fit our own probability distribution generated on real data

I want to fit the derived distribution on real data and I need MLE parameters, standard errors of the estimated parameters, AIC, Loglikelihood, goodness-of-fit test (Chi-square, Anderson, etc.), PDF, CDF, graphs and QQplots. The data, CDF and PDF are

data = {3.70, 2.74, 2.73, 2.50, 3.60, 3.11, 3.27, 2.87, 1.47, 3.11, 
   4.42, 2.41, 3.19, 3.22, 1.69, 3.28, 3.09, 1.87, 3.15, 4.90, 3.75, 
   2.43, 2.95, 2.97, 3.39, 2.96, 2.53, 2.67, 2.93, 3.22, 3.39, 2.81, 
   4.20, 3.33, 2.55, 3.31, 3.31, 2.85, 2.56, 3.56, 3.15, 2.35, 2.55, 
   2.59, 2.38, 2.81, 2.77, 2.17, 2.83, 1.92, 1.41, 3.68, 2.97, 1.36, 
   0.98, 2.76, 4.91, 3.68, 1.84, 1.59, 3.19, 1.57, 0.81, 5.56, 1.73, 
   1.59, 2.00, 1.22, 1.12, 1.71, 2.17, 1.17, 5.08, 2.48, 1.18, 3.51, 
   2.17, 1.69, 1.25, 4.38, 1.84, 0.39, 3.68, 2.48, 0.85, 1.61, 2.79, 
   4.70, 2.03, 1.80, 1.57, 1.08, 2.03, 1.61, 2.12, 1.89, 2.88, 2.82, 
   2.05, 3.65};
cdf = (1 - (1 + ((1 - (1 + x^(Xi))^-(Psi) )^(Lambda)/(1 - (1 - (1 + x^(Xi))^-(Psi) )^(Lambda)))^(Gamma))^-(Alpha))^(\(Beta))
(ScriptCapitalD) = ProbabilityDistribution(-(((Alpha) (Beta) (Gamma) (Lambda) \(Xi) (Psi) x^(-1 + (Xi)) (-1 + 1/(1 - (1 - (1 + x^(Xi))^-(Psi))^(Lambda)))^(Gamma) (1 - (1 + (-1 + 1/(1 - (1 - (1 + x^(Xi))^-(Psi))^(Lambda)))^(Gamma))^-(Alpha))^\(Beta))/((1 + x^(Xi)) (-1 + (1 + x^(Xi))^(Psi)) (-1 + (1 - (1 + x^(Xi))^-(Psi))^(Lambda)) (1 + (-1 + 1/(1 - (1 - (1 + x^(Xi))^-(Psi))^(Lambda)))^(Gamma)) (-1 + (1 + (-1 + 1/(1 - (1 - (1 + x^(Xi))^-(Psi))^(Lambda)))^(Gamma))^(Alpha)))), {x, 0, Infinity} , Assumptions -> (Alpha) > 0 && (Beta) > 0 && (Gamma) > 0 && (Lambda) > 0 && (Psi) > 0 && (Xi) > 0  );