Data & Code
Some Thoughts on Report Usability
A usable report meets a specific need, clearly presenting the facts in a way that’s appropriate for the user’s context.
As an analyst you’re an arbiter of facts and the context necessary to understand those facts. — Unknown
For certain use cases, BIML is pure magic. The best kind of power tools!
Windows Batch Gotcha: Use REM Inside IF Blocks
Normally I comment out lines in a Windows batch script by prefixing them with “::"—it just looks better to me than “REM”. But today I found out the hard way (of course) that you can’t do that inside an IF block, or the script dies with…
The syntax of the command is incorrect.http://www.petri.co.il/forums/showthread.php?t=43604
SSIS Conditional Expressions (Lightbulb:On)
I just ran across this great bit of advice I got back in 1995 from Larry Wall, creator of Perl:
Don't get brainwashed by your education into thinking that all the answers have to come from teachers.
New Project: Backbone Reference App
Today I released a JavaScript reference application, built on Backbone, Marionette, and RequireJS.
I've learned a lot over the past several weeks, and at times the learning curve was steep, partly because I couldn't find a good reference application that I could learn from. To-Do apps are the classic example, but they're too trivial to demonstrate how to architect a larger application. I'm hoping this resource will help fill that gap.
I'm still learning this stuff and am certainly no expert, but I'm happy to share what I've learned.
Lessons in Bug Hunting
Yesterday's lesson in bug hunting: don't assume you're an idiot. I spent a few days trying to figure out why my success callback wasn't being called. It had been working before I updated to jQuery 1.9.0, and I didn't think I had changed anything. After much head scratching I found out that jQuery 1.9.0 introduced an Ajax() bug where HTTP status 204 is considered an error. A fix is in the jQuery master branch and will be in jQuery 1.9.1.
Today's lesson in bug hunting: don't assume you're not an idiot. I spent hours yesterday and this morning trying to get Mousetrap.js working. I triple-checked my code against Craig's documentation, verified the library was loading in the browser, etc. It should have worked. But I set a breakpoint on the line that was throwing the error and there was simply no Mousetrap in the global namespace. Having ruled out an error on my part, in desparation I opened mousetrap.js, hoping to find the bug in there. Instead I found... nothing. Yep, something had gone wrong when I downloaded it, and the file was completely empty.
Bottom line: keep in mind that everyone makes mistakes.
/time
I wanted to GET a lot done today:
/coding, /writing, &more;
but try as I might, I got 302,
and /time returned 404.
Shipped!
I launched a new intranet application today. Nothing fancy, just a simple app to address a real need in my organization. Initial feedback has been very positive. Feels good to ship!
Day-of-Week Differences in MySQL and MS SQL Server
Heads-up! In MySQL, WEEKDAY(‘2012-11-09’)
= 4 (0-6 starting on Monday), but in SQL Server, DATEPART(dw,‘11/09/2012’)
= 6 (1-7 starting on Sunday). If you’re extracting data from MySQL to load into SQL Server, the correct translation is ((WEEKDAY(date)+1)%7)+1
.
How to Override IE's Compatibility View Behavior On Intranet Sites
To force IE to edge mode (even on intranet sites, where IE would otherwise use compatibility mode), the server needs to send X-UA-Compatible as an HTTP header. Using a meta element in the document head doesn’t work reliably.
I found the answer buried in this Stack Overflow thread.
In my case, I was working on a WordPress theme, so I added
header(“X-UA-Compatible: IE=Edge”);
at the top of header.php.
You can also do it at the web server level with Apache or IIS (I haven’t tested either of those methods).
UPDATE 3/13/2014: I have now verified the IIS method linked above.
Something Old, Something New
Digging into a web portal application. It uses Ajax … and frames. 17 years of Web history, all on one page. (I didn’t know browsers still supported frames.)
Converting to Project Connection Across Multiple Packages in SSIS 2012
I’m migrating a Business Intelligence project from SQL Server 2005 to SQL Server 2012. Microsoft has, overall, done a great job with their development and migration tools, and some of the new features of SQL 2012 are great and will save me a lot of time going forward. One neat new feature in SQL Server Integration Services (SSIS) is Project Connections: you can define a connection at the project level, and all packages in the project automatically inherit a reference to that connection.
So this project I’m migrating has maybe 40 packages, many of which had the same two connections (primary source application and the DW database). In SQL Server Data Tools, you can open a package, right-click on a connection, and “Convert to Project Connection.” So far, so good. Problem is, all those other packages that have a connection of the same name will not inherit the project connection because the local one overrides it (by design). And if you open another package and delete the local connection, every task and data flow component that used that connection gets the dreaded red “X” icon–they don’t automatically revert to the project-level connection with the same name. Best I can tell, the only way to fix it in SSDT is to reconfigure every one of those broken tasks and components. The Internet is full of articles showing how to convert a connection in one package, but nothing gave me any clue what to do with the other 39 packages. I couldn’t accept that I would have to do all that–there must be a better way.
Generating a Range of Dates in MySQL
Working on a report from a MySQL database, I needed a table of all dates for the next year. With SQL Server (2005 and later) there’s a CTE/recursive method to do this pretty elegantly, but I couldn’t find anything similar for MySQL. All the solutions I found involved temporary tables, loops, and/or stored procedures–none of these were viable options for me because it’s a production database and I can’t just go changing things. I needed a simple query, and since I couldn’t find one, I made one.
It’s ugly, but it did the job.
When Low Tech Is the Best Tech
We’ve been thinking about developing a quick application to replace a paper HR process—should be a simple state machine with four possible states: Submitted, Accepted, Rejected, and Completed. But then we realized we would need email notifications and a coherent security model.
These requirements—workflow, notification, and security—happen reasonably well in the old paper model. Not perfectly, but well enough. These mechanisms are ingrained in the way people do their work, but to implement this in a computer application would require us to build it from scratch.
It quickly became more complicated than it was worth, a good reminder that sometimes low tech is the best tech.