Seperis (seperis) wrote,
Seperis
seperis

  • Mood:

monday of the week after

Back at my apartment, and most of my (very large) complex is up and running, though some buildings are still having problems with power and/or water. Austin is under a boil notice, so our complex has an empty apartment where you can pick up water, but fortunately my mom sent over bottled water for me and Child so I don't have to take away from those really in need.

(Personally I think those without power and/or water entirely should be sent giant care baskets complete with whiskey as needed because holy shit.)

School

School was canceled all last week and up to Wednesday, so first week assignments aren't due until next Monday (March 1st). Last Tuesday, before they made the announcement killing first week, I desperately did and turned in both first week assignments and started second week for Intro to Computing as quickly as possible. However, of the two distance learning classes, it's the most self-paced so it probably isn't affected which is a shame; it's kind of sometimes--boring.

Intro to Computing - the Drama
Okay, so here's the problem: it's a required class for the AAS or BAS, and it's important in that it hits that vast array of knowledge of computing in the 21st Century just in case you don't know some of it. I get this is important and is going to go into details I don't know, and I need it.

But.

I have the privilege of having been inducted into fandom in 1998, and for those of you in fandom in 1998, everyone wasn't just computer literate; it was like eeevverryyone but me had PhD's in Computer Shit and the Internet Thing. So to do what I really wanted--write porn about Tom Paris and B'Elanna Torres like anyone sane--I had to learn things like 'webpages' and 'mailing lists' and how to post to usenet and 'search engines'. And as fandom is always two steps ahead of the general population, I had to learn backward as well as forward at the same time. So a lot of the class so far is very much like a technical re-reading of my literal internet history, so much so that I keep glazing over when reading and missing the technical terms I actually don't know and need to that are basically defined by 'your life circa 1998 to 2003 as we talk about the Early Web'.

The thing is, I was twenty-one when I got online; I don't actually remember how things worked before I had the universe at the click of a keyboard. I mean, if you had a gun to my head and told me to relive my childhood RIGHT NOW I remember 'pen pals' and 'encyclopedias' and 'microfiche searches of multiple libraries to find this book I really wanted when I was in my teens'. I remember it as a thing that happened, but I don't remember entirely what it was like to live in. Now I think of it in horror--the frustration! the annoyance! the hellscape! the SLOWNESS!--but in my teens I didn't have any other context so best guess it was those things but like, in the context of 'normal life' not 'how did I survive?' My digital citizenship may not be from birth, but my entire adult life has been here; I've gone native.

The Office modules are an entirely different story. They're all about the basics of Excel, Word, Powerpoint, and Access and how to use them effectively.

I use Office very much--I have folder named Spreadsheets that is stuffed with the beauty of Things I Like to Turn Into Spreadsheets; I write my own VBA for Excel and Word. I have personalized settings saved into Normal.dotm to set my Normal style and in it are modules with an array of functions and subs I use commonly so they're available to any document I open and assure all my documents are saved in the exact same template. In Word and Excel, when I upgrade computers here or at work, I have a list of settings I immediately change in Options, on the ribbon, in the Quick Access Toolbar, registry edits I make, changes I make in accessibility...I barely even think about it.

However, I also skipped over Vast Tracts of Basic Shit I Never Cared About Because I Didn't Ever Use That. Which has more than once been a problem but not enough for me to learn more than just enough to make a note to "Do this thing whatever it is when that happens, no idea". There are quite a few of those, by the way. For a surprising number of what most people would call basic tasks, I know nothing.

Not anymore.

The Create a Flyer Project was a trip; I found things like Borders and Glow and on the ribbon there's a single button that changes everything to All Caps or All Lower or All Something Else, did y'all know about that? So the Office Modules are incredibly exciting because they're--for me--Brand New Information as taught to probably first graders these days. There's Themes and Colors and basically I'm having a super good time; for the first Word Module I did all the optional exercises just to see what else you could do to a flyer (beveling pictures with round edges and shadows at Blue Accent 2 25% Darker!!!!); it was great. Next Word Module is How to Make a Research Paper and the third is Enhancing Documents (?!?!!?!): I am at the edge of my seat. The three spreadsheet modules I'm almost slavering for; what magic will I learn there??????

And while Access I sort of have used (years ago), it and Powerpoint are effectively Here Be Dragons on my mental map of Office and just--can't wait. At all.

It's the non-Office stuff that's getting to me.

