Skip to content
How to print a document as a booklet
Posted 1258 days ago

After spending about an hour, reams of pages, and pails of ink, I finally stumbled into the magic of booklet printing. My source document was a MS-Word 2010 document with…

How to print a document as a booklet
Installing Rails plugins from Github on Windows
Posted 2277 days ago

Well, I have installed several Rails plugins but I was bummed when I tried to install the re-captcha plugin from Github. The command belwo just fails silently and creates an…

How to install RMagick + ImageMagick on Windows
Posted 2039 days ago

I have installed RMagick and Image Magick on many Windows machines and I have stumbled across various kinds of errors, and finally I have decided to document them so that…

Installing gems behind proxy servers
Posted 2697 days ago

It is well documented as part of gem help that using the following common options:

-p, --[no-]http-proxy [URL]      Use HTTP proxy for remote operations

will allow gem to use the proxy server…

ruby-alibris wrapper wins
Posted 1491 days ago

I had blogged about my recent open-source project, a Ruby wrapper for the Alibris API, ruby-alibris. Soon after, Alibris had announced their First Annual Alibris API Programming Contest, and I submitted…

Playing with CoffeeScript
Posted 1659 days ago

After having used Haml and Sass and loving them, a friend introduced me to CoffeeScript. In short CoffeeScript is to Javascript as Haml is to Html and Sass is to…

Playing with CoffeeScript
Error in Ruby relative_path_from call on Windows
Posted 1897 days ago

I was recently working on some code for building an extension for Spree, when I ran into an issue while generating a extension controller. The error only happens on Windows.

The…

Rails Magazine releases free Issue #5 digital edition
Posted 2046 days ago

Themed in beautiful Winter art and pictures, Rails Magazine released their Issue #5 free digital edition to the whole Ruby and Rails community worldwide.

It is the largest issue since we…

Rails Magazine releases free Issue #5 digital edition
Tip: has_one and nested form/attributes
Posted 2181 days ago

Although, the usage of nested forms with has_many associations is well documented, I found that especially the call ..build that works for has_many associations do not work for has_one associations.…

Install SQLite3 on Windows
Posted 2260 days ago

I found this great screencast that shows how easily you can install SQLite3 on Windows. So, here you go:

Install SQLite3 on Windows

PreviousNext

Apr 30 / Rupak Ganguly

How to run boot2docker without TLS?

Boot2Docker by default exposes the docker daemon securely via TLS, and the following env settings are recommended:

DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_CERT_PATH=/Users/username/.boot2docker/certs/boot2docker-vm
DOCKER_TLS_VERIFY=1

But, there are situations in development when you want the docker daemon to be exposed insecurely. I know, not the best of idea, but sometimes it is needed.

So here is what you need to do:

$ boot2docker ssh
##         .
## ## ##        ==
## ## ## ## ##    ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
\______ o           __/
\    \         __/
\____\_______/
_                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.6.0, build master : a270c71 - Thu Apr 16 19:50:36 UTC 2015
Docker version 1.6.0, build 4749651
 
## Create this file
docker@boot2docker:~$ sudo vi /var/lib/boot2docker/profile
 
## Add this one line
DOCKER_TLS="no"

Save the file and exit the ssh session.

Now, edit your bashrc/zshrc profile or export the following envs again:

DOCKER_HOST=192.168.59.103:2375
DOCKER_CERT_PATH=/Users/username/.boot2docker/certs/boot2docker-vm
DOCKER_TLS_VERIFY=

Note: The DOCKER_HOST env var now uses port 2375 (default insecure port), and the DOCKER_TLS_VERIFY env var is empty string.

Now, from another host that does not have docker installed, you can point to the insecure docker host like so:

docker run -d -e DOCKER_HOST=192.168.59.103:2375 -p 3000:3000 mycoolimage

Hope you find this useful. Leave your comments or feedback.


Feb 4 / Rupak Ganguly

Docker is good, Panamax is awesome

I presented at ATLRUG on Panamax, an open source management system for Docker. Directly working with Docker can be very challenging and in many cases one must his apps on his own. Panamax is a containerized app creator with an open-source app marketplace hosted in GitHub. Panamax provides a friendly interface for users of Docker, Fleet and CoreOS.

Video

The video for the presentation is also available at: http://youtu.be/Nj_Jn6pjLPA

This presentation was recorded at the November, 2014, meeting of the Atlanta Ruby Users’ Group. Learn more about our community at http://www.atlrug.com.

Slides

The slides for the presentation are available for download at https://speakerdeck.com/rupakg/2014-atl-ruby-meetup-remote-deployments-with-panamax.

To read more about Docker and Panamax, visit CenturyLinkLabs blog.


Aug 11 / Rupak Ganguly

How to manage whitespace around text in Haml?

While creating some html content using Haml, I ran into the problem of removing the extra space that Haml puts in after a link text. Here is what I wanted the link text to look like:

Check out my website.

But, what I got was: (note the extra space before the period)

Check out my website .

It drove me nuts trying to fix it before I discovered the cool new Haml helpers. The particular helper in question that fixed the above issue is the succeed helper method as shown below:

%strong
   Check out my
   = succeed '.' do
       %a{href: 'http://rails.webintellix.com'} website

Hope that helps you to write good html using Haml.

If you have other Haml tricks you know of, let me know in the comments section.


Nov 13 / Rupak Ganguly

Ruby wrapper for PunchTab API

A while back, in May 2013, I had worked on writing a Ruby wrapper for the PunchTab API. I found the concept of PunchTab‘s loyalty program interesting, and wanted to integrate that into my web apps. So, I wrote the wrapper. See the code snippets below, to see how to use the wrapper to access PunchTab’s loyalty programs.

read more…


Feb 24 / Rupak Ganguly

How to print a document as a booklet

After spending about an hour, reams of pages, and pails of ink, I finally stumbled into the magic of booklet printing. My source document was a MS-Word 2010 document with 18 pages, which I wanted to print as a 2-sided, 2-pages per sheet, booklet on Letter paper. Although, MS-Word comes with an option to print a document as a booklet as shown below,

booklet_printing_1

 

it is impossible to get it right, the way you expect it. It would print page 1 and 7 one side of the sheet, while you would expect it to print 1 and a blank. Just tried every other possibility, even with odd numbered pages, but I had no luck.

read more…


Jul 6 / Rupak Ganguly

ruby-alibris wrapper wins “Most Developer-Friendly Code” award

I had blogged about my recent open-source project, a Ruby wrapper for the Alibris API, ruby-alibris. Soon after, Alibris had announced their First Annual Alibris API Programming Contest, and I submitted the ruby-alibris project as an entry. And, to my surprise, I got notified that it won the “Most Developer-Friendly Code”, and a $250 cash prize. Today, Alibris released a press release announcing the winners. Here is an excerpt from the press release:
read more…


May 15 / Rupak Ganguly

Ruby wrapper for Alibris API

I recently wrote a Ruby wrapper (ruby-alibris) for the Alibris API. I started with the Search API, and I would finish the wrapper with the Recommendations and Reviews shortly. Read the documentation below and give it twirl. I would be interested in your comments and feedback. Alibris, is the premier online marketplace for independent sellers of new and used books, music, and movies, as well as rare and collectible titles.

read more…


Jan 19 / Rupak Ganguly

Playing with CoffeeScript

After having used Haml and Sass and loving them, a friend introduced me to CoffeeScript. In short CoffeeScript is to Javascript as Haml is to Html and Sass is to CSS. Not so strictly speaking but lets roll with this for now. So here is my how-to article to share my thoughts and experience, while I played with it.
What is CoffeeScript and why do you care?
Instead of me, making something up, here is what the CoffeeScript site has to say:
“CoffeeScript is a little language that compiles into JavaScript. Underneath all of those embarrassing braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.
The golden rule of CoffeeScript is: “It’s just JavaScript”. The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly (and vice-versa). The compiled output is readable and pretty-printed, passes through JavaScript Lint without warnings, will work in every JavaScript implementation, and tends to run as fast or faster than the equivalent handwritten JavaScript.”
Read more or try in your browser at the CoffeeScript website.

Jan 19 / Rupak Ganguly

Rails Installer on Windows

If you are like me, I started my Ruby on Rails development on Windows and I had my issues with installing the stack. I had issues with gems especially the ones with C-extensions. But, things have changed dramatically over the years and things are much smoother now. A great example of getting the Rails stack installed on Windows is: Rails Installer.

The Rails Welcome Kit has everything you need to hit the ground running. In one easy-to-use installer, you get all the common packages needed for a full Rails stack. Download it now and be writing (and running) Rails code in no time. Packages included are:

  • Ruby 1.8.7-p330
  • Rails 3.0.3
  • Git 1.7.3.1
  • Sqlite 3.7.3
  • DevKit

Watch the RailsInstaller Introduction from Engine Yard on Vimeo.


Nov 2 / Rupak Ganguly

Rails Magazine Issue #7 released

Rails Magazine Issue #7

Rails Magazine Issue #7

We are happy to bring you the Issue #7, 2010 of Rails Magazine. We are trying our best to fall into a regular publishing schedule. In this edition, we have a very nice collection of articles. I am also very happy to have penned down the editorial for this edition.

In the 28-pages of full color, we bring you the following:

  • Editorial by Rupak Ganguly
  • An Overview of Refinery – a Rails CMS by David Jones
  • Converting A Rails Site to Refinery CMS by Christopher W. Lehman
  • Auditing plugin by Mihai Târnovan and Gabriel Târnovan
  • Hobo – Making Application Development on Rails Even Faster by Dave Reynolds
  • Installing Ruby on Rails on Windows by Victor Thiago
  • Simple Unobtrusive Ruby/Rails Debugging by Stephen Rycyk
  • A Well Kept Secret, Ruby and Cryptography by Richard Penwell

The digital edition (PDF) is available for free at http://www.railsmagazine.com/issues/7. You can also grab a printed copy available in US, UK and Canada (7.60 USD + shipping).

Download the free digital edition of Rails Magazine Issue #7.