Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

PDFetch facelift!!!!

Pdfetch.com was just facelifted al little bit, i was really unhappy for some reason from the previous design, so i did about a 2-hour-fest to do it in another way.

i switched my ad system from Adsense to the Amazon affiliate system, i think it will be more rewarding.




Finally Decided: JQuery, not Prototype

JQuery (for those of you just landed from Mars) is an unobtrusive javascript framework. read more at the JQuery home page.
jQuery supports Behavior driven development and is based on traversing HTML documents by CSS Selectors.
vs.
Prototype,
Prototype is also JavaScript library for Class driven development which makes life easier working with JavaScript. Prototype library has a good support in Ruby on Rails via helper functions and is basically well embedded in.

i decided to try to match both of these libraries (and dojo for the matter of fact, but the project was halted), and here are my conclusions.


  • BDD


    JQuery is very similar to CSS by assigning the HTML element behaviour out-side the HTML, so it is generally more adequate for MVC.
    for ex:

    $(element).click(function() {
    alert("warning");
    });

    simple.

  • Chaining
    Chining methods is as simple as ruby. period

  • CSS Selectors

    Since JQuery is based upon CSS, you can access any element by it's CSS path, and avoid these annoying pesky ID's you have to put using Prototype.


for some more comparisons, visit the Ajaxian article

Finally:
Jquery and prototype are both great. For me, i prefer JQuery since it's approach appeals to me more than Prototype's, Although prototype is kinda Rubish and has inbound support from Rails, JQuery is still cleaner to me.
Did someone said JQuery to Rails integration?

Ruby On Rails Developer Salary in the US


the graph is right here


Data Provided by of simplyhired.com, a search engine for jobs.

As i can see, $86,000 per year, that makes it about $7,100 USD a month, which is just a little more than what a super-rails ninja can get here in Israel, probably more for a short period projects.

how come?

web 2.0 validator

this one is good :)

this site redicoulesly rates your site as a web2.0, the check-list veries from "Denies Rocky V?" to "has favicon?".

Rails.il... Finally!

I ran across the newly and very anticipated rubyonrails.org.il.

This is a great idea that i tried to pull back at Creopolis, but sadly half way there i was no longer an employee there (too bad :) ).
anyway, the guys apperantly responsible for this unexpected yet enjoyed surprise are QCM
way to go guys, looking forward to help.



Use Facets

i am ashamed, i just recently noticed some of my associates are using a gem called "facets".

i was amazed to see how helpful this gem is! the 'facets' gem added a whole bunch of core extensions to the ruby core.
i strongly advice the use of facets.

i woun't fill you up with details, just point out to the links below:


more to come soon!.




Run RUBY!!! RUNNN!

According to a Nimble Method post, ruby is slow (i don't really agree on the other hand) cause' of a garbage collector bugs.

Some Patches are suggested in the post, if you want them... they are here to get.



Apache X-SendFile in Rails

" There's this slick HTTP header called "X-Sendfile" that Apache and Lighttpd support. It was made to address this kind of problem (isn't that convenient?). Now, when you send an HTTP response, all you have to do is tack on an X-Sendfile header with the path of the file you need to send—don't worry about actually reading the file or sending any of those bytes yourself. The web server will load the file you specified and send it downstream."


nothing to add, read more on John Guenin Post

p.s
Benchmrk'd to 400% faster for one of my apps. great job



Ruby Coding Convetions

When working in a team, you must be able to understand and to complete/continue other people code, although rails itself is very easy to understand, some of us need some further instructions :).


get them here




RandExp Gem

the RandExp is an extraordinary gem.
using this gem you are able to generate a value corresponding to a Regexp statement.
read more in the documentation.

List all Controllers and actions

controllers = Dir.new("#{RAILS_ROOT}/app/controllers").entries
controllers.each do |controller|
if controller =~ /_controller/
cont = controller.camelize.gsub(".rb","")
puts cont
(eval("#{cont}.new.methods") -
ApplicationController.methods -
Object.methods -
ApplicationController.new.methods).sort.each {|met|
puts "\t#{met}"
}
end

end

Dump a Model table to fixtures

 


def self.to_fixture
write_file(File.expand_path("test/fixtures/#{table_name}.yml", RAILS_ROOT),
self.find(:all).inject("---\n") { |s, record|
self.columns.inject(s+"#{record.id}:\n") { |s, c|
s+" #{{c.name => record.attributes[c.name]}.to_yaml[5..-1]}\n" }
})
end

ruby-debug User guide

Hi,
i am using ruby-debug for some time, it's a great tool but i didn't know how much until i bumped this great 30 seconds guide to ruby-debug which is filled with useful information.
a must, for a ruby developer

.not proxy for ruby

a post in Powdered Non Sequitur Man made it possible.
".not" proxy for ruby
so no more

!cond

but,

object.attribute.not.nil?

New Design For Pdfetch.com


New design for Pdfetch.com is up, thanks to Barak Edry who did everything to make it look better.
thanks man!


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Labels