May 17, 2013

Quick Tip: Fix Sidekiq-Web with asset pipeline

For those still struggling to figure out why the HTML won't render with Sidekiq web, here's a quick tip:

Old way:

# routes.rb
require 'sidekiq/web'
# ...
mount Sidekiq::Web, at: '/sidekiq'


New way

# config.ru
require 'sidekiq/web'

run Rack::URLMap.new(
    "/" => Rails.application,
    "/sidekiq" => Sidekiq::Web
)
Read on...

May 16, 2013

Quick Tip: Fix Resque-Web with asset pipeline

For those still struggling to figure out why the HTML won't render in resque web, here's a quick tip:

Old way:

# routes.rb
mount Resque::Server, :at => "/resque"


New way

# config.ru
require 'resque/server'

run Rack::URLMap.new(
    "/" => Rails.application,
    "/resque" => Resque::Server.new 
)
Read on...

Mar 9, 2013

Music without Device Lock-in

Recently I took the plunge into figuring out a solution to play music in my apartment. I tried a number of solutions but the deciding factor for me ended up being setup and the type of apps available for the hardware platform.


My building offers free WiFi (hooray!) but no dedicated ethernet port (boo!). Here are the 3 things I tried before succeeding.


The Nexus Q is pretty simple to set up. Joining my existing network was a snap and didn't require any special cables, a monitor, etc. It did require that I download the Nexus Q app for my Android phone though. Once it was up and running I noticed a number of inconveniences.


  1. 1. Software is a bit spotty. Google is King of Software so I'm sure this will get sorted out soon.
  2. 2. Requires wired speakers. A huge bummer. You have to get wired speakers and physically plug them into the Nexus Q using banana jack plugs. I borrowed a pair of good speakers with the necessary wires and plugs and gave it a go but the whole thing just looked ugly. (It's an apartment and I'm not going to be able to hide those wires easily.)
  3. 3. Vendor lock in. I really expected Google to be bigger than this. I can't understand why I can't control my Nexus Q from my Mac. I also can't figure out why they wouldn't allow Pandora or 3rd party apps.

So at the end of it, I had to put the Nexus Q back in its box. All the hardware is there so I hope a future software update enables bluetooth speaker pairing and 3rd party apps.


I next tried a Raspberry Pi. Building it is a snap but the lack of TV really made setup impossible. I may give this a try someplace else. Raspberry Pi + Music Player Daemon should be a no brainer. There's even a version of MPD that works with Spotify.


The last thing I tried was Sonos. They've got a basic bridge and Play 3 wireless speaker that costs around the same price as the Nexus Q. The only problem here is that the bridge requires Ethernet. Fortunately I didn't have to look far before I figured out the Apple Airport Express offers a client mode which basically transforms WiFi signals into Ethernet. (The Airport Express does much more too but this is the mode I needed!) After setting up client mode and getting my building to authenticate the device by MAC Address, I was cooking with gas.


Sonos setup is really simple and they offer applications for Windows, Mac, Android, and iOS. It's not perfect (hey Sonos, where's my Debian package?!) but it works well. And the best part about Sonos is that there's no vendor lock in at all. I've got Pandora, NPR, Spotify, and Amazon's cloud player all set up and working.


Apple and Google may think they're winning the war by using their Android and iOS platforms to lock in users, but the reality is that for me, it means giving even more power to the independent vendors who just want your stuff to work wherever you want it to. So thank you Amazon, Netflix, Dropbox, Evernote, Pandora, Sonos, and the rest of you letting me use the things I paid for how I want to.

Read on...

Dec 15, 2012

RailFood Evolves: Another pivot

Having a startup is easy. Succeeding is a different story. It's a terribly competitive game and there are lots of ways to fail and no absolute ways to succeed. One of the ideas I've been working on for about 5 years just took a big shift both in features and messaging.

Initially, RailFood was a Parts listing site for the rail industry. We have paying customers but many of those on the supply side deal with verticals other than rail. So we expanded and changed the name to Partsbook.

Partsbook handles spare parts inventory for most heavy industrial verticals - not just locomotives. We're now working with Mining, Oil and Gas, Marine, Helicopters, Fixed wing aircraft, and plan to add a few others as well.

Throwing the site out there has presented some challenges. Mostly: the buyers are quite content dealing with their existing suppliers and don't want to lower pricing where it might increase tangential risk. On the other hand, suppliers are finding it a waste to deal with the same buyers and not increase their sales opportunities.

I've been giving this some thought, and I think the solution is to reposition the site. Right now we are transaction based - like Amazon for heavy industries. Instead, we'd like to be more community based. So in the next few weeks we'll be experimenting with some different positioning -- trying to see if get more traction by saying we are a collaboration portal over purely a place to buy/sell parts. In fact, we've already changed the title of the main page: Organized procurement and sales for Heavy Industries.

What's been your experience with repositioning your startup? Any tips or advice? Read on...

Nov 17, 2012

Enable wildcard searches in Sunspot 2.0

We've got a web application that allows folks to search for heavy equipment by part numbers. Sometimes those part numbers follow patterns which makes doing a partial search worthwhile. But we didn't want to clutter the searches by default. So if somebody searched for 10332 we and it wasn't an exact match we'd skip returning any results but 10332* should return anything that was close.


In Solr/Sunspot the default query mode is Dismax. It's fine for the job but there's no easy support for wildcard searches. It is possible to modify the solr/schema.config file but that won't necessarily be effective if you're using a hosted solr solution.

The solution isn't ideal, but thanks to jashkenas I found something which does the trick.

First create a file in config/initializers called solr_edismax.rb or something similar. We'll monkey patch solr to force it to use the Edismax query mode which provides wildcard searches. I'm hoping in the future that this will be the default...

