Posts

(It's Been a Long Time Coming... 🎵🎹) Getting Date Quarters for Months in Python - Or "Why Date and Time Dimension Tables Exist"

Image
Hi. It's been a while. :-) So I recently saw a question on StackOverflow called " First month of quarter given month in Python " where they were asking how to work out a date related issue in Python. There are some wonderful techincal and mathematical solutions there, but it reminded me very much of proper architecture design, especially when the project will be for a non-hobby. User jonrsharpe nailed it with his answer , IMHO. In the continued balancing act of storage space vs. compute power, a dataset will usually win over a computation. Not always, just usually. And even when it doesn't, depending on circumstances, a shared dataset is VITAL to avoid computation bugs when it is needed more than a few times, or by more than one department. It can be a lifesaver when it comes to reporting, as well as Fact-Dimension architecture or even a Data Vault architecture. Create, share, and maintain the single version of the truth. Here's a code sam

HOWTO: Find out the Sizes and Rowcounts of All the User Tables in a Database in SQL (UPDATED! - Now includes the RedGate SQLPrompt Snippet Text)

Here is an update on a blog post that I wrote a decade ago for finding the size and rowcounts for all user tables in a database: --For storing values in the cursor DECLARE @TableName VARCHAR(100) DECLARE @SchemaNameAndTableName VARCHAR(100) --Cursor to get the name of all user tables from the sysobjects listing DECLARE tableCursor CURSOR FAST_FORWARD READ_ONLY FOR     SELECT         so.name AS TableName,         s.name + '.' + so.name AS FullTableName     FROM         sys.objects so INNER JOIN         sys.schemas AS s ON so.schema_id = s.schema_id     WHERE         so.type = 'U'         AND s.name + '.' + so.name LIKE '%%'     ORDER BY         FullTableName --A procedure level temp table to store the results DECLARE @TempTable AS Table         (          TableName VARCHAR(100),          NumberOfRows BIGINT,          ReservedSizeKB VARCHAR(50),          DataSizeKB VARCHAR(50),          IndexSizeKB VARCHAR(50),          Unus

Python, Jupyter, and Restarting the Kernel - What??

Why on earth do I have to restart the kernel when this happens? Strange.... very strange... https://stackoverflow.com/questions/19442060/matplotlib-pyplot-titlestring-returns-error

Google South Africa's Telephone Number

Are you tired of searching for Google South Africa's contact details? You are pretty sure that their office is on the corner of Main Road and Sloane Street , but more than that, you just don't know. Well, @StewartMoss managed to dig up their telephone number - after first having to call Google UK and Google Kenya! So, directly from the Kenyan horse's mouth, here it is: Google South Africa's telephone number: +27-11-575-6000 Apparently, according to the receptionist, they "don't accept calls." So, there you go. You now have a telephone number for Google South Africa. I hope that you have better luck being put through to talk to someone than Stewart did. Thank you for this information and for calling Google UK, Kenya and South Africa Stewart, you rock!

Galactic Inbox: An HTML5 game inspired by Gmail - Official Gmail Blog

Galactic Inbox: An HTML5 game inspired by Gmail - Official Gmail Blog An interesting very cool game by Paul , a Google employee. Check it out! You can also follow Paul on Twitter .

HOWTO: Stay Motivated

This section was taken from Robert L Read's How to be a Programmer: A Short, Comprehensive, and Personal Summary ( direct link to the specific section .) How to Stay Motivated It is a wonderful and surprising fact that programmers are highly motivated by the desire to create artifacts that are beautiful, useful, or nifty. This desire is not unique to programmers nor universal but it is so strong and common among programmers that it separates them from others in other roles This has practical and important consequences. If programmers are asked to do something that is not beautiful, useful, or nifty, they will have low morale. There's a lot of money to be made doing ugly, stupid, and boring stuff; but in the end, fun will make the most money for the company Obviously, there are entire industries organized around motivational techniques some of which apply here. The things that are specific to programming that I can identify are: Use the best langu

A Way to Handle Raised Errors in Both Dynamic and Static SQL Code

If you've needed a reliable way to handle errors that might be raised in both dynamic and static SQL code, here is what I've been doing: SET   ANSI_NULLS   ON GO SET   QUOTED_IDENTIFIER   ON GO -- ============================================= -- Author:      Erland Sommarskog - http://www.sommarskog.se/error_handling_2005.html -- Create date: 2009/11/29 -- Description: **Call this sp from within your --              CATCH block** This --              reraises/throws the most recent --              error. Please see --              http://www.sommarskog.se/error_handling_2005.html --              for more details. -- -- Modifications: -- Author:      A. Jackson -- Create date: 2010/03/11 -- Description: Renamed the sp from --              "error_handler_sp" to --              "dba_Error_Handler" to conform --              to naming conventions. --            : Documented this sp. --            : Enhanced SQL readability. -- Author: