William Theisen - Blog

Enter Skynet

Robots are evil



I grew up in the midwest and rust belt. I hate automation.



April 09th, 2018

Ethics Reading: 08

Cyberpunk is dead



I am very against large corporations. One of my pet peeves is when people expect corporations to do the ethical or moral thing. For profit corporations exist to make money, that is their purpose. In my mind, the government and corporations exist as sort of counter balances, corporations provide products for the people, and the government protects the moral and ethical needs of the nation. There is absolutely no real reason that corporations should act ethically and to think otherwise would be childish. I’m not saying that we shouldn’t provide a reason for them to do so, but appealing to common human decency is a good way to end up angry and taken advantage of. As an aside, I lean towards the political theory espoused towards the end of Dune Messiah so I wouldn’t really take my word on any of this.
This view means that I don’t think IBM did anything wrong by doing business with the Nazi’s and if a corporation makes a decision based on the ethics of their C-level execs I have no problem with this, as long as it is not disobeying a governments orders. I do think that government should stand above corporations and citizens as well. I don’t like the idea of corp. lobbyists having so much sway. I tend to view corporations through the lense of someone whom likes the cyberpunk genre, where all the “mega-corps” are these massive, amoral entities that are purely self interested. These stories are almost always the “man” versus the faceless corporations.
All of this being said, it’s not like I don’t buy things from corporations. I’m an Amazon Prime member and I use google and Facebook every day. I just think it’s stupid to get angry when these companies do something that’s “unethical”. I just assume that these companies are out to take my money and that there’s no good reason for them to do anything else.
I guess it may just be edgy teenager cynicism on my part but that being said I just don’t think that the penalties imposed on companies are strong enough to get them to do the ethical and moral thing. The fines that get put on the companies are just a drop in the bucket compared to the incredible amounts of money that they make. Last year amazon paid 0$ in taxes. These companies are taking complete advantage of every loophole they can and I think the government needs to come down hard against them. Only then will they do the ethical and moral thing.



March 19th, 2018

History Reading: 06

Muh Graphix



My motto is if you’re going to have graphics make sure they’re well done or don’t have them at all. I don’t think graphics are strictly necessary for a game to be good. I really enjoy playing older games like AOE II and Stronghold which are older games with what would be considered ”outdated” graphics by today’s standards. However what’s most important to me is the gameplay. If the gameplay is good I can be very lenient in terms of graphics. That being said there is a line, if the graphics are just bad I can’t get myself to play it. I don’t know how many times I’ve tried to get into DF and I can only get myself to play that game if it has a tileset no matter how excited I get to play it.
I think today a lot of focus is placed on graphics for the newer blockbuster games. Games like Destiny and COD look absolutely incredible. The games suck though. Good graphics don’t make a good game, game play makes a game. That’s literally in the definition. That’s why I can enjoy board and card games so much. The art for MTG is very good, but the art isn’t what makes the game fun. It can only make an already good thing better. Euro games have very simple artwork normally and those are my favorite kinds of games to play.
When it comes to movies I’m much the same way. I enjoy a lot of movies that have next to nothing in terms of graphics. Movies such as Casablanca, The Godfather, The Social Network, and 12 Angry Men have very little in terms of “graphics” and yet these are some of my favorite movies. This is not to say that I don’t like movies with CGI such as the Matrix, or Blade Runner are fantastic. I just think that bad CGI is worse than no CGI as is the case in Dark City or the toboggan scene in Grand Budapest (Still a favorite movie though). I hold this belief so strongly that I actually spent a lot of time getting the “despecialized” version of the original Star Wars trilogy. These special versions try and get as close to the theatrical release as possible and remove many of the awful CGI additions that George Lucas later made to the Movies like Jabba the Hutt in A New Hope or the band at Jabba’s palace. By removing these things the visuals of the movie are more streamlined and you’re not taken aback by random terrible CGI being inserted into shots.
For me “graphics” are more of a spice that goes on top of a main dish. If the dish is good the spices can make it better, and the dish would still be good without the spices. If you get the wrong set of spices though you can completely ruin the dish, even if it was originally good (George Lucas additions, DF).



March 19th, 2018

Ethics Reading: 05

Suprise people are taking advantage of you



