problematic.io
I just launched a new blog. I explain some of the reasoning behind it in its hello world post, but to sum up: WordPress isn’t really doing it for me anymore, and I want to blog about more than programming. Check it out!
I just launched a new blog. I explain some of the reasoning behind it in its hello world post, but to sum up: WordPress isn’t really doing it for me anymore, and I want to blog about more than programming. Check it out!
Holy cow, only 9 months late! Part 1.5 of the Symfony2 tutorial series I started a while back:
Hello! I was searching on stackoverflow in a way to authenticate my users after registration and I found your solution (http://stackoverflow.com/questions/5886713/automatic-post-registration-user-authentication). But for some reason in Symfony 2.1 this does not work, any ideas? Thanks for any help, im stuck here for about one week!
I stumbled upon your site while researching Symfony2 as a framework to use for a PHP project. I must say, Good stuff. I am glad to hear you will be posting more. I do know how life comes by and changes your plans! I will be watching your blog for more sf2 stuff! -Ken
Thanx man!
Finally got me started on Symfony.
“…I can promise that it won’t be nine months before the next episode.” — Well…? Three months since you posted this one… ;)
I’d love it if you made a tutorial on security.
The most awesome piece of Python I learned today? Testing for the presence of a substring using `in`:
>>> 'is' in 'this is a string' True
If you’re just getting into Python and you’re confused about [virtualenv](http://www.virtualenv.org/en/latest/index.html) (which you really should be using), give [virtualenv-burrito](https://github.com/brainsik/virtualenv-burrito) a whirl.
Curse you, @heroku, for convincing me to switch from AWS in the space of one quickstart tutorial. Well played.
— Derek Stobbe (@djStobbe) April 19, 2012
That was me, like ten days ago. I recently started trying to broaden my Twitter horizons to include more python-related stuff, since the vast majority of my feed was either PHP/Symfony2-related, or retweets of funny cat pics. So, I added the first Python user that came to mind, [@kennethreitz](https://twitter.com/#!/kennethreitz). As it turns out, he’s the Python Overlord over at [Heroku](http://www.heroku.com/), and tweets about it occasionally, so I decided to check it out.
Color me impressed. As I mentioned in my tweet, I did the [quickstart](https://devcenter.heroku.com/articles/quickstart) and by the time I was finished with it, I had already decided to make the switch. There are a few features that I _really_ enjoy:
1. Foreman, which is a command-line tool for testing your apps in the same environment that Heroku will use
2. Ease of deployment. `git push heroku master` and you’re done. Seriously. They take care of the rest
3. Seamless scaling. With Amazon EC2, I had to create a disk image, spin up a new EC2 instance, set up a load balancer… what a pain. With Heroku, you can have as many (or as few) processes running as you want with one console command, and load-balancing will happen automatically
4. Worker dynos. It’s really easy to spin up non-web-facing processes to manage queues and what have you
5. Free tier per app. Each app you create gets 750 free dyno-hours per month: more than enough for development and testing and low-scale production work
6. Suggestions for deployment. You can find tons of tutorials and guides for setting up development environments, but I’ve found very few that talk about creating a production-ready application. As part of the quickstart guide, Heroku actually goes into how to set up and use something more than the built-in development servers (gunicorn for Python, for instance)
Top all that off with easy-to-use add-ons (easy as in “click a button and it’s ready” easy), and I see no reason to ever go back to managing an Amazon EC2 instance again. There’s no “official PHP support” right now, but Heroku and foreman make it easy enough to develop deploy a Ruby or Python app that I no longer stress about setting up environments for them. A big win all around.
Hello,
this sounds very interesting. But what is “low-scale production work” for you? A community website with 100 daily visiting users? :D
Today I learned something about Python that I did not know before: single-item tuples must have a trailing comma.
I mentioned before that certain aspects of Django leave a bad taste in my mouth, and that I was looking to other solutions as I move my language of choice for web development from PHP to Python. However, in the end I really couldn’t ignore [my own advice](http://iamproblematic.com/getting-over-the-not-invented-here-mentality/), and I’ve been getting to know Django a little better, mostly for all the batteries included (user authentication, for example). I kinda like it. The automatic admin generator, for instance, is really nifty; at work, it lets to get the non-programmers in the other room up and running before the project is really anything more than a handful of classes.
The admin site is dynamically generated from your models, and has a concept called [fieldsets](https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fieldsets): logical groupings of fields in the admin form. From the docs, here’s an example:
class FlatPageAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('url', 'title', 'content', 'sites')
}),
('Advanced options', {
'classes': ('collapse',),
'fields': ('enable_comments', 'registration_required', 'template_name')
}),
)
Basically, a tuple of tuples containing the fields and other options. Anyway, while I was creating my admin class, I kept getting a weird error:
ImproperlyConfigured at /admin/foo/bar/add/
‘BarAdmin.fieldsets[2][1]['fields']‘ refers to field ‘x’ that is missing from the form.
Where the name of the field in question starts with the letter ‘x’. I was initially frustrated because the exception message isn’t very helpful, but it turns out, this isn’t so much an issue with Django as it is a gotcha in the way tuples work. My admin class contained a fieldset with only a single field, like so:
fieldsets = (
('Advanced', {
'fields': ('xylophone')
}),
)
Okay, ‘xylophone’ is a little contrived, but my example error from earlier started with an ‘x’. Shoot me. Anyway, after [RTFM](http://docs.python.org/tutorial/datastructures.html#tuples-and-sequences), it makes perfect sense. Since my single-item tuple lacked a trailing semicolon, it wasn’t a tuple at all, but an expression. And the expression `(‘xylophone’)` returns what, class? The string `xylophone`. Very good! Then the interpreter was trying to iterate over a string, only there is no field that matches the first item returned: `x`. Hence, an error.
This is why I find actual fieldwork with a new language, framework or library to be the best way to learn it, over reading the documentation or sourcecode or anything else. Now that I’ve learned that little tidbit of information, it’s mine and I’m unlikely to make that mistake again (or if I do, I’ll recognize it instantly when I see it). No amount of documentation-reading could possibly make it stick in my head like that.
So I mentioned before that I blogged every single day in March, and that I would be writing about it. I’ve either got to stop making promises on timelines or get better at estimating them, but here we are a few weeks after the fact… my post mortem for the March blogathon. A good post mortem has four things: a summary of activity, a review of what went right, a review of what went wrong/what could be done better next time, and a conclusion. So, without further ado:
### Summary
Thirty-one days of blogging, about various programming/software development-related topics. At least, that was the intent. I spent about a week beforehand brainstorming topics to write about; most of them I hit on, a few I didn’t feel like I had time (more about that later).
### What went right
I successfully posted every day, even if some of the posts were very short. I managed to put out what I feel is helpful information, mostly toward the beginning of the month. Also, putting thoughts in a public space turned out to be a _great_ sounding board.
### What went wrong
Switching jobs in the middle of March didn’t really help with putting as much thought and effort into my posts as I would’ve liked: things got _really_ busy, and the amount of energy I was able to put into blogging definitely suffered. Which wouldn’t have been so bad, except that being on a 24-hour schedule doesn’t leave a lot of time to develop ideas or do research. Most nights, I found myself starting to write at 10pm, rushing to get something semi-coherent out before midnight, and going back after to edit and revise. There are a few topics that I wanted to hit (backbone.js, for one) that I didn’t get to, because I knew the subject would suffer in the amount of time I could give it.
### Conclusion
All in all, it was a lot of fun, a little stressful, and worth it. I’d hoped that doing a blogathon would give me some exposure on the interwebs, and it seems to have done that… thanks to everyone who reads and/or comments regularly and all the insight that you provide, you people are great. I’m leaning toward a Monday/Friday update schedule from here on out; frequent enough to merit coming back on a regular basis, but with enough space in between to let me put some thought and effort into my writing (or at least, get _something_ out on the weeks where work is hell). The tentative plan at this point is to go back through and find posts that I thought had a good potential but could’ve been better, and give them more love… since I’ve been diving headfirst into both the Python and JavaScript worlds, I should have a lot to say on new subjects as well ([flask](http://flask.pocoo.org/) is great, doncha know).
After completing my March blogathon (I posted every day for a month… go me), I’m taking a break this week, and then I’ll be back with a Monday/Friday schedule.
I’m currently writing up a post-mortem on what I learned from the exercise, so you can expect to see that on Monday. And if you have any topics that you’d like to see after that, you’re always welcome to drop me a line at djstobbe@gmail.com.
Tonight, we were at my brother-in-law’s for dinner, and his two year old wanted him to help her with her food. The chicken had already been cut into small pieces, and the bowtie noodles weren’t very big, so it wasn’t like she _couldn’t_ eat it herself… she just didn’t want to make the effort.
My brother-in-law did something cool: he asked her, “What do you want me to do? Show me.” And then he had her walk through exactly how she wanted him to help her eat the food: stab the chicken with the fork, dip it in ketchup, and eat it. “There! You just did it! You don’t need my help at all! Good job!”
That got me thinking about the approach I take to helping people with their problems. If I’m not terribly busy and I’m in a good mood, I might be willing to spend a few minutes to explain the solution, but very rarely do I help people help themselves: spoon-feeding might put a band-aid on the problem, but the next time they need help, they’ll come right back to you.
A wise man once said that the best lessons aren’t given, they’re caught (as in, catching a fish versus having someone give you one that they caught themselves). Most people aren’t incapable of learning how to solve problems on their own, they’ve just been conditioned to ask for help and receive it without a challenge.
I’m making a commitment from now on to give people the pieces and the tools they need (like I said, the chicken was already cut up for my niece… the part of the problem that would’ve been beyond her skill had been solved for her), and helping them come to their own conclusions. Once people start to see that they _can_ solve their own problems, and have before, it sets a precedent and starts a pattern of self improvement. Which is great for the days when I’m in a bad mood and don’t have time to field questions.
I think the matter is mostly that people try to build things the way they were used to be. But as it happens in programming and when we get to new tool, we tend to try the old way instead of learning why that new tool is built differently. So old solution do not work anymore. That is the case with symfony2. That is a good commitment you have. I found your articles indeed very insightful. I keep you in my own blogroll.
You remember a few years back, when the market for health information management exploded, and everyone was throwing money at startups targeting it? I think I figured out what the next _that_ will be. There was an article published on nytimes.com a couple days ago called [A Surge in Learning the Language of the Internet](http://www.nytimes.com/2012/03/28/technology/for-an-edge-on-the-internet-computer-code-gains-a-following.html?_r=1), that hits on a big one:
> The market for night classes and online instruction in programming and Web construction, as well as for iPhone apps that teach, is booming. Those jumping on board say they are preparing for a future in which the Internet is the foundation for entertainment, education and nearly everything else. Knowing how the digital pieces fit together, they say, will be crucial to ensuring that they are not left in the dark ages.
I’ve been thinking about this, and I don’t believe that the apps and businesses in this market that are going to be wildly successful will be targeting people who want to be programmers. There’s already plenty of ground covered there (the article mentions Codecademy, which wants to monetize by helping recruiters and companies find new programmers). I think the tools that will see the most success are those that try to put computer programming in the skillset of people whose jobs aren’t related to software development at all: receptionists and doctors and what have you… people who aren’t interested in making a living as a developer, but who realize that knowing how to write a simple program will help them stay competitive in the job market.
Think about it: how many people do you know who have some part of their job which is just mind-numbingly repetitive work? If a receptionist knows how to parse a CSV file with a simple script instead of copy-pasting for hours, and their competitors do not, they’ve _instantly_ gained value as an employee. Everyone benefits.
Of course, it also helps that being a programmer is sexy right now, and being a “nerd” has gone from being a derogatory term to one of praise. The time has literally never been better for the uninitiated to break into the world of computer programming; it’s really just a question of who will take them there.
Much appreciated video :)