Monthly Archives: January 2019

Google AdSense Account Login Bug…

I am only posting this because I found a bug in Google’s account ID logic. If you encounter this bug, its very difficult to rectify, especially since there is no direct phone or email AdSense support – only online forums.

Whats the bug?

So an AdSense account is tied to a main google account. This could be your G Suite email, like user@domain.com or generic Gmail google account like user@gmail.com. The account is then associated with a website, say www.domain.com. A website entity can only be assigned to a single account. So here is the bug occurs:

  1. You setup G Suite for business so you can use Gmail with your own domain, lets call this domain foo.com and your G Suite login/account is bob@foo.com.
  2. Over time, you decide to show ads on your foo.com website, so you signup for AdSense using your bob@foo.com google account.
  3. Everything works great, your making money showing Ads.
  4. One day you decide you dont want to use Gmail for email services, you want to move your foo.com email service to another party. So you go into G Suite and cancel all G Suite for foo.com. At this point, your bob@foo.com google account is deleted.
  5. A few months go by and forgot about the AdSense stuff, so you try to login to AdSense… But WAIT.. your AdSense login was bob@foo.com google account, which doesn’t exist now, so you cant login.
  6. You assumeall accounts are deleted that are associated with bob@foo.com so you create a new free generic gmail account, like bob.foo@gmail.com.
  7. You create an AdSense account for bob.foo@gmail.com and associate it with your foo.com website. When you do this, Google analyzes your site and says to check back in 24 hours.
  8. The next day you get an email from AdSense that looks like this:

The problem is none of these options will help you because its IMPOSSIBLE to login to AdSense as bob@foo.com. You are now in this paradox where google has an old invalid account preventing you from creating a new AdSense account, and there is no way to delete the account, nor is there a way to easily contact Google to have them fix this anomaly.

What do you do? 

After many AdSense forum posts, someone (presummably from Google) sent me a link to a hidden form submission page:

https://support.google.com/adsense/contact/cant_log_in

This page gathers basic info, though it still lacks the option to describe whats really going on, then sends to a human at Google. I recommend in the box where it asks about browser issues, type in an explanation of the bug.

 

Using sed to edit files in place…

The other day I ran across a scenario where I needed to edit a file via a web app. Seems simply, but the file permissions were tricky and I didn’t have the rights to delete the file then re-create again since the top level directory permission wont allow it. So the easiest solution is to use sed to edit the file in place. The sed command can be called from inside the web app as long as the file we are editing has the proper permissions.

What is sed?

sed is a Stream Editor, hence the name. Normally you would use it to edit data coming in via STDIN or a STDOUT redirect. But the “-i” flag allows you to edit a flat file in place. Lets look at a few examples, take the following file contents:

Date: Dec 15th, 2019

TODO LIST
Clean house
Take out garbage
Buy groceries
Feed the fish
Watch TV

Lets say I want to edit this file in place and delete the line “Buy groceries”. There are few ways to do this, I can delete it via the line # or via regular expressions. The line # is 6, so the command would be:

# sed -i ” ‘6d’ /some/path/to/filename.txt

Note the empty set of single quotes after the -i, this is required for newer versions of sed, -i tells it to edit the file in place without creating a backup extension file. The ‘6d’ simply tells it to delete the 6th line of the file. Here is how you do it via regular expressions:

# sed -i ” ‘/^Buy.*/d’ /some/path/to/filename.txt

Again the d tells it to delete, the regular expression is inside the forward slashes, in this case the REGEX is find something that matches beginning of line word Buy, followed by anything.