At the fundamental level I don’t really have a problem with whistle blowing. I think that in some extreme cases it is a necessary action. However there are two complaints I have with it. My first problem with it is that often times people are surprised at the consequences, and can’t believe that they, or their whistle blowing heroes are being persecuted so heavily by these evil governments and corporations. I think people are too quick to absolve their idols of all their sins and have trouble looking at both sides of the situation while remaining objective. Every action has consequences and when you sign a contract you are legally bound to that contract. You leaking information is in direct contrast to the contract you signed and you will have to live with the consequences of your actions.
My second complaint is with the idealistic nature of most of these people. They think they’re going to be a hero and that they can’t believe the corporations and governments are doing these horrible things, oh my goodness the people need to know that they’re being taken advantage of. It all really comes down to how you think about the world I suppose. I’m quite cynical, surprising I know, and so I always have trouble understanding why people get so worked up about these things. Of course governments and corps. are lying to us and black-bagging people. We keep giving these entities more and more power, and for some reason expect them not to use it. If someone can break the law and get away with it of course they would. We willingly sacrifice so much of our privacy in return for convenience that I just can’t understand why people are surprised they’re being manipulated and taken advantage of when they’re willing participants in their own destruction. Fifteen years ago the common line was to not give out any personal information on the internet. Even when I finally got facebook I still put in the wrong birthday. Even today I use a different name and wrong birthday for almost every site I use and people look at me like I’m crazy. No one really understands why I would pay for a VPN service.
I think in the end that every whistle blower is a traitor of sorts, regardless of the information leaked. The very act of whistle blowing implies that you are a traitor of the trust and contract that you had with the entity that you are blowing the whistle on. That being said I believe that while someone can be classified as a traitor it is still possible that they are doing the right thing. I guess I’m sort of like Ned Stark, where whether or not you’ve done the right thing, if you’ve broken the law your punishment must be the same. You shouldn’t whistle blow because you imagine yourself being the hero and because you think you’ll be protected afterwards. You should do it when you believe that the information is worth suffering the consequences for and you shouldn’t be surprised when you have to suffer them.



February 18th, 2018

History Reading: 05

Hold on I'm jacking in



I’m of differing opinions on the whole movement focused gaming experience. To me it seems a bit gimmicky and not worth the extra money that it usually costs. Take the wiimote for example, while it was fun for a while having to swing your arm around, or hold the remote like a steering wheel to drive, eventually most people just got tired of it. I know that I hated playing mario kart with the wiimote as I felt like I had less control over my car. I immediately switched to using a classic controller for basically every game. That being said the wii was incredibly successful amongst casual people, so maybe the dislike of the motion controls is just for neckbeards like myself.
The thing that I really dislike is the whole push for games as exercise thing. I think that instead of doing that just make people play sports and work out. Again though I’m against the general consensus it seems as things like pokemon go have apparently worked wonders for some people’s health. I never understood the hype but for a lof of people it was the coolest thing ever and who am I to knock that. It does worry be though that so many people need that dopamine hit of playing video games in order to entice them to keep themselves in shape. I do not like what that says about our society as a whole.
I prefer my games to be sit down experiences, usually social ones though. I get enough exercise myself and I play games when I want to take a break. Needing to jump and twirl and what not kind of turns me off from a game. Additionally many of these games could easily be distilled down to a few distinct twitchy motions you could make and that takes a lot of fun and skill out of the game. Maybe in the future we’ll see games require more dexterity but then all of a sudden you’re losing almost all the people that play games in the first place. Most people that are truly into games are into games because they’ve been not so successful at sports. Turning games into sports marginalizes these people yet again. So I think companies need to be careful with the direction they head in.
Virtual Reality is an entirely different story for me however. Last semester I did dev work for the HTC vive system and while we got basically nothing accomplished it was really cool. VR can put you into the game in a way that simple things like the rockband guitar or the wiimotes cannot. Using VR for the first time is like being a little kid again. I couldn’t help but having a huge goofy smile on my face. It really is an incredible experience and one that is hard to describe if you’ve never done it before. When the game is all you see you really do lose all sense of where you are and the room you’re in. While it is overpriced and underpowered today, if they can find a way to increase the resolution of the viewports and the units become normalized enough to lower the price I really do think that VR is the future of gaming. The only big problem is the space/hardware requirements needed for the full experience but hopefully a solution is found for those too.



February 18th, 2018

History Reading: 01

Global Game Jam Review



