Monday, November 28

Configuring databases in case of integer type password

Though I have been working from past 6 years with Ruby on Rails in one of the recent bootstrap session to a small and enthusiastic groups I had noticed one another fine point in the way we use yml files.

Any newbie who is aware of Rails can pretty much recollect that we configure databases, test data and many other information required for application through YAML files.

Like in many of the previous sessions & trainings conducted I had moved on by creating simple rails application. Since it was a bootstrap session and the attendees were doing on their personal laptops couple of them had difficulty in configuring the database. I had zeroed down to database.yml after I got confirmed that they are all running on the right versions of mysql. This was the yml that they have in their applications


development:
  adapter: mysql2
  encoding: utf8
  database: blog_development
  pool: 5
  username: root
  password: 000000
  socket: /tmp/mysql.sock


As I found it normal I gave another try by myself and landed into same issue so did dig into the logs over there...


** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env** Execute db:load_config** Execute db:create
rake aborted!
can't convert Fixnum into String
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.4/lib/mysql2/client.rb:36:in `connect'


So here it is evident that there was a data type mis-match and keeping fingers crossed looked over again at the database.yml and this time zeroed down to the mistake




development:
  adapter: mysql2
  encoding: utf8
  database: blog_development
  pool: 5
  username: root
  password: 000000
  socket: /tmp/mysql.sock




The password was  000000 an integer type as per the yaml and password was expected as string. Once it was identified the fix was pretty simple




development:
  adapter: mysql2
  encoding: utf8
  database: blog_development
  pool: 5
  username: root
  password: "000000"
  socket: /tmp/mysql.sock



As always... every bootstrap session will keep on helping me to pick some tricky and interesting points otherwise which could not be easily noticed or observed in our day to day projects.

Monday, May 30

Action Item - Ruby Community

As every rubyist agree with me though Ruby has very active community around still in India our numbers are not that great. The number of genuine Ruby/Ruby on Rails resources are very less and but there is a great demand.

What I had observed was that quite number of professionals around have directly started with Ruby on Rails and then get carried away with Rich Internet Applications implementations and gets busy in learning all new new technologies giving less time to spend in the core of Ruby itself.

I decided to contribute towards this by teaching ruby. Things fell in place so perfectly there is this graduate also have sun certfication to his credit. He approached me for mentorship and happily agreed. That's how I started my very first action item of spreading ruby and helping the community to grow

HAPPY RUBY CODING :)

Sunday, May 29

RubyConf 2011 - Take Away

It was a very good weekend, good as it was a get together of rubyists across India. Fortunately I made it to this rubyconf in the last minute. Unlike last time, I had a plan for this rubyconf in terms of
what talks to attend whom to meet, what to discuss on...

Meetings included with folks from start-up's, research organizations, mobile. And I can keep going on with the list
however to condense what impressed me are

1. Community - Matz's calling out to help community grow

2. jRuby - Well Mark kindled my thoughts to go for Mac & i-phone

3. MacRuby - Mark's presentation was very impressive and just pushed purchasing mac & i-phone to top in my To Be purchased list

4. New ventures - Having a good experience of starting and building teams with Innozon I am always eager and encourage to share my experiences with everyone. Got to meet couple of interesting and enthusisatic guys from down Chennai. I promised them all my support possible to make sure they grow healthy ;)

RubyConf helped me to concentrate on certain niche things that I will be covering as I go along...

Monday, September 6

More black listed guys

List of blacklisted people have been increased... reach me to get the latest list [if you want to save time & energy ;)]

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/