Then, paste in this code snippet.


OriginalDismax = Sunspot::Query::Dismax

class PatchedDismax < OriginalDismax

  def to_params
    params = super
    params[:defType] = 'edismax'
    params
  end

  def to_subquery
    query = super
    query = query.sub '{!dismax', '{!edismax'
    query
  end

end

Sunspot::Query.send :remove_const, :Dismax
Sunspot::Query::Dismax = PatchedDismax



Once done, your query parameters sent to solr via sunspot should use defType=edismax by default. The adjust_solr_params and adjust_query_params methods didn't seem to work at the time of this writing, but if that changes, those would also be valid ways to accomplish this.
Read on...

Jul 27, 2012

Fix Homebrew, Apache, & PHP in Mountain Lion

If you just upgraded to Mac OS X 10.8 (Mountain Lion) you're probably prepared for a little heart ache as you try to get your beloved stack up and running again. Rails, Apache, and Homebrew are probably all causing you some fits.  But don't worry! Getting things back up and running is easy.

Here two quick links to help you accomplish  your goals:

1. http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion

2. https://gist.github.com/3182604

Be prepared for a lot downloading and compiling! Read on...

Jan 21, 2012

Quick Tip: Using the Progress Bar gem

I've got a long running rake task.  Yep, I hate to have it but it's necessary.  So rather than just sit back and wonder how long it's going to take and how long I've already been waiting, I decided to take a look at the progress_bar gem.  Using it is fairly simple.. you can take a look at the documentation for some nifty options but let me step you through a very simple example on how I use it in a rake task.


require 'progress_bar'

desc "Do some awesome thing that takes a long time"
task :my_rake_task => :environment do |t|

  progress_bar = ProgressBar.new(Person.count)

  Person.all.each do |person|
    progress_bar.increment!
    person.gender = person.gender.downcase
    person.save
  end

end

Super simple. Here we have a few key things to remember:

  1.    1. Require the progress_bar gem and make sure it's in your Gemfile

  2.    2. Set up a new progress bar outside your loop and set the max correctly. In our case we're doing something for each Person so we'll set the total amount of records to the count of everybody in our Person model.

  3.    3. Increment the progress bar in the loop. By default you increment by 1 but read the docs if that's not what you want.


And that's it! I first ran into this gem from using the sunspot:reindex rake task. It's perfect for something like that and adds a little polish to your work.
Read on...

Dec 26, 2011

6 Ways I'm using my Nook Tablet


A little while back I bought a Nook Tablet. I have no idea why I did it.  I've owned an iPad in the past and the application used the most (iMockups) isn't even available on Android.  But the NT is smaller, lighter and cheap enough that I had to give it a try.  It started off miserably.  Even after rooting, it was basically collecting dust.  But then I started to embrace it and now I find it useful for a number of things.  Here's what I'm up to with it. Perhaps it can inspire you as well.



1. Reading comic books.  Yeah, how old am I?  Confession: I haven't enjoyed comic books since I was 15 or so. Somehow at that age I got the impression that collecting comic books could be worth a lot of money someday. I bought comics I thought would appreciate and kept them in immaculate condition hoping that 20 years on I could sell them for beaucoup bucks.  It didn't turn out that way.  



But years later here I am and comics are available in digital format.  I'm happy to pay and buy those same comics using the Comixology app for Android. It's got a nifty pane-by-pane viewer that makes reading a snap.  And if you've got your own CBR or CBZ files, there's Perfectviewer and a slew of other comic book readers as well.  



2. Sketching.  I know, first comic books and now I'm doodling!  Honestly I was thinking about getting an Wacom Inkling and that plan may still come to fruition. But since they aren't shipping yet, I figure I'd get back in the game using SketchBook Pro.  So far I'm having fun but not producing anything worthwhile.  I figure that'll come with practice.  Plus I also need a decent stylus. (The one I bought doesn't seem to work well.)  If you've got a recommendation please let me know!  [Update: I ended up buying the official Vara stylus from a Barnes and Noble store. Not sure why they're not sold online, but it works way way better than the other one I had.]


3. Keeping track of my music practice.  I started playing the sitar in early 2011.  Every week I'd bring a notebook and write down the notes to the song my teacher wanted me to practice. Then I'd also record what the song was supposed to sound like using Voice Recorder.  Now I record the audio in Evernote and tie those to hand-written notes in Genial Writing. Boom, both audio and text in one convenient notebook that syncs everywhere!

4. Reading and surfing.  Here's one thing I'd really prefer to do on an e-ink reader. And I mostly do use my kindle for this. (Hey BN, where's 3G and audio on your Nook Simple Touch!?)  Still, as with comic books, some web pages come alive on the tablet.  The Google Currents app is my current favorite way to consume news.  If you haven't seen it I encourage you to check it out!

5. Gaming.  Ok, I don't play a lot of games. The types of games I like to play don't seem to exist in the Android market yet. Maybe someday but for the moment I've only found a few.  Plenty of blogs can recommend games for you so I won't bother. But I will say the extra screen real estate is useful for seeing what's coming at you. 

6. Watching movies. Yep, I'm on the Netflix bandwagon. I just signed up for an account and am happily going through seasons 1-4 of That Mitchell and Webb Look.  If I could figure out a way to watch live sports on this thing I'd be a happy guy.

Now I realize all of this could be done with an Android phone too. And if you've got one with a big enough screen you might be happy with that. Still, the extra screen real-estate means that the Nook Tablet is a bit more useful doing these things in my opinion.  In any case, I finally found a few uses for my tablet and I couldn't be happier.
Read on...