Instead of doing the normal blog post this week I'm going to give a brief recap of my experience at the Global Game Jam this weekend with Nick Carroll. The local event was held at a place called Ignition Park on the south side of South Bend. It was a location for start-ups to find space. Nick and I showed up and we were given the theme of "Transmission". Before going to the event we had decided that if the theme was dumb we were just going to do our own thing.

The game we ended up making (starting) was something I've wanted to work on for a while. A top down Hotline Miami meets Borderlands. The coolest piece of our game, available at: https://github.com/wtheisen/GlobalGameJam is the dynamic object system. Every object in the game is generated by a JSON formatted stat sheet. Using the properties specified by the stat sheet the game generates a class for each item. Therefore the game is actually a kind of compiler. Using the generated classes the game imports them all and then runs. This means that the player can add whatever kind of items he wants and they'll be automatically integrated into the game. We successfully finished this portion of the game. We got as far as rolling our own raycasting, and ended when we got collisions working.

In the end we didn't actually get much done, but it was really fun trying to execute an idea I've had for a while. I want to keep working on this game in the future as I think it has a lot of potential. Hopefully this class doesn't take up too much of my time.



January 28th, 2018

Ethics Reading: 02

Work Sucks



These questions are all focused around people planning on entering industry next year after graduation. Due to the fact that I will be going to graduate school instead, I'll talk about the events leading up to that decision.

A big reason that I decided to go to grad school instead of going into industry was my experience during my summer internship. The internship was not the most enjoyable experience for me. One of the other interns was not the best programmer and so instead of actually doing the work I was supposed to do I instead had to try and teach him how to code. (He actually could not type a for loop at the start of the summer) This meant that it looked like I was getting very little done and thus effected my entire exprience at the firm.

The other intern was able to get the job because the firm had zero technical questions during the interview. This meant that basically anyone could get the job regardless of skill-level. This is good for people that are not as talented, but extremely frustrating for the person that ends up needing to baby-sit them. This is why I think that having at least a few technical questions during the interview process is important.

In addition to helping out the other intern I came to realize that teaching the other intern was actually more enjoyable than the work I had to do. The work was very menial web-dev and C# programming. The kind of programming where you know the solution as soon as you start but still have to go through the process of typing it out. It was a bit soul crushing.

I had been entertaining the idea of grad school before going into the internship and about half-way through the summer I decided that it was something I was going to start thinking about seriously. I just came to the realization, that for me at least, I'd rather be happy and fulfilled than be making a lot of money in industry. The final nail in the coffin was the career fair this year. I'd always hated going but after the summer I had had enough. I just hate playing the game, it is repulsive to me. Obviously there are just as terrible games in academia but at least I can lie to myself that I'm doing it for the fullfillment that teaching will bring. I also don't have to wear a suit.

My grandparents did not like the idea of me gong to grad school and made all kinds of derogatory remarks about me and my parents which made me sad. It was also hard to give up on the dream I had of being someone important in industry and making boatloads of money. It's been on ongoing process trying to accept the fact that I'm going to be some no-name professor at some no-name college in some no-name flyover state. At least I'm going to be happy though.



January 28th, 2018

Ethics Reading: 01

Being a hacker used to mean something man



The word hacker originally meant something far different than it does now. Originally hacker meant someone who was fighting against the "man" using a computer as their means of assault. It began as a subsection of the punk movement with the original hackers trying to promote activism against the government and corporations. Today this image is no longer the case. Unfortunatley as the general populace has begun to suckle more and more at the teat of the government and mega-corporations the term hacker has been psy-op'ed into oblivion by the controlling powers. Today a hacker is an evil, fat neckbeard that lives in their parents basement that is out to steal your personal information for profit. (the fat neckbeard part has always been accurate though) Through political trickery and optics gone are the days of the cyber-cowboys. The hacker movement has had its roots removed and become something else entirely.

As the punk movement died so too did the hacker movement. just as computer scientists today as soft and weak so too are the activists and hackers. In an effort to get more people into the field of computer science, they had to tear down the traditionally male stereotypes of the field. This in turn watered down the term computer scientist, and by proxy, the term hacker. I think this needs to be remedied. I think there should be a stronger distinction between "programmers" and computer scientists. Additionally I resent the effort to tear down people that are simply better and harder-working than others. The original hacker ethos was all about hard work and self exploration. Many got started on their own in their basement spending hours exploring how things worked and learning from their mistakes. Contrast this with todays "ethical hackers" that are simply stuck up middle-class kids that are often not only worse computer scientists and programmers but are also quick degrade anyone subscribing to the original hacker ethos. This mirrors a trend in larger western society of simply handing things to people instead of promoting hard work and self discovery. The "participation award" mindset worms its way into everything.

