• 10 years ago

    February 25, 2016 was the 10th anniversary of my blog. Technically, it’s the 10th anniversary of my using wordpress on the blog. I believe I registered coldandheartless in 2000, when my nephew was born, though I’m not entirely sure. But since I have pictures from when he was born posted, I’m pretty sure. And I have some pictures in directories named 2003. Yay for me in naming the directories correctly. So I know I had the website before 2006. But moving to wordpress looks to have happened in 2006. So let’s celebrate that.

  • Producing a Lot of Crap

    I was reading some notes a person took on a book and found something that I really like a lot. In the book “The Geography of Bliss” (which I haven’t yet read, but now have a hold on at my library), the author writes that in Iceland, they produce a lot of crap. I guess the idea is that lots of people there produce art. So, of course, with so much art being produced, a lot of it is junk. But instead of thinking that’s a bad thing, it turns out that all the crap produced encourages even more people to produce art. So basically, all the bad art is working as fertilizer to help make more art. And every so often, something great is produced. I think that’s great! My immediate reaction is that I should start producing more and just accept that most of it will be bad. But, hopefully, it will work as fertilizer for me as well and maybe I’ll make something great.

  • Uploading a File in a Rails Site to Use to Update

    I want to upload a file to my rails webpage, but not store it in the database. I just want to upload it and then get the data out of it and update the database with the information in the uploaded file.

  • Using Ruby on XML Files

    I need to copy some data from one system to another. On the first system, I can download an xml file. The second system is a ruby on rails website. So I’d like to them upload the xml file to the site and have it enter in the data. But since I’m not that familiar with working with xml files, I thought I’d work on it from the command line first.

    In ruby, there’s a gem called nokogiri which works with xml (or html) files. Here’s the sample xml file that I’m using:

    
    <AbstractBook>
     <Conference>TEST CONFERENCE 2016</Conference>
     <abstract>
      <Id>5</Id>
      
    
    
      Diversity, diversity
    
      <Content>This is all about diversity.</Content>
      <field id="content">This is all about diversity.</field>
      <PrimaryAuthor>
       <FirstName>George</FirstName>
       <FamilyName>Washington</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>WH</Affiliation>
      </PrimaryAuthor>
      <Speaker>
       <FirstName>George</FirstName>
       <FamilyName>Washington</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>WH</Affiliation>
      </Speaker>
      <ContributionType>Abstract</ContributionType>
      <Track>Diversity and Inclusion </Track>
      <AcceptedTrack>Diversity and Inclusion </AcceptedTrack>
     </abstract>
     <abstract>
      <Id>6</Id>
      
    
    
      Higgs, higgs, higgs
    
      <Content>I've got *something to say* out the **Higgs.**</Content>
      <field id="content">I've got *something to say* out the **Higgs.**</field>
      <PrimaryAuthor>
       <FirstName>Abe</FirstName>
       <FamilyName>Lincoln</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>The White House</Affiliation>
      </PrimaryAuthor>
      <Speaker>
       <FirstName>Abe</FirstName>
       <FamilyName>Lincoln</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>The White House</Affiliation>
      </Speaker>
      <ContributionType>None</ContributionType>
      <Track>Higgs Physics</Track>
      <AcceptedTrack>Higgs Physics</AcceptedTrack>
     </abstract>
     <abstract>
      <Id>7</Id>
      
    
    
      Oh the Lovely Higgs
    
      <Content>Some interesting info about how pretty the Higgs is.</Content>
      <field id="content">Some interesting info about how pretty the Higgs is.</field>
      <PrimaryAuthor>
       <FirstName>Grover</FirstName>
       <FamilyName>Cleveland</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>WH</Affiliation>
      </PrimaryAuthor>
      <Speaker>
       <FirstName>Grover</FirstName>
       <FamilyName>Cleveland</FamilyName>
       <Email>[email protected]</Email>
       <Affiliation>WH</Affiliation>
      </Speaker>
      <ContributionType>None</ContributionType>
      <Track>Higgs Physics</Track>
     </abstract>
    </AbstractBook>
    

    And here’s the script I wrote:

    #!/Users/maryh/Software/rubies/2.2.3/bin/ruby
    
    require 'nokogiri'
    
    File.open("Abstracts.xml") do |file|
    	@doc2 = Nokogiri::XML(file)
    	elems = @doc2.xpath("//Speaker")
    	myfirst ='Abe'
    	mylast = 'Lincoln'
    	elems.each do |e|
    		if (e.at('FirstName').text == myfirst) && (e.at('FamilyName').text == mylast)
    			puts e.parent.at('Title').text
    			puts e.parent.at('Content').text
    			print "#{e.at('FirstName').text} " 
    			print "#{e.at('FamilyName').text}\n"
    		end
    	end
    
    end
    

    First, I open the file and open it as an xml file with nokogiri. I then put in elems all the xml fields labelled “Speaker”. I then cycle through elems looking for the string “Abe” and “Lincoln”. If I find them both, I print out the field “Title” and “Content” which are both in the parent field from “Speaker” and then I print out the first and family names.

    This is very basic and there are a lot more things that I need to do. I need to match the speaker info with names stored in a model in my rails app. And then update that entry with the title and content if I find a match.

  • Using Ruby on CSV Files

    I’m working with some different systems for a conference I’m working on. We’re using RegOnline to handle the registrations. One of the things that I need to do is get a list of people who have registered on RegOnline and post them on our conference website. Our conference site is plain html and I don’t want to have to type in each person who registers. I can download a csv file from RegOnline. I want to write a script that reads the downloaded csv file and makes an html file for the website. I hadn’t done much with csv files before, but here’s a basic script that pretty much does what I want. (I still have to put html tags in, but that should be pretty easy.)

  • Paperclip with Spoof File Checks

    I have a rails site that accepts pdf files as uploads. Based on previous experience, I have found that trying to validate on content-type causes lots of problems. There are many browsers that send weird content types with file names. For pdf files, they should always be using ‘application/pdf’ and most browsers do. However, this morning I got email from someone who couldn’t upload his file in one browser. He told me he used a different browser and it then worked. I searched the log files and found a bunch of error messages, but the main bit was this:

  • January Check-In

    Normally, I only review my entire year to see how I did, but I thought I’d maybe check in at the end of each month. I may not do this again until the end of the year, but I had some time so let’s take a look at how the year is going so far.

  • Getting Started with Ubuntu

    Just about all of the linux systems that I work on are a RedHat variant (Scientific Linux or Centos). But in the past few years, more people have been using Ubuntu, so I need to become familiar with it. And yesterday, I had to set up a system to help someone troubleshoot a board that we built. So here are some things about Ubuntu that I’ve learned recently. And just about all of this stuff is done using the command line because that’s how I prefer to work.

  • So far, so good

    We’re three days into the new year and it’s so far, so good. Tomorrow, I have to go back to work. I’m a little bummed that I can’t wear sweatpants all day anymore, but that’s ok. It’ll be good to get back in the swing of things. I’ve taken short bike rides every day so far and am up to 11 miles. So only 2242 to go to hit my goal. 🙂 I’ve cooked some good meals (homemade pizza, eggs with pepper, onion and avocado) and some ok ones (roasted vegetables with noodles). I’ve also used up my blackened bananas by making banana muffins, which turned out pretty good. I went with Paul today to his bar and helped him clean up some wood. So while I didn’t technically do a workout, I worked there for a couple of hours and got my heart rate up. My car has only been out of the garage one day. And since the weather looks pretty good, I’m hoping that the bike will get me to work for most of this week.

  • To 2016

    Happy New Year!

  • 2015 Year in Review

    I’m trying to come up with a one-word summary for 2015 and am having some problems. All that pops into my mind is ok, which is sort of a lousy word to sum up a year. Perhaps acceptable would be better? Anyway, there’s no need to dwell on a one-word summary. Let me look at things in a bit more detail.

  • Declarative Authorization attribute rules

    I have a website where I use declarative authorization to determine who is allowed to do what. One thing that I need to allow is for people to change their own passwords. It’s pretty simple, my model/controller is users. Here’s what I needed to do:

  • It&#8217;s Funny

    I’m a huge fan of YouTube for learning how to do different things. I’ve been watching tons of YouTube videos for woodworking while I try to build stuff with my reclaimed wood. Last weekend, I decided got a beanbag chair that had no cover. So I decided to make a new cover for it and in the process broke something on my sewing machine. So I was looking around YouTube for some help on fixing it. In the process, I watched a bunch of videos on sewing. It was so funny to me how the genders of the people hosting the videos just changed. For woodworking, I can think of one female who made videos. Everyone else was guys. For sewing, it’s all women. This just struck me as very funny.

  • Early Gift to Me

    Since I had been doing a bit more work in my basement, I was continually using my old workbench and it was annoying me more and more. It’s more of a cheap worktable than workbench. But the big issue is that it was just really too tall for me. It was around 36″ tall and I think that I’d prefer a workbench that was quite a bit lower. It really hit me when I was trying to use a handplane to clean up some old lathe. Along with being too tall, it was also too wobbly, which made planing impossible. So I found a design online that didn’t look too hard. I took apart the old table and made myself a new workbench.

  • Making a PDF File and Automatically Attaching It

    I’m writing a rails site that collects information from an applicant and references from other people that will then be reviewed by a different group of people. For the programmer, it’s easy to present the information from the database on a webpage and then provide links to uploaded documents. However, this is not necessarily the easiest way for the reviewers to read all the information. Based on other sites that do the same type of job, I’ve learned that reviewers want to be able to download a single file with all the information in it. I’ve put together various hacks in the past to do this, but have recently come up with a proper way. The following isn’t complete, but it presents the basics of how to do this.

  • Final Fun

    Before I even think about going back to work tomorrow, I decided to try to do something fun in my basement. My project is to make something to hang coats by my door. I have a couple of boards that I made out of lathe that are around 6″ wide and maybe 30″ long. I sanded them down and painted them red with milk paint. Once they dry, I’m going to pound in some of the original nails to use as hooks. Then I’ll hang one of the boards on the wall by the door. I haven’t yet decided if I’ll hang them both. I think I’ll see if I like the one by itself first to see if I like how it looks. And how the nails work as hooks.

  • Black Friday

    Today is “Black Friday”, which means that I’m spending it relaxing after hosting Thanksgiving yesterday. Thanksgiving is my favorite holiday and I believe yesterday was quite enjoyable for everyone. The wild turkey got deplucked and turned out ok. My turkey breast roast, made out of a bunch of pieces, was good. The roasted sweet potatoes were good. And as always the desserts were finished off without a problem.

  • Winter Biking

    Chicago had it’s first snowfall of the year yesterday. A few inches. But then it got quite cold and while roads were plowed and salted, the remaining water froze to ice. Since I have been biking all year and loving it, I wanted to keep the commute to work for as long as I can. I was a bit nervous about biking in the snow, so I decided to get up early this morning and bike to the grocery store, four blocks away. It was 14 degrees when I left. I was dressed well, so the cold wasn’t a concern at all. All I was worried about was the ice.

  • Car Repair

    My last car repair class at the park was a couple of weeks ago. While I sometimes dreaded getting in the car to drive over when it was already dark out, I enjoyed every single class. And I learned something in every single class. It was easily the best $60 I’ve spent in a long time.

  • Working with Wood

    I have written before how I’m trying to reuse the old lathe that I saved when I redid part of my house. The procedure was basically to plane the lathe, glue it together and then plane it to a smooth thickness. This has produced some very nice boards and I’ve made a couple of nice things with them. The problem is that I’m not enjoying the process. First of all, the planer is freakin’ loud. I wear ear-covering sound mufflers and it still sounds loud to me. I tried using a sander and wet-dry vac, but that’s crazy loud too. As I get older, one thing I’ve noticed about myself is that I like quiet. Another problem is that the planer seems to be breaking a lot. I’ve spent a lot of money on a new set of carbide blades, which have worked well, but cost $249. And I’ve replaced the belt twice. It also generates a tremendous amount of sawdust that gets all over the place. But the main problem is the noise. I like working in the mornings…the earlier the better. But I don’t want to make that much noise. I’m sure my neighbors could hear some of it and I don’t want to be a jerk.

  • Getting Built-in Sound Working with RHEL6

    I had a user running RHEL6 who no longer had sound. His computer has an Asus P8H67-M PRO motherboard. This board has a built-in Intel soundcard.

  • Chicken and Dumplings Soup

    I just made this chicken and dumplings soup. It’s ok, but it’s not great. My main problem is with the dumplings. They’re really heavy. And the soup is good, but I think there should have been an onion in the soup. So after thinking about things, this is what I’m going to try the next time I make it.

  • Bike Travel

    The bulk of my vacation time the past few years, has been spent with me driving to a city with my bike and then biking around the city. Sometimes this has been to go on official bike rides with thousands of other people on closed streets and others it’s just me riding around town on bike paths or in the street. I absolutely love doing this. The big rides are fun because the towns usually route the ride through interesting neighborhoods and past important landmarks. And the individual rides are fun because it’s neat to learn your way around a new town. It’s also easy. I can put a destination in google maps and have it tell me directions best for biking.

  • Could I Live without My Car?

    A couple of days ago, I hit 2000 miles of biking for the year. It wasn’t a goal to do this at the start of the year, but I’m rather pleased with myself. I actually thought it was a bit of an accomplishment until I read a blog post somewhere about a woman with MS who rode like 6000 miles for the year. I have a long way to go to reach that. But this got me thinking, do I really need to own my own car?

  • Oatmeal Update

    I had posted my recipe for oatmeal a while back. As it’s getting chilly, I’ve started having it for breakfast again. This time though, I had whole milk in the house because I had been using it for baking. I think this improves the taste a lot. So my new recipe for oatmeal is: