brandontreb.com Tips And Resources For Software Consultants

XCode Shortcut Cheat Sheet

Xcode ShortcutsThrough my travels through the internets, I have stumbled upon this amazing reference. It’s a complete set of XCode shortcut commands. Learning some of these commands has drastically improved my efficiency when developing in XCode.

As a big fan of not using the mouse (yes I’m and Emacs guy), this is invaluable. Download the full size image here. Enjoy!

Creating A Twitter Client In Objective-C Client Part 2

Creating A Twitter Client For OSX – Part 1

This is part 2 in our series about creating a Twitter client in Objective-C. In case you missed it, here is a link to part 1 of this series.

In the last tutorial I showed you how to retrieve data from Twitter and display the XML in the Console. Today, we will be focusing on sending messages to Twitter via POST. We will be implementing the code to update our Twitter status. So let’s just dig right in.

1. Updating The TwitterRequest Header File

Open up TwitterRequest.h and add the following code (Click the image to enlarge)

screenshot_16

We have added two properties. The first isPost will be true when we are calling a method that requires a POST to Twitter. This will be methods such as update_status, follow, etc… Next, the variable requestBody will hold the POST arguments that will be sent to Twitter. These will be things such as status text or friend id.

Finally, we will be adding a method called statuses_update. The reason I named it this is because that is what the method is called in the Twitter API. Like our friends_timeline method, it takes a delegate and selector to call when the request is complete.

Important: I didn’t highlight this in the screenshot but make sure you change theRequest from an NSURLRequest to NSMutableURLRequest. It will give us some additional methods to set up the POST.

2. Updating The Twitter Request Class

Open up **TwitterRequest.m **and add the following code (Click the image to enlarge):

screenshot_17

I’ll start by explaining the status_update method. We first set the global isPost property to true. This will tell the request method to make a POST. The next 2 lines set the callback stuff as we did before. The only new line here is setting the requestBody variable. This is just a string that looks like “status=new twitter status”.

The addition to the request **method is what will allow us to POST to Twitter. First, we check if the **isPost property is set. This will be true if request is called from our status_update **method. Next, we call the **setHTTPMethod of the request to POST. This is pretty obvious.

The following line let’s Twitter know the type of data that we are sending to it. Next, we call setHTTPBody to set the body of the request. At some point we will want to URL Encode this string, but that will be for a different tutorial. Just don’t use any special characters such as & and = in your update to Twitter right now. All that is happening on this line is we convert the string to NSData using the **dataUsingEncoding **method of NSString and set it to the HTTPBody.

The last line just sets the Content-Length property to the length of our string. This is needed to correctly do a POST.

3. Calling The statuses_update Method To Update Your Twitter Status

Open up ApplicationDelegate.m and add the following code (click the image to enlarge):

screenshot_03

One thing to notice here is I commented out the line to get the friends timeline. This is because having both requests running at the same time with the same request object could cause conflicts. The best way to approch this to create an entirly new TwitterRequest object. I just wanted to keep it short.

This is pretty straight forward. We call the statuses_update method the same way we called the friends_timeline method except pass in the update text. The information received back from Twitter will look something like this:

screenshot_01

It’s basically all of your personal profile information.

That’s it for today. If you have any comments or questions, feel free to leave them in the comments of this post or write me on Twitter. You can also download the source for this version below.

Twitter Mac Client Tutorial 2 – Source

Happy Coding!

Installing And Deploying Rails On A Red Hat Server With Passenger

railsI have long been a fan of Ruby on Rails and even jumper on board very early on. The one thing that has held me back from using it in the majority of my projects is the fact that it’s such a pain to configure with Apache.

I know what you are saying… Just switch to a more Rails friendly server. I like and know Apache. Not to mention I also host PHP apps.

With the (re)release of tagacloud, I have recently fell in love with ruby on rails again. So, I looked for a better solution for installation (last time I installed it was 3 years ago) and I stumbled upon Passenger.

