Bret Taylor, a co-creator of Google Maps, recounted how Google Maps Satellite Mode was almost called Bird Mode. See a screenshot of the story below:
Read the HN discussion on this story here: https://news.ycombinator.com/item?id=19235017 .
Tips, tricks, and thoughts about Google, AdWords, Google Cloud Platform, and all its subsidiaries. Not affiliated with or sponsored by Google.
Bret Taylor, a co-creator of Google Maps, recounted how Google Maps Satellite Mode was almost called Bird Mode. See a screenshot of the story below:
Read the HN discussion on this story here: https://news.ycombinator.com/item?id=19235017 .
Today’s Google Doodle celebrates the 57th birthday of “Crocodile Hunter” Steve Irwin, who was a famous wildlife conservationist, zookeeper, and TV personality.
This is what the Google homepage looked like with the doodle:
Clicking on it goes to a slideshow showcasing many aspects of Steve Irwin’s life.
Many other organizations are also taking the opportunity of celebrating Steve’s life, such as Animal Planet on Twitter:
A quick code example today: serializing a Java object to Google Cloud storage. write_object stands for the object being written. This code depends on the App Engine libraries for Java, and the Google Cloud Storage libraries.
GcsService gcs_service = GcsServiceFactory.createGcsService();
GcsFilename gcs_filename = new GcsFilename(AppIdentityServiceFactory.getAppIdentityService().getDefaultGcsBucketName(), "subfolder_within_bucket" + "/" + "filename.extension");
GcsFileOptions gcs_options = GcsFileOptions.getDefaultInstance();
GcsOutputChannel output = gcs_service.createOrReplace(gcs_filename, gcs_options);
ObjectOutputStream oos = new ObjectOutputStream(Channels.newOutputStream(output));
oos.writeObject(write_object);
oos.flush();
oos.close();
output.close();
I often use the Python sqlite3 module: it helps save time during development as it’s a lightweight SQL engine. Even in production, some small applications can get away with running SQLite instead of a more normal SQL application.
To create a table in sqlite:
import sqlite3
def create_table():
create_table_sql = """CREATE TABLE tweets (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE,
posted_date DATETIME, tweet_text VARCHAR(300),
user VARCHAR(20), retweet_count int, favorite_count int,
original_tweet_id VARCHAR(20)
original_user VARCHAR(20));"""
conn = sqlite3.connect("example.db")
c = conn.cursor()
c.execute(create_table_sql)
conn.commit()
conn.close()
And to execute operations against the created table, you simply need to connect to example.db and run c.execute:
# Execute into sqlite
conn = sqlite3.connect("example.db")
c = conn.cursor()
As I’ve said before, I love documenting error pages from popular web sites: they often have a sense of humor or show off another face of the company.
Here’s an example of an Amazon error page. What a handsome looking dog!
Do you need to transfer text/music/pictures from your desktop/laptop PC to your iPhone? Do you need these files available to look/listen to even when your iPhone can’t get a signal?
I frequently need to transfer audio files/music from my laptop and listen to them on my iPhone, even in areas that don’t have cell reception. Fortunately, Google Drive offers the ability to mark files as available offline – to download the files to the iPhone’s local memory so they’re available at all times.
To do this, first use your PC to upload files to Google Drive. Then on the iPhone, open up the Google Drive app, find the audio file, and click on the three period symbol (inside the purple box) below:
A context menu will pop up below:
Use your finger to pull the menu up (towards the top of your phone). You’ll see the full menu. Where it says Available Offline, pull the switch to the right until you see blue.
You’re done! A prompt should show up, where Drive acknowledges the offline request:
To make sure the file is fully downloaded, leave the Google Drive app open a moment before you close it out.
When installing a new Django app on App Engine, I forgot to set the hosts header, and found this error:
The problem here is that I didn’t set the allowed hosts header in the settings file. To fix this, go to settings.py file and set ALLOWED_HOSTS to list a wildcard, like so:
ALLOWED_HOSTS = ['*']
You can see this replicated in Google’s own Django example: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/django/mysite/settings.py#L46 (see screenshot below).
Warning: A wildcard is only acceptable because App Engine’s other security policies are protecting the application. If you move the Django site to another host, make sure you change out the wildcard to the appropriate domain/domains.
I spent today morning pulling my hair out trying to get a Python 3 application running within AWS’ Cloud9 IDE. Essentially the problem is that if you pip install some-package, that package only becomes available within the Python 2 runner, not within the Python 3 runner (the current Cloud9 machine image includes Python 2 aliased as python, and Python 3 available through python3).
Fortunately for me, someone else had the same problem, and an Amazon staffer suggests creating a virtual environment: https://forums.aws.amazon.com/thread.jspa?messageID=822214&tstart=0 . I followed the steps mentioned, but it didn’t work – pip still installed dependencies for Python 2. I wonder if this staffer forgot to mention another step, such as remapping the pip command to a Python 3 install.
What finally did work was calling the pip command through the python3 interpreter, like so:
First, ensure pip is installed:
python3 -m ensurepip --default-pip
Then upgrade pip:
python3 -m pip install --upgrade pip setuptools wheel
Then you can install any requirements of your app, such as BeautifulSoup:
sudo python3 -m pip install --upgrade bs4
And after all that, my Python 3 app was able to access the BeautifulSoup dependency.
I’ve been setting up redirects from my old Tumblr blog to WordPress; here is documentation how I handled it.
Netlify offers static web page hosting, and more importantly, supports redirects and rewrites. It can deploy a static web site from a git repository, or by uploading a folder from your local computer. What I did was set up a git repo with a file named “_redirects” (no quotation marks) and connected it with a Netlify deployment; instructions to do this are available here: https://www.netlify.com/docs/continuous-deployment .
The redirects file should look like this:
/ https://www.learngoogle.com/ 301
/tagged/* https://www.learngoogle.com/tag/:splat 301
/post/49459687975/* https://www.learngoogle.com/2013/05/02/test/ 301
This works by:
Obviously, all of these redirects are 301 Moved Permanently links. You’ll also need to remap your old domain to point to the Netlify deployment target: https://www.netlify.com/docs/custom-domains/ .
I love seeing error pages – it’s great to see how many companies customize their web pages to reflect their corporate character. Disney is no exception.