What is Larry Thinking? #27 => Flex, Getting Published, and Coming Full Circle

April 24, 2010

In this edition…

About This Newsletter

Answers to some questions, a couple of interesting things I’ve seen online…all this and more in my latest newsletter! As always, thanks for reading, and for your feedback and questions.

On the Blog => A Simple Approach to Site Security

I write about security quite a bit in my books, but normally (because of the format of the books), the focus is on individual techniques. I’m trying to put together some posts on my blog that look at the bigger picture and more of the general thinking. To start, I wrote one called “A Simple Approach to Site Security“. In it, I both talk about security from a programming perspective, starting with the database even, and then how I simply test the security of my sites by trying a few basic things.

On the Web => BumpTop, the Snazzy Desktop App

I recently StumbledUpon BumpTop, a commercial product that greatly changes (dare I say “revolutionizes”?) how you use your computer’s desktop. It runs on both Windows and Mac OS X and is quite reasonably priced. The best way to get a sense of BumpTop is to watch the videos available at their site. I haven’t personally used the application, as I don’t even see my desktop that often, but it’s a really cool product that’s worth looking at.

On the Web => Excerpt from “Effortless Flex 4 Development”

Peachpit Press, publisher of my forthcoming “Effortless Flex 4 Development” book, has published an excerpt of the book online, free for anyone to read. (Technically New Riders is the publisher, but New Riders is owned by Peachpit.) The article represents the first several pages from Chapter 4 of the book, “Event Management”. Even if you don’t yet know Flex and ActionScript, you should still be able to follow along. Most importantly, Flex is largely an event-driven approach to application development (conversely, Flash Professional is primarily a timeline-driven approach), so this section is really a key insight into what it’s like to use Flex.

I believe another excerpt from the book will be published soon, and I’m currently working on two “5 Tips in 5 Days” blog posts for Peachpit’s site. One will be specifically on the Flex 4 framework and the other will be on Flash Builder. Flash Builder, in case you’re not familiar with it, used to be called Flex Builder and is just a commercial IDE for developing using Flex. You don’t have to use Flash Builder as the Flex 4 framework and its SDK are available for free, but it does ease the process significantly. The book does not assume you’re using Flash Builder, either. There are specific instructions for how to create Flex applications using a text editor and the command-line IDE, but there are also areas that cover how you would do X or Y using Flash Builder. Most of the book focuses on the Flex framework, so it doesn’t matter what development tools you’re using.

On the Web => DMC Insights, Inc. Reaches a Million Hits

Last month (March, 2010), my company’s Web site, www.dmcinsights.com, reached one million hits for the first time. This isn’t “significant” so much as I think it’s interesting. I don’t sell advertising on the site, so it’s not like I make money off of the hits, but it seems that the increase is thanks to my blog, in particular thanks to my “Learning the Yii Framework” series, which is getting the most attention (the support forums generate hundreds of thousands of hits, too, but that has been the case for years). Still, hopefully later this year (after I write two more books!), I’m going to do a major overhaul of the Web site in order to better build my “brand”. The first thing I’ll need to do is figure out what that means, not being a marketing person…

