I know I've mentioned Usenet's alt.hackers and "ObHacks" before... the latest is this:
My main VPS is pretty old (I'm migrating to a new one) and it doesn't do a good job of letting me how close to my disk quota I am - but when I start having problems, the clearest telltale is that if I try writing to a file from terminal, the file is made but is zero bytes.
But on that same server I run my personal start page, so many times during the day I'm going back to that site. So now the script that generates that page tries does this:
// QUOTA PROBLEM CHECK
// Get the current Unix timestamp
$timestamp = time();
// Write it to a file named "timetest.txt"
file_put_contents("timetest.txt", $timestamp);
// Initialize $bodyclass with an empty value
$bodyclass = "";
// Open the file and read the timestamp
$readTimestamp = file_get_contents("timetest.txt");
// Check if we can open the file, if it's not empty, and if the contents match
if ($readTimestamp === FALSE
|| $readTimestamp == ""
|| $readTimestamp != $timestamp) {
$bodyclass = "alert";
}
and I made the body.alert CSS to be bright red, so I'll see that something is up.
Heh, that piece of PHP reminds me of a thought I had recently; in general I don't adore TypeScript because while I like having JSON arguments described, there are better ways to do that, I find the syntax makes code a bit harder to read, and also there's more of a chance of a false sense of security, since you don't REALLY know what types are going to come back from a given endpoint at runtime.
My observation with that is that 90% of the typing issues I *do* have in JS would go away if "+" always meant addition and not string concatenation. Which is how PHP does it. But then I realized that PHP only gets away with supporting both $string.$concatenation and $object.key lookup syntax because it prefixes its variables with "$", otherwise you'd have to do object["key"] only since object.key would look like a lookup reference.
No comments:
Post a Comment