On this day: 9 February

2025 · 1 year ago

Listened to 3 tracks

Eminem, My Chemical Romance, Tool · 6m ·

Tracklist
  1. Bagpipes from Baghdad · Eminem
  2. To the End · My Chemical Romance
  3. Stinkfist · Tool

Listened to 10 tracks

Quiet Riot, Boney M., Tenacious D and 7 more · 45m ·

Tracklist
  1. Love's A Bitch · Quiet Riot
  2. Rasputin · Boney M.
  3. Kickapoo · Tenacious D
  4. Numb · Linkin Park
  5. Creatures That Kissed in Cold Mirrors · Cradle of Filth
  6. Venice · Royal Philharmonic Orchestra
  7. RESIST AND DISORDER · Rezodrone & The Cartesian Duelists
  8. Song For The Dead · Queens of the Stone Age
  9. Paranoid (2009 Remaster) · Black Sabbath
  10. Even Flow · Pearl Jam

2024 · 2 years ago

Listened to 13 tracks

Boney M., Pantera, Midnight Oil and 10 more · 57m ·

Tracklist
  1. Rasputin · Boney M.
  2. Cemetery Gates · Pantera
  3. The Dead Heart (2007 Remastered) · Midnight Oil
  4. Great Southern Land · Icehouse
  5. London Girls · Chas 'n' Dave
  6. Thelma Plum - Gold ('Like A Version' Chet Faker Cover) · Backward Misery
  7. Devils Be Damned · Mushroomhead
  8. Baby Come Back · Player
  9. Sober · Tool
  10. Man of War · Radiohead
  11. Sex Metal Barbie · In This Moment
  12. Are You Dead Yet? · Children of Bodom
  13. In the Eye of the Storm · Arch Enemy

Listened to 6 tracks

Blue Öyster Cult, The Romantics, Tom Petty and 3 more · 22m ·

Tracklist
  1. Burnin' for You · Blue Öyster Cult
  2. Talking in Your Sleep · The Romantics
  3. Love Is A Long Road · Tom Petty
  4. Love & Meth · Korn
  5. Reload That: Reloaded (feat. Milli Major, Tempa T, Big Narstie & Example) · Jaguar Skills
  6. Wasted Years · Iron Maiden

2023 · 3 years ago

Inventory app — saving inventory items.

This is the absolute bare bones minimum implementation for my inventory keeping: saving items to my inventory list. Super simple, but meant only as an example of how I’d work when working on an API. Here are the changes made to my Inventory Manager. Those changes include the test and logic for the initial index

This is the absolute bare bones minimum implementation for my inventory keeping: saving items to my inventory list.

Super simple, but meant only as an example of how I’d work when working on an API.

Here are the changes made to my Inventory Manager. Those changes include the test and logic for the initial index endpoint too. I may blog about that part in a separate post soon.

Writing the store test

One of Laravel’s many strengths is how well it is set up for testing and just how nice those tests can read. Especially now that I’ve started using Pest.

Here is the test I wrote for the store endpoint I was yet to write:

test('inventory items can be created', function () {
    $response = $this->postJson(route(name: 'inventory.store'), [
        'name' => 'My Special Item',
    ]);

    $response->assertStatus(201);

    $this->assertDatabaseHas(Inventory::class, [
        'name' => 'My Special Item',
    ]);
});

Firstly I post to an endpoint, that I am yet to create, with the most minimal payload I want: an item’s name:

$response = $this->postJson(route(name: 'inventory.store'), [
    'name' => 'My Special Item',
]);

Then I can check I have the correct status code: an HTTP Created 201 status:

$response->assertStatus(201);

Finally I check that the database table where I will be saving my inventory items has the item I have created in the test:

$this->assertDatabaseHas(Inventory::class, [
    'name' => 'My Special Item',
]);

The first argument to the assertDatabaseHas method is the model class, which Laravel will use to determine the name of the table for that model. Either by convention, or by the value you override it with on the model.

The second argument is an array that should match the table’s column name and value. Your model can have other columns and still pass. It will only validate that the keys and values you pass to it are correct; you don’t need to pass every column and value — that would become tedious.

Writing the store logic

There is a term I’ve heard in Test-driven development called “sliming it out”. If I remember correctly, this is when you let the test feedback errors dictate every single piece of code you add.

You wouldn’t add any code at all until a test basically told you too.

