• Unexpected Topology

    Today I’m wearing a dress with two layers. Depending how many dresses you’ve worn, you might know where this is going next.

    The top layer is the main part of the dress, colorful and long-sleeved. The inner layer exists because the top layer is a bit too thin to really stand on its own; the inner layer is black and sleeveless (spaghetti straps). The two layers are attached to each other at the shoulders. They are attached by a chain of thread. Since these are cheap clothes, this is a permanent point of attachment. Unlike nicer clothes, there is no snap to unsnap to separate the layers.

    This morning when I was getting dressed, I discovered that the inner layer was inside out and backwards with respect to the outer layer. So I had to figure out what sort of deformation to apply in order to get everything back like it should be.


  • Wednesday Omens

    1. Found a check in my laptop bag. It had expired about a week ago. Since it was for $40, I am unsure whether I am going to try to get a new check or if the time I would need to spend on the phone (and then the time I would spend remembering to cash the new check) wouldn’t be worth it.

    2. I’ve been assigned a task to complete at work today that calls up some deep-held vestigal fears. Like, I can explain to you why the person I am now is not irrationally afraid of the same things the person I was when this sort of stuff became scary was afraid of, but I’m still sort of dreading this task.

    3. My hiring woes: Not only am I shopping for an Applicant Tracking System and maintaining pleasant — but frequent — business-related conversations with the sales representatives, but I am also being buried under a mountain of applications from prospective interns. It is too bad that intern-hiring season started before ATS-shopping season concluded.

    4. I had been super-excited to tell you about a line of very clever code that I wrote, but it looks like it needs to remain a secret for now.


  • Putting Multiple d3 Charts on One Page

    I wanted to put multiple d3 charts on one page, but I couldn’t find any examples that I liked. All of the examples on the internet expected you to know how many charts you wanted to put on the page to begin with. And I wanted to put one chart for each dataset, and I didn’t know how many datasets there would be.

    So I spent today making a basic example that I can modify later. Again, this is another case of my putting this here so that I have a better chance of finding it in the future when I need it.

    Each chart should be attached to its own element of the page. It made sense to me to give each chart its own <div>. Each of my <div>s is named something like chart0, chart1, etc., and it’s created as I loop over the array of datasets. I then toss the name of the <div> and the dataset to my chart-drawing function, and then I have some charts. Whee.

    And that is what I did today while the world burned.

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8">
            <title>Some Rectangles</title>
            <script src="https://d3js.org/d3.v4.min.js"></script>
            <script>
                // Where do I draw the chart? With which data?
                function drawChart(dom, thedata){
    				
                //Width and height
                var w = 500;
                var h = 100;
    			
                var color = ["DarkOrange", "SteelBlue"];
                var dataset = thedata;
    			
                //Create SVG element
                var svg = d3.select(dom)
                            .append("svg")
                            .attr("width", w)
                            .attr("height", h);
    
    			// My charts are made out of two rectangles each
    			var rectangles = svg.selectAll("rect")
    			                    .data(dataset)
    			                    .enter()
    			                    .append("rect");
    			   
    			rectangles.attr("x", function(d, i) {
    						return d[0];
    						})
    					   .attr("y", 0)
    					   .attr("width", function(d){
    							return d[1];
    					    })
    					   .attr("height", h)
    					   .attr("fill", function(d, i){
    							return color[i];
    					   });			   
    				}
    
            </script>
            <style type="text/css">
                /* STYLE! */
                html * {font-family: sans-serif;}	
            </style>
        </head>
    
        <body>
            <?php
            // Add more data, and there will be more charts!
            // These data represent the horizontal extents of my rectangles     
            $all_my_data = array("[[0, 200], [200, 500]]",
                                 "[[0, 100], [100, 500]]", 
                                 "[[0, 400], [400, 500]]"
                                 ); 
    
            echo '<div id="container">';
            echo '<h1>Let\'s make some charts!</h1>';
            
            foreach($all_my_data as $i => $item){
                echo '<h2>This is chart '. $i .'</h2>';
                echo '<div id="chart'.$i.'"></div>';
                
                echo '<script>';
    
                echo 'var myDOM = "#chart'.$i.'";';
                echo 'var mydata = '. $all_my_data[$i] .';';
                echo 'drawChart(myDOM, mydata);';
            
                echo '</script>';
    
            }
            echo '</div>';        
            ?>
            
        </body>
    </html>
    

  • Water Main Break

    Big excitement in my neighborhood yesterday! There was a water main break over by our park!

    There is more coverage of it in the local news. You will see in the news coverage that we had a water main break last year, too. Last year’s water main break happened maybe 50 feet from this one, but the city claims that this is just a coincidence. If you look at enough local news coverage of yesterday’s water main break, you’ll find comments from NIMBYs who assert that the way that this neighborhood has changed from single family homes to multi-family buildings over the past century is what is causing the water main breaks. The arguments put forward in support of this position are inconsistent with my understanding of water infrastructure, but I am not an expert.

    The real decision I had to make, though, was whether it was better to go to work and get my car out of the rising water or if it was better to stay at home and not drive through disconcertingly deep water. There were parts of the street that were really quite flooded.

    alley

    I did end up going to work. It is possible that instead of 100% working all of the day that I did take the time to call my homeowner’s insurance to let them know about this situation. My apartment is on the second floor, so the only possible damage would be to my heat pump (a/c unit). Since the outdoor part of the unit is outside all of the time and gets rained on (especially in places where it rains), I suspect that it has a certain amount of indifference to water. No idea how well rain resistance translates to flood resistance. Also, my a/c unit is over 30 years old, so even if this flood brings about its demise, I’d kind of expected that I’d have to replace it at some point in the next few years.

    When I came home, I went to go look at the hole in the ground where the pipe was. some people are calling this a sink hole, but I feel that is an unfair characterization of the situation.

    hole


  • Calling R Scripts from PHP (mostly a note to myself)

    I’m writing this down here so that I have a chance of finding it the next time I look for it instead of having to happen upon all of the little pieces of advice that are scattered around the internet. Maybe someone else will find it useful, too?

    1. In my current use cases, I’m having the R script write a file and output the name of the file to stdout so that the PHP script knows where the file is. This works so much better when I have my R script write(filename, stdout()) than when I have it print(filename).

    2. In my call to exec, I append . "2>&1" to the command so that I capture both stderr and stdout. This gives me a better chance of figuring out what is going wrong.

    3. For the stuff that I am writing, it is much more efficient for me to start by using absolute path names for everything. This way I don’t have to keep track of whether the webserver’s user has the same things in its PATH that I have in mine.


  • My KitchenAid French Door Refrigerator and the Case of the Doors that Popped Open

    Another update that has nothing to do with math.

    I have a KitchenAid French door refrigerator, and when your close one of the doors, the other door would pop open a little bit. Annoyingly — and unlike the GE refrigerator in the old house — having the door be ajar was insufficent to trigger the “door open” alarm. In any event the door was like this all day, and it got warmer than it should have in the fridge, and no alarms went off, and at some point I need to remember to throw away the eggs.

    (Writing this reminds me of a joke from middle school: “The door is ajar.” “No, it’s a bottle.”)

    At first I assumed that the door alarm was broken or that I needed to press some buttons to turn it on or something. No, the alarm is just poorly designed.

    Who knew that hidden behind the bottom grill of the fridge are feet that need to be adjusted so that the front of the refrigerator is at least as high as the back of the refrigerator so that gravity pulls the doors closed rather than open. NOT ME!

    So, the moral of the story is that if you are disappointed with the way that the doors of your French door refrigerator close, check the leveling feet. I may have over-corrected the situation, but I am now much happier with my refrigerator.


  • My Inability to Make a Decision

    This is what Random.org has determined on my behalf so far with my latest knitting project.

    knitting project

    It’s going to be a poncho because I don’t want to worry about fit.

    Also, the tan project bag in the background is made out of an old sheet. For some reason, a lot of the old sheets started to get holes in them recently. So I am turning them into bags of various sorts. (Well, the regions without holes are being turned into bags.) Almost all of the bags that I have made so far have serious flaws in them, but I am learning. I feel like soon I will be able to make very functional bags very quickly.

    The plan for future bags: Make a tube of fabric. The cylinder should have a very large radius and a fairly small height. Turn the tube right side out and press flat, with the seam(s) symmetrically arranged around the center of the rectangle that you have flattened the tube into. Fold this rectangle in half, nicest (seam-free) right sides together; the raw edges will be the sides of the bag, and the folded edges will be the rim of the bag. Serge the sides. You should now have a terrible inside-out bag. Cut identical small-ish squares out of the two bottom corners. Puff the bag out so that the bottom is now a rectangle; serge these cut edges together, too. Turn the bag right-side out and then either attach some handles or else sew a channel and cut some holes for a drawstring (reinforce the holes with grommets – trying to arrange buttonholes ahead of time was too much of a pain in the neck). Feed some ribbons or whatever you have through the channel. Put the zipper away. Don’t even consider adding a zipper.


subscribe via RSS