Posts Tagged ‘PHP’

Advanced PHP Debugger (APD)

Tool Tips | Posted by attriel April 21st, 2009

The first Code Profiler we looked at was the Advanced PHP Debugger (APD).  (http://pecl.php.net/apd) Which I insist on calling ADP for some reason.  This one had a lot of features that looked interesting, and had a single function call for turning it on or off.  Something we could add to the pages we were interested in checking, or to our config to profile the complete set.

Unfortunately, the project looks to have been abandoned, with the last release (1.0.1) being from 2004.  We tried setting it up anyway, the zend hooks still existed AFAICT and it’s not unreasonable to believe that profiling data would be reasonably unchanging.  The rest of the “Debugger” might be out of date, but perhaps profiling would work.

As it turned out, apparently not ALL of the zend hooks still existed in the same form, and so every page load simply crashed PHP and the apache process managing the connection.

Problems with Python

Programming | Posted by attriel August 28th, 2008

One of the things I’m having to deal with at work lately is Python.  It’s used around the UltraSeek (nee Inktomi) search engine in use that predates me (and boy is THAT a nuisance)

And a few things I’ve learned about python so far:

  1. If I wanted to use a position-sensitive language, I’d go back to programming in FORTRAN.  whitespace should be used for making things pretty and legible, not for replacing “ugly” braces
  2. Bacchus-Nauer Form language definitions are NOT good user documentation
  3. The guy who wrote the local mods for this code was an idiot!

On the first point:  Seriously?  Whitespace structured code?  Jesus, Guido, (no, that’s not a slur, that’s the man’s name who designed python), did someone put out a hit on { and } ???  I’m scared to replace tabs with spaces, because, honestly?  I don’t know what effect that would have.  I think 1 space would===1 tab, but wtf knows.  Because back in FORTRAN we used spaces b/c those first couple columns had meaning.  I’m not versed enough in python to know all the ins and outs, but I think it’s just “whitespace”. 

Point the second, BNF.  Don’t get me wrong, I can read BNF.  I actually LIKE BNF definitions.  They’re great for the details and nuances of “what can I put here” once you’ve got the basic setups.  But for interpreting “what does this line do”?  BNF SUCKS.  Because now you have to know the answer to know where to look for the answer.

For instance.  How do I print out the contents of a variable who’s type I don’t know?  Only way to print anything that I’ve found is “write(variable)” (no EOL markers, b/c the newline character is whitespace and thus meaningful, ooooh).  I’m sure if I knew python I’d know how to write the equivalent of PHP’s print_r() or var_dump().  But because I don’t, the official docs that I found on python.org don’t help any.  Oh, and join(“,”, $array)? join(“, “, @arr)?  yeah, reading the docs, it’s supposed to be “, “.join(arr) … uh, W T F?  I have to make an string variable, assign it the conjunction, then use it to invoke join?  who joins on the conjunction?  arr.join(“, “) would be SOOOO much more logical I’m sorry.  And I still haven’t figured out how the code is doing when it calls “string.join(arr, “, “)” … because string doesn’t have a join that takes two parameters.

I’ll grant this:  Coming from Perl (language of line noise) to looking at python (language of whitespace) is kindof a long jump.  They’re kindof conflicting paradigms, honestly.  But still.  I hate python.