The New and Kindlier Kindle

It’s kindlier to the pocket that is. I’ve never paid much attention to Amazon’s Kindle products because I thought it cost too much. It’s an extraordinary product. No doubt. Recently, Amazon made an announcement that raised my eyebrow. The price of the latest Kindle is now just $189. It’s still somewhat pricey, but that’s my opinion. In addition, there is WiFi-only Kindle for only $139.

With the 3G wireless, you can download and start reading books in 60 seconds. The screen has no glare in direct sunlight. A single charge can last one month. It can store up to 3,500 books and it weighs only 8.7 ounces. If you ever run out of space, you can delete books with abandon and Amazon will allow you to re-download your books at anytime for free.

The 3G network works in the US as well as abroad. There are no monthly fees. Getting a Kindle with 3G Wireless access at $189 is nice to have, but the Kindle WiFi-only at $139 is simply irresistible.

Check out the latest Kindle.

Add Google Maps To Your Posts

They say a picture is worth a thousand words. Adding a static map to your posts can make a world of difference. Your posts not only look good, but are informative and effective as well. Whether you are giving out directions or simply just showing off where in the world you were at one point, you can add great value and effectiveness to your posts. The good news is, adding Google Maps is not so difficult.

The Google Static Maps API

The Google Static Maps API lets you embed a Google Maps image on your webpage without requiring JavaScript or any dynamic page loading. The Google Static Map service creates your map based on URL parameters sent through a standard HTTP request and returns the map as an image you can display on your web page. I will breakdown the URL piece by piece and explain.

The URL

http://maps.google.com/maps/api/staticmap?<em>parameters</em>

Required Parameters: Center, zoom, size and sensor. Examples.

center=101+Market+Street+San+Francisco  (enter address or latitude, longitude)
zoom=14 (from levels 1 to 20)
size=480x300 (map size in pixels)
sensor=false (use default 'false' unless using GPS locator)

Optional Parameters

Maptype: Roadmap, Satellite, Terrain or Hybrid.
Marker: See below.
Paths: See below.

Putting It All Together

We can string it all together using ampersand (&).

This URL:

http://maps.google.com/maps/api/staticmap?center=101+Market+Street+San+Francisco&amp;zoom=14&amp;zoom=14&amp;size=480x300&amp;maptype=roadmap&amp;sensor=false

Produces this:
San Francisco

Finally, to add an image to your post, just add an HTML img tag. Example:

<img src=”http://maps.google.com/maps/api/staticmap?center=101+Market+Street+San+Francisco&zoom=14&zoom=14&size=480×300&maptype=roadmap&sensor=false” 
alt=”San Francisco” />

There are other options that can be added such as Markers and Paths, but are a bit more involved. You can check out the rest from the Google Static API V2 Developer Guide.

Add a Home in WordPress Pages Widget

WordPress Widgets are handly little pieces of code that usually come from plugins. They are usually displayed on sidebars. One of my favorite widget is the Pages Widget. One thing that is obviously lacking from the Pages Widget is a ‘Home’ link.

A number of WordPress themes use ‘Pages’ for navigation. The navigation links are usually located on top or just below the header. Theme designers usually add a custom ‘Home’ link in addition to listing the pages, ie, wp_list_pages().

If you use the Pages Widget, you can add a ‘Home’ link without adding a single line of code. The inspiration came from an earlier article I wrote about ‘Creating a WordPress Page With An External Link.’

Add A Home

Go to your Dashboard > Pages > Add New

Enter in the Title: 

<a href=”/”>Home<a/>

Leave the content blank. Publish.

You now have a WordPress Page pointing back to your main index page. Verify if the ‘Home’ link is reflected on the Sidebar.

That’s it.

Remove Old Kernel in Ubuntu and Grub2

In 2005, I wrote a short article on how to delete old kernels in Linux. At that time, I was using Fedora exclusively. Since then, I’ve moved on to Ubuntu. In addition, Grub2 is now standard for all Ubuntu releases. This short article will show you how to remove old kernels in your Linux system as well as clean up your Grub2 entries. By the way, you will see Grub2 entries only if you have a multi-boot configuration. If not, Ubuntu will boot directly to the login screen.

First, determine the current kernel being used by typing the following command in the Terminal.

# uname -r

The result will display something like the one below.

2.6.32-24-generic

Now, it’s important not to delete your current kernel because all hell will break loose or the sky will fall on your head. In either case, you don’t want to be in that predicament.

You can use the ‘Synaptic Package Manager’ to remove the older kernels. Use ’2.6.32′ to narrow down your search. Right click on the kernel you want removed and choose ‘Mark for Complete Removal.’ After all older kernels are removed, you can now update the Grub2 configuration.

Grub2 Configuration

# sudo update-grub

That’s it. The next time you boot your multi-boot Ubuntu system, you will see less entries in Grub as well as successfully have deleted older kernels you no longer needed. There is a more detailed instruction how to remove other entries in Grub from howtogeek.com.

New Xbox 360 at $199

Microsoft revealed the price of the new Xbox 360 today at just $200. It’s sleek new design with glossy black finish is quite impressive. The biggest difference in my opinion is how quiet this new console compared to its predecessor. The whisper quiet console won’t drown out the sound when you’re watching Netflix late at night. The device also comes with a 250GB hard drive and a built-in Wi-Fi N adapter.

Microsoft also revealed the price of Kinect today at $150. If you don’t have a Xbox 360 and are looking to get one, you might want to take advantage of the bundle that includes the Xbox 360 that comes with a 4GB internal flash memory,  the Kinect and a game called Kinect adventures. The bundle is priced at $300.

If you are not familiar what Kinect can do, check out the Xbox 360 website. It’s similar to Wii, but without the paddle.

Add Twitter Trends To Your WordPress Blog

Several months ago, I wrote a post on how to retrieve Twitter trends. Today, I’ll show you how to add and display Twitter Trends in your WordPress theme. First, the code to retrieve Twitter trends.

function get_twitter_trends() {
  $contents = @file_get_contents("http://search.twitter.com/trends.json");
  if (strpos($http_response_header[0], "200")) {
    $json = json_decode($contents);
    foreach ($json->trends as $trend) {
      echo $trend->name;
    }
  }
}

Add this function in your theme’s functions.php file. If you want to make the trends clickable, then use the Twitter search link. This will send users to the Twitter Search page when they click on a trend.

echo '<a href="http://twitter.com/#search?q='.$trend->name.'">'.$trend->name.'</a>';

Finally, place this code in your WordPress theme where you deem appropriate.

if ( function_exists( 'get_twitter_trends' ) ) get_twitter_trends();

Mandriva Spring 2010

I was a Mandrake user for several years, before Ubuntu and Fedora were even part of the Linux lexicon. At the time, Mandrake was one of the easiest distributions in the Linux community. Mandrake was derived from Redhat with a focus on ease of use and usability.

Shortly after, Mandrake became Mandriva. I lost track of the distro because other better distros came along. Fedora and Ubuntu particularly took the Linux community by storm. Most people jumped ship and moved on to other distros. I did the same and chose Ubuntu.

Mandriva is still around. 3 million users strong according to their website. Mandriva has a new distro called Mandriva Spring 2010. It’s available for free to download. It comes in two flavors, Gnome and KDE. I’m not used to seeing Mandriva with Gnome since it was a KDE distro.

If you have some spare time, you can give Mandriva Spring 2010 a try. I’m interested in two other products by Mandriva, the InstantOn and Flash. InstantOn boots in less than 10 seconds while Flash is a mobile desktop in a USB key. Unfortunately, they are not free.

Anyways, give Mandriva Spring 2010 a try. Download.

Display Latest Twitter Status On Your Blog

Here’s a short little script that will display the latest Twitter status on your blog. I pulled the code from CSS-Tricks and modified it a bit. This little piece of code will pull-up the user’s latest Twitter status, time and source. You can also pull up the user’s name, screen name, location, url, followers, friends, favorites and more.

Here’s the snippet of code:

<?php
function getTwitterStatus($userid) {
  $url = “http://twitter.com/statuses/user_timeline/$userid.xml?count=1?;
  $xml = simplexml_load_file($url) or die(“could not connect”);
 
  foreach($xml->status as $status){
    echo $status->text;
    echo $status->created_at;
    echo $status->source;
    echo $status->user->name;
    echo date(“F j, Y, g:i a”,strtotime($status->user->created_at));
    echo $status->user->statuses_count;
    echo $status->user->followers_count;
    echo $status->user->friends_count;
    echo $status->user->favourites_count;
    echo $status->user->location;
    echo $status->user->time_zone;
    echo $status->user->url;
  }
}
?>

You can format the output anyway you want it. For readability purposes, I formatted the $status->user->created_at field with the date function. All the other variables are pretty much self-explanatory.

Add the function in ‘functions.php,’ then insert this code anywhere in your WordPress template.

getTwitterStatus("user");

HTTP Referrer

This short article will teach you how to return your program to the referring URL if you are running a PHP script or a function. At the top of the script you will need to capture the referring URL by including the following:

$ref = getenv("HTTP_REFERER");

You can then place your function next anyway you want it.

function {
 your function ...
}

When you are done, you can return the user to the referring URL by sending a header function.

header('Location: '. $ref );

Caveat: you will get a “header already sent error” if you are printing to the screen before the header function.

That’s it.

Charging For Spam

Spam seems to be everywhere. I thought about all the spam I’ve received since I started blogging.  If I’ve charged for a dollar a spam, I’ll be a rich man by now. My current spam count is at 323,460.

My Akismet stats indicate that 99% of all my comments are of the spam variety. It’s a well-known fact that 95% of email is spam. Spam takes up a tremendous amount of hardware resources from CPU, memory and storage.

To fight back for resources lost, all bloggers should start charging spammers for every spam sent. Spam comments will be allowed to stand if a spammer has paid for them. All unpaid spam are deleted.

The question is, will there be enough spammers willing to pay for premium spam?