I Heart Kindle App

I bought an iPad. I don’t live in the US. Therefore, I’m stuck with a limited selection of iBooks content, and a selection that unfortunately doesn’t include any of the books that I’d otherwise be interested in. I’m not suggesting it’s a bad selection – Canadian content is great… just that it doesn’t necessarily interest me.

And I don’t have a Kindle or other ebook reader and the books that I want to read are new releases and as such don’t seem to be found as an ebook through less legitimate means. Not that I’d do that anyway, although GoodReader is easily the best app I have on my iPad.

So I decided to download the Kindle app.

It isn’t spectacular at first glance. Certainly doesn’t have the fancy-pants page turning animations that iBooks has (although on a positive note, the Kindle app is free of that dreadful faux bookshelf graphic that iBooks has). Despite the lack of fancy-pants-ness, however, I must say that I truly like the Kindle app.

I busted through a few sample chapters from various books that were magically sent to my iPad through the Amazon “whispernet” after I clicked the “send to kindle” button on the Amazon website. Then I decided to purchase Rework from 37Signals’ Jason Fried and David Heinemeier Hansson and this is where the awesomeness of the Kindle app really hit me.

First, I can create notes and highlight parts of the book with ease. Going back to those highlights and page notes is super easy too.

But I can also see other people’s highlighted text. This really blew me away. If enough people highlight the same text, it shows up unobtrusively underlined in everyone else’s copy (can be turned off). Wow! It’s like social networking meets reading! Absolutely brilliant. I’m sure this is also a feature on the physical Kindle and hardly news to many, but seeing it with my own Kindle rookie eyes made me all giddy inside.

Bookmarking is easy; navigating around the book is easy; pics show up nicely on the iPad screen; book downloads are quick and small.

And then I decided to load Kindle on my iPod Touch. As soon as that completed, I was able to read my collection on that as well!
Then I decided to download Kindle for my BlackBerry. Shwing! Yep, I can read my book on there too.

Suddenly I can read my book wherever I am. In bed, on the couch: iPad. On a bus or on the can: iPod version. In line at Timmy’s: BlackBerry is great too. And best of all, Kindle picks up in the book right where I left off on the other device.

Yes, this makes me very happy.

Oh, and Rework is an absolutely fantastic book.

Twitter oAuth in .Net without Web Login

I was interested in getting a Twitter App together to orchestrate some follows and unfollows and user searches for a personal project. In the past, I’ve used Twitter’s Basic Authentication API to get my Twitter feed, but according to the Twitter API documentation, Basic Auth is going to be unsupported in August of this year. So I figured I might as well get my feet wet with Twitter oAuth authentication.

I came across this article about how to use Twitter oAuth with .Net (via Twitter API documentation) and used the extended oAuth code for my own project.

Unfortunately in all examples of desktop apps that I can find, they all involve opening up Twitter.com in a web browser control to get the user’s PIN for the app. Of course, this makes sense, but I wanted to short circuit this process. I wanted to be able to enter a userid and password and go straight into my account.

Here’s a quick snip of my code in case you’re interested in doing the same. The code uses HTTPWebRequest and HTTPWebResponse to automate the PIN request procedure so a web browser control is not needed.

This code uses Twitter oAuth for .Net from here, which itself extends .Net oAuth from here. The code is probably not complete as I simply took the code snippets from a larger project and as such, some variables may not be declared or initialized properly.

//Assumes these vars are populated before below code.
private string _consumerKey = "";
private string _consumerSecret = "";
private string _userid = "";
private string _password = "";

//These get populated by below code
private string _token="";
private Uri AuthUri = null;
private oAuthTwitter oAuth;
private string _pin = "";

public void authenticate()
{
    oAuth = new oAuthTwitter();
    oAuth.ConsumerKey = _consumerKey;
    oAuth.ConsumerSecret = _consumerSecret;

    Uri AuthUri = new Uri(oAuth.AuthorizationLinkGet());
    _token = HttpUtility.ParseQueryString(AuthUri.Query)["oauth_token"];
    CookieContainer cookies = null;
    string content = getContent(AuthUri.ToString(), null, "", null, ref cookies);
    string authenticity_token = Regex.Match(content, "twttr\\.form_authenticity_token = '([^']+)';", RegexOptions.IgnoreCase).Groups[1].Value;

    string post = ue("authenticity_token", authenticity_token) +
                    "&" + ue("oauth_token", _token) +
                    "&" + ue("session[username_or_email]", _userid) +
                    "&" + ue("session[password]", _password) + "&Allow=allow";

    content = getContent(oAuthTwitter.AUTHORIZE, post, "https://www.twitter.com/", cookies, ref cookies);
    Match m = Regex.Match(content, "oauth_pin\\\">\\s*([0-9]+)", RegexOptions.IgnoreCase);
    _pin = "";
    if (m != null)
    {
        _pin = m.Groups[1].Value;
    }

    oAuth.Token = _token;
    oAuth.AccessTokenGet(_token, _pin);
    if (oAuth.TokenSecret.Length > 0)
    {
        string xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, "http://twitter.com/account/verify_credentials.xml", String.Empty);
    }
}
private string ue(string parm, string val)
{
    return HttpUtility.UrlEncode(parm) + "=" + HttpUtility.UrlEncode(val);
}

