install pg with native extension error

I was getting trouble to install pg gem. The error i was getting is

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

I also found some tips on SO. It was to locate the postgre’s config (pg_config) to bundler before running `bundle install` command. For general postgresql installation,

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

(path was not same for me on Mac OSx. It was /Library/PostgreSQL/9.1/bin/pg_config)

But this did not solve my problem. I was still getting the same error when i was running bundler. However, when i tried to install the gem separately with this directive set, it worked fine.

gem install pg -- --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config

Now the gem is installed fine and i ran the `bundle install` and it was installed without issues.

Try it!

SSL/OpenSSL issue with Ruby 1.9.3

After upgrading to Ruby 1.9.3x, I was totally unable to use SSL. Even i could not run ‘bundle install’ when i was using ‘https://rubygems.org’ as the source. It was showing a multi-page error messages starting with something like ‘segmentation fault’. For the time being, i’ve used ‘http’ rather than ‘https’ for the rubygems.org url. However, it did not solve other problems.

While googling about it, i found many suggestions and i’ve screwed my OS (Mac OSx) OpenSSL. However, i’ve found a simple solution. It was just two lines of command if you are, like me, using RVM to managing Rubies.

First of all, you need to install openssl package using rvm. So run

$ rvm pkg install openssl

It will install openssl in your rvm path usually .rvm/usr under your home (~) directory.

Now, you need to reinstall your current ruby version (you can also install a newer version if you want) mentioning the path of the OpenSSL.

$ rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr

If you want to install a new version, you should use ‘install’ rather than ‘reinstall’.

That should solve your problem. If not, my sympathy goes for you. Good luck googling!

jQuery Mobile: Part 3 – Modifying default ‘loading’ and ‘error loading page’ messages

In the second part of this series we have learned how to link pages. If you followed them, probably, you’ve also noticed that a ‘loading’ message while you are visiting pages back and forth. jQuery Mobile shows this while it loads the page behind the scene. Well, you may not see this in fast connection or during testing in your computer as it loaded too fast. Similarly, jQuery Mobile shows ‘error loading page’ when it fails to load any page.

In my application, I wanted to change these texts as I wanted them in Bangla.  We were seeing these because they are set by default in the framework. By modifying the default properties, we can change them to something we want.

To do so we will hook into jQuery Mobile’s ‘mobileinit’ event. This event (on document object) is triggered just on the moment jQuery Mobile is started to load. So, we will have to override these before loading jQuery Mobile library.

So far, we have loaded the library files in the following order:

Continue reading →

How I have solved the “The plugin generated xxxx characters of unexpected output during activation” problem

Recently this problem troubled me a lot. All time I try to activate my plugin, I get the following error:

The plugin generated 1186 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

After several attempts of debugging, I failed to understand why it is coming. The mysterious thing was that, this error was not coming for all WordPress installations!

Today, I decided to read the core files those are responsible for activating and/or deactivating the plugins. When I was reading wp-admin/includes/plugin.php, I saw a action hook ‘activated_plugin’ is available just before throwing the error. I believed, if I monitor what is happening here, I can know the reason of the error. So I wrote a small function to save the errors like:

Continue reading →

Solution for “M2M authentication error – password invalid (code: 823)” error in OpenX

If you receive the error “M2M authentication error – password invalid (code: 823)” in your installation of OpenX, you can solve it quite easily.

Suppose, your OpenX is installed at: www.yourdomain.com/adserver/

then call the following link:

www.yourdomain.com/adserver/regenerate-platformhash.php

Once your platform hash is re-generated, you should not see the error message again.

Layout “unijoy” not found – Got this Joomla problem finally fixed

I was suffering from this problem from long time. Just few minutes ago I got the real and effective solution for it. The main solution remains here and here. Recently also came to know that problem remains in Firefox and Flock. It was working fine on IE and Safari. So solution only needs for Firefox and variants.

The solution is simple. Somehow a cookie is created named ‘layout’ and with value ‘unijoy’. You just need to detele it.

Solution: