500 error with rails application running in production via apache2 & passenger

I sometimes face 500 Internal Server Error when running Ruby on Rails application on Apache Passenger but the same application is working fine with webrick server. One of the following reasons are responsible for the issue. 1. Permission Issues Check permission of the files and directories of your project. It should be writeable by the […]

Enum column in Rails

Declare an enum attribute where the values map to integers in the database, but can be queried by name. Example: class User < ActiveRecord::Base enum status: [ :admin, :user, :banned ] end  For migration, write  def up create_table :authorities do |t| t.string ‘value’, :default => ”, :null => false t.integer :status end end  

How to write text on existing image using php

The post below describes an easy and quick way to write text over an existing image using PHP. You can use this method to watermark your images and can put it to use in number of other ways.   First we would have to make the existing image editable to write text on that image. […]

How to Record Audio Files in Android

The android multimedia frameworks performs a remarkable job with recording and playing a variety of media files. By using this scalable framework you can enrich your applications with audio integration. Depending on your device hardware, you can use the MediaRecorder API to record audio stream from mic. Recording of audio is a fairly simple process. […]

Send SMS programmatically in Android

SMS messaging has become an integral part of every mobile phone and for the past decade every mobile device be it a smartphone or a simple mobile phone has come with an sms messaging feature. Understanding how this application works can open new horizons and opportunities for android developers. Today in this article we would […]

How to use PDO-MySQL with PHP

PDO is a PHP extension that allows multiple PHP's database connections by creating a single cohesive interface. It allows code portability and compatibility across various platforms. It can be considered as a database access layer providing a uniform method of access to multiple databases. By using PDO you can switch between different databases and platforms […]

How to use 9-Patch images in Android

Android is remarkable good in supporting various screen sizes, it allows various drawable directories for particular screens and layout configurations using density-independent pixel (dp) instructions. Android also allows using 9 patch images as backgrounds for buttons and application content. In a 9 patch image 4 corners remain unscaled, but the four edges are scaled in […]

PHP PHAR Package

The phar extension is used to put entire PHP applications into a single file called a "phar" (PHP Archive) for easy distribution and installation. It provides the means for distributing code as a single archive, that does not have to be extracted to a folder before usage. In addition to providing this service, the phar […]