Storm Clouds Over the Bundy Ranch

April 15th, 2014

Excellent. Analysis.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Use “the big E” for quick and clean monitoring

April 3rd, 2014

Despite all the great monitoring tools out there these days for monitoring, it’s difficult to get away without writing a custom monitoring script or two. Spools, various types of cache, multi-server indexing. So many things that can go wrong.

Once upon a time I used to write quick and dirty complex scripts that would email in one case, otherwise do some-such-thing, etc. They were brittle with questionable reliability. Talk about a false sense of security.

These days I like to use an untouted feature of mail to keep things simpler. The idea is to only make noise when there is a problem. If all is well, keep silent.

Take this cron job for example:


*/5 * * * * root /somedir/check-spool.sh | mail -E -s 'Spool Monitor' problem@somedomain.com

check-spool.sh will do just that: Check a spool each time it is run. If everything is fine, no output. If it finds a problem then it outputs what it finds. The “big E” (-E) switch tells mail to ignore any body-less input, and will therefore only spam us when there is some panic-worthy output.

Thanks big E.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

JMS\Serializer\Exception\RuntimeException: “Resources are not supported in serialized data…” Yadda yadda

March 9th, 2014

Been bit by this a couple of times now. It’s really a problem with a bad route. In my case I had some ajax using the FOSJsRoutingBundle to generate a route along the lines of:

Routing.generate('some_titles', {id: $(this).val()});

where val() was actually returning an empty string. The resulting URL (“some//titles”) was invalid, looks to JMSSerializer like a resource thanks to the double slash, and badda bing badda boom: completely irrelevant error.

I think this may also be the source of “Cannot redeclare class Doctrine\ORM\Mapping\Annotation” errors to boot. Double whammy.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Couldn’t reserve space for cygwin’s heap, Win32 error 0

February 14th, 2014

Cygwin and Windows git stopped playing nicely together after a recent Windows update. There’s a variety of recommendations for how to fix this this on StackOverflow and elsewhere, but this post actually makes the most sense. In a nutshell, msys-1.0.dll (installed into your Program Files\Git\bin directory) is not built to be position independent. Use the dll rebaser to get it to load at a new address, like so:

$ rebase.exe -b 0x50000000 msys-1.0.dll

And voila, git goodness restored.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Simple Twig Fallback

February 6th, 2014

Love the simplicity of Twig; mainly that it allows us to do away with the conditionals that tend to litter most interface code.  You know the drill: If this then show that otherwise show the other thing except in such-and-such a case..  Confusing and brittle.  Twig’s hierarchical layout is the way to go.

Falling back to a parent block depending on complex output can be tricky however.  Here’s a simple way to do it without a bunch of ifs:

Yay. If less.

Or with one ternary conditional if running parent() through default() is unclear:

{{ details|trim|raw ?: parent() }}

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

ElasticSearch Delete All

January 13th, 2014

Even though it’s not documented anywhere (as far as I can tell), I probably should have realized this would work:


$ curl -XDELETE http://localhost:9200/
{"ok":true,"acknowledged":true}

Deletes all indices in one fell swoop. Nuclear option. Use caution.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Bananas for Fruitcake: Hipsters Explain the Collapse

September 11th, 2013

This is awesome on many levels.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Not Defined and Not Empty/Null in Twig

May 1st, 2013

Long time no write.  Came across some syntax today that solves an old annoyance in Symfony's Twig.

Rather than blather on in code with the following complex statement to make sure that a value is both defined and not null:

{% if var is defined and var is not null %}

one can instead simply do this:

{% if var|default is not empty %}

or even more simply:

{% if var|default %}

Nice.

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading ... Loading ...

Federal Government declares admits open season on Americans

February 5th, 2013

From NBC of all places.

A confidential Justice Department memo concludes that the U.S. government can order the killing of American citizens if they are believed to be “senior operational leaders” of al-Qaida or “an associated force” — even if there is no intelligence indicating they are engaged in an active plot to attack the U.S.


View Fullscreen
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Redacted

January 25th, 2013

If you’ve ever seen Stan Friedman talk about UFO’s, you’ve probably seen his shtick about redacted documents. For example:

Always loved that.

Well, move over Stan. Apparently the U.S. government has even bigger secrets than aliens.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...