Ben Lobaugh Online

I think, therefore I am. I am, therefore I sail

Second week update on the nano reef cleanup

Today ends the second week of the new saltwater nano reef tank. Here is the update on the cleanup project.

The tanks started out overgrown with algae an aiptasia. The tank had crashed. Here is a photo of how it started.

Nano Reef Tank Crashed

I am dedicated to bringing this tank back up to snuff and giving it back to my buddy looking like the beautiful reef it should.

I started by removing all three large rocks for cleaning. The rose bubble anemone refused to be moved, so I wound up leaving that rock in. You can see the anemone on the left most rock in the above photo. Leaving that rock in has made the revitalizing of the tank more difficult as I have been unable to simply kill off and scrub it like the other two rocks. Minor speed bump!

Later, I took a good look at the default sump configuration and was not too thrilled with what I saw. The built in sump is convenient, and certainly makes this tank much easier to maintain, but it has not been doing a great job out of the box. There are three chambers, in the first chamber was nothing but water. The second chamber held a highly porous black sponge that contained a tiny bit of activated carbon and even less bio material. Not nearly enough bio material to build the level of beneficial bacteria I would like to see.

For the short term, I need to be collecting junk in the water, which the black sponge cannot do. I pulled that and the carbon out, then dropped the bio material to the bottom of the second chamber. Then I took filter floss and stuffed the second chamber full. The first chamber was still empty. Here is a photo of the water change 2 days after updating the sump. The filter looks whiter than it really is in the photo, it is dark brown.

Yowza! That is some gross water!

Both chambers one and two now are packed with filter floss. More bio media should be arriving shortly, and that will fill most of the second chamber. There are other specialty saltwater gadgets that could be used, but I am attempting to keep this as simple as possible.

The sump pump was also replaced. It had an anemic 80 gph pump in it. Or at least it felt like the same output as my other 80 gph pump. A 200 gph pump replaced it. This provides much better flow that everyone in the tank seems to be enjoying. The water is much cleaner as well.

Onto the critters!

Removing the other rocks helped the stock feel much better. Everyone is more active now, especially the shrimp, which had stayed in one place for the most part. I also picked up some cleanup crew to assist:

  • 10 Trochus snails – general algae eater
  • 3 peppermint shrimp – aiptasia eater
  • Emerald crab – bubble algae eater

The anemone was looking depressed initially. I fed it some brine shrimp and the next day it looked better. I have been feeding it directly every other day and it is looking happier now. It has fully emerged and opened up, and it’s arms are floating up again.

I have been heavily consulting with a couple pro saltwater buddies, Josh and Jordan. Their guidance has been invaluable. Barrier Reef Aquariums has also been critical to the success of this rehab. I highly recommend you check them out if you are in the Seattle area.

Here are some photos of the tank now:

Click on this link to see a video of the Emerald Crab dining on some algae.

Emerald Crab

I was avoiding getting a crab, but since I put this Emerald Crab in the tank she has become my favorite! Fascinating to watch.

New fish tank, saltwater- I have never had this before!

For over three decades I have kept aquariums. I tried to calculate of all the individual tanks over the years and came up with a rough 400 gallon number. In all of that time I have never had a saltwater fish tank! My friends Joshua and Jordan were the salt pros and I was the freshwater guy. 

A  buddy with a nano reef tank asked me a couple weeks ago if I could take care of his tank for a while. An established tank, with a built in sump. It is the perfect salt water aquarium starter package. I gladly agreed and the tank is now sitting next to my desk where I get to look at during the work day. 

Tank: Fluval Evo 13.5 

Current stocking:

  • Rose bubble tip anemone
  • Frosted Clown
  • Black and White Clown
  • Watchman Goby
  • Pistol Shrimp
  • Yellow Coral Banded Shrimp 
  • Peppermint Shrimp
  • Emerald Crab (I added)
  • Trochus snails

Photo of the tank after moving it to my house

Algae and Aiptasia got a foothold during my buddy’s vacation. We are currently battling it out, but I am confident that we will be the victors and the tank will be pristine again soon!

Some photos of the stock:

Video of the Emerald Crab

Lock attached to door

How to Force SSL (HTTPS) in Laravel

