botvector.net domain for sale $5k usd (negotiable). Em@il me t0: alex at israstage dot com

My Git activity

EVE

21 September 2010

हम्म

Want to say me "thanks" ?
Send SMS to number 97605 with message

RRR TNK iNNERMAn

from USA only.. cost u 1$ only and alot for me
10x !

04 November 2009

Color is not a module in pdf-writer + rmagick SOLVED

Color is not a module
/usr/lib/ruby/gems/1.8/gems/color-1.4.0/lib/color.rb:19

Gems installed in application:
pdf-writer 1.1.8 + color 1.4.0 + color-tools 1.3.0
can happen to any pdf-writer version and in any OS (tested on XP/Ubuntu/Debian/FreeBSD)

I have two models:

#require "color"
require 'pdf/writer'
require 'pdf/writer/graphics'
require 'pdf/simpletable'
class ModelA

In this model i generate pdf's.


require 'RMagick'
include Magick
require 'rvg/rvg'
class ModelB

And in this model i generate images's.

Problem are raised when i added ModelB to project.
I was unable to use pdf generator(ModelA) as well as ModelB.

After some research i found that if i remove requires from ANY model, other model is working well ....

Temporary i removed ModelB requirements (generating images from another place).
Looking for solution ..

SOLVED

add
require "color"
BEFORE
require 'RMagick'
in ModelB so it will looks like:

require "color"
require 'RMagick'
include Magick
require 'rvg/rvg'
class ModelB


Magick should not to be on the toplevel.

27 May 2009

Update: 2.0.x to 2.3.2

Updating to 2.3.2 to get nice features ?
Thanks to all Rails Core team,

Now my own experience upgrating from 2.1.2 to 2.3.2:

Lets begin:
1/
READ THIS !!! MUST !!

2/
To update has_many_polymorphs go to here.

3/
To update output_compression plugin (output_compression.rb):
replace ActionController to Rack
replace class AbstractRequest to ActionController::Request

4/
To patch Globalize:
in vendor/pligins/globalize/lib/globalize/rails/action_view.rb
update:
alias_method :globalize_old_render_file, :render_file
to
alias_method :globalize_old_render_file, :render
AND
in /pligins/globalize/lib/globalize/localization/db_translate.rb
add :having key to options array
VALID_FIND_OPTIONS = ...
line 794 approximately.

x/
RUN:
rake rails:update

x/
Replace all render_file => "foo" to render :file => "foo" if any.

x/
Instead of config.action_controller.session = { :session_key => 'foo', ... use config.action_controller.session = { :key => 'foo', ....

x/
Use:
class ActionController::Request
instead of:
ActionController::AbstractRequest

and ruby script/server !
if anything ok, run your tests ..

Useful:
Rack module

Let me know if you encounter more "bugs" while patching to 2.3.2 ..

06 November 2008

Enhanced Migrations Plugin + Rails 2.1+

Hi,
In 2.1+ there are new migration style - it uses time stamp to create migration filename , just like Enhanced Migrations Plugin did.

Recently i updated my application to 2.1.2 (from 2.0.2) and found incompatibility with this plugin.

So we need to update our database!
We need take all Enhanced Migrations Plugin "migrations_info" and simply put them on schema_migration table !

First, backup your database.

Next:


DROP TABLE IF EXISTS schema_migrations;
CREATE TABLE schema_migrations (
version varchar(255) NOT NULL,
UNIQUE KEY unique_schema_migrations (version)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO schema_migrations (SELECT ID FROM migrations_info);
DROP TABLE migrations_info;


Now remove Enhanced Migrations Plugin from vendor/plugins,

And you're ready !

04 September 2008

Altering table

Adding and modifying table with Rails was never so easy and sexy !
You don't need to make tons of add_column for one type.. use change_table !!

and for def self.down use remove_column :table_name, [:column1, :column2 ...]

Add a column
 change_table(:suppliers) do |t|
t.column :name, :string, :limit => 60
end
Add 2 integer columns
 change_table(:suppliers) do |t|
t.integer :width, :height, :null => false, :default => 0
end
Add created_at/updated_at columns
 change_table(:suppliers) do |t|
t.timestamps
end
Add a foreign key column
 change_table(:suppliers) do |t|
t.references :company
end

Creates a company_id(integer) column

Add a polymorphic foreign key column
 change_table(:suppliers) do |t|
t.belongs_to :company, :polymorphic => true
end

Creates company_type(varchar) and company_id(integer) columns

Remove a column
 change_table(:suppliers) do |t|
t.remove :company
end
Remove several columns
 change_table(:suppliers) do |t|
t.remove :company_id
t.remove :width, :height
end
Remove an index
 change_table(:suppliers) do |t|
t.remove_index :company_id
end

HAVE FUN !!

28 August 2008

will_paginate on AJAX

Do you want will_paginate with AJAX functionality ?
Follow:

  1. Remove will_paginate plugin if you have it (/vendor/plugins/) /or backup it.
  2. in command line: gem sources -a http://gems.github.com
  3. in command line: gem install mislav-will_paginate
Now in config/environment.rb put after Initializer
Rails::Initializer.run do |config|
...
end

require 'will_paginate'
Next step, create new helper: remote_link_renderer.rb .. and copy&paste inside:


class RemoteLinkRenderer < WillPaginate::LinkRenderer
def prepare(collection, options, template)
@remote = options.delete(:remote) || {}
super
end
protected
def page_link(page, text, attributes = {})
@template.link_to_remote(text, {:url => url_for(page), :method => :get}.merge(@remote))
#replace :method => :post if you need POST action
end
end

Now, to ajaxize put:
<%= will_paginate :collection, :renderer => "RemoteLinkRenderer",:remote => {:with => "something_you_want", :update => "dom_id_element"} %>

And you are happy-ajax-paginator !
Sample:
<%= will_paginate @events, :renderer => "RemoteLinkRenderer",:remote => {, :update => "events_container", :loading => visual_effect(:appear, "loader"),:complete =>visual_effect(:fade,"loader" ) } %>
will call /events?page=x with AJAX request..
in my EventController:

respond_to do |format|
format.html { }
format.js { render :partial => "events" }
format.xml { render :xml => @events.to_xml }
end

Thats all !!
More info about will_paginate plugin here
Original post here

13 August 2008

acts_as_taggable_on_steroids + Globalize

Okay, situation is:

Parties involved: Rails 2.0.2, Globalize plugin, acts_as_taggable_on_steroids, ME.
(clickables) :)

Having model Event that translates :name, :body, :description with Globalize plugin.
Also Event are acts_as_taggable with acts_at_taggable_on_steroids ...

Ok for now, model works well, translated well, adding/removing/editing tags as well !

The problem is raise when we trying to @tags = Event.tag_cloud
we got :select option not allowed on translatable models (DISTINCT * FROM events .... !! THAT IS BADD !!!

Solution:
Open /ventor/plugin/acts_as_tabbable_on_steroids/lib/acts_as_taggable.rb
FIND:


LINE: 66
def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : find(:all, options)
end

CHANGE TO:

def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : untranslated_find(:all, options)
end


Restart server and you're done !

p.s. More info about great acts_as_taggable_on_steroid plugin is here.

09 August 2008

Dreamhost Hosting

Hi !

Personally i am hosting 3 websites working very well with dreamhost ( thru mod_rails & passanger), and its very easily to create new projects, svn repositories, mysql, custom gem packs, etc... everything You need for Rails site.

SOO if you want fast and cheap rails hosting check Dreamhost !
I would recommend basic plan(its really enought for hosting rails!),
I can give You free LIFETIME domain registration(domain never expires and You NEVER pay for him) !
This discount give's You upon NEW registration.
Plus i give You:
10$ off for monthly hosting plan,
25$ off for one year plan,
40$ (!) off for two year plan,

So get yourself promotional code BOTVECTORCX on DREAMHOST (click here)
(free lifetime domain + hosting discounts), enter promotional code in bottom of registration form to redeem $$$$$$ !
Have Fun !!! :)


p.s. If you need more specific code let me know ;)