Tatva-Artha

meaning of "it"

Archive for the ‘All’ Category

Installing RMagick gem on mac osx (Mountain Lion)

without comments

Several things have changed since the last time I wrote about gotchas when installing rmagick on mac osx.

Now a days, you need Homebrew instead of Port.

Install ImageMagick using homebrew first

$ brew install imagemagick

Before, you install rmagick gem though, find out the homebrew folder where imagemagick libraries are installed.

$ Magick-config --prefix

Change directory into this directory.

$ cd `Magick-config --prefix`

Now, symlink the versioned library to what the gem is looking for.

$ ln -s libMagick++-6.Q16.dylib libMagick++.dylib
$ ln -s libMagickCore-6.Q16.dylib libMagickCore.dylib
$ ln -s libMagickWand-6.Q16.dylib libMagickWand.dylib

Your specific versioned library may differ a little bit.

Now, you should be able to infall gem just fine.

$ gem install rmagick

Written by Sharad

October 6th, 2013 at 11:53 pm

Posted in All,Technology

Tagged with , ,

Unix init script for searchd (sphinx server) and monit config

without comments

If you are using thinking_sphinx for your text search needs on a rails project, you will need to have searchd service monitored in production. Monit service allows us to monitor a unix service. However, there is no good/recommended init script that exists. Here’s one that could work for your rails3 project.

Read the rest of this entry »

Written by Sharad

September 20th, 2012 at 5:05 pm

Posted in All,Technology

Tagged with , , ,

Postgres command reference for rails project

without comments

If you recently switched your default rails project from mysql database to postgres, you may realize that creating databases and users isn’t as much breeze as mysql was.

Here’s a few commands to keep in mind:

On Ubuntu atleast, installing postgres using apt-get creates a unix system user called postgres. The postgres server seems to run under this user and this is kind of like the root user for database. You have to “sudo su – postgres” to create other users.

If your app is setup to use app_development and app_test for development purposes, you need a database user say “app”. Here’s to start:

# create user app;

If you need the user to have password

# create user app with password 'password';

In postgres, new users don’t have privilege to create database by default. A user created with above command will not be able to execute “rake db:create:all” to create databases. In order to create a user who has ability to create database, use this.

# create user app createdb;

If you need to enable an existing user to drop/create database, use this:

# ALTER ROLE username WITH CREATEDB;

Written by Sharad

September 18th, 2012 at 2:45 pm

Posted in All

Tagged with ,

Intalling pg gem on ubuntu

without comments

Installing pg gem (for protgres) on ubuntu server requires following packages

$ sudo apt-get install libpq-dev
$ sudo apt-get install postgresql-server-dev-all

Written by Sharad

September 18th, 2012 at 2:20 pm

Posted in All

Tagged with , , ,

Enforcing HTTPS using apache config

without comments

Rails 3.1 makes it easy to enforce SSL from within the application. If entire site is to be served under SSL, it may be cleaner to configure this at apache level. Here’s what apache vhost config would look like in that case.

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName website.com
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<VirtualHost *:443>

  ServerName website.com
  DocumentRoot /var/www/website.com/

  SSLEngine on
  SSLProtocol all
  SSLCipherSuite HIGH:MEDIUM
  SSLOptions +StdEnvVars
  SSLCertificateFile      /path/to/website.com.crt
  SSLCertificateKeyFile   /path/to/website.com.key

</VirtualHost>

Written by Sharad

June 6th, 2012 at 7:02 pm

Posted in All

Tagged with , ,

Group Chat Services: Campfire, HipChat, FlowDock, Grove.io

with one comment

If your software development team is still using email or mailing list as primary tool for chat purposes, you are doing it wrong. Having used one in last few years, I can say that group chat services like Campfire, Grove.io, HipChat and FlowDock are as indispensible as your IDE or choice of OS.

I evaluated these few services recently and here’s how I see them stack up:

TXT chat

All have it. I don’t count ability to choose fonts etc. as a big deal as long as the default fonts are good not annoying. All of these services do a decent job at that. One thing I do look for is minimalistic interface. I like interface where most of the space is used for chat text and listing users and no other fancy logo etc. Again, most of them do a good job. Having used campfire in the past, I like HipChat screen slightly better. Personally, I don’t like how Campfire quotes multiline text differently from single line text. HipChat does this better. Undoubtedly, this is a minore point.

File/Image upload

Grove.io is the only one that doesn’t support this, I am guessing, because it’s implementation is IRC protocol based. The benefit for IRC based protocol is that you can use your existing IM clients (Adium, Colloquy etc.) instead of having another app running on your machine. To me, that is a minor advantage versus having ability to attach files/images while I am chatting. As trivial as this sounds, this is the most used feature after txt messages when you are upgrading from age-old IRC based chats. And it is plenti-useful in your day today operations. Ability to drag-drop files/images is the biggest efficiency gain with group chats. And this point alone made Grove.io a no-go for me.

IM integration or stand-alone application

While I enjoyed campfire for unobtrusive chat and file/image sharing, I didn’t like web based interface. Web-app wrappers like Fluid app mitigate it to a certain extent, but still it doesn’t enable full desktop integration like growl notification. Grove.io beats other at this game since it allows your traditional IRC based client to be used. HipChat has a standalone app, which is awesome.

Third party application integration

While these group chat service are useful to any business domain, I am primarily looking at software development shops. And as software developers you need ability to integrate your apps/tools. Any service that doesn’t have such integration is a fail. All 4 services I evaluated offer different level of integration. Some are basic in that they enable any kind of HTTP post and integration has to be built (Grove.io). While others like FlowDoc have already written whole host of plugins to use. Campfire has a few as well. Integration with github could be useful for my purposes. Which one wins for you depends on your specific needs here.

Pricing

For a medium size team of 15-25 people, most of these service cost round $25-$40/month. I didn’t care which one is absolutely the cheapest since they are all within a ball-park and what tools/integrations they offer is more important than saving a few extra bucks. I do like HipChat’s pricing model of $2/user/month which is linearly applicable as opposed to different buckets of pricing that Campfire and FlowDoc offers.

If you are using no such tools, check these out. They are a must for a software development team!

(Thanks @automach and @raykrueger for services suggestions.)

Written by Sharad

May 5th, 2012 at 3:32 pm

Posted in All

Tagged with , , ,

Installing gsl gem on mac osx

without comments

At Local Offer Network, we use GNU scientific library to categorize all the offers that we aggregate using scientific methods. We leverage a rubygem called gsl for this heavily. Since this is a native gem installing it is a little tricky atleast on mac OSX.

In order to install, we have to install an older version of gsl library using homebrew first.

$ brew install gsl114

This installs the gsl version v1.14. Please note that latest version of gsl library (brew install gsl) will not work for the gsl gem. If you have already installed latest gsl, remote it (brew remove gsl) and start over.

Once this is installed successfully, the gsl gem should install fine.

$ gem install gsl

Written by Sharad

April 30th, 2012 at 2:32 pm

Posted in All

Tagged with , , ,

Upgrading to ruby 1.9: rbx-require-relative requires Ruby version ~> 1.8.7

without comments

If you are upgrading from ruby 1.8 or Ruby Enterprise 1.8.7 to ruby 1.9.2, you may encounter this error.

Installing rbx-require-relative (0.0.5) Unfortunately, a fatal error has occurred.
Please report this error to the Bundler issue tracker at https://github.com/carlhuda/
bundler/issues so that we can fix it. Thanks!/Users/sjain/.rvm/rubies/ruby-1.9.2-p290/
lib/ruby/site_ruby/1.9.1/rubygems/ installer.rb:364:in `ensure_required_ruby_version_met':
rbx-require-relative requires Ruby version ~> 1.8.7. (Gem::InstallError)

This most likely happens because you are declaring a dependency on ruby-debug gem in your Gemfile.

group :development do
  gem 'ruby-debug'
end

With ruby 1.9, you need to update this with new gem name ruby-debug19.

group :development do
  gem 'ruby-debug19'
end

This will eliminate the dependency on rbx-require-relative and fix the issue.

Written by Sharad

August 21st, 2011 at 1:55 pm

Posted in All,Technology

Tagged with , , ,

Developing webapp that require you to expose your local machine on web

with one comment

If you’ve ever developed facebook applications or have needed to integrate with paypal payment service, you know that those services require a reverse connection from their servers to your webapp to complete full circle. The process of making your webapp, running on your machine during development, to outside world was painful at best.

Not anymore. With this service called “localtunnel”, it is a piece of cake.

http://progrium.com/localtunnel/

Written by Sharad

June 10th, 2011 at 8:54 pm

Posted in All

Tagged with , , ,

Setting environment variables in Max OSX

without comments

Any a developer switching from linux to mac, the way to set environment variables is similar yet different enough that is annoying at times. I have so far failed to find a good documentation on where and how to set those in mac osx. Today I found one here.

My takeaway:

Mac OS X applies .bash_profile and .profile only for Terminal.app environment and Apple’s technical documentation suggests using ~/.MacOSX/environment.plist for other applications. So, by default PATH value will differ for RubyMine and the console.

For managing the global environments, it also recommends a system preference pane app. This worked for me.

Written by Sharad

May 16th, 2011 at 10:12 am

Posted in All,Technology

Tagged with , , ,