CategoryDevelopment

Is Rails going down?

The first Rails framework was fast. then it become slow, big and the idea of convetion over configuration becomes more poisoned.

Currently to start with Rails you have to learn a lot of stuff which are added just now and is not sure how long they will stay.

Also Rails is not targeting the developers to be fast but is targeting to be the perfect framework.

The price for that is that almost a year and a half there is no new version while the they refactor it.

No goodies like scafolding, only enterprise stuff around.

That is my personal opinion on this framework.

As I like to say – you cant leave your followers without food for such long time.

Piece of wizdom

The original code

<%= select(“city”,”kind”, t(:place_types).map.map!.each{|key, value| [value, key]}, {:include_blank => t(:chose), :selected => @city.kind}) %>

The bad code

t(:place_types).map.map!.each{|key, value| [value, key]}, {:include_blank => t(:chose), :selected => @city.kind})

the replacement

key_values = t(:place_types).collect{|key, value| [value.to_s, key.to_s, ]}

Rails.ouch.ouch.omg!

10 Questions From Modern Web Designers: Answered

This article is talking on designers but I think most of the things there apply for coders also.

If you read it now and get it – you will be ok, else you will learn all those rules by own in the future.

Read the full article here…

http://www.onextrapixel.com/2010/08/18/10-questions-from-modern-web-designers-answered/comment-page-1/#comment-7981

Search Logic and whats wrong with it

The idea of the Searchlogic is to save you time and give flexibility.

The first time I saw this gem  I was very excited about it.

With only a few lines of code an you have the whole search done. I have start using it.

Once I want to apply it to a complicated search. The problem was that I have to write more code and “patches” in order to keep the Searchlogic working….

So my advice is – don’t use such boosters if you can apply your own solution. There will be aways a time when you want to extend your search and you will loose a lot of time search how to do it with the 3rd party solution.

Do it yourself.

Hiring Juniors

Starting a company or a team

If you think that by hiring juniors you will save money and will get working application – you are wrong.
You will loose much more than money.

Yes they are low cost, but read the rest of the post to be not tricked. Continue reading

Argh…this rmagick gem – aways difficult to install/maintain.

I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error:

RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)

google for This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)

then found this page in mixed English/Chinees

and finally got a page in German :)

Then I decide to write this post in English and slightly modify the solution

instead of putting

RMAGICK_BYPASS_VERSION_TEST = true in the deploy.rb

I have put this in the development.rb

and all it works – this way on the production I will be forced to use real compatible library or at least check again for another solution or gem.

AUCH! This solution doesn’t work even in development I got weird core dumps :( …so here it is another try

Here is the real working  solution:

su -
git clone http://github.com/rmagick/rmagick.git
cd rmagick/
ruby setup.rb
ruby setup.rb  install

Nice code

I have just finished one method and I was not happy with the code. Then I put a comment on top of the method “Far from perfect….”.

Then I read the class – it was ugly.

here is the before

def validate
 return if is_email == false
 found = InternetComunicatorType.find(:first, :conditions => {
 :is_email => true,
 })

 return unless found

 if found.id != id
 errors.add(:is_email, "We have already email type")
 return
 end
end

here is the after

def validate
  if is_email
    found = InternetComunicatorType.find(:first, :conditions => {
      :is_email => true,
    })

    if found and found.id != id
      errors.add(:is_email, "We have already email type")
    end
  end
end

The result is much far readable

Mongoid presentations

When starting with mongoid I have missed a lot some demo source code.

How it works with controllers, does it plays nice with nested attributes, such things.

Here is presentation of mongo  and here are some slides

Mongoid

I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  – so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the examples are not aways working and you have to fight with all the code – I don’t maybe I have found some old documentation. When you dive in the code – again no documentation and not clear behaviour. Maybe it is a good solution but for me it doesn’t work. I lost 1.5 days experimenting and hoping that the things will go.

Then I give a try with mongoid. It has wonderfull documentation for starters also it seems at first glance that the code in mongoid is more readably and human friendly. It took me 2hours to port all my models to mongoid.

The guy developing mongoid seems pretty active.

last words – it is pleasure to work with mongoid – I recommend it to all.

Four websites in a two weeks

A lot of work last weeks.

Check those

The interesting think is that two of them are on Rails (www.mebelicomfort.com, shop.djibutzo.com) , one of them is on WordPress and the last one is on some custom PHP framework.

And meanwhile we are doing a lot of refactoring on our company website psspy.se, which finally is starting to look good.

 

psspy

After so much work I think that I will be tired but I am ready now for 6 websites for 1 week.

 

© 2024 Gudasoft

Theme by Anders NorénUp ↑