It was super easy to use and had my running on Rails in no time.

Deployment is only a matter of uploading application files. No Ruby (on Rails)-specific server configuration required!

Just to give you some background, here are some details about my server.

OS: Linux

Distribution: Red Hat Enterprise Linux Server release 5.3 Hosted At Server Beach

Control Panel: Plesk 8.6

And here are the steps I took to get Ruby on Rails up and running from scratch

1. Install Ruby

<code class=’bash’>yum install ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs</code>

This will do some magic and install Ruby on your system…

2. Download And Install Ruby Gems

Head on over to http://rubygems.org/ and download the latest version of Ruby Gems. Here is an example of getting the latest version as of the posting date of this article.

<code class=’bash’>wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz</code>

Untar this file…

<code class=’bash’>tar -xvf rubygems-1.3.5.tgz</code>

Navigate to the extracted directory and run the setup script

<code class=’bash’>ruby setup.rb</code>

3. Install Rails

This will install rails. If it asks you about dependencies, just type “Y”

<code class=’bash’>gem install rails</code>

4. Install The Passenger Gem

Now that rails has been installed, we need to install Passenger. The installation process is stupid simple. Passenger can be installed via a Ruby Gem.

<code class=’bash’>gem install passenger</code>

Now, it will do some stuff and and you some questions. At some point in the process, it will check to see if you have all of the dependencies. You most likely will not. Luckily, the geniuses who created Passenger tell you the commands to install all of the dependencies. So just follow the directions and you should be ok.

5. Set Up Passenger For Apache

<code class=’bash’>passenger-install-apache2-module</code>

It will ask you more questions and install everything needed to run Passenger. Pay attention to the stuff spit out at the end of the process. You will take this and paste it into your httpd.conf file. For example, here is the what mine spit out:

<code class=’bash’>LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby</code>

Your httpd.conf file is probably located at /etc/httpd/conf/httpd.conf

You should now be good to go! Navigate to one of your vhosts folder (ex: tagacloud/httpdocs/) and create (or copy) a rails application.

<code class=’bash’>rails someRailsApp</code>

Then set permissions…

<code class=’bash’>chmod -R 755 someRailsApp</code>

And then a miracle happens… and viola! You (should) have a fully functional up and running. Navigate to http://domain.com/someRailsApp/public to see your app in action.

If you have any comments or questions, feel free to leave them in the comments section of this post.

TagACloud.com (Re)Launched!

tagAcloud-ad

So in 2006, my buddy JJ and I took some inspiration from the Million Dollar Homepage and decided to create a totally inovative Web 2.0 site that works on the same principle. That is when we came up with the idea for tagacloud.com.

Tagacloud is a simple concept that uses the fact that people are obsessed with stats to make a fun game that will also direct traffic to your site. Here is how it works (from the website)…

The Idea:

TagACloud is a very unique idea for a website, thus it will take a little explaining to understand all the facets. To take full advantage of the site, you must be the owner or have control over your own website. The idea is to create a tag that represents your website. A tag is a descriptive phrase or a creative tagline describing your site. Once you have added your tag, it gets added to the Tag Cloud. This is where all the fun begins.

The Goal:

The goal is simple. Become the biggest freakin’ tag on the TagACloud website. The bigger the tag, the more hits it gets. It is that simple.

How Your Tag Gets Bigger:

Your tag gets bigger every time it levels up! And the only way to get your tag to level up is by accumulating points. Points can be acquired in many different ways, but the two primary ways to acquire points are as follows:

  1. Get Clicked: your tag gets 1 point for every click that your tag receives.
  2. Incoming Hits: your tag gets 2 points for every hit you send to your tag on TagACloud.com. You can get tag specific code via your “Get Tag Code” page.

How Your Tag Gets Hits

