Creating a custom image service for Twitter for iPhone Tweetbot

Update Jan 13, 2012: It looks like setting a custom image service is no longer available on Twitter for iPhone. Tweetbot allows it though. This article still works for Tweetbot. For the rest of this article, please treat the text “Twitter for iPhone” as any app that supports custom image services (e.g. Tweetbot).

Custom Image Service

We’ve just recently deployed a custom endpoint to allow Twitter for iPhone users to post their pics through PicLyf.

When you attach an image to a tweet, Twitter for iPhone will upload that image to the image service of your choice. It allows you to choose from various image services (e.g. yFrog, Twitpic, TweetPhoto) or a custom image service. In our (PicLyf) case, it was custom. We made a custom endpoint: http://api.piclyf.com/twitter. Using this url as the custom image service, attached images will be uploaded to the user’s PicLyf account.

Read more →

Why I don't code in Ruby

Well, not yet anyway. Perhaps when those hosting prices go down I’d go and take a shot at building something useful. I did start reading a few books on Ruby and Rails. It’s an incredibly awesome and fun language. I’ve never been very excited when learning a new language. I drool when I see Ruby code. It’s easy to learn but I’ve already forgotten most about it since I don’t use it fulltime.

If it were just me, I’d have built PicLyf using Ruby to make it more exciting. But there’s the city talent pool we had to think of. Currently, it’s hard to find good PHP developers. I reckon it’ll be more hard to find those who know Ruby.

Read more →

Creating PID files for beanstalkd on CentOS

Yep, managing servers is hard >.< I’ve been trying to set beanstalkd to be managed by monit on CentOS. Unfortunately beanstalkd doesn’t seem to create pid files on CentOS (it creates one in Ubuntu though). Pid files are needed by monit so it can check if the process is still running or not. Many grueling hours later, I settled with modifying /etc/init.d/beanstalkd and adding this to the start() function (after daemon $exec…):

echo `ps auxf | grep -v grep | grep "$exec -d $options" | awk '{print $2}'` > /var/run/beanstalkd.pid

I have no idea what all those grep and awk exactly mean. ^_^x But the effect is it creates the pid file in /var/run/beanstalkd.pid containing the correct process id of beanstalkd. You could then have monit watch that pid file.

Here’s the whole modified script. And this is my main reference: http://gist.github.com/508889. A huge thanks to him (Sam X).

Read more →

The undefined curl function in console (WampServer)

Stupid stupid me. On Windows/WampServer, I’ve always had this problem when working with PHP code that can run in the console and using cURL methods..

PHP Fatal error:  Call to undefined function curl_init() in D:\Shiki\github\yii-clockwerk\test-app\CurlHelper.php on line 90
Fatal error: Call to undefined function curl_init() in D:\Shiki\github\yii-clockwerk\test-app\CurlHelper.php on line 90

Read more →

FirePHP Logger for Yii Framework

I made this a few weeks ago. It is a Yii Framework extension which routes log messages to FirePHP.

Read more →

Installing Memcached for PHP 5.3 on Windows 7

Memcached

Updated:

First off, all credits go to this guy. I’m just listing the steps on how I did it in Windows 7 with PHP 5.3. Also, I tested this using WampServer but I believe it should work on any PHP install.

Read more →

"Ignoring funny ref" error on Git + Dropbox

At Twidl HQ, we use a combination of Git and Dropbox for managing our source code. It’s a simple but awesome setup. Sometimes, we get this really cryptic error when fetching from our main repo (our shared Dropbox folder):

Ignoring funny ref 'refs/remotes/origin/master (Shiki's conflicted copy 2010-01-14)' locally

It seems to happen when 2 people push to origin/master at almost the same time. This makes Dropbox update the same file and seems to be the cause of the error. When this happens, you can bet that one of the people who did the push will lose his changes to origin/master. So you’ll have to fix it accordingly.

The “funny ref” error does not have any critical effect on the repo and Git seems to work perfectly. It will just annoy you every time you try to fetch. It turns out that this "master (Shiki's conflicted copy 2010-01-14)" is a branch in the main repo. Simply deleting it will remove the error. In terminal, go to your main repo’s (Dropbox) root folder:

$ git branch -d "master (Shiki's conflicted copy 2010-01-14)"

If you’re not sure of the name of the conflicting branch, you can execute git branch to show all branches. There should at least be a “master” branch and your conflicting branch.

Read more →

Creating custom Box2D shape components in PushButton Engine

If you ever need to use other ways of creating Box2D shapes that are not currently available in PushButton Engine, you can simply make one yourself. You’ll just need to create a subclass of CollisionShape and use it just like the PBE shape classes.

Read more →

Experiment: Using SWF MovieClips in PushButton Engine

Important: This tutorial is now deprecated due to the new and awesome, fully rewritten, rendering components. You can see some discussions about it here.

I’ve been working with PushButton Engine for a short while now but last night was actually the first time I tried integrating/using a MovieClip from a SWF into PBE. Unfortunately, there are no documentations on how do this at the moment. The examples mostly use images (pngs). I won’t b*tch about it because that is totally understandable. The PBE team are working their a**es off to get to 1.0 and the documentation is the least of their worries. I could at least thank them for doing such a good job – PBE’s a well thought-out framework, everything I learned from it made a lot of sense.

Read more →

Zend Studio (Eclipse) Remote Editing through a secure proxy

Remote Editing in Zend Studio for Eclipse has to be one of the biggest reasons why I use it in my current job. I work from home and our team’s development environment is securely setup on a Linux server with a firewall open only to specific IP addresses. This is a no biggie if my IP address never changes or if I work only in one place. Unfortunately, that’s not the case for my DSL setup – I get a different IP address everyday. And since I can’t bug the server admin every time I need to have my IP address added to the firewall, I connect through our proxy server first and then connect to the main development server. The setup’s kinda like this:

Local Machine to Proxy Server to Development Server setup

The problem now is Zend Studio doesn’t seem to support this kind of setup. At least, that’s what I concluded after so many hours of googling. Then I found this super awesome article. We can use Putty! Or just plain ol’ Terminal on a Mac (Linux should be the same I think).

Read more →