Larry Ullman's Blog, page 3
October 6, 2014
“Faster Web Development with Yii Framework 2″ Presentation on NomadPHP
On October 23, I’ll be doing an online presentation titled “Faster Web Development with Yii Framework 2”. In this presentation, I’ll be introducing the Yii framework in general, and version 2 in particular. Keep reading this post or click the “Faster Web Development with Yii Framework 2″ link, for an introduction to the presentation.
This is a paid event, put on by NomadPHP, but the cost is only $15, for either live attendance or a video afterwards.
No doubt, there are a lot of PHP frameworks to choose from, but my personal favorite is Yii. Yii is your standard MVC framework, complete with scaffolding, performance tools, and a high level of extendibility. Yii has a pretty low level of entry for beginners, with great power and capability for the expert. Really, Yii is just a delight to work with. In this presentation, I’m going to introduce web development using Yii, using live coding and demonstrations. Plenty of time will be given to the range of what Yii offers, with an emphasis of what I consider to be its strengths. The presentation will also cover what’s new in version 2 of the framework, which is coming out in 2014. And despite the fact that I really like Yii, absolutely no time will be spent suggesting why it’s better or worse than your favorite framework.
September 22, 2014
What is Larry Thinking? #74 => Freelancing, Part 1
In this edition…
About This Newsletter
On the Web => Faster Web Development with Yii Framework 2
On the Web => How to decide when to work for free
On the Web => Success at Sales
Q&A => When do you decide to freelance?
What is Larry Thinking => Money
Larry Ullman’s Book News => “The Yii Book” et al.
About This Newsletter
Hello, hello! So…this newsletter is about two months late in coming (or so), but that’s (sadly) still a better pace than I had been on over the past year. In any case, it’s here now!
In this newsletter and the next two (it’s a three-part series), I’ll discuss the business of freelancing: what it means to be a freelance worker, important things to keep in mind, and how to survive. I freelanced for 14 years before stopping last year when I joined Stripe. I worked on great projects, I worked on duds; some paid well, some clients stiffed me; some I’m still proud of today, and others never made it online. But I learned a lot, and know that it is possible to make a career as a freelancer. Some of you already are freelancing, while others aspire towards that end. No matter your situation, I hope this newsletter provides ideas that are helpful to you in that pursuit.
As always, questions, comments, and all feedback are much appreciated. If you have any specific thoughts, resources, or stories about freelancing, please let me know so I can include them in Parts 2 and 3 (in October and November).
And thanks for your interest in what I have to say and do!
On the Web => Faster Web Development with Yii Framework 2
This isn’t related to freelancing (unless you’re doing Yii web development!) but I wanted to announce that on October 23, I’ll be doing an online presentation titled “Faster Web Development with Yii Framework 2”. In this presentation, I’ll be introducing the Yii framework in general, and version 2 in particular.
It is a paid event, put on by NomadPHP, but the cost is only $15, for live attendance or a video afterwards.
On the Web => How to decide when to work for free
On August 17, 2013, at the Northeast PHP conference in Boston, I gave a presentation titled “How To Get There”. This was a motivational-like presentation, which was virgin territory for me, but I think it turned out well. In the talk, I recommend 21 behaviors and attitudes one should have in order to succeed, in order to achieve one’s goals. The tl;dr version comes down to this:
Be honest. Work hard. Never stop learning.
This is common sense, yes, but often it’s the things that should go without saying that most need to be said.
One of the specific recommendations I have in the talk (one of my 21 points of light) is: Give It Away. This is actually one of my recommendations for making money. Yes, ironically, one way of making money, one way of getting a great job, is to give your time or work away for free. This is absolutely, 100% valid, and I could relay dozens of stories about myself and others where giving it away has had remarkable financial rewards. (I’ll return to this idea shortly.)
Coincidentally, I later came across a blog post by Penelope Trunk titled “How to decide when to work for free”. In the article, Ms. Trunk wonderfully illuminates the benefits of working for free, of giving it away. Moreover, the article provides recommendations for how one makes the decisions as to when you should work for free and when you shouldn’t. If you’re looking to get a job, or just to build your resume, the article is well worth reading.
On the Web => Success at Sales
I am not a salesperson. I don’t like people trying to talk me into buying or doing something, and I don’t like trying to do that to others. So, along with my disinterest and discomfort with marketing, I know I’m missing some key skills that freelancers need. (Fortunately, it turns out that publishing was an amazing marketing tool, but it’s not the most efficient one!)
Relative to the sales aspect of freelancing, an article that may be of use to you is “3 Powerful Skills You Must Have to Succeed in Sales”. Also, I’ve not read it yet, but this book is on my wish list: “The Greatest Salesman in the World” by Og Mandino.
Again, this is not my area of expertise, but I think the most important thing to remember is that you’re not selling anything; you’re helping people solve a problem, address a need. If you come to clients with that perspective, and with lots of empathy, you’ll do right by them, and be successful (assuming you follow through, of course!).
Q&A => When do you decide to freelance?
Thomas had sent me an email about freelancing, specifically asking:
What, when and how did you decide to go freelance? Did you jump into full-time or build it up between full-time/part-time work?
I have a very long-winded and backwards story as to how I became a freelancer. It’s not a good story for email, but if you ever meet me in person, feel free to ask me about it. Regardless, the unusual nature of my story makes it inapplicable for others. I did jump into it full-time, but that was only due to unusual circumstances, using my own specific justifications.
The prudent approach is to build up a business while continuing your existing job. This, of course, means you’re doing two jobs, which can be exhausting, and it might result in taking much longer to build up your own freelancing career. On the other hand, if you go full-time immediately, you obviously have more time to work on projects, develop skills, and run the business. But can you go about a full year without any significant income?
Simply put, I think it all comes down to money and, secondarily, benefits. Unless you already have clients and projects lined up, it will take you months to start earning a regular income when you start freelancing. The more experience, clients, projects, and marketing you do before you freelance full-time, the easier and faster it will go.
Secondarily, I think you need to identify how you’ll have benefits. This may be more of an issue in the United States than elsewhere. But in the US, where there is no universal coverage, health insurance is expensive and not great to buy for an individual. But you can’t not have it, even if you’re still in your 20’s and therefore immortal.
But it’s not just health insurance, as a freelancer, you’ll have no:
Company putting money away for your retirement (thereby delaying when you can retire)
Paid sick days, vacations, or holidays
Meals, travel, or other expenses covered
Hardware and software paid for
(On the bright side, freelancing in programming and development has a pretty low cost of entry, so your out-of-pocket startup costs won’t be high.)
No matter what your situation is, if you’re thinking about freelancing full-time, you have to accept that the only money you can count on is the money you currently have. Whatever projections for income you imagine, no matter how soundly derived, are just projections. So ask yourself: how long can I (and my family, if applicable) live on the money I have right now?
Don’t get me wrong: it’s not that you can’t make money freelancing, and there are secondary benefits to doing so. But it order to do it right, you’ll need to be financially prepared. The absolute worst thing to do would be to quit a job, blow all of your savings trying to freelance for only 3 or 6 months, and then have to go find another conventional job, without ever being able to dedicate the time required to really see if freelancing could work for you.
What is Larry Thinking? => Money
As I was writing and rereading this newsletter (and the next two), I realized a theme emerged: I may have a jaded sense of money when it comes to freelancing. This, of course, is just my perspective on freelancing; your results my vary. But I should probably explain where I’m coming from on this front.
There are lots of pros and cons to freelancing, which I’ll expand upon in the third newsletter in this series. But for almost all of us, we work because we need money. Many people would continue working if they didn’t need the money, but not necessarily the same kind of work. But regardless of who you are, you can’t afford to keep freelancing if you don’t make enough money doing it.
Now, money is a funny thing, and different people have different attitudes on it, including those like me that we’re raised not to talk about money! But the thing about money, especially when you’re thinking about freelancing, is that there are two factors: how much you make and how much you spend. The latter is much, much easier to control than the former, and that’s something to keep in mind when you’re considering jumping into freelancing.
I started freelancing the same year my wife went back to school to get a graduate degree (we didn’t have kids at the time). This meant that we gave up two full incomes at the same time. We were able to make it work in part because we had saved up some money, but mostly because we controlled our expenses. I just checked my tax returns, and in my first full year of freelancing (2000), we made a combined $13,000 (US). That’s all the income we had, for two adults in their 20’s, for an entire year. But we made it work. And because we were able to live on that small amount, I was able to dedicate the time required to build up my business.
(As an aside, I know it’s gauche to talk specific numbers, but I wanted to clearly illustrate my point. And while some of you may be in countries where $13,000 USD is a good sum of money, in the US, it’s well below the poverty level.)
I mention all this for two reasons. First, if your primary goal in freelancing is making (a lot of) money, you’re probably going to be disappointed. Honestly, even with my success as a writer, I never made that much money as a freelancer, and that was with no benefits. Don’t get me wrong: I’ve made a fine living, but the good fortune I had as a writer and freelancer still didn’t match up with what can be earned working a conventional IT job, even in a middle-tier role.
Second, if you’re going to freelance full-time, you’ll need to find a way to live on the money you have, and live on less money in general. Businesses take time to build up. You should plan on having little money for a year, not that much money the second year, some money the third, and so on.
In return for making less money than you otherwise might, you get Freedom. If you can live with having less money, that’s a pretty great deal.
Larry Ullman’s Book News => “The Yii Book” et al.
Kind of quiet on the “Larry Ullman’s Book News” front. The highlight is that at the end of July I pushed version 0.9 of “The Yii Book”. The book is now 21 chapters long and almost 600 pages in length! I’m pretty close to finishing Chapter 24, “Shipping Your Project”. This leaves just the two example chapters. I should have the entire book completed relatively quickly, and then I’ll start the update for Yii 2.
Needless to say, I really look forward to having this project wrapped (specifically the first complete edition).
All of my other (active) books are reasonably up-to-date:
“PHP for the Web: Visual QuickStart Guide (4th Edition)”
“PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)”
“PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)”
“Modern JavaScript: Develop and Design”
“Effortless E-Commerce with PHP and MySQL (2nd Edition)”
There are currently no new editions planned for these titles, although I imagine I’ll have that conversation with the publisher in 2015. (This still means the earliest any book would be updated would be a year from now.)
August 18, 2014
Adding JavaScript to a Page in Yii
The first thing you’ll need to know to use JavaScript and jQuery in Yii is how to add JavaScript to a Web page. As with any standard Web page, there are two primary options:
Link to an external file that contains the JavaScript code
Place the JavaScript code directly in the page using SCRIPT tags
Just as I assume you’re already comfortable with JavaScript, I’ll also assume you know the arguments for and against both approaches. (Technically, there’s a third option: place the JavaScript inline within an HTML tag. This is not a recommended approach in modern Web sites, however, and I won’t demonstrate it here.)
This is an excerpt from Chapter 12, “JavaScript and jQuery,” of “The Yii Book“.
Linking to JavaScript Files
External JavaScript files are linked to a page using the SCRIPT tag:
The contemporary approach is to link external files at the end of the HTML BODY, although some JavaScript libraries must be included in the HEAD.
If you need to include a JavaScript file on every page of your site, an option is to just add the reference to your layout file:
Do be certain to use an absolute reference to the file, for reasons explained in Chapter 6, “Working with Views.”
Alternatively, you can use Yii’s CHtml::scriptFile() method to create the entire HTML tag:
request->baseUrl . "/path/to/file.js");
?>
The end result is the same.
Sometimes, you’ll have external JavaScript files that should only be included on specific pages. In theory, you could just add the appropriate SCRIPT tag to the corresponding view files, but that’s less than ideal for a couple of reasons. For one, the final page will end up with SCRIPT tags in the middle of the page BODY, which is sloppy. Another reasons why you don’t want to take this approach is that it gives you no vehicle for putting the script in the HTML HEAD, should that be necessary.
The better way to add external files to a page from within the view file is to use Yii’s “clientScript” component, and its registerScriptFile() method in particular:
# protected/views/foo/bar.php
clientScript->registerScriptFile("/path/to/file.js"); ?>
The “clientScript” application component manages JavaScript and CSS resources used by a site. By calling that line anywhere in a view file (or a controller), Yii will automatically include a link to the named JavaScript file in the complete rendered HTML. Further, if, for whatever reason, you register the same JavaScript file more than once, Yii will still only create a single SCRIPT tag for that file.
By default, Yii will link the registered script in the HTML HEAD. To change the destination, add a second argument to registerScriptFile(). This argument should be a constant that indicates the proper position in the HTML page for the JavaScript file reference:
CClientScript::POS_HEAD, in the HEAD before the TITLE (the default)
CClientScript::POS_BEGIN, at the beginning of the BODY
CClientScript::POS_END, at the end of the BODY
To have the SCRIPT tag added at the end of the body, you would do this:
# protected/views/foo/bar.php
clientScript->registerScriptFile("/path/to/file.js", CClientScript::POS_END); ?>
Linking jQuery
The previous section explained how to link external JavaScript files from a Web page. There’s a subset of external JavaScript files that are treated differently, however. I’m referring to JavaScript files that come with the Yii framework, such as the jQuery library.
To incorporate jQuery into a Web page, invoke the registerCoreScript() method, providing it with the value “jquery”:
clientScript->registerCoreScript("jquery"); ?>
That line results in the jQuery library being linked to the page via a SCRIPT tag. The jQuery library is referenced within the Web directory’s assets folder. Copies of the library will be placed in that folder by Yii’s assets manager.
By default, registerCoreScript() will place SCRIPT tags within the HTML HEAD. To have Yii place the tags elsewhere, change the coreScriptPosition attribute value to one of the constants already named:
clientScript->coreScriptPosition = CClientScript::POS_END;
Yii::app()->clientScript->registerCoreScript("jquery");
?>
You can also globally change this setting in your primary configuration file (by assigning a value to the “coreScriptPosition” index of the “clientScript” component).
Some pages, like those that use certain widgets or that have Ajax form validation enabled, will already include jQuery. Fortunately, you don’t have to worry about possible duplication, as the Yii assets manager will only incorporate the library once.
If you’re curious as to what other core scripts are available, check out the web/js/packages.php file found in your Yii framework directory. As of this writing, some of the core scripts are:
jquery
yii, a Yii extension of the jQuery library
yiiactiveform, which provides code for client-side form validation
jquery.ui
cookie, for cookie management
history, for client-side history management
This means, for example, to incorporate the jQuery User Interface library, you would do this:
clientScript->registerCoreScript("jquery.ui");
?>
For all of the options, and details on the associated scripts, see the web/js/sources directory (within the Yii framework folder).
Adding JavaScript Code
When you have short snippets of JavaScript code, or when the code only pertains to a single file, it’s common to write that code directly between the HTML SCRIPT tags. Again, you could do this in your view files:
You could also use the Yii CHtml::script() method to create the SCRIPT tag for you:
You could add SCRIPT tags in either of those ways, but there’s a better approach: the “clientScript” component’s registerScript() method. This is the companion to registerScriptFile(), but instead of linking to an external JavaScript file, it’s used to add JavaScript code directly to the page.
The method’s first argument is a unique identifier you should give to the code snippet. The second is the JavaScript code itself. This code is generated by Gii on the “admin” view pages:
# protected/views/page/admin.php
clientScript->registerScript("search", "$(".search-button").click(function(){
$(".search-form").toggle();
return false;
});
$(".search-form form").submit(function(){
$.fn.yiiGridView.update("post-gridæ, {
data: $(this).serialize()
});
return false;
});
");
?>
The first bit of JavaScript (lines 4-7), shows and hides the advanced search form that can appear above the grid. The form’s visibility is toggled when the user clicks on the search button. The second bit invokes the yiiGridView.update() method when the search form is submitted. Both sections use jQuery.
As you can see in that example, the combination of PHP and JavaScript can easily lead to syntax errors. You should use one set of quotation types to encapsulate the JavaScript (passed to registerScript()) and another type within the JavaScript. Also be certain to terminate JavaScript commands with semicolons, and terminate the PHP command, too. If the JavaScript you write doesn’t work, start by confirming that the resulting JavaScript code (in the browser’s source) is syntactically correct.
One of the benefits of providing a unique identifier is that the “clientScript” component will manage the code bits so that even if the same code (by identifier) is registered multiple times, it will still only be placed on the page once.
As with registerScriptFile(), registerScript() takes a final argument to indicate where, in the HTML page, the JavaScript should be added:
CClientScript::POS_HEAD, in the HEAD before the TITLE (the default)
CClientScript::POS_BEGIN, at the beginning of the BODY.
CClientScript::POS_END, at the end of the BODY.
CClientScript::POS_LOAD, within a window.onload event handler
CClientScript::POS_READY, within a jQuery “ready” event handler
The two additional options are necessary because of the way the browser loads the DOM. If you are using jQuery and you want to execute some JavaScript when the document is ready, use CClientScript::POS_READY. It’s slightly faster than the standard JavaScript window.onload option. If you’re not using jQuery, then use CClientScript::POS_LOAD.
July 26, 2014
Version 0.9 of “The Yii Book” Shipped!
After way too long, I’ve finally posted version 0.9 of “The Yii Book“. This includes two of the hardest chapters to write: Chapter 20, “Working with Third-Party Libraries,” and Chapter 21, “Testing Your Application”. (See the current table of contents.)
This update adds about 12% more content, bringing the book up to 575 pages. (As an aside, my original target for the book was 120,000 words; it’s now at 150,000, and will end at around 180,000. So, essentially 50% longer than I expected it to be!)
This leaves three chapters left: two example chapters (CMS and e-commerce) and a “Shipping Your Projects” chapter. From a writing standpoint, these are all relatively easy. So my hope is to complete all three chapters and publish a complete v. 1 of “The Yii Book” quickly. (I won’t share an estimated timeline because…history would suggest that doesn’t go well for me, but I am hopeful here.)
After I finish the Yii 1 edition of the book, I’ll start writing an update for version 2 of the framework. It should hopefully go relatively quickly. Rewrites are always much faster than the first edition. I don’t want to make any promises (as I’m not good at estimating times), but I will do the update for Yii 2 ASAP and you won’t have to wait too long. It will be a free update to everyone that has purchased the book.
Also, I gave a presentation on Yii 2 in May. You can see the slides here.
So that’s that. I hope you’re doing well and are eagerly anticipating Yii 2 as much as I am. As always, thanks for your interest in the book, your patience, your feedback, and the rest!
Cheers,
Larry
June 11, 2014
What is Larry Thinking? #73 => Useful Resources
In this edition…
About This Newsletter
Social Media
Cooper Press
Websec.io
Chris Hartjes
Kate Matsudaira’s Tech Leadership News
Yii 2 Status and Looking Forward
Larry Ullman’s Book News => “Effortless E-commerce with PHP and MySQL (2nd Edition)”
About This Newsletter
So………you may have noticed that it’s been a while since my last newsletter. It’s been a loooong while. And, technically, the last newsletter was just a “hey, I’m going to start doing newsletters again”, so the last real newsletter was even longer ago. Hmmm…as you may know, I’m pretty crazy busy these days, and some things just aren’t getting done (despite the fact that I’m working 7 days a week, ugh). But let’s not dwell on the past, but rather revel in this, a new newsletter!
In this edition, I wanted to share some of the resources that I like to use for learning about new things. Safe to say that my (this) newsletter is rather personal and different (and more inconsistent!) than most. I gather people do find my newsletter to be useful, which is good, considering the effort I actually put into it. But if you’d like to broaden your horizons, to get information from other sources, these other newsletters are worth considering, too. Truth be told, then tend to stack up in my email until I have time to review them like once a month. And then I have to bookmark the articles I’m interested in for later reading, but still…worth considering and subscribing to. (They’re all free, by the way.)
Looking ahead, I have tentative newsletters scheduled on: the business of freelancing; attending and speaking at conferences; and on writing and publishing. I’m going to try to do better about getting these newsletters out more regularly, like every month-ish. As I’ll address later in this newsletter, the first version of “The Yii Book” is winding down, and I’ll be completing it and the version for Yii 2 this summer, so I’m hoping that my life becomes a lot more maintainable in the near future.
Returning to this newsletter, if you have any resources that you value that I didn’t mention, please let me know and I’ll include it in a follow-up. As always, questions, comments, and all feedback are much appreciated. And thanks for your interest in what I have to say and do!
Social Media
The first, and obvious resource, is social media. For me, this is almost entirely Twitter. I don’t really use Facebook much, or Google Plus. In fact, I practically don’t use them at all. I see their value, I just don’t have time. Twitter is similarly tricky in that there are hundreds of people I could follow, but then I’d never have the time to actually read what people tweet. It’s a balancing act. But following the right people in social media is immensely helpful when it comes to learning new things, being influenced, and so forth.
As I said, I’m not very active these days, but I’m on Twitter under @LarryUllman, on Facebook as larry.ullman.5, and on Google Plus using larryullman@gmail.com.
Cooper Press
A first good resource for newsletters is Cooper Press, from the great Peter Cooper. For me, the most critical newsletters from Cooper Press are:
HTML5 Weekly
JavaScript Weekly
StatusCode
The first two are, um, weekly newsletters about HTML5 (including CSS 3, WebSockets, etc.) and JavaScript (including CoffeeScript and server-side JavaScript frameworks). You’ll get links to featured articles, videos, and job postings. There are also links to relevant libraries, code, and tools.
StatusCode is less frequently put out and is not targeted to any one technology. But it includes a ton of great links about programming in general, trends and events in the community, and so forth. It’s irregularly put out, but one of my favorites.
SitePoint
Another good resource for newsletters is SitePoint. I subscribe to all of them, I think: SitePoint, Mobile, PHP, JavaScript, and the rest. They are short-ish, but high in quality.
Websec.io
Short and sweet, Websec.io is a newsletter that every web developer ought to subscribe to. The focus is on web security, with PHP given the most attention. Edited by Chris Cornutt, a PHP security guru (and the technical editor on my “Effortless E-commerce with PHP and MySQL (2nd Edition)” book), Websec.io helps to keep you up to date on the latest news and best practices relative to web security.
Chris Hartjes
Chris Hartjes, colloquially known as the “grumpy programmer”, is single-handedly leading the cause of better testing in PHP. (Okay, not “single-handedly” but…) Chris has a couple of books specific to testing, but any PHP developer will find his newsletter to be worthwhile. For example, there was a really good one recently about the minimum viable system administrative skills that everyone should have.
Kate Matsudaira’s Tech Leadership News
Kate Matsudaira’s Tech Leadership News (TLN) may be my favorite newsletter, but there’s the caveat that it’s so good, and comes out weekly, that I have a hard time keeping up with everything I want to read. In short, it’s The New Yorker of newsletters (that’s high praise in my book).
Ms. Matsudaira is an industry leader that knows not just the underlying technologies, but also how to work with organizations and people. She’s an accomplished speaker, a paid consultant, and true leader, and still rather down to earth. I find myself wanting to read nearly every article she highlights, and frankly don’t know how she has the time to put out such a quality newsletter.
Some of the many topics covered include: leadership, management, being productive, technical web development concepts, startups, emotional health, career advice, and so on, and so on.
Just great, great stuff!
Yii 2 Status and Looking Forward
Switching gears, this isn’t a “useful resource”, but I wanted to take a moment to talk about the status of version 2 of the the Yii framework, “The Yii Book”, and so forth.
The beta of Yii 2 was announced in April. Besides being another release, which is a good thing, officially reaching beta status means that no new major features will be added before Yii 2 is released. In other words, what Yii 2 looks like in beta will be pretty close to what Yii 2 is. Yay!
Rather than discussing all, or the most important, changes in Yii 2, I’d recommend you read the announcement page just linked. As for how I imagine this will play out looking forward…
I expect the first general release of Yii 2 will be out this summer. I’m currently (and continually) helping with the Yii documentation, which is the last major hurdle in getting Yii 2 to a production release.
As for “The Yii Book”, I am still, of course, honoring my commitment to update the entire book to Yii 2. And anyone that’s purchased a copy of the book will get that update for free. I’m going to finish the book for Yii 1 first, though, for these reasons:
Yii 2 isn’t finished yet, so more changes in Yii 2 just means more changes in the book (i.e., it’ll be inefficient to rush into updating the book to Yii 2 right now)
Most developers are (and should be) using Yii 1 for the near future
Completing the entire book in Yii 1 will make the changes to Yii 2 that much more obvious and easier to highlight when I do the update
I’m separately going to send out an update to those subscribed to Yii updates (in the account page, if you purchase a book), but the short version is…
Right now there are just four chapters left. But I’m going to hold off on writing the chapter on unit testing (Chapter 21) in this edition. Testing in Yii 2 uses a different framework, so a chapter on testing in Yii 1 would be largely a waste of time. This leaves three chapters left: two example chapters, and a chapter on shipping your project. I’m going to write those three chapters and complete version 1 of the book as quickly as possible. Then I’ll update the book for Yii 2.
I don’t want to give a timeline on this (as I obviously can’t be trusted when it comes to my timelines), but know that I’m going to finish version 1 of the book ASAP, and then do version 2 of the book (for Yii 2) ASAP. The update for Yii 2 shouldn’t be that hard to do, or take that long.
As always, thanks to everyone for their interest in Yii, for their interest in the book, for their patience with a much-delayed and overworked writer, and for all the feedback and support along the way. Do let me know if you have any questions!
Larry Ullman’s Book News => “Effortless E-commerce with PHP and MySQL (2nd Edition)”
It’s been so long since my last newsletter, that I never officially mentioned that the 2nd edition of my “Effortless E-commerce with PHP and MySQL” came out last November. I think the new edition of this already popular book turned out well.
For the second edition, here are the main changes and updates that were implemented:
A third payment processing example, using a system and approach that’s only been invented in the past couple years: Stripe!
Updated PayPal section to reflect changes in PayPal’s options and methodologies since the first edition.
Updated Authorize.net section to reflect changes in Authorize.net’s options and methodologies since the first edition.
A chapter on adding functionality using JavaScript and Ajax.
A chapter on extending the first example site in many sites.
A chapter on extending the second example site in many sites.
And, of course, all of the existing material was also updated for clarity, fixing errors, and so forth.
As I said, I think the new edition turned out well, and it’s approximately 200 pages longer than the previous edition.
The only book on the horizon right now is the completion of “The Yii Book”, for both versions 1 and 2 of the framework. I’m pretty sure I won’t be writing another book in 2014, although 2015 may see updates to some of my existing books.
May 22, 2014
“How to Get There” Presentation Citations
In my php[tek] keynote, “How to Get There“, I make several references to books, cognitive psychology, TED talks, dead Austro-Hungarian writers, and 1980′s television dramas. For those interested in pursuing any of these (especially “L.A. Law”), and to give due credit to my influences, here are the things I named.
(Separately, you can see the slides at SpeakerDeck. The video was recorded, but I’m not sure when that will be posted.)
L.A. Law, a 1980′s evening television drama (maybe?) about some lawyers in Los Angeles. You should not watch it.
Franz Kafka, an amazing writer, perhaps best known for “The Metamorphosis“.
“Alice’s Adventures in Wonderland” by Lewis Carroll, a classic children’s story that’s really quite weird. But amusing.
Jim Henson, a genius, and creator of The Muppets.
“David and Goliath: Underdogs, Misfits, and the Art of Battling Giants” by Malcolm Gladwell. Really great book by a fantastic author (seriously: read all of his stuff). The key premise of the book: “We need a better guide to facing giants.”
“Why Students Don’t Like School?” by Daniel T. Willingham. A cognitive psychologist’s explanation on how we think and how we learn. Written for teachers.
Kathryn Schulz, “On Being Wrong“. A TED talk about the mentality involved with being wrong (vs. being right) and how that affects our lives and decision making. Brilliant, revolutionary, totally amazing.
“How to Ask Questions the Smart Way“, a classic web page explaining how to do better asking questions.
The discussion of “fixed” vs. “growth” mindset comes from the work of Carol Dweck. I first read about it in a The Atlantic article titled “Why Writers Are the Worst Procrastinators” by Megan McArdle.
“The Pragmatic Programmer” by Andrew Hunt and David Thomas. A standard book on being a good programmer. Nearly a must-read for developers.
“How Will You Measure Your Life?” by Clayton M. Christensen, James Allworth, and Karen Dillon. A rather heavy book on setting life goals and achieving them.
Friedrich Nietzsche, a 19th century German philosopher, known for his “man and superman” theory.
Steve Jobs, one of the founders of Apple, among other things. Also, kind of an a**hole.
May 12, 2014
Why You Should Finish Your Presentation Earlier
My goal today is to finish the rough draft of the two presentations I’ll be giving at php[tek] in Chicago next week:
How to Get There (keynote)
Faster Web Development with Yii 2 (technical)
In trying to finish up these presentations today–a full 10 and 11 days before I give each presentation (respectively), I’m reminded of the myriad benefits of finishing the presentations you’re giving way, way, WAY earlier than you’re probably used to.
I’ve been to conferences where there’s a dedicated speaker room, and there’s undoubtedly many presenters in there, actively working on completing their presentation, even up until the time the presentation is given. At other conferences, I’ve seen presenters in the hallways, or in the backs of other presentation rooms, working away.
Frankly, if you’re still working on your presentation while at the conference, you’re doing it wrong.
Here’s why you should have your presentations finished way, way, WAY earlier than you’re probably already doing it…
It’ll Be a Better Presentation
The more time spent on something the better it should be, right? Right. (Or, hopefully.) Getting a presentation done well in advance means you’ve given the whole thing a lot of thought. You’ve really analyzed what you’re going to say and why you’re going to say it. You’ve thought about, and repeatedly corrected, the order of material. You’ve caught any typos (that you’re going to catch, anyway).
If you’re still working on the presentation on the day of the presentation, any changes you make will not be well vetted. I know this from experience, more so in books than in presentations…
When you write a technical book, each draft of a chapter goes from you, to a line editor, to a technical editor, and to a managing editor, before coming back to you for revisions. Including your own review of that draft, that means there are four sets of eyes (at least) that review every word and idea of the first draft. But when you make changes during the review process, those changes will be seen by just the managing editor before being composited (i.e., converted into a PDF). To recap:
The original draft will have at least four reviews.
Rewrites will have one.
I can guarantee a large number of mistakes that make it into the final version of one of my books was made during the rewrites, including any serious ones. Any code changes I make during the rewrites won’t be inspected by a technical editor, and won’t be meaningful to the other editors. I’ve since learned to submit better first drafts, and to only make critical changes during the rewrites.
No matter who you are, any last minute work you do will never be as good as work done earlier. So do your work earlier.
It’ll Be a Better Presentation
Yes, the first two reasons for getting that presentation done ahead of time is that it’ll be a better presentation! (I mean it.) The first argument is that the quality of the slides and content will be better. In this argument, I mean that your ability to give the presentation–what actually happens in the room–will be vastly superior.
Scott Berkun brilliantly points out in his must-read book, Confessions of a Public Speaker, that most people are uncomfortable with public speaking. And what do you do when you’re uncomfortable with something? You put it off. You try not to think about it. So most people put off thinking about a presentation, working on it, let alone practicing it, because those are all reminders that you’ll be publicly speaking soon. Which you don’t want to do. The end result is that you’re less prepared to give the presentation. And when you’re less prepared, you’ll be more nervous. When you’re more nervous, the presentation will go more poorly, you’ll be really uncomfortable, and it will suck for the audience. And…this circle repeats.
If, however, you work on your presentation and you practice your presentation, the experience itself will be much, much better, for both you and the audience. I used to be in Camp A, and Berkun’s comment really hit home with me. Now I practice every presentation I’m going to give at least 3 times, if not 5, out loud. I use the same remote and laptop I’ll be using for the presentation. I treat my external monitor as if it’s the projector. Sometimes I even wear the same clothes I’ll wear on the day of the presentation. The only thing missing will be the audience, which is why I’ll still be nervous come presentation day.
I practice 3-5 times, or more, whether I’m giving 3 presentations at a conference (a la Northeast PHP 2013), or giving a 90-minute presentation (Boston PHP, 2012). This does mean that I put hours and hours into giving a presentation, but if you’re not willing to do that, then you’re not that interested in doing the best job you possibly can.
Also, being a writer, I tend to script my entire presentation–every word I’ll say–and then work on memorizing an ad lib-able version of that. That’s just my routine, for non-technical-demo presentations, at least.
You’ll Enjoy the Conference More
The final reason to get that presentation done in advance is that you’ll enjoy the conference more. Instead of being holed up in a speaker’s room, or not paying attention to the current speaker (how rude!), you can enjoy it. You can actually watch the presentations you want to watch. Sweet, right? You can have good conversations with new people and old friends. And you’ll waste absolutely no energy thinking “OMG, I have to finish my presentation!”
This also means that on the flight to the conference, you can relax and read a book. On the evening before your presentation, you can participate fully in the conference events, hang out in the bar, and stay up too late enjoying yourself. (But not too, too late: you have a presentation to give the next day, after all.)
If you’re not convinced by the arguments that the presentation will be better by getting it down well in advance, then take the selfish reason: you’ll enjoy the conference more.
Conclusion
I was always deathly afraid with public speaking, and I’m still rather nervous about it in general. But I’m no longer nervous about the presentation I’m going to give, because it’s done, and has been well rehearsed far ahead of time. And now, heading to the airport for a conference, I can shift my mind to “I’m going to go enjoy this”, instead of “I still need to do X, Y, and Z”. I can now attend, and pay attention to, the other presentations I want to see. And I can enjoy any conversation I get into, without fear of it eating into my last minute work on the presentation because I wasn’t aptly prepared.
For your sake as a presenter, and for my sake as a potential audience member, you should get in the habit of completing that presentation much farther in advance than you have been. Trust me: we’ll all be the better for it.
May 5, 2014
“Effortless E-commerce with PHP and MySQL (2nd Edition)” Giveaway
Approximately 1,000 years ago (or 5 months), I promised to give away copies of my “Effortless E-commerce with PHP and MySQL (2nd Edition)” book to those people that have purchased “The Yii Book“. The only problem is I had to create the code to do that. Which I now have. And it may even work.
If you’re interested in possibly winning a copy, log into your account. Then click the “Giveaway” link that appears in the navigation sidebar. If you can’t recall your password, use the reset link.
Pesky details of this giveaway…
You have until June 2nd to enter. You only need to enter once. In fact, you can only enter once. On June 2nd, I’ll pick the winners based upon an algorithm that favors those that purchased “The Yii Book” earlier (i.e., I’ll try to reward those that have been waiting the longest for completion of “The Yii Book”). I have 20 copies to giveaway. I’ll sign them, and I’ll cover shipping.
Understand that I have 20 copies to giveaway and there are up to 2500 (-ish) possible entrants. And I’m going to give away more copies to those that bought “The Yii Book” early. DO NOT BUY “The Yii Book” TODAY IN THE HOPES OF WINNING THIS OTHER BOOK. The odds are not with you. The primary purpose of this giveaway is to give something back to those that believed in me and my Yii book experiment, and to serve as a small “mea culpa” for how long it’s taken me to complete.
If you have any questions, let me know. In the meantime, I’ll be working on Chapter 21.
Thanks!
Larry
April 22, 2014
Chapter 20 (beta) of “The Yii Book”)
On Sunday night I posted Chapter 20, “Working with Third-Party Libraries,” of “The Yii Book“. The chapter is 39 pages long as a PDF, with the following contents:
Installation
Accessing Library Classes
Working with Composer
Using Symfony
Using Swift Mailer
Using Elasticsearch
Most of the chapter covers Elasticsearch, creating the shell of a search engine. This rules out the need for Chapter 24, “Implementing a Search Engine,” in my opinion. So, by my count, after this, there are 4 chapters left.
The only issue is that the tech editors haven’t reviewed it yet. So it’s a bit rough around the edges. But in order to get this to you ASAP, I thought I’d provide it now, and then do a formal update with both this and Chapter 21, “Implementing Unit Testing,” in the near future (hopefully by mid-May at the latest). In other words, the next update will be through all of Part 3.
Keep in mind that 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).
You can download this chapter, and the corresponding code, from your account page.
My thanks, as always, for your patience and feedback.
Larry
April 14, 2014
Yii 2 Status and Looking Forward
As you may already know, the beta of Yii 2 was announced yesterday. Besides being another release, which is a good thing, officially reaching beta status means that no new major features will be added before Yii 2 is released. In other words, what Yii 2 looks like in beta will be pretty close to what Yii 2 is. Yay!
Rather than discussing all, or the most important, changes in Yii 2, I’d recommend you read the announcement page linked above. As for how I imagine this will play out looking forward…
I expect the first general release of Yii 2 will be out this summer. I have a side project currently being developed in Yii 1, that I’ll convert to Yii 2 this summer, and complete using Yii 2, so that will provide me with some good insights into the new version.
As for writing about Yii 2, I’ll try to do one or more blog posts on it over the next few weeks: key features, switching to Yii 2, etc.. I’m giving a presentation on Yii 2 at php[tek] in Chicago at the end of May, so the coincidental timing works out in my favor. I’ll be doing a lot of thinking about Yii 2 over the next few weeks and months.
As for “The Yii Book“, I am still, of course, honoring my commitment to update the entire book to Yii 2. And anyone that’s purchased a copy of the book will get that update for free. I’m going to finish the book for Yii 1 first, though, for these reasons:
Yii 2 isn’t finished yet, so more changes in Yii 2 just means more changes in the book (i.e., it’ll be inefficient to rush into updating the book to Yii 2 right now)
Most developers are (and should be) using Yii 1 for the near future
Completing the entire book in Yii 1 will make the changes to Yii 2 that much more obvious and easier to highlight when I do the update
Tentatively thinking, here’s how I am hoping things play out (with the obvious caveat that I can’t be trusted when it comes to my timelines):
I’m very close to finishing Chapter 20, “Working with Third-Party Libraries”. (In fact, working on that more once I post this.)
Within the next month, I’ll also finish Chapter 21, “Implementing Unit Tests”. That chapter will complete Part 3 of the book.
Hopefully by the end of June, I’ll finish the book, as there are only three remaining chapters in Part 4 (Chapter 20 obviates the need for Chapter 24).
This summer I’ll revise the book for Yii 2.
Once the book has been revised for Yii 2, and is “stable”, I’ll pursue translations and a print run.
That’s my thinking/wishing, which I believe to be do-able. I also think the timing works out quite well with Yii 2′s progression.
As always, thanks to everyone for their interest in Yii, for their interest in the book, for their patience with a much-delayed and overworked writer, and for all the feedback and support along the way. Do let me know if you have any questions!
Larry Ullman's Blog
- Larry Ullman's profile
- 14 followers

