I'm Davinder

A drupal developer and a linux geek from India, an opensource contributor, a debugger in opensource softwares , web developer and currently working in TCS.

Recent Blogs

Generate dummy content in drupal via drush

Prerequisite :

1. Installed drupal.
2. Installed drush.
3. Having internet connectivity

How to generate content:
Go to drupal root folder

 cd /var/www/drupal7 

Download devel module

 drush dl devel -y 

Enable devel module

 drush en devel -y

Enable devel generate module

 drush en devel_generate -y

Create 20 dummy nodes

drush genc 20 

Create 10 nodes and 20 comments

 drush genc 10 20

Create 30 new nodes and deleting old ones

Move all files except some files or folder

mv /var/www/!(drupal7|drupal8) /var/www_bkp/ 

It will move all the content of /var/www into /var/www_bkp except drupal7 and drupal8 folders.

If you want to try the same for some specific files try this:

 mv /var/www/!(a.txt|b.txt) /var/www_bkp 

will move alll the files of /var/www into /var/www_bkp except a.txt and b.txt.

Delete files older then n days

Unix Command for delete files and folder older than 10 days:

 find directory_name -mtime +10 -exec rm -f {} \; 

Move files and folders older than 10 days in tmp folder.

 find directory_name -mtime +10 -exec mv {} tmp \; 

Install asciidoc on ubuntu

How to install asciidoc on ubuntu
1. Go to terminal by ctrl+alt+t in ubuntu
2. Download asciidoc from here.
3. tar -xzf asciidoc-8.6.9.tar.gz
4. cd asciidoc-8.6.9
5. ./configure
6. sudo make install
7. sudo make doc

To uninstall
sudo make uninstall

Install drush on shared hosting

How to install drush on shared hosting :

1. Go to your server like

 ssh username@hostname.com

2. Go to your home folder by typing

 cd ~ 

3. Type this

 wget https://github.com/drush-ops/drush/archive/6.x.zip  

(I have not used drush 7 because it needs composer, so i was unable to install composer on shared hosting, if you help me in that i can buy a coffee for you)
4. Edit .bashrc file in your favorite editor may be nano, vi or vim.
5. Look for

How to install Aptana Studio 3 in ubuntu

1. Download Aptana from aptana.com
2. Unzip the folder
3. Go to aptana folder in terminal.
cd Aptana_Studio_3
4. Now run this
export UBUNTU_MENUPROXY=0
5. At last run this
./AptanaStudio3
6. Choose your workspace.
Its done.

How to remove ^M at the end of every line

Hi, today i just gone through a serious problem between windows and unix.

Problem description:

Whenever i move file from windows to UNIX with winscp. Every line got ^M at the end in every file.

Solution:

I opened that file in vi and done this

:%s/^M//g 
 Where ^ is (Control V) and M is (Control M).
It will remove all the trailing ^M at the end of every line.

Git in 2 days(Git Cheat Sheet)

First of all, i m very sorry for not updating my blog for a long time. I was very busy in office stuff, finally now am back with more concentration and Power.
Here I m sharing some commands for my new girlfriend GIT. i hope you like, if yes then don't forget to comment below.
If you know all this, may be its time to revise again.

git clone https://github.com/user/git.git

// to clone a existing repository

How to activate root login in ubuntu

sudo -i
sudo passwd root

//setting password for root login

sudo passwd -dl root

// to deactivate root login
That's it.

How to Create Clickable(linked) index in openoffice

Do not:- 1. Make headings manually by bolding and increasing its size.
2. Don't use enter button again and again to go to next page.
Do's:-
1. For making headings write the text and then select that text, press f11 Select whatever heading you want to make heading1, heading2 etc.
2. For going to next page press ctl+Enter.
Making Documents in Openoffice:-
1. Enter Text whatever you want to write.
2. Make proper headings, title and subtitle etc.

Enable Clean Url in Drupal on Linux

