Posts tagged code
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
Software algorithms as Ikea instruction manuals.
Apr 1st: This review of Doom 3's source release is full of tons of interesting stuff, even for non-graphics programmers. [via waferbaby]
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.
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
lots of good projects coming out of node.js right now - Uglify JS is a JS minifier based on a JS AST parser and tree walker. Could do some neat things with that.
learning javascript oddities from wikipedia: using !! for normalization and the return from || and &&. nice
kellan points out this interesting old TPJ article on problems with localization and gettext. the solution isn't really any good, but the problem is real
a new version of the php rfc (2)822 parser is now out, fixing a nasty bug that allowed extra periods almost anywhere in the address. oops
a nice summary of some js oddities that can be used for building exploits against various filtering systems
ohloh has some interesting views of open source projects - the committer sparklines are especially nice. like a much more polished version of a tool we use internally.
bookmarking for a later - fb code leaks
mozilla are talking about some nice changes coming up in JavaScript 1.7 (starting with the next beta of ff2)
get it while it's hot - the perl color ascii art library
and i've also updated lib_filter to handle single quoted attributes.
i've coded an experimental version of an RFC 2822 address parser to update the RFC 822 version.
a c boardgame. sooooo awesome
rate my code is awesome - thanks to salti for finding that
and here's that code in php for your enjoyment.
so easter is in march this year. the 'ecclesiastical' rules for calculating the date of easter sunday are: 1, easter falls on the first sunday following the first ecclesiastical full moon that occurs on or after the day of the vernal equinox. 2, this particular ecclesiastical full moon is the 14th day of a tabular lunation (new moon). 3, the vernal equinox is fixed as march 21. this page has more information and a code sample for calculating the date for any given year.
a new release of lib_filter (only 2 months late) to avoid the br tag being removed when the b tag should be (bad regexp - no cookie for you!).
my newest solver for roadblocks can handle one-ways and teleporters. seems to be able to cope with advanced levels easily.
[roadblocks](http://www.freeaddictinggames.com/?id=340&req=givegame
) is pretty fun, but trying to [build a solver](http://code.iamcal.com/pl/games/roadblocks-solver_pl.txt) is more fun. patches to support one ways and teleporters are welcomed (you'd need to extend the find_stop_*) functions to return an x,y pair for the teleporters. one ways are easy - just add to the blocks list for each direction). :)
Inline::Parrot is now in CPAN. i suspect i'll be installing that later today.
a nice faq answer about portable single character io. in a nutshell: no. of course, parrot will solve this for us by making everything seem portable.
the poignant guide to ruby now has 5 completed chapters (with the sixth slated to come this christmas). it's really really good - both funny and informative.
a question i've had before: "the x argument is a unix timestamp, but in what timezone? UTC?". unix timestamps are always UTC, since that's part of their definition.
the newly launched php wtf seem to be struggling for content - maybe there's not as many bad php programmers as one would imagine, or (as i find that hard to believe), the people running the site are finding bad code tough to spot ;)
the flickr mt plugin is pretty awesome, using not only Flickr::API, but also my XML::Parser::Lite::Tree and XPath modules. code resuse strikes again!
sean o'rourke points out a nice way to get a perl shell. now why isn't there a Perl::Shell module to do the same thing without all the line noise? a CPAN-esque "perl -MPerl -e shell" would be nice.
a french compsci teacher is using parrot on their vm course.
a vaguely interesting perl5 oo syntax filter module (though no standard build/install process, which sucks ass). i prefer luke's Class::Closure.
at least someone took my comments about PEAR's failing to heart.
scary goings on in th p6i world - jospeh ryan explains how to inline prolog in perl 6 using macros and the cross-language eval statement.
very useful - a list of which c functions are required in each standard (c89, c99, posix, etc).
oooh. yoz has released a cool hack for delicious - tag auto-completion.
a new perl module: XML::Parser::Lite::Tree::XPath . my first foray into xpath backends. docs are here. should reach cpan later today.
natural docs looks really good - like javadoc but much richer and more forgiving. also makes for very readable unprocessed docs. nice.
steve fink is documenting his quest to write a regexp compiler in parrot. the three days logged so far make for interesting reading.
was reminded of channel9 again today. looks like pep designed it, but full of geniuses. from microsoft. no, seriously.
there's a discussion happening on p61 at the moment about multimethod dispatch on return continuations. this sounds like pretty crazy at first, with fungeoid implications, but could lead to some very nice debugging hook oppertunities.
a nice collection of efficiency quotes. two of those adorn the walls in the office.
what. the. fuck. i did a "pear upgrade-all" and it first failed because of dependencies. fair enough - stupid that it didn;t automatically install the dependency, but forgivable. but then once finished, pear was broken because it used php 4.2.0 only features. how fucking stupid is that? the people in charge or pear are braindead idiots.
bookmarked for later - the rex parser with a javascript version of the regexp.
six apart is now taking signups for MT 3.1 beta testing. might be interesting. might not.
bookmarked for later - itunes sdks for osx and windows
a world of sql-related headaches today. while searching for an answer, i came across this nice explanation of joins in mysql - detailing multiple left joins, which is handy stuff.
span looks to be the first fully featured language built on the parrot vm, and so marks a big milestone in parrot's evolution. leo's python work is coming along too, with an AST generator posted this weekend. parrot is getting closer to the elusive 1.0
a live-journal-type teen-angst-girl started a use perl; jounral, thinking it was a general journal site. funny stuff
leonard linked to a nice short guide to lex and yacc. i'm working on a new language right now, using perl and P:RD. maybe lex and yacc in the future if i get adventurous.
flashkit is a constant source of despair for me. when i come up against some dumb problem in flash, i sometimes eventually post in the flashkit forums. to date, i've always recieved an entirely unhelpful solution, and usually by the same user, which doesn't fit the question at all and assumes i'm making a really basic mistake. forums with actually knowlegeable people (like ubbdev in the days of old) are a huge asset for a product's company.
further investigation of the if-modified-since problem with apache and php appears to show that it's a bug in apache 2 and the php filter plugin. stupid stupid stupid. it can be worked around with an apache directive, although that also stops php from recieving the i-m-s header, so you can't handle the 304 response manually.
Recommended porn resources by Cal, HD Porno izle and bedava porno izle finally Free Porn Tube for amazing movies.
the wikipedia page on surreal numebrs makes for interesting reading.
six-apart announce the winners of their mt-plugin contest. they should at least by slightly fucking embarrassed of the winner, since it basically patches a big problem in mt. i didn't win any of the six prizes, though all three of my plugins were in the shortlist of thirty (i know some judges ;), so 10% of the shortlist was my work. not so bad.
hammond's webkit2png is really fucking awesome. time to fire up the ibook and get grabbing.
webpac is incorporating my google search-term highlighter in their distribution. i don't quite understand what it does (very text-heavy site) but they seem nice enough. yay for open source and code reuse.
stupid manila, part 2. in addition to not supporting the full blogger or metaweblog apis, it looks like they have escaping issues with the methods they do support :(
urgh. stupid userland/winer/manila. turns out that manila doesn't support the revised metaweblogapi spec, which is hard to find so no big suprise. but, err, userland created the spec. they also don't fully support the blogger v1 api. a developer tells me that you need to send the full url of your blog as the blog id to the *.newPost method - is this a userland construct or is it standard practice? crazy.
the ever-lucid MJD has some advice for newbies in this short video.
stupid stupid pear doesn't have an atom parser yet (and wont for ages - their standards and approval process greatly discourage people writing for it - there's no way i ever will :/) so i wrote one with the same interface as XML::RSS, for drop in replacement (it's going to be used in an upcoming aggregator project).
check out my rtf tokeniser in perl which i wrote many years ago and just remembered about (although we now have RTF::Tokenizer on cpan which didn't exist when i wrote my tokenizer).