Pages

4.17.2013

Coding Derp of the day

As I write more and more code in my CS classes, this type of post could become a regular thing.


This code actually works.

The function above simply asks the user if he/she would like to go again, used for whatever.  If the user answers yes or no, the function returns 1 or 0.  Otherwise it loops again until the user inputs yes or no.  The "for" loop capitalizes each character in the response so that the input string can be of any case.

Here's the derp I made.  I forgot to initialize "i" to 0 (line 57) each time the main loop runs, so if the user entered an invalid answer the first go around, "i" was incremented to 10 and never reset.  Any subsequent go-rounds would never enter the for loop to capitalize the input, therefore entering "yes" was not being considered as valid because "yes" is not the same as "YES"!

Anyway, I spent about 30 minutes debugging this one thinking it was some sort of input buffer issue with new line characters.  Hope that somebody else can learn from my mistake.

4.11.2013

Das keyboard modding

You can go anywhere and read somebody else's review of the Das Keyboard Ultimate.  I bought mine this week and I love it so far.  But the one irritating thing is the plastic on plastic banging sound when the keys bottom out.  I've never been a good touch typist, so I inevitably bang on the keys harder than I need to.  The solution to the obnoxious noise: O-rings under the key caps.

To do this project yourself, you'll need a few tools and some O-rings.

I recommend the following key cap puller tool: link
These o-rings also worked well for me: link

You should also grab a set of long nose pliers for removing the large keys from the stabilizers.

The process itself is fairly straight forward.  Spread the puller tool over a key cap and pull upward.  The larger keys will require you to use the pliers to pull outward on the stabilizer bar in order to remove the key.


Pitfalls to avoid:
  • Avoid removing all the caps at once.  Each row is slightly different.
  • Put the keys on the right way. The flat side of the key faces the back of the keyboard. (When you look at a key from the top down, once side is noticeably less slanted.
In case you do make the mistake, the keys are stamped on the backside with a row number and another number.  If you screwed this up like I did, here is a little diagram.

`1234567890-=    (No row number) tallest
qwertyuiop[]    (R3)
asdfghjkl;'    (R2)
zxcvbnm,./    (R1) shortest


The actual placement of the keys within the row does not seem to matter from what I can tell.

If you're wondering what is sounds like when you're all done, have a listen.  The first set is from the un-modded keyboard, the second part of the clip is from the keyboard after the O-rings have been installed.  Listen on soundcloud.  Sorry, I couldn't place the widget on this page, the soundcloud widget was causing Chrome to tweak out.