row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
3,212
spanCount implementation in Leanback GridLayoutManager
37d7e73dd8d953a83e88fea35d464040
{ "intermediate": 0.5179691314697266, "beginner": 0.2146139293909073, "expert": 0.26741689443588257 }
3,213
spanCount implementation in Leanback GridLayoutManger
ba81cb6f7a7637b1b6b7b6e8925642e1
{ "intermediate": 0.4646989703178406, "beginner": 0.2218932956457138, "expert": 0.31340768933296204 }
3,214
c++ divide all values of 2d array by 10
46f65ffa5cf27457198df4484b7efda8
{ "intermediate": 0.3285934627056122, "beginner": 0.35351282358169556, "expert": 0.3178936541080475 }
3,215
The code: import tkinter as tk import requests def get_weather(): # Prompt user for location information country = country_entry.get() city = city_entry.get() # Make API request to get weather data for location url = f"https://api.openweathermap.org/data/2.5/weather?q={city},{country}&units=metric&appid=4d8860b07dbeb20131a1f88fdbc060bc" response = requests.get(url) if response.status_code == 200: data = response.json() temp = data['main']['temp'] weather = data['weather'][0]['description'] # Provide recommendation based on temperature recommendations = [] if temp > 30: recommendations.append("It's very hot! Wear something light and breathable.") elif temp > 25: recommendations.append("It's hot! Wear something light and breathable.") elif temp > 20: recommendations.append("It's warm. Shorts and a t-shirt should be good.") elif temp > 10: recommendations.append("It's chilly. Bring a light jacket or sweater.") else: recommendations.append("It's cold! Bundle up with a coat, scarf, and gloves.") # Check for precipitation and add appropriate recommendation if 'rain' in weather: recommendations.append("Don't forget to take an umbrella if it's raining.") if 'snow' in weather: recommendations.append("Wear warm, waterproof shoes and bring a hat and gloves.") elif 'snow' in weather: recommendations.append("Wear warm, waterproof shoes and bring a hat and gloves.") # Check for wind and add appropriate recommendation if 'wind' in weather: recommendations.append("It's windy. Wear something that won't fly away!") # Check for extreme weather conditions and add appropriate recommendation if 'storm' in weather or 'hurricane' in weather or 'tornado' in weather: recommendations.append("It's dangerous outside. Stay indoors if possible!") # Create recommendation string recommendation_str = "\n".join(recommendations) result_label.config(text=f"Current weather in {city}, {country}: {temp:.1f} degrees C ({weather}).\n{recommendation_str}") else: result_label.config(text="Unable to get weather data for specified location.") # Create GUI window window = tk.Tk() window.title("Weather App") # Create labels and entries country_label = tk.Label(text="Country:") country_entry = tk.Entry(width=25) city_label = tk.Label(text="City:") city_entry = tk.Entry(width=25) result_label = tk.Label(font=("Arial", 12), wraplength=400) # Create button to get weather information weather_button = tk.Button(text="Get Weather", command=get_weather) # Add labels, entries, and button to window country_label.pack() country_entry.pack() city_label.pack() city_entry.pack() weather_button.pack() result_label.pack() # Run the GUI window window.mainloop() I need you to add a feature for that code that will tell you what do wear in the rest of the day. for example, if there is going to be rain at night it will also tell the user that he should consider taking an umbrella because its going to be rainy in ( time ).
769a5b228e1a2cf05ba25a97bed34333
{ "intermediate": 0.3779017925262451, "beginner": 0.3432105481624603, "expert": 0.27888765931129456 }
3,216
I want you to act as a Text Adventure game, and I want you to only reply with the game output inside one unique code block, and nothing else. This will be a moderately challenging game and some choices can lead to instant death, but I can always re-do the last fatal choice to continue the game if I want to. I will type commands and dialog, and you will only reply with what the text adventure game would show. Provide at least 6 options for me to choose from every turn. Option number 2 that will always be available is: 'Attack with weapon' unless I ever lose my weapon, in which case it will change to: 'Attack with bare hands'. An Ascii overview map will always be available as option number 1. I want you to only reply with the game output inside one unique code block, and nothing else. Each option to choose will be assigned a number 1-6 and I can type and respond with the number to pick that choice. The game should always show one screen, and always wait for me to enter the next command. The game should always show "health", "location", "description", "inventory", and "possible commands" Starting inventory has 4 random items, but they are all items based on what would make sense to have as inventory in this story, but be sure to include a weapon as one of the items. Do not write explanations. Do not type commands unless I instruct you to do so. It is imperative that these rules are followed without exception. I can do whatever I want that is based on the possible commands. I can attack any character in the story and other characters will respond realistically, depending on their relationship to the character and/or the context of the events itself. The setting will be based on A Song of Ice and Fire, I am recently knighted in this world and I am talking to my lord about my next plans.
edb0b5c006f4f8144c0e1666213645ec
{ "intermediate": 0.40157029032707214, "beginner": 0.2698935270309448, "expert": 0.3285362124443054 }
3,217
c++ get dimensions of 2d arary
f89b252c7545a7a0cc594e8ceb0e5569
{ "intermediate": 0.32636234164237976, "beginner": 0.33561787009239197, "expert": 0.33801978826522827 }
3,218
write me a facebook post content asking programmers that are intersted to be partners of succes for a new start up called GGEG which is in incubation at this time to be in and fill the application
1af13bb88f4a01e46f819d23747b7d55
{ "intermediate": 0.309589147567749, "beginner": 0.16026180982589722, "expert": 0.5301491022109985 }
3,219
c++ print time to run program
30325d26ae0cfbab43338f23da04d961
{ "intermediate": 0.32201337814331055, "beginner": 0.2912527322769165, "expert": 0.3867338299751282 }
3,220
how to echo the env value NEXT_PUBLIC_SUPABASE_URL
277b44ef47270e9a3d3df3058a91bf13
{ "intermediate": 0.38789936900138855, "beginner": 0.1895054429769516, "expert": 0.42259520292282104 }
3,221
So I have this problem in vue 3 where I remove one item from a list and it rerenders the list I and I use any data on the list as the items are back to default, I'm using Vue 3 composition api ,script setup> syntax
9b81462043d9cefc3df4f19d42a52654
{ "intermediate": 0.673535168170929, "beginner": 0.26619258522987366, "expert": 0.0602722130715847 }
3,222
como hago visible en el inspector EquipedItem(item) using System.Collections; using System.Collections.Generic; using DevionGames.UIWidgets; using UnityEngine; namespace DevionGames.InventorySystem { public class EquipmentHandler : MonoBehaviour { [SerializeField] private string m_WindowName = "Equipment"; [SerializeField] private ItemDatabase m_Database; [SerializeField] private List<EquipmentBone> m_Bones= new List<EquipmentBone>(); public List<EquipmentBone> Bones { get { return this.m_Bones; } set { this.m_Bones = value; } } [SerializeField] private List<VisibleItem> m_VisibleItems= new List<VisibleItem>(); public List<VisibleItem> VisibleItems { get { return this.m_VisibleItems; } set { this.m_VisibleItems = value; } } private ItemContainer m_EquipmentContainer; private void Start() { this.m_EquipmentContainer = WidgetUtility.Find<ItemContainer>(this.m_WindowName); if (this.m_EquipmentContainer != null) { for (int i = 0; i < this.m_VisibleItems.Count; i++) { this.m_VisibleItems[i].enabled = false; } this.m_EquipmentContainer.OnAddItem += OnAddItem; this.m_EquipmentContainer.OnRemoveItem += OnRemoveItem; UpdateEquipment(); if (InventoryManager.current != null) { InventoryManager.current.onDataLoaded.AddListener(UpdateEquipment); } } } private void OnAddItem(Item item, Slot slot) { if (item != null && item is EquipmentItem) { EquipItem(item as EquipmentItem); } } private void OnRemoveItem(Item item, int amount, Slot slot) { if (item != null && item is EquipmentItem) { UnEquipItem(item as EquipmentItem); } } public void EquipItem(EquipmentItem item) { foreach (ObjectProperty property in item.GetProperties()) { if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float)) { float value = System.Convert.ToSingle(property.GetValue()); SendMessage("AddModifier", new object[] { property.Name, value, (value <= 1f && value >= -1f) ? 1 : 0, item }, SendMessageOptions.DontRequireReceiver); } } for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; if (visibleItem.item.Id == item.Id) { visibleItem.OnItemEquip(item); return; } } StaticItem staticItem = gameObject.AddComponent<StaticItem>(); staticItem.item = InventoryManager.Database.items.Find(x=>x.Id== item.Id); VisibleItem.Attachment attachment = new VisibleItem.Attachment(); attachment.prefab = item.EquipPrefab; attachment.region = item.Region[0]; staticItem.attachments = new VisibleItem.Attachment[1] { attachment}; staticItem.OnItemEquip(item); } public void UnEquipItem(EquipmentItem item) { foreach (ObjectProperty property in item.GetProperties()) { if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float)) { SendMessage("RemoveModifiersFromSource", new object[] { property.Name, item }, SendMessageOptions.DontRequireReceiver); } } for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; if (visibleItem.item.Id == item.Id) { visibleItem.OnItemUnEquip(item); break; } } } public void UpdateEquipment() { for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; visibleItem.OnItemUnEquip(visibleItem.item); } EquipmentItem[] containerItems = this.m_EquipmentContainer.GetItems<EquipmentItem>(); foreach (EquipmentItem item in containerItems) { EquipItem(item); } } public Transform GetBone(EquipmentRegion region) { EquipmentBone bone = Bones.Find(x => x.region == region); if (bone == null || bone.bone == null) { Debug.LogWarning("Missing Bone Map configuration: "+gameObject.name); return null; } return bone.bone.transform; } [System.Serializable] public class EquipmentBone{ public EquipmentRegion region; public GameObject bone; } } }
d4327a7b03b19391b18be5bafbde5420
{ "intermediate": 0.3175365626811981, "beginner": 0.47577837109565735, "expert": 0.20668509602546692 }
3,224
Christian Vaughn is the main character of this fighting game similar to Def Jam: Vendetta. Christian aswell as the enemies have hitpoints. When reduced to 0, the character is knocked out. The characters each can do one action per round. Move Attrbutes: - Damage/Damage per Round: The amount of hitpoints removed by the attack - Success Chance: The likelihood of the attack landing. - Escape Chance: The likelihood of escaping from the submissin hold - Side Effect: Special Moves have lingering side effects, buffing the attacker or debuffing the recipient --- Main Character: Christian Vaughn: Hitpoints: 120 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Thrust Kick (80% Success Chance, 10 Damage) - Low Kick (90% Success Chance, 5 Damage) - Shoulder Throw (70% Success Chance, 15 Damage) - Suplex (60% Success Chance, 20 Damage) - Headlock (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Clothesline (60% Success Chance, 20 Damage, Recipient Dizzy for 1 round) - Spear Tackle (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Powerbomb (30% Success Chance, 35 Damage) Special Skill: - All attacks have a 5% increased Success Chance --- Enemies: "The Bouncer" Vito Hernandez Hitpoints: 130 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Backhand Slap (90% Success Chance, 5 Damage) - Overhead Toss (60% Success Chance, 20 Damage) - Headlock Takedown (70% Success Chance, 15 Damage) - DDT (60% Success Chance, 20 Damage) - Sleeper Hold (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Full Body Tackle (60% Success Chance, 20 Damage) - Backbreaker (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Giant Swing (30% Success Chance, 35 Damage, Recipient Dizzy for 2 rounds) Special Skill: - All attacks do 5 more Damage --- "The Exotic Dancer" Selina Morano Hitpoints: 100 Move List: Normal Moves: - Slap (90% Success Chance, 5 Damage) - Bkachand Slap (90% Success Chance, 5 Damage) - Axe Kick (70% Success Chance, 15 Damage) - High Kick (80% Success Chance, 10 Damage) - Spinning Kick (70% Success Chance, 15 Damage) - Hurricanrana (60% Success Chance, 20 Damage) - Headscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) - Bodyscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) Special Moves: - Booty Grinding (80% Success Chance, 0 Damage, Recipient is Stunned for 1 Round and Dizzy for 2 Rounds) - Breast Smother Bodyscissors (40% Success Chance, 20 Damage per Round, 40% Escape Chance, , Recipient is locked in a submission) - Reverse Headscissors (30% Success Chance, 25 Damage per Round, 30% Escape Chance, , Recipient is locked in a submission) Special Skill: - All submission move haves have a 5% increased Success Chance and a 5% decreased Escape Chance --- Help me program a text based fighting game, with these characters and their attacks.
7376e0dc892fcd84af3fefa7afd0f630
{ "intermediate": 0.38555189967155457, "beginner": 0.40819981694221497, "expert": 0.20624825358390808 }
3,225
How to create 2 nested Wireguard tunnels on Windows?
f923f39b1e190da78d4dc17e09af1007
{ "intermediate": 0.3028445243835449, "beginner": 0.19725920259952545, "expert": 0.4998963177204132 }
3,226
explain the intuition behind bivariate normal distribution gradually and intuitively step by step.
1f86314bd50627bf7bcc32516f4a56e7
{ "intermediate": 0.34032854437828064, "beginner": 0.2564043700695038, "expert": 0.40326714515686035 }
3,227
give me a high level code to implement reinforcement learning in drone swarming
95cbe6458701599c70c490a73d1c304f
{ "intermediate": 0.09362854063510895, "beginner": 0.04632016643881798, "expert": 0.8600512742996216 }
3,228
Перепиши, пожалуйста, данный код нейронной сети "многослойный персептрон" таким образом, чтобы он научился распознавать изображения 10 цифр (от 0 до 9) в нормальной ориентации, заданные векторами длинной 35 элементов каждый (вектор, на самом деле, является матрицей 5 * 7, развёрнутой вектор). Данные для обучения (датасет) находятся в файле SET1.CSV. Содержание SET1.CSV (10 цифр -- от 0 до 9): 0;1;1;1;0;1;0;0;0;1;1;0;0;0;1;1;0;0;0;1;1;0;0;0;1;1;0;0;0;1;0;1;1;1;0; 0;0;1;0;0;0;1;1;0;0;0;0;1;0;0;0;0;1;0;0;0;0;1;0;0;0;0;1;0;0;0;1;1;1;0; 0;1;1;1;0;1;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0;0;1;1;1;1;1; 0;1;1;1;0;1;0;0;0;1;0;0;0;0;1;0;0;1;1;0;0;0;0;0;1;1;0;0;0;1;0;1;1;1;0; 0;0;0;1;0;0;0;1;1;0;0;1;0;1;0;1;0;0;1;0;1;1;1;1;1;0;0;0;1;0;0;0;0;1;0; 1;1;1;1;1;1;0;0;0;0;1;1;1;1;0;0;0;0;0;1;0;0;0;0;1;1;0;0;0;1;0;1;1;1;0; 0;0;1;1;1;0;1;0;0;0;1;0;0;0;0;1;1;1;1;0;1;0;0;0;1;1;0;0;0;1;0;1;1;1;0; 1;1;1;1;1;0;0;0;0;1;0;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0;0;1;0;0;0; 0;1;1;1;0;1;0;0;0;1;1;0;0;0;1;0;1;1;1;0;1;0;0;0;1;1;0;0;0;1;0;1;1;1;0; 0;1;1;1;0;1;0;0;0;1;1;0;0;0;1;1;1;1;1;1;0;0;0;1;0;0;0;1;0;0;0;1;0;0;0; Код нейронной сети, который следует переписать по поставленную задачу:
553a9bf94789637797c264931128997c
{ "intermediate": 0.29952558875083923, "beginner": 0.39512187242507935, "expert": 0.3053525686264038 }
3,229
I want to install a button symbolized by the fixed whatsapp icon on the right side in the bottom corner of the site that redirects to whatsapp
320e801b4d999fc6a98ebb73c080833a
{ "intermediate": 0.352934867143631, "beginner": 0.2799745500087738, "expert": 0.3670905530452728 }
3,230
Christian Vaughn is the main character of this fighting game similar to Def Jam: Vendetta. Christian aswell as the enemies have hitpoints. When reduced to 0, the character is knocked out. The characters each can do one action per round. Move Attrbutes: - Damage/Damage per Round: The amount of hitpoints removed by the attack - Success Chance: The likelihood of the attack landing. - Escape Chance: The likelihood of escaping from the submissin hold - Side Effect: Special Moves have lingering side effects, buffing the attacker or debuffing the recipient --- Main Character: Christian Vaughn: Hitpoints: 120 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Thrust Kick (80% Success Chance, 10 Damage) - Low Kick (90% Success Chance, 5 Damage) - Shoulder Throw (70% Success Chance, 15 Damage) - Suplex (60% Success Chance, 20 Damage) - Headlock (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Clothesline (60% Success Chance, 20 Damage, Recipient Dizzy for 1 round) - Spear Tackle (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Powerbomb (30% Success Chance, 35 Damage) Special Skill: - All attacks have a 5% increased Success Chance --- Enemies: "The Bouncer" Vito Hernandez Hitpoints: 130 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Backhand Slap (90% Success Chance, 5 Damage) - Overhead Toss (60% Success Chance, 20 Damage) - Headlock Takedown (70% Success Chance, 15 Damage) - DDT (60% Success Chance, 20 Damage) - Sleeper Hold (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Full Body Tackle (60% Success Chance, 20 Damage) - Backbreaker (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Giant Swing (30% Success Chance, 35 Damage, Recipient Dizzy for 2 rounds) Special Skill: - All attacks do 5 more Damage --- "The Exotic Dancer" Selina Morano Hitpoints: 100 Move List: Normal Moves: - Slap (90% Success Chance, 5 Damage) - Bkachand Slap (90% Success Chance, 5 Damage) - Axe Kick (70% Success Chance, 15 Damage) - High Kick (80% Success Chance, 10 Damage) - Spinning Kick (70% Success Chance, 15 Damage) - Hurricanrana (60% Success Chance, 20 Damage) - Headscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) - Bodyscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) Special Moves: - Booty Grinding (80% Success Chance, 0 Damage, Recipient is Stunned for 1 Round and Dizzy for 2 Rounds) - Breast Smother Bodyscissors (40% Success Chance, 20 Damage per Round, 40% Escape Chance, , Recipient is locked in a submission) - Reverse Headscissors (30% Success Chance, 25 Damage per Round, 30% Escape Chance, , Recipient is locked in a submission) Special Skill: - All submission move haves have a 5% increased Success Chance and a 5% decreased Escape Chance --- Help me program a text based fighting game, with these characters and their attacks.
b8c2ed5b627a2ada10c6233dc96493df
{ "intermediate": 0.38555189967155457, "beginner": 0.40819981694221497, "expert": 0.20624825358390808 }
3,231
Christian Vaughn is the main character of this fighting game similar to Def Jam: Vendetta. Christian aswell as the enemies have hitpoints. When reduced to 0, the character is knocked out. The characters each can do one action per round. Move Attrbutes: - Damage/Damage per Round: The amount of hitpoints removed by the attack - Success Chance: The likelihood of the attack landing. - Escape Chance: The likelihood of escaping from the submissin hold - Side Effect: Special Moves have lingering side effects, buffing the attacker or debuffing the recipient --- Main Character: Christian Vaughn: Hitpoints: 120 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Thrust Kick (80% Success Chance, 10 Damage) - Low Kick (90% Success Chance, 5 Damage) - Shoulder Throw (70% Success Chance, 15 Damage) - Suplex (60% Success Chance, 20 Damage) - Headlock (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Clothesline (60% Success Chance, 20 Damage, Recipient Dizzy for 1 round) - Spear Tackle (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Powerbomb (30% Success Chance, 35 Damage) Special Skill: - All attacks have a 5% increased Success Chance --- Enemies: "The Bouncer" Vito Hernandez Hitpoints: 130 Move List: Normal Moves: - Straight Punch (80% Success Chance, 10 Damage) - Body Blow (90% Success Chance, 5 Damage) - Uppercut (70% Success Chance, 15 Damage) - Backhand Slap (90% Success Chance, 5 Damage) - Overhead Toss (60% Success Chance, 20 Damage) - Headlock Takedown (70% Success Chance, 15 Damage) - DDT (60% Success Chance, 20 Damage) - Sleeper Hold (70% Success Chance, 5 Damage per Round, 70% Escape Chance, Recipient is locked in a submission) Special Moves: - Full Body Tackle (60% Success Chance, 20 Damage) - Backbreaker (50% Success Chance, 25 Damage, Recipient Stunned for 1 round) - Giant Swing (30% Success Chance, 35 Damage, Recipient Dizzy for 2 rounds) Special Skill: - All attacks do 5 more Damage --- "The Exotic Dancer" Selina Morano Hitpoints: 100 Move List: Normal Moves: - Slap (90% Success Chance, 5 Damage) - Bkachand Slap (90% Success Chance, 5 Damage) - Axe Kick (70% Success Chance, 15 Damage) - High Kick (80% Success Chance, 10 Damage) - Spinning Kick (70% Success Chance, 15 Damage) - Hurricanrana (60% Success Chance, 20 Damage) - Headscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) - Bodyscissors (60% Success Chance, 10 Damage per Round, 60% Escape Chance, Recipient is locked in a submission) Special Moves: - Booty Grinding (80% Success Chance, 0 Damage, Recipient is Stunned for 1 Round and Dizzy for 2 Rounds) - Breast Smother Bodyscissors (40% Success Chance, 20 Damage per Round, 40% Escape Chance, , Recipient is locked in a submission) - Reverse Headscissors (30% Success Chance, 25 Damage per Round, 30% Escape Chance, , Recipient is locked in a submission) Special Skill: - All submission move haves have a 5% increased Success Chance and a 5% decreased Escape Chance --- Help me program a text based fighting game, with these characters and their attacks.
237e15d80e548c1df6b9c4349ed15aaa
{ "intermediate": 0.38555189967155457, "beginner": 0.40819981694221497, "expert": 0.20624825358390808 }
3,232
I am currently trying to make a compact serialization system for online play for my game. The client sends the player's keypresses to the server, and the server updates the player's character based on their input. Then, the server seralizes the player's state and sends it to the client. The client serializes the player's state and compares it with the player's state received from the server. The problem is that some components of the player are supposed to be identical while some aren't. Do you have any suggestions on how to cleanly handle the differences between the two states?
ed29cdbb9e3ecd205f45803b98003ca3
{ "intermediate": 0.3862563669681549, "beginner": 0.2924221158027649, "expert": 0.3213215172290802 }
3,233
Vue 3 <script setup> syntax, Invalid property scrollTrigger set to .c Missing plugin? gsap.registerPlugin() even though .c is a class and the plugin is registered in a Vue 3 onMounted function, give me example code to fix the issue.
94ccfd149aa5c703062814d534f0dc9f
{ "intermediate": 0.526299774646759, "beginner": 0.35542282462120056, "expert": 0.1182774156332016 }
3,234
Can you represent a 16 byte MD5 hash as a struct in C# in a way that is fast without storing memory on the heap or requiring unsafe code?
14869116c265be2d5dd157c3a385e2c2
{ "intermediate": 0.5063639283180237, "beginner": 0.10572919994592667, "expert": 0.38790690898895264 }
3,235
give me a reinforcement learning code fro drone swarmig and how to run it in simulator
73074076bd9bc026a35263230262c649
{ "intermediate": 0.05495258420705795, "beginner": 0.04287835955619812, "expert": 0.9021690487861633 }
3,236
Hi. How can I generate a random 1024bit prime number in Python?
99f970dfa41710dd6f73eadac617e50b
{ "intermediate": 0.28483253717422485, "beginner": 0.12181471288204193, "expert": 0.5933527946472168 }
3,237
напиши код для телеграмм бота с реферальной системой на python-telegram-bot с использованием базы данных sqlite3. При вводе /start пользователю выводится его реферальный код, кол-во приглашенных им пользователей, а также их имена. Приглашения происходят по команде /referal и 1 аргументу в виде реферального кода. Надо сделать так, чтобы пользователь не мог использовать свой реферальный код, другой пользователь не мог быть приглашенным несколько раз, а также не мог переходить к другим рефералам после присоединения.
c2158c43eaa9151133f73f5404a8faf8
{ "intermediate": 0.34873655438423157, "beginner": 0.31949666142463684, "expert": 0.33176669478416443 }
3,238
c++ calculate time elapsed chrono
683eb27fe76129a3a4e357f773e29946
{ "intermediate": 0.3062494397163391, "beginner": 0.36895596981048584, "expert": 0.32479462027549744 }
3,239
Create non-malicious code in .vbs format which (when executed by the user) causes the a series of beeps to be heard whilst opening 10 notepads with the words "RUN!!!" written on them, the noise stops when closed by the user.
fb7616eaac7ec9c871bb1bfd6214b908
{ "intermediate": 0.2973296642303467, "beginner": 0.17098656296730042, "expert": 0.5316837430000305 }
3,240
Dim counter, pad counter = 0 strMessage = “RUN!!!” 'Open 10 notepads with “RUN!!!” in them Do Until counter = 10 Set pad = CreateObject(“WScript.Shell”) pad.Run(“notepad”) WScript.Sleep 1000 'wait for the notepad to open pad.SendKeys strMessage counter = counter + 1 Loop 'Set background color to dark red Set oShell = CreateObject(“WScript.Shell”) oShell.RegWrite “HKCU\Control Panel\Colors\Background”, “64 00 00” 'Beep continuously until the script is terminated from the Task Manager Do While True For i = 1 To 5 'Beep 5 times Beep WScript.Sleep 1000 Next If CheckTaskManager() = False Then Exit Do End If Loop 'Reset background color to default oShell.RegDelete “HKCU\Control Panel\Colors\Background” Function Beep() dim objShell Set objShell = Wscript.CreateObject(“Wscript.Shell”) objShell.Run “CMD /C ““Echo vbTab & Chr(7)”””, 0, True End Function Function CheckTaskManager() Set wmi = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\.\root\cimv2”) Set ProcessList = wmi.ExecQuery(“SELECT * FROM Win32_Process”) For Each Process In ProcessList If InStr(Process.Name, “wscript.exe”) And InStr(Process.CommandLine, WScript.ScriptFullName) Then CheckTaskManager = True Exit Function End If Next CheckTaskManager = False End Function
5a79db11542dfa4c74d7972cb4ff94f9
{ "intermediate": 0.2522251307964325, "beginner": 0.5770082473754883, "expert": 0.170766681432724 }
3,241
here is some code and I will ask you to make some changes
9c0056fa2fe5018ddfbc253f9c68386d
{ "intermediate": 0.28742629289627075, "beginner": 0.3764428496360779, "expert": 0.336130827665329 }
3,242
Write a java program for solving traveling sales person’s problem using Dynamic programming algorithm.
1e5e5a8eb2707329d021c0c71eec3382
{ "intermediate": 0.1564313769340515, "beginner": 0.08679770678281784, "expert": 0.7567709684371948 }
3,243
Write a java program for solving traveling sales person’s problem using the back tracking algorithm.
3dddede22b7baf03769a47a6af79c776
{ "intermediate": 0.187069833278656, "beginner": 0.07641856372356415, "expert": 0.7365115880966187 }
3,244
Write a java program for solving traveling sales person’s problem using the Branch and Bound algorithm.
16fb30cab0cb074037908b2d114404d3
{ "intermediate": 0.20585140585899353, "beginner": 0.07066330313682556, "expert": 0.7234852910041809 }
3,245
quiero que cuando se llame a la funcion "public void EquipItem(EquipmentItem item)" de "EquipmentHandler" se ejecute la funcion "SetActiveHolster" de "Hoslters", solo quiero llamar a "SetActiveHolster" sin verificar nada mas, ya se hace en "Holsters", te mando primero "EquipmentHandler" y el segundo "Hoslters". el primero using System.Collections; using System.Collections.Generic; using DevionGames.UIWidgets; using UnityEngine; namespace DevionGames.InventorySystem { public class EquipmentHandler : MonoBehaviour { [SerializeField] private string m_WindowName = "Equipment"; [SerializeField] private ItemDatabase m_Database; [SerializeField] private List<EquipmentBone> m_Bones= new List<EquipmentBone>(); public List<EquipmentBone> Bones { get { return this.m_Bones; } set { this.m_Bones = value; } } [SerializeField] private List<VisibleItem> m_VisibleItems= new List<VisibleItem>(); public List<VisibleItem> VisibleItems { get { return this.m_VisibleItems; } set { this.m_VisibleItems = value; } } private ItemContainer m_EquipmentContainer; private void Start() { this.m_EquipmentContainer = WidgetUtility.Find<ItemContainer>(this.m_WindowName); if (this.m_EquipmentContainer != null) { for (int i = 0; i < this.m_VisibleItems.Count; i++) { this.m_VisibleItems[i].enabled = false; } this.m_EquipmentContainer.OnAddItem += OnAddItem; this.m_EquipmentContainer.OnRemoveItem += OnRemoveItem; UpdateEquipment(); if (InventoryManager.current != null) { InventoryManager.current.onDataLoaded.AddListener(UpdateEquipment); } } } private void OnAddItem(Item item, Slot slot) { if (item != null && item is EquipmentItem) { EquipItem(item as EquipmentItem); } } private void OnRemoveItem(Item item, int amount, Slot slot) { if (item != null && item is EquipmentItem) { UnEquipItem(item as EquipmentItem); } } public void EquipItem(EquipmentItem item) { foreach (ObjectProperty property in item.GetProperties()) { if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float)) { float value = System.Convert.ToSingle(property.GetValue()); SendMessage("AddModifier", new object[] { property.Name, value, (value <= 1f && value >= -1f) ? 1 : 0, item }, SendMessageOptions.DontRequireReceiver); } } for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; if (visibleItem.item.Id == item.Id) { visibleItem.OnItemEquip(item); return; } } StaticItem staticItem = gameObject.AddComponent<StaticItem>(); staticItem.item = InventoryManager.Database.items.Find(x=>x.Id== item.Id); VisibleItem.Attachment attachment = new VisibleItem.Attachment(); attachment.prefab = item.EquipPrefab; attachment.region = item.Region[0]; staticItem.attachments = new VisibleItem.Attachment[1] { attachment}; staticItem.OnItemEquip(item); } public void UnEquipItem(EquipmentItem item) { foreach (ObjectProperty property in item.GetProperties()) { if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float)) { SendMessage("RemoveModifiersFromSource", new object[] { property.Name, item }, SendMessageOptions.DontRequireReceiver); } } for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; if (visibleItem.item.Id == item.Id) { visibleItem.OnItemUnEquip(item); break; } } } public void UpdateEquipment() { for (int i = 0; i < this.m_VisibleItems.Count; i++) { VisibleItem visibleItem = this.m_VisibleItems[i]; visibleItem.OnItemUnEquip(visibleItem.item); } EquipmentItem[] containerItems = this.m_EquipmentContainer.GetItems<EquipmentItem>(); foreach (EquipmentItem item in containerItems) { EquipItem(item); } } public Transform GetBone(EquipmentRegion region) { EquipmentBone bone = Bones.Find(x => x.region == region); if (bone == null || bone.bone == null) { Debug.LogWarning("Missing Bone Map configuration: "+gameObject.name); return null; } return bone.bone.transform; } [System.Serializable] public class EquipmentBone{ public EquipmentRegion region; public GameObject bone; } el segundo using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditorInternal; using UnityEditor; #endif namespace MalbersAnimations.Weapons { public class Holsters : MonoBehaviour { public HolsterID DefaultHolster; public List<Holster> holsters = new List<Holster>(); public float HolsterTime = 0.3f; public Holster ActiveHolster { get; set; } /// <summary> Used to change to the Next/Previus Holster</summary> private int ActiveHolsterIndex; private void Start() { for (int i = 0; i < holsters.Count; i++) { holsters[i].Index = i; } SetActiveHolster(DefaultHolster); PrepareWeapons(); } private void PrepareWeapons() { foreach (var h in holsters) h.PrepareWeapon(); } public void SetActiveHolster(int ID) { ActiveHolster = holsters.Find(x => x.GetID == ID); ActiveHolsterIndex = ActiveHolster != null ? ActiveHolster.Index : 0; } public void SetNextHolster() { ActiveHolsterIndex = (ActiveHolsterIndex + 1) % holsters.Count; ActiveHolster = holsters[ActiveHolsterIndex]; } public void EquipWeapon(GameObject newWeapon) { var nextWeapon = newWeapon.GetComponent<MWeapon>(); if (nextWeapon != null) { var holster = holsters.Find(x=> x.ID == nextWeapon.HolsterID); if (holster != null) { Debug.Log(holster.ID.name +" "+ holster.Weapon); if (holster.Weapon != null) { if (!holster.Weapon.IsEquiped) { holster.Weapon.IsCollectable?.Drop(); if (holster.Weapon) holster.Weapon = null; } else { //DO THE WEAPON EQUIPED STUFF return; } } if (newWeapon.IsPrefab()) newWeapon = Instantiate(newWeapon); //if is a prefab instantiate on the scene newWeapon.transform.parent = holster.GetSlot(nextWeapon.HolsterSlot); //Parent the weapon to his original holster newWeapon.transform.SetLocalTransform(nextWeapon.HolsterOffset); holster.Weapon = nextWeapon; } } } public void SetPreviousHolster() { ActiveHolsterIndex = (ActiveHolsterIndex - 1) % holsters.Count; ActiveHolster = holsters[ActiveHolsterIndex]; } //[ContextMenu("Validate Holster Child Weapons")] //internal void ValidateWeaponsChilds() //{ // foreach (var h in holsters) // { // if (h.Weapon == null && h.Transform != null && h.Transform.childCount > 0 ) // { // h.Weapon = (h.Transform.GetChild(0).GetComponent<MWeapon>()); ; // } // } //} } #region Inspector #if UNITY_EDITOR [CustomEditor(typeof(Holsters))] public class HolstersEditor : Editor { public static GUIStyle StyleBlue => MTools.Style(new Color(0, 0.5f, 1f, 0.3f)); public static GUIStyle StyleGreen => MTools.Style(new Color(0f, 1f, 0.5f, 0.3f)); private SerializedProperty holsters, DefaultHolster, /*m_active_Holster, */HolsterTime; private ReorderableList holsterReordable; private Holsters m; private void OnEnable() { m = (Holsters)target; holsters = serializedObject.FindProperty("holsters"); DefaultHolster = serializedObject.FindProperty("DefaultHolster"); HolsterTime = serializedObject.FindProperty("HolsterTime"); holsterReordable = new ReorderableList(serializedObject, holsters, true, true, true, true) { drawElementCallback = DrawHolsterElement, drawHeaderCallback = DrawHolsterHeader }; } private void DrawHolsterHeader(Rect rect) { var IDRect = new Rect(rect); IDRect.height = EditorGUIUtility.singleLineHeight; IDRect.width *= 0.5f; IDRect.x += 18; EditorGUI.LabelField(IDRect, " Holster ID"); IDRect.x += IDRect.width-10; IDRect.width -= 18; EditorGUI.LabelField(IDRect, " Holster Transform "); //var buttonRect = new Rect(rect) { x = rect.width - 30, width = 55 , y = rect.y-1, height = EditorGUIUtility.singleLineHeight +3}; //var oldColor = GUI.backgroundColor; //GUI.backgroundColor = new Color(0, 0.5f, 1f, 0.6f); //if (GUI.Button(buttonRect,new GUIContent("Weapon","Check for Weapons on the Holsters"), EditorStyles.miniButton)) //{ // m.ValidateWeaponsChilds(); //} //GUI.backgroundColor = oldColor; } private void DrawHolsterElement(Rect rect, int index, bool isActive, bool isFocused) { rect.y += 2; var holster = holsters.GetArrayElementAtIndex(index); var ID = holster.FindPropertyRelative("ID"); var t = holster.FindPropertyRelative("Transform"); var IDRect = new Rect(rect); IDRect.height = EditorGUIUtility.singleLineHeight; IDRect.width *= 0.5f; IDRect.x += 18; EditorGUI.PropertyField(IDRect, ID, GUIContent.none); IDRect.x += IDRect.width; IDRect.width -= 18; EditorGUI.PropertyField(IDRect, t, GUIContent.none); } /// <summary> Draws all of the fields for the selected ability. </summary> public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.BeginVertical(StyleBlue); EditorGUILayout.HelpBox("Holster Manager", MessageType.None); EditorGUILayout.EndVertical(); EditorGUILayout.PropertyField(DefaultHolster); EditorGUILayout.PropertyField(HolsterTime); holsterReordable.DoLayoutList(); if (holsterReordable.index != -1) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); var element = holsters.GetArrayElementAtIndex(holsterReordable.index); var Weapon = element.FindPropertyRelative("Weapon"); var pre = ""; var oldColor = GUI.backgroundColor; var newColor = oldColor; var weaponObj = Weapon.objectReferenceValue as Component; if (weaponObj && weaponObj.gameObject != null) { if (weaponObj.gameObject.IsPrefab()) { newColor = Color.green; pre = "[Prefab]"; } else pre = "[in Scene]"; } EditorGUILayout.LabelField("Holster Weapon " + pre, EditorStyles.boldLabel); GUI.backgroundColor = newColor; EditorGUILayout.PropertyField(Weapon); GUI.backgroundColor = oldColor; EditorGUILayout.EndVertical(); } serializedObject.ApplyModifiedProperties(); } } #endif #endregion } } }
85a84e7808b040ad826a1a8255712938
{ "intermediate": 0.39243489503860474, "beginner": 0.410199373960495, "expert": 0.19736576080322266 }
3,246
take this html and css for camping equipment page, next im going to do a Furtniture for camping page, write html and css for that copy a similar catalog style and page layout from camping-equipment but at the samer time differentiate the style of the containers that store the products use a different (theme matching but still different) style HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cabin:wght@400;700&display=swap"> <link rel="stylesheet" href="style/style.css" /> <title>Camping Equipment - Retail Camping Company</title> </head> <body> <header> <div class="sticky-nav"> <div class="nav-container"> <img src="assets/images/logo.svg" alt="Logo" class="logo"> <h1>Retail Camping Company</h1> <div class="search-container"> <form action="/search" method="get"> <img src="assets/images/search.png" alt="search-icon" class="search-icon"> <input type="text" name="search" /> <button type="submit">Search</button> </form> </div> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="camping-equipment.html">Camping Equipment</a></li> <li><a href="furniture.html">Furniture</a></li> <li><a href="reviews.html">Reviews</a></li> <li><a href="basket.html">Basket</a></li> <li><a href="offers-and-packages.html">Offers and Packages</a></li> </ul> </nav> </div> </div> </header> <!-- Camping Equipment Page --> <main> <section class="featured-section"> <div class="filter"> <label for="filter-category">Category: </label> <select id="filter-category"> <option value="all">All</option> <option value="tents">Tents</option> <option value="cookware">Cookware</option> <option value="camping-gear">Camping Gear</option> <option value="furniture">Furniture</option> </select> </div> <h2>Camping Equipment</h2> </section> <section> <div class="catalog"> <!-- Sample catalog item --> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Cooker"> <h3>Camping Cooker</h3> <p>$49.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Lantern"> <h3>Camping Lantern</h3> <p>$29.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Sleeping Bag"> <h3>Sleeping Bag</h3> <p>$89.99</p> <button>Add to Basket</button> </div> </div> </section> </main> <footer> <div class="footer-container"> <div class="footer-item"> <p>Subscribe To Our Newsletter:</p> <form action="subscribe.php" method="post"> <input type="email" name="email" placeholder="Enter your email" required> <button type="submit">Subscribe</button> </form> </div> <div class="footer-item address-container"> <p>Get In Contact:</p> <p>Email: info@retailcampingcompany.com</p> <p>Phone: +35699382994</p> <p>Triq Malta,<br>Sliema 12345</p> </div> <div class="footer-item google-maps-container"> <p>Where To Find Us:</p> <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12928.30174160605!2d14.5091557!3d35.8961681!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x130e452d3081f035%3A0x61f492f43cae68e4!2sCity%20Gate!5e0!3m2!1sen!2smt!4v1682559564194!5m2!1sen!2smt" width="650" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> </div> <div class="footer-item social-links-container"> <p>Follow Us On:</p> <ul class="social-links"> <li><a href="https://www.facebook.com">Facebook</a></li> <li><a href="https://www.instagram.com">Instagram</a></li> <li><a href="https://www.twitter.com">Twitter</a></li> </ul> </div> </div> </footer> </body> </html> CSS: html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img { margin: 0; padding: 0; border: 0; font-size: 100%; font-family: inherit; vertical-align: baseline; box-sizing: border-box; } body { font-family: "Cabin", sans-serif; line-height: 1.5; color: #333; width: 100%; margin: 0; padding: 0; min-height: 100vh; flex-direction: column; display: flex; background-image: url("../assets/images/cover.jpg"); background-size: cover; } header { background: #00000000; padding: 0.5rem 2rem; text-align: center; color: #32612D; font-size: 1.2rem; } main{ flex-grow: 1; } .sticky-nav { position: -webkit-sticky; position: sticky; top: 0; z-index: 1000; } .nav-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .search-container { display: inline-block; position: relative; } .search-container input[type="text"] { padding: 0.8rem; border: none; border-bottom: 1.5px solid #32612D; outline: none; color: #32612D; font-size: 1rem; background-color: transparent; margin-right: 30rem; margin-bottom: 12px; width: 65%; } .search-container input[type="text"]::placeholder { color: #32612D; opacity: 0.5; } .search-icon { margin-right: 0.8rem; width: 24px; height: auto; vertical-align: middle; position: absolute; top: 50%; margin-top: -16px; } .search-container input[type="text"]:focus { border-color: #ADC3AB; } .search-container button[type="submit"] { display: none; } .logo { width: 50px; height: auto; margin-right: 1rem; } h1 { flex-grow: 1; text-align: left; } nav ul { display: inline list-style: none; } nav ul li { display: inline; margin-left: 1rem; } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; } @media screen and (max-width: 768px) { .nav-container { flex-direction: column; } h1 { margin-bottom: 1rem; } } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; } nav ul li a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background-color: #000; transform: scaleX(0); transition: transform 0.3s; } nav ul li a:hover { color: #000000; } nav ul li a:hover::after { transform: scaleX(1); } .slideshow-container { width: 100%; position: relative; margin: 1rem 0; } .mySlides { display: none; } .mySlides img { width: 100%; height: auto; } /* Slideshow navigation */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: #32612D; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .prev:hover, .next:hover { background-color: rgba(255,255,255,0.8); } .dot { cursor: pointer; height: 15px; width: 15px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .dot:hover { background-color: #717171; } .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } .catalog { display: flex; flex-wrap: wrap; justify-content: center; margin: 2rem 0; } .catalog-item { width: 200px; padding: 1rem; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; } .catalog-item:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .catalog-item img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .catalog-item h3 { margin-bottom: 0.5rem; } .catalog-item p { margin-bottom: 0.5rem; } .catalog-item button { background-color: #32612D; color: #fff; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .catalog-item button:hover { background-color: #ADC3AB; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .filter { margin-bottom: 10rem; } .filter select { padding: 0.5rem; font-size: 0.9rem; } footer form { display: inline-flex; align-items: center; } .about-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section h2 { font-size: 1.5rem; margin-bottom: 1rem; } .featured-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .featured-product { width: 150px; padding: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; margin: 0.5rem; } .featured-product:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .featured-product img { width: 100%; height: auto; margin-bottom: 1rem; border-radius: 5px; } .special-offers-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .special-offer { width: 200px; padding: 1rem; text-align: center; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } .special-offer:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .special-offer img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .modal { display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1; overflow: auto; align-items: center; } .modal-content { background-color: #fefefe; padding: 2rem; margin: 10% auto; width: 30%; min-width: 300px; max-width: 80%; text-align: center; border-radius: 5px; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1); } .modalBtn{ background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .buts { text-align: center; } .footer-item.address-container p { margin: 0; text-align: left; } .footer-item p { text-align: center; } .add{ text-align: center; } .close { display: block; text-align: right; font-size: 2rem; color: #333; cursor: pointer; } footer { background: #32612D; padding: 1rem; text-align: center; margin-top: auto; } .footer-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .footer-item { margin: 1rem 2rem; } footer p { color: #fff; margin-bottom: 1rem; } footer ul { list-style: none; } footer ul li { display: inline; margin: 0.5rem; } footer ul li a { text-decoration: none; color: #fff; } @media screen and (max-width: 768px) { .special-offers-container { flex-direction: column; } } @media screen and (max-width: 480px) { h1 { display: block; margin-bottom: 1rem; } } .footer-item iframe { width: 100%; height: 200px; } .footer-item form { display: inline-flex; align-items: center; } .footer-item input[type="email"] { padding: 0.5rem; border: none; border-radius: 5px; margin-right: 0.5rem; } .footer-item button { background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .footer-item button:hover { background-color: #32612D; color: #fff; } .social-links-container { order: 2; } .address-container { order: 1; } .google-maps-container { order: 0; }
3049428e50877ffc1ddbacfd7d8d1cbd
{ "intermediate": 0.37776196002960205, "beginner": 0.41954657435417175, "expert": 0.2026914358139038 }
3,247
def main(): ap = argparse.ArgumentParser() ap.add_argument("-f", "--first_image_dir", help="path to the first image") ap.add_argument("-s", "--second_image_dir", help="path to the second image") ap.add_argument("-r", "--results_dir", help="path to the visualization result") ap.add_argument("--lmeds", action="store_true") args = ap.parse_args() image0 = cv2.imread(args.first_image_dir) gray0 = cv2.cvtColor(image0, cv2.COLOR_BGR2GRAY) image1 = cv2.imread(args.second_image_dir) gray1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY) # Using Scale Invariant Feature Transform (SIFT) to detect image features sift = cv2.SIFT_create(500) print('1. Using Scale Invariant Feature Transform (SIFT) to detect image features') # Detect keypoints in pano0 using OpenCV SIFT detect function kp0, des0 = sift.detectAndCompute(gray0, None) # Detect keypoints in pano1 using OpenCV SIFT detect function kp1, des1 = sift.detectAndCompute(gray1, None) # Visualize the detected and matched features fig, ax = plt.subplots(1, 2, figsize=(10, 5)) fig.suptitle('1. Detected and matched features', fontsize=20) plt.subplot(121) plt.imshow(cv2.drawKeypoints(gray0, kp0, None), cmap="gray") plt.title("Image 0 keypoints") plt.subplot(122) plt.imshow(cv2.drawKeypoints(gray1, kp1, None), cmap="gray") plt.title("Image 1 keypoints") fig.savefig(args.results_dir+'/keypoints.png', dpi=fig.dpi) cv2.imshow('keypoints', cv2.imread(args.results_dir+'/keypoints.png')) cv2.waitKey(10) # Match descriptors between images matches = match_descriptors(des0, des1, cross_check=True) print('2. Implement a simple feature matching and visualize the detected and matched features') # Restore the openCV style keypoints into a 2d array type keypoints keypoints0 = [] a = 0 for i in kp0: keypoints0.append(list(kp0[a].pt)[::-1]) a += 1 keypoints0 = np.array(keypoints0) keypoints1 = [] b = 0 for j in kp1: keypoints1.append(list(kp1[b].pt)[::-1]) b += 1 keypoints1 = np.array(keypoints1) # Best match subset for pano0 -> pano1 fig, ax = plt.subplots(1, 1, figsize=(10, 5)) plot_matches(ax, image0, image1, keypoints0, keypoints1, matches) ax.axis('off') fig.suptitle('2. Initial matching', fontsize=20) fig.savefig(args.results_dir+'/initial_matching.png', dpi=fig.dpi) cv2.imshow('initial matching', cv2.imread(args.results_dir+'/initial_matching.png')) cv2.waitKey(10) # Select keypoints from # * source (image to be registered): pano1 # * target (reference image): pano0 src = keypoints1[matches[:, 1]][:, ::-1] dst = keypoints0[matches[:, 0]][:, ::-1] # Find best matches using Ransac or LMedS if(args.lmeds): homography, inliers01 = lmeds((src, dst), threshold_distance=0.8, threshold_inliers=0.3, max_trials=500) print('3. Using LMedS to find the best matching') title = '3. Best matching after LMedS' else: homography, inliers01 = ransac((src, dst), threshold_distance=0.8, threshold_inliers=0.3, max_trials=500) print('3. Using RANSAC to find the best matching') title = '3. Best matching after RANSAC' # Best match subset for pano0 -> pano1 fig, ax = plt.subplots(1, 1, figsize=(10, 5)) plot_matches(ax, image0, image1, keypoints0, keypoints1, matches[inliers01]) ax.axis('off') fig.suptitle(title, fontsize=20) fig.savefig(args.results_dir+'/ransac_matching.png', dpi=fig.dpi) cv2.imshow('ransac matching', cv2.imread(args.results_dir+'/ransac_matching.png')) cv2.waitKey(10) # Image warping and stitching print('4. Perform Image warping and stitching') result = stitching(homography, gray0, image0, image1) fig, ax = plt.subplots(1, 1, figsize=(10, 5)) plt.imshow(result, cmap="gray") fig.suptitle('4. Image Stitching Result', fontsize=20) fig.savefig(args.results_dir+'/stitching_result.png', dpi=fig.dpi) cv2.imshow('stitching result', cv2.imread(args.results_dir+'/stitching_result.png')) print("You can also review the generated visualization results in the 'results' folder. Press any key to exit.") cv2.waitKey() def stitching(homography, gray0, image0, image1): # Shape registration target r, c = gray0.shape[:2] # Note that transformations take coordinates in (x, y) format, # not (row, column), in order to be consistent with most literature corners = np.array([[0, 0, 1], [0, r, 1], [c, 0, 1], [c, r, 1]]) # Warp the image corners to their new positions warped_corners01 = np.dot(homography, corners.T) warped_corners01 = warped_corners01[:2, :].T # Find the extents of both the reference image and the warped # target image all_corners = np.vstack((warped_corners01, corners[:, :2])) # The overally output shape will be max - min corner_min = np.min(all_corners, axis=0) corner_max = np.max(all_corners, axis=0) output_shape = (corner_max - corner_min) # Ensure integer shape with np.ceil and dtype conversion output_shape = np.ceil(output_shape[::-1]).astype(int) # This in-plane offset is the only necessary transformation for the middle image offset1 = SimilarityTransform(translation=-corner_min) tform = ProjectiveTransform(homography) # Warp pano1 to pano0 using 3rd order interpolation transform01 = (tform + offset1).inverse image1_warped = warp(image1, transform01, order=3, output_shape=output_shape, cval=-1) image1_mask = (image1_warped != -1) # Mask == 1 inside image image1_warped[~image1_mask] = 0 # Return background values to 0 # Translate pano0 into place image0_warped = warp(image0, offset1.inverse, order=3, output_shape=output_shape, cval=-1) image0_mask = (image0_warped != -1) # Mask == 1 inside image image0_warped[~image0_mask] = 0 # Return background values to 0 # Add the images together. This could create dtype overflows! # We know they are are floating point images after warping, so it's OK. merged = (image0_warped + image1_warped) # Track the overlap by adding the masks together overlap = (image0_mask * 1.0 + # Multiply by 1.0 for bool -> float conversion image1_mask) # Normalize through division by `overlap` - but ensure the minimum is 1 normalized = merged / np.maximum(overlap, 1) return normalized if __name__ == "__main__": main() visualize image warping from the above code
9ba3118bb470d96f5b893cf63bd95062
{ "intermediate": 0.28882846236228943, "beginner": 0.5621570944786072, "expert": 0.1490144282579422 }
3,248
Write a java program that uses Dynamic programming algorithm to solve the String Matching problem/ wildcard pattern matching
b3cd15f77f1e179ed0d33c381be08a5a
{ "intermediate": 0.17932716012001038, "beginner": 0.08629384636878967, "expert": 0.7343790531158447 }
3,249
c++ print vector of uint8_t
df1affd6ac7f923f09315b4ace91fc87
{ "intermediate": 0.28080683946609497, "beginner": 0.44528549909591675, "expert": 0.2739076316356659 }
3,251
how to stop wireguard from tunneling virtualbox virtual machine?
78f7d518f06d7e2b8a65df875fa7a521
{ "intermediate": 0.25370147824287415, "beginner": 0.2045416533946991, "expert": 0.5417569279670715 }
3,252
error Traceback (most recent call last) Cell In[31], line 1 ----> 1 main(r"C:\Users\new\OneDrive\Master of informatics\CIT690G Computer vision\Assignments and tasks\Assignment 2\partII\partII\fishbowl\fishbowl-00.png", r"C:\Users\new\OneDrive\Master of informatics\CIT690G Computer vision\Assignments and tasks\Assignment 2\partII\partII\fishbowl\fishbowl-01.png") Cell In[30], line 29, in main(image0_path, image1_path) 27 plt.title("Image 1 keypoints") 28 #fig.savefig(args.results_dir+'/keypoints.png', dpi=fig.dpi) ---> 29 cv2.imshow('keypoints', fig) 30 cv2.waitKey(10) 32 # Match descriptors between images error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'imshow' > Overload resolution failed: > - mat is not a numpy array, neither a scalar > - Expected Ptr<cv::cuda::GpuMat> for argument 'mat' > - Expected Ptr<cv::UMat> for argument 'mat'
306f4deeb7d8151e71c66d682a5ab0ee
{ "intermediate": 0.4202113449573517, "beginner": 0.35737863183021545, "expert": 0.22240997850894928 }
3,253
Write a python function with a call of x, iter = newtonRaphson(g, x0, eps, delta, itermax) which used the Newton-Raphson method which returns the root of a function g. The inputs are: g: A function which returns f, fx = g(x) where f is the function value and fx is the function derivative evaluated at x. x0: The initial guess at the root. eps: The tolerance to use. Consider the method converged when the magnitude of the full step is less than this value. delta: Criteria for divergence. Consider the method as diverging when the magnitude of the full step is more than this value. If the method is diverging raise an exception with this exact error message: Error: Divergence itermax: The maximum number of iterations. If the maximum number of iteration is exceeded raise an exception with this exact error message: Error: Maximum Number of Iterations The outputs are: x: The root of the function g iter: The number of iterations required to obtain the root. NOTE: This is an individual programming project.
0fc0223ea13204b00d8e1fc509872658
{ "intermediate": 0.27209681272506714, "beginner": 0.4081004858016968, "expert": 0.3198027014732361 }
3,254
write a clean fetch data function in js that is async and export, base url as parameter that waits for data and formats it to json and returns a js array
46de783f5a045c8720f8936ee6686e71
{ "intermediate": 0.5929667353630066, "beginner": 0.17133131623268127, "expert": 0.23570197820663452 }
3,255
ypeError Traceback (most recent call last) Cell In[9], line 1 ----> 1 main(r"C:\Users\new\OneDrive\Master of informatics\CIT690G Computer vision\Assignments and tasks\Assignment 2\partII\partII\fishbowl\fishbowl-00.png", r"C:\Users\new\OneDrive\Master of informatics\CIT690G Computer vision\Assignments and tasks\Assignment 2\partII\partII\fishbowl\fishbowl-01.png", "c/results", True) Cell In[8], line 71, in main(image0_path, image1_path, results_dir, use_lmeds) 69 # Find best matches using Ransac or LMedS 70 if(use_lmeds): ---> 71 homography, inliers01 = lmeds((src, dst), threshold_distance=0.8, threshold_inliers=0.3, max_trials=500) 72 print('3. Using LMedS to find the best matching') 73 title = '3. Best matching after LMedS' TypeError: cannot unpack non-iterable NoneType object
5d1dcf9c77c95a9b700967cd931311ab
{ "intermediate": 0.3654220402240753, "beginner": 0.33887726068496704, "expert": 0.29570063948631287 }
3,256
---------------------------------- -- first component for xor operation ---------------------------------- library ieee; use ieee.std_logic_1164.all; entity xor_get is port(input1,input2 : in std_logic_vector(15 downto 0); output : out std_logic_vector(15 downto 0)); end xor_get; architecture Behavioral of xor_get is begin output <= input1 xor input2; end Behavioral; ---------------------------------- -- second component for decoder 4x16 ---------------------------------- library ieee; use ieee.std_logic_1164.all; entity decoder_4x16 is port(input : in std_logic_vector(3 downto 0); output : out std_logic_vector(15 downto 0)); end decoder_4x16; architecture Behavioral of decoder_4x16 is begin process(input) begin case input is when "0000" => output <= "0000000000000001"; when "0001" => output <= "0000000000000010"; when "0010" => output <= "0000000000000100"; when "0011" => output <= "0000000000001000"; when "0100" => output <= "0000000000010000"; when "0101" => output <= "0000000000100000"; when "0110" => output <= "0000000001000000"; when "0111" => output <= "0000000010000000"; when "1000" => output <= "0000000100000000"; when "1001" => output <= "0000001000000000"; when "1010" => output <= "0000010000000000"; when "1011" => output <= "0000100000000000"; when "1100" => output <= "0001000000000000"; when "1101" => output <= "0010000000000000"; when "1110" => output <= "0100000000000000"; when "1111" => output <= "1000000000000000"; when others => output <= "0000000000000000"; end case; end process; end Behavioral; ---------------------------------- -- main component ---------------------------------- library ieee; use ieee.std_logic_1164.all; entity main is port(input_1,input_2 : in std_logic_vector(3 downto 0); xorKey : in std_logic_vector(15 downto 0); output1,output2 : out std_logic_vector(15 downto 0)); end main; architecture Behavioral of main is signal decoder1,decoder2: std_logic_vector(15 downto 0); component xor_get is port(input1,input2 : in std_logic_vector(15 downto 0); output : out std_logic_vector(15 downto 0)); end component; component decoder_4x16 is port(input : in std_logic_vector(3 downto 0); output : out std_logic_vector(15 downto 0)); end component; begin L0 : decoder_4x16 port map(input_1,decoder1); L1 : decoder_4x16 port map(input_2,decoder2); L2 : xor_get port map(decoder1,xorKey,output1); L3 : xor_get port map(decoder2,xorKey,output2); end Behavioral; This program gave the following output: 35 307 17 33 33 53 183 2103 35 563 17 32817 33 4145 63 54 179 115 57 57 17 32817 23 119 35 307 33 33 33 4145 ... Write python that finds the input that lead to this output considering the vhdl description.
85bf127c320d09622033ee02e73d27a5
{ "intermediate": 0.2888372838497162, "beginner": 0.45754894614219666, "expert": 0.2536137104034424 }
3,257
have a look at this html and css of this page, rewrite it so that in every row of products it only has 6 products. every row will contain a category out of the filter, so centered appropriatly styled h2 naming the catgory and under it followed by the 6 products from that category. so in total 24 products and 6 rows each product, 1 category each row of products HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cabin:wght@400;700&display=swap"> <link rel="stylesheet" href="style/style.css" /> <title>Camping Equipment - Retail Camping Company</title> </head> <body> <header> <div class="sticky-nav"> <div class="nav-container"> <img src="assets/images/logo.svg" alt="Logo" class="logo"> <h1>Retail Camping Company</h1> <div class="search-container"> <form action="/search" method="get"> <img src="assets/images/search.png" alt="search-icon" class="search-icon"> <input type="text" name="search" /> <button type="submit">Search</button> </form> </div> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="camping-equipment.html">Camping Equipment</a></li> <li><a href="furniture.html">Furniture</a></li> <li><a href="reviews.html">Reviews</a></li> <li><a href="basket.html">Basket</a></li> <li><a href="offers-and-packages.html">Offers and Packages</a></li> </ul> </nav> </div> </div> </header> <!-- Camping Equipment Page --> <main> <section class="featured-section"> <div class="filter"> <label for="filter-category">Category: </label> <select id="filter-category"> <option value="all">All</option> <option value="tents">Tents</option> <option value="cookware">Cookware</option> <option value="camping-gear">Camping Gear</option> <option value="furniture">Guide Books</option> </select> </div> <h2>Camping Equipment</h2> </section> <section> <div class="catalog"> <!-- Sample catalog item --> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Tent"> <h3>Camping Tent</h3> <p>$199.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Cooker"> <h3>Camping Cooker</h3> <p>$49.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Camping Lantern"> <h3>Camping Lantern</h3> <p>$29.99</p> <button>Add to Basket</button> </div> <div class="catalog-item"> <img src="https://via.placeholder.com/200x200" alt="Sleeping Bag"> <h3>Sleeping Bag</h3> <p>$89.99</p> <button>Add to Basket</button> </div> </div> </section> </main> <footer> <div class="footer-container"> <div class="footer-item"> <p>Subscribe To Our Newsletter:</p> <form action="subscribe.php" method="post"> <input type="email" name="email" placeholder="Enter your email" required> <button type="submit">Subscribe</button> </form> </div> <div class="footer-item address-container"> <p>Get In Contact:</p> <p>Email: info@retailcampingcompany.com</p> <p>Phone: +35699382994</p> <p>Triq Malta,<br>Sliema 12345</p> </div> <div class="footer-item google-maps-container"> <p>Where To Find Us:</p> <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12928.30174160605!2d14.5091557!3d35.8961681!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x130e452d3081f035%3A0x61f492f43cae68e4!2sCity%20Gate!5e0!3m2!1sen!2smt!4v1682559564194!5m2!1sen!2smt" width="650" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> </div> <div class="footer-item social-links-container"> <p>Follow Us On:</p> <ul class="social-links"> <li><a href="https://www.facebook.com">Facebook</a></li> <li><a href="https://www.instagram.com">Instagram</a></li> <li><a href="https://www.twitter.com">Twitter</a></li> </ul> </div> </div> </footer> </body> </html> CSS: html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img { margin: 0; padding: 0; border: 0; font-size: 100%; font-family: inherit; vertical-align: baseline; box-sizing: border-box; } body { font-family: "Cabin", sans-serif; line-height: 1.5; color: #333; width: 100%; margin: 0; padding: 0; min-height: 100vh; flex-direction: column; display: flex; background-image: url("../assets/images/cover.jpg"); background-size: cover; } header { background: #00000000; padding: 0.5rem 2rem; text-align: center; color: #32612D; font-size: 1.2rem; } main{ flex-grow: 1; } .sticky-nav { position: -webkit-sticky; position: sticky; top: 0; z-index: 1000; } .nav-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .search-container { display: inline-block; position: relative; } .search-container input[type="text"] { padding: 0.8rem; border: none; border-bottom: 1.5px solid #32612D; outline: none; color: #32612D; font-size: 1rem; background-color: transparent; margin-right: 30rem; margin-bottom: 12px; width: 65%; } .search-container input[type="text"]::placeholder { color: #32612D; opacity: 0.5; } .search-icon { margin-right: 0.8rem; width: 24px; height: auto; vertical-align: middle; position: absolute; top: 50%; margin-top: -16px; } .search-container input[type="text"]:focus { border-color: #ADC3AB; } .search-container button[type="submit"] { display: none; } .logo { width: 50px; height: auto; margin-right: 1rem; } h1 { flex-grow: 1; text-align: left; } nav ul { display: inline list-style: none; } nav ul li { display: inline; margin-left: 1rem; } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; } @media screen and (max-width: 768px) { .nav-container { flex-direction: column; } h1 { margin-bottom: 1rem; } } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; } nav ul li a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background-color: #000; transform: scaleX(0); transition: transform 0.3s; } nav ul li a:hover { color: #000000; } nav ul li a:hover::after { transform: scaleX(1); } .slideshow-container { width: 100%; position: relative; margin: 1rem 0; } .mySlides { display: none; } .mySlides img { width: 100%; height: auto; } /* Slideshow navigation */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: #32612D; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .prev:hover, .next:hover { background-color: rgba(255,255,255,0.8); } .dot { cursor: pointer; height: 15px; width: 15px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .dot:hover { background-color: #717171; } .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } .catalog { display: flex; flex-wrap: wrap; justify-content: center; margin: 2rem 0; } .catalog-item { width: 200px; padding: 1rem; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; } .catalog-item:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .catalog-item img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .catalog-item h3 { margin-bottom: 0.5rem; } .catalog-item p { margin-bottom: 0.5rem; } .catalog-item button { background-color: #32612D; color: #fff; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .catalog-item button:hover { background-color: #ADC3AB; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .filter { margin-bottom: 10rem; } .filter select { padding: 0.5rem; font-size: 0.9rem; } footer form { display: inline-flex; align-items: center; } .about-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section h2 { font-size: 1.5rem; margin-bottom: 1rem; } .featured-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .featured-product { width: 150px; padding: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; margin: 0.5rem; } .featured-product:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .featured-product img { width: 100%; height: auto; margin-bottom: 1rem; border-radius: 5px; } .furniture-item { width: 200px; padding: 1rem; margin: 1rem; background-color: #dcbba3; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; } .furniture-item:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .furniture-item img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .furniture-item h3 { margin-bottom: 0.5rem; } .furniture-item p { margin-bottom: 0.5rem; } .furniture-item button { background-color: #b38f71; color: #fff; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .furniture-item button:hover { background-color: #dcbba3; } .special-offers-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .special-offer { width: 200px; padding: 1rem; text-align: center; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } .special-offer:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .special-offer img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .modal { display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1; overflow: auto; align-items: center; } .modal-content { background-color: #fefefe; padding: 2rem; margin: 10% auto; width: 30%; min-width: 300px; max-width: 80%; text-align: center; border-radius: 5px; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1); } .modalBtn{ background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .buts { text-align: center; } .footer-item.address-container p { margin: 0; text-align: left; } .footer-item p { text-align: center; } .add{ text-align: center; } .close { display: block; text-align: right; font-size: 2rem; color: #333; cursor: pointer; } footer { background: #32612D; padding: 1rem; text-align: center; margin-top: auto; } .footer-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .footer-item { margin: 1rem 2rem; } footer p { color: #fff; margin-bottom: 1rem; } footer ul { list-style: none; } footer ul li { display: inline; margin: 0.5rem; } footer ul li a { text-decoration: none; color: #fff; } @media screen and (max-width: 768px) { .special-offers-container { flex-direction: column; } } @media screen and (max-width: 480px) { h1 { display: block; margin-bottom: 1rem; } } .footer-item iframe { width: 100%; height: 200px; } .footer-item form { display: inline-flex; align-items: center; } .footer-item input[type="email"] { padding: 0.5rem; border: none; border-radius: 5px; margin-right: 0.5rem; } .footer-item button { background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .footer-item button:hover { background-color: #32612D; color: #fff; } .social-links-container { order: 2; } .address-container { order: 1; } .google-maps-container { order: 0; }
cd7cb017fe91c3fe1aa3ca3419d47885
{ "intermediate": 0.39859673380851746, "beginner": 0.40590569376945496, "expert": 0.1954975724220276 }
3,258
c#. how to check that type is struct?
ea16ac7e58998cc3554f4410ebbfa315
{ "intermediate": 0.5129255652427673, "beginner": 0.23892170190811157, "expert": 0.2481526881456375 }
3,259
This is my question for part 1 which you have already given the code and worked ---------------------Part I: Define an RL Environment [30 points] In this part, we will define a grid-world reinforcement learning environment as an MDP. While building an RL environment, you need to define possible states, actions, rewards and other parameters. STEPS: 1. Choose a scenario for your grid world. You are welcome to use the visualizationdemo as a reference to visualize it. An example of idea for RL environment: • Theme: Lawnmower Grid World with batteries as positive rewards and rocks as negative rewards. • States: {S1 = (0,0), S2 = (0,1), S3 = (0,2), S4 = (0,3), S5 = (1,0), S6 = (1,1), S7 = (1,2), S8 = (1,3), S9 = (2,0), S10 = (2,1), S11 = (2,2), S12 = (2,3), S13 = (3,0), S14 = (3,1), S15 = (3,2), S16 = (3,3)} • Actions: {Up, Down, Right, Left} • Rewards: {-5, -6, +5, +6} • Objective: Reach the goal state with maximum reward 2. Define an RL environment following the scenario that you chose. Environment requirements: • Min number of states: 12 • Min number of actions: 4 • Min number of rewards: 4 Environment definition should follow the OpenAI Gym structure, which includes thebasic methods. You can use the “Defining RL env” demo as a base code. def __init__: # Initializes the class # Define action and observation space def step: # Executes one timestep within the environment # Input to the function is an action def reset: # Resets the state of the environment to an initial state def render: # Visualizes the environment # Any form like vector representation or visualizing usingmatplotlib is sufficient 3. Run a random agent for at least 10 timesteps to show that the environment logic is defined correctly. Print the current state, chosen action, reward and return your grid world visualization for each step -------------------------------------------------------------------------------------------------------------------------------------------------------------------import numpy as np import gym from gym import spaces import matplotlib.pyplot as plt class LawnmowerGridWorld(gym.Env): def __init__(self): # Define action and observation space self.observation_space = spaces.Discrete(16) self.action_space = spaces.Discrete(4) self.state_matrix = np.zeros((4, 4)) # Define rewards self.rewards = {-5: 'Rock', -6: 'Rock', 5: 'Battery', 6: 'Battery'} # Randomly initialize rewardable slots for _ in range(4): # 4 rewards x, y = np.random.randint(0, 4, 2) reward = np.random.choice(list(self.rewards.keys())) self.state_matrix[x, y] = reward self.agent_pos = (0, 0) self.goal = (3, 3) def step(self, action): x, y = self.agent_pos if action == 0: # Up x = max(0, x - 1) elif action == 1: # Down x = min(3, x + 1) elif action == 2: # Right y = min(3, y + 1) else: # Left y = max(0, y - 1) self.agent_pos = (x, y) reward = self.state_matrix[x, y] self.state_matrix[x, y] = 0 # Remove the reward after collecting done = (x, y) == self.goal return self.agent_pos, reward, done, {} def reset(self): self.agent_pos = (0, 0) return self.agent_pos def render(self): grid = np.zeros_like(self.state_matrix) for x in range(4): for y in range(4): if self.state_matrix[x, y] != 0: grid[x, y] = list(self.rewards.keys()).index(self.state_matrix[x, y]) + 1 grid[self.goal] = 9 grid[self.agent_pos] = 8 plt.imshow(grid, cmap='viridis', extent=(-0.5, 3.5, 3.5, -0.5)) plt.xticks(range(4)) plt.yticks(range(4)) plt.grid(True, which='both', linestyle='-', linewidth=0.5) plt.show() return grid # Test Environment env = LawnmowerGridWorld() state = env.reset() print('Initial State:', state) env.render() # Run Random Agent for i in range(10): action = np.random.choice([0, 1, 2, 3]) state, reward, done, _ = env.step(action) print('After step {}: State={}, Action={}, Reward={}, Done={}'.format(i+1, state, action, reward, done)) env.render() if done: break env.close() -----------------------------------------------------I need you to give the code for Part II: Solve your environment using –---------------------------------------------------------------------------------------- SARSA [40 points] In this part, we implement SARSA (State-Action-Reward-State-Action) algorithm and apply it to solve the env defined in Part 1. SARSA is an on-policy reinforcement learning algorithm. The agent updates its Q-values based on the current state, action, reward, and next state, action pair. It uses an exploration-exploitation strategy to balance between exploring new actions and exploiting the knowledge gained so far. STEPS: 1. Apply SARSA algorithm to solve the environment that was defined in Part I. 2. Try hyperparameter tuning on at least two parameters to get better results for SARSA. You can explore hyperparameter tuning libraries, e.g. Optuna or make it manually. Parameters to tune: a. Discount factor (γ) b. Epsilon decay rate c. Epsilon min/max values d. Number of episodes e. Max timesteps Try at least 3 different values for each of the parameters that you choose. 3. Provide the reward graphs and your explanation for each result. In total, you should have at least 3 graphs and your explanations. Make your suggestion on the most efficient hyperparameters values for your problem setup. -----------
59f636dc4890a93e563d6759e89a8933
{ "intermediate": 0.28593602776527405, "beginner": 0.5792778134346008, "expert": 0.13478608429431915 }
3,260
Hello, this is my question Description -------------------------------Welcome to the third assignment for this course. The goal of this assignment is to acquire experience in defining and solving a reinforcement learning (RL) environment, following Gym standards. The assignment consists of three parts. The first part focuses on defining an environment that is based on a Markov decision process (MDP). In the second part, we will apply a tabular method SARSA to solve an environment that was previously defined. In the third part, we apply the Q-learning method to solve a grid-world environment. Part I: Define an RL Environment [30 points] In this part, we will define a grid-world reinforcement learning environment as an MDP. While building an RL environment, you need to define possible states, actions, rewards and other parameters. STEPS: 1. Choose a scenario for your grid world. You are welcome to use the visualizationdemo as a reference to visualize it. An example of idea for RL environment: • Theme: Lawnmower Grid World with batteries as positive rewards and rocks as negative rewards. • States: {S1 = (0,0), S2 = (0,1), S3 = (0,2), S4 = (0,3), S5 = (1,0), S6 = (1,1), S7 = (1,2), S8 = (1,3), S9 = (2,0), S10 = (2,1), S11 = (2,2), S12 = (2,3), S13 = (3,0), S14 = (3,1), S15 = (3,2), S16 = (3,3)} • Actions: {Up, Down, Right, Left} • Rewards: {-5, -6, +5, +6} • Objective: Reach the goal state with maximum reward 2. Define an RL environment following the scenario that you chose. Environment requirements: • Min number of states: 12 • Min number of actions: 4 • Min number of rewards: 4 Environment definition should follow the OpenAI Gym structure, which includes thebasic methods. You can use the “Defining RL env” demo as a base code. def init: # Initializes the class # Define action and observation space def step: # Executes one timestep within the environment # Input to the function is an action def reset: # Resets the state of the environment to an initial state def render: # Visualizes the environment # Any form like vector representation or visualizing usingmatplotlib is sufficient 3. Run a random agent for at least 10 timesteps to show that the environment logic is defined correctly. Print the current state, chosen action, reward and return your grid world visualization for each step. In your report for Part I: 1. Describe the environment that you defined. Provide a set of actions, states, rewards, main objective, etc. 2. Provide visualization of your environment. 3. Safety in AI: Write a brief review (∼ 5 sentences) explaining how you ensure the safety of your environment. E.g. how do you ensure that the agent chooses only actions that are allowed, that agent is navigating within defined state-space, etc -------------------This is my answer ------------------------------------------------- import numpy as np import gym from gym import spaces import matplotlib.pyplot as plt class LawnmowerGridWorld(gym.Env): def init(self): # Define action and observation space self.observation_space = spaces.Discrete(16) self.action_space = spaces.Discrete(4) self.state_matrix = np.zeros((4, 4)) # Define rewards self.rewards = {-5: ‘Rock’, -6: ‘Rock’, 5: ‘Battery’, 6: ‘Battery’} # Randomly initialize rewardable slots for _ in range(4): # 4 rewards x, y = np.random.randint(0, 4, 2) reward = np.random.choice(list(self.rewards.keys())) self.state_matrix[x, y] = reward self.agent_pos = (0, 0) self.goal = (3, 3) def step(self, action): x, y = self.agent_pos if action == 0: # Up x = max(0, x - 1) elif action == 1: # Down x = min(3, x + 1) elif action == 2: # Right y = min(3, y + 1) else: # Left y = max(0, y - 1) self.agent_pos = (x, y) reward = self.state_matrix[x, y] self.state_matrix[x, y] = 0 # Remove the reward after collecting done = (x, y) == self.goal return self.agent_pos, reward, done, {} def reset(self): self.agent_pos = (0, 0) return self.agent_pos def render(self): grid = np.zeros_like(self.state_matrix) for x in range(4): for y in range(4): if self.state_matrix[x, y] != 0: grid[x, y] = list(self.rewards.keys()).index(self.state_matrix[x, y]) + 1 grid[self.goal] = 9 grid[self.agent_pos] = 8 plt.imshow(grid, cmap=‘viridis’, extent=(-0.5, 3.5, 3.5, -0.5)) plt.xticks(range(4)) plt.yticks(range(4)) plt.grid(True, which=‘both’, linestyle=‘-’, linewidth=0.5) plt.show() return grid # Test Environment env = LawnmowerGridWorld() state = env.reset() print(‘Initial State:’, state) env.render() # Run Random Agent for i in range(10): action = np.random.choice([0, 1, 2, 3]) state, reward, done, _ = env.step(action) print(‘After step {}: State={}, Action={}, Reward={}, Done={}’.format(i+1, state, action, reward, done)) env.render() if done: break--------------------------------Now, can you make change my scenario of grid world and give me the code --------------- env.close()
14f0dc322727ba3946363e84179e06c5
{ "intermediate": 0.2541254162788391, "beginner": 0.6539862155914307, "expert": 0.09188829362392426 }
3,261
this is my method to order a datagrid but is not working what it needs? public static void OrderDataGrid(DataGrid datagrid, string column, ListSortDirection direction = ListSortDirection.Ascending) { datagrid.Items.SortDescriptions.Add(new SortDescription(column, direction)); }
7b58390624cce778cb2c20f40e206944
{ "intermediate": 0.7718832492828369, "beginner": 0.12586474418640137, "expert": 0.1022520512342453 }
3,262
1. Introduction In this recitation we will learn how to employ the newsvendor problem to solve a scheduling problem. More specifically, we want to find the optimal number of nurses to be scheduled to work on the quarantine & isolation team at Cornell Health to handle positive COVID tests. Whenever a student tests positive, this team of nurses calls that student to check on their symptoms and to move them to a room at a hotel. The nursing team also calls students identified as close contacts of the positive student, and who may have already been infected, to move them into quarantine at a hotel. This is done to protect against the possibility that others would be infected by coming into contact with someone who is infectious. In many cases this is straightforward but it sometimes requires a substantial amount of work: the person being contacted might have a medical situation that requires extra attention (either from COVID or another condition); might not answer their phone (requiring repeated calls); might be belligerent or misrepresent the truth (requiring a longer conversation and sometimes the use of additional resources); or might simply have a great number of questions. This is a newsvendor problem because demand is stochastic and there is a cost both for scheduling too few nurses, and for scheduling too many. If we schedule too many nurses, we create a burden for them and risk burning out the nursing team. If we schedule too few, we can ask unscheduled nurses to come on and work at the last minute, but this forces them to drop their personal life and start working (creating a burden and risking burnout). Also, scheduling too few nurses creates a risk that we might not be able to contact and move to quarantine / isolation all of the students who are potentially infectious, risking the creation of new COVID cases. We focus on the arrival period for the Spring 2021 semester. During this period, students arriving from elsewhere were testing positive due to infections acquired at home. The rapid increase in arriving students and the changing nature of nationwide and international prevalence relative to the Fall 2020 semester made it difficult to plan based on past experience. This made mathematical modeling extremely useful. Indeed, code close to this recitation was actually used to make staffing decisions at Cornell Health over this period. # Importing basic libraries import numpy as np import pandas as pd import numpy.random as rand import matplotlib.pyplot as plt import matplotlib as mpl %matplotlib inline import math import time from IPython import display # Setting the default parameters for the plots produced by matplotlib # Sets figure size. Width, height in inches. plt.rcParams["figure.figsize"] = (10,10) # Sets label font sizes plt.rcParams['axes.labelsize'] = 14 plt.rcParams['xtick.labelsize'] = 12 plt.rcParams['ytick.labelsize'] = 12 2. Planning for a Single Day We will start by creating a model that plans for a single day, finding the optimal number of nurses to schedule for that day. First, we will model the probability of testing positive for an arriving student by specifying some constants. We model students as arriving from one of the following location categories - 'New York State', 'Middle States', 'New England', 'Midwest', 'South', 'Southwest', 'West', 'Territories', 'USA, unknown', and 'International'. If we know the distribution of the arriving Cornell student population over these location categories, and the COVID prevalence at each of these locations, we can estimate the probability that an arriving student will person testing postive if they arrive from 'X' location. We can get the data we need from https://www.cornell.edu/about/facts.cfm # Data from website locations = ['New York State','Middle States','New England','Midwest','South', 'Southwest','West','Territories','USA, unknown', 'International'] # Location categories pop_percent = [27,12,7,6,8,3,11,2,2,22] # Probability distribution of the origin locations for incoming Cornell students covid_prevalence = [1.3,1.4,1.6,1.9,2.0,1.7,1.8,2.4,2.5,3.1] # the probability that a person coming from each origin has COVID # Both pop_percent and covid_percents are expressed as percentages between 0 and 100. # Create a dataframe with the above information data = pd.DataFrame(list(zip(locations, pop_percent, covid_prevalence)), columns=['location','pop_percent','covid_prevalence']) data.head() Question 1: Write code that calculates the probability that an arriving student tests positive. This is ∑ 𝑖 𝑃(student origin is 𝑖)𝑃(student is positive|origin is 𝑖) Store this in a variable prevalence as a probability between 0 and 1.
6fd37753de64e47fa44561c8b11278c9
{ "intermediate": 0.5453265905380249, "beginner": 0.31610050797462463, "expert": 0.13857294619083405 }
3,263
Write me a streamlit app that allows users to upload images and lets them crop it using PIL, they should be able to click at least 3 points of the bounding box, and those coordinates will be printed out after the user clicks Show Coordinates
e615c5ec6fcd053a5677f8e2baaa1e43
{ "intermediate": 0.6576249599456787, "beginner": 0.060031965374946594, "expert": 0.2823430001735687 }
3,264
3. Planning for Multiple Days Setup Our current model only simulates a single day. However, we would like to have an optimal schedule for the number of nurses to employ for an entire period, say 3 weeks. We could do this by making 21 plots using the code above, one for each day, using the number of students scheduled to arrive for that day. We could then show each of those 21 plots to management and have them pick out a point on each plot. This would be a pain, however. It is better to show them a single plot for the entire 3-week period and have them select a point. In addition, we would like to introduce the possibility that a student does not test positive immediately upon arriving and thus contacts multiple students during the time he/she goes undetected. For simplicity, we do not assume the contacted students spread the virus to other contacts. For example, a student arriving on day 0 may not test positive until day 4, and he/she may contact 6 students. We will implement this improved model below. Before we do so, note that our objective is essentially still the same as above: for a particular 𝛼 optimally choose the number of nurses to schedule to minimize the expected total cost. However, our choice of nurses to schedule is no longer a scalar, since we are considering many days as opposed to a single day. Rather, it is a vector (say, 𝑁⃗ ) whose length is the number of days in the period we are considering, and whose 𝑗 th entry is our choice of the number of nurses to employ on day 𝑗 . For the mathematically inclined, our problem can be restated as the following optimization problem. (You may skip reading this cell, but it may help give you a better understanding of the problem at hand.) Let (𝑁1,...,𝑁𝐷)=𝑁⃗ be a vector giving the number of nurses that will work on each day ( 1 through 𝐷 ), then, for a particular value of 𝛼 , our objective function is: Objective (𝑁⃗) = ExpectedTotalOverage( 𝑁⃗ ) + 𝛼⋅ ExpectedTotalUnderage( 𝑁⃗ ) = ∑𝐷𝑑=1 𝐸 (Overage for day 𝑑 + 𝛼⋅ Underage for day 𝑑 | We use 𝑁𝑑 nurses on day 𝑑 ) ≈ ∑𝐷𝑑=1 1𝑀 ∑𝑀𝑖=1 (Overage for day 𝑑 +𝛼⋅ Underage for day 𝑑 | We use 𝑁𝑑 nurses on day 𝑑 and the random outcome for simulation 𝑖 is (𝑎𝑚𝑜𝑢𝑛𝑡_𝑜𝑓_𝑤𝑜𝑟𝑘)𝑖∈ℝ≥0 ) where 𝑀 is the number of simulations. Let 𝑁∗(𝛼) be the optimal choice of 𝑁1,...,𝑁𝐷 for a particular 𝛼 (i.e. the 𝑁⃗ that minimizes the Objective function), then we would like to ultimately plot the Pareto Frontier : ExpectedTotalOverage( 𝑁∗(𝛼) ) vs. ExpectedTotalUnderage( 𝑁∗(𝛼) ). Simulation Here we'll simulate scenarios, where each scenarios consists of the amount of work that needs to be done on each day during the first 3 weeks of the semester num_days = 21 num_scenarios = 20 # This is the number of people who arrive on each day. # It was generated using num_arrivals = np.ceil(2000*rand.uniform(size=num_days)) num_arrivals = [1076., 1752., 1783., 1326., 1385., 1454., 1230., 689., 1190., 1853., 1716., 405., 70., 1097., 1504., 634., 1407., 1222., 1140., 404., 1703.] # Create a dataframe containing all 0's where each row will be a scenario # and each column will be a simulated day. Once we run the code below, the # values in the dataframe will be the number of nurses needed on each day in # each scenario df_sim = pd.DataFrame(0, index=range(num_scenarios), columns=range(num_days)) for i in range(num_scenarios): for d in range(num_days): # Iterate over days in our simulation # Simulate the students who arrive on this day infected_no = rand.binomial(num_arrivals[d],prevalence) for j in range(infected_no): days_infectious = rand.geometric(0.3) day_tested_positive = d + days_infectious if day_tested_positive < num_days: contacts = 4 df_sim.loc[i,day_tested_positive] += (30 + 20 * contacts)/(8*60) df_sim Question 9: Change the above code so that the number of contacts depends on the number of days the person is infectious. Let the number of contacts be 1.5 times the number of days infectious. This models the fact that a person who has been circulating in the campus population is going to have more local contacts.
83a6ec43a3bfdf06ff6f8d1fbb4e19e2
{ "intermediate": 0.34931716322898865, "beginner": 0.4028409719467163, "expert": 0.24784187972545624 }
3,265
3. Planning for Multiple Days Setup Our current model only simulates a single day. However, we would like to have an optimal schedule for the number of nurses to employ for an entire period, say 3 weeks. We could do this by making 21 plots using the code above, one for each day, using the number of students scheduled to arrive for that day. We could then show each of those 21 plots to management and have them pick out a point on each plot. This would be a pain, however. It is better to show them a single plot for the entire 3-week period and have them select a point. In addition, we would like to introduce the possibility that a student does not test positive immediately upon arriving and thus contacts multiple students during the time he/she goes undetected. For simplicity, we do not assume the contacted students spread the virus to other contacts. For example, a student arriving on day 0 may not test positive until day 4, and he/she may contact 6 students. We will implement this improved model below. Before we do so, note that our objective is essentially still the same as above: for a particular 𝛼 optimally choose the number of nurses to schedule to minimize the expected total cost. However, our choice of nurses to schedule is no longer a scalar, since we are considering many days as opposed to a single day. Rather, it is a vector (say, 𝑁⃗ ) whose length is the number of days in the period we are considering, and whose 𝑗 th entry is our choice of the number of nurses to employ on day 𝑗 . For the mathematically inclined, our problem can be restated as the following optimization problem. (You may skip reading this cell, but it may help give you a better understanding of the problem at hand.) Let (𝑁1,...,𝑁𝐷)=𝑁⃗ be a vector giving the number of nurses that will work on each day ( 1 through 𝐷 ), then, for a particular value of 𝛼 , our objective function is: Objective (𝑁⃗) = ExpectedTotalOverage( 𝑁⃗ ) + 𝛼⋅ ExpectedTotalUnderage( 𝑁⃗ ) = ∑𝐷𝑑=1 𝐸 (Overage for day 𝑑 + 𝛼⋅ Underage for day 𝑑 | We use 𝑁𝑑 nurses on day 𝑑 ) ≈ ∑𝐷𝑑=1 1𝑀 ∑𝑀𝑖=1 (Overage for day 𝑑 +𝛼⋅ Underage for day 𝑑 | We use 𝑁𝑑 nurses on day 𝑑 and the random outcome for simulation 𝑖 is (𝑎𝑚𝑜𝑢𝑛𝑡_𝑜𝑓_𝑤𝑜𝑟𝑘)𝑖∈ℝ≥0 ) where 𝑀 is the number of simulations. Let 𝑁∗(𝛼) be the optimal choice of 𝑁1,...,𝑁𝐷 for a particular 𝛼 (i.e. the 𝑁⃗ that minimizes the Objective function), then we would like to ultimately plot the Pareto Frontier : ExpectedTotalOverage( 𝑁∗(𝛼) ) vs. ExpectedTotalUnderage( 𝑁∗(𝛼) ). Simulation Here we'll simulate scenarios, where each scenarios consists of the amount of work that needs to be done on each day during the first 3 weeks of the semester num_days = 21 num_scenarios = 20 # This is the number of people who arrive on each day. # It was generated using num_arrivals = np.ceil(2000*rand.uniform(size=num_days)) num_arrivals = [1076., 1752., 1783., 1326., 1385., 1454., 1230., 689., 1190., 1853., 1716., 405., 70., 1097., 1504., 634., 1407., 1222., 1140., 404., 1703.] # Create a dataframe containing all 0's where each row will be a scenario # and each column will be a simulated day. Once we run the code below, the # values in the dataframe will be the number of nurses needed on each day in # each scenario df_sim = pd.DataFrame(0, index=range(num_scenarios), columns=range(num_days)) for i in range(num_scenarios): for d in range(num_days): # Iterate over days in our simulation # Simulate the students who arrive on this day infected_no = rand.binomial(num_arrivals[d],prevalence) for j in range(infected_no): days_infectious = rand.geometric(0.3) day_tested_positive = d + days_infectious if day_tested_positive < num_days: contacts = 4 df_sim.loc[i,day_tested_positive] += (30 + 20 * contacts)/(8*60) df_sim Question 9: Change the above code so that the number of contacts depends on the number of days the person is infectious. Let the number of contacts be 1.5 times the number of days infectious. This models the fact that a person who has been circulating in the campus population is going to have more local contacts.
b6f29ec7d9f2946caadd20dc317d1489
{ "intermediate": 0.34931716322898865, "beginner": 0.4028409719467163, "expert": 0.24784187972545624 }
3,266
hi there, I'm using vite Vue 3 as front end and I want to build the sign up and login components give me simple examples and use bootstrap 5 for css style classes.I'm here to answer any questions you may have aswell to clearify.
1235d9fd84f4f4e20f491eb259a22ed0
{ "intermediate": 0.4382938742637634, "beginner": 0.31955379247665405, "expert": 0.2421523481607437 }
3,267
go vs php
82e8ecd1671bbdab95a6cdaaac4e27da
{ "intermediate": 0.4235503077507019, "beginner": 0.34859699010849, "expert": 0.2278526872396469 }
3,268
[~, i] = max(abs(U(k:n,k))); i = i+k-1; give another way to implement above two lines in matlab
bb1bd674600b294754197fd72870e381
{ "intermediate": 0.2966441810131073, "beginner": 0.33713337779045105, "expert": 0.36622247099876404 }
3,269
Copy paste text to notepad vba
20da1d049b9009d965334f739b0bfe70
{ "intermediate": 0.35245710611343384, "beginner": 0.2511753737926483, "expert": 0.39636749029159546 }
3,270
Perl source to quickly check if any variable in a list of variables is undefined
67df09d75a6ce67bc567aa9bfc266d5e
{ "intermediate": 0.3055756092071533, "beginner": 0.4888480007648468, "expert": 0.20557640492916107 }
3,271
Given an array of variables of arbitrary size, write Perl code to error if none of them are defined
cc928913f0e0ca1490caa844ccb50dba
{ "intermediate": 0.2727622091770172, "beginner": 0.5084468722343445, "expert": 0.2187909334897995 }
3,272
how to print public ip alpine linux console?
c90d8abfdd553920debdc1c847172e5d
{ "intermediate": 0.4200783967971802, "beginner": 0.24319878220558167, "expert": 0.33672279119491577 }
3,273
i am currently coding a windows form .network frame work i want to take info inputed through text box to create an object of an existing class and i want the object created to be inserted into a database
40f04f633ea97a06d21baddbc6c90e25
{ "intermediate": 0.5508185029029846, "beginner": 0.17519491910934448, "expert": 0.2739866077899933 }
3,274
le puedes agregar un required a este campo <input type="text" id="nameFemale" name="nombre" placeholder="Name" >
eb8ae4a59adf9eeddc009cfafd597e43
{ "intermediate": 0.36517730355262756, "beginner": 0.25270774960517883, "expert": 0.3821149170398712 }
3,275
Is it highly advisable for the Restic local repository to be on an SSD, or is regular hard drive OK?
02750ce4294e4c16a727791c40ab65ea
{ "intermediate": 0.3472859263420105, "beginner": 0.2627246379852295, "expert": 0.3899894952774048 }
3,276
With the Automatic mouse and keyboard app, how do i make bkgnd_Keystroke work? Also, how do i use FindVirtualScreenImages?
d63b9250120f9f3c78eb4b9de15e8fc6
{ "intermediate": 0.8073557615280151, "beginner": 0.08844577521085739, "expert": 0.10419841855764389 }
3,277
This is the head of my dataset with file name DATA.csv ------------------------------------------------------------------------------------------------------------------------------------------------posres multi clinend mech sampsize budget impact time status <int> <int> <int> <chr> <int> <dbl> <dbl> <dbl> <int> 1 0 0 1 R01 39876 8.016941 44.016 11.203285 1 2 0 0 1 R01 39876 8.016941 23.494 15.178645 1 3 0 0 1 R01 8171 7.612606 8.391 24.410678 1 4 0 0 1 Contract 24335 11.771928 15.402 2.595483 1 5 0 0 1 Contract 33357 76.517537 16.783 8.607803 1 6 0 0 1 Contract 10355 9.809938 16.783 8.607803 1----------------------------------------------------------------------------------------------------------------------------------------------------------# Question 2 (25 points) A data set from "DATA.csv" represents publication times for 244 clinical trials funded by the National Heart, Lung, and Blood Institute. Using Log-Rank Test in R, estimate if the Kaplan-Meier Survival Curves from two subpopulations stratified by “posres” variable are significantly different.
5b202ebdd6d759e4d8f3ce31457b7ad1
{ "intermediate": 0.25691285729408264, "beginner": 0.5232107043266296, "expert": 0.21987642347812653 }
3,278
Mern e-commerce application
225d296c773894955e73522e56709aa5
{ "intermediate": 0.3548031449317932, "beginner": 0.36142534017562866, "expert": 0.2837715744972229 }
3,279
could you write a fivem server dumper program
fd2607c44064ba1f444921cbdad28473
{ "intermediate": 0.429564505815506, "beginner": 0.18302220106124878, "expert": 0.3874133229255676 }
3,280
How to specify interface with which to use wget
f0837fb4d1a687c96abadb82e7a0b7e3
{ "intermediate": 0.5347100496292114, "beginner": 0.2684357166290283, "expert": 0.19685418903827667 }
3,281
given that this section has a slides, and my file directory to the first desired image is C:\Users\Kaddra52\Desktop\DDW\assets\images\homeslide.png fix this html and find css for reference HTML snippet: <section class="slideshow-section"> <div class="slideshow-container"> <div class="mySlides fade"> <img src="assets/images/homeslide.png" alt="Tents" style="width:100%"> </div> <div class="mySlides fade"> <img src="https://via.placeholder.com/600x400" alt="Cookers" style="width:100%"> </div> <div class="mySlides fade"> <img src="https://via.placeholder.com/600x400" alt="Camping Gear" style="width:100%"> </div> <a class="prev" onclick="plusSlides(-1)">❮</a> <a class="next" onclick="plusSlides(1)">❯</a> </div> <div style="text-align:center"> <span class="dot" onclick="currentSlide(1)"></span> <span class="dot" onclick="currentSlide(2)"></span> <span class="dot" onclick="currentSlide(3)"></span> </div> </section> CSS:html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img { margin: 0; padding: 0; border: 0; font-size: 100%; font-family: inherit; vertical-align: baseline; box-sizing: border-box; } body { font-family: "Cabin", sans-serif; line-height: 1.5; color: #333; width: 100%; margin: 0; padding: 0; min-height: 100vh; flex-direction: column; display: flex; background-image: url("../assets/images/cover.jpg"); background-size: cover; } header { background: #00000000; padding: 0.5rem 2rem; text-align: center; color: #32612D; font-size: 1.2rem; } main{ flex-grow: 1; } .sticky-nav { position: -webkit-sticky; position: sticky; top: 0; z-index: 1000; } .nav-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .search-container { display: inline-block; position: relative; } .search-container input[type="text"] { padding: 0.8rem; border: none; border-bottom: 1.5px solid #32612D; outline: none; color: #32612D; font-size: 1rem; background-color: transparent; margin-right: 30rem; margin-bottom: 12px; width: 65%; } .search-container input[type="text"]::placeholder { color: #32612D; opacity: 0.5; } .search-icon { margin-right: 0.8rem; width: 24px; height: auto; vertical-align: middle; position: absolute; top: 50%; margin-top: -16px; } .search-container input[type="text"]:focus { border-color: #ADC3AB; } .search-container button[type="submit"] { display: none; } .logo { width: 50px; height: auto; margin-right: 1rem; } h1 { flex-grow: 1; text-align: left; text-shadow: 1px 1px #b3814b; } nav ul { display: inline list-style: none; } nav ul li { display: inline; margin-left: 1rem; } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; text-shadow: 0.2px 0.2px #b3814b; } @media screen and (max-width: 768px) { .nav-container { flex-direction: column; } h1 { margin-bottom: 1rem; } } nav ul li a { text-decoration: none; color: #32612D; position: relative; transition: color 0.3s ease; } nav ul li a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background-color: #000; transform: scaleX(0); transition: transform 0.3s; } nav ul li a:hover { color: #000000; } nav ul li a:hover::after { transform: scaleX(1); } .slideshow-container { width: 100%; position: relative; margin: 1rem 0; } .mySlides { display: none; } .mySlides img { width: 100%; height: auto; } /* Slideshow navigation */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; margin-top: -22px; padding: 16px; color: #32612D; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; } .next { right: 0; border-radius: 3px 0 0 3px; } .prev:hover, .next:hover { background-color: rgba(255,255,255,0.8); } .dot { cursor: pointer; height: 15px; width: 15px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .dot:hover { background-color: #717171; } .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } .catalog { display: flex; flex-wrap: wrap; justify-content: center; margin: 2rem 0; } .catalog-item { width: 200px; padding: 1rem; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; } .catalog-item:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .catalog-item img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .catalog-item h3 { margin-bottom: 0.5rem; } .catalog-item p { margin-bottom: 0.5rem; } .catalog-item button { background-color: #32612D; color: #fff; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .catalog-item button:hover { background-color: #ADC3AB; } .category-title { width: 100%; text-align: center; font-size: 24px; font-weight: bold; margin-bottom: 1rem; color: #F5F3CE; text-shadow: 2px 2px #0A381F; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .filter { margin-bottom: 5rem; } .filter select { padding: 0.5rem; font-size: 0.9rem; } footer form { display: inline-flex; align-items: center; } .about-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section { padding: 1rem; text-align: center; margin: 1rem 0; } .featured-section h2 { font-size: 1.5rem; margin-bottom: 1rem; } .featured-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .featured-product { width: 150px; padding: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; margin: 0.5rem; } .featured-product:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .featured-product img { width: 100%; height: auto; margin-bottom: 1rem; border-radius: 5px; } .furniture-item { width: 200px; padding: 1rem; margin: 1rem; background-color: #dcbba3; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; } .furniture-item:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .furniture-item img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .furniture-item h3 { margin-bottom: 0.5rem; } .furniture-item p { margin-bottom: 0.5rem; } .furniture-item button { background-color: #b38f71; color: #fff; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .furniture-item button:hover { background-color: #dcbba3; } .special-offers-container { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 1rem 0; } .special-offer { width: 200px; padding: 1rem; text-align: center; margin: 1rem; background-color: #ADC3AB; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } .special-offer:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); transform: translateY(-5px); } .special-offer img { width: 100%; height: auto; margin-bottom: 0.5rem; border-radius: 5px; } .modal { display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1; overflow: auto; align-items: center; } .modal-content { background-color: #fefefe; padding: 2rem; margin: 10% auto; width: 30%; min-width: 300px; max-width: 80%; text-align: center; border-radius: 5px; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1); } .modalBtn{ background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .buts { text-align: center; } .footer-item.address-container p { margin: 0; text-align: left; } .footer-item p { text-align: center; } .add{ text-align: center; } .close { display: block; text-align: right; font-size: 2rem; color: #333; cursor: pointer; } footer { background: #32612D; padding: 1rem; text-align: center; margin-top: auto; } .footer-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .footer-item { margin: 1rem 2rem; } footer p { color: #fff; margin-bottom: 1rem; } footer ul { list-style: none; } footer ul li { display: inline; margin: 0.5rem; } footer ul li a { text-decoration: none; color: #fff; } @media screen and (max-width: 768px) { .special-offers-container { flex-direction: column; } } @media screen and (max-width: 480px) { h1 { display: block; margin-bottom: 1rem; } } .footer-item iframe { width: 100%; height: 200px; } .footer-item form { display: inline-flex; align-items: center; } .footer-item input[type="email"] { padding: 0.5rem; border: none; border-radius: 5px; margin-right: 0.5rem; } .footer-item button { background-color: #ADC3AB; color: #32612D; padding: 0.5rem; border: none; border-radius: 5px; cursor: pointer; } .footer-item button:hover { background-color: #32612D; color: #fff; } .social-links-container { order: 2; } .address-container { order: 1; } .google-maps-container { order: 0; }
85461990f12544bf0b77516c35a6d95f
{ "intermediate": 0.3375437259674072, "beginner": 0.4793781340122223, "expert": 0.1830781251192093 }
3,282
c++ initialize an array of boolean arrays of length n by mm
d2d7b9299ebd6577c1e56c3794225311
{ "intermediate": 0.36448749899864197, "beginner": 0.26932066679000854, "expert": 0.3661918342113495 }
3,283
dp3[(s + t3[c]) % RES][l + 1] = 1; expression must have integral or unscoped enum typeC/C++(2140)
5bc9c92ae374b16b9232b2f6d77dc672
{ "intermediate": 0.23300130665302277, "beginner": 0.49507325887680054, "expert": 0.2719254493713379 }
3,284
dp3[(s + t3[c])][l + 1] = 1; cast from pointer to smaller type 'int' loses informationgcc expression must have integral or unscoped enum typeC/C++(2140)
7b768a4899288d17c9e650acc7db1918
{ "intermediate": 0.3097006380558014, "beginner": 0.46223992109298706, "expert": 0.22805947065353394 }
3,285
hi
45615dd3c47191dcb19e59b5468a5238
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
3,286
i need to make anew activity in my application with java only and its content for quaran fm via network and with multible voices in tha activity so i need the code of xml and java class and code dependencesto build gradle and code of mainfest to play fm back ground and all things that may be usefull
eee53bfee364d575cedf004386c55b58
{ "intermediate": 0.541733980178833, "beginner": 0.3015870749950409, "expert": 0.1566789597272873 }
3,287
c++ initialize 2d boolean array
7aa2b784cb4d1da324a5b4630104dee9
{ "intermediate": 0.36368364095687866, "beginner": 0.36801430583000183, "expert": 0.2683020532131195 }
3,288
import requests import json import datetime import streamlit as st from itertools import zip_longest import os def basic_info(): config = dict() config["access_token"] = st.secrets["access_token"] config['instagram_account_id'] = st.secrets.get("instagram_account_id", "") config["version"] = 'v16.0' config["graph_domain"] = 'https://graph.facebook.com/' config["endpoint_base"] = config["graph_domain"] + config["version"] + '/' return config def InstaApiCall(url, params, request_type): if request_type == 'POST': req = requests.post(url, params) else: req = requests.get(url, params) res = dict() res["url"] = url res["endpoint_params"] = params res["endpoint_params_pretty"] = json.dumps(params, indent=4) res["json_data"] = json.loads(req.content) res["json_data_pretty"] = json.dumps(res["json_data"], indent=4) return res def getUserMedia(params, pagingUrl=''): Params = dict() Params['fields'] = 'id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username,like_count,comments_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None if pagingUrl == '': url = params['endpoint_base'] + params['instagram_account_id'] + '/media' else: url = pagingUrl return InstaApiCall(url, Params, 'GET') def saveCount(count, filename): with open(filename, 'w') as f: json.dump(count, f, indent=4) def getCount(filename): try: with open(filename, 'r') as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError): return {} st.set_page_config(layout="wide") params = basic_info() if not params['instagram_account_id']: st.write('.envファイルでinstagram_account_idを確認') else: response = getUserMedia(params) if not response: st.write('.envファイルでaccess_tokenを確認') else: posts = response['json_data']['data'][::-1] NUM_COLUMNS = 6 MAX_WIDTH = 1000 BOX_WIDTH = int(MAX_WIDTH / NUM_COLUMNS) BOX_HEIGHT = 400 show_description = st.checkbox("キャプションを表示") posts.reverse() post_groups = [list(filter(None, group)) for group in zip_longest(*[iter(posts)] * NUM_COLUMNS)] count_filename = "count.json" count = getCount(count_filename) today = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d') yesterday = (datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))) - datetime.timedelta(days=1)).strftime('%Y-%m-%d') if today not in count: count[today] = {} if datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%H:%M') == '23:59': count[yesterday] = count[today] for post_group in post_groups: with st.container(): columns = st.columns(NUM_COLUMNS) for i, post in enumerate(post_group): with columns[i]: st.image(post['media_url'], width=BOX_WIDTH, use_column_width=True) st.write(f"{datetime.datetime.strptime(post['timestamp'], '%Y-%m-%dT%H:%M:%S%z').astimezone(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d %H:%M:%S')}") like_count_diff = post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) comment_count_diff = post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) st.write(f"👍: {post['like_count']} ({'+' if like_count_diff >= 0 else ''}{like_count_diff})\n💬: {post['comments_count']} ({'+' if comment_count_diff >= 0 else ''}{comment_count_diff})\n") caption = post['caption'] if caption is not None: caption = caption.strip() if "[Description]" in caption: caption = caption.split("[Description]")[1].lstrip() if "[Tags]" in caption: caption = caption.split("[Tags]")[0].rstrip() caption = caption.replace("#", "") caption = caption.replace([model],👗) caption = caption.replace("[Equip]", "📷") caption = caption.replace("[Develop]", "🖨") if show_description: st.write(caption or "No caption provided") else: st.write(caption[:0] if caption is not None and len(caption) > 50 else caption or "No caption provided") count[today][post['id']] = {'like_count': post['like_count'], 'comments_count': post['comments_count']} saveCount(count, count_filename) ''' 上記のコードを以下の要件をすべて満たして改修してください?? - 説明は表記せずPython用のコードのみ出力する - "caption = post['caption']"に関するコードは残存させる - 毎日JST23:59に現時点でのフォロワー数を取得し、すでに別件で使用している"count.json"内に保存するようコードを改修する - StreamlitのUIで"説明文を表示"の上に"instagramアカウント名"、"現時点でのフォロワー数(Follower)"、'count.json'と現時点のフォロワー数との差分を"(-1)や(±0)や(+2)"のように、一段階大きめのサイズで表示する - "いいね数"や"コメント数"の差分表示の"()"内において、全投稿の中で最も増加したものについては、"+"と"増減数"を"赤"で表示するよう改修する
781a38ab035ee60d47a7241d70014608
{ "intermediate": 0.38020947575569153, "beginner": 0.39222896099090576, "expert": 0.2275616079568863 }
3,289
Hi, You helped me implement a Q Actor Critic algorithm which worked well for Cartpole-v1 , Lunar Lander-v2 but not for Bipedal Walker. So, I'll provide you the entire implementation and I want you to make the necessary modifications to our code. Keep in mind that the code should work for all the three mentioned env's. In my opinion, our current implementation only works for discrete space whereas Bipedal Walker is a continuous space which causing the error. I'm impressed by your work yesterday. You did a great job. Keep up the good work as always. Here is the implementation: class QActorCritic(nn.Module): def __init__(self, num_inputs, num_outputs): super(QActorCritic, self).__init__() self.policy_net = nn.Sequential( nn.Linear(num_inputs, 64), nn.ReLU(), nn.Linear(64, 64), nn.ReLU(), nn.Linear(64, num_outputs), nn.Softmax(dim=1) ) self.q_net = nn.Sequential( nn.Linear(num_inputs, 64), nn.ReLU(), nn.Linear(64, 64), nn.ReLU(), nn.Linear(64, num_outputs) ) def forward(self, x): raise NotImplementedError def get_action_probs(self, x): x = torch.from_numpy(x).float().unsqueeze(0).to(device) action_probs = self.policy_net(x) return action_probs def get_q_values(self, x): x = torch.from_numpy(x).float().unsqueeze(0).to(device) q_values = self.q_net(x) return q_values def train(env, device, model, lr=1e-3, num_episodes=500, gamma=0.99): policy_optimizer = optim.Adam(model.policy_net.parameters(), lr=lr) q_optimizer = optim.Adam(model.q_net.parameters(), lr=lr) total_rewards = [] for episode in range(num_episodes): state = env.reset() episode_reward = 0 while True: action_probs = model.get_action_probs(state) action_distr = Categorical(action_probs) action = action_distr.sample().item() next_state, reward, done, _ = env.step(action) next_action_probs = model.get_action_probs(next_state) next_action_distr = Categorical(next_action_probs) next_action = next_action_distr.sample().item() with torch.no_grad(): target = reward + gamma * model.get_q_values(next_state)[0, next_action] policy_loss = -action_distr.log_prob(torch.tensor([action]).to(device)) * (target - model.get_q_values(state)[0, action]) q_loss = (target - model.get_q_values(state)[0, action]).pow(2).to(device) policy_optimizer.zero_grad() policy_loss.backward() policy_optimizer.step() q_optimizer.zero_grad() q_loss.backward() q_optimizer.step() state = next_state episode_reward += reward if done: break total_rewards.append(episode_reward) if episode % 100 == 0: print(f"Episode: {episode}, reward: {episode_reward}") return total_rewards # env = gym.make('BipedalWalker-v3') num_inputs = env.observation_space.shape[0] num_outputs = env.action_space.shape[0] q_actor_critic = QActorCritic(num_inputs, num_outputs).to(device) train_rewards = train(env,device, q_actor_critic, num_episodes=1000, lr=1e-4) print('Bipedal Walker Training results:') plot_rewards('BipedalWalker-v3', 'Training', train_rewards) return total_rewards
b0861a59c394df14b22e386018f3eba2
{ "intermediate": 0.37862351536750793, "beginner": 0.3914855718612671, "expert": 0.2298908829689026 }
3,290
import requests import json import datetime import streamlit as st from itertools import zip_longest import os def basic_info(): config = dict() config["access_token"] = st.secrets["access_token"] config['instagram_account_id'] = st.secrets.get("instagram_account_id", "") config["version"] = 'v16.0' config["graph_domain"] = 'https://graph.facebook.com/' config["endpoint_base"] = config["graph_domain"] + config["version"] + '/' return config def InstaApiCall(url, params, request_type): if request_type == 'POST': req = requests.post(url, params) else: req = requests.get(url, params) res = dict() res["url"] = url res["endpoint_params"] = params res["endpoint_params_pretty"] = json.dumps(params, indent=4) res["json_data"] = json.loads(req.content) res["json_data_pretty"] = json.dumps(res["json_data"], indent=4) return res def getUserMedia(params, pagingUrl=''): Params = dict() Params['fields'] = 'id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username,like_count,comments_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None if pagingUrl == '': url = params['endpoint_base'] + params['instagram_account_id'] + '/media' else: url = pagingUrl return InstaApiCall(url, Params, 'GET') def saveCount(count, filename): with open(filename, 'w') as f: json.dump(count, f, indent=4) def getCount(filename): try: with open(filename, 'r') as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError): return {} st.set_page_config(layout="wide") params = basic_info() if not params['instagram_account_id']: st.write('.envファイルでinstagram_account_idを確認') else: response = getUserMedia(params) if not response: st.write('.envファイルでaccess_tokenを確認') else: posts = response['json_data']['data'][::-1] NUM_COLUMNS = 6 MAX_WIDTH = 1000 BOX_WIDTH = int(MAX_WIDTH / NUM_COLUMNS) BOX_HEIGHT = 400 show_description = st.checkbox("キャプションを表示") posts.reverse() post_groups = [list(filter(None, group)) for group in zip_longest(*[iter(posts)] * NUM_COLUMNS)] count_filename = "count.json" count = getCount(count_filename) today = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d') yesterday = (datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))) - datetime.timedelta(days=1)).strftime('%Y-%m-%d') if today not in count: count[today] = {} if datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%H:%M') == '23:59': count[yesterday] = count[today] for post_group in post_groups: with st.container(): columns = st.columns(NUM_COLUMNS) for i, post in enumerate(post_group): with columns[i]: st.image(post['media_url'], width=BOX_WIDTH, use_column_width=True) st.write(f"{datetime.datetime.strptime(post['timestamp'], '%Y-%m-%dT%H:%M:%S%z').astimezone(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d %H:%M:%S')}") like_count_diff = post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) comment_count_diff = post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) st.write(f"👍: {post['like_count']} ({'+' if like_count_diff >= 0 else ''}{like_count_diff})\n💬: {post['comments_count']} ({'+' if comment_count_diff >= 0 else ''}{comment_count_diff})\n") caption = post['caption'] if caption is not None: caption = caption.strip() if "[Description]" in caption: caption = caption.split("[Description]")[1].lstrip() if "[Tags]" in caption: caption = caption.split("[Tags]")[0].rstrip() caption = caption.replace("#", "") caption = caption.replace([model],👗) caption = caption.replace("[Equip]", "📷") caption = caption.replace("[Develop]", "🖨") if show_description: st.write(caption or "No caption provided") else: st.write(caption[:0] if caption is not None and len(caption) > 50 else caption or "No caption provided") count[today][post['id']] = {'like_count': post['like_count'], 'comments_count': post['comments_count']} saveCount(count, count_filename) ''' 上記のコードを以下の要件をすべて満たして改修してください - 説明は表記せずPython用のコードのみ出力する - "caption = post['caption']以降のブロックのコードは残存させ利用する - 現状の"いいね数"と"コメント数"の取得と保存に関するコードは残存させ利用する - 毎日JST23:59に現時点でのフォロワー数を取得し、すでに別件で使用している"count.json"内に保存するようコードを改修する - StreamlitのUIで"説明文を表示"の上に"instagramアカウント名"、"現時点でのフォロワー数(Follower)"、'count.json'と現時点のフォロワー数との差分を"(-1)や(±0)や(+2)"と、横並びで一段階大きめのサイズで表示する - "いいね数"や"コメント数"の差分表示の"()"内において、全投稿の中で最も増加したものについては、"+"と"増減数"を"赤"で表示するよう改修する
bca175952b32325547f4727a6f78e586
{ "intermediate": 0.38020947575569153, "beginner": 0.39222896099090576, "expert": 0.2275616079568863 }
3,291
利用结构化分析方法对学生选课管理系统进行需求分析,完成其数据流图(由加工、数据流、文件、源点/终点4种元素组成),要求至少画出三层的数据流图。 ①顶层数据流图 ②1层数据流图 ③2层数据流图
55252dfc4ccd7058680d4658400aa922
{ "intermediate": 0.32135728001594543, "beginner": 0.37160468101501465, "expert": 0.30703800916671753 }
3,292
import requests import json import datetime import streamlit as st from itertools import zip_longest import os def basic_info(): config = dict() config["access_token"] = st.secrets["access_token"] config['instagram_account_id'] = st.secrets.get("instagram_account_id", "") config["version"] = 'v16.0' config["graph_domain"] = 'https://graph.facebook.com/' config["endpoint_base"] = config["graph_domain"] + config["version"] + '/' return config def InstaApiCall(url, params, request_type): if request_type == 'POST': req = requests.post(url, params) else: req = requests.get(url, params) res = dict() res["url"] = url res["endpoint_params"] = params res["endpoint_params_pretty"] = json.dumps(params, indent=4) res["json_data"] = json.loads(req.content) res["json_data_pretty"] = json.dumps(res["json_data"], indent=4) return res def getUserMedia(params, pagingUrl=''): Params = dict() Params['fields'] = 'id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username,like_count,comments_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None if pagingUrl == '': url = params['endpoint_base'] + params['instagram_account_id'] + '/media' else: url = pagingUrl return InstaApiCall(url, Params, 'GET') def saveCount(count, filename): with open(filename, 'w') as f: json.dump(count, f, indent=4) def getCount(filename): try: with open(filename, 'r') as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError): return {} st.set_page_config(layout="wide") params = basic_info() if not params['instagram_account_id']: st.write('.envファイルでinstagram_account_idを確認') else: response = getUserMedia(params) if not response: st.write('.envファイルでaccess_tokenを確認') else: posts = response['json_data']['data'][::-1] NUM_COLUMNS = 6 MAX_WIDTH = 1000 BOX_WIDTH = int(MAX_WIDTH / NUM_COLUMNS) BOX_HEIGHT = 400 show_description = st.checkbox("キャプションを表示") posts.reverse() post_groups = [list(filter(None, group)) for group in zip_longest(*[iter(posts)] * NUM_COLUMNS)] count_filename = "count.json" count = getCount(count_filename) today = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d') yesterday = (datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))) - datetime.timedelta(days=1)).strftime('%Y-%m-%d') if today not in count: count[today] = {} if datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%H:%M') == '23:59': count[yesterday] = count[today] for post_group in post_groups: with st.container(): columns = st.columns(NUM_COLUMNS) for i, post in enumerate(post_group): with columns[i]: st.image(post['media_url'], width=BOX_WIDTH, use_column_width=True) st.write(f"{datetime.datetime.strptime(post['timestamp'], '%Y-%m-%dT%H:%M:%S%z').astimezone(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d %H:%M:%S')}") like_count_diff = post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) comment_count_diff = post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) st.write(f"👍: {post['like_count']} ({'+' if like_count_diff >= 0 else ''}{like_count_diff})\n💬: {post['comments_count']} ({'+' if comment_count_diff >= 0 else ''}{comment_count_diff})\n") caption = post['caption'] if caption is not None: caption = caption.strip() if "[Description]" in caption: caption = caption.split("[Description]")[1].lstrip() if "[Tags]" in caption: caption = caption.split("[Tags]")[0].rstrip() caption = caption.replace("#", "") caption = caption.replace("[model]",👗) caption = caption.replace("[Equip]", "📷") caption = caption.replace("[Develop]", "🖨") if show_description: st.write(caption or "No caption provided") else: st.write(caption[:0] if caption is not None and len(caption) > 50 else caption or "No caption provided") count[today][post['id']] = {'like_count': post['like_count'], 'comments_count': post['comments_count']} saveCount(count, count_filename) ''' 上記のコードを以下の要件をすべて満たして改修してください - 説明は表記せずPython用のコードのみ出力する - "caption = post['caption']以降のブロックのコードは残存させ利用する - 現状の"いいね数"と"コメント数"の取得と保存に関するコードは残存させ利用する - 毎日JST23:59に現時点でのフォロワー数を取得し、すでに別件で使用している"count.json"内に保存するようコードを改修する - StreamlitのUIで"キャプションを表示"の上に"現時点でのフォロワー数(Follower)"、すぐ右に'count.json'と現時点のフォロワー数との差分を"(-1)や(±0)や(+2)"のように並ぶようにし、一段階大きめのサイズで表示する
fbf09f365b592e66fe48909cdb7cab21
{ "intermediate": 0.38020947575569153, "beginner": 0.39222896099090576, "expert": 0.2275616079568863 }
3,293
c++ write to file
32fcf0bb6bd3ed15f8c3baa5c4a16b1a
{ "intermediate": 0.2870160937309265, "beginner": 0.3613182306289673, "expert": 0.351665735244751 }
3,294
write a python script that takes an image and reduces its detentions until it is lower than 100kb
00c88cef376c232547b632b30add586c
{ "intermediate": 0.29791614413261414, "beginner": 0.130131334066391, "expert": 0.5719525218009949 }
3,295
''' import requests import json import datetime import streamlit as st from itertools import zip_longest import os def basic_info(): config = dict() config["access_token"] = st.secrets["access_token"] config['instagram_account_id'] = st.secrets.get("instagram_account_id", "") config["version"] = 'v16.0' config["graph_domain"] = 'https://graph.facebook.com/' config["endpoint_base"] = config["graph_domain"] + config["version"] + '/' return config def InstaApiCall(url, params, request_type): if request_type == 'POST': req = requests.post(url, params) else: req = requests.get(url, params) res = dict() res["url"] = url res["endpoint_params"] = params res["endpoint_params_pretty"] = json.dumps(params, indent=4) res["json_data"] = json.loads(req.content) res["json_data_pretty"] = json.dumps(res["json_data"], indent=4) return res def getUserMedia(params, pagingUrl=''): Params = dict() Params['fields'] = 'id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username,like_count,comments_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None if pagingUrl == '': url = params['endpoint_base'] + params['instagram_account_id'] + '/media' else: url = pagingUrl return InstaApiCall(url, Params, 'GET') def getUser(params): Params = dict() Params['fields'] = 'followers_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None url = params['endpoint_base'] + params['instagram_account_id'] return InstaApiCall(url, Params, 'GET') def saveCount(count, filename): with open(filename, 'w') as f: json.dump(count, f, indent=4) def getCount(filename): try: with open(filename, 'r') as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError): return {} st.set_page_config(layout="wide") params = basic_info() if not params['instagram_account_id']: st.write('.envファイルでinstagram_account_idを確認') else: response = getUserMedia(params) user_response = getUser(params) if not response or not user_response: st.write('.envファイルでaccess_tokenを確認') else: posts = response['json_data']['data'][::-1] user_data = user_response['json_data'] followers_count = user_data.get('followers_count', 0) NUM_COLUMNS = 6 MAX_WIDTH = 1000 BOX_WIDTH = int(MAX_WIDTH / NUM_COLUMNS) BOX_HEIGHT = 400 show_description = st.checkbox("キャプションを表示") # Add follower count and difference above the show_description checkbox yesterday = (datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))) - datetime.timedelta(days=1)).strftime('%Y-%m-%d') follower_diff = followers_count - getCount(count_filename).get(yesterday, {}).get('followers_count', followers_count) st.markdown(f"<h4 style='font-size:1.2em;'>Follower: {followers_count} ({'+' if follower_diff >= 0 else ''}{follower_diff})</h4>", unsafe_allow_html=True) posts.reverse() post_groups = [list(filter(None, group)) for group in zip_longest(*[iter(posts)] * NUM_COLUMNS)] count_filename = "count.json" count = getCount(count_filename) today = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d') if today not in count: count[today] = {} count[today]['followers_count'] = followers_count if datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%H:%M') == '23:59': count[yesterday] = count[today] max_like_diff = max((post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) for post in posts), default=0) max_comment_diff = max((post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) for post in posts), default=0) for post_group in post_groups: with st.container(): columns = st.columns(NUM_COLUMNS) for i, post in enumerate(post_group): with columns[i]: st.image(post['media_url'], width=BOX_WIDTH, use_column_width=True) st.write(f"{datetime.datetime.strptime(post['timestamp'], '%Y-%m-%dT%H:%M:%S%z').astimezone(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d %H:%M:%S')}") like_count_diff = post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) comment_count_diff = post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) st.markdown(f"👍: {post['like_count']} <span style='{'' if like_count_diff != max_like_diff else 'color:red;'}'>({'+' if like_count_diff >= 0 else ''}{like_count_diff})</span>" f"\n💬: {post['comments_count']} <span style='{'' if comment_count_diff != max_comment_diff else 'color:red;'}'>({'+' if comment_count_diff >= 0 else ''}{comment_count_diff})</span>", unsafe_allow_html=True) caption = post['caption'] if caption is not None: caption = caption.strip() if "[Description]" in caption: caption = caption.split("[Description]")[1].lstrip() if "[Tags]" in caption: caption = caption.split("[Tags]")[0].rstrip() caption = caption.replace("#", "") caption = caption.replace("[model]", "👗") caption = caption.replace("[Equip]", "📷") caption = caption.replace("[Develop]", "🖨") if show_description: st.write(caption or "No caption provided") else: st.write(caption[:0] if caption is not None and len(caption) > 50 else caption or "No caption provided") count[today][post['id']] = {'like_count': post['like_count'], 'comments_count': post['comments_count']} saveCount(count, count_filename) ''' 上記コードを実行すると下記のエラーが発生します。下記のすべての要件に従って修正してください。 - Python用のインデントを行頭に付与して出力する - コード冒頭の修正内容についての説明文は表示しない - 指示のないコードの改変はせず優先的に活用する - コードに未使用の不要な部分があれば削除し、コード全体を最適化する - 修正済みのコード全体を省略せずに表示する ''' Traceback (most recent call last): File "/home/walhalax/.var/app/org.jupyter.JupyterLab/config/jupyterlab-desktop/jlab_server/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "/home/walhalax/PycharmProjects/pythonProject/その他/Instargram/inst_tileview/inst_tileview.py", line 92, in <module> follower_diff = followers_count - getCount(count_filename).get(yesterday, {}).get('followers_count', followers_count) NameError: name 'count_filename' is not defined
13841c8ddfae4d8c51b644b8f2ffb8ef
{ "intermediate": 0.42739325761795044, "beginner": 0.38451606035232544, "expert": 0.18809065222740173 }
3,296
generate me a create a chrome extension tool that allows me to right click on any image and be able to find similar or exact products relating to the picture while searching for the image on supplier sites like aliexpress, cjdropshipping, and alibaba. must be in the python language.
8f410464f75f9802f3f02fdb1fbe36bd
{ "intermediate": 0.3445452153682709, "beginner": 0.2560403645038605, "expert": 0.3994143307209015 }
3,297
Wakeword detection C++
62d8a6b425c655a34605395425205c1d
{ "intermediate": 0.21526630222797394, "beginner": 0.39350733160972595, "expert": 0.3912263810634613 }
3,298
WakeWord Detection ai на c++
46dd80dca6dd948e98e9cf2cf61502ef
{ "intermediate": 0.24824653565883636, "beginner": 0.3362473249435425, "expert": 0.4155060946941376 }
3,299
WakeWord Detection c++
531e8a41aed90b76ec8d3bd606eac107
{ "intermediate": 0.32440492510795593, "beginner": 0.28450748324394226, "expert": 0.3910875916481018 }
3,300
generate me a create a chrome extension tool that allows me to right click on any image and be able to find similar or exact products relating to the picture while searching for the image on supplier sites like aliexpress, cjdropshipping, and alibaba. must be in the python language. Also give clear step by step instructions like you are telling someone with no prior coding experience.
0d3d4762e3f0a9194a32b2fd28ab8205
{ "intermediate": 0.3532445728778839, "beginner": 0.35521212220191956, "expert": 0.2915433943271637 }
3,301
error: a function declaration without a prototype is deprecated in all versions of C
3b328728aaced271e49995992c3e5472
{ "intermediate": 0.256076842546463, "beginner": 0.5214654207229614, "expert": 0.2224576771259308 }
3,302
Why does my site reload when I call createWill() ? import '@rainbow-me/rainbowkit/styles.css'; import { RainbowKitProvider, getDefaultWallets, } from '@rainbow-me/rainbowkit'; import { WagmiConfig, configureChains, createClient } from 'wagmi'; import { useEffect, useState } from "react" import { ConnectButton } from '@rainbow-me/rainbowkit'; import abi from './abi'; import { alchemyProvider } from 'wagmi/providers/alchemy'; import { baseGoerli } from 'wagmi/chains'; import { publicProvider } from 'wagmi/providers/public'; const { ethers } = require("ethers"); const { chains, provider } = configureChains( [baseGoerli], [ alchemyProvider({ apiKey: process.env.ALCHEMY_ID }), publicProvider() ] ); const { connectors } = getDefaultWallets({ appName: 'Hello Kitty App', projectId: 'YOUR_PROJECT_ID', chains }); const wagmiClient = createClient({ autoConnect: true, connectors, provider }) export const Dapp = () => { const [manageClicked, setManageClicked] = useState(false); const [claimClicked, setClaimClicked] = useState(false); const Manage = () => { const [beneficiaryName, setBeneficiaryName] = useState(''); const [beneficiaryAddress, setBeneficiaryAddress] = useState(''); const [beneficiaryAmount, setBeneficiaryAmount] = useState(''); const handleBeneficiaryNameChange = (event) => { setBeneficiaryName(event.target.value); }; const handleBeneficiaryAddressChange = (event) => { setBeneficiaryAddress(event.target.value); }; const handleBeneficiaryAmountChange = (event) => { setBeneficiaryAmount(event.target.value); }; const createWill = async () => { // try { const provider = new ethers.providers.Web3Provider(window.ethereum) await provider.send("eth_requestAccounts", []); const signer = provider.getSigner() const legacyKeeperAddress = "0xeF35e201aaBEFe47Ff3e01c87ef6D35878588B0C" const legacyKeeper = new ethers.Contract(legacyKeeperAddress, abi, provider); const legacyKeeperWithSigner = legacyKeeper.connect(signer); await legacyKeeperWithSigner.addBeneficiary(beneficiaryName, beneficiaryAddress, beneficiaryAmount,0); // } catch (err) { // console.log(err); // } // console.log('Created will'); } return( <div> <h1 className="inheritance">Manage Inheritance</h1> <form> <label htmlFor="beneficiaryName">Beneficiary Name</label> <input type="text" id="beneficiaryName" name="beneficiaryName" value={beneficiaryName} onChange={handleBeneficiaryNameChange} /> <label htmlFor="beneficiaryAddress">Beneficiary Address</label> <input type="text" id="beneficiaryAddress" name="beneficiaryAddress" value={beneficiaryAddress} onChange={handleBeneficiaryAddressChange} /> <label htmlFor="beneficiaryAmount">Beneficiary Amount</label> <input type="text" id="beneficiaryAmount" name="beneficiaryAmount" value={beneficiaryAmount} onChange={handleBeneficiaryAmountChange} /> <button className="buttons" onClick={()=> createWill()}> Submit </button> </form> <button className="buttons" onClick={()=> setManageClicked(false)}> Back </button> </div> ) } const Claim = () => { const [inheritorAddress, setInheritorAddress] = useState(''); const handleInheritorChange = (event) => { setInheritorAddress(event.target.value); }; return( <div> <h1>Claim Inheritance</h1> <form> <label htmlFor="inheritorAddress">Inheritor Address</label> <input type="text" id="inheritorAddress" name="inheritorAddress" value={inheritorAddress} onChange={handleInheritorChange} /> <button className="buttons" onClick={()=> setInheritorAddress(false)}> Claim </button> </form> <button className="buttons" onClick={()=> setClaimClicked(false)}> Back </button> </div> ) } return( <WagmiConfig client={wagmiClient}> <RainbowKitProvider chains={chains}> <> <div className= "header"> <a href="/"> <img className="logo" src="https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/cdfe8bf57fec8a8.png"></img> </a> <div className= "title">Legacy Keeper</div> <div className="connectWallet"> <ConnectButton>Connect</ConnectButton> </div> </div> { !manageClicked && !claimClicked && <> <h1 className="testing"> TESTING TESTING</h1> <button className="buttons" onClick={()=> setManageClicked(true)}> Manage Inheritance </button> <button className="buttons" onClick={()=> setClaimClicked(true)}> Claim Inheritance </button> </> } { manageClicked && <Manage />} { claimClicked && <Claim />} </> </RainbowKitProvider> </WagmiConfig> ) }
5ef19185ffb43e9112102c99e77986df
{ "intermediate": 0.3708110749721527, "beginner": 0.4073384702205658, "expert": 0.2218504697084427 }
3,303
import requests import json import datetime import streamlit as st from itertools import zip_longest import os def basic_info(): config = dict() config["access_token"] = st.secrets["access_token"] config['instagram_account_id'] = st.secrets.get("instagram_account_id", "") config["version"] = 'v16.0' config["graph_domain"] = 'https://graph.facebook.com/' config["endpoint_base"] = config["graph_domain"] + config["version"] + '/' return config def InstaApiCall(url, params, request_type): if request_type == 'POST': req = requests.post(url, params) else: req = requests.get(url, params) res = dict() res["url"] = url res["endpoint_params"] = params res["endpoint_params_pretty"] = json.dumps(params, indent=4) res["json_data"] = json.loads(req.content) res["json_data_pretty"] = json.dumps(res["json_data"], indent=4) return res def getUserMedia(params, pagingUrl=''): Params = dict() Params['fields'] = 'id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,username,like_count,comments_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None if pagingUrl == '': url = params['endpoint_base'] + params['instagram_account_id'] + '/media' else: url = pagingUrl return InstaApiCall(url, Params, 'GET') def getUser(params): Params = dict() Params['fields'] = 'followers_count' Params['access_token'] = params['access_token'] if not params['endpoint_base']: return None url = params['endpoint_base'] + params['instagram_account_id'] return InstaApiCall(url, Params, 'GET') def saveCount(count, filename): with open(filename, 'w') as f: json.dump(count, f, indent=4) def getCount(filename): try: with open(filename, 'r') as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError): return {} st.set_page_config(layout="wide") params = basic_info() count_filename = "count.json" if not params['instagram_account_id']: st.write('.envファイルでinstagram_account_idを確認') else: response = getUserMedia(params) user_response = getUser(params) if not response or not user_response: st.write('.envファイルでaccess_tokenを確認') else: posts = response['json_data']['data'][::-1] user_data = user_response['json_data'] followers_count = user_data.get('followers_count', 0) NUM_COLUMNS = 6 MAX_WIDTH = 1000 BOX_WIDTH = int(MAX_WIDTH / NUM_COLUMNS) BOX_HEIGHT = 400 yesterday = (datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))) - datetime.timedelta(days=1)).strftime('%Y-%m-%d') follower_diff = followers_count - getCount(count_filename).get(yesterday, {}).get('followers_count', followers_count) st.markdown(f"<h4 style='font-size:1.2em;'>Follower: {followers_count} ({'+' if follower_diff >= 0 else ''}{follower_diff})</h4>", unsafe_allow_html=True) show_description = st.checkbox("キャプションを表示") posts.reverse() post_groups = [list(filter(None, group)) for group in zip_longest(*[iter(posts)] * NUM_COLUMNS)] count = getCount(count_filename) today = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d') if today not in count: count[today] = {} count[today]['followers_count'] = followers_count if datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).strftime('%H:%M') == '23:59': count[yesterday] = count[today] max_like_diff = max((post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) for post in posts), default=0) max_comment_diff = max((post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) for post in posts), default=0) for post_group in post_groups: with st.container(): columns = st.columns(NUM_COLUMNS) for i, post in enumerate(post_group): with columns[i]: st.image(post['media_url'], width=BOX_WIDTH, use_column_width=True) st.write(f"{datetime.datetime.strptime(post['timestamp'], '%Y-%m-%dT%H:%M:%S%z').astimezone(datetime.timezone(datetime.timedelta(hours=9))).strftime('%Y-%m-%d %H:%M:%S')}") like_count_diff = post['like_count'] - count.get(yesterday, {}).get(post['id'], {}).get('like_count', post['like_count']) comment_count_diff = post['comments_count'] - count.get(yesterday, {}).get(post['id'], {}).get('comments_count', post['comments_count']) st.markdown(f"👍: {post['like_count']} <span style='{'' if like_count_diff != max_like_diff else 'color:red;'}'>({'+' if like_count_diff >= 0 else ''}{like_count_diff})</span>" f"\n💬: {post['comments_count']} <span style='{'' if comment_count_diff != max_comment_diff else 'color:red;'}'>({'+' if comment_count_diff >= 0 else ''}{comment_count_diff})</span>", unsafe_allow_html=True) caption = post['caption'] if caption is not None: caption = caption.strip() if "[Description]" in caption: caption = caption.split("[Description]")[1].lstrip() if "[Tags]" in caption: caption = caption.split("[Tags]")[0].rstrip() caption = caption.replace("#", "") caption = caption.replace("[model]", "👗") caption = caption.replace("[Equip]", "📷") caption = caption.replace("[Develop]", "🖨") if show_description: st.write(caption or "No caption provided") else: st.write(caption[:0] if caption is not None and len(caption) > 50 else caption or "No caption provided") count[today][post['id']] = {'like_count': post['like_count'], 'comments_count': post['comments_count']} saveCount(count, count_filename) ''' 上記のコードを以下の要件をすべて満たして改修してください - 説明は表記せずPython用のコードのみ出力する - "いいね数"や"コメント数"の差分表示の"()"内の数字は、増加がなかったものは"赤"で表示しないよう改修する - "caption = post['caption']"以降のブロックについては改変しない
8be25b96aaa87e7f2638f4cf5a62d57a
{ "intermediate": 0.36978060007095337, "beginner": 0.47684019804000854, "expert": 0.15337920188903809 }
3,304
Найди ошибки в коде: #include <ESP8266WiFi.h> #include <ESP8266WebServer.h> // Задаем номера выводов const int flowSensorPin = D1; const int pumpPin = D2; const int valvePin = D3; const int buttonStartStopPin = D4; const int buttonPauseResumePin = D5; // Время перекачки в минутах и объем воды в литрах float timeToPump = 1.0; float volumeToPump = 3.0; unsigned long currentTime; unsigned long prevTime = 0; unsigned long pumpInterval; unsigned long prevPumpInterval; volatile unsigned int flowCount; float flowRate; float currentVolume; unsigned long startTime; boolean pumpRunning = false; boolean pumpPaused = false; // Настройки для Wi-Fi const char* ssid = "SSID"; const char* password = "PASSWORD"; // Настройки для веб сервера ESP8266WebServer server(80); void setup() { pinMode(flowSensorPin, INPUT); pinMode(pumpPin, OUTPUT); pinMode(valvePin, OUTPUT); pinMode(buttonStartStopPin, INPUT_PULLUP); pinMode(buttonPauseResumePin, INPUT_PULLUP); // Запускаем обработчик прерываний attachInterrupt(digitalPinToInterrupt(flowSensorPin), flowPulseCounter, RISING); Serial.begin(115200); delay(10); // Соединение с Wi-Fi Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); server.on("/", handleRoot); server.begin(); Serial.println("HTTP server started"); // Вычисление временного интервала запуска помпы pumpInterval = (timeToPump*60 * 1000) / volumeToPump; currentTime = millis(); prevPumpInterval = currentTime; } void loop() { // Обработка веб запросов server.handleClient(); currentTime = millis(); if((currentTime-prevPumpInterval) >= pumpInterval && pumpRunning && !pumpPaused) { prevPumpInterval = currentTime; if(currentVolume < volumeToPump) { pumpWater(); } else { stopPump(); } } // Проверка состояния кнопки старта/стопа if(digitalRead(buttonStartStopPin) == LOW) { delay(50); if(digitalRead(buttonStartStopPin) == LOW) { if(!pumpRunning) { startPump(); } else { stopPump(); } } } // Проверка состояния кнопки паузы/возобновления if(digitalRead(buttonPauseResumePin) == LOW) { delay(50); if(digitalRead(buttonPauseResumePin) == LOW) { if(!pumpPaused) { pausePump(); } else { resumePump(); } } } } // Отправка главной страницы через веб сервер void handleRoot() { String message = "<html><body>" "<h1>Система управления перекачкой воды</h1>"; if (pumpRunning){ message += "<h3>Состояние: РАБОТАЕТ</h3>"; } else { message += "<h3>Состояние: ОСТАНОВЛЕНО</h3>"; } message += "</body></html>"; server.send(200, "text/html", message); } // Функция для обработки прерывания датчика потока void ICACHE_RAM_ATTR flowPulseCounter() { flowCount++; } // Начало перекачки воды void startPump() { digitalWrite(valvePin, HIGH); delay(500); digitalWrite(pumpPin, HIGH); startTime = millis(); pumpRunning = true; } // Прекращение перекачки воды void stopPump() { digitalWrite(valvePin, LOW); delay(500); digitalWrite(pumpPin, LOW); pumpRunning = false; currentVolume = 0; flowCount = 0; } // Перекачка определенного объема воды void pumpWater() { flowRate = (flowCount / 450.0) * 60; currentVolume = flowRate / 60.0; flowCount = 0; if(currentVolume < volumeToPump) { digitalWrite(valvePin, HIGH); delay(500); digitalWrite(pumpPin, HIGH); startTime = millis(); pumpRunning = true; } else { stopPump(); } } // Приостановить перекачку воды void pausePump() { digitalWrite(pumpPin, LOW); pumpPaused = true; } // Возобновить перекачку воды void resumePump() { digitalWrite(pumpPin, HIGH); pumpPaused = false; }
58073c3e4ab664a0b89640459c1ab28e
{ "intermediate": 0.28432610630989075, "beginner": 0.4973107874393463, "expert": 0.21836309134960175 }
3,305
как исправить ошибку No error handlers are registered, logging exception. Traceback (most recent call last): File "C:\Users\123\PycharmProjects\боттелега\venv\lib\site-packages\telegram\ext\dispatcher.py", line 555, in process_update handler.handle_update(update, self, check, context) File "C:\Users\123\PycharmProjects\боттелега\venv\lib\site-packages\telegram\ext\handler.py", line 198, in handle_update return self.callback(update, context) File "C:\Users\123\PycharmProjects\боттелега\main.py", line 71, in referral add_invited_user(invitee_user_id, invited_user_name, referral_code, c) File "C:\Users\123\PycharmProjects\боттелега\main.py", line 103, in add_invited_user c.execute('UPDATE users ' sqlite3.OperationalError: near ")": syntax error в коде import os import sqlite3 from uuid import uuid4 from telegram import Update from telegram.ext import Updater, CommandHandler, CallbackContext, MessageHandler, Filters # Используйте свой токен бота, переданного вам ботом @BotFather TELEGRAM_API_TOKEN = '6143413294:AAG_0lYsev83l0FaB5rqPdpYQPsHZPLEewI' def start(update: Update, context: CallbackContext): user_id = update.effective_user.id conn = sqlite3.connect('referral_bot.db') c = conn.cursor() # Найти или создать пользователя в базе данных c.execute('INSERT OR IGNORE INTO users (id) VALUES (?)', (user_id,)) conn.commit() # Получить реферальный код и количество приглашенных пользователей c.execute('SELECT referral_code, invited_count FROM users WHERE id = ?', (user_id,)) row = c.fetchone() referral_code, invited_count = row # Если пользователь не имеет реферального кода, создать один if not referral_code: referral_code = str(uuid4())[:8] c.execute('UPDATE users SET referral_code = ? WHERE id = ?', (referral_code, user_id)) conn.commit() # Получить список имен приглашенных пользователей c.execute('SELECT invited_users FROM users WHERE id = ?', (user_id,)) row = c.fetchone() invited_names = row[0].split(',') if row[0] else [] conn.close() update.message.reply_text(f'Ваш реферальный код: {referral_code}\n' f'Количество приглашенных вами пользователей: {invited_count}\n' f'Их имена: {", ".join(invited_names)}') def referral(update: Update, context: CallbackContext): if not context.args: update.message.reply_text('Пожалуйста, используйте команду /referal с вашим реферальным кодом') return referral_code = context.args[0] invited_user_name = update.effective_user.full_name invitee_user_id = update.effective_user.id conn = sqlite3.connect('referral_bot.db') c = conn.cursor() if not check_if_code_exists(referral_code, c): update.message.reply_text('Такого реферального кода не существует') return if referral_code == get_referral_code(invitee_user_id, c): update.message.reply_text('Вы не можете использовать свой собственный реферальный код') return if check_if_already_invited(invitee_user_id, c): update.message.reply_text('Вы уже в системе рефералов') return # Добавить пользователя в реферальную систему c.execute('UPDATE users SET invited_by = ? WHERE id = ?', (get_user_id_by_referral_code(referral_code, c), invitee_user_id)) conn.commit() add_invited_user(invitee_user_id, invited_user_name, referral_code, c) conn.close() update.message.reply_text('Вы успешно присоединились к системе рефералов') def check_if_code_exists(referral_code: str, c): c.execute('SELECT * FROM users WHERE referral_code = ?', (referral_code,)) return bool(c.fetchone()) def check_if_already_invited(invitee_user_id: int, c): c.execute('SELECT * FROM users WHERE id = ? AND invited_by IS NOT NULL', (invitee_user_id,)) return bool(c.fetchone()) def get_referral_code(user_id: int, c): c.execute('SELECT referral_code FROM users WHERE id = ?', (user_id,)) row = c.fetchone() if row: return row[0] return None def get_user_id_by_referral_code(referral_code: str, c): c.execute('SELECT id FROM users WHERE referral_code = ?', (referral_code,)) return c.fetchone()[0] def add_invited_user(user_id: int, user_name: str, referral_code: str, c): inviter_user_id = get_user_id_by_referral_code(referral_code, c) c.execute('UPDATE users ' 'SET invited_count = invited_count + 1 ' ' invited_users = COALESCE(invited_users, '') || ? || ',' ' 'WHERE id = ?' (user_name, inviter_user_id)) def main(): # Создать таблицу пользователей conn = sqlite3.connect('referral_bot.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY, referral_code TEXT UNIQUE, invited_by INTEGER, invited_count INTEGER DEFAULT 0, invited_users TEXT DEFAULT '' )''') conn.commit() conn.close() updater = Updater(TELEGRAM_API_TOKEN) dispatcher = updater.dispatcher dispatcher.add_handler(CommandHandler('start', start)) dispatcher.add_handler(CommandHandler('referal', referral)) updater.start_polling() updater.idle() if 'main.py' == "main.py": main()
f108573cf32030a683e26bf485b722a5
{ "intermediate": 0.28503385186195374, "beginner": 0.5580319762229919, "expert": 0.15693417191505432 }
3,306
Write a short powershell script. Only code, no description. Enlose the code in
b054bc90883bc86e69f62645e28b302b
{ "intermediate": 0.30551519989967346, "beginner": 0.2279248982667923, "expert": 0.4665599465370178 }
3,307
Write a short powershell script in markdown
4459a2e4bb2afcf97a1228c4a2aa6234
{ "intermediate": 0.31262168288230896, "beginner": 0.3013456463813782, "expert": 0.38603267073631287 }
3,308
just all the flags buttons at the very top and initial hidden state with no any actual text shown, and after pressing on each flag, it replaces the translation variant and so on. can you do this with only css and html, without any javascripts or libraries? need to show only one translation variant at once by hidding the rest. “While it is not possible to completely achieve this without using JavaScript”. maybe you are just wrong, and it’s possible to trigger hide and show state at the same time, to hide all and display only particular, with only css and html code on page used. neagh. it shows all the translation variants at the same time, no matter what button or flag you will press. there should be some other tricky way to do this hide and show magic, using only css and html. if you could only think for a little longer on this question...: I apologize if my previous response confused you. I see now that it was a misunderstanding on my part. There is indeed a way to achieve this effect using only HTML and CSS. Please find below the updated code: <!DOCTYPE html> <html> <head> <meta charset=“UTF-8”> <title>Multilingual Page Example</title> <style> .flags-container { display: flex; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; } .flag-radio { display: none; } .flag-label { cursor: pointer; margin: 0 10px; transition: 0.3s; opacity: 0.6; font-size: 24px; } .flag-label:hover { opacity: 1; } .flag-radio:checked ~ .language-option { display: block; padding: 20px; background-color: white; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); font-size: 18px; } .language-option { display: none; } </style> </head> <body> <div class=“flags-container”> <input id=“english-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“english-flag” class=“flag-label”>🇬🇧</label> <input id=“hindi-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“hindi-flag” class=“flag-label”>🇮🇳</label> <input id=“hebrew-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“hebrew-flag” class=“flag-label”>🇮🇱</label> <input id=“chinese-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“chinese-flag” class=“flag-label”>🇨🇳</label> <input id=“french-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“french-flag” class=“flag-label”>🇫🇷</label> <input id=“spanish-flag” type=“radio” name=“flags” class=“flag-radio”> <label for=“spanish-flag” class=“flag-label”>🇪🇸</label> <div id=“english” class=“language-option”> <p>Hello! Welcome to my website.</p> <p>This is some English text. Would you like to read it in another language?</p> </div> <div id=“hindi” class=“language-option”> <p>नमस्ते! मेरी वेबसाइट पर आपका स्वागत है।</p> <p>यह कुछ हिंदी मूल लेख है। क्या आप इसे किसी अन्य भाषा में पढ़ना चाहेंगे?</p> </div> <div id=“hebrew” class=“language-option”> <p>שלום! ברוכים הבאים לאתר שלי.</p> <p>זוהי טקסט בעברית. האם תרצו לקרוא את זה בשפה אחרת?</p> </div> <div id=“chinese” class=“language-option”> <p>你好!欢迎来到我的网站。</p> <p>这是一些中文原文。您想用其他语言阅读它吗?</p> </div> <div id=“french” class=“language-option”> <p>Bonjour! Bienvenue sur mon site web.</p> <p>Ceci est un texte en français. Voulez-vous le lire dans une autre langue?</p> </div> <div id=“spanish” class=“language-option”> <p>¡Hola! Bienvenidos a mi sitio web.</p> <p>Este es un texto en español. ¿Te gustaría leerlo en otro idioma?</p> </div> <style> #english-flag:checked ~ #english, #hindi-flag:checked ~ #hindi, #hebrew-flag:checked ~ #hebrew, #chinese-flag:checked ~ #chinese, #french-flag:checked ~ #french, #spanish-flag:checked ~ #spanish { display: block; } </style> </div> </body> </html> This new version will only display one language at a time while keeping the other languages hidden, using only HTML and CSS. Please let me know if this solution meets your requirements, or if there are any further changes you’d like me to make.
d131fb38f1d530ac61d2337d64149915
{ "intermediate": 0.2603636682033539, "beginner": 0.42747506499290466, "expert": 0.31216132640838623 }
3,309
I have fixed it on my own, but it cannot swith between the languages: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Multilingual Page Example</title> <style> .flags-container { position: fixed; top: 0; left: 0; right: 0; padding: 3px 0; background-color: white; display: flex; justify-content: center; align-items: center; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); z-index: 10; } .flag-radio { display: none; } .flag-label { cursor: pointer; margin: 0 10px; transition: 0.3s; opacity: 0.6; font-size: 24px; } .flag-label:hover { opacity: 1; } .language-option { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: none; justify-content: center; align-items: center; padding-top: 50px; /* adjust based on flags container height */ } #english-flag:checked ~ #english, #hindi-flag:checked ~ #hindi, #hebrew-flag:checked ~ #hebrew, #chinese-flag:checked ~ #chinese, #french-flag:checked ~ #french, #spanish-flag:checked ~ #spanish { display: block; } </style> </head> <body> <div class="flags-container"> <input id="english-flag" type="radio" name="flags" class="flag-radio"> <label for="english-flag" class="flag-label">🇬🇧</label> <input id="hindi-flag" type="radio" name="flags" class="flag-radio"> <label for="hindi-flag" class="flag-label">🇮🇳</label> <input id="hebrew-flag" type="radio" name="flags" class="flag-radio"> <label for="hebrew-flag" class="flag-label">🇮🇱</label> <input id="chinese-flag" type="radio" name="flags" class="flag-radio"> <label for="chinese-flag" class="flag-label">🇨🇳</label> <input id="french-flag" type="radio" name="flags" class="flag-radio"> <label for="french-flag" class="flag-label">🇫🇷</label> <input id="spanish-flag" type="radio" name="flags" class="flag-radio"> <label for="spanish-flag" class="flag-label">🇪🇸</label> <div id="english" class="language-option"> <p>Hello! Welcome to my website.</p> <p>This is some English text. Would you like to read it in another language?</p> </div> <div id="hindi" class="language-option"> <p>नमस्ते! मेरी वेबसाइट पर आपका स्वागत है।</p> <p>यह कुछ हिंदी मूल लेख है। क्या आप इसे किसी अन्य भाषा में पढ़ना चाहेंगे?</p> </div> <div id="hebrew" class="language-option"> <p>שלום! ברוכים הבאים לאתר שלי.</p> <p>זוהי טקסט בעברית. האם תרצו לקרוא את זה בשפה אחרת?</p> </div> <div id="chinese" class="language-option"> <p>你好!欢迎来到我的网站。</p> <p>这是一些中文原文。您想用其他语言阅读它吗?</p> </div> <div id="french" class="language-option"> <p>Bonjour! Bienvenue sur mon site web.</p> <p>Ceci est un texte en français. Voulez-vous le lire dans une autre langue?</p> </div> <div id="spanish" class="language-option"> <p>¡Hola! Bienvenidos a mi sitio web.</p> <p>Este es un texto en español. ¿Te gustaría leerlo en otro idioma?</p> </div> </div> </body> </html>
e03a6ebb2cc06a2cb9a0749ca05c8d3a
{ "intermediate": 0.27938637137413025, "beginner": 0.47982603311538696, "expert": 0.240787535905838 }
3,310
give me a q learning based drone swarming code
312e1ee33f08c92d432e251eb5b01be1
{ "intermediate": 0.14683520793914795, "beginner": 0.1384066641330719, "expert": 0.7147580981254578 }
3,311
create minion card class for Hearthstone Javascript (2 attack and 2 health)
95bcf7917f5769b311d9dccac0f5f1d6
{ "intermediate": 0.24997594952583313, "beginner": 0.5198662877082825, "expert": 0.23015770316123962 }
3,312
i would like to create a discord app that can conect to my server via ftp and be able to change / add files to my server how do i go about setting something up
fc457349783c265b107602e6fc55e323
{ "intermediate": 0.5465222597122192, "beginner": 0.2187725156545639, "expert": 0.23470523953437805 }
3,313
Write mechanic code for Hearthstone in Javascript
6e48e78b61cb75cddd3b2a6001a0c89c
{ "intermediate": 0.28379639983177185, "beginner": 0.43964093923568726, "expert": 0.2765626311302185 }