oci_bind_by_name maxlength is not so optional

May 6th, 2008 by Harun Yayli | 4 Comments »

If you think that the maxlength parameter in the documentation of oci_bind_by_name is optional, see this example and think again.
Lets say you have your column names in an array already and you want to bind them in a loop smartly.
Read more…

Is Sun going to buy PHP too?(PHP Quebec 2008)

March 14th, 2008 by Harun Yayli | 6 Comments »

It was good 2 days at PHP Quebec Conf here in Montreal.

A lot of great sessions!!!!
My highlights:
- Great session by Eli White – High Performance PHP & MySQL.
- Really nice 2 sessions by Marc Wandschneider (The I18N and memcached sessions)
Some sessions I’ve attended were really really bad. I’m not going to name names :P
But overall, I guess it was worth taking 2 days from work and going to the php conf.

Here is the part about Sun and PHP:
Read more…

PHP APC apc_shm_create error on CLI

March 11th, 2008 by Harun Yayli | 3 Comments »

If you’re getting an error like this one below on Windows PHP commandline make sure that you are not running an apache server that uses apc on the same machine!

[apc-error] apc_shm_create: shmget(0, 8388608, 658) failed: No error. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment.

This was hard to figure! Tested with PHP 5.2.5, APC 3.1.0-dev.

Facebook’s Buggy Spam Detection

February 29th, 2008 by Harun Yayli | No Comments »

Oh my! I’ve heard people getting kicked out of Facebook because they were sending too much messages and facebook considered them as spamming.
One last thing is added to the pile. Now they are claiming the reader of a message is spamming people.
Oh boy, it is funny.
I’ve logged into Facebook and saw I’ve received a message. I clicked the message and boom! There is a red box saying I’m spamming people with messages and I’ll be blocked soon if I continue this.
Wait a minute! I’m not the one writing the message I’m reading it.
So as a responsible geek, I’ve send a message to Facebook and here is the result:

From: Facebook ([edited])
To: [edited]
Subject: Messages Help: bug in spam detection

Hello,
I clicked on the inbox to see a message that is coming to me. I clicked the message to read it (t=[edited])
I’ve received a box saying, I’m spamming.
You’re algo is buggy. I’m not sending messages, I’m reading a spam.
FYI

Answer:

Facebook Support [edited] wrote:
Hi Harun,

We are aware of the problem that you described and hope to resolve it as soon as possible. Sorry for any inconvenience. Let me know if you have any further questions.

Thanks for contacting Facebook,
James
User Operations
Facebook

Well at least they know that somebody made a booboo. Or not?

Test your PHP Facebook. I’m sure you have bugs in detecting the spam as well.

Is it Firefox or Zend Debugger? Cookie Standards

February 20th, 2008 by Harun Yayli | 1 Comment »

I’m frequently using Zend Debugger and recenlty it started not working with firefox so I decided to investigate. It still works with IE7 and Opera so it was weird to see Firefox being broken with the recent update (2.0.0.12).

When Zend Debugger starts, it sets a cookie on the browser, so when the request passes through the Debugger, it’s caught. Simple enough.

See the cookie that is set by Zend Debugger:
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/ ZendDebuggerCookie=192.168.33.87%2C127.0.0.1%3A10000%3A0||084|77742D65|0; path=/ SESSdd12cedd715988d11c29f14605e8aa57=rfem27em2jsn3l9ipusujaava2; path=/; domain=.127.0.0.1
Nothing looks weird to me…
But when firefox does a second request it returns only the cookies below:

Cookie: ZDEDebuggerPresent=php,phtml,php3; SESSdd12cedd715988d11c29f14605e8aa57=rfem27em2jsn3l9ipusujaava2

What happened to ZendDebuggerCookie? The little firefox ate it?
Plain weird.

ezComponents ready for prod?

February 11th, 2008 by Harun Yayli | 2 Comments »

I’m following what ezComponents doing for sometime now.
Quite nice framework for whatever you need.
I gave a try to write a mysql schema sync.
Real easy to write. only 4-5 lines of code to sync schemas.
It would have been great if it was actually working. The outout sql ddl is not runnable in some cases (syntax errors). Or the order of the columns are different.
I’m sure they’ll fix it soon but this tells me they are not yet ready for production quality.

See the code below, maybe I’m doing something wrong.
Read more…

You Used PHP to Write WHAT?!

February 1st, 2008 by Harun Yayli | 5 Comments »

There is an article on PHP on CIO, bashing it a bit.

PHP may be the most popular Web scripting language in the world. But despite a large collection of nails, not every tool is a hammer. So when should it be used, and when would another dynamic programming language be a better choice? We identify its strengths and weaknesses.

For the ones, who doesn’t know about CIO, their target audience is managerial. not developers.
So potentially reader will be your manager and they’ll get this info as a reference.
I’m copy/pasting some parts of it for your convenience. Let’s assume your manager does not know about PHP (I hope not) and you’re about to convince him/her to use PHP on a project. What whould he/she think after reading this?

When should you use PHP?

  • Creating an intranet site.
  • Prototyping an application that will be converted to Java or some other language.
  • Creating a Web database application.
  • Deploying an inexpensive or quick solution.
  • Using ready-made apps from Sourceforge.net or other sites.

In general you should not use PHP:

  • Where data security is of high importance.
  • In Shell or automated scripted applications.
  • In enterprise applications where scalability takes higher precedence than economy.

What a short sight!?!? Kenneth Hess the author of the article, is also the new “On The Desktop” columnist for Linux Magazine. Honestly, I would not really expect these claims from Ken Hess.

Please share your comment.

Link: You Used PHP to Write WHAT?!

CPM and Ajax (a.k.a New Metrics)

January 27th, 2008 by Harun Yayli | No Comments »

I was trying not to write about facebook but it came to a point that it’s a good example for my post.

Classic web advertising for banners (in some cases text links) are still paid by impressions. Like the banners on the left column of Facebook pages, everytime user changes a page, an ad is shown, and the advertiser is charged per 1000 impressions. Everybody knows that there is nothing interesting with this.

Facebook, some weeks ago has changed their photo gallery to an ajax photo gallery.
Everytime you see a photo and start browsing to the other photos, without refreshing the page, an Ajax call was done and new photo was shown on the very same page. There was no refresh, therefore the rest of the page -as well as the banner on the left- were not changed.

Facebook recently switched back to their old way. One photo is 1 page view again. I wondered why? It was really obvious. They’ve lost major page views with just this change. On the old system, people were rapidly viewing photos spending (in most cases) no more than 15 seconds per photo. For an album of 20 photos, it was an easily generated 20 page views for them. New system, slowed down the page views but now the users were spending more time on the same page with the same banner. Still with the old metric, 1 page view for 20 photos.
Read more…

Where are you Rasmus?

January 24th, 2008 by Harun Yayli | 2 Comments »

I’ve just finish checking this years roster for PHP Quebec Conference 2008.
The list is quite good. Lots of interesting sessions, some not-so-really-php sessions. But this year, there is no Rasmus :(
I’ve always found him interesting to listen to and inspiring. It’s quite interesting to see what challenges he’s seeing at Yahoo.
Between the lines, he gives a lot of tips. Is it just me who likes him talking ? :P
I’m sorry that he’ll not be in Montreal this year. Maybe he didn’t like the food last year lol.

Look ma! Mysql Federation sucks!

January 20th, 2008 by Harun Yayli | 4 Comments »

I was trying to explore alternatives for slave/master architectures and gave a try to federated tables.

No this post is not about Sun buying mySql.

Read more…