I wont lie – I actually love this idea, but it soon becomes tiresome. It’s great to do when you start out in TDD, in my opinion, but soon you’ll start seeing things you can add before running the test.

For example, you know you’ll need a database table and a model class, and most likely a Model Factory for upcoming tests, so you could run the artisan command to generate those straight away:

php artisan make:model -mf Inventory

# or with sail
./vendor/bin/sail artisan make:model -mf Inventory

I dont tend to generate my Controller classes with these, as I now use single-action controllers for personal projects.

Store Route

Within the routes/web.php file, I add the following:

use App\Http\Controllers\Inventory\StoreController;

Route::post('inventory', StoreController::class)->name('inventory.store');

Using a single-action class here to keep logic separated. Some would see this as over-engineering, especially if keeping controller code to a minimum anyway, but I like the separation.

Adding an explicit “name” to the endpoint, means I can just refer to it throughout the app with that name. Like in the test code above where I generate the endpoint with the “route” helper function:

route(name: 'inventory.store')

Store Controller

<?php

declare(strict_types = 1);

namespace App\Http\Controllers\Inventory;

use App\Http\Requests\InventoryStoreRequest;
use App\Models\Inventory;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Response;

class StoreController
{
    public function __invoke(InventoryStoreRequest $request): Response|ResponseFactory
    {
        Inventory::create([
            'name' => $request->get(key: 'name'),
        ]);

        return response(content: 'Inventory item created', status: 201);
    }
}

Super straight forward at the moment. After receiving the request via the custom request class (code below), I just create an inventory item with the name on the request.

I then return a response with a message and an HTTP Created 201 status.

This code does assume that it was created fine so I might look at a better implementation of this down the line…

…but not before I have a test telling me it needs to change.

InventoryStoreRequest class

This is a standard generated request class with the following rules method:

/**
 * Get the validation rules that apply to the request.
 *
 * @return array<string, mixed>
 */
public function rules(): array
{
    return [
        'name' => 'required',
    ];
}

Again, nothing much to it. It makes sure that a name is required to be passed.

Its not saying anything about what that value could be. We could pass a date time or a mentally-long string.

I’ll fix that in a future post.

An extra test for the required name

In order to be “belt and braces”, I have also added a test that proves that we require a name to be passed. Pest makes this laughable simple:

test('inventory items require a name', function () {
    $this->postJson(route(name: 'inventory.store'))
        ->assertJsonValidationErrorFor('name');
});

This just performs a post request to the store endpoint, but passes no data. We then just chain the assertJsonValidationErrorFor method, giving it the parameter that should have caused the failed validation. In this case “name”.

As the validation becomes more sophisticated I will look at adding more of these tests, and even possibly running all “required” fields through the some test method with Pests data functionality. Essentially the same as how PHPUnit’s Data Providers work.

Useful Links

Complete changes in git for when I added the store and the index endpoints to my Inventory app.

2020 · 6 years ago

Listened to 15 Insane Horror Games On The PS4 You Absolutely Need To Play by GamingBolt

Earned 1 trophy in Everybody's Gone To The Rapture

1 bronze ·

Trophies
  • Passive Observer

Listened to 2 tracks

Thomas Brush, I'm not Norm · 14m ·

Tracklist
  1. 5 Steps To Start Making Games · Thomas Brush
  2. Norm Macdonald's Welding Joke · I'm not Norm

Earned 1 trophy in Everybody's Gone To The Rapture

1 gold ·

Trophies
  • The End

2019 · 7 years ago

Earned 1 trophy in RESIDENT EVIL 2

1 bronze ·

Trophies
  • Like Skeet Shooting

Earned 2 trophies in RESIDENT EVIL 2

2 silver ·

Trophies
  • A Heroine Emerges
  • Broken Umbrella

2018 · 8 years ago

Listened to 8 tracks

The National, Kano, The War on Drugs and 1 more · 32m ·

Tracklist
  1. Wasp Nest · The National
  2. All the Wine · The National
  3. All Dolled-Up in Straps · The National
  4. Cherry Tree · The National
  5. GarageSkankFREESTYLE [Bonus Track] · Kano
  6. Red Eyes · The War on Drugs
  7. Flow of the Year (feat. JME) [Bonus Track] · Kano
  8. The Shape · Slipknot

Playing the first Uncharted game on PS4. I’m enjoying everything about it except for the combat. I realise it’s an old game and isn’t representative of how awesome Naughty Dog are now. Just getting bit grindy at times. Looks beautiful too.

