Tuesday, August 26, 2008

How to unzip a RPM file and a bz2 file on unix/linux

You may use
1. Unzip RPM file
$ rpm2cpio myrpmfile.rpm | cpio -idmv

for detailed explaination look at
http://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html

2. for a bz2 file

$ bunzip2 filename.txt.bz2

To compress a file using bzip2, execute the following command:

$ bzip2 filename.txt

for more details you may visit
http://www.debianadmin.com/create-and-extract-bz2-and-gz-files.html

cheers
Vaibhav

Zipping and Unzipping Files in UNIX

taken from http://www.hostingmanual.net/other/zip.shtml

There are several methods of archiving files and retrieving archives. We recommend using the "zip" function to compress your files for its ease of use and portability. (Files zipped in Unix can be extracted using WinZip or PKunzip in Windows). We have provided various "unzip" methods. The "right" unzip method depends upon the method used to zip the file. You can tell the zip method by the file extension (e.g., .zip, .tar, .gz, etc.)


Zipping Files Using ZIP

This Unix program is compatible with the zip program for DOS and Windows. To zip files, first have the files uploaded to your server, then log into your account with Telnet. Navigate to the directory where the files are that you want to zip (for instance by typing cd www then cd sounds to move to your /www/sounds directory). Then type:

zip myzip file1 file2 file3

This puts the files named file1, file2, and file3 into a new zip archive called myzip.zip.


Unzipping Files

Please note that the unzip method you use is defined by the filename you are trying to unzip. For example, if you are trying to unzip a file called file.tar - you would use the method described in "tar". Files ending in .gzip or .gz need to be extracted with the method described in "gunzip".


Zip

If you have an archive named myzip.zip and want to get back the files, you would type:

unzip myzip.zip

Typing zip or unzip by itself will give you a usage summary, showing nearly all the options available.


Tar

To extract a file compressed with tar (e.g., filename.tar), type the following command from your telnet prompt:

tar xvf filename.tar

Basically, this command means that you will see the file "explode", so don't worry when you see your screen scrolling wildly. It also means that you will see any errors in the archive.


Gunzip

To extract a file compressed with gunzip, type the following:

gunzip filename_tar.gz

then if you receive no errors, type:

tar xvf filename_tar

Monday, August 18, 2008

adding a persistent route to windows server 2003

You may use the following command on your cmd prompt to add a persistent route to windows server 2003.

C:\Route add -p network [network address] mask [subnet mask] [gateway] metric [value]

for help on this command type
C:\ route ADD

to print all added routes type in

C:\route print

hope it helps.

vaibhav chugh

Sunday, July 20, 2008

RadioButtons in gridview. Select one at a time

Hi,

This is another problem I just solved. I found all possible stuff on the internet and no one had solved it in an easier fashion. Though people might call it JUGAD Tech but I must say what I have made just worked for me.

The problem with using radio buttons in a gridview is that even if u use the groupname property of the radio button it will select multiple radio buttons.

So what i did is
1. To the column tag of the gridview add the following code



2. make this function in your .CS file
protected void uncheckOthers(object sender, EventArgs e)
{

int count = GridView1.Rows.Count;
for (int i = 0; i < count; i++)
{
RadioButton rb = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("selectItem");
rb.Checked = false;
}
RadioButton test=(RadioButton)sender;
test.Checked = true;

}

Isn't it easy..


Cheers!!!
Vaibhav

Wednesday, July 16, 2008

Fetching data into a variable from SqlDataSource in Asp.NET with C#

After my struggle of 3 hours I finally got it working. I thought it would be easy but MSDN was of no help at all and the web is full of all the stupid stuff but not the correct information. People just put in the concept and nobody even bothers to write down the steps to fetch the data after the execution of query.

Here is the code I made with the help of a post on some discussion forum. The title of the topic i read was "Getting Variable value out of a SqlDataSource in asp 2.0".

Following is the automatically generated markup when you configure the sqldatasource from the data tab.



Then to you onclick function just add the following lines:

protected bool CustomerAuthenticate(string username, string password)
{

DataView dv = ((System.Data.DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)));

TextBox1.Text=dv.Table.Rows[0]["password"].ToString();


//check and return
}


I hope it will help

Saturday, July 12, 2008

Master Pages and Themes in .NET

following are a few nice links for master pages and themes that can be used in .NET. I will be using them for my final project for my Internet Programming course.

http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx
http://www.simple-talk.com/dotnet/asp.net/beginning-asp.net-2.0/
http://msdn.microsoft.com/en-us/magazine/cc163967.aspx
http://www.odetocode.com/articles/450.aspx
http://www.west-wind.com/WebLog/posts/4899.aspx

Special thanks to Dr. Fawcett.


Vaibhav

Wednesday, June 11, 2008

mounting and unmounting pendrive

This is for Damani Sir,

To mount a pendrive on ur freeBSD running on VMWARE SERVER or WORKSTATION. just plug in ur pendrive when vmware screen is in focus. It will show you some device information.
In case you dont see the device information coming up. go to
VM tab on the top of your screen > choose Detachable devices > and from the list choose the pendrive.
After doing the above
write
#cd /mnt
#mkdir pendrive
#mount -t msdos /dev/da0s1/ /mnt/pendrive/

and your pendrive is ready to use,

to unmount

#cd /mnt/pendrive
#sync
#cd ..
#umount /mnt/pendrive/


and u r all set to go...

ciao
vaibhav