Monday, May 5, 2008

Monitor resolution test using perl

dccmd.exe is a tool which gives all supported resolutions of a monitor.
Download Location:
http://www.softpedia.com/get/System/OS-Enhancements/ResChange.shtml

If somebody wants to write a script to test
the graphics or resolutions supported by the Monitor
we can write a basic perl script as below:

#!c:\Perl\bin\perl.exe
#use Strict;
#use warnings;

# Find all posible resolutions supported by the used monitor
# And capture the command output.
open(SYSCMD, "dccmd -listmodes |");

while()
{
if(/(\d+)[\s+](.*)$/)
{
chomp;
push(@X_Cord, $1);
}
if(/[\s+](\d+)(\s+)(.*)$/)
{
chomp;
push(@Y_Cord, $1);

}
if(/[\s+](\d+)(\s+)(\d+)$/)
{
chomp;
push(@depth, $1);

}
if(/[\s+](\d+)$/)
{
chomp;
push(@refresh, $1);

}

}
close(SYSCMD);

# Put all supported resolutions in arrays
# And count any one arrays length.

$Count = @X_Cord;

# Use dccmd tool to run any utility of test
# in all posible resolutions
# For example I am running
# a movie using media player classic
# Once the movie will be over in one particular resolution,
# it will come back to original resolution
# and again go back to next resolution
# and run the movie again

for ($i=0; $i <= $Count; $i++)
{
`dccmd -force -width=$X_Cord[$i] -height=$Y_Cord[$i] -depth=$depth[$i] -refresh=$refresh[$i] mplayerc.exe /play pursuit_of_happiness.avi /close /fullscreen`;
}

Wednesday, July 11, 2007

How to mount a USB drive if its not auto mounted in Linux

1. cat /proc/partitions - find the partition of your USB stick
( Check for all entries with USB drive connected and without USB drive connected, and the diff is the name of USB partition)
2. make a mount point (perhaps in /media) to which you will mount the USB stick
3. for user accessibility, edit your /etc/fstab file
4. mount the usb stick

Most of the time, when you plug in a USB stick or card reader (with a card in it), SUSE Linux will just pop open a window asking you if you want to see the contents of the device. However, in cases where that does not happen, or you are using a distribution that doesn’t do that, this trick should work.




Monday, July 2, 2007

Change the IP permanently..in linux

# cd /etc/sysconfig/network-scripts

# ls -l will give the listing of files as per the no of ethernet cards installed

suppose you want to change the IP of eth0.
The concerned file will be "ifcfg-eth0"

So edit the file and change the IP as per requirement and save and exit.