Archive for the ‘Geeky’ Category

Lessons learned from 11 screencasts

Friday, November 13th, 2009

I’ve now completed 11 screencasts for FOSSCasts.com, and I must say it has been a great learning experience.  I’d like to share the workflow that I’ve settled on.

Getting Started

First, the equipment:

  • recorded on a Mac using Snapz Pro to record the desktop.  Lots of other Mac screencasters will recommend iShowU, but I already had a Snapz Pro license and it works well enough for me.
  • Shure SM55S Mic
  • Tascom USB Audio interface.
  • Final Cut Pro to edit the video, add transitions, and overdub audio.  The first couple episodes were edited with iMovie.
  • Keynote to create slides.
  • Sun VirtualBox for virtualization
  • Levelator to normalize the audio.  Levelator is a great piece of software.

Now, I actually got some advice from Ryan Bates  of RailsCasts fame as to actually recording the screencasts.  For the Quicktime videos I use the Animation codec.  One thing that Ryan pointed out is that the fewer pixels that change, the smaller the file size.  You many notice I don’t do a lot of moving my mouse and try to not use arrows when scrolling.  Just jumping to a section of a document is much better with the Animation codec.  Scrolling text, fades, or anything with lots of movement will make your file size grow quickly.

Now, the Ogg Theora codec is a different story. It is much closer to H264 than Quicktime Animation.  Generally I get smaller files with Ogg Theora, but they tend to have slightly less accurate color and detail.

For both I usually set the frame rate to 15 frames per second and keyframe every 160 frames with Quicktime animation and 24 frames with Ogg Theora.  I hear that Ryan has set this as high as 600.  Geoffery Grosenbach of PeepCode uses a lower value and has now started using H264 for many of his screencasts.  I may switch, but for the time being, Animation has given me better results, though a slightly higher file size.  I record at 800×600, same as Ryan Bates does for RailsCasts.

I thought about whether to upload the screencasts to something like Vimeo or YouTube, but in the end decided against it.  One thing I want FOSSCasts to be is well produced and high quality.  Once you convert them to Flash, the quality drops considerably, thus I decided against it.

Now, when it comes down to actually putting the screencast together, my workflow is as follows:

  1. Research the topic.
  2. run through what I want to do.
  3. re-run through it while recording the desktop and talking into the mic.  The talking is just so I can roughly gauge myself and get a feel for what I need to say.
  4. watch what I just recorded, keep what works, and re-record what doesn’t.
  5. Load everything into Final Cut.
  6. Go through slicing everything into sections so I can overdub the audio.
  7. Go through, overdubbing audio, extending parts that should be longer, shortening others.
  8. Create the slides in Keynote, exporting them to PNGs.
  9. Import the slide PNGs, putting them into whatever order I need.
  10. Record over them, shortening and extending as necessary.
  11. Finally, add transitions, the ending slide, and recording over the ending.
  12. Create the title slides, export it, and add to Final Cut.
  13. Add the into and outro music clips.
  14. Export only the audio to an AIFF and use Levelator to normalize it.
  15. Import the normalized audio into Final Cut and export the entire movie to Quicktime and Ogg Theora!

Looking back at that list,  it is quite a bit and there is some room for improvement in my workflow.  I can usually get through the whole thing in 3-4 hours if I’m aiming for a 5-6 minute FOSSCast.

The hard part

Initially it was dealing with all the strange things I would say or noises I would make while recording the audio that I didn’t realize I was making.  For example, I would make this clicking noise between sentences.  Go listen the first episode and I’m sure you’ll hear some.  I also tend to do a lot of “umms” and “so’s”.  I’m still working those :)

Of course, you have to get over listening to yourself talk.  I found that after the first two weeks this was no longer an issue.  Learning how to talk into a microphone is also fun and something I’m still perfecting.

Also getting over “putting yourself out there” takes some time.

Thoughts

I might have to write a version 2 of this post in a year and see what changes in my work flow and how I feel about FOSSCasts then.  In the mean time, I’m having a blast.