I am learning technical terms and concepts and also there is stuff I don't think I knew, and I missed two questions--TWO--on my first test and got a 23/25 instead of a perfect score so obviously I need to study much harder (when I wanted to retake it--you get at least one retake, highest score is selected--Child told I had lost my mind, but I am not entirely reconciled to this stain on my grade).

Just. Brain-glaze. Ugh.

Fundamentals of Programming - Less Drama

This class is actually on a regular weekly schedule, which means I can't jump ahead (Project 2 hasn't been posted), which means I am going out of my mind. I want to do everything and reading ahead just doesn't cut it or doing the practice exercises to entertain myself until the next project comes out, and if you're baffled on why, I'll tell you.

Coding is probably the highest form of entertainment to me, second only to writing and not by much. This can be a problem.

I already write in Python, and probably I could read straight through doing exercises and learning it without need for Projects to guide me (I just go back and complete the projects as assigned). But: I need to learn it right.

The same problem I have in Office above comes up for me in computer languages; at least in coding, my pattern recognition works extremely fast. Variables, functions, structure: once I've identified each, I start editing immediately, and once I hit a certain edit point (when I rewrite an entire script into something else entirely and realize hey) I start writing from scratch. I learn the advanced level coding--to do something new, you kind of have to--but there vast, vast tracts of basic stuff that if I use it, I just copy paste or memorize without actually understanding it; if I don't use it, I don't know it exists. Which means I am far too often surprised by behavior I didn't predict because I have no idea of a basic principle. And much like Word, I google, correct it, add a paragraph comment explaining it and where I found it, and go on.

My best example of this phenomenon is regex and related concepts.

It's ridiculous, but I have to google the base principles every time and actually have at this point a copy/paste library. And I have, actually, used it enough (dear God enough) to have at least by accident learned it, but my brain, for reasons unclear, does not consider it coding but a really annoying convenience.




#!/bin/bash
# Get list of movies
# updated 2/20/2021

# Paths
mPath=/media/movies
mPath2=/media/movies2
mPath3=/media/movies3
dPath=/home/jennifer/moviedata

# Files
dFileName="moviesListA.txt"
dFileName2="moviesAllA.txt"
mName="*"

# Text
text="Last Update: "
text2="Count: "

# Other
date=$(date +%m/%d/%Y::%T);
a="/"
t="."
u=" "
f=","

# do not
lostDir="lost+found"
moveDir="1.movies.move"

# directory
mDir=$mPath$a$mName
mDir2=$mPath2$a$mName
mDir3=$mPath3$a$mName

# file names
movieFile=$dPath$a$dFileName
movieFile2=$dPath$a$dFileName2

# erase existing info
cp /dev/null $movieFile
cp /dev/null $movieFile2
echo "Files erased."

# add to movieFile
echo $text $date 1>$movieFile

# get data
for movieDir in $mDir $mDir2 $mDir3; do
	# get directory path without *
	# remove everything after the last /
	aPath=${movieDir%/*}

	# get root folder
	# remove everything before the first  /
	mRoot=${aPath#*/}
	# remove everything before the first / in mRoot (media)
	movieRoot=${mRoot#*/}

	for dir in $movieDir; do
		# do not check these directories
		fullLostDir=$aPath$a$lostDir
		moveDir=$aPath$a$moveDir
		if [ $dir != "$moveDir" ] && [ $dir != $fullLostDir ] && [ -d $dir ] && [ "$(ls -A $dir)" ]; then
			# get file subdirectory
			subMovieDir=$dir$a$mName

			echo
			echo "Subdirectory found."
			# FORMAT SUBDIR NAME
			# remove everything before the last /
			xdir=${dir##*/}
			# remove extra dots and spaces
			locDir=${xdir//$t/$u}

			for file in $subMovieDir; do
				if [ ! -d $file ]; then
					# GET FILE NAME WITH EXTENSION
					# remove everything before the last /
					xfile=${file##*/}
					fileName=$xfile

					# GET FILE EXTENSION ONLY
					# remove everything before the last .
					fileExt=${xfile##*.}

					# check for non-movie files
					array=("nfo" "jpg" "gif" "txt" "srt" "json" "xml")
					arrSize=7
					ai=0
					for ix in ${array[@]}; do
						if [ "$fileExt" == $ix ]; then
							continue;
						else
							let ai=ai+1
						fi

						if [ $ai -eq $arrSize ]; then
							# GET FILE NAME ONLY
							# remove file extension
							# remove everything after the last .
							afile=${xfile%.*}

							# EXCEPTION CHECK - movie names with hyphens
							# remove everything after the first dash
							exType=${afile%%-*}
							if [ "$exType" == "spider" ] || [ "$exType" == "et.the.extra" ] || [ "$exType" == "ant" ]; then
								movEx="y"
							else
								movEx="n"
							fi

							# GET MOVIE RESOLUTION ONLY
							# remove movie name
							# remove everything before the first dash
							xtype=${afile#*-}

							# if movie name has hyphens
							if [ "$movEx" == "y" ]; then
								# remove everything before the first dash in xtype
								atype=${xtype#*-}
							else
								# set to common variable
								atype=$xtype
							fi

							# remove extraneous data after resolution 
							# remove everything after the first dash
							btype=${atype%%-*}
							
							# check for 4K movies
							# remove everything after the K
							ctype=${btype%%K*}
							if [ "$ctype" == 4 ]; then
								# 4K movie
								# add K back in
								movieType="${ctype}K"
							else
								# not 4K movie
								# remove everything after the p
								dtype=${btype%%p*}
								# For 2160p, 1080p, 720p, 480p
								# add the p back in
								if [ "$dtype" == 2160 ] || [ "$dtype" == 1080 ] || [ "$dtype" == 720 ] || [ "$dtype" == "480" ]; then
									# add p back in
									movieType="${dtype}p"
								else
									movieType=$ctype
								fi
							fi

							# GET MOVIE NAME ONLY
							# remove movie resolution
							# if movie name with hyphens
							if [ "$movEx" == "y" ]; then
								# remove extra data after resolution
								# remove everything after the last dash
								xname=${afile%-*}

								# for spiderman into the spiderverse
								if [ "$exType" == "spider" ]; then
									# remove everything after the last dash in x2name
									aname=${xname%-*}
								else
									# set to common variable
									aname=$xname
								fi
							else
								# remove everything after the first dash
								aname=${afile%%-*}
							fi

							# GET YEAR ONLY
							# get year from movie name
							# remove everything before the last period
							movieYear=${aname##*.}
							# format year
							formYear=" ($movieYear)"

							# FORMAT MOVIE NAME
							# remove year from movie name
							bname=${aname%.*}
							# remove extra dots and spaces
							formName=${bname//$t/$u}
							# join name and year
							movieName=$formName$formYear

							# GET DATE AND SIZE
							# get date
							xdate=$(stat -c %y "$file")
							# remove everything after the last space
							movieDate=${xdate%% *}
							# get file size
							movieSize=$(stat -c %s "$file")

							# output to files
							printf "%-60s %-20s %-15s %-15s %-60s %-10s\n" "$movieName" "$movieSize" "$movieDate" "$movieRoot" "$locDir" "$movieYear" 1>>$movieFile
							printf "%s\n" $movieName$f$movieSize$f$movieType$f$fileExt$f$movieDate$f$movieRoot$f$locDir$f$fileName | paste -sd ' ' 1>>$movieFile2
						fi
					done
				fi
			done
		fi
	done
done
echo
echo "Done"
exit 0




Explanation
So this script searches my media directories for all movie files, removes the path, then takes apart the file name. My name template is [movie name].[movie year]-[resolution].[extra information].extension.

Example:
spider-man.into.the.spiderverse.2018-4K.extended.edition.mkv

It's a variation of the standard naming scheme for Plex, but I use periods in the place of spaces in movie name and extra information and to separate the movie name from the year (instead of using () around the year) This is because I generally only access my media files using command line and didn't want to mess with strings so simplified into something I could type without hitting shift or remember to use " ". Plex recognizes it for sorting and metadata retrieval, so I'm keeping it.

The code breaks down the file name for a text file and a csv file into Movie Name, Movie Year, Resolution, Extra Information (that I don't need in the spreadsheet so gets deleted), extension (that gives me the specific container), and then some extra code at the end to get date added and file size. The csv file I import into excel, where it's sorted into a master list of all movie files.

(One movie can have up to I think six files for multiple resolutions and added AAC versions. If 4K, a 2160 file that's a sane size if I really want to stream it remotely and also includes AAC versions of all non-Dolby audio streams if it's DTS; a 1080 bluray also needs an AAC compliant version because a lot are DTS only, etc.)

If you're wondering what the problem is, scroll down to first do statement and note all the #comments. Specifically the text of them. Specifically, how many are explanations of what a single small piece of code assigned to a variable does. The same piece of code, in multiple variations.

Example:

# remove everything before the last period
fileExt=${xfile##*.}



There's only four variations of this. Before first, before last, after first, after last. The only things that change between these functions are which of these (#, %), how many (1 or 2), and the location of the * (before or after the dividing character).

Again: there are only four variations of this. Four.

Variations:

# remove everything before the first /
mRoot=${aPath#*/}

# remove everything before the last period
fileExt=${xfile##*.}

# remove everything after the first dash
aname=${afile%%-*}

# remove everything after the last period
afile=${xfile%.*}



I cannot remember them for love or money. That's why every single one not only says 'what specifically I'm removing' but also 'exactly what this tiny piece of is doing to make that happen'. I just checked and some of my comments are wrong (again) because I cannot identify which is which just by looking and have to read the definitions (again) to remember.

This is an example of something I first memorized because it was basic, I only needed it for this one thing once, and now cannot make pattern recognition add it to knowledge base. I can see the goddamn pattern--this is not rocket science--but I can't internalize it enough to recognize one of those four in isolation (or which is which of those four when seen together without notes). Except the *, which is because it matches before (it's before the split character if splitting before, after if splitting after) but I have to think about it to make it happen and keep double checking. It's not that I can't see how it relates to each other; my brain simply will not do it. I can memorize it, and that will work for the discrete session I am writing or editing the script; it will be gone the next day or after I sleep.

I will learn it--eventually--but for reasons unclear to me, frequent usage won't help (this script has been refactored and updated multiple times over two to three years and items moved around quite a bit). One day, for no reason, I'll open this one and suddenly have no problem reading those pieces of code the same way I read the rest, or read a book; that day, however, is not today.

That first printf statement? I know what it does--it's printing to file in columns of x spaces--but I can't take it apart without referring to my notes. If I want to do this with other data, I'd copy paste and very carefully change the numbers. It simply doesn't stick.

This problem happens a lot.


Yeah, that was long.

Anyway, with this Python class, I have an opportunity to be force-paced by the instructor and the lessons to learn first principles instead of jumping ahead to 'Thing I Want to Design' and cheerfully write sixteen nested loops with random if/elif/else or switches. So I'm carefully reading every word of every lesson and examining the examples and using the class structure to avoid jumping ahead and indicating to my brain to discard something as 'unimportant details'. It is interesting, this works for my brain; if i jump ahead too much, however, my brain can and will start deciding what is 'just details' and I am screwed again.

Will this way work? It should: that's how I learned C++. Granted, that was an entirely new language to me at the time, but I'd been writing Javascript enough that it was less unfamiliar territory than a new dialect with a compiling chaser. I can still read all my C++ programs perfectly; all I need to refresh myself is checking my notes, and back then, my notes weren't exactly illustrative.

Other News

Nothing really. Work today should have most of us back, so we'll find out the damage to this sprint. I can't even judge what the decision will be or if they even have one yet; last week was--would have been--Week Two of a four week sprint for a March release. They might decide to scrap it and start everything over at Week One starting this week; they may scrap some items and leave other that didn't require a lot of code changes or already had the code changes done in Week One; they may scrap nothing and just do four weeks of work in a badly interrupted three weeks for everyone. I don't even know if all our data centers are up, if they stayed up, if they went down and came up and error checking found them fine, if they're still error checking....

For that matter, production will take precedence; it's possible they'll scrap the sprint and send us all back to All Regression Testing All the Time to make sure everything in production works which is like if boredom was an Olympic Event.

Oh yeah, can't wait for that. Posted at Dreamwidth: https://seperis.dreamwidth.org/1086189.html. | You can reply here or there. | comment count unavailable comments
Tags: #comments, coding, jenn's life, school
Subscribe

  • sgafic(ish): silver

    The thing is, when one is feeling blocked, one should write porn. Or at least rewrite it. Or perhaps rewrite it and think, right. This will totally…

  • sgafic: I Hear and I Forget

    Annnnd. Writer's block broken, editing complete, reclaiming my energy (and a less homicidal state of mind as well).... Title: I Hear and I Forget…

  • my life, it is symbolized by wednesday

    Tell me it is wrong to blow off work to seriously go through my lj and start a tragic tagging campaign that can only end in svmadelyn

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment