Wednesday, July 05, 2006
Variety Blogging
Categories: Life • Religion • Technology
Geek Speak
I've been doing lots of PHP coding lately. I've noticed a marked improvement in my coding ability as a result. It tends to take me about half the time to work through the logic I need to get my desired result and I spend a lot less time debugging. I was also introduced to a neat little trick at the pMachine Forums that makes debugging a ton easier. Its a simple trick, too simple really, but I hadn't read it mentioned anywhere in all of my searches for PHP debug tricks so I thought I would mention it in more detail.
PHP has no built in debugging abilities beyond using the echo() and print() functions to spit back variables at different points to get an idea of what is going on within a piece of code that isn't working the way you want.
This works great, most of the time. However, I find myself often writing pieces of code that are embedded in larger pieces of code. The issue here is those echo() and print() functions don't show up in those cases. So what I used to do was rewrite problem code separately using dummy strings that I hoped would match the real world situation so that I could run them on their own to debug.
So where does the trick come in? At a spot where you want to get your variable spit back you use an exit() function immediately after it on the same line like this:
echo $debug_variable; exit();
When the larger script runs and it pulls in the smaller chunk of code and hits that exit function the whole thing stops and you get just the debug variable as the output. If I had known I could do this years ago it would have made life so much easier. So thats it. I can hear all the real programmers groaning at my silly excitment over something they probably think I should have already known. Oh well. I refuse to not be excited.
Stupid Dumb Christians
I've recently been watching ReGenesis a TV show made in Canada about the near future where genetics and diseases are the next big thing (of course they already are kind of the next big thing). Anyway, the show is great and deals with some interesting topics in pretty even handed ways.
Even handed that is until it gets on religion.
I know I shouldn't allow myself to be bothered. And it doesn't really bother me in a real sense because I know the portrayal is silly. But it saddens me a little to always see Christians presented as idiots. It isn't that I don't know some stupid Christians. It isn't that I haven't had moments where I myself have thought, "why are my fellow Christians so stupid?" However, I know Christians that are intelligent. I know Christianity itself is not incompatible with science. There are plenty of scientists who are themselves Christians. But they don't make very much noise. And sadly they are overshadowed by the ones who do make alot of noise doing idiotic things.
Oh well. :)
The Fourth In Portland
The last 4th of July that I watched fireworks on was in Sitka two years ago. I stood on the bridge connecting Japonski and Baranof islands with two of my childhood friends and watched the city sponsored displays reflected on the water. It was one of those moments that felt oddly poetic. This 4th wasn't nearly as beautiful in that way. But I can't complain with a nice walk in the dark to the sound and colors of the local amateur fireworks displays.
Posted by Jamie at 01:03 AM
comments
re: geek speak - better to learn it late than never! - interesting trick - i didn’t know that myself. :)
re: stupid dumb christians - i enjoyed this part of the post particularly - rebecca and i have been talking about this recently - about how christians seem to eitehr dumb in that you can’t get into a halfway decent conversation with them or about how so many things marked with the christian label are just crap. if you put christ’s name to something it better be good. ccm could learn from this, in my opinion.
anyway…
re: the 4th - i went to a local show in the town where we live - it was nice, but it wasn’t like i remember. memories like that are priceless (and poetic as you said).
thanks for hanging out with us on saturday. you’re a stand up guy and we always enjoy seeing you.
-j
Posted by joshua on July 11, 2006 at 12:33 PM
It was awesome seeing both you and Rebecca as well. I’ll definitely have to make a trip up there sometime when work calms down and bug you guys.
Posted by Jamie on July 11, 2006 at 08:18 PM