Floyd’s Thoughts…

Because Everything is Interesting!!!

Archive for the ‘Didn't know Yesterday’ Category

iTunes 8 really does have a “Genius” feature.

without comments

As you know iTunes 8 has a new feature called Genius, which when activated will create a playlist based on the song that you are currently listening to.

Let me take this opportunity to say that the iTunes Genius feature is… well GENIUS! It has changed the way I use iTunes for ever!

Once your iTunes library get over a few thousand tracks you often find that you loose the ability to put your hand on a great track to listen to next, the grouping of albums, artists, genres, etc makes it almost impossible to create a “Fresh” new playlist that hangs together well, Genius solves this issue in an instant.

The icing on the cake is the Genius side bar that includes songs that would fit well into the playlist that you don’t already own, in the few hours that I have been using it, I have already found several “GEMS” that i would normally not have in my library.

The only down side to the Genius feature that i can see it that I’m now going to spend even more cash on iTunes each day! Doh!

Written by Floyd Price

September 10th, 2008 at 5:40 pm

Something I didn’t know Yesterday #2

without comments

Rails (or should i say ActiveSupport) adds a blank? instance method to object that encapsulates the nil? || empty? check that I find myself doing all the time.

A quick review of the source show that the empty? method is added to the following:

  # An object is blank if it's nil, empty, or a whitespace string.
  # For example, "", "   ", nil, [], and {} are blank.
  #
  # This simplifies
  #   if !address.nil? && !address.empty?
  # to
  #   if !address.blank?

The full source is actually very simple (I Love Ruby)

class Object
 
  def blank?
    if respond_to?(:empty?) && respond_to?(:strip)
      empty? or strip.empty?
    elsif respond_to?(:empty?)
      empty?
    else
      !self
    end
  end
end
 
class NilClass #:nodoc:
  def blank?
    true
  end
end
 
class FalseClass #:nodoc:
  def blank?
    true
  end
end
 
class TrueClass #:nodoc:
  def blank?
    false
  end
end
 
class Array #:nodoc:
  alias_method :blank?, :empty?
end
 
class Hash #:nodoc:
  alias_method :blank?, :empty?
end
 
class String #:nodoc:
  def blank?
    empty? || strip.empty?
  end
end
 
class Numeric #:nodoc:
  def blank?
    false
  end
end

Written by Floyd Price

August 13th, 2008 at 8:46 pm

Something I didn’t know Yesterday

without comments

Using the SVN client you can pass –xml to most of the commands to get a response in XML!

This is great for apps that use the SVN Client API and need to parse the response, for example…

svn log http://svn_url --xml

Will produce a nice XML version of the SVN log.

For good measure you can also use the verbose option to extract even more information…

svn log http://svn_url --xml -v

Pretty cool ey?

Written by Floyd Price

August 12th, 2008 at 8:23 pm