Author Archive



Blog DIY – How to Add Hashtags to Your Blog RSS Feed Tweets!

March 1st, 2010

hashtags

Adding hashtags to your tweets can certainly enhance the chances of your tweets being spread further into the Twittersphere.  If you have a blog and you are using tools like TwitterFeed or a wordpress plug-in, chances are that your blog tweets aren’t getting the full hashtag exposure it can have.

Google has introduced a new “Socialize” section along with ability to add hash tags to your blog tweets.  Not only that, there’s an “inline hash tag” mode which will automatically turn important keywords of your blog post title into hashtags.

Plus, Google Feedburner will automatically cut off enough characters so there’s room for retweets.

These simple features make Google Feedburner a great way to get your blog tweets “enhanced” with hashtags.

Your Complete HOWTO Guide to Twitter API using PHP and Javascript/AJAX!

January 26th, 2010

Recently, I’ve been developing a new Twitter app site and found some great resources on Twitter API.  Believe me, this isn’t my first Twitter app ever so I have some experience dealing with Twitter API.

I’ve begun to realize more and more that there’s a lot of great Twitter API resources out there but none are so “complete” for PHP/AJAX programmers out there.  It’s basically a big maze out there for someone who’s just testing out the Twitter API waters but let me give you some great sites and tips on how to get started with Twitter API using PHP and/or javascript/AJAX.

First off, you will want to start learning how to use the Twitter API via curl.  Curl is basically a linux/PHP command that allows you to retrieve other web pages to the web server.  This would be way your web server actually communicates with Twitter API.

Simply put it, your web server ask for a webpage such as http://twitter.com/user/statuses and would get back some of of user statuses in the format of XML and JSON. (Btw, the webpage URL is just made up in this example.)

XML and JSON are simply how data are formatted so you can easily access it.  I have used both XML and JSON for receiving data and I would have to say to learn both but use JSON if you can as it’s faster.  (Plus Twitter team also recommends JSON over XML)

So the very first thing I want you to do (if you don’t know how already), is to learn how to use the Twitter API via Curl.  Try this guide on MoreThanSeven.Net.  It should only take you 15-30 minutes to try out the code and get somewhat familiar with how simply Twitter API is and how it works.

Of course, don’t forget, you need “Curl” installed on your web server. From linux command line, simply do “yum install curl” for Fedora/CentOS and probably “sudo apt-get install curl” on Ubuntu/Debian.

Once you have mastered that Curl API method, you will want to learn about “caching”.  If you don’t “cache” your API requests, you will eventually run out of API requests very quickly and your Twitter app will come to a screeching halt.  You don’t want that so let’s learn to “cache” the API requests itself.  Mark Kolich has a great guide Twitter Caching which comes with some of the basic API request functions.  Somewhat different from the previous Curl guide but this will help you get some ideas on how to “cache” your API requests.

AND/OR you can setup a file caching system that will cache every PHP file in your web server.  This way, if a webpage gets more than 1 hit, it will load super-fast.   You can follow the PHP File Caching guide here.  Also note that you can actually include the files cache.php and endcache.php on the header and footer of your file to cache if you don’t feel like using .htaccess or use non-Apache servers Nginx or Lighttpd like I do.

I am sure after trying all of the above, you will come up with a method to cache all your web pages efficiently as possible.  (This will save you a ton of money on servers if your Twitter app site gets HUGE.)

Another way you can also optimize your server for heavy traffic is to install Lighttpd or Nginx.  See how to install Lighttpd here and how to install Nginx here.

Now you got the basics out of the way,  you will want to learn how to authenticate Twitter users using the OAuth Twitter API.  This is simply a method for authenticating your Twitter users without them typing in their Twitter username/password into your site.  Plus, by using OAuth, you have to benefits of adding “from MyTwitterAppSite.com” instead of the default “from web” or “from API” under tweet signatures.

I’ve tried a bunch of OAuth guides out there and the best one (that actually worked) is Twitter-Async by Jaisen Mathai.  Btw, don’t download the source code using the zipped file, download the “latest” files under source.  (Or copy and paste every file like I did)  The zipped file comes with older files that don’t work.

Also, there’s a PHP 5.2 requirement for Twitter Async.  If you are running PHP 5.1.6 or below, you might want to upgrade before trying.  Btw, PHP 5.2 runs JSON natively and runs like 20 times faster than PHP 5.1.6 so you have every reason to upgrade to PHP 5.2.  If you are running on CentOS, try my guide on how to upgrade PHP 5.1.6 to 5.2 here.

To check your PHP version, do “php -v” at linux command line.

Also, another note on OAuth in general.  You need to set your web server time correctly otherwise Twitter OAuth won’t communicate with you.  Make sure your web server has correct date and time! (I spent about 10 hours trying to figure out why I kept getting failed authentications and my web server time was too fast by 2 hours.)

Twitter-Async also comes with dynamic way of calling API plus ability to send API calls in “parallel” or asynchronously.  (This means you can do 5 API calls in 1 API call time, much faster than doing one by one.)  One thing that’s missing from the API is caching and I think it shouldn’t be too hard to hack one in.

My advice is to use the OAuth code separately only for logged in users and use simpler “cached” Curl library (I use the Mark Kolich’s Twitter Cacher code for non-users) for visitors that are not logged in.

One more thing, make sure you call for authorization tokens on OAuth in real-time using javascript, otherwise you will be requesting tokens from Twitter OAuth on every page load.  (and sometimes that will slow down your whole site.  Instead use something like onClick=”getTokens()”)

Whatever the case, you will want to learn the basic of Twitter API I have outlined here and practice it.  Once you get the hang of it, make a good plan of how you will make your overall Twitter app site.

Good luck and I have just provided you with some of the best Twitter API guides/tips so you got nothing to lose!  Feel free to ask me any questions on the comments line.

Extras

I find that you will need to use a lot of Javascript Regex to process twitter tweets and whatnot, here’s some good guides for that.

Javascript Regex – This could work well for matching/replacing strings.  SitePoint also has a great guide on Javascript Regex

How to Make a Twitter Webcam Security System!

January 3rd, 2010

webcam-hack

It’s going to be an exciting year as Twitter hacks such as this one appears.  It’s a laser-tripped webcam that actually can tweet the photo taken to Twitter.  I think this could serve as a great security device on the cheap.

It requires a bit of hacking though, looks like an Arduino, Linux, and bunch of programming, not for the faint-hearted indeed.

This instructable will show you how to construct a laser tripwire that can twitter and grab an image from a webcam, as well as execute any command you can put in a bash script.
This instructable is actually quite simple and is even suitable as a beginner arduino project. It requires a GNU/linux (or possibly Mac) operating system with the arduino IDE and Processing IDE working properly. This project could also be implemented in Windows if you created a more complex processing application.

via instructables

Twitter Hack – Twitter Controlled Christmas Tree!

December 22nd, 2009

twitter-tree

For the Christmas holidays, here’s a fun project that involves Twitter and a small Christmas tree.  Twitters can change the color of the Christmas Tree by tweeting to @tweet_tree the color you want.

To choose the color of our tree, just send a color to @tweet_tree on Twitter.

@tweet_tree red, green, purple, green, p, g, r, b

@tweet_tree understands red, orange, yellow, green, blue, and purple. Send one color, or combination of colors to morph through. Separate multiple colors with a comma. Only the first letter of the color matters, r,o,y,g,b, & p, are acceptable color commands.

@tweet_tree red, *ff0000, green, *00ff00, blue, *0000ff

via instructables

How to Back Up Your Tweets on Google Calendar!

December 6th, 2009

Twistory, is a new Twitter-app site that lets you back-up your valuable tweets on Google Calendar through Google API.  It’s simple to use and all you have to do is enter your Twitter username to get started.  Of course, if you use your Google Calendar for other purposes, we suggest you to make a new Twitter-backup account for Google Calendar so it stays separate.

