• iTunes is Lying

    I had a migraine for much of the day, so I barely managed to read the newspaper and pet the cats. I also tried to listen to some Podcasts.

    Apple asserts that they can give Podcast publishers information about who listens to their content, various analytics, etc., etc.

    Meanwhile, iTunes can not keep track of which Podcasts I have and have not listened to on my phone and on my computer, even though these two devices are both signed in with my AppleID and communicate with each other daily over a USB cable.


  • More Disappointments with DataCamp

    So many of my nerd friends like DataCamp that I really, really, really want to like it more than I do. Some might say that I am an overly negative person, but, really, I just have high standards. I got lured in by a sponsored Facebook post to try out their phyllotaxis project, and they let me down again. On the bright side, the poor quality of the free content has me convinced that I am never going to pay them a cent for their paid content.

    I will summarize the phyllotaxis project for you so that you don’t need to register an account.

    1. Phyllotaxis and sunflowers are really awesome looking!
    2. There is this thing called the Golden Angle, and it equals \((3 - \sqrt{5})\pi\).
    3. Want to know more about it? Read the Wikipedia!
    4. We will grade you on fiddly nonsense, like removing the axis tick marks and all that crap that you need to google every time you do it. Also, you can’t just do it by using an existing theme because that doesn’t match with what our auto-grader expects.

    I had never heard of the Golden Angle before. If you divide a circle into two arcs where one is one Golden Ratioth of the other (I can “-th” any number to make it the denominator of a fraction), then the central angle of the minor arc is the Golden Angle. This was not mentioned in the DataCamp course; I had to see the Wikipedia.

    The rest of the DataCamp course was, as I mentioned, a bunch of antfucking about tick lines and colors and opacity. There was nothing at all in the guide about figuring out why things work.

    Of note: If the angle in the code is any integer factor of \(\pi\), then you will just get points aligned along rays, and it will not be particularly interesting. However, some choices, such as \(\pi\) will give you cool-looking artifacts, probably because of issues relating to precision and rounding. Any other angle, even something boring like 1 (radian), will give you a spiral; it just won’t be a phyllotaxic spiral.

    Nothing in the code helped me understand how the spiral was built. Which points went where!?

    So here is my improved version. Specifically, I replaced the points with their indices; smaller numbers were plotted first. Also, I made the points that were congruent to 1 modulo 13 a different color. You could go modulo any Fibonacci number and see something cool.

    library(ggplot2)
    theme_set(theme_bw())
    
    # Inspired by the DataCamp phyllotaxis project
    
    points <- 200
    
    # Defining the Golden Angle
    angle <- pi*(3 - sqrt(5))
    
    index <- 1:points
    t <- index * angle
    phyllo <- data.frame(index, t)
    
    # Make a scatter plot of points in a spiral
    p <- ggplot(phyllo) + geom_text(aes(x=t*cos(t), y=t*sin(t), label=index, size=t, color=(index %% 13 == 1))) + theme_void() + theme(legend.position="none") + scale_color_manual(values = c("#1b9e77", "#d95f02"))
    
    ggsave(filename="~/Desktop/phyllo.png", plot=p, width=6, height=6, units="in", dpi=100)
    

    Phyllotaxis


  • Welcome to Rat Mail

    For the past few days instead of finishing the thing that I should be finishing, I have been building the Rat Mail system. Just like everywhere else in the world, the Pareto Principle is in effect here, and a lot of our problems are caused by a small number of users. I’ve stitched together a sequence of scripts that will send me an email every Monday morning ratting on the troublesome users.

    A lot of the trouble is remarkably consistent. Registration email addresses that satisfy a fairly simple regular expression are likely to be from users creating sock-puppet accounts to cause trouble. An account that is created at a particular school and then is primarily used at a specific non-school location that has been cut off from creating new accounts is likely to be a problem. There are a lot of things going on that are fairly predictable. Instead of having me comb through the data on the site, I’ve put machines in charge of doing it.

    Here are the pieces.

    First I wrote an R script that I called rat-facts.R that queries the database, figures out which users need to be ratted on, and then writes the body of the email into a text file called rats.txt. As I find more ways to identify trouble-makers, their behavior will get encoded in this script, and I will learn about what they have been doing.

    Next, I wrote an AppleScript that I called send-mail.scpt that tells Mail.app (which is logged in to Gmail as me) to send an email whose body is drawn from rats.txt

    set theFile to "/Users/amy/ratfacts/rats.txt"
    open for access theFile
    set fileContents to (read theFile)
    close access theFile
    
    set fileContents to fileContents as string
    
    
    set recipientName to "Amy"
    set recipientAddress to "email.address@example.com"
    set theSubject to "Rat facts!"
    set theContent to fileContents
    
    tell application "Mail"
    	
    	##Create the message
    	set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
    	
    	##Set a recipient
    	tell theMessage
    		make new to recipient with properties {name:recipientName, address:recipientAddress}
    		
    		##Send the Message
    		send
    		
    	end tell
    end tell
    

    This isn’t how I wanted to send the email. I really, really, really wanted to figure out how to get postfix to authenticate to Gmail’s SMTP server as me and do all of this through a shell script instead of needing to have an AppleScript talk to Mail.app. But I was not willing to put in the amount of time that it would have taken to make that work. Compromises.

    Finally, I told my office computer (recall, access to this database is restricted to users that have been GRANTed acces and that are connecting from the office IP address) to run rat-facts.R to create the text file then then run send-mail.scpt to send the email. This was also harder than it needed to be because for reasons that entirely escape me, the crons are not running on my office computer. They fail silently, and I have absolutely no idea why, so I am stuck with launchd. Thus, I had to set up two plist files in ~/Library/LaunchAgents/: one to run rat-facts.R and one to run the AppleScript. Monday is Weekday 1, so this will have the AppleScript run every Monday morning at quarter after 8 and send the email.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>com.amyszczepanski.sendmail</string>
    
      <key>ProgramArguments</key>
      <array>
        <string>/usr/bin/osascript</string>
        <string>/Users/amy/ratfacts/community/send-mail.scpt</string>
      </array>
    
      <key>Nice</key>
      <integer>1</integer>
    
        <key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>8</integer>
            <key>Minute</key>
            <integer>15</integer>
            <key>Weekday</key>
            <integer>1</integer>
        </dict>
    </dict>
    </plist>
    

    To make sure that everything would actually run, I had to tell launchd about these plists by issuing the command launchctl load com.amyszczepanski.sendmail.plist from within ~/Library/LaunchAgents/.

    Ideally when I get to my desk on Monday morning, my inbox will have a message waiting for me with a list all of the things that I need to delete and turn off. If it works, next week it will just have a list of the links that I’ll need to click in order to clean everything up.


  • Nothing to Report

    The weather was terrible for plane-spotting, so I didn’t even bother to go and watch Air Force One land at Miramar. Plus, I’m saving my PTO for when we start to get LH service to KSAN (next week, I think!). How can you tell that I am a boring person? Because upon learning about direct service from my city to FRA and imagining a trip to Germany, instead of having the next step in my thinking be “…and once at FRA get on another plane to Berlin” or “…and once at FRA get on another plane to Hamburg and finally go and see Miniatur Wunderland in person,” I am thinking, “…and then I could take the schnell train to the Strassenbahn to Bonn!”

    Linguistic asides:

    1. When I use a German adjective in English, I will never decline it. So I would always say “the schnell train” and never “the schnelle train” (and I’m not even sure if it’s der schnelle Zug because fuck adjective endings). (In den USA, haben wir keine schnellen Züge.)

    2. Also on the matter of transportation, we have this mostly-useless-to-me public transportation option called “the trolley.” Although it travels on the track, it does not fit at all with what I would call a “trolley” (trolleys should be single-car, not have sliding doors, and must have a bell), so when I talk to Jim (who puts up with me), I insist on calling it the Strassenbahn because that is totally what it is.

    3. The other day I bought some fancy greens at Whole Foods, reinforcing my belief that the English word for Feldsalat is mâche, which is to say, I don’t think we have a word in Engish for Feldsalat.

    If yesterday had been a successful day at work, I could have written up some sort of professional post explaining how to get postfix on a Mac to authenticate to Gmail’s SMTP so that your shell scripts can send you email that won’t get caught up in your spam filter. But one of my attempts (following Mac-specific directions) did not work at all, and the other attempt (using directions for Ubuntu) led to Gmail bouncing the mail and returning some sort of error code (530, maybe?).

    You might think that I could use this free-tier AWS account that I have and do… something that authenticates to a non-spam SMTP server, but you might be overestimating my ability to follow the directions that I find by googling. Also, the main wrinkle here is that I am not allowed to touch the live server, and the test server that I do have access to will only accept connections made from the office IP address, so I would still need to run scripts on my office computer to put together all the information that I want to have in the email.

    And then add to that the fact that the crons don’t run on my office computer. Everyone on the internet seems to be saying that Apple doesn’t want me to set a crontab but that the crons should still run, and yet they don’t. So I also spent far too much time yesterday reading about launchd and launchctl.

    Apparently Google Sheets can run something called GoogleScript that can send Gmail. I am hoping that I can find some sort of reasonable API that will allow me to transfer the output of my shell script into a Google Sheet and then have the GoogleScript send the email.

    Are you yelling at me to give up on the shell script and just do this in AppleScript? I can’t hear you.


  • Where Will Air Force One Land?

    The president is coming to San Diego today to see his wall!

    As you might or might not know, I am the sort of person who hangs around airports with a ridiculous camera waiting for planes to land. And Air Force One is a great plane to take pictures of. The San Diego planespotting Instagram is going to be chock-full of Air Force One pictures that other people have taken.

    I have this pesky grown-up job, and I have two specific tasks that I have been assigned today that need to be done at specific times in the office (interviewing a candidate for ONE OF OUR MANY OPEN POSITIONS and making sure that a certain part of our site does not explode between 4pm and 5pm). Thus, I can not stand around just almost barely not trespassing while I wait for the plane to show up. This is especially the case because I know neither when nor where Air Force One will be landing.

    My guess is that he is going to land at Miramar MCAS and then drive to the border on the 805, making the traffic on the 805 even worse than it usually is. We have two nice military airfields in San Diego, Miramar and North Island. Miramar is nice if you are going to load up a motorcade and drive on the freeway. North Island is (as the same suggests) on the north tip of Coronado Island (not actually an island), and is much better if you want to catch Pokémon or play golf. Getting a motorcade out of Coronado sounds like a terrible idea from an OPSEC point of view; a helicopter would be better.

    We also have an airport conveniently located near the border. Go to Google Maps and search for KSDM and switch to satellite view. San Diego has a lot of airports, each terrible in their own way (mostly due to being in bad locations with respect to weather and/or terrain). The runway at Brown Field is unable to handle a large plane, such as Air Force One, so even though is it right next to The Wall, it won’t work. Also nearby is General Abelardo L. Rodríguez International Airport, which can handle large planes, but is also not a great choice. Are the rules about walls the same as some local zoning about fences, where you need to put the “nice” side pointing toward’s your neighbor’s property?


  • Circles and Lines

    Part of my quilt idea backlog has been the idea of a quilt with circles in its design. This would be the fourth quilt in a four-part series. The first one is made of squares and rectangles, and they remind me of a calendar, especially the way that the rectangles make me think of the way the calendar on my computer shows an “all day event” that lasts for several days. If you looked at this quilt without talking to me first, you wouldn’t see anything about it as a calendar; you’d just see a bunch of squares and rectangles. All of the first three quilts in this sequence (two of them are done and on the bed right now, the third one is still a work-in-progress; I need to decide if I should buy some pink fabric and applique on some cherry blossoms) are based on straight-sided shapes, and I don’t have that much experience sewing with circles. And circles remind me of clocks (because I am old and because math-contest-obsessed middle school children need to know how to find the angle between the hands of a clock), and I think that clocks might be a good way to end a series that started with calendars.

    Since one of my friends had a baby last month, I’m trying out some ideas, and I’m going to turn the blocks that I make into a quilt for her baby. Sure the baby has already been born, but I’m told that babies don’t sleep under blankets until they are bigger. And I suspect that babies ruin things and need new things every now and then.

    I have some ideas for structuring the blocks. I’m going to make the quilt out of red and blue fabric because I already own a lot of red and blue fabric, and I am not buying any more craft supplies unless I really can’t avoid it. Some of the blocks will just be boring patchwork, too, because I already have a bunch of leftover squares that I already cut out for other projects.

    My secret plan

    Yesterday I made the first of the circles. I’d like to pretend that I’m going to make a block a day and be done with the quilt top in roughly two weeks, but with daylight stealing time upon us, I no longer get up sufficiently early to do as many things before going to work. Also I had to put a lot of the sewing stuff away so that Roomba could vacuum.

    The first circle


  • I Hate Daylight Saving Time

    1. Just because I actually benefit from it this year doesn’t mean that I hate it any less. Now that we have curved the clocks, I no longer officially have insomnia because I’m pretty sure that there is some definition about having to wake up before 4am for it to count as insomnia, and today I woke up at the time that we are now calling 4:15.

    2. Sunrise this morning in Knoxville, TN is at 7:52am. That is right, the sun does not rise until almost 8am. One should not need to wake up significantly before sunrise in order to be on time for normal-people things. This is one of the reasons that I left Knoxville: the ridiculous year-round assumption that one should wake up before sunrise all the time in order to participate in society. Waking up hours before sunrise should be left for insomniacs and people who need to catch a plane.

    3. It will grate upon my pedantic soul for the next several months when people assert that certain events take place at such-and-such time EST when they mean EDT. This is very-bad extra worse when they mean PDT. If you want to be unambiguous about time, you can use Swatch Beats or the number of seconds that have elapsed since midnight UTC on January 1, 1970.

    4. Did the crons run? I bet that some of the crons didn’t run. Who else knows what went wrong. At least leap seconds are not foisted upon us by our government and the madness of the masses.

    5. All the people who want to go do things outside after work could just go in an hour earlier and leave everyone else alone. With very few exceptions I have not used an alarm clock in years, and I am strongly opposed to this societal peer pressure forcing people to wake up early just because some people want to go out and play in the evening.


subscribe via RSS