Tuz the new mascot for Linux

By abhishek | Wed, 04/15/2009 - 19:48

Tux the Linux mascot will take a break for a while with the release of Kernel 2.6.29 Tuz would be replacing Tux.

Tuz mascot for 2.6.29

Tuz is a Tasmanian Devil, which is a species in danger of becoming extinct. The Tasmanian Devil is native to Australia and during this year's Linux.Conf.Au conference it was decided that Tuz will stand in for Tux for one kernel release in order to raise awareness for this creature. Tux will return with the release of the Linux 2.6.30 kernel :).

 

Whats in your MBR ??

By abhishek | Wed, 04/15/2009 - 17:39

Master Boot Record or the MBR max to 512 Kb but very essential have you ever looked at what your MBR contains most probably NO!!, so try out the following 2 commands as root and check your MBR Contents

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

This will display your MBR change hda to sda if u have an sda type disk, following is my MBR you might not understand anything from this but a careful look is required to know what is it :)

0000000 48eb d090 bc66 7c00 0000 c08e d88e e689
k H dle P f < nul | nul nul so @ so X ht f
0000020 bf66 0600 0000 b966 0100 0000 a5f3 23ea
f ? nul ack nul nul f 9 nul soh nul nul s % j #
0000040 0006 8000 80fa 057c fa80 7e87 b202 8880
ack nul nul nul z nul | enq nul z bel ~ stx 2 nul bs
0000060 4916 6607 bebf 0007 3100 66f6 04b9 0203
syn I bel f ? > bel nul nul 1 v f 9 eot etx stx
0000100 00ff 2000 0001 0000 0200 90fa f690 80c2
del nul nul sp soh nul nul nul nul stx z dle dle v B nul
0000120 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0
u stx 2 nul j Y | nul nul 1 @ so X so P <
0000140 2000 a0fb 7c40 ff3c 0274 c288 be52 7d7f
nul sp { sp @ | < del t stx bs B R > del }
0000160 34e8 f601 80c2 5474 41b4 aabb cd55 5a13
h 4 soh v B nul t T 4 A ; * U M dc3 Z
0000200 7252 8149 55fb 75aa a043 7c41 c084 0575
R r I soh { U * u C sp A | eot @ u enq
0000220 e183 7401 6637 4c8b be10 7c05 44c6 01ff
etx a soh t 7 f vt L dle > enq | F D del soh
0000240 8b66 441e c77c 1004 c700 0244 0001 8966
f vt rs D | G eot dle nul G D stx soh nul f ht
0000260 085c 44c7 0006 6670 c031 4489 6604 4489
\ bs G D ack nul p f 1 @ ht D eot f ht D
0000300 b40c cd42 7213 bb05 7000 7deb 08b4 13cd
ff 4 B M dc3 r enq ; nul p k } 4 bs M dc3
0000320 0a73 c2f6 0f80 ea84 e900 008d 05be c67c
s nl v B nul si eot j nul i cr nul > enq | F
0000340 ff44 6600 c031 f088 6640 4489 3104 88d2
D del nul f 1 @ bs p @ f ht D eot 1 R bs
0000360 c1ca 02e2 e888 f488 8940 0844 c031 d088
J A b stx bs h bs t @ ht D bs 1 @ bs P
0000400 e8c0 6602 0489 a166 7c44 3166 66d2 34f7
@ h stx f ht eot f ! D | f 1 R f w 4
0000420 5488 660a d231 f766 0474 5488 890b 0c44
bs T nl f 1 R f w t eot bs T vt ht D ff
0000440 443b 7d08 8a3c 0d54 e2c0 8a06 0a4c c1fe
; D bs } < nl T cr @ b ack nl L nl ~ A
0000460 d108 6c8a 5a0c 748a bb0b 7000 c38e db31
bs Q nl l ff Z nl t vt ; nul p so C 1 [
0000500 01b8 cd02 7213 8c2a 8ec3 4806 607c b91e
8 soh stx M dc3 r * ff C so ack H | ` rs 9
0000520 0100 db8e f631 ff31 f3fc 1fa5 ff61 4226
nul soh so [ 1 v 1 del | s % us a del & B
0000540 be7c 7d85 40e8 eb00 be0e 7d8a 38e8 eb00
| > enq } h @ nul k so > nl } h 8 nul k
0000560 be06 7d94 30e8 be00 7d99 2ae8 eb00 47fe
ack > dc4 } h 0 nul > em } h * nul k ~ G
0000600 5552 2042 4700 6f65 006d 6148 6472 4420
R U B sp nul G e o m nul H a r d sp D
0000620 7369 006b 6552 6461 2000 7245 6f72 0072
i s k nul R e a d nul sp E r r o r nul
0000640 01bb b400 cd0e ac10 003c f475 00c3 0000
; soh nul 4 so M dle , < nul u t C nul nul nul
0000660 0000 0000 0000 0000 c6d7 0002 0000 0180
nul nul nul nul nul nul nul nul W F stx nul nul nul nul soh
0000700 0001 fe83 ffff 003f 0000 36a8 01e0 fe00
soh nul etx ~ del del ? nul nul nul ( 6 ` soh nul ~
0000720 ffff fe83 ffff 36e7 01e0 124d 00a0 fe00
del del etx ~ del del g 6 ` soh M dc2 sp nul nul ~
0000740 ffff fe82 ffff 4934 0280 3986 0040 fe00
del del stx ~ del del 4 I nul stx ack 9 @ nul nul ~
0000760 ffff fe05 ffff 82ba 02c0 6207 0690 aa55
del del enq ~ del del : stx @ stx bel b dle ack U *
0001000

G2Image in Drupal using TinyMCE with WYSIWYG API

By abhishek | Tue, 04/14/2009 - 13:03

UPDATE: This post is quite old now and wont work with the latest version of WYSIWYG API, will try to update this soon.

Gallery2 is one of the best galleries available which could be integrated with Drupal easily you would have read my post on integrating it earlier, after you have integrated it the bigger question is how get those images into your content or nodes so this posts answers it, after reading this post you would be able to integrate Gallery2 with your WYSIWYG (TinyMCE) Editor.

Prerequisites

The Steps

  1. Extract G2 Image Application in $DRUPAL_HOME/sites/all/modules/wysiwyg/tinymce/jscripts/tiny_mce/plugins/
  2. Open Gallery Setting in Web Browser from $SITENAME/admin/settings/gallery/g2image and enable G2Image for TimyMCE as shown in the image below
    gallery settings
  3. Once you have selected the Mode as TinyMCE add the following code in %drupal%sites/all/modules/wysiwyg/editors/tinymce.inc (function wysiwyg_tinymce_plugins($editor))

    'G2Image' => array(
            'path' => $editor['library path'] .'/plugins/G2Image',
            'buttons' => array('G2Image' => t('G2Image')),
            'internal' => TRUE,
            'load' => TRUE,
             ),

  4. Now enable G2Image button for TinyMCE from the editor profile at "admin/settings/wysiwyg/profile/edit/2"
  5. Thats it select G2Image button in TinyMCE

    it will popup a Galley as shown below for you to select images and insert them directly in your posts :)

    gallery Pop Up

Indic Touch to Drupal 6

By abhishek | Sat, 04/04/2009 - 15:20

Typing and display of any language other then English is always tough on the Internet to ease this we had various plugins coming in, i had also written a blog for akindic plugin for Drupal 5 last year, but what about the later and better versions of drupal, Gamabhana provides indic typing support but does not works with WYSIWYG API so this blog presents you a solution to type in Indic on Drupal using WYSIWYG API with TinyMCE

Prerequisites

The Steps

  1. Extract the Indic Plugin for TinyMCE in %drupal%sites/all/modules/wysiwyg/tinymce/jscripts/tiny_mce/plugin/indicime
  2. Add the following code in %drupal%sites/all/modules/wysiwyg/editors/tinymce.inc (function wysiwyg_tinymce_plugins($editor))

    'indicime' => array(
            'path' => $editor['library path'] .'/plugins/indicime',
            'buttons' => array('indicime' => t('indicime')),
            'internal' => TRUE,
            'load' => TRUE,
             ),

  3. Enable indicime button for Full HTML input format  from "admin/settings/wysiwyg/profile/edit/2"Adding indicime to TinyMce
  4. Enable rich text editor when creating Full HTML content and select the language from indicime dropbox as shown in the following image
    Adding indicime to TinyMce
  5. बस अब अपनी मन चाही स्थानीय भाषा मे टाइप् करे !

Restoring GRUB after a reinstall

By abhishek | Wed, 03/25/2009 - 11:13

You had just did a weekly install of some OS which did not detected Linux, Follow the steps mentioned below to get GRUB working again. Please note this would erase the current bootloader and install a new one for you if you are unsure of what you are doing do not try this

    1. Boot from a Linux Live CD ( ex ubuntu or knopix, i use Ubuntu)
    2. Open the terminal
    3. Follow the commands mentioned below
    • sudo grub

    if sudo doesnot works switch to root user and use grub drectly, Find the ROOT device you will get the values for X & Y which will be used later.

    • grub> find /boot/grub/stage1

    Set the root device from the information achieved from the above command

    • grub> root (hdX,Y)

    Install GRUB

    • grub> setup (hd0)

    Exit GRUB

    • grub> quit

    Reboot the system without using the live CD you will dind your boot loader back :)

    From http://ubuntuforums.org/showpost.php?p=121355&postcount=5

    User / Group Disk Quotas A three Step Guide

    By abhishek | Fri, 03/20/2009 - 13:32

    A disk quota is a limit set by a system administrator that restricts certain aspects of file system usage on modern operating systems. "Wikipedia"

    Requirements : Quota Package

    Where to get it : Quota package is generally available in majority of Linux Distros but still if your distro doesn't provide you with Quota compile it from http://sourceforge.net/projects/linuxquota/ :)

    Step 1) Installation :

    a) openSUSE : yast -i quota

    b) Ubuntu : sudo apt-get install quota

    c) Fedora : yum install quota

    d) Others : Use rpm or compile if not available

     

    Step 2) Enable Disk Quota

    Disk quota is generally applied on a user or a set of users to its recommended to enable Disk Quota on your Home partition dont enable quota on the root partition unless you are under the expert category

    To enable disk quota in certain partition just add "usrquota,grpquota" to that partition in your fstab you need root privileges to do this of course.

    Following is my sample fstab entry for /home

    /dev/sda9 /home ext3 acl,user_xattr,usrquota,grpquota 1 2

    After you have added the entry in fstab you need to create the aquota.user and aquota.group files in the partition where you have enabled quota /home in our case use the following command in /home directory

    touch aquota.user

    touch aquota.group

    chmod 600 aquota.user

    chmod 600 aquota.group

    Now a reboot is recommended

     

    Step 3) Limiting Users on Quota

    Now its the time to give quota to user/groups using the following command

    edquota -u <username>

    or

    edquota -g<groupname>

    This will open up the configuration file which would look something like this

    Disk quotas for user <user> (uid <uid>)

    Filesystem blocks soft hard inodes soft hard

    /dev/sda9 9215 1048576 1050624 603 0 0

    You would notice soft, hard and inodes in this file i would recommend not to use inode as using this would be limiting user on the number of files to create specify size in KB for soft and hard part soft is actually the limit and after soft limit is reached the user is given a grace on size to a maximum mentioned as hard

    This completes quota :)

    Now how to apply same settings for different users, For instance, to use the same settings for user "nagar" that you set for user "abhishek", you would enter:

    edquota -p abhishek -u nagar

     

    Further Study http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-disk-quotas.html

    SMTP Authentication Support for your Drupal Sites

    By abhishek | Tue, 03/17/2009 - 19:25

    Drupal uses the php mail() function to send emails by default.
     
    Here is a module which adds SMTP functionality to Drupal. More specifically, the ability for your site to send mail using an SMTP server that requires authentication.
     
    Link to Module http://drupal.org/project/smtp
    This module is currently in Beta stage for Drupal 6.x, i just tried it works fine and you can use this too. remember to read INSTALL.txt before installing this module as there are certain dependencies which are needed to have this module working.
     
    This module uses the smtp and mail class’s from PHPMailer. http://phpmailer.sourceforge.net

    How to Masquerade (ICS) in Linux

    By abhishek | Mon, 03/16/2009 - 12:50

    Its very simple to masquerade in linux with few lines of iptables and ip_forward commands.

    Assumptions : Your Linux box has 2 NIC's one connected to internet (eth0) other connected to local network (eth1 IP 192.168.0.10)

    first of all you have to flush and delete existing firewall rules which are there by default in linux .

    so flush rules by typing the following in terminal

    iptables -F
    iptables -t nat -F
    iptables -t mangle -F

    now delete the chains by using

    iptables -X
    iptables -t nat -X
    iptables -t mangle -X

    now its time to save iptables so type

    service iptables save
    service iptables restart

    now all rules and chains will clear !

    check it by /etc/sysconfig/iptables which has all defaults rules set to accept.

    now open /etc/rc.d/rc.local

    and insert the following line

    echo ” 1 “> /proc/sys/net/ipv4/ip_forward

    and then save and close.

    now asuming that your internet interface is eth0 then type :

    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    service iptables save
    service iptables restart

    note:- check your service of iptables is set to start during boot up .

    or check status of your iptables service

    chkconfig -–list iptables

    if level 5 is on then its ok othewise start service at level 5 or level 2345.

    Now Set the Default Gateway of eth1 as eth0's IP Address

    and then set Default Gateways of all other client to Server's eth1's IP address (192.168.0.10) enjoy :)

    Adding CAPTCHA to Drupal Guestbook Module

    By abhishek | Sun, 03/15/2009 - 15:08

    Guest book is one of the essential part for any website, To add a guestbook on your drupal site you can use the guestbook module, the problem you would face is adding a captcha to this now captcha is also very essential to control spam now how to add captcha its very simple just execute the following query

     

    INSERT INTO `captcha_points` ( `form_id` , `module` , `type` ) 
    VALUES
    ( 'guestbook_form_entry_form', NULL , NULL );

    and you are done now go to /admin/user/captcha on your site and enable captcha on guestbook this would look something like this