Saturday, June 20, 2009

Converting Excel file into Xml

You can Easily convert Excel Sheet into Xml File by One Click
I am Writing That code Here.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim Str As String = Nothing
Dim src, src2 As String
src = txtExcel.Text// name of .xls File
src2 = txtTablename.Text//name Excel Sheet it take multiple sheet name with seprated by comma




Str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & src & ";Extended Properties=Excel 8.0;"//connecting to Excel
Dim stringItems() As String = src2.Split(",")

Dim count As Integer
For count = 0 To stringItems.Length - 1

Dim dx As New DataSet()

Dim DA As New OleDb.OleDbDataAdapter()
Dim DS As New DataSet()

Dim str2 As String
str2 = "$"
Dim objConn As New OleDb.OleDbConnection(Str)
Dim scomman As String = "select * from [" + stringItems(count) + "$]"
Dim ada As New OleDbDataAdapter(scomman, objConn)

ada.Fill(dx, "transport")

Dim doc As New XmlDataDocument(dx)
doc.Save("C:\" + stringItems(count) + ".xml")

Next

MsgBox("Xml Files Created", MsgBoxStyle.Information, "Xml Converter")


End Sub

Tuesday, June 16, 2009

Javascript Validation

function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}

Friday, June 12, 2009

Network engineer interview questions

Network engineer interview questions
OSPF

* Describe OSPF in your own words.
* OSPF areas, the purpose of having each of them
* Types of OSPF LSA, the purpose of each LSA type
* What exact LSA type you can see in different areas
* How OSPF establishes neighboor relation, what the stages are
* If OSPF router is stucked in each stage what the problem is and how to troubleshoot it
* OSPF hierarchy in the single or multi areas. Cool OSPF behavior in broadcast and nonbroadcast
* Draw the diagram of typical OSPF network and explain generally how it works, DR, BDR, election, ASBR, ABR, route redistribution and summarization

STP

* How it works and the purpose
* Diff types (SSTP, MSTP, RSTP) Cisco - PVST/PVST+
* root election
* Diff. port stages and timing for convergence
* Draw the typical diagram and explain how diff types of STP work
* What ports are blocking or forwarding
* How it works if there are topology changes

ACLs

* What are they
* Diff types
* Write an example if you want to allow and to deny…
* Well-known port numbers (DNS - 53 and etc…)

QOS

* What is that
* What is the diff b/w L2 and L3 QoS
* How it works

Network:

* Draw the typical network diagram you have to deal with
* explain how it works
* What part of it you are responsible
* firewall, what is that, how it works, how it is diff from ACLs
* What problems with the network you had had and how you solved it.
* What are the ways to troubleshoot the network, techniques, commands
* network security, ways to achieve it

Switching:

* VLANs
* STP
* How a L2 switch works with broadcast, unicast, multicast, known/unknown traffic
* VRRP, GLBP
* port monitoring and mirroring
* L3 switch, how it works
* PIM sparse and dense modes


^Back to Top
Windows admin interview questions

1. Describe how the DHCP lease is obtained. It’s a four-step process consisting of (a) IP request, (b) IP offer, © IP selection and (d) acknowledgement.
2. I can’t seem to access the Internet, don’t have any access to the corporate network and on ipconfig my address is 169.254.*.*. What happened? The 169.254.*.* netmask is assigned to Windows machines running 98/2000/XP if the DHCP server is not available. The name for the technology is APIPA (Automatic Private Internet Protocol Addressing).
3. We’ve installed a new Windows-based DHCP server, however, the users do not seem to be getting DHCP leases off of it. The server must be authorized first with the Active Directory.
4. How can you force the client to give up the dhcp lease if you have access to the client PC? ipconfig /release
5. What authentication options do Windows 2000 Servers have for remote clients? PAP, SPAP, CHAP, MS-CHAP and EAP.
6. What are the networking protocol options for the Windows clients if for some reason you do not want to use TCP/IP? NWLink (Novell), NetBEUI, AppleTalk (Apple).
7. What is data link layer in the OSI reference model responsible for? Data link layer is located above the physical layer, but below the network layer. Taking raw data bits and packaging them into frames. The network layer will be responsible for addressing the frames, while the physical layer is reponsible for retrieving and sending raw data bits.
8. What is binding order? The order by which the network protocols are used for client-server communications. The most frequently used protocols should be at the top.
9. How do cryptography-based keys ensure the validity of data transferred across the network? Each IP packet is assigned a checksum, so if the checksums do not match on both receiving and transmitting ends, the data was modified or corrupted.
10. Should we deploy IPSEC-based security or certificate-based security? They are really two different technologies. IPSec secures the TCP/IP communication and protects the integrity of the packets. Certificate-based security ensures the validity of authenticated clients and servers.
11. What is LMHOSTS file? It’s a file stored on a host machine that is used to resolve NetBIOS to specific IP addresses.
12. What’s the difference between forward lookup and reverse lookup in DNS? Forward lookup is name-to-address, the reverse lookup is address-to-name.
13. How can you recover a file encrypted using EFS? Use the domain recovery agent.


