Tag Archives: Zend_Framework

How to get your talk accepted, experiences on the advisory board of Semtech & Zendcon

This year I was honored by the organizers of Semtech and Zendcon to be on their advisory board.

I always love reading pre & post-conference articles by board members, so it’s only right to blog when it’s my turn.

This will serve as a pre AND post mortem, as Semtech has passed and Zendcon is upcoming.

Background
For those who don’t know what an advisory board is, conference organizers get loads of proposals and need help deciding who should speak. So they ask others in the industry to provide some feedback. It was quite a learning experience.

Speaker Backlash
Speakers don’t like to get rejected. Understandable. Watching the process on this end… from proposal to acceptance/rejection being played out on Twitter, I think it’d make a great TheOatmeal or XKCD.

e.g., you see a proposal littered with spelling mistakes…insane comments….on a talk that’s been proposed by 5 other people. It gets unanimous rejection votes. Then the speaker takes the case to twitter, and fans who haven’t even seen the proposal discuss the stupidity of the conference in rejecting it. It’s hilarious!

When you look at the comments on Twitter, you’d think these choices are a no-brainer. In fact, and I’m not sure if I’m allowed to provide actual numbers so I won’t, there are FAR more proposals than spots. FAR more. Good talks WILL get rejected. And it will break our hearts.

So don’t expect to get into any one conference. Or at least not in a particular year. But if you’re determined to become a conference speaker, there are plenty of things you can do. You WILL succeed if determined. You may have to work hard on it, but you can get there. Read on.

Professionalism and Courtesy
I’m amazed at the arrogance of some submitters. You’ll get an “important” person who doesn’t fill out the basic info. Just a one-liner, thinking their reputation will let them in.

Unfortunately, often it does. And I tend to vote that way more than others, because the goal is to put on the best show for the attendees, not to “punish” arrogant assholes. If you got speaking chops, we owe it to the audience to let you speak…

That said, if there’s a tough choice between two great speakers, guess who will get the nod? Or if there are two rooms, one “better” than the other…do you think arrogance will help curry favor?

As an aside, and I hate even mentioning this, the lack of common courtesy by many in our field is appalling. I have been disappointed over and over again after putting people together with jobs and gigs, how often folks don’t even say “Thank you.”

I’ve had several instances where I had to find out from the client (consulting) or the company (full-time) that they hired a referral!

If you’re a shitty person, don’t worry. Pretending to be “courteous” won’t turn you into a nice person. But it is a smart career and life move. So please, try to fool us! Thank you.

Getting your talk accepted
If you want to get accepted at a talk, let me tell you what will help sway the board. Particularly if you’re not that well known.

First, take the fill out form seriously. Keep in mind that there’s not a lot of money to be made in conference software. Therefore, it’s usually built in-house. So even if the form isn’t that great, it doesn’t mean you don’t need to fill it out fully or put a lot of thought into how you present your proposal.

Think about it. If you can’t give the board a compelling reason to pick you, why would we expect that you’d be able to give a great talk? Honestly, it’s *shocking* how poorly people are filling out these forms.

Second, have you honed your speaking skills? Don’t expect to start out at a major conference. That’s a horrible place to practice your talk. Approach your local meetup organizer and ask if you can speak. You can do that right now in fact. If you’re going to be in the LA area, drop me a line. gmail is joedevon. Or ping me on http://twitter.com/joedevon. If I don’t /(co||run)/ a meetup related to your field, chances are I’ll be able to refer you to someone who does.

Even if we think a speaker is mediocre, you’ll usually get at least one chance to prove it.

How to turn an otherwise rejection-worthy talk into an approval?
There are several major things you can do to get a yes. Whet our appetite! Chances are, if we’re reviewing proposals, we know the field pretty well. We’ve heard most of the well-known speakers. We’ve heard podcasts on most topics. Other than the contacts, why do even attend conferences? To learn something new of course.

So ideally, come up with something new! Invent something (more on that below). But if you can’t do that, at least provide us with something different. Pick a difficult topic and learn it inside out. Give us the nitty gritty details we might not otherwise know.

It’s not enough that it’s in your talk. We need to know this somehow! Give us your slide deck!

I’ll give you a simple example. Memcached. I’ve heard quite a few talks covering the topic. The then-DBA of Facebook was my first one. In fact, that was one of the first talks I ever organized. Another speaker is Ben Ramsey. How can you compete with that?

Along comes Ilia Alshanetsky. Here’s slides on his latest version of the Memcached talk. He teaches you about the benefits of the igbinary…which wasn’t that well-known when he started talking about it. And if you use Memcached & don’t know what I’m talking about, listen to a previous Zendcon talk of his. It was excellent! And a perfect illustration of how to compete in a crowded marketplace.

I only mention this particular case because it was before I was on the advisory board and yet is an example of a talk that excites me. For work, I live in caching layers all day long. It’s not every day you can teach your techops guy a new trick 😉 Thanks Ilia 😉

Share your unique experience
So you aren’t the DBA of Facebook. Fair enough. But I’m sure if you’re at the stage that you’re ready to speak, you have some unique experience. Focus on that. What did you learn because of what you’re working on that can help teach others?

Can’t come up with something? It’s very easy. What problem frustrated the heck out of you? How did you solve it? You probably aren’t the only one with that problem. If you can’t remember a previous problem, just remember the next time you’re frustrated, can it be a good topic for a talk once you solve this?

You a consultant? Share your secrets. The chances that you’ll lose business to competition by doing so are VERY low. But the likelihood of getting business as a result of a well-received talk? VERY high.

Come up with something new
Come up with a brand new topic. If an established speaker is cornering the market on “widget” talks, invent a new field where you are the only speaker! That will establish you as the go to gal. We all like to learn new things.

For a good example of this, check out Tim Wright, AKA @csskarma’s blog. He likes to go where no one else has gone. This opens the door to him to get talks accepted as well as articles in major e-journals.

I remember a recent talk he did on getting dropdowns on touch devices working right. He came up with original stuff by reading Safari docs that few people have. It was painful. But when he reached the a-ha moment, I’m sure he felt it was worth it.

Being somewhere new gives you lots of room to breathe. And shine.

Joind.in, Meetup, Slideshare, Twitter
Lanyrd and Google+ are good too.

We are active on all these sites. Make sure you’ve got a healthy profile on each. Joind.in is helpful to know how your talks have been rated. Slideshare lets us look at your history. If you have tons of presos, you probably don’t suck.

Not being on Twitter doesn’t mean you’re a bad speaker. But boy do speakers in particular have a lot to gain from the “open-faced” social networks. IOW, twitter, G+. Facebook is more for friends…

If you’re “working it”, and have 100,000 followers on Twitter…. and you tend to promote the conferences you speak at, don’t you think this might influence the organizers a bit? Maybe not.

Maybe the jury takes it to heart when a judge instructs them not to let the fact that *a man’s daughter was raped* influence their verdict on his murder of said rapist.

I’ll tell you this. It couldn’t hurt.

Conclusion
I hope I’ve given you a few ideas on what attitude you should have in life if you want to succeed. Wait, did I just say life? Yes… because having a winning attitude will help you get a new talk, a new job, a new wife, a new life.

So be professional. Be courteous. Take your lumps with grace. Appreciate opportunities you’ve been given. And if you aren’t at the top of your field, create a new one!

Next Time
I should really blog about my Semtech experiences. Man oh man, it was something else. Especially the Birds of a Feather.

Setting up first Lithium project

I’m now starting my first Lithium project. So I thought I’d jot down notes while playing with it. Just random stuff. I’m not trying to accomplish anything in particular with this post. It might be interesting to you if you’re planning to try it out. Especially, if like me, you’re used to Zend Framework.

So far the docs are a little better than I expected, as we aren’t yet at release 1.0. But we should expect some speed bumps.

The first thing I noticed is the suggestion to install the whole framework under the docroot. To see the homepage you go to http://localhost/lithium . I’m sure that will change though so that your application code doesn’t live under your docroot. If you’re doing anything other than development, obviously you can and should fix this in production.

Something I like about the Zend Framework coding standards is the lack of an end php tag ?>. Having been bitten by that spacing after the endtag “bug” before, it now looks weird to me to see the end tag closing up a file. Hopefully #LI3 will follow Zend’s lead on that.

If you’d like to peruse the #LI3 coding standards, they are here. Overall I really like them.

