Posts

PostgreSql : Most common issues

Installation To install PostgreSQL, run the following command in the command prompt: sudo apt-get install postgresql Test the installation by following command here 8.3 is the version which i am using sudo /etc/init.d/postgresql-8.3 restart Now that we can connect to our PostgreSQL server, Please make sure that you restart the server after making the below mentioned changes, the next step is to set a password for the postgres user. Run the following command at a terminal prompt to connect to the default PostgreSQL template database: sudo -u postgres psql template1 The above command connects to PostgreSQL database template1 as user postgres. Once you connect to the PostgreSQL server, you will be at a SQL prompt. You can run the following SQL command at the psql prompt to configure the password for the user postgres. ALTER USER postgres with encrypted password 'your_password'; Now you can also use the PGADMIN for the GUI with the following mentioned username and password.

Multiple Skype Instance on MAC (Snow Leopard)

Run the following command to open another instance of skype sudo /Applications/Skype.app/Contents/MacOS/Skype

Install ImageMagick on MAC (Snow Leopard)

Install MAC Ports (Download the .dmg file from macports website , install it and restart your system) Then run the following commands. sudo port install tiff -macosx imagemagick +q8 +gs +wmf Install Gem sudo gem install rmagick

Converting One Image Format to Another using Ruby

Insert the following code in your Ruby file. require 'rubygems' require 'RMagick' img = Magick::Image.read("image.png").first img.write("image.jpg") # Writes a JPEG img.write("image.gif") # Writes a GIF img.write("JPG:image") # Writes a JPEG img.write("JPG:image.gif") # Writes a JPEG

Re-Crop Image using Jcrop and Paperclip

For the people who wanted to crop an image twice or wanted to give users an option to re-crop the image without uploading it again. So here it is by the below mentioned code , only the small image will be cropped and you can use large to show the user an option to re-corp without hurting the cropping ratio. So In your model you need to mention : :styles => { :small => "150x150#", :large => "400x400>" }, :processors => [:cropper] And the change which you need to make is : :styles => { :small => {:geometry => "150x150#", :processors => [:cropper]}, :large => {:geometry => "400x400>"} }

Active Admin

Image
Active Admin Documentation Active Admin is a framework for creating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort. An elegant DSL built for developer productivity. Get started with one line of code or customize the entire interface with the provided DSL . # app/admin/posts.rb ActiveAdmin . register Product do # Create sections on the index screen scope :all , :default => true scope :available scope :drafts # Filterable attributes on the index screen filter :title filter :author , :as => :select , :collection => lambda { Product . authors } filter :price filter :created_at # Customize columns displayed on the index screen in the table index do column :title column "Price" , :sortable => :price do | product | numb...

MySQL couldn't find log file on Snow leopard

If you have removed the Binary logs from the file system that exits in the mysql data folder and during the start up an error will occur These is after tailing the error log of mysql. /usr/sbin/mysqld: File './mysql_bin.000025' not found (Errcode: 2) [ERROR] Failed to open log (file './9531_mysql_bin.000025', errno 2) [ERROR] Could not open log file [ERROR] Can't init tc log [ERROR] Aborting InnoDB: Starting shutdown... InnoDB: Shutdown completed; log sequence number 0 2423986213 [Note] /usr/sbin/mysqld: Shutdown complete Basically, MySQL is looking in the mysql-bin.index file and it cannot find the log files that are listed within the index. This will keep MySQL from starting, but the fix is quick and easy. You have two options: Edit the index file You can edit the mysql-bin.index file in a text editor of your choice and remove the references to any logs which don't exist on the filesystem any longer. Once you're done, save the index file and start...