Monday, July 6

Making Light window & Ajax Pagination to work simultaneously on a single module

Here is one more simple tip to make both Ajax Pagination & Light Window work together.

It's not that great solution but a simple thought which would not strike when you are struck. Before moving ahead with problem and solution, few words on light window & Ajax pagination.
Light Window: A javascript library that relies on porotype & scriptaculous for it's effective visuals.
Ajax Pagination: A simple pagination in ajax way, doesn't need to reload the page.

In one of our enhancing projects, the lightwindow was implemented to maximize or enlarge the thumbnail photo. And then on, simple pagination to update the images/thumbnail in the album one by one. Both are working fine, but as and when we navigate to second page and all further inside pages the enlarge link doesn't seem to work as expected. Instead maximizing the image in pop-up it redirected and opened the image in browser window.

Though the parameters, function calls and all other required setup is same still this did not work.

No surprise!!

Digging little deep into the way how Light Window works, an object is instantiated at the time of page loading.

function lightwindowInit() {

myLightWindow = new lightwindow();

}


And all the pop-up's would be simple effects that will be derived. Here is the catche, since we are doing ajax pagination which does not do any page reload so also the lightwindow function is not called second time.

Quick fix: To initate the object.

Be it in rails or in any other frameworks to use the combination effects we need to make sure the function is triggered.

Bonus:
same goes with other 'box' approaches (lightbox, modalbox, redbox...). For lightbox it's initLightbox(), just dig in to find out the function in respective javascript libraries and then enjoy both pop-up and ajax pagination effects.

Monday, June 22

Recruitment Pains -1

Note: Expressed here are my personal views and experience.

All these five years I never felt that recruitment was such a pain. I am not referring to freshers but to the so called experience guys 2+. Was trying to help my friend in getting a good Ruby on Rails resource. Though this was not the first time, and I have done even at all my previous companies but I should say it's a totally, shockingly new experience.
  • I heard that in telephonic interviews people try to fool the interviewers under the wrong names or even speaking on behalf of someone else. Observed the same with one of the candidates from Karnataka, India.

  • Another great gem who claims to be working for a budding company from past 2.5 years, but the truth is he started working only couple of months back and he was trying to fool us.

  • Another beautiful one I can't even think of something like this. A guy claimed to be 1.9 yrs experience in Ruby on Rails went through the couple of rounds of interview and was not bad. So we offered him the position so irresponsible was he, didn't even respond back. So withdrew the offer.

  • One of the coolest one, which you got to hear... Another aspirant(friend of above mentioned guy) sent us the same application and claimed it to be done by him entirely.

In the whole process what I failed to understand was, why can't people be genuine to themselves. What were such candidates trying to prove?
Can they perform same way, even they were offered the job?
Why do they create wrong impressions and ultimately they will be in trouble by not performing?
...
...
...
I can list many more... but what's the use.

But I would like to stretch out and help other Ruby on Rails recruiters by sharing away their names. Hoping to save others time and money.

Saturday, April 18

toghq: extensible open source social networking platform


It was couple of back in January, I decided to write  on the RoR based social networking applications.  And I had taken the widely accepted bunch of apps and made a nice and useful doc out of it here.  I have been getting pretty good response on this post @ Scribd & slideshare.

  To continue with my exploration, from couple of weeks I was playing with toghq.  A beautiful one and easy to extend.  I thought I would share my thoughts on this.  

  The beauty of toghq is in it's extendability and agility.  Tog, contains set of plug-ins that are very easy to integrate and easy to use.  One such plug-in's that impressed me that I would talk today is tog_picto.














top_picto, is the photo management plug-in with tog.  What impressed me is:
1. Easy to manage
2. Photoset creation, manage, delete
3. simple drag drop to create/delete photosets
4. multiple image uploads
5. taggable, commentable, rateable...
6. mulitsized photos

Thanks to Haritha, for her help with screenshots.

Thursday, March 5

Web Accessibility principles

I was going through my juniors work on Ruby on Rails. I was helping them to build some interesting web applications. And then the discussions lead to design, usability and accessibility of the application. As they don't have enough exposure on web applications, I quoted few articles and books to say UI is as important as functionality. Of which, I highlighted the "Ten Principles for Web Accessibility" from "Pragmatic Design & Accessible Web Sites" by Jeremy J. Sydik.
  1. Avoid making assumptions about the the physical, mental, and sensory abilities of your users whenever possible.
  2. Your users’ technologies are capable of sending and receiving text.
    That’s about all you’ll ever be able to assume.
  3. Users’ time and technology belong to them, not to us. You should
    never take control of either without a really good reason.
  4. Provide good text alternatives for any non-text content.
  5. Use widely available technologies to reach your audience.
  6. Use clear language to communicate your message.
  7. Make your sites usable, searchable, and navigable.
  8. Design your content for semantic meaning and maintain separation between content and presentation.
  9. Progressively enhance your basic content by adding extra features. Allow it to degrade gracefully for users who can’t or don’t wish to use them.
  10. As you encounter new web technologies, apply these same principles when making them accessible.

Link to Book:
http://www.pragprog.com/titles/jsaccess/design-accessible-web-sites

Monday, March 2

"memcached" "libmemcached" gem installation for rails app

It's been so hectic with the installations on ubuntu.

sudo apt-get install memcached

then I realised that "libmemcached" also needed. Got the latest tar http://tangent.org/552/libmemcached.html and installed.

then went on to install the "memcached" gem.

Unfortunately, this did not go as expected but raised lots of issues!

rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_next_distribution_rebuild_set’:
rlibmemcached_wrap.c:5835: error: ‘struct memcached_st’ has no member named ‘next_distribution_rebuild’
rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_next_distribution_rebuild_get’:
rlibmemcached_wrap.c:5858: error: ‘struct memcached_st’ has no member named ‘next_distribution_rebuild’
rlibmemcached_wrap.c: In function ‘Init_rlibmemcached’:
rlibmemcached_wrap.c:11380: error: ‘MEMCACHED_SERVER_MARKED_DEAD’ undeclared (first use in this function)
rlibmemcached_wrap.c:11380: error: (Each undeclared identifier is reported only once
rlibmemcached_wrap.c:11380: error: for each function it appears in.)
rlibmemcached_wrap.c:11411: error: ‘MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS’ undeclared (first use in this function)
make: *** [rlibmemcached_wrap.o] Error 1

After googling across and friends suggestions, could solve the problem. The problem seems to be with the latest versions of the libmemcached and also gem memcached. I cleaned up the mess and repeated the trial with the following combination.

RubyInline(3.8.1);
memcache-client (1.6.3);
memcached (0.13);
libmemcached (0.25.14);

and things are back to normal :)
Hope this would save somebody's time!

References:

http://rubyforge.org/forum/forum.php?thread_id=31257&forum_id=20894
http://blog.evanweaver.com/articles/2009/01/24/secret-codes/

Monday, January 26

Twitter based Applications

It's been quite a while I wrote about Twitter, in the context of micro-blogging and Ruby on Rails applications.


http://sumanthtechsavvy.blogspot.com/2008/07/websites-weblogs-micro-blogging-what.html

http://sumanthtechsavvy.blogspot.com/2008/07/twitter-whats-truth.html


I thought it's worth to maintain a separate blogs, to collect the fast releasing applications based on "Twitter".


I welcome your suggestions to list the applications.  Mail across the twitter app that you are using/noticed.


http://appsontwitter.blogspot.com/



Friday, January 23

RoR based Social Networking apps compared

Ruby on Rails and Social networking are probably few that took limelight when WEB2.0 bug was bit! You hear/find/discuss... everywhere on these, and I thought it would be good idea to club the both and do a comparison withing social networking Applications based on Ruby on Rails.

RoR Based Social Networking Apps Compared

Wednesday, December 31

Qucik Fix: ActiveRecord Migrations reset_column_information

Few days back I had created few migrations that would rename existing table and again create a table with old name.
  1. user should be renamed as "old_users" 
  2. create a new table "user"
  3. restore the data with different column names in the "user"

  def self.up
    rename_table :users, :old_users
    create_table :users do |t|
      t.column :created_at, :datetime
    end  

    Temp.find(:all).each do |user|
      new_user = User.new(:id=> user.id, :created_at => user.created_at)
      new_user.save!
    end
  end

Don't worry about the Temp, Temp is a class through which I am accessing the old_users table.  Precisely,

class Temp <>
  set_table_name "old_users"
end

This worked pretty well in my local environment and when I deployed in staging, it crashed.  The error was that, it was trying to insert data into table with prvious structure/columns.  Which means, the new structure hasn't taken effective.

The quick fix seems to be reset_column_information.  Before pushing/creating fresh data in the table, I need to reset the column information of the tables.  So including the following line:
      User.reset_column_information
right before creating new users solved the problem.

By the way "WISH YOU HAPPY AND PROSPEROUS NEW YEAR"

Quick Fix: YAML syntax & Fixtures issue

Today I got a mail from one of my juniors who was struck with some strange problem.  
While he started playing with built in unit tests in one of his rails project, he got an error

Errno::ENOENT: No such file or directory - ramesh

  I was bit confused with this error and asked him to send me a screen shot of the error so that I can understand it better.  And here he sent the following snapshot,

Well when I got this it was very clear that the problem was with fixtures.  So I peeked into his fixtures, which is like this:


having looked into the fixture,  it was pretty clear that this is about right syntax.  And this was the quick fix which worked out:


Quickly revising back about YAML & Syntax while defining hierarchical elements would give you clear view of this quick fix.

  Anyways, it was the mistake in the indentation while defining the YAML :)

Tuesday, December 30

Usability Tip: Ajax loading/busy indicator

What is Ajax?
In a nutshell, "With Ajax,web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page".

  Now that these requests are happening at the background, user should be aware that the application is trying hard to retrieve the data.  But, How do we do that?

This is where we can use Ajax loading/busy indicator.  We show some text/image saying that we are working/loading... until the request is completed.  This would increase the usability and end user will be happy enough.  
  I am going to show it's implementation in RoR based web applications.  

Module ActionView::Helpers::PrototypeHelper, takes care of Ajax implementation through prototype library.





as you see the rails form tag helper comes out with interesting usability options. Above we just implemented, :loading & :complete options where-in it would show/hide particular div ("loading"). And what's in that div?




well it's done.  
Few samples...




Do I need a designer? 
hmm... we don't need designer for every thing. Especially this usability can be entirely handled by developer.  

How do I create an image? I don't have prior experience! 
Not needed just follow 3 simple steps 
2. select Indicator type, colors. 
3. Generate & Download It  

I don't know RoR, how can I do it in PHP/Python/Java/JavaScript? 
This needs prototype, JavaScript library that provides DOM manipulation. The same is achieved like this:



use the above snippet.