brandontreb.com Tips And Resources For Software Consultants

This Pretty Much Sums It Up

Source

App Store (Link Share) Affiliate Link Generator

A while back, I wrote a post called ”Money You Might Be Missing Out On” where I discussed the Linkshare API. Well, I took it upon myself to create a simple tool that I have been using in my blog posts to quickly generate affiliate iTunes links for iPhone apps. Here is a screenshot of the app.

The generator is quite simple and perfect for bloggers that are discussing apps. Here is how it works.

  1. Sign up for LinkShare (if you haven’t already done so)
  2. Go to http://brandontreb.com/apps/linkshare/
  3. Enter your LinkShare Token. You get this in the Web Services section if the LinkShare site when you sign up.
  4. Select a merchant. By default, I have already populated it with Apple iTunes. Linkshare supports thousands of affiliate programs, so you can click other if you are using it for something else besides the app store.
  5. Enter the App Store URL of the application that you wish to get an affiliate link for. (ex http://itunes.apple.com/us/app/hundred-pushups/id301174591?mt=8)
  6. Click submit

Now, it will interface with the LinkShare API and produce an affiliate link for your account.

I hope you find this tool as useful as I do.

Great WordPress Plugin To Connect Your WordPress Blog To Your Tumblr

Ok, so maybe this is stupid, reposting your own content in multiple areas. As far as SEO goes, it may not be the best idea. However, I really love Tumblr and I really love WordPress. I can’t seem to part with either yet I don’t quite have the time for both.

I put out a quick tweet earlier today (and this is why I flippin love Twitter), asking if anyone knew of a good way to connect WordPress to Twitter. Here are the popular options.

  1. Use Tumblr’s feed importer (suggested by @abrahamvegh). This option requires you to enter your blog’s RSS feed. Tumblr then scans your RSS feed every so often and pulls the new posts. I didn’t care too much for this approach because it’s not instantaneous. I added my feed and it told me that it would refresh in about an hour. After an hour it still didn’t pull my WordPress posts and had a status of queued.
  2. There are quite a few Tumblr WordPress plugins out there. I have tried a few and have seen no success. Until one of my twitter followers (**@TheSilber) **suggested that I use tumblrize. Tumblrize is a great plugin that worked perfectly right out of the box. It was easy to set up and boasts quite a few options.”Tumblrize posts to Tumblr whenever you hit the “publish” button. It uses Tumblr’s simple API to keep posts in sync; when you edit your WordPress post, it updates your Tumblr post.”

I would highly recommend option 2 if you are planning on syncing your WordPress blog with your Tumblr.

Download Tumblr.ize Here

Would love to hear about some other interesting solutions. Feel free to post them in the comments.

SEO: Works Every Time

So I received an internal email at work the other day about how we could SEO our company website (http://elctech.com). Here was my suggestion:

“Just put up a few <h1> tags that state (in this order) Rails, Coding, Consulting, Porn, Free Porn, Porn on Rails, Viagra, iPhone, development, hot chicks, elc.

Guaranteed hits!”

Genius right? So after a while, a fellow employee (@maxmurphy) suggested we implement this rails solution:

<code class=’ruby’>["Rails", "Coding", "Consulting", "Porn", "Free Porn", "Porn on Rails", "Viagra",
"iPhone", "development", "hot chicks", "elc"].each do |seo|
  "#{seo} \n ELC ROCKS #{seo}"
end</code>

Perfect!

Feel free to steal this and you too can be an SEO Guru!

6 Traits Of A Successful Developer

I really enjoyed this article on traits of developers.

http://www.turnleafdesign.com/6-traits-of-successful-developers

In my experience, developers tend to become arrogant and totally ignore #1 (see Windows Devs). I feel that this is the most important trait of all.

“For a developer to be successful over any period of time a continued commitment to learning is absolutely vital. The field is too large, too quickly changing, and too in depth for any developer to ever “know it all.” Luckily there are a lot of resources a developer can use to learn; books, co-workers, classes, blogs, among many others.”

Great HTML5 Infographic

This info graphic just about sums it up in terms of what is HTML, and why we should care. It includes browser readyness, various API support, comparison of competition, and more. Check it out.

Technology + Fitness = <3 :: 3 Apps That Will Keep Even The Laziest Geek In Shape

If you are reading this post you are most likely a geek. It’s true, otherwise if you were a reader of my blog and not a geek, you would be very confused ;).

Well, being a fellow geek, I am prone to the same sort of problems as you when it comes to fitness. As geeks we sit in our chairs and more often than not end up looking like this. (sad face)

Ok ok, that photo is a little cliché, but you get my point. This prolonged sitting along with a lazy (Mountain Dew + Cheetos ) diet leads to this stereotypic geek look.

The Solution

Dun duh dun duh (those were trumpet sounds in case you didn’t know). Well, we all love technology (duh), so why not combine it with some basic fitness and fight the stereotype. With sweet gadgets (like the iPhone :)), we now have some incredible tools that almost make a game out of exercise.

