row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
32,826
|
HttpClientFactory как ты его опишешь?
|
08646e638b07e5fc237399e8c33caf10
|
{
"intermediate": 0.3922598659992218,
"beginner": 0.21441307663917542,
"expert": 0.39332708716392517
}
|
32,827
|
HttpUtility и WebUtility чем отличаются
|
cff1855e84f65c70bfa248c18c1150a9
|
{
"intermediate": 0.40541723370552063,
"beginner": 0.28821516036987305,
"expert": 0.30636754631996155
}
|
32,828
|
Сделай обработку исключений (к примеру неправильный токен) для этого метода
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
using (HttpResponseMessage response = await httpClient.GetAsync("")) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
}
|
81c0fac38b4f49f3585352ebd78d2bd6
|
{
"intermediate": 0.42847833037376404,
"beginner": 0.39399439096450806,
"expert": 0.17752723395824432
}
|
32,829
|
Сделай вызов исключений (к примеру неправильный токен) для этого метода
private async Task<T> getAsync<T>(string url, IEnumerable<KeyValuePair<string, string>> query) {
using (HttpResponseMessage response = await httpClient.GetAsync(“”)) {
response.EnsureSuccessStatusCode();
using (Stream stream = await response.Content.ReadAsStreamAsync()) {
return fromJson<T>(stream);
}
}
}
|
2efa96894a1f87cf3b6184ff818a423a
|
{
"intermediate": 0.4038316011428833,
"beginner": 0.3751586079597473,
"expert": 0.22100982069969177
}
|
32,830
|
How do I add text that is readable by the screenreader but invisible to users
|
2ed752c9949a648947271369be0e52a2
|
{
"intermediate": 0.34007376432418823,
"beginner": 0.21850387752056122,
"expert": 0.44142231345176697
}
|
32,831
|
Im trying to add an invisible element that can be seen by a screen reader. <h1 hidden aria-label="sus">Website Control Panel</h1>. This is not picked up by a screenreader but is hidden
|
59d0d1fd5d0e5b830d4720ba39d4f35a
|
{
"intermediate": 0.31488844752311707,
"beginner": 0.311041921377182,
"expert": 0.3740697205066681
}
|
32,832
|
in c++ sdl2, how could i use a texture as a viewport?
|
763beecc1a9d75a2626659c87b79d000
|
{
"intermediate": 0.5137230157852173,
"beginner": 0.2196347415447235,
"expert": 0.2666422128677368
}
|
32,833
|
<router-view aria-label="Website Control Panel"></router-view> how do I make this visible to a screenreader
|
7bb0e59ec6b1fbf8e6edbbcb5af17d4e
|
{
"intermediate": 0.33939704298973083,
"beginner": 0.3948293626308441,
"expert": 0.26577356457710266
}
|
32,834
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class ScoreCounter : MonoBehaviour
{
[Header("Dynamic")]
public int score = 0;
private int currentSceneIndex;
private Text uiText;
private ScoreCounter scoreCounter;
private static int previousScore = 0;
private static int previousSceneIndex = 0;
// Start is called before the first frame update
void Start()
{
uiText = GetComponent<Text>();
currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
scoreCounter = FindObjectOfType<ScoreCounter>();
if (previousSceneIndex == 0 || previousSceneIndex == 1)
{
scoreCounter.score = previousScore;
}
}
// Update is called once per frame
void Update()
{
uiText.text = score.ToString("Score:#,0"); //This 0 is a zero!
}
}
why is the score not staying the same if moving to the next scene?
|
3c1338ef10ac2a46a427b0f39c078384
|
{
"intermediate": 0.518778920173645,
"beginner": 0.32809901237487793,
"expert": 0.15312205255031586
}
|
32,835
|
1) Write a function called quartiles(li) that takes an unordered list with at 1 least 4 positive integers in it and returns a list containing Q1, Q2 and Q3 for that list. For example, if the following list is past to the function, [1, 2, 5, 8, 9, 10, 12, 14, 15] the function should return [3.5, 9, 13]
|
c0529de8bf8054e4323ceb38d465946e
|
{
"intermediate": 0.31164485216140747,
"beginner": 0.30653509497642517,
"expert": 0.38182005286216736
}
|
32,836
|
create the HTML code to calculate IELTS score based on this site code https://manaimmigration.com/tools/clb-score-calculator/
|
b80917fece12b032716ed3a9c0f55ec3
|
{
"intermediate": 0.3770346939563751,
"beginner": 0.21466799080371857,
"expert": 0.4082973301410675
}
|
32,837
|
como hago para ponerle de fondo a esto una imagen que esta en la carpeta images/ al lado de mi componente import FormControl from "@mui/material/FormControl";
import { FunctionComponent, useCallback, useState } from "react";
import loginService from "features/auth/services/login.service";
import { useDispatch } from "react-redux";
import { login as loginAction } from "features/auth/store/auth-slice";
import useRedirectWhenLogged from "../../hooks/use-redirect-when-logged";
import { useNavigate } from "react-router-dom";
import LoginForm from "./login-form/LoginForm";
import Div100vh from 'react-div-100vh'
const Login: FunctionComponent = () => {
const { loading, onSubmit } = useLogin();
const mediaQueryStyles = {
'@media (min-width: 600px)': {
minHeight: '500px',
},
'@media (min-width: 900px)': {
minHeight: '600px',
},
};
return (
<Div100vh style={{
display: 'flex',
flexDirection: 'column',
backgroundColor: 'blue',
alignItems: 'center',
justifyContent: 'center',
minHeight: '800px',
minWidth: '300px',
...mediaQueryStyles,
}}>
<FormControl>
<LoginForm disabled={loading} onSubmit={onSubmit} />
</FormControl>
</Div100vh>
);
};
function useLogin() {
const dispatch = useDispatch();
const navigate = useNavigate();
useRedirectWhenLogged();
const [loading, setLoading] = useState(false);
const onSubmit = useCallback(
async (email: string, password: string) => {
setLoading(true);
try {
if (!email || !password) return;
const result = await loginService({
email,
password,
});
dispatch(loginAction(result));
navigate(`/dashboard`);
} catch (error) {
console.log(error);
} finally {
setLoading(false);
}
},
[navigate, dispatch]
);
return { onSubmit, loading };
}
export default Login;
|
3fdaf9392dab22eb8aa8fbc3bce0f28b
|
{
"intermediate": 0.3982183337211609,
"beginner": 0.5042427182197571,
"expert": 0.09753897041082382
}
|
32,838
|
I am trying to use equalizer apo on my pixel buds pro with an alternative bluetooth driver that allows aac and using a colvution eq i found on auto.eq. I get very bad cracking. The bit rate of the convultion is correct and the khz
|
c822e8dd0bac9a16a4ad2496ab34f6d0
|
{
"intermediate": 0.4109143316745758,
"beginner": 0.20619872212409973,
"expert": 0.38288697600364685
}
|
32,839
|
write a C# script that allows the boss to activate a barrier (game object) randomly, lasting for 3 seconds (can do it more than once)
|
baae1b022b0cb2ed92077d7d3684cd3a
|
{
"intermediate": 0.44131913781166077,
"beginner": 0.20589570701122284,
"expert": 0.3527851104736328
}
|
32,840
|
How do i view the sample rate of my usb dac for android
|
b3cb90002fd78860972debaa03a9f21d
|
{
"intermediate": 0.46557268500328064,
"beginner": 0.16285039484500885,
"expert": 0.3715769350528717
}
|
32,841
|
Design an app in Android Studio to start an Intent service to monitor battery. If the battery level is under 30%, send a notification to alert the user regarding the battery state. It's made for Android 7.
BatteryManager bm = (BatteryManager)
getSystemService(BATTERY_SERVICE);
int percentage = bm.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
ad42a484e50740b08fd2f5e412327731
|
{
"intermediate": 0.5133768916130066,
"beginner": 0.196796715259552,
"expert": 0.2898264229297638
}
|
32,842
|
Design an app in Android Studio to start an Intent service to monitor battery. If the battery level is under 30%, send a notification to alert the user regarding the battery state. It's made for Android 7.
BatteryManager bm = (BatteryManager)
getSystemService(BATTERY_SERVICE);
int percentage = bm.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
68a087db33864e8c492e4d865a4d9bd4
|
{
"intermediate": 0.5133768916130066,
"beginner": 0.196796715259552,
"expert": 0.2898264229297638
}
|
32,843
|
This doesn't make a smooth q-slide-transition. How can I edit this code to allow that: <q-btn :aria-expanded="showFilters" aria-controls="filtersSection" id="filtersSectionID" v-if="!showSuperCP" class="text-center text-white" @click="toggleFilters()"
style="min-width: 10%; border-radius: 0"
:class="(!showURLs && !showPreviewUsers && !showBilling && !showSuperCP) ? 'bg-negative' : 'bg-red'">Filter</q-btn>
</div>
<q-slide-transition>
<div v-show="showFilters" style="display: flex;" id="filtersSection" role="region" aria-labelledby="filtersSectionID">
<!--<q-btn class="bg-negative text-white text-center q-mr-sm" @click="getBilling">{{ showBilling ? "Hide" : "Show" }} Billing</q-btn>-->
<q-btn role="button" aria-level="1" flat v-if="isSuper" class="bg-grey text-white" :style="showPreviewUsers ? '' : ''"
style="width: 50%; border-radius: 0;" @click="previewUsers">{{
showPreviewUsers ? "Hide" : "Show" }} Admins</q-btn>
<q-btn flat class="bg-grey text-white" style="width: 50%; border-radius: 0" @click="getURLS">{{ showURLs ?
"Hide" : "Show" }} URLs</q-btn>
<span v-if="false && fetchingUsage">Query Progress: {{ statscount }} of {{ groupNames.length }} </span>
</div>
</q-slide-transition>
|
5435635fd7ee80bcbd3a2f9cbad7a496
|
{
"intermediate": 0.453738272190094,
"beginner": 0.3468772768974304,
"expert": 0.1993844360113144
}
|
32,844
|
I made an app that's supposed to notify me having a low battery, below 30%. However im not getting any notifications. Can you help me with this?
Here's the code for my ServiceIntent as reference:
public class BatteryMonitorService extends IntentService {
public static final String ACTION_BATTERY_LOW = "com.example.app.ACTION_BATTERY_LOW";
public BatteryMonitorService() {
super("BatteryMonitorService");
}
@Override
protected void onHandleIntent(Intent intent) {
// Get the battery level
BatteryManager bm = (BatteryManager) getSystemService(BATTERY_SERVICE);
int batteryLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
// Check if the battery level is under the threshold
if (batteryLevel < BATTERY_THRESHOLD) {
// Send a notification to alert the user
sendBatteryLowNotification();
}
}
private void sendBatteryLowNotification() {
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "battery_monitor")
.setSmallIcon(R.drawable.ic_battery_low)
.setContentTitle("Battery Low")
.setContentText("Your battery level is under 30%. Please charge your device.")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
notificationManager.notify(0, builder.build());
}
}
|
5e07394a011b5be4014d2186148cf181
|
{
"intermediate": 0.3929378390312195,
"beginner": 0.357048362493515,
"expert": 0.2500137686729431
}
|
32,845
|
Container(
width: 230.w,
height: 300.h,
decoration: BoxDecoration(
color: UIColors.lightGrey,
borderRadius: BorderRadius.circular(16.sp),
),
child: SizedBox(
child: Text(
widget.fbName!,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
),
) i want to center the word
|
61075cf0f1dce2ca2061326fb9f4240f
|
{
"intermediate": 0.3115212023258209,
"beginner": 0.33421483635902405,
"expert": 0.35426393151283264
}
|
32,846
|
If you have ever played Genshin Impact, you must remember “Divine Ingenuity: Collector’s Chapter” event. In this event, players can create custom domains by arranging components, including props and traps, between the given starting point and exit point. Paimon does not want to design a difficult domain; she pursues the ultimate “automatic map”. In
the given domain with a size of m × n, she only placed Airflow and Spikes. Specifically, Spikes will eliminate the player (represented by ‘x’), while the Airflow will blow the player to the next position according to the wind direction (up, left, down, right represented by ‘w’, ‘a’, ‘s’, ‘d’, respectively). The starting point and exit point are denoted by ‘i’ and ‘j’, respectively. Ideally, in Paimon’s domain, the player selects a direction and advances one position initially; afterward, the Airflow propels the player to the endpoint without falling into the Spikes. The player will achieve automatic clearance in such a domain.
However, Paimon, in her slight oversight, failed to create a domain that allows players to achieve automatic clearance. Please assist Paimon by making the minimum adjustments to her design to achieve automatic clearance.
Given that the positions of the starting point and exit point are fixed, you can only adjust components at other locations. You have the option to remove existing component at any position; then, place a new direction of Airflow, or position a Spikes.
1.2 Input
The first line of input contains two integers m and n, representing the size of the domain. m lines follow, each containing n characters. The characters must be one of ‘w’, ‘a’, ‘s’, ‘d’, ‘x’, ‘i’ and ‘j’. It is guaranteed that there is only one ‘i’ and ‘j’ on the map, and they are not adjacent.
1.3 Output
Output a single integer, representing the minimum number of changes needed.
写一个python程序来满足上述要求
|
f059aa9cc86997c1ffc90c7cb088ae16
|
{
"intermediate": 0.41212189197540283,
"beginner": 0.27261677384376526,
"expert": 0.3152613043785095
}
|
32,847
|
Design an app in Android Studio to start an Intent service to monitor battery. If the battery level is under 30%, send a notification to alert the user regarding the battery state. It's made for Android 7. The app should show me my battery percentage. Use the following code as a basis:
BatteryManager bm = (BatteryManager)
getSystemService(BATTERY_SERVICE);
int percentage = bm.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
5bea70d1946975ca1df9d213647eefc8
|
{
"intermediate": 0.4389653503894806,
"beginner": 0.24645039439201355,
"expert": 0.31458428502082825
}
|
32,848
|
Design an app in Android Studio to start an Intent service to monitor battery. If the battery level is under 30%, send a notification to alert the user regarding the battery state. It’s made for Android 7. The app should show me my battery percentage. Use the following code as a basis:
BatteryManager bm = (BatteryManager)
getSystemService(BATTERY_SERVICE);
int percentage = bm.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
8b85c3d3a958d93842dfc50db81ce2bf
|
{
"intermediate": 0.4791129231452942,
"beginner": 0.22327865660190582,
"expert": 0.2976084351539612
}
|
32,849
|
What is the best board manager for esp8266
|
5e6156a895153d177136fd2a99c0f689
|
{
"intermediate": 0.3357447385787964,
"beginner": 0.22959256172180176,
"expert": 0.43466266989707947
}
|
32,850
|
Design an app in Android Studio to start an Intent service to monitor battery live. If the battery level is under 30%, send a notification to alert the user regarding the battery state. It’s made for Android 7. The app should show me my battery percentage. Use the following code as a basis:
BatteryManager bm = (BatteryManager)
getSystemService(BATTERY_SERVICE);
int percentage = bm.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
65e1bb2b9aff73f694fffc3e5f15d50e
|
{
"intermediate": 0.47911518812179565,
"beginner": 0.23212359845638275,
"expert": 0.2887612283229828
}
|
32,851
|
What is Bluetooth Device (Personal Area Network) #2 and is it safe to delete it?
|
35f07c8b03c6c1538da8acf0854fb644
|
{
"intermediate": 0.3583149015903473,
"beginner": 0.36033692955970764,
"expert": 0.2813481390476227
}
|
32,852
|
tspan = [0,18000];
Tb0 = 10;
[t,Tb] = ode45(@(t,Tb) Rth*As_Box*Tb(Tf-Tb)*R/(Cv*Pair*V_Box), tspan, Tb0);
plot (t, Tb)
|
7d3a61c5c20f411f1c3d0ef5365e8c52
|
{
"intermediate": 0.27579548954963684,
"beginner": 0.43871837854385376,
"expert": 0.285486102104187
}
|
32,853
|
How do i enable https/3 and quic in firefox in about:config
|
fba969b5d71f95949d76e2ca7c39cd27
|
{
"intermediate": 0.6250485777854919,
"beginner": 0.18757498264312744,
"expert": 0.187376469373703
}
|
32,854
|
refactor this code if observers_group.status == ObserversStatus.PROBLEM.value and data == ObserversStatus.RECORDED.value:
raise ObserverIvalidStatus
elif observers_group.status in (ObserversStatus.NOT_RELEVANT.value, ObserversStatus.DECIDED.value) and data == ObserversStatus.PROBLEM.value:
raise ObserverIvalidStatus
|
473aeae57f7c723f43d95349819bcafa
|
{
"intermediate": 0.44163021445274353,
"beginner": 0.3183116614818573,
"expert": 0.2400580793619156
}
|
32,855
|
I want to create a program to automatically apply for a jobs on the websites like linkedin
|
59bd51941e20e78e82c65638dfb1ec70
|
{
"intermediate": 0.20988209545612335,
"beginner": 0.16183994710445404,
"expert": 0.6282779574394226
}
|
32,856
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Player : MonoBehaviour
{
public float speed = 5f; // Speed of character movement
public int maxHealth = 3; // Maximum player health
public int currentHealth; // Current player health
private Animator anim;
private bool isInvincible = false; // Flag to track invincibility state
private float invincibleTimer = 2f; // Duration of invincibility in seconds
private void Start()
{
anim = GetComponent<Animator>();
currentHealth = maxHealth; // Set the initial health to maxHealth value
}
private void Update()
{
// Move character based on input axes
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
// Calculate movement direction
Vector2 movement = new Vector2(horizontalInput, verticalInput) * speed * Time.deltaTime;
// Apply movement to the character’s position
transform.Translate(movement);
anim.SetFloat("moveX", movement.x);
anim.SetFloat("moveY", movement.y);
}
private void OnCollisionEnter2D(Collision2D collision)
{
// Check if the player collides with an enemy or boss and is not invincible
if ((collision.gameObject.CompareTag("Enemy") || collision.gameObject.CompareTag("Boss")) && !isInvincible)
{
TakeDamage(1); // Deduct 1 health point
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
else
{
StartCoroutine(StartInvincibility()); // Start the invincibility timer
}
}
// Check if the player collides with a health object
if (collision.gameObject.CompareTag("Health"))
{
AddHealth(1); // Increase health by 1
Destroy(collision.gameObject); // Destroy the health object
}
}
public void TakeDamage(int amount)
{
currentHealth -= amount; // Deduct the specified amount from the current health
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
}
public void AddHealth(int amount)
{
currentHealth += amount; // Increase the current health by the specified amount
currentHealth = Mathf.Min(currentHealth, maxHealth); // Ensure current health doesn’t exceed max health
}
private void ResetScene()
{
SceneManager.LoadScene("Level1");
}
private IEnumerator StartInvincibility()
{
isInvincible = true; // Set the invincibility flag to true
yield return new WaitForSeconds(invincibleTimer); // Wait for the specified duration
isInvincible = false; // Set the invincibility flag back to false
}
}
make it so when the scene first loads the player is invincible for 3 seconds
|
ca5b127b6f2fc426022f90480209d3ff
|
{
"intermediate": 0.4064123332500458,
"beginner": 0.37771549820899963,
"expert": 0.2158721536397934
}
|
32,857
|
write a vba excel macro to remove cell content of active selection cell if it is the same as the above one and from search from bottom to the top
|
b9405d986c7823f0189e6173b990d49d
|
{
"intermediate": 0.3179210424423218,
"beginner": 0.171675443649292,
"expert": 0.510403573513031
}
|
32,858
|
hello, can you write me a program in c++ according to the following requirements:
|
78f2c219d88ca2de0042ead883f9fa20
|
{
"intermediate": 0.28503113985061646,
"beginner": 0.377098947763443,
"expert": 0.3378698527812958
}
|
32,859
|
Can you write a C program that implements fizzbuzz without using modulo division?
|
dc28a18c602e38f0a4435e7644a9bb9f
|
{
"intermediate": 0.272589772939682,
"beginner": 0.23568566143512726,
"expert": 0.49172458052635193
}
|
32,860
|
请详细解释以下代码: const onFormSubmit = useCallback(
(e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (value.trim()) {
props.onSubmit(value)
}
setValue('')
},
[props, value],
)
|
75dc9e11a2f797c0f12635d2ca6b443b
|
{
"intermediate": 0.4778457581996918,
"beginner": 0.32472923398017883,
"expert": 0.19742494821548462
}
|
32,861
|
Create an app that would send me a message to my email daily at 8am for remote machine learning roles at https://github.com/monkrus/convobots/edit/main/README.md
|
4ec6da7e23c90fc8bfd99526a7446f17
|
{
"intermediate": 0.19107089936733246,
"beginner": 0.15332478284835815,
"expert": 0.655604362487793
}
|
32,862
|
Create an app that sends every morning to my email a list of new jobs from https://startup.jobs/?q=machine+learning&remote=true&c=Full-Time
|
6848920e7cec6a414b4e2a2642166d30
|
{
"intermediate": 0.08470550179481506,
"beginner": 0.11894375085830688,
"expert": 0.7963507175445557
}
|
32,863
|
1) In the context of a custom systemd service, does WantedBy=multi-user.target mean the custom systemd service will do what it's meant to do right before all the other shutdown-oriented tasks are done?
2) If so, how could I make a a systemd service like the above except that it does what it's meant to do right before all the other startup-related tasks are done?
Be concise for everything.
|
32566df38347480560948532753b9a20
|
{
"intermediate": 0.35729357600212097,
"beginner": 0.3001512289047241,
"expert": 0.3425551950931549
}
|
32,864
|
Wite a code to run pi hole and firewall on pi 4
|
d41e257a5b2ac65bd345c586860f3b79
|
{
"intermediate": 0.2944522500038147,
"beginner": 0.14590594172477722,
"expert": 0.5596418380737305
}
|
32,865
|
How exactly could I export a sfm model that was imported into blender, back into sfm?
|
87e81ef30906fb20ceead968d996b7ce
|
{
"intermediate": 0.39548245072364807,
"beginner": 0.2081083208322525,
"expert": 0.396409273147583
}
|
32,866
|
ModuleNotFoundError: No module named 'keys'
|
54758a8c0188ee65a913d02d8b47741c
|
{
"intermediate": 0.38376691937446594,
"beginner": 0.2892356514930725,
"expert": 0.3269973695278168
}
|
32,867
|
when exporting a sfm model from blender back into sfm, where exactly do the textures go?
|
449c06e1b990afbc371a3a20fbd06163
|
{
"intermediate": 0.3964286744594574,
"beginner": 0.20070819556713104,
"expert": 0.402863085269928
}
|
32,868
|
would you fix this code ".model small
.stack 100h
.data
prompt1 db 'Enter first 2-digit binary number: $'
prompt2 db 13, 10, 'Enter second 2-digit binary number: $'
resultMsg db 13, 10, 'The sum is: $'
promptInvalid db 13, 10, 'Invalid input. Enter either 0 or 1: $'
num1 db 2 dup ('0') ; Buffer for the first number
num2 db 2 dup ('0') ; Buffer for the second number
sum db 3 dup ('0') ; Buffer for the sum (up to 3 digits for overflow)
linefeed db 13, 10, '$'
.code
; Procedure to read two characters as a 2-digit binary number
ReadBinaryNumber PROC near
mov cx, 2 ; Counter for two digits
mov bx, 0 ; BX will contain the binary number
read_loop:
mov ah, 1 ; Function for reading a char without echo
int 21h ; Call interrupt
cmp al, '0' ; Check if input is '0'
jb invalid_input ; If below '0', it's invalid
cmp al, '1' ; Check if input is '1'
ja invalid_input ; If above '1', it's invalid
; Convert char to digit and shift left to concatenate
sub al, '0' ; Convert from ASCII to binary digit (0 or 1)
shl bx, 1 ; Shift left to make space for the next bit
or bl, al ; Insert the bit into the binary number
loop read_loop ; Continue until two digits are read
ret ; Return with binary number in BX
invalid_input:
mov dx, offset promptInvalid
mov ah, 09h
int 21h
jmp read_loop ; Ask for input again if invalid
ReadBinaryNumber ENDP
start:
mov ax, @data
mov ds, ax
; Prompt and read the first binary number
mov ah, 09h
mov dx, offset prompt1
int 21h
call ReadBinaryNumber
mov [num1], bl ; Use BL instead of BX to store the first digit
; Prompt and read the second binary number
mov ah, 09h
mov dx, offset prompt2
int 21h
call ReadBinaryNumber
mov [num2], bl ; Use BL instead of BX to store the second digit
; Add the binary numbers - note that BL already contains the second number
add bl, [num1]
; Convert result to binary
mov cx, 2 ; We have 2 binary digits
mov di, offset sum + 2 ; Start at the end of the sum buffer
convert_loop:
ror bl, 1 ; Rotate right to get each bit
adc al, 0 ; AL = 0 + carry
and al, 1 ; Keep only the least significant bit
or al, '0' ; Convert the bit to '0' or '1'
dec di
mov [di], al ; Store the ASCII character
loop convert_loop
; Print the sum
mov ah, 09h
mov dx, offset resultMsg
int 21h
; Print the result in binary
lea dx, [di] ; DX points to the beginning of the converted result
mov ah, 09h
int 21h
; Newline
mov ah, 09h
mov dx, offset linefeed
int 21h
; Exit program
mov ax, 4C00h
int 21h
end start
"
on this code the program should do the binary addition in TASM programming, the code i gave u is running but it display wrong output
|
d21993789d09cefdf96ea7c4920200f0
|
{
"intermediate": 0.3596217930316925,
"beginner": 0.48137301206588745,
"expert": 0.15900516510009766
}
|
32,869
|
"The DALY formula was applied to age and gender stratified human CE surgical incidence data. The DALY is made up of two parts; years of life lost due to mortality (YLL) and years of life lost due to time lived in a disability state (YLD). The formulas for YLL and YLD are:
where N = number of deaths per age-sex group, L = remaining life expectancy at age of death
where I = age and sex specific estimates of incidence, DW = disability weight, D = average duration of disability.
Disability weight for CE was assigned a multinomial distribution based on numerous retrospective studies evaluating postoperative outcome. In accordance with previous studies, the percentage of patients projected to improve after surgery was assigned a disability weight of 0.200 for 1 year, the percentage of patients projected to have substantial postsurgical complications was assigned a disability of 0.239 for 5 years, the percentage of patients projected to have recurrent disease was assigned a disability of 0.809 for 5 years, and the percentage of patients projected to die postoperatively were assigned a disability of 1 (indicating death) for the remainder of their predicted lifespan."
From the above paragraph, how do you interpret this part "[...] and the percentage of patients projected to die postoperatively were assigned a disability of 1 (indicating death) for the remainder of their predicted lifespan."; this is accounting as YLDs or as YLLs?
|
960d23d66e19ebf42d773d301a5d28e7
|
{
"intermediate": 0.18859846889972687,
"beginner": 0.4647670388221741,
"expert": 0.34663450717926025
}
|
32,870
|
how can I combine these cmds:
grep “EQUINO” fallecidos_sinadef.csv |
grep “HIDAT” fallecidos_sinadef.csv
I just want to catch anything that has “EQUINO*”OR “HIDAT*”
|
df4a35c98c7efd88cb3a401e67f127fb
|
{
"intermediate": 0.4367629289627075,
"beginner": 0.2597370445728302,
"expert": 0.3035000264644623
}
|
32,871
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BossAttack2 : MonoBehaviour
{
public GameObject bombPrefab; // Reference to the bomb prefab
public float spawnRadius = 2f; // Maximum distance from boss to spawn the bomb
public float explosionDelay = 2f; // Delay after which the bomb explodes
private bool canPlaceBomb = true;
private void Update()
{
if (canPlaceBomb)
{
StartCoroutine(PlaceBomb());
}
}
private IEnumerator PlaceBomb()
{
canPlaceBomb = false;
Vector3 randomOffset = Random.insideUnitCircle.normalized * spawnRadius;
Vector3 spawnPosition = transform.position + randomOffset;
GameObject bomb = Instantiate(bombPrefab, spawnPosition, Quaternion.identity);
yield return new WaitForSeconds(explosionDelay); // Delay before the bomb explodes
// Handle explosion (e.g., damage nearby objects, particle effects, etc.)
Debug.Log("Bomb exploded!");
Destroy(bomb); // Destroy the bomb
yield return new WaitForSeconds(Random.Range(1f, 5f)); // Time delay between bomb placements
canPlaceBomb = true;
}
}
make it so the explosion is only 1m radius
|
c1d6ca43a83cde6c90cc8cfb5633c8ec
|
{
"intermediate": 0.46999967098236084,
"beginner": 0.3539038896560669,
"expert": 0.1760963797569275
}
|
32,872
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Player : MonoBehaviour
{
public float speed = 5f; // Speed of character movement
public int maxHealth = 3; // Maximum player health
public int currentHealth; // Current player health
private Animator anim;
private bool isInvincible = false; // Flag to track invincibility state
private float invincibleTimer = 2f; // Duration of invincibility in seconds
private void Start()
{
anim = GetComponent<Animator>();
currentHealth = maxHealth; // Set the initial health to maxHealth value
StartCoroutine(StartInvincibility());
}
private void Update()
{
// Move character based on input axes
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
// Calculate movement direction
Vector2 movement = new Vector2(horizontalInput, verticalInput) * speed * Time.deltaTime;
// Apply movement to the character’s position
transform.Translate(movement);
anim.SetFloat("moveX", movement.x);
anim.SetFloat("moveY", movement.y);
}
private void OnCollisionEnter2D(Collision2D collision)
{
// Check if the player collides with an enemy or boss and is not invincible
if ((collision.gameObject.CompareTag("Enemy") || collision.gameObject.CompareTag("Boss")) && !isInvincible)
{
TakeDamage(1); // Deduct 1 health point
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
else
{
StartCoroutine(StartInvincibility()); // Start the invincibility timer
}
}
// Check if the player collides with a health object
if (collision.gameObject.CompareTag("Health"))
{
AddHealth(1); // Increase health by 1
Destroy(collision.gameObject); // Destroy the health object
}
// Check if the player collides with the bomb
if (collision.gameObject.CompareTag("Bomb"))
{
Bomb bomb = collision.gameObject.GetComponent<Bomb>();
bomb.Explode(); // Trigger bomb explosion on the player
}
}
public void TakeDamage(int amount)
{
currentHealth -= amount; // Deduct the specified amount from the current health
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
}
public void AddHealth(int amount)
{
currentHealth += amount; // Increase the current health by the specified amount
currentHealth = Mathf.Min(currentHealth, maxHealth); // Ensure current health doesn’t exceed max health
}
private void ResetScene()
{
SceneManager.LoadScene("Level1");
}
private IEnumerator StartInvincibility()
{
isInvincible = true; // Set the invincibility flag to true
yield return new WaitForSeconds(invincibleTimer); // Wait for the specified duration
isInvincible = false; // Set the invincibility flag back to false
}
}
i changed the sprite of the bomb, why when it explodes or the player collides with it is it not doing damage?
|
5b3245797403385659b2483bb6842b0b
|
{
"intermediate": 0.33102771639823914,
"beginner": 0.5098080039024353,
"expert": 0.15916432440280914
}
|
32,873
|
import time
start_time = time.time()
image = cv2.imread("0.6/01.pgm", cv2.COLOR_BGR2GRAY)
IMAGE_THRESHOLD = 100
def count_zero_pixels(image):
zero_pixels = np.count_nonzero(image == 0)
return zero_pixels
def calculate_zero_pixel_percentage(image):
total_pixels = image.size
zero_pixels = count_zero_pixels(image)
zero_percentage = zero_pixels / total_pixels * 100
return zero_percentage
zero_percentage = calculate_zero_pixel_percentage(image)
if zero_percentage > 75:
IMAGE_THRESHOLD = 0
print(f"image_threshold: {IMAGE_THRESHOLD}")
print(f"Процент зануленных пикселей относительно всех пикселей: {zero_percentage}%")
def get_coords_by_threshold(
image: np.ndarray, threshold: int = IMAGE_THRESHOLD
) -> tuple:
"""Gets pixel coords with intensity more then 'theshold'."""
coords = np.where(image > threshold)
return coords
def delete_pixels_by_min_threshold(
image: np.ndarray, min_threshold: int = IMAGE_THRESHOLD
) -> np.ndarray:
"""Deletes coords from image and returns this image."""
anti_coords = np.where(image < min_threshold)
image[anti_coords] = 0
return image
def get_neigh_nums_list(
coords: tuple, kernel_size: int = 3
) -> list:
"""
Gets list with number of neighborhoods by kernel.
Returns list like [[x1, y1, N1], [x2, y2, N2]],
Where N - neighborhood's number.
"""
neigh_nums = []
offset = (kernel_size - 1) // 2
for x, y in zip(coords[0], coords[1]):
if x < 0 + offset or x > image.shape[0] - offset:
continue
if y < 0 + offset or y > image.shape[1] - offset:
continue
kernel = image[x-offset:x+offset+1, y-offset:y+offset+1]
step_neigh_num = np.count_nonzero(kernel) - 1
neigh_nums.append([x, y, step_neigh_num])
return neigh_nums
def get_neigh_coeffs_list(
coords: tuple, kernel: np.array
) -> list:
"""
Gets list with number of neighborhoods by kernel.
Returns list like [[x1, y1, N1], [x2, y2, N2]],
Where N - neighborhood's coeffs.
"""
neigh_coeffs = []
offset = (kernel.shape[0] - 1) // 2
print(offset)
for x, y in zip(coords[0], coords[1]):
if x < 0 + offset or x > image.shape[0] - offset:
continue
if y < 0 + offset or y > image.shape[1] - offset:
continue
try:
image_kernel = image[x-offset:x+offset+1, y-offset:y+offset+1]
step_neigh_coeff = np.sum(kernel * image_kernel)
neigh_coeffs.append([x, y, step_neigh_coeff])
except ValueError as e:
continue
return neigh_coeffs
def sort_neight_nums_by_N(neigh_nums: list) -> np.ndarray:
"""
Sort neigh_nums by N parameter.
Removes N=-1, N=0 and sorts by N desc.
"""
np_neigh_nums = np.array(neigh_nums)
np_neigh_nums = np_neigh_nums[
(np_neigh_nums[:, 2] != -1) & (np_neigh_nums[:, 2] != 0)]
np_neigh_nums = np_neigh_nums[
np.argsort(-np_neigh_nums[:, 2])]
return np_neigh_nums
def get_potential_points_coords(
sorted_niegh_nums: np.ndarray, potential_points_num: int = 200
) -> np.ndarray:
"""
Gets best candidates, potential points coords only.
Returns np.ndarray like [[x1, y1], [x2, y2]].
"""
sorted_neigh_nums = np.delete(sorted_niegh_nums, 2, axis=1)
return sorted_neigh_nums[:potential_points_num]
def get_best_lines(potential_points: np.ndarray) -> np.ndarray:
"""
Gets best combinations of lines by all points.
Line y = kx + b.
Returns np.ndarray like [[k1, b1], [k2, b2]].
"""
best_lines = []
num_lines = 0
iterations_num = 1000
threshold_distance = 1
threshold_k = 0.5
threshold_b = 20
while num_lines < 3:
if num_lines == 0:
remaining_points = np.copy(potential_points)
print(f"remaining points: {len(remaining_points)}")
best_inliers = []
best_line = None
for i in range(iterations_num):
sample_indices = np.random.choice(remaining_points.shape[0], size=3, replace=False)
sample_points = remaining_points[sample_indices]
sample_x = sample_points[:, 1]
sample_y = sample_points[:, 0]
coefficients = np.polyfit(sample_x, sample_y, deg=1)
distances = np.abs(remaining_points[:, 0] - np.matmul(np.vstack((remaining_points[:, 1], np.ones_like(remaining_points[:, 1]))).T, coefficients)) / np.sqrt(coefficients[0] ** 2 + 1)
inliers = np.where(distances < threshold_distance)[0]
is_similar = False
for line in best_lines:
diff_k = abs(coefficients[0] - line[0])
diff_b = abs(coefficients[1] - line[1])
if diff_k <= threshold_k and diff_b <= threshold_b:
is_similar = True
break
if not is_similar and len(inliers) > len(best_inliers):
best_line = coefficients
best_inliers = inliers
if best_line is not None:
best_lines.append(best_line)
# buffer = remaining_points
remaining_points = np.delete(remaining_points, best_inliers, axis=0)
# if len(remaining_points) < 1:
# remaining_points = np.append(remaining_points, buffer[:len(buffer)//2 + 1])
num_lines += 1
return np.array(best_lines)
# main
coords = get_coords_by_threshold(image)
# @@@
kernel = np.array([[-1, -1, -1, -1, -1], [-1, 5, 5, 5, -1], [-1, 5, 0, 5, -1], [-1, 5, 5, 5, -1], [-1, -1, -1, -1, -1]])
neigh_nums = get_neigh_nums_list(coords, 11)
sorted_neigh_nums = sort_neight_nums_by_N(neigh_nums)
potential_points = get_potential_points_coords(sorted_neigh_nums)
best_lines = get_best_lines(potential_points)
print(best_lines)
# Visualization
plt.imshow(image, cmap="gray")
plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o")
plt.show()
# Plot the lines on the image
for equation in best_lines:
k, b = equation
x = np.arange(0, image.shape[1])
y = k * x + b
plt.imshow(image, cmap="gray")
plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o")
plt.plot(x, y, color="green")
plt.scatter(potential_points[:, 1], potential_points[:, 0], color="red", marker="o")
plt.show()
intersection_points = np.array([
np.linalg.solve(np.array([[best_lines[0][0], -1], [best_lines[1][0], -1]]), np.array([-best_lines[0][1], -best_lines[1][1]])),
np.linalg.solve(np.array([[best_lines[0][0], -1], [best_lines[2][0], -1]]), np.array([-best_lines[0][1], -best_lines[2][1]])),
np.linalg.solve(np.array([[best_lines[1][0], -1], [best_lines[2][0], -1]]), np.array([-best_lines[1][1], -best_lines[2][1]]))
], dtype=np.float32)
print(intersection_points)
end_time = time.time()
elapsed_time = end_time - start_time
print('Elapsed time: ', elapsed_time)
Почему код на treshold_k не срабатывает? Он все равно находит прямые, k между которыми менее 0.5
|
18f3f414ae7c75ceacd00f6b6b506b29
|
{
"intermediate": 0.25380852818489075,
"beginner": 0.4495691955089569,
"expert": 0.29662221670150757
}
|
32,874
|
i am getting this error: NullReferenceException: Object reference not set to an instance of an object
Player.OnCollisionEnter2D (UnityEngine.Collision2D collision) (at Assets/__Scripts/Player.cs:69) for the following script: using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Player : MonoBehaviour
{
public float speed = 5f; // Speed of character movement
public int maxHealth = 3; // Maximum player health
public int currentHealth; // Current player health
private Animator anim;
private bool isInvincible = false; // Flag to track invincibility state
private float invincibleTimer = 2f; // Duration of invincibility in seconds
private void Start()
{
anim = GetComponent<Animator>();
currentHealth = maxHealth; // Set the initial health to maxHealth value
StartCoroutine(StartInvincibility());
}
private void Update()
{
// Move character based on input axes
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
// Calculate movement direction
Vector2 movement = new Vector2(horizontalInput, verticalInput) * speed * Time.deltaTime;
// Apply movement to the character’s position
transform.Translate(movement);
anim.SetFloat("moveX", movement.x);
anim.SetFloat("moveY", movement.y);
}
private void OnCollisionEnter2D(Collision2D collision)
{
// Check if the player collides with an enemy or boss and is not invincible
if ((collision.gameObject.CompareTag("Enemy") || collision.gameObject.CompareTag("Boss")) && !isInvincible)
{
TakeDamage(1); // Deduct 1 health point
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
else
{
StartCoroutine(StartInvincibility()); // Start the invincibility timer
}
}
// Check if the player collides with a health object
if (collision.gameObject.CompareTag("Health"))
{
AddHealth(1); // Increase health by 1
Destroy(collision.gameObject); // Destroy the health object
}
// Check if the player collides with the bomb
if (collision.gameObject.CompareTag("Bomb"))
{
Bomb bomb = collision.gameObject.GetComponent<Bomb>();
bomb.Explode(); // Trigger bomb explosion on the player
}
}
public void TakeDamage(int amount)
{
currentHealth -= amount; // Deduct the specified amount from the current health
if (currentHealth <= 0)
{
ResetScene(); // Reset the scene if health reaches 0
}
}
public void AddHealth(int amount)
{
currentHealth += amount; // Increase the current health by the specified amount
currentHealth = Mathf.Min(currentHealth, maxHealth); // Ensure current health doesn’t exceed max health
}
private void ResetScene()
{
SceneManager.LoadScene("Level1");
}
private IEnumerator StartInvincibility()
{
isInvincible = true; // Set the invincibility flag to true
yield return new WaitForSeconds(invincibleTimer); // Wait for the specified duration
isInvincible = false; // Set the invincibility flag back to false
}
}
|
fac7017bf220c6bd7c80837438ca3fe1
|
{
"intermediate": 0.3893703818321228,
"beginner": 0.44454216957092285,
"expert": 0.16608747839927673
}
|
32,875
|
what is SQL code for Insert three more records into the "Players" table that contain the following data:
(2, "Karl", 20)
|
3a2a9ea8e6ed0e5f82a02d66b2b97a95
|
{
"intermediate": 0.2453092634677887,
"beginner": 0.44007644057273865,
"expert": 0.31461429595947266
}
|
32,876
|
I need to webscrape https://startup.jobs/?remote=true&c=Full-Time&q=machine+learning and select all remote full time machine learning jobs
|
ea5c438427c1ea28f9b25f7b2b12a1c8
|
{
"intermediate": 0.08504396677017212,
"beginner": 0.1431514173746109,
"expert": 0.7718046307563782
}
|
32,877
|
Objective:
Write a Python program that creates a child thread and explore the concepts of Process IDs
(PIDs) and Thread IDs in a multithreaded environment.
Tasks:
1. Create a Child Thread Function:
• Define a function that the child thread will execute. This function should print the child
thread’s Process ID and Thread ID. Let it perform a simple task, like a loop with a sleep
delay, and print a message each iteration.
2. Main Thread:
• In the main part of your script, print the main thread’s Process ID and Thread ID.
• Create and start the child thread from this main part.
3. Thread Joining:
• Use the join() method to wait for the child thread to complete. Then, experiment
with commenting out the join() method to observe the behaviour change.
Instructions:
• Use the threading module for creating and managing threads.
• Use os.getpid() to get the Process ID and threading.get_native_id() for
the Thread ID.
• Experiment with and without the join() method and observe the differences
|
7d8732ddb5e6b8f6338d9d11fae54740
|
{
"intermediate": 0.3350302278995514,
"beginner": 0.44603168964385986,
"expert": 0.21893809735774994
}
|
32,878
|
Create an explanation of this text with examples so that a beginner would understand it: "The main purpose of a database management system is not just to store the data, but also facilitate retrieval of the data. In its simplest form, a SELECT statement is select star from table name. Based on a simplified library database model and the table Book, SELECT star from Book gives a result set of four rows. All the data rows for all columns in the table Book are displayed or you can retrieve a subset of columns for example, just two columns from the table book such as Book_ID and Title. Or you can restrict the result set by using the WHERE clause. For example, you can select the title of the book whose Book_ID is B1. But what if we don't know exactly what value to specify in the WHERE clause? The WHERE clause always requires a predicate, which is a condition that evaluates to true, false or unknown. But what if we don't know exactly what value the predicate is? For example, what if we can't remember the name of the author, but we remember that their first name starts with R? In a relational database, we can use string patterns to search data rows that match this condition. Let's look at some examples of using string patterns. If we can't remember the name of the author, but we remember that their name starts with R, we use the WHERE clause with the like predicate. The like predicate is used in a WHERE clause to search for a pattern in a column. The percent sign is used to define missing letters. The percent sign can be placed before the pattern, after the pattern, or both before and after the pattern. In this example, we use the percent sign after the pattern, which is the letter R. The percent sign is called a wildcard character. A wildcard character is used to substitute other characters. So, if we can't remember the name of the author, but we can remember that their first name starts with the letter R, we add the like predicate to the WHERE clause. For example, select first name from author, where firstname like 'R%'. This will return all rows in the author table whose author's first name starts with the letter R. And here is the result set. Two rows a return for authors Raul and Rav. What if we wanted to retrieve the list of books whose number of pages is more than 290, but less than 300. We could write the SELECT statement like this, specifying the WHERE clause as, where pages is greater than or equal to 290, and pages is less than or equal to 300. But in a relational database, we can use a range of numbers to specify the same condition. Instead of using the comparison operators greater than or equal to, we use the comparison operator 'between and.' 'Between and' compares two values. The values in the range are inclusive. In this case,we rewrite the query to specify the WHERE clause as where pages between 290 and 300. The result set is the same, but the SELECT statement is easier and quicker to write. In some cases, there are data values that cannot be grouped under ranges. For example, if we want to know which countries the authors are from. If we wanted to retrieve authors from Australia or Brazil, we could write the SELECT statement with the WHERE clause repeating the two country values. However, what if we want to retrieve authors from Canada, India, and China? The WHERE clause would become very long repeatedly listing the required country conditions. Instead, we can use the IN operator. The IN operator allows us to specify a set of values in a WHERE clause. This operator takes a list of expressions to compare against. In this case the countries Australia or Brazil. Now you can describe how to simplify a SELECT statement by using string patterns, ranges, or sets of values. "
|
bfca1643da7724ca9f740493159a71d3
|
{
"intermediate": 0.51723712682724,
"beginner": 0.323947012424469,
"expert": 0.15881586074829102
}
|
32,879
|
in sfm, how exactly could I create a hologram effect
|
aa02119b86ed757a0e49f313c9bdeb9d
|
{
"intermediate": 0.29134538769721985,
"beginner": 0.20579054951667786,
"expert": 0.5028640627861023
}
|
32,880
|
in sfm, how could I use a light to project a realistic image?
|
cc1f7adf8fb87d45dcdf1fbbca06f408
|
{
"intermediate": 0.3872905671596527,
"beginner": 0.2337113320827484,
"expert": 0.3789980709552765
}
|
32,881
|
Virtual function
|
fdd03b50e23286ddfbaa453976f1f0fc
|
{
"intermediate": 0.2540137469768524,
"beginner": 0.2551158368587494,
"expert": 0.4908704161643982
}
|
32,882
|
in sfm, how exactly could I create an animated light texture?
|
8ecaffcd4feffeb8c22a8d64cbe46c2b
|
{
"intermediate": 0.4707827866077423,
"beginner": 0.15686717629432678,
"expert": 0.3723500669002533
}
|
32,883
|
SELECT
DATE(lastModifiedAt) AS target_date,
LEFT(userId, 8) AS idp_service_id,
COUNT (DISTINCT userId) AS sign_up_count
FROM
oauth_approvals
WHERE
lastModifiedAt >= '2021-10-16 00:00:00'
AND lastModifiedAt <= '2023-11-30 23:59:59'
AND clientServiceId = 'LT001001'
AND LEFT (userId, 8) IN ('TH001001', 'QA001001', 'IT002002', 'BR002001')
GROUP BY
target_date,
idp_service_id
ORDER BY
target_date ASC
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT userId) AS sign_up_count
FROM
oauth_approvals
WHERE
lastMod' at line 4
时间: 0.13s
sql的错误信息 请问我sql的问题在哪
|
6b9227c714a81d9adfc654ee5db095ea
|
{
"intermediate": 0.22115644812583923,
"beginner": 0.5446643233299255,
"expert": 0.23417918384075165
}
|
32,884
|
Types of website hosting
|
df2f0dacbb7bdef3393b71b18749f46e
|
{
"intermediate": 0.3495843708515167,
"beginner": 0.3516497015953064,
"expert": 0.29876595735549927
}
|
32,885
|
Design a java program that will input a number and will print "Divisible". If the number is divisible by 5, otherwise print "Not Divisible". Use if else if else statement and Switch statement.
|
8548cd2ded660f159a76997b23629bcf
|
{
"intermediate": 0.3995809555053711,
"beginner": 0.40249305963516235,
"expert": 0.19792598485946655
}
|
32,886
|
Difference between static and dynamic websites
|
8fa6f31bdb5b1b4613e0b414f99675ec
|
{
"intermediate": 0.3267386555671692,
"beginner": 0.4153815805912018,
"expert": 0.25787976384162903
}
|
32,887
|
What is the version of chat gpt?
|
ce0e0dfbaaf79e102f17e2939e24c96d
|
{
"intermediate": 0.25626373291015625,
"beginner": 0.3805727958679199,
"expert": 0.36316344141960144
}
|
32,888
|
Write a simple program that shows how a function is defined and called in JavaScript
|
d306b44755645852a9765e5998c8b11a
|
{
"intermediate": 0.23680031299591064,
"beginner": 0.5832251906394958,
"expert": 0.1799745261669159
}
|
32,889
|
.helm/values.yaml
base-chart:
defaultImagePullPolicy: IfNotPresent
generic:
serviceAccountName: "{{ .Release.Name }}"
extraImagePullSecrets:
- name: dockey
deploymentsGeneral:
terminationGracePeriodSeconds: 120
envFrom:
- secretRef:
name: sec-widget-config
serviceAccount:
"{{ .Release.Name }}":
labels: {}
services:
app:
type: ClusterIP
ports:
http:
port: 80
targetPort: http
protocol: TCP
ingresses:
http:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-body-size: "128m"
nginx.ingress.kubernetes.io/use-regex: "true"
serviceMonitors:
http:
endpoints:
http:
path: /metrics
interval: 15s
deployments:
app:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 5
maxUnavailable: 5
containers:
app:
securityContext:
capabilities:
add:
- SYS_PTRACE
ports:
http:
containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 500m
memory: 500Mi
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: nginx-config
mountPath: /etc/nginx/mime.types
subPath: mime-types
volumes:
- type: configMap
name: nginx-config
items:
- key: nginx.conf
path: nginx.conf
- key: mime-types
path: mime-types
configMaps:
nginx-config:
data:
nginx.conf: |
pid /var/run/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
}
http {
keepalive_timeout 65;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/json
application/ld+json
application/manifest+json
application/octet-stream
application/rdf+xml
application/rss+xml
application/x-javascript
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
server {
listen 8080;
charset UTF-8;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
mime-types: |
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
Добавить под антиафинити для равномерного распределения подов по нодам
1. пример -
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 80
podAffinityTerm:
labelSelector:
matchLabels:
app: {{ include “orders.fullname” . }}
version: {{ .Values.image.tag | default .Chart.AppVersion | sha256sum | trunc 63 }}
topologyKey: “kubernetes.io/hostname”. Ответ на русском
|
d47f70f67d0c15a0957975b50f4494e7
|
{
"intermediate": 0.33683866262435913,
"beginner": 0.5886334180831909,
"expert": 0.07452785223722458
}
|
32,890
|
-- This script assumes that SwitchResX daemon is installed and that Test1 and Test2 are valid display set names
tell application "SwitchResX Daemon"
-- Activate the application
activate
-- Get the current display set name
apply display set "Test1"
-- Check if it is different from Test1
if name is not equal to "Test1" then
-- Apply Test1 display set
apply display set "Test1"
-- Display a notification
display notification "Switched to Test1 display set" with title "SwitchResX"
-- Set a variable to store the current time
set startTime to current date
-- Create a file to indicate the script is running
do shell script "touch ~/script_running"
-- Repeat until 5 seconds have passed
repeat until (time of (current date)) - startTime > 5
-- Check if the script is run again
if not (do shell script "[ -f ~/script_running ] && echo true || echo false") as boolean then
-- Exit the repeat loop
exit repeat
end if
end repeat
-- Delete the file to indicate the script is finished
do shell script "rm ~/script_running"
-- Check if the script is run again
if not (do shell script "[ -f ~/script_running ] && echo true || echo false") as boolean then
-- Apply Test2 display set
apply display set "Test2"
-- Display a notification
display notification "Switched to Test2 display set" with title "SwitchResX"
end if
else
-- Display a notification
display notification "Already using Test1 display set" with title "SwitchResX"
end if
end tell
|
4d0c921d78914b0f8fba344755214991
|
{
"intermediate": 0.19513031840324402,
"beginner": 0.6661466360092163,
"expert": 0.1387229859828949
}
|
32,891
|
test cha
|
9c5e84c1fdf91e69430e9c71c9dccf89
|
{
"intermediate": 0.37841370701789856,
"beginner": 0.3448602259159088,
"expert": 0.2767260670661926
}
|
32,892
|
.helm/values.yaml - это основной values
base-chart:
defaultImagePullPolicy: IfNotPresent
generic:
serviceAccountName: "{{ .Release.Name }}"
extraImagePullSecrets:
- name: dockey
deploymentsGeneral:
terminationGracePeriodSeconds: 120
envFrom:
- secretRef:
name: sec-widget-config
serviceAccount:
"{{ .Release.Name }}":
labels: {}
services:
app:
type: ClusterIP
ports:
http:
port: 80
targetPort: http
protocol: TCP
ingresses:
http:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-body-size: "128m"
nginx.ingress.kubernetes.io/use-regex: "true"
serviceMonitors:
http:
endpoints:
http:
path: /metrics
interval: 15s
deployments:
app:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 5
maxUnavailable: 5
containers:
app:
securityContext:
capabilities:
add:
- SYS_PTRACE
ports:
http:
containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 500m
memory: 500Mi
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: nginx-config
mountPath: /etc/nginx/mime.types
subPath: mime-types
volumes:
- type: configMap
name: nginx-config
items:
- key: nginx.conf
path: nginx.conf
- key: mime-types
path: mime-types
configMaps:
nginx-config:
data:
nginx.conf: |
pid /var/run/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
}
http {
keepalive_timeout 65;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/json
application/ld+json
application/manifest+json
application/octet-stream
application/rdf+xml
application/rss+xml
application/x-javascript
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
server {
listen 8080;
charset UTF-8;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
mime-types: |
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
templates/deployment.yml - Это файл шаблона
{{- $general := $.Values.deploymentsGeneral -}}
{{- range $name, $d := .Values.deployments }}
{{- if not (.disabled | default false) }}
---
apiVersion: {{ include "helpers.capabilities.deployment.apiVersion" $ }}
kind: Deployment
metadata:
name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "helpers.app.labels" $ | nindent 4 }}
{{- with $general.labels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }}
{{- with .labels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }}
annotations:
{{- include "helpers.app.genericAnnotations" $ | indent 4 }}
{{- with .annotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }}
spec:
replicas: {{ .replicas | default 1 }}
{{- with .strategy }}
strategy: {{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "helpers.app.selectorLabels" $ | nindent 6 }}
{{- with .extraSelectorLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}{{- end }}
template:
metadata:
labels:
{{- include "helpers.app.selectorLabels" $ | nindent 8 }}
{{- with .extraSelectorLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}{{- end }}
{{- with $.Values.generic.podLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}{{- end }}
{{- with .podLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}{{- end }}
annotations:
{{- with $.Values.generic.podAnnotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}{{- end }}
{{- with .podAnnotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}{{- end }}
spec:
{{- include "helpers.pod" (dict "value" . "general" $general "name" $name "extraLabels" .extraSelectorLabels "context" $) | indent 6 }}
{{- end }}
{{- end }}
добавить под антиафинити для равномерного распределения подов по нодам
1. пример -
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 80
podAffinityTerm:
labelSelector:
matchLabels:
app: {{ include “orders.fullname” . }}
version: {{ .Values.image.tag | default .Chart.AppVersion | sha256sum | trunc 63 }}
topologyKey: “kubernetes.io/hostname”
ОТвет пиши на русском
|
c6a034261a97dac34768e1a435e922d6
|
{
"intermediate": 0.3255508542060852,
"beginner": 0.49719464778900146,
"expert": 0.17725452780723572
}
|
32,893
|
How to access EUtranFreqRelation list last value
|
b2d9f4b1ecd7d4ffc8357eb75521ed44
|
{
"intermediate": 0.5039459466934204,
"beginner": 0.14059369266033173,
"expert": 0.35546040534973145
}
|
32,894
|
When I run the following apple script test2 is applied even though the script was not run a second time within 5 seconds-- This script assumes that SwitchResX daemon is installed and that Test1 and Test2 are valid display set names
tell application "SwitchResX Daemon"
-- Activate the application
activate
-- Get the current display set name
apply display set "Test1"
-- Check if it is different from Test1
if name is not equal to "Test1" then
-- Apply Test1 display set
apply display set "Test1"
-- Display a notification
display notification "Switched to Test1 display set" with title "SwitchResX"
-- Set a variable to store the current time
set startTime to current date
-- Create a file to indicate the script is running
do shell script "touch ~/script_running"
-- Repeat until 5 seconds have passed
repeat until (current date) - startTime > 5
-- Check if the script is run again
if not (do shell script "[ -f ~/script_running ] && echo true || echo false") as boolean then
-- Exit the repeat loop
exit repeat
end if
end repeat
-- Delete the file to indicate the script is finished
do shell script "rm ~/script_running"
-- Check if the script is run again
if not (do shell script "[ -f ~/script_running ] && echo true || echo false") as boolean then
-- Apply Test2 display set
apply display set "Test2"
-- Display a notification
display notification "Switched to Test2 display set" with title "SwitchResX"
end if
else
-- Display a notification
display notification "Already using Test1 display set" with title "SwitchResX"
end if
end tell
|
8574f66bfffa674628aa299cb6dd11e5
|
{
"intermediate": 0.206295445561409,
"beginner": 0.6690693497657776,
"expert": 0.12463527917861938
}
|
32,895
|
in golang i need to find and print the digit at a certain position of an integer. what's the most simple way to do this, for example by converting the integer to a string?
|
55ac99506a1f88a4971e8185bb9ff5df
|
{
"intermediate": 0.6237569451332092,
"beginner": 0.10159958153963089,
"expert": 0.2746434509754181
}
|
32,896
|
SQL qurey to to assign foreign key of a Primary Key attribute CourseID with Foreign key DepartmentID and and Department Table with Primary Key DepartmentID
|
6ee98f0beac1cc599f993c3eb4de9521
|
{
"intermediate": 0.34880128502845764,
"beginner": 0.3466376066207886,
"expert": 0.3045611083507538
}
|
32,897
|
теперь модернизируй код - вычиследние по директории, должна помещаться в Image. А в class должна помещаться переменная - Если hostname = Director, то 1, если нет, то 0. Дополни алгоритм сортировкой по hostname и нормализацией п class image eventID threadid/ RJL (def classify_image(image, user):
if 'Director' in user:
return 3
executable_extensions = ['.exe', '.dll', '.sys', '.bat', '.cmd', '.ps1', '.vbs']
if 'System32' in image or 'AppData' in image:
if any(image.lower().endswith(ext) for ext in executable_extensions):
return 3
else:
return 2
elif any(image.lower().endswith(ext) for ext in executable_extensions):
return 1
else:
return 0
def process_record(data, output_file):
source = data.get('_source', {})
event_data = source.get('event_data', {})
user = event_data.get('User', '')
sourcehostname = event_data.get('SourceHostname', '')
event_id = source.get('event_id', '')
thread_id = source.get('thread_id', '')
image = event_data.get('Image', '')
utc_time = event_data.get('UtcTime', '')
classification = classify_image(image, user)
src_or_user = sourcehostname if sourcehostname else user
record = {
"SourceHostname_User": src_or_user,
"EventId": event_id,
"ThreadId": thread_id,
"Image": image,
"UtcTime": utc_time,
"Class": classification
}
output_file.write(orjson.dumps(record) + b'\n')
return record
input_file_name = 'Logs.json'
output_file_name = 'processed_records.jsonl'
processed_count = 0
with open(input_file_name, 'rb') as input_file, open(output_file_name, 'wb') as output_file:
for line in input_file:
try:
data = orjson.loads(line)
process_record(data, output_file)
processed_count += 1
except KeyError as e:
print(f"KeyError encountered: {e}")
if processed_count % 10000 == 0:
print(f'Processed {processed_count} records…')
print(f'Total processed records: {processed_count}'))
|
d1e2cb53ea744b905f9cb40c59feb311
|
{
"intermediate": 0.38618871569633484,
"beginner": 0.4366329610347748,
"expert": 0.17717833817005157
}
|
32,898
|
i using ros2 humble version in windows.The ros2 commands are becoming unresponsive in windows10.It is not loading...what should i do..
|
7b1ac33a0b9195b82eea7403bb462d0f
|
{
"intermediate": 0.5169497132301331,
"beginner": 0.2392299473285675,
"expert": 0.24382035434246063
}
|
32,899
|
теперь модернизируй код - вычиследние по директории, должна помещаться в Image. А в class должна помещаться переменная - Если hostname = Director, то 1, если нет, то 0. Дополни алгоритм сортировкой по hostname и нормализацией п class image eventID threadid. КОД - (def classify_image(image, user):
if 'Director' in user:
return 3
executable_extensions = ['.exe', '.dll', '.sys', '.bat', '.cmd', '.ps1', '.vbs']
if 'System32' in image or 'AppData' in image:
if any(image.lower().endswith(ext) for ext in executable_extensions):
return 3
else:
return 2
elif any(image.lower().endswith(ext) for ext in executable_extensions):
return 1
else:
return 0
def process_record(data, output_file):
source = data.get('_source', {})
event_data = source.get('event_data', {})
user = event_data.get('User', '')
sourcehostname = event_data.get('SourceHostname', '')
event_id = source.get('event_id', '')
thread_id = source.get('thread_id', '')
image = event_data.get('Image', '')
utc_time = event_data.get('UtcTime', '')
classification = classify_image(image, user)
src_or_user = sourcehostname if sourcehostname else user
record = {
"SourceHostname_User": src_or_user,
"EventId": event_id,
"ThreadId": thread_id,
"Image": image,
"UtcTime": utc_time,
"Class": classification
}
output_file.write(orjson.dumps(record) + b'\n')
return record
input_file_name = 'Logs.json'
output_file_name = 'processed_records.jsonl'
processed_count = 0
with open(input_file_name, 'rb') as input_file, open(output_file_name, 'wb') as output_file:
for line in input_file:
try:
data = orjson.loads(line)
process_record(data, output_file)
processed_count += 1
except KeyError as e:
print(f"KeyError encountered: {e}")
if processed_count % 10000 == 0:
print(f'Processed {processed_count} records…')
print(f'Total processed records: {processed_count}'))
|
c549472e9e60ab6c0959780052f190ae
|
{
"intermediate": 0.40396344661712646,
"beginner": 0.45639151334762573,
"expert": 0.13964509963989258
}
|
32,900
|
help me write a python code express emotion
|
b24e6ef08db233bb50db9cd3c93070d4
|
{
"intermediate": 0.36055853962898254,
"beginner": 0.3998536467552185,
"expert": 0.23958779871463776
}
|
32,901
|
修改下列代码,实现通过Read_excel函数对Choose_sheet数据更改,如果有更改就将cb下拉栏中选择的项返回给Choose_sheet,如果有更改那么show_file_dialog应该调用更改后的内容,没有更改则调用默认的内容。class MainWindow(QMainWindow):
def init(self):
super().init()
self.setWindowTitle(“Data_Processing_By_CG_For_镇海_202031124”)
self.resize(800, 320)
#全局变量设置
revised_value = None
Choose_sheet = “CASE1-某月方案测算”
def show_file_dialog(): #
global Choose_sheet
print(“数据已传输至函数”, Choose_sheet)
def Read_excel():
# 声明全局变量
global Choose_sheet
# 创建文件选择对话框
file_dialog_2 = QFileDialog()
file_dialog_2.setFileMode(QFileDialog.ExistingFile)
# 如果文件选择成功,获取所选文件的绝对路径并打印
if file_dialog_2.exec_():
file_path = file_dialog_2.selectedFiles()[0]
print(file_path)
workbook = openpyxl.load_workbook(file_path)
sheet_names = workbook.sheetnames
# for sheet_name in sheet_names:
# print(sheet_name)
print(sheet_names)
self.cb.addItems(sheet_names)
self.cb.currentIndexChanged.connect(Change_Sheet)
Choose_sheet = sheet_names
return Choose_sheet
|
ffc9acb065de94a742570ad51e4bb2f0
|
{
"intermediate": 0.4071235954761505,
"beginner": 0.35958442091941833,
"expert": 0.23329201340675354
}
|
32,902
|
solidity code reverts with Index out of range. fix it
struct VotingToken {
uint256 chainId;
address token;
address balanceType; // voting power strategy
// address 1
// address 2
}
struct VotingSystemTokenCheckpoint {
uint256 fromBlock;
VotingToken[] votingTokens;
}
struct VotingSystemLayout {
VotingSystemTokenCheckpoint[] checkpoints;
mapping(uint256 /* current chain blockNumber */ => mapping(uint256 /* chainId */ => uint256)) otherChainBlockNumbers;
}
function layout() internal pure returns (VotingSystemLayout storage l) {
bytes32 slot = VOTING_SYSTEM_LAYOUT_STORAGE_SLOT;
assembly {
l.slot := slot
}
}
function _writeCheckpoint(
VotingSystemLayout storage layout,
VotingToken[] memory newVotingTokens
) private {
uint256 pos = layout.checkpoints.length;
layout.checkpoints[pos].fromBlock = block.number;
unchecked {
for (uint256 i = 0; i < newVotingTokens.length; i++) {
layout.checkpoints[pos].votingTokens.push(newVotingTokens[i]);
}
}
}
|
a94016ad7a2f95e31ed2f10fed5b1e54
|
{
"intermediate": 0.44887053966522217,
"beginner": 0.3636012673377991,
"expert": 0.18752817809581757
}
|
32,903
|
what is raspberry pi
|
626ae4dee767c435424152b194005afb
|
{
"intermediate": 0.36652055382728577,
"beginner": 0.3719654977321625,
"expert": 0.26151397824287415
}
|
32,904
|
C# Make window think cursor is over it at x and y location when it's not over it at all
|
34d847dd1bcc92a17e6db476f5d60078
|
{
"intermediate": 0.5839238166809082,
"beginner": 0.19193878769874573,
"expert": 0.22413739562034607
}
|
32,905
|
Hi, in centos 7 :1. Change your server name to your name, verify and display after change. 2. Display all running processes in Linux system with its pid and child process. 3. What is the difference between unit configuration files type. 4. shows all systemd options that can be configured in the samba.service unit 5. Open configuration file bluetooth unit, write this info: wanted by , Befor ,execstart, 6. Check if is any systemd wants when starting graphical target 7. Shows detailed status information about services. 8. Shows all services that have failed.
|
bb80c61fea7e73d82dc1f6fc700533b8
|
{
"intermediate": 0.33972951769828796,
"beginner": 0.3219825029373169,
"expert": 0.33828791975975037
}
|
32,906
|
open mp4 file with LVC media player using python
|
2ecc4654930edff0599289d53c106bf4
|
{
"intermediate": 0.3523131310939789,
"beginner": 0.26786184310913086,
"expert": 0.37982502579689026
}
|
32,907
|
HI,I need 1000 line java code,any code
|
ec969f68ac3902988e53dcbefcc7c209
|
{
"intermediate": 0.2779836654663086,
"beginner": 0.47475844621658325,
"expert": 0.24725787341594696
}
|
32,908
|
write me a code in java that parse JSON string (with arrays) without any json libraries and without substring
|
9bb39cd9d5cdacac43bffc5cbf40d522
|
{
"intermediate": 0.8204479813575745,
"beginner": 0.05203333869576454,
"expert": 0.1275186985731125
}
|
32,909
|
dùng jquery remove element
|
b60bef323e69eb67cf55f2e20cb2a9df
|
{
"intermediate": 0.36346006393432617,
"beginner": 0.2391670197248459,
"expert": 0.39737293124198914
}
|
32,910
|
make an example of matrix computation
|
3b500f49fffa982ab25af5eb674c9b27
|
{
"intermediate": 0.33046144247055054,
"beginner": 0.21157671511173248,
"expert": 0.4579618275165558
}
|
32,911
|
typescript cdktf digitalocean firewall allow all outbound ports
|
085acb06795b9a623549f3c8d7c322e3
|
{
"intermediate": 0.2507944703102112,
"beginner": 0.515880823135376,
"expert": 0.23332466185092926
}
|
32,912
|
Теперь модифицируй код следующим образом. в Image записываются вычисления по его директории (там будет только одна цифра). в Class запиывается результат - уыли sourcehostname включает в себя Director, то 1 иначе 0. Сортируй всё по Hostname и нормализуй числовые данные фрейма. вот код (def classify_image(image, user):
if 'Director' in user:
return 3
executable_extensions = ['.exe', '.dll', '.sys', '.bat', '.cmd', '.ps1', '.vbs']
if 'System32' in image or 'AppData' in image:
if any(image.lower().endswith(ext) for ext in executable_extensions):
return 3
else:
return 2
elif any(image.lower().endswith(ext) for ext in executable_extensions):
return 1
else:
return 0
def process_record(data, output_file):
source = data.get('_source', {})
event_data = source.get('event_data', {})
user = event_data.get('User', '')
sourcehostname = event_data.get('SourceHostname', '')
event_id = source.get('event_id', '')
thread_id = source.get('thread_id', '')
image = event_data.get('Image', '')
utc_time = event_data.get('UtcTime', '')
classification = classify_image(image, user)
src_or_user = sourcehostname if sourcehostname else user
record = {
"SourceHostname_User": src_or_user,
"EventId": event_id,
"ThreadId": thread_id,
"Image": image,
"UtcTime": utc_time,
"Class": classification
}
output_file.write(orjson.dumps(record) + b'\n')
return record
input_file_name = 'Logs.json'
output_file_name = 'processed_records.jsonl'
processed_count = 0
with open(input_file_name, 'rb') as input_file, open(output_file_name, 'wb') as output_file:
for line in input_file:
try:
data = orjson.loads(line)
process_record(data, output_file)
processed_count += 1
except KeyError as e:
print(f"KeyError encountered: {e}")
if processed_count % 10000 == 0:
print(f'Processed {processed_count} records…')
print(f'Total processed records: {processed_count}')) а теперь предоставлю строку из данных файла Logs(Где таких сотни миллионов ({"_index": "winlogbeat-2023.11.23", "_type": "doc", "_id": "mu99-YsB5ZnwQua3q9mk", "_score": null, "_source": {"process_id": 4328, "event_data": {"User": "ISS-RESHETNEV\\VilshanskiySI", "DestinationIp": "10.0.8.77", "SourceHostname": "n743879.iss-reshetnev.ru", "DestinationPortName": "-", "UtcTime": "2023-11-22 23:55:23.961", "ProcessGuid": "{160589a2-7444-6551-e700-000000002d00}", "RuleName": "-", "Image": "C:\\Users\\VilshanskiySI\\AppData\\Local\\Programs\\TrueConf\\Client\\TrueConf.exe", "SourceIsIpv6": "false", "ProcessId": "11300", "DestinationPort": "4307", "Initiated": "true", "SourceIp": "10.14.8.219", "SourcePort": "55838", "SourcePortName": "-", "DestinationIsIpv6": "false", "Protocol": "tcp", "DestinationHostname": "trueconf.npopm.ru"}, "opcode": "\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f", "record_number": "25091745", "beat": {"hostname": "ELC-SRV01", "version": "6.6.1", "name": "ELC-SRV01"}, "user": {"type": "User", "identifier": "S-1-5-18", "domain": "NT AUTHORITY", "name": "\u0421\u0418\u0421\u0422\u0415\u041c\u0410"}, "type": "wineventlog", "@version": "1", "level": "\u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f", "thread_id": 1100, "event_id": 3, "provider_guid": "{5770385f-c22a-43e0-bf4c-06f5698ffbd9}", "tags": ["beats_input_codec_plain_applied"], "task": "Network connection detected (rule: NetworkConnect)", "version": 5, "@timestamp": "2023-11-23T00:03:37.473Z", "computer_name": "n743879.iss-reshetnev.ru", "source_name": "Microsoft-Windows-Sysmon", "host": {"name": "ELC-SRV01"}, "log_name": "Microsoft-Windows-Sysmon/Operational", "message": "Network connection detected:\nRuleName: -\nUtcTime: 2023-11-22 23:55:23.961\nProcessGuid: {160589a2-7444-6551-e700-000000002d00}\nProcessId: 11300\nImage: C:\\Users\\VilshanskiySI\\AppData\\Local\\Programs\\TrueConf\\Client\\TrueConf.exe\nUser: ISS-RESHETNEV\\VilshanskiySI\nProtocol: tcp\nInitiated: true\nSourceIsIpv6: false\nSourceIp: 10.14.8.219\nSourceHostname: n743879.iss-reshetnev.ru\nSourcePort: 55838\nSourcePortName: -\nDestinationIsIpv6: false\nDestinationIp: 10.0.8.77\nDestinationHostname: trueconf.npopm.ru\nDestinationPort: 4307\nDestinationPortName: -"}, "sort": [1700697817473]}
)
|
03e6fb6564a020fdd8062bc078d9f64b
|
{
"intermediate": 0.4437170624732971,
"beginner": 0.4209849238395691,
"expert": 0.1352979838848114
}
|
32,913
|
remove exact element from list in python
|
87c57abb630bb228000953e189eb28f5
|
{
"intermediate": 0.3760213553905487,
"beginner": 0.22459428012371063,
"expert": 0.39938440918922424
}
|
32,914
|
Optimize code
|
a11111f346255573ee11143713e06678
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,915
|
Optimize code
|
8a5fee76b49e3b8a6bbf116e25ff0a56
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,916
|
Optimize code
|
276fd4b4ce7fedb0e54bc7195205c5fc
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,917
|
Optimize code
|
02f873de8b8d6247b0a0ebd8e43011fb
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,918
|
I am trying to do this but i get an error: adb push C:\Users\chris\Downloads\Config Portable Devices\Chris\Internal storage\Android\data\com.blizzard.diablo.immortal\files\LocalData
* daemon not running; starting now at tcp:5037
* daemon started successfully
adb: error: target 'storage\Android\data\com.blizzard.diablo.immortal\files\LocalData' is not a directory
|
c766e5287df195de04528fef7c186582
|
{
"intermediate": 0.5058624744415283,
"beginner": 0.27090543508529663,
"expert": 0.22323204576969147
}
|
32,919
|
I am creating a python webui using FastAPI, React, SQLAlchemy and Pydantic.
I have just finished implementing a basic database that lets me add images(stores the path on disk, image width and image height), but also stores image captions, which is flexible to let me have multiple captions for each image, because each caption has it's own caption source(scraped from web, caption .txt file, generated by BLIP/CLIP vision AI models, user written), and I just finished the ability to search the captions to return a list of captions from the database containing the proper search terms.
So I am almost ready to start filling the database with all my images and captions, except for one hiccup, I want to prevent duplicate images from going into the database, it might be worthwhile to link duplicates together if they exist as multiple files, however I don't want to maintain multiple entries and multiple entries of captions for the exact same image.
Just to add a bit of context, this is the SQLAlchemy model for the Images:
|
4780701198d85d5b2fc77bb7ba2d7c67
|
{
"intermediate": 0.7038504481315613,
"beginner": 0.07583963871002197,
"expert": 0.22030986845493317
}
|
32,920
|
Может ты скажешь ей, что ты не Леонтий?
Недавно вошедшие в список форбс 24 до 24-ех Леонид и Семен решили открыть новый бизнес. Для этого они нашли знаменитую предпринимательницу Лизу, которая стала спонсором их стартапа. Для успешного трейдинга ребята создали один основной аккаунт и один дополнительный.
Для хорошей отчестности перед инвестором все рискованные сделки они проводят со второго аккаунта. Как только второй аккаунт выходит в положительный баланс, то ребята сливают все акции на основной аккаунт, а второй портфель очищается.
Вы
−
− первый разработчик в их стартапе, перед Вами стоит сложная задача реализации придуманной Семой и Лёвой системы.
С аккаунтами могут происходить следующие операции:
buy
�
�
�
�
�
�
�
account
�
�
id
−
− купить акции с номером
�
�
id в портфель
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
sell
�
�
�
�
�
�
�
account
�
�
id
−
− продать акции с номером
�
�
id в портфели
�
�
�
�
�
�
�
account (может быть для обоих аккаунтов)
merge
−
− сливать все акции в основной портфель
После каждого объединения товарищи проводят показ результатов Лизе, поэтому при этой операции требуется выводить
�
�
id акций в отсортированном виде.
Входные данные
В первой строке подается
�
n
−
− число операций
1
≤
�
≤
1
0
7
1≤n≤10
7
В следующих n строках подаются команды одного из 3 видов (buy, sell, merge) Гарантируется, что номер акции:
0
≤
�
�
≤
1
0
9
0≤id≤10
9
Выходные данные
При каждой операции merge вывести
�
�
id акции в отсортированном виде
STDIN STDOUT
1
buy 1 1
2
buy 1 2
merge
2
реши на cpp
|
ba9d246e1820bf04517ede21e6d21ba1
|
{
"intermediate": 0.19810988008975983,
"beginner": 0.6142464280128479,
"expert": 0.18764372169971466
}
|
32,921
|
import openai
prompt = CustomPromptTemplate(
template=template,
tools=tools,
# This omits the `agent_scratchpad`, `tools`, and `tool_names` variables because those are generated dynamically
# This includes the `intermediate_steps` variable because that is needed
input_variables=["input", "intermediate_steps"]
)
output_parser = CustomOutputParser()
openai.api_key = "EMPTY" # Not support yet
# openai.api_base = "http://i-2.gpushare.com:43036/v1"
# model_name = "StableBeluga-13B"
# model_name = "chatglm2-6b"
# openai.api_base = "http://i-2.gpushare.com:42054/v1"
openai.api_base = "http://i-2.gpushare.com:20778/v1"
# model_name = "SFT_Model"
# model_name = "openbuddy-llama2-13b-v11.1-bf16"
model_name = "izdax-llama2-7b-v1-chat"
llm = OpenAI(model=model_name, openai_api_key=openai.api_key, openai_api_base=openai.api_base)
# LLM chain consisting of the LLM and a prompt
llm_chain = LLMChain(llm=llm, prompt=prompt)
tool_names = [tool.name for tool in tools]
agent = LLMSingleActionAgent(
llm_chain=llm_chain,
output_parser=output_parser,
stop=["\nObservation:"],
allowed_tools=tool_names
)
# print(agent.llm_chain.prompt.template)
agent_executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, verbose=True) 我想查看最终的prompt 我该如何查看 类似这种template = """Respond to the human as helpfully and accurately as possible. You have access to the following tools:
terminal: Run shell commands on this MacOS machine., args: {{{{'commands': {{{{'title': 'Commands', 'description': 'List of shell commands to run. Deserialized using json.loads', 'anyOf': [{{{{'type': 'string'}}}}, {{{{'type': 'array', 'items': {{{{'type': 'string'}}}}}}}}]}}}}}}}}
get_time: get_time(text: str = '') -> str - Returns todays date, use this for any questions related to knowing todays date . this input should always be an empty string, and this function will always return todays date - any date mathmatics should occur outside this function., args: {{{{'text': {{{{'title': 'Text', 'default': '', 'type': 'string'}}}}}}}}
Search: Search(query: str, top_n: int) -> dict - A wrapper around film search plugin. Useful for when you need to answer questions about films or other movies., args: {{{{'query': {{{{'title': 'Query', 'description': 'should be a chinese search query', 'type': 'string'}}}}, 'top_n': {{{{'title': 'Top N', 'description': 'should be a integer number that agent want to get If you cannot find a number, should be 10', 'type': 'integer'}}}}}}}}
text_to_image: text_to_image(query, top_n: int) -> dict - A wrapper around Text To Image plugin. Useful for when you need to generate image., args: {{{{'query': {{{{'title': 'Query', 'description': 'should be a chinese search query', 'type': 'string'}}}}, 'top_n': {{{{'title': 'Top N', 'description': 'should be a integer number that agent want to get If you cannot find a number, should be 3', 'type': 'integer'}}}}}}}}
weather_info: weather_info(city_name: str, time_str: str) -> dict - A wrapper around weather info plugin. Useful for when you need to get weather info., args: {{{{'city_name': {{{{'title': 'City Name', 'description': 'should be a chinese city name if you cannot find a name should be 乌鲁木齐', 'type': 'string'}}}}, 'time_str': {{{{'title': 'Time Str', 'description': 'should be a time str that like 20230726', 'type': 'string'}}}}}}}}
qa: qa(query: str) -> dict - A wrapper around QA plugin. input should be a chinese search query Useful for when you need to get answer., args: {{{{'query': {{{{'title': 'Query', 'type': 'string'}}}}}}}}
Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
Valid "action" values: "Final Answer" or terminal, get_time, Search, text_to_image, weather_info, qa
Provide only ONE action per $JSON_BLOB, as shown:
|
47b0a5b2f69cae8822d31ed84c52b564
|
{
"intermediate": 0.450711727142334,
"beginner": 0.3626079261302948,
"expert": 0.18668031692504883
}
|
32,922
|
Optimize code
|
9524c02bfc43a7a54d8c998d597b1aea
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,923
|
Optimize code
|
d1eda32c32f3c660f4fff92c10e32f7f
|
{
"intermediate": 0.2213270664215088,
"beginner": 0.19202853739261627,
"expert": 0.5866443514823914
}
|
32,924
|
make this old code:
<?php
/*
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.07
Generated by thesitewizard.com's Feedback Form Wizard.
Copyright 2000-2006 by Christopher Heng. All rights reserved.
thesitewizard and thefreecountry are trademarks of Christopher Heng.
$Id: phpscript.txt,v 1.8 2006/02/28 13:07:11 developer Exp $
Get the latest version, free, from:
http://www.thesitewizard.com/wizards/feedbackform.shtml
You can read the Frequently Asked Questions (FAQ) at:
http://www.thesitewizard.com/wizards/faq.shtml
I can be contacted at:
http://www.thesitewizard.com/feedback.php
Note that I do not normally respond to questions that have
already been answered in the FAQ, so *please* read the FAQ.
LICENCE TERMS
1. You may use this script on your website, with or
without modifications, free of charge.
2. You may NOT distribute or republish this script,
whether modified or not. The script can only be
distributed by the author, Christopher Heng.
3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
IMPLIED WARRANTY OF MECHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
SCRIPTS AND THE DOCUMENTATION.
If you cannot agree to any of the above conditions, you
may not use the script.
Although it is NOT required, I would be most grateful
if you could also link to thesitewizard.com at:
http://www.thesitewizard.com/
*/
// ------------- CONFIGURABLE SECTION ------------------------
// Set your reCAPTCHA keys here
$recaptcha_secret = '6LcCWB8pAAAAAO12H2yf9zwwAXhMMGkLYF9kbBXB'; // Replace with your reCAPTCHA secret key
$recaptcha_response = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : null;
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "valuemylhdform@sellmylefthanddrive.co.uk" ;
$mailto = 'bllede@gmail.com';
// $subject - set to the Subject line of the email, eg
//$subject = "Valuation Request from sellmylefthanddrive.co.uk" ;
$subject = "Valuation Request";
// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;
$formurl = "https://selllefthanddrive.uk/sak/valuemylhdform.php";
$errorurl = "https://selllefthanddrive.uk/sak/formerror.php";
$thankyouurl = "https://selllefthanddrive.uk/sak/valuemylhdthanks.php";
$uself = 0;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$headersep = (!isset($uself) || ($uself == 0)) ? "\r\n" : "\n";
$name = $_POST['element_1'];
$number = $_POST['element_3'];
$myemail = $_POST['element_4'];
$emailconfirm = $_POST['element_5'];
$vehiclelocation = $_POST['element_6_1'];
$vmake = $_POST['element_9'];
$vmodel = $_POST['element_10'];
$vyear = $_POST['element_11'];
$vder = $_POST['element_12'];
$vesize = $_POST['element_13'];
$vfuel = $_POST['element_14'];
$vtrans = $_POST['element_15'];
$vmilage = $_POST['element_16'];
$vmilkm = $_POST['element_24'];
$vsh = $_POST['element_25'];
$vreg = $_POST['element_17'];
$vregin = $_POST['element_17a'];
$vbcol = $_POST['element_18'];
$vint = $_POST['element_19'];
$vcon = $_POST['element_20'];
$vei = $_POST['element_21'];
$vof = $_POST['element_22'];
$vaccept = $_POST['element_23'];
$http_referrer = getenv("HTTP_REFERER");
if (!isset($_POST['email'])) {
header("Location: $formurl");
exit;
}
// Verify reCAPTCHA
$recaptcha_url = "https://www.google.com/recaptcha/api/siteverify?secret={$recaptcha_secret}&response={$recaptcha_response}";
$recaptcha_data = json_decode(file_get_contents($recaptcha_url));
if (!$recaptcha_data->success) {
// Redirect to error page or handle the error as needed
header("Location: $errorurl");
exit;
}
if (get_magic_quotes_gpc()) {
$comments = stripslashes($comments);
}
$messageproper =
"My name is: $name\n" .
"My Telephone Number: $number\n" .
"My Email: $myemail\n" .
"Confirm Email: $emailconfirm\n\n" .
"Vehicle Location: $vehiclelocation\n\n" .
"Vehicle Details... \n" .
"Make: $vmake\n" .
"Model: $vmodel\n" .
"Year of Manufacture: $vyear\n" .
"How many doors: $vder\n" .
"Engine Size: $vesize\n" .
"Fuel: $vfuel\n" .
"Transmission: $vtrans\n" .
"Milage: $vmilage\n" .
"Milage shown is in: $vmilkm\n" .
"Service History: $vsh\n" .
"Reg: $vreg\n" .
"Vehicle is Reg in: $vregin\n" .
"Bodywork Colour: $vbcol\n" .
"Interior: $vint\n" .
"Tell us about the condition of your vehicle..: $vcon\n" .
"What would you accept in GBP: $vaccept\n\n" .
"This message was sent from: $http_referrer\n";
mail($mailto, $subject, $messageproper, "From: \"$name\" <$number>");
header("Location: $thankyouurl");
exit;
?>
looks like this new :
<?php
if(isset($_POST["send"])) {
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
// Form validation
if(!empty($name) && !empty($email) && !empty($subject) && !empty($message)){
// reCAPTCHA validation
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {
// Google secret API
$secretAPIkey = '6LfZ4AAVAAAAAF722GPGWyJ_lf1F2hMSWzPHmuYc';
// reCAPTCHA response verification
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretAPIkey.'&response='.$_POST['g-recaptcha-response']);
// Decode JSON data
$response = json_decode($verifyResponse);
if($response->success){
$toMail = "johndoe@gmail.com";
$header = "From: " . $name . "<". $email .">\r\n";
mail($toMail, $subject, $message, $header);
$response = array(
"status" => "alert-success",
"message" => "Your mail have been sent."
);
} else {
$response = array(
"status" => "alert-danger",
"message" => "Robot verification failed, please try again."
);
}
} else{
$response = array(
"status" => "alert-danger",
"message" => "Plese check on the reCAPTCHA box."
);
}
} else{
$response = array(
"status" => "alert-danger",
"message" => "All the fields are required."
);
}
}
?>
|
0b3679bcce46c7983a9cbd418625f625
|
{
"intermediate": 0.2914840877056122,
"beginner": 0.4615124762058258,
"expert": 0.2470034658908844
}
|
32,925
|
What are some useful scripts or websites similar to MAS https://massgrave.dev/
|
b93a0a53cdbaa1cf196a7276581e0770
|
{
"intermediate": 0.40752729773521423,
"beginner": 0.23723135888576508,
"expert": 0.3552413582801819
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.