My Guide to Killing a Broken Pipe

When I start a server using node, I sometimes get this error: “Error: listen EADDRINUSE :::8092”

To be able to still use the 8092 port, or any other number, without changing my code, I need to kill or stop the process on that specific port, and restart the server:

Type in terminal $ ps -ef | grep node

A list appears. For each line, the first number listed is the process ID

Then type in terminal $kill # (# is the ID number)

Now type in $ node server.js

Artists in the Archive – Excavator

I have a couple ideas in mind. I couldn’t get the code to work but I’ll have more time to attend to it this coming week.

Subject Headings

I tried to run the code just looking at what’s returned in the SubjectHeadings.xml file. I might want to create a project that looks at the first time a subject heading was created, and the first object entered into the collection under that subject heading. Maybe I could bring in news headlines from that same time period. My question is – How does real life get into the collections?

This seems like a big project. I’m not sure how it would turn out! I’d have to interview a librarian about Subject Headings to get a better sense of how they work.

I was inspired by this LOC page, which lists all Subject Headings. The filter on the left seems to suggest LOC knows the general date for some, because I can look at only those made in the 2010s, for example.

While I did inspect the contents of .xml Subject Heading files, I am not sure whether I am seeing records of Subject Headings, or records of objects in the collection? I’m pretty sure it’s the first thing, but it’s not clear.

Either way, I want to know if LOC stores the year Subject Headings are created, and if not, how I might look for the earliest item in the collection for each subject heading.

I struggled to get the code to work, see my error below. It must be something fairly simple that’s not connected in my code.

People’s Biographies

I’m also curious how many people are in the LOC’s collections, but not in Wikipedia? It might be interesting to compare the two and see if there is any difference. I could limit it to a certain period of time, occupation, or gender. At the end, I might share the list with groups who get together to add entries to Wikipedia.

I’d need to keep in mind that this idea is more about critiquing Wikipedia than the LOC.

I could flip it, and see how many people on Wikipedia are not in the LOC.

Examining the LOC with a Critical Eye

Along the lines of the last idea, I find it hard to critique the LOC’s holdings without comparing it to something outside it, which means bringing together two data sets. I’m interested in trying it but want to talk through what this looks like.

My Guide to Javascript Objects with Functions in Them

In the open source code I’m using, there are lots of functions declared like this:

onNewParticipant: function(numberOfViewers) {
document.title = ‘Viewers: ‘ + numberOfViewers;
},

In larger projects where you want to scope as much as possible to prevent overusing variable and function names, you want to create objects that have functions inside of them.

People on StackOverflow informally explain here that writing loose functions willy nilly is “90s”.

More formally, Mozilla explains the many ways you can write objects and functions here. They say that a method is a function associated with an object. Said another way, methods are properties of objects. These special types of functions are defined the same ways as normal functions, except they have to be assigned as the property of an object.

Below this example starts with the object’s name, the method name I want, and the function name I use for the method name.

objectName.methodname = functionName;

var myObj = {
  myMethod: function(params) {
    // ...do something
  }

  // OR THIS WORKS TOO

  myOtherMethod(params) {
    // ...do something else
  }
};

You can then call the method in the context of the object as follows:

object.methodname(params);

My Guide to Adding Node.JS to My Project

My Challenge

To remind myself for all eternity how to add node.js to a project that will live remotely on a server, and not able to access the version of node.js that’s on my local computer.

What is node.js?

Node allows JavaScript, originally a client-side programming language processed in the browser, to be used as a server-side language.

Why do I need it for my project?

I want to run a little server to handle visitors’ requests to my website, and I want to write it in Javascript. Node.js will allow my javascript server to perform this “server-side” functionality.

I also need node.js inside my local project because it’s going to live on a remote server, without access to my globally installed node.js on my computer.

How do I add Node.js to a local project?

I’ll use npm (or “node packaged models”) as a tool to install node.js into my local project. npm can install the node.js packages I need in local or global mode. In local mode it will install packages in a node_modules folder in my project’s parent working directory.

Use this npm webpage to find the latest commands.

But generally all I need to do is inside my project’s working directory in terminal, use $ npm install node.js ($ npm install <package_name>).

One extra step

Then put the created package.json file and node_modules folder onto my remote server, so that my html and javascript files have access to them. I do this by opening up the application Fetch, and dropping in the files.

How do I check for updates?

Check NPM’s webpage here for the latest commands. Generally, first check that I have node and npm installed. To check if you have Node.js installed, run this command in your terminal.

Note: This command checks whether node.js exists globally on your machine, not whether a copy is saved in your project folder that will exist on a remote server. I need both.