Out of the box, Laravel will allow both HTTPS and HTTP requests to your website or application. Ideally all requests are served via SSL. There are several ways to accomplish this, some of which require access to server configs. I am going to show you how you can easily force SSL in your Laravel application to ensure HTTPS will be on no matter where you application is deployed. Of course the server still requires a valid SSL certificate to run- that is outside the scope of this tutorial.

Assumptions

  • Working server with the SSL certificate already installed
  • Laravel app running
  • Requests being fulfilled on both HTTP and HTTPS
  • Basic Laravel knowledge

Time to complete in your app

30 minutes or less!

How it works

Laravel provides a mechanism for filtering HTTP requests called Middleware. Middleware has many use cases, a few of which include: user verification, CORS headers, logging requests, etc. Only after all Middleware conditions have been met is the app able to fulfill the visitor’s request. This is the perfect place for us to enforce SSL.

Read more about Middleware in the on the official Laravel docs https://laravel.com/docs/master/middleware

Step One: Create the Middleware Base

Middleware can be generated automatically with artisan with the following command:

php artisan make:middleware ForceSSL

The new file will be created in app/Http/Middleware/ForceSSL.php

namespace App\Http\Middleware;

use Closure;

class ForceSSL
{

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return $next($request);
    }
}

Step Two: Update the handler

All we have to do now is look at the request and if it is not secure redirect to the secure version of the url!

Update the handle method like so

    public function handle($request, Closure $next)
    {

        // If the request is not secure, redirect to the HTTPS url.
        if( !$request->secure() ) {
            return redirect()->secure( $request->getRequestUri() );
        }

        // Otherwise carry on.
        return $next($request);
    }

Step Three: Test

That is it. 

Really.

Go test it.

Step Four: Enjoy a nice scotch

‘nuff said

Photo by Anita Jankovic on Unsplash

Man reading newspaper

Add a Mailchimp email subscription form in Laravel – double opt in!

With several fantastic extension out there, integrating a Mailchimp email subscription form in Laravel has never been easier!

I am going to show you an example integration that collects an email address in a simple form. We will be using the laravel-newsletter package by spatie.

Assumptions

  • You have a Laravel application already running
  • You have a Mailchimp account
  • You have a basic understanding of Laravel

Step One: Include the spatie/laravel-newsletter package

Include the spatie/laravel-newsletter package in your project with

composer require spatie/laravel-newsletter

This package contains a very easy to use set of methods to control all aspects of your subscribers and user management. In this tutorial we will only be using the subscribe functionality.

Step Two: Configuration

The default configuration file will be generated with

php artisan vendor:publish --provider="Spatie\Newsletter\NewsletterServiceProvider"

A file will be created at config/newsletter.php. In this file are a set of variables that will be needed in the .env file.

Step Three: Create the Controller

A Controller will be used to send off the subscriber’s email to the Mailchimp service. Other tutorials on form submission will also include a Model and Migration here. I am choosing to skip that since we are not putting data into a database, but rather are acting as a passthrough.

php artisan make:controller Subscriber 

The controller file will be created at app/Http/Controllers/Subscriber.php

Add a method called addSubscriber

    public function addSubscriber( Request $request ) {

        $validatedData = $request->validate([
            'email' => 'required|email',
        ]);

        // Do additional validation and security checks here....

        // Sign up the user!
        Newsletter::subscribePending( $validatedData['email'] );

        if( Newsletter::lastActionSucceeded() ) {
            $status = json_encode( [ 'success' => true, 'message' => 'You have been added to the list! Please check your email to confirm.' ] );
        } else {
            $status = json_encode( [ 'success' => false, 'message' => 'There was an issue adding you to the list! Please try again or contact the admin.', 'error' => Newsletter::getLastError() ] );
        }

        return $status;
    }

Step Four: Update routes

Next you will need to update your routes file to add the new endpoint. Do this in routes/web.php

Route::get('subscriber/add’, 'Subscriber@addSubscriber');

If you are building this into an API you can use the routes/api.php file.

Step Five: Wire up your form

This is the final step to world domination!…. or at least having your subscription form ready for prime time. Simply wire up your form to use this new endpoint. I am going to assume that you know how to handle html forms here 😉

Step Six: Final Testing

Because we set this up as a GET query, testing is as simple as passing the email query parameter. Submit an email and see it populate in your Mailchimp account!

Step Seven: Drink Scotch

The final and most important step!

Page 3 of 164

Powered by WordPress & Beards