simpler blog
I've set up a simpler blog and will be deleting this posterous very soon. if you're interested in remaining subscribed, head to davezor.net.
I've set up a simpler blog and will be deleting this posterous very soon. if you're interested in remaining subscribed, head to davezor.net.
It's sometimes hard to figure out exactly why certain companies are successful. Often times it seems to be a magic-lightbulb moment and the mere idea is something lots of people will instantly pay for. Other times the idea is more general but the defaults are set correctly -- and there's no choice. The iPod comes to mind. It's an old story -- mp3 players had been around for awhile and nobody expected the iPod to be anything spectacular. Apple's previous performance (until Steve Jobs came back) was nothing to brag about. But they got the defaults right, they got the design right, and they executed extremely well. Good engineering coupled with good marketing won them the vast majority of that market, to the exclusion of nearly every single competitor.
Just came across a cool little decorator use.
I'm using Python fabric for Djangy.com deployment. We have a production server, a stage server, and a local VM for development. The IP addresses for the two servers stay the same, while my VM's IP address changes according to whatever network I happen to be on.
Ideally, I'd like to run any of the following:
Now, I could simply alias 'stage' and 'production' to their respective ip addresses. But where's the fun in that? Instead, I added these two strings and their corresponding IP addresses into constants and then put them into a HOSTS dictionary:
Then I created a python decorator that checks the host argument and swaps it out for the right address, but only if it's included in the HOSTS dictionary. Otherwise, it lets it pass through unchanged.
The new thing I learned here was the ability to unpack the calling arguments in a decorator. You can specify them individually and then say *args to denote "the rest" of the arguments. Useful to know! Now, I can call any of those hosts by their aliases, or I can simply specify a hostname or IP address.
If you run into this error when you first try to clone your gitosis-admin repository, the solution is to run:
git --exec-path
and copy that into your gitosis user's .bashrc. (Mine was /usr/local/git/libexec/git-core):
PATH=/usr/local/git/libexec/git-core:$PATH
Done!
Yes, another rails post. This time I'm sharing a solution.
I have a class I wrote to utilize the Delayed::Job functionality of Heroku. I tried to use the standard rails logger.info("some error") and it kept throwing exceptions.
The solution is to add the following line to your class:
logger = RAILS_DEFAULT_LOGGER
Everything is perfect after that. (Well, okay, rails is far from perfect, but whatever).