Background

Have you heard about Google’s latest service – Google Cloud Print?

It’s a cool service which allows you to print stuff from your home printer using any other computer in the world or even (and especially) mobile devices.

The service is still in beta, so right now you can only print through mobile devices with HTML5 compliant browsers which can access Google’s Gmail and Docs mobile version.
They claim that their next step is embedding this functionality in Chrome OS notebooks.

It kind of looks like they skipped over Google Chrome’s version.
That’s why I developed an extension for Google Chrome through which you may print using the Google Cloud Print service to any of your connected printers.

I encountered quite a few technical challenges while developing this extension. But I’ve overcome all of then and I’m proud to present the final outcome.
Everyone is welcome to download and study the extension’s source code.

Download

You may download the extension here: (A 5 star rating will be greatly appreciated :)
https://chrome.google.com/webstore/detail/ffaifmgpcdjedlffbhenaloimajbdkfg

What does the extension do?

The extension gives you the ability to print any doc/pdf/txt file, Gmail attachment, email or Google Docs document using Google Cloud Print™.

Screenshots

Here are some screenshots of the extension in action:

Some more screenshots people took I found on Flicker:
http://www.flickr.com/photos/nda/5411410871/
http://www.flickr.com/photos/nda/5411411069/
http://www.flickr.com/photos/nda/5411410263/
http://www.flickr.com/photos/nda/5411410395/
http://www.flickr.com/photos/nda/5411410871/
http://www.flickr.com/photos/nda/5412023376/

Instructions

Print a pdf/doc/txt/jpg/jpeg file

Navigate your way to the desired file and click the extension’s icon.

The icon will appear on the left side of the address bar only when the current tab’s URL ends with .pdf, .doc or .txt.

Print a Gmail attachment or email

Look for the “Print using Google Cloud Print” links (you can see where they are located in the screenshots).

Print a Google Docs document

Open a document and click File > Print using Google Cloud Print.

Demo Video

Here is a demo video of the extension in action (thanks to Digital Inspiration):

Changelog

Version 0.31 (5/3/1011)

Version 0.3 (15/2/1011)

Version 0.22 (10/2/1011)

Version 0.21 (9/2/1011)

Version 0.2 (7/2/1011)

Press

This extension has been broadly reviewed by bloggers and news sites:

Feedback

Please leave any feedback / suggestions you might have at the extension’s feedback forum (no registration needed):
http://printusinggooglecloudprint.uservoice.com

or in the comments section below, or by contacting me.

Learn more

About Google Cloud Print™:
http://www.google.com/support/cloudprint/
http://www.google.com/chrome/intl/en/p/cloudprint.html
http://code.google.com/apis/cloudprint/docs/overview.html

Search terms:

You can extract and view any Google Chrome extension’s full source code following the following easy steps.

Every Google Chrome extension is basically a CRX file. When you click the “Install” button on the Google Chrome extension gallery you are basically clicking a link of the extension’s CRX file.

The first step is downloading the extension’s CRX file. Instead of clicking it’s link, which will lead to that extension being installed on your browser, right-click the link and choose “Save link as…”.

Now that you have the CRX file on your computer, rename it’s extension from CRX to ZIP. Turns out that every CRX file is a renamed ZIP archive of the extension.

All there is left to do is extract the ZIP archive to the desired destination. The full code of the Chrome extension is there.

Have fun exploring other peoples code!

Search terms:

I was curious to see what’s inside a wireless keyboard that was laying around the house. So I cracked it open. And boy did I learn some interesting stuff.

Tip of the day – follow your curiosity and instincts. Only good can come out of it.
Or like National Geographic says: “Live Curious“.

Anyhow, I had some fun with what used to be a wireless keyboard and this is the end result:

The odd ball at the top acts as the mouse. It’s surprisingly comfortable and accurate.
The upper trigger acts as a left mouse button.
The lower trigger acts as a right mouse button.
The scroll wheel at the bottom acts as a… scroll wheel.