^Back to Top

Read more at TechInterviews.com
Network engineer/architect interview questions

1. Explain how traceroute, ping, and tcpdump work and what they are used for?
2. Describe a case where you have used these tools to troubleshoot.
3. What is the last major networking problem you troubleshot and solved on your own in the last year?
4. What LAN analyzer tools are you familiar with and describe how you use them to troubleshoot and on what media and network types.
5. Explain the contents of a routing table (default route, next hop, etc.)
6. What routing protocols have you configured?
7. Describe the commands to set up a route.
8. What routing problems have you troubleshot?
9. How do you display a routing table on a Cisco? On a host?
10. How do you use a routing table and for what?
11. What is a route flap?
12. What is a metric?
13. When do you use BGP, IGRP, OSPF, Static Routes?
14. What do you see as current networking security issues (e.g. NFS mounting, spoofing, one time passwords, etc.)?
15. Describe a routing filter and what it does.
16. Describe an access list and what it does.
17. What is a network management system?
18. Describe how SNMP works.
19. Describe the working environment you are currently in, e.g. frequent interruptions, frequent priority shifting, team or individual.
20. What do you use to write documentation? Editor? Mail reader?
21. What platform (s) do you currently work on at your desk?
22. How do you manage multiple concurrent high level projects?
23. Describe a recent short term stressful situation and how you managed it.
24. How do you manage a long term demanding stressful work environment?
25. Have you worked in an assignment based environment, e.g. work request/trouble ticket system, and if so, describe that environment.
26. Describe what network statistics or measurement tools you are familiar with and how you have used them.
27. Describe what a VPN is and how it works.
28. Describe how VoIP works.
29. Describe methods of QoS.
30. How does ToS bit work?


^Back to Top
CCNA/Cisco admin interview questions

1. You need to retrieve a file from the file server for your word processing application, which layer of the OSI model is responsible for this function?
1. Presentation layer
2. Application layer
3. Session layer
4. Transport layer
5. Datalink layer
2. You are working in a word processing program, which is run from the file server. Your data comes back to you in an unintelligible manner. Which layer of the OSI model would you investigate?
1. Application layer
2. Presentation layer
3. Session layer
4. Network layer
5. Datalink layer
3. The IEEE subdivided the datalink layer to provide for environments that need connectionless or connection-oriented services. What are the two layers called?
1. Physical
2. MAC
3. LLC
4. Session
5. IP
4. You are working with graphic translations. Which layer of the OSI model is responsible for code formatting and conversion and graphic standards.
1. Network layer
2. Session layer
3. Transport layer
4. Presentation layer
5. Which is the best definition of encapsulation?
1. Each layer of the OSI model uses encryption to put the PDU from the upper layer into its data field. It adds header and trailer information that is available to its counterpart on the system that will receive it.
2. Data always needs to be tunneled to its destination so encapsulation must be used.
3. Each layer of the OSI model uses compression to put the PDU from the upper layer into its data field. It adds header and trailer information that is available to its counterpart on the system that will receive it.
4. Each layer of the OSI model uses encapsulation to put the PDU from the upper layer into its data field. It adds header and trailer information that is available to its counterpart on the system that will receive it.
6. Routers can be configured using several sources. Select which of the following sources can be used.
1. Console Port
2. Virtual Terminals
3. TFTP Server
4. Floppy disk
5. Removable media
7. Which memory component on a Cisco router contains the dynamic system configuration?
1. ROM
2. NVRAM
3. Flash
4. RAM/DRAM
8. Which combination of keys will allow you to view the previous commands that you typed at the router?
1. ESC-P
2. Ctrl-P
3. Shift-P
4. Alt-P
9. Which commands will display the active configuration parameters?
1. show running-config
2. write term
3. show version
4. display term
10. You are configuring a router, which prompt tells you that you are in the privileged EXEC mode?
1. @
2. >
3. !
4. :
5. #
11. What does the command “IP name-server 255.255.255.255″ accomplish?
1. It disables domain name lookup.
2. It sets the domain name lookup to be a local broadcast.
3. This is an illegal command.
4. The command is now defunct and has been replaced by “IP server-name ip any”
12. The following selections show the command prompt and the configuration of the IP network mask. Which two are correct?
1. Router(config-if)#netmask-format { bitcount | decimal | hexadecimal }
2. Router#term IP netmask-format { bitcount | decimal | hexadecimal }
3. Router(config-if)#IP netmask-format { bitcount | decimal | hexadecimal }
4. Router#ip netmask-format { bitcount | decimal | hexadecimal }
13. Which layer is responsible for flow control with sliding windows and reliability with sequence numbers and acknowledgments?
1. Transport
2. Application
3. Internet
4. Network Interface
14. Which processes does TCP, but not UDP, use?
1. Windowing
2. Acknowledgements
3. Source Port
4. Destination Port
15. Select which protocols use distance vector routing?
1. OSPF
2. RIP
3. IGRP
4. PPP


