• Coffeescript is Whitespace Sensitive

    I’m attempting to get autocomplete working on a rails app. I’m basically following the instructions in Railscast #102 (revised). It wasn’t working because I didn’t realize that coffeescript was whitespace sensitive. Once I realized that, I thought I was set, but I wasn’t. I like having my tabs be two spaces, but coffeescript wants four space tabs. So after I doubled all of my tabs, things started working.

  • Context

    There are a number of blogs that I read, almost daily. I know a lot of people do this and many do it by subscribing to the RSS feed of a given blog. I am not one of those people. Why? I like to see the information in its original context. RSS readers strip everything off the webpage except the text of the post. So just by glance, I can’t tell which website the post came from. I don’t like this at all. I prefer to read the text on the original site that the author created. Why? It helps me to remember where I read the information. A typical example, just the other day, I was thinking that there was a book I was interested in reading because I had read about it on some website. It was a somewhat technical book, so it could have been reviewed on any number of sites that I visit. However, I couldn’t remember the title and I didn’t think it was an actual review of the book. I was something written by the person who wrote the book. I remembered liking the post, but all I could remember was that I had read about it in December and it was to be published in January. Now that it was January, I wanted to remember it to see if I wanted to buy it. After picturing the article, I remembered that it was on the NY Times website. I like that my brain still had the connection of where I read the article. I supposed if I read it in an RSS feed (which I don’t even know if the NY Times provides), I could have looked there somehow. But I think it’s good for my brain to still be making connections like this. It’s probably more inefficient to read blogs this way, but it’s my preferred way. And I’m also not a fan of making everything more efficient. Inefficiency is good. But that’s a post for another day.

  • To 2013

    Here are my goals for 2013. A lot of the same things as last year, but hopefully I’ll get further along with them.

  • 2012 in Review

    Being the last day of 2012, I thought I’d take a minute and check out how I did with the goals I set for last year.

  • Kindle/iPad/ebook Reader Issue

    I just purchased a book on Amazon to read on my ipad. Unfortunately, I have a number of different email addresses and I ended up using an email address that was different than the one I used to set up the Amazon app on my ipad. So the only way that I can read the book I just bought is to deregister the app with the old email, which will delete all the books that I currently have and then reregister with the new email address that I used. I did that and now have a single book in my ipad app, which is the one I just bought. If I want to get back the others, I have to repeat the process and go back to my old email address.

  • Ruby and Ldap

    I’ve been rewriting a script I use that lets people update their linux and samba user passwords at the same time. Our server uses samba and openldap to behave as a primary domain controller for our windows computers and a single sign-on for a few other services. It’s been working great for years and way back when we started using this, I wrote a perl script to take care of keeping the two passwords in sync. The original problem was that if you use the regular linux passwd command, the linux password will change, but the samba one will not. The samba password uses an nthash. In a given user’s ldap account, there is the userPassword field which holds the linux password and the sambaNTPassword field which holds the samba password. For a user to be able to use any of the web services we run on the server and login to any of our windows computers with the same password, these two fields need to contain the same password.

  • Hidden ~/Library Directory

    Mac OS X 10.8 (I think 10.7 too) hides the user’s Library directory by default. This is annoying. To automatically make in show in Finder, run this:

  • Mac Keyboard Shortcuts

    Command – arrow keys = change to different terminal windows

  • Site Update

    I had a little time yesterday so I updated the user interface for the colandheartless site. It didn’t take too long and I’m very happy with how it turned out. The site is basically just serving up static webpages, so it’s just some basic css/html. I did make all the pages php, but that’s just so that I could put a function at the top of the page to display the header and navigation bar. It’s really the only php that I know, but it’s so handy that I use it all the time. Anyway, I wanted to update things so that I have slightly better organization for when I add new stuff. Specifically, I’d like to continually make pages that document the process of making the map game I’ve been thinking about and all the stuff that I’ve had to learn to be able to make the game. I could do this in the blog, but I’d also like to have a freer format for things than the blog provides. With the new site, I can pretty much do whatever I want.

  • It Takes Time

    I have, for the past few days, been immersing myself in adding parts to my arduino to extend functionality. There’s a game involving a map that has been floating around in my head for a very long time. It’s finally time for me to do something about it, so I’m starting to learn the things necessary to make it happen. I successfully hooked up a shift register to add a lot more leds, which will be necessary and now am hooking up a different type of shift register to add more buttons. This has proved a bit more difficult, but now, in my advanced age, I know that it takes time for things to sink in. Today was one of those great days where after struggling for a while, the light bulb went off over my head and I think I understand how things work.

  • Regex in Ruby

    This is something simple that I should know off the top of my head, but seemed to have forgotten today. So I’m writing it here, to hopefully, help me to remember.

    On one of the webapps I’ve written, someone signed up but had an apostrophe in their name. I had already accounted for spaces in names, but not apostrophes. So, I decided that I should fix things for any non-word character.

    The method that cleans up the name is this:

    def fullname_no_spaces
      [firstname.gsub(" ","_"), lastname.gsub(" ","_")].join("_")
    end
    

    This just substitutes any spaces it finds with an underscore. To have it replace any non-word character with an underscore, I just changed it to this:

    def fullname_no_spaces
      [firstname.gsub(/\W/,"_"), lastname.gsub(/\W/,"_")].join("_")
    end
    

    That fixed my problems. For further reference, here are the regex values I could use:

    ^  beginning of a line or string 
    $  end of a line or string 
    .  any character except newline 
    \w  word character[0-9A-Za-z_] 
    \W  non-word character 
    \s  whitespace character[ \t\n\r\f] 
    \S  non-whitespace character 
    \d  digit, same as[0-9] 
    \D  non-digit 
    \A  beginning of a string 
    \Z  end of a string, or before newline at the end 
    \z  end of a string 
    \b  word boundary(outside[]only) 
    \B  non-word boundary 
    \b  backspace(0x08)(inside[]only) 
    [ ] any single character of set 
    *   0 or more previous regular expression 
    *?  0 or more previous regular expression(non greedy) 
    +  1 or more previous regular expression 
    +?  1 or more previous regular expression(non greedy) 
    {m,n}   at least m but most n previous regular expression 
    {m,n}?  at least m but most n previous regular expression(non greedy) 
    ?  0 or 1 previous regular expression 
    |  alternation 
    ( )  grouping regular expressions 
    (?# )  comment 
    (?: )  grouping without backreferences 
    (?= )  zero-width positive look-ahead assertion 
    (?! )  zero-width negative look-ahead assertion 
    (?ix-ix)  turns on (or off) `i' and `x' options within regular expression.
    

    I use a few of these a lot, but I need to remember all of them because they’re really handy. Perhaps, I’ll make a printout and hang it in my office.

  • Fun

    I can’t believe that my nieces and nephews don’t like coming to my house because I have no games. I let them play with real tools like drills, hammers, saws, etc. That’s way more fun. Here’s Abby using a drill.

  • Windows 8

    I had read a bunch of bad things about Windows 8, so I thought I’d use my Technet subscription to install it and see for myself. When it first starts, it does truly suck. I don’t know what that first window that comes up is, but it looks ridiculous on a laptop. However, my clicking on my account name, I got to the familiar desktop. I’ll have to see if there’s a way to just make that be the default. The next weird thing was the lack of a start button. This meant that I couldn’t figure out how to get to the Control Panel. So I ended up installing a free program called Classic Shell. This gave me the start button and let me get to the Control Panel, which looks remarkably like Windows 7. That’s good. Anyway, I created a link on my desktop to Control Panel. I tried duplicating this link to see if I could have created it without installing Classic Shell, but that didn’t work.

  • Cloudflare

    I just put coldandheartless.com on Cloudflare. It sounds like something that would be really helpful and I figured I’d give the free version a try before I move another domain to the paid version. It was incredibly easy to set up, which was great. Took basically a single click in my Badger account to enable Cloudflare and then put in the new dns values. I’ll admit that I don’t exactly know how it all works, but so far it seems pretty cool. I did see that there’s a wordpress plugin for Cloudflare and I’ll probably install that next.

  • Floor Pictures

    I’m basically done with the floor, but forgot to post the pictures I took of the process. So, for future reference, here they are:

  • Blinds!

    The floor is basically done. I just put some brown paper on it for protection as I washed all the walls and repainted in a few areas. I also put up blinds! They look great and work wonderfully as well. To help me with the blinds, I brought down my table and put that in the dining room so I could work easily.

  • Days Off

    I took the rest of this week off. Today, I decided to drive to Glacial Park Nature Preserve in Ringwood IL, which took me about two hours to get to. I read they had a nice hiking trail and while I hadn’t ever hiked before, I thought it was something that I might enjoy. My goal on the hike was to take one picture that I could print out and hang on the wall of my newly finished house. All of my pictures are here. Most aren’t very good, but there are two that I think I’d be happy with on my wall. So, when I move back home, one of the first things I’m going to do is have a print made of one or two of them.

  • Updates

    It’s been a while since I’ve posted work done at the house, but work has progressed quite a bit.

  • How I Spent My Labor Day Weekend

    Aside from the time I spent working on my laptop, I did get quite a bit done at the house. I was going to do the final sanding of the wood floor, but then decided that doing the tiling would probably scuff it up a lot. So, instead I decided to start working on the area around the stairs, which will be tiled.

  • Switching to Mac OS X 10.8

    Today, I downloaded and installed Mac OS X 10.8. I won’t call it an upgrade because it’s not. About two hours ago, I attempted to install 10.6 on my one-month-old laptop. Sadly, it did not work. Every time I tried to boot to the old OS, the system crashed. So, I’m stuck with this piece of shit operating system. Here’s the thing. I thought 10.7 was pretty bad. It made no real changes, except things that appeared to be eye-candy, and which, for me, made the product worse. So, what do I hate about 10.8?

  • Test Pattern with Processing

    We have a couple of students who needed a test pattern printed out. The pattern was basically a circle cut into a given number of pieces of pie. They initially requested 100 “pieces”, but weren’t exactly sure if that was going to be what they wanted. There was no chance I’d be able to draw this by hand, so I wanted to write something that would generate the pattern and be easy to edit so they could generate patterns with a different number of pieces. I thought that Processing would be a good way to do this and it turned out to be very easy, once I remembered two things. One, all angles in Processing should be in radians, so 360 degrees is 2 * PI radians. And two, that [0,0] is the upper left corner of the drawing. Once I had those settled, I wrote the following:

  • Last Patch

    There was a small area between the dining room and the bedroom that had some weird wood in the floor. I found out why when I removed it and tried to piece in some pieces I had pulled up elsewhere. The opening was a little bit bigger than the thickness of two pieces. So, I decided to fill it using the maple floor that I had left. Here’s how it looked when I was about halfway through. I think it looks pretty good.

  • Ready for Sanding

    I think I’ve now finished all the repairs on the floor. The wooden floor is now ready for more sanding before finishing. I even broke out the good camera to take some pictures. Here’s how things look, including some of the mistakes that I made.

  • Finished Something

    It took a while, but I finally finished the big flooring replacement at my house. Putting the very last piece in took a bit of work and it’s by no means perfect, but I’m happy with it. Hopefully, I didn’t make any big mistakes that will cause the floor to buckle in winter. I still have two smaller places to patch, but I’m happy with the bit I finished today.

  • New Laptop

    My new MacBook Pro (WITHOUT retina display) came yesterday. It’s SO nice having a matte screen again. I cannot say how much I hate seeing reflections of lights or myself in my screen. So this has been great. I still have my old laptop and I have a time machine backup for it. However, I decided not to use time machine to restore the computer. One, because there’s tons of stuff installed that I don’t really want any more. So, this will force me to clean up. Two, I did restore with time machine a while back, when the hard drive failed. It didn’t work perfectly. And I had to reinstall some software packages and clean up other stuff anyway. So, I decided to just avoid it altogether. This also got me to look at some programs that I was using to see that they won’t run under 10.7. The program I use to encrypt stuff is one such program, so I need to find an alternative for that. There were a couple others, but I think it’s good to set things up again. It helps me to remember why I did it.