• Tuesday Omens

    1. A debt collector called at quarter after six this morning trying to get in touch with someone else with my name. The representative on the phone probably doesn’t realize how very common my name is.

    2. My car complained: TIRE PRESSURE LOW. I drove to work as normal. I figured that with the cooler weather we’ve been having as fall has settled in, this is some sort of \(PV = nRT\) thing and that the pressure has fallen just barely below some programatic threshold. Would sure be nice if the car told me which tire(s).

    3. Even though I ordered a hot drink, Starbucks made my drink iced. Yes, I did ask the barrista to re-make it.

  • Teetering on the Edge of the Rabbit Hole of Map Projections

    For one of my side projects, I’m making a map of San Diego County and adorning it with various features. I’m using d3 (because I’m obsessed with d3 this month), so my map needs to be represented with GeoJSON. If you don’t know about GeoJSON, it is basically a list of vertices of your region as (longitude, latitude) pairs.

    One of the important features of San Diego County is that it shares a border with Mexico. The border with Mexico is linear (at least in some map projections), but it does not fall exactly on a latitude line.

    One of the other important features of San Diego County is that it shares a border with the Pacific Ocean. The ocean is very large and mostly non-linear, and the public domain shapefiles from the US Census only show the ocean for some fixed distance away from the coast. The polygon is also clipped at the Mexican border.

    (Gee it would be nice if I included an image to show what I’m talking about, but right now all of my map files are kind of broken.)

    My goal here is to edit the GeoJSON (list of vertices) so that the ocean polygon extends linearly along the Mexican border, has a vast blue region representing So Much Ocean, and then comes back, linearly, along the Orange County border.

    So the problem is: If a set of (longitude, latitude) points that are already in the GeoJSON file (i.e. the Mexican border) lie along the same line in (x, y) space when transformed to the Mercator projection, how can I extrapolate that line out into the ocean? Where can I find some sort of inverse-Mercator function to take the desired points in my image and map them back to (longitude, latitude) pairs?

  • The Weekend In Review

    Subtitle: Briefly.

    1. Panera, Liberty Station: As always, the staff is over-worked and under-prepared. People are going to go to Panera on a weekned morning and order coffee and bagels? Color them shocked. Eternal pro: There is that really big table, and they never make the knitting group feel unwelcome.

    2. The Man in the High Castle: Finished watching it today. This season seemed to make a lot more sense than last season. That isn’t necessarily a good thing. I think that my favorite part of the show is the Nazis’ costumes.

    3. The Romanoffs: Are they episodes of a television series or are they short films? So far they are kind of boring. If you want to watch an anthology-style television series, you should watch Dekalog. If you can’t find it on your favorite streaming service, come over here, and we can watch it on DVD.

    4. PartyCity: Excellent selection of plastic spiders. Last year I was unable to replenish my plastic spider supply because I wasn’t driving because of all of that neurology stuff.

  • 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">
            <meta charset="utf-8">
            <title>Some Rectangles</title>
            <script src="https://d3js.org/d3.v4.min.js"></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)
                            .attr("width", w)
                            .attr("height", h);
    			// My charts are made out of two rectangles each
    			var rectangles = svg.selectAll("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];
            <style type="text/css">
                /* STYLE! */
                html * {font-family: sans-serif;}	
            // 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>';        

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


    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.


subscribe via RSS