May 29, 2010

New Job At PuppetLabs

Filed under: food,General,Technology — mmrobins @ 11:05 am

More technical info on my nerdy blog for those that don’t fall asleep to a few programming terms, but I’ve got a new job at Puppet Labs.  Aside from the technology, I’m excited about the shorter commute to downtown, the insanely better food options because of all the food carts nearby, and of course the better salary right before the baby is born.

I’ve already been there two weeks now and have probably eaten at DC Veg food cart half the days.  Sooner or later I’ll start bring my own lunch from home again rather than eat out  in order to save money and not get fat eating out all the time, but for now all the delicious food options are just too much and my new coworkers like to go out to lunch together.

August 28, 2007

Sony Reader

Filed under: Technology — mmrobins @ 1:23 pm

I faced a major dilemma in packing for Peru: what books to bring? Books are heavy and bulky, but I can’t imagine not having something to read during downtime, which there’s plenty of while traveling (airports, bus stops, train stations, etc). While I can easily entertain myself with one or two books for a week, six months is too long for just a couple of books. So I got a Sony Reader. So far I love it.

The screen is as easy on the eyes as paper and the battery lasts a long time. The text can be resized to three different sizes which makes it even easier on the eyes. It can even do a decent job of displaying PDF’s that are formatted to be printed at 8.5×11, although it’s often necessary to rotate the device to a horizontal display so that half a page is displayed at a time (hold the size button down until it rotates).

The device costs $300 which is a bit much for some books, but when I think about how much I spend on gear to make it lighter and smaller I feel justified. I wanted to wait a bit longer for it to come down in price and include a few more features, but moving abroad determined the timing of the purchase. The features that I really want included that aren’t:

  1. Searchable text
  2. A touchscreen that allowed hyperlinks to be followed so that you could put wikipedia on it.
  3. A dictionary so that you could click on words and bring up the definition.

So basically everything I want would require and input method like a stylus or an onscreen keyboard or something. The Iliad is another reader that costs $700 and you can write on it, but it doesn’t look like it makes the text searchable either, and I don’t think it can do hyperlinks.

I’ve got dozens of books ready for the trip now. The best places I’ve found for getting free books are Project Gutenberg for stuff out of copyright and Wowio which has free books that are ad sponsored. There is a store that Sony has where you can buy books, but when you’re DRMing the purchase and still charing almost as much as you would for a paper copy, it’s not very worthwhile. I’m willing to pay for electronic versions of things, but not when they’re less useful than the physical media versions and when the cost doesn’t reflect even part of the savings in distribution.

Overall I’m already happy with the purchase. I’m looking forward to reading a lot of good books while traveling.

March 7, 2007

Email Subscriptions Now Available

Filed under: General,Technology — mmrobins @ 3:44 pm

I realize that most of my friends and family don’t have a clue what RSS is or use any kind of feed reader, so I’ve setup email subscriptions if you want em.

Enter your email address:

Delivered by FeedBurner

I’ve also converted my feeds to feedburner so I can see if anyone ever actually does subscribe to an RSS feed. I figure once I move to Peru more people might be interested in reading about that than me moving across town.

February 13, 2007

New Tech Website

Filed under: Technology — mmrobins @ 11:26 pm

It’s time for me to branch my blogging: one for personal stuff, one for work related technical stuff. I’ve never really wanted my personal blog to be big on search results for my name, even if I have a way of keeping my personal posts mostly personal. However, it’s always bothered me a little that searching for “Matt Robinson” I don’t even register on the first 5 pages (I quit looking after that). So I’ve nabbed a sweet new domain: mattrobinson.net. Both .com and .org had been taken, and honestly I’m surprised this one hadn’t with all the matt robinsons there are. Now I can write technical, nerdy stuff and get recognized for it. Potential employers will Google me and find stuff that looks good for a job app instead of my vacations and movie reviews that I post here at mmrobins.com.

Anyway, hopefully anyone who actually reads this isn’t upset about possibly subscribing to two RSS feeds, but then most people who read this don’t even know what RSS is, so they definitely won’t miss my tech writing, of which there should be a lot more now on the other site.

January 23, 2007

Ruby sort_by for Enumerables

Filed under: Technology — mmrobins @ 10:28 pm

