faraweilyas's avatar

faraweilyas liked a comment+100 XP

2d ago

The Docker Tutorial: Ep 8, Packaging for Distribution

Just some friendly feedback. First i do like the presentation, great voice and its very obvious you know your stuff. This series however felt rushed and seems to be more of an overview rather than a how to. I felt like i was just copying code as opposed to learning. It at times felt like how fast can i type this out. I think providing some source code so that one can focus on what is being done and slowly explain what is being done at all steps. You did do this for some things not all. Coming from WIndows this hour long course took me 4 or 5, sometimes cause of a typo other times just trying to figure out what was being done.

This is a learning platform and i dont think I personally reach the full potential that was expected. As an example after watching a laravel from scratch i feel like i can go out and make a website without having to refer too much to resources, however i feel that if i tried to set up a docker environment Id be back and forth and feel like id need to look something up at every strep.

I saw in some comments that Andrew is a great instructor and i see that. I feel if i had some more knowledge going in i would have taken alot more from it and with that ill be looking into more of Andrews teachings.

faraweilyas's avatar

faraweilyas liked a comment+100 XP

2d ago

The Docker Tutorial: Ep 8, Packaging for Distribution

@BrickZ28 I agree. While the description for this series mentions that it is from a beginner’s perspective it definitely requires some beginner docker knowledge. I would suggest adding that as a prerequisite. This will help people avoid frustration and get the most out of this. Personally I quickly skimmed this, saw that it was a bit too advanced and watched a 3hr beginner docker course first that went over the core concepts. This series then made a lot more sense afterwards. But that’s just the docker part. People would also benefit from some experience with Linux , dev ops and running a web server.

faraweilyas's avatar

faraweilyas liked a comment+100 XP

2d ago

The Docker Tutorial: Ep 2, Create a Simple Dockerfile

If you don't see any output with docker images then try docker images -a

This showed me the untagged image from the initial example. Alternatively you can use Docker Desktop which shows all images by default.

faraweilyas's avatar

faraweilyas liked a comment+100 XP

1mo ago

Jeremy's Larabits: Ep 3, How to Bulk Insert Data

Thank you very much @jwmcpeak

I think importing data into tables is important and is found in almost every system today.

Maybe you should create a unique course for importing data

There are many points to touch on:

  • insert/update
  • Data validation
  • jobs/batches
  • queues
  • Displaying the status to the front side
  • Display the errors for each row
  • Download a file with the errors
faraweilyas's avatar

faraweilyas liked a comment+100 XP

1mo ago

Jeremy's Larabits: Ep 3, How to Bulk Insert Data

@gocanto You're right; I should've mentioned something about the dangers of disabling indexes and keys.

With saying that, however, anyone given a task such as this should do their due diligence on the data before any code is written, and definitely before any data is imported into the database. That would've been important to say and underscore in the video.

faraweilyas's avatar

faraweilyas liked a comment+100 XP

1mo ago

Jeremy's Larabits: Ep 3, How to Bulk Insert Data

@jwmcpeak I Agree with you, but I would argue this is a learning platform. Nonetheless, I enjoy your videos :)

faraweilyas's avatar

faraweilyas liked a comment+100 XP

1mo ago

Jeremy's Larabits: Ep 3, How to Bulk Insert Data

@gocanto And you would be correct to argue that. Good point =)

faraweilyas's avatar

faraweilyas liked a comment+100 XP

1mo ago

config() helper in bootstrap/app.php

Use booted().

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })
    ->booted(function (Application $app) {
        EncryptCookies::except(config('...'));
    })->create();
faraweilyas's avatar

faraweilyas wrote a comment+100 XP

3mos ago

Debugging Real-World Production Nightmares: Ep 4, Atomic or Die (Or At Least Oversell)

This can be improved to bring down queries count:

// phase 3
foreach ($orderItems as $item) {
    OrderItem::create([
        'order_id' => $order->id,
        'product_id' => $item['product']->id,
        'quantity' => $item['quantity'],
        'price' => $item['price'],
        'subtotal' => $item['subtotal'],
    ]);

    $item['product']->decrement('stock_quantity', $item['quantity']);

    // ...
}

Single query to create order line items:

$orderLineItems = collect($orderItems)->map(fn ($item) => [
    'order_id' => $order->id,
    'product_id' => $item['product']->id,
    'quantity' => $item['quantity'],
    'price' => $item['price'],
    'subtotal' => $item['subtotal'],
]);

OrderItem::fillAndInsert($orderLineItems->toArray());

// can still be improved further by building an array of data we want to update first, then run a single mass update query
collect($orderItems)->each(fn ($item) => $item['product']->decrement('stock_quantity', $item['quantity']));

//...
faraweilyas's avatar

faraweilyas liked a comment+100 XP

3mos ago

Debugging Real-World Production Nightmares: Ep 4, Atomic or Die (Or At Least Oversell)

Nice reminder about handling race conditions.

Just a small suggestion regarding this statement:

$product = Product::where('id', $item->product_id)
    ->lockForUpdate()
	->first();

That can be a bit simpler with whereKey:

$product = Product::whereKey($item->product_id)
    ->lockForUpdate()
	->first();
faraweilyas's avatar

faraweilyas wrote a comment+100 XP

4mos ago

Everything New in Livewire 4: Ep 15, Named Islands

This super powerful!

I have a suggestion though, this could be syntactic sugar....

we could have namespaced islands like so, using dot notation

@island(name: 'metrics.views-card')
    <div class="metrics-card">
        .....
    </div>
@endisland

@island(name: 'metrics.visitors-card')
    <div class="metrics-card">
        .....
    </div>
@endisland

Outside the islands

<!-- Target all islands -->
<button wire:click="refresh" wire:island="metrics.*">
  Refresh All Metrics
</button>

<!-- Target dedicated islands -->
<button wire:click="refresh" wire:island="metrics.views-card">
  Refresh views-card
</button>

<button wire:click="refresh" wire:island="metrics.visitors-card">
  Refresh visitors-card
</button>
faraweilyas's avatar

faraweilyas liked a comment+100 XP

4mos ago

faraweilyas's avatar

faraweilyas wrote a comment+100 XP

5mos ago

Laravel Queue Mastery: Ep 10, Scaling Workers

Hello,

as referenced in the laravel docs, i think you might have the values swapped around at 10:00

'balanceMaxShift' => 3,
'balanceCooldown' => 1,

laravel docs: https://laravel.com/docs/12.x/horizon#balancing-strategies

'balanceMaxShift' => 1,
'balanceCooldown' => 3,