^Back to Top

Read more at TechInterviews.com
Networking and Unix interview questions

What is UTP?

UTP — Unshielded twisted pair 10BASE-T is the preferred Ethernet medium of the 90s. It is based on a star topology and provides a number of advantages over coaxial media:

It uses inexpensive, readily available copper phone wire. UTP wire is much easier to install and debug than coax. UTP uses RG-45 connectors, which are cheap and reliable.

What is a router? What is a gateway?

Routers are machines that direct a packet through the maze of networks that stand between its source and destination. Normally a router is used for internal networks while a gateway acts a door for the packet to reach the ‘outside’ of the internal network

What is Semaphore? What is deadlock?

Semaphore is a synchronization tool to solve critical-section problem, can be used to control access to the critical section for a process or thread. The main disadvantage (same of mutual-exclusion) is require busy waiting. It will create problems in a multiprogramming system, where a single CPU is shared among many processes.

Busy waiting wastes CPU cycles.

Deadlock is a situation when two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes. The implementation of a semaphore with a waiting queue may result in this situation.

What is Virtual Memory?

Virtual memory is a technique that allows the execution of processes that may not be completely in memory. A separation of user logical memory from physical memory allows an extremely large virtual memory to be provided for programmers when only a smaller physical memory is available. It is commonly implemented by demand paging. A demand paging system is similar to a paging system with swapping. Processes reside on secondary memory (which is usually a disk). When we want to execute a process, we swap it into memory.

Explain the layered aspect of a UNIX system. What are the layers? What does it mean to say they are layers?

A UNIX system has essentially three main layers:

. The hardware

. The operating system kernel

. The user-level programs

The kernel hides the system’s hardware underneath an abstract, high-level programming interface. It is responsible for implementing many of the facilities that users and user-level programs take for granted.

The kernel assembles all of the following UNIX concepts from lower-level hardware features:

. Processes (time-sharing, protected address space)

. Signals and semaphores

. Virtual Memory (swapping, paging, and mapping)

. The filesystem (files, directories, namespace)

. Pipes and network connections (inter-process communication)

C++ code job interviews

: Write a short code using C++ to print out all odd number from 1 to 100 using a for loop(Asked by Intacct.com people)

for( unsigned int i = 1; i < = 100; i++ )
if( i & 0x00000001 )
cout << i<<\",\";

ISO layers and what layer is the IP operated from?( Asked by Cisco system people)

cation, Presentation, Session, Transport, Network, Data link and Physical. The IP is operated in the Network layer.

3.Q: Write a program that ask for user input from 5 to 9 then calculate the average( Asked by Cisco system people)

A.int main()
{
int MAX=4;
int total =0;
int average=0;
int numb;
cout<<"Please enter your input from 5 to 9";
cin>>numb;
if((numb <5)&&(numb>9))
cout<<"please re type your input";
else
for(i=0;i<=MAX; i++)
{
total = total + numb;
average= total /MAX;
}
cout<<"The average number is">>average<
return 0;
}

4.Q: Can you be bale to identify between Straight- through and Cross- over cable wiring? and in what case do you use Straight- through and Cross-over? (Asked by Cisco system people)

A. Straight-through is type of wiring that is one to to one connection Cross- over is type of wiring which those wires are got switched

We use Straight-through cable when we connect between NIC Adapter and Hub. Using Cross-over cable when connect between two NIC Adapters or sometime between two hubs.

5.Q: If you hear the CPU fan is running and the monitor power is still on, but you did not see any thing show up in the monitor screen. What would you do to find out what is going wrong? (Asked by WNI people)

A. I would use the ping command to check whether the machine is still alive(connect to the network) or it is dead.

^Back to Top
C++ object-oriented interview questions

1. How do you write a function that can reverse a linked-list? (Cisco System)

void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur->next = head;

for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}

curnext->next = cur;
}
}

2. What is polymorphism?

Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.

3. How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.

4. How can you tell what shell you are running on UNIX system?

You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.

5. What is Boyce Codd Normal form?

A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one of the following holds:

* a->b is a trivial functional dependency (b is a subset of a)
* a is a superkey for schema R


^Back to Top
Interview questions on C/C++