1. Go to Terminal and type following commands

sudo a2enmod rewrite
sudo vi /etc/apache2/sites-enabled/default

If second command didn't work or it open a new file then try following command

sudo vi /etc/apache2/sites-enabled/000-default

2. Change (line 7 and line 11), "AllowOverride None" to "AllowOverride All".
Save and exit.
3. Restart Apache by following command.

sudo /etc/init.d/apache2 restart

Important HTML Tags

I was going through the html course in W3schools then
I find some important tags which i had never used in html, so
here are these tags :
<small>
<del> // delete with line
<ins> // insert in stead of delete
<mark> // gives color to text
<cite> // Title of the work
<q> // Short Quotation
<map> // tag is used to define a client-side image-map.
An image-map is an image with clickable areas.
<fieldset>

11.10 Modem Disconnected, You are offline Now.

Yesterday i upgraded my ubuntu 11.04 to 11.10.
Everything gone great but after restart, my modem was not able to connect
with the system.
Error was "Modem Disconnected, you are offline now."
I resolved this issue with following steps

How to install JDK in ubuntu

Step 1: Open Applicaction>> Accessories>> Terminal

Step 2: Type commandline as below...

sudo apt-get install openjdk-6-jdk

Difference Between apt-get update and apt-get Upgrade

  • apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.
  • apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed. This is why you first want to update.
  • You should first run update, then upgrade. Neither of them automatically runs the other.

    Shortcuts of facebook in Google Chrome

    1. To create new message:

     Alt+m 

    2. To view Help Center

     Alt+0 

    3. To visit the home page:

     Alt+1 

    4. To visit the Profile Page

     Alt+2 

    5. To Manage Friend List

     Alt+3 

    6. To view message list

     Alt+4 

    7. To view the notification page

     Alt+5 

    8. To view the account settings

     Alt+6 

    9. To view privacy settings

     Alt+7 

    10. To view the Facebook fan page

     Alt+8 

    Install drupal with DRUSH(Drupal Shell)

    This tutorial is tested on ubuntu(Linux) for installing drupal with drush.
    Requirements:
    1. LAMP
    2. DRUSH(sudo apt-get install drush)
    3. Write access to www folder
    4. Mysql username, password, database name.
    Installation

     drush dl drupal-7.xx

    I used drupal-7.22

    drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase

    Enjoy Drupal Development.

    Training @Tata Consultancy Services[ILP]

    ILP(Initial Learning Program) Experience

    This was the first time when i was called for training in one of the largest IT company of India TCS, in beautiful city named as Ahmadabad.
    We were tagged with a stream named as BIPM(Business Intelligence & Performance Management).
    We were groomed in two different ways, one was technically and other was personally.

    Some Drupal Rules

    As i am working in SRIJAN technologies from past 11 months, which is a drupal development company. I learned some rules regarding drupal in this span of time, which are listed below :

    Vi Magics

    I was working with coder of drupal from past 3 days and had removed 7000 errors from a particular module. But i have done it with VI-Editor by following Commands.

    1.For Removing all leading spaces

    :1,$s/^\s*//gc
    

    I have used gc so that it will confirm for every instance on every line.
    2. Make an indentation of 2 spaces for every line starting.

    :%s!^!  !
    

    3. Replacing

    ,

    with

    , 
     :%s/,/, /gc
    

    4. For deleting all trialing spaces at the end of line

    :%s/ \+$//c
    

    Wrong permissions on configuration file, should not be world writable!

    If you install phpMyAdmin on your web host and all you see when you access www.yoursite.com/phpmyadmin (or whatever) is “Wrong permissions on configuration file, should not be world writable!” you are supposed to just change the permissions of /phpmyadmin/config.inc.php to not be world writable (i.e. chmod 755 config.inc.php, or by using your FTP client).

    sudo: /etc/sudoers is mode 0777, should be 0440 Solved Problem

    Today I was getting a Problem in ubuntu that is

    sudo: /etc/sudoers is mode 0777, should be 0440
    sudo: no valid sudoers sources found, quitting
    

    I solved it in following way :-
    I have put Ubuntu onto a LiveCD, boot into the LiveCD, mounted my Ubuntu Partition on the Hard Drive (Open a file browser, like Nautilus, and click your Ubuntu Partition; or click Places->"xxGB Partition/Your Ubuntu Partition").

    Then, opened a terminal within the LiveCD session and type these two commands:

    cd /media//etc
    sudo chmod 0440 sudoers
    Thats it :)

    Alpha Pager for User_listing

    In this tutorial, i will telll you how to add A-Z alphabetical searchable users with the help of views
    This tutorial is just for drupal 6.x
    The Steps for this tutorials are as follows :-

    1. First, create a new page view and set your path to “directory”
    Assuming you want your pager to be based on the nodes title, add in an argument: “Node: Title”
    Set title equal to: “Directory: %1”
    Action to take if argument is not present: “Display all values”
    Check “Glossary Mode”
    Set character limit to “1”
    Case: “upper case”
    Case in path: “lower case”
    Save and update

    Install Redmine on Ubuntu

    Install redmine on ubuntu

    sudo add-apt-repository ppa:ondrej/redmine
    
    sudo apt-get update
    
    sudo apt-get install redmine redmine-mysql
     
    

    Then, create this for /etc/init/redmine.conf
    Paste the following code in it .

    
    # Redmine
    
    description  "Redmine" 
    
    start on runlevel [2345]
    stop on runlevel [!2345]
    
    expect daemon
    exec ruby /usr/share/redmine/script/server webrick -e production -b 0.0.0.0 -d
    
    
    sudo service redmine start
    

    Then Click Here
    You can stop it via

    sudo service redmine stop
    

    Journey up-to Srijan Technology

    In this blog i am sharing some of my past experience of life, in which i have faced many problems.

    Vi With tricks

    Hello
    All, i am using vi editor in ubuntu with some hidden tricks. Following is the trick to cut from one existing file and paste into a new file:
    1. Open the file you want to cut from.
    2. Press m a for marking text or it will start marking the text from current position.
    3. Move down upto which you want to cut the text
    and use " a d ' a where a for storing all marked text in buffer in a and d for deleting it.
    4. Now create the file with :e and type there "a p where a is again stored buffer and p for putting values.

    Escape from html via CSS

    Hello Everyone!
    I am currently working on drupal.
    I have noticed that most of the developers like me is doing some stupid mistakes, we are using every html coding in body of drupal page, block, panel, webform any many other features by drupal. So if you are a real programmer then your working way should be like as follow.
    1. If you are using an h1 and h2 heading tags, please don't save it as full html, save it as filtered html.
    2. Then do its css in css file by using class, id. Or in following way

      h2 {
      text-align:float;
      font-size: 16px;
         }
    

    Low space in boot ubntu

    Every time Ubuntu installs a new Linux kernel, the old one is left behind. This means that if you are regularly updating an Ubuntu system the Grub boot menu becomes longer and longer with kernels you don’t need anymore.

    The old kernels are deliberately left installed and on the menu so you can boot a previous kernel if you have trouble with a new one.
    Steps:-
    1.Open the terminal and type there

    uname -r
    

    It will print the version of the Linux kernel you are running, this is the one you want to keep. It should look something like this:

    2.6.38-12-generic
    

    Mapping Parties

    Here is our news regarding openstreetmap.
    These are the free editable maps means everyone can edit it, modify it and can upload it on internet. Moreover if you want to use it as commercial usage or some business it requires no charges due to its GPL licensing. But in case of other maps you have to pay for commercial or business usage.
    Here is our photo in TIMES OF INDIA.

    Install Myreview on Ubuntu

    Apply following command in terminal

     sudo -s
     cd /var/www
     wget http://202.164.53.122/~davinder/myreview-1.9.9.tgz
     tar zxf myreview-1.9.9.tgz 
     mv myreview lqq
     chown -R www-data:www-data lqq
     cd lqq
     cp  DBInfo.php.sample DBInfo.php
     vim CreateDB.sql
    

    Add following lines to it

    CREATE DATABASE lvqq;
    GRANT ALL PRIVILEGES ON lvqq.* TO lvqqAdmin@localhost
    IDENTIFIED BY 'lvqqadmin';
    GRANT select ON lvqq.* TO SQLUser@localhost IDENTIFIED BY 'pwdSQL';
    //lvqqAdmin is the database user,lvqqadmin is the password.
    
    vim DBInfo.php
    

    How to open .rpm files

    You need alien to convert .rpm to .deb.

    1.) sudo apt-get install alien
    2.) sudo alien name_o_file.rpm
    

    This will convert your RPM to a DEB and then you can install the deb with:

    3.) sudo dpkg -i name_o_file.deb
    

    CHEERS
    davinder kumar

    failed to open dir: Permission denied in file_scan_directory()

    Don't get panic from this problem
    Just go to your drupal folder by

    cd /var/www/drupal
    

    chnage the permission of module directory
    it works for me.
    THANKS.

    Increase upload file size in phpmyadmin

    Increase upload file size in phpmyadmin
    1.Become root by

    $ sudo -s
    

    2.Edit /etc/php5/apache2/php.ini by following command

    $ vim /etc/apache2/php.ini
    

    3.Now change the following in this file as
    Completed example, to increase 10Mb
    upload_max_filesize = 10M ;
    post_max_size = 20M ;
    memory_limit = 128M

    4.Close the file.

    5.Restart apache by following command

    $ sudo /etc/init.d/apache2 restart
    

    6.Thats it your uploading or importing file size is increased upto 10mb.
    Cheers.

    Author

    How to install LAMP in ubuntu

    Type the following commands in terminal of ubuntu:-

    #sudo apt-get install apache2
    #sudo apt-get install php5 libapache2-mod-php5
    #sudo apt-get install mysql-server mysql-server
    #sudo apt-get install phpmyadmin
    #sudo apt-get install libapache2-mod-auth-mysql php5-mysql
    #sudo /etc/init.d/apache2 restart
    

    set password according to your choose
    and check on broswer

    http//:localhost
    http//:localhost/phpmyadmin

    How to uninstall LAMP in ubuntu

    Remove phpMyAdmin:-

    sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin
    

    You'll be presented with a screen asking if you want to deconfigure the database for phpMyAdmin.
    Go ahead and select Yes and hit .
    You'll be asked next if you want to purge the database for phpMyAdmin.Again, select Yes and hit .

    How to install Libredwg in ubuntu

    GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the OpenDWG libraries. DWG is the native file format of AutoCAD.

    GNU LibreDWG is based on LibDWG, originally written by Felipe Castro.
    For installing libredwg copy paste the following command
    in terminal of ubuntu.

    
    git clone git://git.sv.gnu.org/libredwg.git
    sudo apt-get install gcc
    sudo apt-get install autoconf
    sudo apt-get install libtool
    sudo apt-get install swig
    sudo apt-get install swig.-doc 
    sudo apt-get install swig.
    sudo apt-get install python-dev
    

    How to use category in Media-Wiki

    How to use categories in media-wiki

    This is the very special article related to the use of categories in the media-wiki.By doing this your name or any special note will be in that category whatever you want.Here is one tutorial for doing this.Lets go through the tutorial.
    1.Let us suppose you are a user in

  • Openstreetmap wiki page
  • .
    2.LOGIN into above given link.Let us suppose you want to display your name in category USERS in INDIA.For this you have to follow below given functions.

    Drupal 7.0 Easy Installation

    Here is the script for installing the drupal 7.0
    The things you have to do
    1.Become root by sudo -s

    2.Run the following commands

    Or you can download the script

    wget http://ftp.drupal.org/files/projects/drupal-7.0.tar.gz
    
    tar -zxvf drupal-7.0.tar.gz
     
    chmod 777 -R /var/www
    
    mkdir /var/www/drupal1
    
    mv drupal-7.0/* drupal-7.0/.htaccess /var/www/drupal1/
    
    mkdir /var/www/drupal1/sites/default/files
    
    chown www-data:www-data /var/www/drupal1/sites/default/files/
    
    cp /var/www/drupal1/sites/default/default.settings.php
     /var/www/drupal1/sites/default/settings.php
    
    

    How to Run a LUG(Linux User Group)

    If there was one thing Linux Format magazine learned from the Readers' Round Table event it organised, it was that us Linux folk like to get out and have a good chat.
    Over the several hours we were all together, we covered dozens of subjects, and the conversation was lively and opinionated. And that was with only nine of us.
    Imagine what such a meeting could be like if there were more attendees, more of a schedule and a little better organisation?

    Easy Install Django-CMS

    This guide was tested on Ubuntu 10.10 and might work on other Debian based Linux flavors. For Mac OS X, Windows or other Linux distributions.

    Open a shell and run the following commands, substitute 'mycmsproject' with the desired project name:

    sudo aptitude install python2.6 python-setuptools python-imaging
    
    sudo easy_install pip
    
    sudo pip install django django-cms south django-appmedia
    django-admin.py startproject mycmsproject
    
    cd mycmsproject
    
    rm settings.py
    
    rm urls.py
    
    wget https://gist.github.com/raw/776313/settings.py
    
    

    Gmail keyboard shortcuts



    Activating Gmail’s Keyboard Shortcuts
    Before these shortcuts can be used you have to make sure that the Keyboard Shortcuts Setting for Gmail is set to “on” in Gmail Settings as shown here:

    Gmail Shortcuts

    SU AND ROOT ( the difference )

    SU AND ROOT ( the difference )

    There have been questions , what is the difference between “su” and “root” . . well, the difference is minimal but still very important.

    As you login as “root” right from booting the system, all the privileges are set to root, what makes your system more vulnerable to your own mistakes and those wishing to enter your system.

    Add permissions to /var/www in ubuntu

    Add permissions to /var/www in ubuntu
    Hey Folks,

    You might be having troubles adding files and folders to the /var/www folder of Ubuntu installation. Sometimes various other folders also require root permission to perform some action on it. So in that case you can use the following command.

    
    gksudo nautilus
    

    How to Recover a Lost MySQL Password

    If you are using mysql on Debian / Ubuntu Linux then use following command:

    sudo /etc/init.d/mysql stop
    
    sudo /usr/bin/mysqld_safe --skip-grant-tables &
    
    mysql -u root mysql
    
    UPDATE user SET password=PASSWORD('your_password') WHERE user = 'root';
    
    FLUSH PRIVILEGES;
    
    quit;
    
    sudo pkill mysql_safe (or kill -9 pid)
    
    sudo /etc/init.d/mysql restart

    OSS CAMP IN OUR GNDEC

    An OSS(Open Source Softwares) Awareness Camp was organised by me and my team named
    LUGL(Linux User Group Ludhiana) at Guru Nanak Dev Engineering College on Feb.12,2011 where the students were made aware about the various Open Source Technologies.

    20 reasons you should switch to linux

    There are hundreds of compelling reasons why Linux is better than all the rival operating systems. Here are just 20.

    1. Linux is free

    No matter how many computers you install it on, the cost of Linux remains the same: zero.
    In these days of multi-computer households, this can be a massive saving, especially when you consider the cost of all the programs you have to add to a standard Windows installation.

    2. Software repositories

    Having all the software you need in one place saves you having to trawl the web to find the program you're missing.