A short article explaining how to improve your experience and produce slightly better code.
URLs: it's important to define your URLs rather than exposing all your PHP files to the world.
Use routes - study the one in ZF2 but don't copy it unless you really need it. CodeIgniter's is pretty nice too. Routes help map URLs to classes and methods.
If you don't want to use routes, use Apache's mod_rewrite. It's faster, and also awesome. It tranforms specific URL into specifc requests to specific scripts.
This article is being rewritten. If you want the latest, contact johnk at this domain.
The original was written: 2004-11-18 03:16:46 -0700.
Here's a bit of the article:
Dang, but it took me forever to learn CSS. Maybe I should have used a book. Here, I'm going to share with you the hard-found knowledge, presented using technical programmer jargon. (Revised in 2014.)
What is Cascading Style Sheets (CSS)? The typical answer is that it's a way to separate the way a page looks from the the underlying HTML, which describes the structure of the document.
This snippet of code can be modified and used to change the stylesheet on your page. I set it up to work against a layout extracted from Salsa, but it should work on generic pages. It's good for demos, discussions about a layout, trying different colors, etc.
This is one of those "why bother with an external library" moments. Mostly copied from MDN.
viudata created a Schelling Segregation Simulator in processing, and added a third race to it.
A while back, I made a little program called TPCalc to do one of my favorite mundane activities, which is to determine the best price for toilet paper at
I got the ezmlm migration working, which is cool. Mailman and mail migration will be easier. So I took a day off. (Web migration will be a headache.)
There is no great writing, only great rewriting. - Justice Brandeis
I'm not much of a Python coder, but I'm learning to be a pretty good Python re-coder.
Mobile websites all seem to have this button, which appears when you've scrolled down a bit. The button scrolls you back to the top of the page, where most of the menus reside.
This seems so basic, it's almost embarrassing to publish, but this showed up a few times on Stackexchange. I had trouble figuring it out, too, partly because the Python docs are so lengthy.
What's an Exception?
This script uses ImageMagick and AVConc (ffmpeg) to convert images uploaded by a low-end DLINK internet camera to an FTP server.
I almost wrote a page for this, but it turns out a bookmarklet is good enough:
MySQL has a feature to log slow queries, and it's nice, but the problem is, a lot of the queries look alike. So what you want is a backtrace so you can find the code that created the query.