I personally do not consider myself a hacker. The reason I actually became interested in computer science was to become a hacker and while I had the typical hacker learning experience growing up as I outlined above (I bricked my mom's laptop installing Linux in 8th grade), I still would not call myself one. This is not because I don't want to be one but because I do not consider myself talented enough to stand amongst the ranks of true hackers like pbui and wscheirer. That being said, I think that the hacker mindset is extremely valuable to have as a computer scientists and I'm very glad that my Russian friend got me into it as early as he did. Through it I learned the value of hard work and developed the ability to figure things out on my own in addition to learning to simply try things out until they worked. Being a TA I find that many students are lacking in this mindset and it causes them a lot of problems with their assignments. I think this is because the assignments are created by professors that more often than not grew up in hacker culture and are assuming the kids to be the same way. This difference in upbringing can cause a lot of trouble for the kids as they are thrown into the fire and until they can develop the hacker mindset it is a lot of work for them.

In the end I think as computer science has become more mainstream it has begun to lost it's hacker roots. In my opinion this is a great loss and leads to lazier and just simply worse developers and computer scientists. I hope that in the future we can see a return to the roots of the field but with the way today's society is developing I just don't see it happening any time soon.

Until next time o7



January 21st, 2018

History Reading: 00

Video Games Suck



Playing board games is one of my favorite past times. In a lot of cases I'd actually prefer playing a board game to a video game. I've actually gone so far as to design several board games myself. While most people usually consider video games to be a successor and replacement to board games I disagree. There has been a recent resurgance in board games which has led to some fantastic new options for people interested in the hobby.

Board games have recently begun to be categorized into two different categories: euro games and Ameri-trash. The main difference between the two categories is what the primary focus of the game is. Euro games tend focus more on the mechanics and strategy of the game, while Ameri-trash games focus more heavily on the theme and the feel of the games. Examples of euro games would be Puerto Rico, Terra Mystica, or Dominion these tend to have simple premises, with little direct player interaction (e.g. combat) and few to no luck elements. Additionally the playing pieces tend to be simple, and usually wooden.

Ameri-trash games one the other hand emphasize the theme and feeling of the game. In contrast to euro games they usually are heavy on player interaction and have elements of the game that are luck based normally resolved through dice rolls. An example of this style would be the games Twilight Imperium, King of Tokyo, and Candy Land in addition to luck and player interaction, player elimination is often a prevalent component of these games for better or for worse.

The reason I think that video games will NOT replace video games is because most video games fall under the category of Ameri-trash. Almost all modern games focus more on the spectacle and theme (graphics and cut scenes) rather than in-depth mechanics and strategy. Take for example to original DOOM games with non-linear levels requiring the player to take time to look at their map and back-track. Compare that to the "on the rails" shooters of today like Call of Duty or Battlefield. Clearly these games, while looking nice, don't provide the level of depth or discovery that some gamers crave. That being said the new DOOM is awesome and one of my favorite modern games.

One category that I think could be replaced however is RPG games. Games like DnD can be very slow and boring on paper and this provides a great opportunity for video games to show their worth. Unfortunately as time has gone on modern vRPGs have gotten more and more watered down. Things like Skyrim and Fallout 4 when compared to their predecessors are just bad. So it remains to be seen whether there will be a renaissance in games that focus not on spectacle but on depth of mechanics.

Personally I hate ameri-trash games. I don't like the feeling of not having agency in the game. When luck is involved it just feels terrible. If you lose it was bad luck and if you win you just got lucky. The more luck a game involves, the less room their is for personal skill. Games that involve luck are good for beginners and people that are just trash but if you're good at a game there's nothing more frustrating than feeling like you have no agency in it.

As computer science has begun to be watered down with children and idiots, so too has the video-game industry. This is incredibly sad to me but I think there is an inverse correlation between the dumbing of video games and the resurgence of board games. As CS and video games get worse I think that board games will continue to grow and I am excited to see where we end up in a few years.



January 20th, 2018

Ethics Reading: 00

Anyone can into engineering, only the great can into art



As the title suggests, I believe that the categorization of computer science depends on the ability of the actor in question. When the programmer is unskilled computer science falls into the realm of engineering, an ugly and dispassionate discipline focused purely on pragmatism and plodding your way to the most effective answer. However, when the person in question is truely talented at what he does, it turns into a kind of art. A truly gifted programmer manages to elevate computer programming beyond its binary roots into a higher form of art.
I think one of the closest examples to this is with athletes. Watching a professional athlete is always impressive, but watching a defender in a soccer match is completely differnt from watching a truly gifted attacker like Messi or Ronaldo. They take the sport into a different realm where they dance with the ball and glide past defenders. Every piece of movement seems to be in perfect harmony, and the move with an otherworldy grace to a music that only they can hear. I think this state is achievable in computer programming but only for the talented programmers out there.
Unfortunatley I think it's one of those things that is nearly impossible to explain, but easy to recognize when you see it. I think the big thing is the seemingly effortless nature of the artist in creating something novel. Most programmers spend almost all their time maintaining previously created programs. I think it's impossible to consider maintainence of someone else's creation a form of art. I think art comes about when you create something wholly original and what propels that act into an act of art is the passion and effortless-ness of the act of creation. Art comes about when you're presented with something that does not have a formulaic solution. It allows you you to create your own solution and in this problem space we have the opportunity for art. I know it's always impressive to watch truly talented programmers write some code. Something about the way their fingers fly across the keyboard, imposing their will on the computer, the way the code just appears on the screen and the incredible precision and grace of it all (assuming you're using vim) is truly a work of art in my mind.
Contranst this with someone clunkily using atom, waitng for it to start and needing to stop and google something every line. It just breaks the flow and turns into engineering, characterized by blindly applying something predetermined in a slow and plodding manner. It's just not the same. This being said I think it's possible for everyone to become an artist at programming. It's not something like sports where birth decides so many factors, it's merely a matter of how much time you're willing to devote to your craft. I know that I have improved immensley during my time here, as have all of my classmates. It's not something you're either born with or not.
I think the big implications of this whole art v. engineering debate is important when it comes to how you teach the subject. Engineering courses tend to be structered very rigidly and have defined modules that if you learn how to fit the pieces together you will become a good programmer. On the other hand art classes tend to be a bit more hands off. You are taught the very basic concepts, and then let loose to create something. In my opinion I thing that the way computer science is taught is a little too much on the engineering side. At least here at Notre Dame the classes seem to stifle out a lot of creativity and replace it with boring toy assignments with very defined constraints. I strongly believe that computer science is a very intuitive field and that teaching-wise we could really benefit by taking a some ideas from how art classes are taught. The soul and passion needs to be put back into computer science and the drudgery and on-rails style of teaching needs to be updated.
Anyone can be an artist, but it certainly takes work.



