This book is new. If you'd like to go through it, then join the Learn Code Forum to get help while you attempt it. I'm also looking for feedback on the difficulty of the projects. If you don't like public forums, then email firstname.lastname@example.org to talk privately.
Exercise 11: uniq
There isn't much more to say in the beginning of these last two exercises. You should know how to think about your work environment, how you start, how you sit, everything that impacts your ability to get started. You should also have been busting through that initial starting phase using these tiny little 45 minute projects. If you haven't figured it out yet, setting a 45 minute timer and yelling "GO GO GO!" is a solid technique for making yourself get started. The goal hasn't been to craft stellar work but to just get going.
You should also have a decent lab notebook with run charts plotting how well your improvements are working. There's nothing very scientific about your charts, but they should be helping you understand what might be working and what isn't working. When you use a run chart you'll want to simply look for spikes in either direction and then try to find an "assignable cause" for the spike. If the spike was a positive one, then try to find out why and do it again. If the spike was in the negative direction, then try to find out why and prevent it in the future.
When I say "spike" I mean significant changes. One thing about a run chart is it's supposed to fluctuate. In fact, if it stays stagnant for a few 45 minute hacks, then that's also bad and you should find out why. Normal processes fluctuate and bounce around the mean, and you should only try to find causes for large spikes in any one direction. If you did the "Further Study" from the previous exercise then you can use 2 * std.dev (two times standard deviation) as a line above and below the mean to spot problems.
See the video for this exercise for more demonstrations of a run chart. They are much easier to explain visually in a video.
The uniq command simply takes a list of sorted lines from sort and removes any duplicates. It's very handy when you want to get just the unique lines of a list. If you've been implementing these commands then you should be able to do this:
history | sed -e "s/^[ 0-9]*//g" | cut -d ' ' -f 1 | sort | uniq
The history command prints out a list of every command you've run. Your sed command needs regular expressions and this will strip the beginning off of the history command. Next I use cut to grab just the command name as the first word. After that I sort and run it through uniq, and you have all the commands you run.
Implement enough of uniq and any other commands necessary to make the preceding command work. You can change up the format if your sed can't handle expressions yet, but you should get a list of commands when you're done with this exercise.
- You now have a list of commands you can start to implement if you want to do further study.
- This is the first multi-project exercise, where you are combining the exercises from previous steps into one. Did you find anything new about your process?
- How are your run charts looking? Are they helping?
Research charting libraries for Python and see if you can generate these run charts with Python. You should also start tracking how long it takes you to get started and see if the run chart helps you decrease the time it takes.