Aug 28
Linux + Apache 2 + FastCGI + Ruby
icon1 Dipesh Nyachhyon | icon2 Tutorials | icon4 08 28th, 2008| icon3No Comments »

This whole week, I was frustrated trying to make RoR app. run in Apache 2 with FastCGI. I setup couple of instances of linux as virtual machines (mainly Fedora 8/9 and openSUSE 11) and banged on them. So here is what I come up with to make ror apps run  in apache 2 with fastcgi… I hope it helps all the poor souls out there…

  1. Install Apache 2
  2. Install ruby
    $ yum install ruby
  3. Install ruby gems
    $ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
    $ tar xzf rubygems-1.2.0.tgz
    $ cd rubygems-1.2.0
    $ ruby setup.rb
  4. Install Ruby on Rails
    $ gem install rails –include-dependencies
  5. Install httpd devel package
    $ yum install httpd-devel
  6. Install FastCGI
    $ wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
    $ tar xzf fcgi-2.4.0.tar.gz
    $ cd fcgi-2.4.0
    $ ./configure
    $ make
    $ make install
  7. Install mod_fcgid
    $ wget http://nchc.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz
    $ tar -zxvf mod_fcgid.2.2.tar.gz
    $ cd mod_fcgid.2.2

    In Makefile file set top_dir to the top path of the apache installation e.g. /etc/httpd

    $ make
    $ make install

  8. Install FCGI gem
    $ yum install ruby-devel
    $ gem install fcgi
    $ yum install fcgi-devel
  9. Configure apache (httpd.conf)
    • Add LoadModule fcgid_module modules/mod_fcgid.so
    • DocumentRoot “/var/www/html/<app-name>/public”
    • <Directory “/var/www/html/<app-name>/public”>
    • Inside <Directory> apply these changes

AllowOverride All

Options +FollowSymLinks

Options -Includes -ExecCGI

<IfModule mod_fcgid.c>

AddHandler fcgid-script .fcgi

Options +FollowSymLinks +ExecCGI

</IfModule>

#fcgi

FCGIWrapper “/usr/bin/ruby /var/www/html/<app-name>/public/dispatch.fcgi” .fcgi

RewriteEngine On

RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

  1. Install sqlite3
    $ yum install sqlite3
    $ yum install ruby-sqlite3
  2. Troubleshoot
    If you get “You don’t have permission to access /dispatch.fcgi on this server.” or/and
    if you see an error similar to below in apache error log:

    [error] (13)Permission denied: mod_fcgid: couldn’t bind unix domain socket /etc/httpd/logs/fcgidsock/5093.5
    [warn] (13)Permission denied: mod_fcgid: spawn process /var/www/html/poc/public/dispatch.fcgi error

    Then check permission/ownership of /fcgidsock/ directory…

Apr 16
Combobox plugin for jQuery
icon1 Dipesh Nyachhyon | icon2 jQuery Plugins | icon4 04 16th, 2008| icon3No Comments »

What it is?
dxCombobox is a jQuery plugin that allows you to transform any element into an editable combobox.

Pressing any alphanumeric key will transform select box into editable state by creating a text box element. An case insensitive search is performed on the corresponding of the select box, one the users starts to type in this box. When user goes out of the box (on blur/return), if a direct match is found in the then it is selected else a new option is created with the entered text.

How to use it?
$(element).dxCombobox()

Download

I would like to hear what you thought of this plugin…

Jan 29
JAXER – The Ajax Server
icon1 Dipesh Nyachhyon | icon2 External | icon4 01 29th, 2008| icon3No Comments »

Modern web sites and applications use Ajax to create engaging user experiences: the HTML and CSS are set in motion using JavaScript running in the browser and calling back the server. To achieve this, the server needs to prepare the web page appropriately, and to know what to do when the JavaScript calls it. But the server knows nothing about the HTML and CSS DOM, nor how to handle JavaScript data, and you can’t code it in JavaScript…

