-
Friday Omens
-
Cat barf.
-
Today in Facebook ads: How to ride the NYC subway. How to outsource work to the Philippines. An oral medication for lung cancer.
-
A colleague from when I was at UTK came to talk to us about whether our curriculum products could be helpful for a project that she’s working on.
-
-
My Own Personal Time Machine
I listen to NPR on my way to work. One day as I neared the office, I heard what I had assumed was an editing glitch in the story. The reporter repeated the last phrase, as if the audio wasn’t spliced together correctly. The overlap was just a few seconds.
But then it happened again another day. Another case in which the story on the radio went back in time a few seconds.
And then again another day.
If this keeps up, I will probably end up venturing a few minutes into the past.
As it always happens at roughly the same geographical location, my assumption is that the radio station broadcasts multiple signals and that they are out of sync. The spot near the top of the hill is probably where my car’s radio decides that one signal is better than the other.
But it’s amusing to pretend that I have a time machine.
-
Brief Updates from Work
-
Finally set the flags so that my pages will refuse to load on the live site and will only run on testservers. My queries take several seconds to run, even after I have optimized them quite aggressively, so they can not run on the live server.
-
Relatedly: Finally figured out the right way to display the data so that it is easy for people to understand. There are still some decisions to be made, but now that I have acted like a grown-up and separated out the key part of one page into its own React component, it should not be too hard to change things up.
-
Fighting with React. Remember how back in the 1990s all of your telephonic devices wanted to be closest to the wall? Well, in my world, all of the JavaScript libraries want to have control of the DOM. We all know that React will eventually get its way, which makes it the modem in this imperfect analogy and d3 is the answering machine, perhaps?
-
It’s too bad that we don’t have some sort of IoT device monitoring the upstairs kitchen at work because I would like to make a real-time visualization of the snack situation. We are doing well on coffee, tea, yogurt, sparkling water, cheese, fruit, and chocolate, but the granola bar situation is troublesome. Also, the upstairs microwave broke, so I can get my hot beverages as hot as I would like them to be.
-
-
PostgreSQL, unnest, and array_agg respecting order
tl;dr:
WITH ORDINALITY
andORDER BY ordinality
are your friends.Once upon a time I could write fairly simple SQL queries, pull my data into R, and then manipulate the resulting data in R. It worked really well for me. But now I live in a world where my only two tools are PostgreSQL and Javascript, and I don’t know anyone who reaches for Javascript when she needs to reshape a bunch of tabular data.
The problem that I have right now is that each lesson is associated with an ordered list of
problemID
s. But these id numbers are not meaningful to humans; the problems have other names that people know about. Thelessons
table has a column calledproblemIDs
, which contains an array of the problems’ ids (in order). Meanwhile, theproblems
table has a column ofid
s and a column of the correspondingproblemName
s.Something sort of like this:
lessons
id
problemIDs
100 {1, 2, 3, 4} 101 {5, 6, 7, 8} problems
id
problemName
1 'some name' 2 'whatever' 3 'more stuff' 4 'yadda yadda' (OK, not exactly. I have fudged the structure of things to simplify this example. Don’t even get me started on the column full of JSON that I also need to deal with in the real-life version of things.)
My goal is to get the array
problemIDs
as well as the corresponding array ofproblemName
s—and to have both of these in the same order as the original arrayproblemIDs
.That is, I want rows that look something like this:
100, {1, 2, 3, 4}, {'some name', 'whatever', 'more stuff', 'yadda yadda'}
Philosophically, what I need to do is
unnest(problemIDs)
, thenJOIN
with theproblems
table to get the corresponding name for each problem, and thenarray_agg()
everything back together into arrays.The issue, of course, is that goodness knows what order the query planner is going to do things in, and there is no guarantee that my arrays are going to be in the same order as the original array
problemIDs
. I had been working my way around this by using subqueries and various functions, but it was all pretty awkward.But on Friday I learned about the good news of
unnest(foo) WITH ORDINALITY
. Pair that witharray_agg(bar ORDER BY ordinality)
, and the problem is solved.SELECT lessons.id, array_agg("problemID" ORDER BY ordinality) AS "problemIDs", array_agg(problems."problemName" ORDER BY ordinality) AS "problemNames" FROM lessons, unnest("problemIDs") WITH ORDINALITY AS "problemID" INNER JOIN problems ON "problemID" = problems.id GROUP BY lessons.id
-
What My Grocery Store is Not Doing with Big Data and Apps
They’ve got to be working on this, right? It’s just that it’s a hard problem, and that’s why we haven’t seen this product, right?
Back when I was not driving, I considered buying groceries online to be delivered. I live in the sort of “city” neighborhood where I have a lot of options for this sort of thing. But then I realized that I had no idea what I wanted to buy. My usual grocery-shopping strategy is to wander the store aimlessly and buy whatever seems interesting together with whatever various staple items I always buy out of habit. And I always forget something important, so I go back to the store a few days later to get whatever I forgot together with whatever catches my eye. This model does not transfer well to online grocery shopping.
Lots of companies are working on putting together really robust recipe databases. Ingredients, quantities, nutrition facts, difficulty ratings, star reviews, all that. You see where this is going, right?
The grocery store (and I am nominating Amazon-Whole Foods to pilot this) should have an app that lets me pick meals for the week (it can suggest some things based on options that I’ve selected), and then it tells me what ingredients I would need and lets me add them to my cart–allowing for a manual override if I want to substitute or omit an ingredient. I could also add various staple items as recurring purchases.
The tedious part here would be matching the way that the ingredients are coded in the database to the grocery store’s SKUs. Probably also getting quantities to match up in a reasonable way. Someone would need to tell the computer the density of flour because flour is sold by weight, but most US recipes consume flour by volume. But this is also the sort of task that tech companies are very good at outsourcing to offshore contractors.
Eventually the system would use its Big Data to make better suggestions. It would know that I bought flour last week, so it could ask if I still have flour left for this week’s recipes. It would know what I’ve chosen before, so it can do some sort of straight-forward clustering to suggest things that I would also probably like.
Grocery stores are notorious for having very low margins, and this sort of app could help them extract more money from customers who value convenience over price. (It’s not the right product for the sort of shopper who goes to four different stores to get the best price on everything.) It would be pretty simple for the interface to suggest the version of an item with the highest margin and to require a few clicks for the customer to select a different brand or variety. Likewise, it could suggest recipes that include items that the store is particularly eager to sell (for whatever reason). Not to mention that it makes it easier for someone to always shop at the same store.
-
Please Send a Freakin' Cover Letter
I have tried really, really hard to be professional and to avoid writing about all of the people who are terrible at applying for jobs. For reasons that can not be explained succinctly, I deal with the initial stages of all job applications, and we are hiring for roughly 20 positions, so I get to see a lot applications.
First off: THE JOB LISTING SAYS THAT YOU NEED TO SEND A COVER LETTER. THAT MEANS THAT YOU NEED TO SEND A COVER LETTER. WHATEVER THE JOB LISTING SAYS TRUMPS WHATEVER ADVICE YOU READ ON SOME SEO-INFUSED BLOG POST ABOUT APPLYING FOR JOBS.
A lot of people don’t send a cover letter. IT IS A REQUIRED PART OF THE APPLICATION. I DO NOT MAKE THE RULES. THIS IS A REAL GROWN-UP JOB. YOU NEED TO PUT IN A FEW MINUTES OF EFFORT IN ORDER TO APPLY. MERELY CLICKING THE “EASY APPLY” BUTTON IS INSUFFICIENT.
Speaking of cover letters, after I send potential applicants my form letter asking for the freakin’ cover letter, some of them send cover letters, and sometimes it becomes really clear to me why these particular individuals didn’t send cover letters in the first place. What is that old saying? “Better to remain silent and be thought a fool than to speak and to remove all doubt.”
Actual cover letters I have received:
-
A cover letter template without any of the fields filled in. Yes, the person sent something that literally said, “I was pleased to find (Company Name)’s opening for a (Position Title).” This template also later asserted that the writer has a “sharp attention to detail.”
-
One that began: “Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.” (I copied and pasted to get the correct number of “blah”s.)
-
Instead of writing about his own professional goals and accomplishments, the applicant wrote about the successes of people he is related to. And not in some sort of charming “The Moth”-style storytelling that gave me insight into the candidate’s skills and competencies. No, this was more along the lines of, “Don’t you know who my Daddy is!?” (No one related to a current or former president, btw.)
Maybe you are an applicant for one of our jobs, and you have received my somewhat-frosty form letter chiding you for the lack of a cover letter and you have read this far? I know that y’all are searching for me because LinkedIn is like, “Gurrrrl, you are POPULAR!” Don’t get mad; write a cover letter!
And, guess what: I can pass you on to the next stage of the process no matter how terrible your cover letter is! The three people I cited above? All sent on to the next step! The only decision I make is based on whether or not the cover letter exists, not on its quality!
Here, I’ll write one for you. I’d recommend changing the placeholder text, but that’s kind of up to you. Since the bulk of our hiring is for Academy roles, I’m going to write you an Academy cover letter; if you’re applying for a Headquarters role, you’re on your own.
Oh, and don’t forget to send a resume, too. An alarming number of people don’t send resumes.
Dear Dr. Szczepanski:
Please accept my application for the Mathematics/Language Arts Campus Director/ Assistant Director role at the AoPS Academy location in Name of City.
I wish that I had had access to a more challenging curriculum when I was in school, and as an educator, I’m excited for the opportunity to bring AoPS’s approach to students. As technology moves forwards and more routine tasks become automated, students need to learn open-ended problem solving in order to find success in the world. I am impressed by AoPS’s commitment to offering a challenging curriculum that also excites students’ creativity.
This approach resonates with my teaching philosophy. I have found that students want to be successful and to make sense of the world. Many struggling students will rise to the challenge of a tough assignment if they trust that their teacher is not trying to trick them. Unfortunately, others will shut down when they first face difficulty. In order to help all students have confidence in their abilities to meet academic challenges, I believe that we should start early with meaningful and creative work. Young children’s brains are wired to learn and explore, and I would love to be a part of a team that brings a problem-solving-based curriculum to students as young as the 2nd grade.
Not only do I have experience teaching level of students, but I also have experience leading a team. My management philosophy echoes my teaching philosophy: People want to be successful, and if we give them meaningful work and the support they need to get the job done, they will succeed.
I look forward to hearing from you about the next steps in the application process.
Sincerely,
your name
your contact information
-
-
Small Dramas
We’re in the midst of math contest season here. If you are not familiar with how this goes, the MAA runs a sequence of math contests that are used in selecting the members of the US team for the International Math Olympiad. The first contest in the sequence is called the AMC, and it took place about a month and a half ago.
The MAA does not have a lot of resources, and many tens of thousands of students participate in this contest. Also, students can be pretty bad at filling out the headers of their Scantron forms. So it is always a struggle for the MAA to wrangle all the data from all the tests. Since qualification for the second round is based on student performance on the first round, the MAA needs to do a bit of psychometrics to make sure that everything is balanced. They probably also need to take a few other steps to clean up their results as well.
If you look at the perfect scores report for the AMC 10A from 2019, there are currently 22 entries on the list. Several of these entries look like placeholder data. For example, there is a “J. BOX” from “MAA AMC School of Mathematics.” There are also several who are listed as being from “William Penn Demonstration HS” (which is closed) and whose names are suspiciously similar to the names of charaters from an anime.
Our students, of course, are going absolutely nuts about all this. They have come up with some very complicated conspiracy theories about how this might have happened. Many dismiss the idea of general incompetence with placeholder data in favor of elaborate trolling and nefarious cheating.
The second round of the competition wrapped up yesterday, so the MAA has several weeks to reveal the list of the 200 or so students who move on to the next stage of the competition. We’ll see if any of the placeholder students end up qualifying.
subscribe via RSS