Install “bcrypt-ruby” on Windows

I was trying to install “bcrypt-ruby” on Windows 8, 64 bit .

Tried a lot of configurations, ranging from different versions of the gem, direct from git, platform ruby etc.

But nothing worked

At the end installed DEVKIT compatible to my ruby version and thats it.

Steps

Install Devkit compatible to your ruby version

Link : http://rubyinstaller.org/downloads/

Download under

C:/Ruby Folder/devkit

Then on command line go to above path

C:/Ruby Folder/devkit

then say

gem install bcrypt-ruby

This should install it,

Post this, you need to add the gem to your Gemfile and say

bundle install
bundle update
bundle install

This should work fine. Also solves update issues related to active_record etc.

The same should work for WIN 64, WIN 32 also.

The “StateCraft” of Salary Hikes, promotions , appraisals and an implementable solution

Appraisals

Indians Exports :
Contribution  of IT Industry
1994 – 4%
2012 – 25 %

Thats Cheetah Fast !!! And salaries also did grow at the same pace, almost till recent past. Most of the times we saw the ladder of career growth faster than an elevator – most of times defying logic and rationale.

But things are changing now , so do the process of appraisals , promotions needs a change.

Obviously, HR practices that evolved during these years took a certain shape.

Today :
A budget is decided for the total amount of increments by the company , and then allocated to each group or a team. So basically they are trying to fit the appraisal ratings distribution to the increments one(tring tring!!). At times promotions also follow the same road which leads to Rome, may be at times the manager feels threatens about attrition and promotes someone, otherwise there is not much rational.

Sounds unfair and crude ? 

Solution :Live  it, as thats the way it it .

No , the HR system needs a revamp. High time.

Time to innovate

For starters – do realize that each of those tools serve a different need.

  • Appraisal Ratings give feedback about how the person has performed over the past cycle.
  • Hikes (or Increments) plus bonuses serve a dual purpose – first to make sure the employee considers it worthwhile to spend his/her effort and time for your work, and then as a mechanism to share the company’s good performance and fortunes in the market with everyone who was involved.
  • Promotions are a way of telling people that you see greater potential in them, and would like them to shoulder more responsibilities.
The above 3 are of course correlated , however the strong CAUSE-EFFECT(Appraisal-Hike) effect linkage is simply  wrong. Not only this linkage messes up the desired communication (rationale behind a basic Appraisal)  but also screw’s the communication of the retrospective messages that the employees derive out of these.
eg: appraisal rating is mostly done against some objectives which are not static across the year (or the period of appraisal) , mostly in IT the goals change frequently and its hard to make the sound tangible. Now adding relative grading over that is not only redundant, but ugly, not smart at all.
Some workable solutions , be brave try them out:
  • Disconnect/Separate the increment and appraisal cycle completely : Outcomes of both should be different, and monetary benefits should not be linked to only increment cycle.
  • Be Transparent : Let the numbers do the talking, be as transparent as possible about how the company is doing, and what are the effects and plans etc. Make the employees part of decision making , share the responsibility.
  • Have shorter and more frequent appraisal cycles : Make the appraisal cycles more frequent, at times we keep them biannual or annual as we see lot of efforts are invested into it , however if there are more frequent and little less formal then automatically it will feel routine and easy. Also with this you will have the ability to revisit the objectives more frequently and also monitor them better.
  • “Together we sail together we sink” : Visibility sells more than ability. I am sure its not Greek to you. In simpler words if you are visible and the manager feels you are important than you have won half of the battle , so no matter how excellent you have been at work compared to your team mates what matters eventually is the perception or your demand. What happened to skills ? What happened to efforts ? What happened to relative grading ? is the appraisal for me to help me grow , or for the company itself so that it knows whos is good or who is bad ? Confused .. yeah! So better reward those who are less visible but have been playing a key role of an enabler in your firm.
  • Its not always about money , honey ! : Track skills and value growth as well Apart from monetary increments(Short term or Long term). This will not only help the employee to gauge himself but also help the company to have a better foundation for bigger opportunities within the organization.
  • Promotions should not come easy : Its a commitment to a vision one buys into, and the readiness to explore and experiment with ideas, practices and execution at a level one has not tried before. You should be able to undo a role-experiment. Try a different word for “promotion” so you don’t have to “demote” someone if they or you feel they’d rather do something else.
    Delink roles from “salary bands” etc . Create them based on levels of responsibility, impact and effort needed.
  • Self appraisals –  Assuming you have smart and ethical employees (i.e. if you have hired them right), overall, you’re likely to stay within the same ballpark for errors in the process. Balance with sanity checks at random. If you cannot trust your folks at all, well, you have bigger issues!