Here are 3 iPhone apps that I use on a daily basis to keep me in peak, geek, 1337 shape.

#1 100 Pushups

I stumbled upon this gem of an app when I started seeing my buddy @oodelali ‘s Twitter feed displaying the following.

160 Pushups! Gangster right? Intrigued, I asked him about the app. After a brief synopsis, I was sold. Here is the rundown of this app (per its app store description).

“If you’re serious about increasing your strength, follow this six week training program and you’ll soon be on your way to completing 100 consecutive push ups!”

Basically, this app utilizes interval training where you exercise 3 times per week for about 10 minutes. After 6 weeks of this, the app claims you will be able to do 100 consecutive pushups! Here is a screenshot so you can see what I’m talking about.

So far, I’m on week 4 and am doing a total of 94 pushups (not consecutive yet).

**Don’t have an iPhone (sad face), you can still benefit from this app by using their web interface at **http://hundredpushups.com/.

The developer of this app has a whole suit of these including 200 Sit-ups, 200 Squats, and Twenty Chin Ups.

#2 Run Keeper Pro

Run Keeper Pro is a stellar app that has both paid and free versions. It uses the GPS to map our your run and gives you feedback on elevation, pace, distance, and location. I use this app every single day when I go for runs.

One killer feature of this app is its ability to sync with the web at RunKeeper.com. Here you are able to track more statistics about your runs, create paths, and get more social.

The interface is both beautiful and intuitive. (Aesthetics are super important to me. You could have the most functional app in the world and I won’t use it if it looks like feces).

When I first started running, I could barely make it to the end of my street, and with this app, I am now running over 10 miles per week!

#3 iFitness

So, this app is for the geek that might actually go to they gym (you mean like…leave…the house). Or if you are really a hobbit, have a home gym. iFiness allows you to track all aspects of a workout. It will track what exercises you do, on what day, with how many reps for how long.

With these killer features, it’s easy to create a fully customized workout and track it the way you want.

“But Brandon, I have never been to the gym and don’t know how to use the weights/machines because I’m level 75 in WOW.” Well, iFitiness has got you covered! For every workout they have in the system, they provide full graphics or videos on how to perform each one. So if you are unsure about how to do anything, just take a quick peak at your phone, jump on the machine, get jacked, and the ladies (or dudes if you are a lady reading this) will be flocking from all over.

Another great feature of this app is that it has built in workout plans to suite your lifestyle. So weather or not you want to build muscle or you just want to lose that gut you have been working on, they have a plan for you. Whoa, I am starting to sound like a P90X commercial, time to pump the breaks.

Take Away

To wrap up, I feel that staying healthy and fit is very important. You have to make it a part of your lifestyle and these few tools are a great way to get a jump on it. Feel free to post comments, questions, or grammar corrections (expected bc we are all the grammar police) in the comments.

WordPress For iPhone/iPad NSXMLParserErrorDomain Error 64 Resolved

If you have a WordPress blog and an iPhone/iPad, then you most likely have the WordPress for iOS app. If you don’t, you should.

Over the past couple of days, I have been receiving the following error when trying to add my blog to the iPhone app.

After scouring the internet, I found that this could be the result of a few issues.

  • Special characters in a post body that are not supported by NSXMLParser
  • Special characters in a comment
  • Invalid post or comment RSS
  • An error in a theme/plugin file

