Category > PHP

All the Little Pieces, or TextIterator in PHP 6

13 July 2006 » In PHP » 11 Comments

I have been working on the Unicode support in PHP for quite a while now and I figure that it is time to start talking about Unicode and I18N in general and specifically about some of the new features that PHP 6 will be bringing to the table.
First up is the new Swiss-army knife-like TextIterator class. The purpose of this class is to provide access to various text units in a generic fashion. Actually, I lied. TextIterator implements ICU‘s full boundary analysis API, so what it really gives you are the boundaries between the text units. A slight distinction, but well worth remembering. And what are these units, might you ask?

  • codepoints
  • combining sequences
  • characters (slightly different than combining sequences)
  • words
  • line breaks
  • sentences

As its name tells you, TextIterator also implements PHP’s Iterator interface and thus can be used in such constructs as foreach(). As a quick example, let’s go through a string and extract all words contained in it (skipping empty pieces). Using foreach() it is as simple as:


$str = "The quick brown fox jumped over the lazy dog.";
foreach (new
TextIterator($str, TextIterator::WORD)
as
$num => $word) {
if (
$word[0] != " ") {
printf("%d. %s\n", $num, $word);
}
}


The result is:

0. The
2. quick
4. brown
6. fox
8. jumped
10. over
12. the
14. lazy
16. dog
17. .

Continue reading “All the Little Pieces, or TextIterator in PHP 6” »

Yahoo! Looking for PHP Talent

11 July 2006 » In PHP » No Comments

Yahoo Site Operations Group needs a top-class PHP developer. Here is the official job description:

Yahoos Site Operations Group is looking for a software engineer to build and support existing tools for the Operations groups. You will be responsible for the design, implementation and ongoing maintenance and operation of internal web-based applications targeted at an operations/service-engineering audience. If you thrive on fast-paced development, challenging projects, and being part of a fun and highly-skilled team, read on.
This position will require development of scalable database-driven web applications able to communicate with various backend systems via web services, direct database connections, etc. You should be comfortable with all aspects of the development cycle from requirements-gathering and specification design to implementation and ongoing development.
The ideal candidate will be comfortable working in a cross-functional environment as part of a team composed of project managers, senior engineers, database architects, tech writers, etc. You should be able to identify and fill gaps, find innovative solutions for design problems, work well independently with an eye for high-level objectives, and consistently deliver quality products in a timely fashion.
Required Qualifications
– 5+ years of industry experience building top quality web apps
– Proven expertise with PHP and MySQL
– Expert level UI skills (HTML, CSS, JavaScript)
– Knowledge of C/C++ is a big plus
– Experience with object oriented design and development (PHP/C++)
– Experience with data modeling and advanced query design, optimization, and benchmarking
– Web Services (REST, SOAP, XML_RPC, etc) experience
– Expertise in at least one Unix shell scripting language (bash, PHP CLI, Perl, etc)
– Understand software engineering life cycle, client/server application and Internet application architectures (TCP/IP, HTTP, etc)
– Significant experience with requirements analysis, design, coding, testing, documentation, and application maintenance
– Experience with Linux/Unix/BSD system administration and shell scripting, Apache, and basic database administration
– BS or MS in Computer Science
– Excellent self-motivating, multi-tasking, communication, and interpersonal skills

If that sounds like you, send me a resume and I’ll forward it to the hiring manager.

Sara joins Yahoo!

10 July 2006 » In PHP, Work » No Comments

This may be known to some of you already, but Sara Golemon, author of runkit, classkit, ssh2, and other PECL packages as well as a regular contributor to PHP core, has started at Yahoo! today. She’ll be working in the Search & Marketplace Group and will be a valuable addition to the team. Welcome, Sara!

PHP-GTK Book is Out

30 April 2006 » In Books, PHP » No Comments

Well, I certainly never imagined back when I was starting work on PHP-GTK that one day there would be a 400 page book about it. Pro PHP-GTK by Scott Mattocks is the first English language book on this topic and it is on the bookshelves, real and virtual, right now. I just wanted to say, kudos to Scott and congrats on his newborn as well. He’s very productive. 🙂

Good Old Times

18 April 2006 » In PHP » 9 Comments

I was browsing the MARC archives the other day and decide to see what my very first posting to any of the PHP lists was. It turned out to be this one on php-general list. And then shortly thereafter I posted on php-dev offering to help with … wait for it … PHP on Windows development. And here’s my first submitted bug, too. <tear up />.
Ah, good old times indeed.. Especially considering Zeev’s reply to me. 🙂

Notes from PHP Québec 2006

03 April 2006 » In Food, PHP, Talks » 1 Comment

I just got back from Montreal where I gave two talks at the PHP Québec conference: one on PHP 6 and Unicode and another on PHP-GTK 2. Both of my sessions were full and I got very positive comments from the attendees. I think I am getting close to figuring out the right proportions of theory, examples, and demos that should be present in a talk.
For PHP-GTK 2, I showed off a couple of apps that I quickly wrote a few days before and that make use of Yahoo! developer APIs. The first one lets you pick two airports and calculates the distance between them as well as showing the local maps and weather info. The second one uses Flickr API to display a continuous grid of latest images from flickr.com. These were about 100-200 lines of code total each, so, of course, Rasmus had to brand them as Pidgets.
The conference itself was well organized and attended and had a number of interesting talks. Kudos to Sylvan, Yann, and others for their efforts.
The post conference program for each day was full as well. On Thursday night we had a dinner for speakers and organizers at the always excellent À la Decouverte, a small and cozy restaurant with a big taste. I had marinated snails with mushrooms in garlic butter and phylo dough for appetizer, and ostrich medallions in blueberry sauce for main course, and both were delicious.
On Friday night we made a visit to the ever popular Les Deux Pierrots which is hard to describe to someone who’s never been there before. Two bands alternate on the stage and play anything from popular rock tunes (think Take Me Out) to French camping songs to something resembling a hoedown. The level of energy is amazing, and you can’t help being pulled into the manic foot-stomping/hand-clapping atmosphere. Great place to let off steam, basically.
And Saturday morning found us at the Sucrerie de la Montagne, a “sugar shack” outside Montreal that lets you take a peek into the process of obtaining and making maple syrup and also manages to feed hundreds of visitors an hour at the rustic wooden tables in its giant restaurant. The rule of thumb is, you have a big (> 1 liter) bottle of syrup on the table and it has to be gone by the end of the meal. So you put maple syrup on and into everything: bread, pea soup, omelette, sausages, meat pie, mashed potatoes, pancakes, and coffee. We almost managed to finish ours.
Pics should be coming up soon.

This Is Not "American Idol"

29 November 2005 » In PHP, Rants » 9 Comments

The latest round of discussions on the php-internals mailing list highlights something that has been a pet peeve of mine for a long time. As PHP became more and more popular, the number of people subscribed to the mailing list has grown as well, and lately this has resulted in a slew of interminable threads of will-crushing length. It seems that every time I open my mail reader, the counter next to “php-internals” blinks and jumps to over a 100. And roughly half, if not more, of the messages are, a) from people I have never heard about, and b) contain opinions, rants, and “votes” on fairly important issues, as in “I’m +2 on this namespace separator”.
A whole lot of these folks are under the impression that one can simply subscribe to the list, read discussions while lurking or semi-lurking, and start to vote on things that affect intimate parts of the language. That is… kind of gall-ish, if you ask me. I have lived in the United States for over 13 years, I pay all my taxes, I respect the law (except for occasional speeding), yet I still cannot vote in either federal or state elections. Whether it’s fair or not is debatable, but at least there is a vetting process in place that requires immigrants to fully adopt this country as their new home before being able to vote.
I appreciate the enthusiasm with which these people partake in the discussions, and I understand that they may have strong opinions on things that PHP does or does not do. However, in order to be taken seriously one has to have a certain amount of respect, experience, “karma” – call it what you will – and that has to be earned.
And how do you earn it? Through concrete participation, be it code contributions, documentation write-ups, bug triage, or just some good ideas that you design and promote in a respectful and polite manner. But to show up, issue forth proclamations on topics that you do not even necessarily understand, and assume that you can influence the course of development through sheer arrogance or grandiose rants is a misguided, if not brazen, attempt at “democracy”. And if your first email to the list ignores the customs and practices of the group, your subsequent ones are likely to be taken less than seriously. First impressions count, you know.
Why not just ignore posts like these, some would say? Because on average, the signal to noise ratio on php-internals is still pretty good, and there are occasional insightful posts from new people that I would like to read. But since they may be buried under an avalanche of superfluous messages, I have to take a deep breath and wade through until I find the worthy ones. And that takes time. Precious, precious time.
To sum up: make a difference, contribute something, think before you post, be polite, and try to consider that yours is not the only opinion out there, especially if you are new to the list.
Oh, if you are using a mail reader that screws up message threading, I will hunt you down and stuff you full of Perl internals until you look like a camel. I will go fucking ninja on you, and you will not see me coming.