…Jaxer changes all that. Jaxer is the world’s first true Ajax server. HTML, JavaScript, and CSS are native to Jaxer, as are XMLHttpRequests, JSON, DOM scripting, etc. And as a server it offers access to databases, files, and networking, as well as logging, process management, scalability, security, integration APIs, and extensibility.

Learn more >>

Jan 16
Sun to Acquire MySQL
icon1 Dipesh Nyachhyon | icon2 External | icon4 01 16th, 2008| icon3No Comments »

Sun announced an agreement to acquire MySQL AB, an open source icon and developer of one of the world’s fastest growing open source databases. This acquisition accelerates Sun’s position in enterprise IT to now include the $15 billion database market and reaffirms Sun’s position as the leading provider of platforms for the Web economy and its role as the largest commercial open source contributor.

Learn more

Dec 14

Here are the most exciting, amazing, and incredible PC advances of all time. From the venerable TRS-80 to the first programmable graphics cards, this is every single major tech advance for the last 20+ years!
more >>

- maximumpc.com

Dec 7

By Andy Patrizio

Mass market CPUs have reached the four-core stage, and there are 64-core and 80-core processors in labs right now, but for IBM, that’s still not enough. Big Blue has designs on a processor with a whopping 1,000 (or more) cores. But don’t get any purchase orders ready; this is a long-term effort that might take as long as 15 years to complete.

The breakthrough, published by a group of IBM researchers in the journal Optics Express, details how IBM used optical interconnects between CPU cores instead of copper wires to transmit data between the cores through pulses of light rather than electrical charges.

Continue >>

Dec 6
The programmer dress code
icon1 Dipesh Nyachhyon | icon2 Misc... | icon4 12 6th, 2007| icon3No Comments »

codethinked.com

I really want to know what it is about programming, or computers in general, that makes people want to grow a beard, have long hair, and dress like a slob. I can say these things without guilt because while I do not have long hair, I do have a beard and I do in fact dress like a slob. Not horribly sloppy or anything. I am actually pretty fanatical about hygiene, I just am not big on tucking my shirt in or ironing it or shaving. So who was the guy that started the unkempt programmer code of honor?

Find it out >>

Dec 6
Send content of a webpage in email
icon1 Dipesh Nyachhyon | icon2 Tutorials | icon4 12 6th, 2007| icon3No Comments »

We can use php’s ob_* functions to capture page content and send it in an email… The ob_* functions are mainly used for caching in php, and we can make use of it.

<?php

ob_start();
include_once(’Page.html’);
$__buffer = ob_get_contents();
ob_end_clean();

mail($__to_email, ‘Subject’, $__buffer, $__headers);
?>

The ob_start() function will turn output buffering on. While output buffering is active no output is sent from the script. The output is stored in an internal buffer.

We included an html page, since we turned output buffering on with ob_start()  at the beginning, no output is sent. The content of Page.html is stored an internal buffer. The contents of this internal buffer can be copied into an variable using ob_get_contents() To output what is stored in the internal buffer, we use ob_end_flush().

Next we use php’s mail function to send this content from internal buffe, to an email address $__to_email.

Dec 4
How to Track Down Anyone Online
icon1 Dipesh Nyachhyon | icon2 External | icon4 12 4th, 2007| icon3No Comments »

When you’re trying to find someone online, Google’s not the only game in town. In the last two years, a handful of new people search engines have come onto the scene that offer better ways to pinpoint people info by name, handle, location, or place of employment. While there’s still no killer, one-stop people search, there are more ways than ever to track down a long-lost friend, stalk an ex, or screen a potential date or employee. The next time you wonder, “What ever happened to so-and-so?” you’ve got a few power people search tools to turn to.

- Lifehacker.com

Dec 4
Best of CSS Design 2007
icon1 Dipesh Nyachhyon | icon2 External | icon4 12 4th, 2007| icon3No Comments »

http://www.webdesignerwall.com/trends/best-of-css-design-2007/

« Previous Entries