node -v

To confirm that you have npm installed you can run this command in your terminal:

npm -v

npm is a separate project and updates more regularly, so update your npm. To update your npm, type this into your terminal:

npm install npm@latest -g

How do I make sure I’m using a LTS version of Node.js ?

Not sure yet.

Should I use a Node.js version manager?

Probably?N

Is there a way to switch between versions of node and npm?

Yes

How do I switch my project over to run forever?

Full instructions here.

Type $ npm install forever -g

Then type forever start app.js

My Guide to How Live Streaming Media in the Browser Will Work in My Project

The Challenge

With this guide, I am to explain to myself the higher level flow of how live streaming media, or audio in my case, is being sent by my project’s website from a speaker to a listener.

What is Live Streaming Media?

Live Streaming Media looks like …

  • Watching the Kavanaugh court proceedings live on the New York Times
  • Listening to a live Carnegie Hall concert on the radio station’s WQXR’s website
  • or watching a live Youtube feed of cats playing or sleeping…
  • [I did all of these things recently]

You are enjoying live streaming media in the browser. The technology that allows all of this is WebRTC… at least I think. Perhaps in some cases they aren’t using WebRTC?

What is WebRTC?

Coming. More here. https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling

And here. https://www.html5rocks.com/en/tutorials/webrtc/basics/

And here. https://codelabs.developers.google.com/codelabs/webrtc-web/#0

What kind of server do I need to use WebRTC?

From what I can tell, I need a javascript file (called server.js) that describes the behavior I want my remote server to carry out. It seems I’ll be using the word “server” a lot, but sometimes I’ll be referring to my server.js file, and other times to my remote server that is hosting all my files.

Based on further research, it looks like people tend to use the words “Signaling Server” to describe the type of behavior I want from my javascript file (?).

A signaling server takes care of a lot of things when one user “calls” another, asking for a live media stream. (The live media stream can be video, audio or both.)

What does a Signaling Server do?

A Signaling Server fulfills an essential function that the WebRTC API does not handle: getting two users connected in the first place.

This type of server lets two users transfer initial introductory messages before they have access to a WebRTC peer connection. This type of communication is called signaling.

Do I have to build it myself?

Yes. The people who wrote the WebRTC APIs (there are three) decided to not handle initial connections, allowing others to set this part up exactly as you please.

Do I really have to build it myself?

Not literally. Actually, most examples I’ve found use the socket.io library to handle signaling for them. As will I!

What are different options for setting up my Signaling Server?

@Mauz, who I am forking super helpful code from his Web RTC Experiments github repos, has a helpful page about all of this.

He suggests using either Socket.io/WebSockets (what I’ll use, like him), XMPP/SIP, PHP/MySQL, WebSync/SignalR, PeerServer/SignalMaster or other gateway.

If people want, you can bypass socket.io and use your own signaling gateway/implementation.

What kind of messages does my Signaling Server need to send?

The bread and butter: the list below is taken from an article by HTML5Rocks.

  • Session messages to begin or end communication.
  • Error messages.
  • Media settings, such as video or audio, the formats to encode media with, bandwidth.
  • Key data for secure connections (how does this work?).
  • Network data, such as a host’s IP address and port as seen by the outside world (what does this mean?)

Once User 1 calls another User, the server needs to pass the offer from User 1, pass the answer from User 2, pass the ICE candidates (more soon) between them, and set up the WebRTC connection.

Below is a nice infographic from Tutorials Point.

Building the Server
A diagram showing communication patterns between User 1, a Server and User 2. Borrowed from Tutorials Point website.

What is RTCPeerConnection?

Not sure yet, do I need to know?

What are STUN and TURN Servers?

Not sure yet, but I might need to know… these servers apparently help users who can’t connect by the most direct route possible, and instead need to traverse NAT gateways and firewalls because direct connection fails. Are these reasons why my friends with AT&T couldn’t connect without local wifi outdoors in Washington Square Park?

It looks like the WebRTC APIs use STUN servers to get the IP address of your computer (why?) and TURN servers to function as relay servers in case peer-to-peer servers fail.

How to Actually Build X

Steps I Need to Take

I started a guide for myself here.

References and More Reading

X Y Z

Future Topics

X Y Z

My Guide to Securing My Project with HTTPS

The Challenge

My goal is to get my code accessible by anyone on the internet, yet prevent anyone else from knowing who visited my site, or seeing any data in transit from them to my server. I hope I can also prevent my visitors’ data from being saved on my server, or prevent my own server, with possibly their data on it, from getting hacked.

Will HTTPS get me there?

Ostensibly, yes. From my understanding, HTTPS is the first major step to prevent bad actors from eavesdropping, tampering, and message forgery on my site.

To be honest, I don’t yet how “safe” HTTPs really is. Can I, the owner of the server, see who is visiting my HTTPS site? How can I not do this? How can I prevent others from hacking my server?

Along these lines, I’ve read that people can modify HTTPS’ security parameters to their liking, which seems to defeat the purpose of consistent and safe browsing on the internet. Maybe it’s not as much modification as it first sounds like. But I need to find out what kinds of security parameters I will add to my site.

Generally, though, HTTPS is the accepted standard. Even Google Chrome wants me to know which sites are secure or not. Interestingly, my WordPress editing page is not secure.

So, what is HTTP?

HTTP is a protocol that sends data between a visitor’s browser and a website. (HTTPS stands for Hyper Text Transfer Protocol). HTTP fetches resources to show on your browser when you visit sites.

And what is HTTPS?

Adding an S on the end signifies the protocol is secure (Hyper Text Transfer Protocol Secure).

HTTPS is secure because it uses additional protocols, most commonly TLS (Transfer Layer Security), to apply encryption to the client’s data.

What is TLS?

TLS offers authentication, encryption, and integrity. It confirms the identity of the server and user. It encrypts any data passed back and forth. And it ensures the data is not lost along the way.

How does HTTPS/TLS check for identity?

HTTPS/TLS helps your browser check a website’s server’s digital certificate to see if it was issued by a trusted organization (important because otherwise anyone can create a certificate claiming to be whatever website they want).

The certificate is used to confirm identity. Specifically, a digital certificate is a data file that links a private cryptographic key to an organization.

You’re Not Done

To modify your server’s configuration of TLS, Mozilla recommends using newest cryptographic tools available for the browsers you want to connect to your site. There are basically three options, each allowing you to work with older and older browsers if needed.

Once you use a configurator tool like Mozilla’s to find a TLS set up that’s best for your visitors, it looks like you enter the provided TLS text inside an appropriate file on your server and restart the server. You need to review the new TLS text in your file to add correct domain names.

How to Actually Build a Site with HTTPS

The ‘Moving to HTTPS Guide‘ is a good overview & how-to for switching over. … Or at least the Mozilla Foundation recommends it, and I trust Mozilla!

You can find the actual configuration options and associated code at Mozilla’s configurator tool here.

I’m unclear if using CertBot’s command-line level application to get a HTTPS key and certificate removes the need to use Mozilla’s TLS configurator tool above? Or do I also need the TLS protocol text provided by Mozilla?

Steps I Need to Take

I started a guide for myself here.

References and More Reading