PHP Developer's Meeting 2005

22 November 2005 » In PHP » 1 Comment

It’s been a while since there was a small, focused meeting for the purposes of working out the evolution of the next version of PHP. The last, and only, time was probably in January 2000 when Rasmus, Zeev, Andi, Stig, Sascha, Thies, Frank, myself, and a few others gathered in Tel Aviv to hash out PHP 4. You can see how young we looked back then.
Last week in Paris saw the second iteration of the PDM and this time the focus was on PHP 6. We had a very productive discussion over two days and Derick did a great job taking notes and writing up the report. It has been posted on the internals mailing list, and once 5.1 is out, I think we can concentrate on the implementation of PHP 6, which should be great.

PHP Quebec 2006 Note

18 November 2005 » In PHP, Talks » 2 Comments

I got the notice today that PHP Quebec 2006 committee has accepted two of my talk proposals: one about PHP 6 Unicode support and another about PHP-GTK 2. So, see you in Montreal in March!

All Bless PHP

29 September 2005 » In PHP » 22 Comments

Today’s issue of Wall Street Journal has an article by David Bank, “PHP Language Wins Supporters As Tool for Making Web Software: Alternative to Sun’s Java Is Adopted by Companies, Developers Like Andreessen”. On the whole, it plays up PHP and its success over the years, but contains several things that I could not help but talk about here. I hope WSJ doesn’t mind if I quote a few sentences.

Back when the Web was young, Marc Andreessen, then the wunderkind co-founder of Netscape Communications Inc., gave his backing to a new software programming language from Sun Microsystems Inc. That blessing launched the Java language as a counterweight to Microsoft Corp.’s technology dominance. A decade later, Mr. Andreessen is endorsing another programming language called PHP as an alternative to Java for creating a new generation of Internet software.

I like Marc. He’s a bright guy who did a lot for the Web by driving the development of NCSA and Netscape browsers and trying to fight Microsoft. But “blessing” and “endorsement”? I would really hope we’re past the point where intelligent developers — and would you want any other kind — are swayed by a celebrity endorsement that tells them what programming language they should use. I think PHP’s record speaks for itself, and hardly needs any “blessing”. My guess is that this is a marketing maneuver designed to capitalize on the recent news of Marc joining Zend’s board of directors.

“When it comes to the Web and Web applications, Java is not the right language,” Mr. Andreessen says.

Indubitably so.

But he adds: “[..] PHP is to 2005 what Java was to 1995.”

If that means that all of a sudden there are hundreds of half-assed books written by people suffering from what can only be called delusions of self-grandeur and whose only skill is the ability to copy-and-paste text from the online manual, no, thank you. If that also heralds the day that I see thousands of job postings asking for overpaid and underqualified PHP consultants with “10 years of experience” who don’t know their 404 from 403 and whose highest qualification is building a personal guestbook, I can live without that too. Although, maybe it’s already happening..

Zend, originally based in Israel, includes two of the leaders of the open-source PHP effort, Andi Gutmans and Zeev Suraski, who took over the project from Rasmus Lerdorf, who released the first version in 1995.

That’s just plain wrong. Rasmus didn’t hand off the project to Zend, but to the open source community that Zend and Andi are part of. Keep your facts straight, WSJ.

IBM has assigned 20 engineers to PHP and is particularly focused on improving the technology’s security, considered a weak point.

These must be phenomenally stealthy engineers, sneaking onto our CVS server and planting in the bug fixes under the cover of the night. Because that’s the first that I have heard of 20 IBM engineers working on PHP, and the article makes it sound like they are engaged in it full-time. What are they producing exactly? Maybe I’m senile, but other PHP developers, such as Edin and Ilia, confirmed that there has not been a single official security patch from IBM. The only regular contributor from IBM that I know if is Dan Scott, and he himself acknowledges that he only spends about 10% of his time on PHP-related stuff. If I am incorrect, then I would invite IBM to share with the PHP community all the work that these engineers have been producing.
I don’t know who David Bank interviewed for this story exactly — aside from Zend folks, Marc, and Rod Smith — but next time he should include a couple more relevant people, like, oh, say, Rasmus. It’s only fair. Me, I’m going to listen to a song from 1995.