Home » Archives for January 2012

Month: January 2012

Apparently it isn’t elementary.

I started watching the Sherlock TV series sometime last week. Since there are only 3 episodes per season I went through it quite quickly. It was an OK few hours of television but it had the same hole as any other Sherlock TV show, book, and movie.

  • Sherlock does INDUCTIVE reasoning NOT deductive reasoning.

So the whole branch of science he “created”

  1. Already exists, it’s called deductive logic.
  2. Is completely wrong. He uses inductive logic.

For some reason, people writing adventures for Mr. Holmes have been unable to understand the difference between induction and deduction since 1887. Apparently there’s some other branch of logic that it actually is, called abductive reasoning. From the description it’s basic induction, some guessing, and finally after one has acquired these “facts” actual deductive logic.

I’m, probably, one of the few people who is irritated by this, aside from Philosophy professors who have to re-teach students the definitions. If only the creators were smart enough to see the difference; they could have used the correct terms to make the series more original and correct.

So ist das Leben.

Context Switching Sucks

During my day job as a sysadmin I spend all of my time in a text context. I read and write Python, English, bash, and on a bad day some SQL. Switching between text and speech, when someone comes into my office to ask me a question, can completely derail whatever I was doing. Context switches like this are fairly expensive when it comes to working on a hard problem, multiple levels down. Ted Dziuba has a great article about this on his site. I’ve also found that switches between programming languages are painful i.e., going from writing Python to Java without some sort of break in between.

Luckily, I work at home with non-technical people so I don’t often need to give verbal stack traces. I do, however, go to school during the day. I’m a senior and my degree is in German so most of my classes are, at least partially, in German and I’m expected to participate in conversation and reading. The context switch from English to German is pretty rough most days, it is especially so when I’ve spent all morning in a text context.

One, very unfortunate, day I spent about 5 hours straight writing Python before going to the German class. No one else in the house was awake, the kids were at school, the girlfriend was up late so she was asleep when I woke up. I didn’t speak a single word to anyone all day; I spent the entirety of the morning writing code…I don’t think I even chatted in IRC, at all, I just programmed all morning. In class we were just doing conversation and reading aloud from the book, nothing else that day. Going from Python to English to German to English to German (repeatedly) gave me a massive headache. By the end of the class my brain felt like it had been put through a meat grinder.

I spent the rest of the workday (2 hours) trying to get back to where I was when I left, dynamic languages seem to require more information be kept in a “stack” in the programmer’s head than static languages do. I’d planned a bunch of stuff for after work that evening, finishing a novel that I’d been reading and some homework for the Java class…It never happened. After work I did nothing but watch TV and take Ibuprofen because my brain was so over worked from the context switching; I could hardly function.

I don’t have a good solution for handling context switches like that, yet. I’ve experimented with spending some time just talking to people before having to go to the German class, I’ve tried watching TV in English on my lunch break before going to class, and I’ve tried taking more frequent breaks during the morning (with frequent notes about where I was, in the code, and what I was doing there). The last experiment seemed to be the most helpful, I didn’t feel quite as bad after the switches but it isn’t a complete solution i.e., there is still some headache involved.

Good things from my Java class.

I’ve taken the Intro to Java class three times at SUU. The first two times I took it I had surgery and I wasn’t able to finish the class.

The first time

The first time was absolutely awful. The professor showed up to class the first day, told us to go to his class files and download his customized version of Wordpad that included a few batch scripts and other hackery to set the CLASSPATH correctly and open a terminal to the right directory for compiling.

Our book was about working with multimedia in Java. It wasn’t a “learning Java” book. We were assigned reading every day, it didn’t match up with what we were actually doing. We were also assigned reading of the Appendices that actually did match up with what we were doing.

Each class period we would spend 40 – 45 minutes writing code that the professor was writing on the overhead projector and 5 minutes finding out what our homework would be. Mostly the homework was taking the code we had written in class and modifying it in some way, basic script kiddie shit, not actual programming.

There were no quizzes.

The exams were in this format:

50 minutes:

  • 20 term definitions,

  • 15 multiple choice questions, and

  • 3 – 5 coding problems; no computers allowed.

The coding problems were written on paper, from memory, syntax and compile time errors counted as missed points. The midterm was 3 programs, each of them more than 25 lines of code.

It was total bullshit.

The second time

The second time wasn’t too bad, there was quite a bit of homework but I didn’t attend long enough to take a quiz or exam.

Setup

The class was set up so that we would spend the maximum amount of time practicing writing Java rather than learning about syntax and how compilers work. We got a 50 minute presentation on Java’s basic syntax, data types, and an approximation of how the compiler worked. It was just enough that we could use it as a reference when actually writing Java code.

We didn’t start out with Eclipse or Notepad like some classes do. We started with BlueJ, it’s just functional enough that you don’t have to worry about setting up a CLASSPATH for compiling or using the right Java SDK but it doesn’t give you too many hints about the code.

After we learned the syntax and some data types we went into a workshop format. We would show up to class and spend the time writing the different programs on the worksheet list; each of them designed to teach us one of the concepts we learned. After a couple simple exercises the difficulty would increase usually by using multiple concepts at the same time or combining multiple data types.

Once finished with each of the assignments we’d have to compile and pass them off for the professor.

Grading

Each assignment assigned as part of a workshop was worth from 1-8% of our grade, each quiz was worth 6% of our grade, the midterm was worth 20% of our grade, and the Final project was worth the rest of the remaining percentage. Nothing else mattered as long as you could write the code.

Quizzes

Each quiz, there were three total, was a programming problem. We had 45 minutes to code a solution to the problem listed on piece of paper that was handed out. The problem was usually one of the harder problems that were assigned during the workshop with information changed. They were pass/fail, a full 6% or 0%.

Midterm

The midterm was 5 parts: part one, multiple choice question set about Java syntax and data types; part two, accreditation question set (2 questions); parts three – five, the programming question from each of the three quizzes IF you didn’t pass them the first time. If you passed the quizzes the first time the midterm was about 6 minutes long.

Final

The final was just a final project. Pick something that is interesting or that you want to learn more about then discuss it with the professor and code it. We had about a month to build the final project with each class period being a workshop with the professor and tutor able to help with anything in the project.

This was the best, by far, of the programming classes I’ve taken. It allowed me to not show up to class as long as I understood what was going on and I was able to pass off the assignment which was a huge incentive to me. It was definitely worth the time I spent on it.

Problems reading and burning DVDs with a MacBook Pro

Over the last couple months I’ve been having more and more problems with my MBP reading and burning DVDs, honestly I’ve only tried to burn one DVD in the last two years so it may have been broken for longer. When I actually needed to burn a DVD, before the session could open, I would get an error that there was something wrong with the media and the disk would be ejected.

Numerous solutions I found online were to:

  1. Take the MBP apart, pull out the SuperDrive, take it apart, and clean the lens.
  2. Find a thin object and a smooth cloth to shove into the drive repeatedly to clean the lens.

I decided I would try option 2, while I was looking for a clean, soft cloth to use I was reminded by Katrina that shoving something into the drive is a really dumb thing to do. She suggested just using the canned air I keep in my desk to get rid of dust.

Aha! Finally a sane solution. I used the canned air, two full passes (up and down) trying to keep the airflow even, popped in a DVD that 3 hours ago wouldn’t read and it worked. I tried burning the DVD that I’d tried 20 minutes before and it worked.

So, the real solution to an MBP disk drive not working, MBP not reading DVDs, MBP SuperDrive not working, MBP DVD burn failed, and any number of other phrases is actually:

  1. Use canned air to clean the dust off the lens.