-
This Week in First World Problems
-
Indecision part 1: Not all of the “Komono” in the apartment belongs to me, and while I have Kon-Maried a significant volume of stuff, there are still things that need to be kept and stored. IKEA offers three different “cubby” shelves, the KALLAX, the EKET, and the FLYSTA, and I do not know which one to get.
-
Indecision part 2: I am nine rows, give or take, away from finishing up the current knitting project. What do I knit next? Note that it must be something that can be made out of yarn that I currently own, as I suspect that I already own a lifetime supply of yarn.
-
Do I load all the data all at once and then hide and show the various graphs based on user interaction? Or do I show half the data at the beginning and then have the page send a request for the rest of the data when the user wants it? The former strategy is likely to be easier, and it is liklier to give better performance if the user wants to switch back and forth between the views. The latter strategy is the one that I really need more practice implementing, so using it here would help me learn how to do it better.
-
The coffee/bar near my house serves too many IPAs, and I don’t like IPAs.
-
My favorite bar doesn’t have wifi.
-
I took a photography lesson this week, and I learned a specialized technique for getting the autofocus to only focus on the things that I want to focus on. So now I need to go out and take a lot of pictures of things to practice the technique. Meanwhile, we live in a world where film is free (metaphorically speaking), so I can take well over a thousand pictures with a $20 memory card, delete them all, and do it all again.
-
Also in photography: I have several projects that I want to do, and I’m going to need new lenses for some of them. Now I must decide which lenses to buy. (Fortunately, all three of my cameras use the same style of lenses.)
-
-
In Which I Admit the Way I Join a Whole Bunch of Tables
First off, I am going to state my opinion that most of the advice that you find on the internet for writing SQL queries is meant for people who are doing something involving websites in production. You have some user logged into your site, and you want to show a moderately-sized collection of information relating to that user. Or, the user does something, and you want to update a small amount of information in your database. Because this is happening all the time and at unpredictable times and with no one supervising it, the queries need to run quickly without gumming up the works.
You don’t really see much about the ways to write queries for analysis work. The database was designed to make the website run well, not to do some sort of analysis after the fact. Analysis work often involves grabbing data about a whole bunch of users and then doing a whole bunch of joins with other tables, possibly matching on columns that you were hoping to do calculations on.
There is a certain standard structure for queries. Often people will
SELECT
a bunch of columns that come from a whole bunch of tables, and the tables will be aliased in ways that make it hard for me to remember which tables they come from. Worse, all of our columns seem to be named things likenoun_id
and our tables are named by mixing and matching a bunch of the nouns. Things likehomework_students_problems_results
orstudents_homework_classes_problems
and other things that are easy to get mixed up with each other. So I spend a lot of time asking myself, “Wait, whichproblem_id
is that talking about?” And then the litany of tables is joined in. Finally, there are someWHERE
s in which I can’t remember which tables or columns are being restricted.So I have developed a personal style of query-writing which I call “rat nest of subqueries.” It’s great if you only need to run the query a few times during which time you are there babysitting it (and also it is running on some sort of test server and has no chance of melting a production server).
And then I end up with something of the form
SELECT * FROM (SELECT some_stuff FROM some_table WHERE something) T1 INNER JOIN (SELECT some_other_stuff FROM some_other_table WHERE something_else) T2 USING(whatever) INNER JOIN (SELECT still_more_stuff, possibly_aggregated AS nice_name FROM yet_another_table GROUP BY still_more_stuff) T3 USING(nice_name)
and I just keep on chaining things together. I’m sure that the optimizer hates me. Yet, in my defense, the other day I ran a query written in the conventional way by one of the most experienced people in the office, and it took a thousands seconds to run. So does it really matter if my version of it would have taken 1100 seconds to run? You’re still going to need to find some way to entertain yourself while it’s running.
And what I like about my way of doing things is that I can debug each of my subqueries on their own. I am terrible at tracking down the logic in the standard way of writing queries
Now that everyone is super-bored by my yammering on and on about databases, I’d like to take a moment to say that some of the email that I get at work is pretty wild. I’m the person who gets your email if you are applying for most of the full-time jobs that we are hiring for. And some people do not know how to apply for a job. I really do wonder how many of the applicants are trying to stay on unemployment by sending out the required number of applications a week but intentionally sabotaging themselves so that they won’t get hired anywhere.
-
In Praise of Powdered Coconut Milk
I thought that I was going to spend the day sewing. Then I checked FlightAware and saw that United was sending a 767, which they never do, so I went out to take its picture. Since we are having “winter,” I just threw on a coat over my pajamas. And then I came home and intentionally ignored the 777 that was coming and lolled about doing not much of anything.
I happened to look out the window, and I saw a plane flying from west to east. I live about three miles from the airport, and when I look out my window I normally see the planes flying from east to west on their final descent into the airport. Seeing a plane flying from west to east means that the airport is all turned around and they are running both departures and arrivals off of runway 9. This happens very infrequently, and it almost never happens when it is sunny out. So I went to the park at the end of the runway and took pictures until I went through two camera batteries.
But the real thing that this blog post is about is powdered coconut milk. This product is sad and terrible if you think that you are going to mix it with water and that it is going to be just like coconut milk. But as an ingredient, it exceeds expectations. For example, if you mix a few tablespoons in with the rice when you cook it, you will have coconut rice, which is delicious. Your meal can have a real sense of culinary fusion if you also buy mango salsa from the refrigerated section of Whole Foods. If my Instagram were not heavily themed, I might have taken a picture of the shredded pork that I made in the InstantPot served with coconut rice and several types of Whole Foods salsas.
The other thing that powdered coconut milk is good for is making a batch of “we have no food in the house” soup. This is an amazing instant soup that owes its existence to various modern technologies for creating foods that last for a really long time. Its ingredients are: powdered coconut milk, chicken flavor “better than bullion” (keeps forever in the fridge), tom yum soup powder, and hot water. Add some Trader Joe’s pre-cooked chicken if you have it. Add some of those rice vermicelli that cook by soaking in hot water if you have them. If not, just drink the soup from a mug
-
Farewell to Nazi News
Wow, it has been so long since I’ve written something that I worried that I forgot how this blog even works.
I could tell you what an idiot I am about databases, but I was soothed by the fact that Google autocomplete suggested the rest of “postgresql opposite of unnest” after I had gotten halfway through “opposite,” so I am not the only database idiot out there. Also, I had an epiphany about joins that will lead to me writing very non-clever queries that are also very readable to me. YOUR PROBLEM NOW, OPTIMIZER.
But instead I will inform you that I have finally cancelled my subscription to the New York Times. I think that I might have been a subscriber for over a decade this go around. Do you know what got me to cancel my subscription? No, it was not the sympathetic profiles of Nazis. No, it was not the consistent decision to put articles about male fashion designers’ businesses in the Business section but to put articles about women in business or politics in the Styles section. It was because they did not deliver my freakin’ paper.
Around the end of the summer, the paper stopped arriving. Or, sometimes it would come after the promised time of 8am. So I would complain via the website. Report a missing paper; credit my account. After this happened a few times, I started sending emails to customer service. Customer service promised me that they were on it.
And you know how this goes, the paper still didn’t come, so I called to cancel because it seemed stupid for me to report a missing paper every week and then buy it at the newsstand. The hard-sell guy on the phone (because you can not cancel without talking to a rep) looked at my file and all of the missing papers and emails with customer service and admitted that, yes, someone should have done something about this sooner. He was going to escalate this issue to the “executive” level. I told him I’d give him a shot to fix this because I still do want to read the paper, despite all the Nazis and other questionable editorial decisions. I did wonder why it took me calling up to cancel for them to actually try to do something about the problem that I had been having – and complaining about – for months.
The next week my paper arrived at 7:58am, which is technically before 8am.
But then yesterday, the paper still hadn’t arrived by 8:30am, so I got in touch with the Times again to cancel. This rep also pleaded for another chance. This rep asserted that none of the other reps that I talked to had the level of access that he has to contact the people who could fix this problem, but that he could solve the issue. My thought were that either (1) he was lying (or mistaken), or (2) you really do need to threaten to cancel your subscription not once but twice before you get to talk to a rep with any power to do something about the issue. Neither of these options seem like business practices that I wanted to support. So I cancelled. Even though he offered to let me retain digital access for more dollars a month than I was paying for both the paper and digital access.
The winner here seems to be the guy who runs the newsstand because I am going to buy the paper there. The surprise loser is the Los Angeles Times. I strongly suspect that the same carrier who was not delivering my New York Times also has the contract for the LA Times, so I wasn’t going to risk subscribing to a different paper. Ten years from now (once I have lived in California at least as long as I lived in New York) I may revisit that decision.
-
Children of the Potatoes
Things are going remarkably well today, as the internet revealed to me that Google Sheets have a method that allows you to get the displayed value (string) of the contents of a cell rather than the object containing the value in the cell. Maybe it’s the cell that has a method? It’s a good thing that my faculty position in an EECS department was a research position and involved no teaching because I can’t keep up with the lingo.
Today’s deep thought is about how the students choose their usernames. We keep an eye on the usernames to ensure that they are mostly G-rated and generally appropriate for a wide audience. There is no way to write a regex that is going to catch everything terrible that the children think up without being unfairly restrictive on the other users.
But today we are not talking about terrible and offensive usernames. Today we are talking about the lowly potato. A surprising number of users choose usernames that contain the string “potato.” By my count, 360 users. Or roughly one in a thousand. One in a thousand might not sound like a lot, but it is an order of magnitude more than the number of users who choose usernames containing “tomato.” My unscientific look at other vegetables has potato being a strong favorite for vegetable-containing usernames. We even have some whose usernames are the word for potato in other languages.
-
Life in the Trenches
Lately I have been fighting the good fight in the realm of Google Apps Scripts. You might not know what this is or else maybe you understand the misery that I have been enduring. The idea is that Google Docs and its associated products are, unlike some competing office applications, not bloated with unnecessary features like Mail Merge because you can get them a la carte from developers that you have never heard of in the Chrome Store or else you can write your own solutions using Google Apps Scripts, which is sort of like JavaScript but not really.
Now, the thing is that a Google Apps Script is really just a whole bunch of unhappiness in programmatic form. The documentation is remarkably sparse. The idea is that if you were the sort of person who thought that it was a good idea to roll your own mail merge from scratch that you probably know enough about writing applications that you don’t need documentation. Or something like that.
I’m thinking that I have reached the point here where it is easier to teach one of the HR people how to find the unique identifier of a Google Sheets spreadsheet and to paste it into a particular part of the code than to figure out how to get a web front end to have a file picker to have her choose the spreadsheet that she wants. It took much of today for me to figure out how to send my script a GET request and to have it list the parameters on a web page. (Pro tip: If your script is in a Team Drive, you can not deploy it as a web app because only the owner of a script can deploy it as a web app, and when something lives in a Team Drive, it is owned by the drive.)
So instead of fighting with all these things this morning, I spent part of my day training a Markov Chain text generator on a corpus of the titles of California ballot initiatives from the past few decades and then had it come up with 500 units of nonsense based on what I fed it.
The original idea came about as I was imagining a game in which one person got the title of a real ballot initiative and two people got the title of fake ones, and they each needed to come up with a description of what the ballot initiative was about, and the other team needed to figure out which one was real.
Band of Teen’s Pregnancy . Required Employee . Primaries . Low-Income Rental Assistance . Taxation – State and grants free admission to require a two-thirds for those Purposes . Redevelopment Agencies – Boards Of 1982 . Housing and Spending Limitation . Higher Education Facilities . Daylight Savings And Housing and Jobs Investment . Required Employee Union Members , Coastal , Seismic Safety And Insurers-Taxation . Sex Offender Laws . Wildlife Protection . Constitutional Amendment . 55% Local Public Services . Initiative Constitutional Amendment . Schools And Scenic Rivers Initiative . Higher Education Facilities Including A .B . Licensing Requirements for recreational use of insurance companies to 12 years total state levies and No-Smoking Sections—Initiative Statute . Drugs . Dismissal . Ballot Measures . Tribal Gaming Compacts . Health Requirements . Legislative Campaigns . Initiative . Initiative Constitutional Amendment and Flood Protection of 1984 . Public Schools . Housing and Environmental Law Of 1990 . Dedication Of 1984 . Initiative Constitutional Amendment . Safe Drinking Water Resources . Consumer Protection . Taxation . Nonpublic Schools and Quality Bond Act . Initiative Constitutional Amendment & Statute . State School Facilities Bond Act . Initiative Constitutional Amendment . Automobile Accident Claims Practices . Top Income Tax Rate Changes California Housing and Emergency Reserve Fund Act of California Safe Neighborhood Parks , the Auditor General . Motor Vehicle Tax Credit Union and Parental Notification Before Termination of 1978 . Mountain Lions . Initiative Constitutional Revision: Public Entities . Youthful and Animal Poisons . Assessments , Foreign Entities . Fire Protection and Architectural Services . Local Majority Vote For Tax appropriations mandate and exempt from expenditures limit . 1572 . Earthquake Relief And Water , Ethnicity , Historic Structure Exemption . Use Taxes—Revenue Sharing . Death . A .C .A . Bingo . Welfare . Funding . State-Negotiated Rebates . 15 . Wildlife Habitat Enhancement Bond Act Of Persons’ Exposure To Provide Public Funding . Health Services . Clean , Legislators and Water Reclamation Bond Law Of Schools . Partial Constitutional Amendment and Reporting . Statewide Voter Fraud Penalties . Bond Act Of 1976 . State Offices . Transfer Of 1990 . Transportation . Acquired Immune Deficiency Syndrome ( third attempt at Proposition 73 ) Bonds . Public Funding . Attorneys’ Contingent Fees . Veterans Bond Act of Education Facilities Bond Act Of 1990 . California State Civil Service . Prescription Drugs . Electric Service Position . Ethics , Corporations And Mass Transit Guideways . Repeat Offenders . Property . Commission Or Slanderous Campaign Financing Act of 1993 . Class Actions . Peace Officers . Property . Open Meetings . State Civil Service Position . Statute . English Only . State-Funded Private Contractors . $1 .00 per pack , 2012 primary Limits On Terms Of 1986 . Veterans Bond Act Of Office of Existing Motor Vehicle Taxation And Replacement Bond Act Of 1986 . Public Schoolfunding . Initiative . Imposes additional requirement to all state parks to lower taxable income tax credits , Supply and
-
Tales from the Regrade Log
An assortment of answers that students have submitted to this problem.
-16,-8,8,16
0
a+b
15
16384
-64 -9,9
3,5
(x+3)(x+5)
8
8x
x^2+8x+15
10
30
225
15376
16144
64
3,5,-3,-5,1,15,-1,-15
10,8
-7168
\(k>9\)
i dunno
sqrt15, -sqrt15
Qwertyuiopasdfghjklzxcvbnm
205520896I do worry about the problems when the students have trouble agreeing on what category the answer should belong to.
subscribe via RSS