Rough Book

random musings of just another computer nerd

Tag: coding

Duct-tape programmers are not heroes

Today, I ran into this article from Joel on Software. Usually, I listen to what software professionals have to say regarding software development and software-development processes in general, and I mostly agree with them. However, I found myself vehemently disagreeing with this article.
Read the rest of this entry »

jQuery tip: Changing the TYPE attribute of an INPUT element

I was trying to change the type attribute (using jQuery) of an input element from submit to button when I got this error:

type property can’t be changed

Apparently, you can’t change the type attribute of an input element once it’s part of the DOM. I figured out a way to do it by cloning the old element and then changing its attribute. Since the element isn’t part of the DOM, you can change its attribute. After that, you can add it to the DOM and remove the old element:

var oldButton = jQuery("#Submit");
    var newButton = oldButton.clone();

    newButton.attr("type", "button");
    newButton.attr("id", "newSubmit");
    newButton.attr("id", "Submit");


I’m going out of town for two weeks for WLC (Warrior Leader Course). It’s a course I’ve had to take after I got promoted to Sergeant while I was in Iraq. I never had a chance to go to it because there was a lot of confusion with the standing-down of the old artillery unit and the formation of the new infantry unit. My readiness NCO was able to get me a class starting this week. The class is in Utah (fun!) and I will be learning a lot of “NCO stuff” like commanding formations, marching, conducting PT sessions, OP orders, and things of that nature. I think it will be pretty interesting. The first week is classroom stuff, and the second week will be field-training. I’m going to see if I can take some pictures. I’ll post them here when I get back.

The other thing that I wanted to write about was an experience I had in college. I’ve been reading The Daily WTF a lot, recently. It highlights examples of bad code, horrible design, and stupid management. Things that basically make you go “WTF?!”. Anyway, some of the articles on the site talk about incompetent professors. After reading that, I was reminded of a terribly idiotic and incompetent professor that I had in college. This happened during the first semester of my senior year (spring of ’03), and of course, I had full-blown senioritis. Scratch that, I wouldn’t say that I was apathetic; I just figured out how to put in the optimum amount of effort. This meant that I would try and see if going to class gave me any value. If it didn’t, I would pretty much teach myself the material. This meant more time for me to party and drink. I’m sorry, I meant study and review. Yes… that’s right. Anyway, the class I had was called CSE 423. I don’t remember the title of the class, but it had to do with VHDL. In simple words, VHDL lets you design logic circuits programatically and then configure an FPGA (Field Programmable Gate Array) to behave like the circuit you designed. It’s pretty nifty and interesting stuff. I would have enjoyed the class if it hadn’t been taught by this retard of a professor. This professor, let’s call him R. C. is as terrible as they come. He came to class unprepared, his slides were full of errors, and he often had no clue what he was talking about. In addition, he seemed to be passively arrogant. Initially we all liked him because he seemed to have a lively personality. But that didn’t make up for the fact that he pretty much sucked. On the rare occasion you actually got through to him (he almost always directed you to the TA – who was nowhere to be found and checked his email once a millenium) to discuss a problem in your homework (let’s say you were docked a point and you wanted to know why) he would be extremely unhelpful. Most professors explain to you why you are wrong, they don’t just tell you “You’re wrong” and end the conversation.

I remember how I had to leave class early once to meet with my readiness NCO regarding some paperwork. I let him know I was leaving. He wasn’t happy and decided to give quiz to the class just because I left. When I talked to him about it, he told me that he needed a letter from my readiness NCO. I gave him one, and after that he gave me two homework questions to make up the quiz. He randomly picked the last two questions in the list of homework questions for the chapter. When I tried to ask him some questions about the homework, he told me that he hadn’t read them and that I was on my own. Now that I’ve told you what kind of person he is, on to the actual issue. We had a midterm that was about 30% of the grade of the class. In that midterm there was a 30-point question having to do with a VHDL implementation of a state machine. I wrote a correct solution to the problem and I was surprised when I got my paper back and I received a zero. I got a 60% on the test, when I should have received a 90%. I went to him to discuss the problem. There were a bunch of angry and aggravated students in the lab. All of them had been unfairly graded on the test. I mean, what do you expect when you have an idiot for a professor? I went up to him and patiently explained my solution and how I arrived at it.

He told me, “It’s wrong.” I asked him, “How? Can you explain to me what’s wrong?” He said, “Your state machine is wrong, so your implementation is wrong.” Once again, I patiently shows him the state machine with all the correct inputs (or transition conditions) and outputs (or states) and how the VHDL implementation corresponded to it. I asked him, “How can you say my state machine is wrong?” He responded and I kid you not, “Your state machine is wrong because the outputs are supposed to be on the arrows, and the inputs are in the circles. The arrows come out of the circles, so they are outputs.” I stared at him in disbelief for a few seconds. I honestly could not believe what I was hearing. Every computer engineer worth his salt knows what a basic state machine looks like. I argued with him for about 10 minutes. Other students were standing around me, shaking their head because they couldn’t believe what they were hearing either. He finally said, “No, you’re wrong. This conversation is over.” I stormed out of the lab, fuming. Due to the idiocy of my professor, I got a B in that course when I should have received an A (don’t even get me started on the final project. Apparently he thinks it’s totally fair to give you a zero on a question that he didn’t even ask you). I eventually was vindicated later that year when I was part of the Student Advisory Committee. We were a bunch of students who met with the department heads so that they would have a better idea of what the students felt. Basically, liaisons between the student body (the CS/CSE majors anyway) and the faculty. They were asking us about our opinions of professors and I told them exactly what I felt about R. C. I was pleasantly surprised when they told me that they had heard the same complaints from numerous students. “He won’t be teaching here again”, is what they told me. Ahhh… sweet victory. I’m not a vindictive person, but this was something I felt very strongly about and I felt that I was treated unfairly. I was glad to know that others felt the same way as well.

Anyway, so that’s my “WTF?!” story. I probably won’t be posting from my WLC training, so I’ll try and post after I get back. Until next time.

Real Programmers

Real Programmers have their epiphanies at around 3 or 4 am. I have been debugging assembly code for a few hours. I fixed it at about 4:15 am. It is a wonderful feeling. I am a code monkey and proud of it.

All original content on these pages is fingerprinted and certified by Digiprove
%d bloggers like this: