P/S: django-nose, nosegrowl2 and tdaemon were used in order to show notification of testing results (just FYI)
Ngo Minh Nam's blog
A blog about geek stuff
Saturday, November 12, 2011
Fabric deployment
P/S: django-nose, nosegrowl2 and tdaemon were used in order to show notification of testing results (just FYI)
Saturday, November 5, 2011
Fatal error: Call to undefined function _make_cat_compat()
If you have the following error after uploading your WordPress, and re-uploading category-template.php didn't work, you could try pasting this function at the of the file.
function _make_cat_compat( &$category ) {
if ( is_object( $category ) ) {
$category->cat_ID = &$category->term_id;
$category->category_count = &$category->count;
$category->category_description = &$category->description;
$category->cat_name = &$category->name;
$category->category_nicename = &$category->slug;
$category->category_parent = &$category->parent;
} elseif ( is_array( $category ) && isset( $category['term_id'] ) ) {
$category['cat_ID'] = &$category['term_id'];
$category['category_count'] = &$category['count'];
$category['category_description'] = &$category['description'];
$category['cat_name'] = &$category['name'];
$category['category_nicename'] = &$category['slug'];
$category['category_parent'] = &$category['parent'];
}
}
Saturday, June 11, 2011
Aliases for Google Storage
I've just registered an account on Google Storage last month and I totally love it as. I particularly like gsutil since I'm most of my time on Terminal. Here are two aliases I use with gsutil in my .bash_profile. Of course, remember to replace your bucket name
Sunday, May 8, 2011
Using PHP to parse git history
Here is how you can store git command output in a good manner after which you will be able to easily retrieve necessary information. This snippet belongs to the project I'm currently working on.
Saturday, April 16, 2011
Get all updated git repositories easily
Sometimes, you'll find yourself looking for the newest versions of some projects that you have to use in your own projects e.g: jQuery. I myself like to organize all those projects in one place so I can search for them easily. This is how I keep it organized:
- Create a directory "git-repos" anywhere you want
- Create an alias in .bash_profile: alias clone="cd /path/to/git-repos/ && git clone". You can now clone repositories with: clone git@server:project.git
- Put the below git-pull-all.php script in git-repos directory
- Finally, create an alias to issue the update: alias update-git-repos="php /path/to/git-repos/git-pull-all.php".
Friday, March 4, 2011
Problem with Internet Sharing in Mac OS X
I have unofficially graduated from Republic Polytechnic and I'm here back at my hometown Hanoi. Currently, I only have wired connection at home. The router is not around and I have so many devices that I want to connect to the Internet. Luckily I have my spare Macbook (old Santa Rosa generation) which I could use to share the Internet from Ethernet. However, there was a problem with devices not being able to obtain the correct IP addresses (most probably due to DHCP). So I've managed to Google my way out from this problem. Here are some steps you have to take in order to get Internet Sharing to work:
- Start Internet Sharing normally
- Open Terminal, type: cp /etc/bootpd.plist /tmp/
- Stop Internet Sharing
- In Terminal type: sudo nano /tmp/bootpd.plist
- Change the last
4 to0 - Save it and: sudo cp /tmp/bootpd.plist /etc/
I'll try to write a simple applescript to automate copying bootpd file from /tmp to /etc and start Internet Sharing. Come back to see the updated entry
Saturday, December 25, 2010
Some dev tips picked up during holidays
Finally got time to continue developing Push Contacts. I've gotten a nerve-wrecking problem while developing with C2DM applications. When the app supposed to get the push message, it didn't respond to it. Looking at the logs I encountered an error stack related to GTalk (with TalkProvider tag). Decided to google the problem and the solution was to sign out of GTalk on the phone.
Ok now a tip related to Google App Engine development. I just added a new feature to Push Contacts which is allowing users to reply to the latest SMS received. I had to retrieve the email of the user the bot is chatting with to find which phone number to send the SMS to. Took a look at guru.appspot.com source code and decided to use xmpp_handlers.CommandHandler. Used this method text_message(self, message) and message.sender supposed to return the sender of a message but instead it returned an IM formatted string. Here is how you can retrieve the email.
Ok now a tip related to Google App Engine development. I just added a new feature to Push Contacts which is allowing users to reply to the latest SMS received. I had to retrieve the email of the user the bot is chatting with to find which phone number to send the SMS to. Took a look at guru.appspot.com source code and decided to use xmpp_handlers.CommandHandler. Used this method text_message(self, message) and message.sender supposed to return the sender of a message but instead it returned an IM formatted string. Here is how you can retrieve the email.
Subscribe to:
Posts (Atom)