Larry Ullman's Blog, page 5

December 31, 2013

Chapter 19 of “The Yii Book” on the Horizon

I wanted to wait on saying something until the chapter was on its way to the tech editors, but it’s the end of the year and the chapter is close enough to being done that I can offer an update now. My wife and kids went away to visit friends for a couple of days, and I stayed home to work, spending the vast majority of my time on “The Yii Book“. Not only did I make pretty good progress on Chapter 19, but I got my Yii book mojo back (in terms of being in the flow and mindset), which is just as important.


Chapter 19, “Extending Yii,” is around 30 pages long it looks like. I start by covering the fundamental concepts, such as general guidelines, structuring extensions, and publishing assets (i.e., copying CSS, JavaScript, and other media from an extension directory to the assets directory). Then I walk through the various types of extensions, explaining the key components of each type: the class it’s based on, minimum requirements (e.g., mandatory methods), and how to make the extension configurable.


After that, there are a few more examples, both walking through existing extensions written by others and new examples for the book. The focus isn’t so much on the chapter outputting finished extensions as it is on explaining the thought and development process. I just now finished the widgets discussion, which I think turned out well. The last thing I need to do is finish up the module section.


The chapter ends with a quick coverage of deploying extensions.


So…I need to finish up the module discussion, take the images, proofread it one more time, and then it’s off to the technical editors. Once I get their feedback, I’ll finally (finally!) post an update. And I’m back on the horse, so to speak, which is a very good thing.


Happy holidays and best wishes to you and yours!

 •  0 comments  •  flag
Share on Twitter
Published on December 31, 2013 08:43

December 16, 2013

Speaking About Stripe at the eCommerce Web Summit

On January 30th, 2013, I’ll be presenting “Using, and Learning From, Stripe“, at the online eCommerce Web Summit. This is one of several conferences put together by the awesome folks behind php[architect]. Mine is one of four presentations that are part of this online e-commerce conference:



eCommerce Content Management – Patrick Schwisow
Using, and Learning From, Stripe – Larry Ullman
PHP eCommerce Evolution: Then, Now, the Future – Ben Marks
A Service Architecture Approach to Ecommerce – Luke Stokes

Tickets start at $39 for the recording only, and $49 for the live (online) attendance. And you will be able to ask questions during the live presentation!


There are two thrusts to my specific presentation. About two-thirds of the content will explain how to use Stripe to accept payments online. I’ll cover both one-time charges and recurring billing. Along the way, I’ll emphasize best practices and any applicable tips and tricks.


In the last third of the presentation, I’ll share some of the things I’ve learned in my few months at Stripe. I’ve organized the ideas into three categories: technical, structural, and personal. The technical and structural lessons are intended to help you design your product and run your business. The personal lessons are my way of sharing what it’s been like to work for an organization of Stripe’s calibre, with such amazing coworkers.


I think it’ll be a great afternoon of online e-commerce talks, and I hope you’ll consider joining in. Let me know if you have any specific questions or thoughts about it.

 •  0 comments  •  flag
Share on Twitter
Published on December 16, 2013 07:32

December 2, 2013

An Apology, an Explanation, and a Plan

You may have noticed, and possibly found yourself quite frustrated by, the fact that I have not updated “The Yii Book” in quite some time. Once again (once again!) my sincerest apologies for the delay. I have not been as productive on “The Yii Book”, or as communicative, as of late as I would have liked, or as you certainly deserve. Though a lack of updates or information conveys nothing to you, “The Yii Book” has been constantly at the forefront of my mind, and no one wants it to be done more than I. I know that progress has been somewhere between slow and terrible, and while there are reasons, I don’t want to make excuses. Basically it’s been a ton of work, and life is complicated. I can see how it could seem from the outside that I’m not prioritizing “The Yii Book”, but it’s on my mind constantly, I’m well aware of how poorly I’ve done (in terms of the schedule), and I really am making decisions towards the goal of finishing it. On that note…


Some of you may also have noticed that I’ve just completed a different book: the second edition of my “Effortless E-commerce with PHP and MySQL”. What happened there? Well, first, I was contractually obligated to write that book, and write it by a very hard deadline. “Very hard” in the sense that if I didn’t complete it in time, the publisher could take the book away from me and have someone else write it. Second, revisions of books are infinitely easier to write than first editions, no matter the subject, so it was not a comparable amount of either time or work. And with a traditional publisher, there are other people doing work that I have to do all of when self-publishing. Third, and most importantly, when I originally set the deadline on the e-commerce book, I never imagined that “The Yii Book” would not be done by that point. Never. But clearly I’ve been atrocious at judging the amount of time and work “The Yii Book” requires all along. But the primary reason there have been no updates on “The Yii Book” as of late was due to this other book (and because life is complicated). So where does that leave “The Yii Book” today? I’ve got a multistep process to right this wrong and complete this book…