For me, this turned out to be an issue with the comments RSS feed. I loaded it up in the browser and long behold, even the browser threw an error. But what could be causing this? Turns out, I had left a space in a plugin that I created. This caused a space to be output at the beginning of the comments XML, causing it to error. Notice the space between ?> and <?php below. (Face Palm)

After removing the space from this plugin, I loaded up WordPress for iPhone and it added my blog without a problem.

So, the take away from this is don’t output spaces when you create a plugin.

I hope this post has proven useful for you, I can’t imagine that I’m the only person with this issue 😉

Feedburner Anywhere Plugin Updated

I have updated my WordPress plugin Feedburner Anywhere. In case you are unfamiliar with it, it’s a plugin that allows you to output your Feedburner subscriber count anywhere on your blog.

**The Problem: **Since Google took over Feedburner, I feel that it has been quite unreliable. A few times a week, Feedburner would return 0 for your subscriber count. This was an issue with the plugin. If the return value was 0 when the plugin pulled and cached the feedburner data, you would look like you had no subscribers.

The Fix: I am now caching the values returned from Feedburner. If for any reason Feedburner returns a 0 subscriber count, the last known value (greater than 0) is used instead.

Download the updated plugin here

If you have any other suggestions for the plugin, please let me know.

Simple Office Fitness: Replace Your Office Chair With An Exercise Ball

When I was in Portland this past month, I saw that many people in my work’s office were sitting on large exercise balls instead of office chairs. Curious, I researched the benefits and decided to purchase one for my home office. The benefits include:

  • Improved posture – sitting on the ball forces you to sit up straight of you won’t be very comfortable
  • Constant movement – Sitting for long periods of time can be bad for you, even when you exercise. Check out this recent study that was discussed on the New York Times. When you use an exercise ball for a chair, you are constantly repositioning yourself and are combatting this issue.
  • Getting Jacked! – having a ball for a chair has encouraged me to exercise during my down time. Code is compiling…bang out some crunches. I will now do ~ 300 crunches per day while waiting for various tasks to complete.
  • They are cheap – Most exercise balls range from $15-$25. Check out Amazon for some deals. I recently purchased one at Target on sale for $9.
  • It’s fun – Need a break? Just bounce a bit on the ball 😉

While I’m not saying to completely replace your office chair with an exercise ball (you will end up switching back an fourth a bit), it is a great way to stay in shape and enforce good posture while at work.

Test Version of TweetPress 3.0

So WordPress 3.0 has broken Tweetpress for many people. If you are daring, willing to help, and experiencing issues with Tweetpress, please download the 3.0 test build of Tweetpress and install it on your WordPress blog.

Here are your next steps after installation:

  1. Make sure you add your Twitter username and Password to the Tweetpress settings in your wp-admin and save it
  2. Attempt to post a photo to Twitter using Twitter for iPhone
  3. If it works, you win, let me know, if not do this:
    1. go back to the tweetpress admin in wp-admin
    2. click the log link at the very bottom
    3. copy the text and email it to brandontreb [at] gmail [dot] com with the subject “Tweetpress Log”

This will really help me troubleshoot the issues that everyone has been having.

Thanks!

Download Tweetpress Test Build 3.0

Feedburner Anywhere Plugin Released

Image representing FeedBurner as depicted in C…

Image via CrunchBase

I have just released another WordPress plugin called Feedburner Anywhere.

What it does is allow you to display your RSS subscriber count anywhere on your blog.

You have the choice of using the built-in widget, embedding it in your posts/pages, or a combination of both.

Check out my sidebar for an example of usage.

Download Feedburner Anywhere at WordPress.org

Reblog this post [with Zemanta]

HECK YES C Macro, For When Something Is REALLY True

Quite possibly the most useful macro you will ever use.

#define HECK_YES true && true
 
// Usage
if(self.sleepy)
{
   self.needsCoffee = HECK_YES;
}

Now if only I could replace semi colons with exclamation points…

Dynamically Load WordPress Post Images Like Mashable.com

What?

Have you ever noticed that the content on Mashable.com loads Incredibly fast? Also, have you noticed that as you scroll the images seem to ‘fade’ in? Well, this isn’t due to some crazy h4x0r code written specifically by Mashable Engineers. It’s a simple JQuery plugin that loads the images ‘Lazily’.

