Saturday, November 17, 2018

Using Symfony 4, PHPUnit, and PHPStorm

It took me a few minutes to work out how to be able to run PHP Unit from within PHPStorm for my new Symfony 4.1 project.

Here's the configuration that ultimately worked, with no fiddling of any configuration files or changes to my symfony code of any kind.





The relevant part of the Path to phpunit.phar is: <your-project-directory>/bin/.phpunit/phpunit-6.5/phpunit

You'll receive something along the lines of

Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\KernelTestCase' not found

when running your unit tests if you haven't checked the 'Default configuration file' box.

Wednesday, August 29, 2018

2018 Diner Dash Bike Tour - Henderson Harbor, NY to Selkirk Shores State Park, NY

Overnight at a camp ground in upstate New York, keeping it light at around 55 miles of biking.

Goals

  • Take it easy
  • Don't shy away from stops
  • Eat a lot!
  • Shake down the rigs
  • Get out of the cottage for a bit

The Crew

Jim, John, and Adam. Adam and I have done an overnight or two before, but this was John's first time doing anything like this. 

Jim, John, Adam


The Route


The route to the Selkirk State Forest
The route we took
Route 3 is a moderately bike-friendly highway that's just inland from the eastern edge of Lake Ontario. It had the attractive feature of presenting a straight line between our starting point and destination.

Naturally we avoided this!


To dodge traffic, add some miles, hit a few stops, and vary the scenery, Adam plotted an alternative route that focused on back roads, passed through a few small towns, and gave us a chance to check out Monitor Mills Falls.

Highlights

Monitor Falls

This was a surprising gem with very little indication of its existence, and we blew right past it initially. It was worth the backtrack, though.

It's a short way (less that a quarter mile) down Monitor Mill Road off of 289, but there are no signs. You'll see it when you cross a small bridge. There's a parking lot (a grassy field) on the south side of the road, from which you can find steep trails running down into the creek valley. One of these even has a rope aid the descent. Alternatively, you can walk across the street to the entrance of a field, and follow a gently sloping grass path down to the upper part of the falls themselves.



Monitor falls on a "low" day
When we visited, the water was low. A later trip back featured water gushing across the entirety of the stone wall.

The low water allowed us to splash around safely, and fully explode the lower part of the falls.


It was a great stop, and very refreshing.







Random Blueberries




There were a few more hills that we originally expected. At the crest of one of the bigger ones, we couldn't resist taking a quick break and picking some blueberries at Farnham Farm. Some friendly conversation with the woman at the stand, a local of near-by Pulaski, a potassium rich snack, and some rest for our middle aged legs, and we were off again.






Selkirk Shores

We went in to Selkirk Shores through a back way, that would have only been accessible via bike, as the gravel road was gated. This was accessible via Pine Grove Road.

The park itself was very nice, with a different feel to it than the rest of the area... Cooler, older, mossier. It felt like we were in a state park. We didn't have time to explore it, as it was late when we arrived, but there trails looked well groomed and maintained.

We camped in Loop B. The sites felt a bit cramped and close together; there was no natural separation between each spot. However, this was fine for the evening, as it wasn't crowded and quite. The area for tents was level, and there was a fire pit. The outer sites on Loop A looked slightly more secluded (though not much) with a small about or natural separation between the sites.

Returning on Route 3

Our initial concerns about Route 3 were that it was too busy and would feel risky. That concern was reinforced for the first two miles, where pavement grooming was occurring, the lanes were tight, and it seemed like all commuters upgraded to semi trucks. Fortunately, once the construction ended, the wide shoulder revealed itself and it was pretty easy going for the rest of the way home. We were passed by several other bikers during a breaks, and we didn't have any close calls.



At the Trolley Ice Cream shop, we were flagged down by a large group of riders touring from DC to Canada. They offered us some giant cinnamon rolls that we couldn't refuse, despite the stop happening between our recent snack break and an imminent lunch. I wish I had captured the name of the group!


Tuesday, January 29, 2013

Bootstrap Modal Double Backdrop

I recently had an issue where I was getting the modal-backdrop class applied twice, so I ended up with two overlays.

Symptoms

Upon calling .modal(), I ended up with a very dark background overlay. Dismissing the modal cause the overlay to lighten but remain. Clicking somewhere on the page or pressing ESC caused the overlay to vanish.

Method

This was occurring whenever I loaded the entire content of the modal with AJAX. Something like:


function makeModal(html) {
        var $modal = $(html);
        $('body').append($modal);
        $modal.modal();
    }

The problem is that html had a script tag present, so $modal.modal(); was actually being applied to the modal div and the script tag.

The Fix

You need to make sure you only apply modal() to the modal  div, like this:

function makeModal(html) {
        var $modal = $(html);
        $('body').append($modal);
        $modal.filter('.modal').modal();
    }

I found the answer to this problem via landon's post on this github issue: https://github.com/twitter/bootstrap/issues/679

Friday, January 25, 2013

Confluence: Failed to create the user X. Check your server logs for more information.

I recently received this error when trying to create a new user.

The error was occurring because of the order of my Group Directories.

I have both Confluence Internal Directory and Microsoft Active Directory enabled. The order is important here. Microsoft Active Directory was listed first, so when I was trying to create a new user it was trying to do so in AD.

In my case, I wanted the user to be created in the internal directory, not my AD.

The Fix


  1. Browse -> Confluence Admin
  2. User Directories
  3. Use the green arrows to make it so the Internal directory is first in the list.






You should now be able to create your user!



Tuesday, January 22, 2013

Get a Stack Trace on the Symfony2 Command line (console)

If you run a command via the Symfony 2 Console component and receive an exception, you aren't presented with much more information than the exception name and message.

To see a full stack trace, append -v to your command.

For example:

php app/console doctrine:schema:update --force -v

This will provide a full stack trace. You probably need to have Xdebug installed.

Friday, December 7, 2012

Symfony 2 cache and log permissions on Ubuntu

Using the ACL, run the following in your project home directory:


sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs

More info at http://symfony.com/doc/current/book/installation.html

Tuesday, November 27, 2012

CSS, Sublime Text 2, Colon, Vintage Mode

Can't use ':w' to save CSS/LESS files in ST2 in Vintage mode because it keeps just inserting the colon? The problem is actually with ZenCoding keybindings.

Quick Fix

Add the following to your User Confirmation file, found via Preferences -> Key Bindings (User)


{ "keys": [":"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": ":"},
        "context": [{"key": "setting.command_mode"}]
    }

Note: The above should be inserted inside of the square brackets ([]).

What's going on?

ZenCoding has a default key binding for ':' that doesn't really respect Vintage mode. You can see these bindings in Preferences->Package Settings->ZenCoding->Bindings->Key Bindings (Default).

The binding mentioned in the Quick Fix is a copy/paste from the Vintage package key bindings. What we're doing here is putting it into our User key binding file, effectively over-ridding the one from ZenCoding.