public static string getContent(string url, string requestBody, string referrer, CookieContainer cookies, ref CookieContainer retCookies)
{
    ServicePointManager.CertificatePolicy = new trustedCertificatePolicy();
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
    request.Method = (requestBody == null) ? "GET" : "POST";
    request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729)";
    request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
    request.Referer = referrer;
    request.CookieContainer = cookies;

    if (requestBody != null)
    {
        request.ContentType = "application/x-www-form-urlencoded";
        request.ContentLength = System.Text.Encoding.UTF8.GetByteCount(requestBody);
        Stream requestStream = request.GetRequestStream();
        StreamWriter writer = new StreamWriter(requestStream);
        writer.Write(requestBody);
        writer.Flush();
    }
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    Stream stream = response.GetResponseStream();
    StreamReader reader = new StreamReader(stream);
    string content = reader.ReadToEnd();

    CookieContainer rc = new CookieContainer();

    UriBuilder ubuilder = new UriBuilder();
    Uri u = new Uri("https://www.twitter.com");

    rc.SetCookies(u, response.Headers["Set-Cookie"]);
    rc.Add(response.Cookies);
    retCookies = rc;

    return content;
}

How to Load Random Flickr Images with PHP

This isn’t rocket science, but I did search Google extensively before building my own script.  Save the script as Random_Flickr_Image.php (or whatever) and reference it in your img tag.  For example, <img src=”/images/Random_Flickr_Image.php”/>.

<?php
$doc = new DOMDocument();
@$doc->loadHTMLFile("http://www.flickr.com/explore/interesting/7days/");
$xpath = new DOMXpath($doc);
if($xpath){
	$url = $xpath->query("//td[@class='Photo']/span/a/@href");

	@$doc->loadHTMLFile("http://www.flickr.com".$url->item(0)->nodeValue);

	$xpath = new DOMXpath($doc);
	if($xpath){
		$url = $xpath->query("//link[@rel='image_src']/@href");
		$im = @imagecreatefromjpeg($url->item(0)->nodeValue);
		if($im){
			header('content-type: image/jpeg');
			imagejpeg($im);
		}else
			echo "error";
	}
}
?>

Traffic Generation Part 2 – Social Networking

The term “Social Networking” isn’t necessarily easy to describe. In the context of the web, technically I suppose it could be defined as building and interacting with individuals online. But by this definition, social networking isn’t something recently new. Blogging, forums, IRC could all be considered social networking. Some of these I discussed as traffic generation sources in part 1 of this series about creating backlinks.  But when we think of “Social Networking”, these days that encompases things like Facebook and Twitter.  Perhaps Youtube or Google Wave even (Google wha?). These are the “social networking” sources that I will discuss in this post – part 2 in a series about website traffic generation.

Social Bookmarking

In the last few years, hundreds of “Social Bookmarking” websites have sprung up. Social bookmarking sites are sites that share links to resources which are seen by the thousands of readers of the bookmarking site. Generally users can vote a link up and down. The popularity of the link affects the link’s position in lists of “most viewed”, “most popular, “highest rated” or “most commented on”.

Slashdot and Digg.com were arguably the first sites that did this sort of link submission and ranking.  Furl, Reddit, del.ic.io.us, Newsvine and a host of others have since followed.

On some of these sites, a high ranking link has driven massive amounts of traffic to websites, ultimately bringing down the host web servers. The terms, “Slashdotted“, the “Slashdot effect” and the “Digg effect” were all coined for server outages due to links becoming popular on the respecitve sites.

Using social bookmarking in an attempt to gain website traffic may seem spammy, but you could say the same for any other traffic generation technique outside the scope of basic SEO and ultimately for the vast majority of content publishers and website owners, traffic generation techniques such as exploiting social bookmarking are necessity in order to be competetive.

Compared to the effort involved in social bookmarking, the benefit is indeed minimal. However, there are some tools available to assist in littering the web with your social bookmarks making the process marginally less effortful.  I’ve used a couple, including socialposter and socialmarker.  Both do relatively the same thing – attempting to make the social bookmarking process a tiny bit less painstaking.

Facebook Fan Pages

Facebook is quickly becoming the Web within the Web. Amazingly enough, Already, loads of commercials (from big companies) display their Facebook Fan Page along with their logo. Building a Facebook Fan Page isn’t enough though.  You also need to get people to “Like” it. If you already have a Facebook account, then you can at least start there by “Liking” your own Fan Page. Your friends will probably see that you’ve “Liked” it and there’s a possibility that they may as well.  On your website, include a link to the Fan Page.  People who visit your site may then “Like” the Fan Page and their friends will in turn see the “Like” notification and could possibly “Like” it themselves and the snowball effect continues.

You can also use your Facebook account (or create a new account) to gain fan page “followers”.  You can do this by finding Facebook people with a thousand or more Friends.  Friend them, yourself, and they will likely confirm your friendship.  Anyone with a thousand “Friends” indicates that in reality they just confirm whomever Friends them.  Once you amass a large following, you can post links to your Fan Page, or even better, hook your Twitter feed up to your Facebook profile and Fan Page and whenever you post to Twitter, you create content on your Facebook profile/Fan Page.

Your Fan Page is more or less a gateway to your website. Content is still King, of course, but you want your Fan Page to generate leads and hits to your website (and then hopefully generate a conversion and the sound of coins dropping into your piggy bank).

Facebook recently released the iLike button that can be used with blog posts.  Make sure to add this button to your blog posts.

Twitter

Although I’m fairly certain that 99% of Twitter users are marketers in one form or another, it doesn’t mean that Twitter isn’t a goldmine for targeted website traffic. A key Twitter technique for building up website traffic from scratch is to take advantage of Twitter’s huge visibility. It is incredibly easy to build up a group of Twitter accounts. Use one of the accounts to tweet links (with good descriptions) to your website.  Use the other accounts to “retweet” the tweet.  Use an application such as Twitterel (http://www.twitterel.com) to find Twitter users that have specific interests and therefore could turn into potential leads and follow those individuals.  Comment on their tweets as well.

To make Twitter a successful tool, two way interaction is required. Nobody on Twitter gains followers by making only one way tweets.  You need to engage your community. Make replies often to individuals who share the same interests.

Ultimately to take full advantage of Twitter, you need to build your follower list.  There are many ways to do this, but you’re best off if your follower list is made up of quality targeted individuals (rather than a bunch of other Twitters simply looking for reciprical followers – an odd waste of time imho).  Treat your Twitter account like you would a website. Build up traffic to your Twitter account by placing backlinks to your Twitter profile on various websites – again, forums, blog comments, your websites etc…  Guaranteed that if you make a good comment on a forum or blog post and use your Twitter account as your website, you will get good Twitter followers.

For a quick following on a new account, I recommend the HitFollow service.  You can get an easy 100 followers for free, or for a small fee, get thousands.  No work on your part required.  Note, however, that people who have only 1 or 2 tweets but thousands of followers (and are, themselves, following thousands of tweeps) have a low Twitter clout.  In other words, although you have a huge following, you probably have a low likelihood of getting website hits from Twitter posts.

Something else that Twitter has that is waiting to be taken advantage of is the vast number of Twitter supplemental websites.  TwitPic, for example, has a huge amount of visibility.  Place an interesting pic on TwitPic (or any of the Twitter photo uploading sites) and you’re bound to get followers and a high number of views.  The associated tweets are also a goldmine for targeted website hits.

Youtube

Youtube can be a great resource for targeted website traffic.  Create an account, upload some clips.  Customize your channel so that it looks semi-professional with a custom background.  Make sure that you have an interesting avatar or profile pic (this is huge).  Also make sure that the thumbnail for your videos is an interesting part of the video clip.

Ultimately, the quality of your presentation is only half the activity of Youtube.  The other half is attracting subscribers, friends and hits.  Make loads of comments on related video content.  Subscribe to other related channels and Friend the users as well.  Making video responses to related content that receives high view counts is also gold for getting channel and profile views and increasing your Youtube subscriber count. All of this is work that results in more views on your own Youtube channel or profile.  Make sure that your website link is visible on your channel and profile in order to turn those views into website hits and leads.

This was part 2 in my Website Traffic Generation series of articles.  Stay tuned for part 3 where I will discuss traffic generation through widget or app creation.

Putting it on the Line

In an odd twist of time management, I caught the TV show, “America’s Got Talent” last night.  I didn’t necessarily intend to tune in.  Just happened to be in the right place at the right time, for lack of a better expression (what I mean is that I was on the couch at 9pm EST with the TV on, mindlessly flipping channels).

The show was currently in the final stage of choosing the top 48 contestants to go on to Hollywood. I was actually really impressed with some of the talent, but what really caught my attention is the passion and drive that many of the contestants have.  More often than not, their emotions seemed to be on overdrive, like they were literally putting their lives on the line.

One act, in particular, really drew me in. Jeremy does mountain bike tricks – hops and stalls and stuff.  His first audition of small bike hops over people lying on the ground impressed the judges enough to send him on to Vegas for audition number 2.  But doing the same routine again in the second audition probably wouldn’t have been enough to propel him to the top of his category.  He knew he needed to up his game.  So Jeremy decides to jump two feet in. He quits his job and goes broke building a better obstacle course for the stage.  He gives up everything to focus on training for his next audition, in an attempt to make it to the top of a talent show with what is little more than a novelty act!!

Jeremy has a determination that I will possibly never know.

What he does that many of us fail to do is to not only dream, not only set a goal, but to actually put things on the line to reach that goal, and take action, full bore, in a big way.  He knows that if he fails, he has no money or job to go back to.  Despite everything that he pours into his act, he knows that he’s up against big competition and there’s a good chance that he won’t be put through to the finals.  He knows this but there’s no questioning him – he is dead serious – he is going for it.

It made me realize that some of the things I want in life I probably will not achieve, or succeed as well as I could if I were only willing to put the necessary things on the line – take the risks; realize that some of the things that I would otherwise see as a means to an end are also possibly obstacles in the way of me attaining some of my dreams.