January 17th, 2018

Ethics Reading 00

Introduction



As it says on my website, I am William(Bill) Theisen. I am interested in both low-level systems programming as well as AI/ML. I plan on pursuing my PhD in the fall with the intent to go into teaching after completion. In this class I hope to learn about the different views my classmates hold on various topics and to expand my knowledge of the topics involved. I think the largest issue in ethics right now is privacy and data-collection. Computer scientists are privy to so much personal inforamtion and it can be hard to know when it is and is not okay to make use of the information. I am very excited to discuss this topic in class.



January 17th, 2018

Raindrop, Drop Top, Linux Monitor Hot Swap

What do you mean I spent 4 and a half hours on this!


Goal: Allow me to plug my laptop into an external monitor and have it work immediately

Problem: I'm running linux

The way my dorm room is set up means that I'm either at my desk on my desktop or I'm laying in my bed. My desktop is running windows which means that doing development for my homework, which is designed to be done entirely in linux, is a little difficult. Most of my classmates use the student machines that are set up for that very purpose but I cannot stand them. Not having sudo priviledges just drives me up the wall and they're so slow most of the time. So instead I do all of my dev work on my laptop which is running ubuntu. This is nice while I'm walking around all day, but when I'm in my room I'd like to use a bigger screen and one of my nice keyboards.

Plugging my laptop into the monitor works, but I have to set it up manually with something like lxrandr every time and the resolution and wallpapers are always wacky. This gets annoying and I wouldn't be a computer science major if I didn't believe that there was a better way to do it. Enter the idea of setting up some sort of "hotswap" process where all I need to do is plug it in, and the OS takes care of everything else. This being linux it's of course far more complicated and in-depth than it needs to be and it took me almost five hours from start to finish. I'll outline my process here in case anyone else wants to follow in my footsteps.


First a word about the environment I'm using: I have a dell xps13 9350, and I'm running ubuntu 16.04, kernel 4.11.2 - Now onto the adventure...

I pretty much immediately realized that xrandr had the power to do what I wanted, but the question quickly became how do I harness this power in an intelligent way. Of course that being my goal lead me to an incredibly unintelligent first excuse of a solution. What if I have a script that continuously loops that I begin when I log in that constantly checks if a monitor has been plugged in, and when that happens, executes a set of xrandr rules to set up my dev environment. Being a computer science student I googled, and then copied code off of stack overflow to try and fix my problem. Here's the script I copied:

                        
        #!/usr/bin/env python3
        import subprocess
        import time

        #--- set both commands (connect / disconnect) below
        connect_command = "gedit"
        disconnect_command = ""
        #---

        def get(cmd): return subprocess.check_output(cmd).decode("utf-8")
        # - to count the occurrenc of " connected "
        def count_screens(xr): return xr.count(" connected ")
        # - to run the connect / disconnect command(s)
        def run_command(cmd): subprocess.Popen(["/bin/bash", "-c", cmd])

        # first count
        xr1 = None

        while True:
            time.sleep(5)
            # second count
            xr2 = count_screens(get(["xrandr"]))
            # check if there is a change in the screen state
            if xr2 != xr1:
                print("change")
                if xr2 == 2:
                    # command to run if connected (two screens)
                    run_command(connect_command)
                elif xr2 == 1:
                    # command to run if disconnected (one screen)
                    # uncomment run_command(disconnect_command) to enable, then also comment out pass
                    pass
                    # run_command(disconnect_command)
                    # set the second count as initial state for the next loop
                    xr1 = xr2
                        
                    
Source: Ask Ubuntu

For the life of my I could NOT get this script to work, and so I discarded it and began my search for a better solution. I then stumbled upon something called udev rules. Apparently these are rules that you can write that you can trigger on certaing hardware events, such as plugging an external monitor in, which allow execution of arbitrary code upon the rule being satisfied. This seemed perfect! Once again I delved into the depths of stack overflow and found what was surely the solution to my problem. This first thing I needed was a custom udev rule that would fire when an external montitor is plugged in. The following is what I gleaned from the page:

                        
        ACTION=="change", SUBSYSTEM=="drm", HOTPLUG=="1", RUN+="/path/to/hotplug.sh"
                        
                    
Source: Unix Stackexchange

So ideally, this rule would trigger when an external monitor is plugged in thus causing hotplug.sh to run. Hotplug.sh would look a little something like this:

                        
        export DISPLAY=:0.0

        function connect(){
            xrandr --output VGA1 --auto --left-of LVDS1

        }

        function disconnect(){
        xrandr --output VGA1 --off

        }

        xrandr | grep "VGA1 connected" &> /dev/null && connect || disconnect
                        
                    
Source: Ruedigergad Blog

The script itself is very simple, when run it checks the output of xrandr to see if a monitor has been plugged in, if so it executes connect, if not it executes disconnect. Theoretically this script gets called everytime one of these two events happens and can thus assume that if there is no external monitor connected it must have been a disconnect event. I put my udev rule in etc/udev/rules.d/14-monitor-hotplug.rules I think the number is actually supposed to be higher than 14, but it wasn't working and 14 is my lucky number so I changed it. Anyway, this initial pass at using a udev rule didn't work in the slightest, so I had to roll up my sleeves and get digging.

The most pressing problem was that the script never triggered, no matter how many times I plugged and unplugged my monitor. After reading many an article on udev rules I came to the conclusion that udev rules trigger with no knowledge of the user shell environment, and thus need be be executed with the full path of the shell specified in the udev rule, or a shebang at the start of the script to execute. I did both just to be safe. After a few modifications my udev rule looked like: ACTION=="change", KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", RUN+="/bin/sh /usr/bin/hotswap.sh" and I additionally added the #!/bin/sh to the top of my shell script as well. Still this refused to work. Thanks to the syntax checker I have in vim however, I realized that /bin/sh wasn't going to cut it, I had to use /bin/bash for my code to work.

