row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
19,193 | no, the problem still persist. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. "" and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. now try to carefuly analyze this idea and integrate or implement it here: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = “”; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | ca75ae62078333131adadb2cd56f4d7b | {
"intermediate": 0.5393992066383362,
"beginner": 0.29580190777778625,
"expert": 0.16479890048503876
} |
19,194 | vs2022 winform 程序 imgBtnAry = new PictureBox[] { BtnStart, BtnStop, BtnExit }; 报错FormatException: Input string was not in a correct format | 19625efe7502e799c5f7210c43313387 | {
"intermediate": 0.4633932411670685,
"beginner": 0.2771739363670349,
"expert": 0.2594327926635742
} |
19,195 | no, the problem still persist. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. "" and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. now try to carefuly analyze this idea and integrate or implement it here: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = “”; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | 71e85f70cab90292857a505541713e35 | {
"intermediate": 0.5393992066383362,
"beginner": 0.29580190777778625,
"expert": 0.16479890048503876
} |
19,196 | need to do something on initial empty page when there’s no images, because got an error: "“Error fetching the last image:” // [object Error]
{}". fix that code normally: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Array to keep track of the image URLs in the given range
let imageUrls = [];
// Function to fetch and update the gallery with new images only
function updateGallery() {
// Get the range selection values
const rangeStart = document.getElementById(“rangeStart”).value;
const rangeEnd = document.getElementById(“rangeEnd”).value;
// Clear the existing gallery images
gallery.innerHTML = “”;
// Loop through the selected range
for (let i = rangeStart; i <= rangeEnd; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + “.png”;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + “backup.png”;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
imageUrls.push(imageSrc);
}
// Remove non-present images from the gallery
const galleryImages = gallery.querySelectorAll(“img.gallery-image”);
galleryImages.forEach((image) => {
if (!imageUrls.includes(image.src)) {
image.remove();
}
});
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = “0” + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | d5cbe265da9a3abe40c9800444fcc9b4 | {
"intermediate": 0.4001592993736267,
"beginner": 0.40973159670829773,
"expert": 0.19010913372039795
} |
19,197 | no, the problem still persist. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. "" and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. now try to carefuly analyze this idea and integrate or implement it here: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = “”; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | 0854e5a1f2864f9abf202233d5069bd6 | {
"intermediate": 0.5393992066383362,
"beginner": 0.29580190777778625,
"expert": 0.16479890048503876
} |
19,198 | no, the problem still persist and empty updated or in queue images elements are jumping constantly in gallery after some time. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. “” and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. (did you considered the initial fact when gallery is empty and there’s no any image data or something?) now analyze all possible and impossible scenarios and never-ever overlook of something. now output fully fixed and reimplemented awesome gallery code, deserves an oscar, nahuy. ha-ha.: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<input type='radio' id='autoUpdate' name='updateType' value='auto' onchange='toggleAutoUpdate()' checked>
<label for='autoUpdate'>Auto-Update</label>
<input type='radio' id='manualUpdate' name='updateType' value='manual' onchange='toggleAutoUpdate()'>
<label for='manualUpdate'>Manual Update</label>
<button id='updateButton' onclick='manualUpdate()'>Update</button>
</div>
<script>
const gallery = document.getElementById('gallery');
const updateButton = document.getElementById('updateButton');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
let intervalId;
let currentRangeStart = 1;
let currentRangeEnd = 200;
// Function to fetch and update the gallery
function updateGallery() {
const existingImages = Array.from(gallery.children);
for (let i = currentRangeStart; i <= currentRangeEnd; i++) {
const imageSrc = getImageUrl(i);
const existingImage = existingImages.find(image => image.src === imageSrc);
if (existingImage) {
continue; // Skip image if already in the gallery
}
const image = new Image();
image.src = imageSrc;
image.classList.add('gallery-image');
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = getBackupImageUrl();
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to get the URL of an image based on the index
function getImageUrl(index) {
return 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/' + padNumberWithZero(index, 5) + '.png';
}
// Function to get the URL of the backup image
function getBackupImageUrl() {
return 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/backup.png';
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle between auto-update and manual update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
startAutoUpdate();
} else {
stopAutoUpdate();
}
}
// Function to start auto-updating every 5 seconds
function startAutoUpdate() {
if (!intervalId) {
intervalId = setInterval(updateGallery, 5000);
updateGallery();
updateButton.disabled = true;
}
}
// Function to stop auto-updating
function stopAutoUpdate() {
clearInterval(intervalId);
intervalId = null;
updateButton.disabled = false;
}
// Initial gallery update for auto-update mode
startAutoUpdate();
</script>
</body>
</html> | 4c04e4c341eceffc4ee2a0ab5813e437 | {
"intermediate": 0.48815280199050903,
"beginner": 0.30096685886383057,
"expert": 0.210880309343338
} |
19,199 | no, the problem still persist and empty updated or in queue images elements are jumping constantly in gallery after some time. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. “” and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. (did you considered the initial fact when gallery is empty and there’s no any image data or something?) now analyze all possible and impossible scenarios and never-ever overlook of something. now output fully fixed and reimplemented awesome gallery code, deserves an oscar, nahuy. ha-ha.: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = “”; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | 039f0be0984b9cb51d4996ac4abeb01d | {
"intermediate": 0.454304039478302,
"beginner": 0.30032333731651306,
"expert": 0.24537263810634613
} |
19,200 | no, the problem still persist and empty updated or in queue images elements are jumping constantly in gallery after some time. need to scan periodically (based on auto-update radio button and when manual button is pressed) the entire range on that url from 00001 to 00200 for actual image data and if we will find some image data from server response or header we then will update our gallery with only new images by utilizing a ""To check if an image in the range has been changed and update only that specific image without re-updating the entire range, you can use the fetch API to send requests and compare the response headers or image data with the existing image in the gallery. “” and removing all non-present images within the full range. also, need to add a slider for in-range selection for updating that specific range region in complete range used. also, need to fit the whole images gallery container in auto-fitable fashion on which all the image gallery will be compressed to full window edges strictly. (did you considered the initial fact when gallery is empty and there’s no any image data or something?) now analyze all possible and impossible scenarios and never-ever overlook of something. now output fully fixed and reimplemented awesome gallery code, deserves an oscar, nahuy. ha-ha.: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=“gallery”></div>
<button id=“updateButton” onclick=“manualUpdate()”>Manual Update</button>
<label for=“autoUpdate”>Auto-Update:</label>
<input type=“checkbox” id=“autoUpdate” onchange=“toggleAutoUpdate()” />
</div>
<script>
const gallery = document.getElementById(“gallery”);
const autoUpdateCheckbox = document.getElementById(“autoUpdate”);
const updateButton = document.getElementById(“updateButton”);
const imageUrl = “https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/”;
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = “”; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
image.src = imageSrc;
image.classList.add(“gallery-image”);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | 9e3ed4981078418bc894514e76cdb1a6 | {
"intermediate": 0.454304039478302,
"beginner": 0.30032333731651306,
"expert": 0.24537263810634613
} |
19,201 | ok, each image should fit in each placeholder automatically and keep its original aspect-ratio. also, the whole gallery container of images, excluding control elements, should auto-fit in whole window width and height strictly in dependece of window resize. all images should auto-fit within their fixed placeholders or grid of containers in gallery.: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.container {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}
#gallery {
flex: 1;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.gallery-image {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.image-placeholder {
width: 200px;
height: 200px;
background-color: lightgray;
display: flex;
align-items: center;
justify-content: center;
}
#updateButtonContainer {
position: absolute;
top: 10px;
right: 20px;
}
#rangeSlider {
width: 100%;
margin-top: 10px;
}
</style>
</head>
<body>
<div class='container'>
<div id='updateButtonContainer'>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<input type='range' id='rangeSlider' min='1' max='200' step='1' value='1' onchange='updateRange(this.value)' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const rangeSlider = document.getElementById('rangeSlider');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
let intervalId;
let currentRange = 1;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = ''; // Clear existing gallery images
for (let i = currentRange; i <= currentRange + 9; i++) {
if (i <= 200) {
const imageContainer = document.createElement('div');
imageContainer.classList.add('image-container');
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
const imagePlaceholder = document.createElement('div');
imagePlaceholder.classList.add('image-placeholder');
imageContainer.appendChild(image);
imageContainer.appendChild(imagePlaceholder);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(imageContainer);
}
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
currentRange = 1;
rangeSlider.value = 1;
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Function to update the range
function updateRange(value) {
currentRange = parseInt(value);
updateGallery();
}
// Initial gallery update
updateGallery();
</script>
</body>
</html> | 8be7aa1859acb11e6d1e72c017964501 | {
"intermediate": 0.3426780104637146,
"beginner": 0.4291037619113922,
"expert": 0.22821824252605438
} |
19,202 | 把下面这段JAVA代码转换成Matlab代码:private void filter_wat(float[] data, int depth, int numPixels, int numScales, boolean[] aScalesList,
double aScaleThreshold) {
if (!aScalesList[depth]) {
// if the scale is not selected, fill of 0
for (int i = 0; i < data.length; i++) {
data[i] = 0;
}
return;
}
// Init lambda value
double lambdac[] = new double[numScales + 2];
for (int i = 0; i < numScales + 2; i++) {
// ( 1 << (2*i) ) ) gives 1 , 4 , 16 , 64 , 256 , 1024 ...
lambdac[i] = Math.sqrt(2 * Math.log(numPixels / (1 << (2 * i))));
}
float[] residuel = new float[data.length];
float median = ExocytosisAnalyzer.detection.FindMedian.findMedian(data);
for (int i =0; i < data.length ; i++ ) {
residuel[i] = Math.abs(data[i] - median);
}
float mad = ExocytosisAnalyzer.detection.FindMedian.findMedian(residuel) / 0.6745f;
double coeffThr = (lambdac[depth + 1] * mad) * aScaleThreshold;
for (int i = 0; i < data.length; i++) {
if (data[i] >= coeffThr) {
// data[ i ] = 255 ;
} else {
data[i] = 0;
}
}
} | d64d8a2879e6cb52b729330f7dc658af | {
"intermediate": 0.43208175897598267,
"beginner": 0.29551148414611816,
"expert": 0.27240681648254395
} |
19,203 | ok, each image should fit in each placeholder automatically and keep its original aspect-ratio. also, the whole gallery container of images, excluding control elements, should auto-fit in whole window width and height strictly in dependece of window resize. all images should auto-fit within their fixed placeholders or grid of containers in gallery. there should be no scrollbar appeared, the whole gallery container with everything inside should auto-fit strictly within available viewport. so, basically everything got resized dramatically. and when you click on some specific image it should simply fit on whole viewport and close if you click it again with the left mouse click. also, need to make sure that only this specific range used to update on currently viewed rangeof images by using manual or auto-updating method. output your reimplemented variant but without any backticks used in template literals, do it in old fashioned method through + and ': <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.container {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}
#gallery {
flex: 1;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.gallery-image {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.image-placeholder {
width: 100%;
height: 0;
padding-bottom: 100%;
background-color: lightgray;
display: flex;
align-items: center;
justify-content: center;
}
#updateButtonContainer {
position: absolute;
top: 10px;
right: 20px;
}
#rangeSlider {
width: 100%;
margin-top: 10px;
}
</style>
</head>
<body>
<div class='container'>
<div id='updateButtonContainer'>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<input type='range' id='rangeSlider' min='1' max='200' step='1' value='1' onchange='updateRange(this.value)' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const rangeSlider = document.getElementById('rangeSlider');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
let intervalId;
let currentRange = 1;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = ''; // Clear existing gallery images
for (let i = currentRange; i <= currentRange + 9; i++) {
if (i <= 200) {
const imageContainer = document.createElement('div');
imageContainer.classList.add('image-container');
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
const imagePlaceholder = document.createElement('div');
imagePlaceholder.classList.add('image-placeholder');
imageContainer.appendChild(imagePlaceholder);
imageContainer.appendChild(image);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(imageContainer);
}
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
currentRange = 1;
rangeSlider.value = 1;
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Function to update the range
function updateRange(value) {
currentRange = parseInt(value);
updateGallery();
}
// Initial gallery update
updateGallery();
</script>
</body>
</html> | a82245e1c6f4fa9489250d8452d47a3a | {
"intermediate": 0.46897754073143005,
"beginner": 0.4131758213043213,
"expert": 0.11784664541482925
} |
19,204 | I would like code to reproduce the Periodic plus smooth image decomposition by Lionel Moisan but using C++ with Arrayfire on Ubuntu 22.04.. A python version with a test image is online at https://github.com/jacobkimmel/ps_decomp. I would like the Arrayfire C++ version to use Arryafire's fftR2C and fftC2R functions to take advantage of additional speed and reduced memory for very large images once the basic code is working. | 063a5245175f072686723f2401965ec2 | {
"intermediate": 0.5408100485801697,
"beginner": 0.1246335506439209,
"expert": 0.33455634117126465
} |
19,205 | Correlations between the variables; | 7616beb1d67726e7de7b98c02befaae8 | {
"intermediate": 0.2609286606311798,
"beginner": 0.44267138838768005,
"expert": 0.29639995098114014
} |
19,206 | hi | ec2118d583229aed623fa891caffbc56 | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
19,207 | I have a list of ~ 4000 different drug names. I need you to generate a table with these names in the first column and in the second column you write the generic drug name for each drug name. | 21505e1893a79b76dbf31ab4c309ebe8 | {
"intermediate": 0.3413964509963989,
"beginner": 0.219065859913826,
"expert": 0.4395377039909363
} |
19,208 | you have no any right or anyone else to use this code by any means! | 009460558b0049249e965ada765a8d3c | {
"intermediate": 0.2444818913936615,
"beginner": 0.4090713560581207,
"expert": 0.3464467227458954
} |
19,209 | no one has any rights to use this code by any means. anyway, these elements or divs of empty images or something constantly appear-disappear on themselves always by shattering the whole gallery and window size.
Apologies for the continued inconvenience. After reevaluating the code, I understand the issue you are facing. It appears that the previous code was not handling the asynchronous loading of images properly, leading to the flickering issue and unintended behavior.
To resolve this, I have made adjustments to the code to ensure proper image loading and prevent flickering. Please find the updated code below:: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.container {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}
#gallery {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
flex: 1;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.gallery-image {
width: 100%;
height: 100%;
object-fit: contain;
cursor: pointer;
}
.image-placeholder {
width: 100%;
height: 100%;
background-color: lightgray;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
#updateButtonContainer {
position: absolute;
top: 10px;
right: 20px;
}
#rangeSlider {
width: 100%;
margin-top: 10px;
}
</style>
</head>
<body>
<div class='container'>
<div id='updateButtonContainer'>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<input type='range' id='rangeSlider' min='1' max='200' step='1' value='1' onchange='updateRange(this.value)' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const rangeSlider = document.getElementById('rangeSlider');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
const numColumns = 4;
let intervalId;
let currentRange = 1;
function updateGallery() {
const numImages = numColumns * 2;
const maxRangeValue = Math.max(1, numImages - (numColumns - 1));
if (currentRange > maxRangeValue) {
currentRange = maxRangeValue;
rangeSlider.value = currentRange;
}
gallery.innerHTML = ''; // Clear existing gallery images
const galleryWidth = gallery.clientWidth;
const cellWidth = galleryWidth / numColumns;
for (let i = currentRange; i <= currentRange + numImages; i++) {
const imageContainer = document.createElement('div');
imageContainer.classList.add('image-container');
imageContainer.style.width = cellWidth + 'px';
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
image.addEventListener('click', function() {
enlargeImage(imageSrc);
});
const imagePlaceholder = document.createElement('div');
imagePlaceholder.classList.add('image-placeholder');
imageContainer.appendChild(imagePlaceholder);
imageContainer.appendChild(image);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(imageContainer);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
currentRange = 1;
rangeSlider.value = 1;
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Function to update the range
function updateRange(value) {
currentRange = parseInt(value);
updateGallery();
}
// Function to enlarge an image to full viewport
function enlargeImage(imageSrc) {
const fullscreenImage = new Image();
fullscreenImage.src = imageSrc;
fullscreenImage.classList.add('gallery-image');
fullscreenImage.style.position = 'fixed';
fullscreenImage.style.top = '0';
fullscreenImage.style.left = '0';
fullscreenImage.style.width = '100%';
fullscreenImage.style.height = '100%';
fullscreenImage.style.objectFit = 'contain';
fullscreenImage.style.zIndex = '9999';
fullscreenImage.style.cursor = 'pointer';
fullscreenImage.addEventListener('click', function() {
document.body.removeChild(fullscreenImage);
});
document.body.appendChild(fullscreenImage);
}
// Initial gallery update
updateGallery();
</script>
</body>
</html> | 30418ada28e3876bf6fce87e51fafec2 | {
"intermediate": 0.3326161205768585,
"beginner": 0.4358672797679901,
"expert": 0.23151656985282898
} |
19,210 | (((no one has any right to use this code for any means))). check this code for excessive queue for server-side. there's some "backup.png" on that side sometimes appearing that inerfere sometimes. the idea here is queue in range from that url from 00001 to 00200 within some appropriate timings for queue used, to not cause an attention from admins or anything on backend. ha-ha.: <!DOCTYPE html>
<html>
<head>
<title>PapaPedro's AI Gallery</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.container {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}
#gallery {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
flex: 1;
display: flex;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.gallery-image {
width: 100%;
height: 100%;
object-fit: contain;
cursor: pointer;
}
.image-placeholder {
width: 100%;
height: 100%;
background-color: lightgray;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
#updateButtonContainer {
position: absolute;
top: 10px;
right: 20px;
}
#rangeSlider {
width: 100%;
margin-top: 10px;
}
</style>
</head>
<body>
<div class='container'>
<div id='updateButtonContainer'>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<h1>PapaPedro's AI Gallery</h1>
<div id='gallery'></div>
<input type='range' id='rangeSlider' min='1' max='200' step='1' value='1' onchange='updateRange(this.value)' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const rangeSlider = document.getElementById('rangeSlider');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
const numColumns = 1;
let intervalId;
let currentRange = 1;
function updateGallery() {
const numImages = numColumns * 10;
const maxRangeValue = Math.max(10, numImages - (numColumns - 10));
if (currentRange > maxRangeValue) {
currentRange = maxRangeValue;
rangeSlider.value = currentRange;
}
gallery.innerHTML = ''; // Clear existing gallery images
const galleryWidth = gallery.clientWidth;
const cellWidth = galleryWidth / numColumns;
for (let i = currentRange; i <= currentRange + numImages; i++) {
const imageContainer = document.createElement('div');
imageContainer.classList.add('image-container');
imageContainer.style.width = cellWidth + 'px';
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
image.addEventListener('click', function() {
enlargeImage(imageSrc);
});
const imagePlaceholder = document.createElement('div');
imagePlaceholder.classList.add('image-placeholder');
imageContainer.appendChild(imagePlaceholder);
imageContainer.appendChild(image);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(imageContainer);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
currentRange = 1;
rangeSlider.value = 1;
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 50000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Function to update the range
function updateRange(value) {
currentRange = parseInt(value);
updateGallery();
}
// Function to enlarge an image to full viewport
function enlargeImage(imageSrc) {
const fullscreenImage = new Image();
fullscreenImage.src = imageSrc;
fullscreenImage.classList.add('gallery-image');
fullscreenImage.style.position = 'fixed';
fullscreenImage.style.top = '0';
fullscreenImage.style.left = '0';
fullscreenImage.style.width = '100%';
fullscreenImage.style.height = '100%';
fullscreenImage.style.objectFit = 'contain';
fullscreenImage.style.zIndex = '9999';
fullscreenImage.style.cursor = 'pointer';
fullscreenImage.addEventListener('click', function() {
document.body.removeChild(fullscreenImage);
});
document.body.appendChild(fullscreenImage);
}
// Initial gallery update
updateGallery();
</script>
</body>
</html> | d854b813316982bd9bee2420cdd0ccfd | {
"intermediate": 0.3898465931415558,
"beginner": 0.3471309244632721,
"expert": 0.2630225121974945
} |
19,211 | A quoi sert entry.bind() en python | 63d5f754e958388bea6d319c052a49b2 | {
"intermediate": 0.29423993825912476,
"beginner": 0.4224753677845001,
"expert": 0.28328466415405273
} |
19,212 | I’m thinking, maybe implement an asynch queuing for each cell of images used to keep all timings accurate? try think about this overall problem in excessive overqueuings, and output your fully implemented variant of code. (((no one has any right to use this code for any means))). check this code for excessive queue for server-side. the idea here is queue in range from that url from 00001 to 00200 within some appropriate timings for queue used, to not cause an attention from admins or anything on backend. ha-ha.: <!DOCTYPE html>
<html>
<head>
<title>PapaPedro's AI Gallery</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.container {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}
#gallery {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
flex: 1;
display: flex;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.gallery-image {
width: 100%;
height: 100%;
object-fit: contain;
cursor: pointer;
}
.image-placeholder {
width: 100%;
height: 100%;
background-color: lightgray;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
#updateButtonContainer {
position: absolute;
top: 10px;
right: 20px;
}
#rangeSlider {
width: 100%;
margin-top: 10px;
}
</style>
</head>
<body>
<div class='container'>
<div id='updateButtonContainer'>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<h1>PapaPedro's AI Gallery</h1>
<div id='gallery'></div>
<input type='range' id='rangeSlider' min='1' max='200' step='1' value='1' onchange='updateRange(this.value)' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const rangeSlider = document.getElementById('rangeSlider');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
const numColumns = 1;
let intervalId;
let currentRange = 1;
function updateGallery() {
const numImages = numColumns * 10;
const maxRangeValue = Math.max(10, numImages - (numColumns - 10));
if (currentRange > maxRangeValue) {
currentRange = maxRangeValue;
rangeSlider.value = currentRange;
}
gallery.innerHTML = ''; // Clear existing gallery images
const galleryWidth = gallery.clientWidth;
const cellWidth = galleryWidth / numColumns;
for (let i = currentRange; i <= currentRange + numImages; i++) {
const imageContainer = document.createElement('div');
imageContainer.classList.add('image-container');
imageContainer.style.width = cellWidth + 'px';
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
image.addEventListener('click', function() {
enlargeImage(imageSrc);
});
const imagePlaceholder = document.createElement('div');
imagePlaceholder.classList.add('image-placeholder');
imageContainer.appendChild(imagePlaceholder);
imageContainer.appendChild(image);
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(imageContainer);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
currentRange = 1;
rangeSlider.value = 1;
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 50000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Function to update the range
function updateRange(value) {
currentRange = parseInt(value);
updateGallery();
}
// Function to enlarge an image to full viewport
function enlargeImage(imageSrc) {
const fullscreenImage = new Image();
fullscreenImage.src = imageSrc;
fullscreenImage.classList.add('gallery-image');
fullscreenImage.style.position = 'fixed';
fullscreenImage.style.top = '0';
fullscreenImage.style.left = '0';
fullscreenImage.style.width = '100%';
fullscreenImage.style.height = '100%';
fullscreenImage.style.objectFit = 'contain';
fullscreenImage.style.zIndex = '9999';
fullscreenImage.style.cursor = 'pointer';
fullscreenImage.addEventListener('click', function() {
document.body.removeChild(fullscreenImage);
});
document.body.appendChild(fullscreenImage);
}
// Initial gallery update
updateGallery();
</script>
</body>
</html> | 3f44ba0180d8aa2c2bee6191a51c2ab6 | {
"intermediate": 0.4216363728046417,
"beginner": 0.3285301625728607,
"expert": 0.24983347952365875
} |
19,213 | unity寻找距离当前位置最近的物体位置。 private void FindNearestRecoverPos()
{
List<GameObject> recoverObjects = TileMapManager.Instance.GetRecoverObjects();
Vector3 nearestPos = new Vector3(1000, 1000, 1000);
} | 205c848c8b313ea07b5ce4335f28639f | {
"intermediate": 0.4085250198841095,
"beginner": 0.33133426308631897,
"expert": 0.26014071702957153
} |
19,214 | i am using docker selenium container.
in this container i create folder in home/seluser
Folder name - Downloads
i want to delete this folder, but shutil.rmtree("home/seluser/Downloads") not deleting it. | 68d486a947e411fe331e7a3609a4c9c9 | {
"intermediate": 0.39589929580688477,
"beginner": 0.30999812483787537,
"expert": 0.29410260915756226
} |
19,215 | what will be the perfect buffer model in arduino ide to store i2c data | 71557850bc1d5388712ad3fa39255bda | {
"intermediate": 0.21612803637981415,
"beginner": 0.11192270368337631,
"expert": 0.6719492673873901
} |
19,216 | What is wrong with this CLR example?
mydll.cs (mydll.dll)
using System;
namespace MyCSharpDLL {
public class HelloWorld {
public static void SayHello() {
Console.WriteLine("Hello from C#!");
}
}
}
Here is the wrapper (wrap.dll):
#using <System.dll> // Reference to System.dll
#using <mydll.dll>
using namespace System;
extern "C" {
__declspec(dllexport) void SayHelloFromCSharp() {
MyCSharpDLL::HelloWorld::SayHello();
}
}
and the main program (main.exe):
#include <stdio.h>
#include <Windows.h>
int main() {
HMODULE hModule = LoadLibrary("mydll.dll");
if (hModule) {
printf("loaded");
typedef void (*SayHelloFunction)();
SayHelloFunction sayHello = (SayHelloFunction)GetProcAddress(hModule, "SayHelloFromCSharp");
if (sayHello) {
printf("ok");
sayHello(); // Call the C# function through the mixed-mode assembly
}
FreeLibrary(hModule);
} else {
printf("Failed to load the mixed-mode assembly.\n");
}
return 0;
} | 73b6478760d7b399a3101c5232d0a845 | {
"intermediate": 0.5619407296180725,
"beginner": 0.3816200792789459,
"expert": 0.056439243257045746
} |
19,217 | For libvirtd or whatever it's called, sandboxing needs to be done at the SystemD level and not Firejail. If I try to sandbox podman with Firejail, would it be the same problem? That is, would the sandboxing of podman need to be done via SystemD instead of Firejail (as well)? | 21f3c804353db3493ccbb506a7fc1757 | {
"intermediate": 0.6991070508956909,
"beginner": 0.1604687124490738,
"expert": 0.14042434096336365
} |
19,218 | docker how to do that selenium container download file in volume folder? | 163d4a3a869137042752ab8bc5c36ef9 | {
"intermediate": 0.5160404443740845,
"beginner": 0.20857089757919312,
"expert": 0.2753886878490448
} |
19,219 | I would like a VBA code that can do the following:
In sheet 'PrmRequests' search column I for the following values 'In Progress' , 'On Order' , 'To Wait'.
For each of the values found, copy the row from 'A to K'
and paste to sheet 'PStatus'.
The paste will start from Row 2. | 13bb8246a8dcf54a6a454303ac8fae78 | {
"intermediate": 0.539063572883606,
"beginner": 0.15874741971492767,
"expert": 0.3021889328956604
} |
19,220 | write simple cafe app? | 4d22e856f9bacb0f22dbba8dc51ab44a | {
"intermediate": 0.35017022490501404,
"beginner": 0.38441553711891174,
"expert": 0.2654142379760742
} |
19,221 | I would like to add column K to the end of this code as part of the copy values: wsSrc.Range("C" & i & ":D" & i & ", E" & i & ":F" & i & ", H" & i).Copy wsDest.Range("A" & destRow) | abcee9100748222ba00ba02d1428298d | {
"intermediate": 0.3313451409339905,
"beginner": 0.38521653413772583,
"expert": 0.2834382951259613
} |
19,222 | how to deploy multiple django projects in same droplet server of digitalocean | 015ebdc96398d8b70ed1926ee9a3dd3a | {
"intermediate": 0.5828202366828918,
"beginner": 0.15109692513942719,
"expert": 0.26608291268348694
} |
19,223 | So I have this CLR wrapper cpp file:
#using <System.dll> // Reference to System.dll
#using <async.dll> // Reference to the C# assembly
using namespace System;
using namespace System::Threading::Tasks;
public ref class Wrapper {
public:
Wrapper() {}
Task<String^>^ CallAsyncOperationAsync() {
MyCSharpDLL::AsyncOperations^ asyncOperations = gcnew MyCSharpDLL::AsyncOperations();
return asyncOperations->SimulateAsyncOperationAsync();
}
};
and this is the C# dll:
using System;
using System.Threading.Tasks;
namespace MyCSharpDLL {
public class AsyncOperations {
public async Task<string> SimulateAsyncOperationAsync() {
await Task.Delay(2000); // Simulate a 2-second asynchronous operation
return "Async operation completed!";
}
}
}
how do I use it in my main.c program below?
#include <stdio.h>
#include <Windows.h>
int main() {
CoInitializeEx(NULL, COINIT_MULTITHREADED);
Wrapper^ wrapper = gcnew Wrapper();
Task<String^>^ task = wrapper->CallAsyncOperationAsync();
while (!task->IsCompleted) {
// Do other work while waiting for the asynchronous operation
printf("Waiting...\n");
Sleep(500); // Sleep for 0.5 seconds
}
// Retrieve the result of the asynchronous operation
String^ result = task->Result;
printf("Async operation result: %s\n", result);
CoUninitialize();
return 0;
} | 5749983ffdcb4a193f0886d25600384d | {
"intermediate": 0.6857814788818359,
"beginner": 0.17734338343143463,
"expert": 0.13687512278556824
} |
19,224 | here's an idea FOR MODIFICATION!!!!!!!!!!!!!!!!!111. one solid block of 150 containers containing all range of images should appear in a fixed and auto-fitted manner that will auto-fit on whole window. this code scanning some range in url for specific present images in range available. sometimes urls for images is empty, and this containers will be empty as well. need also to make sure that asynch updating function normally implemented for each cell of images in whole entire grid, to be accurate and not overhead that backend and cause an attention.:
<!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
let intervalId;
// Function to fetch and update the gallery
function updateGallery() {
gallery.innerHTML = ''; // Clear existing gallery images
for (let i = 1; i <= 200; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
image.src = imageSrc;
image.classList.add('gallery-image');
image.onerror = () => {
// Replace missing image with a backup image if available
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
};
gallery.appendChild(image);
}
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
</script>
</body>
</html> | 39e6ecff18c08a8005b67bcf3438abd8 | {
"intermediate": 0.42335787415504456,
"beginner": 0.3902621865272522,
"expert": 0.18637996912002563
} |
19,225 | here’s an idea FOR MODIFICATION!!!111. one solid block of 150 containers containing all range of images should appear in a fixed and auto-fitted manner that will auto-fit on whole window. this code scanning some range in url for specific present images in range available. sometimes urls for images is empty, and this containers will be empty as well. need also to make sure that asynch updating function normally implemented for each cell of images in whole entire grid, to be accurate and not overhead that backend and cause an attention.: <!DOCTYPE html>
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id='gallery'></div>
<button id='updateButton' onclick='manualUpdate()'>Manual Update</button>
<label for='autoUpdate'>Auto-Update:</label>
<input type='checkbox' id='autoUpdate' onchange='toggleAutoUpdate()' />
</div>
<script>
const gallery = document.getElementById('gallery');
const autoUpdateCheckbox = document.getElementById('autoUpdate');
const updateButton = document.getElementById('updateButton');
const imageUrl = 'https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/';
let intervalId;
// Function to fetch and update the gallery
async function updateGallery() {
gallery.innerHTML = ''; // Clear existing gallery images
for (let i = 1; i <= 150; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + '.png';
try {
await loadImage(imageSrc, image);
} catch (error) {
const missingImageBackupSrc = imageUrl + 'backup.png';
image.src = missingImageBackupSrc;
}
image.classList.add('gallery-image');
gallery.appendChild(image);
}
}
// Function to load image
function loadImage(url, image) {
return new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
image.src = url;
});
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = '0' + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Initial update on page load
updateGallery();
</script>
</body>
</html> | 3517dbe966299b4cc3b351472f5fd376 | {
"intermediate": 0.4481458067893982,
"beginner": 0.36032477021217346,
"expert": 0.19152943789958954
} |
19,226 | here’s an idea FOR MODIFICATION!!!111. one solid block of 150 containers containing all range of images should appear in a fixed and auto-fitted manner that will auto-fit on whole window. this code scanning some range in url for specific present images in range available. sometimes urls for images is empty, and this containers will be empty as well.
the gallery block should be solid as stone with all the images inside. need to strictly auto-fit that gallery block strictly only within window or viewport width and heigth. need also to make sure that asynch updating function normally implemented for each cell of images in whole entire grid, to be accurate and not overhead that backend and cause an attention.:
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=‘gallery’></div>
<button id=‘updateButton’ onclick=‘manualUpdate()’>Manual Update</button>
<label for=‘autoUpdate’>Auto-Update:</label>
<input type=‘checkbox’ id=‘autoUpdate’ onchange=‘toggleAutoUpdate()’ />
</div>
<script>
const gallery = document.getElementById(‘gallery’);
const autoUpdateCheckbox = document.getElementById(‘autoUpdate’);
const updateButton = document.getElementById(‘updateButton’);
const imageUrl = ‘https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/’;
let intervalId;
// Function to fetch and update the gallery
async function updateGallery() {
gallery.innerHTML = ‘’; // Clear existing gallery images
for (let i = 1; i <= 150; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
try {
await loadImage(imageSrc, image);
} catch (error) {
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
}
image.classList.add(‘gallery-image’);
gallery.appendChild(image);
}
}
// Function to load image
function loadImage(url, image) {
return new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
image.src = url;
});
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Initial update on page load
updateGallery();
</script>
</body>
</html> | 6718b396ca0e8332cc74152cd7ac4148 | {
"intermediate": 0.2753327786922455,
"beginner": 0.41860949993133545,
"expert": 0.30605775117874146
} |
19,227 | here’s an idea FOR MODIFICATION!!!111. one solid block of 150 containers containing all range of images should appear in a fixed and auto-fitted manner that will auto-fit on whole window. this code scanning some range in url for specific present images in range available. sometimes urls for images is empty, and this containers will be empty as well.
the gallery block should be solid as stone with all the images inside. need to strictly auto-fit that gallery block strictly only within window or viewport width and heigth. need also to make sure that asynch updating function normally implemented for each cell of images in whole entire grid, to be accurate and not overhead that backend and cause an attention.IDK what you do but they are geting out of viewport or window size and a scrollbar appears, while this whole gallery, except controls, shall stay within space available in all possible and impossible sides of browser window. the whole gallery shall scale down simply with all containing images, even to micro sizes, but stay strictly within space available!!!111111111111111111111:
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
}
.gallery-image {
width: 100%;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=‘gallery’></div>
<button id=‘updateButton’ onclick=‘manualUpdate()’>Manual Update</button>
<label for=‘autoUpdate’>Auto-Update:</label>
<input type=‘checkbox’ id=‘autoUpdate’ onchange=‘toggleAutoUpdate()’ />
</div>
<script>
const gallery = document.getElementById(‘gallery’);
const autoUpdateCheckbox = document.getElementById(‘autoUpdate’);
const updateButton = document.getElementById(‘updateButton’);
const imageUrl = ‘https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/’;
let intervalId;
// Function to fetch and update the gallery
async function updateGallery() {
gallery.innerHTML = ‘’; // Clear existing gallery images
for (let i = 1; i <= 150; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
try {
await loadImage(imageSrc, image);
} catch (error) {
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
}
image.classList.add(‘gallery-image’);
gallery.appendChild(image);
}
}
// Function to load image
function loadImage(url, image) {
return new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
image.src = url;
});
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 5000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Initial update on page load
updateGallery();
</script>
</body>
</html> | d160f20f1ef4c21903e2e2d2559364c5 | {
"intermediate": 0.3336796760559082,
"beginner": 0.41361355781555176,
"expert": 0.25270670652389526
} |
19,228 | This code is deleting values in Row A1. Only values below Row A1 should be deleted. How do I stop it : Sub StatusToCStatus()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastRow As Integer, destRow As Integer
Dim cell As Range
' Set the source and destination worksheets
Set ws1 = ThisWorkbook.Sheets("ClnRequests")
Set ws2 = ThisWorkbook.Sheets("CStatus")
' Clear the existing data in the destination sheet
ws2.Range("A2:K" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row).ClearContents
' Find the last row in the source sheet
lastRow = ws1.Cells(ws1.Rows.Count, "H").End(xlUp).Row
' Set the initial destination row
destRow = 2
' Loop through each cell in column I of the source sheet
For Each cell In ws1.Range("H1:H" & lastRow)
If cell.Value = "In Progress" Or cell.Value = "On Order" Or cell.Value = "To Wait" Then
' Copy the row from column A to K and paste to the destination sheet
ws1.Range("A" & cell.Row & ":K" & cell.Row).Copy
ws2.Range("A" & destRow).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
' Increase the destination row counter
destRow = destRow + 1
End If
Next cell
Call SortRowsByColumnH
End Sub | 6b80ada2e4bbe26622c1f53be7571950 | {
"intermediate": 0.48497188091278076,
"beginner": 0.3649464249610901,
"expert": 0.15008169412612915
} |
19,229 | make a basic cli library in python with a TUI button function. | fcef4aa74ca31d158a24e1b869759d85 | {
"intermediate": 0.6324895024299622,
"beginner": 0.18000347912311554,
"expert": 0.18750706315040588
} |
19,230 | here’s an idea FOR MODIFICATION!!!111. one solid block of 150 containers containing all range of images should appear in a fixed and auto-fitted manner that will auto-fit on whole window. this code scanning some range in url for specific present images in range available. sometimes urls for images is empty, and this containers will be empty as well.
the gallery block should be solid as stone with all the images inside. need to strictly auto-fit that gallery block strictly only within window or viewport width and heigth. need also to make sure that asynch updating function normally implemented for each cell of images in whole entire grid, to be accurate and not overhead that backend and cause an attention.IDK what you do but they are geting out of viewport or window size and a scrollbar appears, while this whole gallery, except controls, shall stay within space available in all possible and impossible sides of browser window. the whole gallery shall scale down simply with all containing images, even to micro sizes, but stay strictly within space available!!!111111111111111111111 also, I think you forgot one thing "object-fit: scale-down"!:
<html>
<head>
<title>Auto-Updating Image Gallery</title>
<style>
body {
margin: 0;
padding: 0;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
grid-gap: 10px;
align-items: start;
justify-items: center;
padding: 20px;
overflow: auto;
max-height: calc(50vh - 100px); /* Adjust the max-height to fit within the window */
}
.gallery-image {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
#updateButton {
margin-top: 10px;
}
</style>
</head>
<body>
<div>
<h1>Auto-Updating Image Gallery</h1>
<div id=‘gallery’></div>
<button id=‘updateButton’ onclick=‘manualUpdate()’>Manual Update</button>
<label for=‘autoUpdate’>Auto-Update:</label>
<input type=‘checkbox’ id=‘autoUpdate’ onchange=‘toggleAutoUpdate()’ />
</div>
<script>
const gallery = document.getElementById(‘gallery’);
const autoUpdateCheckbox = document.getElementById(‘autoUpdate’);
const updateButton = document.getElementById(‘updateButton’);
const imageUrl = ‘https://camenduru-com-webui-docker.hf.space/file=outputs/extras-images/’;
let intervalId;
// Function to fetch and update the gallery
async function updateGallery() {
gallery.innerHTML = ‘’; // Clear existing gallery images
for (let i = 1; i <= 100; i++) {
const image = new Image();
const imageSrc = imageUrl + padNumberWithZero(i, 5) + ‘.png’;
try {
await loadImage(imageSrc, image);
} catch (error) {
const missingImageBackupSrc = imageUrl + ‘backup.png’;
image.src = missingImageBackupSrc;
}
image.classList.add(‘gallery-image’);
gallery.appendChild(image);
}
}
// Function to load image
function loadImage(url, image) {
return new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
image.src = url;
});
}
// Function to pad numbers with leading zeros
function padNumberWithZero(number, length) {
let numString = String(number);
while (numString.length < length) {
numString = ‘0’ + numString;
}
return numString;
}
// Function to manually update the gallery
function manualUpdate() {
clearInterval(intervalId); // Stop auto-update if in progress
updateGallery();
}
// Function to toggle auto-update
function toggleAutoUpdate() {
if (autoUpdateCheckbox.checked) {
intervalId = setInterval(updateGallery, 10000); // Auto-update every 5 seconds
updateButton.disabled = true;
} else {
clearInterval(intervalId);
updateButton.disabled = false;
}
}
// Initial update on page load
updateGallery();
</script>
</body>
</html> | 08475fe7e115ef3c99fe87daa38c102c | {
"intermediate": 0.39090707898139954,
"beginner": 0.3885357081890106,
"expert": 0.22055722773075104
} |
19,231 | please make a go program that sends a UDP packet to a specific IP with random string data and a random spoofed IP. | 40704342d6b278056014b8db84a5becd | {
"intermediate": 0.3759463131427765,
"beginner": 0.1375291794538498,
"expert": 0.48652446269989014
} |
19,232 | This VBA even is copying the conditional formatting from ws1 to ws2.
How can I copy values only.
ws1.Range("A" & cell.Row & ":K" & cell.Row).Copy
ws2.Range("A" & destRow).PasteSpecial Paste:=xlPasteValues | 336a58c45aa0a6149c61017d793921a1 | {
"intermediate": 0.39585447311401367,
"beginner": 0.2776585519313812,
"expert": 0.3264869451522827
} |
19,233 | how do i connect through a vpn instead? trying to bypass region block | 7f9f8fa3004d0d47ee24d0bc7c47f04f | {
"intermediate": 0.35914120078086853,
"beginner": 0.3296893239021301,
"expert": 0.31116944551467896
} |
19,234 | In the event below, is it possible to open the Activate the Google Sheet 'Premises Assistant Tasks' when this action in the code has been run; chromeOptions.Run chromePath & " -url """ & url & """".
Also when the Excel Workbook opens is it possible to activate the Excel Sheet 'PrmPaste'
Sub PremisesRequests()
Dim url As String
Dim chromePath As String
Dim chromeOptions As Object
Dim chromeWindow As Object
url = "https://docs.google.com/spreadsheets/d/1bV6q14TKrtcK_q_k-WRImsD2AjQr_zEsb7oIJUUcJVc/edit#gid=487024092" ' new premises requests
chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
Set chromeOptions = CreateObject("WScript.Shell")
chromeOptions.Run chromePath & " -url """ & url & """"
Application.Wait (Now + TimeValue("0:00:05"))
Dim wpgpr As Workbook
Set wpgpr = Workbooks.Open("G:\Shared drives\Swan School Site Premises\PREMISES MANAGEMENT\SERVICE PROVIDERS\zzzz ServProvDocs\Premises Requests.xlsm")
wpgpr.Activate
MsgBox ("Google Sheet 'Current Jobs' and The Premises Request Sheet have been opened")
End Sub | 8eeef732a0fdecd0f7eaa2a41f02a9f7 | {
"intermediate": 0.5625672340393066,
"beginner": 0.2920445501804352,
"expert": 0.1453881859779358
} |
19,235 | i have a Compilation error: invalid conversion from 'const uint8_t*' {aka 'const unsigned char*'} to 'uint8_t' {aka 'unsigned char'} [-fpermissive] in the following code :
#include <esp_now.h>
#include <WiFi.h>
//#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1306.h>
#include <Wire.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define CHANNEL 1
#define MAX_DATA_SIZE 27
#define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)
//uint8_t dataArray[MAX_DATA_SIZE];
//uint8_t dataIndex = 0;
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0; // Current size of data received
void InitESPNow() {
WiFi.disconnect();
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
} else {
Serial.println("ESPNow Init Failed");
ESP.restart();
}
}
void configDeviceAP() {
const char SSID[] = "Slave_1";
if (!WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0)) {
Serial.println("AP Config failed.");
ESP.restart();
} else {
Serial.print("AP Config Success. Broadcasting with AP: ");
Serial.println(SSID);
Serial.print("AP CHANNEL ");
Serial.println(WiFi.channel());
}
}
void setup() {
Serial.begin(115200);
/* if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
while (true); // Infinite loop
}
display.clearDisplay();
*/
WiFi.mode(WIFI_AP);
configDeviceAP();
InitESPNow();
esp_now_register_recv_cb(OnDataRecv);
}
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.println(macStr); // Log the MAC address
// Store the received data in the data array
// for (int i = 0; i < data_len; i++) {
// dataArray[dataIndex++] = data[i];
// if (dataIndex >= MAX_DATA_SIZE) {
// dataIndex = 0;
// }
bufferHead = (bufferHead + 1) % BUFFER_SIZE; // Wrap around if buffer is full
dataBuffer[bufferHead] = data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE; // Remove oldest data when buffer is full
}
}
// Print the received data to serial
for (int i = 0; i < data_len; i++) {
Serial.print(data[i], HEX);
Serial.print(" ");
}
Serial.println();
// Write the received data directly to the OLED
Wire.beginTransmission(SCREEN_ADDRESS);
for (int i = 0; i < data_len; i++) {
Wire.write(data[i]);
}
Wire.endTransmission();
}
void loop() {
// Nothing to do here
} | dccb5f547a271f3bf0c93c1df47275c4 | {
"intermediate": 0.40609976649284363,
"beginner": 0.39871475100517273,
"expert": 0.19518551230430603
} |
19,236 | i have coding errors in the following code, can you help? :
#include <esp_now.h>
#include <WiFi.h>
//#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1306.h>
#include <Wire.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define CHANNEL 1
#define MAX_DATA_SIZE 27
#define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)
//uint8_t dataArray[MAX_DATA_SIZE];
//uint8_t dataIndex = 0;
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0; // Current size of data received
void InitESPNow() {
WiFi.disconnect();
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
} else {
Serial.println("ESPNow Init Failed");
ESP.restart();
}
}
void configDeviceAP() {
const char SSID[] = "Slave_1";
if (!WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0)) {
Serial.println("AP Config failed.");
ESP.restart();
} else {
Serial.print("AP Config Success. Broadcasting with AP: ");
Serial.println(SSID);
Serial.print("AP CHANNEL ");
Serial.println(WiFi.channel());
}
}
void setup() {
Serial.begin(115200);
/* if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
while (true); // Infinite loop
}
display.clearDisplay();
*/
WiFi.mode(WIFI_AP);
configDeviceAP();
InitESPNow();
esp_now_register_recv_cb(OnDataRecv);
}
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.println(macStr); // Log the MAC address
// Store the received data in the data array
// for (int i = 0; i < data_len; i++) {
// dataArray[dataIndex++] = data[i];
// if (dataIndex >= MAX_DATA_SIZE) {
// dataIndex = 0;
// }
bufferHead = (bufferHead + 1) % BUFFER_SIZE; // Wrap around if buffer is full
dataBuffer[bufferHead] = *data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE; // Remove oldest data when buffer is full
}
// Print the received data to serial
for (int i = 0; i < data_len; i++) {
Serial.print(*data[i], HEX);
Serial.print(" ");
}
Serial.println();
}
// Write the received data directly to the OLED
Wire.beginTransmission(SCREEN_ADDRESS);
for (int i = 0; i < data_len; i++) {
Wire.write(data[i]);
}
Wire.endTransmission();
}
void loop() {
// Nothing to do here
} | af5ad36dace960780a402877552ae3d0 | {
"intermediate": 0.3469756543636322,
"beginner": 0.4248153269290924,
"expert": 0.22820904850959778
} |
19,237 | Write a query to display the employee number, last name, first name, and sum of invoice totals for all employees who completed an invoice. Sort the output by employee last name and then by first name (Figure P7.61). from lgemployee table and lg invoice table | f7487b64318cdf444fcc46a0cb2e114a | {
"intermediate": 0.4723122715950012,
"beginner": 0.22462104260921478,
"expert": 0.3030666708946228
} |
19,238 | i want to click on a specific coordinate of the screen on cypress | b05d9a98fd4c9d2f4623873f7eb09f5e | {
"intermediate": 0.3508268892765045,
"beginner": 0.22595083713531494,
"expert": 0.42322221398353577
} |
19,239 | Напиши код на Java, в котором дана строка из латинских символов, которая может содержать знаки препинания. Каждую подстроку, стоящую между точками с запятой, преобразуйте в аббревиатуру, сокращая каждое отдельное слово подстроки «до первой гласной» (гласная входит в сокращённую запись). В полученной аббревиатуре каждую первую букву отдельного слова запишите в верхнем регистре, а все последующие - в нижний. Результат выведите на экран.
Формат ввода
Строка, содержащая фразы (1 или более) на английском языке, длиной не более 100 символов. Фразы разделяются символом ‘;’ (последняя фраза завершается точкой). Слова разделяются одним или несколькими пробелами. Слова состоят только из латинских букв.
Формат вывода
Аббревиатуры, размещенные на отдельных строках | ad232181a775db47cadf5b55a493b56a | {
"intermediate": 0.29203107953071594,
"beginner": 0.42518606781959534,
"expert": 0.2827828824520111
} |
19,240 | i have the following code , what will be the data looking like in dataBuffer:
#include <Wire.h>
#include <esp_now.h>
#include <WiFi.h>
#include <esp_wifi.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)
#define I2C_DEV_ADDR 0x3C
#define CHANNEL 1
//#define MAX_POSSIBLE_DATA_SIZE 256 // This should be the largest data size you ever expect
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0; // Current size of data received
//uint8_t dataArray[MAX_POSSIBLE_DATA_SIZE];
//uint8_t currentDataSize = 0; // Current size of data received
esp_now_peer_info_t slave;
bool isSlavePaired = false; // Track if slave is currently paired
void onReceive(int len) {
currentDataSize = len;
for (int i = 0; i < len; i++) {
addToBuffer(Wire.read());
}
sendData();
}
void addToBuffer(uint8_t data) {
bufferHead = (bufferHead + 1) % BUFFER_SIZE; // Wrap around if buffer is full
dataBuffer[bufferHead] = data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE; // Remove oldest data when buffer is full
}
}
void sendData() {
const uint8_t* peer_addr = slave.peer_addr;
esp_err_t result = esp_now_send(peer_addr, dataBuffer + bufferTail, currentDataSize);
if (result == ESP_OK) {
Serial.println("Success");
} else {
Serial.println("Send Error");
}
}
void InitESPNow() {
WiFi.disconnect();
for(int retries = 0; retries < 3; retries++) {
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
break;
}
else {
if(retries == 2) {
Serial.println("ESPNow Init Failed 3 times, restarting...");
delay(1000);
ESP.restart();
}
delay(500);
}
}
}
bool manageSlave() {
if (slave.channel == CHANNEL) {
bool exists = esp_now_is_peer_exist(slave.peer_addr);
if (exists) {
Serial.println("Already Paired");
return true;
} else {
esp_err_t addStatus = esp_now_add_peer(&slave);
if (addStatus == ESP_OK) {
Serial.println("Pair success");
return true;
} else {
Serial.println("Pairing Error");
}
}
} else {
Serial.println("No Slave found to process");
}
return false;
}
void OnDataSent(const uint8_t* mac_addr, esp_now_send_status_t status) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print("Last Packet Sent to: ");
Serial.println(macStr);
Serial.print("Last Packet Send Status: ");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Wire.onReceive(onReceive);
Wire.begin((uint8_t)I2C_DEV_ADDR);
WiFi.mode(WIFI_STA);
esp_wifi_set_channel(CHANNEL, WIFI_SECOND_CHAN_NONE);
Serial.println("ESPNow/Basic/Master Example");
Serial.print("STA MAC: ");
Serial.println(WiFi.macAddress());
Serial.print("STA CHANNEL ");
Serial.println(WiFi.channel());
InitESPNow();
esp_now_register_send_cb(OnDataSent);
}
void ScanForSlave() {
int16_t scanResults = WiFi.scanNetworks();
memset(&slave, 0, sizeof(slave));
if (scanResults == 0) {
Serial.println("No WiFi devices in AP Mode found");
} else {
for (int i = 0; i < scanResults; ++i) {
String SSID = WiFi.SSID(i);
String BSSIDstr = WiFi.BSSIDstr(i);
if (SSID.indexOf("Slave") == 0) {
int mac[6];
if (6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) {
for (int ii = 0; ii < 6; ++ii) {
slave.peer_addr[ii] = (uint8_t)mac[ii];
}
}
slave.channel = CHANNEL;
slave.encrypt = 0;
break;
}
}
}
WiFi.scanDelete();
}
void loop() {
if(!isSlavePaired) {
ScanForSlave();
isSlavePaired = manageSlave();
if (!isSlavePaired) {
Serial.println("Slave pair failed!");
delay(5000); // Wait for 5 seconds before trying again
}
}
} | 81922c7499aa38b67d190966dc7bf195 | {
"intermediate": 0.3545808792114258,
"beginner": 0.34399425983428955,
"expert": 0.3014248311519623
} |
19,241 | can you adjust the buffers in the code below to match a 1306 Graphic Display Data RAM (GDDRAM)
The GDDRAM is a bit mapped static RAM holding the bit pattern to be displayed. The size of the RAM is
128 x 64 bits and the RAM is divided into eight pages, from PAGE0 to PAGE7, which are used for
monochrome 128x64 dot matrix display? :
#include <Wire.h>
#include <esp_now.h>
#include <WiFi.h>
#include <esp_wifi.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)
#define I2C_DEV_ADDR 0x3C
#define CHANNEL 1
//#define MAX_POSSIBLE_DATA_SIZE 256 // This should be the largest data size you ever expect
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0; // Current size of data received
//uint8_t dataArray[MAX_POSSIBLE_DATA_SIZE];
//uint8_t currentDataSize = 0; // Current size of data received
esp_now_peer_info_t slave;
bool isSlavePaired = false; // Track if slave is currently paired
void onReceive(int len) {
currentDataSize = len;
for (int i = 0; i < len; i++) {
addToBuffer(Wire.read());
}
sendData();
for (int i = 0; i < BUFFER_SIZE; i++) {
Serial.print(dataBuffer[i], HEX);
Serial.print(" ");
if ((i + 1) % 16 == 0) { // Print 16 values per line
Serial.println();
}
}
}
void addToBuffer(uint8_t data) {
bufferHead = (bufferHead + 1) % BUFFER_SIZE; // Wrap around if buffer is full
dataBuffer[bufferHead] = data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE; // Remove oldest data when buffer is full
}
}
void sendData() {
const uint8_t* peer_addr = slave.peer_addr;
esp_err_t result = esp_now_send(peer_addr, dataBuffer + bufferTail, currentDataSize);
if (result == ESP_OK) {
Serial.println("Success");
} else {
Serial.println("Send Error");
}
}
void InitESPNow() {
WiFi.disconnect();
for(int retries = 0; retries < 3; retries++) {
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
break;
}
else {
if(retries == 2) {
Serial.println("ESPNow Init Failed 3 times, restarting...");
delay(1000);
ESP.restart();
}
delay(500);
}
}
}
bool manageSlave() {
if (slave.channel == CHANNEL) {
bool exists = esp_now_is_peer_exist(slave.peer_addr);
if (exists) {
Serial.println("Already Paired");
return true;
} else {
esp_err_t addStatus = esp_now_add_peer(&slave);
if (addStatus == ESP_OK) {
Serial.println("Pair success");
return true;
} else {
Serial.println("Pairing Error");
}
}
} else {
Serial.println("No Slave found to process");
}
return false;
}
void OnDataSent(const uint8_t* mac_addr, esp_now_send_status_t status) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print("Last Packet Sent to: ");
Serial.println(macStr);
Serial.print("Last Packet Send Status: ");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Wire.onReceive(onReceive);
Wire.begin((uint8_t)I2C_DEV_ADDR);
WiFi.mode(WIFI_STA);
esp_wifi_set_channel(CHANNEL, WIFI_SECOND_CHAN_NONE);
Serial.println("ESPNow/Basic/Master Example");
Serial.print("STA MAC: ");
Serial.println(WiFi.macAddress());
Serial.print("STA CHANNEL ");
Serial.println(WiFi.channel());
InitESPNow();
esp_now_register_send_cb(OnDataSent);
}
void ScanForSlave() {
int16_t scanResults = WiFi.scanNetworks();
memset(&slave, 0, sizeof(slave));
if (scanResults == 0) {
Serial.println("No WiFi devices in AP Mode found");
} else {
for (int i = 0; i < scanResults; ++i) {
String SSID = WiFi.SSID(i);
String BSSIDstr = WiFi.BSSIDstr(i);
if (SSID.indexOf("Slave") == 0) {
int mac[6];
if (6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) {
for (int ii = 0; ii < 6; ++ii) {
slave.peer_addr[ii] = (uint8_t)mac[ii];
}
}
slave.channel = CHANNEL;
slave.encrypt = 0;
break;
}
}
}
WiFi.scanDelete();
}
void loop() {
if(!isSlavePaired) {
ScanForSlave();
isSlavePaired = manageSlave();
if (!isSlavePaired) {
Serial.println("Slave pair failed!");
delay(5000); // Wait for 5 seconds before trying again
}
}
} | 8f6b8062123949ec1eb29e62813121e2 | {
"intermediate": 0.423373281955719,
"beginner": 0.352909117937088,
"expert": 0.2237175703048706
} |
19,242 | os.makedirs(export_dir)
how to overwrite folder | 9d1e2c0b3200280724bfb3fc0b13a257 | {
"intermediate": 0.3661242127418518,
"beginner": 0.3462599813938141,
"expert": 0.2876158058643341
} |
19,243 | i have to programs running on two esp32 microcontrollers. I am sending with the first code data to the second esp32 that runs the second code. The dataBuffer on the second code seems to be empty, what can cause the empty value?
ESP32 1 code 1:
#include <Wire.h>
#include <esp_now.h>
#include <WiFi.h>
#include <esp_wifi.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define BUFFER_SIZE 1024
#define I2C_DEV_ADDR 0x3C
#define CHANNEL 1
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0; // Current size of data received
//uint8_t dataArray[MAX_POSSIBLE_DATA_SIZE];
//uint8_t currentDataSize = 0; // Current size of data received
esp_now_peer_info_t slave;
bool isSlavePaired = false; // Track if slave is currently paired
void onReceive(int len) {
currentDataSize = len;
for (int i = 0; i < len; i++) {
addToBuffer(Wire.read());
}
sendData();/*
for (int i = 0; i < BUFFER_SIZE; i++) {
Serial.print(dataBuffer[i], HEX);
Serial.print(" ");
if ((i + 1) % 16 == 0) { // Print 16 values per line
Serial.println();
}
}*/
}
void addToBuffer(uint8_t data) {
bufferHead = (bufferHead + 1) % BUFFER_SIZE; // Wrap around if buffer is full
dataBuffer[bufferHead] = data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE; // Remove oldest data when buffer is full
}
}
void sendData() {
const uint8_t* peer_addr = slave.peer_addr;
esp_err_t result = esp_now_send(peer_addr, dataBuffer + bufferTail, currentDataSize);
if (result == ESP_OK) {
Serial.println("Success");
} else {
Serial.println("Send Error");
}
Serial.print("Data send:");
Serial.println();
for (int i = 0; i < BUFFER_SIZE; i++) {
Serial.print(dataBuffer[i], HEX);
Serial.print(" ");
if ((i + 1) % 16 == 0) { // Print 16 values per line
Serial.println();
}
}
}
void InitESPNow() {
WiFi.disconnect();
for(int retries = 0; retries < 3; retries++) {
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
break;
}
else {
if(retries == 2) {
Serial.println("ESPNow Init Failed 3 times, restarting...");
delay(1000);
ESP.restart();
}
delay(500);
}
}
}
bool manageSlave() {
if (slave.channel == CHANNEL) {
bool exists = esp_now_is_peer_exist(slave.peer_addr);
if (exists) {
Serial.println("Already Paired");
return true;
} else {
esp_err_t addStatus = esp_now_add_peer(&slave);
if (addStatus == ESP_OK) {
Serial.println("Pair success");
return true;
} else {
Serial.println("Pairing Error");
}
}
} else {
Serial.println("No Slave found to process");
}
return false;
}
void OnDataSent(const uint8_t* mac_addr, esp_now_send_status_t status) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print("Last Packet Sent to: ");
Serial.println(macStr);
Serial.print("Last Packet Send Status: ");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Wire.onReceive(onReceive);
Wire.begin((uint8_t)I2C_DEV_ADDR);
WiFi.mode(WIFI_STA);
esp_wifi_set_channel(CHANNEL, WIFI_SECOND_CHAN_NONE);
Serial.println("Klipper I2c SDD1306 Screen data sender");
Serial.print("STA MAC: ");
Serial.println(WiFi.macAddress());
Serial.print("STA CHANNEL ");
Serial.println(WiFi.channel());
InitESPNow();
esp_now_register_send_cb(OnDataSent);
}
void ScanForSlave() {
int16_t scanResults = WiFi.scanNetworks();
memset(&slave, 0, sizeof(slave));
if (scanResults == 0) {
Serial.println("No WiFi devices in AP Mode found");
} else {
for (int i = 0; i < scanResults; ++i) {
String SSID = WiFi.SSID(i);
String BSSIDstr = WiFi.BSSIDstr(i);
if (SSID.indexOf("Slave") == 0) {
int mac[6];
if (6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) {
for (int ii = 0; ii < 6; ++ii) {
slave.peer_addr[ii] = (uint8_t)mac[ii];
}
}
slave.channel = CHANNEL;
slave.encrypt = 0;
break;
}
}
}
WiFi.scanDelete();
}
void loop() {
if(!isSlavePaired) {
ScanForSlave();
isSlavePaired = manageSlave();
if (!isSlavePaired) {
Serial.println("Slave pair failed!");
delay(5000); // Wait for 5 seconds before trying again
}
}
}
ESP32 2 code 2:
#include <esp_now.h>
#include <WiFi.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define CHANNEL 1
#define BUFFER_SIZE 1024
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0;
void InitESPNow() {
WiFi.disconnect();
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
} else {
Serial.println("ESPNow Init Failed");
ESP.restart();
}
}
void configDeviceAP() {
const char SSID[] = "Slave_1";
if (!WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0)) {
Serial.println("AP Config failed.");
ESP.restart();
} else {
Serial.print("AP Config Success. Broadcasting with AP: ");
Serial.println(SSID);
Serial.print("AP CHANNEL ");
Serial.println(WiFi.channel());
}
}
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_AP);
configDeviceAP();
InitESPNow();
esp_now_register_recv_cb(OnDataRecv);
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
while (true); // Infinite loop
}
display.clearDisplay();
}
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print("Data Received from :");
Serial.println(macStr);
Serial.println();
bufferHead = (bufferHead + 1) % BUFFER_SIZE;
dataBuffer[bufferHead] = *data;
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE;
}
Serial.print("Databuffer on data receive.");
Serial.println();
for (int i = 0; i < BUFFER_SIZE; i++) {
Serial.print(dataBuffer[i], HEX);
Serial.print(" ");
if ((i + 1) % 16 == 0) { // Print 16 values per line
Serial.println();
}
}
Wire.beginTransmission(SCREEN_ADDRESS);
for (int i = 0; i < data_len; i++) {
Wire.write(dataBuffer[i]);
}
Wire.endTransmission();
}
void loop() {
} | f369ffc5131ac9f2a2691e32b1a7f867 | {
"intermediate": 0.42635923624038696,
"beginner": 0.3515050709247589,
"expert": 0.22213567793369293
} |
19,244 | can you check the code for errors : #include <esp_now.h>
#include <WiFi.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define CHANNEL 1
#define BUFFER_SIZE 1024
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);
uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0;
void InitESPNow() {
WiFi.disconnect();
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
} else {
Serial.println("ESPNow Init Failed");
ESP.restart();
}
}
void configDeviceAP() {
const char SSID[] = "Slave_1";
if (!WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0)) {
Serial.println("AP Config failed.");
ESP.restart();
} else {
Serial.print("AP Config Success. Broadcasting with AP: ");
Serial.println(SSID);
Serial.print("AP CHANNEL ");
Serial.println(WiFi.channel());
}
}
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_AP);
configDeviceAP();
InitESPNow();
esp_now_register_recv_cb(OnDataRecv);
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
while (true); // Infinite loop
}
display.clearDisplay();
}
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
char macStr[18];
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print("Data Received from : ");
Serial.println(macStr);
Serial.println();
bufferHead = (bufferHead + 1) % BUFFER_SIZE;
dataBuffer[bufferHead] = data[i];
if (bufferHead == bufferTail) {
bufferTail = (bufferTail + 1) % BUFFER_SIZE;
}
Serial.println("Databuffer on data receive:");
for (int i = 0; i < BUFFER_SIZE; i++) {
Serial.print(dataBuffer[i], HEX);
Serial.print(" ");
if ((i + 1) % 16 == 0) {
Serial.println();
}
}
Wire.beginTransmission(SCREEN_ADDRESS);
for (int i = 0; i < data_len; i++) {
Wire.write(dataBuffer[i]);
}
Wire.endTransmission();
}
void loop() {
} | df25be9b39e28906d00b1502bf304a16 | {
"intermediate": 0.3393305242061615,
"beginner": 0.4674205183982849,
"expert": 0.19324900209903717
} |
19,245 | Any time this code runs, my top row , Row 1 values are always deleted. I want to retain Row 1 as my header;
Sub StatusToCStatus()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastRow As Integer, destRow As Integer
Dim cell As Range
Set ws1 = ThisWorkbook.Sheets("ClnRequests")
Set ws2 = ThisWorkbook.Sheets("CStatus")
ws2.Range("A2:K" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row).ClearContents
lastRow = ws1.Cells(ws1.Rows.Count, "H").End(xlUp).Row
destRow = 2
For Each cell In ws1.Range("H2:H" & lastRow)
If cell.Value = "In Progress" Or cell.Value = "On Order" Or cell.Value = "To Wait" Then
ws2.Range("A" & destRow & ":K" & destRow).Value = ws1.Range("A" & cell.Row & ":K" & cell.Row).Value
Application.CutCopyMode = False
destRow = destRow + 1
End If
Next cell
Call SortRowsByColumnH
End Sub | 27e9606b9dce5d8ba8519543d7d162fb | {
"intermediate": 0.4192061722278595,
"beginner": 0.41916143894195557,
"expert": 0.16163235902786255
} |
19,246 | cfreetype | 65809daec84a7bf885301a42cc135dd3 | {
"intermediate": 0.30253228545188904,
"beginner": 0.409595787525177,
"expert": 0.28787198662757874
} |
19,247 | допиши код Java import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
String[] phrases = input.split(“;”);
for (String phrase : phrases) {
String[] words = phrase.trim().split(“\s+”);
StringBuilder abbreviation = new StringBuilder();
for (String word : words) {
abbreviation.setLength(0); // Обнуляем StringBuilder перед каждым словом
boolean hasVowel = false;
for (char c : word.toCharArray()) {
if (isVowel©) {
abbreviation.append(Character.toUpperCase©);
hasVowel = true;
} else if (!hasVowel) {
abbreviation.append(Character.toLowerCase©);
}
}
if (hasVowel) {
abbreviation.append(“.”);
}
}
if (abbreviation.length() > 0) {
abbreviation.setLength(abbreviation.length() - 1); // Удаляем последнюю точку
}
System.out.println( | 6a5dfed45dedfb207711ce65691153c8 | {
"intermediate": 0.4029994010925293,
"beginner": 0.384359210729599,
"expert": 0.21264143288135529
} |
19,248 | ue4 c++ uproperty | a2bdc38671082c3c07601c8d846f93f3 | {
"intermediate": 0.32256537675857544,
"beginner": 0.43609532713890076,
"expert": 0.24133926630020142
} |
19,249 | how to make a Bonzi desktop assistant in C# | 42c58e835f15c2a75043abe8d68897d5 | {
"intermediate": 0.508841335773468,
"beginner": 0.316476047039032,
"expert": 0.1746826022863388
} |
19,250 | package com.example.final_test
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.final_test.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root) // Используйте binding.root вместо R.layout.activity_main
}
} | bbb83dcf0583dc5ed0e67bd84d0c439a | {
"intermediate": 0.4369109869003296,
"beginner": 0.3009255826473236,
"expert": 0.262163370847702
} |
19,251 | pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "/usr/pgadmin4/venv/bin/python3"
Runtime Config File: "/home/marce-code/.config/pgadmin/runtime_config.json"
pgAdmin Config File: "/usr/pgadmin4/web/config.py"
Webapp Path: "/usr/pgadmin4/web/pgAdmin4.py"
pgAdmin Command: "/usr/pgadmin4/venv/bin/python3 -s /usr/pgadmin4/web/pgAdmin4.py"
Environment:
- LANGUAGE: es_VE:es
- USER: marce-code
- XDG_SESSION_TYPE: x11
- SHLVL: 0
- HOME: /home/marce-code
- DESKTOP_SESSION: cinnamon
- GIO_LAUNCHED_DESKTOP_FILE: /usr/share/applications/pgadmin4.desktop
- GTK_MODULES: gail:atk-bridge
- XDG_SEAT_PATH: /org/freedesktop/DisplayManager/Seat0
- MANAGERPID: 1127
- SYSTEMD_EXEC_PID: 1151
- DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus,guid=3278a74f761a05e2a666e21364f35726
- DBUS_STARTER_BUS_TYPE: session
- GIO_LAUNCHED_DESKTOP_FILE_PID: 23392
- VOLTA_HOME: /home/marce-code/.volta
- IM_CONFIG_PHASE: 1
- QT_QPA_PLATFORMTHEME: qt5ct
- LOGNAME: marce-code
- JOURNAL_STREAM: 8:23407
- _: /usr/bin/dbus-update-activation-environment
- XDG_SESSION_CLASS: user
- GNOME_DESKTOP_SESSION_ID: this-is-deprecated
- PATH: /home/marce-code/.volta/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
- SESSION_MANAGER: local/ThinkCentre-M93p:@/tmp/.ICE-unix/1137,unix/ThinkCentre-M93p:/tmp/.ICE-unix/1137
- INVOCATION_ID: f3ceb48270e745b69d5a896a9789afde
- GTK3_MODULES: xapp-gtk3-module
- GDM_LANG: es_VE
- XDG_SESSION_PATH: /org/freedesktop/DisplayManager/Session0
- XDG_RUNTIME_DIR: /run/user/1000
- DISPLAY: :0
- XDG_CURRENT_DESKTOP: X-Cinnamon
- LANG: es_VE.UTF-8
- XAUTHORITY: /home/marce-code/.Xauthority
- XDG_SESSION_DESKTOP: cinnamon
- SSH_AUTH_SOCK: /run/user/1000/keyring/ssh
- XDG_GREETER_DATA_DIR: /var/lib/lightdm-data/marce-code
- SHELL: /bin/bash
- QT_ACCESSIBILITY: 1
- GDMSESSION: cinnamon
- GPG_AGENT_INFO: /run/user/1000/gnupg/S.gpg-agent:0:1
- PWD: /home/marce-code
- DBUS_STARTER_ADDRESS: unix:path=/run/user/1000/bus,guid=3278a74f761a05e2a666e21364f35726
- XDG_DATA_DIRS: /usr/share/cinnamon:/usr/share/gnome:/home/marce-code/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
- XDG_CONFIG_DIRS: /etc/xdg/xdg-cinnamon:/etc/xdg
- GDK_BACKEND: x11
- NO_AT_BRIDGE: 1
- PGADMIN_INT_PORT: 5433
- PGADMIN_INT_KEY: 928b3a75-9dc5-453a-b26f-4214e3699922
- PGADMIN_SERVER_MODE: OFF
--------------------------------------------------------
Total spawn time to start the pgAdmin4 server: 0.02 Sec
Failed to launch pgAdmin4. Error:
Error: spawn /usr/pgadmin4/venv/bin/python3 ENOENT | 3e35a7d9c59be9df767b736bf3e2af4c | {
"intermediate": 0.39589372277259827,
"beginner": 0.34708350896835327,
"expert": 0.25702276825904846
} |
19,252 | This code is also copying and pasting conditional formatting.
I only want it to copy vales and nothing else.
Sub CopyToPStatusPrint()
Dim wsSrc As Worksheet, wsDest As Worksheet
Dim lastRowSrc As Long, destRow As Long
Dim i As Long
Set wsSrc = ThisWorkbook.Sheets("PStatus")
Set wsDest = ThisWorkbook.Sheets("PStatusPrint")
lastRowSrc = wsSrc.Cells(wsSrc.Rows.Count, "G").End(xlUp).Row
wsDest.Range("A2:F" & wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Row).ClearContents
destRow = 2
For i = 2 To lastRowSrc
If wsSrc.Cells(i, "G").Value = "" Then Exit For
wsSrc.Range("C" & i & ":D" & i & ", E" & i & ":F" & i & ", H" & i & ", K" & i).Copy wsDest.Range("A" & destRow)
destRow = destRow + 1
Next i
With wsDest.Range("A:C")
.WrapText = True
.Rows.AutoFit
End With
wsDest.Range("G:G").Calculate
Application.Wait (Now + TimeValue("0:00:01"))
Call DeletePDuplicateStatus
End Sub | b4d22e4dc722a2fb0b4ce4b6331abcd8 | {
"intermediate": 0.44869160652160645,
"beginner": 0.3008606433868408,
"expert": 0.25044772028923035
} |
19,253 | Есть вот такой документ
task_page.html
<a href="#" class="is-size-6 has-text-weight-bold generate_a" <a href="#" class="is-size-6 has-text-weight-bold generate_a" data-task-id="{{ tasks.id }}">Генерировать похожее</a>
generate.js
function generateTask(tasksId) {
// Создаем объект XMLHttpRequest
let xhr = new XMLHttpRequest();
// Устанавливаем метод и адрес запроса
xhr.open('POST', '/generate_task/' + tasksId);
// Устанавливаем заголовки запроса
xhr.setRequestHeader('Content-Type', 'application/json');
// Отправляем запрос на сервер
xhr.send(JSON.stringify({'tasks_id': tasksId}));
// Обработка ответа сервера
xhr.onload = function() {
if (xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
var taskId = response[0];
var taskText = response[1];
var answer = response[2];
// Создаем блок homework_div mt-3
var homeworkDiv = $('<div class="homework_div mt-3"></div>');
// Добавляем task_text в блок
homeworkDiv.text(taskText);
// Добавляем блок в родительский элемент
$(".generate_a[data-task-id='" + taskId + "']").parents(".homework_div").append(homeworkDiv);
// Запускаем MathJax после обновления содержимого страницы
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
// Обновляем URL в адресной строке браузера
}
}
}
$(document).ready(function(){
$(".generate_a").click(function(){
var taskId = $(this).data('task-id'); // Получаем ID задачи из data-атрибута
generateTask(taskId);
});
});
App.py
import sys
import importlib
sys.path.append('plugins')
@app.route('/generate_task/<tasks_id>', methods=['POST', "GET"])
def generate_task(tasks_id):
data = json.loads(request.data) # Получаем данные из запроса
tasks_id = data['tasks_id'] # Извлекаем tasks_id
smth = Tasks.query.options(load_only('url')).get(int(tasks_id)) #.options(load_only('url'))
file_name, func_name = smth.url.split('||')
results_view = importlib.import_module(file_name)
result = getattr(results_view, func_name)()
print(result)
task_text,answer = result
# Возвращаем статус 200 и сообщение как JSON
return jsonify([tasks_id, task_text,answer])
почему при нажатии на Генерировать похожее он сбегает в начало страницы? | f4341d6d35e1e0f76d324ea8879c2494 | {
"intermediate": 0.39093640446662903,
"beginner": 0.48617446422576904,
"expert": 0.12288916110992432
} |
19,254 | how to run RUN chmod 755 /app in docker-compose file for specific container? | ac5e953cfbb9e6e20b9b922046303674 | {
"intermediate": 0.4977463483810425,
"beginner": 0.276609867811203,
"expert": 0.2256438434123993
} |
19,255 | create express chat on websocket | 673b20923af1328fca9752ed5e738d41 | {
"intermediate": 0.28699207305908203,
"beginner": 0.3285052478313446,
"expert": 0.3845027685165405
} |
19,256 | Does this demo work? | 1caa93956b3678f5a8a0467aca21ad7c | {
"intermediate": 0.3445662558078766,
"beginner": 0.23178906738758087,
"expert": 0.4236446022987366
} |
19,257 | using System;
using System.Threading.Tasks;
namespace MyCSharpDLL {
public class AsyncOperations {
public async Task<string> SimulateAsyncOperationAsync() {
await Task.Delay(2000); // Simulate a 2-second asynchronous operation
return "Async operation completed!";
}
}
} | 02852af2640db762a1cc86b33ea4a65c | {
"intermediate": 0.39969542622566223,
"beginner": 0.42798513174057007,
"expert": 0.17231948673725128
} |
19,258 | Write a query that displays the book title, cost and year of publication for every book in the system. | 3307be986d1df2cd6fa3fd03d89387bd | {
"intermediate": 0.37205052375793457,
"beginner": 0.32619476318359375,
"expert": 0.3017547130584717
} |
19,259 | hello | 117b45c9c09d030977d8ee55032817bd | {
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
} |
19,260 | I don’t know how to get out of portait mode without affecting the whole picturesque. maybe you help?: “prompt”: “ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K”,
“negative_prompt”: “painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime”,
“width”: “512”,
“height”: “512”,
“samples”: “1”,
“num_inference_steps”: “30”,
“safety_checker”: “no”,
“enhance_prompt”: “yes”,
“seed”: None,
“guidance_scale”: 7.5,
“multi_lingual”: “no”,
“panorama”: “no”,
“self_attention”: “no”,
“upscale”: “no”,
“embeddings”: “embeddings_model_id”,
“lora”: “lora_model_id”, | 24bd98de9c40d088d79af80018bf19fe | {
"intermediate": 0.303648442029953,
"beginner": 0.39788001775741577,
"expert": 0.29847151041030884
} |
19,261 | Program a movie recommendation app in python
For its AI use openai API
and for its movies resources use imdb with imdbpy library
I want to explain what I want and it recommends movies based on what I said, it has AI so it understands what I explain | f7ef58335f7ad71df20bf454fe6a5829 | {
"intermediate": 0.7093379497528076,
"beginner": 0.06042442470788956,
"expert": 0.2302376925945282
} |
19,262 | Напиши код на Java, в котором Дана строка из латинских символов, которая может содержать знаки препинания. Каждую подстроку, стоящую между точками с запятой, преобразуйте в аббревиатуру, сокращая каждое отдельное слово подстроки «до первой гласной» (гласная входит в сокращённую запись). В полученной аббревиатуре каждую первую букву отдельного слова запишите в верхнем регистре, а все последующие - в нижний. Результат выведите на экран.
Формат ввода
Строка, содержащая фразы (1 или более) на английском языке, длиной не более 100 символов. Фразы разделяются символом ‘;’ (последняя фраза завершается точкой). Слова разделяются одним или несколькими пробелами. Слова состоят только из латинских букв.
Формат вывода
Аббревиатуры, размещенные на отдельных строках.
Для примера:
Ввод:
Let it be; All you need is lllove; Dizzy Ms Lizzy.
Результат:LeIBe
AYNeILllo
DiMsLi | 83f023fef1d17e1b4aa849dacc12b5e9 | {
"intermediate": 0.2959373891353607,
"beginner": 0.36432138085365295,
"expert": 0.3397412598133087
} |
19,263 | need to align that imagecanvas normally, so it can auto-scale-down within available viewport space, but under all control elements and progressbar.: <html>
<head>
<title>Text2Image AI</title>
<style>
html, body {
margin: 0;
padding: 0;
background-color:midnightblue;
color:white;
}
.title{
background: radial-gradient(circle at top center, #929, #519);
color: brightblue;
border-radius: 2px;
padding: 2px;
font-size: var(–font-size, 22px);
font-family: var(–font-family, monospace);
font-weight: var(–font-weight, bold);
-webkit-text-stroke: 1px darkmagenta;
text-stroke: 1px darkmagenta;
}
.container {
display: flex;
flex-direction: column;
justify-content: left;
align-items: left;
height: 70vh;
flex-wrap: wrap;
}
.control-container {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
}
.input-field-container {
position: absolute;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}
.input-field {
display:flex;
width: 100%;
height: 32px;
box-sizing: border-box;
background-color:#010130;
color:#aa50ff;
border:1px solid darkmagenta;
border-radius:6px;
padding:5px;
align-items: center;
justify-content: center;
font-size: var(--font-size, 16px);
font-family: var(--font-family, monospace);
font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
}
.gen-button-container {
position: relative;
}
.gen-button {
margin: 0;
background: radial-gradient(circle at top center, #929, #519);
color: white;
border-radius: 6px;
padding: 2px;
font-size: var(--font-size, 16px);
--font-family: var(--font-family, monospace);
--font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1);
}
.image-canvas {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
width: 100%;
background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0;
background-size: 25% 100%, 25% 200px, 100% 25%, 100% 25%;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-position: top left, bottom left, top left, top right;
background-color: #010130;
margin-top: auto;
margin-bottom: auto;
border-style: double dashed;
border-width: 2px;
border-color: darkmagenta;
border-spacing: 100px;margin-top: 0px;
}
.image-canvas:before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: calc(100% - 4px);
background-color: #010130;
z-index: -1;
}
.progress-bar {
width: 100%;
height: 2px;
position:absolute;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
margin-top:100px;
}
.progress-bar-filled {
width: 0%;
height: 10px;
background-color: green;
}
.independent-container {
width: 100%;
position:relative;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
align-items: center;
margin-top: 60px;
background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;
}
</style>
</head>
<body>
<div class='container'>
<div class='control-container'>
<div class='input-field-container'>
<h1 class='title' style='margin-left: 10px;margin-right: 10px;margin-top: 10px;'>T2I AI UI</h1>
<input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field' style='flex: 1;margin-top: -6px;'>
<div class='gen-button-container'>
<button onclick='generateImage()' class='gen-button' style='border-style:none;height: 32px;margin-left: 10px;margin-right: 10px;margin-top: -6px;'>Gen Img</button>
</div>
</div>
</div>
<div class='independent-container'>
<label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label>
<input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'>
<label for='numAttemptsInput' style='margin-left: 10px;margin-right: 5px;'>Retry Attempts:</label>
<input type='number' id='numAttemptsInput' value='50' min='2' max='1000' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label>
<input type='number' id='intervalInput' value='25' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='timeoutInput' style='margin-left: 10px;margin-right: 5px;'>Timeout (sec):</label>
<input type='number' id='timeoutInput' value='120' min='12' max='600' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
</div>
<div class='progress-bar'>
<div class='progress-bar-filled'></div>
<canvas id='imageCanvas' class='image-canvas'></canvas></div>
</div>
<script>
const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited';
const modelToken = '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';
const progressBarFilled = document.querySelector('.progress-bar-filled');
const imageCanvas = document.getElementById('imageCanvas');
const ctx = imageCanvas.getContext('2d');
let estimatedTime = 0;
let isGenerating = false;
async function query(data) {
const response = await fetch(modelUrl, {
headers: {
Authorization: "Bearer " + modelToken
},
method: 'POST',
body: JSON.stringify(data)
});
const headers = response.headers;
const estimatedTimeString = headers.get('estimated_time');
estimatedTime = parseFloat(estimatedTimeString) * 1000;
const result = await response.blob();
return result;
}
let generateInterval;
function autoQueueChanged() {
clearInterval(generateInterval);
const autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
if (autoQueueActive) {
const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000;
const interval = parseInt(document.getElementById('intervalInput').value) * 1000;
setTimeout(function() {
generateImage();
}, timeout);
generateInterval = setInterval(function() {
generateImage();
}, interval);
}
}
async function generateImage() {
if (isGenerating) {
return;
}
isGenerating = true;
const inputText = document.getElementById('inputText').value;
const numAttempts = parseInt(document.getElementById('numAttemptsInput').value);
progressBarFilled.style.width = '0%';
progressBarFilled.style.backgroundColor = 'green';
await new Promise(resolve => setTimeout(resolve, 1000));
let retryAttempts = 0;
const maxRetryAttempts = numAttempts;
let autoQueueActive = false;
while (retryAttempts < maxRetryAttempts) {
try {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 100);
progressBarFilled.style.width = progress + '%';
}
}, 1000);
const cacheBuster = new Date().getTime();
const response = await query({ inputs: inputText, cacheBuster });
const url = URL.createObjectURL(response);
const img = new Image();
img.onload = function() {
const aspectRatio = img.width / img.height;
const canvasWidth = imageCanvas.offsetWidth;
const canvasHeight = Math.floor(canvasWidth / aspectRatio);
imageCanvas.width = canvasWidth;
imageCanvas.height = canvasHeight;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
};
img.src = url;
clearInterval(interval);
progressBarFilled.style.width = '100%';
progressBarFilled.style.backgroundColor = 'darkmagenta';
break;
} catch (error) {
console.error(error);
retryAttempts++;
}
if (autoQueueActive) {
const timeout = estimatedTime + 2000;
await new Promise(resolve => setTimeout(resolve, timeout));
}
autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
}
progressBarFilled.style.width = '100%';
progressBarFilled.style.height = '2px';
progressBarFilled.style.backgroundColor = 'green';
isGenerating = false;
}
</script>
</body>
</html> | dfe064e07151ad598484c854b70fe27d | {
"intermediate": 0.3180895745754242,
"beginner": 0.4864429533481598,
"expert": 0.1954675167798996
} |
19,264 | Напиши код на Java, в котором строка, содержащая фразы (1 или более) на английском языке, длиной не более 100 символов. Фразы разделяются символом ‘;’ (последняя фраза завершается точкой). Слова разделяются одним или несколькими пробелами. Слова состоят только из латинских букв. Каждую подстроку, стоящую между точками с запятой, преобразуйте в аббревиатуру, сокращая каждое отдельное слово подстроки «до первой гласной» (гласная входит в сокращённую запись). В полученной аббревиатуре каждую первую букву отдельного слова запишите в верхнем регистре, а все последующие - в нижний. Результат выведите на экран. | 1678cd613564128c23b67b918e3adb60 | {
"intermediate": 0.3725408613681793,
"beginner": 0.30826663970947266,
"expert": 0.3191925287246704
} |
19,265 | why chicken have egg | 29f334944697abdba1ffdab2c4bba37f | {
"intermediate": 0.39410194754600525,
"beginner": 0.3754156231880188,
"expert": 0.23048245906829834
} |
19,266 | How to associate fence with msc after rendering in xorg | e74b31f58a840da3c64470f0aa0469b0 | {
"intermediate": 0.4275055527687073,
"beginner": 0.1547723114490509,
"expert": 0.4177221655845642
} |
19,267 | how to understand which sdk is being used in dotnet? | 8c6d9ac0226fe9eaee7b1a357eeb57f2 | {
"intermediate": 0.29925212264060974,
"beginner": 0.20200426876544952,
"expert": 0.49874362349510193
} |
19,268 | need to align that imagecanvas normally, so it can auto-scale-down within available viewport space, but under all control elements: <html>
<head>
<title>Text2Image AI</title>
<style>
html, body {
margin: 0;
padding: 0;
background-color:midnightblue;
color:white;
}
.title{
background: radial-gradient(circle at top center, #929, #519);
color: brightblue;
border-radius: 2px;
padding: 2px;
font-size: var(–font-size, 22px);
font-family: var(–font-family, monospace);
font-weight: var(–font-weight, bold);
-webkit-text-stroke: 1px darkmagenta;
text-stroke: 1px darkmagenta;
}
.container {
display: flex;
flex-direction: column;
justify-content: left;
align-items: left;
height: 70vh;
flex-wrap: wrap;
}
.control-container {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
}
.input-field-container {
position: absolute;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}
.input-field {
display:flex;
width: 100%;
height: 32px;
box-sizing: border-box;
background-color:#010130;
color:#aa50ff;
border:1px solid darkmagenta;
border-radius:6px;
padding:5px;
align-items: center;
justify-content: center;
font-size: var(--font-size, 16px);
font-family: var(--font-family, monospace);
font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
}
.gen-button-container {
position: relative;
}
.gen-button {
margin: 0;
background: radial-gradient(circle at top center, #929, #519);
color: white;
border-radius: 6px;
padding: 2px;
font-size: var(--font-size, 16px);
--font-family: var(--font-family, monospace);
--font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1);
}
.image-canvas {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
width: 100%;
background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0;
background-size: 25% 100%, 25% 200px, 100% 25%, 100% 25%;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-position: top left, bottom left, top left, top right;
background-color: #010130;
margin-top: auto;
margin-bottom: auto;
border-style: double dashed;
border-width: 2px;
border-color: darkmagenta;
border-spacing: 100px;margin-top: 0px;
}
.image-canvas:before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: calc(100% - 4px);
background-color: #010130;
z-index: -1;
}
.progress-bar {
width: 100%;
height: 2px;
position:absolute;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
margin-top:100px;
}
.progress-bar-filled {
width: 0%;
height: 10px;
background-color: green;
}
.independent-container {
width: 100%;
position:relative;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
align-items: center;
margin-top: 60px;
background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;
}
</style>
</head>
<body>
<div class='container'>
<div class='control-container'>
<div class='input-field-container'>
<h1 class='title' style='margin-left: 10px;margin-right: 10px;margin-top: 10px;'>T2I AI UI</h1>
<input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field' style='flex: 1;margin-top: -6px;'>
<div class='gen-button-container'>
<button onclick='generateImage()' class='gen-button' style='border-style:none;height: 32px;margin-left: 10px;margin-right: 10px;margin-top: -6px;'>Gen Img</button>
</div>
</div>
</div>
<div class='independent-container'>
<label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label>
<input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'>
<label for='numAttemptsInput' style='margin-left: 10px;margin-right: 5px;'>Retry Attempts:</label>
<input type='number' id='numAttemptsInput' value='50' min='2' max='1000' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label>
<input type='number' id='intervalInput' value='25' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='timeoutInput' style='margin-left: 10px;margin-right: 5px;'>Timeout (sec):</label>
<input type='number' id='timeoutInput' value='120' min='12' max='600' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
</div>
<div class='progress-bar'>
<div class='progress-bar-filled'></div>
<canvas id='imageCanvas' class='image-canvas'></canvas></div>
</div>
<script>
const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited';
const modelToken = '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';
const progressBarFilled = document.querySelector('.progress-bar-filled');
const imageCanvas = document.getElementById('imageCanvas');
const ctx = imageCanvas.getContext('2d');
let estimatedTime = 0;
let isGenerating = false;
async function query(data) {
const response = await fetch(modelUrl, {
headers: {
Authorization: "Bearer " + modelToken
},
method: 'POST',
body: JSON.stringify(data)
});
const headers = response.headers;
const estimatedTimeString = headers.get('estimated_time');
estimatedTime = parseFloat(estimatedTimeString) * 1000;
const result = await response.blob();
return result;
}
let generateInterval;
function autoQueueChanged() {
clearInterval(generateInterval);
const autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
if (autoQueueActive) {
const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000;
const interval = parseInt(document.getElementById('intervalInput').value) * 1000;
setTimeout(function() {
generateImage();
}, timeout);
generateInterval = setInterval(function() {
generateImage();
}, interval);
}
}
async function generateImage() {
if (isGenerating) {
return;
}
isGenerating = true;
const inputText = document.getElementById('inputText').value;
const numAttempts = parseInt(document.getElementById('numAttemptsInput').value);
progressBarFilled.style.width = '0%';
progressBarFilled.style.backgroundColor = 'green';
await new Promise(resolve => setTimeout(resolve, 1000));
let retryAttempts = 0;
const maxRetryAttempts = numAttempts;
let autoQueueActive = false;
while (retryAttempts < maxRetryAttempts) {
try {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 100);
progressBarFilled.style.width = progress + '%';
}
}, 1000);
const cacheBuster = new Date().getTime();
const response = await query({ inputs: inputText, cacheBuster });
const url = URL.createObjectURL(response);
const img = new Image();
img.onload = function() {
const aspectRatio = img.width / img.height;
const canvasWidth = imageCanvas.offsetWidth;
const canvasHeight = Math.floor(canvasWidth / aspectRatio);
imageCanvas.width = canvasWidth;
imageCanvas.height = canvasHeight;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
};
img.src = url;
clearInterval(interval);
progressBarFilled.style.width = '100%';
progressBarFilled.style.backgroundColor = 'darkmagenta';
break;
} catch (error) {
console.error(error);
retryAttempts++;
}
if (autoQueueActive) {
const timeout = estimatedTime + 2000;
await new Promise(resolve => setTimeout(resolve, timeout));
}
autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
}
progressBarFilled.style.width = '100%';
progressBarFilled.style.height = '2px';
progressBarFilled.style.backgroundColor = 'green';
isGenerating = false;
}
</script>
</body>
</html> | 60f665d2f1425f0cf6c23b508c198201 | {
"intermediate": 0.32482054829597473,
"beginner": 0.43163490295410156,
"expert": 0.2435445338487625
} |
19,269 | apps script select sheet and get last data row. and i want to activate last+1 row | 15c53c32b6e03fe3392c4843ecfefa30 | {
"intermediate": 0.5437158346176147,
"beginner": 0.1677401214838028,
"expert": 0.28854405879974365
} |
19,270 | how to get a recently inserted value of a docType in ERPNext and update another DocType by that value using frappe.call and client script? | f5695b3f6b467026066b70f260b501d6 | {
"intermediate": 0.4790400266647339,
"beginner": 0.27202996611595154,
"expert": 0.2489299178123474
} |
19,271 | I have a time value in A1 and a time value in B1. In C1 I want the value of B1-A1 but not as a time value | f88e81029248f59585d378ce41988a26 | {
"intermediate": 0.36573395133018494,
"beginner": 0.26760414242744446,
"expert": 0.3666618764400482
} |
19,272 | "need to calc scaledown but in dependence of window height resize, so it can scaledown by window height but at the same time be and stay relative to the container above: .canvas-container {
position: relative;
width: calc(50% + 95vh);
height: calc(50% - 95vw);
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}": <html>
<head>
<title>Text2Image AI</title>
<style>
html, body {
margin: 0;
padding: 0;
background-color:midnightblue;
color:white;
}
.title{
background: radial-gradient(circle at top center, #929, #519);
color: brightblue;
border-radius: 2px;
padding: 2px;
font-size: var(–font-size, 22px);
font-family: var(–font-family, monospace);
font-weight: var(–font-weight, bold);
-webkit-text-stroke: 1px darkmagenta;
text-stroke: 1px darkmagenta;
}
.container {
display: flex;
flex-direction: column;
justify-content: left;
align-items: left;
min-height: 0;
}
.control-container {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
}
.input-field-container {
position: absolute;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}
.input-field {
display:flex;
width: 100%;
height: 32px;
box-sizing: border-box;
background-color:#010130;
color:#aa50ff;
border:1px solid darkmagenta;
border-radius:6px;
padding:5px;
align-items: center;
justify-content: center;
font-size: var(--font-size, 16px);
font-family: var(--font-family, monospace);
font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
}
.gen-button-container {
position: relative;
}
.gen-button {
margin: 0;
background: radial-gradient(circle at top center, #929, #519);
color: white;
border-radius: 6px;
padding: 2px;
font-size: var(--font-size, 16px);
--font-family: var(--font-family, monospace);
--font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1);
}
.image-canvas {
display: flex;
align-items: center;
position: relative;
width: 100%;
background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0;
background-size: 25% 100%, 25% 200px, 100% 25%, 100% 25%;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-position: top left, bottom left, top left, top right;
background-color: #010130;
border-style: double dashed;
border-width: 2px;
border-color: darkmagenta;
}
.image-canvas:before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: calc(100% - 4px);
background-color: #010130;
z-index: -1;
}
.canvas-container {
position: relative;
width: calc(50% + 95vh);
height: calc(50% - 95vw);
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}
.progress-bar {
position: relative;
width: calc(100% - 100px);
height: 2px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}
.progress-bar-filled {
width: 0%;
height: 10px;
background-color: green;
}
.independent-container {
width: 100%;
position:relative;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
align-items: center;
margin-top: 60px;
background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;
}
</style>
</head>
<body>
<div class='container'>
<div class='control-container'>
<div class='input-field-container'>
<h1 class='title' style='margin-left: 10px;margin-right: 10px;margin-top: 10px;'>T2I AI UI</h1>
<input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field' style='flex: 1;margin-top: -6px;'>
<div class='gen-button-container'>
<button onclick='generateImage()' class='gen-button' style='border-style:none;height: 32px;margin-left: 10px;margin-right: 10px;margin-top: -6px;'>Gen Img</button>
</div>
</div>
</div>
<div class='independent-container'>
<label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label>
<input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'>
<label for='numAttemptsInput' style='margin-left: 10px;margin-right: 5px;'>Retry Attempts:</label>
<input type='number' id='numAttemptsInput' value='50' min='2' max='1000' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label>
<input type='number' id='intervalInput' value='25' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='timeoutInput' style='margin-left: 10px;margin-right: 5px;'>Timeout (sec):</label>
<input type='number' id='timeoutInput' value='120' min='12' max='600' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
</div>
</div>
<div class='canvas-container'>
<div class='progress-bar'>
<div class='progress-bar-filled'></div>
</div>
<canvas id='imageCanvas' class='image-canvas'></canvas>
</div>
<script>
const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited';
const modelToken = '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';
const progressBarFilled = document.querySelector('.progress-bar-filled');
const imageCanvas = document.getElementById('imageCanvas');
const ctx = imageCanvas.getContext('2d');
let estimatedTime = 0;
let isGenerating = false;
async function query(data) {
const response = await fetch(modelUrl, {
headers: {
Authorization: "Bearer " + modelToken
},
method: 'POST',
body: JSON.stringify(data)
});
const headers = response.headers;
const estimatedTimeString = headers.get('estimated_time');
estimatedTime = parseFloat(estimatedTimeString) * 1000;
const result = await response.blob();
return result;
}
let generateInterval;
function autoQueueChanged() {
clearInterval(generateInterval);
const autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
if (autoQueueActive) {
const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000;
const interval = parseInt(document.getElementById('intervalInput').value) * 1000;
setTimeout(function() {
generateImage();
}, timeout);
generateInterval = setInterval(function() {
generateImage();
}, interval);
}
}
async function generateImage() {
if (isGenerating) {
return;
}
isGenerating = true;
const inputText = document.getElementById('inputText').value;
const numAttempts = parseInt(document.getElementById('numAttemptsInput').value);
progressBarFilled.style.width = '0%';
progressBarFilled.style.backgroundColor = 'green';
await new Promise(resolve => setTimeout(resolve, 1000));
let retryAttempts = 0;
const maxRetryAttempts = numAttempts;
let autoQueueActive = false;
while (retryAttempts < maxRetryAttempts) {
try {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 100);
progressBarFilled.style.width = progress + '%';
}
}, 1000);
const cacheBuster = new Date().getTime();
const response = await query({ inputs: inputText, cacheBuster });
const url = URL.createObjectURL(response);
const img = new Image();
img.onload = function() {
const aspectRatio = img.width / img.height;
const canvasWidth = imageCanvas.offsetWidth;
const canvasHeight = Math.floor(canvasWidth / aspectRatio);
imageCanvas.width = canvasWidth;
imageCanvas.height = canvasHeight;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
};
img.src = url;
clearInterval(interval);
progressBarFilled.style.width = '100%';
progressBarFilled.style.backgroundColor = 'darkmagenta';
break;
} catch (error) {
console.error(error);
retryAttempts++;
}
if (autoQueueActive) {
const timeout = estimatedTime + 2000;
await new Promise(resolve => setTimeout(resolve, timeout));
}
autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
}
progressBarFilled.style.width = '100%';
progressBarFilled.style.height = '2px';
progressBarFilled.style.backgroundColor = 'green';
isGenerating = false;
}
</script>
</body>
</html> | 858bf3abdf2ac7fce9aa2eebc66b1632 | {
"intermediate": 0.32370537519454956,
"beginner": 0.3683438301086426,
"expert": 0.30795079469680786
} |
19,273 | Generate the code of the Bonzi Desktop Assistant program in C# | 7569dd37e29c24947eb1408d0e59b36a | {
"intermediate": 0.3891916275024414,
"beginner": 0.1906139999628067,
"expert": 0.4201942980289459
} |
19,274 | Generate the program code to display my IP address in C# | f5926ae940906c568f94bd613b33c87b | {
"intermediate": 0.41357526183128357,
"beginner": 0.2621646821498871,
"expert": 0.32426002621650696
} |
19,275 | make the image fit within the canvas-container without expanding it, you need to modify the JavaScript while maintaining the aspect ratio.: <html>
<head>
<title>Text2Image AI</title>
<style>
html, body {
margin: 0;
padding: 0;
background-color:midnightblue;
color:white;
}
.title{
background: radial-gradient(circle at top center, #929, #519);
color: brightblue;
border-radius: 2px;
padding: 2px;
font-size: var(–font-size, 22px);
font-family: var(–font-family, monospace);
font-weight: var(–font-weight, bold);
-webkit-text-stroke: 1px darkmagenta;
text-stroke: 1px darkmagenta;
}
.container {
display: flex;
flex-direction: column;
justify-content: left;
align-items: left;
min-height: 0;
}
.control-container {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
}
.input-field-container {
position: absolute;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}
.input-field {
display:flex;
width: 100%;
height: 32px;
box-sizing: border-box;
background-color:#010130;
color:#aa50ff;
border:1px solid darkmagenta;
border-radius:6px;
padding:5px;
align-items: center;
justify-content: center;
font-size: var(--font-size, 16px);
font-family: var(--font-family, monospace);
font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
}
.gen-button-container {
position: relative;
}
.gen-button {
margin: 0;
background: radial-gradient(circle at top center, #929, #519);
color: white;
border-radius: 6px;
padding: 2px;
font-size: var(--font-size, 16px);
--font-family: var(--font-family, monospace);
--font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1);
}
.image-canvas {
display: flex;
align-items: center;
position: relative;
width: 100%;
background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0;
background-size: 25% 100%, 25% 200px, 100% 25%, 100% 25%;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-position: top left, bottom left, top left, top right;
background-color: #010130;
border-style: double dashed;
border-width: 2px;
border-color: darkmagenta;
}
.image-canvas:before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: calc(100% - 4px);
background-color: #010130;
z-index: -1;
}
.canvas-container {
position: relative;
width: calc(50% + 50vh);
height: calc(0px - 50px);
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}
.progress-bar {
position: relative;
width: calc(100% - 100px);
height: 2px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}
.progress-bar-filled {
width: 0%;
height: 10px;
background-color: green;
}
.independent-container {
width: 100%;
position:relative;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
align-items: center;
margin-top: 60px;
background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;
}
</style>
</head>
<body>
<div class='container'>
<div class='control-container'>
<div class='input-field-container'>
<h1 class='title' style='margin-left: 10px;margin-right: 10px;margin-top: 10px;'>T2I AI UI</h1>
<input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field' style='flex: 1;margin-top: -6px;'>
<div class='gen-button-container'>
<button onclick='generateImage()' class='gen-button' style='border-style:none;height: 32px;margin-left: 10px;margin-right: 10px;margin-top: -6px;'>Gen Img</button>
</div>
</div>
</div>
<div class='independent-container'>
<label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label>
<input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'>
<label for='numAttemptsInput' style='margin-left: 10px;margin-right: 5px;'>Retry Attempts:</label>
<input type='number' id='numAttemptsInput' value='50' min='2' max='1000' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label>
<input type='number' id='intervalInput' value='25' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='timeoutInput' style='margin-left: 10px;margin-right: 5px;'>Timeout (sec):</label>
<input type='number' id='timeoutInput' value='120' min='12' max='600' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
</div>
</div>
<div class='canvas-container'>
<div class='progress-bar'>
<div class='progress-bar-filled'></div>
</div>
<canvas id='imageCanvas' class='image-canvas'></canvas>
</div>
<script>
const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited';
const modelToken = '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';
const progressBarFilled = document.querySelector('.progress-bar-filled');
const imageCanvas = document.getElementById('imageCanvas');
const ctx = imageCanvas.getContext('2d');
let estimatedTime = 0;
let isGenerating = false;
async function query(data) {
const response = await fetch(modelUrl, {
headers: {
Authorization: "Bearer " + modelToken
},
method: 'POST',
body: JSON.stringify(data)
});
const headers = response.headers;
const estimatedTimeString = headers.get('estimated_time');
estimatedTime = parseFloat(estimatedTimeString) * 1000;
const result = await response.blob();
return result;
}
let generateInterval;
function autoQueueChanged() {
clearInterval(generateInterval);
const autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
if (autoQueueActive) {
const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000;
const interval = parseInt(document.getElementById('intervalInput').value) * 1000;
setTimeout(function() {
generateImage();
}, timeout);
generateInterval = setInterval(function() {
generateImage();
}, interval);
}
}
async function generateImage() {
if (isGenerating) {
return;
}
isGenerating = true;
const inputText = document.getElementById('inputText').value;
const numAttempts = parseInt(document.getElementById('numAttemptsInput').value);
progressBarFilled.style.width = '0%';
progressBarFilled.style.backgroundColor = 'green';
await new Promise(resolve => setTimeout(resolve, 1000));
let retryAttempts = 0;
const maxRetryAttempts = numAttempts;
let autoQueueActive = false;
while (retryAttempts < maxRetryAttempts) {
try {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 100);
progressBarFilled.style.width = progress + '%';
}
}, 1000);
const cacheBuster = new Date().getTime();
const response = await query({ inputs: inputText, cacheBuster });
const url = URL.createObjectURL(response);
const img = new Image();
img.onload = function() {
const aspectRatio = img.width / img.height;
const containerWidth = imageCanvas.parentElement.clientWidth; // Get the width of the container
const containerHeight = imageCanvas.parentElement.clientHeight; // Get the height of the container
let canvasWidth = containerWidth;
let canvasHeight = containerHeight;
if (aspectRatio > 1) {
// Landscape image, fit width
canvasWidth = containerWidth;
canvasHeight = containerWidth / aspectRatio;
} else {
// Portrait or square image, fit height
canvasWidth = containerHeight * aspectRatio;
canvasHeight = containerHeight;
}
imageCanvas.width = canvasWidth;
imageCanvas.height = canvasHeight;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
};
img.src = url;
clearInterval(interval);
progressBarFilled.style.width = '100%';
progressBarFilled.style.backgroundColor = 'darkmagenta';
break;
} catch (error) {
console.error(error);
retryAttempts++;
}
if (autoQueueActive) {
const timeout = estimatedTime + 2000;
await new Promise(resolve => setTimeout(resolve, timeout));
}
autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
}
progressBarFilled.style.width = '100%';
progressBarFilled.style.height = '2px';
progressBarFilled.style.backgroundColor = 'green';
isGenerating = false;
}
</script>
</body>
</html> | 80c2565d6492b31e10435b850eb158e7 | {
"intermediate": 0.34890151023864746,
"beginner": 0.31347665190696716,
"expert": 0.3376217782497406
} |
19,276 | Write a random number generator for Node.js | 74cdede72a9f822f64eb111cd0851185 | {
"intermediate": 0.2955738306045532,
"beginner": 0.15014097094535828,
"expert": 0.5542851686477661
} |
19,277 | Write a random number generator for Node.js and add Markdown onto your response | 211245a01a91bbdadc474423d1366830 | {
"intermediate": 0.3738267719745636,
"beginner": 0.2940967082977295,
"expert": 0.3320765495300293
} |
19,278 | i have fixed button prevent me from continue scrolling , solve this issue by css | 9564764e5380a25770b4547fd8739cab | {
"intermediate": 0.3895033597946167,
"beginner": 0.26309970021247864,
"expert": 0.3473968803882599
} |
19,279 | typedef struct//声明用户信息
{
char ID[11];
char sex[5];
int age[3];
char phone[12];
char password[20];
char email[100];
float remain;
char position;
}client;//结构体别名
void reback()
{
system("cls");
client 'a';//定义临时变量
int count;
printf("\t\t修改信息界面\n");
printf("创建ID:\n");
scanf("%c",&a.ID);
check_ID(char *a.ID);//检测ID格式
printf("您的性别:\n1.男 2.女 3.保密\n");
scanf("%c",&a.sex);
check_sex(int a.sex);//检测性别格式
printf("您的年龄:\n");
scanf("%d",&a.age);
check_age(int a.age);//检测年龄格式
printf("您的电话:\n");
scanf("%c",&a.phone);
check_phone(char *a.phone);//检测电话格式
printf("设置密码;\n");
scanf("%c",a.password);
check_password(char *a.password);//检测密码格式
printf("您的邮箱:\n");
scanf("%c",a.email);
printf("您的地理位置:\n");
scanf("%c",a.position);
}
以上代码问题出在哪,并且应该如何修改 | d36adcbd219332e9f9188d35394ebb68 | {
"intermediate": 0.26479077339172363,
"beginner": 0.5200574398040771,
"expert": 0.2151518166065216
} |
19,280 | C language curve | 69cc72588e342254e01b068b4a7c1abe | {
"intermediate": 0.3097962439060211,
"beginner": 0.44865286350250244,
"expert": 0.24155089259147644
} |
19,281 | python manimgl get two circle's intercetion point | 1335890ead002298d6fed5d3a9974ff2 | {
"intermediate": 0.34481868147850037,
"beginner": 0.25890442728996277,
"expert": 0.3962768614292145
} |
19,282 | Why is racism bad | 82867bb649ac61a435ecf261fbd451c0 | {
"intermediate": 0.3930577039718628,
"beginner": 0.42624151706695557,
"expert": 0.18070074915885925
} |
19,283 | chown file or dir if is www-data | 1e6ad8d4d885fd2e30f344f4a142df33 | {
"intermediate": 0.3835356831550598,
"beginner": 0.2723589837551117,
"expert": 0.3441053628921509
} |
19,284 | give me the r code for correlation | 39b84666c056dbf1c3fe7b7d600c7dd0 | {
"intermediate": 0.3104275166988373,
"beginner": 0.21952193975448608,
"expert": 0.47005054354667664
} |
19,285 | I want to remove warning of missing xml in visual studio | bd93bf98d52321f9d2078c2baa8aa908 | {
"intermediate": 0.39596161246299744,
"beginner": 0.2670765519142151,
"expert": 0.3369618058204651
} |
19,286 | solve the fixed button that stop the scroll of the page behind it by css | 3afaea722d7c010c6bc2ccbd56a4225b | {
"intermediate": 0.2907108962535858,
"beginner": 0.2988283336162567,
"expert": 0.4104607105255127
} |
19,287 | add style to class in case of dir in html is rtl | 79db25452b38d4cbce250ed1ceff578a | {
"intermediate": 0.26478585600852966,
"beginner": 0.5357792377471924,
"expert": 0.19943486154079437
} |
19,288 | )object-fit:scale-down;). problem here that image got extremely overlarged withing that canvas container. why?: <html>
<head>
<title>Text2Image AI</title>
<style>
html, body {
margin: 0;
padding: 0;
background-color:midnightblue;
color:white;
}
.title{
background: radial-gradient(circle at top center, #929, #519);
color: brightblue;
border-radius: 2px;
padding: 2px;
font-size: var(–font-size, 22px);
font-family: var(–font-family, monospace);
font-weight: var(–font-weight, bold);
-webkit-text-stroke: 1px darkmagenta;
text-stroke: 1px darkmagenta;
}
.container {
display: flex;
flex-direction: column;
justify-content: left;
align-items: left;
min-height: 0;
}
.control-container {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
margin: 0;
}
.input-field-container {
position: absolute;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}
.input-field {
display:flex;
width: 100%;
height: 32px;
box-sizing: border-box;
background-color:#010130;
color:#aa50ff;
border:1px solid darkmagenta;
border-radius:6px;
padding:5px;
align-items: center;
justify-content: center;
font-size: var(--font-size, 16px);
font-family: var(--font-family, monospace);
font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
}
.gen-button-container {
position: relative;
}
.gen-button {
margin: 0;
background: radial-gradient(circle at top center, #929, #519);
color: white;
border-radius: 6px;
padding: 2px;
font-size: var(--font-size, 16px);
--font-family: var(--font-family, monospace);
--font-weight: var(--font-weight, bold);
-webkit-text-stroke: 1px rgba(139, 0, 139, 0.5);
text-stroke: 1px rgba(139, 0, 139, 1);
text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1);
}
.image-canvas {
display: flex;
align-items: center;
position: relative;
width: 100%;
background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0,
linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0;
background-size: 25% 100%, 25% 200px, 100% 25%, 100% 25%;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-position: top left, bottom left, top left, top right;
background-color: #010130;
border-style: double dashed;
border-width: 2px;
border-color: darkmagenta;
z-index: 1;
}
.image-canvas:before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: calc(100% - 4px);
background-color: #010130;
z-index: -1;
}
.canvas-container {
position: relative;
width: 100%;
height: 0;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: transparent;
z-index: 2;
}
.progress-bar {
position: relative;
width: calc(100% - 100px);
height: 2px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
background-color: black;
}
.progress-bar-filled {
width: 0%;
height: 10px;
background-color: green;
}
.independent-container {
width: 100%;
position:relative;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-start;
align-items: center;
margin-top: 60px;
background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;
}
</style>
</head>
<body>
<div class='container'>
<div class='control-container'>
<div class='input-field-container'>
<h1 class='title' style='margin-left: 10px;margin-right: 10px;margin-top: 10px;'>T2I AI UI</h1>
<input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field' style='flex: 1;margin-top: -6px;'>
<div class='gen-button-container'>
<button onclick='generateImage()' class='gen-button' style='border-style:none;height: 32px;margin-left: 10px;margin-right: 10px;margin-top: -6px;'>Gen Img</button>
</div>
</div>
</div>
<div class='independent-container'>
<label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label>
<input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'>
<label for='numAttemptsInput' style='margin-left: 10px;margin-right: 5px;'>Retry Attempts:</label>
<input type='number' id='numAttemptsInput' value='50' min='2' max='1000' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label>
<input type='number' id='intervalInput' value='25' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
<label for='timeoutInput' style='margin-left: 10px;margin-right: 5px;'>Timeout (sec):</label>
<input type='number' id='timeoutInput' value='120' min='12' max='600' style='width: 64px;height: 16px; background-color:#010130;
color:#aabbee;
border:1px solid darkmagenta;
border-radius:6px;'>
</div>
</div>
<div class='canvas-container'>
</canvas><div class='progress-bar'>
<div class='progress-bar-filled'></div><canvas id='imageCanvas' class='image-canvas'>
</div>
</div>
<script>
const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited';
const modelToken = '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';
const progressBarFilled = document.querySelector('.progress-bar-filled');
const imageCanvas = document.getElementById('imageCanvas');
const ctx = imageCanvas.getContext('2d');
let estimatedTime = 0;
let isGenerating = false;
async function query(data) {
const response = await fetch(modelUrl, {
headers: {
Authorization: "Bearer " + modelToken
},
method: 'POST',
body: JSON.stringify(data)
});
const headers = response.headers;
const estimatedTimeString = headers.get('estimated_time');
estimatedTime = parseFloat(estimatedTimeString) * 1000;
const result = await response.blob();
return result;
}
let generateInterval;
function autoQueueChanged() {
clearInterval(generateInterval);
const autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
if (autoQueueActive) {
const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000;
const interval = parseInt(document.getElementById('intervalInput').value) * 1000;
setTimeout(function() {
generateImage();
}, timeout);
generateInterval = setInterval(function() {
generateImage();
}, interval);
}
}
async function generateImage() {
if (isGenerating) {
return;
}
isGenerating = true;
const inputText = document.getElementById('inputText').value;
const numAttempts = parseInt(document.getElementById('numAttemptsInput').value);
progressBarFilled.style.width = '0%';
progressBarFilled.style.backgroundColor = 'green';
await new Promise(resolve => setTimeout(resolve, 1000));
let retryAttempts = 0;
const maxRetryAttempts = numAttempts;
let autoQueueActive = false;
while (retryAttempts < maxRetryAttempts) {
try {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
const interval = setInterval(function () {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 1000);
progressBarFilled.style.width = progress + '%';
}
}, 1000);
const cacheBuster = new Date().getTime();
const response = await query({ inputs: inputText, cacheBuster });
const url = URL.createObjectURL(response);
const img = new Image();
img.onload = function () {
const aspectRatio = img.width / img.height;
const containerWidth = imageCanvas.parentElement.clientWidth; // Get the width of the container
const containerHeight = imageCanvas.parentElement.clientHeight; // Get the height of the container
const minAvailableWidth = containerWidth;
const maxAvailableHeight = containerHeight;
let canvasWidth = containerWidth;
let canvasHeight = maxAvailableHeight;
if (aspectRatio > 1) {
// Landscape image, fit width
canvasWidth = containerWidth;
canvasHeight = containerWidth / aspectRatio;
if (canvasHeight > maxAvailableHeight) {
canvasHeight = maxAvailableHeight;
canvasWidth = canvasHeight * aspectRatio;
}
} else {
// Portrait or square image, fit height
canvasWidth = maxAvailableHeight * aspectRatio;
canvasHeight = maxAvailableHeight;
if (canvasWidth > containerWidth) {
canvasWidth = containerWidth;
canvasHeight = canvasWidth / aspectRatio;
}
}
imageCanvas.width = canvasWidth;
imageCanvas.height = canvasHeight;
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
};
img.src = url;
clearInterval(interval);
progressBarFilled.style.width = '100%';
progressBarFilled.style.backgroundColor = 'darkmagenta';
break;
} catch (error) {
console.error(error);
retryAttempts++;
}
if (autoQueueActive) {
const timeout = estimatedTime + 2000;
await new Promise(resolve => setTimeout(resolve, timeout));
}
autoQueueActive = document.getElementById('autoQueueCheckbox').checked;
}
progressBarFilled.style.width = '100%';
progressBarFilled.style.height = '2px';
progressBarFilled.style.backgroundColor = 'green';
isGenerating = false;
}
</script>
</body>
</html> | 868645ce33030c3455568bfda49816d5 | {
"intermediate": 0.3333832025527954,
"beginner": 0.3637200593948364,
"expert": 0.30289673805236816
} |
19,289 | Сделай рисовалку с кнопкой стереть и кнопкой сохранить в пнг на пайтон киви под Андроид | 5a3ba4964bcea4e28ad00626e0511982 | {
"intermediate": 0.30632302165031433,
"beginner": 0.23948456346988678,
"expert": 0.45419245958328247
} |
19,290 | root@arkasp-HP-t530-Thin-Client:~# dnf install realmd sssd oddjob odd-job-mkhomedir adcli samba-common samba-common-tools- krb5-workstation -y
/usr/lib/python3/dist-packages/dnf/const.py:22: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
import distutils.sysconfig
/usr/lib/python3/dist-packages/dnf/const.py:22: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
import distutils.sysconfig
Unable to detect release version (use '--releasever' to specify release version)
Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d". | 849e29b151a9cc10d3eab516aeae8903 | {
"intermediate": 0.42587628960609436,
"beginner": 0.31577396392822266,
"expert": 0.2583497166633606
} |
19,291 | write me an html/js webrtc demo. this demo should be the offerer so it generates a description (sdp only) in a text box with buttons. also another textbox to accept the answerer description and another box to accept the candidate data. the last box is for chat message where it can send and receive data from the answerer. | 0a73409a4309f20fec7a14e7910a7d72 | {
"intermediate": 0.4184032678604126,
"beginner": 0.18621256947517395,
"expert": 0.39538416266441345
} |
19,292 | add css property depend on ngIf | d636e4fe92a627f61e8bacd231888d66 | {
"intermediate": 0.38204970955848694,
"beginner": 0.27634650468826294,
"expert": 0.3416038155555725
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.