Notes from 15 October, 2015: loop invariants, psql will eat your soul, bad server.log pickup lines, TV ideas

Autumn Bridge Term continues!

I have some outstanding questions from the end of chapter 1 of CLRS (outstanding questions…they’re terrific!) (ho ho ho), and I will ask about them later, but also I dove right into chapter 2.

Unsurprisingly, it gets denser pretty fast. I am reading and rereading and rerereading a bunch of things. I have a basic grasp on, say, loop invariants, but I absolutely do not yet grok them.


Had a part-social-catchup, part-lunch-with-Nathan-and-his-mom-who’s-in-town lunch, and have significantly decreased my FOMO related to RC chat (Zulip). (I made a lot of choices about what NOT to read, which I am really proud of, and chose to read a small number of threads. All hail good threading.)

Now I do not have a big glaring “6949 UNREAD MESSAGES” thing hovering over the icon, and also I haven’t been keeping Zulip open, which makes it even easier. And I didn’t have to read 6949 messages to get there. (Phew!)

Decided to bravely tackle a Postgres problem with Nathan after lunch. We’ve previously tried to work on programming problems before, and it turns out that that might be a dangerous thing to do with your partner?

This time went a lot smoother, though, than any previous attempt, which I suspect is largely due to practicing “I don’t know” and related skills at RC.

Let’s back up in the terminal and see what we discovered! My brain is exhausted, but I know that I can understand my past.

? ? ? ? ? ? ? psql
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

As you may remember from previous adventures with my prompt, the “? ? ? ? ? ? ?” is literally my bash prompt and I refer to it by its shortname sometimes, “chickparty,” because that’s what you get with a baby chicken and six balloons.

Anyway.

All the googling in the world yesterday & today helped me find some interesting information: namely, be exquisitely careful with your postmaster.pid, because you can do DEEP DAMAGE if you go messing with it all willy-nilly, but sometimes you MUST mess with it. This was not one of those times, regrettably.

For an excellent explanation of one possible path here, see this StackOverflow post. I’m especially impressed that the OP  ultimately solved their own problem, and THEN took the time to retrace their steps, explaining each one for the benefit of others.

I tweaked the find command just in case I was missing something, but there was indeed no postgres…except, as Nathan explained to me, the instance of grep that was searching for postgres. Sigh. Now I know!

  501  6548  3487   0  3:19PM ttys016    0:00.00 grep postgres

Ugh. Go find yourself, grep.

Alas, the end of my server log had an entirely different error than the one in the SO post:

LOG:  skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.4.4.

Yesterday, I had PAGES upon pages upon pages upon pages of this, almost endlessly repeating (there was some other stuff way way way up high, and the only dates I found for THOSE were in early 2014…hmm!). I scrolled with the mouse, the scrollbar barely moved, and I ultimately just had to drag and drop it like some kind of…person who does inelegant things.

For fun, and because both the internet and Nathan had suggested this, I ran tail -f,  which follows (aha! there’s the f) the progress of the file until you tell it to stop. Sure enough, guess what kept adding to itself every few beats:

? ? ? ? ? ? ? tail -f /usr/local/var/postgres/server.log 
DETAIL:  The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.4.4.
LOG:  skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.4.4.

(and on and on until control-c stopped it)

SPOILER ALERT it is the postgres logs! My friend, you have been so, so busy for SUCH a long time, huh? Your legs must be tired (why) because you have been running on my computer for all eternity (groan) ho ho ho

This postgres directory had all kinds of goodies in it:

? ? ? ? ? ? ? ls
PG_VERSION	pg_clog		pg_multixact	pg_subtrans	pg_xlog		postmaster.pid
base		pg_hba.conf	pg_notify	pg_tblspc	postgresql.conf	server.log
global		pg_ident.conf	pg_stat_tmp	pg_twophase	postmaster.opts

And yeah, doing cat PG_VERSION netted a clean 9.2. Rats. 9.2 is apparently five hundred kinds of trouble! Down with 9.2; long live 9.4 until the next Extremely Different New Version comes out.

We looked at disk usage here with the -h flag, which stands for human? It displays it not in…another format which is trickier.

? ? ? ? ? ? ? du -h
6.0M	./base/1
6.0M	./base/12265
6.0M	./base/12270
6.0M	./base/16384
 24M	./base
428K	./global
8.0K	./pg_clog
8.0K	./pg_multixact/members
8.0K	./pg_multixact/offsets
 16K	./pg_multixact
8.0K	./pg_notify
4.0K	./pg_stat_tmp
8.0K	./pg_subtrans
  0B	./pg_tblspc
  0B	./pg_twophase
 16M	./pg_xlog
 83M	.

