About Me

My photo
PhD Candidate at Purdue University, Computer Science.
Showing posts with label Plugins. Show all posts
Showing posts with label Plugins. Show all posts

Sunday, December 14, 2008

Aiming at SVG..Experience Rich Web


I think that the future will be for the SVG replacing the normal image formats..
First time for me to hear about SVG was when I was discovering the Batik. I liked at that time the easy way the batik provide access to SVG.
But I didn't go deep with this as SVG couldn't be used with web products at that time.
Currently, the latest versions of Mozilla is supporting SVG, and work is still going to fully integrate it to the firefox. check the Mozilla SVG project for further information.
Opera also announced that it has support to some extent for the SVG
Adobe released Adobe viewer which is a plugin to support SVG in browsers, though I prefer a native support without relying on plugins.
So why someone should use SVG instead of normal image formats in web:
  • SVG is a vector format, SVG images can be printed with high quality at any resolution.
  • SVG is plain text, it's W3C standard. So, you can deduce that it is much more easy to compress these text formats.
  • As it is text .. then SVG support search in text! Suppose you implement google maps on SVG then you can search the text in the maps. (interesting)
  • Did you worry every time by the level of zooming you provide vs the resolution you have for your image? With SVG there is no worries about pixelization with increasing zooming level. You can get very good zooming quality.
  • You can get the same effect you want with Flash as the SVG supports animation.
  • It's open source if you seek openess.


Tuesday, September 23, 2008

Thursday, May 08, 2008

Accessing multi-solr through acts_as_solr

You may need for multicore to manage multi languages search at least. An approach to solve the multilanguages problems is to use replication of each field (i.e field_arabic, field_english, field_french..etc) which I think is not feasible for large systems..

As a quick fix, using the acts_as_solr plugin, I just added a parameter to the Post method. I send the url to the method and post my request on this specific solr url. So, I make the search by iterating on all the solrs I define in my rails application and then combine the results.

The advantage of this approach that you don't enforce the user to specify the language he uses in the query, which I think it worth.

Check the multi-solr cores shaped. I didn't have the time to try it yet. This is really a powerful feature to add to the solr core. It is similar to having many solr running on one tomcat.

Sunday, March 25, 2007

Globalize on Ruby-On-Rails

The Globalize is an internationalization and localization plugin.
  • Translates both db content and view text.
  • Supports automatic selection of an alternate, localized template for each view.
  • Built-in localization and translation of strftime, numbers, and currency formats.
  • Supports pluralization.
  • All based on three automatically migrated database tables.
I is the best solution to support multi languages for your rails application.
The globalization wiki is not yet complete. But I think the "Get Started" part is fair enough to help you out making your globalized application, it provides very helpful external links.
  1. Sven’s Globalize Writeup – has many times been refered to as “the best documentation available for Globalize” .
  2. Example Application – takes you step by step through the process of creating a Globalized example application.
  3. Unit-tested Example – a walkthrough using a test-driven approach by Josh Harvey.

Sunday, February 25, 2007

Acts_as_Statable

I have been introduced to rails for about 30 days ago. I really don't spend much time on developing my coding skills. I almost know nothing about the ruby syntax, I took the shortest way and dig into my tasks.
Many people think that the best way is "do it yourself"; don't spend much time on reading tutorials, couple of days are enough and then release your skills to go further. me too, I believe in this. But I think also, that you have a good view to know when to stop digging.
It's true that i did good progress in my programming tasks, but i still find that this is not enough. I believe it's time to make some readings to enlarge my dictionary.

Hunting the best opportunity to do so is the most important part. It's not a silly H.W you do to raise your salary. It's the willingness of tasting some craft.
We were working on a small forum, when it comes to define a forum/thread to be closed, blocked, forbidden..bla, bla...whatever anybody calls these restricted access issues.
Yeah, it's simple. A tiny flag in some few minutes will solve the whole story...."NOW Let's move to another real task".
I started to think for something different. Why we don't just add some craft to this part; although it doesn't deserve all that panic.

My proposed solution to go for using a rails plugin. I know I may look silly, but Just I felt that I need to make more interaction with plugin.
I made a quick lookup for the available plugins, it was difficult at the beginning as I was looking for something without knowing what it can be called. Finally, I found the acts_as_enumerated plugin, it should be the one. I succesfully installed it, at the end it didn't work with me ( I may be missing something) but i decided not to give aq second try for now. I thought it doesn't satisfy my design. Instead i started to think of something which should like this:
Did I make something wrong here? It seems no sense to make a relation of many-to-many. Why could any forum have more than one state!!!
Well, I made this on purpose. What if we want in the future to expand our feature to be supported on the user-level. I mean, we may want to support (for example) "block option" for a forum on the user-level. In this case the forum will have more than one state depending on the user. We will need to add to the staging-table a new column carrying the user_id. Let's keep it simple for now, this is my first plugin, I don't want to get stuck.

Steps to create a plugin:
Note: the following steps are provided as guidance to create plugins.

1. In your project directory run the following command.

$ruby script/generate plugin acts_as_statable
create vendor/plugins/acts_as_statable/lib
create vendor/plugins/acts_as_statable/tasks
create vendor/plugins/acts_as_statable/test
create vendor/plugins/acts_as_statable/README
create vendor/plugins/acts_as_statable/Rakefile
create vendor/plugins/acts_as_statable/init.rb
create vendor/plugins/acts_as_statable/install.rb
create vendor/plugins/acts_as_statable/uninstall.rb
create vendor/plugins/acts_as_statable/lib/acts_as_statable.rb
create vendor/plugins/acts_as_statable/tasks/acts_as_statable_tasks.rake
create vendor/plugins/acts_as_statable/test/acts_as_statable_test.rb


2. Edit "vendor/plugins/acts_as_statable/init.rb" to look like this

require 'acts_as_statable'
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Statable)
require File.dirname(__FILE__) + '/lib/stating'
require File.dirname(__FILE__) + '/lib/state'

3. your real work will be in this file "vendor/plugins/acts_as_statable/lib/acts_as_statable.rb"
you will need to define your methods just right here

module ActiveRecord
module Acts
module statable
..........
end
end
end

4. create the new classes stating and state
"vendor/plugins/acts_as_statable/lib/stating.rb"
"vendor/plugins/acts_as_statable/lib/state.rb"

class Stating < ActiveRecord::Base
belongs_to :state
belongs_to :statable, polymorphic =>true
............
............
end

class State < ActiveRecord::Base
has_many : statings
.......
end