The Jquery plugin can be found here and a nice tutorial for implementing it can be found here.

If you don’t feel like hacking it yourself, read on and I will point you in the direction of a great WordPress plugin that handles this automagically.

Where?

Luckily the hard work has been done for you and you can download a WordPress plugin that will automatically add this functionality to your WordPress blog.

You can download the plugin from WordPress.org

This plugin will work for EVERY image on your blog. Even the Gravatar icons of the commenters.

Thats It?

Yep, try it out. Just scroll down on my homepage and watch as the images magically fade in.

Happy Wp-ing!

WordPress Coding: Programmatically Add Post Tags (and other meta info)


I was recently working on a script that imports from a custom blogging platform into WordPress and had some need to programmatically add post keywords.

The script to do this is actually quite simple and can be used to update any post attribute.

Here is the code:

// Create the post array
$post = array(
    ‘ID’ => 5,
    ‘tags_input’ => ‘foo,bar,baz’);     
 
// Update the post
wp_update_post($post);

This will assign the keywords “foo”, “bar”, and “baz” to the post with ID 5. This task seems trivial, however it’s very powerful when you think about automation. For example, you could write a script to scrape a google search for your target keyword and find related keywords for each of your posts automatically. Hrm… plugin idea?

Give it a shot. More info on available parameters can be found on WordPress’ site here

Here are some of the other fields that you are able to update this way:

defaults = array(
‘post_status’ => ‘draft’, 
‘post_type’ => ‘post’,
‘post_author’ => $user_ID,
‘ping_status’ => get_option(‘default_ping_status’), 
‘post_parent’ => ,
‘menu_order’ => ,
‘to_ping’ =>,
‘pinged’ =>,
‘post_password’ =>,
‘guid’ =>,
‘post_content_filtered’ =>,
‘post_excerpt’ =>,
‘import_id’ => );

Happy WPCoding!

WordPress Programming Tip: Enable Database Error Reporting For Custom Queries

So this one should seem pretty obvious, but it wasn’t apparent to me at first.  It was only after digging through the wp-db.php file that I discovered how to enable error reporting.

The Problem

As you may have discovered, the wp_query() function isn’t a “one size fit’s all” solution.  Often times, you may need to query the WordPress database using a custom MySQL query.  Especially  if you are using WordPress for anything other than a blog (ie freshapps.com).

When writing custom queries, it can often be frustrating if you make a mistake in the SQL syntax as WordPress will simply display no results.  For example:

$results = $wpdb->get_results("SELECT * FROM $wpdb->posts 
   WHERE post_title = ‘foo bar baz");
print_r($results);
 
// Outputs Array ( )

Since we have made an error in our SQL statement (I didn’t add the second single quote), WordPress will suppress it and simply return an empty array. This is not very helpful for debugging.

The Solution

The solution is actually quite simple. The global $wpdb object has a property called show_errors. Setting this property to true will cause WordPress to output the SQL errors to the screen for a given query.

Here it is with our example above

// Enables Wordpress’s DB Error reporting
$wpdb->show_errors = true;
 
$results = $wpdb->get_results("SELECT * FROM $wpdb->posts 
   WHERE post_title = ‘foo bar baz");
print_r($results);
 
// Outputs 
// WordPress database error: [You have an error in your 
// SQL syntax; check the manual that corresponds to your 
// MySQL server version for the right syntax to use near 
// ”foo bar baz’ at line 1]
// SELECT * FROM wp_posts WHERE post_title = ‘foo bar baz

Now we know what went wrong with our query rather than just receiving empty results.

Let me know if you have any questions or comments.

Happy WPCoding!

Reblog this post [with Zemanta]

Emacs For OSX Is Out!

For all you Vi using, Emacs haters out there, I will fight you!

The iPad Is Out And It Sounds Like iPod While Plugging Your Nose

Watch Out Apple, The Kindle Dev Kit Is Almost Live

With the success of the Apple App Store, it seems that everyone is wanting a piece of the pie.

Amazon is now looking to throw their hat into the ring and is releasing their own dev kit for their ever so popular Kindle.

http://www.amazon.com/gp/feature.html/?ie=UTF8&docId=1000476231

It appears that big name game developers Electronic Arts is also getting involved (WTH?!?!)

This just seems like it will be an epic fail. Who really wants to play video games on their Kindle? Maybe they can port Kirby’s Dreamland from the original Game Boy :) .

Reblog this post [with Zemanta]

Code Monkey Music Video

Watching this video makes me appreciate the fact that I work from home.



Hacking Redbox – How To Get Free DVDs

Red Box, Video Rental Automat, found in a Wal-…

Image via Wikipedia

I was at Wally-World the other day getting a movie from RedBox with my wife when I noticed some guy enter in a code into the machine. The code was BREAKROOM. After watching him for a moment, I realized this code entitled him a free DVD rental.

Now, RedBox is pretty stinking cheap ($1.50/night), but if you’re an avid movie watcher, this really adds up.

So, I did some searching on the Google machine and sure enough, there are new RedBox codes that go into circulation every day. Each one giving you a free DVD.

The site that offers the RedBox codes is http://www.insideredbox.com/redbox-codes/

Users submit the codes and update the site with the last time they were used. That way, you always know which codes are currently working.

You simply need to enter the coupon code from the main screen or just before checkout at your local Redbox kiosk. When you do, you will receive a one-day free rental. Any additional days you keep the movie will be charged at the usual $1.50/day.

Update: @diemer on Twitter pointed out to me that inside Redbox also has an iPhone app. The link for the app is http://itunes.apple.com/us/app/inside-redbox-pro/id306217360?mt=8

I may actually cancel my Netflix account now…

Reblog this post [with Zemanta]

Great List Of Algorithm Programming Tutorials

Recently TopCoder.com posted a list of algorithm tutorials from some of their “top coders”.

The tutorials are very comprehensive and pretty much sum my undergraduate computer science degree up in one page :) This page is a great resource for anyone that does any amount of coding…

Some of the tutorials include:

  • Greedy algorithms
  • Various sort and search techniques
  • Data structures
  • Graph theory

Here is the link to the Top Coder Tutorials:

http://www.topcoder.com/tc?d1=tutorials&d2=alg_index&module=Static

Reblog this post [with Zemanta]

XCode Shortcut

When in XCode on a MacBook Pro, doing a 3-finger swipe up will switch between the .h and .m files.

⌘-option-up will do the same thing

Productivity++

Reblog this post [with Zemanta]

Programming Tip Of The Day #2 – Difference Between i++ and ++i

To some, this should seem a bit obvious and if I am insulting your intelligence by discussing it, I am sorry. But, one of the main reasons I want to discuss this topic is, I was asked this question in a job interview for Lockheed Martin.

What is the difference between i++ and ++i?

The answer is actually quite simple.

i++ first evaluates the value of i and then increments it

++i increments the value of i and then evaluates it

Here is a brief example to demonstrate what I mean.

// Example: i++ 
$i = 5;
echo "The value of i is " . $i++ ;
// Output "The value of i is 5"
// i = 6
 
// Example: ++i 
$i = 5;
echo "The value of i is " . ++$i;
// Output "The value of i is 6"
// i = 6

So, now if you are ever asked about this in an interview, you will have a response.

Happy programming!

Programming Tip Of The Day #1 – Ternary Operator

So, I though I’d start this series called Programming Tip Of The Day to write about useful things I come across in programming. Both to educate my readers and as a personal archive of ideas and tips.

I will kick it off today with a quick rant about the ternary operator. I <3 the ternary operator. It’s quick, efficient and saves a lot of ugly code.

For those of you who don’t know, the ternary operator is made up of 3 elements: The condition and two results. It is of the form:

(condition) ? (result if true) : (result if false);

This is much nicer than an if statement. So here is a brief example about how a ternary operator can replace an if-statement.

if-statement

<code class=’c’>if(isSnowing) {
    iMustBe = "cold";
} else {
    iMustBe = "warm";
}</code>

Same thing using ternary

<code class=’c’>iMustBe = isSnowing ? "cold" : "warm";</code>

That is so much easier to read (IMHO). You can even do clever things in printing. Here is a small example in PHP for using the ternary operator when doing an echo.

<code class=’php’><?php
  echo "I am a ".((height > 72) ? "tall" : "short")." person!";
?></code>

Most languages support the ternary operator. Check out this wiki page if you want more info.

Happy programming!