Wherein I occasionally rant on various topics including, but not limited to, PHP, Music, and whatever other Topics I find interesting at the moment, including my brain tumor surgery of August 2010.

Friday, October 30, 2009

PHP, Frames, and Sessions

Any time you try to use frames and PHP sessions, you are likely to run into trouble.

It's basically a race condition just waiting to blow up in your face:

1. Frame A sends HTTP request, with no session Cookie
2. PHP/server processes request, with no session Cookie, so creates NEW session
3. Frame B sends HTTP request, with no session Cookie
4. Frame A receives response, with session Cookie from Step 2.
5. PHP/server processes request, with no session Cookie, so creates NEW session
6. Frame B receives response, with different session Cookie from Step 5.

See Step 4 the browser *gets* the cookie it needed in step 3 for there to be just ONE session?

Your best bet is to initialize the session in a frame-less landing page, and then move forward with frames. Once the user has the session Cookie, all the frames can "share" it.

You'll have to redirect a session-less user to that frame-less page and back again, however, which uses up a lot of HTTP connections, and so is resource-intensive.

Note that Frame A and Frame B steps could actually interleave in ANY order, really. Each request is completely independent of the other.

And *some* orderings are actually going to "work", so you may not find this bug until your server gets busy enough that HTTP requests/responses start to lag a little bit.

Tuesday, October 27, 2009

Tethercommute

Being in the job market, I'd like to make a modest proposal to HR and recruiters:

Please label jobs where telecommute has geographical restrictions such as "same city" as "tethercommute".

I realize, of course, that coining such a term is no guarantee that it will be accepted in wide usage, but I doubt that anybody is going to misinterpret it.

Thanks.

Monday, October 26, 2009

Dear Sprint; Please update your time servers.

As you may know, I hate daylight savings. It doesn't save anything anymore, if it ever did.

And it's a royal pain.

It's particularly painful to me, since my cell phone is my alarm clock.

And apparently, Sprint / Nextel has still not clued in to the fact that the
United States Congress has changed the dates on which clocks are changed

It is particularly irksome, since I have duly informed Sprint / Nextel of this fact twice a year, every year, since 2007.

Yes, I know I could change the option to take my cell phone off of network server time, and rely on its internal time clock. Unfortunately, the cell phone then lags a minute or two eventually, since it is not synched with a reliable time source.

For $100+ a month, Sprint can find somebody with a clue to update the time zone data on their time servers!

If anybody reads this post and has any contacts at Sprint that can resolve this, please feel free to contact me.

Wednesday, June 03, 2009

Facebook Performance

I've been logging calls to Facebook API servers in my DEV environment for some weeks now.

I'm pretty disappointed by the performance, overall:
Facebook API Call Performance Stats

I realize Facebook has scalability issues beyond my ken, but they also have resources beyond my ken as well...

Facebook doesn't wait over 4 seconds for my server; Surely I shouldn't have to wait 30 seconds for theirs! :-)

In fact, it's kind of pointless in the context of a canvas page for their servers to bother to respond at all after 4 seconds...

User --A--> Facebook server request canvas page --B--> Request to my server --C--> API Call to Facebook server.

If C can detect that we are in the context of a canvas page, and Facebook already knows that B will not wait more than X seconds, they might as well issue an HTTP 408 Request Timeout or something similar after X seconds, because there's no real point in them giving me the info they aren't going to wait for...

I went ahead and created a Feature Request in Facebook's Bugzilla. You can vote for it if you think it will help you.
#5528

Thursday, May 14, 2009

svn diff in vim

In the category of "How did I live without this?!" tools, I'm late to the party with this vim plugin from Brian Shire of Facebook / APC / PHP fame:



If you use svn, git, cvs or similar, this plugin shows you a "diff" in vim.

I don't know how often I quit vi or open another shell just to do a diff.

Now, I don't have to!

Saturday, February 14, 2009

Lumni I Likovski, Cook County Assessor's Office

ADVERTISEMENT: Hire Me



So the other day, I had to go down and file for a home owner's exemption on my house.

I got my little queue ticket #96. They were calling out #32, with 5 or 6 workstations.

I had a half hour, max, to get this done, before I had to be elsewhere.

This did not look good...

Thank God for Lumni I. Likovski, Manager, Taxpayer Exemptions.

He was out in the waiting area, checking for people who didn't need a full-blown computer workstation (such as myself) and doing "triage" to get us the forms we needed, get our questions answered, and get us out of there.

He even cheerfully (and I stress cheerfully) photocopied my Driver's License for me, a requirement to hand in the form.

It's not often in this day and age that you get excellent service/help like this, most especially from government staff.

So I'm dedicating this blog post to LUMNI I LIKOVSKI down that at Cook County. I owe you a beer!

PS
I tried to just send in a comment to his boss using their online form, but it blows up like this, every time I try to submit it:

Database Results Error
Description: The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
Number: -2147217913 (0x80040E07)
Source: Microsoft OLE DB Provider for SQL Server


Maybe they should hire me to re-do their website? :-)