kandi background
Explore Kits

duality | a 2D Game Development Framework | Game Engine library

 by   AdamsLair C# Version: v3.0 License: MIT

 by   AdamsLair C# Version: v3.0 License: MIT

Download this library from

kandi X-RAY | duality Summary

duality is a C# library typically used in Gaming, Game Engine, Unity applications. duality has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.
Duality - A 2D GameDev Framework.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • duality has a medium active ecosystem.
  • It has 1245 star(s) with 291 fork(s). There are 115 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 134 open issues and 516 have been closed. On average issues are closed in 144 days. There are 4 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of duality is v3.0
duality Support
Best in #Game Engine
Average in #Game Engine
duality Support
Best in #Game Engine
Average in #Game Engine

quality kandi Quality

  • duality has 0 bugs and 0 code smells.
duality Quality
Best in #Game Engine
Average in #Game Engine
duality Quality
Best in #Game Engine
Average in #Game Engine

securitySecurity

  • duality has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • duality code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
duality Security
Best in #Game Engine
Average in #Game Engine
duality Security
Best in #Game Engine
Average in #Game Engine

license License

  • duality is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
duality License
Best in #Game Engine
Average in #Game Engine
duality License
Best in #Game Engine
Average in #Game Engine

buildReuse

  • duality releases are available to install and integrate.
  • Installation instructions are not available. Examples and code snippets are available.
duality Reuse
Best in #Game Engine
Average in #Game Engine
duality Reuse
Best in #Game Engine
Average in #Game Engine
Top functions reviewed by kandi - BETA

Coming Soon for all Libraries!

Currently covering the most popular Java, JavaScript and Python libraries. See a SAMPLE HERE.
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.

duality Key Features

a 2D Game Development Framework

default

copy iconCopydownload iconDownload
### Maintainers
- [SirePi](https://github.com/SirePi)
- [Barsonax](https://github.com/Barsonax)
- [Ilexp](https://github.com/ilexp) (creator, now inactive but still around to give us advice)

iterate over columns to count words in a sentence and put it in a new column

copy iconCopydownload iconDownload
cupid %>% 
  mutate(across(starts_with("essay"), \(x) stringr::str_count(x, " +") + 1,
                .names = "{.col}_num"))
# ...other column...
#  essay0_num essay1_num essay2_num essay3_num essay4_num essay5_num essay6_num essay7_num
# 1        237         45         16         28         62          5          4         16
# 2        130          7         18          1         50         53          1          1
# 3        246         90         65         46        355          6          1          6
# 4         11          7         13          7         29          1          4          1
# 5         40          6          7          8         44          1          1          1
# 6        160         12         60         15         70         59         20          4
#   essay8_num essay9_num
# 1         14         30
# 2         10          1
# 3         12         39
# 4          1          4
# 5          1          1
# 6         17          2

How to set a button if clicked, ignore the mouseout on vanilla JS?

copy iconCopydownload iconDownload
let task = document.querySelector('.task')
document.querySelector('.check').addEventListener('click', function(event) {
  event.target.classList.add('active')
  task.classList.add('active')
});
.check {
  cursor: pointer;
  color: #08a59d;
  border: 1px solid #08a59d;
  margin-left: -40vw;
  padding: 4px;
  border-radius: 5px;
}

.check:hover {
  color: #eaeaea;
  background-color: #08a59d;
}

.check.active {
  color: #eaeaea;
}

.task.active {
  width: 30vw;
  height: 30px;
  background-color: #5B8581;
  color: #eaeaea;
  text-align: center;
  margin-top: -4.3vh;
  border-radius: 10px;
  font-weight: 500;
  font-size: 18px;
  padding-top: 4px;
  text-decoration: line-through;
}



.closebutton {
  width: 25px;
  cursor: pointer;
  color: #C70039;
  border: 1px solid #C70039;
  margin-left: 40vw;
  padding: 4px;
  padding-left: 6.2px;
  border-radius: 5px;
  margin-top: -3.7vh;
}

.closebutton:hover {
  background-color: #C70039;
}
<div class='check'>Check div</div>
<ul class='task'><li>Task 1</li></ul>

<button class='closebutton'>X</button>
-----------------------
let task = document.querySelector('.task')
document.querySelector('.check').addEventListener('click', function(event) {
  event.target.classList.add('active')
  task.classList.add('active')
});
.check {
  cursor: pointer;
  color: #08a59d;
  border: 1px solid #08a59d;
  margin-left: -40vw;
  padding: 4px;
  border-radius: 5px;
}

.check:hover {
  color: #eaeaea;
  background-color: #08a59d;
}

.check.active {
  color: #eaeaea;
}

.task.active {
  width: 30vw;
  height: 30px;
  background-color: #5B8581;
  color: #eaeaea;
  text-align: center;
  margin-top: -4.3vh;
  border-radius: 10px;
  font-weight: 500;
  font-size: 18px;
  padding-top: 4px;
  text-decoration: line-through;
}



.closebutton {
  width: 25px;
  cursor: pointer;
  color: #C70039;
  border: 1px solid #C70039;
  margin-left: 40vw;
  padding: 4px;
  padding-left: 6.2px;
  border-radius: 5px;
  margin-top: -3.7vh;
}

.closebutton:hover {
  background-color: #C70039;
}
<div class='check'>Check div</div>
<ul class='task'><li>Task 1</li></ul>

<button class='closebutton'>X</button>
-----------------------
let task = document.querySelector('.task')
document.querySelector('.check').addEventListener('click', function(event) {
  event.target.classList.add('active')
  task.classList.add('active')
});
.check {
  cursor: pointer;
  color: #08a59d;
  border: 1px solid #08a59d;
  margin-left: -40vw;
  padding: 4px;
  border-radius: 5px;
}

.check:hover {
  color: #eaeaea;
  background-color: #08a59d;
}

.check.active {
  color: #eaeaea;
}

.task.active {
  width: 30vw;
  height: 30px;
  background-color: #5B8581;
  color: #eaeaea;
  text-align: center;
  margin-top: -4.3vh;
  border-radius: 10px;
  font-weight: 500;
  font-size: 18px;
  padding-top: 4px;
  text-decoration: line-through;
}



.closebutton {
  width: 25px;
  cursor: pointer;
  color: #C70039;
  border: 1px solid #C70039;
  margin-left: 40vw;
  padding: 4px;
  padding-left: 6.2px;
  border-radius: 5px;
  margin-top: -3.7vh;
}

.closebutton:hover {
  background-color: #C70039;
}
<div class='check'>Check div</div>
<ul class='task'><li>Task 1</li></ul>

<button class='closebutton'>X</button>
-----------------------
const btn = document.querySelectorAll('.btn')
const show = document.getElementById('showme')

btn.forEach(button => {
  let disabled = false;
  button.addEventListener('click', e => {
  console.log('clicked')
    disabled = true;
  })
  button.addEventListener('mouseover', e => {
    document.getElementById('showme').style.display = 'block'
    e.target.textContent = 'Mouse out to hide'
  })
  button.addEventListener('mouseout', e => {
    if(disabled !== true){          
      document.getElementById('showme').style.display = 'none';
      e.target.textContent = "Hover to show"
    }else{
      show.textContent = 'Now mouse out is disabled...'
    }
    
  })
})
#showme {
  display: none;
}
<button class="btn">Hover to show</button>
<div id="showme">I am shown, now click to set disabled variable to true</div>
-----------------------
const btn = document.querySelectorAll('.btn')
const show = document.getElementById('showme')

btn.forEach(button => {
  let disabled = false;
  button.addEventListener('click', e => {
  console.log('clicked')
    disabled = true;
  })
  button.addEventListener('mouseover', e => {
    document.getElementById('showme').style.display = 'block'
    e.target.textContent = 'Mouse out to hide'
  })
  button.addEventListener('mouseout', e => {
    if(disabled !== true){          
      document.getElementById('showme').style.display = 'none';
      e.target.textContent = "Hover to show"
    }else{
      show.textContent = 'Now mouse out is disabled...'
    }
    
  })
})
#showme {
  display: none;
}
<button class="btn">Hover to show</button>
<div id="showme">I am shown, now click to set disabled variable to true</div>
-----------------------
const btn = document.querySelectorAll('.btn')
const show = document.getElementById('showme')

btn.forEach(button => {
  let disabled = false;
  button.addEventListener('click', e => {
  console.log('clicked')
    disabled = true;
  })
  button.addEventListener('mouseover', e => {
    document.getElementById('showme').style.display = 'block'
    e.target.textContent = 'Mouse out to hide'
  })
  button.addEventListener('mouseout', e => {
    if(disabled !== true){          
      document.getElementById('showme').style.display = 'none';
      e.target.textContent = "Hover to show"
    }else{
      show.textContent = 'Now mouse out is disabled...'
    }
    
  })
})
#showme {
  display: none;
}
<button class="btn">Hover to show</button>
<div id="showme">I am shown, now click to set disabled variable to true</div>

