Pages

Your Ad Here

This Blog is not to read or go through

because, I have never been such a mess


Search the blog instead

Wednesday, August 19, 2009

codeigniter tweak for find_in_set

It was really really frustrating when i could not find any good function in the Codeigniter Active Record Class for FIND_IN_SET type queries.

So, i just buit this.


$set = implode(',',$where);
$this->db->where('1 <=', "FIND_IN_SET(`".$field."`,".$this->db->escape($set).")",false);

Where $where is an array of values

And Yest , it works with a miracle now.

Sunday, August 16, 2009

not in the database

select src from (
select "node/1" as src
union select "node/2" as src
union select "node/3" as src
) temp where src not in (select src from drupal_url_alias)

Saturday, July 11, 2009

checking the distro name in linux

$ cat /etc/*-release
or
$ cat /etc/*-version

Thursday, June 25, 2009

ghazal ghuzzle गजल

Ghazal (pronounced "ghuzzle") is an Arabic word that means "talking to women."

Tuesday, June 9, 2009

Email validation in php

eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)

Wednesday, May 6, 2009

low level formatting in linux

Source: http://tldp.org/LDP/LGNET/issue37/tag/38.html


dd if=/dev/zero of=/dev/hda
... to wipe out the whole first IDE drive, or
dd if=/dev/zero of=/dev/sda
... to wipe out the whole first SCSI drive.
Actually you could just blow away one sector on these drives using
dd if=/dev/zero of=/dev/sda count=1
It wouldn't make sense to do this to other drives (/dev/hdb, /dev/hdc, /dev/sdb, etc) since their boot sectors aren't referenced as code and you can reformat those drives with normal DOS or Linux commands to re-make your filesystems on them. However, you can issue this command for all of your drives if you like. In fact you should be able to do something like:
for i in a b c d; do
dd if=/dev/zero of=/dev/hd$i
done
... to get four IDE drives or
for i in a b c d e f g ; do
dd if=/dev/zero of=/dev/hd$i
done
... to wipe out all seven disks on a SCSI chain.
(?)
Your Ad Here