Listened to 11 tracks

Muse, Anna Netrebko, Future Islands and 3 more · 43m ·

Tracklist
  1. I Am Hated · Slipknot
  2. Dead Inside · Muse
  3. Psycho · Muse
  4. Mercy · Muse
  5. God Help the Outcasts (from "The Hunchback of Notre Dame") · Favorite Movie Songs
  6. Puccini: Gianni Schicchi - O Mio Babbino Caro · Anna Netrebko
  7. Verdi: La traviata / Act 1 - "Libiamo ne'lieti calici" · Anna Netrebko
  8. Dvorák: Rusalka, Op.114, B.203 / Act 1 - Mesicku na nebi hlubokém · Anna Netrebko
  9. Tacky · "Weird Al" Yankovic
  10. Seasons · Future Islands
  11. Full Performance (Live on KEXP) · Future Islands

Listened to 10 tracks

Buckethead, R. Kelly, Chet Faker and 6 more · 1h 5m ·

Tracklist
  1. Real Talk · R. Kelly
  2. Gold · Chet Faker
  3. Drop the Game · Flume & Chet Faker
  4. Courtney Barnett · Pedestrian At Best
  5. Stephen Merchant's Best Man Speech · I Give It a Year
  6. Avant Gardener · Courtney Barnett
  7. Equality Street · Brent and Johnson
  8. Lady Gypsy · David Brent
  9. Soothsayer/Meta-Matic(A+! 4KFront Row) 2016-Lincoln Theater 5/13/2016 · Buckethead
  10. Smooth Criminal and Star Wars - Governors Island, NYC - 9/26/09 · Buckethead

Listened to OutRun by Kavinsky

8 listens · 22m ·

Tracklist
  1. Prelude · Kavinsky
  2. Prelude · Kavinsky
  3. Blizzard · Kavinsky
  4. Protovision · Kavinsky
  5. Odd Look · Kavinsky
  6. Rampage · Kavinsky
  7. First Blood · Kavinsky
  8. First Blood · Kavinsky

Listened to Anna Netrebko

3 listens · 7m ·

Tracklist
  1. Puccini: Gianni Schicchi - O Mio Babbino Caro · Anna Netrebko
  2. Verdi: La traviata / Act 1 - "Libiamo ne'lieti calici" · Anna Netrebko
  3. Dvorák: Rusalka, Op.114, B.203 / Act 1 - Mesicku na nebi hlubokém · Anna Netrebko

Listened to Alligator by The National

20 listens · 1h 25m ·

Tracklist
  1. Secret Meeting · The National
  2. Karen · The National
  3. Lit Up · The National
  4. Looking for Astronauts · The National
  5. Daughters of the Soho Riots · The National
  6. Baby, We'll Be Fine · The National
  7. Friend of Mine · The National
  8. Val Jester · The National
  9. All the Wine · The National
  10. Abel · The National
  11. The Geese of Beverly Road · The National
  12. City Middle · The National
  13. Mr. November · The National
  14. Prelude · Kavinsky
  15. Blizzard · Kavinsky
  16. Protovision · Kavinsky
  17. Odd Look · Kavinsky
  18. Rampage · Kavinsky
  19. Suburbia · Kavinsky
  20. Testarossa Autodrive · Kavinsky

2017 · 9 years ago

Listened to 16 tracks

Tove Lo, Slipknot, Say Lou Lou and 2 more · 55m ·

Tracklist
  1. That Girl · Tegan and Sara
  2. Vermilion · Slipknot
  3. Pulse of the Maggots · Slipknot
  4. Before I Forget · Slipknot
  5. Love Is the Loneliest Place (Bonus Track) · Say Lou Lou
  6. Electrify (Bonus Track) · Say Lou Lou
  7. Edge of the Blade · Epica
  8. Never Enough · Epica
  9. Fairy Dust (Chapter I) · Tove Lo
  10. Influence (feat. Wiz Khalifa) · Tove Lo
  11. Lady Wood · Tove Lo
  12. True Disaster · Tove Lo
  13. Cool Girl · Tove Lo
  14. Fire Fade (Chapter II) · Tove Lo
  15. Don’t Talk About It · Tove Lo
  16. Imaginary Friend · Tove Lo

Listened to 6 tracks

Epica, Slipknot · 49m ·