I excitedly made my changes, saved and restarted udev and plugged in my laptop! Success! The sense of accomplishment quickly faded as I repeatedly unplugged and plugged my laptop. The rule/script was completely busted. It only worked about half the time and sometimes it would even get stuck on the wrong cycle so my laptop screen would turn itself off when I unplugged my external monitor instead of the other way around. So if you want a half baked solution here's what the rule and script looked like:
ACTION=="change", KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", RUN+="/bin/bash /usr/bin/hotplug.sh"

                        
        !/bin/bash

        export DISPLAY=:0.0

        function connect() {
            xrandr --output HDMI1 --auto --left-of eDPI1
        }

        function disconnect() {
            xrandr --output HDMI1 --off
        }

        xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect
                        
                    

So once again I had to do some more research. After a little while I stumbled upon someone whom had the same problem I had, they tried the script grepping xrandr and found it to be a bit dodgy and they had come up with a better solution, making a system service that executes when the udev rule is triggered. This gives us three parts of code that work together to do what we want.

        The udev rule:
                    ACTION=="change", KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", RUN+="/bin/systemctl start hot_plug.service"
                    
        The system service:
                    
        [Unit]
        Description=Monitor hotplug

        [Service]
        Type=simple
        RemainAfterExit=no
        User=wtheisen
        ExecStart=/usr/local/bin/hotplug_monitor.sh

        [Install]
        WantedBy=multi-user.target
                    
                    
        And finally the user script:
                    
        !/bin/bash

        X_USER=wtheisen
        export DISPLAY=:0
        export XAUTHORITY=/home/wtheisen/.Xauthority
        export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

        function connect () {
            xrandr --output eDP1 --off
            xrandr --output HDMI1 --auto --scale 2x2 --fb 3840x2160
        }

        function disconnect() {
            xrandr --output HDMI1 --off
            xrandr --output eDP1 --auto
        }

        if [ $(cat /sys/class/drm/card0-HDMI-A-1/status) == "connected"  ] ; then
            connect
        elif [ $(cat /sys/class/drm/card0-HDMI-A-1/status) == "disconnected"  ] ; then
            disconnect
        else
            exit
        fi
                    
                    
Source: Archlinux Forums

Luckily this worked, and it worked well. So finally, after almost five hours I had achieved what I had set out to do. The nice thing about all this was a learned a lot about linux along the way. I had never heard of udev rules before, and I got to write my first systemd service which was cool. In the end though it seems kind of dumb that I had to spend five hours making this work. It seems like on another OS this sort of thing would be trivial. I suppose if I wanted it to be that easy I wouldn't be using linux though would I.


September 27th, 2017

Applying to Grad School

Part One: Do I even want to do this?


"What would you do if you had a million dollars?"

"I'd relax, I would sit on my ass all day, I would do nothing"


This is almost the exact conversation I had last Easter that led me to grad school. One day I was talking to my professor about how lackluster I found the prospect of working a 9-5 job after graduation. He asked me what I enjoyed doing and I said playing video games and doing nothing. Immediately he asked me if I had thought about going to grad school.

Truth be told I had thought about grad school. My grandfather has his PhD and was a professor. My father has my PhD and is a professor. My mother taught college classes for years. Teaching seems to be my calling. Like many sons, for years I've fought and fought against being exactly like my father. That of course has led to me going to Notre Dame and now hopefully to grad school. I suppose the apple never falls far from the tree.

The final nail in the coffin was going to the career fair for the fourth time in my college career. I had finally had enough of it. I've never handled other people having authority well, and I loathe the game that is getting a job. When I arrived and saw the same people, in the same suits, saying the same disingenuous things I just couldn't handle it. Sucking up like that has never been easy for me and I finally decided that I couldn't handle it. Luckily for me academia is known for its lack of politics and sucking up.

I consider myself blessed that I have been given the opportunity to TA several classes here at Notre Dame. It's another reason that I began considering pursuing my PhD. Teaching material to kids, and watching their eyes light up in understanding after finally getting it is just so much more fulfilling than the droll work I had to perform this summer at my internship. I began to realize that there is more to life than making a lot of money and that the money is not worth feeling my soul dying a little more each day.

It seems that despite my best efforts otherwise the life of a pedagogue is the one I'm heading towards. All I have left until then is five or so years of doing nothing and playing video-games. Who knew grad school was going to be so easy.


September 25th, 2017