Nola Stowe's blog

Book review: Beginning Ajax with PHP by Lee Babin

Book Review
Apress: Beginning Ajax with PHP by Lee Babin

Book Site | Sample Chapter: 3 PHP and Ajax | Table of Contents

Although no stranger to Ajax, I received a review copy of Beginning Ajax with PHP expecting some watered down presentation of Javascript with some PHP thrown in. I was quite surprised to find a good presentation of using Ajax and PHP, easy enough for the beginner and still interesting for those who have done it for years.

The book starts out exactly how I would write it -- SIMPLE! The first time I did Ajax with XHR (xml http request), I used a plain text file, which I then read into a DIV at the click of a link. This takes a similar approach and has data stored in an array which is then accessed with a simple call to a PHP file. The following chapter, takes it a step further and this building upon previous chapters is a common theme in the book.

Book Review: PHP Hacks

Book Review: PHP Hacks by Jack D. Herrington, published by O'Reilly

I had borrowed a Perl Hacks book from and friend and really liked it, it was great! It had a lot of practical things as well as some fun things. I expected the same from PHP Hacks and I was not disappointed!

Here’s the table of contents: http://www.oreilly.com/catalog/phphks/toc.html

O’Reilly also has some sample hacks: http://www.oreilly.com/catalog/phphks/chapter/index.html

Here's some that I found interesting:

The Practical Stuff

Breadcrumbs
Not familiar with the term? Check it out. I think this hack may get you started on a breadcrumb function/method. In the end they suggest a xml file to show which page urls were parents of which. The way I've done this before was I had a class for each major section, and sub section, and had a method ->addCrumb($label, $url) which I had in the constructor…and the subsections of course would call the parent contructor and it kept the breadcrumb hierarchy intact. But hey, that’s the fun of programming - different ways to do the same thing to meet different needs! Definitely a good hack to get the juices flowing!

Contest: The Technology Person Who Has Had The Biggest Impact On Me

This is the third of the contest entires. Voting begins tonight at 5pm EST.

I wasn’t going to enter, because the person who probably has had the most impact so far on me is Keith Casey. Oh yeah what a kiss up!! You’re just writing this because he is running this site and you want to get on his good side! … no, I’m not writing this to win. I’m just writing about him because I would feel dishonest writing about anybody else.

I knew Keith from when we were teenagers. I would see him occasionally since those day, but we never talked too much and certainly not about programming! One day, I hear he is looking for PHP programmers. Hey, I do PHP. I dream in PHP. So I shoot him an email and I start working as a contractor for CaseySoftware.

The two years before this, however, I was sort of in a “programmer depression” where I didn’t even actually check my personal email at home. I didn’t do any consulting, no freelancing, no “talking” about coding with anyone. I was a lone developer working in an environment that was not very progressive.

I Spec, You Spec, We RSpec!

I love testing, I could hardly wait for this meeting of the Chicago Ruby Group. I was not disappointed. Unit tests are cool, but specs are awesome. Whats the difference you say? I think its a more natural way to write your tests, it makes you think of the behaviour of your object and not "oh gosh, I have to write 3 tests for each of my methods."

From PHP to Perl

In recent months I've been moving away from PHP, a language for which I have developed in for 6 years. I learned it because it was free instead of learning ASP. I made a website for my boyfriend so he could write articles about computer gaming hardware. I interned at a place and did PHP, and then moved to another company doing PHP.

I was pretty content with PHP ... until I saw Ruby first, then made friends with some Perl geeks, realized they weren't all arrogant l33t language snobs and took another look at Perl. Hey, its kind fun! PHP had become boring and Ruby and Perl gave me a new challenge. At first, I only read them thinking "how can I do this in PHP.." and managed to get my company where I did PHP to send me to YAPC. But after a time, I realized I didn't like PHP anymore and I wanted to do Perl or Ruby.

I've written a few articles on CodeSnipers on the differences between Ruby and PHP. I wrote one on datatypes in PHP vs Perl. Click on the Ruby topic on the side to find those articles.

Since I have been coerced into giving a 5 min talk at Perl meeting tonight about this.. Here's some of my thoughts in a blog...