Tracklist
  1. Edge of the Blade · Epica
  2. Beyond the Matrix · Epica
  3. Once Upon a Nightmare · Epica
  4. XIX · Slipknot
  5. Sarcastrophe · Slipknot
  6. AOV · Slipknot

Listened to 5 tracks

Tove Lo, JME, STORMZY [@STORMZY1] and 2 more · 19m ·

Tracklist
  1. True Disaster (Part of Fairy Dust) · Tove Lo
  2. Integrity · JME
  3. BIG FOR YOUR BOOTS · STORMZY [@STORMZY1]
  4. Brotherhood · Stormzy
  5. That's Not Me (All-Star Remix) Live On Toddla T · Skepta

Listened to 4 tracks

Lady Leshurr, Meat Loaf, Shogun · 15m ·

Tracklist
  1. Wasted Youth & Everything Louder Than Everything Else · Meat Loaf
  2. #UNLESHED 2 · Lady Leshurr
  3. #UNLESHED (Panda Freestyle) · Lady Leshurr
  4. VULCAN · Shogun

Listened to Black Mirror - Nosedive (Music From The Original TV Series) by Max Richter

11 listens · 58m ·

Tracklist
  1. Been There Lately · Slash's Snakepit
  2. Just Like Anything · Slash's Snakepit
  3. Shine · Slash's Snakepit
  4. Mean Bone · Slash's Snakepit
  5. On Reflection · Max Richter
  6. Dopamine 1 · Max Richter
  7. The Sorrows Of Young Lacie · Max Richter
  8. Dopamine 2 · Max Richter
  9. The Journey, Not The Destination · Max Richter
  10. Nocturne · Max Richter
  11. The Consolations Of Philosophy · Max Richter

Listened to #UNLESHED 2 by Lady Leshurr

Epica live at Shepherd’s Bush Empire

Thanks to a friend of mine, I got the chance to see Epica live at Shepherds Bush Empire last week. This was the second time I can remember going to see a band without having heard the music much before hand. However even though I only knew one of their songs, I still had a great

Thanks to a friend of mine, I got the chance to see Epica live at Shepherds Bush Empire last week. This was the second time I can remember going to see a band without having heard the music much before hand. However even though I only knew one of their songs, I still had a great night. All three bands were entertaining: Epica, of course, and the two supporting bands: “Beyond The Black” and “Powerwolf“.

Support Bands

Beyond The Black

Despite the idiots that were stood behind us moaning about how crap the support would probably be, Beyond The Black were actually pretty good I thought. They seemed to be going for the same look and sound as the main act but that’s fine.

They sounded pretty tight and the lady had a great voice to boot. Although they were the first support, and pulling in a lesser amount of dedicated supporters than Powerwolf – judging by the cheers, I have to say that I actually preferred Beyond the Black out of the two.

Powerwolf

Hailing from Germany, Powerwolf are probably one of the most animated bands I’ve seen live. The first thing that we saw of them was their back drops depicting a ruined cathedral. I whispered to Grant (the aforementioned friend) “I’m going to be really disappointed if they don’t come out in full robes and the like”… I was not disappointed.

They came out dressed in full priest garb and even face paint. I immediately expected much death metal growls and screams, however the lead singer came across more operatic than anything. There were still the odd growls but that was pretty much par for the course that evening.

Although the songs did sort of start merging into one another for me, Powerwolf were still entertaining to see and had a great rapport with the audience throughout. Also pretty much the whole room of people knew most of their songs – including the older woman sat next to me, who was absolutely going mental for them.

She was an inspiration.

Epica

The one song that I knew, “Edge of the Blade”, sounding great live. As did the rest of the set. Throughout the whole show the band were forever switching places, including the keyboardist up on a stage-surrounding ledge, which he had rigged to a track. It seemed that every three or four minutes he would be rolling around the ledge on his keyboard.

Even though I couldn’t name a single song of theirs, I still enjoyed the show. The band seemed to have a great chemistry on stage and this came through in the performances and their unending energy.

I was very grateful we had seated tickets too. After our full-day walkabout in London, I don’t think I would have survived the “Wall of Death” and following Mosh Pit that was in full swing by the end. At least that’s how it looked from the safety of our balcony seats. The band kept the energy and positivity up till the very end of the night. The crowd too were pumped up until the end, until the moment came to say goodbye and we were all ushered out into the cold London night.

Given the chance I would probably see them again.