Larry Ullman's Blog, page 4

March 28, 2014

php[tek] 2014 Keynotes

I’m quite happy to say that I’ll be one of two keynote speakers at php[tek] 2014! The opening keynote is from Terry Chay, Director of Features Engineering for Wikimedia Foundation. He’ll be discussing the technology challenges faced by Wikipedia. On the second morning, I’ll relay an inspiring story about how to get where you want to be in your career, based upon my own experiences.


The conference takes place in the great city of Chicago (well, just outside of the city), from May 21st to the 23rd, with training and tutorial days preceding the conference itself. You can read on to get more details about the two keynotes, and don’t forget to check the full schedule and speaker list on the php[tek] website to see all the other great talks that are being offered.



Inside the Tech Challenges of Wikimedia Engineering

Wikipedia is the 5th largest website on the Internet, and there a number of factors that make it a veritable challenge for the engineering team: working with existing legacy infrastructure, leveraging innovative new technologies without pissing off the community, and doing it all without taking the site down or sacrificing performance. In this keynote, Wikimedia Director of Features Engineering Terry Chay will pull back the curtain on how Wikipedia tackles its technical hurdles, demonstrating how to apply creative approaches to sticky situations when managing and growing large-scale websites.


Bio: Terry Chay is Director of Features Engineering at the Wikimedia Foundation. In previous lives, he worked at Automattic (WordPress), grew, architected, and sustained the third largest social network in the U.S., and developed the largest revenue-generating product for Plaxo (later purchased by Comcast) as their first web engineer.


How to Get There

I work for Stripe, a major startup player, and I’m a successful developer, writer, instructor, and speaker, but way back when, I was just a graduate holding an English Literature degree with a minor in Philosophy and Religion. How in the world did I get from there to here? Reflecting upon the path I’ve taken, I’ve come to the conclusion that success and achievement aren’t just about learning X or Y technologies. You have to have the right attitudes and behaviors to succeed. Whether you want to be a developer, the founder of a startup, a writer, or whatever, in this presentation, I’ll explain what you need to know and do to get to where you want to be.


Bio: Larry Ullman is a bestselling writer of more than 20 books, published in over 20 languages around the world. Larry has been an active web developer since 1999 with an emphasis on PHP and MySQL (although he’s flirted with other languages and technologies). Over the past 15 years, Larry has also written numerous articles, taught PHP web development online for the University of California at Berkeley, spoken at multiple conferences, and performed in-house training for divisions of the US government. As of 2013, Larry is a Support Engineer at Stripe.

 •  0 comments  •  flag
Share on Twitter
Published on March 28, 2014 13:17

March 14, 2014

Previewing Chapter 20 of “The Yii Book”

I’m hard at work on Chapter 20, “Working with Third-Party Libraries,” of “The Yii Book“, and making decent progress. The goal of the chapter, really, is to explain how to include third-party libraries without getting a ton of errors about not being able to find the class definition. If you’ve played around in this area at all, then you’ll know what I’m talking about: simple libraries, namespaces, autoloaders…it can get complicated.

A while back, I did an informal survey asking what third-party libraries people would like to see me use in this chapter. Between that input, and my own experiences, I’ve settled upon these examples:



Swift Mailer
Symfony (specifically the DomCrawler)
ElasticSearch

It won’t be a cohesive chapter, but it’ll be quite useful. And the chapter begins with some general instructions on integrating third-party libraries. (Also note that Chapter 19, “Extending Yii,” had an example on using the Stripe library.)

In terms of the schedule, I might do what I did with Chapter 19: post the un-edited version as a separate item first. The next formal release of the book will include both Chapter 20, and Chapter 21, “Implementing Unit Tests”. My goal is to make great progress over the next couple of days and get this next release out this month. That will conclude Part 3, “Advanced Topics,” of the book. Yay!

Looking ahead, Part 4, “Completing Projects,” of the book was originally going to have four chapters, but the ElasticSearch example in Chapter 20 makes Chapter 24, “Implementing a Search Engine,” unnecessary. Part 4 will then have three chapters, which should be do-able in April and May, although I think we all know I can’t be held to that deadline (ugh, actually very sorry for the delays).

And then…it’s a massive update for Yii 2 over the summer! And translations! And a print run! Followed quickly by my retirement!

 •  0 comments  •  flag
