Monday, December 17, 2007

Top 10 Tips for Linux Users

 Everyone develops their favorite tips and tricks for using Linux based on their own experience and the kind of work they are doing. Here are some of mine. These tips may seem simple, but I've found it's often the simple tricks that are the most useful in day-to-day work.

  1. Switch to another console. Linux lets you use "virtual consoles" to log on to multiple sessions simultaneously, so you can do more than one operation or log on as another user. Logging on to another virtual console is like sitting down and logging in at a different physical terminal, except you are actually at one terminal, switching between login sessions.

    Virtual consoles are especially useful if you aren't running X, but you can use them even if you are.

    In early versions of the kernel (pre-1.1.54), the number of available virtual consoles was compiled into the kernel. With more recent kernels, 63 virtual consoles are available, with 6 set up by default in the file /etc/inittab.

    Use the key combination Alt+Fn to switch between virtual consoles, where Fn is one of the function keys F1-F6. (If you are in X, you'll probably need to use Ctrl-Alt-Fn instead.) Alt+F7 gets you back to your X session, if one is running. You can rotate between consoles with the Alt-right arrow and Alt-left arrow key combinations.

  2. Temporarily use a different shell. Every user account has a shell associated with it. The default Linux shell is bash; a popular alternative is tcsh. The last field of the password table (/etc/passwd) entry for an account contains the login shell information. You can get the information by checking the password table, or you can use the finger command. For example, the command "finger ellen" shows, among other things, that I use /bin/tcsh.

    Related Reading

    Linux in a Nutshell The command chsh changes the login shell for all future logins; that is, it changes the account entry in the password table to reflect the new shell. However, you can also temporarily use another shell at any time by simply running the new shell. For example, if I want to try something out in bash, I can type "bash" at the prompt and be put into a bash shell. Typing either Ctrl-d or exit gets rid of that shell and returns me to my tcsh session.

Print a man page. Here are a few useful tips for viewing or printing manpages:

To print a manpage, run the command:

man <manpage> | col -b | lpr

The col -b command removes any backspace or other characters that would make the printed manpage difficult to read.

Also, if you want to print a manpage that isn't in a standard man directory (i.e., it's in a directory that isn't specified in the MANPATH environment variable), you can specify the full pathname of the manpage, including the full filename:

man /work/myapp/mymanpage.1

If you use the Emacs editor, you can view a manpage with the command Meta-x man; Emacs then prompts you for the name of the manpage. You can view the page or print it as you would any other Emacs buffer.

As a last resort, you can format the manpage directly with the groff command. However, the default output is a PostScript file, so you'll want to either send it to a PostScript printer or to a viewer such as ghostview:

groff -man /work/myapp/mymanpage.1 | ghostview -i

You can get ASCII output with the -a option, but the result is unformatted text. Not pretty to read, but it might suffice if nothing else works.

  1. Use command substitution to simplify complex operations. Command substitution lets you use the output of one command as an input argument to another command. To use command substitution, determine what command will generate the output you want, put that command in backquotes, and use it as an argument to another command. For example, I often use command substitution to recursively grep the files in a directory tree:

    grep 'Title' `find /work -type f -name 'chap*' -print` > chaptitles

    The portion of this command in backquotes is a find command that builds a list of chapter files in the /work directory. That list is then used to provide the set of input files for grep to search for titles. The output is saved in a file called chaptitles.

  2. Look inside a non-text file. Sometimes you really want to see inside a binary file. Maybe there isn't a manpage and you're looking for usage information, or perhaps you're looking for information about who wrote a program or what application a file is associated with.

    The strings command is perfect for that purpose--it searches through a file looking for sequences of printable character strings and writes them to standard output. You can pipe the output through a pager like more, or if you are looking for particular text, you can pipe the output to the grep command.

  3. Use the locate command. Looking for an easier way to find files than the find command? Try using locate. In contrast to find's complexity, locate is the ultimate in simplicity. The command:

    locate <string>

    searches an internal database and prints the pathnames of all files and directories that contain the given string in their names. You can narrow down the search by piping the output to grep. For example, the following finds all files containing the string "kde" that are in bin directories:

    locate kde | grep bin

    The strings don't have to be complete names; they can be partial strings, such as "gno" instead of spelling out "gnome". The -r option lets you use a regular expression (in quotes):

    locate -r 'gno*'

    One thing to be aware of is that locate is case-sensitive: Searching for HOWTO and for howto will give you different results.

    Rather than searching the disk each time, as find does, locate depends on the creation and maintenance of a database. Because it only has to search the database, not the disk, locate is faster than find. On the other hand, the results are only as current as the database.

    The locate database is generally updated daily by a cron job, but you can update it manually by running the command updatedb (usually as root). If you are adding new applications or deleting old files and you don't want to wait for the next day to have an up-to-date database, you might want to run it manually.

  4. Use dmesg to view startup messages. The dmesg command provides an easier way to see the boot messages than trying to read them before they scroll off the screen. When Linux boots, the kernel startup messages are captured in a buffer known as the kernel ring buffer; dmesg prints the contents of that buffer. By default, dmesg prints its output to the screen; you can of course redirect the output to a file:

    % dmesg > bootmsg

  5. Find out what kernel version you are using. Do you ever need to know what version of the Linux kernel is running on your system? You can find out with the uname command, which prints information about the system. Issued with the -r option, uname prints the kernel version:

    % uname -r

    Other uname options provide information such as the machine type, the name of the operating system, and the processor. The --all option prints all the available information.

  6. Use df and du to maintain your disk. Use the df (display filesystem) command to keep an eye on how much space each of your filesystems occupies and how much room is left. It's almost inevitable that if you like to download new software and try it out, you'll eventually fill up your disk. df has some options, but running it without options provides the basic information--the column labeled Use% tells you how full each filesystem is:

    % df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda3 1967156 1797786 67688 96% /

    Oops, time to clean house... and that's where du (disk usage) comes in handy. The du command provides the information you need to find the big space users, by printing the amount of disk space used for each file, subdirectory, and directory. You can specify the directory du is to start in, or let it default to the current directory.

    If you don't want to run du recursively through subdirectories, use the -s option to summarize. In that case, you need to specify all the directories you are interested in on the command line. For example:

    % du -s /usr/X11R6
    142264 /usr/X11R6

    % du -s /usr/X11R6/*
    34490 /usr/X11R6/bin
    1 /usr/X11R6/doc
    3354 /usr/X11R6/include

    97092 /usr/X11R6/lib
    7220 /usr/X11R6/man
    106 /usr/X11R6/share

    With the information provided by du, you can start in the directories that occupy the most disk space and delete or archive files you no longer actively use.

  7. Permit non-root users to mount or unmount drives. While hard drives are normally mounted automatically when the system is booted, other drives such as the floppy drive and the CD-ROM are generally not mounted until they are going to be used, so that disks can be inserted and removed. By default, root privileges are required for doing the mount (or unmount). However, you can modify the entries in the filesystem table, /etc/fstab, to let other users run the mount command. Do this by adding the option "user" to the appropriate entry:

    /dev/fd0 /mnt/floppy auto noauto,user 0 0 /dev/cdrom /mnt/cdrom iso9660 noauto,ro,user,unhide 0 0

    You can see what filesystems are currently mounted, and what options they were mounted with, by looking at the file /etc/mtab or by running the mount command with no options or arguments.


Excel Tips : The easiest way to find Duplicates of cell in a column

Dates in column A   Text in Column B
03/10/2003 | AAA
03/15/2003 | BBB
03/20/2003 | CCC
03/25/2003 | AAA
03/30/2003 | BBB
04/04/2003 | CCC
03/25/2003 | AAA
03/30/2003 | BBB
04/04/2003 | CCC
03/25/2003 | AAA
03/30/2003 | BBB
04/04/2003 | CCC

1> Enter the formula : =A1&B1 to cell C1 and copy / paste the formula to cells C2:C12

2> Enter the formula : =IF(COUNTIF($C$1:C1,C1)>1,"Duplicate","Unique")
                                      to cell E1 and copy / paste the formula to cells E2:E12



** (you can use the second formula directly if you have only a single column  : Like

Column A


Column A        

Insert this Formula in Column B : =IF(COUNTIF($A$1:A1,A1>1),"Duplicate","Unique")

and  you are done ..

Technorati Tags: ,,,

Thursday, December 13, 2007

7 Simple ways to work fast on slow Internet connections

Microsoft's simple 7 optimizations

Summary :

  1. Sending multiple file faster by compressing .
  2. Turning images and flash can boost faster loading .
  3. Sending E-mail using Distribution list
  4. Working Offline Using Cached Exchange Mode in Outlook
  5. Reducing E-Mail Size With Simple E-Mail Signatures
  6. Browsing offline by saving web pages on Your computer
  7. Open Web Pages Faster by Increasing Your Cache

In Details :

1. Sending multiple file faster by compressing .

If you're sending multiple files—for example several files related to a project—you can reduce their combined size by using a compression utility. Compressing your files can dramatically reduce the time needed to send files online, and won't take up as much space in your (or the recipient's) e-mail Inbox. WinZip is one of the most common compression tools.

2. Turning images and flash can boost faster loading .

Graphics are important to Web pages, but they also take time to download if you're online. You can turn them off to speed your Internet browsing.

To disable graphics in Internet Explorer:

  1. On the Tools menu, click Internet Options.
  2. In the Internet Options dialog box, click the Advanced tab.
  3. In the Settings box, scroll down to the Multimedia section. Clear the following boxes.
  • Play animations in Web pages
  • Play sounds in Web pages
  • Play videos in Web pages
  • Show pictures

4 . Click Apply.


3 . Sending E-mail using Distribution list

If you're sending an e-mail to multiple people, create a distribution list instead of listing each recipient separately. Messages are sent faster and more efficiently when you're using a distribution list. Your company may have established procedures for creating mailing lists.

4 .Working Offline Using Cached Exchange Mode in Outlook

Even if you lose your network connection, you can continue to working in Outlook if you're using Cached Exchange Mode. With Cached Exchange Mode, a copy of your mailbox is stored on your computer. This copy provides quick access to your data and is frequently updated with the mail server. If you work offline, whether by choice or due to a connection problem, your data is still available to you instantly wherever you are. Cached Exchange Mode does require you to work with a Microsoft Exchange Server e-mail account.

5 .Reducing E-Mail Size With Simple E-Mail Signatures

E-mail signatures leave a professional stamp on your messages, but elaborate signatures that include multiple images take up a lot of unnecessary storage space in each e-mail. Ultimately, they can slow down the time needed to send each message. Instead create distinctive text signatures combining fonts, type sizes, and colors to make your e-mail signature smaller and quicker to transmit and receive.

6.Browsing offline by saving web pages on Your computer

If you use reference a Web page often, save it locally to your computer. If you lose your connection or are working on a slow connection, you'll still be able to read and find the information you need.

To save a Web page on your computer:

  1. In Internet Explorer, go to the Web page you want to save.
  2. On the File menu, click Save As.
  3. In the Save As type drop-down menu, select Web page, complete.
  4. Click Save.
7. Open Web Pages Faster by Increasing Your Cache

If you increase the size of the Temporary Internet files cache in Internet Explorer, your computer won't have to work so hard when you revisit Web pages. Many of the images will already be downloaded on your computer, decreasing the amount of time it takes to open a page.

To increase the Temporary Internet Files cache:

  1. On the Tools menu, click Internet Options.
  2. On the General tab, in the Temporary Internet Files section, click Settings.
  3. In the Settings dialog box, under Check for newer versions of stored pages:, click the Automatically radio button.
  4. In the Temporary Internet files folder section, set the Amount of disk space to use: to at least 250 megabytes (MB).
  5. Click OK.


Thursday, November 22, 2007

How to Charge an iPod using electrolytes and an onion

In this episode we show you how to charge your iPod (or other mp3 player) for up to 20 minutes using electrolytes derived from Gatorade or Powerade which are then stored within the cells of an onion.

You will need:

1. 1 White onion
2. 2 cups of Gatorade
3. Screwdriver
4. iPod and USB cable

Monday, November 19, 2007

Making Keygens ..

How to make key generators?

I take no responsibility of the usage of this information.
This tutorial, is for educational knowledge ONLY.
Hi there, in this tutorial, I intend to teach you how to make a pretty
simple keygen, of a program called W3Filer 32 V1.1.3.
W3Filer is a pretty good web downloader...
I guess some of you might know the program.

I`ll assume you know:

A.How to use debugger (in this case, SoftIce).
B.How to crack, generally (finding protection routines,patching them,etc...).
C.How to use Disassembler (This knowledge can help).
E.How to code in Turbo Pascal (tm).

Tools you`ll need:

A.SoftIce 3.00/01 or newer.
B.WD32Asm. (Not a must).
C.The program W3Filer V1.13 (if not provided in this package), can be found in I believe.
D.Turbo Pascal (ANY version).

Well, enough blah blah, let's go cracking...


> > > Run W3Filer 32.

A nag screen pops, and , demands registration (Hmm, this sux ;-)) Now,
We notice this program has some kind of serial number (Mine is 873977046),
Let's keep the serial in mind, I bet we`ll meet it again while we're on
the debugger.

Well, now, let's put your name and a dummy reg code...
set a BP on GetDlgItemTextA, and, press OK.
We pop inside GetDlgItemTextA, Lets find the registration routine...

I`ll save you the work, the registration routine is this:

:00404DB2 8D95A8FAFFFF lea edx, dword ptr [ebp+FFFFFAA8]
:00404DB8 52 push edx ---> Your user name here.
:00404DB9 E80B550000 call 0040A2C9 ---> Registration routine.
:00404DBE 83C408 add esp, 00000008 ---> Dunno exactly what is it.
:00404DC1 85C0 test eax, eax ---> Boolean identifier, 0 if
:00404DC3 7D17 jge 00404DDC ---> registration failed, 1 if

Well, Let's enter the CALL 40A2C9, and see what's inside it:
(Please read my comments in the code).
* Referenced by a CALL at Addresses:

|:00404DB9 , :00407F76

:0040A2C9 55 push ebp
:0040A2CA 8BEC mov ebp, esp
:0040A2CC 81C4B0FEFFFF add esp, FFFFFEB0
:0040A2D2 53 push ebx
:0040A2D3 56 push esi
:0040A2D4 57 push edi
:0040A2D5 8B5508 mov edx, dword ptr [ebp+08]
:0040A2D8 8DB500FFFFFF lea esi, dword ptr [ebp+FFFFFF00]
:0040A2DE 33C0 xor eax, eax
:0040A2E0 EB16 jmp 0040A2F8
* Referenced by a (U)nconditional or (C)onditional Jump at Address:

:0040A2E2 0FBE0A movsx ecx, byte ptr [edx] ----> Here Starts the
interesting part.
:0040A2E5 83F920 cmp ecx, 00000020 ----> ECX is the the current
char in the user name, Hmm, 20h=' '...
:0040A2E8 740D je 0040A2F7 ----> Let's see,
:0040A2EA 8A0A mov cl, byte ptr [edx] ----> Generally, all this loop does, is copying the user name from  [EDX], to [ESI], WITHOUT the spaces!
(Keep this in mind! ).

:0040A2EC 880C06 mov byte ptr [esi+eax], cl
:0040A2EF 42 inc edx
:0040A2F0 40 inc eax
:0040A2F1 C6040600 mov byte ptr [esi+eax], 00
:0040A2F5 EB01 jmp 0040A2F8
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
:0040A2F7 42 inc edx
* Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:0040A2E0(U), :0040A2F5(U)
:0040A2F8 803A00 cmp byte ptr [edx], 00
:0040A2FB 75E5 jne 0040A2E2 ----------------> This is the loop , we got

what it does,
Let's continue tracing
the code...

:0040A2FD 56 push esi --------> The user name is pushed, in order

Upcase it's chars.
* Reference To: USER32.CharUpperA, Ord:0000h
:0040A2FE E80F330000 Call User!CharUpper ---> After this, our name is in
upper case.
:0040A303 56 push esi -----> Our name in upper case here.
* Reference To: cw3220mt._strlen, Ord:0000h
:0040A304 E86F300000 Call 0040D378 ---> This is the length of our name.
:0040A309 59 pop ecx
:0040A30A 8BC8 mov ecx, eax ---> ECX=Length.
:0040A30C 83F904 cmp ecx, 00000004 ---> Length>=4 (MUST).
:0040A30F 7D05 jge 0040A316 ---> Let's go to this address...
:0040A311 83C8FF or eax, FFFFFFFF
:0040A314 EB67 jmp 0040A37D
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
:0040A316 33D2 xor edx, edx
:0040A318 33C0 xor eax, eax
:0040A31A 3BC8 cmp ecx, eax
:0040A31C 7E17 jle 0040A335 ---> (Not important, just another useless

============ FROM HERE AND ON, THE IMPORTANT CODE, PAY ATTENTION ==================
One thing before we continue, EDX = 00000000h as we enter to the next instructions.
* Referenced by a (U)nconditional or (C)onditional Jump at Address:

:0040A31E 0FBE1C06 movsx ebx, byte ptr [esi+eax] ---> EBX <--- char in user
name, offset EAX.
:0040A322 C1E303 shl ebx, 03 -----> Hmm, it shl's the char by 03h...
(Remember that).
:0040A325 0FBE3C06 movsx edi, byte ptr [esi+eax] ---> Now EDI <--- Char in
user name , offset EAX.
:0040A329 0FAFF8 imul edi, eax -----> It multiplies the char by the
offset in user name! (Remember that).
:0040A32C 03DF add ebx, edi -----> Adds the result to EBX (That was
Shelled (Ding Dong =)).
:0040A32E 03D3 add edx, ebx -----> EDX=EDX+EBX!!! - This is the CORE
of this registration routine!!!
:0040A330 40 inc eax -----> Increase EAX by one (next char).
:0040A331 3BC8 cmp ecx, eax
:0040A333 7FE9 jg 0040A31E ----> If ECX<EAX then, we leave the

* Referenced by a (U)nconditional or (C)onditional Jump at Address:

:0040A335 A120674100 mov eax, dword ptr [00416720] ---> HMMMMMM, What's in
:0040A33A C1F803 sar eax, 03 ---------> WAIT! Please type in SIce '?

Does this number in EAX look familiar to us? ;-)

If you still don`t understand,than, It's our SERIAL NUMBER! (PLEASE, take your time, and check by
yourself - don`t trust me!). OK, so now we know,That it SHR's EAX by 03 (SAR is almost identical to SHR).

:0040A33D 03D0 add edx, eax ---------> Hmm, it adds the result from the
loop, the serial number shr'd by 03h
:0040A33F 52 push edx -------> Let's continue. (At this point, I
can tell you , the reg number, is
in EDX - only that the reg number
is in HEX --> That's how you enter it).
* Possible StringData Ref from Data Obj ->"%lx"
:0040A340 685EF54000 push 0040F55E
:0040A345 8D95B0FEFFFF lea edx, dword ptr [ebp+FFFFFEB0]
:0040A34B 52 push edx
* Reference To: USER32.wsprintfA, Ord:0000h
:0040A34C E8E5320000 Call 0040D636 -------> This one, does HEX2STR (Takes
the value from EDX, and turns it to an hex string).
:0040A351 83C40C add esp, 0000000C
:0040A354 8D8DB0FEFFFF lea ecx, dword ptr [ebp+FFFFFEB0] -----> type 'd ecx' -
THIS is the reg number! That's enough for us, the rest of
the code, is
just for comparing the correct reg code with ours.
:0040A35A 51 push ecx
* Reference To: USER32.CharLowerA, Ord:0000h
:0040A35B E8B8320000 Call 0040D618
:0040A360 8D85B0FEFFFF lea eax, dword ptr [ebp+FFFFFEB0]
:0040A366 50 push eax
:0040A367 FF750C push [ebp+0C]
* Reference To: cw3220mt._strcmp, Ord:0000h
:0040A36A E875300000 Call 0040D3E4
:0040A36F 83C408 add esp, 00000008
:0040A372 85C0 test eax, eax
:0040A374 7405 je 0040A37B
:0040A376 83C8FF or eax, FFFFFFFF
:0040A379 EB02 jmp 0040A37D
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
:0040A37B 33C0 xor eax, eax
* Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:0040A314(U), :0040A379(U)
:0040A37D 5F pop edi
:0040A37E 5E pop esi
:0040A37F 5B pop ebx
:0040A380 8BE5 mov esp, ebp
:0040A382 5D pop ebp
:0040A383 C3 ret
Making the actual Keygen

Now, after I've explained how does the program calculate the registration
code, you can either write your own keymaker, without looking at my code, or
look at my code (in Turbo Pascal - sorry for all you C lovers ;-) Next time).
That's it, here's the source of my keygen:

------------------- Cut here ---------------------------------------------

Program W3FilerKeygen;

Writeln(' W3Filer32 V1.1.3 Keymaker');
writeln('Cracked by ^pain^ ''97 / Rebels!');
Write('Your Name:'); { Read the name }
Write('Serial Number:');
readln(SerialNum); {Yes, we need the serial number for the calculation!}
For I:=1 to length(Name) do
If Name[I]<>' ' then begin
eb:=ord(Name[I]) shl 3; {EB = Name[I] Shl 03h}
Ed:=ord(Name[I]); {ED = Name[I]}
ed:=ed*(x); {ED=ED*Offset}
eb:=eb+ed; {Add ED to EB}
Key:=Key+EB; {Add EB to KEY}
Key:=Key+(SerialNum shr 3); { Add SerialNum shr 03h to Key}
{ From here, this is just HEX2STRING --> I`m quite sure it's
Self explaintory, else - go and learn number bases again! ;-)}
digit:=Key mod 16;
key:=key div 16;
If digit<10 then KeyHex:=Chr(Digit+ord('0'))+KeyHex;
If digit>10 then KeyHex:=Chr(Digit-10+ord('a'))+KeyHex;
until key=0;
writeln('Your Key:',KeyHex);
writeln(' Enjoy!');

--------------------- Cut here -------------------------------------------

Wednesday, November 14, 2007

Ask the Optimist! - Part 2

his is the second part of the adaptation of George Saunders' "Ask the Optimist" piece that is part of his new book of essays, "Braindead Megaphone."

Wakey, wakey! Morning Yoga w/Tara Stiles

Your alarm is ringing, you have to go to work, but first relax and do this morning yoga routine with Tara Stiles. Become a member of by clicking here!

Monday, November 12, 2007

Creating Rounded Corners With Ajax In C#

Learn how to create rounded corners with Ajax

read more | digg story

Sunday, October 28, 2007

How many classes can a single .NET DLL contain?

It can contain many Classes./p>

True or False: To test a Web service you must create a windows application or Web application to consume this service?

False, the webservice comes with a test page and it provides HTTP-GET method to test.

Which control would you use if you needed to make sure the values in two different controls matched?

CompareValidator Control

Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?

DataTextField property

What does WSDL stand for?

(Web Services Description Language)

True or False: A Web service can only be written in .NET?


What is the transport protocol you use to call a Web service?

SOAP is the preferred protocol.

What tag do you use to add a hyperlink column to the DataGrid?


What tags do you need to add within the asp:datagrid tags to bind columns manually?

Set AutoGenerateColumns Property to false on the datagrid tag

Name two properties common in every validation control?

ControlToValidate property and Text property.

What base class do all Web Forms inherit from?

The Page class.

What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

You must set the DataSource property and call the DataBind method.

How can you provide an alternating color scheme in a Repeater control?

Use the AlternatingItemTemplate

Which template must you provide, in order to display data in a Repeater control?


Can you edit data in the Repeater control?

No, it just reads the information from its data source

Which method do you invoke on the DataAdapter control to load your generated dataset with data?

The .Fill() method

Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

Explain what a diffgram is, and a good use for one?

The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

Describe the difference between inline and code behind.

Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

Whats an assembly?

Assemblies are the building blocks of the .NET framework.

Overview of assemblies from MSDN

Can you explain what inheritance is and an example of when you might use it?

When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.

If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?

Maintain the login state security through a database.

Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?

This is where you can set the specific variables for the Application and Session objects.

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.

· A DataSet is designed to work without any continuing connection to the original data source.

· Data in a DataSet is bulk-loaded, rather than being loaded on demand.

· There's no concept of cursor types in a DataSet.

· DataSets have no current record pointer You can use For Each loops to move through the data.

· You can store many edits in a DataSet, and write them to the original data source in a single operation.

Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.

What does the "EnableViewState" property do? Why would I want it on or off?

It enables the viewstate on the page. It allows the page to save the users input on a form.

Should validation (did the user enter a real date) occur server-side or client-side? Why?

Client-side. This reduces an additional request to the server to validate the users input.

What type of code (server or client) is found in a Code-Behind class?

Server-side code.

Explain the differences between Server-side and Client-side code?

Server-side code runs on the server. Client-side code runs in the clients’ browser.

What data type does the RangeValidator control support?

Integer,String and Date.

Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler?

It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.


What’s a bubbled event?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

What’s the difference between Codebehind="MyCode.aspx.cs" and

CodeBehind is relevant to Visual Studio.NET only.

Where do you store the information about the user’s locale?


Where does the Web page belong in the .NET Framework class hierarchy?


What methods are fired during the page load?

Init() - when the page is instantiated, Load() - when the page is loaded into server memory, PreRender() - the brief moment before the page is displayed to the user as HTML, Unload() - when page finishes loading.

What’s the difference between Response.Write() and Response.Output.Write()?

Ans > The latter one allows you to write formatted output.

Technorati Tags: ,

Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

Technorati Tags: , ,

Thursday, October 11, 2007

Adding Tooltip to a component in C#

Tooltip is a simply a nice ways to show a shot help to any component or control ...

Here is a short example for how to add a tooltip to a component ..

Source Code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form
  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.ToolTip toolTip1;
  private System.Windows.Forms.ToolTip toolTip2;
  private System.Windows.Forms.PictureBox pictureBox2;
  public Form1() {
  private void InitializeComponent()
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        this.toolTip1 = new System.Windows.Forms.ToolTip(new System.ComponentModel.Container());
        this.toolTip2 = new System.Windows.Forms.ToolTip(new System.ComponentModel.Container());
        this.pictureBox2 = new System.Windows.Forms.PictureBox();
        // pictureBox1
        this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.pictureBox1.Location = new System.Drawing.Point(12, 24);
        this.pictureBox1.Name = "pictureBox1";
        this.pictureBox1.Size = new System.Drawing.Size(100, 50);
        this.pictureBox1.TabIndex = 0;
        this.pictureBox1.TabStop = false;
        this.toolTip1.SetToolTip(this.pictureBox1, "This is a tooltip.");
        // toolTip1
        this.toolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
        this.toolTip1.ToolTipTitle = "Titled ToolTip";
        // pictureBox2
        this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.pictureBox2.Location = new System.Drawing.Point(148, 24);
        this.pictureBox2.Name = "pictureBox2";
        this.pictureBox2.Size = new System.Drawing.Size(100, 50);
        this.pictureBox2.TabIndex = 1;
        this.pictureBox2.TabStop = false;
        this.toolTip2.SetToolTip(this.pictureBox2, "This is a tooltip.");
        // Form1
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(279, 107);
        this.Name = "Form1";
        this.Text = "ToolTip Test";
  static void Main()
    Application.Run(new Form1());


Do write a comment if this code is helpful for you ...

Technorati Tags: , , , ,

Wednesday, October 10, 2007

Multithreading Using C#


Multithreading has always been a helpful friend of a programmer . Multithreading increases the response time of an application .  Multithreading can be implemented by using namespace system.threading  .

Why Multithreading is required ?

> For this I will give U a simple example : Assume U have a company and U have only one assistance and 0 workers then what will happen the complete workload of company will be on your assistance , the assistance then take much time to do everything one by one , Which will affect U in turn .. your application also runs in the same manner if U have only single thread Your execution and your processing will be very slow which may also hangs your application . So Multithreading distributes specified process to run in another thread  an wont affect the normal processing of your application ..

Lets have a little demo for this .

Demo - 1


using System;
using System.Threading;
public class MyThread
    public static void Thread1()
        for (int i = 0; i < 10; i++)
            Console.WriteLine("Thread1 {0}", i);
    public static void Thread2()
        for (int i = 0; i < 10; i++)
            Console.WriteLine("Thread2 {0}", i);
public class MyClass
    public static void Main()
        Console.WriteLine("Before start thread");
        Thread tid1 = new Thread(new ThreadStart(MyThread.Thread1));
        Thread tid2 = new Thread(new ThreadStart(MyThread.Thread2));

Explanation :

In this Demo u have 2 static methods Thread1 and Thread2 . To make a thread we are making a object class named Thread.

The constructor of this class takes a reference of a ThreadStart class. This constructor
can send two types of exceptions; ArgumentNullException when the parameter is
a null reference or a Security Exception when program does not have permission to
create thread.


The parameter of the Thread class is reference to a ThreadStart class.
ThreadStart class points to the method that should be executed first when a
thread is started. The parameter is the name of the function, which is considered as
a thread function. Thread1 is a static function so we give it with the name of class
name without making an object of the class. The thread starts execution with
Start() method of the Thread class. The output of this program is

Before start thread
Thread1 0
Thread1 1
Thread1 2
Thread1 3
Thread1 4
Thread1 5
Thread1 6
Thread1 7
Thread1 8
Thread1 9
Thread2 0
Thread2 1
Thread2 2
Thread2 3
Thread2 4
Thread2 5
Thread2 6
Thread2 7
Thread2 8
Thread2 9

This is how we using multithreading in our application ...

Technorati Tags: , ,