We provide visitors several ways to find your tag:

  1. The Home Page: The home page features 200 random tags in random order.
  2. Popular Tags: If your tag is one of the 200 most popular today, the last 7 days, last month, or of all time; it will be featured in order of popularity on the applicable page.
  3. Keywords: Keywords are essential for any tag that wants to generate hits. Keywords are like user defined categories. We combine all the tags that share common keywords. For example, google.com, yahoo.com, and vanillasasquatch.com would all share the keyword, SearchEngine. Each tag can have up to 3 keywords associated with it.
  4. The Randomizer: The title says it all. A user can view a random tag’s website, or view a random keyword.

Statistics

There are 3 big addictions on the web. Without sharing the top 2, we will let you know #3, is statistics. People love to view the stats on anything and everything. Here at TagACloud, we will make sure not to disappoint. You will be able to view statistics for every little thing, to ensure that you always know the current state of your tag. You will also find the website itself is littered with stats. Just keep your eyes open.
tagacloud

As of late 2007, Tagacloud was booming with over 10,000 users. Then, one day JJ and I decided we would take a weekend and “improve” tagacloud. Now, if any of you are programmers, you know “improving” an app takes much longer than you anticipate.

We set out to do it in a weekend and the ideas started flowing. It was Facebook meets Halo 3 meets Digg meets Hannah Montanna meets Karate Kid 3… And then the weekend ended and Tagacloud would remain a “Coming Soon” page for a year and a half… :(

A couple of weeks ago, JJ and I were sitting around and thought to ourselves “Why did we ever take down the old tagacloud?”. One thing led to another and we decided to completely wipe the database and start tagacloud fresh.

So, go fourth and start leveling your tag.

New Alice In Wonderland Movie Looks Sick

I was a big fan of the game Alice that came out for PC. It def portrayed AIW as a darker sort of movie. It looks like Tim Burton will add a similar twist to the latest Alice In Wonderland Movie. Check out the trailer above.

iPhoneLB.com gets a much needed update

screenshot_04

So, I started this site called iphonelb.com a few months back and left out a very important feature. The ability to edit your applications!?! What this means is, users have been testing their apps and putting in “test data” and when it comes time for release, the can’t modify it.

Another feature missing, was the ability to clean out all of your test scores.

Well, thanks to about 8 minutes of my time, this has been resolved and the feature has been added. I am really excited about iphonelb and have some big things planned for it in the future. Write me on Twitter or on my blog if you have any feature requests for it.

Parks & Recreation is to The Office as American Dad is to Family Guy

pandr

After seeing the show Parks and Recreation last night, I have come to the conclusion that the show is doomed to fail. Not only is it not funny, it’s jokes try to mimic the dry awkward humor of The Office. Parks and Recreation Fail!

Increasing Your Blog Traffic Using Twitter Trends

twitter_trends

Twitter Trends are a very interesting part of Twitter. They are basically the most typed keywords or hashtags on twitter for a given day. Some examples might be #musicmonday or macHeist. These are fun and all but how can you use them to get traffic to my website/blog…

Well, often times trends refer to words associated with website articles, videos, images, etc… For example, the other day, the word mashable was trending on Twitter. This was because Mashable.com had just put out an article on twitter trends. Since people were talking about and more importantly linking to this article, the word mashtable was trending…Naturally, this article got quite a bit of traffic.

Post a Comment On The Article

So, I commented on the article leaving a link to my blog. That day, I got ~50 extra uniques to my blog! You can do the same by closely following the trends. Make sure you read the article and are not just spamming the comments section. Many articles use blog systems (such as WordPress) that allow you to link to your website/blog in your commentsl. Post a comment that contributes to the discussion and I guaruntee it will generate more traffic to your website/blog. Again, don’t be a spammer, contribute something to the discussion…

Be Prompt (comment early)

The sooner you comment on the article, the more traffic it will generate to your site. In the above example, I was like the 15th or 16th to commenter. Imagine if I had been the first…

Although this method isn’t perfect, it’s a sure fire way to generate some quick traffic for your blog/website. Do this every day, and you could be huge!

I freakin hate this page…

over

Seems to show up way too much.

Alexa Gets a Much Needed Update

alexa

If you have a blog/website then you probably have heard of Alexa. If not, you should search your blog in it to find out some interesting stats. Being a stat junkie, I check services like this frequently.

It appears that Alexa has recently updated their interface from their old jenk web .05 hideousness. While it’s not quite web 2.0, I’d say it has a good start as web 1.6 (maybe 1.7 because of the shine on the logo).

On a side note, icodeblog seems to be huge in Canada 😉

WordPress Plugin To Increase Twitter Popularity

twitterpluswordpress

If there are two things I love on the intenets, they are WordPress and Twitter. Recently there have been many plugins developed to integrate the two. Mainly, updating your Twitter from your blog or vice-versa. But the question is, do these benefit one another?

Does your Twitter send traffic to your WordPress blog or your WordPress blog get you more followers? Maybe if you are @kevinrose but in my opinion, not really…

I’m currently developing a plugin that will incredibly benenfit your Twitter following using your WordPress blog. It’s called TwitPop and should be available shortly for download. So be sure to subscribe to the RSS feed and check back soon.

Twouble With Twitter Video

Ok, so I am sure you have seen this video by now, but I just had to post it because it’s flippin hilarious.

This perfectly describes mine (and others) Twitter obsession. Kinda sad actually.


"Twouble with Twitter" sous-titré
Uploaded by LePostfr

Google In Real Life Using Google Classic

google

Image Source: http://www.boomerang.nl

I depend on Google way too much for spell checking, simple math, and looking up things I don’t know off the top of my head.

It’s sad because often my first instinct when handwriting something or even looking for a lost object in my house is to “Google it”.

WordPress For iPhone Gets A Much Needed Update

wordpress-icon-512
A few days ago, the popular blogging tool WordPress released a much needed update to their iPhone application. The main features included in the update were:

  • Landscape mode for writing posts – This is a huge one. It was a total pain in the butt writing blog posts with the vertical keyboard
  • Page Editing/Creation – Meh… How often do you do this?
  • Comment Moderation – Very excited about this feature. I love being able to check out comments quickly without loading my entire blog.
  • Photo resizing – Very cool option. Makes photo uploads go much quicker.

If you have both an iPhone AND a WordPress blog (your own host or WordPress.com), I would highly suggest downloading the WordPress iPhone app for blogging on the go.

Hopefully, having the landscape keyboard mode will motivate me to blog more often.

Click here to download the WordPress application for the iPhone

Top Dugg Story of Today – I hate Dane Cook

LOL, SlightyOverDressed.com had a post that made it to the top of DIGG today simply titled “I Hate Dane Cook”. That’s freakin hilarious.

Here’s the link. http://slightlyoverdressed.com/i-hate-dane-cook/

Free Leaderboard Solution for iPhone Game Developers

What makes most multiplayer games more exciting that single player games? It’s competition! People love to compete with eachother.

And how can competition be achieved in single player games? Leaderboards.

A leaderboard is basically a table ranking players based on their scores in the game. This allows players to see how they stack up against other players.

The Problem

Many programmers either know how to do web development or system development. They don’t know both and certainly don’t know how to integrate the two. This is why I believe there are not more single player games with leaderboards in the App Store.

The Solution

This is where iPhone Leaderboards comes in. It’s an online hosted leaderboard that is incredibly easy to integrate with any iPhone game. The code to integrate with iPhoneLB is given to you to paste directly into your own. It couldn’t be easier.

Try it out and let me know what you think!

Part 3 of iPhone Game Programming Tutorial Posted On iCodeBlog

It’s been a while, but I finally posted part 3 of the iPhone Game Programming tutorial series on iCodeblog.com. The focus of this tutorial was to create a splash page for your game that fades into your game’s main view.

I chose to create this tutorial after seeing many games that just jump right in to the main game play. A splash page makes the game feel more “professional” as well as gives the developer a chance to brand the app by displaying a company logo or something to that extent.

Hopefully, I will be able to get part 4 up in a timely fashion to teach developers how to incorporate sounds into their games.

So, go ahead and check out part 3 of the iPhone Game Programming Tutorial Series.

New Web Application That Will Be Useful For iPhone Games Developers

So, after downloading many iPhone games and talking with a ton of iphone developers, I have a found a huge need in the community. Over the next week I will be developing a killer web application with a web service API that will be free to iPhone developers to use.

I am not going to give out any details at the moment, but be sure to subscribe to my RSS feed as I will be blogging about it through out next week (Spring Break = Time to develop). It should be completed by late next week.

I guarantee, if you are an iPhone game developer, you will benefit tremendously from what I am about to release.

Excited? So am I…

The Only Twitter API PHP Class You Will Ever Need

twit

Note Twitter has switchted their entire interface to use OAUTH and this class no longer works (I should probably change the title hahaha). I will post an oauth connection tutorial in the near future, so make sure to ****subscribe to my RSS feed** for all of the sweet sweets updates!**

Cheers!

So, I started writing a Twitter API Programming series last week… Here is part 1. I have found that there is not much else to teach when it comes to interfacing with Twitter. Basically, we just need to implement all of the Twitter functions.

I have taken it upon myself to create a fully functional Twitter API PHP class. It has every Twitter function you will ever need (less the direct messages). I have also fully documented it with comments directly from the Twitter API so that the functions are easy to understand. Here is how you would use the class. The first parameter of every function is the return type. For Twitter it can be either xml, json, or rss for some functions.

<code class=’php’>include("Twitter.class.php");
    $twitter = new Twitter();
    $twitter->username = "twitteruser";
    $twitter->password = "twitterpass";
    // Show public timeline
    echo $twitter->public_timeline();
    // Update your status
    echo $twitter->update(‘xml’,’This PHP class is flippin sweet!’);
    // Start following a user
    echo $twitter->create(‘xml’,’brandontreb’);</code>

These are just 3 of the functions implemented in this class. The full function list includes:

  • public_timeline
  • friends_timeline
  • user_timeline
  • update
  • replies
  • friends
  • followers
  • show
  • create
  • destroy
  • exists

All of these functions are fully documented and simple to use. You can also check out Twitter’s API here (but you shouldn’t need to).

So, now you can fully **integrate Twitter into any PHP application you create! **

Download The PHP Twitter Class here Twitter.class.php

Also, make sure you subscribe to my RSS feed. More great programming tutorial to come.

Why Many iPhone Apps Suck

I have been downloading many different iPhone apps lately and have noticed that many of them suck.

When I say they suck, I’m not necesarily referring to the content of the app. What I am talking about is the programming of the app. But Brandon, how do you know the programming sucks. Well, frequent crashing is an obvious indicator. Also, taking too long to do various computations as well as overall awkwardness.

This is because many non-programmers or hobby programmers decide they want to make an iPhone app without first learning the objective-c language. People just use jank copy and pasted code frankensteined from different examples, close their eyes and pray. This is the architecture of many iPhone apps.

So, who’s fault is this? Well, at first I wanted to say Apple for their lack of tutorials/explanations. After thinking about it, I feel it’s simply lazy programmers driven by trying to make money rather than the desire create a solid and useful applications. It’s quite sad actually.

One challenge here is the iPhone is a terrible platform to learn programming with. The forced program design assumes you have a solid understaning of object oriented programming design patterns as well as many other advanced programming topics. Many CS students don’t even get this until their second year in college! So how can a novice programmer jump right in and make an iPhone app? They code a pile of crap.

So what’s the solution to this? Well I’ll tell you. Teaching people objective-c from the ground up (that, and Apple being more selective when approving apps). I intend to write a whole series of beginner objective-c tutorials (using the mac as a platform rather than the iPhone). I’m not sure yet if these will be posted here or on icodeblog.com. I have yet to decide.

So stay tuned for the first Mac Application Development tutorials.

Buzzword Is Now In The App Store

Well, after anxiously waiting for the past 6 days (feels like forever) I have finally gotten that magical email from Apple stating that my “application is ready for sale”. The application of course referring to a game I created called Buzzword.

Buzzword is essentially a clone of the popular party game CatchPhrase ported on to the iPhone. Click Here for all the details on Buzzword.

I am asking a huge favor to anyone that wants to participate. I will give you a free copy of Buzzword (wow saves you a whole buck) if you would kindly write a review of it on your blog or website. If you are interested, either post a comment in this post, contact me, or hit me up on Twitter.

Click on the image below to download Buzzword now.

Download Buzzword In The App Store

Twitter API Programming Tutorial With PHP – Intro

<img src="http://brandontreb.com/wp-content/uploads/2009/02/picture-15.png" alt="picture-15" title=&uuot;picture-15" width="400" height="125" class="alignnone size-full wp-image-85" />

I have recently started using Twitter and completely fell in love with it. Being a programming, this naturally made me want to develop applications for interfacing with it. So, I scoured the internet (checking Twitter’s website as well) to find good *simple tutorials for doing this. After searching for a while, I couldn’t really find any. Ok, I lied, I found a few but they were terrible. I hate tutorials that assume the reader knows more than they actually do.

So, I am taking it upon myself to write a series of comprehensive tutorials for interfacing with Twitter. I will first do them all in PHP and then maybe in some other languages. I may even do some in Objective-C to be implemented on the iPhone. These would be written of course at iCodeBlog.com 😉 .

Let’s just jump right in. Twitter offers a few ways to interface with their web services, which are all documented on their API Wiki. The documentation is great, assuming you know the code to get connected and make the calls. So, let’s skip all of the nerdy low level stuff and write an application.

Today, I will be teaching you how to simply connect to Twitter and update your status. This will be pretty straight forward and require very little PHP code. So, grab some coffee, open up your favorite PHP editor (notepad?).

Ok, so let’s start by wrapping our code into an easy to call function. We don’t want to have to copy and paste our Twitter interface code every time we need it in a project. Wouldn’t it be nice if we could just call it like this

<code class=’php’>updateTwitter("Just Rockin Out")</code>

So let’s begin by declaring a function called updateTwitter. Type the following code</p>

<code class=’php’>function updateTwitter($status){ 
    // Twitter login information 
    $username = "TwitterUsername"; 
    $password = "TwitterPassword";</code>

Our function begins with a declaration of a username and password. This will be your Twitter login information. Every Twitter API call requires that you authenticate yourself. Make sure you update the code to include your username and password/

Next, we will add the following code to initialize the variables needed to make our Twitter API call. Continue by adding the following code.

<code class=’php’>// The url of the update function 
    $url = ‘http://twitter.com/statuses/update.xml’; 
    // Arguments we are posting to Twitter 
    $postargs = ‘status=’.urlencode($status); 
    // Will store the response we get from Twitter 
    $responseInfo=array(); 
    // Initialize CURL 
    $ch = curl_init($url);</code>

One thing I want to point out is the URL. Notice the update.xml at the end of it. This is telling the Twitter API we want to call the update function and we expect to receive xml back. You could also change it to be update.json if you want to receive json data back.

The next variable postargs is simply the arguments we will pass to the update function. Since these arguments get appended to the URL, they need to be urlencoded. The responseInfo array will contain the return data from the cURL request to Twitter. Finally, we just initialize a new cURL session. cURL is just a protocol for transferring data. You can read up on it on Wikipedia if you feel so inclined.

Next, we need to tell cURL to do a POST rather than a GET and pass it our argument string

<code class=’php’>// Tell CURL we are doing a POST 
    curl_setopt ($ch, CURLOPT_POST, true); 
    // Give CURL the arguments in the POST 
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);</code>

The next part is where the magic happens. Here is the next bit of code (I’ll explain it below)…

<code class=’php’>// Set the username and password in the CURL call 
    curl_setopt($ch, CURLOPT_USERPWD, $username.’:’.$password); 
    // Set some cur flags (not too important) 
    curl_setopt($ch, CURLOPT_VERBOSE, 1); 
    curl_setopt($ch, CURLOPT_NOBODY, 0); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    // execute the CURL call 
    $response = curl_exec($ch); 
    // Get information about the response 
    $responseInfo=curl_getinfo($ch); 
    // Close the CURL connection curl_close($ch);</code>

Wow! that looks like a lot of nerdy code. Good thing you only have to write it once and don’t have to understand it (unless you want to). The first line sets the username and password fields in our cURL call. When we first connect with the Twitter API, it will prompt for a username and password. cURL will automatically feed the username and password to the API. The next few lines are not super important. If you one of those people that get hung up on that sort of thing, you can read about them here. We’re almost done, I promise… Finally, we make the cURL call itself by calling curl_exec. This will return a response from Twitter which will contains some XML if your call completed successfully. The next line, gets the http response (makes sure you were able to connect to Twitter). If it is anything other than 200 (HTTP OK), it means your cURL request never even reached Twitter. Here is the last bit of code

<code class=’php’>// Make sure we received a response from Twitter 
    if(intval($responseInfo[‘http_code’])==200){ 
        // Display the response from Twitter 
        echo $response; 
    }else{ 
        // Something went wrong 
        echo "Error: " . $responseInfo[‘http_code’]; 
    } 
} 
?></code>