A reader submitted the interview questions he was asked. More C/C++ questions will be added here, as people keep sending us a set of 2-3 questions they got on their job itnerview.

Q1: Tell how to check whether a linked list is circular.

A: Create two pointers, each set to the start of the list. Update each as follows:

while (pointer1) {
pointer1 = pointer1->next;
pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
if (pointer1 == pointer2) {
print (\"circular\n\");
}
}

Q2: OK, why does this work?

If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, it’s either 1 or 2 jumps until they meet.

How can you quickly find the number of elements stored in a a) static array b) dynamic array ?

Why is it difficult to store linked list in an array?

How can you find the nodes with repetetive data in a linked list?

Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.

This is a C question that I had for an intern position at Microsoft: Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique. After I wrote out my function, he asked me to figure out from the code how many times the printf statement is run, and also questions on optimizing my algorithm.

What’s the output of the following program? Why?

#include
main()
{
typedef union
{
int a;
char b[10];
float c;
}
Union;

Union x,y = {100};
x.a = 50;
strcpy(x.b,\"hello\");
x.c = 21.50;

printf(\"Union x : %d %s %f \n\",x.a,x.b,x.c );
printf(\"Union y :%d %s%f \n\",y.a,y.b,y.c);
}

Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively)

What is output equal to in

output = (X & Y) | (X & Z) | (Y & Z)


^Back to Top
C++ gamedev interview questions

This set of questions came from a prominent gaming company. As you can see, the answers are not given (the interviews are typically conducted by senior developers), but there’s a set of notes with common mistakes to avoid.

1. Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at:
* const char *
* char const *
* char * const

Note: Ask the candidate whether the first declaration is pointing to a string or a single character. Both explanations are correct, but if he says that it’s a single character pointer, ask why a whole string is initialized as char* in C++. If he says this is a string declaration, ask him to declare a pointer to a single character. Competent candidates should not have problems pointing out why const char* can be both a character and a string declaration, incompetent ones will come up with invalid reasons.
2. You’re given a simple code for the class BankCustomer. Write the following functions:
* Copy constructor
* = operator overload
* == operator overload
* + operator overload (customers’ balances should be added up, as an example of joint account between husband and wife)

Note:Anyone confusing assignment and equality operators should be dismissed from the interview. The applicant might make a mistake of passing by value, not by reference. The candidate might also want to return a pointer, not a new object, from the addition operator. Slightly hint that you’d like the value to be changed outside the function, too, in the first case. Ask him whether the statement customer3 = customer1 + customer2 would work in the second case.
3. What problems might the following macro bring to the application?

#define sq(x) x*x

4. Consider the following struct declarations:

struct A { A(){ cout << \"A\"; } };
struct B { B(){ cout << \"B\"; } };
struct C { C(){ cout << \"C\"; } };
struct D { D(){ cout << \"D\"; } };
struct E : D { E(){ cout << \"E\"; } };
struct F : A, B
{
C c;
D d;
E e;
F() : B(), A(),d(),c(),e() { cout << \"F\"; }
};

What constructors will be called when an instance of F is initialized? Produce the program output when this happens.
5. Anything wrong with this code?

T *p = new T[10];
delete p;


Note: Incorrect replies: “No, everything is correct”, “Only the first element of the array will be deleted”, “The entire array will be deleted, but only the first element destructor will be called”.
6. Anything wrong with this code?

T *p = 0;
delete p;

Note: Typical wrong answer: Yes, the program will crash in an attempt to delete a null pointer. The candidate does not understand pointers. A very smart candidate will ask whether delete is overloaded for the class T.
7. Explain virtual inheritance. Draw the diagram explaining the initialization of the base class when virtual inheritance is used.
Note: Typical mistake for applicant is to draw an inheritance diagram, where a single base class is inherited with virtual methods. Explain to the candidate that this is not virtual inheritance. Ask them for the classic definition of virtual inheritance. Such question might be too complex for a beginning or even intermediate developer, but any applicant with advanced C++ experience should be somewhat familiar with the concept, even though he’ll probably say he’d avoid using it in a real project. Moreover, even the experienced developers, who know about virtual inheritance, cannot coherently explain the initialization process. If you find a candidate that knows both the concept and the initialization process well, he’s hired.
8. What’s potentially wrong with the following code?

long value;
//some stuff
value &= 0xFFFF;

Note: Hint to the candidate about the base platform they’re developing for. If the person still doesn’t find anything wrong with the code, they are not experienced with C++.
9. What does the following code do and why would anyone write something like that?

void send (int *to, int * from, int count)
{
int n = (count + 7) / 8;
switch ( count % 8)
{
case 0: do { *to++ = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
} while ( --n > 0 );
}
}

10. In the H file you see the following declaration:

class Foo {
void Bar( void ) const ;
};

Tell me all you know about the Bar() function.