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

Saturday, April 26, 2008

A simple C program for writing to a file

Source:http://www.mycplus.com/cplus.asp?CID=8

#include "stdio.h"
main( )
{
FILE *fp;
char stuff[25];
int index;
fp = fopen("TENLINES.TXT","w"); /* open for writing */
strcpy(stuff,"This is an example line.");
for (index = 1; index <= 10; index++)
fprintf(fp,"%s Line number %d\n", stuff, index);
fclose(fp); /* close the file before ending program */
}

Wednesday, April 9, 2008

B+ Tree Tutorial links.

For my DBMS course I studied the B+ tree implementation. I came across a few nice links.. I enjoyed reading the stuff and things were made pretty clear by the following links...This might be of some help to you as well..

http://www.scribd.com/doc/18211/B-TREE-TUTORIAL-PPT

http://www.seanster.com/BplusTree/BplusTree.html

http://www.ceng.metu.edu.tr/~karagoz/ceng302/302-B+tree-ind-hash.pdf



Take Care
Vaibhav

Monday, March 10, 2008

Process Memory Layout

Just came across a nice link that describes the memory layout of a running process.
It explains & covers

-stack layout
-heap layout
-Executable code
-static data
-Virtual Address Space Of A Linux Process with an example


http://dsrg.mff.cuni.cz/~ceres/sch/osy/text/ch03s02s01.php

Thanks to Christian Sarmoria for the link..

Sunday, March 2, 2008

Difference between MUTEX and SEMAPHORE

Source: http://koti.mbnet.fi/niclasw/MutexSemaphore.html

Mutex vs. Semaphore, what is the difference?
The Toilet Example (c) Copyright 2005, Niclas Winquist ;)

Mutex:

Is a key to a toilet. One person can have the key - occupy the toilet - at the time. When finished, the person gives (frees) the key to the next person in the queue.

Officially: "Mutexes are typically used to serialise access to a section of re-entrant code that cannot be executed concurrently by more than one thread. A mutex object only allows one thread into a controlled section, forcing other threads which attempt to gain access to that section to wait until the first thread has exited from that section."
Ref: Symbian Developer Library

(A mutex is really a semaphore with value 1.)

Semaphore:

Is the number of free identical toilet keys. Example, say we have four toilets with identical locks and keys. The semaphore count - the count of keys - is set to 4 at beginning (all four toilets are free), then the count value is decremented as people are coming in. If all toilets are full, ie. there are no free keys left, the semaphore count is 0. Now, when eq. one person leaves the toilet, semaphore is increased to 1 (one free key), and given to the next person in the queue.

Officially: "A semaphore restricts the number of simultaneous users of a shared resource up to a maximum number. Threads can request access to the resource (decrementing the semaphore), and can signal that they have finished using the resource (incrementing the semaphore)."
Ref: Symbian Developer Library
http://geekswithblogs.net/shahed/archive/2006/06/09/81268.aspx