Random snippets of all sorts of code, mixed with a selection of help and advice.
My AI code passed all tests—then pinned my CPU at 100% [closed]
21 May 2026 @ 10:26 am
I recently used an AI assistant to write a function. The source code looked perfectly clean and passed all my unit tests. But the moment it was deployed, it spiked my CPU to 100%.
The issue: AI models are great with syntax, but they are hardware-blind. They don't understand how the compiler translates code into binary/assembly, leading to unexpected cache misses and instruction bloat on the actual silicon.
Looking for guidance: How do we catch these hardware-level regressions in CI/CD before deploying? Does anyone know of a tool or workflow—perhaps something that analyzes compiled binaries or uses an assembly-aware model—to flag these performance issues?
Would love some pointers if you've solved this!
Laravel strict type validation on query parameters
21 May 2026 @ 10:18 am
So i'm working on a Laravel application, which uses query parameters (GET parameters) to communicate from front to back. To validate these parameters, I extented the FormRequest class:
class CommunityRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'radius' => ['sometimes', 'nullable', 'integer:strict', 'min:1'],
];
}
}
As indicated, the radius parameter can be omitted or nullable, but must be an integer when present.
The :strict flag allows the query to only pass validation when the parameters is of the given type and not, for example, the string value of an int (ie radius='15' does not pass validation).
To get the validated value of that parameter, i do as follows :
class Communi
Child component triggers after another stage ends
21 May 2026 @ 10:18 am
I develop a GitLab pipeline with few stages.
One of the stages include and trigger 2 child components to perform secrets and vulnerabilities scan of the merge request.
Another stage include 1 job to build.
Currently, the 2 scans start only when the build job ends and it is wrong because the scans don't need to wait, I would like them to run in parallel to reduce the time needed by the pipeline and make it faster.
Below is my current pipeline:
stages:
- build
- scans
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
include:
- component: ******/secrets-scan@~latest
inputs:
allow_failure: true
stage: scans
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- component: ******n/vulnerabilities-scan@~latest
inputs:
allow_failure: true
stage: scans
verbose: true
rules:
- if: $CI_PIPELINE_SOURCE == &quo
I am facing Axios Error : Request failed with status code 403 in streamlit in snowflake file_uploader functionality [closed]
21 May 2026 @ 10:09 am
I am able to upload csv file and it works properly but not able to upload excel file in streamlit file_uploader functionality in snowflake. how can I solve this issues in streamlit in snowflake
Axios Error : Request failed with status code 403
Unity is giving the error in console when I try to click transisition in animator
21 May 2026 @ 10:09 am
I am facing a very strange issue in unity animator.
I have create animations for a 3rd person controller.
But on one animation "crouch walk" the behaviouse is not understanable.
Its about "loop time" checked or unchecked. in both cases the animation worked fine.
but when "loop time" is checked and I try to click on transition in animator it does'not show any paramters (which I created earlies : eg: crouch bool for crouching).
and in inspecter it gives the error below:
[14:53:35] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
PS. I have tried changing the animation clip but nothing helps, also it does matter if the clip is attached in animator or not , the moment I check the
How to correctly set base_url for QuickSilver Pro with OpenAI SDK in Python?
21 May 2026 @ 10:05 am
I am a beginner and trying to use QuickSilver Pro with Python.
I have an API key from QuickSilver Pro, but I don't know how to correctly set the base_url.
What I want to do:
I want to call models like DeepSeek V4 or Qwen using the official OpenAI Python library.
What I tried:I created an OpenAI client and put my QuickSilver API key and the base_url "https://quicksilverpro.io/v1".
But when I try to send a message, it shows an error.
Problem:The connection is not working. I don't know if the base_url is wrong or if there is something else I need to set.
Questions:
What is the correct base_url for QuickSilver Pro?
Is there anything else I need to set besides the api_key and base_url?
Can you explain in simple words how to make it work?
I don't understand code very well, so please explain step
Laravel php artisan migrate:fresh --seed fails with Class "PublisherController" does not exist even though the controller exists
21 May 2026 @ 9:21 am
I started a new Laravel project and created my workspace using:
laravel new project-name
Then I generated my models with:
php artisan make:model Publisher --all
php artisan make:model Game --all
After that, I installed the API support using:
php artisan install:api
Everything seemed fine at first, but when I ran:
php artisan migrate:fresh --seed
I received this error:
Class "PublisherController" does not exist
What is strange is that the controller file does exist, I can open it, and I already modified it.
The same error also appears when running:
php artisan route:list
I only included the parts of the code that I changed from the default Laravel workspace.
Routes (api.php)
Route::resource('/publishers', \App\Http\Controllers\PublisherContro
If statement on itertools groupby object in a list comprehension always False
21 May 2026 @ 8:59 am
I got a list of files that has the following structures :
[output-input]_[A-Z]_foo_bar_[0-n].pkl with n varying
file_list = [
'output_A_foo_bar_0.pkl',
'output_A_foo_bar_1.pkl',
'output_A_foo_bar_2.pkl',
'output_A_foo_bar_3.pkl',
'output_B_foo_bar_0.pkl',
'output_B_foo_bar_1.pkl',
'output_B_foo_bar_2.pkl',
'output_B_foo_bar_3.pkl',
'output_G_foo_bar_1.pkl',
'output_H_foo_bar_0.pkl',
'output_H_foo_bar_1.pkl',
'input_A_foo_bar_0.pkl',
'input_H_foo_bar_0.pkl',
'input_H_foo_bar_1.pkl',
'input_H_foo_bar_2.pkl',
'input_H_foo_bar_3.pkl']
What I want :
[['output_A_foo_bar_0.pkl',
'output_A_foo_bar_1.pkl',
'output_A_foo_bar_2.pkl',
'output_A_foo_bar_3.pkl',],
['output_B_foo_bar_0.pkl',
'output_B_foo_bar_1.pkl',
'output_B_foo_bar_2.pkl',
'output_B_foo_bar_3.pkl']
]
I tried this :
Could this seemingly practical `requires` C++20 form of disambiguation of base method ever work in the future?
21 May 2026 @ 8:54 am
This is more a question of opinion, targeted mainly at C++20 language lawyers and compiler backend engineers. It probably has a lot to with the specific compiler implementations, and the hurdles they would impose on achieving this? It is about whether such pattern has been attempted before, proposed before, and so on. I'm not very familiar of who and how to approach this, so I'm starting off here for general advice.
Some context: I'm trying to create statically composable templated containers through template metaprogramming and requires.
Here's what I tried to do:
template<int ID>
struct A {
template<int SELECTOR = ID> requires (SELECTOR == ID)
auto Get() { /*implementation*/ }
};
template<int ID>
struct B {
template<int SELECTOR = ID> requires (SELECTOR == ID)
auto Get() { /*implementation*/ }
};
struct C {
// A base may or may not have a 'Get' method
};
struct
How to pass generated (with foreach) inputs into controller?
21 May 2026 @ 4:15 am
I have a test consisting of a list of questions stored in a database. I do not know in advance how many questions there are, but the test submission should be accepted only if the user has provided an answer for every question (much like in Google Forms).
According to the technical specifications, I am required to use radio buttons for selecting answers. Unfortunately, I am not very experienced with ASP.NET Core MVC, and I am struggling to visualize how the model should be structured so that when the "Submit" button is clicked, I can successfully retrieve all the RadioButton groups within the Vote action of my controller.
I try generate form (radio buttons group) with this view:
@{
string title = "Тест";
ViewBag.Title = title;
IEnumerable<Question>? questions = ViewBag.Questions;
IEnumerable<Answer>? answers = ViewBag.Answers;
}
<form class="m-5" asp-area="" asp-cont