Smart Searching Using Anonymous Scopes

Sunday, June 21st, 2009

I really like how Lovetastic’s search works.  Instead of a plethora of select boxes, users can simply use expressions to create searches.  We did something similar with Tryst’s searching.  One text field and you enter stuff like age ranges (30-45), things like smoke-yes or smoke-no, cities, zipcodes, etc.

Tryst.com Search

To make this whole thing more Rails like, I did not want to just use Regex to parse out search terms and plug them into a complicated SQL query.  That would be soooooo PHP.

Named Scopes are awesome.  You can use them to built decently formatted and fairly complicated SQL queries in a nice, no bullshit, manner. You can do cool stuff like this:

@users = User.active.males.in_zipcode(params[:zip_code]).nonsmokers.top_ten

Just keep stacking scopes on.  Rails generates the query and it usually doesn’t suck.

Go read the API docs for the basics on Named Scopes. We’re gonna do some not basic stuff. Check out Ryan Bate’s Anonymous Scopes Railscast, which introduced me to this method of generating Scopes.

We wanted to add a Class Method called search and have it define the Scopes. We pass in the params hash, anything else we need (like the current user), and let it handle the Scoping and determining what we’re looking for from the search params.

To start, here is our search class method.

# app/models/user.rb
 def self.search(params, current_user)
    page = params[:page] || 1
    search_terms = params[:search]
end

Yeah, using Will Paginate and assigning my search terms to a local variable. I’ve also written another Class Method that does the parsing of the params.

# app/models/user.r.b
def self.search(params, current_user)
    page = params[:page] || 1
    search_terms = params[:search]
   #parse params
    max_age, min_age, zip_codes, gender, smoke, drink = self.get_parameters(search_terms.to_s, current_user)
  end

Now, we’re going to define some dynamic scopes. This is awesome. For it to work, we’ll add an initializer.

#config/initializers/scopes.rb

class ActiveRecord::Base
  named_scope :conditions, lambda { |*args| {:conditions => args} }
end

Now, lets make the scopes.

def self.search(params, current_user)
    page = params[:page] || 1
    search_terms = params[:search]

    max_age, min_age, zip_codes, gender, smoke, drink = self.get_parameters(search_terms.to_s, current_user)

    scope = User.scoped({})
    scope = scope.conditions "users.age >= ? and users.age <= ?", min_age, max_age unless min_age.blank?
    scope = scope.conditions "users.zip_code in (?)", zip_codes unless zip_codes.blank?
    scope = scope.conditions "users.smoker = ?", smoke unless smoke.blank?
    scope = scope.conditions "users.drink = ?", drink unless drink.blank?
    scope = scope.conditions "users.gender = ?", gender unless gender.blank?
    scope.paginate :page => page, :order => "created_at DESC"
  end

Pretty slick, huh? So now, in my controller I just need

# app/controllers/search.rb
def users
    @users = User.search(params, current_user)
end

Assuming your class method for parsing out scope parameters doesn’t suck, you should have very clean, cuddly, and concise searching. No more worrying about breaking some huge crappy SQL query.

You’ll notice I used

users.zip_codes in (?)

This is because I can pass an array of zipcodes and return all the users in those zipcodes. This is because I’ve implemented radial distance searching base on zipcodes. Users can search like ” 60606 25miles” and return all users who are within 25 miles of 60606. We’ll go into how this works in the next post.

rQuote – Ruby on Rails Stock Quote Plugin

Friday, August 29th, 2008

I merged some stock quoting stuff I had into a Rails plugin today. If you’d like to be able to simply grab real time stock quotes in your Rails app, this will do the job. Pretty much any stock symbol will work and you can enter as many as you’d like, you’ll get a hash array of hashes containing each symbol’s current value, change since open, and volume.

http://github.com/johnyerhot/rquote/tree/master

Rquote
======

Gets realtime stock quotes from Yahoo Finance. 

Its super simple to use.

Example
=======

quote = Rquote.new
quote.find("aapl", "msft") 

