StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

FFmpeg/React video editor renders successfully but ignores object recolor and color grading

14 May 2026 @ 8:22 pm

I built a custom AI video editing app using: - React - TypeScript - Vite - FFmpeg - SAM2 segmentation/tracking - Replicate API Problem: The app successfully renders/export videos, but object recolor and cinematic color grading are ignored in the final export. What works: - UI updates - object selection works - render pipeline starts - export completes - masks/tracking appear connected What fails: - final exported video keeps original colors - targeted object recolor does not appear - FFmpeg render finishes but output video looks unchanged Current suspicion: The edited frames or FFmpeg filter chain are being bypassed before final encode/export, and the pipeline may still be exporting the original source video. I need help tracing: - frontend state to backend render - FFmpeg filter chain - compositing path - wher

PHP Session Variable Gets Reset After Redirecting to Dashboard

14 May 2026 @ 8:15 pm

I’m currently building a simple login system in PHP using sessions. The login form works correctly and validates the username/password from my database, but after redirecting to the dashboard page, the session variable becomes empty again. Here is my login code: <?php session_start(); include 'db.php'; if(isset($_POST['login'])) { $username = $_POST['username']; $password = $_POST['password']; $query = mysqli_query($conn, "SELECT * FROM users WHERE username='$username' AND password='$password'"); if(mysqli_num_rows($query) > 0) { $_SESSION['username'] = $username; header("Location: dashboard.php"); } else { echo "Invalid username or password"; } } ?> And this is my dashboard.php: <?php echo "Welcome " . $_SESSION['username']; ?> The problem is that sometimes it says:

Coldfusion CFMail is seeming to send 3 or even 4 emails during one process

14 May 2026 @ 8:15 pm

My CFmail script is seeming to send sometimes 2,3 or even 4 emails in a single run and I cannot figure it out. I have the script count through and only do 50 emails at a time to prevent it locking up. I have these emails going out through SendGrid everything else works perfect. This also was not an issue last year and my code did not change. I only do this for a charity and I dont really do much more website stuff so my coding might be going out of date. Here is my code below. <cfparam name="URL.EmailCounter" default="0"> <cfset z = #URL.EmailCounter# + 50> <cfset y = #URL.EmailCounter# + 1> <cfquery name="Soldtickets" datasource="Raffle"> SELECT ru.*, coalesce(st.tickets, 0) As Tickets FROM RegisteredUser ru LEFT JOIN ( SELECT PlayerID, SUM(Qty) As Tickets FROM StripeImport GROUP BY PlayerID ) st ON st.PlayerID = ru.Identifier where pk between '#y#' and '#z#' </cfquery> <cfset i= #U

Is there a cleaner way to share filters and validation rules between reports() and exportCsv() in Laravel?

14 May 2026 @ 8:13 pm

I have this BookController in my Laravel app: My main concerns: The reports() and exportCsv() methods have identical filtering logic copied and pasted. If I need to add a new filter (like by author or year range), I have to update both places. What's the Laravel way to DRY this up? The validation rules in store() and update() are mostly the same except for the unique:books rule needing the ID for updates. Should I extract this to a FormRequest class? If so, how do I handle the dynamic unique rule that changes between store and update? I'm using Book::CATEGORIES and Book::STATUSES in multiple places. Is there a better place to define these so my controller isn't so tightly coupled to the model constants? The exportCsv() method feels very long. Is there a more Laravel-idiomatic way to handle CSV exports? I've heard of Laravel Excel but don't want to add a package for just this one feature. Also, is it okay that index() uses paginate(10)

Why is git hanging when a push appears nearly done?

14 May 2026 @ 8:03 pm

I'm not sure whether this is an appropriate place to ask this. Please feel free to redirect me if it's not. I'm trying to push a few commits to a remote Gitlab repository that I use all the time. But since yesterday my attempts to push have been stalling. Here's what it looks like in my terminal. % git push origin main Enumerating objects: 27, done. Counting objects: 100% (27/27), done. Delta compression using up to 12 threads Compressing objects: 100% (22/22), done. Writing objects: 100% (22/22), 845.47 KiB | 5.91 MiB/s, done. Total 22 (delta 17), reused 0 (delta 0), pack-reused 0 (from 0) Based on Writing objects: 100% I believe that this is not a problem with connection or authentication with the remote. I can leave the terminal in this state for a long time and it never returns to a command prompt. If I terminate the process with command-c, then I am returned to a command prompt as expected, but the remote shows that the push n

Icons inside Excel Text

14 May 2026 @ 7:54 pm

I have an Excel file created by AI with some fancy emojis inside the cell text. I would like to see available emojis like that to use manually in other cells, I tried in "insert symbol" option but it seems they are not there. Also tried the "insert icons" but in that case the images are inserted on top of cells. One interesting thing is if I check the code of that emoji (with "=code(...)") the result is always 63 How can I insert this type of emojis manually in Excel cells? Emojis in Excel cells

Context menu for TortoiseGit does not appear at all, TortoiseHG context menu does on Windows 10

14 May 2026 @ 7:51 pm

Right-Clicking on a git repo dir does not show the TortoiseGit context menu, even though the TortoiseGit overlays are visible. The TortoiseHG cotext menu does appear, even though dirs are git repos, not mercurial ones. I tried reinstalling TortoiseGit, and I tried re-running the fisrt-start dialog, they made no difference. I suspect something is corrupted.

Why does importing package module #2 from package module #1 import all attributes of module #2 in the namespace?

14 May 2026 @ 7:34 pm

Consider a folder containing a simple python package: python ├── main.ipynb ├── package │   ├── __init__.py │   ├── function.py │   └── operations.py ├── pyproject.toml ├── README.md └── uv.lock where the modules in the package are # function.py from package.operations import my_add, my_multiply def my_function(alpha, beta, x, y): return my_add(my_multiply(alpha, x), my_multiply(beta, y)) and # operations.py def my_add(x, y): return x + y def my_multiply(x, y): return x * y From main.ipynb, I run the import command from package.function import my_function, my_add This works, and both my_function and my_add are loaded into the namespace

Do i need to create a separate factory class if I'm using HasFactory in my Laravel Model?

14 May 2026 @ 7:32 pm

I am using laravel 10 and have this book model. <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Book extends Model { use HasFactory; // Enum constants const CATEGORIES = \['Fiction', 'Non-Fiction', 'Science', 'History', 'Technology'\]; const STATUSES = \['Available', 'Borrowed', 'Damaged', 'Lost'\]; protected $table = 'books'; protected $fillable = \[ 'user_id', 'title', 'author', 'isbn', 'category', 'quantity', 'shelf_location', 'status', 'published_year', \]; protected $casts = \[ 'quantity' =\> 'integer', 'published_year' =\> 'integer', \]; // Relationship with User public function user() { return $this-\>belongsTo(User::class); } // Scopes for filtering public function scopeAvailable($query) { return $query-\>where('status', 'Available')-\>w

What is the cleanest way to structure a Resource Controller and Web Routes for a basic CRUD module in Laravel?

14 May 2026 @ 7:24 pm

I have an Item model set up, and now I need to create the controller logic to list the items, show a creation form, save the data, edit, and delete them. Right now, my web.php is getting really cluttered with Route::get, Route::post, Route::delete, etc. I know Laravel has resource controllers, but I'm getting a bit lost on how exactly the controller methods (index, create, store, edit, update, destroy) should look, especially regarding validation and redirecting back to the index page. Can someone show me a clean example of an ItemController and how to register it inside an auth middleware group in the routes file?