Well, I guess I have a clue why this fell off the front page, or whatever.

But ...

TIL: [man]glob/man sorts by default, and has a GLOB_NOSORT flag. Hopefully will save time (for the process, not for me, LOL ... I'll be looking into a ton of script to see how many would benefit by gaining that flag ...) :rolleyes:

Hurray for TFM!

Also did some garbage collection in general on a script that's buggy on a large dataset. Hopefully that will fix it!

    5 months later

    Enter this in your browser's URL bar:

    data:text/html,<h1>Hello, World</h1><p>TIL: You can create a web page in your browser's URL bar.</p>

    Javascript: works up there, too!

    I also learned that there's drag-n-drop support in some of 'em, but it replaces the entire page as well.

      8 days later

      ^ Whoa, now thats interesting!

      Apparently more and more young folks don't know how to use regular keyboards.

        9 days later

        TIL I learned you can dislocate your patella so badly it slips between the femur and tibia. (Fortunately I learned this third-hand.)

          I'd say "glad to hear that", except that wouldn't be nice to your friend/acquaintance. Sounds like quite a fall ....

            Rugby is a tough game...

            But TIL what coddled eggs are. Take the egg out of the shell and put it in a cup (a "coddler"). Put the cup in hot water for a while.

            Can't think of a practical benefit - poach it or boil it, just make up your mind it will be faster either way - but there it is.

              Sounds like what my mother called "poached eggs", though the cup was a purpose-built teflon-lined metal cup just right for one egg, with a thingy that held 3 such cups in a shallow pot/pan of boiling water (so that the cups were not in contact with the bottom of then pan). [shrug]

                a month later

                TIL my scripts would be running a lot faster than they are if someone had remembered to turn off automatic execution tracing a couple of weeks ago. D'oh

                TIL that in PostgreSQL you can use the MAX() aggregate function on non-numeric column types. (I didn't bother to test what it considers to be "max", as I just needed it to pick one of the possible several matches.)

                  Weedpacket

                  At least there was a switch. What I hate is finding hard-coded debugging during a re-factor.

                  Of course I have never done that ....

                  TIL that a trailing newline character can sneak through this regex:

                  // outputs YES
                  if (preg_match('/^[a-zA-Z0-9\-_]+$/', "hello-dolly\n")) {
                    die("YES"); 
                  } else {
                    die("NO");
                  }

                  You have to add the /D modifier to exclude a trailing newline. Very sneaky grrrr.

                  // outputs NO
                  if (preg_match('/^[a-zA-Z0-9\-_]+$/D', "hello-dolly\n")) {
                    die("yes");
                  } else {
                    die("no");
                  }

                    dalecosp
                    Not to mention how I found it. See, some of them were long-running to begin with, so the fact they were taking a long time to complete wasn't itself odd. The process was:

                    "Low disk space? Why? How?" [a couple of minutes later] "What's with all these 150GB logfiles here?"

                    Still, another thing I learned was that I really do need to clean up around here. Anyone interested in a bunch of Indiana University Computer Science Department Technical Reports circa 1978?

                      w00t! Class of '78! (OMG I'm old.)

                        a month later

                        ...that C.O.D. means Collect On Delivery.
                        The thing being collected being the payment.
                        The form of the payment being unspecified.

                        That might just show how often I deal with anything "COD"; I guess back in the day cash was the only way it could be collected.

                          6 months later

                          TIL: PDOStatement implements Traversable. In theory I should be able to clean things up a little bit with a foreach($stmt as $row) instead of the while($row = $stmt->fetch()) sort of thing I've always done, I think.

                          Yeah, not earth-shaking -- just surprised I never knew this after using PDO on a pretty much daily basis for 7+ years now. 🙂

                          Today I learnt the importance of rest, the highlands are breathe taking

                          6 days later

                          Today I learnt

                          <p id="geo"></p>
                          
                          <script>
                          
                          var x = document.getElementById("geo");
                          
                          function getLocation() {
                            if (navigator.geolocation) {
                              navigator.geolocation.watchPosition(showPosition);
                            } else { 
                              x.innerHTML = "Geolocation is not supported by this browser.";
                            }
                          }
                              
                          function showPosition(position) { x.innerHTML="Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script>

                          This first draft of a site is going to be so badly done lol

                            That's nice. FWIW, I wouldn't use 'x' ... too much chance of collision in the global/window scope.

                            I spent part of yesterday trying to figure out how to make a rough duplicate of a PHP class in JavaScript.

                            It's not done yet, to say the least ...

                            6 days later

                            Well I'll admit I don't fully understand it yet but I learned this today..

                            SELECT postcode, town,
                                   lat, lon, distance
                              FROM (
                             SELECT z.postcode,
                                    z.town,
                                    z.lat, z.lon,
                                    p.radius,
                                    p.distance_unit
                                             * DEGREES(ACOS(COS(RADIANS(p.latpoint))
                                             * COS(RADIANS(z.lat))
                                             * COS(RADIANS(p.longpoint - z.lon))
                                             + SIN(RADIANS(p.latpoint))
                                             * SIN(RADIANS(z.lat)))) AS distance
                              FROM shopAddress AS z
                              JOIN (  
                            SELECT 57.11149510000001 AS latpoint, -3.157924900000012 AS longpoint, 50.0 AS radius, 111.045 AS distance_unit ) AS p ON 1=1 WHERE z.lat BETWEEN p.latpoint - (p.radius / p.distance_unit) AND p.latpoint + (p.radius / p.distance_unit) AND z.lon BETWEEN p.longpoint - (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) AND p.longpoint + (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) ) AS d WHERE distance <= radius ORDER BY distance