I have been trying to figure this one out forever. I have an array of objects, usually hashes, and want to sort them. Thing is I want to sort them by their values, not their keys. Regular old sort for arrays is powerless here since it doesn’t know how to compare complex objects, let alone reach down inside them and sort by that value. I found sort_by finally, but still couldn’t get it to do what I wanted often because sometimes the objects I was sorting could have a nil value, and the sort function doesn’t know how to sort nil. Here’s an example: I have an array of Employees, and each employee has an employee_number. Actually not every employee has a number, since some are temporary. So if I try to sort by employee_number bad things happen.

Here’s how I finally made it work.

array.sort_by { |employee| employee.number.nil? : 0 : employee.number }

It basically says if the employee number is nil or null or whatever you want to call it, pretend we’re sorting by the value 0, otherwise sort by the employee number. Hooray!

September 15, 2006

Two Weeks on Nothing but Linux at Home and Loving it

Filed under: Technology — mmrobins @ 10:31 pm

So far there’s nothing I really miss from Windows, thanks in large part to the help frum ubuntuguide.org. I haven’t dealt with finding a replacement for Microsoft Money yet and will have to soon. Gnucash sounds like it’ll work, but it really does look uglier than Money, not that it’s toooo important for a simple finance program.

I was really impressed that I was able to find a program called VueScan that supported my dimage scan dual iv so that I could scan all my photos. It seems to work even better than the program for windows that came with the scanner.

My only complaint so far is that FLAC files didn’t play on Amarok. I found an updated version of libxine on somebody’s web page that fixed it. I’m absolutely loving Amarok though. That’s easily the best music player I’ve ever used.

I’ve got a computer running Ubuntu at work now too. I’m slowly tring to move everything over there too, but it’s a lot harder when everything around you is Microsoft, from Active Directory to Exchange to Project.

September 3, 2006

Ubuntu 6.06

Filed under: Technology — mmrobins @ 10:51 pm

I’ve finally got linux working with wireless on my laptop with http://www.ubuntu.com/. It still didn’t work straight off the install, and I’m wondering why Network Manager isn’t the default by now, but after installing that, and the correct drivers for my wireless card to use with ndiswrapper (type lspci in the terminal and look for you wireless hardware info then find the drivers at http://ndiswrapper.sourceforge.net/mediawiki/index.php/List), I had a wireless connection that could do WPA authentication in more than one place easily. Phew.

There were a few other small road bumps. Almost everything can be fixed or figured out with the help of ubuntuguide.com. Sound for flash didn’t work, which was a problem for youtube.com, but ubuntu guide had an entry for that. One of the first things you should do is run Automatix (there’s instructions for that on ubuntuguide.com also), which automatically downloads a ton of proprietary software than can’t be included with the open source Ubuntu install like mp3 and other audio and video codecs, Acrobat PDF reader and more. I wanted a utility to tell me where my disk space was like Treesize does for Windows and found baobab in the Synaptic package listing.

I was excited to see Google has some of their apps on linux, because I love Picasa for organizing photos. Google Earth is cool even if I rarely use it. I was even able to get some Windows apps installed with wine. So far I’ve been using this linux distro for about a week and haven’t needed to boot back into Windows for anything except Yahoo Music Player so that I can stream those damned DRM’d music files.

If any of my friends or family read this and want to try installing Ubuntu let me know and I’ll help. In many ways it really is better and easier than Windows, the main downside is you have to learn a whole new system which makes it seem harder at first. I don’t belive Linux will really take off in the Desktop arena in the U.S. until it comes preloaded on more computers, but that IS beginning to happen. Even if people don’t take the time to run linux or other ‘free software‘, it’s well worth understanding the philosophy and ethics behind free software.

June 28, 2006

Connecting Rails to Pervasive SQL ODBC

Filed under: Technology — mmrobins @ 10:40 am

