row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
29,511
|
need that block to be attached strictly from the right side-end of gradient expansion, so it can translate from left-initial to the most-right side in animation duration:
|
b3dc1a55222b8bc946bf95d4bb1533b8
|
{
"intermediate": 0.32159122824668884,
"beginner": 0.14034388959407806,
"expert": 0.5380648970603943
}
|
29,512
|
need that block to be attached strictly from the right side-end of gradient expansion, so it can translate from left-initial to the most-right side in animation duration. I mean that block symbol inside array. what if determine actual container width and blink it strictly in the end of container width?:
|
ae6c0ead232159853a368e4e52e1b57b
|
{
"intermediate": 0.43598371744155884,
"beginner": 0.1592952460050583,
"expert": 0.4047210216522217
}
|
29,513
|
need that block to be attached strictly from the right side-end of gradient expansion, so it can translate from left-initial to the most-right side in animation duration. I mean that block symbol inside array. what if determine actual container width and blink it strictly in the end of container width?:
|
4a83dc835913bea3dd7991765ab0eb61
|
{
"intermediate": 0.43598371744155884,
"beginner": 0.1592952460050583,
"expert": 0.4047210216522217
}
|
29,514
|
LIBTYPE libHandle = OPENLIB(L"test"));
stock the "test" string in a variable
|
cdc637215e413a1203a2eeb93e037cc2
|
{
"intermediate": 0.48164644837379456,
"beginner": 0.35123690962791443,
"expert": 0.16711659729480743
}
|
29,515
|
Write Python program that counts digits of pi number.
|
b84d0ad76a76fbed26b2dd862338732e
|
{
"intermediate": 0.4127933084964752,
"beginner": 0.22310452163219452,
"expert": 0.3641021251678467
}
|
29,516
|
Write Python program that calculates digits of pi number.
|
d473eea88d19eb4ca9cc0aeb052bb589
|
{
"intermediate": 0.3744089603424072,
"beginner": 0.2167862206697464,
"expert": 0.40880486369132996
}
|
29,517
|
need that block to be attached strictly from the right side-end of gradient expansion, so it can translate from left-initial to the most-right side in animation duration. I mean that block symbol inside array. what if determine actual container width and blink it strictly in the end of container width?:
|
7f86f26db248b5c2f5649625b63165af
|
{
"intermediate": 0.43598371744155884,
"beginner": 0.1592952460050583,
"expert": 0.4047210216522217
}
|
29,518
|
simplify this code, do something with that inserline function to not show any chaacters in trace. also append that block symbols as an animated caret cursor that blinks at gradient animation end from the most-right side. keep everything in one single line width to not switch on a new row by gradient expansion.:
|
d283390a8799846d1e535615809958d1
|
{
"intermediate": 0.34803006052970886,
"beginner": 0.23874369263648987,
"expert": 0.4132261872291565
}
|
29,519
|
simplify this code, do something with that inserline function to not show any chaacters in trace. also append that block symbols as an animated caret cursor that blinks at gradient animation end from the most-right side. keep everything in one single line width to not switch on a new row by gradient expansion.:
|
6ef2ce678bb384388f5370f533cec195
|
{
"intermediate": 0.34803006052970886,
"beginner": 0.23874369263648987,
"expert": 0.4132261872291565
}
|
29,520
|
simplify this code, do something with that inserline function to not show any chaacters in trace. also append that block symbols as an animated caret cursor that blinks at gradient animation end from the most-right side. keep everything in one single line width to not switch on a new row by gradient expansion.:
|
25f2c891a0e82a62fc59fb2e8f52cafc
|
{
"intermediate": 0.34803006052970886,
"beginner": 0.23874369263648987,
"expert": 0.4132261872291565
}
|
29,521
|
simplify this code, do something with that inserline function to not show any chaacters in trace. also append that block symbols as an animated caret cursor that blinks at gradient animation end from the most-right side. keep everything in one single line width to not switch on a new row by gradient expansion. maybe you can redo that "gradientLine.textContent = Array.from(lineText).map(() => '█').join('');" in some other fashion, because it looks just weird.:
|
3cbc84892105a7898553585b49a68716
|
{
"intermediate": 0.4870815873146057,
"beginner": 0.2146829068660736,
"expert": 0.29823553562164307
}
|
29,522
|
how it was made in sci-fi movies? do you have some movie names examples? "holographic projections". dude, curb your intusiasm. I don't remember in which movie I saw it, some ancient movie fragment, don't remember exactly. so, this block caret cursor should or suppose to be blinking on that shot animation end at the most-right side, or it should initially blink at the current caret position and after key trigger event as "space" it should morph into this shooting gradient and fly to the most-right side by disolving and then returning back to initial caret origin but without any gradient.:
|
0c54b9c14e30c7eb6b4329d1fde5fb1f
|
{
"intermediate": 0.37320417165756226,
"beginner": 0.2875690162181854,
"expert": 0.3392268419265747
}
|
29,523
|
how it was made in sci-fi movies? do you have some movie names examples? "holographic projections". dude, curb your intusiasm. I don't remember in which movie I saw it, some ancient movie fragment, don't remember exactly. so, this block caret cursor should or suppose to be blinking on that shot animation end at the most-right side, or it should initially blink at the current caret position and after key trigger event as "space" it should morph into this shooting gradient and fly to the most-right side by disolving and then returning back to initial caret origin but without any gradient.:
|
f70c5875eabe170c9e84aa51d8586a9a
|
{
"intermediate": 0.37320417165756226,
"beginner": 0.2875690162181854,
"expert": 0.3392268419265747
}
|
29,524
|
do you know maui's collectionview?
|
917d842568e3a51912e7099702e98d6c
|
{
"intermediate": 0.3516930639743805,
"beginner": 0.32089248299598694,
"expert": 0.32741451263427734
}
|
29,525
|
how it was made in sci-fi movies? do you have some movie names examples? "holographic projections". dude, curb your intusiasm. I don't remember in which movie I saw it, some ancient movie fragment, don't remember exactly. it should initially blink at the current caret position and after key trigger event as "space" it should morph into this shooting gradient and fly to the most-right side by disolving and then returning back to initial caret origin but without any gradient. try implement that concept into this code example without extremely overcomplexify all the things to absolute nonsensical extreme level of stupidity.:
|
79165e92db2066b4394a1a98dc8da4dc
|
{
"intermediate": 0.2923711836338043,
"beginner": 0.15346559882164001,
"expert": 0.5541632175445557
}
|
29,526
|
below is the data set, using python code, to fill in the missing value by reference to the same value of "Hour" column and previous value of "Date". For example, Date of 2013-01-02 and Hour of 1 , the value should be 5, because Date of 2013-01-01 and Hour of 1 , the value is 5. The another example is Date of 2013-01-02 and Hour of 13 , the value should be 17, because Date of 2013-01-01 and Hour of 13 , the value is 17.
Date|Hour|Value
2013-01-01|1|5
2013-01-01|2|6
2013-01-01|3|7
2013-01-01|4|8
2013-01-01|5|9
2013-01-01|6|10
2013-01-01|7|11
2013-01-01|8|12
2013-01-01|9|13
2013-01-01|10|14
2013-01-01|11|15
2013-01-01|12|16
2013-01-01|13|17
2013-01-01|14|18
2013-01-01|15|19
2013-01-01|16|20
2013-01-01|17|21
2013-01-01|18|22
2013-01-01|19|23
2013-01-01|20|24
2013-01-01|21|25
2013-01-01|22|26
2013-01-01|23|27
2013-01-01|24|28
2013-01-02|1|
2013-01-02|2|
2013-01-02|3|
2013-01-02|4|
2013-01-02|5|
2013-01-02|6|
2013-01-02|7|
2013-01-02|8|
2013-01-02|9|6
2013-01-02|10|6
2013-01-02|11|6
2013-01-02|12|6
2013-01-02|13|
2013-01-02|14|
2013-01-02|15|
2013-01-02|16|
2013-01-02|17|
2013-01-02|18|
2013-01-02|19|
2013-01-02|20|
2013-01-02|21|
2013-01-02|22|
2013-01-02|23|
2013-01-02|24|
|
f84f6ceaedfb562ad82ae28abc4244e2
|
{
"intermediate": 0.3298226594924927,
"beginner": 0.3217094838619232,
"expert": 0.3484678864479065
}
|
29,527
|
Counter component yasash
- maxLimit, minLimit kirita olishligi
- disabled holati
- active state, hover state
- inputga faqat raqam kirita olishligi
- componentga v-model implementation
shu so’rovga moslab vue3 jsni composition variantida kod yoz bexato ishlashini xoxlayman
|
88632dbd30b1888ec52d9f4b6ab9ee6a
|
{
"intermediate": 0.3323277235031128,
"beginner": 0.12159512937068939,
"expert": 0.5460770726203918
}
|
29,528
|
find second element inside of another element selenium though css selector, child
|
9459b4a8b2dd8dc0b907380072992e69
|
{
"intermediate": 0.3982453942298889,
"beginner": 0.28661656379699707,
"expert": 0.3151380121707916
}
|
29,529
|
find second element inside of another element selenium though css selector, child
|
f77f95eb549d7aa5f85a89f5c4bb108b
|
{
"intermediate": 0.3982453942298889,
"beginner": 0.28661656379699707,
"expert": 0.3151380121707916
}
|
29,530
|
IIf([Forms]![FrmSolfaDetail]![Che3].[OptionValue]=3;[TblSolfdetails].[payment];IIf([Forms]![FrmSolfaDetail]![Che2].[OptionValue]=2;[TblSolfdetails].[payment]=True;IIf([Forms]![FrmSolfaDetail]![Che1].[OptionValue]=1;[TblSolfdetails].[payment]=False;Null))) correct this code to working in query access
|
4f1c4994a9dff8f74263345e0f594632
|
{
"intermediate": 0.43735000491142273,
"beginner": 0.3557048738002777,
"expert": 0.20694509148597717
}
|
29,531
|
hi
|
6a5d519ccb629264ff21a516154a200f
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
29,532
|
这代码有问题//@version=5
strategy(“Supertrend RTX with Trailing Stop and Hull Moving Average Filter”, overlay=true)
// Input variables
atrPeriod = input(10, “ATR Length”)
factor = input.float(3.0, “Factor”, step=0.01)
trailingStopPercentage = input(1.0, “Trailing Stop Percentage”, step=0.1)
hullPeriod = input(14, “Hull Moving Average Period”)
// Calculate Supertrend
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// Calculate Hull Moving Average
hull = ta.hma(close, hullPeriod)
// Plot Supertrend and Hull Moving Average
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, “Up Trend”, color=color.green, style=plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, “Down Trend”, color=color.red, style=plot.style_linebr)
hullPlot = plot(hull, “Hull Moving Average”, color=color.blue)
// Fill body middle
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)
// Entry Rules
longCondition = ta.crossover(close, supertrend) and close > hull
shortCondition = ta.crossunder(close, supertrend) and close < hull
// Exit Rules
longExitCondition = ta.crossunder(close, hull)
shortExitCondition = ta.crossover(close, hull)
// Trailing Stop
var float longTrailingStopPrice = na
var float shortTrailingStopPrice = na
if (longCondition)
strategy.entry(“Long”, strategy.long)
longTrailingStopPrice := close * (1 - trailingStopPercentage / 100)
if (shortCondition)
strategy.entry(“Short”, strategy.short)
shortTrailingStopPrice := close * (1 + trailingStopPercentage / 100)
if (longExitCondition)
strategy.close(“Long”)
if (shortExitCondition)
strategy.close(“Short”)
if (strategy.position_size > 0)
strategy.exit(“Long Exit”, “Long”, trail_price=longTrailingStopPrice)
else if (strategy.position_size < 0)
strategy.exit(“Short Exit”, “Short”, trail_price=shortTrailingStopPrice)
|
78e1738bf120e3004c57586c8c6afb5a
|
{
"intermediate": 0.29820743203163147,
"beginner": 0.3266462981700897,
"expert": 0.3751462697982788
}
|
29,533
|
exit 和 filter 没有起到作用,帮我改以下代码//@version=5
strategy("Supertrend RTX001", overlay=true)
// Input variables
atrPeriod = input(10, "ATR Length")
factor = input.float(3.0, "Factor", step=0.01)
trailingStopPercentage = input.float(1.0, "Trailing Stop Percentage", step=0.1)
hullPeriod = input(14, "Hull Moving Average Period")
// Calculate Supertrend
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// Calculate Hull Moving Average
hull = ta.hma(close, hullPeriod)
// Plot Supertrend and Hull Moving Average
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color=color.green, style=plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color=color.red, style=plot.style_linebr)
hullPlot = plot(hull, "Hull Moving Average", color=color.blue)
// Fill body middle
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)
// Entry Rules
longCondition = ta.crossover(close, supertrend) and close > hull
shortCondition = ta.crossunder(close, supertrend) and close < hull
// Exit Rules
longExitCondition = ta.crossunder(close, hull)
shortExitCondition = ta.crossover(close, hull)
// Trailing Stop
var float longTrailingStopPrice = na
var float shortTrailingStopPrice = na
if longCondition
strategy.entry("Long", strategy.long)
longTrailingStopPrice := close * (1 - trailingStopPercentage / 100)
if shortCondition
strategy.entry("Short", strategy.short)
shortTrailingStopPrice := close * (1 + trailingStopPercentage / 100)
if longExitCondition
strategy.exit("Long Exit", "Long", stop=longTrailingStopPrice)
if shortExitCondition
strategy.exit("Short Exit", "Short", stop=shortTrailingStopPrice)
|
77f5684b07f50e61f3a9da1c056ec48a
|
{
"intermediate": 0.2702549397945404,
"beginner": 0.43600356578826904,
"expert": 0.29374149441719055
}
|
29,534
|
#include <iostream>
#include <vector>
#include <string>
#include <Windows.h>
std::vector<std::string> listFilesInFolder(const std::string& folderPath) {
std::vector<std::string> fileNames;
WIN32_FIND_DATAA findData;
HANDLE hFind = INVALID_HANDLE_VALUE;
std::string searchPath = folderPath + "\*";
hFind = FindFirstFileA(searchPath.c_str(), &findData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
fileNames.push_back(findData.cFileName);
std::cout << findData.cFileName << std::endl;
}
} while (FindNextFileA(hFind, &findData) != 0);
FindClose(hFind);
} else {
std::cout << "Error opening directory." << std::endl;
return fileNames;
}
return fileNames;
}
int main(int ac,char **av)
{
std::vector<std::string> files = listFilesInFolder("test");
for (int i = 0;i != files.size();i++)
std::cout << files.at(i);
}
correct this code
|
5a281e8aaa7c9abfa9dca6198aca3f30
|
{
"intermediate": 0.39357975125312805,
"beginner": 0.26757514476776123,
"expert": 0.33884507417678833
}
|
29,535
|
simple cmake
|
4b597c97251b58fc7421a9fe0fc40d96
|
{
"intermediate": 0.3770045042037964,
"beginner": 0.42353934049606323,
"expert": 0.1994560956954956
}
|
29,536
|
how to apply precision on this code
fi_price = accounting.formatMoney(final_total, { symbol: "<?php echo $string; ?>", format: "%s%v" , precision = 0}
|
3a1eb298b8867bb973f33ee2e4fffe1b
|
{
"intermediate": 0.26165738701820374,
"beginner": 0.5952000021934509,
"expert": 0.1431426703929901
}
|
29,537
|
In pandas, calculate the average value of top 10 in each group
|
f0fc60dd74558e55e1f2505e31fa5e75
|
{
"intermediate": 0.4137474298477173,
"beginner": 0.32509633898735046,
"expert": 0.261156290769577
}
|
29,538
|
how to compile asm program using masm32 link16 and ml tools?
|
121c31a8715859a13a53fd8c40470aea
|
{
"intermediate": 0.4491707980632782,
"beginner": 0.2716403007507324,
"expert": 0.279188871383667
}
|
29,539
|
NAME=$(filename)
$(NAME).exe: $(NAME).obj
D:\5vts-31\tools\masm32\bin\link16 $(NAME).obj, $(NAME).exe ,,,,
$(NAME).obj: $(NAME).asm
D:\5vts-31\tools\masm32\bin\ml /c $(NAME).asm
What is wrong in this makefile?
|
5f424c6e261906ecaf3d74a3e1bc3d26
|
{
"intermediate": 0.3624257743358612,
"beginner": 0.42699703574180603,
"expert": 0.21057724952697754
}
|
29,540
|
Windows Library
x86_64-w64-mingw32-g++ -shared test.cpp -o windows/test.dll -fPIC
Windows exe
x86_64-w64-mingw32-g++ main.cpp -o exe.exe
Linux Library
g++ -shared test.cpp -o linux/test.dll -fPIC
Linux exe
g++ main.cpp -o exe
is this possible to convert this to cmake
|
f9d02564ced6b23742743b0966c9508d
|
{
"intermediate": 0.5683659911155701,
"beginner": 0.2539803981781006,
"expert": 0.17765361070632935
}
|
29,541
|
generate alarm program using c#
|
17d73f9ed8cf30c1a02f1fdec5840eaf
|
{
"intermediate": 0.3861995041370392,
"beginner": 0.27397122979164124,
"expert": 0.3398292064666748
}
|
29,542
|
bool function in c that checks if a name entered matches a name in an array and returns true or false
|
75f3308c0cc2e9c5a47e33e7afc5d520
|
{
"intermediate": 0.3603680729866028,
"beginner": 0.23175887763500214,
"expert": 0.4078730642795563
}
|
29,543
|
hello
|
622ca5eaabf67551a1692832baab52a1
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
29,544
|
帮我将下面用到 clap库的 rust 代码改为 宏版本代码
use clap::{App, AppSettings, Arg, SubCommand};
use std::process::exit;
fn main() {
let matches = App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.setting(AppSettings::DisableHelpSubcommand)
.setting(AppSettings::SubcommandRequiredElseHelp)
.setting(AppSettings::VersionlessSubcommands)
.subcommand(
SubCommand::with_name("set")
.about("Set the value of a string key to a string")
.arg(Arg::with_name("KEY").help("A string key").required(true))
.arg(
Arg::with_name("VALUE")
.help("The string value of the key")
.required(true),
),
)
.subcommand(
SubCommand::with_name("get")
.about("Get the string value of a given string key")
.arg(Arg::with_name("KEY").help("A string key").required(true)),
)
.subcommand(
SubCommand::with_name("rm")
.about("Remove a given key")
.arg(Arg::with_name("KEY").help("A string key").required(true)),
)
.get_matches();
match matches.subcommand() {
("set", Some(_matches)) => {
eprintln!("unimplemented");
exit(1);
}
("get", Some(_matches)) => {
eprintln!("unimplemented");
exit(1);
}
("rm", Some(_matches)) => {
eprintln!("unimplemented");
exit(1);
}
_ => unreachable!(),
}
}
|
a8b03221435d5cdc0cbb4e87587a4101
|
{
"intermediate": 0.29820165038108826,
"beginner": 0.46225059032440186,
"expert": 0.2395477145910263
}
|
29,545
|
Is there a linux tool that detects cyclic dependencies with std::shared_ptr ?
|
807ba8c3ba4ea07aed6f99b5d3a572ec
|
{
"intermediate": 0.4531458616256714,
"beginner": 0.17790918052196503,
"expert": 0.36894500255584717
}
|
29,546
|
Add documentation for this code:
|
70881d141ed413fca14526f366257ba3
|
{
"intermediate": 0.29188889265060425,
"beginner": 0.44248029589653015,
"expert": 0.265630841255188
}
|
29,547
|
how to know if page with inputs like text input radiobuttons or checkboxes in asp.net have changed or not with javascript?
|
8560c7719c4e131c25a9d621b35c1781
|
{
"intermediate": 0.5630239248275757,
"beginner": 0.18153998255729675,
"expert": 0.2554360628128052
}
|
29,548
|
как задать ширину колонки ID Партнера?
<div class="row">
<div class="col-md-12">
<div style="overflow-x:auto;">
<table class="table table-bordered">
<thead>
<tr>
<ncs:columnHeader columnName="Имя клиента" column="name" sort="${list.sort}"/>
<ncs:columnHeader columnName="Статус" column="activeState" sort="${list.sort}"/>
<ncs:columnHeader columnName="ИНН" column="inn" sort="${list.sort}"/>
<ncs:columnHeader columnName="ID Партнера" column="id" sort="${list.sort}"/>
<th>Системный продукт</th>
<th>Вид контрагента</th>
<ncs:columnHeader columnName="Менеджер" column="managerName" sort="${list.sort}"/>
<ncs:columnHeader columnName="Категория (вид товара / услуг)" column="mccDictionary" sort="${list.sort}"/>
<ncs:columnHeader columnName="Сотрудник изменивший" column="lastActionUser" sort="${list.sort}"/>
<ncs:columnHeader columnName="Дата изменения" column="updateDate" sort="${list.sort}"/>
</tr>
</thead>
<c:if test="${!empty list.content}">
<tbody>
<c:forEach items="${list.content}" var="item">
<tr>
<td><a href="<c:url value='/company/view/${item.id}' />">${item.name}</a>
</td>
<td>${item.activeState}</td>
<td>${item.inn}</td>
<td>${item.id}</td>
<td>${item.partnerProduct}</td>
<td>${item.partnerRoles}</td>
<td>${item.managerName}</td>
<td>${item.mccDictionary}</td>
<td>${item.lastActionUser}</td>
<td>
<fmt:formatDate var="updateDate" value="${item.updateDate}" pattern="dd.MM.yyyy HH:mm" />
${updateDate}
</td>
</tr>
</c:forEach>
</tbody>
</c:if>
</table>
</div>
<c:if test="${empty list.content}">
Данные не найдены.
</c:if>
</div>
</div>
|
dd01ba6c2fecb4790d8c3bbfa0f2b12c
|
{
"intermediate": 0.22466020286083221,
"beginner": 0.6149517297744751,
"expert": 0.1603880673646927
}
|
29,549
|
def greet(name, msg="How do you do?"):
print("Hello ", name + ', ' + msg)
greet("Ankit")
greet("Ankit", "How do you do?")
"""
this code will print the following for both the calls -
`Hello Ankit, How do you do?`
"""
explain default argument in this program
|
83f8fc2f60ae65d7fbad7a5fea720a5f
|
{
"intermediate": 0.316170334815979,
"beginner": 0.4526686668395996,
"expert": 0.23116101324558258
}
|
29,550
|
c++ code for this problem
find similar element in 2 different array
input:
line 1 n,m <= 5000
line 2 array a[n] in which each element is <=10^9
line 2 array b[m] in which each element is <=10^9
output:
line 1: number that show how many number is similar to each other
line 2: list of that number
|
5a3bdb46dc0539c2379deb7a3245f832
|
{
"intermediate": 0.5629515647888184,
"beginner": 0.1528376340866089,
"expert": 0.28421080112457275
}
|
29,551
|
what is qemu
|
5b16b9543d41487020a7353794b6de20
|
{
"intermediate": 0.4286728799343109,
"beginner": 0.3687947392463684,
"expert": 0.2025323361158371
}
|
29,552
|
generate c code that counts to 100
|
5e6c80740925def1a3c29472705a9d39
|
{
"intermediate": 0.24520137906074524,
"beginner": 0.23175416886806488,
"expert": 0.5230444669723511
}
|
29,553
|
<!DOCTYPE html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Морской бой</title> </head> <body> <h1>Морской бой</h1> <button id="add-ships-button" onclick="initGame()">Добавить одиночные и двойные корабли</button> <button onclick="resetGame()">Начать заново</button> <center><h1><p id="turn-info">Ваш ход, Игрок 1.</p></h1></center> <div class="boards-container"> <div class="board" id="player-1-board"></div> <div class="board" id="player-2-board"></div> </div> </body> <style> .boards-container { display: flex; padding: 50px; } .board { display: grid; grid-template-columns: repeat(10, 50px); grid-gap: 5px; margin-top: 20px; margin-right: 20px; } .cell { width: 50px; height: 50px; border: 1px solid black; display: flex; justify-content: center; align-items: center; font-size: 20px; cursor: pointer; } .cell.clicked { background-color: lightgray; } .player-1-board .cell { background-color: lightblue; } .player-2-board .cell { background-color: lightgreen; } </style> <script> let currentTurn = 1; let fieldSize = 10; // changed here let player1Ships, player2Ships; let occupiedCells1, occupiedCells2; function generateBoard(player) { let occupiedCells = player === 1 ? occupiedCells1 : occupiedCells2; let numberOfShips = 4; addShips(numberOfShips, 1, player, occupiedCells); numberOfShips = 3; addShips(numberOfShips, 2, player, occupiedCells); } function addShips(numberOfShips, size, player, occupiedCells) { let attemptCount = 0; const MAX_ATTEMPTS = 100; while (numberOfShips > 0 && attemptCount < MAX_ATTEMPTS) { let randomCell = Math.floor(Math.random() * occupiedCells.length); // Now we check the availability of surrounding cells before placing the ship if (checkPlacement(randomCell, size, occupiedCells)) { let cellsToMark = [randomCell]; if(size > 1) { cellsToMark.push(randomCell - 1); } cellsToMark.forEach(cell => { if (player === 1) { player1Ships.add(cell); } else if (player === 2) { player2Ships.add(cell); } // Mark the selected cell and surrounding as occupied markCellAndSurrounding(cell, occupiedCells); }); numberOfShips--; } else { attemptCount++; } } } function checkPlacement(cell, size, occupiedCells) { let canPlace = true; for(let i = 0; i < size; i++) { if (!occupiedCells[cell - i] && checkSurroundingCells(cell - i, occupiedCells)) { continue; } canPlace = false; break; } return canPlace; } function checkSurroundingCells(cell, occupiedCells) { let surroundingCellsExist = true; let x = cell % fieldSize; let y = Math.floor(cell / fieldSize); let top = y > 0; let bottom = y < fieldSize - 1; let left = x > 0; let right = x < fieldSize - 1; // Check if the surrounding cells are occupied if (top && occupiedCells[cell - fieldSize]) surroundingCellsExist = false; if (bottom && occupiedCells[cell + fieldSize]) surroundingCellsExist = false; if (left && occupiedCells[cell - 1]) surroundingCellsExist = false; if (right && occupiedCells[cell + 1]) surroundingCellsExist = false; if (top && left && occupiedCells[cell - fieldSize - 1]) surroundingCellsExist = false; if (top && right && occupiedCells[cell - fieldSize + 1]) surroundingCellsExist = false; if (bottom && left && occupiedCells[cell + fieldSize - 1]) surroundingCellsExist = false; if (bottom && right && occupiedCells[cell + fieldSize + 1]) surroundingCellsExist = false; return surroundingCellsExist; } function initGame() { player1Ships = new Set(); player2Ships = new Set(); occupiedCells1 = Array(fieldSize * fieldSize).fill(false); occupiedCells2 = Array(fieldSize * fieldSize).fill(false); generateBoard(1); generateBoard(2); createBoard('player-1-board', 1, player1Ships); createBoard('player-2-board', 2, player2Ships); } function markCellAndSurrounding(cell, occupiedCells) { let x = cell % fieldSize; let y = Math.floor(cell / fieldSize); let top = y > 0; let bottom = y < fieldSize - 1; let left = x > 0; let right = x < fieldSize - 1; occupiedCells[cell] = true; if (top) occupiedCells[cell - fieldSize] = true; if (bottom) occupiedCells[cell + fieldSize] = true; if (left) occupiedCells[cell - 1] = true; if (right) occupiedCells[cell + 1] = true; if (top && left) occupiedCells[cell - fieldSize - 1] = true; if (top && right) occupiedCells[cell - fieldSize + 1] = true; if (bottom && left) occupiedCells[cell + fieldSize - 1] = true; if (bottom && right) occupiedCells[cell + fieldSize + 1] = true; } function createBoard(id, player, playerShips) { const board = document.getElementById(id); board.innerHTML = ''; for (let i = 0; i < fieldSize; i++) { for (let j = 0; j < fieldSize; j++) { const cell = document.createElement('div'); cell.className = 'cell'; cell.onclick = () => cellClick(i, j, player); if (playerShips.has(i * fieldSize + j)) { cell.style.backgroundColor = 'purple'; } board.appendChild(cell); } } } function createEmptyBoard(id, player) { const board = document.getElementById(id); board.innerHTML = ''; for (let i = 0; i < fieldSize; i++) { for (let j = 0; j < fieldSize; j++) { const cell = document.createElement('div'); cell.className = 'cell'; cell.onclick = () => cellClick(i, j, player); board.appendChild(cell); } } } function resetGame() { player1Ships.clear(); player2Ships.clear(); createEmptyBoard('player-1-board', 1); createEmptyBoard('player-2-board', 2); } function cellClick(i, j, player) { // If you try to make a move that's not supposed to be the current player's, just exit the function if (player !== currentTurn) return; const cellIndex = i * fieldSize + j; const cell = document.getElementById(`player-${player}-board`).children[cellIndex]; let currentPlayerShips = player === 1 ? player1Ships : player2Ships; // If you have no ships, just return out of the function if (currentPlayerShips.size === 0 && player1Ships.size === 0 && player2Ships.size === 0) { return; } if (cell.classList.contains('clicked')) { alert('Вы уже стреляли в эту ячейку!'); } else { cell.classList.add('clicked'); let nextPlayer = player === 1 ? 2 : 1; if (currentPlayerShips.has(cellIndex)) { cell.style.backgroundColor = 'red'; currentPlayerShips.delete(cellIndex); // If the player hit a ship, they keep their turn } else { cell.style.backgroundColor = 'gray'; // Player missed, pass the turn to the other player currentTurn = nextPlayer; document.getElementById("turn-info").innerText = `Ваш ход, Игрок ${nextPlayer}.` } if (currentPlayerShips.size === 0) { alert(`Игрок ${nextPlayer} выиграл!`); resetGame(); return; } } } </script> </html> сделай генерацию трехпалубных кораблей в количестве двух для каждого игрока и пропиши их в каждой функции, как и остальные корабли
|
60c53c8ca3d52c0737b46dbcbb1c4fb0
|
{
"intermediate": 0.5420723557472229,
"beginner": 0.3106542229652405,
"expert": 0.14727342128753662
}
|
29,554
|
[
{
"name": " Rajasekar",
"dept": [
{
"de": "CSE",
"val": "B.E"
}
]
},
{
"name": " sekar",
"dept": [
{
"de": "CSE",
"val": "B.E"
},
{
"de": "IT",
"val": "B.E"
}
]
}
]
on the above example name is an dropdown based on the name load dept dropdown in angular
|
801a66662f4c97de065689713b64ab28
|
{
"intermediate": 0.2954825758934021,
"beginner": 0.3273374140262604,
"expert": 0.3771800100803375
}
|
29,555
|
C# findwindow and get process id
|
cf93984ab34a0364d35a40e7d5ca3e7c
|
{
"intermediate": 0.5402030944824219,
"beginner": 0.27609825134277344,
"expert": 0.1836985945701599
}
|
29,556
|
I am planning to stack huawei switch. The switches to be stacked are 2 set of S5720‐28X‐SI‐AC and 2 set of S5720‐28X‐Sl‐24S‐AC. Please provide me the configuration for the stacking
|
b7b411b58ade17f6cb03c592b09707ce
|
{
"intermediate": 0.32363054156303406,
"beginner": 0.2482871562242508,
"expert": 0.42808231711387634
}
|
29,557
|
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.packet import packet, ethernet, ether_types
import logging
class ControllerHub(app_manager.RyuApp):
OFP_VERSION = ofproto_v1_3.OFP_VERSION
def __init__(self, *args, **kwargs):
super(ControllerHub, self).__init__(*args, **kwargs)
# Change the log file location to your user-writable directory (e.g., your home directory)
LOGFILE = '~/ryu.log' # Use the tilde (~) to represent your home directory
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
filename=LOGFILE,
filemode='w'
)
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# Install a default flow to flood traffic
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]
self.add_flow(datapath, 0, match, actions)
def add_flow(self, datapath, priority, match, actions):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, actions)]
mod = parser.OFPFlowMod(datapath=datapath, priority=priority, match=match, instructions=inst)
datapath.send_msg(mod).find error
|
53cd34f1420fec2e0a8f750670a7b92f
|
{
"intermediate": 0.508102297782898,
"beginner": 0.35852766036987305,
"expert": 0.1333700716495514
}
|
29,558
|
объясни код программы
|
991e8dfecdd85637333374f0a803bf57
|
{
"intermediate": 0.3365608751773834,
"beginner": 0.28942689299583435,
"expert": 0.3740122318267822
}
|
29,559
|
In stata, generate dummy variable if the "variable" >1
|
16f8b174989b4a6304f53807f0258653
|
{
"intermediate": 0.2105635404586792,
"beginner": 0.3649495244026184,
"expert": 0.42448690533638
}
|
29,560
|
curl post request example
|
e1ab1aab32f74d42ab108e659b67011e
|
{
"intermediate": 0.3053339421749115,
"beginner": 0.29740217328071594,
"expert": 0.39726391434669495
}
|
29,561
|
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.packet import packet, ethernet
class FirewallMonitor(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
def _init_(self, *args, **kwargs):
super(FirewallMonitor, self)._init_(*args, **kwargs)
self.mac_to_port = {}
self.packet_count = 0
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch()
# Install default flow to send unknown packets to the controller
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]
self.add_flow(datapath, 0, match, actions)
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def packet_in_handler(self, ev):
msg = ev.msg
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
in_port = msg.match['in_port']
pkt = packet.Packet(msg.data)
eth = pkt.get_protocols(ethernet.ethernet)[0]
src = eth.src
dst = eth.dst
if src not in self.mac_to_port:
self.mac_to_port[src] = in_port
out_port = self.mac_to_port.get(dst, ofproto.OFPP_FLOOD)
actions = [parser.OFPActionOutput(out_port)]
# Real-time firewall rules:
if (src == '00:00:00:00:00:02' and dst == '00:00:00:00:00:03') or \
(src == '00:00:00:00:00:01' and dst == '00:00:00:00:00:04'):
self.logger.info("Dropping packet from {} to {}".format(src, dst))
return # Drop the packet
# Count packets from H3 on S1
if datapath.id == 1 and src == '00:00:00:00:00:03':
self.packet_count += 1
data = None
if msg.buffer_id == ofproto.OFP_NO_BUFFER:
data = msg.data
out = parser.OFPPacketOut(
datapath=datapath, buffer_id=msg.buffer_id, in_port=in_port,
actions=actions, data=data)
datapath.send_msg(out)
def add_flow(self, datapath, priority, match, actions, buffer_id=None):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, actions)]
if buffer_id:
mod = parser.OFPFlowMod(
datapath=datapath, buffer_id=buffer_id, priority=priority,
match=match, instructions=inst)
else:
mod = parser.OFPFlowMod(
datapath=datapath, priority=priority, match=match,
instructions=inst)
datapath.send_msg(mod)
|
868273c7c1c41f5a3064cce72687c24e
|
{
"intermediate": 0.45024335384368896,
"beginner": 0.39501288533210754,
"expert": 0.15474377572536469
}
|
29,562
|
Assuming you have a class Student:
1. Implement the class setter and print member function.
2. Overload the operator < such that it compares the names of 2 student
objects.
3. Now implement as template functions:
1. A quadratic sorting algorithm (bubble, selection or insertion)
2. The sub-quadratic algorithm Shell Sort
3. Another sub-quadratic algorithm (quick or merge sort)
4.Read into 3 dynamic arrays of student objects (a1, a2 & a3) from a file
named students.txt which will have the number of students followed by their
info as follows:
5. Sort the 3 arrays, each using one of the 3 sorting algorithms you
implemented in step 5. For example a1 will be sorted using insertion sort, a2
will be sorted using shell sort, & a3 will be sorted using quick sort.
6. Each of the 3 sorted arrays should be saved in a separate txt file with the
name of the sorting algorithm. So you will have 3 txt files named, for
example: Insertion.txt, Shell.txt, and Merge.txt.
7. You should count comparisons for each of the sorting algorithms you
implemented such that the number of comparisons made by each
8. Implement a binary search algorithm to work on any of your sorted students
arrays, such that given a student’s name the search returns its index or -1 if
it’s not found. A binary search has better complexity (O(log N)) than a linear
search (O(N)). You can look up the code of binary search online.
9. In main you should :
1. Read from students.txt to fill the 3 arrays.
2. Call each of the sorting algorithms on each of the arrays.
3. Save the results to 3 text files, one for each sort.
4. Then display the following menu, which will change depending on the
algorithms you chose to implement.
5. For the search option, the user will enter a student’s name and if it’s
found the whole student record will be shown, otherwise display an
appropriate message.
|
93df7dba0cc76c6a122bc92dc1c126c0
|
{
"intermediate": 0.3541356027126312,
"beginner": 0.26506295800209045,
"expert": 0.38080140948295593
}
|
29,563
|
Добавить методы setMake(), setNumber(), setCapacity(), setState() в класс Bus, чтобы можно было изменять значения полей автобуса.
Добавить методы setName(), setAge(), setExperience() в класс Driver, чтобы можно было изменять значения полей водителя.
Реализовать методы removeBusFromPark() и removeDriverFromPark() в классе BusFleet, чтобы можно было удалить автобус или водителя из парка.
Добавить методы addViolation() и removeViolation() в класс Driver, чтобы можно было добавлять и удалять информацию о нарушениях водителя.
Реализовать методы addSchedule() и removeSchedule() в классе Driver, чтобы можно было добавлять и удалять графики работы водителя.
Добавить методы addStop() и removeStop() в класс Route, чтобы можно было добавлять и удалять остановки на маршруте.
Реализовать методы printDriverViolations() и printDriverSchedules() в классе Driver, чтобы можно было выводить информацию о нарушениях и графиках работы водителя.
Добавить методы printBusViolations() и printBusSchedules() в классе Bus, чтобы можно было выводить информацию о нарушениях и графиках работы автобуса. #include <iostream>
#include <string>
#include <vector>
class Driver {
private:
std::string fullName;
int age;
int experience;
public:
Driver(std::string name, int age, int experience) : fullName(name), age(age), experience(experience) {}
std::string getName() {
return fullName;
}
int getAge() {
return age;
}
int getExperience() {
return experience;
}
void printDriverInfo() {
std::cout << "Водитель: " << getName() << ", возраст: " << getAge() << " лет, опыт: " << getExperience() << " лет" << std::endl;
}
};
class Bus {
private:
std::string make;
int number;
int capacity;
std::string state;
public:
Bus(std::string make, int number, int capacity, std::string state) : make(make), number(number), capacity(capacity), state(state) {}
std::string getMake() {
return make;
}
int getNumber() {
return number;
}
int getCapacity() {
return capacity;
}
std::string getState() {
return state;
}
void printBusInfo() {
std::cout << "Автобус: Марка: " << getMake() << ", номер: " << getNumber() << ", вместимость: " << getCapacity() << ", состояние: " << getState() << std::endl;
}
};
class Route {
private:
std::vector<std::pair<std::string, std::string>> stops;
public:
void addStop(std::string stop, std::string arrivalTime) {
stops.push_back(std::make_pair(stop, arrivalTime));
}
std::vector<std::pair<std::string, std::string>> getStops() {
return stops;
}
void printRouteStops() {
std::cout << "Маршрут:" << std::endl;
for (auto stop : getStops()) {
std::cout << stop.first << ", прибытие: " << stop.second << std::endl;
}
}
};
class Violation {
private:
std::string violation;
std::string when;
public:
Violation(std::string violation, std::string when) : violation(violation), when(when) {}
std::string getViolation() {
return violation;
}
std::string getWhen() {
return when;
}
void printViolationInfo() {
std::cout << "Нарушение: " << getViolation() << " " << getWhen() << std::endl;
}
};
class Schedule {
private:
std::string day;
std::string time;
public:
Schedule(std::string day, std::string time) : day(day), time(time) {}
std::string getDay() {
return day;
}
std::string getTime() {
return time;
}
void printScheduleInfo() {
std::cout << "График: " << getDay() << " " << getTime() << "\n" << std::endl;
}
};
class BusFleet {
private:
int totalBuses;
int busesOnRoute;
std::vector<Bus> busesInPark;
public:
BusFleet(int totalBuses, int busesOnRoute) : totalBuses(totalBuses), busesOnRoute(busesOnRoute) {}
int getTotalBuses() {
return totalBuses;
}
int getBusesOnRoute() {
return busesOnRoute;
}
void addBusToPark(Bus bus) {
busesInPark.push_back(bus);
}
std::vector<Bus> getBusesInPark() {
return busesInPark;
}
};
int main() {
// Создаем объекты водителей и автобусов
Driver driver1("Иванов И.И.", 30, 9);
Driver driver2("Петров П.С.", 35, 13);
Driver driver3("Сидоров В.И.", 44, 15);
Driver driver4("Ким А.С.", 49, 16);
Driver driver5("Осипов И.М.", 30, 9);
Driver driver6("Воронин К.Н.", 40, 18);
Driver driver7("Синичкин А.А.", 24, 4);
Driver driver8("Кузнецов С.С.", 37, 14);
Driver driver9("Щербаков Р.А.", 33, 11);
Driver driver10("Ульянов В.Ю.", 50, 27);
Bus bus1("Mercedes", 101, 50, "исправен");
Bus bus2("Volvo", 102, 40, "исправен");
Bus bus3("Volvo", 103, 45, "не исправен");
Bus bus4("Mercedes", 104, 35, "исправен");
Bus bus5("Volvo", 105, 30, "в ремонте");
Bus bus6("Mercedes", 106, 40, "исправен");
Bus bus7("Volvo", 107, 50, "иправен");
Bus bus8("Mercedes", 108, 55, "исправен");
Bus bus9("Solaris", 109, 35, "в ремонте");
Bus bus10("Mercedes", 110, 60, "исправен");
// Создаем объекты маршрутов, нарушений и графиков
Route route1;
route1.addStop("Остановка 1", "8:05");
route1.addStop("Остановка 2", "9:15");
route1.addStop("Остановка 3", "11:25");
route1.addStop("Остановка 4", "12:45");
route1.addStop("Остановка 5", "13:55");
Route route2;
route2.addStop("Остановка 1", "8:08");
route2.addStop("Остановка 2", "9:45");
route2.addStop("Остановка 3", "11:05");
route2.addStop("Остановка 4", "13:57");
route2.addStop("Остановка 5", "15:05");
route2.addStop("Остановка 6", "17:55");
Violation violation1("превышение скорости", "2023-10-28 в 12:17");
Schedule schedule1("Пн-Чт", "8:00 - 14:00");
Schedule schedule2("Пн-Ср", "8:00 - 18:00");
// Создаем объект автобусного парка и добавляем автобусы
BusFleet fleet(10, 2);
fleet.addBusToPark(bus1);
fleet.addBusToPark(bus2);
fleet.addBusToPark(bus3);
fleet.addBusToPark(bus4);
fleet.addBusToPark(bus5);
fleet.addBusToPark(bus6);
fleet.addBusToPark(bus7);
fleet.addBusToPark(bus8);
fleet.addBusToPark(bus9);
fleet.addBusToPark(bus10);
// Выводим все автобусы, которые стоят в парке
std::cout << "Все автобусы в парке:" << std::endl;
for (auto bus : fleet.getBusesInPark()) {
bus.printBusInfo();
}
// Выводим всех водителей, которые работают в парке
std::cout << "\nВодители, работающие в парке:" << std::endl;
driver1.printDriverInfo();
driver2.printDriverInfo();
driver3.printDriverInfo();
driver4.printDriverInfo();
driver5.printDriverInfo();
driver6.printDriverInfo();
driver7.printDriverInfo();
driver8.printDriverInfo();
driver9.printDriverInfo();
driver10.printDriverInfo();
std::cout << "\nАвтобусы на маршруте:" << std::endl;
driver1.printDriverInfo();
bus1.printBusInfo();
route1.printRouteStops();
violation1.printViolationInfo();
schedule1.printScheduleInfo();
driver2.printDriverInfo();
bus2.printBusInfo();
route2.printRouteStops();
schedule2.printScheduleInfo();
return 0;
}
|
e3b4fe688401866b615fc1097e3b6d28
|
{
"intermediate": 0.2929587960243225,
"beginner": 0.5362406373023987,
"expert": 0.17080058157444
}
|
29,564
|
how to add multiple users reviews on single product in node js mongoose express with es6 syntax mdoule base best practice code snippet
|
59af9340f07515e81822c2d6cd4c0f5f
|
{
"intermediate": 0.5574260950088501,
"beginner": 0.29436594247817993,
"expert": 0.14820800721645355
}
|
29,565
|
Modify eRanConType function so default state of createFieldsetRadio be object.Bridge
|
353d9b5108ae2fa9debd7f5ca534fb1f
|
{
"intermediate": 0.45344454050064087,
"beginner": 0.2231041043996811,
"expert": 0.32345137000083923
}
|
29,566
|
I want to do a project. This project serves as a preliminary exercise so that you can get familiar with Gibbs/MRF models, the fundamental principles of the Gibbs sampler, and the application of Partial Differential Equations (PDE) in the context of image restoration and inpainting. Three kinds of images are featured in the illustration presented below, all enclosed within the compressed file provided. The original image comprises distinct color bands, specifically Red, Green, and Blue. At the same time, the distorted counterpart is the result of superimposing a mask image onto the Red band of the original image. It is worth noting that two image sets are provided, one featuring a small font size, and the other, a big font size. In this experimental setting, pretend that you are provided solely with the distorted image denoted as I in subfigure (c) and the corresponding mask image M featured in subfigure (b). The primary objective of this experiment is to reconstruct the original image, represented as O, by filling in the masked pixels exclusively within the Red-band. It is essential to underscore that no restorative action is required for the Green and Blue bands. Given that information within the masked pixels has been irreversibly compromised, our task is to approximate the original image as X, which serves as an estimable substitute for O. To evaluate the efficacy of this restoration process, a per-pixel error assessment must be undertaken, explicitly concerning all the pixels concealed by the mask, comparing the reconstructed X with the ground truth image O.
|
86ed6f7c43b79a997a5c7e2f2ed86ae9
|
{
"intermediate": 0.30871129035949707,
"beginner": 0.3213783800601959,
"expert": 0.3699103891849518
}
|
29,567
|
Modify eRanConType function so default state of createFieldsetRadio be object.Bridge
|
1aeec7acd934e2189cac123bc5f8cfda
|
{
"intermediate": 0.45344454050064087,
"beginner": 0.2231041043996811,
"expert": 0.32345137000083923
}
|
29,568
|
rust 中Option<&String>如何转为 Option<String>
|
514b603aa614655c4151c2eb3ef66b88
|
{
"intermediate": 0.3558260500431061,
"beginner": 0.4245639741420746,
"expert": 0.21960999071598053
}
|
29,569
|
Modify eRanConType function so default checked state of createFieldsetRadio be object.Bridge
Now I have TypeError: selectorBridge is null
|
a9a29118f68fe134881334753174724b
|
{
"intermediate": 0.621024489402771,
"beginner": 0.1851741224527359,
"expert": 0.1938013732433319
}
|
29,570
|
write a python code which can access google lens
|
59e60ab85fa52715d22902d23026eecd
|
{
"intermediate": 0.45803093910217285,
"beginner": 0.2062007635831833,
"expert": 0.3357682228088379
}
|
29,571
|
کتاب خانه cuda را به برنامه زیر اضافه کن و آن را بهینه کن :
#include <iostream>
#include <cstdlib>
#include <ctime>
void multiply_matrices(int n) {
// ایجاد دو ماتریس n*n با مقادیر تصادفی
int matrix1[n][n];
int matrix2[n][n];
int result[n][n];
// مقداردهی تصادفی به ماتریسها
srand(time(0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
matrix1[i][j] = rand() % 10;
matrix2[i][j] = rand() % 10;
}
}
// ضرب دو ماتریس
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
result[i][j] = 0;
for (int k = 0; k < n; k++) {
result[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
// نمایش نتیجه ضرب دو ماتریس
std::cout << "نتیجه ضرب دو ماتریس:" << std::endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cout << result[i][j] << " ";
}
std::cout << std::endl;
}
}
int main() {
int n;
std::cout << "تعداد سطر و ستون ماتریس را وارد کنید: ";
std::cin >> n;
// فراخوانی تابع ضرب ماتریس
multiply_matrices(n);
return 0;
}
|
4532dfe21dbfdccd175f6c44adc00e71
|
{
"intermediate": 0.34865546226501465,
"beginner": 0.3903924822807312,
"expert": 0.26095205545425415
}
|
29,572
|
how to handlig punctuation in whoosh library
|
7bf2c731e8fcdcabf7a6d116f6ab83f5
|
{
"intermediate": 0.5840728878974915,
"beginner": 0.25547856092453003,
"expert": 0.16044855117797852
}
|
29,573
|
کتابخانه openmp را به کد زیر اضافه کن و آن را بهینه کن : #include <iostream>
#include <cstdlib>
#include <ctime>
void multiply_matrices(int n) {
// ایجاد دو ماتریس n*n با مقادیر تصادفی
int matrix1[n][n];
int matrix2[n][n];
int result[n][n];
// مقداردهی تصادفی به ماتریسها
srand(time(0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
matrix1[i][j] = rand() % 10;
matrix2[i][j] = rand() % 10;
}
}
// ضرب دو ماتریس
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
result[i][j] = 0;
for (int k = 0; k < n; k++) {
result[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
// نمایش نتیجه ضرب دو ماتریس
std::cout << "نتیجه ضرب دو ماتریس:" << std::endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cout << result[i][j] << " ";
}
std::cout << std::endl;
}
}
int main() {
int n;
std::cout << "تعداد سطر و ستون ماتریس را وارد کنید: ";
std::cin >> n;
// فراخوانی تابع ضرب ماتریس
multiply_matrices(n);
return 0;
}
|
d1858b10e8412abbf1f922a5f9672ace
|
{
"intermediate": 0.408501535654068,
"beginner": 0.3311137557029724,
"expert": 0.2603847086429596
}
|
29,574
|
ноw to clear string from puctuation in python
|
7c73ce63abf3264dc1ca4b1a95962e23
|
{
"intermediate": 0.3508245646953583,
"beginner": 0.2809593081474304,
"expert": 0.3682160973548889
}
|
29,575
|
write a for loop in java which prints a list of questions
|
bff5cc2b36f76c47746eaa0ccb7cb097
|
{
"intermediate": 0.29415363073349,
"beginner": 0.4617363512516022,
"expert": 0.24411006271839142
}
|
29,576
|
can you write me a policy for auto-attendance system for iot core using json?
|
e99455f19ee8a1f3fb07c695cf6b59ed
|
{
"intermediate": 0.509768545627594,
"beginner": 0.17377819120883942,
"expert": 0.31645330786705017
}
|
29,577
|
что здесь происходит?
public Predicate toPredicate(final Root<Company> root, final CriteriaQuery<?> query, final CriteriaBuilder builder) {
return builder.or(builder.like(builder.lower(root.<String>get("inn")), buildLikePattern(replaceMaskSymbols(searchString))),
builder.like(builder.lower(root.get("id")), buildLikePattern(replaceMaskSymbols(searchString))),
builder.like(builder.lower(root.<String>get("ogrn")), buildLikePattern(replaceMaskSymbols(searchString))),
builder.like(builder.lower(root.<String>get("fullName")), buildLikePattern(replaceMaskSymbols(searchString))),
builder.like(builder.lower(root.<String>get("managerName")), buildLikePattern(replaceMaskSymbols(searchString))),
builder.equal(root.<String>get("activeState"), buildActiveState(replaceMaskSymbols(searchString)))
);
}
|
72f5d9af17e5cf0ee37d686257896f7a
|
{
"intermediate": 0.3729288876056671,
"beginner": 0.41526171565055847,
"expert": 0.21180938184261322
}
|
29,578
|
import os
import random
from typing import Tuple
from ContractTest import ContractTest, Configuration
class CrowdTest(ContractTest):
DONATE_FLAG_INDEX = 4
SPECIAL_DONATE_FLAG_INDEX = 5
WITHDRAW_FLAG_INDEX = 6
# totalDonateValue = 0
# donateCount = 0
# 调用部署时候的constructor函数,向里面传递受益人的地址self.config.configuration[Configuration.ACCOUNTS][0][Configuration.ADDRESS]就是受益人的地址
def __init__(self):
self.configuration = Configuration(os.path.basename(__file__))
ContractTest.__init__(self, self.configuration)
# Set the contract name to be tested.
self.contract_test_name = "Crowd"
pass
def init_test_result(self, test_result):
#DONATE_FLAG_INDEX
test_result.append(0)
#SPECIAL_DONATE_FLAG_INDEX
test_result.append(0)
#WITHDRAW_FLAG_INDEX
test_result.append(0)
pass
#调用部署时候的constructor函数,向里面传递受益人的地址self.config.configuration[Configuration.ACCOUNTS][1][Configuration.ADDRESS]
#就是受益人的地址
def construct_contract(self, nonce, eoa_index):
return self.current_contract.constructor(self.config.configuration[Configuration.ACCOUNTS]
[1][Configuration.ADDRESS]).buildTransaction(
{
# "chainId": chain_id,
"gas": 30000000,
"gasPrice": self.web3.eth.gas_price,
"from": self.config.configuration[Configuration.ACCOUNTS][eoa_index][Configuration.ADDRESS],
"nonce": nonce,
}
)
# 向donate函数转账的Python函数 number 转账的数量,uint 转账的单位: "wei" 或 "ether"
def send_wei_to_contract_donate(self, number: int, uint: str):
tx_hash = self.current_contract.functions.donate().transact(
{'from': self.config.configuration[Configuration.ACCOUNTS]
[2][Configuration.ADDRESS], 'value': self.web3.toWei(number, uint)})
tx_receipt = self.web3.eth.waitForTransactionReceipt(tx_hash) # 收据:表示的是交易的详情,包含gas和转账金额
# print(tx_receipt)
wallet = self.web3.to_checksum_address(
self.config.configuration[Configuration.ACCOUNTS][1][Configuration.ADDRESS])
print(self.web3.eth.getBalance(wallet))
self.web3.eth.waitForTransactionReceipt(tx_hash)
#使用部署者的地址作为构造函数的参数部署合约
#使用非部署者的地址作为构造函数的参数部署合约
#部署成功后检查(状态变量)fundingGoal的值是否为2ether
# donate
# 分别使用部署者、受益者、参与者的地址调用donate捐款(正常捐款,异常捐款)
# specialDonate
# 分别使用部署者、受益者、参与者的地址调用specialDonate捐款(正常捐款,异常捐款)
# withdraw
# 分别使用部署者、受益者、参与者的地址调用withdraw支取(正常支取,异常支取[金额,身份])
def donate_test(self):
def execute(self):
print(self.current_contract)
# python StringConcatTest.py -c .\Configuration_201-1.json > test_result.txt
if __name__ == "__main__":
contract_test = CrowdTest()
contract_test.run()
|
cd0bb1e113e38650c0524bca271d5e22
|
{
"intermediate": 0.22078649699687958,
"beginner": 0.5558685660362244,
"expert": 0.22334495186805725
}
|
29,579
|
write regular expression to replace `h string with 'h
|
f5fc28ead7be95134ba211461d6db3f3
|
{
"intermediate": 0.3828681409358978,
"beginner": 0.2926516532897949,
"expert": 0.32448017597198486
}
|
29,580
|
Hi
|
a645cd587d506e9b7ff2961c0aa1d3d5
|
{
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
}
|
29,581
|
Convert code from JS to C#
'use strict';
const crypto = require('crypto');
const IV_LENGTH = 16;
const tokenBody = {
"access_token": "",
"iat": Date.now() / 1000,
"exp": (Date.now() / 1000) + (60 * 60),
"subject": "login_with_eljour",
"payload":{"is_child":0,"ip":"123.123.123,123"},
}
const serviceKey = "36dc4fc036dc4fc036dc4fc09635c998af336dc36dc4fc053c126f34ef4d62ecaab3eb0";
const encrypted = encrypt(JSON.stringify(tokenBody), serviceKey);
console.log('encrypted: ' + encrypted);
console.log('decrypted: ' + decrypt(encrypted, serviceKey));
function encrypt(text, key) {
const [encryptKey, signKey] = prepareKeys(key);
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', encryptKey, iv);
let encrypted = cipher.update(text);
encrypted = Buffer.concat([encrypted, cipher.final()]);
encrypted = Buffer.concat([iv, encrypted]);
let signature = hmac(encrypted, signKey);
return Buffer.concat([signature, encrypted]).toString('base64');
}
function decrypt(text, key) {
const [encryptKey, signKey] = prepareKeys(key);
text = Buffer.from(text, 'base64');
let signature = text.slice(0, 32);
let ciphertext = text.slice(32);
if (Buffer.compare(hmac(ciphertext, signKey), signature)) {
throw new Error('Signature does not match');
}
let iv = ciphertext.slice(0, IV_LENGTH);
let encryptedText = ciphertext.slice(IV_LENGTH);
let decipher = crypto.createDecipheriv('aes-256-cbc', encryptKey, iv);
let decrypted = decipher.update(encryptedText);
decrypted = Buffer.concat([decrypted, decipher.final()]);
return decrypted.toString('utf-8');
}
function prepareKeys(key) {
const hash = crypto.createHash('sha512');
hash.update(key);
const hashed = hash.digest();
return [
hashed.slice(0, 32),
hashed.slice(32),
];
}
function hmac(data, key) {
return crypto.createHmac('sha256', key)
.update(data)
.digest();
}
module.exports = { decrypt, encrypt };
|
7dc73199f2e0e78970be833059285fb3
|
{
"intermediate": 0.4504591226577759,
"beginner": 0.25301095843315125,
"expert": 0.2965298891067505
}
|
29,582
|
could you act a react native developer and create a component that shows a vertical dashed line
|
54b26bd3a38ae624471a52356d17d409
|
{
"intermediate": 0.49213171005249023,
"beginner": 0.2295895367860794,
"expert": 0.27827876806259155
}
|
29,583
|
C# streamwriter to write a text file
|
5426588b326a4a8fcff7598f538e3a2b
|
{
"intermediate": 0.5431628823280334,
"beginner": 0.26888507604599,
"expert": 0.18795202672481537
}
|
29,584
|
import json
import math
import os
import requests
import time
from keep_alive import keep_alive
keep_alive()
url = ("https://api.mcstatus.io/v2/status/java/" + os.environ['SERVER_IP'])
while True:
try:
response = requests.get(url)
json_data = json.loads(response.text)
expires_at = json_data['expires_at'] / 1000
current_time = time.time()
print("Current time:", current_time, " Expires at:", expires_at)
players_list = json_data['players']['list']
players_online = json_data['players']['online']
players_list_names = [player["name_clean"] for player in players_list]
print("Players online:", players_online)
if players_online > 0: print(players_list_names)
# Read the players list from the file
with open("players.json", "r") as file:
file_data = file.read()
file_list_names = eval(file_data)
# Compare the lists
common_players = set(players_list_names) & set(file_list_names)
new_players = set(players_list_names) - set(file_list_names)
removed_players = set(file_list_names) - set(players_list_names)
if len(common_players) > 0: print("Common Players:", common_players)
if len(new_players) > 0: print("New Players:", new_players)
if len(removed_players) > 0: print("Removed Players:", removed_players)
if len(removed_players) or len(new_players):
list_leaving = f"- {', '.join(removed_players)}"
list_joining = f"+ {', '.join(new_players)}"
web_content = f"<t:{math.trunc(expires_at)}> Online: {players_online}"
web_content += "
|
2fad3e1916909817139750b575bae4cc
|
{
"intermediate": 0.46336913108825684,
"beginner": 0.3733234703540802,
"expert": 0.16330738365650177
}
|
29,585
|
C# how to get path to current uers desktop
|
78591931a9390a32205cfd381ac7ba4d
|
{
"intermediate": 0.480695515871048,
"beginner": 0.3149734437465668,
"expert": 0.20433104038238525
}
|
29,586
|
C# how to get path to current users desktop
|
1017e2207ec04510efd860b96652f5f6
|
{
"intermediate": 0.42127352952957153,
"beginner": 0.40600520372390747,
"expert": 0.17272134125232697
}
|
29,587
|
import json
import math
import os
import requests
import time
from keep_alive import keep_alive
keep_alive()
url = ("https://api.mcstatus.io/v2/status/java/" + os.environ['SERVER_IP'])
while True:
try:
response = requests.get(url)
json_data = json.loads(response.text)
expires_at = json_data['expires_at'] / 1000
current_time = time.time()
online = json_data['online']
print("Current time:", current_time, " Expires at:", expires_at)
if online == "false":
players_list = json_data['players']['list']
players_online = json_data['players']['online']
players_list_names = [player["name_clean"] for player in players_list]
print("Players online:", players_online)
if players_online > 0: print(players_list_names)
# Read the players list from the file
with open("players.json", "r") as file:
file_data = file.read()
file_list_names = eval(file_data)
# Compare the lists
common_players = set(players_list_names) & set(file_list_names)
new_players = set(players_list_names) - set(file_list_names)
removed_players = set(file_list_names) - set(players_list_names)
if len(common_players) > 0: print("Common Players:", common_players)
if len(new_players) > 0: print("New Players:", new_players)
if len(removed_players) > 0: print("Removed Players:", removed_players)
if len(removed_players) or len(new_players):
list_leaving = f"- {', '.join(removed_players)}"
list_joining = f"+ {', '.join(new_players)}"
web_content = f"<t:{math.trunc(expires_at)}> Online: {players_online}"
web_content += "
|
46662558493353328b807cd78750de51
|
{
"intermediate": 0.4555369019508362,
"beginner": 0.32535961270332336,
"expert": 0.21910353004932404
}
|
29,588
|
Please give a minimalistic c source implementing a simple generative stable diffusion model for images.
|
3c1ef0e29b1ec743f5e3b905a1e86262
|
{
"intermediate": 0.23033329844474792,
"beginner": 0.11656524240970612,
"expert": 0.6531015038490295
}
|
29,589
|
create sql for getting ten best product
|
6015caa41dc681445fe0740614611fbf
|
{
"intermediate": 0.23782381415367126,
"beginner": 0.2682736814022064,
"expert": 0.4939025044441223
}
|
29,590
|
C# Find mapped memory from module
|
76cdc5c1d9df795e4b73df97b3954875
|
{
"intermediate": 0.535965621471405,
"beginner": 0.19179604947566986,
"expert": 0.2722383737564087
}
|
29,591
|
Why did I choose live streaming as the topic of my thesis?
|
f401312d84893ceeca05c47390016b24
|
{
"intermediate": 0.24662905931472778,
"beginner": 0.24287891387939453,
"expert": 0.5104919672012329
}
|
29,592
|
i got two promise all that calls different services, how to do a mock for them, one call the service MassBalanceService and the other QualityService
|
d6e623bc8d8b8d2b12f33cc20cf2ccbb
|
{
"intermediate": 0.4257658123970032,
"beginner": 0.23637571930885315,
"expert": 0.33785852789878845
}
|
29,593
|
code for All proposed passwords must
a. be at least eight characters long
b. have at least one uppercase letter
c. have at least one digit
d. have at least one of the following symbols !, @, #, or $.
e. if the password fails validation, a message indicating the reason for failure should appear in the web form.
|
2caf2e45d26468a8cec9152369644283
|
{
"intermediate": 0.3417661488056183,
"beginner": 0.1818300187587738,
"expert": 0.4764038622379303
}
|
29,594
|
code for HTML, and JavaScript. All proposed passwords must
a. be at least eight characters long
b. have at least one uppercase letter
c. have at least one digit
d. have at least one of the following symbols !, @, #, or $.
e. if the password fails validation, a message indicating the reason for failure should appear in the web form.
|
2a6b33653688d4baf9dd8a416a5f227e
|
{
"intermediate": 0.4428347647190094,
"beginner": 0.18994370102882385,
"expert": 0.36722150444984436
}
|
29,595
|
C# find process mapped memory addresses
|
0aad50b8c42b55c9a0c835871ef340a5
|
{
"intermediate": 0.5276713371276855,
"beginner": 0.19991429150104523,
"expert": 0.27241435647010803
}
|
29,596
|
C# winforms send desktop notification
|
587ec7da9a2846dbf08c8d867b4f1181
|
{
"intermediate": 0.4764449894428253,
"beginner": 0.27621951699256897,
"expert": 0.24733546376228333
}
|
29,597
|
WHAT IS THE EFFECT OF MATERIAL THE HOLD THE RFID TAG ON THE RANGE
|
8d134715a16dc613ef0a47e8c97aea12
|
{
"intermediate": 0.3792436718940735,
"beginner": 0.2679489850997925,
"expert": 0.3528074324131012
}
|
29,598
|
Uncaught SyntaxError: Invalid or unexpected token
|
8090cf26e479aee249211bfeafeb9c01
|
{
"intermediate": 0.2751480042934418,
"beginner": 0.5248093008995056,
"expert": 0.2000427097082138
}
|
29,599
|
Acknowledge this Python NumPy Char-RNN: """
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
print('data has %d characters, %d unique.' % (data_size, vocab_size))
char_to_ix = { ch:i for i,ch in enumerate(chars) }
ix_to_char = { i:ch for i,ch in enumerate(chars) }
# hyperparameters
hidden_size = 100 # size of hidden layer of neurons
seq_length = 25 # number of steps to unroll the RNN for
learning_rate = 1e-1
# model parameters
Wxh = np.random.randn(hidden_size, vocab_size)*0.01 # input to hidden
Whh = np.random.randn(hidden_size, hidden_size)*0.01 # hidden to hidden
Why = np.random.randn(vocab_size, hidden_size)*0.01 # hidden to output
bh = np.zeros((hidden_size, 1)) # hidden bias
by = np.zeros((vocab_size, 1)) # output bias
def lossFun(inputs, targets, hprev):
"""
inputs,targets are both list of integers.
hprev is Hx1 array of initial hidden state
returns the loss, gradients on model parameters, and last hidden state
"""
xs, hs, ys, ps = {}, {}, {}, {}
hs[-1] = np.copy(hprev)
loss = 0
# forward pass
for t in range(len(inputs)):
xs[t] = np.zeros((vocab_size,1)) # encode in 1-of-k representation
xs[t][inputs[t]] = 1
hs[t] = np.tanh(np.dot(Wxh, xs[t]) + np.dot(Whh, hs[t-1]) + bh) # hidden state
ys[t] = np.dot(Why, hs[t]) + by # unnormalized log probabilities for next chars
ps[t] = np.exp(ys[t]) / np.sum(np.exp(ys[t])) # probabilities for next chars
loss += -np.log(ps[t][targets[t],0]) # softmax (cross-entropy loss)
# backward pass: compute gradients going backwards
dWxh, dWhh, dWhy = np.zeros_like(Wxh), np.zeros_like(Whh), np.zeros_like(Why)
dbh, dby = np.zeros_like(bh), np.zeros_like(by)
dhnext = np.zeros_like(hs[0])
for t in reversed(range(len(inputs))):
dy = np.copy(ps[t])
dy[targets[t]] -= 1 # backprop into y. see http://cs231n.github.io/neural-networks-case-study/#grad if confused here
dWhy += np.dot(dy, hs[t].T)
dby += dy
dh = np.dot(Why.T, dy) + dhnext # backprop into h
dhraw = (1 - hs[t] * hs[t]) * dh # backprop through tanh nonlinearity
dbh += dhraw
dWxh += np.dot(dhraw, xs[t].T)
dWhh += np.dot(dhraw, hs[t-1].T)
dhnext = np.dot(Whh.T, dhraw)
for dparam in [dWxh, dWhh, dWhy, dbh, dby]:
np.clip(dparam, -5, 5, out=dparam) # clip to mitigate exploding gradients
return loss, dWxh, dWhh, dWhy, dbh, dby, hs[len(inputs)-1]
def sample(h, seed_ix, n):
"""
sample a sequence of integers from the model
h is memory state, seed_ix is seed letter for first time step
"""
x = np.zeros((vocab_size, 1))
x[seed_ix] = 1
ixes = []
for t in range(n):
h = np.tanh(np.dot(Wxh, x) + np.dot(Whh, h) + bh)
y = np.dot(Why, h) + by
p = np.exp(y) / np.sum(np.exp(y))
ix = np.random.choice(range(vocab_size), p=p.ravel())
x = np.zeros((vocab_size, 1))
x[ix] = 1
ixes.append(ix)
return ixes
n, p = 0, 0
mWxh, mWhh, mWhy = np.zeros_like(Wxh), np.zeros_like(Whh), np.zeros_like(Why)
mbh, mby = np.zeros_like(bh), np.zeros_like(by) # memory variables for Adagrad
smooth_loss = -np.log(1.0/vocab_size)*seq_length # loss at iteration 0
while True:
# prepare inputs (we're sweeping from left to right in steps seq_length long)
if p+seq_length+1 >= len(data) or n == 0:
hprev = np.zeros((hidden_size,1)) # reset RNN memory
p = 0 # go from start of data
inputs = [char_to_ix[ch] for ch in data[p:p+seq_length]]
targets = [char_to_ix[ch] for ch in data[p+1:p+seq_length+1]]
# sample from the model now and then
if n % 100 == 0:
sample_ix = sample(hprev, inputs[0], 200)
txt = ''.join(ix_to_char[ix] for ix in sample_ix)
print('----\n %s \n----' % (txt, ))
# forward seq_length characters through the net and fetch gradient
loss, dWxh, dWhh, dWhy, dbh, dby, hprev = lossFun(inputs, targets, hprev)
smooth_loss = smooth_loss * 0.999 + loss * 0.001
if n % 100 == 0: print('iter %d, loss: %f' % (n, smooth_loss)) # print progress
# perform parameter update with Adagrad
for param, dparam, mem in zip([Wxh, Whh, Why, bh, by],
[dWxh, dWhh, dWhy, dbh, dby],
[mWxh, mWhh, mWhy, mbh, mby]):
mem += dparam * dparam
param += -learning_rate * dparam / np.sqrt(mem + 1e-8) # adagrad update
p += seq_length # move data pointer
n += 1 # iteration counter
Rewrite the code in C. This should be a simple translation of the code, without any unnecessary changes except for it to compile and produce the same output as the Python code. The code you will provide will not allocate memory dynamically.
|
b65539a0dacf2f37f29fb1c412e6344f
|
{
"intermediate": 0.2813236117362976,
"beginner": 0.40787777304649353,
"expert": 0.3107985854148865
}
|
29,600
|
6. Using the work studied in chapter 11, create an interactive form that retrieves the place name and region for a given country and postal code in the home/postal address fields.
|
ffbd21d7fb4d2862a533e839d0538761
|
{
"intermediate": 0.3067016303539276,
"beginner": 0.2245914787054062,
"expert": 0.4687068462371826
}
|
29,601
|
C# for loop eating cpu
|
a0b5bf5ea23648f73a06699468344181
|
{
"intermediate": 0.29192838072776794,
"beginner": 0.6045543551445007,
"expert": 0.10351727157831192
}
|
29,602
|
13. Create an orderSubmit.html page as in chapter 6 and display all above information in the page, the password must show as * characters in all pages.
|
8c005fb229fdbadae8966dd0f9c3b24c
|
{
"intermediate": 0.27241167426109314,
"beginner": 0.27576661109924316,
"expert": 0.45182180404663086
}
|
29,603
|
17. Create a play.html page, visit the site https://www.transum.org/Maths/Investigation/CarPark/ . Using the information studied in chapter 10 create a similar type game where users can add, remove and move cars, motorcycles and trucks of different sizes around. It is OK if your vehicles “bump” into each other when being moved.
|
c50914c4bc2cc1a793113bb2b6874331
|
{
"intermediate": 0.25490933656692505,
"beginner": 0.3398268520832062,
"expert": 0.4052637815475464
}
|
29,604
|
Modify the existing vector's contents, by erasing the element at index 1 (initially 200), then inserting 100 and 102 in the shown locations. Use Vector ADT's erase() and insert() only, and remember that the first argument of those functions is special, involving an iterator and not just an integer. Sample output of below program with input 33 200 10:
100 33 102 10
|
a0ab4910fd950a134ab44561e60ba395
|
{
"intermediate": 0.4478788673877716,
"beginner": 0.2327447086572647,
"expert": 0.3193764388561249
}
|
29,605
|
can you please tell me what is wrong with this code and how to fix it Uncaught SyntaxError: Invalid or unexpected token errorMsg += “Password must contain at least one of the following symbols: !, @, #”;
}
|
9ae13ccc962de9663339a2d5f2b7f856
|
{
"intermediate": 0.4254191815853119,
"beginner": 0.34893184900283813,
"expert": 0.2256489396095276
}
|
29,606
|
{% extends 'blank.html' %}
{% block body %}
<div class="container">
<h1>{{ page_title }}</h1>
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="input-field">
{{ form.text.label }}
<textarea class='materialize-textarea'>{{ form.text }}</textarea>
</div>
<br><br>
<div class="input-field">
{{ form.translation.label }}
<textarea class='materialize-textarea' readonly=True>{{ form.translation }}</textarea>
</div>
{{ form.submit }}
<br><br>
</form>
</div>
{% endblock %}
почему в полях формы выводится <input id="text" name="text" required type="text" value=""> и <input id="translation" name="translation" required type="text" value="">
|
714d7d46ce436a7491f2783e5d63415d
|
{
"intermediate": 0.36726123094558716,
"beginner": 0.36309191584587097,
"expert": 0.26964688301086426
}
|
29,607
|
Due date: 11-06-2023 (M), 9am Close date: 11-20-2023 (M), 9awhm
Submission: a C++ file (hw6.cpp) on Blackboard
Points: 40
Description:
Movie Ratings Analysis
You have collected a file of movie ratings where each movie is rated from 1 (bad) to 5 (excellent). The
first line of the file is a number that identifies how many ratings are in the file. Each rating then consists
of two lines: the name of the movie followed by the numeric rating from 1 to 5. Your task is to write a
program that reads in a file in this format, calculates the average rating for each movie, and outputs the
average along with the number of reviews.
Here is a sample rating file with four unique movies and seven ratings:
7
Happy Feet
4
Happy Feet
5
Pirates of the Caribbean
3
Happy Feet
4
Pirates of the Caribbean
4
Flags of Our Fathers
5
Gigli
1
Here is the desired output for the sample data:
Happy Feet: 3 reviews, average of 4.3 / 5
Pirates of the Caribbean: 2 reviews, average of 3.5 / 5
Flags of Our Father: 1 review, average of 5 / 5
Gigli: 1 review, average of 1 / 5
Suggestion: consider using associative container(s) to efficiently organize the process the data and
generate the output.
Rubric:
• Please read GradingRubricGuidline.pdf on Blackboard
• 80% for the correctness of the code
• 20% for the documentation and the programming style, including but not limited to the following rules
below.
• Each function must be commented with a description of what it does, the role of its parameters and the
meaning of its return value.
• Indentation level of your code must correspond to the nesting level.
|
967dd7caf90891df15af513520096b36
|
{
"intermediate": 0.2233572155237198,
"beginner": 0.6263189315795898,
"expert": 0.15032386779785156
}
|
29,608
|
Certainly! Here is another possible implementation using a std::map to efficiently organize and process the movie ratings:
#include <iostream>
#include <fstream>
#include <string>
#include <map>
// Function to read ratings from a file and calculate average ratings
void analyzeRatings(const std::string& filename) {
std::ifstream file(filename);
if (!file) {
std::cout << “Error opening file.” << std::endl;
return;
}
std::map<std::string, std::pair<int, double>> movieRatings;
int totalRatings;
file >> totalR
|
7173fb7872e3b03c3ab291a335c78143
|
{
"intermediate": 0.48254120349884033,
"beginner": 0.3493637144565582,
"expert": 0.16809503734111786
}
|
29,609
|
what is prolactin? What are it's functions in the human body?
|
9320aa0eafac9e84f41f065150b296d9
|
{
"intermediate": 0.3670702576637268,
"beginner": 0.3225482106208801,
"expert": 0.3103815019130707
}
|
29,610
|
summarize this article https://www.economist.com/game-theory/2012/04/10/melting-hopes
|
1239292b9d3f1db66807150ad3012f06
|
{
"intermediate": 0.3298908472061157,
"beginner": 0.3140124976634979,
"expert": 0.35609665513038635
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.