Not all work for monetary rewards and establishing a company around that will only lead to a culture which will choke when the money flow is down. Hire better and nurture them(not use them!). Look at creating a self-managed and transparent organization where you do not have to conjure up untenable explanations or make people look unproductive or inefficient merely because there’s not enough to give everyone a good hike.

"Installing Rmagick / Image Maagick on Windows"

  1. Download from the following link: http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
  2. Extract to a folder.
  3. Run the installer.
  4. Install the gem contained in that folder on your local machine using the following command: C:Userssambit.duttaDesktopRMagick-2.12.0-ImageMagick-6.5.6-8-Q8>gem install rmagick-2.12.0-x86-mswin32.gem
  5. Ensure that the gem is correctly installed by checking your gem list.
  6. Restart your computer.

"Compilation : Increase performance of any Application "

Short Term

  • Asset Packager
  • Caching – All levels
    • Memcache
    • Action
    • Active Record
    • Fragment
  • combine CSS and JS files with the :cache option
  • avoid HTTP 302 redirects
  • use secondary indices for your database (Rails won’t do this for you)
  • increase SQL-Server query cache
  • SSL only where required
  • Load assets from Subdomain/ different instance , make these environments cookie free
  • Iframe the videos in app
  • Reduce the HTTP request to any page
  • Put all style-sheets at top
    • and compress them to single CSS
    • No Inline CSS
  • Put Scripts to the bottom
    • and compress them to single JS
    • Remove Duplicate scripts
    • No Inline JS
  • Reduce DNS lookups
  • Avoid 301 Redirects
  • Cache and reduce size of Favicon
  • Dont scale images in HTML
  • No empty img src=””
  • Get rid of the extra/unused meta-tags
  • Trim out the white chars
  • Remove the comments
  • Use short names for media included in your website(images, flash files, movies and others)
  • Use relative links instead of full url links


Ongoing :

  • Optimize queries, eager loading of associations with :include and JOIN
  • group operations in a transaction
  • use a Sphinx search server for searching
  • Minimize Response Size
    • SELECT only the needed columns
    • LIMIT the number of return datasets (pagination)
  • Dont use Before Filters for large data
  • Host the server nearer to the user
  • Add Expiry to Header 
  • no 404
  • Reduce Cokiee size


Long term

  • AWS – EC2 AMAZON – Content Delivery Network
  • Compress Assets YUI 
  • use CSS Sprites
  • replace full HTTP requests by XHR requests (i.e. Ajax calls)
  • use counter cache columns
  • denormalize (e.g. comma-separated list of ids in single fields to cache queries)
  • precalculate data through rake tasks
  • Migrating to Rails 3 and Ruby 1.9.2
  • Image caching/compressing
  • Redis
  • Cache option enabled for Js and CSS
  • Configure Etags
  • Cache AJAX requests
  • Use a GET request even if we are doing a AJAX, depending on whether we need to only fetch data or post also
  • Post load components – YUI image loader
  • Pre load some components
  • Reduce number of DOM elements
  • Move irelevant or non-unique content into subpages or popups
  • Remove site-wide links from your footer
  • No tables, tableless design

Ways to test

  • Benchmarking
  • Profiling
  • New Relic
  • Rails Log Analyser
  • Ruby Prof
  • Load Less SQL queries
  • YSLOW

Bibliography



"Ruby-YUI Compressor"

Need :

Check jquery and jquery min, why we need it and what is the difference ?
Yes , it saves memory and hence load time .

So how to achieve the same in a JAVA or a RUBY app.

Solution:
Yahoo came with a YUI compressor .
Link : http://developer.yahoo.com/yui/compressor/

What it does :
It compresses the JS and CSS
– by removing white spaces
– by replacing the variables with short names etc

Ruby Equivalent
Ruby-YUI Compressor provides a Ruby interface to the YUI Compressor Java library for minifying JavaScript and CSS assets.
Link : https://github.com/sstephenson/ruby-yui-compressor

"Increase performance of RAILS Application"

Minimize HTTP Requests

– combine CSS and JS files with the :cache option

– use CSS Sprites

– avoid HTTP 302 redirects

– replace full HTTP requests by XHR requests (i.e. Ajax calls)

Minimize Database Requests

– Optimize queries, eager loading of associations with :include and JOIN

– use Rails caching: action, page and fragment caching, Memcache is an option

– use caching with timed-based expiration for dynamic content

– group operations in a transaction

– use counter cache columns

– denormalize (e.g. comma-separated list of ids in single fields to cache queries)

– precalculate data through rake tasks

– use a Sphinx search server for searching

Minimize Response Size

– SELECT only the needed columns

– LIMIT the number of return datasets (pagination)

Minimize Framework Activity

– use direct links instead of linkto or urlfor to avoid routing

– avoid dynamic finders like Model.findby*.

Minimize Database Activity

– use secondary indices for your database (Rails won’t do this for you)

– increase SQL-Server query cache

– Benchmarking

– Profiling

– YSLOW

– EC2 AMAZON

– ASSET packager

– SSL only where required

– Caching (Action, Fragment, Active Record)

– Migrating to Rails 3 and Ruby 1.9.2

– Image caching (if possible)

– Use Redis to check

– Add Benchmarks

– Cache option enabled for Js and CSS

– Replace HTTP to XHR where ever possible

– Eager Loading, use include and join

– CSS sprites

– Counter Cache

– Indexing

– Pre Calc large Data using Rake

– Sphinx Search

– Select only those fields required

– New Relic

– Rails Log Analyser

– Ruby Prof

– Load Less SQL queries

– Dont use Before Filters for large data

"Deploying on Amazon AWS"

How to deloy applications on AWS (Ruby on Rails or LAMP or JAVA etc ).

Was just trying something and thought of saving some of my server cost , and decided to use Amazon AWS instances for it. I know I know .. I am bit late but nevertheless .

Will try to form a basic approach of deploying on AWS , wont cover actual ROR or LAMP deployment , but will try to take you till how we can actually get ssh access , rest post that is routine .

  1. Amazon is currently offering a ‘Free’ (http://aws.amazon.com/ec2/pricing/) service tier in their EC2 cloud, so go ahead and register that .
  2. Once you have registered now, try to create an instance .
  3. Sign into aws.amazon.com and click on Amazon EC2
  4. Click on the “Launch Instance” button and deploy an instance
    • If you want to stay in the ‘Free’ Tier to just try things out, pick a Micro instance which has a big yellow star next to the Select button
    • In my case, I picked the UBUNTU Image
    • As part of setting up the new instance you will be asked to re-use or create a new keypair. This will be important when accessing the Image later on
  5. Login to the EC2 instance you created before.
    • On the Instances page, highlight your instance and select Instance Actions -> Connect
    • A dialog box will indicate how to use an SSH client to access the instance. The command looks something like this:
      ssh -i keypairname.pem ec2-user@ec2-XX-XX-1XX-1XX.us-west-1.compute.amazonaws.com
    • For windows users, see this article about how to use PuTTY to access the Instance (http://docs.amazonwebservices.com/AmazonEC2/gsg/2007-01-19/putty.html)
  6. Once you  have logged into your system using SSH , now you can easilyinstall LAMP, or ROR or whatever you want to. It will be the same way you install these on any other UBUNTU boxes.

EASY pesy !!

Thats it ! Will try to make time and write more of actual ROR and LAMP installations and also DOMAIN mapping in the coming posts .

Thanks !!