First, I’m going to extend the free updates phase on “The Yii Book” to two years from the time the 1.0 release is complete. If the first complete edition is done in X of 2014, then you’ll get free updates until X of 2016. That will include updates for Yii 2 (which, like “The Yii Book”, is taking longer than some would like) and anything else significant that comes along in that period. If Yii 3 comes out by X of 2016, I’ll update the book for Yii 3 for free (which, that won’t happen, but…).


Second, I’ve got a plan in place to get back to regular monthly updates, starting in December. There’s not that much left of the whole book, and really only maybe 4 chapters of what’s new material (as opposed to the chapters of examples). I was able to get a decent amount of writing done over the holidays, and while driving (well, while my wife was driving), so am “back on the horse” there and will return to monthly updates until the book is finished. I don’t want to estimate when that will be, as I’m quite clearly horrible at that, but it will be ASAP.


When I accepted the position at Stripe, I accepted it on a part-time basis so that I can continue to be a good husband and father and continue to support readers of my books. That includes both existing, traditionally-published books, and self-published books. Thus, I’ve already taken on fewer hours at Stripe to make time to write and help readers. If need be, I’ll take additional days off at Stripe in order to get regular updates out. I’m going to do what I have to to complete this book ASAP.


Third, since my having to complete the second edition of “Effortless E-commerce with PHP and MySQL” has impacted the schedule of “The Yii Book”, there’s a little something I can do there. I get 20 free copies of a traditionally-published book, which I normally give out in my newsletter or on social media. This time, I’ll set aside those 20 copies for owners of “The Yii Book”. I’ll cover shipping, too. I’ll set this up after I get an update out, but I imagine the process will work like this:



I’ll provide a way/place for you to indicate your interest in the e-commerce book.
At a certain point in time, I’ll randomly draw names from that pool.
The drawing will be weighted so that more copies are given to people that purchased “The Yii Book” earlier (i.e., those that have been waiting longest).

That’s my thinking there. As I said, I’ll create a system for this once I get the next update of “The Yii Book” out.


Once again, my apologies to you for the too-long delay, as of late and in general. This is not how I would have hoped progress on “The Yii Book” would have gone (although I think the book itself is good). And betraying your trust and good faith is absolutely the last thing I would want to do.


My thanks, as always, for your interest in “The Yii Book”, for your patience, and for just generally joining me on this little self-publishing experiment, that has turned into a saga.

 •  0 comments  •  flag
Share on Twitter
Published on December 02, 2013 07:42

November 25, 2013

“Effortless E-commerce with PHP and MySQL (2nd Edition)” Pages Online

I just posted a couple of support pages for the 2nd edition of my “Effortless E-commerce with PHP and MySQL” book. The main URL for the book is:


http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql-2nd-edition/


You can also view the table of contents here (which is probably what’s most interesting now):


http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql-2nd-edition/table-of-contents/


I highlighted what’s new in this edition in this blog post:


http://www.larryullman.com/2013/11/15/whats-new-in-the-2nd-edition-of-effortless-e-commerce-with-php-and-mysql/


And, if your interest is piqued, you can buy the book at Amazon for about $31!


Let me know if you have any questions and thanks for your interest!


(PS Spending all my available time on finishing “The Yii Book” from here on out.)

 •  0 comments  •  flag
Share on Twitter
Published on November 25, 2013 07:00

November 22, 2013

9 Ways to Make the Payment Process Easy for Online Customers (Link)

I recently came across an article titled “9 Ways to Make the Payment Process Easy for Online Customers“. The article describes nine best practices for e-commerce sites: what you should do to have the best possible conversion rate. I definitely stress most, if not all, of these points in my “Effortless E-commerce with PHP and MySQL” book, but they are policies and approaches worth repeating. If you do any kind of web development, and especially if you do e-commerce, give this quick article a read. The only thing the article leaves out is how to convince your client that you’re right when it comes to implementing these policies, especially the one about not requiring accounts to complete orders!

 •  0 comments  •  flag
Share on Twitter
Published on November 22, 2013 06:00

November 15, 2013

What’s New in the 2nd Edition of “Effortless E-commerce with PHP and MySQL”?

The second edition of my “Effortless E-commerce with PHP and MySQL” book is now at the printer, and the electronic version is already available. So, you may ask, what’s new in the 2nd edition? In this post, I’ll highlight additions and changes in the book, and in a subsequent post, I’ll put up the complete table of contents. (And, in the interim, I’ll be working to finish up another book that just won’t end!)



The book’s first edition was broadly organized like so:



Part 1, Fundamentals
Part 2, Selling Virtual Products
Part 3, Selling Physical Products

In terms of the existing content (i.e., Parts 1-3), here are the changes in the second edition…


In the first example project (Part 2 of the book), you’ll now find:



Twitter Bootstrap (version 3)
The password_hash() function for secure password hashing and verification
A different approach for communicating with PayPal (IPN)
A more secure method for verifying uploaded files
An introduction to and use of the�openssl_random_pseudo_bytes()�function

In the second example site (Part 3 of the book), you’ll now find:



Use of the�newer Authorize.net SDK
A more secure method for verifying uploaded files
An introduction to, and use of, Composer and Zend\Mail (in the Zend Framework 2)
Better explanations of mod_rewrite, stored procedures, and the other most complicated stuff

Also, for both examples, I cleaned up some of the code, optimized some oddities, and corrected any mistakes made in the first edition.


Also new in this book is Part 4, Extra Touches. Part 4 consists of four new chapters, which is about 150 pages of new material.


Chapter 12, “Extending the First Site,” covers potential new public features, administrative features, and security improvements you could add to the first site. Some of the ideas are discussed loosely (e.g., theory but not code), others are fully implemented, and others are somewhere in between (e.g., some code, the database table, but not a complete step-by-step). The security improvements include using prepared statements and a more secure way to reset passwords. The chapter also explains, in detail, how to use PayPal PDT.


Chapter 13, “Extending the Second Site,” does the same for the second example project (that sells physical products). There are a lot of recommendations for improving the public side of the site, including sending email receipts, adding customer reviews, and more. The administrative side is also re-examined, and the chapter explains some structural changes you could make to the site’s design, both in terms of the PHP code and the database.


Chapter 14, “Adding JavaScript and Ajax,” walks through a gazillion features you could add to either project that require either just JavaScript or also Ajax. This includes:



Preventing duplicate orders
Implementing a suckerfish menu
Adding a datepicker
Implementing the ability to mark content as a favorite (via Ajax)
Recording notes (via Ajax)
Taking customer reviews (via Ajax)

Finally, the new Chapter 15, “Using Stripe Payments,” explains how to integrate the author’s favorite payments processor to either site. This is basically the same treatment given to PayPal and Authorize.net elsewhere in the book: what is Stripe?, getting started, processing single charges, and processing recurring charges.


Whew! So there’s that. All in all, about 200 new pages of content, and I’m quite pleased with the result. Hopefully you will be, too. The only thing that didn’t make it in was a chapter doing an OOP implementation of an e-commerce site. I just ran out of both time and book space to do that. Maybe the third edition? ;)


As I said, I’ll post a full table of contents soon. In the meantime, I’ve got one more book to finally (finally!) wrap up!

 •  0 comments  •  flag
Share on Twitter
Published on November 15, 2013 11:23

November 1, 2013

Northeast PHP 2013 Presentation Videos Online

The great people at the Northeast PHP conference have made videos of all the presentations available online at YouTube. How great is that?


All of the videos, linked by presentation, can be found on this Northeast PHP page.

 •  0 comments  •  flag
Share on Twitter
Published on November 01, 2013 08:07

October 18, 2013

Where Have I Been?

Yeesh! So where am I behind, and by how much? Let me count the ways…



I haven’t put up a blog posting in almost a month
I haven’t updated the Yii book in two months (ugh!!!)
I haven’t sent out a newsletter in almost three months

But other than that…Oh, I haven’t exercised in four months (in the spring, I had started exercising daily, which I did successfully do for two months). So, where have I been?


Through a confluence of events, I managed to totally bury myself this summer, which I’m just now working my way out of. Since August, I’ve…



Given three presentations at Northeast PHP in Boston
Continued to work on “The Yii Book” (albeit not nearly enough)
Written the second edition of “Effortless E-commerce with PHP and MySQL
Started working for Stripe (although only part time thus far, and starting to take on more hours)
Been helping with the documentation for version 2 of the Yii framework
All the other aspects of work maintenance: answering emails, replying in the forums (with a lot of help from others), doing the accounting, etc.

