Ooh, SymfonyStyle looks like it’ll make IO a lot easier for Symfony Console (CLI) apps.
Toby's Log page 91
Line Mode Browser, or progressive enhancement all the way back
Progressive enhancement is a development strategy meant to provide older and / or less capable browsers with a working website while providing the more capable with a rich, full experience. It is often presented as a set of layers of support, with HTML at its base, then CSS added to that for styles, then JavaScript for advanced behavior. With this, it’s often posited that a well-crafted HTML experience can be used by any browser. However, for really old browsers from the early web, the new web provides many things that can make pages difficult to read, functionality unusable, or even entire sites inaccessible.
Today, I’m going to go back as far as I reasonably can in terms of browser support, to the second web browser ever made, and the first widely supported one, Line Mode Browser. I can’t look at the first, WorldWideWeb, because it was only made for NextStep and, as far as I can tell, isn’t accessible for me to test with. Line Mode is though. It was open-source by the w3c and kept available. I was able to get it with MacPorts with the ‘libwww’ package (run as www
on the command line).
Line Mode was based on WorldWideWeb, and in fact was less featured, so it is likely to have any issues WorldWideWeb has and more. I will look at some issues that Line Mode has with modern web pages, and provide some solutions that will improve the abilities of even the oldest browsers to use a page.
Continue reading post "Line Mode Browser, or progressive enhancement all the way back"Symfony 3.0 has finally been released. I hadn’t even noticed for almost a week. It took some time, but I’ve updated my boilerplate and related bundles to use it. I then updated my site. I haven’t delved too far into 3 yet, but I like the new directory structure and profiler / dev toolbar.
Testing out WordPress’s “aside” format. I’m hoping it’ll work nice for short little posts like a tumblelog. Most of the time I have thoughts that might not be enough for a full titled post but that I still want to get out there. I have a Twitter account, but posting here is more IndieWeb.
Upgrading my Awstats setup
I don’t really monitor analytics for my personal sites that often besides for my blogs, for which I use wordpress.com’s analytics. I do have three open-source analytics programs set up for my main sites though: piwik, owa, and awstats. Awstats is the one I’ve tended to look at the least, probably because its interface isn’t as nice as the others and it doesn’t have as much data about visits. However, it is the only one that looks at actual server logs, so it should be the most accurate about basic visit information. The other two use JavaScript, one having an image fallback, so there’s the potential for them to miss visits.
I have my awstats set up as I described in 2010. I keep the configuration and the data separate from the install to make updates easier. However, it had been so long since I upgraded that I forgot how it was set up and fumbled a little before finding that article and figuring out what had to be done. In order to make it easier for next time, I created myself a simple little script to handle the upgrade for me:
Continue reading post "Upgrading my Awstats setup"Testing the Monty Hall problem
I have always had trouble understanding and even believing the proposition of the Monty Hall problem. It feels like it is proposing that the probability of past events affect the probability of future events, like suggesting that a coin landing on heads will be more likely to land on tails the next time. Rather, it’s about the information provided by the circumstances. I still don’t intuitively understand it, but at least I have now verified for myself that the proposed probability approximates outcomes. I have created a PHP simulation of the game and script to iterate it numerous times.
The code allows testing other numbers of doors and number of doors for the host to reveal. Increasing the numbers shows increasing odds. Even if Monty opens less than all but the remaining door (obviously requires more than three total doors), it still increases odds by switching.
Continue reading post "Testing the Monty Hall problem"ASCII art source code signature for my site
Sometimes I see sites with ASCII art hidden in comments in their source code. I’ve long admired the retro computer nerdiness of ASCII art. At times, I’ve wanted to add some to my site, but have been reluctant because of the extra bites it would add to page weight, the difficulty in making it look good, the lack of a subject I felt worth it, and the problems they can have with differing fonts and display widths. However, after adding an easter egg recently, I was more receptive to the idea when reminded about it by the source code of archive.org.
I spent some time this past weekend trying various different ASCII versions of my name. Some examples:
Continue reading post "ASCII art source code signature for my site"Konami easter egg
What web developer’s site is complete without an easter egg? Until today, mine didn’t have one, but I had long wanted something. Since I was struggling to make forward progress on what I had actually wanted to work on this weekend, and had just been reminded of the Konami Code, I decided it was finally time to add one. I had seen a friend do a key sequence easter egg on a site he built a while back, which had put the idea in my head. The Konami Code sequence has been used on several websites already (Digg and Vogue are two examples I could get to work), so why not mine?
A simple Konami Code script:
Continue reading post "Konami easter egg"Symfony AppCache and ‘X-Reverse-Proxy-TTL’, a hack
Symfony’s HttpCache reverse proxy is a simple way to get caching of pages with Symfony. It is simple to set up, easy to work with, and easy to clear. I started using it recently on my own site.
A simple app/console cache:clear
will clear the entire cache. Otherwise, following the HTTP-oriented spirit of the framework, invalidation is based entirely on HTTP headers. In this way, it works the same as proxy / gateway caches. It only caches responses with public
Cache-Control
headers. It is age based, using the Cache-Control
s-maxage
or maxage
values or Expires
headers (following that order of precedence). It then considers the cached items fresh until they are stored for longer than those headers specify they can be stored. The cached version is served, bypassing the router / controller, as long as the cache is fresh.
This is all nice, but using long max-ages for those headers means that caches outside of my control can cache pages for long periods of time. cache:clear
won’t help when a page changes. One possible option would be to have shorter and safer max-ages as Cache-Control
headers and use something else for HTTPCache
.
404 with autofilling form
Inspired by a tweet by @simevidas about a 404 page search form, I decided to finally replace Symfony’s default 404 page on my site. The tweet was about an example site’s 404 pages that take pieces from the URL path to populate a search field. Upon seeing it, I immediately thought how easy it would be to implement a simple version of that.
I had been thinking of customizing my 404 for a while, but stopped trying because Twig doesn’t seem to know about bundle paths in the error pages, preventing me from extending the “base” template in my bundle. I still didn’t find a solution for this, so the 404 page has an unstyled look, but I wanted to capture the search form idea while it was on my mind.
Looking into 404 best practices, I found three things that I wanted on mine: branding, guidance / next steps for the user, and small size / low power.
Continue reading post "404 with autofilling form"