Tuesday, September 27, 2016

flash drives have "solid state storage"

...as opposed to a spinning disc making them vaguely twice as fast. Also, there are fewer moving parts to break.

PHP at NGiNX

FastCGI will allow you to run PHP on NGiNX. Another approach is to run let Apache run PHP and use NGiNX merely as a router (as a front door to Apache). NGiNX is apparently petty light in and of itself.

Monday, September 26, 2016

CTE within SUM or COUNT!

Starting with this T-SQL and improving upon it gives us:

SELECT c.CurrencyId AS 'Id'
c.CurrencyCode,
COUNT(i.TotalAmount) AS 'OpenInvoices',
COALESCE(SUM(i.TotalAmount), 0) AS 'Balance',
(SELECT COUNT(TotalAmount) FROM #Invoices
   WHERE DueDate < GETDATE() AND Id = CurrencyId) AS 'OpenInvoices',
COALESCE((SELECT SUM(TotalAmount) FROM #Invoices
   WHERE DueDate < GETDATE() AND Id = CurrencyId), 0) AS 'Balance',
FROM #Currencies c
LEFT JOIN #Invoices i ON c.CurrencyId = i.CurrencyId
GROUP BY CurrencyCode

 
 

Note that if you want to use a column from another table not specified in your CTE that it better be one of the columns returned in the select statement. Otherwise, expect an error. To that end I've looped CurrencyId into the list of columns returned and have fudged its name so there is no ambiguity when matching CurrencyId to CurrencyId in my CTEs without a leading c. or i. to distinguish them.

Use COALESECE in T-SQL to make columns which sum up nothing return a zero instead of NULL.

This...

SELECT c.CurrencyCode,
COUNT(i.TotalAmount) AS 'OpenInvoices',
SUM(i.TotalAmount) AS 'Balance',
COUNT(pdi.TotalAmount) AS 'PastDueInvoices',
SUM(pdi.TotalAmount) AS 'PastDueBalance'
FROM #Currencies c
LEFT JOIN #Invoices i ON c.CurrencyId = i.CurrencyId
LEFT JOIN #PastDueInvoices pdi ON c.CurrencyId = pdi.CurrencyId
GROUP BY CurrencyCode

 
 

...needs to become...

SELECT c.CurrencyCode,
COUNT(i.TotalAmount) AS 'OpenInvoices',
COALESCE(SUM(i.TotalAmount), 0) AS 'Balance',
COUNT(pdi.TotalAmount) AS 'PastDueInvoices',
COALESCE(SUM(pdi.TotalAmount), 0) AS 'PastDueBalance'
FROM #Currencies c
LEFT JOIN #Invoices i ON c.CurrencyId = i.CurrencyId
LEFT JOIN #PastDueInvoices pdi ON c.CurrencyId = pdi.CurrencyId
GROUP BY CurrencyCode

 
 

Get it?

You may skip the empty curly braces when newing up a list in C# if you like.

var buckToothedTreeGnawers = new List<Beaver>();

...and...

 
 

var buckToothedTreeGnawers = new List<Beaver>() { };

...are basically the same thing.

VoIP stands for Voice Over Internet Protocol

The last blog posting I just typed up made me think of Voice over IP. This stuff allows your business telephone to interface with your PC, etc. You can get voicemail messages as email attachments and the like.

marketing misadventures

There are two different members of the waitstaff at the Olive Garden that I always eat at who are trying to improve their lot and get into marketing and out of service. One of them is a young guy whom, to me it sounds, has landed his first office job gig in the marketing space. I think it's gonna be mostly office admin stuff, but there will be some email campaign marketing going on there too. It sounds like a good start. I certainly had to answer the phone a lot in my day, and there was a time when I was in restaurants too, making sandwiches at Texadelphia or bussing tables at Fresh Choice. To this day my heart bleeds for people suffering in service jobs who don't want to be there because I've been there myself. I always tip well. I digress. The other person is a woman my age with a large history in pharmaceutical marketing in New Jersey (including focus groups!) who has moved to Texas and is trying to find her footing here. They both have me thinking of marketing in general. I really don't know that much about it, all in all. I've gotten to work some with Christa Tuttle and Shawna Boyce of Launch Marketing and I get the impression that the typical background is one of a bachelors in, well, marketing, which is an awful lot like a generic bachelors in business with only a few classes differing, just enough to make a specialization of a business degree. From Launch I learned that anymore to make a press release you just write something up and put in on your web site. Maybe back in the day you had to have a press kit, but not anymore. I don't know what a press kit even is and if it varies from a press packet and opens other doors. Someone with the formal background knows these things. Eleven years ago towards the end of my time at Network Logistic, Inc. I was given the grandiose, ridiculous title of Director of Marketing before I had ever rubbed elbows with a real marketer. Before then I had designed some marketing slicks when I worked for Gary McKibben and Michael Johnson at Johnson/McKibben Architects and I had made some 3D models for presentations when I both did a week long contract with Joel Shakespear at a now dead startup called TRiAD and a much longer stint for John Drury at his slaveworks, but this isn't really, obviously, the background for someone who is a Director of Marketing. What a joke. I made twelve dollars an hour in this role, and, it gets better, all I did was the web developer job I had before while I also now sent out email campaigns. Yes! Plus, there was no one to direct. I was director without underlings. This is the kind of place that would give the title Vice President of Sales or Vice President of Engineering out like it was nothing. I guess it was a part of their posturing as they hired staff on the cheap while acting as if not Mickey Mouse in whole. Paul Williams, an engineer who worked at NLI, suggested that I shouldn't feel awkward about my bogus title because "There's nothing to those fucking people." However, when I eventually started to really know some of them I found them pretty impressive and I wished I knew more of what they knew. I eventually grew some SEO (search engine optimization) chops, but I've let that skill decay and I can't really do it anymore. That other Tom Jaeschke, the volleyball player, always appears when I Google my own name. Yeesh. I ran into Stacy Tallent of Telco-Data maybe a year ago at a, well, Texadelphia, and he spoke well of me for designing the logo that they are still using today way back when Telco-Data and Network Logistic, Inc. were sister companies sharing a common owning partner. I've never learned much of anything about telephony. I can remember Penn Rabb of PrismNet expressing some frustration with me for not knowing more about a business telephone system I was using. Whatever. I digress again. Anyhow, I think I shall always find marketing intriguing and have an ear open to it. It's on my mind right now.