Archive for July, 2009

Chunk an FLV File into Multiple Parts

Posted 29 Jul 2009 — by admin
Category Linux

The format is as follows

ffmpeg -i <input file> -ss <starting point> -t <length of capture> <output file>
ffmpeg -i Input_File.flv -ss 00:00:00 -t 00:10:00 Output_Filename.flv

http://www.surfthedream.com.au/blog/Archives/november-2008/how-to-split-a-movie-file-into-multiple-parts

Twitter Finally Turns into a Real Time Search Engine (or at least admits it now)

Posted 29 Jul 2009 — by admin
Category Social Media

Twitter, http://twitter.com just redesigned their home page. And guess what is featured in their redesign? A big fat search bar! Who would have thunk? You can now search twitter (you could before as well) and get a good sense of what real people are thinking/doing in real time.

A lot of people ‘tweet’ about seemingly irrelevant things like ‘getting milk’ or ‘i like potatoes’. But who is to say what is irrelevant? Perhaps, I’m a dairy or potato farmer? The real value of Twitter occurs in between the pointless ramblings, when groups of people make similar decisions and/or observations and catalog them online. Regardless of the content, we still want the content so as to come to our own conclusions.

Twitter is a barometer on public mood/perception of events, products, brands, bands, celebrity… etc. People who use the service are not conservative with their tweetage because there is no usage limit (except on bots) and posts are extremely short, 140 characters or less.  The side effect is a plethora of short status updates, w/ subject matter much like you would send to your friends over SMS. The origin of the 140 character limit design decision stems from the maximum number of single characters that can be sent over an SMS message. Twitter was first envisioned as a mobile communication facilitation service for tech people in San Francisco.

The big boys of Search, like Google, Yahoo! and MSN, don’t even have this figured out yet and they are scrambling to play catch up w/ Twitter. Search engines index the web but by the time they get things all nice and organized, the content is stale! (The one exception that I know of is Google Suggest) Not to mention the classical web is full of longer posts, which take more time to produce and contains whole thoughts, complete sentences and less ‘discoverable information’. Discoverable information is the information you accidentaly find in large datasets of seemingly random information.

Because of the frequency of tweets and the personal nature of the service (The I’m famous on Twitter mentality) some pretty interesting and accurate information can be gathered and plotted, not just in real time but over time as well. The concept of Abundance and Waste in Nature shows us that only such a random and free service can actually deliver meaningful content at all! Because of the prolific tweetage of people, in between their pointless ponderings, we all share some similar ideas, opinions and observation, truths and falsehoods. Twitter helps us group and analyze what has been for the most part an intangible thing, public opinion and perception from the bottom up. If you were tasked with the design decision of having to make an accurate snapshot of society, and you have whatever means at your disposal, how would you do it? The best way I can think of  would be to hand everyone a piece of paper and collect their thoughts, then aggregate and analyze. Sound like Twitter much?

Twitter has become the dandelion of the internet. It fills in the cracks of the information superhighway that would have otherwise been overlooked and/or determined to be largely irrelevant.

David Heinemeier Hansson – Ruby on Rails, Startups, Culture

Posted 29 Jul 2009 — by admin
Category Ruby on Rails, video
YouTube Preview Image

Ruby on Rails vs. PHP in a Nutshell

Posted 29 Jul 2009 — by admin
Category Ruby on Rails
YouTube Preview Image

Nested Has_one Relationship with Fields_for and Attr_accessible in Model Class

Posted 26 Jul 2009 — by admin
Category Ruby on Rails

To make child attributes accessible to your model through a nested forms (Rails 2.3) you’ll need to add the “#{child_class}_attributes” to the attr_accessible method in your parent class. If you don’t use attr_accessible in your parent model (you would do this to restrict certain attributes to be accessed via a web form) then you should be all set.

Below is an example where User has_one Profile with the favorite_color attribute being set/updated in the nested form.

class User < ActiveRecord::Base
  has_one :profile #child class
  accepts_nested_attributes_for :profile
  attr_accessible :profile_attributes # the format is the child_class followed by the "_attributes"
end

And the form would like this...

<% form_for @current_user do |f| %>
   <% f.fields_for :profile do |profile| %>
     <%= profile.text_field :favorite_color %>
  <% end %>
<% end %>

Joining Technorati

Posted 25 Jul 2009 — by admin
Category Linux

yuw3dqxzp2

Nested Attributes in a Form for Has_One Model Association in Rails

Posted 23 Jul 2009 — by admin
Category Ruby on Rails

Just for reference…

class Member < ActiveRecord::Base
    has_one :member_profile
    accepts_nested_attributes_for :member_profile
end


<% form_for @member do |f| -%>
       <%= f.label :fullname %> <%= f.text_field :fullname %>
	<% f.fields_for :member_profile, @member.member_profile do |member_profile|%>

<%= member_profile.label :about %><%= member_profile.text_field :about %>

<%= member_profile.label :favorite_color %><%= member_profile.text_field :favorite_color %>

	<% end %>

Destroy Children In Rails 2.3

Posted 22 Jul 2009 — by admin
Category Ruby on Rails

In the parent class place the following code

has_many :posts, :dependent => :destroy

This used to be accomplished with

has_many :posts, :dependent=>true

Check out the Rails docs for more information http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html

Make Rails Lib Module Methods Available to Views

Posted 22 Jul 2009 — by admin
Category Ruby on Rails

If you create a module in the lib/ directory of your Rails application you won’t have access to those methods in your views. If you don’t want to put those methods in a helper file, you need to add a method to your module that makes them available for you views like so…

#in lib/my_module_name.rb
module MyModuleName
  def my_method_for_views
     #logic...
  end
  def self.included(base)
    base.send :helper_method, :my_method_for_views if base.respond_to? :helper_method
  end
end

Just “Bing” It

Posted 15 Jul 2009 — by admin
Category Social Media

Bing is now serving up search results inside of Facebook. When you use the search bar on the top right, along with potential friends, a Bing result set will be populated on the right hand sidebar. Here’s a screen shot.

bing on fb

bing on fb

Bing is a Microsoft search engine.