Friday, January 27, 2023

is it time to party like it's windows 95?

Over a decade a go I wrote why windows' taskbar beats osx' dock. In the intervening years I've gotten pretty used to the Mac Dock, (using SizeUp for awesome and intuitive keyboard based window management, and then HyperSwitch to fix the DUMBEST thing in MacOS, because switching to an application with no windows open should open a default window when you switch to it with cmd-` just like it does if you click on its icon in the dock) but just recently I realized there's an app called uBar that lets Mac have a very Windows 95-y/XP-ish button bar.

You can set it with window titles ala Windows 95, or just icons, and with our without the "grouping by app" that later Windows copied from Mac.

Conceptually I like it. I've gotten used to App, then Window thinking that Mac encourages, but honestly I leave a LOT of windows, especially browser windows, just hanging out. (Combine that with how both the Mac and browser assume I want to reopen everything whenever possible, which honestly is totally missing the point of restart/reboots, and it's significantly annoying) Seeing a button or icon for each window helped me keep things neat.

There were enough small annoyance (some programs used wonky icons or would open up a gratuitous second uBar icon even if only one window was visible) that I probably won't stick with, but I found it cleaner and more straight forward than Ventura's Stage Manager. One icon per window still makes a lot of sense. (I guess in the mean while I'll try to remember to ctrl-down-arrow a lot to see how many windows I have lying around, and then cmd-w to close so they won't try and reopen en masse)

public service announcement

I just backed up my computer and my website - kinda the old fashioned way, dumping a single root (or two) - ~/data on my Mac, ~/sites and ~/data for my website - onto an external solid state HD. I guess I prefer that to those more automated systems, just like I don't really trust my photos to iCloud (and anything I consider important I make sure is in ~/data/photos )

Just a friendly reminder to pick a backup plan and run it :-D

working with europeans

 My new team is based in Western Europe. I enjoyed seeing this entry for tags in our design system:



Wednesday, January 25, 2023

$5,000 hammer

I spent a workday getting understanding of a complex Figma to JSON recursive translation process. And the fix was one line. it made me think of this joke:

The Graybeard engineer retired and a few weeks later the Big Machine broke down, which was essential to the company’s revenue.  The Manager couldn’t get the machine to work again so the company called in Graybeard as an independent consultant.

Graybeard agrees. He walks into the factory, takes a look at the Big Machine, grabs a sledge hammer, and whacks the machine once whereupon the machine starts right up. Graybeard leaves and the company is making money again.

The next day Manager receives a bill from Graybeard for $5,000. Manager is furious at the price and refuses to pay. Graybeard assures him that it’s a fair price. Manager retorts that if it’s a fair price Graybeard won’t mind itemizing the bill. Graybeard agrees that this is a fair request and complies.

The new, itemized bill reads….

Hammer:  $5

Knowing where to hit the machine with hammer: $4995

Hammer time!

Sunday, January 22, 2023

"good enough" guid/uuid in PHP?

So once upon a time I used 

$key = time().".".getmypid();   

For a UID (unique ID) in PHP. Maybe I wanted things to sort a bit? But of course there's always plain old
 
$key = uniqid("",true);

(which says "" for prefix, and more entropy.)

if(preg_match('/[^\.a-z_\-0-9]/i', $id)){
    echo "bad id";
}

could be a check if you're using this for a filename, and want to make sure it's not too dangerous to try and open... (shenanigans changing the folder or escaping out)

Friday, January 20, 2023

bookmarkable/link-based random order list shuffler (php + stateless)

I made up a trivial list shuffler so that my zoom-based scrum standup could avoid the awkwardness of figuring out "who goes next".

You can bookmark the page, e.g. https://kirk.is/tools/shuffle/?items=Alice%0D%0ABob%0D%0ACarlos and everytime you reload it will get a new shuffle. 

(I do like that paradigm of putting everything in a link so I don't have to store anything in server or on browser, and putting everything in a textarea so that I don't have to build much UI, and the content can be copy and pasted freely - same idea I used for my quick poll and pill tracking sheet generator but here it's even cleaner since I don't have to make up a format, just items separated by returns)

PHP remains the simplest, lowest-friction way for me to make and deploy something like this in like 10 minutes, borrowing from my own html boilerplate and my no-warnings cgi param functions

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>bookmarkable random list order shuffler</title>
<style>
body {
    background-color: white;
    color: black;
    font-family: sans-serif;    
}
.content {
    width: 800px;
    margin: auto;
}
textarea {
    height:100px;   
    width:400px;
}
</style>
</head>
<body>
  <div class="content">
        <h1>bookmarkable random list order shuffler</h1>
        <?
            $rawitems = trim(getval("items"));            
            if($rawitems != '') {
                $items = explode("\n",$rawitems);
                shuffle($items);
                echo "<ol>";
                foreach($items as $item) {
                    echo "<li>".htmlspecialchars($item);
                }
            }
            echo "</ol>";
        ?>
        <p>
        Trivial random order list shuffler. Add one item per line, and hit the button. You
        can then bookmark the resulting page to get a new order each time.
        </p>
        <p>
        Great for deciding order at team standup meetings!
        </p>
        <form method="GET">
            <textarea name="items"><?echo htmlspecialchars($rawitems) ?></textarea>
            <br>
            <button>Shuffle</button>
        </form>        
  </div>
</body>
</html>
<? 
 function getval($key, $default = ''){
    return isset($_GET[$key]) ? $_GET[$key] : $default;    
 }
?>

(Incidentally that code textaarea is a nice freebie I get from using Freeforamatter.com's HTML Escape - that's weirdly convenient, better than times in the past where I put in code that breaks my blog template.)

Wednesday, January 18, 2023

wikipedia update and webdesign through the ages

 A page on Wikipedia's new look on desktop (with its sadly non-interactive slider letting you peek at old looks of it) reminded me of this page I posted before, a fantasy of potential NASA web design through the ages of the web...