Motorola Droid Turbo – Disable QI charging popup overlay

I’ve had a Motorola Droid Turbo for almost a year now and one of my biggest complaints is that while wirelessly charging on a QI charger a overlay would popup every few seconds even if the screen was unlocked. Today I noticed a system app running called “Inductive Charger” so I thought maybe I can somehow mess with that app to disable the really irritating popup overlay.

Steps to disable overlay

  1. Goto Settings->Apps
  2. Swipe to the “All” tab
  3. Find the app called “Inductive Charger” and open it
  4. Click the “Disable” button

You’re done, your phone will still charge on a QI charger but you wont get that irritating popup.

PostgreSQL: Change column casting type to another type

Because there have been a few times that I have needed to adjust a column in PostgreSQL from one type of casting to another I am going to put it here so I can find it again and for anyone else that may be looking to do the same thing.

ALTER TABLE table_name ALTER COLUMN column_name TYPE INTEGER USING column_name::INTEGER

Open text files using Chrome text app

Did you know you can set the Chrome app named “text” as the default application for opening any document/file on your system?

Today I figured I’d see if I could make the Chrome text app be my default program for opening .txt files on my system and I found that on my Windows system I could.

I did the following to make it work:

  1. First I created a shortcut on my desktop to the app.
    1. Open the apps tab or open the Chrome app launcher.
    2. Right-click on the text icon and select the “Create Shortcut” option
    3. I created the shortcut on my desktop for easy access.
  2. Right-click on the shortcut and go to properties to find what the “Target” path is.
  3. Copy the “Target” path.
  4. Now you can do one of two things you can edit the registry or you can use a program like Types to change the default program for any file, I personally like to use Types because it’s easy.

Using Types

  1. After you have Types installed right click on a .txt (or other document) and select “Edit with type”.
  2. Go to the “Actions” tab and click on the “open” action.
  3. Past the “text” target path into the bottom field and add a space and then “%1” to the end of the string.
  4. Close Types and try and open a file of the type you changed change and it should open with the Chrome app text.

Types Screenshot

Using the Registry

  1. Open regedit
  2. To change .txt files go to “HKEY_CLASSES_ROOT\txtfile\shell\open\command”
  3. Edit the “(Default)” string value to be the target path to the Chrome text app and add a “%1%” to the end of the string. It should look something like this:

Regedit view

GMail: Revert back to the old inbox

By this time most of you probably have either converted to or been converted to the new GMail tabbed inbox layout and found that you dislike it. I searched for a way to get my old priority style inbox back with no avail tell today. Today I randomly came across how to convert the inbox back to the old look and feel and felt I should share it with the world.

It is really easy, just do the following:

  1. Put your mouse over the “Inbox” text on the left hand side of the screen.
  2. After you put your mouse over the “Inbox” text you will see a small arrow pointing down to the right of the text, click on it.
  3. A drop down menu will show up, one of the options will be “Priority Inbox”, click it.
  4. You’re done, your inbox should now look like it did before the change.

Screenshot

Guessing the next occurrence in a date/time sequence

Analyzing a sequence of dates to determine the best guess for when the next event will accor is something best left to statistical modeling tools, but I’m going to try and show you a very basic way to do exactly that using PHP and an array of date/time stamps.


First off the data/time stamp sample array:

$time_stamps = array(
    "5/10/2013 9:30",
    "5/11/2013 9:50",
    "5/12/2013 10:20",
    "5/13/2013 10:59",
    "5/14/2013 11:22",
    "5/15/2013 11:51",
    "5/16/2013 12:28",
    "5/17/2013 12:57",
    "5/18/2013 13:13");

Sense the object of this exercise is to guess the next occurrence we are going to need a function that analyzes the difference between the times and then gives us an average based on that difference.

 function get_average($time_array)
 {
      $total = "";
      $last = "";
      $count = count($time_array);
      for($t=0;$t<$count;$t++)
      {
           $time = $time_array[$t];
           if($t == 0)
           {
                $last = $time;
           } else {
                $diff = get_diff($last, $time);
                $last = $time;
                $total += $diff;
           }
      }
      $average = ($total/($count-1));
      return round($average);
 }

 function get_diff($time1, $time2)
 {
      $t1 = strtotime($time1);
      $t2 = strtotime($time2);
      $diff = ($t2 - $t1)/60;
      return $diff;
 }

In the above function “get_average” you will see the for loop running through the array of date/time stamps and calling the function “get_diff”. The first time the loop runs it sets the varable $last to the first date/time stamp, this is to give us a starting point otherwise when we ran the “get_diff” function it would return an error or a number based on a date out of our sample rage and would therefore make are guess extreamly inaccurate, instead of just somewhat being inaccurate. The get_diff function compaires the last date/time sample and the current date/time sample in the array and returns the differance in minutes, that time is then added to the $total. Once all the items in the array have been calculated the $total is divided by the count of the date/time stamp array minus one (1), we minus one (1) because the first value of the array is not calculated, it is just a starting point to calculate the difference of the next value in the array.

 function guess_next($date_array)
 {
      $diff_avg = get_average($date_array);
      $last_date = new DateTime(end($date_array));
      $last_date->add(new DateInterval('PT'.$diff_avg.'M'));
      $next = $last_date->format('m/d/Y H:i');
      return $next;
 }

We now have the average increase in time to base our prediction on and we can use the above function to tie it all together. We take the last date in the date/time stamp array and add the average to that date and then format it to a readable format and we are done. The next occurrence will most likely occur around “05/19/2013 13:41”.

Obviously this isn’t going to be super accurate but it will provide a “best guess” based on the data provided. If anyone has a better algorithm for guess the next occurrence in a date/time array I would love to see it.

Thanks for reading!


Full code:

 function get_average($time_array)
 {
      $total = "";
      $last = "";
      $count = count($time_array);
      for($t=0;$t<$count;$t++)
      {
           $time = $time_array[$t];
           if($t == 0)
           {
                $last = $time;
           } else {
                $diff = get_diff($last, $time);
                $last = $time;
                $total += $diff;
           }
      }
      $average = ($total/($count-1));
      return round($average);
 }

 function get_diff($time1, $time2)
 {
      $t1 = strtotime($time1);
      $t2 = strtotime($time2);
      $diff = ($t2 - $t1)/60;
      return $diff;
 }

 function guess_next($date_array)
 {
      $diff_avg = get_average($date_array);
      $last_date = new DateTime(end($date_array));
      $last_date->add(new DateInterval('PT'.$diff_avg.'M'));
      $next = $last_date->format('m/d/Y H:i');
      return $next;
 }

 $date_stamps = array(
      "5/10/2013 9:30",
      "5/11/2013 9:50",
      "5/12/2013 10:20",
      "5/13/2013 10:59",
      "5/14/2013 11:22",
      "5/15/2013 11:51",
      "5/16/2013 12:28",
      "5/17/2013 12:57",
      "5/18/2013 13:13");

 print(guess_next($date_stamps));

Droping Google Drive

Today I stopped using Google Drive as a large cloud storage service. I’ve deleted everything but my Google Docs and started using my DropBox account for day-to-day cloud syncing, for backup I’m using Cloudberry S3 backup desktop to backup to Amazon.com’s Glacier.

At $0.01 per-gigabyte Amazon Glacier is hard to beat, but there are some hidden fees if you plan on restoring all the data at one time. You can use the Unofficial Amazon Glacier Cost-Estimator Calculator to get an idea of what it will cost you.

Google Drive Limitations

After almost a week of using Google Drive I have found a limitation that is a show stopper for me. If you add a file to you Google Drive folder that already exists online it doesn’t check to see if the file is the same as the one online it just re-uploads it, as you can imagine this can be rather irritating if you have 70GB, as I do, of data that is already on two systems that you would like to keep in sync.

Other limitations that are bothering me:

  • It doesn’t tell you what file/folder it is currently syncing.
  • If it errors out it doesn’t give you much info, so if it hung on uploading a file you have to enable debugging and dig through the log file to track it down.
  • Memory usage is way to high, for me average running usage is around 300MB and I’ve see it get up to 1GB.

Google Drive “Unable to sync”

Google Drive (http://drive.google.com) has been long anticipated and finely here. I’ve been using it for the last three days and I put it through some tests and it has passed almost every one. One problem did arise, it got stuck with an error “Unable to sync” with no other information, to resolve the “Unable to sync” error I did the fallowing:

  • Restart Google Drive.
  • Enable diagnostic mode.
    1. Hold Shift and right click on the Google Drive icon.
    2. A new option “Enable diagnostic mode” will be in the list, select it.
    3. A new windows will show up, change the option “Log level” to “Debug”.
    4. Click the “Start logging” button.
  • After Google Drive gives you the Error “Unable to sync” open the debug file (Win7: %LOCALAPPDATA%\Google\Drive\sync_log.log)
  • Look through the log file for an error about some file/s not being able to sync.
  • Once you find the file/s remove them from their Google Drive folder/s on your system.
  • Restart Google Drive.
  • If after a restart Google Drive it is able to sync without any errors then you can manually upload the file/s that you had issues with through the Google Drive web interface (http://drive.google.com).

I have uploaded over 70GB of files and I have only had a problem with one file that happened to be one PSD file out of about 70 PSD files.