Mozilla Foundation’s webpages on TLS, HTTP (or how a lot of the internet works, and specifically HTTPS.

Future Topics

Cookies – I don’t need cookies since my visitors won’t be logging in and want anything saved for later (requires cookies to remember state information for the stateless HTTP protocol), and I don’t want to save or analyze my visitors behavior.

Web Analytics – Do I want to know how many people visit the site? Can I accomplish this without google analytics?

Artists in the Archive – Remix

Here is my remix of Jaekook’s tree project.

Despite many things gone awry in the demo (not a fan of CSS at the moment), it does demonstrate the main features of my concept: slowly fading images in conversation with each other, and the ability to submit a word that changes the images.

Below you can see an illustration of my concept. The title is: Design Prototype, Our Lives In Trees”, an outdoor installation by the Muir Woods National Monument and the Library of Congress (LOC).

See below for more description.

Illustration as described in blog post.

The installation aims to explore what trees represent to us, through comparison of photographs that also speak to the surrounding environment of the awe-inspiring Muir Woods National Monument. Perhaps the installation might also expose a strange contrast between how humans use trees in their own lives, and the incredibly critical role trees play without us in the history of the planet’s ecosystems.

Along the main walkway and entrance to the park, projection screens are installed. On each, two images are slowly fading in and out in an opposite pattern, according to my my demo. One image is of a tree from the Library of Congress’ collections, and the other is chosen based off a previous visitor’s word associated with trees, also taken from the LOC collections.

Dawn and Dusk installation, when the light is low and magical.

  1. Entrance to park: The main walkway is installed with projections that display two changing images, one of a tree, and another based off a word submitted by the previous visitor.
  2. At the end of the walkway: A kiosk is in place for visitors to submit their own word.
  3. The projection screen right next to the kiosk shows the visitors submission to themselves.
  4. Traveling Submissions: Images slowly move back down to the start of the pathway for visitors entering the park to see.

Artists in the Archive – In a Haystack

IN A HAYSTACK: Using only the search mechanisms available on loc.gov, find one item or collection of items and write a short ‘portrait’ of the object. What is it? How was it made? Who created it? How did it end up in the Library’s collection?

You can read my initial impressions of using the Library of Congress’ (LOC) site here.

Here is my portrait of one item in the LOC.

Letter from Wilbur Wright, of the Wright Brothers, to Octave Chanute.

This letter was the very first item I found. I couldn’t believe it. What a first sentence to read!

“Dear Sir; For some years I have been afflicted with the belief that flight is possible by man. My disease has increased in severity and I feel that it will soon cost me an increased amount of money if not my life.”

Wilbur Wright

Wilbur Wright, one of the ‘fathers of modern aviation,’ wrote this to Octave Chanute. Chanute was an aviation pioneer who supported the Wright brothers.

… I found this written correspondence because I thought the name “Octave Chanute” in the category of the letter “O” sounded interesting, when I was perusing the LOC’s Finding Aids.

At the time Wilbur Wright wrote the letter, he did not know Chanute. Wright is convincing Chanute that he knows enough about aviation to be taken seriously. The letter became one of many from the Wright Brothers kept by Chanute, despite the Wright brothers apparently keeping nothing.

Without these letters, we would know very little about the invention of the airplane by the Wright brothers. Chanute donated 10,121 items to the LOC.

The power of written correspondence is palpable in the LOC collections. Do emails today collect the same sentiments as written letters?

Also, this letter was written in 1900 — a nice round number! In 1900, the U.S. population was 75 million. Now it is 325 million. Ford Motors was founded three years later. The year before in 1899 the country’s first juvenile court was founded.

Helpfully, this item is listed as part of the American Memory category, which led me to this series “Today in History“.

Artists in the Archive – Initial Research

When I look through the Library of Congress’ (LOC) website, I am mostly struck by how much life in the United States has changed.

The act of combing through the LOC forces me to expand my mind’s eye to encompass it all, and somehow it feels alienating. Where are we today in 2019, and what does it all mean?

The website tossed me around the collections, link by link. The experience created a cognitive dissonance as I flipped between the massive national narratives we tell ourselves, and the unexplained randomness of other items and people.

Below are some of the highlights that spoke to me.

One Room School House, South Pass Avenue near Jefferson Street, South Pass City, Fremont County, WY

This photo was the 7th or 8th item I looked at, and I immediately felt like everything in the LOC started to hang together. This one room school house created a sense of place, whereas the catalog’s links left me feeling unmoored.


Brian Diskin from IWU Local #380, Urbana-Champaign, IL. Diskin was interviewed and photographed at the 2011 IWU National Iron Workers Convention at the Sheraton Hotel on the Chicago River in downtown Chicago.

I found it to be refreshing to see a real person in the collections.

This man Brian Diskin was interviewed in 2011 as part of the Occupational Folklife Project, which documents the culture of contemporary American workers during an era of economic and social transition.

A Recipe for Project-Based Learning, a blog post for teachers about cook box recipes. It would be fun to make a project about recipe instructions.

Lomax Collection, 400 snapshot photographs made in the course of sound recording expeditions carried out by John Avery Lomax, Alan Lomax, and Ruby Terrill Lomax, between 1934 and ca. 1950.

I didn’t know the Lomaxes also took photos when recording American musical life!

Horned Owl|Josh, John (performer), Seminole Indian Reservation, Florida

It was hard to find audio in the LOC that I could actually listen to. Maybe I missed a link here or there.

The Great Train Robbery, Edwin Porter, 1903

Fun to see early film : )

Quilts from three contests in the 90s in the United States. I’m surprised the image aren’t online. But there are images from the “Quilts and Quiltmaking in America, 1978 to 1996” collection held by the American Folklife Center.

Birthday related images, might be fun to make a chrome extension or website for people to send birthday images.

Could be interesting to make a project around food, by searching for dishes. Here are returned images for the search term “salad”.

Images with no title are intriguing. Many come from the Farm Security Administration’s collection of photos from the 30s.

There are worker’s rights songs from Bakersfield, California in the 40s.

Vietnam-Era Prisoner-of-War/Missing-in-Action Database

Library Offers Largest Release of Digital Catalog Records in History. 25 Million Free Records of Bibliographic Metadata.

Not at LOC, but cool: 52,000 index cards of jokes from the Phyllis Diller Gag File.

Not at LOC, but cool: 8,000 documents from Eleanor Roosevelt’s “My Day” columns

Brighton Beach photos.

ACLU Hate Map for US.