All the base are belong to us directories correspond to previously existing databases (from a zillion years ago when I managed QA reports for support, and also possibly from an open source day at Grace Hopper a few years ago?). Which is neat! I did not know that. That is a thing I learned today, too.

Because I decided that I did not care about these old databases that I have not looked at in literally years, we sallied forth with a rm -rf *,  which felt so so spooky to run.

Just. Whole postgres folder there. GONE. Run ls, completely empty.

Running psql still gave the same error (about /tmp/.s.PGSQL.5432), BUT, I ran ls again in /usr/local/var/postgres/, and we NOW have…dun dun dun…a server.log file! It’s Not Nothing!

Look at the cool new stuff at the end of server.log:

postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory

It’s different! And then it was just THAT forever and ever, ^C (which is, I don’t know, like a computer’s “amen”? sure).

Okay so maybe not the most thrilling, but it’s Progress, and that is what I was after today.

Tried to get something going, since we’d now cleaned out all the old misbehaving stuff. Ran a series of commands that did not impress the computer:

  • initdb? no.
  • initdb -D .? no, initdb: directory “.” exists but is not empty. If you want to create a new database system, either remove or empty the directory “.” or run initdb with an argument other than “.”.
  • How about rm server.log; initdb? nooope. How about…
  • rm server.log; initdb -D . ? JACKPOT. By which I mean “success messages.”

So about that empty postgres directory. What’s it got in it NOW?

? ? ? ? ? ? ? ls
PG_VERSION		pg_ident.conf		pg_snapshots		pg_xlog
base			pg_logical		pg_stat			postgresql.auto.conf
global			pg_multixact		pg_stat_tmp		postgresql.conf
pg_clog			pg_notify		pg_subtrans		postmaster.opts
pg_dynshmem		pg_replslot		pg_tblspc		postmaster.pid
pg_hba.conf		pg_serial		pg_twophase		server.log

It’s not nothing! [distant cheers] The crowd goes wild [some woo-girls scream “WOO” in the background] everything is coming up Chickparty

And look at this adorableness (this is the whole server.log, not just the constantly expanding tail of suffering):

? ? ? ? ? ? ? cat server.log 
LOG:  database system was shut down at 2015-10-15 15:31:42 PDT
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

So then we whacked a few sticks against the wall, eventually creating a database, but that part almost feels like it will be helpful to struggle through a few times.

psql
(no)

psql foo
(no)