I say that a million hits isn’t significant because the number of hits isn’t that good of a measuring tool. For starters, a “hit” includes everything the user requests. For a simple page, this includes the HTML document, every JavaScript file, every image, the CSS files, even the favicon! So the act of a user loading one Web page may easily be 20 or 50 hits (my sites are largely without graphics, so they probably each only constitute 10 hits, more or less. And some of those hits are my visiting the site. Still, a million hits is a lot better than a thousand hits.

One last interesting note here, is that my site is successfully handling a million hits a month using an entry-level VPS hosting account at $50/month (US). (There are a few other sites on the server, but those probably don’t generate 10,000 hits per month all together.) So when you’re developing a site and think you need some over-powerful, dedicated server to start, think again.

Q&A => What’s your current development setup?

My primary computer is a Mac Book Pro, on which I’m running Snow Leopard, the latest version of the Mac OS (and while I prefer Macs, one has to admit Apple is becoming a petty tyrant and doing many of the controlling things that we lambasted Microsoft for; although Apple has yet to make us cope with an IE6; but I digress…). When I need to use Windows, primarily for testing code and for taking Windows images to use in books, I do so through VirtualBox, Sun’s free virtual machine. I have used both Parallels and Fusion for VM purposes, but found them both to be less reliable than I’d prefer. I’m still running Windows XP, though, as I haven’t been compelled to pay for an upgrade to Windows 7 (although I have heard good things about that OS).

I keep switching back and forth between using Firefox and Safari as my primary browser. Each has features I like; each has features (and performance issues) that annoy me. For almost all of my programming I’m using a plain text editor called TextMate, which is really excellent. It has a ton of macros in it for doing code completion, making the shells of functions, syntax highlighting, etc. As I’m doing a lot of Flex development, I’m also using Flash Builder quite a lot. It’s based on Eclipse, which is perhaps the most popular open-source IDE (Aptana Studio, which I like, and many others are derived from Eclipse).

Most importantly, I spent quite a bit of time this past year playing PopCap‘s Plants vs. Zombies game, which is imaginative and sufficiently addicting. It’s available to try for free online, and will run on Windows, Mac OS X, iPhones, and the iPad. Check it out when you don’t mind losing an hour or two! Thanks to Andy for the question.

Q&A => How do I get published?

I wrote about this in a newsletter in December 2008, but it’s still a common enough question that I thought I’d address it again (and Kamran asked this not too long ago). Getting a book published is really a matter of having an idea that a publisher thinks is worth doing, and convincing them that you’re the one to do it. The hardest part is clearly coming up with a book idea that is worth doing and hasn’t already been done. It’s easier to do this if you’re considering a brand new technology or language. For example, in the past year I’ve had opportunities to write books about the Yii framework and a server-side JavaScript technology called Jaxer. You’ll have a really hard time convincing a publisher to do another JavaScript or PHP book, unless you have a really unique approach (but still broad enough to have a good audience). If you’ve not worked for the publisher before (even if you’ve worked for others), they’ll most likely want a writing sample (like a chapter out of the proposed book) to know what you’re capable of. If you’ve done quality blog posts or online articles (for free or for pay), that can certainly help to indicate that you have applicable experience.

Really, the most important thing is that you do your homework. First, you can’t go to a publisher with a book that’s too similar to one they’ve already published or that’s too far off from the kinds of books they put out. In either case they’ll just reject you outright. Second, most publishers have submissions guidelines online. If you don’t do a good job of finding, reading, and abiding by those guidelines, you’re not giving the publisher much hope that you’ll be able to adhere to the rigors of writing an entire book.

Q&A => How do I automatically backup my databases?

Martin had asked some time ago how one goes about automatically backing up one’s databases. Doing so is pretty important and something you should strongly consider doing for your clients, if not yourself. When using MySQL, the mysqldump command-line utility is what you want to use. You should check out the MySQL manual (for your version of MySQL) to see all the particulars for using mysqldump, but it’s primarily “mysqldump database_name” (without the quotes). Of course, to execute this command on a database, you’ll need to use a username/password combination with access: “mysqldump -u username -p password database_name” (without the quotes, replacing username, password, and database_name with your actual values).

To have the database backed up automatically, you’ll need to turn to a scheduling tool, such as cron on *nix systems. This means you’ll need authority to create crons on your server (this is common enough on many hosted sites). I normally have the mysqldump command execute sometime between 1am and 5am, when the server isn’t likely to be used as much. To indicate where to store the MySQL backup, add “> /path/to/somewhere/backup.sql” to the end of the mysqldump command. The > means to output the result to the given filename. The /path/to/somewhere.sql must be correct and the user that the cron is running as must be able to write to the /path/to folder. So if you can get the right syntax for the mysqldump command and you set it to automatically be executed, you’ve now got daily database backups, but on the server. (As a tip, I normally change the outputted file name to include a timestamp so that I’m getting a new backup each day and can revert the database to a given date and time.)

A backup on the server is a good start, but not as good as a backup offline. For my clients, I do perform regular backups of their entire site, so that any file changes will be stored on an external hard drive in my office. When I do that, weekly, I also download the database backups. If you want something more automated, you could look into creating another cron that calls a PHP script that sends the backup somewhere. (As another tip, I normally use a cron to compress the backup to make its transfer faster.) That PHP script could, in theory, send the database backup as an attachment in an email, provided that the backup won’t be too big. For my support forum, the database is about 105MB in size, so sending it in an email is out of the question. If you really want to automate the whole process, and have another server you can use for storage, you can have the PHP script FTP the backup file to that other server.

What is Larry Thinking? => Coming Full Circle

I’ve long been a big fan of a Mac program called QuickSilver, which is an application, document, and Web site launcher, plus so much more. It was really the one program I used most, as I used it every time I opened an application or a recent document, did a Google search, calculated some numbers, and so forth. Unfortunately (or fortunately for him), the person that developed QuickSilver was hired by Google to create a similar program, so development of QuickSilver floundered. The source code is available, so other people can take up the cause, but… When I switched to Snow Leopard, the latest version of Mac OS X, QuickSilver became too unreliable. In doing some research to find the solution, I came across a quote from QuickSilver’s creator where he indicates surprise that people are still trying to use QuickSilver on Snow Leopard and they haven’t just switched over to LaunchBar. So I switched.

Even though LaunchBar is a commercial application (QuickSilver is free), switching didn’t cost me that much as I had a license for an older version. In fact, when I thought about it more, I recalled that I talk about LaunchBar in some detail in my “Mac OS X Timesaving Techniques for Dummies” book, published 2004. So I’ve come full circle on this one: I used to love LaunchBar, then I dropped it for QuickSilver, now I’m happy with it again. Besides the irony of it (not just that I used to use LaunchBar but that I wrote about using it), I took this as a good reminder that it’s worth while to re-evaluate things repeatedly. Such as: The JavaScript of today is clearly not the same JavaScript I learned 10 years ago. Microsoft Windows of today is not the worthless, unsecure Windows of 1995 or 1999.

I believe I once wrote in a newsletter about how I don’t believe in reading manuals so much as re-reading manuals. Which is to say that manuals are most useful after you’ve used a product for a bit. Then you can learn how to use it better, with some context. (Just don’t wait too long–to the point where you’re set in your ways– to revisit a manual.) I guess what I learned in coming full circle is that it’s very important to continue learning new things, but it’s valuable to re-visit old things, too. In my first newsletter, I explained why I wasn’t doing a blog; now I’ve got a blog. In the previous newsletter I said that I don’t use Twitter, but my publisher is strongly recommending that I do so. Things change. But I’m still probably not going back to Windows anytime soon!

Larry Ullman’s Book News => Effortless Flex 4 Development

I’m continuing to work on my next book, permanently titled Effortless Flex 4 Development. I’ve finished the first nine chapters, having just completed Part 2, on data: displaying, formatting, validating, and transmitting it. Chapters 7-9 consist of about 100 pages dedicated to the client-server relationship, using PHP and MySQL on the server end and I’m pretty happy about that content. I just turned in a chapter from Part 3, which means I only have three or four chapters left, depending upon the total page count.

The book is still available to read, as I write it, through Safari Books Online. It looks like the list price of the book will be $44.99 (US), but Amazon’s currently selling it at $29.69 (that’s four dollars cheaper than I first saw it listed at about a week ago). I’ll be finishing the first draft of it within the next couple of weeks so it should be out in July.