All this code really does is makes sure we got a 200 code (successfully reached Twitter). If so, it prints out the XML that Twitter returned to us. Now you have a handy-dandy function you can call whenever we want to update your Twitter status from your website. Simply type

<code class=’php’>updateTwitter("Just finished a sweet tutorial on http://brandontreb.com")</code>

and like magic, your Twitter status will be updated. This has many different uses as you can imagine. Join me next time when I will be putting this code into a PHP class as well as implementing the rest of the Twitter API functions. We will then be able to use this Twitter class in a variety of PHP applications. So , be sure to subscribe to my RSS feed and feel free to ask me any questions in the comments section of this post. You can also download the source code of this tutorial here… (insert clever tag line here (iCodeBlog’s is happy iCoding, I need a new one)).

Binary Game – iPhone App Review

Just posted an app review of B1nary Game over at FreshApps. Check it out!

New iPhone Game Programming Tutorial Post On iCodeBlog

Well, it had taken me a while to slot in the time, but I finally finished part 2 of the iPhone Game Programming series iTennis on iCodeBlog.com . The game is shaping up to be pretty cool and I am really enjoying teaching about game programming.

I think that game programming is perfect for teaching people how to program a certain language. This is because games generally encompasses many aspects of programming (interface, logic, math, animation, AI, etc…). The only problem is, they take forever to code/teach. Here are the links for the iPhone Game Programming Tutorials Series:

Be sure to check them out. Let me know what you think. Also, hit me up if you have tutorial suggestions.

Blogging Practices – Frequency and Size of Posts

If you have ever had your own blog, you may have at one point been faced with a question. How often should I write a blog post and how long should each post be?

I have been thinking about this since I started blogging. It is a common thought that you must write a post every single day in order to increase/maintain traffic. But, is this really true? For busy people with families and lives (that aren’t blogging) might have a tough time writing a new content-rich post every single day.

So, would readers rather see less frequent but “better” blog posts or more frequent “weaker” blog posts? Or maybe even a combo of the two?

For example, what if between killer programming tutorials, I wrote short posts about my dog or response to popular articles. Would this benefit my readers or turn them off?

I don’t have a real solution to this but plan to employ some of these strategies while writing this blog. Hopefully, I will be able to draw some conclusions and share them. If you happen to stumble on this post on your journey through the interwebz, please feel free to comment and shed some light on this for me.