YouTube – Search Found Nothing

As I’ve said before, I love collecting samples of error pages, especially when companies take the extra time to personalize or make the error funny.

Perhaps this isn’t an error per se, but I love the image YouTube pops up when its search function can’t find anything relevant to the query:

no results found on youtube search. image shows a twisted telescope.

Google Search Operator: The Number Range

Suppose you need to find a web page containing a number, but you don’t know the exact number. Enter the Number Range operator. The number range operator looks like this: #..#.

For example, if I wanted to search for content from the Google I/O conventions between Google I/O 2016 and Google I/O 2018, I could search for the following:

google io 2016..2018
Search for Google IO 2016..2018

As you can see from the videos top bar, I found content from Google IO 2018 (the keynote), and Google IO 2017 (Introduction to Kotlin).

The number range operator works for prices as well. Suppose I wanted to buy a laptop, but my budget is only $550 to $700. Let’s try to find a laptop using Google search:

laptop $550..$700
laptop $550..$700

As you can see from Google’s bolded text, I found multiple laptops within my price range of $550 to $700.

Using Google Protobuf Timestamp In PHP

This is more of a documentary post because I haven’t seen documentation on Google’s Timestamp class anywhere.

Google’s libraries – in particular, the GCP libraries for datastore/tasks/etc – use the Google/Protobuf/Timestamp class to represent time. Timestamp is a simple wrapper around the number of seconds since UNIX epoch, in the UTC timezone. For example here is how to create a Timestamp reflecting the current date and time, plus 2 minutes into the future (120 seconds):

use Google\Protobuf\Timestamp;

    $future_time_seconds = time() + 120;
    $future_timestamp = new Timestamp();
    $future_timestamp->setSeconds($future_time_seconds);
    $future_timestamp->setNanos(0);

There are equivalent classes and functions for Python/Java/Go/other languages that Google Cloud supports.

Using the Timestamp class – especially setting up future dates – is necessary for configuring my favorite Google Cloud service: Cloud Tasks. A Cloud Task can accept a future date to run at, thereby giving you a way to queue up and delay execution of an activity. For example, see the below screenshot: I’ve created 3 tasks 20 seconds ago, yet they’re set for a future execution 3 minutes 45 seconds from now:

Google SEO Change: Rel=prev/next No Longer Works

Yesterday, the Google Webmasters Twitter account mentioned that the rel=prev/next tag is no longer used by the Google index spider:

The rel=prev/next attributes were used to indicate paginated content to Google – for example, long forum threads broken up into multiple pages, slideshow-style articles, and so forth.

Search Engine Journal has a longer article about this here: https://www.searchenginejournal.com/google-stopped-supporting-relprev-next-in-search-indexing-years-ago/299689/

Google used to have a help page explaining the use of the attribute – it was located at https://support.google.com/webmasters/answer/1663744?hl=en , but is now deleted. You can see an older copy here:

The former help page discussing rel=prev/next. Click to expand.

This change doesn’t surprise me – it’s been clear for years now that Google is increasingly using ML/AI to “read” web pages and infer relationships between pages, instead of going by what the page says about itself. The information that it extracts can then be used to power knowledge panels on Google search pages.

Furthermore, I wouldn’t be surprised if Google finds pagination relationships to be less important than other signals. For example: if there’s a long forum thread discussing some controversial issue, every page of the forum thread is not equally important; perhaps Google wants to focus on only those pages with important information, or those that get linked to the most frequently.

Activating Basic HTML Mode For Gmail

Sometimes the full Gmail experience is too much for an older laptop or mobile device. Instead of trying to load the new Gmail, you can force the basic HTML version of Gmail to load by going to mail.google.com/?ui=html .

If you’re already signed in, you might see the below screen. If you’re signed out, you’ll need to sign in using the standard login screen.

Google confirming you want to use HTML mail.

After this, you’ll see a much stripped down version of Gmail:

I have way too much email in my inbox!

Creating A WordPress Blog Slug Part 2 – Python

In a previous post, I posted a sample NodeJS function to assemble a WordPress blog slug. I ended up rewriting part of the larger application (and the function itself) in Python.

In the below function, source is a blog title string, and it returns a slug suitable for use in a blog URL.

def generate_slug(source):
    i = 0
    source = source.lower().strip()
    allowed = "abcdefghijklmnopqrstuvwxyz1234567890"
    slug = ""
    while i < (len(source) - 0):
        single_letter = source[i:i+1]
        if single_letter in allowed:
            slug += single_letter
        elif not slug.endswith("-"):
            #letter is not allowed
            #check that the slug doesn't already end in a dash
            slug += "-"
        i = i + 1
    return slug

Utility Functions To Save To Google Cloud Storage

Here are short utility functions used to save to Google Cloud Storage in a Java App Engine application.

These snippets require the Java Cloud Storage library ( com.google.appengine.tools.cloudstorage.GcsService ). The bucket string is the name of the bucket, no gs:// required. folder_path is the subdirectory you want to save the file under. It should end with a forward slash. For example this/is/a/subdirectory/ . If you do not want a subdirectory, pass an empty string (“”). filename is the filename of the file you want to save, while contents is the data being saved.

There are two functions here. The top is intended to quickly save simple text/html/xml/etc files, while the bottom is intended to save binary files such as images, executables, and so forth. The bottom function includes a filetype argument, which should be filled with the appropriate MIME type. For example: image/png, image/jpg, application/octet-stream.

Reminder: GCS innately views files as individual objects. When you specify a subfolder, the filename for the object itself includes the folder path. When you read the file back from Google cloud storage, you need to include the folder path: for example this/is/a/subdirectory/example.png .

	public static void saveStringToGCS(String bucket, String folder_path, String filename, String contents) throws IOException {
		GcsService storage_service = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
		GcsFilename to_file = new GcsFilename(bucket, folder_path + filename);
		GcsFileOptions file_options = GcsFileOptions.getDefaultInstance();
		storage_service.createOrReplace(to_file, file_options, ByteBuffer.wrap(contents.getBytes(StandardCharsets.UTF_8)));
	}
	
	public static void saveByteBufferToGCS(String bucket, String folder_path, String filename, ByteBuffer contents, String filetype) throws IOException {
		GcsService storage_service = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
		GcsFilename to_file = new GcsFilename(bucket, folder_path + filename);
		GcsFileOptions file_options = (new GcsFileOptions.Builder()).mimeType(filetype).build();
		storage_service.createOrReplace(to_file, file_options, contents);
	}

Google Doodle: Seiichi Miyake

Today’s Google doodle celebrates Seiichi Miyake, who invented paving slabs with tactile feedback, allowing the blind and visually impaired to navigate the world.

Here’s the Google home page with the doodle:

Here’s the doodle itself:

The Google doodle for March 18, 2019.

The Google doodle links to a search for Seiichi Miyake:

Google Doodle: St. Patrick’s Day

Google celebrates St. Patrick’s Day today, March 17. Here’s a screenshot of Google’s home page with the doodle:

Google’s home page with the St. Patrick’s Day doodle.

The doodle itself is animated: the oo in Google shifts around:

Clicking on the doodle links to a search for St. Patrick’s Day: