Posts tagged programming
If you want to make a PHP package available that works on versions of PHP from 5.3 to 8.0, testing is a giant pain. There are versions of phpunit that work for each, but none that works for all. Additionally, the basic class names changed at some point in the past. Getting all of this to run on Travis, including running code coverage (but only once for each build!) was a complex series of trials, but I finally figured out the correct .travis.yml incantation, along with a magic test wrapper for aliasing classes
May 7th: It turns out you can make a browser based chat client without using any JS or forcing page reloads. Truly amazing/evil. Probably not practical, but does show a clever mechanism for allowing some dynamic data flow with JS disabled.
Dec 11th: Way back in July, I was inspired by Tripelbyte's language identification quiz, so I made my own version for esoteric languages. Never got around to sharing it outside of Slack, but here it is.
Jul 12th: TraceGL is really stepping up the game of JS debugging in the browser.
Apr 1st: This review of Doom 3's source release is full of tons of interesting stuff, even for non-graphics programmers. [via waferbaby]
There are two answers guaranteed to show up on nearly every PHP question on Stack Overflow - use the mysqli/PDO extension instead of the deprecated mysql one (to avoid SQL injection), and that you can't parse HTML with regular expressions.
With that in mind, my favorite two answers:
- [How PDO is still vulnerable to SQL injection attacks](http://stackoverflow.com/questions/134099/are-pdo-prepared-statements-sufficient-to-prevent-sql-injection/12202218#12202218) by Anthony Ferrara
- [Parsing HTML with regular expressions](http://stackoverflow.com/questions/4231382/regular-expression-pattern-not-matching-anywhere-in-string/4234491#4234491) by Tom Christiansen
I've posted a bunch of projects to Github in the last few months and haven't linked to them anywhere, so here's a quick roundup of recently notable projects:
- [lib_timezones](https://github.com/iamcal/lib_timezones) - A PHP and JS library to handle user-specified timezones properly, with reasonable client-side auto detection.
- [lib_classsify](https://github.com/iamcal/lib_classify) - A partial PHP port of Github's own [linguist](https://github.com/github/linguist) which can automatically detect the programming language, given a code fragment.
- [js-emoji](https://github.com/iamcal/js-emoji) - A JavaScript library to allow display of Emoji in then browser for OSs without native support (anything that's not OSX 10.8 or iOS 6)
- [lib_autolink](https://github.com/iamcal/lib_autolink) - My old PHP URL-detection and linking library, updated to handle multiple protocols.
- [lib_solr_query](https://github.com/iamcal/lib_solr_query) - A PHP library to turn user-entered complex search queries into valid SOLR query syntax. Supports phrases, booleans, nesting, assertions and more.
Feb 2nd: Chrome continue to get better and better. Ilya Grigorik explains some of the optimizations going on under the hood in this chapter from an upcoming performance book. If you work on the web, it's a fascinating read.
Nov 9th: If you're working with JSON on the command line, then I can highly recommend jq for simple data manipulation. It let's you mine into JSON data using an XPath-like query syntax and makes quick work of extracting the stuff you actually care about. The source is on the githubs.
Sep 24th: The silver searcher is basically ack, rewritten in C to be crazy fast. If you're regularly using grep to search a codebase, this is probably a much better idea.
Aug 10th: Patricio Palladino has done a really nice job with hieroglyphy, a library for turning any JavaScript code into strings of only ()[]{}!+
. The explanation of his blog is a great read.
Aug 10th: Björn Höhrmann's excellent compact UTF-8 decoder is one of those C masterpieces that makes you realize quite how powerful the language can be.
Jul 20th: In the wake of password-hacking-month (Linkedin, Last.fm, Yahoo, etc) Jeremy Spilman talks about an interesting idea for increasing the cost to stealing password databases, rather than just the hashing: part 1, part 2
Jul 10th: Javelin JS is full of interesting little things - always fun to find out what compormises other teams make to allow their particular development model to scale. The css classes vs sigils part makes a lot of sense.
With all the current excitement about leaked password databases, I thought I'd take the time to make doing it the right way a bit easier. If you're working on a PHP app, start using lib_bcrypt right now.
12 factor app says a lot of good things that i agree with, but the server-process model rule is odd. there doesn't seem to be an obvious reason why the php/apache/processes model is wrong, but it's not allowed. uh?
A nice read about facebook's release engineering approach. This should all sound very familiar to Flickr alumni.
rev dan catt has written up a nice piece on image processing for backgrounds. a really nice effect
the macpaint and quickdraw source is available on the computer history museum site
mp3 decoding is interesting
it's now over 8 years old, but the 12 views of mjd is still good reading
bookmarking for the future: echoprint is a free open-source music fingerprinting system
php sadness points out a lot of real issues, but it's still the best tool for many problems
damn, someone has figured out my secret
math for programmers makes a lot of good points. i just need a way to track my wikipedia usage and claim it as 'studying'
this guide to the interesting bits of javascript is really good
thanks to kastner for pointing me to this thread from 6 years ago. guess what retarded commenters? i was right all along. see also: everything written on large distributed databases since then.
HgInit is actually a pretty good introduction to distributed version control. it doesn't sell it very well (sooo complex, comparatively), but it does a good job of explaining the mechanics
this visual automation language looks pretty cool, but the video narration is awful. so slow. i get the concept already - demo it faster!
my C is weak, but this presentation on compiler optimizations is a great read
old, but still good: Java2K uses a 11-based number system, which is a very good approximation of the 10-based decimal system for many purposes, including counting up to and including 9.
audiotool is an amazing piece of work - reason redone in flash. very very slick. seems to be the work of andre michelle, whose demo work is also excellent
warehouse looks pretty good, but it requires both ruby on rails (easy-ish to install) and the ruby-svn bindings (which are basically a bitch). why do the harder languages to get up and running on the web (ruby and python) require the bindings while the easier languages (php and perl) just shell out and so work easily? gah. currently using websvn in php which does a reasonable job and is trivial to set up.
learning javascript oddities from wikipedia: using !! for normalization and the return from || and &&. nice
tron versus unprotected memory. kinda awesome
the video of my djangocon keynote has just tipped over 40k views. wow
and wtf - _why has revealed the magic behind the scenes. _why drawing something based on something i caused is the most awesomest thing evar. he's my hero in a total fanboy way
the PHP_Debug bar is kinda neat. very ugly, but packed with useful info
mr kastner has passed me a silly chain thing, only not too silly since it's about programming. amy hoy did one too. but i don't have a long-form blog!
fileformat.info has the best unicode codepoint reference docs i've seen [via ph]
a paper about intercal. very nice
salt pointed me to this excellent windows programming article which talks about the problems with visual studio and code generation. a long read, but worth it if you're interested in the history of vs, vb and resource scripts.
man, joyce sure hates templates. i suspect anyone how really wants to use xslt in a real application is fundamentally sadistic
a c boardgame. sooooo awesome
the ICFP programming contest seems fun - i wonder if anyone's planning on implementing in brainfuck. or smith. or maybe homespring :)
i'm working on timezone stuff again, and came across this great timezone faq. some timezone stuff is really terrifying/retarded from a programming pov - "China observes one time zone UTC/GMT + 08:00 - which makes this time zone uncommonly wide. In the extreme western part of China the sun is at its highest point at 15:00, in the extreme eastern part - at 11:00."