Skip to content

Instantly share code, notes, and snippets.

@jmngpt
jmngpt / MySqlDateDim
Last active August 29, 2015 14:00
Script to build a Date dimension for OLAP reporting on MySQL
DROP TABLE IF EXISTS DimDate;
CREATE TABLE IF NOT EXISTS DimDate (
date_id INT UNSIGNED NOT NULL,
fulldate date,
dayofmonth tinyint UNSIGNED,
dayofyear smallint UNSIGNED,
dayofweek tinyint UNSIGNED,
dayname varchar(10),
monthnumber tinyint UNSIGNED,
monthname varchar(10),
/**
* Check if an incoming call is from a contact with a custom ringtone set
* @return null if the incoming number doesn't have a custom ringtone, the ringtone's Uri if it does
*/
private Uri contactHasCustomRingtone(String callerNumber)
{
String customRingtoneUri = null;
Uri queryUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(callerNumber));
String[] columns = new String[]