Clearly, this has been too much. If I had to do it all over again, I would have made some different decisions. Nothing I can do about that now, but I would like to have done better by some of those that I work with and for, most especially readers. Fortunately, the skies are starting to clear…


I’ll be done with the rewrites on the Effortless E-commerce book in a couple of days. That goes to the printer on November 4th, and is out in stores by the end of that month.


As soon as humanly possible, I’m going to put out the next update on “The Yii Book”, which will be a chapter on extending Yii. My new goal is to complete the first edition of the book by the end of November. I don’t know that I can do it, but I’m going to do everything I can to make that happen, if at all possible. After this next update, I’ve got two more chapters in Part 3. Part 4 of the book only has 3 chapters (I think), and those are implementations of Yii, which should be relatively easy.


Then I’ll be in a good position to update the book for Yii 2 (when the time comes), do a print run, and move forward on translations.


At some point, I’m also going to start exercising again (it’s important), and maybe get a bit of rest.


My apologies for the delay on, well, everything. I got sucked into a vacuum of my own making. As of July I stopped saying “Yes” to any new work, which is helping tremendously. I look forward to a 2014 with many fewer projects, no deadlines, and a manageable workload.

 •  0 comments  •  flag
Share on Twitter
Published on October 18, 2013 07:35

September 23, 2013

Debugging Database Operations in Yii

Whenever you begin working with a database, you introduce more possible causes of errors. Thus, you must learn additional debugging strategies. When using PHP to run queries on the database, the problems you might encounter include:



An inability to connect to the database
A database error thrown because of a query
The query not returning the results or having the effect that you expect
None of the above, and yet, the output is still incorrect

On a non-framework site, you just need to watch for database errors to catch the first two types of problems. There?s a simple and standard approach for debugging the last two types:



Use PHP to print out the query being run.
Run the same query using another interface to confirm the results.
Debug the query until you get the results you want.

When using a framework, these same debugging techniques are a little less obvious, in part because you may not be directly touching the underlying SQL commands. Thankfully, Yii will still be quite helpful, if you know what switches to flip.


This is an excerpt from Chapter 8, “Working with Databases,” of “The Yii Book“.


First of all, while developing your site, enable CWebLogRoute:



# protected/config/main.php "components" section
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
array(
'class'=>'CWebLogRoute',
),
),
),

This will show, in your browser, everything being done by the framework including what queries are being run.


CWebLog Output

Here, the Web log router is showing one of the queries required to fetch a page record.


But there?s one more thing you should do to make debugging SQL problems easier?


Many queries will use parameters, separating the core of the query from the specific (and often user-provided) values used by it. To see the entire query, with the parameter values in place, you must also set the CDbConnection class?s enableParamLogging attribute to true:



# protected/config/main.php "components" section
'db'=>array(
'connectionString' =>
'mysql:host=localhost;dbname=test',
'emulatePrepare' => true,
'enableParamLogging' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),

Now you?ll be able to see the entire query in your output, including the query?s parameter values.


{WARNING} Public display of errors and detailed logging are terrible for a site?s security and performance. Both should only be used during the development of a site.

 •  0 comments  •  flag
Share on Twitter
Published on September 23, 2013 06:24

September 18, 2013

What Third-Party Library Do You Integrate with Yii?

I’m looking ahead to writing Chapter 20, “Working with Third-Party Libraries,” of “The Yii Book” (I’m currently writing Chapter 19), and was wondering what people wanted me to specifically demonstrate. Originally, I had intended to use the Zend Framework as my example. I like how ZF components can be easily used on their own, and I’d frequently used ZF with my own Yii projects.�Lately, I’ve been thinking about using Symfony in the chapter. I’ve not touched Symfony yet myself, but have heard good things.�Of course, the examples don’t have to use frameworks; they could use any type of library.


So as I’m gearing up to write that chapter, I was wondering what third-party library you integrate with Yii? Or, what third-party library would you like to integrate with Yii? Or, what third-party library would you like to see me integrate with Yii?


Any and all suggestions and feedback are most welcome. Thanks!

 •  0 comments  •  flag
Share on Twitter
Published on September 18, 2013 04:49

Larry Ullman's Blog

Larry Ullman
Larry Ullman isn't a Goodreads Author (yet), but they do have a blog, so here are some recent posts imported from their feed.
Follow Larry Ullman's blog with rss.