Share on Twitter
Published on March 14, 2014 14:42

March 7, 2014

Understanding Forms and MVC in the Yii Framework

HTML forms are one of the key pieces of any website. As is the case with many things, creating forms while using a framework such as Yii is significantly different than creating forms using standard HTML alone. In Chapter 9, “Working with Forms,” of “The Yii Book“, you’ll learn what you need to know to create HTML forms when using the Yii framework. You’ll comprehend the fundamentals of forms in Yii and see a few recipes for common form needs.


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


Before getting into the code, let’s take a minute to think about the MVC architecture. A form is part of the view component, as a form is an aspect of the user interface. Forms, though, are almost always associated with specific models. A contact form may have its own model, not tied to a database table (in which case the model extends CFormModel), and a form for employees or departments will be based upon a model that is tied to a database table (in which case the model extends CActiveRecord, most likely). Whether the model extends CFormModel or CActiveRecord, the important thing to remember is that the form is tied to a model. This is significant because it’s the model that dictates what form elements should exist, controls validation of the form data, and even defines the form’s labels (e.g., “First Name” for the firstName attribute), and so forth.


{TIP} With the MVC approach, forms should be associated with models. There are situations where you might have a form not associated with a model, but that is extremely rare.


When you use Gii to auto-generate CRUD functionality for a model, the framework creates a form for you in a file named _form.php. This file in turn gets included by other view files (any view file in Yii that starts with an underscore is intended to be an include). Naturally, the controller dictates which primary view file gets rendered. Also understand that the same _form.php file is intended to be used whether the form is for creating new records or updating existing ones. Yii will take care of populating the form’s elements with the model’s current value when an update is being performed.


Because forms are normally tied to models, you’ll need access to a model instance when you go to create the form. Before getting to the view and its form, let’s be clear as to how the view accesses the specific model. A controller may have this code:


public function actionCreate() {
$model=new Page;
/* Code for validation and redirect upon save. */
// If not saved, render the create view:
$this->render('create',array(
'model'=>$model
));
}

The create.php view file will include _form.php, passing along the model instance in the process:


renderPartial('_form', array('model'=>$model));
?>

So now _form.php has access to the model instance and can create the form tied to that model. Once the form view file has access to the model, it can create form elements in one of two ways:



Invoking the CHtml class methods directly
Using the CActiveForm widget

In the chapter, I explain both approaches, but focus more on the later, which is the current default approach in Yii.


Of course, to be fair, you could create an HTML form using raw HTML, without Yii at all. The downside to that approach is it creates no tie-in between the model’s validation rules, errors, labels, etc., and the form. By creating the form using Yii, labels will be based upon the model definitions (meaning that changing just the model changes reference to attributes everywhere), invalid form values can automatically be highlighted, and much, much more. Plus, it’s not hard to use Yii to create a form, once you understand how.

 •  0 comments  •  flag
Share on Twitter
Published on March 07, 2014 10:11

February 24, 2014

Why is it hard to scale a database, in layman’s terms?

I generally don’t like to link to things that require that you sign in to access the content, but I thought this question and answer on Quora was worth sharing. The question is: “Why is it hard to scale a database, in layman’s terms?” To which Paul King put forth a useful and easy to understand answer.


King identifies the four main problems with scaling databases:



Search
Concurrency
Consistency
Speed

King doesn’t put forth answers to these questions (because the answers vary), but an understanding of the core problems is the first step on the road towards solving them. If you have a Quora account (which is free), take a couple of quick minutes to read this.


 

 •  0 comments  •  flag
Share on Twitter
Published on February 24, 2014 09:21

February 14, 2014

Join Me at php[tek] 2014!

I’m extremely happy to say that I’ll be one of the speakers at php[tek] 2014 this May in Chicago, Illinois! php[tek] is one of the best-regarded PHP conferences around, and this year you’ll again find an all-star line-up (plus me). The conference itself runs for 2.5 days, from May 21st to the 23rd, with one additional tutorial day and a training day (on the 20th and 19th, respectively).


php[tek] 2014



If you look at the schedule, you’ll see that just a smattering of the excellent talks and tutorials include:



