Oracle – Group By Having

I needed a query to find records where duplicate name values exist. I know how to group by and count, but the table has millions of records. I don’t want the 99% of the data where no duplication occurs. By using “having” in conjunction with “group by”, I am able to restrict the output to the groups that match my criterion.

select display_name, count(display_name) from circuit
group by display_name
having count(display_name) > 1;

My result set is the display name & occurrence count for that display name without all of the ‘good’ records where there’s a unique display name. (Yes, I know uniqueness could be enforced. The real scenario isn’t this straight-forward. There are times where the display name should be the same and I’ve got additional filters that drop out those cases).

 

Deodorant Recipe

I needed a recipe for deodorant that didn’t melt in the summer heat, so I added some beeswax to my normal recipe:

  • 2 oz beeswax
  • 6 oz coconut oil
  • 4 oz shea butter
  • 6 Tbsp baking soda
  • 8 Tbsp arrowroot powder

Melt the beeswax and oils, stir in baking soda and arrowroot powders. Pour into container and stir as mixture cools and thickens.

Apache HTTPD: SSL Virtual Hosts

For quite some time, you couldn’t bind multiple SSL web sites to a single IP:Port combination — this had to do with the mechanics of negotiating an SSL session — the client and server negotiated encryption based on a specific certificate before the server really knew what the client was trying to retrieve. The quick/easy solution was to just add a virtual IP to the box and bind each individual web site to a unique IP address. While this was quite effective in a corporate environment or purely internal network, it was a terrible solution for a set of home-hosted personal web servers — I don’t want to buy four public IP addresses to host four differently named websites. My workaround was to off-port sites no one else would be using (the MQTT WebSockets reverse proxy) and use a reverse proxy to map paths within the family website to the remaining web servers. This page, for instance, is rushworth.us/lisa … which the reverse proxy re-maps to https://lisa.rushworth.us behind the scenes.

With Apache HTTPD 2.2.12 or later built against OpenSSL v0.9.8g or later, you can use Server Name Indication (SNI) to serve multiple SSL websites from a single IP:Port just like you have been able to do with non-SSL sites. Using SNI, the client includes “what they’re looking for” in first message of the SSN negotiation process so the server knows which cert to serve.

In your httpd.conf, indicate that you want to use SNI on an IP:Port combo

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:443

And, optionally, configure one of the named virtual hosts as the default for non-SNI browsers:

SSLStrictSNIVHostCheck off

Now the configuration for your SSL sites can include a ServerName directive. Restart Apache HTTPD, and you’ll be able to access the proper SSL-enabled website without adding virtual IP addresses.

HTML – Multiple Values on Select Option

I needed to pass multiple values with a select option. It’s easily accomplished by setting the value to a JSON string

while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
	echo "<option value= " . json_encode($row) . ">" . $row['STRTYPENAME'] . "</option>\n";
}

And using JSON.parse to pull out the key of the value you need:

jQuery("#selectDivSetType").change(function () {     
    var strTemplateObject = $('#selectDivSetType').val();
    var jsonTemplateObject = JSON.parse( strTemplateObject );
    var strTemplateURI = './templates/' + jsonTemplateObject.STRTEMPLATENAME;
    $('#templateURI').attr("href", strTemplateURI); 
});

jQuery – Changing href When Drop-down Selection Changes

I needed to provide a different template depending on the type of activity selected in a drop-down menu. The following jQuery code gets the template name from the drop-down value and updates the href target.

jQuery("#selectDivSetType").change(function () {     
    var strTemplateName = $('#selectDivSetType').val();
    var strTemplateURI = './templates/' + strTemplateName;
    $('#templateURI').attr("href", strTemplateURI); 
});

Crispy Kale Chips

Krispy Kale Chips

Recipe by LisaCourse: SnacksCuisine: AmericanDifficulty: Easy
Servings

4

servings
Prep time

30

minutes
Cooking time

40

minutes

Ingredients

  • Kale

  • Olive Oil

  • Salt

Method

  • Preheat oven to 400 degrees F
  • Wash kale, dry, and slice
  • Toss kale with olive oil and salt
  • Set convection oven to 325 degrees F and roast for 10 minutes. Turn kale over and roast for another 5-10 minutes

Notes

  • This is a great snack, but I also use it as a crunchy topping on hearty stews.

Exporting Microsoft Stream Transcript — Prettier Output and Error Handling

I had posted a one-liner to grab the text content of the Microsoft Stream transcript — there’s a good bit of cleanup required to make something professional looking, but I’ve been lazy about it & leave formatting up to the recipient. The one-liner approach fails when it doesn’t encounter a text element where it expects to find one. A more robust export approach creates a Node List containing all of the transcript-line classed elements, then iterates through that list and when the node has a textContent attribute appends that content to a running string value. Printing the running string value produces output that needs minimal reformatting.

Code:

var objTranscriptLines = window.document.querySelectorAll('.transcript-line');
var strRunningText = null;
for(var i = 0; i < objTranscriptLines.length; i++){
    if( objTranscriptLines[i].textContent ){
        var strLineText = objTranscriptLines[i].textContent;
        strRunningText = strRunningText + "\n" + strLineText.replace("Discard   Save","");
    }
}
console.log(strRunningText);

Results:

You *could* strip off the timestamps as well — instead of strLineText.replace(“Discard Save”,””) use (strLineText.replace(“Discard    Save”,””)).substr(8)

Scratch: Changing Variable In Operator

When I needed to change a variable within an operator block, I’d been removing the variable block and adding the right one. Unlike the “change <variable> …” and “set <variable>…” blocks, the little variable name bubbles do not have a drop-down selector. Today, Anya and I were working on our Chicken Keepers games and she right-clicked the little bubble to select a different variable. Totally didn’t realize you could do that.

SDNY – The Continuing Saga

Looks like Trump’s people assumed Lindsey Graham would rubber-stamp Clayton’s nomination to SDNY without, ya know, actually checking in with Graham. Graham, so far, says he’ll follow the standard process of waiting for blue slips from Gillibrand and Schumer.
 
Personally, I give this above even chances of sticking even after someone explains to Trump what a blue slip is. Trump wants the short-term win, but Graham seems to be looking at long-term strategy. Graham is up for reelection this year … but the presidential race will drive turnout. I can’t see Trump voters abstaining in the Senate race … so Graham can afford some voter outrage from the MAGA extremists. Some centrists could find presidential interference off-putting, and conservative Dems and liberal Repubs would constitute the votes actually up-for-grabs. But, beyond Graham’s possible continued tenure — at *some* point, Democrats will be in charge again, and a lot of Senate traditions cede a significant amount of power to the minority. Upend those traditions for a quick win today, you harm yourself in the future.