PHP with gettext support on Mac OS X

PHP comes installed on OS X by default but it doesn’t come compiled with gettext support. So once you try to do something with gettext you will likely see something like this error message:

Fatal error: Call to undefined function bindtextdomain()

At this point you might be tempted to recompile PHP to add gettext but in fact there’s a better way, you can simply add it as a dynamically loaded library.

To do that download your version of php and do the following:

(inside the php directory)
cd ext/gettext
phpize
MACOSXDEPLOYMENTTARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bindatload" ./configure
make
sudo make install

When done, edit your php.ini (normally located in /etc) and add:

extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/gettext.so

Next just restart apache and you should be all done.

On User Experience..

“But it wasn’t until we’d invested an additional 400 hours improving the user interface — fully two thirds of the overall development cost — that we felt we had a minimum viable product — i.e. a product that delivered the core functionality, and within an experience so delightful that the users would want to tell others about it.”

http://makaluinc.com/blog/2011/07/minimum-viable-product.html

Getting your Google+ Updates Into Your WordPress Blog

1. On Google+ get your user id from the URL (the large number):

2. Go to http://plusfeed.appspot.com/ and add the Google+ user id at the end of it’s URL, e.g. http://plusfeed.appspot.com/111520209329163687335

This will provide you with an instant RSS feed of your public Google+ updates.

3. In your WordPress blog go to Appearance > Widgets > RSS Feed and paste the feed URL.

That’s it :-)

Update: 

Apparently the default frequency with which the RSS widget updates is every 12 hours. If you want to change you can add something like this to your theme’s functions.php:

add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 1800;') );

function.reset Passed variable is not an array or object in query.php

I had this problem with WordPress 3.1 where this weird message would come up while trying to access a blog category:

Warning: reset() [function.reset]: Passed variable is not an array or object in wp-includes/query.php on line 2890

I haven’t researched deeply into what is causing the problem but it seems to be related with WPML 2.0.4 and WP 3.1. Essentially is looks like when you update to WP 3.1 you should also upgrade WPML because 2.0.4 is not compatible with 3.1. However when you try to update you’re stuck with having to buy a commercial version of WPML because the authors no longer support a free version, how convenient, right?

I ended up fixing this by following the advice on the forums to create a Page template instead of using the category template and it worked. So basically you need something like this in your template:

query_posts(‘cat=x’);

I can see on Google that a lot of folks are being affected by this as we speak so I decided to share this quick fix.

Thread about this issue on the WordPress.org support forums

Startups Take Over Your Life

I have to subscribe entirely to the points Graham et al. make in “What Startups Are Really Like“.

It’s been now a year since I quit my previous job. I went from a phase of working at home alone to working with my partner at home to both of us renting a desk at a co-working space. The less stressful period was the first one, excitement was running through my veins, fretting over the finances was not an issue yet and work was organized in a very simple way: if I feel like doing it, I do it, if not, I don’t. The second period was hell. Little was accomplished with both of us working from home. The third period started when we started renting a desk at the co-working space. We started building routines and accomplishing more and working more and better.

Startups do take over your life. You end up thinking about it all the time, weekends included. It can be overwhelming and you have to put up some limits and rules to deal with it. I thought it would be different. I thought I would have another motivation and not so many limitations. Its very easy to get your hopes down. Its easy to start thinking and over thinking.

Here are some of the things that cross my mind every now and then, followed by how I try to deal with them:

I feel like I have to decide everything. I don’t like it when it is up to me to take all the decisions

That’s part of being a leader, some times you have to be confident and just stand your ground on what you are doing. If it turns out that it wasn’t the best decision you can always turn.

My co-founder says “what should we do” instead of “I think we should do like this…”

The other person probably just wants your opinion, not your decision. you can always say “I don’t feel like deciding this right now..”

Things are not going forward as I expected. The deadline is always slipping and we never ship.

Be more careful when estimating; are you estimating too low?

I don’t have enough experience. I don’t know what to do, when to do it, why, where or how to do it!

Invest in whatever training you think can help you improve your experience (management, etc).

I have so much work, I can’t possibly do it all :(

Prioritize. Get rid of the crappy stuff.

And remember, it’s not the end of the world if you don’t manage to get a startup running. There are lot of startups that fail every day.