Friday 27 May 2011

Resolving Dependencies

Nokogiri:
  
libxml and libxslt

sudo apt-get install libxslt-dev libxml2-dev


Thursday 26 May 2011

Custom helpers in Rails

Ever thought of organizing your code in more than one files , rather writing all in one place.
Sometime, you want a method accessible to all your controller. Solutions to this is:
1) ApplicationController
2)Copy the same methods in each controller specific helper file i.e REPEAT YOURSELF, which go against the rails philosophy of DRY( Do Not Repeat Yourself)
3) Custom Helpers

Wednesday 18 May 2011

Run your script on system startup

Sometime you want to auto mount your window partitions on your linux machine or sometime you find need to clean clear or purge your database/inbox or sometime you might want to run your own custom script. Reasons are many and so are the solutions.

1) use cron jobs
2) use linux run level file

Sunday 15 May 2011

Learn three linux command a day

aah, here's a nice trick that'll randomly gives you three command for you to explore.

Trick make use of  linux `shuf' and `ls' command.


sahilsk@dragonaider:~$ ls /usr/bin/  | shuf -n 3
pgmnoise
evolution-settings
infokey

Libraries i like most

Here's is a list of my favourite libraries i use in most of my projects
#cURL family
                         :libcURL/curlcpp/php-curl
#ImageMagick              
                         :  :php imagick, ror:rmagick,cpp:imageMagick

auto mount ntfs drives

To mount ntfs partition on your linux operating evertime your OS boot up:
#automount.sh

#!/bin/bash




#Mount HDD
#create associative array  NOTE:SUPPORTED BY BASH >4.1 .
declare -A disks
disks=(["sda2"]="driveOne" ["sda5"]="driveTwo" ["sda6"]="driveThree")

Stopping Daemons

On my ubuntu server, i've many daemons and server running in the background and everytime i boot my desktop, they bootstrap on there own and start consuming cpu resources.
So, i wrote a script to stop all those server on system boot.


Permission denied error while executing c/c++ code compiled with gcc

Out of many reasons here are those which i faced

Not enough permission
solution:
$ chmod +x yourFileName
or
$chmod 777 yourFileName


little on bash scripting

Linux Bash Scripting


Simple Array
_________________________________________
$ name=("chantu"  "bhantu"  "santa"  Bhanta)
OR
$ name=(chantu bhantu santa bhanta)
_________________________________________

Iterating over an Simple Array