Not sure what’s wrong with casting using shortcuts. Is it really ambiguous to say (int) $var rather than (integer) $var? (not a big deal in the scheme of things though)

Side note, I wish the PHP community would come to a consensus with the underscore thing before _protected methods.

I got used to it with Zend Framework. Now there’s a poll about removing it or not and last I looked it seemed that it was going away.

I just hope everyone keeps it…or removes it…but we make a community decision so that we don’t have another of these tabs vs spaces debates for the next 10 years. Which leads me to my next point. Kudos to #LI3 for choosing correctly with tabs 😉 I thought I was in the minority about that. Certainly seems that way in the Open Source community.

One more thing. Just installed the Lithium Documentation Tool. This is so cool. Really excited to learn more.

I’m going to end this post with a little list of #LI3 RSS feeds that I started to follow. It may be updated periodically and do let me know if you know of any others:

http://nitschinger.at/
http://dev.lithify.me/lithium/wiki/blog.rss

How to integrate Amazon AWS PHP SDK with Zend Framework

I was really excited when I heard that Amazon released the AWS PHP SDK. They hired the developer behind CloudFusion, Ryan Parman.

Some things lend themselves well to a library, because they aren’t that fast-moving. Zend Framework’s services are extremely useful.

However, if you’ve ever attended a talk by one of the AWS devs, they inevitably reach a slide where they show you the list of products they’ve released and when. The pace is rather impressive.

Even Zend, with a huge list of contributors, will have a tough time keeping up. As Till says, this is a situation where you want Amazon to support the AWS service code.

Unfortunately, you can’t just drop the SDK into your library and integrate it with Zend Framework. I haven’t fixed all the details yet, but my goal as I write this is to get a PHP Unit Test to pass.

If you don’t plan to use this for awhile, just wait, as Ryan is planning to work on integrating with Zend.

This is an early release of the SDK and there are a couple of things that bothered me a bit, but I’m sure they’ll fix it up. To give you an idea, I’ll just quote Harold on the blog’s announcement page:

I have to be frank, there is lots of room for improvement in this SDK. Where are the unit tests? Also, what’s up with the file naming convention, and having multiple classes per file? This prevents us from using class autoloading. I’m not sure what format the docblock comments are in, but they sure aren’t standard PHPDoc, and therefore do not integrate with NetBeans/Zend Studio/etc. Also, the CFUtilities class could at least contain static methods, eliminating the need to instantiate it.

OK, let’s begin. Download the SDK here. Or use Pear. Assuming you’re using the recommended Zend Framework project directory structure, create a directory called Aws under your library folder. Drop the files from sdk-1.10 in there.

I haven’t totally figured out how I’m going to be using the SDK yet, so for now I created a Model called Model_Aws. Unfortunately, the SDK wants you to modify their sample configuration file and rename it config.inc.php.

As you know, in Zend Framework we have a config file that allows us to offer up different values depending on environment. So we aren’t too interested in using another, less flexible, config file.

Fortunately, you can pass the config data into the constructor. We want everything of value from the SDK’s config file to be in our application.ini file.

So what I did was, where the SDK has “define(‘AWS_KEY’, ”);”, in application.ini I put “aws.key = my_key_here”. Same concept for all the other constants, with the exception of “define(‘AWS_ENABLE_EXTENSIONS’, ‘false’);” which I’ve left in the SDK config file. Comment out or delete the constants from the SDK config.

If I just lost you, that’s because I’m assuming you’ll put some effort into figuring out how to find your keys. This is not a beginner’s tutorial or for people unfamiliar with Amazon AWS… OK, where was I?

Before I show you where my Model_Aws class stands for now, I want to mention that for convenience I put my config in the Registry. So this method is in my Bootstrap.php.

I haven’t been able to get beyond including the sdk file, because of errors, so my Model_Aws class (filename /path/to/models/Aws.php) has only this in it. We’ll add more as soon as I can run a Unit Test without error.

My unit test is in /path/to/tests/application/models/AwsTest.php. Here’s the contents. OK, on the command line I run:
phpunit –configuration phpunit_local.xml –group aws

and Woaw! I get an html file getting spit out onto the console. Not good.

So open your phpunit.xml file…you should have an exclude section. In there add this in order to exclude /path/to/library/Aws . This way PHPUnit won’t go through the files in there to generate the code coverage report.

Now try. And…Bingo! Test passes.

OK let’s figure out something useful to do now. How about we just take the S3 sample that the SDK comes with, modify it a touch and just create a unique bucket and upload some files…and count that we have as many files as we created.

Now this isn’t necessarily the most useful unit test ever, but my whole purpose was just to prove that I got the SDK playing nicely and my unit tests now pass. Here is the final version of the Model_Aws and AwsTest.php.

Got any questions? Post a comment below or ping me at http://twitter.com/joedevon.

Running PHPUnit + Zend Framework in different environments

One thing that I haven’t seen any of the tutorials cover is how to handle running PHPUnit in different environments. Most people are just setting a new APPLICATION_ENV called ‘testing’, put a section in application.ini called ‘testing’ as well, and leave it at that….

What I’ve found, is that I’m using various things that will change in different environments.

For example, on local I just create a shortcut domain in my hosts file so I can easily play. So if I’m building a site for someverylongexample.com, I just make x.com my localhost. Which works great for me. See, I’m lazy.

Then some clients like to have a different domain for staging so they can point to different databases, or whatever reason.

And then you may just want to run a few tests with an environment of ‘production’ or ‘development’. For example, I only log to firebug on local or dev.

Frustrated, I just modified the usual settings you see.

Before going any further, make sure you check out a basic tutorial on Zend Framework and PHPUnit. For example:
http://weierophinney.net/matthew/archives/190-Setting-up-your-Zend_Test-test-suites.html
or
http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/

Done?
Good.

So here’s how I modified the files to cover these requirements.

1. instead of running phpunit off of phpunit.xml, I renamed that file phpunit_local.xml.

So on the command line, you’ll run this:
phpunit –configuration phpunit_local.xml

The contents of that file are (I’ve had it w/ WordPress messing up my formatting. Why do they have a CODE tag if it doesn’t handle much of anything very well? I’m going to put this on pastie.org and pastebin.com & hopefully one of them will survive as long as this post stays relevant):

Pastie

or

Pastebin

2. You probably noticed that instead of pointing to the bootstrap.php file, I renamed it bootstrap_local.php.

Here are the contents:

Pastie

OR

Pastebin

3. I wanted to be able to override the APPLICATION_ENV to test production/dev/local from time to time. So I modified the ControllerTestCase.php as follows:

Pastie

OR

Pastebin

Now you can test whatever environment you want by just overriding _setAppEnv().

This way, when you switch to prod, you’ll have a robust test to run that things work in the new environment. This happens to be one of the most important aspects of Unit Tests that no one seems to speak about. You usually have a slightly different environment and it can break things. If you’re only running your unit tests on local, you’re really missing one of the key benefits of all this effort.

If you think I’m way off, or have ideas on improving this code, leave a comment or ping me on twitter.

P.S. I just took a look at Matthew’s post on Zend_Test, which I had just found through a Google search, and noticed he uses a TestHelper.php. You can certainly do something very similar with the TestHelper…which is analogous to the bootstrap.php file I was using.

2nd Update: Forgot to mention, obviously you can’t redefine constants, so you may just have a subset you want to test. I’m assuming that you’re organizing things with the wonderful @group functions of PHPUnit and that you run this intelligently.

How to get InArray working for Zend_Validate with a Zend_Config_Xml object

I ran into a problem today and solved it, so I’m just going to quickly jot it down in the hopes it helps someone out. I’m creating a form out of an xml file and needed an InArray Validator. So here’s how you do it: (The Code and Pre tags aren’t working so I substituted < > with [])

[gender]
	[type]select[/type]
	[options]
		[label]Gender:[/label]
		[required]true[/required]
		[!-- gender is custom defined mootools validation --]
		[class]validate['required','gender'][/class]
		[validators]
			[inarray]
				[validator]InArray[/validator]
				[options]
					[array]male[/array]
					[array]female[/array]
				[/options]
			[/inarray]
		[/validators]
		[multioptions]
			[gender]Choose One[/gender]
			[male]male[/male]
			[female]female[/female]
		[/multioptions]
	[/options]
[/gender]

The only thing that still bugs me is that under multioptions, the Choose One shows up as value=”gender” when I’d like it to have a value=””.