Category: Technology

Censorship?

This may be a paranoid thought, but … a bunch of high-profile people’s Twitter accounts were hacked today, and the messages posted asked followers to send Bitcoin. Twitter shut down these accounts for a few hours.

There’s obviously a profit motive here — as of 11:30 today, they’ve garnered over 118k (and have been clearing the money out, so money isn’t just an unfortunate consequence of the hack).

The target list that is hyped includes a lot of big names, and it’s interesting to see which names seem to create the biggest bump in transactions to the wallet.

But the one that stands out to be is Joe Biden — and, yes, it looks like his account was hacked.

This looks like a proof of concept test to me. Now, it’s possible that Trump wasn’t hacked because it is so implausible that he’d be giving back to the community. But forcing the platform to shut down a bunch of accounts, including a number of your political opponents, is a brilliant approach to disrupting campaigning. Seems like a next level move from a government-sponsored intel group looking to interfere with elections after their troll accounts and advertising attempts get shut down.

SCCM Shows “No items found”

The Windows 10 1909 upgrade was rolled out at work, and I got the “if you don’t get this installed, I’m gonna tell your manager” e-mail. Which is odd since all of this ‘stuff’ is supposed to be doing its thing in the background. But whatever. So I opened the “Software Center” and was told there were no items found under applications. Which … possible, I guess. I don’t use IT-deployed software that isn’t part of the stock image. But clicking over to “Operating Systems” (where the update should be found) also yielded “No items found”.

I know enough about Microsoft applications & AD to know I’m on cached credentials when I initiate the VPN connection. No idea what the refresh period is like, so I lock and unlock my workstation to ensure I’ve got an active authentication token. But that didn’t help — still no items found. I had to go into the “Control Panel”, open “Configuration Manager” as an administrative user, and select the ‘Actions’ tab. There were two — “Machine Policy Retrieval & Evaluation Cycle” and “User Policy Retrieval & Evaluation Cycle”. I ran both of them. A few minutes later, I went back into the Configuration Manager utility & found a bunch of things on the actions tab.

I ran all of them — nothing changed. Then let the computer sit for a few hours (I’m certain less than a few hours would have sufficed, but I had other things to do). Ran all of the actions again, and a notice popped up that I have new software available. Sigh! Now I’m downloading the six gig update — a process that should be done in a few hours. But at least I’ll have the update installed before the deadline.

In the process, I also discovered that the CCM logs have been moved from SYSTEM32/SYSWOW64 and are now located at %WINDIR%\CCM\logs

Kid Coding

I’ve seen a number of articles written by developers and IT folks promoting how they won’t be teaching their young kid to code. Of all of the arguments against teaching kids to code, the only one that really strikes me is the fact that a lot of parents don’t know how to code themselves. Now, I expect it is possible to not know French but manage to cobble together some approach to teaching your kid French. It’s a lot easier (and the results are apt to be better) if you actually know some French. My decision to teach my daughter to code doesn’t mean it’s a vital skill that every kid needs to learn to prepare them for future jobs. But, since it is something I do, it is something I share with my daughter. If she weren’t interested in what is going on beyond getting it all typed in, I’d stop. But she’s interested in exploring beyond what the coding book tells her to type. As we created a little character on the screen, Anya wondered if we could make different little figures. At different locations. In different sizes. In different colors. In using Scratch, she develops characters and game play.

Why teach a seven year old kid to code? Why do you teach your kids anything apart from the mandatory school curriculum? Working on the car? She can help and learn a bit about how vehicles work. I replaced the tube on my bicycle tire, and she helped. She was aware that bicycle tires had replaceable tubes that could explode on you … which was useful knowledge when she blew out her own tube. She sews with me — embroidery and a machine — because being able to patch clothes saves having to replace things as frequently. Mowing the lawn – she’s aware that a house with a lot of land requires work and knows how to safely operate both the push and riding mowers. Gardening – she knows where food comes from, how to grow her own, and how much work actually goes into feeding the country. She’ll participate in chicken keeping – somewhat so she knows where eggs come from and the amount of work that goes into egg production, but also because pets are fun (and our chickens will certainly be more socialized with her involvement). We share all sorts of activities with our daughter because we enjoy them. Some intrigue her, some don’t. But how do you learn where your interests are if your exposure is limited to reading and math for the first decade, then science and history for the next almost decade?

All of that provides useful, practical knowledge. And learning to code is certainly useful and practical. But the utility of such knowledge, the practicality of such knowledge isn’t the reason I am teaching my daughter to code. Or, for that matter, the reason I’ve taught her anything else at home. These activities involve deductive reasoning, analytical thought, problem solving, research skills, or accepting instruction from others. All of which are generally useful in life.

Oracle – Select Top

I discovered the “rownum” trick early in my usage of Oracle databases — especially useful for sampling data to see what’s in there, something like “select * from dataTable where rownum < 6” gets you the first five records. But that’s not suitable if you want to sort the records. In this particular case, I have a series of names. I want to find the highest number value in the series so I can name my object with the next sequential name.

Enter “fetch first”  … this appears to be available since 12c (so older database installations may still require a more convoluted solution):

SELECT set_name from set_data
WHERE set_name LIKE 'Something-With-A-Series-%'
ORDER BY set_name DESC
fetch first 1 row only;

Which returns the last name in the series.

PHP Sub-Second Sleep

I needed to add a sleep to a PHP process, but I didn’t want to waste a whole second on each cycle. That’s usleep:

<?php
        date_default_timezone_set('America/New_York');

        $t = microtime(true);
        $micro = sprintf("%06d",($t - floor($t)) * 1000000);
        $d = new DateTime( date('Y-m-d H:i:s.'.$micro, $t) );

        print $d->format("Y-m-d H:i:s.u") . "\n";                                                                       
        usleep(100000);

        $t = microtime(true);
        $micro = sprintf("%06d",($t - floor($t)) * 1000000);
        $d = new DateTime( date('Y-m-d H:i:s.'.$micro, $t) );

        print $d->format("Y-m-d H:i:s.u")  . "\n";                                                                      
        sleep(1);
        $t = microtime(true);
        $micro = sprintf("%06d",($t - floor($t)) * 1000000);
        $d = new DateTime( date('Y-m-d H:i:s.'.$micro, $t) );

        print $d->format("Y-m-d H:i:s.u")  . "\n";                                                                      
?>

Run the script, and you’ll see sub-second sleeps.

[tempuser@564240601ac2 /]# php testSleep.php
2020-07-09 14:06:20.641449
2020-07-09 14:06:20.741952
2020-07-09 14:06:21.742347

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).

 

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); 
});