You can turn the remote sideways and control any TV using the mini universal remote control glued to the side (thanks eBay!).

It comes real handy when watching TV series while in bed (oh the laziness!).

31.10.2009

Lately, a fellow web developer of mine asked me why can’t he manage to save the current time in a MySQL table. The problem was that he didn’t understand how the PHP timing mechanism works. That’s why I decided to write this article.

Working with PHP is easier than most people originally think. It is after all the general purpose scripting language used in web development. Once you understand the basics like time managment and databases, you can very easly produce dynamic web paging using it. Before you even consider setting up a webpage, it must be a priority to understand the basics of PHP. Hopefully you will find the following helpful and informative.

time() and date()

time()

The time() function receives no parameters and returns the current time measured in the number of seconds since January 1 1970 00:00:00 GMT.
This may sound a bit weird but I find it to be clever.

Because one doesn’t want to display dates and times in PHP as a very long number (e.g. “The current time is 1256702873″), the date() function was created.

date()

The date() function returns a string formatted according to the given format parameter.

The function is documented as follows:
string date ( string $format [, int $timestamp ] )
While I prefer to think of it as:
string date ( string $format [, int $timestamp=time()] )
If you don’t pass the second parameter, it uses the time() function instead.

Lets see a couple of examples:
<?php
// Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the
// Mountain Standard Time (MST) Time Zone

$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$today = date("m.d.y"); // 03.10.01
$today = date("j, n, Y"); // 10, 3, 2001
$today = date("Ymd"); // 20010310
$today = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day.
$today = date("D M j G:i:s T Y"); // Sat Mar 10 17:16:18 MST 2001
$today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:18 m is month
$today = date("H:i:s"); // 17:16:18
?>

I don’t want to get into the format parameter in this post, but you can read all about it at the PHP manual.

Saving the time in a MySQL Database

The wrong way

My friend was using some sort of a special “date”/”time”/”timestamp”/”datetime” column type because he didn’t know what he was getting from the time() function.
This is not the way to store the result from time(). While it may be useful in certain circumstances, I’d rather save the number of seconds since January 1 1970 00:00:00 GMT for later easier manipulation with PHP.

The right way

All you need to do is use a simple INT or BIGINT column type to store what you get from your time() call.
In order to display it, use the date() function, passing it as the second parameter.

Search terms:

A theme consists of many files, this can get very confusing very fast. What files are needed? What files runs when and why? Here are the explanations and tips about WordPress template files.

First things first, what is a template exactly? A template is a PHP file that is a part of a theme. For example, there is a template for displaying the home page, one for displaying pages and another one for displaying posts.

What Are The Existing WordPress Tempaltes?

Here is a list of the existing WordPress templates that can be used in themes:

Here is a very useful image provided by WordPress Codex (click to enlarge):

WordPress Template Hierarchy

Custom Templates

There are two main types of custom WordPress templates.

The first one are templates that WordPress looks for automatically, and if one is found it will be used. What the heck am I talking about?
If you have a category called “News” with the ID of 512 and you want the archive page of that category to have it’s own unique template you can create a new template file called category-512.php in the theme’s folder. And WordPress will use it.

This is the list of custom wordpress templates you can use:

WordPress Custom Template Drop Down

Now for the second type of WordPress custom templates.

Let’s say you have more then one page* you want to be displayed in a different way then the others. How do you do that?
Create a new file called whatever.php at your theme’s folder and inside write whatever you want instead of single.php or index.php (depending what displays the single posts at your theme).
Add this comment to the top of the file:

<?php
/*
Template Name: The Whatever Template Yo
*/
?>

(Of course change The Whatever Template Yo to the new template’s name)

Now edit (or create) the pages which you want to use this template and in the right side pick the desired template from the drop down menu. Just like in the screenshot at the right side.

*If you want to do this for posts rather then pages then you will find the Custom Post Template plugin very useful.

Any questions/corrections? Comments are always welcome.

Search terms:

Google Text Size Change - Before and after
Are you asking yourself “Did Google just change their front search page?”, The answer is yes.
Now officially announced in their blog, The size of the buttons, text, logo and text box has increased at google.com or at any other local google home page.

This change is not browser specific and it has been verified that the change includes but not limited to: Google Chrome, Firefox, Internet Explorer and Safari.
Google says at their blog post that this change was made in order to emphasize their goal as a search engine and to show that their focus is always on search.

When I first saw the change I was convinced that me screwing around with Google Chrome’s preferences or something simillar has caused the text to be bigger until I saw Google’s post at their blog. Then I realized that It does not only happen in my computer, it happens everywhere.
Anyway, now that we are aware of actual reason, I wish you all Happy Googleing!

Search terms:
21.08.2009

YouTube New LogoI have received a request from someone that wants even more from my WordPress Custom Fields Plugin. He has a category called “videos” which has posts with YouTube videos embedded with some plugin. He wants to put the videos thumbnail as the post’s thumbnail.

First, how is the video embedded in the post? It uses the following syntax:

Now you can embed it like you would normally do.

Second, how do we get the thumbnail itself after we extracted the video key? We build the image’s URL with the following syntax:
http://i2.ytimg.com/vi/$video_key/default.jpg

Now, how do we put all of this together into a plugin that inserts the thumbnails?
You don’t have to because I have already done it for you.

This plugin runs through the posts in your blog and if it finds a YouTube video embedded in a post it sets the thumbnail to be the video’s thumbnail.
That’s it, have fun playing with the configuration.

If you encounter any issues please comment/contact me.

Search terms:

1000 Downloads on the WordPress Plugin Directory
As you can see in the plugin‘s stats page, It currently has 1050 downloads!

Although the number may be not as big as other plugins (All in On SEO got over 2.5 million downloads), it means a lot to me. Every time you see numbers on the internet you don’t really think about them as you would outside the monitor. When viewing YouTube videos, if I see a video that has less then 5k views most of the times I won’t enter it and try to find another one with millions of views.

But when you think about the actual numbers it’s a huge amount of people sitting on their chair at home or at work, entering YouTube and watching the video. The same goes to plugin downloads, It’s really cool to know that my plugin helped over 300 (?) other people around the world that have their own website.

Update: It how has over 3000 downloads!

Search terms:

WordPress Stats Tab
As I’m sure you have all seen at least one time, each plugin at the wordpress plugin directory has a “stats” page.
The stats page tells you the statistics of the plugin downloads, how many downloads have been today, yesterday, this week and all times. It also displays a cool graph with all the information in it.I don’t know why but I just have this feeling that says I “must” click the stats tab and check the numbers out.

After looking at many stats of many plugins I noticed a similar pattern in the graphs. There is a wave action that looks like this (if you want you can see it for yourself in the popular plugins section):
Plugin Stats Wave

Then I did some research on the dates that the waves began and I realized that those waves are happening every time an update is released.

That’s pretty cool and all but It got me thinking, If every download counts, even the update downloads and every big plugin has 4+ updates that means that the “All Time” download counter is 6 times or more (plus people that download the plugin to check it out and then delete/disable it) the actual number of websites using it.

I just want to let everyone know that the download counter is really far away from the plugin users number/the number of blogs using the plugin. Next time try to say download count instead of plugin downloads.

Search terms:

The new version of Mass Custom Fields Manager is out!
Why do you need it? For example if you have custom fields that old plugins left of your posts and you want to get rid of them you can now do it with a click of a mouse. There are virtually endless occasions where this plugin can save you valuable time and effort.

I added new features that you asked for, fixed some minor bugs and did some code optimization.

Download it now!

If you encounter any bugs or have an idea on how to improve the plugin then I would love to hear it from you.

Search terms:

Next Page »