=> [{:change=>"-4.02", :price=>"169.72", :volume=>"16105013", :symbol=>"aapl"}, {:change=>"-0.42", :price=>"27.52",
:volume=>"27024456", :symbol=>"msft"}]

Copyright (c) 2008 John Yerhot, released under the MIT license

Uncrappifying your Qwest Modem (if it is a GT-701WG that is)

Tuesday, July 8th, 2008

I have DSL service from Qwest.  It is ok.  Beats the competition. The one thing I HATE is the modem I got from them, an Actiontec GT-701WG.

The problem?  It was darn near impossible to make it be JUST a modem, not act as a router/gateway, not act as a NAT, no frickin Actioncrap firewall, just give me the WAN Ip address!

Nearley, but not impossible.  Here is how.

The trick is to set the modem to transparent bridged mode (I think it was labeled as RFC 1483 Bridged). You should be able to find it somewhere in the advanced setup section.  The username and password needed below are also found on the same page.

Then you take your handy dandy router (mine is running DD WRT v.24, may not work with standard firmware) and change the WAN setup like this:

1. Connection type = PPPoE (Even though Qwest says they only support PPPoA
2. Username = your username… our was parts of our last name followed by some numbers.
3. Password = corresponding password
4. PPP Compression = On.  At least I have it on.

Everything else in that option group set to off.  While you’re at it, go to DNS and grab OpenDNS’s DNS server’s ips and throw them in there.

Now what the heck did this do?  Well, now your router’s WAN IP will be the Ip assigned by Qwest.  Before it was being assigned an IP by the Actiontec modem, probably 192.168.1.1XX, cause it was acting as a router, which sucks.  Now, the router is the gateway and, if you’re running DD WRT or some other thirdparty firmware, a much better gateway than the Actiontec was.

Its been going for a month like this and hasn’t been power cycled.  Not to mention all the much better features DD WRT offers.  Sweet.

Mongrel + Nginx: Deploying to a subdirectory

Tuesday, May 27th, 2008

Though using subdomains is all the rage right now, there are certianly instances where you may want to deploy your rails application to a subdirectory such as:

http://www.johnyerhot.com/myrailsapp

Of course Nginx makes it super easy to do so. If you need to get your webserver ready with Nginx, PHP running as a FCGI instance, and Rails check out my other how to.  

Now, onward!

First create a new virtual host.  In my case, for yerhot.org it would look like this:
server {
listen 80;
server_name yerhot.org;
access_log /var/www/yerhot.org/logs/access.log;
error_log /var/www/yerhot.org/logs/error.log;
location / {
root /var/www/yerhot.org/;
index index.html;
}
}

Pretty simple setup, telling Nginx to listen on port 80 for requests for yerhot.org, where to store logs, and finally setting up the site root at /var/www/yerhot.org.

All we would have to do to have Nginx redirect to our Rails app when looking for yerhot.org/myrailsapp is make another location block (in other words, place this right before the last curly brace).

location /myrailsapp {
proxy_pass http://localhost:8000;
}

Now, all requests for /myrailsapp will get proxied to port 8000. Now fire up your Rails app on port 8000.
mongrel_rails start -e production -p 8000 -d
Restart Nginx:
/etc/init.d/nginx stop
/etc/init.d/nginx start

And….

Crap. Rails is looking for a ‘myrailsapp’ route, which there is none.  No, no, don’t create one – we’ll need to use a little known feature of Mongrel to fix the problem.. the prefix.
Stop Mongrel…
mongrel_rails stop
And try this:
mongrel_rails start -e production -p 8000 -d --prefix=/myrailsapp

And… your app should fire right up. Pretty neat, if you wanted to you could use it forward to a Mongrel Cluster, a FCGI instance of PHP (from my other post), or lots of stuff.

Got a new monitor

Thursday, March 20th, 2008

monitor

Yup, brand new 24 inch Samsung. I’m always amazed what an extra 4 inches will do for your screen real estate. I love it.

Royner & Co.

Sunday, February 10th, 2008

Well, after a little bit of down time and some re-adjusting my slice at slicehost we’re back and I’ve gotten Royner up and running at royner.johnyerhot.com.

What is Royner?

Good question. Well, you sign up with either a Google Talk (Gtalk) or Jabber instant message screen name, give Royner a url for a RSS/ATOM feed (i.e. Feedburner)

Please give me some feed back on Royner. I didn’t put tons and tons of hours into Royner (the majority on Backgroundrb, which is working beautifully now), but I’d like to keep it alive if the demand is there.

There are some to-do’s left:

Set Royner up so that you can respond to IM’s with “OK” or something and Royner will quit looking for that key word.

Hasta pasta

Weekly Roundup

Monday, January 28th, 2008

Heres the week in review:

-Linux Mint home networking is now done and working beautifully. Had some trouble getting the onboard Via Chrome9 Video working correctly, but I followed the instructions here(compiling it from source) and everything was great. I wanted to use the OpenChrome driver instead of the VESA driver because the OpenChrome one has support for XvMC which accellerates all kinds of video (i.e. Xvid, mpeg4…). Only thing left to do is get a static IP so I can get to my machine from the outside world.

-Royner – I haven’t had much time to work on ironing out any of the kinks before a first release. Hopefully this week will be different. Thinking about Slicehost to host it, as I’ve heard great things about them. I’m also going to try out deprec for deployment, using Nginx instead of Apache. Should be interesting.


Other than thats, its another work week. See ya’ll.

Linux Mint Media Server – Day 1 – Samba/iTunes Sharing

Wednesday, January 23rd, 2008

First I apologize, I’m watching Rambo III as I write this (preparing for the new Rambo {!!!!!}coming out this Friday) so I may screw some of this up.

This all started with a couple of great deals I saw on slickdeals.net.

1. Got 5 x 1024mb sticks of DDR2 667 Ram for $7 shipped after rebate.
2. Got a cheap (AM2) mATX ASUS mobo, case, and PSU for $50 shipped.

So, I ordered a Athlon X2 4000+ for $55 while I was at it. This got me a cheap as hell backup pc($112 for a dual core PC w/4 gigs ram and an extra stick for a rainy day). I already had a spare optical drive and an old IDE 40gig hard drive to throw at it. I’m not going to be using it for anything needing 3-d acceleration, so I’m going to stick with the onboard video.

Now, a while back I made a MythTV box consisting of the following:

Core 2 Duo e4300
1024mb ddr2 800mhz
2×320gig harddrives
Nvidia 7300gt
DVDRW
pcHDTV tv tuner (for DVR functionality)
running Linux Mint (didn’t have to install all those codecs)
Old Antec case and an Antec Earthwatts PSU (go green).
NOTE: having a HTPC has changed my life. Just like people who have TiVo will tell you, its awesome. I could never go back. You could put together a decent one for $300-400 if you tried and its wayyy worth it.

It works pretty well, and I know that its pretty high powered for a htpc, but I needed it to handle 1080p x264 rips, which the C2D can. I’ve got about 400 gigs of music, movies, and tv rips on it.

So here is the plan:
The new AMD build will be the front end, mainly running Mythtv and the current pc will be Jen’s computer/the server. Right now, I’ve setup Samba shares for all the media, and set up Firefly (aka mt-daapd) to share all the music as an iTunes share (for my Macbook Pro). I’m also going to use it as a Subversion repository.

So, tomorrow the parts for the AMD build will be here and I’ll have to transplant some parts to it – the TV tuner, possibly the vid card (we’ll have to see how the x2 4000+ handles video.. I hope it can handle HD x264 since the 7300gt won’t help with it. I’ll setup a fresh install of Mit + MythTv and be in configuration heaven for the majority of the night I’m guessing.

Stay tuned.

Thats as far as I got tonight. My crappy D-Link router was giving me trouble so I didn’t get as far as I wanted. Wish DD-Wrt would run on it.