Grumpy Unit Testing Bootcamp by Chris Hartjes
Introduction to Databases by Davey Shafik
Advanced Date/Time Handling with PHP by Derrik Rethans
Modern PHP by Ben Ramsey
How to Be a Great Developer by Edward Finkler
Working with Difficult People by Laura Thomson
Socket Programming with PHP by Elizabeth Smith
Git and Github: Working Effectively on a Team by Jeff Carouth

There’s just tons of great stuff here, from the basic to the advanced, from the non-technical to the very technical. I’m really looking forward to attending it. But I’m also speaking…


I’ll be doing two talks:



Faster Web Development with Yii 2
Keynote: How To Get There

I’m thrilled to be doing both talks and honored that the latter was selected as a keynote. It’s a talk I really like: personal, meaningful, and useful. The Yii talk will be an introduction to, and demonstration of, Yii 2.


And if all that wasn’t enough, the conference takes place in the city of Chicago, Illinois, my hometown! Well, just outside of the city… If you come, I can regale you with stories of a young Larry Ullman, angst youth in Chicago in the John Hughes-modeled 1980′s. Or I could not. Up to you, really.


So what else do you need to know? Go buy your ticket, because I hope to see you there!

 •  0 comments  •  flag
Share on Twitter
Published on February 14, 2014 17:32

February 3, 2014

Version 0.8 of “The Yii Book” Released

On Friday evening, I officially released version 0.8 of “The Yii Book” (Chapter 19 had previously been released in rough format). This update includes over 55 pages of new content, which I call Chapter 19, “Extending Yii”. This is a 10% increase in the book’s total length, and by far the longest chapter in the book. You can download the latest version from the account page.


And today (Monday, February 3rd), I’ll begin writing Chapter 20, “Working with Third-Party Libraries”. I’m planning on having that out in February.


In the meantime, my thanks to everyone that’s pointed out errors or points of confusion in past versions. I’ve addressed those as best as I could. Do please let me know if there are any questions or problems with this latest release.


Thanks ever so much!

Larry


—–


Release notes:

0.8

Date published: 2014-01-31

Added Chapter 19, “Extending Yii”

Fixed all the errors found in previous releases

514 pages total as a PDF

 •  0 comments  •  flag
Share on Twitter
Published on February 03, 2014 07:14

January 27, 2014

“Using, and Learning From, Stripe” Online Presentation

As a reminder, this Thursday, January 30th, 2014, 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 January 27, 2014 10:08

January 24, 2014

Many Words on “The Yii Book”

On Wednesday, I sent out three emails about “The Yii Book“, the contents of which I’ll summarize here. But first, if you’re not receiving these emails but you’d like to, you can set that on your Yii account page.


As for those emails, and this summarization, the tl;dr version is:



A rough draft of Chapter 19, “Extending Yii,” is available for download on the account page.
Got some plans on doing more work on this going forward.
You all are great!


Chapter 19, “Extending Yii”

The good news is that Chapter 19, “Extending Yii,” is done. Well, done-ish. I’ve got 55 pages of a PDF in my virtual hands. What I thought would be a 30 page chapter done in December, became a 55 page chapter in January. The only caveat is…the tech editors haven’t reviewed it yet. It is a bit raw.


That being said, considering how way-crazy-far-disgustingly long it took to complete this chapter, I’ve done the very rare thing and made it available now, before technical editing. You can download the chapter on the Yii account page. You may also want to download for the Stripe extension I created in the chapter (also available on the download page).


A couple of things to be aware of…First, this is just the one, standalone chapter, it’s not yet part of the whole book. Second, because of the Markdown->LaTeX->PDF process, and this not being part of the book, the chapter number and figure references are kind of wrong. This will automatically be corrected when I export this as part of the whole book (after the tech review).


But if you want it now (and we all know you’ve waited long enough), have at it. If you’d rather wait until it’s part of the book, I’ll send out another update then, although it could be a couple/few days.


My thanks, as always, for your patience and understanding. And my sincerest, most humble apologies for the offensively-long delay.


What’s Next?

I think Chapter 19 is the last really hard chapter, of the few left. We’ll see about the unit testing one. But I’m not worried about any of the others. More importantly, I’m back on the horse after several ugly, hectic months. Moving forward, I’m cutting back a day a week at Stripe to give myself more time to work on this. If need be, I’ll also take some days off, just to make sure I continue to make progress and don’t have the abysmal delay again.


You All Are Great

