row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
4,016
|
Implement a queue in which each element has its own priority in C++ (an element and its corresponding priority are entered into the queue). Use libraries iostream, std namespace, C++ language classes. An implementation must not use the queue library. Functions for adding, withdrawing (without deleting), and withdrawing with deleting an element should be described.
|
86b50c2c3b5f5a1a2f361da4aae5b8e6
|
{
"intermediate": 0.5887935757637024,
"beginner": 0.2392089068889618,
"expert": 0.17199748754501343
}
|
4,017
|
how can i add a loading animation to my login page in react while waiting for the response body after submitting it
|
9d77d5dd43bb65327239c38c51aaa52c
|
{
"intermediate": 0.6338638067245483,
"beginner": 0.16174845397472382,
"expert": 0.20438769459724426
}
|
4,018
|
I have the functions in react
const reload = async (index) => {
setIsNomenclaturaFullUpdated(false);
const updatedNomenclaturaFull = await getHouses(nomenclaturas);
console.log("updated", updatedNomenclaturaFull);
setSelectOption(updatedNomenclaturaFull[index]);
console.log("reloaded");
};
const getHouses = async (nomenclaturas) => {
let houses = nomenclaturas.data.map(async (item, index) => {
let data = { ...item };
let houses = await getNomenclaturasCasasHelper(
"Yd5MV7jkA0MjQeCmzKrZ",
nomenclaturas.data[index].id
).then((houseData) => {
data.houseData = houseData;
});
return data;
});
Promise.all(houses).then((data) => {
setNomenclaturaFull(data);
setIsNomenclaturaFullUpdated(true);
});
};
modify the getHouses function to return the data to the const updatedNomenclaturaFull
|
56b1c025b8661fb96682c1bb0676cc51
|
{
"intermediate": 0.3159690797328949,
"beginner": 0.5460408926010132,
"expert": 0.1379900425672531
}
|
4,019
|
Hello
|
51fc890d6b8de0c0d431954a489ec9ff
|
{
"intermediate": 0.3123404085636139,
"beginner": 0.2729349136352539,
"expert": 0.4147246778011322
}
|
4,020
|
This sql server query selects all the groups that are connected to the tblSource based on SomeoneIDs from #tblSomeTable and sourcetype. How do I change it to also select the direct children of those groups?
SELECT groups.*
INTO #tblGroup
FROM tblGroup groups
JOIN tblSource source ON source.SourceID = groups.SourceID
JOIN tblSomeone someone ON someone.SomeoneID = source.SourceID
JOIN tblSourceType sourceType ON sourceType.SourceTypeID = source.SourceTypeID
WHERE (someone.SomeoneID IN (SELECT SomeoneID FROM #tblSomeTable)) AND (sourceType.Description = 'someone')
|
fc88ab333155875a6a784139d32c0011
|
{
"intermediate": 0.4651922881603241,
"beginner": 0.2568055987358093,
"expert": 0.27800214290618896
}
|
4,021
|
mongodb diff between updateone and findandupdateone
|
edeca19ca4cb706469ac6833e58d1b7d
|
{
"intermediate": 0.42357778549194336,
"beginner": 0.25299909710884094,
"expert": 0.3234231472015381
}
|
4,022
|
Give me the code to start a react app
|
5a9b325a579e4956078096ab5b07b689
|
{
"intermediate": 0.5454307198524475,
"beginner": 0.20533417165279388,
"expert": 0.24923507869243622
}
|
4,023
|
analyze the following code and implement an improvement
import re
import random
import nltk
from nltk.tokenize import word_tokenize
from nltk import pos_tag
# Download required NLTK data
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
responses = {
r"hi|hello|hey": ["Hello!", "Hi there!", "Hey!"],
r"what is your name\??": ["My name is ChatBot.", "You can call me ChatBot.", "I'm ChatBot."],
r"how are you\??": ["I'm good, thanks!", "I'm fine, how about you?", "I'm doing well."],
r"(.*) your name\??": ["My name is ChatBot.", "You can call me ChatBot.", "I'm ChatBot."],
r"(.*) (good|well|fine)": ["That's great!", "Awesome!", "Good to hear."],
r"(.*) (bad|not good)": ["I'm sorry to hear that.", "That's unfortunate.", "Hope you feel better soon."],
# Add more patterns and responses as needed
}
def generate_response(tagged_tokens):
for pattern, possible_responses in responses.items():
for token, pos_tag in tagged_tokens:
if re.match(pattern, token, re.IGNORECASE):
return random.choice(possible_responses)
return "I'm sorry, but I don't understand."
while True:
user_input = input("User: ")
if user_input.lower() == "exit":
break
tokens = word_tokenize(user_input)
tagged_tokens = pos_tag(tokens)
response = generate_response(tagged_tokens)
print("ChatBot:", response)
|
ceeddd8cfcd0cf85bb0e7925d6b80c12
|
{
"intermediate": 0.47470951080322266,
"beginner": 0.18784362077713013,
"expert": 0.3374468684196472
}
|
4,024
|
How to convert derivative map to normal map in c++
|
f47953a93900ac488c54423565e05854
|
{
"intermediate": 0.23236054182052612,
"beginner": 0.24877195060253143,
"expert": 0.5188674926757812
}
|
4,025
|
Below code is designed to reduce total supply chain costs, but it make production each month which has huge setup cost, instead it should hold inventory but it is not
can you help me in that?
import pandas as pd
import pulp
from pulp import LpVariable, LpProblem, lpSum, LpMinimize, LpInteger, LpBinary
filename = "Multi Period Multi Commodity SCNWD.xlsx"
# Read data from the file
demand_df = pd.read_excel(filename, sheet_name="Demand")
plant_capacity_df = pd.read_excel(filename, sheet_name="Plant Capacity")
warehouse_capacity_df = pd.read_excel(filename, sheet_name="Warehouse Capacity per Product")
fixed_plant_cost_df = pd.read_excel(filename, sheet_name="Fixed Plant Cost")
variable_production_cost_df = pd.read_excel(filename, sheet_name="Variable Production Cost")
inbound_cost_df = pd.read_excel(filename, sheet_name="Inbound Cost")
outbound_cost_df = pd.read_excel(filename, sheet_name="Outbound Cost")
fixed_warehouse_cost_df = pd.read_excel(filename, sheet_name="Fixed Warehouse Cost")
holding_cost_df = pd.read_excel(filename, sheet_name="Holding Cost")
setup_cost_df = pd.read_excel(filename, sheet_name="Setup Cost")
# Create dictionaries
demand = demand_df.set_index(["customer", "period", "product"])["demand"].to_dict()
plant_capacity = plant_capacity_df.set_index(["plant", "product"])["capacity"].to_dict()
warehouse_capacity = warehouse_capacity_df.set_index(["warehouse", "product"])["capacity"].to_dict()
fixed_plant_cost = fixed_plant_cost_df.set_index("plant")["cost"].to_dict()
variable_production_cost = variable_production_cost_df.set_index(["plant", "product"])["cost"].to_dict()
inbound_cost = inbound_cost_df.set_index(["plant","warehouse", "product"])["cost"].to_dict()
outbound_cost = outbound_cost_df.set_index(["warehouse", "customer", "product"])["cost"].to_dict()
fixed_warehouse_cost = fixed_warehouse_cost_df.set_index("warehouse")["cost"].to_dict()
holding_cost = holding_cost_df.set_index("product")["cost"].to_dict()
setup_cost= setup_cost_df.set_index(["plant", "product"])["cost"].to_dict()
# Define Variables
customers= demand_df['customer'].unique().tolist()
plants= plant_capacity_df['plant'].unique().tolist()
warehouses= warehouse_capacity_df['warehouse'].unique().tolist()
products= demand_df['product'].unique().tolist()
periods= demand_df['period'].unique().tolist()
# Problem definition
problem = pulp.LpProblem("Multi-Commodity_Flow_Problem", pulp.LpMinimize)
# Decision variables
x = pulp.LpVariable.dicts("x", (plants, warehouses, products, periods), lowBound=0, cat="Continuous")
y = pulp.LpVariable.dicts("y", (warehouses, customers, products, periods), lowBound=0, cat="Continuous")
z_plant = pulp.LpVariable.dicts("z_plant", plants, cat="Binary")
z_warehouse = pulp.LpVariable.dicts("z_warehouse", warehouses, cat="Binary")
inventory = pulp.LpVariable.dicts("inv", (products, warehouses, range(0,13)), lowBound=0, cat="Continuous")
binary = pulp.LpVariable.dicts("binary", (plants, products, periods), lowBound=0, cat="Binary")
production_lot_size = pulp.LpVariable.dicts("lot_size", (plants, products, periods), lowBound=0, cat="Continuous")
# Objective
problem += (
pulp.lpSum([fixed_plant_cost[p] * z_plant[p] for p in plants])
+ pulp.lpSum(
[
variable_production_cost[(p, pr)] * x[p][w][pr][t]
for p in plants
for w in warehouses
for pr in products
for t in periods
]
)
+ pulp.lpSum(
[
inbound_cost[(p, w, pr)] * x[p][w][pr][t]
for p in plants
for w in warehouses
for pr in products
for t in periods
]
)
+ pulp.lpSum(
[
outbound_cost[(w, c, pr)] * y[w][c][pr][t]
for w in warehouses
for c in customers
for pr in products
for t in periods
]
)
+ pulp.lpSum([fixed_warehouse_cost[w] * z_warehouse[w] for w in warehouses])
+ pulp.lpSum(
[
binary[p][pr][t] * setup_cost[(p, pr)]
for p in plants
for pr in products
for t in periods
]
)
+ pulp.lpSum(
[
holding_cost[pr] * inventory[pr][w][t]
for pr in products
for t in periods
for w in warehouses
]
)
)
#----------------------- Constraints ----------------------
for p in plants:
for pr in products:
for t in periods:
problem += production_lot_size[p][pr][t] >= binary[p][pr][t]
for pr in products:
for t in periods:
for w in warehouses:
problem += (
pulp.lpSum([x[p][w][pr][t] for p in plants])
== pulp.lpSum([y[w][c][pr][t] for c in customers]) + inventory[pr][w][t]
)
for c in customers:
for pr in products:
for t in periods:
problem += (
pulp.lpSum([y[w][c][pr][t] for w in warehouses])
>= demand.get((c, t, pr), 0)
)
for p in plants:
for w in warehouses:
for pr in products:
for t in periods:
problem += (
x[p][w][pr][t] <= plant_capacity.get((p, pr), 0) * z_plant[p]
)
for w in warehouses:
for pr in products:
for t in periods:
problem += (
pulp.lpSum([y[w][c][pr][t] for c in customers])
<= warehouse_capacity.get((w, pr), 0) * z_warehouse[w]
)
# Additional constraints to link inventory and production_lot_size variables
for p in plants:
for pr in products:
for t in periods:
problem += (
pulp.lpSum([x[p][w][pr][t] for w in warehouses])
== production_lot_size[p][pr][t]
)
for pr in products:
for w in warehouses:
for t in range(1, len(periods)):
problem += (
inventory[pr][w][t - 1] + pulp.lpSum([production_lot_size[p][pr][t] for p in plants])
- pulp.lpSum([demand.get((c, t, pr), 0) for c in customers])
== inventory[pr][w][t]
)
# Modified constraints to properly link inventory variable
for pr in products:
for w in warehouses:
for t in periods:
# Start with initial inventory in the first period
if t == min(periods):
problem += (
pulp.lpSum([x[p][w][pr][t] for p in plants for w in warehouses])
>= pulp.lpSum([y[w][c][pr][t] for w in warehouses for c in customers])
+ inventory[pr][w][t]
)
# For the rest of the periods, account for the previous period's inventory
else:
problem += (
pulp.lpSum([x[p][w][pr][t] for p in plants for w in warehouses])
+ inventory[pr][w][t - 1] - inventory[pr][w][t]
>= pulp.lpSum([demand.get((c, t, pr), 0) for c in customers])
)
# Solve the model with a time limit of 60 seconds
time_limit_in_seconds = 60 * 2
problem.solve(pulp.PULP_CBC_CMD(msg=1, timeLimit=time_limit_in_seconds))
# Print results
print("Objective value:", pulp.value(problem.objective))
print("Solution status:", pulp.LpStatus[problem.status])
# Print decision variables
for p in plants:
for w in warehouses:
for pr in products:
for t in periods:
if x[p][w][pr][t].varValue > 0:
print(f"x[{p}][{w}][{pr}][{t}] = {x[p][w][pr][t].varValue}")
for w in warehouses:
for c in customers:
for pr in products:
for t in periods:
if y[w][c][pr][t].varValue > 0:
print(f"y[{w}][{c}][{pr}][{t}] = {y[w][c][pr][t].varValue}")
for p in plants:
if z_plant[p].varValue > 0:
print(f"z_plant[{p}] = {z_plant[p].varValue}")
for w in warehouses:
if z_warehouse[w].varValue > 0:
print(f"z_warehouse[{w}] = {z_warehouse[w].varValue}")
# Print production lot size solution
print("Production lot size:")
for p in plants:
for pr in products:
for t in periods:
if production_lot_size[p][pr][t].varValue > 0:
print(f"Plant {p}, Product {pr}, Period {t}: {production_lot_size[p][pr][t].varValue}")
# Print inventory solution
for pr in products:
for w in warehouses:
for t in periods:
if inventory[pr][w][t].varValue > 0:
print(f"inv[{pr}][{t}] = {inventory[pr][w][t].varValue}")
#-------- Print the entire model output
for variable in problem.variables():
if variable.varValue > 0:
print(variable.name, "=", variable.varValue)
import matplotlib.pyplot as plt
def plot_product_results(product, time, demand, production, inventory):
plt.figure(figsize=(12, 6))
plt.title(f"Product: {product}")
plt.plot(time, demand, marker='o', label="Demand")
plt.bar(time, production, alpha=0.5, label="Production")
plt.scatter(time, inventory, marker='s', color='red', label="Inventory")
plt.xlabel("Month")
plt.ylabel("Quantity")
plt.legend()
plt.grid()
plt.xticks(time)
plt.show()
# Initialize a dictionary to store the sum of demand for each product
sum_demand = {}
for pr in products:
print(f"\n\nProduct: {pr}")
print("Month".ljust(10) + "Production".ljust(15) + "Inventory".ljust(15) + "Total Demand")
# Initialize lists to store demand, production, and inventory values for plotting
demand_values = []
production_values = []
inventory_values = []
# Initialize the sum of demand for the current product to 0
sum_demand[pr] = 0
for t in periods:
# Calculate the total demand for all customers for the current product and time period
total_demand = sum(demand[c, t, pr] for c in customers)
# Add the total demand to the sum of demand for the current product
sum_demand[pr] += total_demand
# Initialize variables to store the production and inventory for the current product and time period
total_production = 0
total_inventory = 0
# Calculate the total production and inventory for the current product and time period
for p in plants:
if production_lot_size[p][pr][t].varValue > 0:
total_production += production_lot_size[p][pr][t].varValue
for w in warehouses:
if inventory[pr][w][t].varValue > 0:
total_inventory += inventory[pr][w][t].varValue
# Store the demand, production, and inventory values for plotting
demand_values.append(total_demand)
production_values.append(total_production)
inventory_values.append(total_inventory)
print(f"{t}".ljust(10) + f"{round(total_production,2)}".ljust(15) + f"{round(total_inventory, 2)}".ljust(15) + f"{total_demand}")
# Plot the, demand, and inventory for the current product
plot_product_results(pr, periods, demand_values, production_values, inventory_values)
# Define output dictionary
output = []
# Iterate over decision variables and add non-zero values to output dictionary
for p in plants:
for w in warehouses:
for pr in products:
for t in periods:
for c in customers:
if x[p][w][pr][t].varValue > 0:
# Add decision variable to output dictionary
output.append(
{
"plant": p,
"warehouse": w,
# "customer": c,
"product": pr,
"period": t,
"production": production_lot_size[p][pr][t].varValue,
"inbound_shipment": x[p][w][pr][t].varValue
}
)
if y[w][c][pr][t].varValue > 0:
# Add decision variable to output dictionary
output.append(
{
"plant": p,
"warehouse": w,
"customer": c,
"product": pr,
"period": t,
"outbound_shipment": y[w][c][pr][t].varValue,
}
)
# Convert output to dataframe and export to Excel
output_df = pd.DataFrame(output)
print(output_df)
|
74667ac0f7e4da6c0d8cfaf19c34c99d
|
{
"intermediate": 0.3582279086112976,
"beginner": 0.42909562587738037,
"expert": 0.21267642080783844
}
|
4,026
|
realise card from Slay the Spire in Javascript
|
89c87f81c345afe3250e3bc450732313
|
{
"intermediate": 0.32216259837150574,
"beginner": 0.37888720631599426,
"expert": 0.2989502251148224
}
|
4,027
|
write me a lua script for a rocket launcher for roblox
|
d82354b006c79579839314c2a91cad64
|
{
"intermediate": 0.30422917008399963,
"beginner": 0.3740883469581604,
"expert": 0.32168248295783997
}
|
4,028
|
in perl, i have a hash a hash. i want a key if one of the sub-keys is foo. can we grep?
|
9e587d31ebb23691649f2e871f8cd698
|
{
"intermediate": 0.3839046061038971,
"beginner": 0.2684115767478943,
"expert": 0.34768378734588623
}
|
4,029
|
I want to make a query in sql in table Transact1Tbl I want to find results where ID = @PID Custname=@CN and Total=@T
|
2e4f486bee02315973f6141057836183
|
{
"intermediate": 0.41537490487098694,
"beginner": 0.2953238785266876,
"expert": 0.28930121660232544
}
|
4,030
|
Pada kode ini
import pickle
import pandas as pd
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.utils import pad_sequences
from keras.models import Sequential
from keras.layers import Embedding, LSTM, Dense, Dropout, Conv1D, MaxPooling1D, Flatten
from keras.callbacks import EarlyStopping
from keras.utils import to_categorical
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, classification_report
from skopt import gp_minimize
from skopt.space import Integer, Categorical
from skopt.utils import use_named_args
# Membaca dataset
data_list = pickle.load(open('filtered_pre_processed_berita_2_joined_done.pkl', 'rb'))
data = pd.DataFrame(data_list, columns=['judul', 'isi', 'pre_processed', 'Label'])
data['Isi Berita'] = data['pre_processed']
# Tokenisasi dan Padding
max_words = 10000 # mengurangi jumlah kata maksimum
max_len = 500 # mengurangi panjang input
tokenizer = Tokenizer(num_words=max_words)
tokenizer.fit_on_texts(data['Isi Berita'])
sequences = tokenizer.texts_to_sequences(data['Isi Berita'])
X = pad_sequences(sequences, maxlen=max_len)
y = to_categorical(data['Label'].astype('category').cat.codes)
# Membagi data menjadi data latih dan data uji
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
# Fungsi untuk membuat model
def create_model(lstm_units, conv_filters, kernel_size, dense_units, optimizer):
model = Sequential()
model.add(Embedding(max_words, 64, input_length=max_len))
model.add(LSTM(lstm_units, return_sequences=True, dropout=0.2))
model.add(Conv1D(conv_filters, kernel_size, activation='relu'))
model.add(MaxPooling1D(pool_size=4))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(dense_units, activation='relu'))
model.add(Dense(3, activation='softmax'))
model.compile(optimizer=optimizer, loss='categorical_crossentropy', metrics=['accuracy'])
return model
# Definisikan rentang pencarian untuk masing-masing parameter
space = [
Integer(32, 128, name='lstm_units'),
Integer(32, 128, name='conv_filters'),
Integer(3, 7, name='kernel_size'),
Integer(16, 64, name='dense_units'),
Categorical(['adam', 'rmsprop'], name='optimizer')
]
# Definisikan fungsi objektif yang akan di-minimalkan
@use_named_args(space)
def objective(**params):
model = create_model(**params)
early_stopping = EarlyStopping(patience=2)
history = model.fit(X_train, y_train, validation_split=0.15, epochs=20, batch_size=64, callbacks=[early_stopping], verbose=0)
# Mengambil validasi terbaik
best_val_loss = min(history.history['val_loss'])
print(f"Trying combination: {params} - Best validation loss: {best_val_loss}")
return best_val_loss
# Melakukan optimasi Gaussian Process
result = gp_minimize(objective, space, n_calls=20, random_state=42, verbose=1)
# Mencetak parameter terbaik yang ditemukan
best_params = {dim.name: result.x[i] for i, dim in enumerate(space)}
print(f"Best parameters: {best_params}")
# Melatih model terbaik
best_model = create_model(**best_params)
best_model.fit(X_train, y_train, epochs=20, batch_size=64)
# Mengevaluasi model terbaik
y_pred = best_model.predict(X_test)
y_pred = np.argmax(y_pred, axis=1)
y_true = np.argmax(y_test, axis=1)
# Menghitung akurasi
accuracy = accuracy_score(y_true, y_pred)
print(f"Akurasi: {accuracy}")
# Menampilkan classification report
report = classification_report(y_true, y_pred, target_names=['Negatif', 'Netral', 'Positif'])
print("Classification Report:")
print(report)
# Menyimpan model terbaik
best_model.save('best_lstm_cnn_model.h5')
pickle.dump(tokenizer, open('tokenizer.pkl', 'wb'))
Muncul error
" value_tuple = tuple(value)
^^^^^^^^^^^^
TypeError: 'numpy.int64' object is not iterable"
dan
" result = gp_minimize(objective, space, n_calls=20, random_state=42, verbose=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
raise ValueError(error_msg)
ValueError: The `kernel_size` argument must be a tuple of 1 integers. Received: 6"
Bagaimana cara mengatasinya?
|
a4c3714be1f933fa84d8130751a13980
|
{
"intermediate": 0.3560495674610138,
"beginner": 0.29526805877685547,
"expert": 0.34868237376213074
}
|
4,031
|
Please build a p5.js program thats a grid of 6 columns and 7 rows. To the left of the grid is a list of the cells, and each cell corresponds to it's own item on the list. Whenever somebody touches a cell of the grid, a point in Roman numerals is added to the item in the list which corresponds to the cell.
|
5d32a495387cc38df7a2a546aee0747f
|
{
"intermediate": 0.3855268061161041,
"beginner": 0.15920811891555786,
"expert": 0.455265074968338
}
|
4,032
|
Please build a p5.js program thats a grid of 6 columns and 7 rows. To the left of the grid is a list of the cells, and each cell corresponds to it's own item on the list. Whenever somebody touches a cell of the grid, a point in Roman numerals is added to the item in the list which corresponds to the cell.
|
73d75cb352c1e43f2e42afcb8b27d990
|
{
"intermediate": 0.3855268061161041,
"beginner": 0.15920811891555786,
"expert": 0.455265074968338
}
|
4,033
|
in my code below I have tried everything to fix this issue in my form, why is this happening and help me fix:
the error that shows once i input details into db and click save:
System.Data.OleDb.OleDbException
HResult=0x80040E10
Message=No value given for one or more required parameters.
Source=System.Data
StackTrace:
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at ApplianceRental.AdminDashboardForm.saveButton_Click(Object sender, EventArgs e) in C:\Users\Kaddra52\source\repos\ApplianceRental\ApplianceRental\AdminDashboardForm.cs:line 70
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ApplianceRental.Program.Main() in C:\Users\Kaddra52\source\repos\ApplianceRental\ApplianceRental\Program.cs:line 19
Line :sda.Update(dt);
my full code for reference:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;
namespace ApplianceRental
{
public partial class AdminDashboardForm : Form
{
OleDbDataAdapter sda;
OleDbConnection con;
DataTable dt;
string connectionString = $@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source = {Path.Combine(Application.StartupPath, "db_users.mdb")}";
public AdminDashboardForm()
{
InitializeComponent();
con = new OleDbConnection(connectionString);
}
private void AdminDashboardForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'db_usersDataSet3.ApplianceDBLIST' table. You can move, or remove it, as needed.
this.applianceDBLISTTableAdapter3.Fill(this.db_usersDataSet3.ApplianceDBLIST);
string query = "SELECT * FROM ApplianceDBLIST";
sda = new OleDbDataAdapter(query, con);
dt = new DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt;
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void saveButton_Click(object sender, EventArgs e)
{
using (OleDbCommand insertCommand = new OleDbCommand("INSERT INTO ApplianceDBLIST ([Appliance], [Power Usage], [Typical Usage], [Estimated Annual Costs]) VALUES (?, ?, ?, ?)", con),
updateCommand = new OleDbCommand("UPDATE ApplianceDBLIST SET [Appliance]=?, [Power Usage]=?, [Typical Usage]=?, [Estimated Annual Costs]=? WHERE ID=?", con),
deleteCommand = new OleDbCommand("DELETE FROM ApplianceDBLIST WHERE ID=?", con))
{
sda.InsertCommand = insertCommand;
insertCommand.Parameters.Add("@Appliance", OleDbType.VarWChar, 0, "Appliance");
insertCommand.Parameters.Add("@Power_Usage", OleDbType.VarWChar, 0, "Power Usage");
insertCommand.Parameters.Add("@Typical_Usage", OleDbType.VarWChar, 0, "Typical Usage");
insertCommand.Parameters.Add("@Estimated_Annual_Costs", OleDbType.VarWChar, 0, "Estimated Annual Costs");
sda.UpdateCommand = updateCommand;
updateCommand.Parameters.Add("@Appliance", OleDbType.VarWChar, 0, "Appliance");
updateCommand.Parameters.Add("@Power_Usage", OleDbType.VarWChar, 0, "Power Usage");
updateCommand.Parameters.Add("@Typical_Usage", OleDbType.VarWChar, 0, "Typical Usage");
updateCommand.Parameters.Add("@Estimated_Annual_Costs", OleDbType.VarWChar, 0, "Estimated Annual Costs");
updateCommand.Parameters.Add("@ID", OleDbType.Integer, 0, "ID");
updateCommand.UpdatedRowSource = UpdateRowSource.None;
sda.DeleteCommand = deleteCommand;
deleteCommand.Parameters.Add("@ID", OleDbType.Integer, 0, "ID");
deleteCommand.UpdatedRowSource = UpdateRowSource.None;
con.Open();
sda.Update(dt);
con.Close();
dt.Clear();
sda.Fill(dt);
}
}
}
}
|
e920ea740a4323097c39dae883cc7af2
|
{
"intermediate": 0.3739336431026459,
"beginner": 0.41460564732551575,
"expert": 0.21146076917648315
}
|
4,034
|
fivem scripting
I'm working on a NUI
this is my javascript
window.addEventListener('message', function (event) {
switch (event.data.type) {
case "flashRedScreen":
$("#damage-ui").fadeIn(500)
setTimeout(() => {
$("#damage-ui").fadeOut(300)
}, 1500);
break;
}
});
getting the error
Uncaught ReferenceError: $ is not defined
|
a08ea068c617b2c86bc4129e0ffb9098
|
{
"intermediate": 0.3335774540901184,
"beginner": 0.38398030400276184,
"expert": 0.28244227170944214
}
|
4,035
|
Hello
|
6703f5fb9136a77b1f8b037321424500
|
{
"intermediate": 0.3123404085636139,
"beginner": 0.2729349136352539,
"expert": 0.4147246778011322
}
|
4,036
|
اريد كود في اندرويد ستوديو كوتلن حذف خلفية الصور ووضع صور جديدة يعمل بالذكاء الاصطناعي مجاناً
اريد استخدامة علي الصور المأخوذة بالكاميرا والصور الموجوده علي استوديو الصور علي الهاتف , اريد استخدام افضل طريقة لذلك وبالطبع اريد تقليل استهلاك الذاكرة اريد استخدامة علي الصور المأخوذة بالكاميرا والصور الموجوده علي استوديو الصور علي الهاتف , اريد استخدام افضل طريقة لذلك وبالطبع اريد تقليل استهلاك الذاكرة
الطريقه باستخدام TensorFlow Lite تكون مجانية اريد كود كاملا في Main Activity مع xml الخاص به
|
245490794224427cf7c4be8fdba35f8c
|
{
"intermediate": 0.32634565234184265,
"beginner": 0.3295406401157379,
"expert": 0.34411370754241943
}
|
4,037
|
ارجوا كتابة كود xml هذا الكود class MainActivity : AppCompatActivity() {
lateinit var interpreter: Interpreter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initializeModel()
}
private fun initializeModel() {
val assetManager = assets
val modelPath = “deeplab_model.tflite”
interpreter = Interpreter(loadModelFile(assetManager, modelPath))
}
private fun loadModelFile(assetManager: AssetManager, fileName: String): ByteBuffer {
val fileDescriptor = assetManager.openFd(fileName)
val inputStream = FileInputStream(fileDescriptor.fileDescriptor)
val fileChannel = inputStream.channel
val startOffset = fileDescriptor.startOffset
val declaredLength = fileDescriptor.declaredLength
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
}
private fun removeBackground(image: Bitmap): Bitmap {
val width = image.width
val height = image.height
val inputSize = 513
val resizeRatio = inputSize / max(width, height).toFloat()
val resizedWidth = (width * resizeRatio).toInt()
val resizedHeight = (height * resizeRatio).toInt()
val resizedImage = Bitmap.createScaledBitmap(image, resizedWidth, resizedHeight, true)
val convertedImage = Bitmap.createBitmap(resizedWidth, resizedHeight, Bitmap.Config.ARGB_8888)
// عملية إزالة الخلفية
val inputArray = arrayOf(arrayOf(Array(inputSize) { FloatArray(inputSize) } ))
val outputMap = HashMap<Int, Any>()
outputMap[0] = Array(resizedHeight) { Array(resizedWidth) { IntArray(1) } }
interpreter.runForMultipleInputsOutputs(arrayOf(resizedImage), outputMap)
// لوضع صورة جديدة بالخلفية
val newBackground = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(resources, R.drawable.image1), resizedWidth, resizedHeight, true)
val tempCanvas = Canvas(convertedImage)
tempCanvas.drawBitmap(newBackground, 0F, 0F, null)
for (i in 0 until resizedHeight) {
for (j in 0 until resizedWidth) {
val pixel = (outputMap[0] as Array<Array<IntArray>>)[i][j][0]
if (pixel != 0) {
convertedImage.setPixel(j, i, resizedImage.getPixel(j, i))
}
}
}
return convertedImage
}
} مع اضافة صلاحية الوصول الي الذاكرة
|
39dcea9c5f00e6b2f3358a9f05918ee8
|
{
"intermediate": 0.42992350459098816,
"beginner": 0.4071393609046936,
"expert": 0.16293713450431824
}
|
4,038
|
laravel 10 crud one to many
|
89ff1bc91fb8a80d77c25f315a662e88
|
{
"intermediate": 0.46943655610084534,
"beginner": 0.3424052596092224,
"expert": 0.18815822899341583
}
|
4,039
|
give me an example the expression to express a [2,3,4,5] matrix in python
|
eb721061c24f7c72427f16e1c0fd04c8
|
{
"intermediate": 0.42610469460487366,
"beginner": 0.15490899980068207,
"expert": 0.4189862906932831
}
|
4,040
|
ارجوا تعديل هذا الكود لربط كل جزء فيه بالأخر مع كتابة xml الخاص به بصورة جدية class MainActivity : AppCompatActivity() {
private lateinit var imageView: ImageView
private lateinit var selectedImageBitmap: Bitmap
private lateinit var backgroundBitmap: Bitmap
private val REQUEST_BACKGROUND_GALLERY = 101
private val REQUEST_IMAGE_GALLERY = 100
lateinit var interpreter: Interpreter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initializeModel()
imageView = findViewById(R.id.imageView)
// زر لاختيار الصورة
val pickImageButton = findViewById<Button>(R.id.pickImageButton)
pickImageButton.setOnClickListener {
pickImageFromGallery()
}
// زر لاختيار الخلفية الجديدة
val pickBackgroundButton = findViewById<Button>(R.id.pickBackgroundButton)
pickBackgroundButton.setOnClickListener {
pickBackgroundFromGallery()
}
// زر لإزالة الخلفية
val removeBackgroundButton = findViewById<Button>(R.id.removeBackgroundButton)
removeBackgroundButton.setOnClickListener {
val removedBackgroundBitmap = removeBackground(selectedImageBitmap)
imageView.setImageBitmap(removedBackgroundBitmap)
}
// زر لتركيب الصورتين
val mergeImagesButton = findViewById<Button>(R.id.mergeImagesButton)
mergeImagesButton.setOnClickListener {
val mergedBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(mergedBitmap)
}
}
private fun updateImageView() {
val newBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(newBitmap)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_IMAGE_GALLERY && resultCode == RESULT_OK && data != null) {
val imageUri = data.data
selectedImageBitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, imageUri)
updateImageView()
} else if (requestCode == REQUEST_BACKGROUND_GALLERY && resultCode == RESULT_OK && data != null) {
val backgroundUri = data.data
backgroundBitmap =
MediaStore.Images.Media.getBitmap(this.contentResolver, backgroundUri)
updateImageView()
} else {
Toast.makeText(this, "Error loading image", Toast.LENGTH_SHORT).show()
}
}
private fun mergeImages(imageBitmap: Bitmap, backgroundBitmap: Bitmap): Bitmap {
val mergedBitmap = Bitmap.createBitmap(
backgroundBitmap.width,
backgroundBitmap.height,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(mergedBitmap)
canvas.drawBitmap(backgroundBitmap, 0F, 0F, null)
canvas.drawBitmap(imageBitmap, 0F, 0F, null)
return mergedBitmap
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == REQUEST_BACKGROUND_GALLERY && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
pickBackgroundFromGallery()
}
}
private fun pickBackgroundFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_EXTERNAL_STORAGE),
REQUEST_BACKGROUND_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_BACKGROUND_GALLERY)
}
}
private fun pickImageFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_EXTERNAL_STORAGE),
REQUEST_IMAGE_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_IMAGE_GALLERY)
}
}
private fun initializeModel() {
val assetManager = assets
val modelPath = "deeplab_model.tflite"
interpreter = Interpreter(loadModelFile(assetManager, modelPath))
}
private fun loadModelFile(assetManager: AssetManager, fileName: String): ByteBuffer {
val fileDescriptor = assetManager.openFd(fileName)
val inputStream = FileInputStream(fileDescriptor.fileDescriptor)
val fileChannel = inputStream.channel
val startOffset = fileDescriptor.startOffset
val declaredLength = fileDescriptor.declaredLength
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
}
private fun removeBackground(image: Bitmap): Bitmap {
val width = image.width
val height = image.height
val inputSize = 513
val resizeRatio = inputSize / max(width, height).toFloat()
val resizedWidth = (width * resizeRatio).toInt()
val resizedHeight = (height * resizeRatio).toInt()
val resizedImage = Bitmap.createScaledBitmap(image, resizedWidth, resizedHeight, true)
val convertedImage =
Bitmap.createBitmap(resizedWidth, resizedHeight, Bitmap.Config.ARGB_8888)
// عملية إزالة الخلفية
val inputArray = arrayOf(arrayOf(Array(inputSize) { FloatArray(inputSize) }))
val outputMap = HashMap<Int, Any>()
outputMap[0] = Array(resizedHeight) { Array(resizedWidth) { IntArray(1) } }
interpreter.runForMultipleInputsOutputs(arrayOf(resizedImage), outputMap)
// لوضع صورة جديدة بالخلفية
val newBackground = Bitmap.createScaledBitmap(
BitmapFactory.decodeResource(resources, R.drawable.image1),
resizedWidth,
resizedHeight,
true
)
val tempCanvas = Canvas(convertedImage)
tempCanvas.drawBitmap(newBackground, 0F, 0F, null)
for (i in 0 until resizedHeight) {
for (j in 0 until resizedWidth) {
val pixel = (outputMap[0] as Array<Array<IntArray>>)[i][j][0]
if (pixel != 0) {
convertedImage.setPixel(j, i, resizedImage.getPixel(j, i))
}
}
}
return convertedImage
}
}
|
9e978b99318dbe82662576d346fa4407
|
{
"intermediate": 0.2238411009311676,
"beginner": 0.6896021962165833,
"expert": 0.08655665069818497
}
|
4,041
|
Using this p5.js code, this is a game for dragging letters from words into the correct order. The number of letters from the word is represented by black boxes, and letters are placed randomly on the screen for the user to drag into the correct place. My problem is that after I drag the letter into a box with a letter already on it, I need the letter that was previously there to move to the next position over to the other box, or if it's in the last position of the boxes, to then be placed at the beginning of the boxes while each subsequent letter is moved to the right. Here is the code: let words = [
"HEAD", "FACE", "EYE", "EAR", "NOSE",
"MOUTH", "TEETH", "TONGUE", "NECK", "SHOULDER",
"ARM", "ELBOW", "HAND", "FINGER", "THUMB",
"WRIST", "CHEST", "STOMACH", "BACK", "HIP",
"WAIST", "LEG", "THIGH", "KNEE", "ANKLE",
"FOOT", "HEEL", "TOE"
];
let currentWord;
let wordIndex;
let letterBoxes = [];
let draggedBox;
function setup() {
createCanvas(800, 600);
background(200);
startNewRound();
}
function draw() {
background(200);
// draw word placeholders
for (let i = 0; i < currentWord.length; i++) {
rect(width / 2 - (currentWord.length * 30) / 2 + i * 30, 100, 25, 30);
}
// display letter boxes
for (const box of letterBoxes) {
box.render();
}
}
function mousePressed() {
draggedBox = null;
for (const box of letterBoxes) {
if (box.isMouseInside()) {
draggedBox = box;
break;
}
}
}
function mouseDragged() {
if (draggedBox) {
draggedBox.moveTo(mouseX, mouseY);
}
}
function mouseReleased() {
if (draggedBox) {
let index = null;
for (let i = 0; i < currentWord.length; i++) {
let x = width / 2 - (currentWord.length * 30) / 2 + i * 30;
let y = 100;
if (dist(mouseX, mouseY, x + 25 / 2, y + 30 / 2) < 30) {
index = i;
break;
}
}
let posX = mouseX - 25 / 2;
let posY = mouseY - 30 / 2;
posX = constrain(posX, 0, width - 25);
posY = constrain(posY, 0, height - 30);
if (index !== null) {
// Find the direction to shift the other letters
const occupiedBox = letterBoxes.find(box => box.x === width / 2 - (currentWord.length * 30) / 2 + index * 30 && box.y === 100);
let shiftDirection = 1;
if (occupiedBox) {
const occupiedIndex = letterBoxes.indexOf(occupiedBox);
if (occupiedIndex < letterBoxes.length / 2) {
shiftDirection = -1;
}
}
// Shift the other letters
for (let i = 0; i < letterBoxes.length; i++) {
const box = letterBoxes[i];
if (box === draggedBox || box.y !== 100) {
continue;
}
if (shiftDirection === 1 && box.x >= width / 2 - (currentWord.length * 30) / 2 + index * 30) {
box.snapTo(box.x + 25 * shiftDirection, 100);
} else if (shiftDirection === -1 && box.x <= width / 2 - (currentWord.length * 30) / 2 + index * 30) {
box.snapTo(box.x + 25 * shiftDirection, 100);
}
}
draggedBox.snapTo(width / 2 - (currentWord.length * 30) / 2 + index * 30, 100);
} else {
draggedBox.moveTo(posX, posY);
}
draggedBox.homeX = posX;
draggedBox.homeY = posY;
if (checkComplete()) {
alert( "Well done!");
startNewRound();
}
}
}
// function mouseReleased() {
// if (draggedBox) {
// let index = null;
// for (let i = 0; i < currentWord.length; i++) {
// let x = width / 2 - (currentWord.length * 30) / 2 + i * 30;
// let y = 100;
// if (dist(mouseX, mouseY, x + 25 / 2, y + 30 / 2) < 30) {
// index = i;
// break;
// }
// }
// let posX = mouseX - 25 / 2;
// let posY = mouseY - 30 / 2;
// posX = constrain(posX, 0, width - 25);
// posY = constrain(posY, 0, height - 30);
// if (index !== null) {
// draggedBox.snapTo(width / 2 - (currentWord.length * 30) / 2 + index * 30, 100);
// } else {
// draggedBox.moveTo(posX, posY);
// }
// draggedBox.homeX = posX;
// draggedBox.homeY = posY;
// if (checkComplete()) {
// alert("Well done!");
// startNewRound();
// }
// }
// }
// function mouseReleased() {
// if (draggedBox) {
// let index = null;
// for (let i = 0; i < currentWord.length; i++) {
// let x = width / 2 - (currentWord.length * 30) / 2 + i * 30;
// let y = 100;
// if (dist(mouseX, mouseY, x + 25 / 2, y + 30 / 2) < 30) {
// index = i;
// break;
// }
// }
// if (index !== null) {
// draggedBox.snapTo(width / 2 - (currentWord.length * 30) / 2 + index * 30, 100);
// } else {
// draggedBox.snapBack();
// }
// if (checkComplete()) {
// alert("Well done!");
// startNewRound();
// }
// }
// }
// utility functions
// function startNewRound() {
// wordIndex = Math.floor(Math.random() * words.length);
// currentWord = words[wordIndex];
// letterBoxes = [];
// for (let i = 0; i < currentWord.length; i++) {
// let box = new LetterBox(currentWord[i]);
// let posX = Math.floor(Math.random() * (width - 50)) + 25;
// let posY = Math.floor(Math.random() * (height - 200)) + 150;
// box.moveTo(posX, posY);
// letterBoxes.push(box);
// }
// }
function startNewRound() {
wordIndex = Math.floor(Math.random() * words.length);
currentWord = words[wordIndex];
letterBoxes = [];
for (let i = 0; i < currentWord.length; i++) {
let box = new LetterBox(currentWord[i]);
let posX = Math.floor(Math.random() * (500 - 50)) + 25;
let posY = Math.floor(Math.random() * (300 - 50)) + 25;
box.moveTo(posX, posY);
box.homeX = posX;
box.homeY = posY;
letterBoxes.push(box);
}
}
function checkComplete() {
for (let i = 0; i < currentWord.length; i++) {
let correctBox = letterBoxes.find(box => box.letter === currentWord[i]);
if (!correctBox) return false;
let x = width / 2 - (currentWord.length * 30) / 2 + i * 30;
let y = 100;
if (correctBox.x !== x || correctBox.y !== y) return false;
}
return true;
}
class LetterBox {
constructor(letter) {
this.letter = letter;
this.x = 0;
this.y = 0;
this.homeX = 0;
this.homeY = 0;
}
moveTo(x, y) {
this.x = x - 25 / 2;
this.y = y - 30 / 2;
}
snapTo(x, y) {
this.x = x;
this.y = y;
}
snapBack() {
this.x = this.homeX;
this.y = this.homeY;
}
isMouseInside() {
return mouseX > this.x && mouseX < this.x + 25 && mouseY > this.y && mouseY < this.y + 30;
}
render() {
fill(255);
rect(this.x, this.y, 25, 30);
textSize(24);
textAlign(CENTER, CENTER);
fill(0);
text(this.letter, this.x + 25 / 2, this.y + 30 / 2 - 4);
}
}
|
00df4a56cbc3751ac4754b6ea54a2161
|
{
"intermediate": 0.3900214731693268,
"beginner": 0.4146333634853363,
"expert": 0.1953451782464981
}
|
4,042
|
اريد كود في اندرويد ستوديو كوتلن حذف خلفية الصور ووضع صور جديدة يعمل بالذكاء الاصطناعي مجاناً
اريد استخدامة علي الصور المأخوذة بالكاميرا والصور الموجوده علي استوديو الصور علي الهاتف , اريد استخدام افضل طريقة لذلك وبالطبع اريد تقليل استهلاك الذاكرة اريد استخدامة علي الصور المأخوذة بالكاميرا والصور الموجوده علي استوديو الصور علي الهاتف , اريد استخدام افضل طريقة لذلك وبالطبع اريد تقليل استهلاك الذاكرة
الطريقه باستخدام TensorFlow Lite تكون مجانية اريد كود كاملا في Main Activity مع xml الخاص به
|
407ccb461f6e4147887659e0749913b1
|
{
"intermediate": 0.32634565234184265,
"beginner": 0.3295406401157379,
"expert": 0.34411370754241943
}
|
4,043
|
في هذا الكود class MainActivity : AppCompatActivity() {
private lateinit var imageView: ImageView
private lateinit var selectedImageBitmap: Bitmap
private lateinit var backgroundBitmap: Bitmap
private val REQUEST_BACKGROUND_GALLERY = 101
private val REQUEST_IMAGE_GALLERY = 100
lateinit var interpreter: Interpreter
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initializeModel()
imageView = findViewById(R.id.imageView)
// زر لاختيار الصورة
val pickImageButton = findViewById<Button>(R.id.pickImageButton)
pickImageButton.setOnClickListener {
pickImageFromGallery()
}
// زر لاختيار الخلفية الجديدة
val pickBackgroundButton = findViewById<Button>(R.id.pickBackgroundButton)
pickBackgroundButton.setOnClickListener {
pickBackgroundFromGallery()
}
// زر لإزالة الخلفية
val removeBackgroundButton = findViewById<Button>(R.id.removeBackgroundButton)
removeBackgroundButton.setOnClickListener {
val removedBackgroundBitmap = removeBackground(selectedImageBitmap)
imageView.setImageBitmap(removedBackgroundBitmap)
}
// زر لتركيب الصورتين
val mergeImagesButton = findViewById<Button>(R.id.mergeImagesButton)
mergeImagesButton.setOnClickListener {
val mergedBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(mergedBitmap)
}
}
private fun updateImageView() {
val newBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(newBitmap)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_IMAGE_GALLERY && resultCode == RESULT_OK && data != null) {
val imageUri = data.data
selectedImageBitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, imageUri)
updateImageView()
} else if (requestCode == REQUEST_BACKGROUND_GALLERY && resultCode == RESULT_OK && data != null) {
val backgroundUri = data.data
backgroundBitmap =
MediaStore.Images.Media.getBitmap(this.contentResolver, backgroundUri)
updateImageView()
} else {
Toast.makeText(this, "Error loading image", Toast.LENGTH_SHORT).show()
}
}
private fun mergeImages(imageBitmap: Bitmap, backgroundBitmap: Bitmap): Bitmap {
val mergedBitmap = Bitmap.createBitmap(
backgroundBitmap.width,
backgroundBitmap.height,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(mergedBitmap)
canvas.drawBitmap(backgroundBitmap, 0F, 0F, null)
canvas.drawBitmap(imageBitmap, 0F, 0F, null)
return mergedBitmap
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == REQUEST_BACKGROUND_GALLERY && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
pickBackgroundFromGallery()
}
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun pickBackgroundFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_MEDIA_IMAGES
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES),
REQUEST_BACKGROUND_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_BACKGROUND_GALLERY)
}
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun pickImageFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_MEDIA_IMAGES
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES),
REQUEST_IMAGE_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_IMAGE_GALLERY)
}
}
private fun initializeModel() {
val assetManager = assets
val modelPath = "mobilenetv2_coco_voctrainval.tflite"
interpreter = Interpreter(loadModelFile(assetManager, modelPath))
}
private fun loadModelFile(assetManager: AssetManager, fileName: String): ByteBuffer {
val fileDescriptor = assetManager.openFd(fileName)
val inputStream = FileInputStream(fileDescriptor.fileDescriptor)
val fileChannel = inputStream.channel
val startOffset = fileDescriptor.startOffset
val declaredLength = fileDescriptor.declaredLength
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
}
private fun removeBackground(image: Bitmap): Bitmap {
val width = image.width
val height = image.height
val inputSize = 513
val resizeRatio = inputSize / max(width, height).toFloat()
val resizedWidth = (width * resizeRatio).toInt()
val resizedHeight = (height * resizeRatio).toInt()
val resizedImage = Bitmap.createScaledBitmap(image, resizedWidth, resizedHeight, true)
val convertedImage =
Bitmap.createBitmap(resizedWidth, resizedHeight, Bitmap.Config.ARGB_8888)
// عملية إزالة الخلفية
val inputArray = arrayOf(arrayOf(Array(inputSize) { FloatArray(inputSize) }))
val outputMap = HashMap<Int, Any>()
outputMap[0] = Array(resizedHeight) { Array(resizedWidth) { IntArray(1) } }
interpreter.runForMultipleInputsOutputs(arrayOf(resizedImage), outputMap)
// لوضع صورة جديدة بالخلفية
val newBackground = Bitmap.createScaledBitmap(
BitmapFactory.decodeResource(resources, R.drawable.image1),
resizedWidth,
resizedHeight,
true
)
val tempCanvas = Canvas(convertedImage)
tempCanvas.drawBitmap(newBackground, 0F, 0F, null)
for (i in 0 until resizedHeight) {
for (j in 0 until resizedWidth) {
val pixel = (outputMap[0] as Array<Array<IntArray>>)[i][j][0]
if (pixel != 0) {
convertedImage.setPixel(j, i, resizedImage.getPixel(j, i))
}
}
}
return convertedImage
}
} يحدث حطا FATAL EXCEPTION: main
Process: com.dm.myapplication, PID: 8529
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { dat=content://com.miui.gallery.open/... typ=image/jpeg flg=0x1 }} to activity {com.dm.myapplication/com.dm.myapplication.MainActivity}: kotlin.UninitializedPropertyAccessException: lateinit property backgroundBitmap has not been initialized
at android.app.ActivityThread.deliverResults(ActivityThread.java:5538)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5577)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2394)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8296)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property backgroundBitmap has not been initialized
at com.dm.myapplication.MainActivity.updateImageView(MainActivity.kt:75)
at com.dm.myapplication.MainActivity.onActivityResult(MainActivity.kt:84)
at android.app.Activity.dispatchActivityResult(Activity.java:8908)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5531)
|
1a361ecfbcdf0f13817ee4971959f62e
|
{
"intermediate": 0.26015424728393555,
"beginner": 0.6529200077056885,
"expert": 0.08692573755979538
}
|
4,044
|
this is aarch64 assembly language program.
Write sum_array recursively
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
c216897cf2ef35b3f12b8722f05f5beb
|
{
"intermediate": 0.28441861271858215,
"beginner": 0.3863059878349304,
"expert": 0.3292753994464874
}
|
4,045
|
في هذا الكود class MainActivity : AppCompatActivity() {
private lateinit var imageView: ImageView
private lateinit var selectedImageBitmap: Bitmap
private lateinit var backgroundBitmap: Bitmap
private val REQUEST_BACKGROUND_GALLERY = 101
private val REQUEST_IMAGE_GALLERY = 100
lateinit var interpreter: Interpreter
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initializeModel()
imageView = findViewById(R.id.imageView)
// زر لاختيار الصورة
val pickImageButton = findViewById<Button>(R.id.pickImageButton)
pickImageButton.setOnClickListener {
pickImageFromGallery()
}
// زر لاختيار الخلفية الجديدة
val pickBackgroundButton = findViewById<Button>(R.id.pickBackgroundButton)
pickBackgroundButton.setOnClickListener {
pickBackgroundFromGallery()
}
// زر لإزالة الخلفية
val removeBackgroundButton = findViewById<Button>(R.id.removeBackgroundButton)
removeBackgroundButton.setOnClickListener {
val removedBackgroundBitmap = removeBackground(selectedImageBitmap)
imageView.setImageBitmap(removedBackgroundBitmap)
}
// زر لتركيب الصورتين
val mergeImagesButton = findViewById<Button>(R.id.mergeImagesButton)
mergeImagesButton.setOnClickListener {
val mergedBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(mergedBitmap)
}
}
private fun updateImageView() {
val newBitmap = mergeImages(selectedImageBitmap, backgroundBitmap)
imageView.setImageBitmap(newBitmap)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_IMAGE_GALLERY && resultCode == RESULT_OK && data != null) {
val imageUri = data.data
selectedImageBitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, imageUri)
updateImageView()
} else if (requestCode == REQUEST_BACKGROUND_GALLERY && resultCode == RESULT_OK && data != null) {
val backgroundUri = data.data
backgroundBitmap =
MediaStore.Images.Media.getBitmap(this.contentResolver, backgroundUri)
updateImageView()
} else {
Toast.makeText(this, “Error loading image”, Toast.LENGTH_SHORT).show()
}
}
private fun mergeImages(imageBitmap: Bitmap, backgroundBitmap: Bitmap): Bitmap {
val mergedBitmap = Bitmap.createBitmap(
backgroundBitmap.width,
backgroundBitmap.height,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(mergedBitmap)
canvas.drawBitmap(backgroundBitmap, 0F, 0F, null)
canvas.drawBitmap(imageBitmap, 0F, 0F, null)
return mergedBitmap
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == REQUEST_BACKGROUND_GALLERY && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
pickBackgroundFromGallery()
}
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun pickBackgroundFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_MEDIA_IMAGES
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES),
REQUEST_BACKGROUND_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = “image/"
startActivityForResult(intent, REQUEST_BACKGROUND_GALLERY)
}
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun pickImageFromGallery() {
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_MEDIA_IMAGES
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES),
REQUEST_IMAGE_GALLERY
)
} else {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/”
startActivityForResult(intent, REQUEST_IMAGE_GALLERY)
}
}
private fun initializeModel() {
val assetManager = assets
val modelPath = “mobilenetv2_coco_voctrainval.tflite”
interpreter = Interpreter(loadModelFile(assetManager, modelPath))
}
private fun loadModelFile(assetManager: AssetManager, fileName: String): ByteBuffer {
val fileDescriptor = assetManager.openFd(fileName)
val inputStream = FileInputStream(fileDescriptor.fileDescriptor)
val fileChannel = inputStream.channel
val startOffset = fileDescriptor.startOffset
val declaredLength = fileDescriptor.declaredLength
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
}
private fun removeBackground(image: Bitmap): Bitmap {
val width = image.width
val height = image.height
val inputSize = 513
val resizeRatio = inputSize / max(width, height).toFloat()
val resizedWidth = (width * resizeRatio).toInt()
val resizedHeight = (height * resizeRatio).toInt()
val resizedImage = Bitmap.createScaledBitmap(image, resizedWidth, resizedHeight, true)
val convertedImage =
Bitmap.createBitmap(resizedWidth, resizedHeight, Bitmap.Config.ARGB_8888)
// عملية إزالة الخلفية
val inputArray = arrayOf(arrayOf(Array(inputSize) { FloatArray(inputSize) }))
val outputMap = HashMap<Int, Any>()
outputMap[0] = Array(resizedHeight) { Array(resizedWidth) { IntArray(1) } }
interpreter.runForMultipleInputsOutputs(arrayOf(resizedImage), outputMap)
// لوضع صورة جديدة بالخلفية
val newBackground = Bitmap.createScaledBitmap(
BitmapFactory.decodeResource(resources, R.drawable.image1),
resizedWidth,
resizedHeight,
true
)
val tempCanvas = Canvas(convertedImage)
tempCanvas.drawBitmap(newBackground, 0F, 0F, null)
for (i in 0 until resizedHeight) {
for (j in 0 until resizedWidth) {
val pixel = (outputMap[0] as Array<Array<IntArray>>)[i][j][0]
if (pixel != 0) {
convertedImage.setPixel(j, i, resizedImage.getPixel(j, i))
}
}
}
return convertedImage
}
} يحدث حطا FATAL EXCEPTION: main
Process: com.dm.myapplication, PID: 8529
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { dat=content://com.miui.gallery.open/… typ=image/jpeg flg=0x1 }} to activity {com.dm.myapplication/com.dm.myapplication.MainActivity}: kotlin.UninitializedPropertyAccessException: lateinit property backgroundBitmap has not been initialized
at android.app.ActivityThread.deliverResults(ActivityThread.java:5538)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5577)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThreadH.handleMessage(ActivityThread.java:2394)
at android.os.Handler.dispatchMessage(Handler.java:106) ارجوا اتعديل الاكواد ليعمل
|
c3af2a49caa6984225caddc13b18082a
|
{
"intermediate": 0.2821781039237976,
"beginner": 0.5258902311325073,
"expert": 0.19193170964717865
}
|
4,046
|
this is aarch64 assembly language program.
Write sum_array recursively
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
a254464656ac62a356e4b6cc0cb3675c
|
{
"intermediate": 0.28441861271858215,
"beginner": 0.3863059878349304,
"expert": 0.3292753994464874
}
|
4,047
|
this is aarch64 assembly language program.
Write sum_array function recursively
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
2dd3e6dac9a18572330c331c5c218392
|
{
"intermediate": 0.30068427324295044,
"beginner": 0.38864007592201233,
"expert": 0.3106756806373596
}
|
4,048
|
this is aarch64 assembly language program.
Write sum_array function recursively
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
e147320158f928e07aa09b93f87cc6a3
|
{
"intermediate": 0.30068427324295044,
"beginner": 0.38864007592201233,
"expert": 0.3106756806373596
}
|
4,049
|
this is aarch64 assembly language program.
Write sum_array function recursively
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
d07ca8dedcba7b83628c2550186971f7
|
{
"intermediate": 0.30068427324295044,
"beginner": 0.38864007592201233,
"expert": 0.3106756806373596
}
|
4,050
|
java code to draw a grid of music score lines and put some random scores on it
|
426ec14e95d9cf44b296c35610780998
|
{
"intermediate": 0.5031713843345642,
"beginner": 0.17422515153884888,
"expert": 0.32260340452194214
}
|
4,051
|
this is aarch64 assembly language program.
Write sum_array that computes the sum of all the values in the array in range. This function must use recursion to compute the sum
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
ba6b254e9ba2d611928feffe144df501
|
{
"intermediate": 0.27721571922302246,
"beginner": 0.3875029385089874,
"expert": 0.3352813422679901
}
|
4,052
|
this is aarch64 assembly language program.
Write sum_array that computes the sum of all the values in the array in range. This function must use recursion to compute the sum
Here is code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string “The original array is:\n”
.align 3
dupstr: .string “\n\nThe sorted duplicate array is:\n”
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string “%d”
.align 3
tab10dintstr: .string “%5d”
.align 3
nlstr: .string “\n”
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
b53cbef29ea4d9b4a7ab5b5406146b08
|
{
"intermediate": 0.27721571922302246,
"beginner": 0.3875029385089874,
"expert": 0.3352813422679901
}
|
4,053
|
can you do some nice monospace font for it looking?: <!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
--height: 10vh;
}
.background {
position: relative;
width: 2em;
height: 2em;
margin: 1em;
}
.background-icon-container {
position: absolute;
top: 2em;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.background-icon {
font-size: 20em;
}
.background-text-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
}
.background-text {
font-size: 0.2em;
line-height: 1.1em;
}
</style>
</head>
<body>
<div class="background-container">
<div class="background-icon-container">
<span class="background-icon">🇬🇧</span>
</div>
<div class="background-text-container">
<span class="background-text">YES, WE CARE!</span>
</div>
</div>
</body>
</html>
|
4a123a715a2009ba94c65b2f77c8e3aa
|
{
"intermediate": 0.42049798369407654,
"beginner": 0.30630993843078613,
"expert": 0.2731921374797821
}
|
4,054
|
can you do some nice font for it looking?:<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
--height: 10vh;
}
.background {
position: relative;
width: 2em;
height: 2em;
margin: 1em;
}
.background-icon-container {
position: absolute;
top: 2em;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.background-icon {
font-size: 20em;
}
.background-text-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
}
.background-text {
font-size: 0.2em;
line-height: 1.1em;
}
</style>
</head>
<body>
<div class="background-container">
<div class="background-icon-container">
<span class="background-icon">🇬🇧</span>
</div>
<div class="background-text-container">
<span class="background-text">YES, WE CARE!</span>
</div>
</div>
</body>
</html>
|
0551e622b18455054c7dd2e40e5b73a5
|
{
"intermediate": 0.4281260073184967,
"beginner": 0.32080090045928955,
"expert": 0.25107306241989136
}
|
4,055
|
This is aarch64 assembly language program. Write sum_array function recursively.
Here is the code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string "The original array is:\n"
.align 3
dupstr: .string "\n\nThe sorted duplicate array is:\n"
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string "%d"
.align 3
tab10dintstr: .string "%5d"
.align 3
nlstr: .string "\n"
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type sum_array, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
3662eeab593192ddf1234ea2eb1ef26c
|
{
"intermediate": 0.2607567310333252,
"beginner": 0.3459234833717346,
"expert": 0.3933198153972626
}
|
4,056
|
This is aarch64 assembly language program. Write sum_array function recursively.
Here is the code:
.section .rodata
getnstr: .string "Enter a value of n: "
.align 3
origstr: .string "The original array is:\n"
.align 3
dupstr: .string "\n\nThe sorted duplicate array is:\n"
.align 3
dupstr2: .string "\n\nThe average of the duplicate array is: "
intstr: .string "%d"
.align 3
tab10dintstr: .string "%5d"
.align 3
nlstr: .string "\n"
.align 3
.section .bss
n: .skip 4
n16: .skip 4
.section .text
.global main
.type main, @function
main:
stp x29, x30, [sp, #-16]! // main prolog
// Generate a seed to be used by srand and set the seed for the random number generator
mov x0, 0
bl time
bl srand
// prompt the user to enter their TCU id number
ldr x0, =getnstr
bl printf
ldr x0, =intstr
ldr x1, =n
bl scanf
// Check if the TCU id number is even
ldr x0, =n
and x0, x0, #1
cmp x0, #0
beq even
mov x0, #33
ldr x1, =n
str x0, [x1]
b endgetnstr
even:
mov x0, #42
ldr x1, =n
str x0, [x1]
endgetnstr:
// compute next highest multiple of 16 that is bigger or equal to n
adr x1, n
ldr w1, [x1]
sbfiz x1, x1, #2, #20
add x1, x1, #0xf
and x1, x1, #0xfffffffffffffff0
adr x2, n16
str w1, [x2]
// create the storage for “n” integers (namely orig array) on stack pointer
sub sp, sp, x1
// call init_array
mov x0, sp // move address of orig array to x0
bl init_array
// print orig array
ldr x0, =origstr
bl printf
mov x0, sp
bl print_array
// create the storage for “n” integers (namely dup array) on stack pointer
adr x2, n16
ldr w2, [x2]
sub sp, sp, x2
// call copy_array
mov x0, sp // address of dup array
add x1, sp, x2 // address of orig array
bl copy_array
// call insertion_sort
mov x0, sp // address of dup array
bl insertion_sort
// print dup array
ldr x0, =dupstr
bl printf
mov x0, sp
bl print_array
ldr x0, =nlstr
bl printf
// call compute_average
ldr x0, =dupstr2
bl printf
mov x0, sp // address of dup array
bl compute_average
// print out the average to standard output
ldr x0, =intstr
bl printf
// restore storage for “n” integers (namely dup array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
// restore storage for “n” integers (namely orig array) on stack pointer
adr x1, n16
ldr x1, [x1]
add sp, sp, x1
ldp x29, x30, [sp], #16 // main epilog
mov x0, #0
ret
.type init_array, @function
init_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop1:
cmp x19, x20
bge endloop1
// save random value to sp array
bl rand
and w0, w0, #255
str w0, [x21, x19, lsl 2]
add x19, x19, #1
b loop1
endloop1:
ldp x29, x30, [sp], #16 //function epilog
ret
.type print_array, @function
print_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0
loop2:
// restore x1, x2 from sp
cmp x19, x20
bge endloop2
ldr x0, =tab10dintstr
ldr w1, [x21, x19, lsl 2]
bl printf
add x19, x19, #1
// check if x19 is multiple of 5, if yes print nlstr
mov x22, #5
sdiv x23, x19, x22
mul x24, x23, x22
cmp x24, x19
bne continue_loop2
ldr x0, =nlstr
bl printf
continue_loop2:
b loop2
endloop2:
ldp x29, x30, [sp], #16 //function epilog
ret
.type copy_array, @function
copy_array:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x1 // address of orig array
mov x22, x0 // address of dup array
loop3:
cmp x19, x20
bge endloop3
ldr w23, [x21, x19, lsl 2] // load value from orig array
str w23, [x22, x19, lsl 2] // store value to dup array
add x19, x19, #1
b loop3
endloop3:
ldp x29, x30, [sp], #16 //function epilog
ret
.type compute_average, @function
compute_average:
stp x29, x30, [sp, #-16]! //function prolog
mov x19, #0 // loop counter
ldr x20, =n
ldr w20, [x20]
mov x21, x0 // address of dup array
mov x1, #0 // startidx = 0
mov x2, x20 // stopidx = n
bl sum_array
mov x22, x0 // put result of sum_array
endloop4:
udiv x1, x22, x20
ldp x29, x30, [sp], #16 //function epilog
ret
.type sum_array, @function
sum_array:
stp x29, x30, [sp, #-16]! //function prolog
// x0 has address of dup array
// x1 has startidx
// x2 has stopidx
ldp x29, x30, [sp], #16 //function epilog
ret
.type insertion_sort, @function
insertion_sort:
stp x29, x30, [sp, #-16]! // function prolog
mov x29, sp
ldr x20, =n
ldr w20, [x20] // n
// for i = 1 to n-1
mov x19, #1
outer_loop:
cmp x19, x20
bge end_outer_loop
mov x23, x19
ldr w22, [x0, x23, lsl 2] // key = array[i]
// for j = i-1; j >= 0 and array[j] > key
sub x24, x19, #1
inner_loop:
cmp x24, #0
blt end_inner_loop
ldr w25, [x0, x24, lsl 2] // array[j]
cmp w25, w22
bls end_inner_loop
// array[j+1] = array[j]
add x26, x24, #1
str w25, [x0, x26, lsl 2]
sub x24, x24, #1
b inner_loop
end_inner_loop:
add x27, x24, #1
str w22, [x0, x27, lsl 2] // array[j+1] = key
add x19, x19, #1
b outer_loop
end_outer_loop:
ldp x29, x30, [sp], #16 // function epilog
ret
|
9899ea96b1a4d05997ecb3e8f46ce77c
|
{
"intermediate": 0.2607567310333252,
"beginner": 0.3459234833717346,
"expert": 0.3933198153972626
}
|
4,057
|
can you 3d transform "background-container" in all axis randomly?: <!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.background {
position: relative;
width: 2em;
height: 2em;
margin: 1em;
}
.background-icon-container {
position: absolute;
top: 2em;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.background-icon {
font-size: 20em;
}
.background-text-container {
position: absolute;
top: 50%;
left: 51%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
color:white;
}
.background-text {
font-size: 2em;
line-height: 1.1em;
}
</style>
</head>
<body>
<div class="background-container">
<div class="background-icon-container">
<span class="background-icon">🇬🇧</span>
</div>
<div class="background-text-container">
<span class="background-text">YES, WE CARE!</span>
</div>
</div>
</body>
</html>
|
a1177f24ccc52e644b3d2d29b263d969
|
{
"intermediate": 0.44686830043792725,
"beginner": 0.23962527513504028,
"expert": 0.31350645422935486
}
|
4,058
|
can you 3d transform anim "background-container" in all axis randomly without jvascrips?: <!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.background {
position: relative;
width: 2em;
height: 2em;
margin: 1em;
}
.background-icon-container {
position: absolute;
top: 2em;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.background-icon {
font-size: 20em;
}
.background-text-container {
position: absolute;
top: 50%;
left: 51%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
color:white;
}
.background-text {
font-size: 2em;
line-height: 1.1em;
}
</style>
</head>
<body>
<div class="background-container">
<div class="background-icon-container">
<span class="background-icon">🇬🇧</span>
</div>
<div class="background-text-container">
<span class="background-text">YES, WE CARE!</span>
</div>
</div>
</body>
</html>
|
7411dcb4fba473e9f9296074ef7898d4
|
{
"intermediate": 0.4461553394794464,
"beginner": 0.24637527763843536,
"expert": 0.3074694275856018
}
|
4,059
|
can you 3d transform anim "background-container" in all axis randomly without jvascrips?: <!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.background {
position: relative;
width: 2em;
height: 2em;
margin: 1em;
}
.background-icon-container {
position: absolute;
top: 2em;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.background-icon {
font-size: 20em;
}
.background-text-container {
position: absolute;
top: 50%;
left: 51%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
color:white;
}
.background-text {
font-size: 2em;
line-height: 1.1em;
}
</style>
</head>
<body>
<div class="background-container">
<div class="background-icon-container">
<span class="background-icon">🇬🇧</span>
</div>
<div class="background-text-container">
<span class="background-text">YES, WE CARE!</span>
</div>
</div>
</body>
</html>
|
9e83a8879a4de2785178e496cb7c8856
|
{
"intermediate": 0.4461553394794464,
"beginner": 0.24637527763843536,
"expert": 0.3074694275856018
}
|
4,060
|
Which flag will give you an interactive SQL Shell prompt in sql map?
|
db364c09999a1b1ed43c3a7789293c83
|
{
"intermediate": 0.5046325325965881,
"beginner": 0.2547041177749634,
"expert": 0.2406633198261261
}
|
4,061
|
Your program will create an array of random int numbers, search the array to see if any two elements add to a specific number, and display the results. The size of the array and the specific number to be searched for are defined by user input (and hence, can vary on each run of the program).
Your code should comply with standard Java style guidelines (such as those established in Chapter 1.2 of the textbook and demonstrated in class throughout the term). Please read the question fully; it is recommended that you take notes of key points as you read.
The functionality of your program should include the following behaviors:
Welcome the user to the program and give a brief explanation of what to expect or the purpose of the program.
Prompt the user for a positive whole number; if a non-integer, zero, or negative number is entered prompt repeatedly until a positive whole number is entered.
Once a number is properly entered, create an array of that number of int values and give each element of the array a random value between 1 and 20. Display the array contents to the user.
Prompt the user for a target number they wish to search for as the sum of any two elements of the array. If a non-integer is entered prompt repeatedly until a whole number is entered.
If the target number is less than 2 or greater than 40 (and, hence, cannot be the sum of any two numbers in any generated random array), tell the user that the target number cannot possibly be in the array.
If the target number is from 2 to 40, search the array, and indicate if the target sum was found anywhere in the array or not. If the target sum was found display the array indexes of the numbers that formed the sum (see examples below).
Example output:
Welcome to my program! It creates a random number array and checks to see if any two elements add to a given target!
Enter the size for the array of random numbers: 19
What sum of any two array elements shall I search for? 4
Here's the array: [1, 14, 19, 16, 18, 7, 9, 16, 20, 20, 12, 10, 3, 1, 4, 6, 3, 12, 9]
Elements 0 and 12 add to 4.
Another example output:
Welcome to my program! It creates a random number array and checks to see if any two elements add to a given target!
Enter the size for the array of random numbers: 6
What sum of any two array elements shall I search for? 13
Here's the array: [7, 9, 7, 9, 11, 8]
No pair of elements add to 13.
And one more example output:
Welcome to my program! It creates a random number array and checks to see if any two elements add to a given target!
Enter the size for the array of random numbers: fish
Invalid input, try again.
Enter the size for the array of random numbers: 0
Invalid input, must be 1 or more, try again.
Enter the size for the array of random numbers: do not care
Invalid input, try again.
Enter the size for the array of random numbers: -6
Invalid input, must be 1 or more, try again.
Enter the size for the array of random numbers: 12
What sum of any two array elements shall I search for? 12
Here's the array: [3, 13, 6, 14, 18, 13, 5, 20, 1, 2, 6, 13]
Elements 2 and 10 add to 12.
Coding specifications:
Your code must be divided into main and at least three more methods, which have parameters and/or return some value.
At least one method must have an array as a parameter.
At least one method must return an array.
Your code must compile in the standard tools used in class.
Style & Technique Considerations
Your code should not contain any magic numbers (numbers other than 0 or 1 should be replaced with named constants).
Do not use the break statement. Nor the continue statement.
Be sure to follow proper naming and capitalization conventions.
Comment your code: provide a block comment at the top of each method describing what it does. Include comments throughout the code where appropriate to explain important steps.
|
de21261b8295217e9ca43b0506bb3a93
|
{
"intermediate": 0.4697169363498688,
"beginner": 0.23382142186164856,
"expert": 0.29646167159080505
}
|
4,062
|
Create the snake game in python
|
cd128b6bdd6ab387a65599c1b12a56c3
|
{
"intermediate": 0.35614657402038574,
"beginner": 0.27578112483024597,
"expert": 0.3680723011493683
}
|
4,063
|
Berikut merupakan kode python analisis sentimen LSTM yang memanfaatkan Gaussian Process Optimization untuk mendapatkan kombinasi parameter dengan akurasi model terbaik.
"import pickle
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from keras.preprocessing.text import Tokenizer
from keras.utils import pad_sequences
from keras.models import Sequential
from keras.layers import LSTM, Dense, Embedding, SpatialDropout1D, Dropout
from keras.callbacks import EarlyStopping
from keras.optimizers import Adam
from sklearn.metrics import classification_report
from skopt import gp_minimize
from skopt.space import Real, Integer, Categorical
from skopt.utils import use_named_args
def create_model(vocab_size, sequence_length, embedding_dim, lstm_units, dropout_rate, learning_rate):
model = Sequential()
model.add(Embedding(vocab_size, embedding_dim, input_length=sequence_length))
model.add(SpatialDropout1D(dropout_rate))
model.add(LSTM(lstm_units, dropout=dropout_rate, recurrent_dropout=dropout_rate))
model.add(Dense(3, activation=‘softmax’))
optimizer = Adam(lr=learning_rate)
model.compile(loss=‘sparse_categorical_crossentropy’, optimizer=optimizer, metrics=[‘accuracy’])
return model
# Your existing code to prepare the dataset and perform train-test split goes here…
space = [Integer(50, 150, name=‘embedding_dim’),
Integer(50, 100, name=‘lstm_units’),
Real(0.1, 0.5, name=‘dropout_rate’),
Real(1e-4, 1e-1, “log-uniform”, name=‘learning_rate’)]
@use_named_args(space)
def objective(**params):
print(“Trying parameters:”, params)
model = create_model(max_vocab_size, max_sequence_length,
params[“embedding_dim”], params[“lstm_units”],
params[“dropout_rate”], params[“learning_rate”])
history = model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor=‘val_loss’, patience=3, min_delta=0.0001)])
# Evaluate model on the test set
acc = model.evaluate(X_test_padded, y_test)[1]
print(“Accuracy for parameter combination:”, acc)
# Minimize the negative accuracy (as gp_minimize tries to minimize the objective)
return -acc
# Search for the best parameter combination
res_gp = gp_minimize(objective, space, n_calls=10, random_state=0, verbose=True)
print(“Best parameters found:”, res_gp.x)
# Train the model with the best parameters
best_model = create_model(max_vocab_size, max_sequence_length,
res_gp.x[0], res_gp.x[1],
res_gp.x[2], res_gp.x[3])
best_model_history = best_model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor=‘val_loss’, patience=3, min_delta=0.0001)])
best_model_acc = best_model.evaluate(X_test_padded, y_test)[1]
print(‘Best model accuracy on test data:’, best_model_acc)
# Save the best model to .h5 file
best_model.save(“best_model.h5”)
# Save the tokenizer to a .pkl file
with open(‘tokenizer.pkl’, ‘wb’) as f:
pickle.dump(tokenizer, f)
Modifikasi kode tersebut dengan mengubahnya menjadi menggunakan Bayesian Optimization dengan Gaussian Process untuk mengoptimalkan parameter analisis sentimen LSTM untuk mendapatkan akurasi model terbaik. Parameter yang dicoba-coba adalah:
1. Jumlah unit LSTM
2. Jumlah lapisan LSTM
3. Dimensi Embedding
4. Learning rate
5. Dropout rate
6. Ukuran batch
7. Optimizer (misalnya SGD, Adam, RMSprop)
8. Ukuran vocab
10. Panjang maksimum urutan
11. Fungsi loss (misalnya binary_crossentropy atau categorical_crossentropy)
|
ca75c3ec8762ac64af5084daea2f80cc
|
{
"intermediate": 0.28860071301460266,
"beginner": 0.36462122201919556,
"expert": 0.34677809476852417
}
|
4,064
|
add_custom_command(TARGET my_exe POST_BUILD COMMAND ${CMAKE_COMMAND} -e copy_if_different "${DLL_PATH}" $<TARGET_FILE_DIR:my_exe>) got error: "MSB3073 The command 'setlocal ... if %errorlevel% neq 0 goto :cmEnd :cmEnd ... existed with code 1", how do i fix it.
|
b4446194998e6e1fa88ff739f850be27
|
{
"intermediate": 0.6385342478752136,
"beginner": 0.1579170972108841,
"expert": 0.20354866981506348
}
|
4,065
|
list indices for measuring live stream performance
|
7ed4d025622aed8f2ea019747abf9da4
|
{
"intermediate": 0.35317572951316833,
"beginner": 0.34768009185791016,
"expert": 0.2991441488265991
}
|
4,066
|
how can i display HTML in a IPhone notebook ?
|
6507b95c5fb81297d7e8b987eaec2074
|
{
"intermediate": 0.5284528732299805,
"beginner": 0.27352529764175415,
"expert": 0.1980217844247818
}
|
4,067
|
fivem scripting
I'm working on a table NUI
how would i create a table and then get data from a format like this
{[1] = {['name'] = 'BOB', ['age'] = 18}} and show that data on the NUI
|
7051b99b5771482f9b42d4b3c9ba451b
|
{
"intermediate": 0.6421399116516113,
"beginner": 0.17902785539627075,
"expert": 0.1788322478532791
}
|
4,068
|
need more than 2 values to
|
b887882ca71575b2cd416b87828f7191
|
{
"intermediate": 0.37106749415397644,
"beginner": 0.31217989325523376,
"expert": 0.3167526423931122
}
|
4,069
|
so, what actual set makes text readable in different background colors as for mix-blend-mode?: .background-text-container {
position: relative;
top: 50%;
left: 49%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
white-space: nowrap;
text-align: center;
background-color: rgba(55,255,55,0);
color: rgba(255,150,200,1);
mix-blend-mode: exclusion;
}
|
7b6c859335150b382c475ca7c8bb8dd5
|
{
"intermediate": 0.4115262031555176,
"beginner": 0.2402382344007492,
"expert": 0.348235547542572
}
|
4,070
|
fivem scripting NUI
I'm using Datatable
I want to create a table with the columns
Date, Agent, Buyer, Price, Adress
|
c2265f7f2451fd28f2561b6563242647
|
{
"intermediate": 0.453935444355011,
"beginner": 0.1254153996706009,
"expert": 0.4206491708755493
}
|
4,071
|
Berikut merupakan kode python analisis sentimen LSTM yang memanfaatkan Gaussian Process Optimization untuk mendapatkan kombinasi parameter dengan akurasi model terbaik.
import pickle
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from keras.preprocessing.text import Tokenizer
from keras.utils import pad_sequences
from keras.models import Sequential
from keras.layers import LSTM, Dense, Embedding, SpatialDropout1D, Dropout
from keras.callbacks import EarlyStopping
from keras.optimizers import Adam
from sklearn.metrics import classification_report
from skopt import gp_minimize
from skopt.space import Real, Integer, Categorical
from skopt.utils import use_named_args
def create_model(vocab_size, sequence_length, embedding_dim, lstm_units, dropout_rate, learning_rate):
model = Sequential()
model.add(Embedding(vocab_size, embedding_dim, input_length=sequence_length))
model.add(SpatialDropout1D(dropout_rate))
model.add(LSTM(lstm_units, dropout=dropout_rate, recurrent_dropout=dropout_rate))
model.add(Dense(3, activation='softmax'))
optimizer = Adam(lr=learning_rate)
model.compile(loss='sparse_categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])
return model
# Membaca dataset
data_list = pickle.load(open('pre_processed_beritaFIX_joined.pkl', 'rb'))
data = pd.DataFrame(data_list, columns=['judul', 'isi', 'pre_processed', 'Label'])
data['Isi Berita'] = data['pre_processed']
# Mengkodekan label
le = LabelEncoder()
data['label_encoded'] = le.fit_transform(data['Label'])
# Memisahkan data latih dan data uji
X_train, X_test, y_train, y_test = train_test_split(data['Isi Berita'], data['label_encoded'], test_size=0.25, random_state=42)
# Tokenisasi dan padding
max_vocab_size = 10000
max_sequence_length = 250
tokenizer = Tokenizer(num_words=max_vocab_size)
tokenizer.fit_on_texts(X_train)
X_train_sequences = tokenizer.texts_to_sequences(X_train)
X_test_sequences = tokenizer.texts_to_sequences(X_test)
X_train_padded = pad_sequences(X_train_sequences, maxlen=max_sequence_length)
X_test_padded = pad_sequences(X_test_sequences, maxlen=max_sequence_length)
# Melatih model dengan data latih
epochs = 10
batch_size = 64
# Gaussian Process Optimization
space = [Integer(50, 150, name='embedding_dim'),
Integer(50, 100, name='lstm_units'),
Real(0.1, 0.5, name='dropout_rate'),
Real(1e-4, 1e-1, "log-uniform", name='learning_rate')]
@use_named_args(space)
def objective(**params):
print("Trying parameters:", params)
model = create_model(max_vocab_size, max_sequence_length,
params["embedding_dim"], params["lstm_units"],
params["dropout_rate"], params["learning_rate"])
history = model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor='val_loss', patience=3, min_delta=0.0001)])
# Evaluate model on the test set
acc = model.evaluate(X_test_padded, y_test)[1]
print("Accuracy for parameter combination:", acc)
# Minimize the negative accuracy (as gp_minimize tries to minimize the objective)
return -acc
# Search for the best parameter combination
res_gp = gp_minimize(objective, space, n_calls=10, random_state=0, verbose=True)
print("Best parameters found:", res_gp.x)
# Train the model with the best parameters
best_model = create_model(max_vocab_size, max_sequence_length,
res_gp.x[0], res_gp.x[1],
res_gp.x[2], res_gp.x[3])
best_model_history = best_model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor='val_loss', patience=3, min_delta=0.0001)])
best_model_acc = best_model.evaluate(X_test_padded, y_test)[1]
print('Best model accuracy on test data:', best_model_acc)
# Save the best model to .h5 file
best_model.save("best_model.h5")
# Save the tokenizer to a .pkl file
with open('tokenizer.pkl', 'wb') as f:
pickle.dump(tokenizer, f)
Modifikasi kode tersebut dengan mengubahnya menjadi menggunakan Bayesian Optimization dengan Gaussian Process untuk mengoptimalkan parameter analisis sentimen LSTM untuk mendapatkan akurasi model terbaik. Parameter yang dicoba-coba adalah:
1. Jumlah unit LSTM
2. Jumlah lapisan LSTM
3. Dimensi Embedding
4. Learning rate
5. Dropout rate
6. Ukuran batch
7. Optimizer (misalnya SGD, Adam, RMSprop)
8. Ukuran vocab
10. Panjang maksimum urutan
11. Fungsi loss (misalnya binary_crossentropy atau categorical_crossentropy)
|
5330e24319c93c5503489c0f8bf46c5a
|
{
"intermediate": 0.3267706632614136,
"beginner": 0.32471638917922974,
"expert": 0.3485129177570343
}
|
4,072
|
I want to open a workbook and automatically default to a particular sheet. What is the best way of doing this in excel
|
10b0d005bb5d73c9417b1752ec6cc506
|
{
"intermediate": 0.4093770384788513,
"beginner": 0.2784707844257355,
"expert": 0.31215211749076843
}
|
4,073
|
在使用python,matplotlib绘图时报错Glyph 21482 (\N{CJK UNIFIED IDEOGRAPH-53EA}) missing from current font.怎么解决
|
7460d7ca70666b5391ea9c74fa2e4760
|
{
"intermediate": 0.45608094334602356,
"beginner": 0.24744489789009094,
"expert": 0.29647406935691833
}
|
4,074
|
package com.saket.demo.proxy;
import java.util.ArrayList;
import java.util.List;
public class ProxyInternet implements Internet
{
private Internet internet = new RealInternet();
private static List<String> bannedSites;
static
{
bannedSites = new ArrayList<String>();
bannedSites.add("abc.com");
bannedSites.add("def.com");
bannedSites.add("ijk.com");
bannedSites.add("lnm.com");
}
@Override
public void connectTo(String serverhost) throws Exception
{
if(bannedSites.contains(serverhost.toLowerCase()))
{
throw new Exception("Access Denied");
}
internet.connectTo(serverhost);
}
}
which dependencies is needed for this code
|
f113d319f4a59815b1f4668174ccfbb9
|
{
"intermediate": 0.4421786069869995,
"beginner": 0.299979031085968,
"expert": 0.2578423321247101
}
|
4,075
|
// Initialize Datatable
$(document).ready(function() {
//$("#body").hide()
$('#myTable').DataTable({
data: [],
columns: [
{ data: 'date' },
{ data: 'agent' },
{ data: 'buyer' },
{ data: 'price' },
{ data: 'address' }
]
});
});
// Function to add a new row to the table
function addRow(date, agent, buyer, price, address) {
console.log(date);
console.log(agent);
console.log(buyer);
console.log(price);
console.log(address);
var table = $('#myTable').DataTable();
console.log(table);
table.row.add({
date: date,
agent: agent,
buyer: buyer,
price: price,
address: address
}).draw();
}
addRow('01/01/2022', 'John Doe', 'Jane Doe', '$100,000', '1234 Main St.');
I'm using datatable
for some reason the addRow function is console.logging the correct data its just not adding to the table and updating
|
acb4bac4360fdef499b6e087d559ad8d
|
{
"intermediate": 0.4391650855541229,
"beginner": 0.3688162863254547,
"expert": 0.19201862812042236
}
|
4,076
|
Hi
|
d5f82fcf7f825e80843906e62cedfe2b
|
{
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
}
|
4,077
|
Will this code work for not equal to? if not hen correct it. if condition in ['>', '<', '=', '>=', '<=']:
signs_dict = {'>':'gt', '>=':'ge', '<':'lt', '<=':'le', '=':'eq', '==':'eq', '!=':'ne'}
df_ = df.loc[getattr(df[col1], signs_dict.get(condition, '<'))(df[col2])]
|
dfb43abe111cfe5823d45dad7637bfcd
|
{
"intermediate": 0.44405874609947205,
"beginner": 0.33032092452049255,
"expert": 0.2256203293800354
}
|
4,078
|
In this p5.js code, I'm building a grid with a button that selects a random cell in the grid. In the code I've attached, please color the cell background red instead of there being an X drawn over the cell when the random button is pressed. Here is the code: const button = document.querySelector("button");
const cellSize = 50;
const selectedCells = [];
function setup() {
let canvas = createCanvas(7 * cellSize, 8 * cellSize, WEBGL);
canvas.parent("sketch-holder");
}
function draw() {
background(255);
translate(-width / 2, -height / 2);
drawGrid();
drawSelectedCells();
drawLabels();
}
function drawGrid() {
for (let i = 0; i < 7; i++) {
for (let j = 0; j < 8; j++) {
stroke(0);
noFill();
rect(i * cellSize, j * cellSize, cellSize, cellSize);
}
}
}
// function drawSelectedCells() {
// textSize(24);
// fill(0);
// textAlign(CENTER, CENTER);
// for (const cell of selectedCells) {
// const x1 = cell.col * cellSize + cellSize / 2;
// const y1 = cell.row * cellSize + cellSize / 2;
// }
// }
function drawSelectedCells() {
stroke(255, 0, 0);
for (const cell of selectedCells) {
let x1 = cell.col * cellSize;
let y1 = cell.row * cellSize;
line(x1, y1, x1 + cellSize, y1 + cellSize);
line(x1, y1 + cellSize, x1 + cellSize, y1);
// text("😀", x1, y1);
}
}
function selectRandomPosition() {
if (selectedCells.length >= 7 * 8) {
alert("All cells have been selected.");
return;
}
let col, row;
do {
col = floor(random(7));
row = floor(random(8));
} while (isSelected(col, row));
selectedCells.push({ col, row });
}
function isSelected(col, row) {
return selectedCells.some(cell => cell.col === col && cell.row === row);
}
function drawLabels() {
textSize(20);
fill(0);
textAlign(CENTER, CENTER);
for (let i = 0; i < 7; i++) {
text(i + 1, i * cellSize + cellSize / 2 + 50, 25);
}
for (let j = 0; j < 8; j++) {
text(j + 1, 25, j * cellSize + cellSize / 2 + 50);
}
}
|
7593c6f6e0448265983f09db21ef7d2d
|
{
"intermediate": 0.38222751021385193,
"beginner": 0.3924037218093872,
"expert": 0.22536875307559967
}
|
4,079
|
嵌套查询和派生表有什么区别,用例子解释
|
e704c741782ada47b8fd2b1de64371ff
|
{
"intermediate": 0.32159680128097534,
"beginner": 0.3302035927772522,
"expert": 0.3481995463371277
}
|
4,080
|
add data form html and display it in table by php
|
02ce54d949c92e104d92c5b8735eb34d
|
{
"intermediate": 0.4605269432067871,
"beginner": 0.15756408870220184,
"expert": 0.381909042596817
}
|
4,081
|
Can you write me a horror novel that hardens a person’s grip on objective reality?
|
d20e74de4fd421b257aa8e99d3a78bae
|
{
"intermediate": 0.31431806087493896,
"beginner": 0.3853886127471924,
"expert": 0.30029332637786865
}
|
4,082
|
write sql funtion to check postcode is valid
|
6313e021efe7dcdb94f10ab4c341e224
|
{
"intermediate": 0.4757048189640045,
"beginner": 0.25848913192749023,
"expert": 0.26580604910850525
}
|
4,083
|
Can you write me a script that installs Gentoo to WSL?
|
f7fed1dc23a0e62496a5f5a9c84bac3d
|
{
"intermediate": 0.49147531390190125,
"beginner": 0.172080397605896,
"expert": 0.33644434809684753
}
|
4,084
|
Fivem scripting I'm working on a table NUI
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpha Realestate</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="nui://game/ui/jquery.js"></script>
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
<script src="ui.js"></script>
</head>
<body id="body">
<button id="addRow">Add new row</button>
<table id="myTable" class="display">
<thead>
<tr>
<th>Date</th>
<th>Agent</th>
<th>Buyer</th>
<th>Price</th>
<th>Address</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>
style
table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
font-size: 14px;
padding: 10px;
}
th {
background-color: #eee;
}
javascript
//$("#body").hide()
$(document).ready(function () {
var t = $('#myTable').DataTable();
var counter = 1;
$('#addRow').on('click', function () {
console.log(counter);
t.row.add([counter + '.1', counter + '.2', counter + '.3', counter + '.4', counter + '.5']).draw();
counter++;
});
// Automatically add a first row of data
$('#addRow').click();
});
I want to add a #3a3f52 box around the table, I also want to scale down the table so its about 50% smaller. I also want to center the table so its in the middle of the screen
|
cac1d0d6ed854c5eaea7992083fa1749
|
{
"intermediate": 0.4169456362724304,
"beginner": 0.32950612902641296,
"expert": 0.2535482347011566
}
|
4,085
|
Give me an exemple of emersion/go-imap using oauth with office 365
|
b3fb6081b1ce7a8e5cbe4175c2dfcf55
|
{
"intermediate": 0.5433454513549805,
"beginner": 0.15859022736549377,
"expert": 0.29806432127952576
}
|
4,086
|
generate html, css code about a card that rotate to the other side when you click on it and add litle rotation to a hover efect
|
3de06af41f24f015b57a61d5347ccef7
|
{
"intermediate": 0.41417333483695984,
"beginner": 0.30773288011550903,
"expert": 0.27809372544288635
}
|
4,087
|
Write stored procedure so the input values would be checked for null or emty. If they are throw an error. Here is the beginning of the stored procedure, finish it: CREATE DEFINER=`SPECTRUMDBA`@`%` PROCEDURE `bobTest`(
IN i_a varchar(32),
IN i_o_id int
)
sp_lbl:
BEGIN
|
df61f1eca04aa27e853af3d3df10284f
|
{
"intermediate": 0.46293920278549194,
"beginner": 0.20277129113674164,
"expert": 0.3342895209789276
}
|
4,088
|
fivem scripting I'm working on table NUI
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpha Realestate</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="nui://game/ui/jquery.js"></script>
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
<script src="ui.js"></script>
</head>
<body>
<div id="container">
<button id="addRow">Add new row</button>
<div id="tableWrapper">
<table id="myTable" class="display">
<thead>
<tr>
<th>Date</th>
<th>Agent</th>
<th>Buyer</th>
<th>Price</th>
<th>Address</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</body>
</html>
CSS
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
font-size: 14px;
padding: 10px;
}
th {
background-color: #eee;
}
#container {
background-color: #3a3f52;
padding: 30px;
border-radius: 8px;
display: flex;
flex-direction: column;
align-items: center;
}
#tableWrapper {
width: 50%;
overflow: auto;
}
#myTable {
width: 100%;
transform: scale(0.5);
transform-origin: 0 0;
}
https://cdn.discordapp.com/attachments/1052780891300184096/1103601899774693417/image.png
For some reason the table scaled like it should've but the search, show entries , page select etc did not scale and has now vertically aligned itself
|
8992d230cbee1ce2662fe3188048377c
|
{
"intermediate": 0.4071933627128601,
"beginner": 0.393268883228302,
"expert": 0.1995377391576767
}
|
4,089
|
import React from 'react'; import { CreditsTable, PaymentChargesTableAction, paymentTableSelectors } from '@txp-core/payment-transactions-table'; import { Table } from '@ids-ts/table'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { useFormatMessage } from '@txp-core/intl'; import { TransactionSelectors } from '@txp-core/transactions-core'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes, getTxnUrl } from '@txp-core/transactions-utils'; import { toLocalizedMoneyString, toLocalDateFormat } from '@txp-core/basic-utils'; import TransactionsTableHeader from './TransactionTableHeaders'; import styles from 'src/js/staticLayout/Grid.module.css'; import Checkbox, { CheckboxOnChangeEventType } from '@ids-ts/checkbox'; import style from './Tables.module.css'; import LinkButton from '@txp-core/link-button'; import { useTrowserHooks } from '@txp-core/trowser'; import TransactionTableFilter from './TransactionTableFilter'; import PaymentField from 'src/js/billpayment/modules/TransactionTables/PaymentField'; export interface txnType { txnTypeId: number; txnTypeLongName: string; } export interface CreditsTableDataTypes { txnId: number; txnType: txnType; date: string; amount: string; dueDate: string; openBalance: string; referenceNumber: string; linkedPaymentAmount: string; isLinkedPaymentAmount?: boolean; } export const TransactionCreditsTable = () => { const formatMessage = useFormatMessage(); const customerId = useTXPStateRead(TransactionSelectors.getContactId); const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits) || []; const totalOfChargesTable = useTXPStateRead(paymentTableSelectors.getTotalOfChargesTable); const totalOfCreditsTable = useTXPStateRead(paymentTableSelectors.getTotalOfCreditsTable); const onPaymentFieldUpdate = useTXPStateWrite(PaymentChargesTableAction.creditsTableDataUpdate); const Items = (props: { item: CreditsTableDataTypes; idx: number }) => { const { item, idx } = props; const txnUrl = getTxnUrl(`${item.txnType.txnTypeId}`, item.txnId); const referenceNumber = item.referenceNumber ? `# ${item.referenceNumber}` : ''; const handleCheckboxChange = (event: CheckboxOnChangeEventType, txnId: number) => { if (event.target.checked) { const value = creditTableLines.filter((x) => x.txnId === txnId)[0].openBalance; if (totalOfChargesTable > totalOfCreditsTable) { const creditNeeded = Math.abs(totalOfChargesTable - totalOfCreditsTable); if (creditNeeded <= value) { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: creditNeeded.toString(), isLinkedPaymentAmount: true }); } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } }; const handlePaymentFieldChange = (inputValue: string) => { let value = ''; if (item.linkedPaymentAmount) { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : item.linkedPaymentAmount; } else { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : ''; } const creditNeeded = Math.abs( totalOfChargesTable - (totalOfCreditsTable - Number(item.linkedPaymentAmount)) ); if (Number(value) <= creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } if (Number(value) > creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: creditNeeded === 0 ? '' : creditNeeded.toString(), isLinkedPaymentAmount: true }); } }; const { closeTrowser } = useTrowserHooks(); const handleNavigate = () => closeTrowser?.({ navigateTo: txnUrl, skipTrowserCloseDelay: true }); return ( <> <Table.Row key={idx} className='tableRow'> <Table.Cell className={style.checkbox}> <Checkbox aria-label={formatMessage({ id: 'charges_credits_table_select_rows', defaultMessage: 'Select rows' })} style={{ cursor: 'pointer' }} checked={!!item.linkedPaymentAmount} onChange={(event) => handleCheckboxChange(event, item.txnId)} /> </Table.Cell> <Table.Cell className={styles.leftAlign}> <LinkButton onClick={handleNavigate} text={`${item.txnType.txnTypeLongName} ${referenceNumber}`} />{' '} ({toLocalDateFormat(item.date)}) </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.amount)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.openBalance)} </Table.Cell> <Table.Cell> <PaymentField paymentAmount={item.linkedPaymentAmount} txnId={item.txnId} rowIndex={idx} handleOnPaymentChange={handlePaymentFieldChange} /> </Table.Cell> </Table.Row> </> ); }; return ( <div className={styles.gridWrapper}> {customerId && ( <CreditsTable header={<TransactionsTableHeader dueDateFlag={false} />} filter={<TransactionTableFilter showOverDueCheck={false} />} > {(item: CreditsTableDataTypes, idx: number) => <Items item={item} idx={idx} />} </CreditsTable> )} </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, TransactionCreditsTable );
improve code in handleCheckboxChange and handleCheckboxChange handler
|
b3bb3d5b0986e9f2e244b56e61243ba2
|
{
"intermediate": 0.36294350028038025,
"beginner": 0.5517408847808838,
"expert": 0.08531560748815536
}
|
4,090
|
Ubah embedding built in library Keras pada kode analisis sentimen di bawah ini menjadi menggunakan Word2Vec Bahasa Indonesia!
import pickle
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from keras.preprocessing.text import Tokenizer
from keras.utils import pad_sequences
from keras.models import Sequential
from keras.layers import LSTM, Dense, Embedding, SpatialDropout1D, Dropout
from keras.callbacks import EarlyStopping
from keras.optimizers import Adam
from sklearn.metrics import classification_report
# Membaca dataset
data_list = pickle.load(open(‘pre_processed_beritaFIX_joined.pkl’, ‘rb’))
data = pd.DataFrame(data_list, columns=[‘judul’, ‘isi’, ‘pre_processed’, ‘Label’])
data[‘Isi Berita’] = data[‘pre_processed’]
# Mengkodekan label
le = LabelEncoder()
data[‘label_encoded’] = le.fit_transform(data[‘Label’])
# Memisahkan data latih dan data uji
X_train, X_test, y_train, y_test = train_test_split(data[‘Isi Berita’], data[‘label_encoded’], test_size=0.25, random_state=42)
# Tokenisasi dan padding
max_vocab_size = 10000
max_sequence_length = 250
tokenizer = Tokenizer(num_words=max_vocab_size)
tokenizer.fit_on_texts(X_train)
X_train_sequences = tokenizer.texts_to_sequences(X_train)
X_test_sequences = tokenizer.texts_to_sequences(X_test)
X_train_padded = pad_sequences(X_train_sequences, maxlen=max_sequence_length)
X_test_padded = pad_sequences(X_test_sequences, maxlen=max_sequence_length)
# Membangun model LSTM
embedding_dim = 100
lstm_units = 64
model = Sequential()
model.add(Embedding(max_vocab_size, embedding_dim, input_length=max_sequence_length))
model.add(SpatialDropout1D(0.2))
model.add(LSTM(lstm_units, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(3, activation=‘softmax’))
optimizer = Adam(lr=0.001)
model.compile(loss=‘sparse_categorical_crossentropy’, optimizer=optimizer, metrics=[‘accuracy’])
print(model.summary())
# Melatih model dengan data latih
epochs = 10
batch_size = 64
history = model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor=‘val_loss’, patience=3, min_delta=0.0001)])
# Menghitung akurasi pada data uji
acc = model.evaluate(X_test_padded, y_test)[1]
print(‘Akurasi pada data uji:’, acc)
# Menampilkan classification report
# Menggunakan model untuk prediksi kelas
y_pred_proba = model.predict(X_test_padded)
# Mengonversi probabilitas ke kelas
y_pred = np.argmax(y_pred_proba, axis=1)
# Menampilkan classification report
print(classification_report(y_test, y_pred, target_names=le.classes_))
|
ed285365c9d3a75b727be60aba1a726a
|
{
"intermediate": 0.3998989462852478,
"beginner": 0.3431549072265625,
"expert": 0.2569460868835449
}
|
4,091
|
kettle processRow方法中获取参数
|
691d63d846f90566627cd686f2096d22
|
{
"intermediate": 0.35417503118515015,
"beginner": 0.45300745964050293,
"expert": 0.19281746447086334
}
|
4,092
|
I’m working on this p5.js code. I need you to merge two programs together. Also, please place the random button below the grid.
This is program 1:
const columns = 6;
const rows = 7;
const cellSize = 50;
const offsetX = cellSize;
const offsetY = cellSize;
const points = [];
const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X",
"XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX",
"XXI", "XXII", "XXIII", "XXIV", "XXV", "XXVI", "XXVII", "XXVIII", "XXIX", "XXX",
"XXXI", "XXXII", "XXXIII", "XXXIV", "XXXV", "XXXVI", "XXXVII", "XXXVIII", "XXXIX", "XL",
"XLI", "XLII", "XLIII", "XLIV", "XLV", "XLVI", "XLVII", "XLVIII", "XLIX", "L"];
function setup() {
createCanvas(columns * cellSize + offsetX, rows * cellSize + offsetY);
for (let i = 0; i < columns * rows; i++) {
points.push(0);
}
}
function draw() {
background(255);
textAlign(CENTER, CENTER);
// Draw header row
for (let x = 0; x < columns; x++) {
fill(0);
text(columns - x, x * cellSize + offsetX + cellSize / 2, cellSize / 2);
}
// Draw header column
for (let y = 0; y < rows; y++) {
fill(0);
text(y + 1, cellSize / 2, y * cellSize + offsetY + cellSize / 2);
}
// Draw grid
for (let x = 0; x < columns; x++) {
for (let y = 0; y < rows; y++) {
const index = x * rows + y;
const px = x * cellSize + offsetX;
const py = y * cellSize + offsetY;
stroke(0);
fill(235);
rect(px, py, cellSize, cellSize);
// Colorize text in the cell
// const hue = map(points[index], 0, 10, 0, 255);
// fill(hue, 255, 255);
fill(25, 255, 255);
if (points[index] > 0) {
text(romanNumerals[points[index] - 1], px + cellSize / 2, py + cellSize / 2);
}
}
}
}
function mouseClicked() {
const x = floor((mouseX - offsetX) / cellSize);
const y = floor((mouseY - offsetY) / cellSize);
const index = x * rows + y;
if (index < points.length && x < columns && y < rows) {
points[index]++;
}
}
This is program 2:
const button = document.querySelector("button");
const cellSize = 50;
const selectedCells = [];
function setup() {
let canvas = createCanvas(7 * cellSize, 8 * cellSize, WEBGL);
canvas.parent("sketch-holder");
}
function draw() {
background(255);
translate(-width / 2, -height / 2);
drawGrid();
drawSelectedCells();
drawLabels();
}
function drawGrid() {
for (let i = 0; i < 7; i++) {
for (let j = 0; j < 8; j++) {
stroke(0);
noFill();
rect(i * cellSize, j * cellSize, cellSize, cellSize);
}
}
}
function drawSelectedCells() {
for (const cell of selectedCells) {
let x1 = cell.col * cellSize;
let y1 = cell.row * cellSize;
fill(255, 0, 0);
noStroke();
rect(x1, y1, cellSize, cellSize);
}
}
function selectRandomPosition() {
if (selectedCells.length >= 7 * 8) {
alert("All cells have been selected.");
return;
}
let col, row;
do {
col = floor(random(7));
row = floor(random(8));
} while (isSelected(col, row));
selectedCells.push({ col, row });
}
function isSelected(col, row) {
return selectedCells.some(cell => cell.col === col && cell.row === row);
}
function drawLabels() {
textSize(20);
fill(0);
textAlign(CENTER, CENTER);
for (let i = 0; i < 7; i++) {
text(i + 1, i * cellSize + cellSize / 2 + 50, 25);
}
for (let j = 0; j < 8; j++) {
text(j + 1, 25, j * cellSize + cellSize / 2 + 50);
}
}
|
7e328c4d9df32411d01478b0510a044b
|
{
"intermediate": 0.3086276352405548,
"beginner": 0.4453246295452118,
"expert": 0.2460477352142334
}
|
4,093
|
Write a player script in c# for the unity game engine that contains functions for the following : fall damage, jump, double jump, sprint (with a delay after a short amount of time), shooting, and anything else you think would be useful.
|
392fac237bd2516f958fac140e21a678
|
{
"intermediate": 0.29485929012298584,
"beginner": 0.4572228789329529,
"expert": 0.24791781604290009
}
|
4,094
|
Write a player script in c# that is compatible with the unity game engine that contains functions for the following : fall damage, jump, double jump, sprint (with a delay after a short amount of time), shooting, and anything else you think would be useful.
|
24a34391778504b917394b95a5c19e46
|
{
"intermediate": 0.31933528184890747,
"beginner": 0.4264991879463196,
"expert": 0.25416550040245056
}
|
4,095
|
Draw a circle in SVG.
|
6f4e271ea1d6b330ee0bda1eaf8fd110
|
{
"intermediate": 0.3758995831012726,
"beginner": 0.2813717722892761,
"expert": 0.3427286148071289
}
|
4,096
|
Draw a mickey mouse in SVG.
|
83ca25c6eea2ff8e36dbae83584f693d
|
{
"intermediate": 0.3941950798034668,
"beginner": 0.32374125719070435,
"expert": 0.28206366300582886
}
|
4,097
|
в коде ошибка:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/three_examples_jsm_utils_BufferGeometryUtils__js.js?v=79b2e034' does not provide an export named 'GLTFLoader' (at main.js:3:10)
код:
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
let scene, camera, renderer, model, particles;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 5;
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const loader = new GLTFLoader ();
loader.load('particles three js1.glb', function (gltf) {
model = gltf.scene;
scene.add(model);
// Удаляем все материалы
model.traverse(function (child) {
if (child.isMesh) child.material.dispose();
});
const particleMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 0.1 });
particles = new THREE.BufferGeometry().setFromPoints([]);
// Добавляем частицы в вершины
model.traverse(function (child) {
if (child.isMesh) {
particles.merge(child.geometry, child.matrixWorld);
}
});
const particlesSystem = new THREE.Points(particles, particleMaterial);
scene.add(particlesSystem);
});
}
// Обработчик события колесика мыши
let cameraZ = camera.position.z;
window.addEventListener('wheel', (event) => {
cameraZ += event.deltaY * 0.003;
camera.position.z = cameraZ;
event.preventDefault();
}, { passive: false });
function animate() {
requestAnimationFrame(animate);
if (model) {
// Вращаем модель для анимации
model.rotation.x += 0.01;
model.rotation.y += 0.01;
}
renderer.render(scene, camera);
}
|
4539a1ff75d307399c0d43faccf6fed3
|
{
"intermediate": 0.30923911929130554,
"beginner": 0.4576544463634491,
"expert": 0.23310647904872894
}
|
4,098
|
Есть запрос в potresql SELECT Distinct
users.name,
orders_task.id,
orders_task.data,
orders_task.name_of_order,
topics.name
FROM
( select orders_task_id ,users_id
from users_orders
where users_orders.orders_task_id in
(
select orders_task_id
from users_orders where users_id = 6
)
and is_homework = true) t
JOIN public.orders_task
ON orders_task.id = t.orders_task_id
JOIN public.users
ON t.users_id = users.id
JOIN public.tasks_order
ON tasks_order.orders_task_id = t.orders_task_id
JOIN public.tasks_topics
ON tasks_order.tasks_id = tasks_topics.task_id
JOIN public.topics
ON tasks_topics.topics_id = topics.id . Нужно сделать аналогичный запрос в flask
|
7f97b5a9be5d1a2a1b463d5116f48ebe
|
{
"intermediate": 0.3689929246902466,
"beginner": 0.2692323327064514,
"expert": 0.3617746829986572
}
|
4,099
|
Draw a circle in SVG and display it here.
|
57be458a04a76b27766df7884b29b3a7
|
{
"intermediate": 0.36393052339553833,
"beginner": 0.28413471579551697,
"expert": 0.3519347608089447
}
|
4,100
|
Write a player script in c# that is compatible with the unity game engine that contains functions for the following : fall damage, jump, double jump, sprint (with a delay after a short amount of time), shooting, and anything else you think would be useful.
|
7a25da5d50fe682ec305b409c120eff4
|
{
"intermediate": 0.31933528184890747,
"beginner": 0.4264991879463196,
"expert": 0.25416550040245056
}
|
4,101
|
Berikut adalah kode Analisis sentimen LSTM menggunakan embedding FastText.
import pickle
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from keras.preprocessing.text import Tokenizer
from keras.utils import pad_sequences
from keras.models import Sequential
from keras.layers import LSTM, Dense, Embedding, SpatialDropout1D, Dropout
from keras.callbacks import EarlyStopping
from keras.optimizers import Adam
from sklearn.metrics import classification_report
import fasttext
# Load model FastText Bahasa Indonesia
path_to_fasttext_model = ‘cc.id.300.bin’
ft_model = fasttext.load_model(path_to_fasttext_model)
# Membaca dataset
data_list = pickle.load(open(‘pre_processed_beritaFIX_joined.pkl’, ‘rb’))
data = pd.DataFrame(data_list, columns=[‘judul’, ‘isi’, ‘pre_processed’, ‘Label’])
data[‘Isi Berita’] = data[‘pre_processed’]
# Mengkodekan label
le = LabelEncoder()
data[‘label_encoded’] = le.fit_transform(data[‘Label’])
# Memisahkan data latih dan data uji
X_train, X_test, y_train, y_test = train_test_split(data[‘Isi Berita’], data[‘label_encoded’], test_size=0.25, random_state=42)
# Tokenisasi dan padding
max_vocab_size = 10000
max_sequence_length = 250
tokenizer = Tokenizer(num_words=max_vocab_size)
tokenizer.fit_on_texts(X_train)
X_train_sequences = tokenizer.texts_to_sequences(X_train)
X_test_sequences = tokenizer.texts_to_sequences(X_test)
X_train_padded = pad_sequences(X_train_sequences, maxlen=max_sequence_length)
X_test_padded = pad_sequences(X_test_sequences, maxlen=max_sequence_length)
# Membuat matriks embedding
embedding_dim = ft_model.get_dimension()
embedding_matrix = np.zeros((max_vocab_size, embedding_dim))
for word, index in tokenizer.word_index.items():
if index >= max_vocab_size:
break
embedding_vector = ft_model.get_word_vector(word)
embedding_matrix[index] = embedding_vector
# Membangun model LSTM
lstm_units = 64
model = Sequential()
model.add(Embedding(max_vocab_size, embedding_dim, input_length=max_sequence_length, weights=[embedding_matrix], trainable=False))
model.add(SpatialDropout1D(0.2))
model.add(LSTM(lstm_units, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(3, activation=‘softmax’))
optimizer = Adam(lr=0.001)
model.compile(loss=‘sparse_categorical_crossentropy’, optimizer=optimizer, metrics=[‘accuracy’])
print(model.summary())
# Melatih model dengan data latih
epochs = 10
batch_size = 64
history = model.fit(X_train_padded, y_train, epochs=epochs, batch_size=batch_size, validation_split=0.1, callbacks=[EarlyStopping(monitor=‘val_loss’, patience=3, min_delta=0.0001)])
# Menghitung akurasi pada data uji
acc = model.evaluate(X_test_padded, y_test)[1]
print(‘Akurasi pada data uji:’, acc)
# Menampilkan classification report
# Menggunakan model untuk prediksi kelas
y_pred_proba = model.predict(X_test_padded)
# Mengonversi probabilitas ke kelas
y_pred = np.argmax(y_pred_proba, axis=1)
# Menampilkan classification report
print(classification_report(y_test, y_pred, target_names=le.classes_))
ft_model = fasttext.load_model(path_to_fasttext_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "fasttext\fasttext.pyx", line 154, in fasttext.fasttext.load_model
Exception: fastText: Cannot load cc.id.300.bin due to C++ extension failed to allocate the memory
|
55f330cda73045bb9f7b589a0013968a
|
{
"intermediate": 0.2474626898765564,
"beginner": 0.3785921037197113,
"expert": 0.3739451766014099
}
|
4,102
|
Draw a circle.
|
b77ae1b7b934a6a71c5ee5842b185923
|
{
"intermediate": 0.36582911014556885,
"beginner": 0.32963767647743225,
"expert": 0.3045331835746765
}
|
4,103
|
Is the code correct for not equal to, i doubt 'ne'. if condition in ['>', '<', '=', '>=', '<=', '!=']:
signs_dict = {'>':'gt', '>=':'ge', '<':'lt', '<=':'le', '=':'eq', '==':'eq', '!=':'ne'}
df_ = df.loc[getattr(df[col1], signs_dict.get(condition, '<'))(df[col2])]
|
f4d88964537185145f8a5b1e68bef64d
|
{
"intermediate": 0.37355247139930725,
"beginner": 0.39726123213768005,
"expert": 0.2291863113641739
}
|
4,104
|
Draw a circle using ASCII
|
917ac57346da7d7021133f131f0ebc88
|
{
"intermediate": 0.36440688371658325,
"beginner": 0.4383108615875244,
"expert": 0.19728218019008636
}
|
4,105
|
import React from 'react'; import { CreditsTable, PaymentChargesTableAction, paymentTableSelectors } from '@txp-core/payment-transactions-table'; import { Table } from '@ids-ts/table'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { useFormatMessage } from '@txp-core/intl'; import { TransactionSelectors } from '@txp-core/transactions-core'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes, getTxnUrl } from '@txp-core/transactions-utils'; import { toLocalizedMoneyString, toLocalDateFormat } from '@txp-core/basic-utils'; import TransactionsTableHeader from './TransactionTableHeaders'; import styles from 'src/js/staticLayout/Grid.module.css'; import Checkbox, { CheckboxOnChangeEventType } from '@ids-ts/checkbox'; import style from './Tables.module.css'; import LinkButton from '@txp-core/link-button'; import { useTrowserHooks } from '@txp-core/trowser'; import TransactionTableFilter from './TransactionTableFilter'; import PaymentField from 'src/js/billpayment/modules/TransactionTables/PaymentField'; export interface txnType { txnTypeId: number; txnTypeLongName: string; } export interface CreditsTableDataTypes { txnId: number; txnType: txnType; date: string; amount: string; dueDate: string; openBalance: string; referenceNumber: string; linkedPaymentAmount: string; isLinkedPaymentAmount?: boolean; } export const TransactionCreditsTable = () => { const formatMessage = useFormatMessage(); const customerId = useTXPStateRead(TransactionSelectors.getContactId); const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits) || []; const totalOfChargesTable = useTXPStateRead(paymentTableSelectors.getTotalOfChargesTable); const totalOfCreditsTable = useTXPStateRead(paymentTableSelectors.getTotalOfCreditsTable); const onPaymentFieldUpdate = useTXPStateWrite(PaymentChargesTableAction.creditsTableDataUpdate); const Items = (props: { item: CreditsTableDataTypes; idx: number }) => { const { item, idx } = props; const txnUrl = getTxnUrl(`${item.txnType.txnTypeId}`, item.txnId); const referenceNumber = item.referenceNumber ? `# ${item.referenceNumber}` : ''; const handleCheckboxChange = (event: CheckboxOnChangeEventType, txnId: number) => { if (event.target.checked) { const value = creditTableLines.filter((x) => x.txnId === txnId)[0].openBalance; if (totalOfChargesTable > totalOfCreditsTable) { const creditNeeded = Math.abs(totalOfChargesTable - totalOfCreditsTable); if (creditNeeded <= value) { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: creditNeeded.toString(), isLinkedPaymentAmount: true }); } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } }; const handlePaymentFieldChange = (inputValue: string) => { let value = ''; if (item.linkedPaymentAmount) { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : item.linkedPaymentAmount; } else { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : ''; } const creditNeeded = Math.abs( totalOfChargesTable - (totalOfCreditsTable - Number(item.linkedPaymentAmount)) ); if (Number(value) <= creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } if (Number(value) > creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: creditNeeded === 0 ? '' : creditNeeded.toString(), isLinkedPaymentAmount: true }); } }; const { closeTrowser } = useTrowserHooks(); const handleNavigate = () => closeTrowser?.({ navigateTo: txnUrl, skipTrowserCloseDelay: true }); return ( <> <Table.Row key={idx} className='tableRow'> <Table.Cell className={style.checkbox}> <Checkbox aria-label={formatMessage({ id: 'charges_credits_table_select_rows', defaultMessage: 'Select rows' })} style={{ cursor: 'pointer' }} checked={!!item.linkedPaymentAmount} onChange={(event) => handleCheckboxChange(event, item.txnId)} /> </Table.Cell> <Table.Cell className={styles.leftAlign}> <LinkButton onClick={handleNavigate} text={`${item.txnType.txnTypeLongName} ${referenceNumber}`} />{' '} ({toLocalDateFormat(item.date)}) </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.amount)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.openBalance)} </Table.Cell> <Table.Cell> <PaymentField paymentAmount={item.linkedPaymentAmount} txnId={item.txnId} rowIndex={idx} handleOnPaymentChange={handlePaymentFieldChange} /> </Table.Cell> </Table.Row> </> ); }; return ( <div className={styles.gridWrapper}> {customerId && ( <CreditsTable header={<TransactionsTableHeader dueDateFlag={false} />} filter={<TransactionTableFilter showOverDueCheck={false} />} > {(item: CreditsTableDataTypes, idx: number) => <Items item={item} idx={idx} />} </CreditsTable> )} </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, TransactionCreditsTable );
Improve above in handleCheckboxChange and handlePaymentFieldChange handler
in handlecheckboxchange try to improve this code only “if (totalOfChargesTable > totalOfCreditsTable) { const creditNeeded = Math.abs(totalOfChargesTable - totalOfCreditsTable); if (creditNeeded <= value) { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: creditNeeded.toString(), isLinkedPaymentAmount: true }); } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); }”
and in handlePaymentFieldChange try to improve this code only “const creditNeeded = Math.abs( totalOfChargesTable - (totalOfCreditsTable - Number(item.linkedPaymentAmount)) ); if (Number(value) <= creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); } if (Number(value) > creditNeeded) { onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: creditNeeded === 0 ? '' : creditNeeded.toString(), isLinkedPaymentAmount: true }); }”
|
357ac71aed83472631a31a658363d9ae
|
{
"intermediate": 0.36294350028038025,
"beginner": 0.5517408847808838,
"expert": 0.08531560748815536
}
|
4,106
|
give me sample that use XDO_SHEET with XDO_SUBTEMPLATE
|
6f0c1cebdadcded562c9c35dd24a1fea
|
{
"intermediate": 0.41934505105018616,
"beginner": 0.24984097480773926,
"expert": 0.3308139145374298
}
|
4,107
|
пишет ошибку в коде
Uncaught TypeError: THREE.GLTFLoader is not a constructor
код:
import * as THREE from 'three';
let scene, camera, renderer, model, particles;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 5;
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const loader = new THREE.GLTFLoader();
loader.load('particles three js.glb', function (gltf) {
model = gltf.scene;
scene.add(model);
// Удаляем все материалы
model.traverse(function (child) {
if (child.isMesh) child.material.dispose();
});
const particleMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 0.1 });
particles = new THREE.Geometry();
// Добавляем частицы в вершины
model.traverse(function (child) {
if (child.isMesh) {
child.geometry.vertices.forEach(function (vertex) {
particles.vertices.push(vertex);
});
}
});
const particlesSystem = new THREE.Points(particles, particleMaterial);
scene.add(particlesSystem);
});
}
function animate() {
requestAnimationFrame(animate);
if (model) {
// Вращаем модель для анимации
model.rotation.x += 0.01;
model.rotation.y += 0.01;
}
renderer.render(scene, camera);
}
|
d307bd141ee73fa9a479a10d53ca2ce0
|
{
"intermediate": 0.44801047444343567,
"beginner": 0.35465335845947266,
"expert": 0.19733618199825287
}
|
4,108
|
ошибка: THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead.
в коде:
import * as THREE from ‘three’;
import { GLTFLoader } from ‘three/examples/jsm/loaders/GLTFLoader.js’;
let scene, camera, renderer, model, particles;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 5;
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const loader = new GLTFLoader ();
loader.load(‘particles three js1.glb’, function (gltf) {
model = gltf.scene;
scene.add(model);
// Удаляем все материалы
model.traverse(function (child) {
if (child.isMesh) child.material.dispose();
});
const particleMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 0.1 });
particles = new THREE.BufferGeometry().setFromPoints([]);
// Добавляем частицы в вершины
model.traverse(function (child) {
if (child.isMesh) {
particles.merge(child.geometry, child.matrixWorld);
}
});
const particlesSystem = new THREE.Points(particles, particleMaterial);
scene.add(particlesSystem);
});
}
// Обработчик события колесика мыши
let cameraZ = camera.position.z;
window.addEventListener(‘wheel’, (event) => {
cameraZ += event.deltaY * 0.003;
camera.position.z = cameraZ;
event.preventDefault();
}, { passive: false });
function animate() {
requestAnimationFrame(animate);
if (model) {
// Вращаем модель для анимации
model.rotation.x += 0.01;
model.rotation.y += 0.01;
}
renderer.render(scene, camera);
}
|
2c03d05407263ac1ac1282c3b27ae3c9
|
{
"intermediate": 0.40826740860939026,
"beginner": 0.31413617730140686,
"expert": 0.27759644389152527
}
|
4,109
|
I want a VBA code that will search Column H for dates between 90 days before today and seven days after today, and for any dates found copy the respective rows where the dates were found from Column H to Column K and paste into a new text document with each row on a single line one after the other.
|
3cd361820c2007d85167f5b97ef59ffd
|
{
"intermediate": 0.46593815088272095,
"beginner": 0.10910297930240631,
"expert": 0.42495885491371155
}
|
4,110
|
calculates the z acceleration relative to the ground in a rotating 3D mobile phone using Dart and sensor
|
efbf9179b5fd78f560db0ac76b8dd1f9
|
{
"intermediate": 0.3243766725063324,
"beginner": 0.15864001214504242,
"expert": 0.5169833302497864
}
|
4,111
|
Выполняю код
def get_status(self, route_id, method):
key = f'{route_id}_{method}'
statuses = self.statuses.pop(key, [])
print("statuses", file=sys.stderr)
if not statuses:
statuses = self.__get_statuses(route_id, method)
print("statuses", file=sys.stderr)
status = statuses.pop(0)
print("status", file=sys.stderr)
self.statuses[key] = statuses
return status
получаю ошибку:
mt-fakes-exchange | print("statuses", file=sys.stderr)
mt-fakes-exchange | ^^^
mt-fakes-exchange | NameError: name 'sys' is not defined
|
c9c1df723b8f15e10a0c1165c3865530
|
{
"intermediate": 0.299762487411499,
"beginner": 0.440341055393219,
"expert": 0.25989654660224915
}
|
4,112
|
calculates the z acceleration relative to the ground in a rotating 3D mobile phone using Dart and sensor
|
1a1336cebe98c3bfcd026a752031e6b5
|
{
"intermediate": 0.3243766725063324,
"beginner": 0.15864001214504242,
"expert": 0.5169833302497864
}
|
4,113
|
Give me an exemple of emersion/go-imap with oauth and office 365 without the usage of go-sasl
|
855a43df23e0851b2aef6bb02aa7f268
|
{
"intermediate": 0.677666425704956,
"beginner": 0.12747372686862946,
"expert": 0.1948598027229309
}
|
4,114
|
Hey! tengo este error al hacer rails server, solucionado!
gems are installed into `./vendor/bundle`
gonzuwu@MacBook-Air-de-Gonzalo ux % rails server
Traceback (most recent call last):
25: from bin/rails:4:in `<main>'
24: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
23: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
22: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/commands.rb:18:in `<main>'
21: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/command.rb:46:in `invoke'
20: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/command/base.rb:69:in `perform'
19: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
18: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
17: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
16: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:142:in `perform'
15: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:142:in `tap'
14: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/railties-5.2.8/lib/rails/commands/server/server_command.rb:145:in `block in perform'
13: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
12: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
11: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/config/application.rb:7:in `<main>'
10: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler.rb:174:in `require'
9: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
8: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
7: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
6: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
5: from /Users/gonzuwu/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
4: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
3: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
2: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<main>'
1: from /Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/Users/gonzuwu/Documents/LeadingDev/skade/ux/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- mysql2/mysql2 (LoadError)
gonzuwu@MacBook-Air-de-Gonzalo ux %
|
f94f84a1350d5e2140eff950b506c0c9
|
{
"intermediate": 0.47217077016830444,
"beginner": 0.3402416408061981,
"expert": 0.18758761882781982
}
|
4,115
|
calculate the z acceleration relative to the ground in a rotating 3D Objects
|
da02c19c3f09b486fcd74f45c445f929
|
{
"intermediate": 0.25273239612579346,
"beginner": 0.19391387701034546,
"expert": 0.5533537268638611
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.