Css grid styling 2 vertical columns infinite rows from 2 different types of div

copy iconCopydownload iconDownload
body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row dense;
    grid-gap: 0.5rem;
}

h1 {
    grid-column-start: 1;
    grid-column-end: none;
}

.edition,
.translation {
    display: inherit;
    grid-template-rows: 1fr 1fr;
}

.edition {
    grid-column-start: 2;
}

.translation {
    grid-column-start: 1;
}

.edition > div[type="ed"] {
    background-color: #def;
    padding: 0.5rem;
}

.translation > div[type="trans"] {
    background-color: #abc;
    padding: 0.5rem;
}
<body>
    <h1>This is title</h1>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
     <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
        <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
     <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
</body>
-----------------------
body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row dense;
    grid-gap: 0.5rem;
}

h1 {
    grid-column-start: 1;
    grid-column-end: none;
}

.edition,
.translation {
    display: inherit;
    grid-template-rows: 1fr 1fr;
}

.edition {
    grid-column-start: 2;
}

.translation {
    grid-column-start: 1;
}

.edition > div[type="ed"] {
    background-color: #def;
    padding: 0.5rem;
}

.translation > div[type="trans"] {
    background-color: #abc;
    padding: 0.5rem;
}
<body>
    <h1>This is title</h1>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
     <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
        <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
     <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-edition_1" class="edition">
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p><mark>śrī gaṇeśāya namaḥ</mark> // <mark>atha rājayogaprakāro likhyate</mark> //</p>
                <div class="app">
                    <span class="lem">
                        śrī gaṇeśāya namaḥ (<a href="#E" title="E Printed Edition">E</a> <a href="#L" title="L LALCHAND 5876">L</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>
                        <a href="#U1" title="U1 SORI 1574">U1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]
                    </span>
                    śrī ṇe ya maḥ (<a href="#P" title="P Pune BORI 664">P</a>), śrī gurave namaḥ (<a href="#N1" title="N1 NGMPP 38/31">N1</a>), śrī sarasvatyai namaḥ śrī nirañjanāya namaḥ (<a href="#D1" title="D1 IGNCA 30019">D1</a>), oṃ
                    śrī niraṃjanāya (<a href="#U1" title="U1 SORI 1574">U1</a>)
                </div>
                <div class="app">
                    <span class="lem">atha rājayogaprakāro likhyate (<a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a>) ]</span> atha rājayogaprakāra likhyate (
                    <a href="#U1" title="U1 SORI 1574">U1</a>), rājayogāntargataḥ / binduyogaḥ (<a href="#E" title="E Printed Edition">E</a>), atha tattvabiṃduyogaprāraṃbhaḥ (<a href="#L" title="L LALCHAND 5876">L</a>), atha rājayoga
                    liṣyate (<a href="#P" title="P Pune BORI 664">P</a>), atha rājayoga likhyate (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
        <div type="ed">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            <div xmlns="http://www.w3.org/1999/xhtml" class="wapp">
                <p>rājayogasyedaṃ phalaṃ / yena rājayogenānekarājyabhogasamaya eva / anekapārthivavinoda<mark>prekṣaṇasamaya</mark> eva / bahutarakālaṃ śarīrasthitirbhavati / sa <mark>eva</mark> rājayogaḥ / tasyaite bhedāḥ /</p>
                <div class="app">
                    <span class="lem">prekṣaṇasamaya (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U1" title="U1 SORI 1574">U1</a>) ]</span>
                    prekṣyaṇasamaya (<a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
                <div class="app">
                    <span class="lem">eva (<a href="#P" title="P Pune BORI 664">P</a> <a href="#N1" title="N1 NGMPP 38/31">N1</a> <a href="#D1" title="D1 IGNCA 30019">D1</a> <a href="#U2" title="U2 SORI 6082">U2</a>) ]</span> evaṃ (
                    <a href="#U2" title="U2 SORI 6082">U2</a>)
                </div>
            </div>
        </div>
    </div>
    <div xmlns="http://www.tei-c.org/ns/1.0" xml:id="div-translation_1" class="translation">
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">intro1</h3>
            Homage to Śrī Gaṇeśa. Now the methods of rājayoga are laid down.
        </div>
        <div type="trans">
            <h3 xmlns="http://www.w3.org/1999/xhtml">rajayoga</h3>
            Rājayoga is that by which longterm durability of the body arises even amongst manifold royal pleasures even amongst the manifold royal entertainments and spectacle. This truly is rājayoga. Of this [rājayoga] these are the
            varieties:
        </div>
    </div>
</body>

Using regex modification only in a selected part of a text

copy iconCopydownload iconDownload
(?<=\$).+(?=\$)
import re

s = "In $ \mathcal{N}=4$ we fix them completely through the duality to null"
regex = re.compile(r'(?<=\$).+(?=\$)', re.M)

# returns you the string containing 
# only the contents inside $ ... $
s = ' '.join(map(str.strip, regex.findall(s)))
print(s)
-----------------------
(?<=\$).+(?=\$)
import re

s = "In $ \mathcal{N}=4$ we fix them completely through the duality to null"
regex = re.compile(r'(?<=\$).+(?=\$)', re.M)

# returns you the string containing 
# only the contents inside $ ... $
s = ' '.join(map(str.strip, regex.findall(s)))
print(s)
-----------------------
regex = re.compile(r'(\$[^$]*\$)|[^\x00-\x7F]+|\(')
print(regex.sub(lambda m: m.group(1) or " ", s))

(Yet Another) 'ImportError: No module named my_module'

copy iconCopydownload iconDownload
python -m modone.one
-----------------------
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two().print_two()
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two.Two.print_two()
python -m modone.one
this is one
this is from two
-----------------------
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two().print_two()
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two.Two.print_two()
python -m modone.one
this is one
this is from two
-----------------------
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two().print_two()
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two.Two.print_two()
python -m modone.one
this is one
this is from two
-----------------------
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two().print_two()
from modtwo import two
class One():
    @staticmethod
    def print_one():
        print("this is one")
        two.Two.print_two()
python -m modone.one
this is one
this is from two

Arithmetic operation resulted in an overflow even after applying unchecked

copy iconCopydownload iconDownload
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    static void Main(string[] args)
    {
        var result = GetNumbers().AsParallel().WithDegreeOfParallelism(1)
            .Aggregate((long)0, (acc, i) => acc + i, (a, b) => a + b, acc => acc);
        Console.WriteLine($"Result: {result:#,0}");
    }

    static IEnumerable<uint> GetNumbers()
    {
        for (uint i = 0; i < UInt32.MaxValue; i++)
        {
            if (i % 10_000_000 == 0 || i > (Int32.MaxValue - 1000))
                Console.WriteLine($"Yielding: {i:#,0}");
            yield return i;
        }
    }
}
System.OverflowException: Arithmetic operation resulted in an overflow.
   at System.Linq.Parallel.PartitionedDataSource`1.ContiguousChunkLazyEnumerator.MoveNext(T& currentElement, Int32& currentKey)
   at System.Linq.Parallel.AssociativeAggregationOperator`3.AssociativeAggregationOperatorEnumerator`1.MoveNext(TIntermediate& currentElement, Int32& currentKey)
   at System.Linq.Parallel.StopAndGoSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.RunTaskSynchronously(Object o)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
-----------------------
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    static void Main(string[] args)
    {
        var result = GetNumbers().AsParallel().WithDegreeOfParallelism(1)
            .Aggregate((long)0, (acc, i) => acc + i, (a, b) => a + b, acc => acc);
        Console.WriteLine($"Result: {result:#,0}");
    }

    static IEnumerable<uint> GetNumbers()
    {
        for (uint i = 0; i < UInt32.MaxValue; i++)
        {
            if (i % 10_000_000 == 0 || i > (Int32.MaxValue - 1000))
                Console.WriteLine($"Yielding: {i:#,0}");
            yield return i;
        }
    }
}
System.OverflowException: Arithmetic operation resulted in an overflow.
   at System.Linq.Parallel.PartitionedDataSource`1.ContiguousChunkLazyEnumerator.MoveNext(T& currentElement, Int32& currentKey)
   at System.Linq.Parallel.AssociativeAggregationOperator`3.AssociativeAggregationOperatorEnumerator`1.MoveNext(TIntermediate& currentElement, Int32& currentKey)
   at System.Linq.Parallel.StopAndGoSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.RunTaskSynchronously(Object o)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

jQuery: Toggleable path-like navigation with decorations

copy iconCopydownload iconDownload
$('.tab-opening-button').click(function(){ 
  const openId = $(this).attr('data-open');
  const linkParent = $(this).attr('data-parent-link');
  if(!linkParent){
      $('#categories').hide();
  }
  $('.text-panel').hide();
  $(openId).show();
  
  $('.tab-opening-button').not(linkParent).removeClass('active');
  $(this).addClass('active'); 
});
* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 30px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
  color: rgb(80, 80, 80);
  box-sizing: border-box;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.column {
  border-right: 3px solid;
  flex-shrink: 0;
}

.text-panel {
  flex-shrink: 1;
}

.column_content {
  overflow-y: auto;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.column {
  display: none;
}

.column:first-child {
  display: block;
}

li:hover {
  cursor: pointer;
}

.active {
  text-decoration: underline yellow;
}

.active:before {
  content: "▶ "
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

    <div class="column">
        <div class="column_content">
            <ul>
                <li data-open="#categories" class="tab-opening-button" id="one_link">One</li>
                <li data-open="#text_two" class="tab-opening-button" id="two_link">Two</li>
                <li data-open="#text_three" class="tab-opening-button" id="three_link">Three</li>
            </ul>
        </div>
    </div>

    <div id="categories" class="column">
        <div class="column_content">
            <ul>
                <li data-open="#cats_text" data-parent-link="#one_link"  class="tab-opening-button" id="cats_link">Cats</li>
            </ul>
        </div>
    </div>

    <div class="column text-panel" id="cats_text">
        <div class="column_content">
            <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated
                species in the family Felidae and is often referred to as the domestic cat to distinguish it from the
                wild members of the family.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_two">
        <div class="column_content">
            <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the
                smallest and only even prime number. Because it forms the basis of a duality, it has religious and
                spiritual significance in many cultures.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_three">
        <div class="column_content">
            <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is
                the smallest odd prime number. It has religious or cultural significance in many societies.</p>
        </div>
    </div>

</div>
-----------------------
$('.tab-opening-button').click(function(){ 
  const openId = $(this).attr('data-open');
  const linkParent = $(this).attr('data-parent-link');
  if(!linkParent){
      $('#categories').hide();
  }
  $('.text-panel').hide();
  $(openId).show();
  
  $('.tab-opening-button').not(linkParent).removeClass('active');
  $(this).addClass('active'); 
});
* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 30px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
  color: rgb(80, 80, 80);
  box-sizing: border-box;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.column {
  border-right: 3px solid;
  flex-shrink: 0;
}

.text-panel {
  flex-shrink: 1;
}

.column_content {
  overflow-y: auto;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.column {
  display: none;
}

.column:first-child {
  display: block;
}

li:hover {
  cursor: pointer;
}

.active {
  text-decoration: underline yellow;
}

.active:before {
  content: "▶ "
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

    <div class="column">
        <div class="column_content">
            <ul>
                <li data-open="#categories" class="tab-opening-button" id="one_link">One</li>
                <li data-open="#text_two" class="tab-opening-button" id="two_link">Two</li>
                <li data-open="#text_three" class="tab-opening-button" id="three_link">Three</li>
            </ul>
        </div>
    </div>

    <div id="categories" class="column">
        <div class="column_content">
            <ul>
                <li data-open="#cats_text" data-parent-link="#one_link"  class="tab-opening-button" id="cats_link">Cats</li>
            </ul>
        </div>
    </div>

    <div class="column text-panel" id="cats_text">
        <div class="column_content">
            <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated
                species in the family Felidae and is often referred to as the domestic cat to distinguish it from the
                wild members of the family.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_two">
        <div class="column_content">
            <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the
                smallest and only even prime number. Because it forms the basis of a duality, it has religious and
                spiritual significance in many cultures.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_three">
        <div class="column_content">
            <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is
                the smallest odd prime number. It has religious or cultural significance in many societies.</p>
        </div>
    </div>

</div>
-----------------------
$('.tab-opening-button').click(function(){ 
  const openId = $(this).attr('data-open');
  const linkParent = $(this).attr('data-parent-link');
  if(!linkParent){
      $('#categories').hide();
  }
  $('.text-panel').hide();
  $(openId).show();
  
  $('.tab-opening-button').not(linkParent).removeClass('active');
  $(this).addClass('active'); 
});
* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 30px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
  color: rgb(80, 80, 80);
  box-sizing: border-box;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.column {
  border-right: 3px solid;
  flex-shrink: 0;
}

.text-panel {
  flex-shrink: 1;
}

.column_content {
  overflow-y: auto;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.column {
  display: none;
}

.column:first-child {
  display: block;
}

li:hover {
  cursor: pointer;
}

.active {
  text-decoration: underline yellow;
}

.active:before {
  content: "▶ "
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

    <div class="column">
        <div class="column_content">
            <ul>
                <li data-open="#categories" class="tab-opening-button" id="one_link">One</li>
                <li data-open="#text_two" class="tab-opening-button" id="two_link">Two</li>
                <li data-open="#text_three" class="tab-opening-button" id="three_link">Three</li>
            </ul>
        </div>
    </div>

    <div id="categories" class="column">
        <div class="column_content">
            <ul>
                <li data-open="#cats_text" data-parent-link="#one_link"  class="tab-opening-button" id="cats_link">Cats</li>
            </ul>
        </div>
    </div>

    <div class="column text-panel" id="cats_text">
        <div class="column_content">
            <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated
                species in the family Felidae and is often referred to as the domestic cat to distinguish it from the
                wild members of the family.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_two">
        <div class="column_content">
            <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the
                smallest and only even prime number. Because it forms the basis of a duality, it has religious and
                spiritual significance in many cultures.</p>
        </div>
    </div>

    <div class="column text-panel" id="text_three">
        <div class="column_content">
            <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is
                the smallest odd prime number. It has religious or cultural significance in many societies.</p>
        </div>
    </div>

</div>

Isotope: Gallery with flexible column width does not work in specific case

copy iconCopydownload iconDownload
$("#cats_link").click(function() {
    $("#cats_gallery").toggle();
    $("#text_two").hide();
    $("#text_three").hide();
});
$("#cats_link").click(function() {
    $("#cats_gallery").toggle(function () {
        $grid.isotope('layout');
    });
    $("#text_two").hide();
    $("#text_three").hide();
});
// init Isotope
var $grid = $('.grid').isotope({
    itemSelector: '.grid-item',
    percentPosition: true,
    masonry: {
        columnWidth: '.grid-sizer'
    },
    transitionDuration: 0
});
$("#cats_gallery").toggle(0, function () {
    $grid.isotope('layout');
});
-----------------------
$("#cats_link").click(function() {
    $("#cats_gallery").toggle();
    $("#text_two").hide();
    $("#text_three").hide();
});
$("#cats_link").click(function() {
    $("#cats_gallery").toggle(function () {
        $grid.isotope('layout');
    });
    $("#text_two").hide();
    $("#text_three").hide();
});
// init Isotope
var $grid = $('.grid').isotope({
    itemSelector: '.grid-item',
    percentPosition: true,
    masonry: {
        columnWidth: '.grid-sizer'
    },
    transitionDuration: 0
});
$("#cats_gallery").toggle(0, function () {
    $grid.isotope('layout');
});
-----------------------
$("#cats_link").click(function() {
    $("#cats_gallery").toggle();
    $("#text_two").hide();
    $("#text_three").hide();
});
$("#cats_link").click(function() {
    $("#cats_gallery").toggle(function () {
        $grid.isotope('layout');
    });
    $("#text_two").hide();
    $("#text_three").hide();
});
// init Isotope
var $grid = $('.grid').isotope({
    itemSelector: '.grid-item',
    percentPosition: true,
    masonry: {
        columnWidth: '.grid-sizer'
    },
    transitionDuration: 0
});
$("#cats_gallery").toggle(0, function () {
    $grid.isotope('layout');
});
-----------------------
$("#cats_link").click(function() {
    $("#cats_gallery").toggle();
    $("#text_two").hide();
    $("#text_three").hide();
});
$("#cats_link").click(function() {
    $("#cats_gallery").toggle(function () {
        $grid.isotope('layout');
    });
    $("#text_two").hide();
    $("#text_three").hide();
});
// init Isotope
var $grid = $('.grid').isotope({
    itemSelector: '.grid-item',
    percentPosition: true,
    masonry: {
        columnWidth: '.grid-sizer'
    },
    transitionDuration: 0
});
$("#cats_gallery").toggle(0, function () {
    $grid.isotope('layout');
});

jQuery toggle path navigation

copy iconCopydownload iconDownload
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>
-----------------------
<li class="tablink" id="two_link" data-target="text_two">Two</li>
<div class="column tabtext" id="text_two">
.tabtext {
  opacity: 0;
  transition 0.2s;
}
.tabtext.visible {
  opacity: 1;
}
$("body").on("click", ".tablink", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible"); // Only show if wasn't visible
  $(".tabtext.visible").removeClass("visible"); // Hide visible
  if (show) target.addClass("visible"); // Show the selected
});
$("body").on("click", ".tablink", function(e) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext.visible").removeClass("visible");
  $(".tabtext2.visible").removeClass("visible"); // Hide 2nd level as well
  if (show) target.addClass("visible");
});

$("body").on("click", ".tablink2", function(ev) {
  var target = $("#" + this.dataset.target);
  var show = !target.hasClass("visible");
  $(".tabtext2.visible").removeClass("visible");
  if (show) target.addClass("visible");
});
.tabtext,
.tabtext2 {
  opacity: 0;
  transition: 0.2s;
  display: none;
  position: absolute;
}

.visible {
  opacity: 1;
  display: inline-block;
}

* {
  list-style-type: none;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 100%;
  cursor: default;
  font-family: Arial;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.content {
  display: flex;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  visibility: hidden;
}

.column {
  border-right: 1px solid;
  visibility: visible;
}

.column_content {
  height: 100%;
  padding: 20px;
}

.column_content p {
  font-size: 12px;
}

.column:first-child {
  display: block;
}

li {
  z-index: 1
}

li:hover {
  cursor: pointer;
}

#categories {
  height: 100%;
}

#categories div {
  display: inline-block;
}

.tabtext2 {
  width: 300px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="content">

  <div class="column">
    <div class="column_content">
      <ul>
        <li id="one_link" class="tablink" data-target="categories">One</li>
        <li id="two_link" class="tablink" data-target="text_two">Two</li>
        <li id="three_link" class="tablink" data-target="text_three">Three</li>
      </ul>
    </div>
  </div>

  <div class="texts">
    <div id="categories" class="column tabtext">
      <div class="column_content">
        <ul>
          <li id="cats_link" class="tablink2" data-target="cats_text">Cats</li>
        </ul>
      </div>
      <div class="column tabtext2" id="cats_text">
        <div class="column_content">
          <p>The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family.</p>
        </div>
      </div>
    </div>

    <div class="column tabtext" id="text_two">
      <div class="column_content">
        <p>2 (two) is a number, numeral, and glyph. It is the natural number following 1 and preceding 3. It is the smallest and only even prime number. Because it forms the basis of a duality, it has religious and spiritual significance in many cultures.</p>
      </div>
    </div>
    <div class="column tabtext" id="text_three">
      <div class="column_content">
        <p>3 (three) is a number, numeral, and glyph. It is the natural number following 2 and preceding 4, and is the smallest odd prime number. It has religious or cultural significance in many societies.</p>
      </div>
    </div>
  </div>
</div>

Getting the number of branch and bound nodes explored CPLEX

copy iconCopydownload iconDownload
    prob.set_log_stream(None)
    prob.set_error_stream(None)
    prob.set_warning_stream(None)
    prob.set_results_stream(None)
Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
CPXPARAM_Read_DataCheck                          1
Found incumbent of value 0.000000 after 0.00 sec. (0.00 ticks)
MIP Presolve eliminated 1 redundant SOS constraints.
Tried aggregator 1 time.
MIP Presolve eliminated 2 rows and 2 columns.
Reduced MIP has 0 rows, 2 columns, and 0 nonzeros.
Reduced MIP has 2 binaries, 0 generals, 1 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (0.00 ticks)
Probing time = 0.00 sec. (0.00 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 1 rows and 2 columns.
All rows and columns eliminated.
Presolve time = 0.00 sec. (0.00 ticks)

Root node processing (before b&c):
  Real time             =    0.00 sec. (0.01 ticks)
Parallel b&c, 8 threads:
  Real time             =    0.00 sec. (0.00 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =    0.00 sec. (0.01 ticks)
-----------------------
    prob.set_log_stream(None)
    prob.set_error_stream(None)
    prob.set_warning_stream(None)
    prob.set_results_stream(None)
Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
CPXPARAM_Read_DataCheck                          1
Found incumbent of value 0.000000 after 0.00 sec. (0.00 ticks)
MIP Presolve eliminated 1 redundant SOS constraints.
Tried aggregator 1 time.
MIP Presolve eliminated 2 rows and 2 columns.
Reduced MIP has 0 rows, 2 columns, and 0 nonzeros.
Reduced MIP has 2 binaries, 0 generals, 1 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (0.00 ticks)
Probing time = 0.00 sec. (0.00 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 1 rows and 2 columns.
All rows and columns eliminated.
Presolve time = 0.00 sec. (0.00 ticks)

Root node processing (before b&c):
  Real time             =    0.00 sec. (0.01 ticks)
Parallel b&c, 8 threads:
  Real time             =    0.00 sec. (0.00 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =    0.00 sec. (0.01 ticks)

Community Discussions

Trending Discussions on duality
  • iterate over columns to count words in a sentence and put it in a new column
  • Gurobi: Objective Value of Primal not equal to dual (transportation problem)
  • How to set a button if clicked, ignore the mouseout on vanilla JS?
  • Css grid styling 2 vertical columns infinite rows from 2 different types of div
  • Vectors, gather/scatter and sparse arrays
  • Using regex modification only in a selected part of a text
  • (Yet Another) 'ImportError: No module named my_module'
  • Arithmetic operation resulted in an overflow even after applying unchecked
  • jQuery: Toggleable path-like navigation with decorations
  • Isotope: Gallery with flexible column width does not work in specific case
Trending Discussions on duality

QUESTION

iterate over columns to count words in a sentence and put it in a new column

Asked 2022-Apr-08 at 04:54

I have some columns titles essay 0-9, I want to iterate over them count the words and then make a new column with the number of words. so essay0 will get a column essay0_num with 5 if that is how many words it has in it.

so far i got cupid <- cupid %>% mutate(essay9_num = sapply(strsplit(essay9, " "), length)) to count the words and add a column but i don't want to do it one by one for all 10.

i tried a for loop:

for (i in 0:31) {
   cupid <- cupid %>% mutate(xxx_num = sapply(strsplit(xxx, " "), length))
}

but i am not sure how iterate the columns in a for loop in R. I thought maybe i can pull out the columns i need and put them into a new df and use sapply somehow that way? but i still run into the problem of iterating over the columns.

dput:

dput(head(cupid))
structure(list(age = c(22L, 35L, 38L, 23L, 29L, 29L), status = c("single", 
"single", "available", "single", "single", "single"), sex = c("m",
"m", "m", "m", "m", "m"), orientation = c("straight", "straight",
"straight", "straight", "straight", "straight"), body_type = c("a little extra",
"average", "thin", "thin", "athletic", "average"), diet = c("strictly anything",
"mostly other", "anything", "vegetarian", "", "mostly anything"
), drinks = c("socially", "often", "socially", "socially", "socially", 
"socially"), drugs = c("never", "sometimes", "", "", "never",
""), education = c("working on college/university", "working on space camp",
"graduated from masters program", "working on college/university",
"graduated from college/university", "graduated from college/university"
), ethnicity = c("asian, white", "white", "", "white", "asian, black, other",
"white"), height = c(75, 70, 68, 71, 66, 67), income = c(-1L, 
80000L, -1L, 20000L, -1L, -1L), job = c("transportation", "hospitality / travel",
"", "student", "artistic / musical / writer", "computer / hardware / software"
), last_online = c("2012-06-28-20-30", "2012-06-29-21-41", "2012-06-27-09-10",
"2012-06-28-14-22", "2012-06-27-21-26", "2012-06-29-19-18"),
    location = c("south san francisco, california", "oakland, california",
    "san francisco, california", "berkeley, california", "san francisco, california", 
    "san francisco, california"), offspring = c("doesn't have kids, but might want them",
    "doesn't have kids, but might want them", "", "doesn't want kids",
    "", "doesn't have kids, but might want them"), pets = c("likes dogs and likes cats",
    "likes dogs and likes cats", "has cats", "likes cats", "likes dogs and likes cats",
    "likes cats"), religion = c("agnosticism and very serious about it",
    "agnosticism but not too serious about it", "", "", "", "atheism"
    ), sign = c("gemini", "cancer", "pisces but it doesn&rsquo;t matter",
    "pisces", "aquarius", "taurus"), smokes = c("sometimes",
    "no", "no", "no", "no", "no"), speaks = c("english", "english (fluently), spanish (poorly), french (poorly)",
    "english, french, c++", "english, german (poorly)", "english",
    "english (fluently), chinese (okay)"), essay0 = c("about me:  i would love to think that i was some some kind of intellectual: either the dumbest smart guy, or the smartest dumb guy. can't say i can tell the difference. i love to talk about ideas and concepts. i forge odd metaphors instead of reciting cliches. like the simularities between a friend of mine's house and an underwater salt mine. my favorite word is salt by the way (weird choice i know). to me most things in life are better as metaphors. i seek to 
make myself a little better everyday, in some productively lazy way. got tired of tying my shoes. considered hiring a five year old, but would probably have to tie both of our shoes... decided to only wear leather shoes dress shoes.  about you:  you love to have really serious, really deep conversations about really silly stuff. you have to be willing to snap me out of a light hearted rant with a kiss. you don't have to be funny, but you have to be able to make me laugh. you should be able to bend spoons with your 
mind, and telepathically make me smile while i am still at work. you should love life, and be cool with just letting the wind blow. extra points for reading all this and guessing my favorite video game (no hints given yet). and lastly you have a good attention span.",
    "i am a chef: this is what that means. 1. i am a workaholic. 2. i love to cook regardless of whether i am at work. 3. i love to drink and eat foods that are probably really bad for me. 4. i love being around people that resemble line 1-3. i love the outdoors and i am an avid skier. if its snowing i will be in tahoe at the very least. i am a very confident and friendly. i'm not interested in acting or being a typical guy. i have no time or patience for rediculous acts of territorial pissing. overall i am a very 
likable easygoing individual. i am very adventurous and always looking forward to doing new things and hopefully sharing it with the right person.",
    "i'm not ashamed of much, but writing public text on an online dating site makes me pleasantly uncomfortable. i'll try to be as earnest as possible in the noble endeavor of standing naked before the world.  i've lived in san francisco for 15 years, and both love it and find myself frustrated with its deficits. lots of great friends and acquaintances (which increases my apprehension to put anything on this site), but i'm feeling like meeting some new people that aren't just friends of friends. it's okay if you are a friend of a friend too. chances are, if you make it through the complex filtering process of multiple choice questions, lifestyle statistics, photo scanning, and these indulgent blurbs of text without moving quickly on to another search result, you are probably already a cultural peer and at most 2 people removed. at first, i thought i should say as little as possible here to avoid 
you, but that seems silly.  as far as culture goes, i'm definitely more on the weird side of the spectrum, but i don't exactly wear it on my sleeve. once you get me talking, it will probably become increasingly apparent that while i'd like to think of myself as just like everybody else (and by some definition i certainly am), most people don't see me that way. that's fine with me. most of the people i find myself gravitating towards are pretty weird themselves. you probably are too.",
    "i work in a library and go to school. . .", "hey how's it going? currently vague on the profile i know, more to come soon. looking to meet new folks outside of my circle of friends. i'm pretty responsive on the reply tip, feel free to drop a line. cheers.",
    "i'm an australian living in san francisco, but don't hold that against me. i spend most of my days trying to build cool stuff for my company. i speak mandarin and have been known to bust out chinese songs at karaoke. i'm pretty cheeky. someone asked me if that meant something about my arse, which i find really funny.  i'm a little oddball. i have a wild imagination; i like to think 
of the most improbable reasons people are doing things just for fun. i love to laugh and look for reasons to do so. occasionally this gets me in trouble because people think i'm laughing at them. sometimes i am, but more often i'm only laughing at myself.  i'm an entrepreneur (like everyone else in sf, it seems) and i love what i do. i enjoy parties and downtime in equal measure. intelligence really turns me on and i love people who can teach me new things."
    ), essay1 = c("currently working as an international agent for a freight forwarding company. import, export, domestic you know the works. online classes and trying to better myself in my free time. perhaps a hours worth of a good book or a video game on a 
lazy sunday.",
    "dedicating everyday to being an unbelievable badass.", "i make nerdy software for musicians, artists, and experimenters to indulge in their own weirdness, but i like to spend time away from the computer when working on my artwork (which is typically more 
concerned with group dynamics and communication, than with visual form, objects, or technology). i also record and deejay dance, noise, pop, and experimental music (most of which electronic or at least studio based). besides these relatively ego driven activities, i've been enjoying things like meditation and tai chi to try and gently flirt with ego death.",
    "reading things written by old dead people", "work work work work + play",
    "building awesome stuff. figuring out what's important. having adventures. looking for treasure."
    ), essay2 = c("making people laugh. ranting about a good salting. finding simplicity in complexity, and complexity in simplicity.",
    "being silly. having ridiculous amonts of fun wherever. being a smart ass. ohh and i can cook. ;)",
    "improvising in different contexts. alternating between being present and decidedly outside of a moment, or trying to hold both at once. rambling intellectual conversations that hold said conversations in contempt while seeking to find something that transcends them. being critical while remaining generous. listening to and using body language--often performed in caricature or large 
gestures, if not outright interpretive dance. dry, dark, and raunchy humor.", 
    "playing synthesizers and organizing books according to the library of congress classification system",
    "creating imagery to look at: http://bagsbrown.blogspot.com/ http://stayruly.blogspot.com/",
    "imagining random shit. laughing at aforementioned random shit. being goofy. articulating what i think and feel. convincing people i'm right. admitting when i'm wrong.  i'm also pretty good at helping people think through problems; my friends say i give good advice. and when i don't have a clue how to help, i will say: i give pretty good hug."
    ), essay3 = c("the way i look. i am a six foot half asian, half caucasian mutt. it makes it tough not to notice me, and for me to blend in.",
    "", "my large jaw and large glasses are the physical things people comment on the most. when sufficiently stimulated, i have an unmistakable cackle of a laugh. after that, it goes in more directions than i care to describe right now. maybe i'll come back to this.",
    "socially awkward but i do my best", "i smile a lot and my inquisitive nature", 
    "i have a big smile. i also get asked if i'm wearing blue-coloured contacts (no)."
    ), essay4 = c("books: absurdistan, the republic, of mice and men (only book that made me want to cry), catcher in the rye, the prince.  movies: gladiator, operation valkyrie, the producers, down periscope.  shows: the borgia, arrested development, game of 
thrones, monty python  music: aesop rock, hail mary mallon, george thorogood and the delaware destroyers, felt  food: i'm down for anything.",
    "i am die hard christopher moore fan. i don't really watch a lot of tv unless there is humor involved. i am kind of stuck on 90's alternative music. i am pretty much a fan of everything though... i do need to draw a line at most types of electronica.",    
    "okay this is where the cultural matrix gets so specific, it's like being in the crosshairs.  for what it's worth, i find myself reading more non-fiction than fiction. it's usually some kind of philosophy, art, or science text by silly authors such as ranciere, de certeau, bataille, baudrillard, butler, stein, arendt, nietzche, zizek, etc. i'll often throw in some weird new age or pop-psychology book in the mix as well. as for fiction, i enjoy what little i've read of eco, perec, wallace, bolao, dick, vonnegut, atwood, delilo, etc. when i was young, i was a rabid asimov reader.  directors i find myself drawn to are makavejev, kuchar, jodorowsky, herzog, hara, klein, waters, verhoeven, ackerman, hitchcock, lang, gorin, goddard, miike, ohbayashi, tarkovsky, sokurov, warhol, etc. but i also like a good amount of \"trashy\" stuff. too much to name.  i definitely enjoy the character development that happens in long form episodic television over the course of 10-100 episodes, which a 1-2hr movie usually can't compete with. some of my recent tv favorites are: breaking bad, the wire, dexter, true blood, the prisoner, lost, fringe.  a smattered sampling of 
the vast field of music i like and deejay: art ensemble, sun ra, evan parker, lil wayne, dj funk, mr. fingers, maurizio, rob hood, dan bell, james blake, nonesuch recordings, omar souleyman, ethiopiques, fela kuti, john cage, meredith monk, robert ashley, terry riley, yoko ono, merzbow, tom tom club, jit, juke, bounce, hyphy, snap, crunk, b'more, kuduro, pop, noise, jazz, techno, house, 
acid, new/no wave, (post)punk, etc.  a few of the famous art/dance/theater folk that might locate my sensibility: andy warhol, bruce nauman, yayoi kusama, louise bourgeois, tino sehgal, george kuchar, michel duchamp, marina abramovic, gelatin, carolee schneeman, gustav metzger, mike kelly, mike smith, andrea fraser, gordon matta-clark, jerzy grotowski, samuel beckett, antonin artaud, tadeusz kantor, anna halperin, merce cunningham, etc. i'm clearly leaving out a younger generation of contemporary artists, many of whom are friends.  local food regulars: sushi zone, chow, ppq, pagolac, lers ros, burma superstar, minako, shalimar, delfina pizza, rosamunde, arinells, suppenkuche, cha-ya, blue plate, golden era, etc.",
    "bataille, celine, beckett. . . lynch, jarmusch, r.w. fassbender. . . twin peaks & fishing w/ john joy division, throbbing gristle, cabaret voltaire. . . vegetarian pho and coffee",
    "music: bands, rappers, musicians at the moment: thee oh sees. forever: wu-tang books: artbooks for days audiobooks: my collection, thick (thanks audible) shows: live ones food: with stellar friends whenever movies > tv podcast: radiolab, this american life, the moth, joe rogan, the champs",
    "books: to kill a mockingbird, lord of the rings, 1984, the farseer trilogy.  music: the beatles, frank sinatra, john mayer, jason mraz, deadmau5, andrew bayer, everything on anjunadeep records, bach, satie.  tv shows: how i met your mother, scrubs, the west wing, breaking bad.  movies: star wars, the godfather pt ii, 500 days of summer, napoleon dynamite, american beauty, lotr  food: thai, vietnamese, shanghai dumplings, pizza!"
    ), essay5 = c("food. water. cell phone. shelter.", "delicious porkness in all of its glories. my big ass doughboy's sinking into 15 new inches. my overly resilient liver. a good sharp knife. my ps3... it plays blurays too. ;) my over the top energy and my 
outlook on life... just give me a bag of lemons and see what happens. ;)",
    "movement conversation creation contemplation touch humor",
    "", "", "like everyone else, i love my friends and family, and need hugs, human contact, water and sunshine. let's take that as given.  1. something to build 2. something to sing 3. something to play on (my guitar would be first choice) 4. something to write/draw on 5. a big goal worth dreaming about 6. something to laugh at"
    ), essay6 = c("duality and humorous things", "", "", "cats and german philosophy",
    "", "what my contribution to the world is going to be and/or should be. and what's for breakfast. i love breakfast."
    ), essay7 = c("trying to find someone to hang out with. i am down for anything except a club.", 
    "", "viewing. listening. dancing. talking. drinking. performing.",
    "", "", "out with my friends!"), essay8 = c("i am new to california and looking for someone to wisper my secrets to.",        
    "i am very open and will share just about anything.", "when i was five years old, i was known as \"the boogerman\".",
    "", "", "i cried on my first day at school because a bird shat on my head. true story."
    ), essay9 = c("you want to be swept off your feet! you are tired of the norm. you want to catch a coffee or a bite. or if you 
want to talk philosophy.",
    "", "you are bright, open, intense, silly, ironic, critical, caring, generous, looking for an exploration, rather than finding \"a match\" of some predetermined qualities.  i'm currently in a fabulous and open relationship, so you should be comfortable with that.",
    "you feel so inclined.", "", "you're awesome.")), row.names = c(NA,
6L), class = "data.frame")

ANSWER

Answered 2022-Apr-08 at 04:54

Use across() to apply the same function to multiple columns:

cupid %>% 
  mutate(across(starts_with("essay"), \(x) stringr::str_count(x, " +") + 1,
                .names = "{.col}_num"))
# ...other column...
#  essay0_num essay1_num essay2_num essay3_num essay4_num essay5_num essay6_num essay7_num
# 1        237         45         16         28         62          5          4         16
# 2        130          7         18          1         50         53          1          1
# 3        246         90         65         46        355          6          1          6
# 4         11          7         13          7         29          1          4          1
# 5         40          6          7          8         44          1          1          1
# 6        160         12         60         15         70         59         20          4
#   essay8_num essay9_num
# 1         14         30
# 2         10          1
# 3         12         39
# 4          1          4
# 5          1          1
# 6         17          2

I simplified your word counting logic - splitting on spaces and looking at the length is the same as counting the spaces and adding 1. Using " +" as a regex pattern means consecutive spaces will be lumped together.

Source https://stackoverflow.com/questions/71790948

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install duality

You can download it from GitHub.

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Pre-built Kits with duality
Compare Game Engine Libraries with Highest Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.