Ruby on Rails makes nice with PearDB

Another exciting day in the life of a PHP -- > ROR programmer..

Last week I wrote about how Ruby could access a PHP session and how php site structure could fit inside a Rails structure. This week, I share my findings on how to get ActiveRecord to work with our existing PearDB sequence tables. These are my random, scattered meanderings on a solution..

If you haven't used Pear's DB class before, it creates a table with the [tablename]_seq for each table and stores a single row with a single column "id" with the value of the last ID used. Example of use. This was designed so that your code could easily port to other databases that didn’t have autoincrement like MySQL. Whether this is a good practice is not up for debate, I have what I have :)

Ruby on Rails makes nice with PHP

Not all projects can jump ship from a home grown PHP site to Rails, especially projects where there are exactly 1.3 programmers for the project. I was surprised there wasn't much information on integrating php and rails site (spare me the flame wars). All new development will be done in Rails and old PHP will be written in Rails as time permits. I was exploring some of the ways that this could be possible and what possible problems might arise.

Sessions
I will need to read certain sessions variables from PHP into Rails, I will not need to write to the session. I found a ruby script PHP Serialize which takes a php serialized string and converts it to a Ruby datatype. If your sessions are stored as files, they are in /tmp/sess_[session id] where session id stored in $PHPSESSID they contain a special serialized string. Ruby can get the session id from the cookie and read the file, and PHP Serialize will convert it into an object. If your sessions are stored in a database, then of course you'll be able to create a Rails model to access it. If you need to write to a php session, then I think it would be better this way. I didn't try using sessions stored in a database, because I use files. I’m not sure how you would do it stored in memory. In any case, reading from the session file I believe is a temporary hack at best.

Perl & HTML Generation

There are probably vast amounts of documentation and tutorials about the Perl CGI Module but readers of this site who are not Perl programmers probably won't go out on a whim and read about this interesting module. Even a PHP programmer might get inspired ...

CGI.pm is a "Simple Common Gateway Interface Class." I'm still learning myself how to use it, so I'll share what I know..

CGI can be used with two types of programming styles, functional and OOP. So far I've only used the functional.

Include the module with

use CGI qw/:standard/;

Here I'm bringing the "standard" set of functions into my scope. From my limited understanding thus far, the qw thingy delcares what to "export" into the local scope. Anyways, thats what I'm going on now until I become reach monkhood and earn my Camel Pin.

As always when learning something new, I start Uber Simple. Inspired by a exercise in Practical Perl Programing, I created a form that will take hourly rate, hours, overtime and spit out the salary.

YAPC - NA 2006

Registration is open for the YAPC: NA 2006 being held in Chicago June 26, 27, and 28th.

Chicago.pm is proud to announce that registration is open for Yet Another Perl Conference North America (YAPC::NA) 2006. The primary conference will occur June 26th through 28th at the Illinois Institute of Technology in Chicago, Illinois. The conference will feature speakers from throughout the Perl community, as well as, keynote addresses from luminaries such as Larry Wall, the creator of Perl, and guest speakers from the broader dynamic languages and open source communities. The full three-day conference costs only $100, but early registrants can take advantage of a 15% discount and attend the conference for only $85. With such a low cost, YAPC is one of the most affordable and accessible technical conferences available today.

In addition to the conference, three open courses will be offered on June 29th and 30th. These courses are taught by some of the most notable Perl instructors: brian d foy, Randal Schwartz, and Damian Conway. The courses will all run simultaneously during the two days after the conference. Conference attendance is not required when signing up for classes, but it is encouraged.

Micro ISV: From Vision to Reality, Bob Walsh interview on PerlCast.com

PerlCast is not just about Perl! Josh McAdams interviews Bob Walsh, author of the book Micro ISV: From Vision to Reality. In it he talks about the definition of a MicroISV, gives advice on starting, marketing and dealing with hostile customers among many other topics.

For a chance to win a copy of the book, see the PerlCast site for instructions on how to enter AND see a transcript of the interview.

Links

If you are not familar with PodCasts, they are simply mp3 files you can play on your PC or any portable device, they are not just for iPods! A transcript is available on the site if you prefer not to listen.