I’d been putting off trying to link my rails app to our accounting deparment’s Pervasive SQL database because I thought it would be really hard. Turned out to be quite easy using ODBC. It might be nice if in the future someone wrote an adapter specifically for Pervasive SQL, but for now ODBC does what I need which is allow me to access employee data already populated in the accounting database so that I don’t have to duplicate in the rails database. I found the code to get me going on this from the first reply at this Ruby Forum conversation. Below is a method I defined in my employee controller.

  
  def sync
    @conn = DBI.connect('DBI:ODBC:odbc_name','username','password')
    Employee.current_employees.each do |emp|
      rs = @conn.select_one('SELECT EMPLOYEE.WC_Code, EMPLOYEE.Employee_Name 
                                       FROM EMPLOYEE WHERE ((EMPLOYEE.Employee) = \'' + 
                                       emp.employee_number.to_s + '\')')
      emp.empl_workers_comp_code = rs["WC_Code"] unless rs.nil?
      emp.save
    end
    redirect_to :action => 'list'
  end

The only problem is I can only seem to call this method while running WEBrick. If I try the method while running Mongrel I get

DBI::DatabaseError in EmployeesController#sync
S1000 (-4019) [TimberlineODBC][TimberlineODBCEngine ODBC Driver][DRM File Library]Drive or directory unavailable [IO-WIN 3]
Screen\OD.scr
RAILS_ROOT: c:/rails/kj/config/..
Application Trace | Framework Trace | Full Trace
c:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in `connect'
#{RAILS_ROOT}/app/controllers/employees_controller.rb:9:in `sync'
c:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in `connect'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/base.rb:910:in `perform_action_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/rescue.rb:82:in `perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/base.rb:381:in `process_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/session_management.rb:117:in `process'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/dispatcher.rb:38:in `dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel/rails.rb:85:in `process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:563:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:562:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:648:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:648:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:637:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:969:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:968:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel_service-0.1/bin/mongrel_service:84:in `service_main'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel_service-0.1/bin/mongrel_service:153
c:/ruby/bin/mongrel_service:18
c:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in `connect'
#{RAILS_ROOT}/app/controllers/employees_controller.rb:9:in `sync'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/base.rb:910:in `perform_action_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/rescue.rb:82:in `perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/base.rb:381:in `process_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.2/lib/action_controller/session_management.rb:117:in `process'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.3/lib/dispatcher.rb:38:in `dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel/rails.rb:85:in `process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:563:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:562:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:648:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:648:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:637:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:969:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.2-mswin32/lib/mongrel.rb:968:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel_service-0.1/bin/mongrel_service:84:in `service_main'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel_service-0.1/bin/mongrel_service:153
c:/ruby/bin/mongrel_service:18

and a different error in Apache that I can’t reproduce right now. I’ll probably have to figure this out sooner or later once I have more data that needs to be synced on a regular basis. I tried just writing a method for the model that returns the data in question from the Pervasive database, thus providing completely updated data on every request and avoiding storing the data on the rails database, but it was waaaaaaay too slow. Maybe if there were a Pervasive SQL adapter it would be faster than over ODBC.

April 20, 2006

Rails Sortable Column Headers With Associations

Filed under: Technology — mmrobins @ 1:33 pm

Of all the magic things Ruby on Rails does by default, I’m surprised they didn’t automatically create sortable column headers. I figured out my own way to do it, but I couldn’t figure out how to sort columns correctly when the data for that column contained a foreign key – until now.

For example, I have a requests table with an employee_id field. This is an integer that references the id of some employee in my employee table. Sorting those integers doesn’t alphabetically sort my request list based on who made the request.

I finally found a good lead to the solution from a modified version of SortHelper2, by Jonathan Conway. His code worked great for me as long as I did my list function like this:

def list
      sort_init('id', 'asc', nil, 'cheeses', true)
      sort_update
      @cheese_pages, @cheeses = paginate :cheeses, :per_page => 30, 
      :order =>   sort_clause, :include => [:cheese_maker]
end

But I defined some functions in my class that I use so that I don’t have to rewrite finds every time, so I had to use custom/classic pagination. This got me to wonder what the code looked like for the find statement. I finally figured out how to use the :include statement in the find command to sort by an association.

find( :all, :include => :employee, :conditions => ["resolved_on is null"], 
                          :order => "employees.name asc",
                          :limit  =>  @it_request_pages.items_per_page,
                          :offset =>  @it_request_pages.current.offset)

Normally I think the api documentation for rails is great, but how am I supposed to know how to do this from the find function definition of :include option (:include: Names associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer to already defined associations. See eager loading under Associations). Okay, I guess there’s a decent example if you do find the eager loading section of the Associations definition.

November 13, 2005

Google Adsense – Done

Filed under: Technology — mmrobins @ 2:59 am

I’ve taken that Adsense Ads off my site. They haven’t earned me even a penny in weeks. They just aren’t worth having on a site with so little traffic, especially when traffic is mostly friends and family. I pretty much knew that before I started, but now at least I have a better feel for how it works. It’s a really cool advertising concept though. I was actually interested in quite a few of the ads that displayed since they were about subjects I was writing about.