PHP SQL Tokenizer and Parser Class

by justin on 16/10/08
PHPCoffee Break Code - Quick ExamplesI like to use a pagination class I wrote for lots of projects, it takes a sql query, and some configuration options, and puts together a flexy compatible paged data grid. It's handy as hell and makes my life simple. Someday I'd like to merge it and an ajax enabled version into one class and release it but for now I am just writing about the sql tokenizer component.

I couldn't find a sql tokenizer for php, or a parser of any kind.  If there's one out there that I didn't see hopefully someone will let me know.

CakePHP Behind a Reverse Proxy

by justin on 25/09/08
PHPI was asked to assist with the support of a website that uses CakePHP.  After tweaking the vhost entry and path config the site displayed as expected, but users were not able to logon.  "Authentication failed." was displayed when an invalid logon was used, but nothing happened when the correct credentials were passed.

Searching for information on Google yielded very little help, except one thread that discussed cake's security level settings.  I modified those settings (CAKE_SECURITY) by updating the app config's settings for Security.level in the code.  This did not make any difference.  Authentication was still not working, and the session was invalid.

Direct2Drive Fail

by justin on 22/09/08
Last week, Warhammer Online went gold, and I thought I'd give it a try.  A friend of mine was playing it and I wanted to join him while everyone was low level and the game was new.  So Friday evening I tried to obtain the game using Direct2Drive.  It was a failfest.

They declined my transaction, and their faq stated that I should check my account balance, and maybe call my bank.  So, I called my credit card company, they confirmed that my account was in good standing. They also let me know that no charges had been attempted in the last 24 hours. No authorization attempts were sent by direct2drive. The #@!$?

Zend Debugger Crash from IE

by justin on 18/09/08
PHPI'm still trying to figure out the root cause of all this. But I will explain a workaround until then.

Problem: Apache crash / restart when accessing any local php app/site. Environment: WAMP install ZendDebugger.dll enabled via the ini.

Google Maps and Directions, REST Interface?

by justin on 12/08/08
I'm looking into Google Map's Mobile API and it's RESTful interface.  I don't know if it's supported at all, it may even be against the TOS or TOU.  I do know it's not documented by Google at all. Why use it instead of the API they already supply?  The simple answer is, their GDirections API doesn't support all of the features you can access over the REST interface used by the mobile API.  These features include Walking directions, Highway or Non-Highway directions, and an option to avoid tolls.  The other obvious benefit is the ability to write server side code and avoid JavaScript all together.  Click read more to see example code.

PHP open_basedir Performance Benchmark

by justin on 28/07/08
PHPI noticed a much slower response time from a website I'm working on once I setup open_basedir in my php.ini so I decided to run some benchmarks. It seems like a generic page with several includes ( templates, etc ) takes 4x as long (0.15531941822597 off, 0.64727306365967 on)   to return with open_basedir on.  Sure there's going to be overhead, but I was surprised to go from 6 or 7 requests per second down to 2 just by enabling this.

So safe_mode sucks, and open_basedir is painful. Awesome.

More Cables

by justin on 28/07/08
I had ordered 6ft cables, and I guess I needed 10ft ones.  I went ahead and ordered 3 10ft, 1 15ft, a new set of 12ft rca's and 2 TOSlink cables while I was at it, might as well save on shipping right?  I think everything will arrive Wednesday so I can finish wiring up the living room and get stuff off the floor and chair they're currently on. I can't say enough praise for monoprice.com, good products, fast, cheap. 

Once these arrive I think I'll finally be done with everything house-related for a couple weeks!

PHP and PHAR

by justin on 24/07/08
This is just a simple guide for installing, configuring, and testing PHAR on Windows. Once everything is setup I will be benchmarking it.

Internet Tablet

by justin on 22/07/08
I decided I wanted a tablet PC to hang on my wall and display a Google calendar, and perhaps a few other custom pages I would write that could interface to a gallery app, etc.  Requirements were: Thin and runs a browser, and not much else.  I found some tablets on Ebay that looked like they might work.   The idea is simple, a website will handle multi-user calendars, allowing friends and family to submit events to my calendar via sms, email, or a web page.  The touch panel which would be on the wall in my kitchen would display my calendar and reminders, so I can throw away my paper calendar and stop writing things down everywhere.

But look at this on TechCrunch. Sweet Jesus. It's almost like they read my mind. 

HDMI Cables

by justin on 21/07/08
So you're standing in line at big box retail, and they want to sell you these high quality cables, they're called HDMI and the sales person seems to insist that they're the best for the TV you've purchased. What do you do? Tell them no thanks, tell them you're not spending $30 - $140 for a $5 cable.  Go home with your TV and buy your HDMI cables from monoprice.com instead. They're great cables and there is no difference in picture quality. HDMI cables carry digital content, 1s and 0s, and they either get to their destination or they don't, there's no "better", there's no fancier way to say 1 or 0.   Anyone that tells you any different is a fool or trying to sell you something you don't need.

Home Sweet Home

by justin on 21/07/08
I closed on my house on the 15th in the evening. Steve Hill was my Realtor and he was wonderful.  I would recommend him to anyone looking to buy or sell a home, he really made the process easy on me, even when there were delays from the sellers, etc.  Steve if you read this, thanks again!

PETA Photos Flickr'd

by justin on 06/06/08
I just hit the upload button on Flickr Uploader, they'll take awhile because there are a lot of them.  Some of these pictures my friend Matt took, especially the ones I'm actually in.  Can you find my least favorite picture? Matt's good at bad candids ha ha. No really, I had fun that day, was neat seeing so many people showing up with their various meats.  This kind of stuff makes me smirk, do you think the PETA organizers realize they actually caused more beef and pork to be consumed that day?

I watched Fox news that night, they had about 2 minutes of coverage. Connie Randi was there , she was explaining their goal for the event.  Quote: "We figured if we put it with a person, they would understand it, they could see that, they don't understand meat being wrapped but maybe they'd understand with a person.". Look lady, I've been on the slaughter floor, I know it's flesh, I know  it's delicious.  I'm pretty sure everyone everywhere understands where meat comes from.  I've watched the hides come off, they slice up real nice.

Anyways, here are the photos.

Murder is Delicious

by justin on 05/06/08

Since I'm an Iowa farm boy at heart, I will never understand why anyone wouldn't want to have some delicious beef or pork.

I could not pass up the opportunity to see a "Naked PETA Protest".  My buddy Matt and I went downtown around 3pm for lunch. I had my delectable Arby's Big Roast Beef sandwich while I was there.  It was even tastier than I remembered them being. There were several others that had the same idea, some were wearing their burger king hats.

I'll post the rest of the pictures later tonight but here's the fun shots.


 

p.s. - No-one was naked.

Summer of Code has begun.

by justin on 27/05/08
May 27th, 2008 and my GSoC student just checked in, he's working on his environment and researching the different mapping APIs along with some PHP examples and JavaScript.

Everything is "right on schedule".

Zombiephone - Back from the Dead

by justin on 22/05/08

After my phone washing, I took out the battery and ran a hair dryer on it for a few hours. It didn't want to work at all, so I put it away and planned on getting a new one. I found one of my spare batteries and put it in, hooked up the charger, and BINGO, phone came back to life, though a little less than perfect. I can't make calls ( I can receive and hear but not talk ), but data works, and most importantly, my contacts were safe!

So, if you're trying to call and I don't answer you know why, it rings and I don't pick up.

I'm really amazed at the PPC-6700 and it's durability. It's been dropped, run over and dismantled, washed in a washing machine, dried for a bit, and still functions to some degree.

Twitter "Source" Activated

by justin on 14/05/08
Just got an email from the twitter folks, they've activated the source tag for my Geeklog plugin, so this is a test. I need to wrap it up and make it available for download this week, but I've had 0 free time.

Phone is Dead

by justin on 12/05/08
When I got home from work I found my PPC-6700 to be dead.  It seems it was a drowning victim, forgotten in a sea of pants put through a spin cycle by my oh so helpful girlfriend.  It's so dead it won't even flicker on anymore.  I have it sitting in a box with a hair dryer on it as I write this, but I don't think there is any saving it. 130 or so contacts lost, that's the real kick in the pants. Just a note: Sprint doesn't offer "contacts backup" services like some other carriers, or so I was told about a couple months ago when my phone was run over on the highway and survived somehow. 

So I guess I'm stuck, I hate the PPC-6800, the "Mogul", basically every other phone sprint offers, I hate.  I am not an iPhone fan, and Sony's uber-bar isn't out yet.  I think I'll cut my services back to basic no-data and buy a cheap "phone phone" for now.

Very Simple Twitter Examples

by justin on 10/05/08
PHPBoth Twitter and TinyURL are very easy to talk to using PHP. I've tossed together a few quick PHP examples to demonstrate the basics of connecting to twitter and posting tweets.  TinyURL's API is actually just a HTTP GET.  Combining the two makes a great way to attach script monitors to services, rss feeds, blog postings, etc. 

30 Days of Wii Fit

by justin on 09/05/08
Ryan Block over at Engadget has decided to do 30 days of Wii Fit, 7 days a week for 20 minutes a day. I wonder if he'll see any results. I would guess not a lot, since he's not what I would call "a huge fatty" by any means. I'm guessing someone that weighed 250+ with a mostly sedentary lifestyle might be surprised by the improvement and have fun doing it.

Read the full story here.

Geeklog Portal Block Bug Fix

by justin on 09/05/08
If you're running the latest stable Geeklog and find your RSS feeds are not working for Portal Blocks, you may need to make a one-line fix until the next release. If you see a message that states "There was a problem reading this feed (see error.log for details)" and your log looks like this:


<timestamp>  - Unable to aquire feed reader for <url>
<timestamp>  - HTTP Fetch Failed  _decodeGzip(): data CRC check failed


Then you can change one line in system/pear/HTTP/Request.php to fix it.