I find this the best way to back-up your tweets since Twitter itself doesn’t offer any kind of backups.

Best of all, it’s free so you can lose!

Try out Twistory here

Twitter Hack – How to Tweet Your Palm Pre’s GPS Location!

September 11th, 2009

Here’s a really fun Twitter hack that shows you how to “tweet” your Palm Pre’s GPS location to your Twitter account.  This could be a great way to track your Pre’s whereabouts as you can also optionally set your Twitter account to “protected” so only you see the GPS updates.

(Screenshot of @trackmypalmpre, which gets updated with location of my Palm Pre every hour.)

As promised on my last blog post on how to set up Google GPS tracking on your Palm Pre, I will now show you how to “tweet’ your GPS location to a Twitter account so you can track it on Twitter too.

This might be a great way to keep “track” of where your Palm Pre has been.  You could probably even make a GoogleMaps using the Twitter RSS feed to show exactly where your Palm Pre has been traveling in the past.

via palm pre hacks

Click Here to View in Full Screen Mode

trackmypalmpre

Twitter Hack – Twitter Watches Notifies you of Trending Topics!

September 11th, 2009

For those of you twitter addicts out there who need to know what’s trending on Twitter, there’s a cool Twitter Hack that will update the latest trending topics on a small LCD screen.  This isn’t that hard to implement it looks like, check it out here.

The #twatch connects directly to Twitter and scrolls the latest trending topics and related tweets on an LCD screen. It’s a stand-alone network appliance that stays updated without a PC. It was awesome to watch #iranelection, Michael Jackson, and other historic events scroll by while we developed the #twatch.

twitter hac

Twitter Hack – Home Automation Using Twitter Status Updates!

July 20th, 2009

Here’s an incredibly fun way to devise up home automation using Twitter Status updates as commands for remote-control of your home appliances.  This is a really cool project (as any other Twitter hacks) as it makes use of your actual @reply messages to control your home.

With http://twitter.com/MattsOffice you can send a command by placing a keyword in a @reply message. Valid keywords are “light”, “bright”, “dark”, “temp”, “hot”, “cold”, “lcd”, and “view”. For example, to retrieve the temperature of my office I just need to update my Twitter status with a simple question like “@MattsOffice What is the temperature?”

via diy blog

twitter-hack

Click Here to View in Full Screen Mode

Hackers Send Out Fake Death Tweets!

June 30th, 2009

Hackers have been sending out fake death tweets of famous people like Britney Spears.  Although the matter has been revolved already, (what seems to be caused by TwitPic) it’s interesting to note that Twitter has the power to spread false rumors as much as real ones.

Twitpic fixed this vulnerability by Monday and in an apology letter explained that the hackers tried every PIN combination possible until one worked. Now, Twitpic says a “fix has been put in place to prevent this from happening,” and that less than 10 users were affected by the hack and “no account information was compromised.”

via cnet

Twitter Hack – How to Twitter on a Commodore 64!

June 24th, 2009

Are you joking me?  Why are people suddenly trying to twitter on very old computers?  Well, regardless of reason, it’s cool that you can recycle old computers to “tweet”.  This could possibly make them useful enough to not throw away.

With BREADBOX64 you can post status messages and view your friends timeline. The timeline refreshes every two minutes.  After starting you provide your twitter username and password separated by a colon. After pressing enter, the timeline is retrieved and shown. At the bottom of the screen there is an input field for you to type aq status message. Pressing enter will post that message to twitter.

You can run BREADBOX64 on a C64 emulator. I use VICE, because that one supports networking. However, you can better test it on a real system if you have the hardware ready at hand. If so, copy the D64 to a real disk, put it in your 1541 and go ahead!

via vandenbrande

twitter-hack-commodore-64

Click Here to View in Full Screen Mode