row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
32,725
|
Почему мой код выбирает не все объекты префаба?
Image[] images = instantiatedPrefab.GetComponents<Image>();
foreach (Image image in images){# some code}
|
db6139d02327090c5d97de5ca89dd04b
|
{
"intermediate": 0.4034166634082794,
"beginner": 0.35955628752708435,
"expert": 0.23702698945999146
}
|
32,726
|
Hi, how to calculate PRS based on GWAS analysis database?
|
b594147fa21f42c2ed4f5a10dcd3d50f
|
{
"intermediate": 0.3229793310165405,
"beginner": 0.16873355209827423,
"expert": 0.5082870721817017
}
|
32,727
|
请根据tansformer的注意力机制原理,详细解释以下每一行代码:def attention(query, key, value, mask=None, dropout=None):
“Compute ‘Scaled Dot Product Attention’”
d_k = query.size(-1)
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
scores = scores.masked_fill(mask == 0, -1e9)
p_attn = scores.softmax(dim=-1)
if dropout is not None:
p_attn = dropout(p_attn)
return torch.matmul(p_attn, value), p_attn
|
c1460a9c4e2c94086a901f79623f711f
|
{
"intermediate": 0.38848361372947693,
"beginner": 0.3273635804653168,
"expert": 0.2841528654098511
}
|
32,728
|
sub_visit <- sub_trt3 %>%
group_by(Subject_ID,Analyte,trtpn) %>%
mutate(
next_visit=ifelse(
is.na(lead(Visit)),
99,
lead(Visit)-1
),
) %>%
ungroup()%>%
select(Subject_ID,Visit,next_visit,Analyte,trtpn) how to fix this code to make next_visit shown the correct value, now the visit=3,4,5, and next_visit is also is 3,4,99, the correct value should be 4,5,99
|
9cb7eca55cb6e44e5a41787bba6c4064
|
{
"intermediate": 0.34586647152900696,
"beginner": 0.40929675102233887,
"expert": 0.2448367476463318
}
|
32,729
|
is there any free gpu collab like google
|
bd06ef185bcd641f8d90aafe0d841963
|
{
"intermediate": 0.3327065706253052,
"beginner": 0.17924153804779053,
"expert": 0.4880518913269043
}
|
32,730
|
battery low notification in android studio java full code
|
75f3f5b5d856e865554db10bd72f2d9b
|
{
"intermediate": 0.4336847960948944,
"beginner": 0.34456852078437805,
"expert": 0.22174662351608276
}
|
32,731
|
if I have a map in js file that was declared like this then how could I possible update the value of it if I know for certain that one of the entries is equals 5000?
new Map([...state.entries(), [String(appeal.id), appeal]])
|
bdb9e4160c6c4754e8e5b350b916cc31
|
{
"intermediate": 0.6044027209281921,
"beginner": 0.20296114683151245,
"expert": 0.19263608753681183
}
|
32,732
|
Надо исправить код
Уникальное поле может быть только id и обновлять надо все колонки
|
fc81e38b7e509b831272c35229e0063c
|
{
"intermediate": 0.2912417948246002,
"beginner": 0.35082435607910156,
"expert": 0.35793378949165344
}
|
32,733
|
Write a program that inputs an integer (say n) from user, Then calculate the sum of squares of integers up to n. (i.e., sum = 12 + 22 + 32 + … + n2). in C++ for beginners
|
47b8a264ae06494d62a3e14365acb393
|
{
"intermediate": 0.39967623353004456,
"beginner": 0.21253417432308197,
"expert": 0.38778960704803467
}
|
32,734
|
### ------------------------------ ### ### MINIMUM TECHNICAL REQUIREMENTS ### ### ------------------------------ ### # Write a function that does the following! # 1) Display the name of a continent on the stage # 2) Display 2 countries on the continent # 3) Display a relevant stage background image def africa(): stage.set_background("jungle") africa = codesters.Text("Africa", -200, 225, "red") ethiopia = codesters.Text("Ethiopia", -200, 200, "white") stage.wait(3) ghana = codesters.Text("Ghana", -200, 175, "white") fact.set_text("Ghana means Warrior King.") stage.wait(3) ## Repeat the steps for all 7 continents (at least 7 functions!) def europe(): stage.set_background("flowers") europe = codesters.Text("Europe", 0, 225, "red") france = codesters.Text("France", 0, 200, "white") fact.set_color("white") fact.set_text_background("blue", "black", 1) fact.set_text("The Tour de France is a bike race\nthat is over 100 years old!") stage.wait(3) poland = codesters.Text("Poland", 0, 175, "white") fact.set_text("Marie Curie, a famous scientist who won 2 Nobel Prizes, was born in Poland.") stage.wait(3) def asia(): stage.set_background("park") asia = codesters.Text("Asia", 200, 225, "red") korea = codesters.Text("South Korea", 190, 200, "white") fact.move_down(100) fact.set_color("green") fact.set_text_background("tan", "brown", 1) fact.set_text("Taekwondo is the national sport of South Korea.") stage.wait(3) china = codesters.Text("China", 200, 175, "white") fact.set_text("The Great Wall of China is 13,171 miles long!") stage.wait(3) def oceania(): stage.set_background("underwater") oceania = codesters.Text("Oceania", -200, 125, "red") australia = codesters.Text("Australia", -200, 100, "white") fact.set_color("blue") fact.set_text_background("linen", "green", 1) fact.set_text("Australia is the only continent covered by a single country.") stage.wait(3) fiji = codesters.Text("Fiji", -200, 75, "white") fact.set_text("There are 333 tropical islands in Fiji!") stage.wait(3) def north_america(): stage.set_background("city") north_america = codesters.Text("North America", 0, 125, "red") usa = codesters.Text("USA", 0, 100, "white") fact.set_text_background("silver", "black", 1) fact.set_text("Alaska's the biggest state. It's 2.5 times the Texas!") stage.wait(3) mexico = codesters.Text("Mexico", 0, 75, "white") fact.set_text("Mexico is home to the world's smallest volcano!") stage.wait(3) def south_america(): stage.set_background("soccerfield") south_america = codesters.Text("South America", 180, 125, "red") peru = codesters.Text("Peru", 190, 100, "white") fact.set_text("Machu Picchu, a 15th century city, and one of the 7 wonders of the world, is in Peru!") stage.wait(3) ecuador = codesters.Text("Ecuador", 185, 75, "white") fact.set_text("Ecuador is on the equator!\nIt's in the Northern AND Southern hemispheres.") stage.wait(3) fact.hide() fact = codesters.Text("Ethiopia is the birthplace of coffee!", 0, 100, "gold") fact.set_text_background("grey", "black", 1) # Call all the functions africa() europe() asia() oceania() north_america() south_america() sprite = codesters.Sprite("earth", 100, -100)
CREATE: Display the names of 2 countries from each continent and a background picture for each continent. Bonus: Include a fun fact about each country!
|
c3094e4131cea12340f2a6598d2a7089
|
{
"intermediate": 0.34308215975761414,
"beginner": 0.37124747037887573,
"expert": 0.28567034006118774
}
|
32,735
|
house icon Assignment
|
c4ff34212e87a57a58fa4bc0dc212a68
|
{
"intermediate": 0.32357725501060486,
"beginner": 0.3697170317173004,
"expert": 0.3067057132720947
}
|
32,736
|
请详细解释以下代码:class MultiHeadedAttention(nn.Module):
def __init__(self, h, d_model, dropout=0.1):
"Take in model size and number of heads."
super(MultiHeadedAttention, self).__init__()
assert d_model % h == 0
# We assume d_v always equals d_k
self.d_k = d_model // h
self.h = h
self.linears = clones(nn.Linear(d_model, d_model), 4)
self.attn = None
self.dropout = nn.Dropout(p=dropout)
def forward(self, query, key, value, mask=None):
"Implements Figure 2"
if mask is not None:
# Same mask applied to all h heads.
mask = mask.unsqueeze(1)
nbatches = query.size(0)
# 1) Do all the linear projections in batch from d_model => h x d_k
query, key, value = [
lin(x).view(nbatches, -1, self.h, self.d_k).transpose(1, 2)
for lin, x in zip(self.linears, (query, key, value))
]
# 2) Apply attention on all the projected vectors in batch.
x, self.attn = attention(
query, key, value, mask=mask, dropout=self.dropout
)
# 3) "Concat" using a view and apply a final linear.
x = (
x.transpose(1, 2)
.contiguous()
.view(nbatches, -1, self.h * self.d_k)
)
del query
del key
del value
return self.linears[-1](x)
|
638e15384b6224a5469306aa36d3eacb
|
{
"intermediate": 0.4412096440792084,
"beginner": 0.21335391700267792,
"expert": 0.3454364240169525
}
|
32,737
|
hello
|
30dbf50b810bac39db017aae50b658cd
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
32,738
|
implement playwright typescript parametrized test by using parameters as values from csv file
|
27646ecf602440b2d8a5b01ac7744bf1
|
{
"intermediate": 0.34317323565483093,
"beginner": 0.5071281790733337,
"expert": 0.14969861507415771
}
|
32,739
|
turn this into a streaming post instead of a post:
@app.post("/search1")
async def predict(request: Request, user: str = Depends(get_current_user)):
body = await request.body()
create = requests.post("https://bing.github1s.tk/api/create")
data = json.loads(create.text)
message = body.decode() # convert bytes to string
# logger.info(message) # Add this line
message = f"""I need you to find the used price of a {message}, you will respond with the most relateable item and the price and if you find different prices in Sweden and international price.
1. do a search to figure out the used price of <{message}> give back 5cheapest results you find
2. if {message} is audio related then you can also search on https://www.hifishark.com/ if not then ignore this step
3. I'm only intrested in used products so don't give me the retail price.
4. Always try to find the price relevated to the Swedish market (tradera/blocket/facebook) first hand and only go international if you can't find for swedish market
5. Describe what {message} to look for on this particular item to see if it's worth more or less.
answer in swedish"""
header = {"Content-Type": "application/json"}
request_message = {
"conversationId": data["conversationId"],
"encryptedconversationsignature": data["encryptedconversationsignature"],
"clientId": data["clientId"],
"invocationId": 0,
"conversationStyle": "Balanced",
"prompt": message,
"allowSearch": True,
"context": "",
}
# Serialize the dictionary to a JSON-formatted string
request_message_json = json.dumps(request_message)
# Print the serialized request message
print(request_message_json)
# Make the POST request to the specified URL
responded = requests.post(
"https://bing.github1s.tk/api/sydney", data=request_message_json, headers=header
)
# Check if the response has JSON content
json_objects = responded.text.split("▲")
json_objects = json_objects[0].split("\x1e")
print(json_objects)
texts = []
for obj in json_objects:
if obj:
# Parse the JSON string
json_data = json.loads(obj)
print(json_data)
if "arguments" in json_data and "messages" in json_data["arguments"][0]:
for message in json_data["arguments"][0]["messages"]:
texts = message["text"]
# texts should now contain all extracted text fields from each message
print(texts)
return texts
import { NextApiRequest, NextApiResponse } from 'next'
import assert from 'assert'
import NextCors from 'nextjs-cors';
import { BingWebBot } from '@/lib/bots/bing'
import { BingConversationStyle, APIMessage, Action } from '@/lib/bots/bing/types'
import { messageToContext } from '@/lib/utils';
export const config = {
api: {
responseLimit: false,
},
}
export interface APIRequest {
model: string
action: Action
messages: APIMessage[]
stream?: boolean
}
export interface APIResponse {
choices: {
delta?: APIMessage
message: APIMessage
}[]
}
function parseOpenAIMessage(request: APIRequest) {
const messages = request.messages.slice(0)
const prompt = messages.pop()?.content
const context = messageToContext(messages)
return {
prompt,
context,
stream: request.stream,
allowSearch: /gpt-?4/i.test(request.model),
model: /Creative|gpt-?4/i.test(request.model) ? 'Creative' : 'Balanced',
};
}
function responseOpenAIMessage(content: string): APIResponse {
const message: APIMessage = {
role: 'assistant',
content,
};
return {
choices: [{
delta: message,
message,
}],
};
}
function getOriginFromHost(host: string) {
const uri = new URL(`http://${host}`)
if (uri.protocol === 'http:' && !/^[0-9.:]+$/.test(host)) {
uri.protocol = 'https:';
}
return uri.toString().slice(0, -1)
}
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === 'GET') return res.status(200).end('ok')
await NextCors(req, res, {
// Options
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'],
origin: '*',
optionsSuccessStatus: 200,
})
const abortController = new AbortController()
req.socket.once('close', () => {
abortController.abort()
})
const { prompt, stream, model, context } = parseOpenAIMessage(req.body);
let lastLength = 0
let lastText = ''
try {
const chatbot = new BingWebBot({
endpoint: getOriginFromHost(req.headers.host || '127.0.0.1:3000'),
})
if (stream) {
res.setHeader('Content-Type', 'text/event-stream; charset=utf-8')
}
assert(prompt, 'messages can\'t be empty!')
const toneType = model as BingConversationStyle
await chatbot.sendMessage({
prompt,
context,
options: {
bingConversationStyle: Object.values(BingConversationStyle)
.includes(toneType) ? toneType : BingConversationStyle.Creative,
},
signal: abortController.signal,
onEvent(event) {
if (event.type === 'UPDATE_ANSWER') {
lastText = event.data.text
if (stream && lastLength !== lastText.length) {
res.write(`data: ${JSON.stringify(responseOpenAIMessage(lastText.slice(lastLength)))}\n\n`)
lastLength = lastText.length
}
}
},
})
} catch (error) {
console.log('Catch Error:', error)
res.write(`data: ${JSON.stringify(responseOpenAIMessage(`${error}`))}\n\n`)
} finally {
if (stream) {
res.end(`data: [DONE]\n\n`);
} else {
res.end(JSON.stringify(responseOpenAIMessage(lastText)))
}
}
}
|
619a340a50c0568124ef1857622f2b72
|
{
"intermediate": 0.4374662935733795,
"beginner": 0.33146965503692627,
"expert": 0.23106403648853302
}
|
32,740
|
NoneType' object has no attribute 'dtype
|
ea0fdd8a22faada3ee3232aa03e429a4
|
{
"intermediate": 0.43385955691337585,
"beginner": 0.26159539818763733,
"expert": 0.30454498529434204
}
|
32,741
|
Who earns more: fullstack web developer or machine learning developer?
|
0f50f9336fd02e4c9d286c254689b6e5
|
{
"intermediate": 0.5697062015533447,
"beginner": 0.08597424626350403,
"expert": 0.34431958198547363
}
|
32,742
|
i ran :
cargo install bootimage
throws:
error: could not compile `serde` (lib) due to 5098 previous errors
error: failed to compile `bootimage v0.10.3`, intermediate artifacts can be found at `/var/folders/7w/40hwhj6j71lbbn16ybk04frc0000gn/T/cargo-installWXIfAv`.
|
cfd6f5e38325bf1656e460cebfbb20b6
|
{
"intermediate": 0.4752272665500641,
"beginner": 0.29570287466049194,
"expert": 0.22906984388828278
}
|
32,743
|
get ethereum block number by timestamp with rpc
|
0ce52bdded7dfe416b1d72d1d1cf4885
|
{
"intermediate": 0.4566570222377777,
"beginner": 0.2056942731142044,
"expert": 0.3376486897468567
}
|
32,744
|
Денис
−
− очень занятой человек. Поэтому он нанял Вас, чтобы оптимизировать свои жизненные процессы.
Самое важное для Дениса
−
− это саморазвитие, из-чего для каждого дня он составляет расписание в виде бинарного дерева, каждая вершина которого
−
− это польза от завершения некоторой работы в течение дня.
Чтобы получать максимальную пользу от каждой минуты своего драгоценного времени, Денис ищет в своем расписании оптимальный участок для работы. Таковым он называет поддерево, которое является BST с максимальной пользой.
Входные данные
�
l
−
− спуск в левого ребёнка
�
r
−
− спуска в правого ребёнка
�
u
−
− подъём наверх
В единственной строке подается
�
n значений.
Выходные данные
Вывести в единственной строке число
−
− максимальную пользу
тесты:
STDIN
1 l 4 l 2 u r 4 u u r 3 l 2 u r 5 l 4 u r 6 u u u u
STDOUT
20
STDIN
4 l 3 l 1 u r 2 u u u
STDOUT
2
STDIN
-4 l -2 u r -5 u u
STDOUT
0
реши на cpp я привел примеры тестов
|
409a2cbb477b3fb36b4c4bb587e425bf
|
{
"intermediate": 0.29815754294395447,
"beginner": 0.39341381192207336,
"expert": 0.30842870473861694
}
|
32,745
|
Create a class diagram with generalization arrows (https://www.uml-diagrams.org) for the following
real-world objects that all represent openings in walls. The class diagram shows the (hierarchical)
relationships between these objects/classes:
glass window, room entry, door, bull’s-eye, wall-break, wood door, sliding door, window, glass door explain me what we should do shortly ?
|
4f5b2faa69774b533b8c304fa45eb82c
|
{
"intermediate": 0.30356907844543457,
"beginner": 0.46015316247940063,
"expert": 0.2362777143716812
}
|
32,746
|
backspace lua print
|
0c132a5b95f7053fa3b52adce17ee84f
|
{
"intermediate": 0.3122391104698181,
"beginner": 0.3836473226547241,
"expert": 0.30411359667778015
}
|
32,747
|
Hello, I want this dispatch.meta file to be realistic so I have gta 5 and im using openiv to access the files for modding in singleplayer I want you to edit the dispatch.meta file to make it realistic and tell me what you changed "<?xml version="1.0" encoding="UTF-8"?>
<CDispatchData>
<ParoleDuration value="9000"/>
<InHeliRadiusMultiplier value="1.5"/>
<ImmediateDetectionRange value="25.0"/>
<OnScreenImmediateDetectionRange value="45.0f"/>
<LawSpawnDelayMin>
<SLOW value="20.0"/>
<MEDIUM value="10.0"/>
<FAST value="10.0"/>
</LawSpawnDelayMin>
<LawSpawnDelayMax>
<SLOW value="30.0"/>
<MEDIUM value="20.0"/>
<FAST value="20.0"/>
</LawSpawnDelayMax>
<AmbulanceSpawnDelayMin>
<SLOW value="45.0"/>
<MEDIUM value="20.0"/>
<FAST value="20.0"/>
</AmbulanceSpawnDelayMin>
<AmbulanceSpawnDelayMax>
<SLOW value="60.0"/>
<MEDIUM value="30.0"/>
<FAST value="30.0"/>
</AmbulanceSpawnDelayMax>
<FireSpawnDelayMin>
<SLOW value="45.0"/>
<MEDIUM value="20.0"/>
<FAST value="20.0"/>
</FireSpawnDelayMin>
<FireSpawnDelayMax>
<SLOW value="60.0"/>
<MEDIUM value="30.0"/>
<FAST value="30.0"/>
</FireSpawnDelayMax>
<DispatchOrderDistances>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_PoliceHelicopter</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_SwatHelicopter</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_FireDepartment</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_SwatAutomobile</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_AmbulanceDepartment</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_Gangs</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_PoliceRiders</DispatchType>
<OnFootOrderDistance value="200.0"/>
<InVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_PoliceVehicleRequest</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_PoliceRoadBlock</DispatchType>
<OnFootOrderDistance value="350.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_ArmyVehicle</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_BikerBackup</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
<Item>
<DispatchType>DT_Assassins</DispatchType>
<OnFootOrderDistance value="200.0"/>
<MinInVehicleOrderDistance value="350.0"/>
<MaxInVehicleOrderDistance value="350.0"/>
</Item>
</DispatchOrderDistances>
<WantedLevelThresholds>
<WantedLevelClean value="0"/>
<WantedLevel1 value="50"/>
<WantedLevel2 value="180"/>
<WantedLevel3 value="550"/>
<WantedLevel4 value="1200"/>
<WantedLevel5 value="3800"/>
</WantedLevelThresholds>
<SingleplayerWantedLevelRadius>
<WantedLevelClean value="0.0"/>
<WantedLevel1 value="145.0"/>
<WantedLevel2 value="227.5"/>
<WantedLevel3 value="340.0"/>
<WantedLevel4 value="510.0"/>
<WantedLevel5 value="850.0"/>
</SingleplayerWantedLevelRadius>
<MultiplayerWantedLevelRadius>
<WantedLevelClean value="0.0"/>
<WantedLevel1 value="217.5"/>
<WantedLevel2 value="341.25"/>
<WantedLevel3 value="450.0"/>
<WantedLevel4 value="645.0"/>
<WantedLevel5 value="1275.0"/>
</MultiplayerWantedLevelRadius>
<HiddenEvasionTimes>
<WantedLevelClean value="0"/>
<WantedLevel1 value="30000"/>
<WantedLevel2 value="37500"/>
<WantedLevel3 value="45000"/>
<WantedLevel4 value="56250"/>
<WantedLevel5 value="82500"/>
</HiddenEvasionTimes>
<MultiplayerHiddenEvasionTimes>
<WantedLevelClean value="0"/>
<WantedLevel1 value="30000"/>
<WantedLevel2 value="37500"/>
<WantedLevel3 value="40500"/>
<WantedLevel4 value="50625"/>
<WantedLevel5 value="74250"/>
</MultiplayerHiddenEvasionTimes>
<VehicleSets>
<Vehicle>
<Name>POLICE_CAR</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
<VehicleModels>
<Vehicle>crusader</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_M_Marine_01</Ped>
</PedModels>
</Item>
<Item>
<ZoneType>VEHICLE_RESPONSE_COUNTRYSIDE</ZoneType>
<VehicleModels>
<Vehicle>SHERIFF</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Sheriff_01</Ped>
</PedModels>
</Item>
<Item>
<VehicleModels>
<Vehicle>police3</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_MOTORCYCLE</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>policeb</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>SWAT_JEEP</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
<VehicleModels>
<Vehicle>crusader</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_M_Marine_01</Ped>
</PedModels>
</Item>
<Item>
<ZoneType>VEHICLE_RESPONSE_COUNTRYSIDE</ZoneType>
<VehicleModels>
<Vehicle>sheriff2</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Swat_01</Ped>
</PedModels>
</Item>
<Item>
<VehicleModels>
<Vehicle>fbi2</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Swat_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_HELI_1</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
</Item>
<Item>
<VehicleModels>
<Vehicle>polmav</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Swat_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_HELI_2</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
</Item>
<Item>
<VehicleModels>
<Vehicle>annihilator</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Swat_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>AMBULANCE</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>ambulance</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_M_Paramedic_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>FIRE_TRUCK</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>firetruk</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Fireman_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_ROAD_BLOCK_CARS</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
</Item>
<Item>
<ZoneType>VEHICLE_RESPONSE_COUNTRYSIDE</ZoneType>
<VehicleModels>
<Vehicle>SHERIFF</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Sheriff_01</Ped>
</PedModels>
<ObjectModels>
<Object>prop_roadcone01a</Object>
</ObjectModels>
</Item>
<Item>
<VehicleModels>
<Vehicle>police3</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
<ObjectModels>
<Object>prop_roadcone01a</Object>
</ObjectModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_ROAD_BLOCK_RIOT</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
</Item>
<Item>
<IsMutuallyExclusive value="true" />
<VehicleModels>
<Vehicle>riot</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
<ObjectModels>
<Object>prop_roadcone01a</Object>
</ObjectModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_ROAD_BLOCK_SPIKE_STRIP</Name>
<ConditionalVehicleSets>
<Item>
<ZoneType>VEHICLE_RESPONSE_ARMY_BASE</ZoneType>
</Item>
<Item>
<IsMutuallyExclusive value="true" />
<VehicleModels>
<Vehicle>policet</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
<ObjectModels>
<Object>p_ld_stinger_s</Object>
</ObjectModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>GANGS</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>cavalcade</Vehicle>
</VehicleModels>
<PedModels>
<Ped>G_M_Y_PoloGoon_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>POLICE_BOAT</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>predator</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_Cop_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>ARMY</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>mesa3</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_BlackOps_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>BIKER</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>gburrito2</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_Y_XMech_02_MP</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
<Vehicle>
<Name>ASSASSINS</Name>
<ConditionalVehicleSets>
<Item>
<VehicleModels>
<Vehicle>cog55</Vehicle>
<Vehicle>cog552</Vehicle>
</VehicleModels>
<PedModels>
<Ped>S_M_M_HighSec_01</Ped>
</PedModels>
</Item>
</ConditionalVehicleSets>
</Vehicle>
</VehicleSets>
<PedVariations>
<Item key="S_M_Y_Cop_01">
<ModelVariations>
<Item>
<Component>PV_COMP_TASK</Component>
<DrawableId value="2"/>
<MinWantedLevel value="3"/>
<Armour value="20.0"/>
</Item>
<Item>
<Component>PV_COMP_ACCS</Component>
<DrawableId value="2"/>
<MinWantedLevel value="3"/>
<Armour value="20.0"/>
</Item>
</ModelVariations>
</Item>
<Item key="S_M_Y_Sheriff_01">
<ModelVariations>
<Item>
<Component>PV_COMP_TASK</Component>
<DrawableId value="2"/>
<MinWantedLevel value="3"/>
<Armour value="20.0"/>
</Item>
</ModelVariations>
</Item>
<Item key="S_M_M_HighSec_01">
<ModelVariations>
<Item>
<Component>PV_COMP_JBIB</Component>
<DrawableId value="0"/>
</Item>
</ModelVariations>
</Item>
</PedVariations>
<WantedResponses>
<WantedLevel1>
<DispatchServices>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<NumPedsToSpawn value="3"/>
<DispatchVehicleSets>
<Dispatch>POLICE_BOAT</Dispatch>
</DispatchVehicleSets>
</Item>
</DispatchServices>
</WantedLevel1>
<WantedLevel2>
<DispatchServices>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<NumPedsToSpawn value="3"/>
<DispatchVehicleSets>
<Dispatch>POLICE_BOAT</Dispatch>
</DispatchVehicleSets>
</Item>
</DispatchServices>
</WantedLevel2>
<WantedLevel3>
<DispatchServices>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<NumPedsToSpawn value="8"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceHelicopter</DispatchType>
<NumPedsToSpawn value="3"/>
<DispatchVehicleSets>
<Dispatch>POLICE_HELI_1</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceRoadBlock</DispatchType>
<NumPedsToSpawn value="2"/>
<DispatchVehicleSets>
<Dispatch>POLICE_ROAD_BLOCK_CARS</Dispatch>
<Dispatch>POLICE_ROAD_BLOCK_SPIKE_STRIP</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>POLICE_BOAT</Dispatch>
</DispatchVehicleSets>
</Item>
</DispatchServices>
</WantedLevel3>
<WantedLevel4>
<DispatchServices>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_SwatAutomobile</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>SWAT_JEEP</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceHelicopter</DispatchType>
<NumPedsToSpawn value="3"/>
<DispatchVehicleSets>
<Dispatch>POLICE_HELI_1</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_SwatHelicopter</DispatchType>
<NumPedsToSpawn value="5"/>
<DispatchVehicleSets>
<Dispatch>POLICE_HELI_1</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceRoadBlock</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>POLICE_ROAD_BLOCK_CARS</Dispatch>
<Dispatch>POLICE_ROAD_BLOCK_RIOT</Dispatch>
<Dispatch>POLICE_ROAD_BLOCK_SPIKE_STRIP</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>POLICE_BOAT</Dispatch>
</DispatchVehicleSets>
</Item>
</DispatchServices>
</WantedLevel4>
<WantedLevel5>
<DispatchServices>
<Item>
<DispatchType>DT_PoliceAutomobile</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_SwatAutomobile</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>SWAT_JEEP</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceHelicopter</DispatchType>
<NumPedsToSpawn value="3"/>
<DispatchVehicleSets>
<Dispatch>POLICE_HELI_1</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_SwatHelicopter</DispatchType>
<NumPedsToSpawn value="5"/>
<DispatchVehicleSets>
<Dispatch>POLICE_HELI_1</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceRoadBlock</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>POLICE_ROAD_BLOCK_CARS</Dispatch>
<Dispatch>POLICE_ROAD_BLOCK_RIOT</Dispatch>
<Dispatch>POLICE_ROAD_BLOCK_SPIKE_STRIP</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceBoat</DispatchType>
<NumPedsToSpawn value="9"/>
<DispatchVehicleSets>
<Dispatch>POLICE_BOAT</Dispatch>
</DispatchVehicleSets>
</Item>
</DispatchServices>
</WantedLevel5>
</WantedResponses>
<EmergencyResponses>
<Item>
<DispatchType>DT_FireDepartment</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>FIRE_TRUCK</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_AmbulanceDepartment</DispatchType>
<NumPedsToSpawn value="2"/>
<DispatchVehicleSets>
<Dispatch>AMBULANCE</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_PoliceVehicleRequest</DispatchType>
<NumPedsToSpawn value="2"/>
<DispatchVehicleSets>
<Dispatch>POLICE_CAR</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_Gangs</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>GANGS</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_ArmyVehicle</DispatchType>
<NumPedsToSpawn value="6"/>
<DispatchVehicleSets>
<Dispatch>ARMY</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_BikerBackup</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>BIKER</Dispatch>
</DispatchVehicleSets>
</Item>
<Item>
<DispatchType>DT_Assassins</DispatchType>
<NumPedsToSpawn value="4"/>
<DispatchVehicleSets>
<Dispatch>ASSASSINS</Dispatch>
</DispatchVehicleSets>
</Item>
</EmergencyResponses>
</CDispatchData>"
|
cd2cb3a261aa35fd145b15abaeafb119
|
{
"intermediate": 0.30186954140663147,
"beginner": 0.31952106952667236,
"expert": 0.3786093294620514
}
|
32,748
|
как работает @Scheduled(cron = "0 0/1 * * * ?")
|
092e895e856c83fd17c14c670974c7ae
|
{
"intermediate": 0.23919031023979187,
"beginner": 0.4655924439430237,
"expert": 0.29521727561950684
}
|
32,749
|
give me a behaviour tree in unity
|
217de09f51a62e961ffab0a8ff4a9c0d
|
{
"intermediate": 0.35754647850990295,
"beginner": 0.258609801530838,
"expert": 0.38384371995925903
}
|
32,750
|
with open(log_filename1, ‘a’) as log_file:
uname = platform.uname()
cpufreq = psutil.cpu_freq()
log_file.write(f’======= Computer ====== \nOS Name: {0} \n’.format(os_name))
log_file.write(‘OS Version: {0} \n’.format(os_version))
log_file.write(‘CPU: {0} \n’.format(proc_info.Name))
log_file.write(‘RAM: {0} GB \n’.format(system_ram))
log_file.write(‘Graphics Card: {0} \n’.format(gpu_info.Name))
log_file.write(‘======= System Information =======\n’)
log_file.write(f"System: {uname.system}\n")
log_file.write(f"Node Name: {uname.node}\n")
log_file.write(f"Release: {uname.release}\n")
log_file.write(f"Version: {uname.version}\n")
log_file.write(f"Machine: {uname.machine}\n")
log_file.write(f"Processor: {uname.processor}\n")
log_file.write(‘======= CPU Information =======\n’)
log_file.write(“Physical cores: \n”.format(psutil.cpu_count(logical=False)))
log_file.write(“Total cores: \n”.format(psutil.cpu_count(logical=True)))
log_file.write(f"Max Frequency: {cpufreq.max:.2f}Mhz \n")
log_file.write(f"Min Frequency: {cpufreq.min:.2f}Mhz \n")
log_file.write(f"Current Frequency: {cpufreq.current:.2f}Mhz \n")
log_file.write(f"Total CPU Usage: {psutil.cpu_percent()}% \n")
в этом коде он выдает все верно кроме строчек:
log_file.write(“Physical cores: \n”.format(psutil.cpu_count(logical=False)))
log_file.write(“Total cores: \n”.format(psutil.cpu_count(logical=True)))
log_file.write(f"Machine: {uname.machine}\n")
log_file.write(f"Processor: {uname.processor}\n")
исправь пажалуйста
|
f521d7321806da9e61aad8532a0cf2d8
|
{
"intermediate": 0.3372780382633209,
"beginner": 0.3628672957420349,
"expert": 0.29985469579696655
}
|
32,751
|
C# sendinput send right mouse click to windows client area x and y
|
9b97f869c1fcf41b7387ac035aa9455c
|
{
"intermediate": 0.47701773047447205,
"beginner": 0.2793610095977783,
"expert": 0.24362124502658844
}
|
32,752
|
Hi, how to properly update software built from source on Arch Linux?
|
099e085461ec88c74705383d79358bef
|
{
"intermediate": 0.5053858160972595,
"beginner": 0.21074067056179047,
"expert": 0.28387343883514404
}
|
32,753
|
import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
import os
import shutil
def create_database():
folder_name = entry.get()
if folder_name:
try:
if os.path.exists(folder_name):
messagebox.showwarning("警告", "資料夾已經存在")
else:
os.mkdir(folder_name)
listbox.insert(tk.END, folder_name) # 將資料夾名稱添加到Listbox中
messagebox.showinfo("成功", f"已成功建立資料夾 {folder_name}")
update_combobox_options()
except Exception as e:
messagebox.showerror("錯誤", f"無法建立資料夾: {e}")
else:
messagebox.showwarning("警告", "請輸入資料夾名稱")
def delete_database_window():
selected_folder = listbox.get(tk.ACTIVE) # 獲取選取的資料庫名稱
if selected_folder:
delete_window = tk.Toplevel(root)
delete_window.title("刪除資料庫")
label_delete_folder = tk.Label(delete_window, text="選擇要刪除的資料庫:")
label_delete_folder.pack()
delete_combobox = ttk.Combobox(delete_window, values=listbox.get(0, tk.END))
delete_combobox.pack()
button_confirm_delete = tk.Button(delete_window, text="確定刪除", command=lambda: delete_database(delete_combobox.get()))
button_confirm_delete.pack()
else:
messagebox.showwarning("警告", "請選擇要刪除的資料庫")
def delete_database(folder_name):
if folder_name:
try:
result = messagebox.askyesno("確認", f"確定要刪除資料庫 {folder_name} 嗎?")
if result:
folder_path = os.path.join(os.getcwd(), folder_name)
shutil.rmtree(folder_path) # 刪除資料夾
listbox.delete(listbox.get(0, tk.END).index(folder_name)) # 從Listbox中刪除資料庫名稱
messagebox.showinfo("成功", f"已成功刪除資料庫 {folder_name}")
update_combobox_options()
except Exception as e:
messagebox.showerror("錯誤", f"無法刪除資料庫: {e}")
else:
messagebox.showwarning("警告", "請選擇要刪除的資料庫")
def search_database():
search_content = entry_search.get() # 獲取輸入的查詢內容
if search_content:
if search_content in listbox.get(0, tk.END):
messagebox.showinfo("查詢結果", f"找到資料庫:{search_content}")
else:
messagebox.showinfo("查詢結果", "找不到符合條件的資料庫")
else:
messagebox.showwarning("警告", "請輸入查詢內容")
def create_table_window():
selected_folder = combobox.get() # 獲取所選的資料夾名稱
if selected_folder:
def add_entry():
entry_column = tk.Entry(table_window)
entry_column.pack()
entry_columns.append(entry_column)
table_window = tk.Toplevel(root)
table_window.title("新增表格")
label_table_name = tk.Label(table_window, text="輸入表格名稱:")
label_table_name.pack()
entry_table_name = tk.Entry(table_window)
entry_table_name.pack()
label_columns = tk.Label(table_window, text="輸入欄位名稱:")
label_columns.pack()
button_add_entry = tk.Button(table_window, text="新增輸入框", command=add_entry)
button_add_entry.pack()
button_create_table = tk.Button(table_window, text="建立表格", command=lambda: create_table(selected_folder, entry_table_name.get(), entry_columns))
button_create_table.pack()
entry_columns = []
for i in range(4):
entry_column = tk.Entry(table_window)
entry_column.pack()
entry_columns.append(entry_column)
def create_table(selected_folder, table_name, entry_columns):
if selected_folder and table_name:
try:
file_path = os.path.join(selected_folder, table_name + ".csv")
column_names = []
for entry in entry_columns:
column_name = entry.get()
if column_name:
column_names.append(column_name)
if os.path.exists(file_path):
messagebox.showwarning("警告", "檔案已經存在")
else:
with open(file_path, 'w') as file:
file.write(",".join(column_names) + "\n") # 寫入表格欄位名稱
messagebox.showinfo("成功", f"已成功建立表格 {table_name}")
except Exception as e:
messagebox.showerror("錯誤", f"無法建立表格: {e}")
else:
messagebox.showwarning("警告", "請選擇資料夾並輸入表格名稱")
def update_combobox_options():
folders = os.listdir()
folder_options = [folder for folder in folders if os.path.isdir(folder)]
combobox['values'] = folder_options
# 創建主視窗
root = tk.Tk()
root.title("資料庫建立工具")
root.geometry("600x600") # 設定視窗大小
# 創建標籤和輸入框
label = tk.Label(root, text="輸入資料庫名稱:")
label.pack()
entry = tk.Entry(root)
entry.pack()
# 創建按鈕
button = tk.Button(root, text="建立資料庫", command=create_database)
button.pack()
button_delete_folder = tk.Button(root, text="刪除資料庫", command=delete_database_window)
button_delete_folder.pack()
search_frame = tk.Frame(root)
search_frame.pack()
label_search = tk.Label(search_frame, text="輸入查詢內容:")
label_search.pack(side=tk.LEFT)
entry_search = tk.Entry(search_frame)
entry_search.pack(side=tk.LEFT)
button_search = tk.Button(search_frame, text="查詢", command=search_database)
button_search.pack(side=tk.LEFT)
# 創建Listbox
listbox = tk.Listbox(root)
listbox.pack()
# 列出已存在的資料夾
folders = os.listdir()
for folder in folders:
if os.path.isdir(folder):
listbox.insert(tk.END, folder)
# 創建下拉式選單
combobox = ttk.Combobox(root)
combobox.pack()
update_combobox_options()
button_create_table = tk.Button(root, text="新增表格", command=create_table_window)
button_create_table.pack()
# 開始運行主迴圈
root.mainloop() 可以在create table的地方幫我加下拉選單可以選型別嗎 每一條entry_column都要有
|
7b7c4ff7fc04ee903260197a90d59ecb
|
{
"intermediate": 0.30506664514541626,
"beginner": 0.5027267932891846,
"expert": 0.19220653176307678
}
|
32,754
|
help me on how I can also extract the urls:
{'type': 1, 'target': 'update', 'arguments': [{'messages': [{'text': 'Hej! Tack för din fråga. Jag har sökt efter begagnade Samsung Galaxy S10-priser i Sverige och internationellt. Nedan följer de fem billigaste resultaten jag hittade i Sverige:\n\n1. **PhoneHero** erbjuder en Samsung Galaxy S10 i klass C-skick för **2099 kr** [^1^]. \n2. **Mobilfynd.se** säljer en begagnad Samsung Galaxy S10 för **2990 kr** [^2^].\n3. **Returhuset** har en begagnad Samsung Galaxy S10 för **2995 kr** [^3^].\n4. **Netzone.se** säljer en renoverad Samsung Galaxy S10 för **3990 kr** [^4^].\n5. **Blocket** har en Samsung Galaxy S10 i bra skick för **4000 kr** .\n\nJag har inte hittat några internationella priser för begagnade Samsung Galaxy S10-enheter.\n\nNär det gäller att bedöma värdet på en begagnad Samsung Galaxy S10, finns det några faktorer att tänka på. Först och främst bör du kontrollera enhetens skick. Om enheten har några repor eller skador kan det påverka värdet. Du bör också kontrollera om enheten är olåst eller om den är bunden till en viss operatör. Olåsta enheter tenderar att ha ett högre värde eftersom de kan användas med vilken operatör som helst. Slutligen bör du kontrollera om enheten har några tillbehör, som laddare eller hörlurar, eftersom detta kan påverka värdet ytterligare.\n\nJag hoppas att detta hjälper dig att bedöma värdet på en begagnad Samsung Galaxy S10!', 'author': 'bot', 'createdAt': '2023-11-28T14:46:26.3423607+00:00', 'timestamp': '2023-11-28T14:46:26.3423607+00:00', 'messageId': '18c9bde5-085b-4ef2-b855-b0ab51eb8599', 'requestId': '0f368808-a4d7-486c-9187-727a51c5bc0a', 'offense': 'None', 'adaptiveCards': [{'type': 'AdaptiveCard', 'version': '1.0', 'body': [{'type': 'TextBlock', 'text': '[1]: https://phonehero.se/begagnade-mobiler/Samsung/galaxy-s10 ""\n[2]: https://www.mobilfynd.se/kop/begagnade-mobiltelefoner/samsung/galaxy-s10.html ""\n[3]: https://www.returhuset.se/mobiltelefoner/samsung/galaxy-s10.html ""\n[4]: https://netzone.se/begagnad-samsung/samsung-s10/ ""\n\nHej! Tack för din fråga. Jag har sökt efter begagnade Samsung Galaxy S10-priser i Sverige och internationellt. Nedan följer de fem billigaste resultaten jag hittade i Sverige:\n\n1. **PhoneHero** erbjuder en Samsung Galaxy S10 i klass C-skick för **2099 kr** [^1^][1]. \n2. **Mobilfynd.se** säljer en begagnad Samsung Galaxy S10 för **2990 kr** [^2^][2].\n3. **Returhuset** har en begagnad Samsung Galaxy S10 för **2995 kr** [^3^][3].\n4. **Netzone.se** säljer en renoverad Samsung Galaxy S10 för **3990 kr** [^4^][4].\n5. **Blocket** har en Samsung Galaxy S10 i bra skick för **4000 kr** .\n\nJag har inte hittat några internationella priser
för begagnade Samsung Galaxy S10-enheter.\n\nNär det gäller att bedöma värdet på en begagnad Samsung Galaxy S10, finns det några faktorer att tänka
på. Först och främst bör du kontrollera enhetens skick. Om enheten har några repor eller skador kan det påverka värdet. Du bör också kontrollera om
enheten är olåst eller om den är bunden till en viss operatör. Olåsta enheter tenderar att ha ett högre värde eftersom de kan användas med vilken operatör som helst. Slutligen bör du kontrollera om enheten har några tillbehör, som laddare eller hörlurar, eftersom detta kan påverka värdet ytterligare.\n\nJag hoppas att detta hjälper dig att bedöma värdet på en begagnad Samsung Galaxy S10!\n', 'wrap': True}, {'type': 'TextBlock', 'size': 'small', 'text': 'Learn more: [1. phonehero.se](https://phonehero.se/begagnade-mobiler/Samsung/galaxy-s10) [2. www.mobilfynd.se](https://www.mobilfynd.se/kop/begagnade-mobiltelefoner/samsung/galaxy-s10.html) [3. www.returhuset.se](https://www.returhuset.se/mobiltelefoner/samsung/galaxy-s10.html) [4. netzone.se](https://netzone.se/begagnad-samsung/samsung-s10/)', 'wrap': True}]}], 'sourceAttributions': [{'providerDisplayName': 'Köp Galaxy S10 ny & begagnad hos oss | PhoneHero', 'seeMoreUrl': 'https://phonehero.se/begagnade-mobiler/Samsung/galaxy-s10', 'urlSignature': 'YygmrmmybBfDTW/EqLu3qOyeBGXxRWmltpD0DOdfF0g=', 'searchQuery': 'samsung s10 begagnad pris sverige', 'provider': 'search_web'}, {'providerDisplayName': 'Begagnad Samsung Galaxy S10 | Köp billig begagnad Samsung S10 ...', 'seeMoreUrl': 'https://www.mobilfynd.se/kop/begagnade-mobiltelefoner/samsung/galaxy-s10.html', 'urlSignature': 'Nh3t+xJX0M7tYtoGUMNjDy89qO1aHHj6SdLkaDPDYw8=', 'searchQuery': 'samsung s10 begagnad pris sverige', 'provider': 'search_web'}, {'providerDisplayName': 'Samsung Galaxy S10 & S10 Plus | Billiga och begagnade mobiler - Returhuset', 'seeMoreUrl': 'https://www.returhuset.se/mobiltelefoner/samsung/galaxy-s10.html', 'urlSignature': 'Rk7BoUmzBFhyYAFE5uxPXrGo2Frdy1CsyjUvyhzWPDo=', 'searchQuery': 'samsung s10 begagnad pris sverige', 'provider': 'search_web'}, {'providerDisplayName': 'Köp Begagnad Samsung S10 med Garanti - Netzone.se', 'seeMoreUrl': 'https://netzone.se/begagnad-samsung/samsung-s10/', 'urlSignature': 'Ov8uiKO8EMXv0Bn77D1NJHAliXE6Ezvuzv7W20lggy8=', 'searchQuery': 'samsung s10 begagnad pris sverige', 'provider': 'search_web'}], 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'DeepLeo', 'scores': [{'component': 'BotOffense', 'score': 0.0009399439}, {'component': 'BotOffense', 'score': 0.0013198635}, {'component': 'BotOffense', 'score': 0.0011073389}, {'component': 'BotOffense', 'score': 0.0013617034}, {'component': 'BotOffense', 'score': 0.001044386}, {'component': 'BotOffense', 'score': 0.0017477857}, {'component': 'BotOffense', 'score': 0.0015792594}, {'component': 'BotOffense', 'score': 0.0015978456}], 'suggestedResponses': [{'text': 'Vad är skillnaden mellan Samsung Galaxy S10 och S20?', 'author': 'user', 'createdAt': '2023-11-28T14:46:43.030416+00:00', 'timestamp': '2023-11-28T14:46:43.030416+00:00', 'messageId': '41b1c675-995c-46f4-8fab-35c4b25024e1', 'messageType': 'Suggestion', 'offense': 'Unknown', 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'SuggestionChipsFalconService'}, {'text': 'Var kan jag köpa en ny Samsung Galaxy S10 i Sverige?', 'author': 'user', 'createdAt': '2023-11-28T14:46:43.0304178+00:00', 'timestamp': '2023-11-28T14:46:43.0304178+00:00', 'messageId': '76a059d5-773f-49c1-ad22-bb0270552f8b', 'messageType': 'Suggestion', 'offense': 'Unknown', 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'SuggestionChipsFalconService'}, {'text': 'Kan du hitta priset på andra modeller av Samsung-telefoner också?', 'author': 'user', 'createdAt': '2023-11-28T14:46:43.0304182+00:00', 'timestamp': '2023-11-28T14:46:43.0304182+00:00', 'messageId': '07e2e9f4-c5c2-499d-ab97-300d9f104501', 'messageType': 'Suggestion', 'offense': 'Unknown', 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'SuggestionChipsFalconService'}]}], 'requestId': '0f368808-a4d7-486c-9187-727a51c5bc0a'}]}
for obj in json_objects:
if obj:
# Parse the JSON string
json_data = json.loads(obj)
print(json_data)
if "arguments" in json_data and "messages" in json_data["arguments"][0]:
for message in json_data["arguments"][0]["messages"]:
texts = message["text"]
|
909df20360fc5c15287671b77cce2b41
|
{
"intermediate": 0.2928122878074646,
"beginner": 0.43683311343193054,
"expert": 0.27035465836524963
}
|
32,755
|
#include
#include <vector>
struct Node{
int data;
Node* parent = nullptr;
Node* left = nullptr;
Node* right = nullptr;
};
Node* Build(std::vector<char>& arr) {
Node* root;
for (int i = 0; i < arr.size(); ++i) {
if (arr[i] == ‘l’) {
Node* new_node = new Node;
root->left = new_node;
new_node->parent = root;
root = root->left;
} else if (arr[i] == ‘r’) {
Node* new_node = new Node;
root->right = new_node;
new_node->parent = root;
root = root->right;
} else if (arr[i] == ‘u’) {
if (root->parent != nullptr) {
root = root->parent;
} else {
return root;
}
} else if (isdigit(arr[i])) {
root->data = arr[i] - ‘0’;
}
}
return root;
}
int MaxSumBST(Node* node, int& maxSum) {
if (!node) return 0;
int leftSum = MaxSumBST(node->left, maxSum);
int rightSum = MaxSumBST(node->right, maxSum);
int totalSum = node->data + leftSum + rightSum;
if ((node->left == nullptr || (node->left->data < node->data && node->left == node->left->parent->left)) &&
(node->right == nullptr || (node->right->data > node->data && node->right == node->right->parent->right))) {
maxSum = std::max(maxSum, totalSum);
return totalSum;
}
return 0;
}
int main() {
char cmd;
std::vector<char> arr;
while (std::cin >> cmd) {
arr.push_back(cmd);
}
Node* root = new Node;
root = Build(arr);
int ans = 0;
MaxSumBST(root, ans);
std::cout << ans;
}
вот задача подправь мой код(он почти рабочий однако не проходит второй тест, не реализовани числа больше 9 и отрицательные)
Денис
−
− очень занятой человек. Поэтому он нанял Вас, чтобы оптимизировать свои жизненные процессы.
Самое важное для Дениса
−
− это саморазвитие, из-чего для каждого дня он составляет расписание в виде бинарного дерева, каждая вершина которого
−
− это польза от завершения некоторой работы в течение дня.
Чтобы получать максимальную пользу от каждой минуты своего драгоценного времени, Денис ищет в своем расписании оптимальный участок для работы. Таковым он называет поддерево, которое является BST с максимальной пользой.
Входные данные
�
l
−
− спуск в левого ребёнка
�
r
−
− спуска в правого ребёнка
�
u
−
− подъём наверх
В единственной строке подается
�
n значений.
Выходные данные
Вывести в единственной строке число
−
− максимальную пользу
STDIN STDOUT
1 l 4 l 2 u r 4 u u r 3 l 2 u r 5 l 4 u r 6 u u u u
20
4 l 3 l 1 u r 2 u u u
2
-4 l -2 u r -5 u u
0
Для поддержки значений больше 9 и отрицательных чисел, необходимо считывать числа целиком, а не по одной цифре. Также стоит внимательно проанализировать логику обхода дерева, чтобы убедиться в том, что программа корректно поднимается на уровень вверх.
Перепишем основные части кода, чтобы обработать входные данные корректно:
#include <iostream>
#include <vector>
#include <stack>
#include <string> // Нужно для std::string и std::stoi
struct Node {
int data;
Node* parent;
Node* left;
Node* right;
Node(int val = 0, Node* p = nullptr) : data(val), parent§, left(nullptr), right(nullptr) {}
};
// Объявляем функцию MaxSumBST здесь, чтобы её можно было вызвать в Build
int MaxSumBST(Node* node, int& maxSum);
int main() {
std::stack<Node*> nodes;
std::string token;
Node* root = nullptr;
while (std::cin >> token) {
if (token == “l” || token == “r”) {
// Считываем значение для узла
int value;
std::cin >> value;
// Создаем новый узел
Node* newNode = new Node(value);
if (!root) {
root = newNode;
} else {
Node* parent = nodes.top();
if (token == “l”) {
parent->left = newNode;
} else {
parent->right = newNode;
}
newNode->parent = parent;
}
nodes.push(newNode);
} else if (token == “u” && !nodes.empty()) {
// Подняться вверх к родителю
nodes.pop();
}
}
int ans = 0;
if (root) {
MaxSumBST(root, ans);
}
std::cout << ans << std::endl;
// Здесь нужно добавить очистку памяти, выделенной для дерева
ты не дописал свой ответ
|
b3e5fb09a3689476a4986cea6d8be0a4
|
{
"intermediate": 0.3643427789211273,
"beginner": 0.30159398913383484,
"expert": 0.33406320214271545
}
|
32,756
|
point.py:
import json
class Point:
def init(self, x=0, y=0):
self.x = x
self.y = y
@classmethod
def from_string(cls, s):
x, y = map(float, s.split(‘,’))
return cls(x, y)
def to_json(self):
return json.dumps(self.dict)
@classmethod
def from_json(cls, json_str):
data = json.loads(json_str)
return cls(data)
def repr(self):
return f"Point({self.x}, {self.y})“
vector.py:
from point import Point
import json
import math
class Vector:
def init(self, start=None, end=None):
self.start = start if start is not None else Point()
self.end = end if end is not None else Point()
def length(self):
return math.sqrt((self.end.x - self.start.x) 2 +
(self.end.y - self.start.y) ** 2)
def to_json(self):
return json.dumps({‘start’: self.start.dict,
‘end’: self.end.dict})
@classmethod
def from_json(cls, json_str):
data = json.loads(json_str)
start = Point(**data[‘start’])
end = Point(**data[‘end’])
return cls(start, end)
def add(self, other):
new_start = self.start
new_end = Point(self.end.x + other.end.x - other.start.x,
self.end.y + other.end.y - other.start.y)
return Vector(new_start, new_end)
def repr(self):
return f"Vector({self.start}, {self.end})”
# … other methods …
container.py:
import json
class Container:
def init(self):
self.items = []
def add_item(self, item):
self.items.append(item)
def remove_item(self, item):
self.items.remove(item)
def to_json(self):
return json.dumps([item.to_json() for item in self.items])
@classmethod
def from_json(cls, json_str):
items_data = json.loads(json_str)
container = cls()
for item_data in items_data:
item = Vector.from_json(item_data)
container.add_item(item)
return container
# … other methods …
__init__.py:
from .point import Point
from .vector import Vector
from .container import Container
|
f4a66ba1a6c40dd84145cb9994baa3d7
|
{
"intermediate": 0.3662046194076538,
"beginner": 0.49624133110046387,
"expert": 0.13755400478839874
}
|
32,757
|
Queueing collections with multiple model types is not supported.
|
13f7439509d6f441e9ac91b473ae55e4
|
{
"intermediate": 0.37022340297698975,
"beginner": 0.18504595756530762,
"expert": 0.444730669260025
}
|
32,758
|
write solidity code that would parse a json string “[1000, [1], [100]]” into struct
struct Data {
uint256 total;
uint256[] chainids;
uint256[] blocks;
}
|
0cce68e943681a99b580433f013b1189
|
{
"intermediate": 0.688838005065918,
"beginner": 0.14189603924751282,
"expert": 0.1692659705877304
}
|
32,759
|
$this->agents->push( User::all()); Expected type 'object'. Found 'array'.intelephense(P1006)
|
61b5590b4f199acdb991bf65dc398767
|
{
"intermediate": 0.34241780638694763,
"beginner": 0.30614393949508667,
"expert": 0.3514382541179657
}
|
32,760
|
solidity Invalid escape sequence how to fix
|
011343cd383ae28eea7e9d7fcff0bc0d
|
{
"intermediate": 0.5942474007606506,
"beginner": 0.12605731189250946,
"expert": 0.2796952724456787
}
|
32,761
|
how to access the target tilemap in this scene from the area script:
[gd_scene load_steps=14 format=3 uid="uid://cgk72c7csqgm5"]
[ext_resource type="Script" path="res://addons/wfc/nodes/generator_2d.gd" id="1_mvuye"]
[ext_resource type="Script" path="res://addons/wfc/problems/2d/rules_2d.gd" id="2_67cyc"]
[ext_resource type="Script" path="res://addons/wfc/solver/solver_settings.gd" id="3_q4iet"]
[ext_resource type="Script" path="res://addons/wfc/problems/2d/preconditions/precondition_2d_dungeon_settings.gd" id="4_3abj3"]
[ext_resource type="Script" path="res://addons/wfc/runners/runner_multithreaded_settings.gd" id="5_6cnxx"]
[ext_resource type="TileSet" uid="uid://dgefkshuslimj" path="res://addons/wfc/examples/assets/kenney-tiny-dungeon/tile-set.tres" id="6_q3ht3"]
[ext_resource type="PackedScene" uid="uid://dt2nffs32s7o1" path="res://addons/wfc/examples/helpers/progress_indicator.tscn" id="7_akug4"]
[ext_resource type="Script" path="res://Scenes/Characters/Player/areacheck.gd" id="8_dff18"]
[sub_resource type="GDScript" id="GDScript_sq3cg"]
script/source = "extends Node2D
func _ready():
$generator.start()
$sample.hide()
$negative_sample.hide()
$target.show()
"
[sub_resource type="Resource" id="Resource_50ak6"]
script = ExtResource("2_67cyc")
complete_matrices = true
axes = Array[Vector2i]([Vector2i(0, 1), Vector2i(1, 0)])
axis_matrices = Array[Resource("res://addons/wfc/utils/bitmatrix.gd")]([])
[sub_resource type="Resource" id="Resource_trx14"]
script = ExtResource("3_q4iet")
allow_backtracking = true
require_backtracking = false
backtracking_limit = -1
[sub_resource type="Resource" id="Resource_26rrk"]
script = ExtResource("4_3abj3")
wall_border_size = Vector2i(1, 2)
free_gap = Vector2i(2, 2)
room_half_size_base = Vector2i(2, 2)
room_half_size_variation = Vector2i(2, 2)
room_probability = 0.5
road_len_base = 15
road_len_variation = 10
fork_probability = 0.5
full_fork_probability = 0.5
passable_area_ratio = 0.1
iterations_limit = 1000
road_class = "wfc_dungeon_road"
wall_class = "wfc_dungeon_wall"
[node name="target" type="TileMap" parent="."]
visible = false
z_index = -1
tile_set = ExtResource("6_q3ht3")
format = 2
[node name="progressIndicator" parent="." node_paths=PackedStringArray("generator") instance=ExtResource("7_akug4")]
generator = NodePath("../generator")
[node name="areacheck" type="Node2D" parent="."]
script = ExtResource("8_dff18")
extends Node2D
var detection_radius = 100.0 # How far from the character to check
var grid_size = 10 # Define the grid size for your ‘square-cast’
var collision_mask = 1 # The collision mask we’re interested in
@onready var tilemap : TileMap = $root/target
|
c7f91b538106353b8aa1569a87b13ed2
|
{
"intermediate": 0.35212641954421997,
"beginner": 0.32029232382774353,
"expert": 0.3275812566280365
}
|
32,762
|
What's concept hierarchy ? How is a concept hierarchy useful in solving real world problems?
|
ac8876e1000916f401254a4bd69e06fc
|
{
"intermediate": 0.34136468172073364,
"beginner": 0.1621338427066803,
"expert": 0.49650144577026367
}
|
32,763
|
please give me a python program, which calculates the mean and standard deviation for columns in a csv file and plots a fillbetween
|
13d367fa225a563000b5b4dead00c88d
|
{
"intermediate": 0.3478645086288452,
"beginner": 0.13620686531066895,
"expert": 0.5159286856651306
}
|
32,764
|
Денис
−
− очень занятой человек. Поэтому он нанял Вас, чтобы оптимизировать свои жизненные процессы.
Самое важное для Дениса
−
− это саморазвитие, из-чего для каждого дня он составляет расписание в виде бинарного дерева, каждая вершина которого
−
− это польза от завершения некоторой работы в течение дня.
Чтобы получать максимальную пользу от каждой минуты своего драгоценного времени, Денис ищет в своем расписании оптимальный участок для работы. Таковым он называет поддерево, которое является BST с максимальной пользой.
Входные данные
�
l
−
− спуск в левого ребёнка
�
r
−
− спуска в правого ребёнка
�
u
−
− подъём наверх
В единственной строке подается
�
n значений.
Выходные данные
Вывести в единственной строке число
−
− максимальную пользу
STDIN STDOUT
1 l 4 l 2 u r 4 u u r 3 l 2 u r 5 l 4 u r 6 u u u u
20
4 l 3 l 1 u r 2 u u u
2
-4 l -2 u r -5 u u
0
Примечание
Первый пример необходимо скопировать, чтобы получить все данные.
придумай тесты на эту задачу(как можно больше частных случаев)
|
1fb9466cad5b6b09f43b3e1de1b272b5
|
{
"intermediate": 0.12131687998771667,
"beginner": 0.632162868976593,
"expert": 0.2465202659368515
}
|
32,765
|
#include <iostream>
struct Node {
int data;
Node* left;
Node* right;
Node(int value) : data(value), left(nullptr), right(nullptr) {}
};
struct BST {
Node* top = nullptr;
Node* insert(Node* root, int value) {
if (root == nullptr) {
return new Node(value);
}
if (value < root->data) {
root->left = insert(root->left, value);
} else if (value > root->data) {
root->right = insert(root->right, value);
}
return root;
}
Node* findMin(Node* root) {
while (root && root->left != nullptr) {
root = root->left;
}
return root;
}
Node* pop(Node* root, int value) {
if (root == nullptr) return nullptr;
if (value < root->data) {
root->left = pop(root->left, value);
} else if (value > root->data) {
root->right = pop(root->right, value);
} else {
if (root->left == nullptr) {
Node* temp = root->right;
delete root;
return temp;
} else if (root->right == nullptr) {
Node* temp = root->left;
delete root;
return temp;
}
Node* temp = findMin(root->right);
root->data = temp->data;
root->right = pop(root->right, temp->data);
}
return root;
}
void inorder(Node* root) {
if (root == nullptr) return;
inorder(root->left);
std::cout << root->data << " ";
inorder(root->right);
}
void clear(Node* root) {
if (root == nullptr) return;
clear(root->left);
clear(root->right);
delete root;
}
void merge(BST& other) {
merge(top, other.top);
other.top = nullptr;
}
void merge(Node*& root1, Node* root2) {
if (root2 == nullptr) return;
insert(root1, root2->data);
merge(root1, root2->left);
merge(root1, root2->right);
}
};
int main() {
int n;
std::cin >> n;
std::string cmd;
int acc;
int id;
BST arr[2];
for (int i = 0; i < n; ++i) {
std::cin >> cmd;
if (cmd == "merge") {
arr[0].merge(arr[1]);
arr[0].inorder(arr[0].top);
std::cout << '\n';
arr[1].clear(arr[1].top);
} else if (cmd == "buy") {
std::cin >> acc >> id;
arr[acc - 1].top = arr[acc - 1].insert(arr[acc - 1].top, id);
} else if (cmd == "sell") {
std::cin >> acc >> id;
arr[acc - 1].top = arr[acc - 1].pop(arr[acc - 1].top, id);
}
}
}
4
buy 2 1
buy 1 2
sell 1 2
merge
должно выводить 1 однако не выводит ничего исправь
|
af4ed87a581f1e707dedd218f9929139
|
{
"intermediate": 0.34474536776542664,
"beginner": 0.36678412556648254,
"expert": 0.28847047686576843
}
|
32,766
|
How to solve this error? AttributeError: 'NoneType' object has no attribute 'drop'
|
f841aa44eb97fe2777cf342ae0421bf5
|
{
"intermediate": 0.5226043462753296,
"beginner": 0.1086949035525322,
"expert": 0.3687008023262024
}
|
32,767
|
Data Cleaning, Data Integration, Data Reduction, Data Transformation, Data Mining, Pattern, Evaluation, Knowledge Representation 7 steps in data mining explain each with real wold examples
|
448e898fd1888332e20433f797c90d7a
|
{
"intermediate": 0.36877205967903137,
"beginner": 0.25994551181793213,
"expert": 0.3712824881076813
}
|
32,768
|
int lineAmount = 2;
int midY = height / 2; // Вычисляем середину по оси Y
for (int i = 0; i < lineAmount; i++) {
g2d.setColor(Color.BLACK);
// Определяем, на какой стороне середины канвы будет находиться первая точка линии
int x1 = (i % 2 == 0) ? 0 : width;
int y1 = midY + ((i % 2 == 0) ? random.nextInt(20) - 30 : random.nextInt(20));
// Определяем, на какой стороне середины канвы будет находиться вторая точка линии
int x2 = (i % 2 == 0) ? width : 0;
int y2 = midY + ((i % 2 == 0) ? random.nextInt(20) - 30 : random.nextInt(20));
// Определяем случайное смещение для координат каждой точки линии
int x1Offset = (int) (Math.random() * width / 2);
int y1Offset = (int) (Math.random() * height / 2);
int x2Offset = (int) (Math.random() * width / 2);
int y2Offset = (int) (Math.random() * height / 2);
// Применяем смещение к координатам
x1 += (i % 2 == 0) ? x1Offset : -x1Offset;
y1 += (i % 2 == 0) ? y1Offset : -y1Offset;
x2 += (i % 2 == 0) ? -x2Offset : x2Offset;
y2 += (i % 2 == 0) ? y2Offset : -y2Offset;
g2d.setStroke(new BasicStroke(2));
g2d.drawLine(x1, y1, x2, y2);
} сделай чтобы линии были примерно одинакого размера, а не так что одна длинная другая очень короткая
|
40fa63dc53367d8f1eb588fe0e4c0962
|
{
"intermediate": 0.3063373863697052,
"beginner": 0.4753822684288025,
"expert": 0.21828033030033112
}
|
32,769
|
#include <iostream>
using namespace std;
// Определение структуры элемента списка
struct Node {
string surname;
Node* next;
};
// Функция для добавления элемента в конец списка
void append(Node** head, string surname) {
// Создание нового элемента
Node* newNode = new Node;
newNode->surname = surname;
newNode->next = *head;
// Если список пустой, то новый элемент будет первым и последним элементом
if (*head == NULL) {
newNode->next = newNode;
*head = newNode;
}
else {
// Найти последний элемент списка
Node* last = *head;
while (last->next != *head)
last = last->next;
// Подключить новый элемент после последнего элемента
last->next = newNode;
// Сделать новый элемент последним элементом
newNode->next = *head;
}
}
// Функция для разбиения списка на два списка
void splitList(Node** head) {
// Проверка, что список не пустой
if (*head == NULL) {
cout << "Список пустой." << endl;
return;
}
// Создание двух новых списков
Node* list1 = NULL;
Node* list2 = NULL;
// Переменная для подсчета студентов
int count = 1;
Node* current = *head;
while (current->next != *head) {
if (count % 3 == 0) {
// Добавление каждого третьего студента во второй список
append(&list2, current->surname);
}
else {
// Добавление студентов, не являющихся каждыми третьими в первый список
append(&list1, current->surname);
}
current = current->next;
count++;
}
// Добавление последнего студента в первый список
append(&list1, current->surname);
// Вывод списков на экран
cout << "Первый список: ";
Node* temp = list1;
do {
cout << temp->surname << " ";
temp = temp->next;
} while (temp != list1);
cout << endl;
cout << "Второй список: ";
temp = list2;
do {
cout << temp->surname << " ";
temp = temp->next;
} while (temp != list2);
cout << endl;
// Освобождение памяти, занимаемой списками
Node* current1 = list1;
while (current1 != NULL) {
Node* temp = current1;
current1 = current1->next;
delete temp;
}
Node* current2 = list2;
while (current2 != NULL) {
Node* temp = current2;
current2 = current2->next;
delete temp;
}
}
int main() {
// Создание кольцевого списка
Node* head = NULL;
string surname;
cout << "Введите фамилии студентов (конец ввода - пустая строка):" << endl;
while (getline(cin, surname) && !surname.empty()) {
append(&head, surname);
}
// Разбиение списка на два списка
splitList(&head);
// Освобождение памяти, занимаемой исходным списком
Node* current = head;
while (current != NULL) {
Node* temp = current;
current = current->next;
delete temp;
}
return 0;
}
Ошибка после результата программы Segmentation fault (core dumped)
|
edbf35d03687d24dba31ad23b72521d3
|
{
"intermediate": 0.2852548658847809,
"beginner": 0.5223164558410645,
"expert": 0.19242870807647705
}
|
32,770
|
make it all balanced soo there wont be goovernments that like do so you get 2x more mooney
so the max will be like 1.5
aoc2
{
Government: [
{
Name: "DEMOCRACY",
Extra_Tag: "",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 0.9,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 0
},
{
Name: "DirectDemocracy",
Extra_Tag: "di",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.05,
MIN_GOODS: 0.08,
MIN_INVESTMENTS: 0.09,
RESEARCH_COST: 1.3,
INCOME_TAXATION: 0.5,
INCOME_PRODUCTION: 1.6,
MILITARY_UPKEEP: 1.9,
ADMINISTRATION_COST: 0.7,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 6,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 60
},
{
Name: "ParlamentaricRepulic",
Extra_Tag: "l",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.5,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 2.0,
MILITARY_UPKEEP: 1.4,
ADMINISTRATION_COST: 1.5,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 50
},
{
Name: "PresidentalRepublic",
Extra_Tag: "y",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 2.1,
INCOME_TAXATION: 1.5,
INCOME_PRODUCTION: 0.5,
MILITARY_UPKEEP: 1.5,
ADMINISTRATION_COST: 0.3,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 7,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 200
},
{
Name: "Monarchy",
Extra_Tag: "m",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.40,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 2.2,
INCOME_TAXATION: 0.4,
INCOME_PRODUCTION: 1.8,
MILITARY_UPKEEP: 1.1,
ADMINISTRATION_COST: 0.5,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 7,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 155
},
{
Name: "ConstuntionalMonarchy",
Extra_Tag: "mo",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.30,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.15,
RESEARCH_COST: 1.8,
INCOME_TAXATION: 1.4,
INCOME_PRODUCTION: 1.2,
MILITARY_UPKEEP: 0.9,
ADMINISTRATION_COST: 0.75,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 6,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 2,
G: 255,
B: 155
},
{
Name: "ElectiveMonarchy",
Extra_Tag: "mj",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.25,
MIN_GOODS: 0.15,
MIN_INVESTMENTS: 0.15,
RESEARCH_COST: 2.8,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 1.3,
MILITARY_UPKEEP: 1.4,
ADMINISTRATION_COST: 1.4,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 2,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 50,
G: 255,
B: 150
},
{
Name: "FederalRepublic",
Extra_Tag: "fr",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.15,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 1.2,
INCOME_TAXATION: 1.3,
INCOME_PRODUCTION: 1.5,
MILITARY_UPKEEP: 1.2,
ADMINISTRATION_COST: 1.2,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 4,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 16,
COST_OF_DISBAND: 15,
COST_OF_PLUNDER: 14,
DEFENSE_BONUS: 6,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 100,
B: 255
},
{
Name: "SocialDemocracy",
Extra_Tag: "sd",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.2,
MIN_GOODS: 0.15,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 1.5,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.6,
MILITARY_UPKEEP: 1.1,
ADMINISTRATION_COST: 1.3,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 17,
COST_OF_DISBAND: 16,
COST_OF_PLUNDER: 15,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 100,
B: 0
},
{
Name: "IslamicRepublic",
Extra_Tag: "ir",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.3,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 1.7,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.4,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 6,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 18,
COST_OF_DISBAND: 17,
COST_OF_PLUNDER: 16,
DEFENSE_BONUS: 7,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 200,
B: 0
},
{
Name: "NordicModel",
Extra_Tag: "nm",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.2,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.3,
RESEARCH_COST: 1.4,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 1.5,
MILITARY_UPKEEP: 1.1,
ADMINISTRATION_COST: 1.3,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 17,
COST_OF_DISBAND: 16,
COST_OF_PLUNDER: 15,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 0
},
{
Name: "AuthoritarianRegime",
Extra_Tag: "ar",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.25,
MIN_GOODS: 0.15,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.5,
INCOME_TAXATION: 1.4,
INCOME_PRODUCTION: 1.3,
MILITARY_UPKEEP: 1.4,
ADMINISTRATION_COST: 1.5,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 6,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 18,
COST_OF_DISBAND: 17,
COST_OF_PLUNDER: 16,
DEFENSE_BONUS: 8,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 150,
G: 0,
B: 255
},
{
Name: "CapitalistOligarchy",
Extra_Tag: "co",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.3,
MIN_INVESTMENTS: 0.3,
RESEARCH_COST: 1.6,
INCOME_TAXATION: 1.5,
INCOME_PRODUCTION: 1.7,
MILITARY_UPKEEP: 1.0,
ADMINISTRATION_COST: 1.2,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 4,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 16,
COST_OF_DISBAND: 15,
COST_OF_PLUNDER: 14,
DEFENSE_BONUS: 4,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 0,
B: 0
},
{
Name: "Technocracy",
Extra_Tag: "tc",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.15,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.4,
RESEARCH_COST: 1.3,
INCOME_TAXATION: 1.3,
INCOME_PRODUCTION: 1.6,
MILITARY_UPKEEP: 1.1,
ADMINISTRATION_COST: 1.1,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 17,
COST_OF_DISBAND: 16,
COST_OF_PLUNDER: 15,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 255
},
{
Name: "CommunistState",
Extra_Tag: "cs",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.3,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.3,
RESEARCH_COST: 1.8,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.5,
ADMINISTRATION_COST: 1.6,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 7,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 19,
COST_OF_DISBAND: 18,
COST_OF_PLUNDER: 17,
DEFENSE_BONUS: 9,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 0,
B: 255
},
{
Name: "AbsoluteMonarchy",
Extra_Tag: "o",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.2,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 4.0,
INCOME_TAXATION: 0.2,
INCOME_PRODUCTION: 2.1,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 0.3,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 9,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 25,
G: 255,
B: 155
},
{
Name: "Pacifism",
Extra_Tag: "pa",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.3,
RESEARCH_COST: 1.0,
INCOME_TAXATION: 1.0,
INCOME_PRODUCTION: 1.0,
MILITARY_UPKEEP: 0.2,
ADMINISTRATION_COST: 1.5,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 3,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 22,
COST_OF_DISBAND: 21,
COST_OF_PLUNDER: 20,
DEFENSE_BONUS: 2,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 0,
B: 255
},
{
Name: "Feudalism",
Extra_Tag: "fe",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.3,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 1.5,
INCOME_TAXATION: 1.4,
INCOME_PRODUCTION: 1.1,
MILITARY_UPKEEP: 1.5,
ADMINISTRATION_COST: 0.7,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 4,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 24,
COST_OF_DISBAND: 23,
COST_OF_PLUNDER: 22,
DEFENSE_BONUS: 7,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 100,
G: 0,
B: 255
},
{
Name: "Colonialism",
Extra_Tag: "co",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.4,
MIN_GOODS: 0.3,
MIN_INVESTMENTS: 0.4,
RESEARCH_COST: 1.3,
INCOME_TAXATION: 1.3,
INCOME_PRODUCTION: 1.3,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.1,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 26,
COST_OF_DISBAND: 25,
COST_OF_PLUNDER: 24,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 255
},
{
Name: "Environmentalism",
Extra_Tag: "en",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.2,
MIN_GOODS: 0.3,
MIN_INVESTMENTS: 0.5,
RESEARCH_COST: 0.8,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.2,
MILITARY_UPKEEP: 0.5,
ADMINISTRATION_COST: 1.3,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 14,
COST_OF_DISBAND: 13,
COST_OF_PLUNDER: 12,
DEFENSE_BONUS: 4,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 100
},
{
Name: "Libertarianism",
Extra_Tag: "li",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.2,
INCOME_TAXATION: 1.0,
INCOME_PRODUCTION: 1.3,
MILITARY_UPKEEP: 0.8,
ADMINISTRATION_COST: 0.8,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 6,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 16,
COST_OF_DISBAND: 15,
COST_OF_PLUNDER: 14,
DEFENSE_BONUS: 3,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 100,
G: 255,
B: 0
},
{
Name: "Meritocracy",
Extra_Tag: "me",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.15,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 1.4,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 1.7,
MILITARY_UPKEEP: 1.0,
ADMINISTRATION_COST: 1.0,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 4,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 18,
COST_OF_DISBAND: 17,
COST_OF_PLUNDER: 16,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 255,
B: 0
},
{
Name: "Autocracy",
Extra_Tag: "0",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.5,
MIN_GOODS: 0.05,
MIN_INVESTMENTS: 0.05,
RESEARCH_COST: 1.1,
INCOME_TAXATION: 1.2,
INCOME_PRODUCTION: 0.7,
MILITARY_UPKEEP: 0.9,
ADMINISTRATION_COST: 0.5,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 3,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 9,
COST_OF_DISBAND: 8,
COST_OF_PLUNDER: 7,
DEFENSE_BONUS: 9,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 255,
B: 255
},
{
Name: "Communism",
Extra_Tag: "c",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.7,
MIN_GOODS: 0.05,
MIN_INVESTMENTS: 0.05,
RESEARCH_COST: 0.9,
INCOME_TAXATION: 1.5,
INCOME_PRODUCTION: 0.8,
MILITARY_UPKEEP: 1.0,
ADMINISTRATION_COST: 1.0,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 19,
COST_OF_DISBAND: 18,
COST_OF_PLUNDER: 17,
DEFENSE_BONUS: 8,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 155,
B: 255
},
{
Name: "MixedRepublic",
Extra_Tag: "mi",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.25,
MIN_GOODS: 0.15,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.6,
INCOME_TAXATION: 1.5,
INCOME_PRODUCTION: 1.0,
MILITARY_UPKEEP: 1.4,
ADMINISTRATION_COST: 0.45,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 8,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 50,
G: 255,
B: 155
},
{
Name: "Anarchy",
Extra_Tag: "1",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 10.0,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 0,
G: 0,
B: 255
},
{
Name: "Centrism",
Extra_Tag: "2",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 2.6,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 100,
G: 0,
B: 255
},
{
Name: "Fascism",
Extra_Tag: "f",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.9,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 0.8,
INCOME_TAXATION: 2.5,
INCOME_PRODUCTION: 0.6,
MILITARY_UPKEEP: 0.7,
ADMINISTRATION_COST: 1.2,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 3,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 6,
COST_OF_DISBAND: 5,
COST_OF_PLUNDER: 4,
DEFENSE_BONUS: 12,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 155,
G: 0,
B: 255
},
{
Name: "Dictatorshipoftheproletariat",
Extra_Tag: "fO",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.23,
MIN_GOODS: 0.2,
MIN_INVESTMENTS: 0.2,
RESEARCH_COST: 0.75,
INCOME_TAXATION: 0.9,
INCOME_PRODUCTION: 1.8,
MILITARY_UPKEEP: 0.9,
ADMINISTRATION_COST: 2.1,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 3,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 6,
COST_OF_DISBAND: 5,
COST_OF_PLUNDER: 4,
DEFENSE_BONUS: 18,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 170,
G: 0,
B: 255
},
{
Name: "Laicism",
Extra_Tag: "4",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.55,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 0,
B: 155
},
{
Name: "Liberalism",
Extra_Tag: "5",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.1,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 0,
B: 0
},
{
Name: "Nationalism",
Extra_Tag: "6",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 0.7,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.8,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 55,
B: 0
},
{
Name: "Oligarchy",
Extra_Tag: "7",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 1.9,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 155,
B: 0
},
{
Name: "Theocratism",
Extra_Tag: "8",
GOV_GROUP_ID: 0,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 2.6,
INCOME_TAXATION: 1.1,
INCOME_PRODUCTION: 1.4,
MILITARY_UPKEEP: 1.3,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 15,
COST_OF_DISBAND: 14,
COST_OF_PLUNDER: 13,
DEFENSE_BONUS: 5,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 255,
B: 0
},
{
Name: "Tribal",
Extra_Tag: "t",
GOV_GROUP_ID: 3,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 100.0,
INCOME_TAXATION: 0.5,
INCOME_PRODUCTION: 0.5,
MILITARY_UPKEEP: 0.5,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 5,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 5,
COST_OF_DISBAND: 5,
COST_OF_PLUNDER: 5,
DEFENSE_BONUS: 15,
CAN_BECOME_CIVILIZED: 1,
CIVILIZE_TECH_LEVEL: 0.35f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: false,
AI_TYPE: "DEFAULT",
R: 255,
G: 255,
B: 255
},
{
Name: "Rebels",
Extra_Tag: "u",
GOV_GROUP_ID: 4,
ACCEPTABLE_TAXATION: 0.1,
MIN_GOODS: 0.1,
MIN_INVESTMENTS: 0.1,
RESEARCH_COST: 25.0,
INCOME_TAXATION: 0.1,
INCOME_PRODUCTION: 0.1,
MILITARY_UPKEEP: 0.1,
ADMINISTRATION_COST: 1.00,
ADMINISTRATION_COST_DISTANCE: 1.00,
ADMINISTRATION_COST_CAPITAL: 0.5,
COST_OF_MOVE: 1,
COST_OF_MOVE_TO_THE_SAME_PROV: 2,
COST_OF_MOVE_OWN_PROV: 1,
COST_OF_RECRUIT: 1,
COST_OF_DISBAND: 1,
COST_OF_PLUNDER: 1,
DEFENSE_BONUS: 30,
CAN_BECOME_CIVILIZED: -1,
CIVILIZE_TECH_LEVEL: 2.0f,
AVAILABLE_SINCE_AGE_ID: 0,
REVOLUTIONARY: true,
AI_TYPE: "REBELS",
R: 55,
G: 55,
B: 55
},
],
Age_of_Civilizations: Governments
}
|
7b9d67cab858c4b2920a13c751ba1bf5
|
{
"intermediate": 0.256553590297699,
"beginner": 0.38447150588035583,
"expert": 0.3589749336242676
}
|
32,771
|
package gtanks.captcha;
import javax.imageio.ImageIO;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Random;
public class CaptchaGenerator {
static Random random = new Random();
public static Captcha generateCaptcha() throws IOException {
int width = 281;
int height = 50;
Color color = Color.decode("#665b67");
String captchaText = getRandomCaptchaText(6);
BufferedImage image = new BufferedImage(width, height, 2);
try {
image.createGraphics();
Graphics2D g2d = image.createGraphics();
g2d.setPaint(color);
g2d.fillRect(0, 0, width, height);
double minIntensity = 0.2;
double maxIntensity = 0.5;
double noiseDensity = minIntensity + Math.random() * (maxIntensity - minIntensity);
int noiseAmount = (int) (width * height * noiseDensity);
for (int i = 0; i < noiseAmount; i++) {
g2d.setColor(getRandomColor());
int xPosNoise = (int) (Math.random() * width);
int yPosNoise = (int) (Math.random() * height);
g2d.fillRect(xPosNoise, yPosNoise, 1, 1);
}
g2d.setPaint(Color.BLACK);
g2d.setFont(new Font("Times New Roman", 1, 40));
g2d.drawString(captchaText, 70, 35);
int lineAmount = 2;
int midY = height / 2; // Вычисляем середину по оси Y
for (int i = 0; i < lineAmount; i++) {
g2d.setColor(Color.BLACK);
// Определяем, на какой стороне середины канвы будет находиться первая точка линии
int x1 = (i % 2 == 0) ? 0 : width;
int y1 = midY + ((i % 2 == 0) ? random.nextInt(20) - 30 : random.nextInt(20));
// Определяем, на какой стороне середины канвы будет находиться вторая точка линии
int x2 = (i % 2 == 0) ? width : 0;
int y2 = midY + ((i % 2 == 0) ? random.nextInt(20) - 30 : random.nextInt(20));
// Определяем случайное смещение для координат каждой точки линии
int minOffset = 20;
int x1Offset = (int) (minOffset + Math.random() * (width / 3 - minOffset));
int y1Offset = (int) (minOffset + Math.random() * (height / 3 - minOffset));
int x2Offset = (int) (minOffset + Math.random() * (width / 3 - minOffset));
int y2Offset = (int) (minOffset + Math.random() * (height / 3 - minOffset));
// Применяем смещение к координатам
x1 += (i % 2 == 0) ? x1Offset : -x1Offset;
y1 += (i % 2 == 0) ? y1Offset : -y1Offset;
x2 += (i % 2 == 0) ? -x2Offset : x2Offset;
y2 += (i % 2 == 0) ? y2Offset : -y2Offset;
g2d.setStroke(new BasicStroke(2));
g2d.drawLine(x1, y1, x2, y2);
}
g2d.dispose();
} catch (Exception var4) {
System.out.println(var4.getMessage());
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
byte[] captchaImageBuffer = baos.toByteArray();
return new Captcha(captchaImageBuffer, captchaText);
}
private static String getRandomCaptchaText(int length) {
String base = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
private static Color getRandomColor() {
String letters = "0123456789ABCDEF";
StringBuilder color = new StringBuilder("#");
for (int i = 0; i < 6; i++) {
color.append(letters.charAt((int) (Math.random() * 16)));
}
return Color.decode(color.toString());
}
public static class Captcha {
private byte[] image;
private String text;
public Captcha(byte[] image, String text) {
this.image = image;
this.text = text;
}
public byte[] getImage() {
return image;
}
public String getText() {
return text;
}
}
}
сделай чтобы линии не ложились на одно и тоже место в избижания наложения линии на линию, и желательно без новых метедов
|
764e5a7425ec70d73e1e81dbfdc48adc
|
{
"intermediate": 0.2324308604001999,
"beginner": 0.6577368974685669,
"expert": 0.10983221232891083
}
|
32,772
|
#include <iostream>
struct Node {
int data;
Node* left;
Node* right;
Node(int value) : data(value), left(nullptr), right(nullptr) {}
};
struct BST {
Node* top = nullptr;
Node* insert(Node* root, int value) {
if (root == nullptr) {
return new Node(value);
}
if (value < root->data) {
root->left = insert(root->left, value);
} else if (value > root->data) {
root->right = insert(root->right, value);
}
return root;
}
Node* findMin(Node* root) {
while (root && root->left != nullptr) {
root = root->left;
}
return root;
}
Node* pop(Node* root, int value) {
if (root == nullptr) return nullptr;
if (value < root->data) {
root->left = pop(root->left, value);
} else if (value > root->data) {
root->right = pop(root->right, value);
} else {
if (root->left == nullptr) {
Node* temp = root->right;
delete root;
return temp;
} else if (root->right == nullptr) {
Node* temp = root->left;
delete root;
return temp;
}
Node* temp = findMin(root->right);
root->data = temp->data;
root->right = pop(root->right, temp->data);
}
return root;
}
void inorder(Node* root) {
if (root == nullptr) return;
inorder(root->left);
std::cout << root->data << " ";
inorder(root->right);
}
void clear(Node* root) {
if (root == nullptr) return;
clear(root->left);
clear(root->right);
delete root;
}
void merge(BST& other) {
merge(top, other.top);
clear(other.top);
other.top = nullptr;
}
void merge(Node*& root1, Node* root2) {
if (root2 == nullptr) return;
merge(root1, root2->left);
root1 = insert(root1, root2->data);
merge(root1, root2->right);
}
};
int main() {
int n;
std::cin >> n;
std::string cmd;
int acc;
int id;
BST arr[2];
for (int i = 0; i < n; ++i) {
std::cin >> cmd;
if (cmd == "merge") {
arr[0].merge(arr[1]);
arr[0].inorder(arr[0].top);
std::cout << '\n';
} else if (cmd == "buy") {
std::cin >> acc >> id;
arr[acc - 1].top = arr[acc - 1].insert(arr[acc - 1].top, id);
} else if (cmd == "sell") {
std::cin >> acc >> id;
arr[acc - 1].top = arr[acc - 1].pop(arr[acc - 1].top, id);
}
}
}
Недавно вошедшие в список форбс 24 до 24-ех Леонид и Семен решили открыть новый бизнес. Для этого они нашли знаменитую предпринимательницу Лизу, которая стала спонсором их стартапа. Для успешного трейдинга ребята создали один основной аккаунт и один дополнительный.
Для хорошей отчестности перед инвестором все рискованные сделки они проводят со второго аккаунта. Как только второй аккаунт выходит в положительный баланс, то ребята сливают все акции на основной аккаунт, а второй портфель очищается.
Вы
−
− первый разработчик в их стартапе, перед Вами стоит сложная задача реализации придуманной Семой и Лёвой системы.
С аккаунтами могут происходить следующие операции:
buy
�
�
�
�
�
�
�
account
�
�
id
−
− купить акции с номером
�
�
id в портфель
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
sell
�
�
�
�
�
�
�
account
�
�
id
−
− продать акции с номером
�
�
id в портфели
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
merge
−
− сливать все акции в основной портфель
После каждого объединения товарищи проводят показ результатов Лизе, поэтому при этой операции требуется выводить
�
�
id акций в отсортированном виде.
Входные данные
В первой строке подается
�
n
−
− число операций
1
≤
�
≤
1
0
7
1≤n≤10
7
В следующих n строках подаются команды одного из 3 видов (buy, sell, merge) Гарантируется, что номер акции:
0
≤
�
�
≤
1
0
9
0≤id≤10
9
Выходные данные
При каждой операции merge вывести
�
�
id акции в отсортированном виде
почему то не проходит самый первый тест испарвь
|
9c64ec09aa23eabcf97c9414acc9f7b9
|
{
"intermediate": 0.3335544466972351,
"beginner": 0.39222845435142517,
"expert": 0.2742171287536621
}
|
32,773
|
Может ты скажешь ей, что ты не Леонтий?
Недавно вошедшие в список форбс 24 до 24-ех Леонид и Семен решили открыть новый бизнес. Для этого они нашли знаменитую предпринимательницу Лизу, которая стала спонсором их стартапа. Для успешного трейдинга ребята создали один основной аккаунт и один дополнительный.
Для хорошей отчестности перед инвестором все рискованные сделки они проводят со второго аккаунта. Как только второй аккаунт выходит в положительный баланс, то ребята сливают все акции на основной аккаунт, а второй портфель очищается.
Вы
−
− первый разработчик в их стартапе, перед Вами стоит сложная задача реализации придуманной Семой и Лёвой системы.
С аккаунтами могут происходить следующие операции:
buy
�
�
�
�
�
�
�
account
�
�
id
−
− купить акции с номером
�
�
id в портфель
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
sell
�
�
�
�
�
�
�
account
�
�
id
−
− продать акции с номером
�
�
id в портфели
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
merge
−
− сливать все акции в основной портфель
После каждого объединения товарищи проводят показ результатов Лизе, поэтому при этой операции требуется выводить
�
�
id акций в отсортированном виде.
Входные данные
В первой строке подается
�
n
−
− число операций
1
≤
�
≤
1
0
7
1≤n≤10
7
В следующих n строках подаются команды одного из 3 видов (buy, sell, merge) Гарантируется, что номер акции:
0
≤
�
�
≤
1
0
9
0≤id≤10
9
Выходные данные
При каждой операции merge вывести
�
�
id акции в отсортированном виде
STDIN STDOUT
1
buy 1 1
2
buy 1 2
merge
2
#include <iostream>
#include <vector>
struct Node {
int data;
Node* left;
Node* right;
Node(int value) : data(value), left(nullptr), right(nullptr) {}
};
struct BST {
Node* top = nullptr;
Node* insert(Node* root, int value) {
if (root == nullptr) {
return new Node(value);
}
if (value < root->data) {
root->left = insert(root->left, value);
} else if (value > root->data) {
root->right = insert(root->right, value);
}
return root;
}
Node* findMin(Node* root) {
while (root && root->left != nullptr) {
root = root->left;
}
return root;
}
Node* pop(Node* root, int value) {
if (root == nullptr) return nullptr;
if (value < root->data) {
root->left = pop(root->left, value);
} else if (value > root->data) {
root->right = pop(root->right, value);
} else {
if (root->left == nullptr) {
Node* temp = root->right;
delete root;
return temp;
} else if (root->right == nullptr) {
Node* temp = root->left;
delete root;
return temp;
}
Node* temp = findMin(root->right);
root->data = temp->data;
root->right = pop(root->right, temp->data);
}
return root;
}
void inorder(Node* root) {
if (root == nullptr) return;
inorder(root->left);
std::cout << root->data << " ";
inorder(root->right);
}
void clear(Node* root) {
if (root == nullptr) return;
clear(root->left);
clear(root->right);
root->left = nullptr;
root->right = nullptr;
delete root;
}
void collect_vals(Node* root, std::vector<int>& elements) {
if (!root) return;
collect_vals(root->left, elements);
elements.push_back(root->data);
collect_vals(root->right, elements);
}
void merge(BST& other) {
std::vector<int> elements;
collect_vals(other.top, elements);
for (int value : elements) {
top = insert(top, value);
}
other.clear(other.top);
other.top = nullptr;
}
};
int main() {
int n;
std::cin >> n;
std::string cmd;
int acc;
int id;
BST arr[2];
for (int i = 0; i < n; ++i) {
std::cin >> cmd;
if (cmd == "merge") {
arr[0].merge(arr[1]);
if (arr[0].top != nullptr) {
arr[0].inorder(arr[0].top);
std::cout << '\n';
}
} else {
std::cin >> acc >> id;
if (cmd == "buy") {
arr[acc - 1].top = arr[acc - 1].insert(arr[acc - 1].top, id);
} else if (cmd == "sell") {
arr[acc - 1].top = arr[acc - 1].pop(arr[acc - 1].top, id);
}
}
}
return 0;
}
ну вот в чем мой код неверный? почему не проходит 1 тест?
|
250e39b73421913e247aae4e63249ed1
|
{
"intermediate": 0.19810988008975983,
"beginner": 0.6142464280128479,
"expert": 0.18764372169971466
}
|
32,774
|
hi
|
1ad657cc1ba5e8df2329dade2144e572
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
32,775
|
Может ты скажешь ей, что ты не Леонтий?
Недавно вошедшие в список форбс 24 до 24-ех Леонид и Семен решили открыть новый бизнес. Для этого они нашли знаменитую предпринимательницу Лизу, которая стала спонсором их стартапа. Для успешного трейдинга ребята создали один основной аккаунт и один дополнительный.
Для хорошей отчестности перед инвестором все рискованные сделки они проводят со второго аккаунта. Как только второй аккаунт выходит в положительный баланс, то ребята сливают все акции на основной аккаунт, а второй портфель очищается.
Вы
−
− первый разработчик в их стартапе, перед Вами стоит сложная задача реализации придуманной Семой и Лёвой системы.
С аккаунтами могут происходить следующие операции:
buy
�
�
�
�
�
�
�
account
�
�
id
−
− купить акции с номером
�
�
id в портфель
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
sell
�
�
�
�
�
�
�
account
�
�
id
−
− продать акции с номером
�
�
id в портфели
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
merge
−
− сливать все акции в основной портфель
После каждого объединения товарищи проводят показ результатов Лизе, поэтому при этой операции требуется выводить
�
�
id акций в отсортированном виде.
Входные данные
В первой строке подается
�
n
−
− число операций
1
≤
�
≤
1
0
7
1≤n≤10
7
В следующих n строках подаются команды одного из 3 видов (buy, sell, merge) Гарантируется, что номер акции:
0
≤
�
�
≤
1
0
9
0≤id≤10
9
Выходные данные
При каждой операции merge вывести
�
�
id акции в отсортированном виде
STDIN STDOUT
1
buy 1 1
2
buy 1 2
merge
2
#include <iostream>
#include <vector>
struct Node {
int data;
Node* left;
Node* right;
Node(int value) : data(value), left(nullptr), right(nullptr) {}
};
struct BST {
Node* top = nullptr;
Node* insert(Node* root, int value) {
if (root == nullptr) {
return new Node(value);
}
if (value < root->data) {
root->left = insert(root->left, value);
} else if (value > root->data) {
root->right = insert(root->right, value);
}
return root;
}
Node* findMin(Node* root) {
while (root && root->left != nullptr) {
root = root->left;
}
return root;
}
Node* pop(Node* root, int value) {
if (root == nullptr) return nullptr;
if (value < root->data) {
root->left = pop(root->left, value);
} else if (value > root->data) {
root->right = pop(root->right, value);
} else {
if (root->left == nullptr) {
Node* temp = root->right;
delete root;
return temp;
} else if (root->right == nullptr) {
Node* temp = root->left;
delete root;
return temp;
}
Node* temp = findMin(root->right);
root->data = temp->data;
root->right = pop(root->right, temp->data);
}
return root;
}
void inorder(Node* root) {
if (root == nullptr) return;
inorder(root->left);
std::cout << root->data << " ";
inorder(root->right);
}
void clear(Node* root) {
if (root == nullptr) return;
clear(root->left);
clear(root->right);
root->left = nullptr;
root->right = nullptr;
delete root;
}
void collect_vals(Node* root, std::vector<int>& elements) {
if (!root) return;
collect_vals(root->left, elements);
elements.push_back(root->data);
collect_vals(root->right, elements);
}
void merge(BST& other) {
std::vector<int> elements;
collect_vals(other.top, elements);
for (int value : elements) {
top = insert(top, value);
}
other.clear(other.top);
other.top = nullptr;
}
};
int main() {
int n;
std::cin >> n;
std::string cmd;
int acc;
int id;
BST arr[2];
for (int i = 0; i < n; ++i) {
std::cin >> cmd;
if (cmd == "merge") {
arr[0].merge(arr[1]);
if (arr[0].top != nullptr) {
arr[0].inorder(arr[0].top);
std::cout << '\n';
}
} else {
std::cin >> acc >> id;
if (cmd == "buy") {
arr[acc - 1].top = arr[acc - 1].insert(arr[acc - 1].top, id);
} else if (cmd == "sell") {
arr[acc - 1].top = arr[acc - 1].pop(arr[acc - 1].top, id);
}
}
}
return 0;
}
вот в чем мой код неверный? почему не проходит первый тест? все функции верны, может в выводе проблема?
|
e6bdd4b922f5ac86ee388784388da970
|
{
"intermediate": 0.19810988008975983,
"beginner": 0.6142464280128479,
"expert": 0.18764372169971466
}
|
32,776
|
ef compute_statistics(data):
"""
Compute basic statistics: Mean, Median, and Mode for the given data.
Parameters:
- data: A pandas DataFrame containing the dataset.
Returns:
- Each value should be rounded to 3 decimal places
- mean: A dictionary with the mean of each feature.
- median: A dictionary with the median of each feature.
- mode: A dictionary with the mode of each feature.
"""
import numpy as np
from scipy import stats
# TODO: Replace the 'None' with your code to calculate the mean
mean = print(f'The mean is {data.mean()}')
# TODO: Replace the 'None' with your code to calculate the median
median = print(f'The median is {np.median(data)}')
# TODO: Replace the 'None' with your code to calculate the mode
mode = print(f'The mode is {stats.mode(data)[0]}')
# Round each one to 3 decimal places
statistics = {
'mean': mean,
'median': median,
'mode': mode,
}
return statistics
compute_statistics(dataset)
|
58684472c550e11e9751b04f56ac2c26
|
{
"intermediate": 0.4689394533634186,
"beginner": 0.28527018427848816,
"expert": 0.2457902580499649
}
|
32,777
|
Virtual function
|
f9c754e37d3246b1e36e5523ca25a54e
|
{
"intermediate": 0.2540137469768524,
"beginner": 0.2551158368587494,
"expert": 0.4908704161643982
}
|
32,778
|
For an array of pixels in C, each pixel is 3 uint8_ts (representing color), what would a putpixel implementation be?
|
ac413d19b5800a8f0957d471fae02aa6
|
{
"intermediate": 0.4258834719657898,
"beginner": 0.17542076110839844,
"expert": 0.39869579672813416
}
|
32,779
|
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def generate_dataset():
pass
def plot_3d_scatter(data):
"""
Plot a 3D scatter plot of the dataset to visualize the three features.
Parameters:
- data: A pandas DataFrame containing the dataset.
Returns:
- A 3D scatter plot visualizing the dataset's features and target variable.
"""
# Your code here
fig = plt.figure(figsize = (8,6))
ax = fig.add_subplot(111, projection = '3d')
ax.scatter(data["Feature1"], data["Feature2"], data["Feature3"], c = data["Target"], cmap = "viridis")
ax.set_x = ["Feature_1"]
ax.set_y = ["Feature_2"]
ax.set_z = ["Feature_3"]
ax.set_title("The 3d plot")
plt.show()
dataset = generate_dataset()
plot_3d_scatter(dataset)
|
d7c4946776cdc6bf812e00893bad9af8
|
{
"intermediate": 0.5060572624206543,
"beginner": 0.2198130190372467,
"expert": 0.2741297483444214
}
|
32,780
|
Cannot resolve method 'getApplication' in 'PagerAdapter'
как это исправить?
|
f73ac47792fc2d7ea72195445e9f8944
|
{
"intermediate": 0.4609166085720062,
"beginner": 0.33012840151786804,
"expert": 0.20895497500896454
}
|
32,781
|
Imagine a programming language with these rule: The only character with meaning, by default, is -> to define relations. Relations take some text and return some text, there's no name binding or "arguments". Relations can be applied by typing the first argument. If a relation returns another relation, it can be applied with spaces. // is for comments. Example of the language:
|
d8fcd3269e9a07b16dfa1281999cb054
|
{
"intermediate": 0.3754463195800781,
"beginner": 0.1653916984796524,
"expert": 0.4591619372367859
}
|
32,782
|
Imagine a programming language with these rule: The only character with meaning, by default, is -> to define relations. Relations take some text and return some text, there’s no name binding or “arguments”. Relations can be applied by typing the first argument. If a relation returns another relation, it can be applied with spaces. // is for comments. Example of the language:
|
8c9846c15c525fb803ca4d34e344a414
|
{
"intermediate": 0.3707491457462311,
"beginner": 0.18334755301475525,
"expert": 0.44590330123901367
}
|
32,783
|
import time
from streamlit.delta_generator import DeltaGenerator
import streamlit as st
import os,sys
import importlib.util
import inspect
#from here https://github.com/harahu/st-clean-slate-rendering/blob/main/__main__.py
def get_clean_rendering_container() -> DeltaGenerator:
"""Makes sure we can render from a clean slate on state changes."""
slot_in_use = st.session_state.get("slot_in_use", "initial")
# Use slot 'a' initially, then cycle through 'b' and 'c'.
if slot_in_use == "initial":
slot_in_use = st.session_state.slot_in_use = "a"
elif slot_in_use == "a":
slot_in_use = st.session_state.slot_in_use = "b"
elif slot_in_use == "b":
slot_in_use = st.session_state.slot_in_use = "c"
else: # if slot_in_use == "c":
slot_in_use = st.session_state.slot_in_use = "b"
slot = {
"a": st.empty(),
"b": st.empty(),
"c": st.empty(),
}[slot_in_use]
return slot.container()
from comparesite_models import models_funcs
def list_models():
function_dict = {}
for name, obj in inspect.getmembers(models_funcs):
if inspect.isfunction(obj):
function_dict[name] = obj
return function_dict
@st.cache_data(show_spinner=True,ttl=15)
def get_model_response(model_choice, message):
return models[model_choice](message)
st.set_page_config(
page_title="NeurocoderTestEnv",
page_icon="🧊",
layout="wide",
)
st.subheader("📊 Neurocoder Model compare")
#st.caption("🚀 A streamlit chatbot powered by OpenAI LLM")
if "messages0" not in st.session_state:
st.session_state["messages0"] = [{"role": "assistant", "content": "How can I help you?"}]
if "messages1" not in st.session_state:
st.session_state["messages1"] = [{"role": "assistant", "content": "How can I help you?"}]
if "messages2" not in st.session_state:
st.session_state["messages2"] = [{"role": "assistant", "content": "How can I help you?"}]
if "lastquery" not in st.session_state:
st.session_state["lastquery"] = None
models = list_models()
columns = st.columns(3)
model_choice = [None,None,None]
empties = []
with st.container():
with columns[0]:
# Create a Streamlit selectbox with the model names
model_choice[0] = st.selectbox(
'Choose a model 0:',
models
)
st.write(f"You selected: {model_choice[0]}")
with columns[1]:
# Create a Streamlit selectbox with the model names
model_choice[1] = st.selectbox(
'Choose a model 1:',
models,
index=1
)
st.write(f"You selected: {model_choice[1]}")
with columns[2]:
# Create a Streamlit selectbox with the model names
model_choice[2] = st.selectbox(
'Choose a model 2:',
models,
index=2
)
st.write(f"You selected: {model_choice[2]}")
dg = get_clean_rendering_container()
for i in range(0,len(st.session_state.messages0)):
#print("i",i)
msg = st.session_state.messages0[i]
msg1 = st.session_state.messages1[i]
msg2 = st.session_state.messages2[i]
if msg["role"] == "user":
dg.chat_message(msg["role"]).write(msg["content"])
elif msg["role"] == "assistant":
columnsa = dg.container().columns(spec=(1, 1, 1))
columnsa[0].chat_message(msg["role"]).write(msg["content"])
columnsa[1].chat_message(msg1["role"]).write(msg1["content"])
columnsa[2].chat_message(msg2["role"]).write(msg2["content"])
if prompt := st.chat_input():
st.session_state.messages0.append({"role": "user", "content": prompt})
st.session_state.messages1.append({"role": "user", "content": prompt})
st.session_state.messages2.append({"role": "user", "content": prompt})
st.chat_message("user").write(prompt)
st.session_state.lastquery = prompt
response0 = get_model_response(model_choice[0], prompt)
saveresponse0 = {"role": "assistant", "content": response0}
st.session_state.messages0.append(saveresponse0)
columnsf = st.columns(3)
with columnsf[0]:
st.chat_message(saveresponse0["role"]).write(saveresponse0["content"])
response1 = get_model_response(model_choice[1], prompt)
saveresponse1 = {"role": "assistant", "content": response1}
st.session_state.messages1.append(saveresponse1)
with columnsf[1]:
st.chat_message(saveresponse0["role"]).write(saveresponse1["content"])
response2 = get_model_response(model_choice[2], prompt)
saveresponse2 = {"role": "assistant", "content": response2}
st.session_state.messages2.append(saveresponse2)
with columnsf[2]:
st.chat_message(saveresponse0["role"]).write(saveresponse2["content"])
|
2cdd534ca677f345258592ba9fed2e4f
|
{
"intermediate": 0.3335764706134796,
"beginner": 0.468639999628067,
"expert": 0.19778352975845337
}
|
32,784
|
my python code has error: AttributeError: 'DataFrame' object has no attribute 'append', how to change append?
|
91cea99ad0b90d231f2f2b057921153e
|
{
"intermediate": 0.7034324407577515,
"beginner": 0.11426914483308792,
"expert": 0.1822984218597412
}
|
32,785
|
Hadoop MapReduce
Consider the following tables stored in CSV files: airport.csv, airline.csv, and flight.csv
Airport(code, city, state)
Airline(name, stock)
Flight(number, origin, dest, airline, price)
Example data:
Airport.csv
LAX,Los Angeles, CA
SFO, San Francisco, CA
JFK, New York City,NY
SJO, San Jose, CA
o PDX,Portland, OR
Airline.csv
United,50
Delta,30
American Airline, 15
Flight.csv
UA123,LAX,SFO,United,300
A4482,LAX.SFO American Airline, 1000
DL23,LAX PDX Delta Airline 400
UA124, LAX SFO,United 500
Consider answering the following SQL query using Hadoop MapReduce
Select airline, max(price)
From Flight
Where origin = "LAX" and dest = "SFO*
Group by airline
Having count(*) >= 2
|
553074bd7c23efd51783ead88aa5cf9e
|
{
"intermediate": 0.45785143971443176,
"beginner": 0.2207629531621933,
"expert": 0.32138562202453613
}
|
32,786
|
private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get("items");
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get("name_ru"), (String)item.get("name_en"));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get("description_ru"), (String)item.get("description_en"));
String id = (String)item.get("id");
int priceM0 = Integer.parseInt((String)item.get("price_m0"));
int priceM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m1")) : priceM0;
int priceM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m2")) : priceM0;
int priceM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m3")) : priceM0;
int rangM0 = Integer.parseInt((String)item.get("rang_m0"));
int rangM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m1")) : rangM0;
int rangM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m2")) : rangM0;
int rangM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m3")) : rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
int countModification = typeItem == ItemType.COLOR ? 1 : (typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? 4 : (int)(long)item.get("count_modifications"));
for(int m = 0; m < countModification; ++m) {
JSONArray propertys = (JSONArray)item.get("propertys_m" + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
property[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
switch(m) {
case 0:
propertysItemM0 = property;
break;
case 1:
propertysItemM1 = property;
break;
case 2:
propertysItemM2 = property;
break;
case 3:
propertysItemM3 = property;
}
}
if (typeItem == ItemType.COLOR || typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN) {
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + "_m0", priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + "_m1", priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + "_m2", priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + "_m3", priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get("special_item") == null ? false : (Boolean)item.get("special_item");
boolean multicounted = item.get("multicounted") == null ? false : (Boolean)item.get("multicounted");
boolean addable = item.get("addable_item") == null ? false : (Boolean)item.get("addable_item");
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + "_m0", new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace("%", "")));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
} как добавить возможность добавлять предметы только с м0 модификацией
|
e6412186f4b4334199e0360fbb1e6c50
|
{
"intermediate": 0.31658193469047546,
"beginner": 0.4587089717388153,
"expert": 0.22470910847187042
}
|
32,787
|
Using the below program which is reading a data file(student.txt file) from the disk into
array of structure which has 10 elements .
Assume that data is sorted based on student number.
Complete the below program for binary search operation.
Read a student from the monitor and find and list his name , grade
and the position in the array of structure .
#include <stdio.h>
struct studinfo
{
int stnr;
char name[10];
int grade;
};
void main()
{
struct studinfo s[10];
int cnt;
FILE *stud_file;
cnt=0 ;
stud_file = fopen("C:\\cmpe231\\2009Spring\\student.txt" , "r");
while ( !feof(stud_file))
{
fscanf(stud_file ,"%d %s %d" ,&s[cnt].stnr,&s[cnt].name,&s[cnt].grade);
cnt++;
}
fclose(stud_file);
}
Assume that file has the following data in it(Prepare 10 record of data sorted by student
number)
123 Ahmet 88
456 Cemal 99
633 Sevgi 75
776 Meral 66
792 Kemal 88
..
..
8879 Meral 81
|
7c6f83f4c05ba4895518cfc552920b29
|
{
"intermediate": 0.44586488604545593,
"beginner": 0.23810864984989166,
"expert": 0.3160264790058136
}
|
32,788
|
private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get("items");
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get("name_ru"), (String)item.get("name_en"));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get("description_ru"), (String)item.get("description_en"));
String id = (String)item.get("id");
int priceM0 = Integer.parseInt((String)item.get("price_m0"));
int priceM1 = priceM0;
int priceM2 = priceM0;
int priceM3 = priceM0;
int rangM0 = Integer.parseInt((String)item.get("rang_m0"));
int rangM1 = rangM0;
int rangM2 = rangM0;
int rangM3 = rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
if (typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN) {
JSONArray propertys = (JSONArray)item.get("propertys_m0");
propertysItemM0 = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
propertysItemM0[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
for(int m = 1; m <= 3; ++m) {
propertys = (JSONArray)item.get("propertys_m" + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
property[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
switch(m) {
case 1:
propertysItemM1 = property;
priceM1 = Integer.parseInt((String)item.get("price_m1"));
rangM1 = Integer.parseInt((String)item.get("rang_m1"));
break;
case 2:
propertysItemM2 = property;
priceM2 = Integer.parseInt((String)item.get("price_m2"));
rangM2 = Integer.parseInt((String)item.get("rang_m2"));
break;
case 3:
propertysItemM3 = property;
priceM3 = Integer.parseInt((String)item.get("price_m3"));
rangM3 = Integer.parseInt((String)item.get("rang_m3"));
break;
}
}
} else {
JSONArray propertys = (JSONArray)item.get("propertys_m0");
propertysItemM0 = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
propertysItemM0[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + "_m0", priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + "_m1", priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + "_m2", priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + "_m3", priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get("special_item") == null ? false : (Boolean)item.get("special_item");
boolean multicounted = item.get("multicounted") == null ? false : (Boolean)item.get("multicounted");
boolean addable = item.get("addable_item") == null ? false : (Boolean)item.get("addable_item");
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + "_m0", new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace("%", "")));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
} как записать предмет с только модификацией м0 на основе этого кода
|
8c3a379f7e519136f6f6187827053d2b
|
{
"intermediate": 0.3308432102203369,
"beginner": 0.49844273924827576,
"expert": 0.17071399092674255
}
|
32,789
|
The work of a highly protective security program in cpp using oop
|
8ccb3aef26af37320b387747904b8f0b
|
{
"intermediate": 0.2556125223636627,
"beginner": 0.27441301941871643,
"expert": 0.46997445821762085
}
|
32,790
|
in C add another option to the menu that lets the player do something other than look around the room they are in, move rooms or quit the game. Explain the steps taken to achieve this functionality
// we need the include files io and stdlib and string and stdbool and time
// we need to define a constant for the number of rooms
// we need to define a constant for the maximum number of connections per room
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <time.h>
// we want to write a text based game that is a little bit like a choose your own adventure book
// each turn we will present the player with a choice of actions
// the player will choose an action and we will carry it out
// the player can look at the room, or move to another room
// we will need to keep track of the current room
// we need a way to represent the rooms
// we need a way to represent the connections between the rooms
// let's have a datastructure that represents the rooms
// room has connections and connections have rooms so we need to define connection first but we can't because room needs it
// we can use a forward declaration to tell the compiler that connection is a struct that will be defined later
typedef struct connection connection;
typedef struct room {
char* name;
char* description;
connection* connections;
int numConnections;
} room;
// we need a way to represent the connections between the rooms
// let's have a datastructure that represents the connections
typedef struct connection {
room* room1;
room* room2;
} connection;
// we need a way to represent the player
// let's have a datastructure that represents the player
typedef struct player {
room* currentRoom;
} player;
// we need a way to represent the game
// let's have a datastructure that represents the game
typedef struct game {
room* rooms;
int numRooms;
player* player;
} game;
// let's have a function to print a menu and get user choice, return the choice
int getMenuChoice() {
int choice;
printf("What would you like to do?\n");
printf("1. Look around\n");
printf("2. Move to another room\n");
printf("3. Quit\n");
scanf("%d", &choice);
// we need to check that the choice is valid
while (choice < 1 || choice > 3) {
printf("Invalid choice, please try again\n");
scanf("%d", &choice);
}
return choice;
}
// let's have a function to print the room description
void printRoomDescription(room* room) {
printf("You are in the %s.\n", room->name);
printf("%s\n", room->description);
}
// a function to get user choice of room to move to
int getRoomChoice(room* currentRoom) {
int choice;
printf("Which room would you like to move to?\n");
for (int i = 0; i < currentRoom->numConnections; i++) {
printf("%d. %s\n", i+1, currentRoom->connections[i].room2->name);
}
scanf("%d", &choice);
// we need to check that the choice is valid
while (choice < 1 || choice > currentRoom->numConnections) {
printf("Invalid choice, please try again\n");
scanf("%d", &choice);
}
return choice;
}
// a function to move the player to another room, and describe it to the user
void movePlayer(player* player, int choice) {
player->currentRoom = player->currentRoom->connections[choice-1].room2;
printRoomDescription(player->currentRoom);
}
// a function to load the rooms from a file
// the file is called rooms.csv, and has a room name and room description on each line
// the function returns an array of rooms
room* loadRooms() {
// open the file
FILE* file = fopen("rooms.csv", "r");
// we need to check that the file opened successfully
if (file == NULL) {
printf("Error opening file\n");
exit(1);
}
// we need to count the number of lines in the file
int numLines = 0;
char line[500];
while (fgets(line, 500, file) != NULL) {
numLines++;
}
// we need to rewind the file
rewind(file);
// we need to allocate memory for the rooms
room* rooms = malloc(sizeof(room) * numLines);
// we need to read the rooms from the file
for (int i = 0; i < numLines; i++) {
// we need to read the line
fgets(line, 500, file);
// we need to remove the newline character
line[strlen(line)-1] = '\0';
// we need to split the line into the name and description
// the strings are in quotation marks, and the two quoted strings are separated by a comma
// we need to split the line on ", " (the four characters)
//everything between the first and second " is the name
//everything between the third and fourth " is the description
// we need to find the first "
char* name = strtok(line, "\"");
// we need to find the second " and record where it is so we can null terminate the string
char* endofname=strtok(NULL, "\"");
// we need to find the third "
char* description = strtok(NULL, "\"");
// we need to find the fourth "
char* endofdesc=strtok(NULL, "\0");
//we need to be sure that name and description are null terminated strings
name[endofname-name]='\0';
//description[endofdesc-description]='\0';
// we need to create a room
room room;
//we need to copy the string into the room name
room.name = malloc(sizeof(char) * strlen(name) + 1);
strcpy(room.name, name);
//we need to copy the string into the room description
room.description = malloc(sizeof(char) * strlen(description) + 1);
strcpy(room.description, description);
room.connections = NULL;
room.numConnections = 0;
// we need to add the room to the array
rooms[i] = room;
}
// we need to close the file
fclose(file);
// we need to create a maze like set of connections between the rooms
// we need to loop through the rooms
//let's pick a number between 1 and 3 for the number of connections for each room
srand(time(NULL));
for (int i = 0; i < numLines; i++) {
// we need to pick a random number between 1 and 3
int numConnections = rand() % 3 + 1;
int roomToConnectTo;
// we need to loop numConnections times
for (int j = 0; j < numConnections; j++) {
// we need to pick a random room to connect to
roomToConnectTo = rand() % numLines;
// we need to create a connection between the rooms
connection connection;
connection.room1 = &rooms[i];
connection.room2 = &rooms[roomToConnectTo];
// we need to add the connection to the room
rooms[i].connections = realloc(rooms[i].connections, sizeof(connection) * (rooms[i].numConnections + 1));
rooms[i].connections[rooms[i].numConnections] = connection;
rooms[i].numConnections++;
//and don't forget to add the connection to the other room
rooms[roomToConnectTo].connections = realloc(rooms[roomToConnectTo].connections, sizeof(connection) * (rooms[roomToConnectTo].numConnections + 1));
rooms[roomToConnectTo].connections[rooms[roomToConnectTo].numConnections] = connection;
rooms[roomToConnectTo].numConnections++;
}
}
// we need to return the array of rooms
return rooms;
}
// let's have a function to create a player
player* createPlayer(room* currentRoom) {
// we need to allocate memory for the player
player* player = malloc(sizeof(player));
// we need to set the current room
player->currentRoom = currentRoom;
// we need to return the player
return player;
}
// let's have a function to create a game
game* createGame() {
// we need to allocate memory for the game
game* game = malloc(sizeof(game));
// we need to load the rooms
printf("debug - about to load rooms\n");
game->rooms = loadRooms();
printf("debug - rooms loaded\n");
// we need to set the number of rooms
game->numRooms = 10;
// we need to create the player
game->player = createPlayer(&game->rooms[0]);
// we need to return the game
return game;
}
// let's have a function to play the game which is the main function
void playGame() {
// we need to create the game
printf("Welcome to the game\n");
game* game = createGame();
// we need to print the room description
printRoomDescription(game->player->currentRoom);
// we need to loop until the user quits
bool quit = false;
while (!quit) {
// we need to print the menu and get the user choice
int choice = getMenuChoice();
// we need to carry out the user choice
if (choice == 1) {
// we need to print the room description
printRoomDescription(game->player->currentRoom);
} else if (choice == 2) {
// we need to get the user choice of room to move to
int choice = getRoomChoice(game->player->currentRoom);
// we need to move the player to the room
movePlayer(game->player, choice);
} else if (choice == 3) {
// we need to quit
quit = true;
}
}
}
// let's have a main function to call the playGame function
int main() {
playGame();
return 0;
}
|
4bd1046d2c32f97c9ee3e62cc5d606f7
|
{
"intermediate": 0.40719252824783325,
"beginner": 0.3706328868865967,
"expert": 0.22217456996440887
}
|
32,791
|
Lua code example with using "gui.set_font()" (Defold engine)
|
631425040bb488d5649274992d03192f
|
{
"intermediate": 0.37998688220977783,
"beginner": 0.3242793381214142,
"expert": 0.295733779668808
}
|
32,792
|
I am a teacher of English teaching IT. Can you make me a crossword puzzle with computer output terms,please
|
6ec8ce8cb6cd9fe5a2fa7d3ce8e05f6d
|
{
"intermediate": 0.3400869369506836,
"beginner": 0.46497830748558044,
"expert": 0.19493471086025238
}
|
32,793
|
create regular expression except a one space
|
8fb622af00a76c312ed5d6932eab6cd6
|
{
"intermediate": 0.3692026734352112,
"beginner": 0.3410890996456146,
"expert": 0.28970828652381897
}
|
32,794
|
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Perceptron
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_score, recall_score
import matplotlib.pyplot as plt
def perceptron_classifier_on_normalized_data(data):
"""
Train a Perceptron classifier on data with normalization applied after splitting into training and testing sets.
Evaluate its performance and visualize the decision boundary.
Parameters:
- data: A pandas DataFrame containing the dataset with features and target.
Returns:
- A dictionary containing the classifier's performance metrics.
- Slope and intercept of the decision boundary.
"""
# Split the data into training and testing sets first
# TODO: Extract Feature_1 and Feature_2, then split the data
features = data[['Feature_1', 'Feature_2']]
target = data['Target']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) #Do not change the random state
# Normalize the training data and then apply the same transformation to the test data
# Remember to prevent data leakage, only train/fit on training data, for testing data you just need to transform
# Visualize the normalized training data
# TODO: Plot a scatter plot of the normalized training data
# Train the Perceptron classifier on the normalized training data
# Initialize the Perceptron and fit it to the normalized training data
perceptron = Perceptron(max_iter=1000, eta0=0.1, random_state=42)
# Evaluate the classifier's performance on the normalized testing set
# TODO: Make predictions on the normalized testing set and calculate performance metrics
# Note: Convert the metrics to percentage(out of 100) and round them to the nearest integer
metrics = {
'accuracy': round(accuracy_score(y_test, y_pred) * 100),
'precision': round(precision_score(y_test, y_pred) * 100),
'recall': round(recall_score(y_test, y_pred) * 100),
}
# TODO: Calculate the coefficients and intercept from the Perceptron to determine the decision boundary
slope = -perceptron.coef_[0, 0] / perceptron.coef_[0, 1]
intercept = -perceptron.intercept_[0] / perceptron.coef_[0, 1]
# Calculate the slope and intercept of the decision boundary (round to 2 decimal)
slope = round(slope, 2)
intercept = round(intercept, 2)
# Visualize the decision boundary on the normalized training data
plt.scatter(X_train_scaled[:, 0], X_train_scaled[:, 1], c=y_train, cmap=plt.cm.Paired)
plt.title('Decision Boundary on Training Data')
plt.xlabel('Feature_1 (Normalized)')
plt.ylabel('Feature_2 (Normalized)')
plt.plot(X_train_scaled[:, 0], slope * X_train_scaled[:, 0] + intercept, 'k-')
plt.show()
# TODO: Plot the decision boundary on a scatter plot of the normalized training data
# Visualize the decision boundary on the normalized testing data
# TODO: Plot the decision boundary on a scatter plot of the normalized testing data
return metrics, slope, intercept
np.random.seed(42)
data = {
'Feature_1': np.random.randn(100),
'Feature_2': np.random.randn(100),
'Target': np.random.choice([0, 1], size=100)
}
dataset = pd.DataFrame(data)
perceptron_classifier_on_normalized_data(dataset)
|
5cf2bf68284b945d17725028ace45449
|
{
"intermediate": 0.3890320956707001,
"beginner": 0.3016281723976135,
"expert": 0.3093397319316864
}
|
32,795
|
give em the python code for an application which can displays 5 pictures each tuime a button is pressed
|
0a8960d3f189b5cdfce893822c71b107
|
{
"intermediate": 0.33761435747146606,
"beginner": 0.12159773707389832,
"expert": 0.5407878756523132
}
|
32,796
|
import java.time.LocalDate;
public class ElectricityRecord {
LocalDate date;
double israeliLinesMWs;
double gazaPowerPlantMWs;
double egyptianLinesMWs;
double totalDailySupply;
double overallDemand;
double powerCutsHours;
double temperature;
ElectricityRecord next;
public ElectricityRecord(String record) {
String[] fields = record.split(",");
this.date = LocalDate.parse(fields[0]);
this.israeliLinesMWs = Double.parseDouble(fields[1]);
this.gazaPowerPlantMWs = Double.parseDouble(fields[2]);
this.egyptianLinesMWs = Double.parseDouble(fields[3]);
this.totalDailySupply = Double.parseDouble(fields[4]);
this.overallDemand = Double.parseDouble(fields[5]);
this.powerCutsHours = Double.parseDouble(fields[6]);
this.temperature = Double.parseDouble(fields[7]);
this.next = null;
}
|
f0f66344f5ae607ee17510222ba4bdf6
|
{
"intermediate": 0.33579882979393005,
"beginner": 0.449049174785614,
"expert": 0.21515199542045593
}
|
32,797
|
private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get("items");
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get("name_ru"), (String)item.get("name_en"));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get("description_ru"), (String)item.get("description_en"));
String id = (String)item.get("id");
int priceM0 = Integer.parseInt((String)item.get("price_m0"));
int priceM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m1")) : priceM0;
int priceM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m2")) : priceM0;
int priceM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m3")) : priceM0;
int rangM0 = Integer.parseInt((String)item.get("rang_m0"));
int rangM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m1")) : rangM0;
int rangM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m2")) : rangM0;
int rangM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m3")) : rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
int countModification = typeItem == ItemType.COLOR ? 1 : (typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? 4 : (int)(long)item.get("count_modifications"));
for(int m = 0; m < countModification; ++m) {
JSONArray propertys = (JSONArray)item.get("propertys_m" + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
property[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
switch(m) {
case 0:
propertysItemM0 = property;
break;
case 1:
propertysItemM1 = property;
break;
case 2:
propertysItemM2 = property;
break;
case 3:
propertysItemM3 = property;
}
}
if (typeItem == ItemType.COLOR || typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN) {
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + "_m0", priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + "_m1", priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + "_m2", priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + "_m3", priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get("special_item") == null ? false : (Boolean)item.get("special_item");
boolean multicounted = item.get("multicounted") == null ? false : (Boolean)item.get("multicounted");
boolean addable = item.get("addable_item") == null ? false : (Boolean)item.get("addable_item");
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + "_m0", new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace("%", "")));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
} как сделать чтобы тут не было ограничей на 4 модификации а можно было добавить сколько угодно их
|
69d8dc2b8b9952ea42e19407c2e5fa1b
|
{
"intermediate": 0.31658193469047546,
"beginner": 0.4587089717388153,
"expert": 0.22470910847187042
}
|
32,798
|
In android studio/kotlin I need to add an intent to the button that would open the default email client and pre-fill some of the email form fields (recipient,subject and main body text)
|
6d567cc7fca589bc1ef41f026c80663e
|
{
"intermediate": 0.6156898140907288,
"beginner": 0.11832302808761597,
"expert": 0.26598718762397766
}
|
32,799
|
accuracy = accuracy_score(y_test, y_predection) * 100
precision = precision_score(y_test, y_predection, average = "binary", pos_lable = 1) * 100
recall = recall_score(y_test, y_predection, average = "binary", pos_lable = 1) * 100
|
40d0c14175f9207dd36b8c420574d712
|
{
"intermediate": 0.2777509093284607,
"beginner": 0.31090426445007324,
"expert": 0.4113447368144989
}
|
32,800
|
Write a program that starts by drawing the largest circle that can fully fit on the canvas (radius = 200) and continues drawing circles as long as the radius is greater than 0. Each time a circle is drawn, the radius should decrease by 20. The circle colors should alternate between red and black.
Use the variable radius to control the radii values. Use the variable count to control the color of each circle. in a ver very basic form of java script console
|
1d5884b1044aec3ba93f09c5ed31db0c
|
{
"intermediate": 0.2417546957731247,
"beginner": 0.5066166520118713,
"expert": 0.251628577709198
}
|
32,801
|
private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get("items");
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get("name_ru"), (String)item.get("name_en"));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get("description_ru"), (String)item.get("description_en"));
String id = (String)item.get("id");
int priceM0 = Integer.parseInt((String)item.get("price_m0"));
int priceM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m1")) : priceM0;
int priceM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m2")) : priceM0;
int priceM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("price_m3")) : priceM0;
int rangM0 = Integer.parseInt((String)item.get("rang_m0"));
int rangM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m1")) : rangM0;
int rangM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m2")) : rangM0;
int rangM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get("rang_m3")) : rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
int countModification = typeItem == ItemType.COLOR ? 1 : (typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? 4 : (int)(long)item.get("count_modifications"));
for(int m = 0; m < countModification; ++m) {
JSONArray propertys = (JSONArray)item.get("propertys_m" + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get(p);
property[p] = new PropertyItem(getType((String)prop.get("type")), (String)prop.get("value"));
}
switch(m) {
case 0:
propertysItemM0 = property;
break;
case 1:
propertysItemM1 = property;
break;
case 2:
propertysItemM2 = property;
break;
case 3:
propertysItemM3 = property;
}
}
if (typeItem == ItemType.COLOR || typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN) {
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + "_m0", priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + "_m1", priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + "_m2", priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + "_m3", priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get("special_item") == null ? false : (Boolean)item.get("special_item");
boolean multicounted = item.get("multicounted") == null ? false : (Boolean)item.get("multicounted");
boolean addable = item.get("addable_item") == null ? false : (Boolean)item.get("addable_item");
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + "_m0", new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace("%", "")));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
}
private static int getInt(String str) {
try {
return Integer.parseInt(str);
} catch (Exception var2) {
return 0;
}
}
private static PropertyType getType(String s) {
PropertyType[] var4;
int var3 = (var4 = PropertyType.values()).length;
for(int var2 = 0; var2 < var3; ++var2) {
PropertyType type = var4[var2];
if (type.toString().equals(s)) {
return type;
}
}
return null;
}
}
как сделать чтобы можно было добавить такой формат прдемета {
"name_ru": "тест",
"name_en": "тест",
"description_en": "",
"description_ru": "",
"modification": 0,
"id": "mamont",
"price_m0": "750",
"rang_m0":"12",
"propertys_m0": [
{
"type": "armor",
"value": "130"
},
{
"type": "speed",
"value": "4.0"
},
{
"type": "turn_speed",
"value": "80"
}
]
}
|
0062d3a6ae266cccbe859492a648ee18
|
{
"intermediate": 0.31658193469047546,
"beginner": 0.4587089717388153,
"expert": 0.22470910847187042
}
|
32,802
|
private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get(“items”);
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get(“name_ru”), (String)item.get(“name_en”));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get(“description_ru”), (String)item.get(“description_en”));
String id = (String)item.get(“id”);
int priceM0 = Integer.parseInt((String)item.get(“price_m0”));
int priceM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m1”)) : priceM0;
int priceM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m2”)) : priceM0;
int priceM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m3”)) : priceM0;
int rangM0 = Integer.parseInt((String)item.get(“rang_m0”));
int rangM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m1”)) : rangM0;
int rangM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m2”)) : rangM0;
int rangM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m3”)) : rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
int countModification = typeItem == ItemType.COLOR ? 1 : (typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? 4 : (int)(long)item.get(“count_modifications”));
for(int m = 0; m < countModification; ++m) {
JSONArray propertys = (JSONArray)item.get(“propertys_m” + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get§;
property[p] = new PropertyItem(getType((String)prop.get(“type”)), (String)prop.get(“value”));
}
switch(m) {
case 0:
propertysItemM0 = property;
break;
case 1:
propertysItemM1 = property;
break;
case 2:
propertysItemM2 = property;
break;
case 3:
propertysItemM3 = property;
}
}
if (typeItem == ItemType.COLOR || typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN) {
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + “_m0”, priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + “_m1”, priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + “_m2”, priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + “_m3”, priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get(“special_item”) == null ? false : (Boolean)item.get(“special_item”);
boolean multicounted = item.get(“multicounted”) == null ? false : (Boolean)item.get(“multicounted”);
boolean addable = item.get(“addable_item”) == null ? false : (Boolean)item.get(“addable_item”);
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + “_m0”, new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace(“%”, “”)));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
}
private static int getInt(String str) {
try {
return Integer.parseInt(str);
} catch (Exception var2) {
return 0;
}
}
private static PropertyType getType(String s) {
PropertyType[] var4;
int var3 = (var4 = PropertyType.values()).length;
for(int var2 = 0; var2 < var3; ++var2) {
PropertyType type = var4[var2];
if (type.toString().equals(s)) {
return type;
}
}
return null;
}
}
как сделать чтобы можно было добавить такой формат прдемета {
“name_ru”: “тест”,
“name_en”: “тест”,
“description_en”: “”,
“description_ru”: “”,
“modification”: 0,
“id”: “mamont”,
“price_m0”: “750”,
“rang_m0”:“12”,
“propertys_m0”: [
{
“type”: “armor”,
“value”: “130”
},
{
“type”: “speed”,
“value”: “4.0”
},
{
“type”: “turn_speed”,
“value”: “80”
}
]
} но при этом чтобы остался и стандартный формат точнее м0, м1, м2, м3. просто мне надо для некоторых предметов только одна модификация тоесть м0, я для некоторых других все 4 начиная от m0 заканчивая m3
|
cf0620e42030620a702f6766070c7f26
|
{
"intermediate": 0.2890935242176056,
"beginner": 0.5583557486534119,
"expert": 0.15255074203014374
}
|
32,803
|
write an expression that uses a camera to orbit 180 degrees around a subject in after effects
|
e2c751f7505a9b2322101fb92d5c8583
|
{
"intermediate": 0.31002169847488403,
"beginner": 0.16381427645683289,
"expert": 0.5261639952659607
}
|
32,804
|
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Perceptron
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_score, recall_score
import matplotlib.pyplot as plt
def perceptron_classifier_on_normalized_data(data):
"""
Train a Perceptron classifier on data with normalization applied after splitting into training and testing sets.
Evaluate its performance and visualize the decision boundary.
Parameters:
- data: A pandas DataFrame containing the dataset with features and target.
Returns:
- A dictionary containing the classifier's performance metrics.
- Slope and intercept of the decision boundary.
"""
# Split the data into training and testing sets first
# TODO: Extract Feature_1 and Feature_2, then split the data
features = data[['Feature_1', 'Feature_2']]
target = data['Target']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) #Do not change the random state
# Normalize the training data and then apply the same transformation to the test data
# Remember to prevent data leakage, only train/fit on training data, for testing data you just need to transform
# Visualize the normalized training data
# TODO: Plot a scatter plot of the normalized training data
# Train the Perceptron classifier on the normalized training data
# Initialize the Perceptron and fit it to the normalized training data
perceptron = Perceptron(max_iter=1000, eta0=0.1, random_state=42)
# Evaluate the classifier's performance on the normalized testing set
# TODO: Make predictions on the normalized testing set and calculate performance metrics
# Note: Convert the metrics to percentage(out of 100) and round them to the nearest integer
metrics = {
'accuracy': round(accuracy_score(y_test, y_pred) * 100),
'precision': round(precision_score(y_test, y_pred) * 100),
'recall': round(recall_score(y_test, y_pred) * 100),
}
# TODO: Calculate the coefficients and intercept from the Perceptron to determine the decision boundary
slope = -perceptron.coef_[0, 0] / perceptron.coef_[0, 1]
intercept = -perceptron.intercept_[0] / perceptron.coef_[0, 1]
# Calculate the slope and intercept of the decision boundary (round to 2 decimal)
slope = round(slope, 2)
intercept = round(intercept, 2)
# Visualize the decision boundary on the normalized training data
plt.scatter(X_train_scaled[:, 0], X_train_scaled[:, 1], c=y_train, cmap=plt.cm.Paired)
plt.title('Decision Boundary on Training Data')
plt.xlabel('Feature_1 (Normalized)')
plt.ylabel('Feature_2 (Normalized)')
plt.plot(X_train_scaled[:, 0], slope * X_train_scaled[:, 0] + intercept, 'k-')
plt.show()
# TODO: Plot the decision boundary on a scatter plot of the normalized training data
# Visualize the decision boundary on the normalized testing data
# TODO: Plot the decision boundary on a scatter plot of the normalized testing data
return metrics, slope, intercept
np.random.seed(42)
data = {
'Feature_1': np.random.randn(100),
'Feature_2': np.random.randn(100),
'Target': np.random.choice([0, 1], size=100)
}
dataset = pd.DataFrame(data)
perceptron_classifier_on_normalized_data(dataset)
|
9fdc198e48a982a9a4a5ca7fa4b90971
|
{
"intermediate": 0.3890320956707001,
"beginner": 0.3016281723976135,
"expert": 0.3093397319316864
}
|
32,805
|
Create an easy and elegant app with react native (in javascript) who could translate in realtime a discussion between 2 people, you can use SeamlessM4T from meta to implement the IA. One or two page maximum. The goal is to have a futuritic application like in an episode of blackmirror, the netflix tv show
|
5b68b3bea6c4993765a5f97412513651
|
{
"intermediate": 0.4452442526817322,
"beginner": 0.25396037101745605,
"expert": 0.300795316696167
}
|
32,806
|
public class GarageItemsLoader {
public static HashMap<String, Item> items;
private static int index = 1;
public static void loadFromConfig(String turrets, String hulls, String colormaps, String inventory, String subscription) {
if (items == null) {
items = new HashMap();
}
for(int i = 0; i < 5; ++i) {
StringBuilder builder = new StringBuilder();
Throwable var7 = null;
Object var8 = null;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(i == 3 ? colormaps : i == 2 ? hulls : i == 1 ? turrets : i == 0 ? inventory : subscription)), StandardCharsets.UTF_8));
String line;
try {
while((line = reader.readLine()) != null) {
builder.append(line);
}
} finally {
if (reader != null) {
reader.close();
}
}
} catch (Throwable var18) {
if (var7 == null) {
var7 = var18;
} else if (var7 != var18) {
var7.addSuppressed(var18);
}
try {
throw var7;
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
parseAndInitItems(builder.toString(), i == 3 ? ItemType.COLOR : i == 2 ? ItemType.ARMOR : i == 1 ? ItemType.WEAPON : i == 0 ? ItemType.INVENTORY : ItemType.PLUGIN);
}
} private static void parseAndInitItems(String json, ItemType typeItem) {
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(json);
JSONObject jparser = (JSONObject)obj;
JSONArray jarray = (JSONArray)jparser.get(“items”);
for(int i = 0; i < jarray.size(); ++i) {
JSONObject item = (JSONObject)jarray.get(i);
LocalizedString name = StringsLocalizationBundle.registerString((String)item.get(“name_ru”), (String)item.get(“name_en”));
LocalizedString description = StringsLocalizationBundle.registerString((String)item.get(“description_ru”), (String)item.get(“description_en”));
String id = (String)item.get(“id”);
int priceM0 = Integer.parseInt((String)item.get(“price_m0”));
int priceM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m1”)) : priceM0;
int priceM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m2”)) : priceM0;
int priceM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“price_m3”)) : priceM0;
int rangM0 = Integer.parseInt((String)item.get(“rang_m0”));
int rangM1 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m1”)) : rangM0;
int rangM2 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m2”)) : rangM0;
int rangM3 = typeItem != ItemType.COLOR && typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? Integer.parseInt((String)item.get(“rang_m3”)) : rangM0;
PropertyItem[] propertysItemM0 = null;
PropertyItem[] propertysItemM1 = null;
PropertyItem[] propertysItemM2 = null;
PropertyItem[] propertysItemM3 = null;
int countModification = typeItem == ItemType.COLOR ? 1 : (typeItem != ItemType.INVENTORY && typeItem != ItemType.PLUGIN ? 4 : (int)(long)item.get(“count_modifications”));
for(int m = 0; m < countModification; ++m) {
JSONArray propertys = (JSONArray)item.get(“propertys_m” + m);
PropertyItem[] property = new PropertyItem[propertys.size()];
for(int p = 0; p < propertys.size(); ++p) {
JSONObject prop = (JSONObject)propertys.get§;
property[p] = new PropertyItem(getType((String)prop.get(“type”)), (String)prop.get(“value”));
}
switch(m) {
case 0:
propertysItemM0 = property;
break;
case 1:
propertysItemM1 = property;
break;
case 2:
propertysItemM2 = property;
break;
case 3:
propertysItemM3 = property;
}
}
if (typeItem == ItemType.COLOR || typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN) {
propertysItemM1 = propertysItemM0;
propertysItemM2 = propertysItemM0;
propertysItemM3 = propertysItemM0;
}
ModificationInfo[] mods = new ModificationInfo[4];
mods[0] = new ModificationInfo(id + “_m0”, priceM0, rangM0);
mods[0].propertys = propertysItemM0;
mods[1] = new ModificationInfo(id + “_m1”, priceM1, rangM1);
mods[1].propertys = propertysItemM1;
mods[2] = new ModificationInfo(id + “_m2”, priceM2, rangM2);
mods[2].propertys = propertysItemM2;
mods[3] = new ModificationInfo(id + “_m3”, priceM3, rangM3);
mods[3].propertys = propertysItemM3;
boolean specialItem = item.get(“special_item”) == null ? false : (Boolean)item.get(“special_item”);
boolean multicounted = item.get(“multicounted”) == null ? false : (Boolean)item.get(“multicounted”);
boolean addable = item.get(“addable_item”) == null ? false : (Boolean)item.get(“addable_item”);
items.put(id, new Item(id, description, typeItem == ItemType.INVENTORY || typeItem == ItemType.PLUGIN, index, propertysItemM0, typeItem, 0, name, propertysItemM1, priceM1, rangM1, priceM0, rangM0, mods, specialItem, 0, addable, multicounted));
++index;
if (typeItem == ItemType.COLOR) {
ColormapsFactory.addColormap(id + “_m0”, new Colormap() {
{
PropertyItem[] var5;
int var4 = (var5 = mods[0].propertys).length;
for(int var3 = 0; var3 < var4; ++var3) {
PropertyItem _property = var5[var3];
this.addResistance(ColormapsFactory.getResistanceType(_property.property), GarageItemsLoader.getInt(_property.value.replace(“%”, “”)));
}
}
});
}
}
} catch (ParseException var29) {
var29.printStackTrace();
}
}
private static int getInt(String str) {
try {
return Integer.parseInt(str);
} catch (Exception var2) {
return 0;
}
}
private static PropertyType getType(String s) {
PropertyType[] var4;
int var3 = (var4 = PropertyType.values()).length;
for(int var2 = 0; var2 < var3; ++var2) {
PropertyType type = var4[var2];
if (type.toString().equals(s)) {
return type;
}
}
return null;
}
}
как сделать чтобы можно было добавить такой формат прдемета {
“name_ru”: “тест”,
“name_en”: “тест”,
“description_en”: “”,
“description_ru”: “”,
“modification”: 0,
“id”: “mamont”,
“price_m0”: “750”,
“rang_m0”:“12”,
“propertys_m0”: [
{
“type”: “armor”,
“value”: “130”
},
{
“type”: “speed”,
“value”: “4.0”
},
{
“type”: “turn_speed”,
“value”: “80”
}
]
} но при этом чтобы остался и стандартный формат точнее м0, м1, м2, м3. просто мне надо для некоторых предметов только одна модификация тоесть м0, я для некоторых других все 4 начиная от m0 заканчивая m3
|
eea314a1c1fea3806e201631a554d1e0
|
{
"intermediate": 0.3256196975708008,
"beginner": 0.5302889347076416,
"expert": 0.1440914422273636
}
|
32,807
|
Create the HTML and the CSS and JavaScript from this https://accountantonline.ie/
|
7eadd5cb5287e2eb4341fbd3fe2d5c6c
|
{
"intermediate": 0.36700958013534546,
"beginner": 0.169104665517807,
"expert": 0.46388575434684753
}
|
32,808
|
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/hintButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Подсказка"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="16dp"/>
<ImageView
android:id="@+id/finddiff1"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/finddiff1"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<ImageView
android:id="@+id/finddiff2"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/finddiff2"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Вот код для Android Studio на языке Java. Он должен размещать две картинки на экране, каждая должна занимать ровно 50%. Вторая картинка почему-то не отображается (с путями к картинке все нормально, их видно). Найди ошибку и исправь.
|
cd85d169d697ddf65e520bfced7e756f
|
{
"intermediate": 0.26583972573280334,
"beginner": 0.5518321990966797,
"expert": 0.18232807517051697
}
|
32,809
|
python code using BiLSTM encoder and BiLSTM decoder rnn to translate English text to Arabic text by splitting data from file into train. validate and test ,Tokenize the sentences and convert them into numerical representations ,Pad or truncate the sentences to a fixed length and examples translation from test data
|
a8c59132c7a0bfdfbaa146c002e8ad21
|
{
"intermediate": 0.3731970489025116,
"beginner": 0.11263254284858704,
"expert": 0.5141704082489014
}
|
32,810
|
python code using LSTM encoder and BiLSTM decoder rnn to translate English text to Arabic text by splitting data from file into train. validate and test ,Tokenize the sentences and convert them into numerical representations ,Pad or truncate the sentences to a fixed length and examples translation from test data
|
bb2f12757cf056c71119091394fa9f45
|
{
"intermediate": 0.36776021122932434,
"beginner": 0.11787638068199158,
"expert": 0.5143634080886841
}
|
32,811
|
смотри у меня в MainActivity есть <com.jetradarmobile.snowfall.SnowfallView
android:id="@+id/snow" и во Фрагменте Profile есть switch1 мне нужно сделать так если я нажимаю на свитч то снег становиться видимым и при перезапуске сохраняет свое состояние а если я выключаю свитч то снег пропадает <Switch
android:id="@+id/switch1"package com.example.cardsbattle.utilites;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.cardsbattle.utilites.Constants;
public class PreferenceManager {
private final SharedPreferences sharedPreferences;
public PreferenceManager(Context context){
sharedPreferences = context.getSharedPreferences(Constants.KEY_PREFERENCE_NAME, Context.MODE_PRIVATE);
}
public void putBoolean(String key, Boolean value){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(key, value);
editor.apply();
}
public Boolean getBoolean(String key) {
return sharedPreferences.getBoolean(key, false);
}
public void putString(String key, String value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.apply();
}
public void putInt(String key, int value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(key, value);
editor.apply();
}
public int getInt(String key) {
return sharedPreferences.getInt(key, 0); // Возвращает 0, если ключ не найден
}
public String getString(String key) {
return sharedPreferences.getString(key, null);
}
public void clear() {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
}
public void putLong(String key, long value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putLong(key, value);
editor.apply();
}
public long getLong(String key, long defaultValue) {
return sharedPreferences.getLong(key, defaultValue);
}
public void putBestDrop(String key, String value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.apply();
}
public String getBestDrop(String key) {
return sharedPreferences.getString(key, null);
}
}
|
782942f2d1b2e261d3525ed8ee37339a
|
{
"intermediate": 0.3037712872028351,
"beginner": 0.5210909843444824,
"expert": 0.1751376837491989
}
|
32,812
|
hello
|
a79afdcfa3c07404cc3f9fdcb8263a39
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
32,813
|
Is this a valid way to put the commands they need to run in the command line?
|
58ce920e968fb6e980b14794c80ba358
|
{
"intermediate": 0.4189777374267578,
"beginner": 0.268742173910141,
"expert": 0.3122800588607788
}
|
32,814
|
Is this valid markdown?
|
3bc8442fc6900f70e6d3d333f4cffc5c
|
{
"intermediate": 0.28957703709602356,
"beginner": 0.3079226315021515,
"expert": 0.4025002717971802
}
|
32,815
|
Что такое Spring стартер? Как его создать?
|
3d144df16902213aff70fc5650044920
|
{
"intermediate": 0.44596266746520996,
"beginner": 0.26930782198905945,
"expert": 0.2847295105457306
}
|
32,816
|
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
HttpClient client = new HttpClient();
using (HttpResponseMessage response = await client.GetAsync($"{url}?{string.Join("&", query.Select(kv => $"{kv.Key}={HttpUtility.UrlEncode(kv.Value)}"))}")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
как улучшить этот код?
|
aefa871ee77eb67eab67bb13ff20a00f
|
{
"intermediate": 0.4760763347148895,
"beginner": 0.3111456036567688,
"expert": 0.21277807652950287
}
|
32,817
|
как улучшить этот код?
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
HttpClient client = new HttpClient();
using (HttpResponseMessage response = await client.GetAsync($"{url}?{string.Join("&", query.Select(kv => $"{kv.Key}={HttpUtility.UrlEncode(kv.Value)}"))}")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
|
28b1169a0606f9ad61dfd10f0d6525fb
|
{
"intermediate": 0.47744640707969666,
"beginner": 0.3508308231830597,
"expert": 0.17172276973724365
}
|
32,818
|
Hi give me a python code to give me an analysis of nifty 50 considering OI data, Fii & DII data which I can run daily before market opens
|
de1cb6ec217b68331e19160316332561
|
{
"intermediate": 0.5102389454841614,
"beginner": 0.09370995312929153,
"expert": 0.39605119824409485
}
|
32,819
|
как улучшить этот код?
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
HttpClient client = new HttpClient();
using (HttpResponseMessage response = await client.GetAsync($"{url}?{string.Join("&", query.Select(kv => $"{kv.Key}={HttpUtility.UrlEncode(kv.Value)}"))}")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
|
94ceb51581cd773b80639f1055c0af89
|
{
"intermediate": 0.47744640707969666,
"beginner": 0.3508308231830597,
"expert": 0.17172276973724365
}
|
32,821
|
Can you give me python to first gather historical stock data on Indian stock market and then will calculate and filter companies showing 10% gain in 2-3 months and showing good price volume action
|
24ec15613bf4c0309c09914edc9f0806
|
{
"intermediate": 0.5186929106712341,
"beginner": 0.06157343089580536,
"expert": 0.4197337031364441
}
|
32,822
|
как улучшить этот код?
using (HttpClient client = new HttpClient()) {
using (HttpResponseMessage response = await client.GetAsync($"{url}?{url2}"))}")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
}
|
4aeab459384d5110782125fd060f51e4
|
{
"intermediate": 0.417071133852005,
"beginner": 0.3739292323589325,
"expert": 0.2089996635913849
}
|
32,823
|
как улучшить этот код?
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
using (HttpClient client = new HttpClient()) {
using (HttpResponseMessage response = await client.GetAsync($"{url}?{url2}")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
}
}
|
1f7f7cedf411bd52985859bc4195158c
|
{
"intermediate": 0.4913078844547272,
"beginner": 0.34476956725120544,
"expert": 0.163922518491745
}
|
32,824
|
How do I give elements a screen reader label
|
596a5d87e0732a7ea7ace9cd9d7ff633
|
{
"intermediate": 0.3610667884349823,
"beginner": 0.22376681864261627,
"expert": 0.4151664078235626
}
|
32,825
|
in c++ wxgrid, SelectAll() select all the rows but I want to select all the shown rows only? Do I have to iterate over all the rows, checking if they are shown and then selecting them?
|
c9b96ec83ba30438b7aeb5a48605e876
|
{
"intermediate": 0.6516547203063965,
"beginner": 0.1236456111073494,
"expert": 0.2246996909379959
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.