Category Archives: web discoveries

Mounting NTFS formatted External hard drive on Mac OS-X 10.6 or later

I didn't know until now that using an NTFS formatted hard drive on a Mac OS would not be a trivial task, that it would require digging up the web to find a way to do so. When I plugged in the external hard drive, it was identified and I could see that it was mounted using Finder. However, I was unable to view the contents of the hard drive. For a moment, I thought that all my content has been erased but when I checked the properties using 'File->Get Info', I could see that the disk usage was as I last remembered. Then I began searching(googling) to find out how to resolve this issue.

Following are the steps that worked for me and helped me get read access to the contents of the disk (will need to google more to find how to get write access as well).

  1. Install MacFuse.
  2. Install NTFS-3G for Mac.
  3. Restart your system.
  4. Connect your hard drive.
  5. (Optional) If you get a message like "Unable to mount the hard drive. Perhaps the hard drive was not removed safely from Windows system", connect the hard drive to a windows system and unmount it properly using the "Safely Remove Hardware" option. Then, try again by connecting the hard drive to your Mac OS.

The above steps worked for me and I was able to have read access to the contents of disk. I will have to look up the web to find out how to gain write access as well to an NTFS formatted hard disk. It seems that keeping the external disks FAT formatted is the reliable option to avoid running into cross-platform issues while using it.

Using tinyurl.com api calls for shortening long urls

TinyURL is a url shortener service or you may also call it a url crusher service, which takes in long urls and converts them into very short urls. With the increasing popularity of Twitter and a limitation of 140 characters on tweets, the url shortening services have gained popularity over the past few years. There are over 100+ url shortening services now at a user's disposal.

Almost all such services provides an option for developers to make api calls to return a short url given a long url but they also require an account and an API key. However, tinyurl.com doesn't require the user to have an account or an api key.

All one has to do is include the following function into a function.php file which you can include in any other php file where you need to make a call to tinyurl API.

<?php
 function shortURL($url) {
 $ch = curl_init();
 $timeout = 5;
 curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
 $short_url = curl_exec($ch);
 curl_close($ch);
 return $short_url;
 }
 ?>

To get the short url for a long url, one has to simply call this function as below:

$url = "http://technoflirt.com/tech/2011/01/11/running-php-script-host/";
 $short_url = shortURL($url);
 echo "Actual url =". $url . "<br />";
 echo "Shortened url = <a href=$short_url>$short_url</a>  <br />";

One can also observe how the short url link gets hyperlinked in the last statement.  However, tinyurl.com itself occupies quite a few characters compared to other services such as bit.ly, go.af etc. , so other services are now often used in comparison. The advantage is that it doesn't have a rate limit in the API calls as bit.ly and others.

Facebook Share button and Like button stats do not reflect what we may perceive

We may think, that counter shown near the Facebook share button at some blog post represents the count of unique Facebook users who have actually shared the link to that post on their wall. Similarly, we think that the counter near the Like button represents the count of unique Facebook users who have liked that post(link). But that is not true, the stats do not exactly represent what we may generally perceive them to be.

I became suspicious about the facebook share button count, when the count on one of my blog posts, had reached 6 yesterday. For a moment, I was pleasantly surprised that my post was getting shared across the web by a few facebook users. But after a moment, I realized that there was something wrong, because firstly, the post was not something great and secondly, I do not have a large (or actually even small) fan following that my post would be shared 6 times within a day. Investigating the reason behind it on the web, I discovered what that count actually represents.

Facebook share count = No. of times it has been shared +
                       No. of comments on that shared wall post +
                       No. of likes on that shared wall post.

At the time of writing this blog, the Facebook share count on that post was 7, which was because I had shared this link on my profile page and on my facebook page for this blog, and 4 comments were made on that shared post at my profile page and 1 like for that post at my profile page.

So, the question is how can we actually get to know the number of unique users who actually shared a blog post or link. To get the exact count, you can copy paste the line below into your browser's address bar, replacing the URL_YOUR_LINK by url of the blog post or any other link that has been shared on facebook.

http://api.facebook.com/restserver.php?method=links.getStats&urls=URL_YOUR_LINK  

<share_count> tag value represents actually how many times your link has been uniquely shared by distinct facebook users. But the count we see near the facebook share button is value of <total_count>.

For example, for viewing the actual stats of my blog post, click on this link or copy this link  http://api.facebook.com/restserver.php?method=links.getStats&urls=http://technoflirt.com/noflirt/2010/12/12/sticky-note-part-2/ into your browser's address bar.

Similarly, the stats for Facebook like button counter is actually the value of <total_count> tag value. For example, the number of likes on Drupal: Facebook-style Micropublisher Preview is shown as 5, but if you click this link http://api.facebook.com/restserver.php?method=links.getStats&urls=http://publicmind.in/blog/fbsmp_preview/ , you will notice that <like_count> value is actually 4.

Thus, the bottom line is that facebook share counts  and facebook like counts are actually deceiving. However, the comments or likes made by a facebook user xyz on a post abc shared by another facebook user abcd, are in some sense helping share the link as these activities appear in news feed of that user xyz as "user xyz likes some abc link" or "user xyz has commented on user abcd's link" . Such activities are now visible to the user xyz's connections. So, comments and likes are related to sharing a link. But even if the same user comments 5 times on a shared post, the facebook share button count increases by 5, because this count is related to how many times the link appears in the facebook activity feed of all the facebook users. So, I guess the count should actually represent the unique number of users who share, comment or like some link/post i.e. keep count of the unique association of users with some link.