psql postgres
(yeah, but, what if we want something else. let's try to do something else.)

psql postgres 'create database foo'
(no)

psql postgres -c 'create database foo'
CREATE DATABASE

(thus spake Zarapostgres)

This puzzled Nathan for a bit, too (we didn’t hit on the perfect command the first time, anyway), which made me feel way better, because he does Postgres-y things a bunch for work. It’s nice to have people model that expertise does not equal omniscience — part of being experienced is knowing how to be productive and curious when stuck, I think.

So! Now I still have four CSVs full of all numbers (one date, many many many floats with 15 digits past the decimal…if they’re already double precision types, I’m kinda wishing there were a non-CSV format for these SUCH AS perhaps a database file). But I also have a working postgres to wrestle with tomorrow.

Postgres wrestling! Coming to a television near you. It’s gonna be big.

Notes from 14 October, 2015: autumn bridge term, libraries, & Jawbone

Back in Oregon. It’s strange here. People look at you on the street and I notice the air every time I go outside (it’s delicious; I breathe in and sigh and exclaim) and we only took a few hours to get back in our house (key excitement) and our friends are lovely and it gets so, so much colder at night here.

Today’s day one of Algorithm Study Time (I didn’t start on the road, we got home last Friday, and I gave myself Monday & Tuesday to take care of pressing home needs). Or maybe I’m calling it Autumn Bridge Term. I feel like I need a name for this.

Sonali at RC told me that for the next three weeks, it’s algorithms in the morning, building stuff in the afternoon, with lunch or a bike ride or whatever in the middle, and also I don’t have friends for now. Okay! I’m finding it comically freeing to have this much structure. Also that this feels like structure after the vast open fields of RC.

Cracking into the apparently-infamous CLRS algorithms book on Sonali’s recommendation. It is a beast, and it is a self-aware beast (it has already made references to its enormous size two times outside of the introduction, and I’m only in the first chapter). It is also the first time that I am doing highlighters to a book (perhaps ever), and I’m starting to find my way with this. It doesn’t hurt that I have magic windowed highlighters from Muji, so I can see through the pen as I’m highlighting (!). I continue to find ways to do small, personally meaningful rebellions, like writing “WTF” in the margin when appropriate. This continues to alarm and delight me.

I’m writing all my questions in a notebook, and typing out my exercise answers in a brand new repo. It seems like the kind of thing I should keep to myself, so I’m sharing it, because this is the kind of thing that seems reasonable now, after RC. Just. Share all the things. I like this feeling.

I got through Chapter 1, just not all the exercises or the problem yet. My brain is full, so now it’s time to give my stomach the same treatment. I’m talking, of course, about lunch. We will represent lunch here as a horizontal bar:


I either snuck into or went to the Concordia University library after lunch. The whole third floor, to my delight, is a quiet zone. No music. No talking. Just big beautiful windows and books and study corrals (in case you are a study horse or other study livestock) and wooden chairs and squishy chairs. There IS a “community library card” available here, but I don’t know if that means I’m also allowed to, like, come do stuff here. The existence of a Guest wifi network suggests that yes, however.

¯\_(ツ)_/¯

As mentioned above, the second half of my days for the next few weeks is (are?) Building Something. I ended up deep in the mud of “interesting datasets” and then tried to scale back and think about datasets I have on myself, which might be more interesting to me. Handily enough, I’ve been tracking my sleep and steps nearly every day for almost three years now (with some gaps due to technology or human errors of one kind or another).

Haven’t been using my Jawbone UP24 to track sleep lately, but I’ll figure out if that matters. The Mi Band I got after learning about Xiaomi from the Keyboard.io Kickstarter [whew!] is so so so much easier for sleep tracking, and has stellar battery life…but also a pretty bare-bones app. But also it was $15. In any case, the UP should have excellent coverage as far as steps go. (And also non-labeled “workout” sessions that are mostly bike commutes!)

So! I’m thinking I’d like to do stuff with that data, even if I’d had a rocky relationship with Jawbone products. I had a semi-original UP (not the very first generation, but the second gen, IIRC, which still plugged into the phone’s headphone jack to transmit information). I’ve had a series of misadventures with my original UP and UP24:

  • Original UP (headphone jack sync) stopped working entirely. Just. Blinked out of existence in a way no charging could fix. I eventually received a replacement (through a convoluted return process that almost turned me off of Jawbone entirely), AND, some time later, what I believe is the original defective bracelet. Hmm.
  • Next one stopped vibrating entirely (the vibrations partially confirm mode changes, give alerts, and function as the alarm). Since one of the reasons I am gleefully fond of this band is the little buzzing smart alarm, this was pesky/removed a functionality I had come to depend on.
  • Not wanting to deal with the return process again, and ready to leverage Bluetooth technology to be lazier (programmer’s mantra!), I got a new UP24 (which syncs via BT). It eventually became filthy (fine) and stopped functioning completely, except for secret flashing error codes (not fine). After a series of emails, I eventually had to call (on the telephone!) and go over all the information again to convince them that the thing was really really broken, and there was really really no way for me to fix it, and yes I know how to soft- and hard-reset my band now. It was a new kind of miserable, but the return process was much much easier.
  • And then there’s this one…the rubber has detached at both ends, eventually splitting on the cap side, and it can’t be slid back down to where it should reside. So it is eating itself at both ends, like some sort of Ouroboros.

But! Jawbone continues to make, as far as I can tell, incremental improvements in their support experience. Went to the FAQ, found something about Rubber Warping (sounds about right), filled out a tiny amount of information…and they’re sending me a warranty replacement (!) and it’ll have a return shipping label included (!!). A+, Jawbone.

Anyway now I’ve got five CSV files, each of which was just a click away once I found what I was looking for (thanks, Quora), one for each year from 2011-2015, including one from a year where there shouldn’t be any information (2011 — I got my first UP in November 2012).

Don’t know quite what I’m doing with it yet, but when building something, it helps to have literally any clue about what you are doing. And unless I find something wicked compelling, it’s Data On Myself which I am Finally Using For Something.

I eventually threw up my hands in frustration and headed back to the Udacity Relational Databases course, which I’d really like to finish up (and maybe review a bit). It is, after all, exactly what I am wanting to do with my project (Python + DB == BFF). And I finished lesson 4 of 5!

I also found a bilingual copy of Rainer Maria Rilke’s French poems in this library (yes! he wrote some French poems!) and anyway I guess I DO need to find out about this community library card business.

I can’t get Postgres to start, but fortunately I’m not even sure I’m doing the right thing (something may be broken, and if so, I just found one of those quintessentially lovely StackOverflow pages so I can piece through why and solve it).

Also, my Pomodoro timer went off again, and that makes 10 half-hour ticks or tocks or whatever today, and that’s about three hours of morning & three hours of afternoon and I am happy with that.

Notes from 1 October, 2015: alumni Thursdays & soba

Happy October! I’m at the Recurse Center for alumni Thursdays, and it’s lovely. There are a TON of new faces and several familiar ones, and it’s a nice space to inhabit on our last full day in New York.

Led a large lunch excursion to Corcoron Soba, which might be the only thing I really wish I could just pack up and bring with us (it doesn’t appear the website has been updated in ages, but whatever). It’s Japanese food with more than two full pages of vegan options. Vegan dip soba! I didn’t even know dip soba was a thing. There’s also this soba no kabayaki, which is apparently someone going “what if we made this eel dish out of soba?” So it’s a buckwheat pancake with nori on one side, and it’s fried and crispy on the outside and melty-soft on the inside, and it’s magic.

Want to do a bunch of little errands before hitting the road. Worried I’m not going to get any actual code things done.

But then, code will be there next week, and the week after. The people will be far away quite soon. (Also known as “now” because I’m finishing this up on Monday, in Iowa City, IA, and all my summer people are quite far away indeed.)

Notes from 30 September, 2015: python packaging & unexpected results

I’m learning about python packaging, and I think I just expected to Do A Google, copy a few commands, and be on my way. This is because I was wrong, which is both disappointing and awesome: turns out I get to learn a lot more than I thought I was going to!

My desired end result is running my little Weather Balloon script as a command line script with less fussing, and I found this fabulous little resource, so I’m just doing what primates do and copying motions in order to learn: http://python-packaging.readthedocs.org/en/latest/minimal.html

Already, I’ve done some reading on the differences between python setup.py install and python setup.py develop, and got a better understanding of what that means, and also surprising results in my own terminal.

Adding a new dependency (markdown) in setup.py/__init__.py didn’t actually do anything with the develop option, which is the one mentioned here: http://python-packaging.readthedocs.org/en/latest/dependencies.html

? ? ? ? ? ? ? python setup.py develop
running develop
running egg_info
writing pbr to funniest.egg-info/pbr.json
writing requirements to funniest.egg-info/requires.txt
writing funniest.egg-info/PKG-INFO
writing top-level names to funniest.egg-info/top_level.txt
writing dependency_links to funniest.egg-info/dependency_links.txt
reading manifest file 'funniest.egg-info/SOURCES.txt'
writing manifest file 'funniest.egg-info/SOURCES.txt'
running build_ext
Creating /usr/local/lib/python2.7/site-packages/funniest.egg-link (link to .)
Removing funniest 0.1 from easy-install.pth file
Adding funniest 0.1 to easy-install.pth file

Installed /Users/liene/Documents/src/funniest
Processing dependencies for funniest==0.1
Finished processing dependencies for funniest==0.1

That toooootally doesn’t match the “To prove this works” section on the above page. Zero markdown references to be found in this result.

But install did it just fine (I just removed a bunch of non-salient stuff below, and also I bolded all references to Markdown):

[removed parts are marked with '...']
Removing funniest 0.1 from easy-install.pth file
Adding funniest 0.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/site-packages/funniest-0.1-py2.7.egg
Processing dependencies for funniest==0.1
Searching for markdown
Reading https://pypi.python.org/simple/markdown/
Best match: Markdown 2.6.2
Downloading https://pypi.python.org/packages/source/M/Markdown/Markdown-2.6.2.zip...
Processing Markdown-2.6.2.zip
Writing /var/folders/.../Markdown-2.6.2/setup.cfg
Running Markdown-2.6.2/setup.py -q bdist_egg --dist-dir /var/folders/.../Markdown-2.6.2/egg-dist-tmp-7uJqls
Copying Markdown-2.6.2-py2.7.egg to /usr/local/lib/python2.7/site-packages
Adding Markdown 2.6.2 to easy-install.pth file
Installing markdown_py script to /usr/local/bin

Installed /.../site-packages/Markdown-2.6.2-py2.7.egg
Finished processing dependencies for funniest==0.1
Markdown Markdown Markdown Markdown Malkovich Malkovich Malkovich Malkovich

Huh. And what happens if, for kicks and giggles, I try python setup.py develop again?

? ? ? ? ? ? ? python setup.py develop
running develop
running egg_info
writing pbr to funniest.egg-info/pbr.json
writing requirements to funniest.egg-info/requires.txt
writing funniest.egg-info/PKG-INFO
writing top-level names to funniest.egg-info/top_level.txt
writing dependency_links to funniest.egg-info/dependency_links.txt
reading manifest file 'funniest.egg-info/SOURCES.txt'
writing manifest file 'funniest.egg-info/SOURCES.txt'
running build_ext
Creating /usr/local/lib/python2.7/site-packages/funniest.egg-link (link to .)
Removing funniest 0.1 from easy-install.pth file
Adding funniest 0.1 to easy-install.pth file

Installed /Users/liene/Documents/src/funniest
Processing dependencies for funniest==0.1
Searching for Markdown==2.6.2
Best match: Markdown 2.6.2
Processing Markdown-2.6.2-py2.7.egg
Markdown 2.6.2 is already the active version in easy-install.pth
Installing markdown_py script to /usr/local/bin

Using /usr/local/lib/python2.7/site-packages/Markdown-2.6.2-py2.7.egg
Finished processing dependencies for funniest==0.1

Huh! That was the expected result the first time.

So. I wanna know why this happened. But more than that, I want to make this work.

Gonna have to come back to this later, but I’m looking forward to learning something new here.

Same Old Brave New World

It’s Monday, and it’s not a holiday, and I’m not at the Recurse Center, and that’s strange, but it’s also such a clear marker of change. This, too, is a new chapter. Just a tiny one, a single week long. This is that week where New York still feels familiar, still feels like home, even though I’m not doing the thing that I came here to do, because I already succeeded at that.

This still sounds a little funny to me. Not strange, just funny. I started a thing with a cohort of people, and I finished it.

Maybe this is unremarkable to you. You went to college, a lot of you, right after high school, for a lot of you, and you went to classes and you made friends and you got grades and then you got the fancy paper that, despite the fact that it is NOT shaped like a key, opens a lot of doors both obvious and invisible.

I, too, went to college right after high school. I went to a strange little place on a hill that felt, for all its 3000 miles from my place of birth, like home. But things happened (long story short: at 19, I was not great at setting boundaries or doing anything that at ALL resembled conflict), I took a break, and I never went back. I moved back home, was a disaster, finally cared enough about not caring, and started making a plan.

I took a class at a time while working full time at a natural foods store, checking off the boxes on Bastyr University’s prerequisites (for the Herbal Sciences degree). I finished all of them, then moved to France. Because Reasons, as we say here on the internet, I did not apply to Bastyr in the end. I did not end up returning to the Pacific Northwest for a few months after my French contract ended.

When I returned, I ended up in Portland because of my incredible family. My amazing older sister Inara said, “hey, if you want to do the figuring-out-the-next-chapter thing but not living-with-your-parents-in-your-twenties, we’d love to have you in Portland for a bit, and I think you’d really like Portland.”

14 months later, I had both a job AND a real non-college apartment with a friend. The desperate longing for France had subsided as soon as I got to Portland, and not a moment sooner, to my profound relief.

From there, from 2008, it’s all been tweaking and tuning.

There is something very liberating and very lonely about doing things on your own all the time, though. People have helped me, to be clear. And I have had the good fortune to be part of incredible communities. But there is never a sense of completion unless I quit something. This is not satisfying.

But ah! Then there was RC.

I heard about RC a couple years ago, when it was Hacker School. A friend who made the amazing helper-robot mural in the library nook was there. (I didn’t quite understand what she was doing, but she was enthusiastic about it!) And I knew someone very bright who applied and didn’t get in. And every conference talk I have seen by a Recurser is sharp, interesting, joyful.

This all made me feel like the following was true about RC:

  • Incredible people go there, and
  • People who go there tend to be incredible
  • Even really smart people don’t always get in, and
  • I am not all that remarkable, so
  • Probably I would not get in if I applied

Spoiler alert: I was wrong. I enjoy being right, and usually am (I’m serious!), but I also love learning when I am wrong, because it’s usually not the worst thing ever, and then I know more things. And I LOVE knowing things.

A number of circumstances conspired to get me here, and here’s how I’ve been describing it to folks: I finally got scared enough that doing nothing was no longer the easiest option, and I knew that I would regret it forever if I didn’t just find out what happened if I applied. If I was right, and I wasn’t accepted, then at least I knew what would happen.

Post continues below the line, on Wednesday, so you can think of the line like a time machine. Remember your lines, and also your time machine.


So I got in, and then I had a new problem, which was “how do I move to New York in a month?” My profoundly supportive partner and I talked about it, and decided that he’d come along as well, and so we drove ourselves and our bikes and some other things across the country and started this summer adventure we’ve had.

I’d like to write a more “about RC” post soon (a “return statement,” if you will), but it is clear to me already that everything is subtly and yet profoundly different.

I’m less afraid, for one. I know that I can succeed at something that isn’t open-ended in a timescale way (my 750words.com streak has taught me that I can commit to something for a long period of time, but there’s no end date there). And I am never going to be alone again in my quest for learning.

<3,
Liene, Summer 2 Recurse Center alumna

p.s. For the curious and thorough, you can find ALL my Recurse Center posts under the “recurse center” tag here. Each week has its own tag, too. Things at least marginally related to Actual Computer Programming are under the category Programming (which is most, but not all, days), and also the tag Learning. The difference between the latter two is due to a secret algorithm in my head that I still haven’t pinned down.

All my daily updates are under the Daily Logs category (including the aforementioned programming-heavy days, as well as ruminations on grief, productivity, and more).

Recurse Center: week 12, day 4

Last day of my batch!

I kind of expected to have that kermit-flail reaction, like so:

Kermit the Muppet flailing wildly in front of a red stage curtain

But instead I’ve been talking with people, attending Alicia’s awesome code dojo (we round-robin paired on a Flask app for Abstract Salad Factory, which is where everyone brings an ingredient for salad, and then everyone shares the ingredients, and makes whatever salad they like from those things), and not exactly ever making it out the door to have lunch. (That’s what trail mix is for!)

Also went to Madelyn’s awesome short presentation on “how not to be disrespected,” which, one, was a great presentation anyway, and TWO, Madelyn has such incredible presentation & comedy skills that it was ALSO an absolute blast.

And now somehow it’s five, and I still haven’t heard back from the Latvian embassy, and I’m going to go talk to Sonali and Nancy about JOBS STUFF, and then there are presentations, and THEN there’s our end-of-batch party, and we are dressing up like programming languages. So. This is going to be pretty fun.

I will reflect more on all this soon, for whatever definition of “soon” ends up being right.

Recurse Center: week 12, day 3

Leaned more heavily in to spending time with people. Coffee-walk check-in is the best. Went costume-questing with Alicia and Shad, who are both clever AND a lot of fun. (Our end-of-batch party is Thursday, and it’s a costume party, and the theme is programming languages…) This also took us to an art store, which was fabulous.

Had another soba-licious lunch (two days in a row!), this time with Allie. Hooray Corcoron. Also, dip soba is a thing! You get noodles, and something hot to dip them in, and a separate dish to hold them over as you eat them. It’s amazing. It is another form of “yes, adults, it is okay for you to play with your food.” And then you get soba broth (soba-yu) to pour INTO the hot noodle liquid so you can drink it, because it is full of All The Healthful Things. Okay!

I am sure I did some programming things, but I don’t think I did all that many, and that is okay.

Also made two Annoying Adulthood Phone Calls (I warmed up with a call to my dad, partly to ask about one of the things, and partly because it was a phone call that didn’t scare me).

I called the Latvian embassy (I got the voicemail — all in Latvian — and left a message in English, ending with “Paldies” [thank you in Latvian]. Woulda done Latvian if I knew it!). My brother, my sister, my dad, and I all applied for citizenship last year, and got it, but I have to go to Washington, DC (where the embassy is) in person to do the passport application. Which, ugh. I thought it would be So Easy to do that this summer, and it turns out this was not the case. So now I’m trying to get it done next week. And if worse comes to worst, I’ll take a plane trip soon, and whatever. But I’d rather not. A little train trip would be so much nicer.

I ALSO called the health insurance broker to finally resolve this insurance gap of mine. Since I’m on leave from my old job, and thus not working, my coverage through them ended at the end of July. But that’s a qualifying event, so there’s a special 60-day open enrollment period. You may notice that it’s almost 60 days later. But I did it! I called. And left ANOTHER voicemail. And the very nice broker returned my call, and I had to talk to her for a long time, but now I’m enrolled and I just have to give an insurance company money soon. And then, if anything horrible happens, at least I will not be All The Bankrupt. Just, like, out of savings. Hooray American healthcare. Hork. I’m not in any particular rush, but it will be cool to have a regular adult job with a paycheck and health insurance and stuff again. More energy left over to do awesome things.

Recurse Center: week 12, day 2

Not enough sleep, but what a good opportunity to finally try my first “flat white,” which if I remember correctly, Ann described as “like a latte with less milk.” And it’s got almond milk. And it’s delicious and small. And it’s also not a second iced coffee before 11:00.

There’s so much I want to be working on, but also I should probably be working on my niceties for my batchlings. There’s a tradition (of unknown age, to me) of putting together things with little nice things about all the never-graduating people, and they’re due Wednesday morning (tomorrow!), and they took me WAY longer than I expected last time. Mostly this is because I actively admire a lot of people here, and sometimes it’s tricky to verbalize a feeling.

What else did I do this day? (I’m finishing this Thursday morning, and reminding myself why I’ve written these on the days they applied to.) I did some more PostgreSQL (or however that’s capitalized) study. I got distracted a lot. I had a really good conversation with Liz in the evening about how maybe the last week of one’s batch isn’t so productive on the code front, because it’s the last week that one is around these PEOPLE. I think I’m changing my tack for the rest of the week.

Recurse Center: week 12, day 1

Here we are!

Had good coffee-walk check-in chats with Aagje and Laïs, whose presence(s) I have been enjoying so much. Talked more about why I want to do what I want to do after RC, and although I’m happy to flip the table if need be, I need to give it a shot first.

I have been developing a different kind of patience here, and a big piece of that is that I am no longer willing to throw myself under the bus in the name of patience. I do believe that I had good reasons for doing it before, but I also believe that that was hella destructive, and I’m putting that firmly behind me.

More time with relational database study today! <3 So good. There’s a piece in the code I edited that I don’t quite understand (it looks kiiiinda like a list comprehension, but not quite), but the rest of it makes sense, and ALSO it works:

posts = ({'content': str(row[1]), 'time': str(row[0])}
         for row in cursor.fetchall())


¯\_(ツ)_/¯

Learned about the inside guts of SQL injection and input sanitization and cleaning up the results of not-sanitizing.

Working inside of Vagrant is starting to make sense, in pieces. Having switched almost entirely to vim for text-editing, I notice some things missing already when I’m inside mah box (e.g. “where are my line numbers?”). But it’s helping me strengthen the muscle memory of certain commands (e.g. :set nu!).

Also went for some good walks (I have my first pair of non-little-kid Keds and apparently they are Taylor Swift edition?, and I went by the Littlebits store, and I went on soup-quest with Sonali and Nancy).

Our friends have been in town, and tonight’s their last night in town. For maybe the first time our whole batch, there’s no Monday night talk, and I’m kind of relieved, because it means I don’t have to skip out on something.

Recurse Center: week 11, day 5

In brief: omg RC is almost over, Vagrant, walking in Chinatown, learning unintended things, manpage sandwiches, and your misandrist terminal

Kind of terrified that there’s officially less than a week left. Came in kind of late today, but then Fridays are optional, and they have a totally different energy. Successfully biked from new-home without getting lost. Different challenges than the old route. The Williamsburg Bridge is WAY more relentless than the Manhattan Bridge — it just goes up, and up, and up, and up — but it doesn’t have the same “bump bump bump” from separate concrete panels that the Manhattan’s got. You win some, and you scratch your head at some!

To my delight, though, both bridges give me a chance to work hard, and then a chance to just fly. They’re a huge part of why I’m even fonder of my bike than I’ve ever been — not necessarily one of the effects I anticipated from biking here.

Back to relational database partytime today. I took a long meandering lunchbreak in the middle (and went to one of the Buddha Bodai places — they are unrelated but have the exact same name, because New York), and I read historical placards, and I witnessed a really sweet art lesson/collaboration/mentoring? in the park, and I found a really awesome no-dumping sign in Chinatown:

And then I came back the extremely long way (“I’ll just stop in here for a minute” is never just a minute), got back into things, and got into trouble!

Okay, not bad trouble. We’re building a tiny fake forum in this class, and I’d spun it up, and apparently didn’t close out of it all the way in the terminal.

I’m using Vagrant with this virtualbox (which, for the record, is a clever way of ensuring your students have a consistent development environment that is likely to work. nice!). And because version control is the coolest, I tried to check git status. Nope; no git in the vagrant box. So I backed out of the vagrant session and tried again. Weird .pyc files and some vagrant configuration stuff, as far as I could tell, but nothing cool and useful that I could see.

I eventually gave up on this, headed back in with vagrant up, and…welp:

Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8000 is already in use
on the host machine.

To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:

  config.vm.network :forwarded_port, guest: 8000, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.

I can translate:

Um, some computers did computer things. Now there is something undead in your computer. It’s your zombie; you deal with it. I have not been trained to handle zombies; I am — hark! — a mere vagrant.

If you want to fix it on your own, you could muck about with something. Godspeed, yo.

Sometimes, I try to fix this. But no. No trying this time. Because it didn’t work.

TO THE GOOGLEMOBILE, THEN

A search for “stop process on port” almost did it; adding “mac” gave me this StackExchange page on the first try.

Things I tried from there:

netstat -anp tcp | grep 8000

I, uh, don’t know what that does (safety alert: don’t run commands you don’t understand, and yes I thought about that when I did this, but it seemed safe enough [famous last words]), but it gave me a line of stuff:

tcp4       0      0  *.8000                 *.*                    LISTEN     

¯\_(ツ)_/¯

Undeterred, I kept looking through the page. (I’ve been amazed at what good information I’ve found in questions closed as “not within the guidelines” on StackExchange.)

Lo, what cleverness is this?

lsof -i:8000

It is a “list [you know, like ls] open files” command and a FLAG and oh yay, look at this output:

COMMAND     PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
VBoxHeadl 31878 liene   34u  IPv4 0xc3c82a3fd2729cff      0t0  TCP *:irdmi (LISTEN)

“But Liene,” you say, “that looks like an opportunity to learn about how to override line width in WordPress!” And you would be right. And it is also not my goal right now, so I’m skipping it. (I love this new version of myself.)

If you wanna see it lined up, though, here’s a visual of the same thing from my terminal:

lsof results

There we go! So clear! Now I’ve got a PID (a process identifier, not the other kind of PID, in case you were wondering). And that’s what I was looking for, so I could use this:

kill -9 <PID>

And voilà. Plugged in 31878 for <PID>, and my vagrant box came right back up (from a full halt, but not needing to download/build anything this time).


I’m thinking it might be cool to learn about what I ran, though.

TO THE PAGES OF MAN (i.e. manpages)

What even is netstat -anp tcp | grep 8000?

So glad you asked.

  • `Netstat` shows network status.
  • -a shows the state of allllll the sockets (even ones used by server processes, which seems particularly relevant here, since it’s a server process getting in Vagrant’s way).
  • -n shows network addresses as numbers, instead of the usual “interpret them and then display them symbolically,” whatever that means.
  • -p shows statistics about the protocol you are toooootally about to give it, except the manpage version sounds like someone is either tipsy or playing Mad Libs, so. (Show statistics about protocol, which is either a well-known name for a protocol or an alias for it.”) I’ll grant that it sounds a little more sensible with the formatting in the page-of-man.
  • That explains what the “tcp” part is for, too! Our friend, the Transmission Control Protocol. I look forward to learning more about tcp stuff later.
  • The pipe (NOW we’re getting to the stuff I already knew!) | just says “okay okay do the thing before this, but then hang on to the result for juuuuuust a second, because I want you to do something else with it.”
  • grep says “I want to find something, but in a difficult command-line way”
  • 8000 plays itself in this saga.

That’s all the pieces of the sandwich. But what does the WHOLE sandwich look like?

  • I want to know some stuff about the network status
  • and I want to know about ALL the sockets and their states
  • and please display network addresses as plain ol’ numbers
  • and I only want to know about tcp stuff; everything else is irrelevant
  • AND once you have THAT…
  • I just want things from the above result that contain “8000,” and I don’t care about anything 8000-free, because that is ALSO irrelevant
  • …okay go!

?

YEAH!

Okay and then “lsof” is “list open files” and then there’s the killing command…

“Wait, Liene. What about the flag on lsof?”

…so glad you asked! lsof has a BUNCH of flags. (Check it out, maybe now! Just like, get all “man lsof” with your bad self. Right now! Or maybe later.)

In any case, good ol’ -i is the only one I care about today.

Turns out the info about it is…well, set a -v flag on this one because it is VERBOSE. Ho ho ho, nerd humor!

It, um, “selects  the listing of files any of whose Internet address matches the address specified in i.  If no address is      specified, this option selects the listing of all Internet and x.25 (HP-UX) network files.”

…or as I first read it, “meow meow files meow meow Internet meow meow meow.”

If I’m right, though, that means this command selects the listing of all Internet and whatever-this-other-thing-is network files. So like, just network files.

You can specify any of this stuff, which looks like hieroglyphics but isn’t the worst (also EVERYTHING is optional, which is what the square brackets are for):

                [46][protocol][@hostname|hostaddr][:service|port]

First two square-bracket pairs can be completely ignored. Now we have half as many problemsquestions!

I didn’t specify an address in “lsof -i:8000”, or it would have been in the bracket-pair that starts with @ (where we could have used a name OR a numeric internet address in dot form), but instead there was nothing there. That means we can ditch that bracket-pair, too.

And ooh, there at the end! There’s a colon. We skipped the service part (the manpage example is “e.g. smtp”), because it wasn’t relevant, but OMG the port part is SO RELEVANT.

So — agh this is so good — that means that “lsof -i:8000” means “list all open files that have an internet port of 8000.”

CRAP COMPUTERS ARE AMAZING ?  ?  ?  ?  ?

And then there’s one more, and the manpage for kill isn’t RAD when it comes to finding out what the -9 is about (I scan for flags! by their names! but it turns out this one is found under “-signal_number”), but it’s not awful. -9 just means “KILL (non-catchable, non-ignorable kill).” I don’t know what “non-catchable” means, but I DO know what “non-ignorable” means, so it’s basically like “okay srs this process has to stop RIGHT NOW right now IMMEDIATELY no takebacks.” -9 means BUSINESS.

Also. If you’re ever like, “ugh, I wish my computer were a misandrist,” and you want to feel like it is, just type “man kill” at the command line and watch how quickly it obeys your command. So anyway your computer is probably a misandrist.

We have friends arriving in town, and I could keep doing this all night, but I need to get home. I barely even got to play with Postgres today! But. I learned a lot more about some cool command-line superpowers. And now man-pages are noticeably less scary.

On another note entirely, to my horror, I sat the whole time I was at RC today, which is usually Not My Thing. And it was awesome instead. Well then. Maybe I’ll work on moving around a bit more this coming week.