As is obviously clear, and as I’ve acknowledged several times over, this project has taken WAY too long. Some of that was my being overly ambitious and naive. Had I framed this differently, we could be talking about a lovely project without an end date for which you get free updates. As opposed to a book that’s taking forever to be finished. Semantic difference, but possibly a useful one. Live and learn.


There are many reasons the book has taken so long, but I’ve tried to shy away from making excuses.


On the other hand, what exists now (and has for a while) is 450+ pages of pretty good material, soon to be 500+ pages. That’s not nothing.


Really, I think the book has had only one failure, but it’s a pretty big failure (the time it has taken). I’m not sure how I gauge the success of this, but that’s a significant flaw. Albeit I think not fatal. Regardless of all that, here’s the real message I want to convey…


Over Thanksgiving, someone took me to task for the delay, and in early December I sent and posted an honest, public apology, with an explanation and future plans.


The response I received was really quite overwhelming. I’m getting such support from you all, and that means the world to me. Many of you expressed concerns over my taking this too hard, or that I’m getting too much grief. I really meant to write you each back individually, but as I don’t have time for much these days, that hasn’t happened yet either. (One of many things I’ve pushed off until Chapter 19 was done.)


But I wanted you to know this: you all have been great. Amazingly great. Heart-warming, faith-in-humanity-restoring, wonderfully great. Almost 2,000 people have bought a copy, and I’ve had maybe 5 people express being really angry or disappointed. More than that may be angry and disappointed (probably are), but, no, you have been overwhelmingly supportive. And I appreciate it so. And I don’t begrudge those few people for being angry or disappointed, because this has taken too long and they certainly have every right to those feelings and thoughts.


So, in lieu of thoughtful (and time-taking) personal replies, I just wanted to say thanks to everyone for their patience and support and understanding. I know I say this a lot, but I do mean it. And thanks to those who are angry and disappointed, for being honest and taking the time to express your displeasure. If I do something badly, I ought to be called out on it. It’s only fair.


The last thing I would ever want to do is disappoint or anger my readers. It’s truly important to me that this project gets completed and done well. It’s important to me that you feel you made the right call in giving me $20 or $30 or whatever. I’ve certainly already lost some of you, and that’s something I’ll always know was a failure with this little experiment.


But trust me: no one wants this book done more than I do. If I could have waved a magic wand and had this done in 2013, I would be the happiest man alive. So I’ll get it done. It’s still very much a priority and I have not forgotten. Life is just complicated, and wanting to do right by everyone can sometimes be a hard standard to live up to. But we’re in the final stretch now, and I’ll get it done.


In the meantime, I just wanted to say that you guys are great.


Thank you, thank you all. From my heart.


Best,

Larry

 •  0 comments  •  flag
Share on Twitter
Published on January 24, 2014 13:27

January 13, 2014

Server Migration Complete?

So…it was an unnecessarily rough migration, and a very frustrating Sunday, but I think the server migration is complete. I had to reimport 10 orders for “The Yii Book” (that happened on the old server). If anyone has any problems with “The Yii Book” site or their account, please let me know. I’ll open the forums back up momentarily. If anyone catches anything else odd or untoward or…, please let me know. Thanks to everyone for their patience and understanding!

 •  0 comments  •  flag
Share on Twitter
Published on January 13, 2014 07:58

January 10, 2014

Server Maintenance

Starting tonight, Friday, January 10th, 2014, I’m going to pause some activity on my site for necessary maintenance. My hosting company, ServInt, will be migrating my VPS to a new server (big yay!). The migration will give me a much more current machine, with much more current software, including the latest version of PHP (big yay!). But during the migration, no new data can be added to the sites, whether that’s comments in the blog or postings in the forum. So I’m pausing both for the time being. Once I’ve confirmed the sanctity of my sites (over the weekend), I’ll renable the disabled features. Hopefully this will be Sunday, or Monday at the latest.


Please do not send me any emails (in lieu of a comment or forum posting)! Any emails I receive will go to the back of the queue, and I’m currently trying to get through December’s emails. You’re best off waiting until Monday and posting a comment or forum message then. Really. Also, you should take a couple of days off anyway. It’ll be fine.


Apologies in advance for any inconvenience. But this migration has been a long time coming and is sorely needed. And if you wait until the perfect time, well, that never comes.

 •  0 comments  •  flag
Share on Twitter
Published on January 10, 2014 15:51

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.