Thursday, December 9, 2010

Splitting parts of file path using vb.net by anil nain


Splitting parts of file path using vb.net by anil nain 9416077273
Here we see how you can Split a file system path into separate parts using Visual Basic .NET. We use a New Char() array with one string, "\""c, and then loop through and display the results.=== Program that splits file path (VB.NET) ===
Module Module1
Sub Main()
' The file system path we need to split
Dim s As String = "C:\Users\Sam\Documents\Perls\Main"
' Split the string on the backslash character
Dim parts As String() = s.Split(New Char() {"\"c})
' Loop through result strings with For Each
Dim part As String
For Each part In parts
Console.WriteLine(part)
Next
End Sub
End Module
=== Output of the program ===
C:
Users
Sam
Documents
Perls
Main
How you can split based on words
Often you need to extract the words from a String or sentence in VB.NET. The code here needs to handle punctuation and non-word characters differently than the String Split method. Here we use Regex.Split to parse the words.=== Program that splits words (VB.NET) ===
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
' Declare iteration variable
Dim s As String
' Loop through words in string
Dim arr As String() = SplitWords("That is a cute cat, man!")
' Display each word. Note that punctuation is handled correctly.
For Each s In arr
Console.WriteLine(s)
Next
Console.ReadLine()
End Sub
'''
''' Split the words in string on non-word characters.
''' This means commas and periods are handled correctly.
'''

Private Function SplitWords(ByVal s As String) As String()
'
' Call Regex.Split function from the imported namespace.
' Return the result array.
'
Return Regex.Split(s, "\W+")
End Function
End Module
=== Output of the program ===
That
is
a
cute
cat
man
Description of the example code. In the Main() subroutine you can see that two variables are declared. The second variable is a String() array that receives the results from the Private Function next.
Description of the Regex. The Function shown in the example calls the Regex.Split method, which can be accessed with dot notation, with no instance necessary. The second parameter to the method is a regular expression pattern.
Description of the Regex pattern. The pattern "\W+" is used, and this means "1 or more non-word characters". This pattern will match punctuation and spaces. Therefore, all those characters will be used as delimiters.
Splitting each line in a file
Here we see one way to Split each line in a file using File.ReadAllLines and Split. We have a comma-separated-values CSV file, and want to print out each value and its row number. Here is the input file "example.txt". Please see the below example.
The Split code example follows. It first reads in the file with ReadAllLines. This function puts each line in the file into an array element. The example next Splits on ","c. The final comment shows the output of the program.=== Input file used ===
frontal,parietal,occipital,temporal
pulmonary artery,aorta,left ventricle
=== Example program that splits lines (VB.NET) ===
Imports System.IO
Module Module1
Sub Main()
Dim i As Integer = 0
' Loop through each line in array returned by ReadAllLines
Dim line As String
For Each line In File.ReadAllLines("example.txt")
' Split line on comma
Dim parts As String() = line.Split(New Char() {","c})
' Loop over each string received
Dim part As String
For Each part In parts
' Display to Console
Console.WriteLine("{0}:{1}", i, part)
Next
i += 1
Next
End Sub
End Module
=== Output of the program ===
0:frontal
0:parietal
0:occipital
0:temporal
1:pulmonary artery
1:aorta
1:left ventricle
Splitting parts of file path using vb.net by anil nain

Saturday, August 28, 2010

Distributed Database कांसेप्ट्स बी अनिल NAIN


Distributed Database Concepts बी अनिल नैन 9416077273
Distributed database (DDB) - It is a collection of multiple logically interrelated databases distributed over a computer networks and a distributed database management system (DDBMS) as a software system that manages a distributed database while making tie distribution transparent to the user. A collection of files started at different nodes of network and the maintaining of Inter relationship among them via hyperlinks has become a common organisation on the internet, with file of web pages.
Advantages of Distributed Databases
Distributed database management has been proposed for various reason ranging from organizational, decentralisation and economical processing to greater autonomy. We highlight some of these advantages here.
1. Management of distributed data with different level of transparency: Ideally, a DBMS should be distribution transparent in the sense of hiding the details of where each file (table, relation) is physically stored within the system. Consider the company database that is spread over the network as shown in Figure 6.4.
Communication Network
Chicago (Headquarters)
New York
Atlanta
San Francisco
Los Angles

Employees - San Francisco and Los Angeles
Projects - San Francisco
Works_On - San Francisco Employee
Employees - ALL
Projects - ALL
Works_On - ALL
Employees - New York
Projects - ALL
Works_On - New York Employee
Employees - Atlanta
Projects - Atlanta
Works_On - Atlanta Employee
Employees - Los Angles
Projects - Los Angles and San Francisco
Works_On - Los Angles Employees
Where Employees, Projects and Works_ On are the relation in the Company Database as follows:
EMPLOYEE
FNAME
LANAME
SSN
BDATE
ADDRESS
SEX
SALARY
PROJECT
PNAME
PNUMBER
PLOCATION
DNUM
WORKS_ON
ESSN
PNO
HOURS


· Distributed or network transparency: This refers to freedom for the user from the operational details of the network. It may be divided into location transparency and naming transparency.
Location transparency: It refers to the fact that the command used to perform a task is independent of the location of data and the location of the system where the command was issued.
Naming Transparency: It implies that once a name is specified, the named objects can be accessed unambiguously without additional specification
· Replication transparency: As we show in above figure copies of data may be stored at multiple sites for better availability, performance, and reliability. Replication transparency makes the user unaware of the existence of copies.
· Fragmentation transparency: Two types of fragmentation are possible. Horizontal fragmentation distributes a relation into sets of tuples (rows) and Vertical fragmentation distributes a relation into sub relation where each sub relation is defined by a subset of the column of the original relation. A global query by the user must be transformed into several payment queries. Fragmentation transparency makes the user unaware of the existence of fragments.
1. Increased reliability and availability: Reliability is broadly defined as the probability that a system is running (not down) at a certain point of time, whereas availability is the probability that the system is continuously available during a time interval. When the data and DBMS software are distributed over several sites, one site may fail while other sites continue to operate. Only the data and software that exists at the failed site cannot be accessed. In a centralised system, failure at a single site makes the whole system unavailable to all users.
2. Improved performance: A DDBMS fragments the database by keeping the data closer to where it is needed most. Data localisation reduces the contention for CPU and I/O services and simultaneously reduces access delays involved in Wide Area Network. When a large database is distributed over multiple sites, smaller database exist at each site. As a result, local queries and transactions accessing data at a single site have better performance because of the smaller local databases.
3. Easier Expansion: In a distributed environment, expansion of the system in terms of addition of more data, increasing database size, or addition of more processors is much easier.
Additional Functions of Distributed Databases
Distribution leads to increased complicity in system designed implementation. To achieve the potential advantage by DDBMS as listed previously, software must be able to provide the following functions in addition to those of a centralised DBMS.
Keeping track of data: The ability to keep track of the data distribution, fragmentation, and replication by expanding the DDBMS catalog.
Distributed query processing: The ability to access remote sites and transmit queries and data among the various sites via a communication network.
Distributed transaction management: The ability to devise execution strategies for queries and transactions that access data from more than one site and to synchronise the access to distributed data and maintain integrity of the overall database.
Replicated data management: The ability to decide which copy of a replicated data item to access and to maintain the consistency of copies of replicated data items.
Distributed database recovery: The ability to recover from individual crashes and from new types of failures such as the failure of a communication links.
Security: Distributed transactions must be executed with the proper management of the security of the data and the authorisation/access privileges of users.
Distributed directory (catalog) management: A directory contains information(meta data) about data in the database. The directory may be global for the entire DDB or local for each site. At the physical hardware level, the following main factors distinguish a DDBMS from a centralised system.
There are multiple computers, called sites or nodes.

Tuesday, May 18, 2010

E. F. Codd’s 12 Rules by anil nain 9416077273

E. F. Codd’s 12 Rules by anil nain 9416077273


E. F. Codd has defined twelve rules that should be satisfied by any DBMS to be benchmarked as a RDBMS. These twelve rules are the guidelines on which all the RDBMS like ORACLE, INGRES, SYBASE, INFORMIX are based.
Rule One: The Information Rule
All information in a relational database is represented explicitly at the logical level and in exactly one way – by values in tables.
Rule Two: The Guaranteed Rule
Each and every datum in a relational database is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name.
Rule Three: Systematic Treatment of Null Values
Null values are supported for representing missing information and inapplicable information in a systematic way independent of data type.
Rule Four: Dynamic On-line Catalog Based on the Relational Model
The database description is represented at the logical level in the same way as ordinary data so that authorized users can apply the same relational language to its interrogation as they apply to the regular date.
Rule Five: Comprehensive Data Sub-language Rule
A relational system may support several languages and various modes terminal use. However, there must be at least one language whose statements can express all of the following:
Data Definition, View Definition, Data Manipulation, Integrity constraint, Authorization, Transaction Boundaries.
Rule Six: View Updating Rule
All views that are theoretically updateable are also updateable by the system.
Rule Seven: High-level Insert, Update, and Delete
The capability of handling a base relation or a derived relation as a single operand applies not only to the retrieval of the data but also to the insertion, updation and deletion.
Rule Eight: Physical Data Independence
Application programmes and terminal activities remain logically unimpaired whenever any changes are made in either storage representation or access methods.
Rule Nine: Logical Data Independence
Application programmes and terminal activities remain logically unimpaired when information-preserving changes of any kind that theoretically permitted modifications are made to the base tables.
Rule Ten: Integrity Independence
Integrity constraints specific to a particular relational database must be definable in the relational data sub-language and storable in the catalogue, not in the application programmes.
Rule Eleven: Distribution Independence
The data manipulation data sub-language of a Relational DBMS must enable application programmes and enquires to remain logically the same whether data is physically centralized or distributed.


Rule Twelve: Non-Subversion Rule
If a Relational system has a low level language, that low level cannot be used to subvert or bypass the integrity rules and constraints expressed in the higher-level relational languages.
E. F. Codd’s 12 Rules by anil nain 9416077273

Friday, March 19, 2010

EVENT AND EVENT HANDLING BY ANIL NAIN 9416077273



What Is an Event?
Application programmers (the folks who make the everyday programs you use for Windows or Macintosh)
have long known that the key to graphical user interface (GUI) programming is events. So, what is an event,
and why are events so important? To answer that question, take a closer look at GUIs.
A GUI is, at its most base form, a large menu that lets the user choose what he wants to do. The problem is that
how the user does this choosing is based on a lot of complex interactions: keys being pressed, keys being
released, the mouse moving, a mouse button being pressed—you get the idea. Each one of these interactions is
an event. It occurs at a specific time and may have information associated with it. (The key that was pressed,
for example.) Now, events aren't limited to forms of user input. Things such as timers, network connections,
and file I/O also can create events. Basically, anytime you are working with something external to your code,
whether that is the hard disk, the user, or even time, you will be working with events.
Methods of Event Handling
There are two main methods to work with events in Flash MX: callbacks and listeners. Both have their
strengths and weaknesses as well as situations for which they are best suited. The most important thing to
remember about both methods is that organization and documentation are key to writing maintainable code.
Callbacks
The first method of working with events is known as a callback. Callbacks take advantage of the fact that
ActionScript is a highly forgiving language. In particular, callbacks execute a function that doesn't exist, and
Flash won't generate an error or even complain. Some forms of callbacks also utilize the fact that you can
overwrite any variable in Flash at any time, which includes functions.
The quick-and-dirty explanation of a callback is when an event occurs, the object that is the event's source tries
to execute a specific function. This may seem a bit confusing, but after you've read a bit more and seen them in
action, you'll see that callbacks are pretty simple.
A good example of a callback in action is the XML class. Now, I'm not going to get into the ins and outs of
XML quite yet, instead I'll go into how the XML class utilizes callbacks.
When you create an XML object your goal is to load XML formatted data into it from a source that can't
deliver the XML instantaneously, such as a hard disk, or more commonly for Flash, an Internet connection.
Therefore, your code needs to be able to deal with this latency. An XML object does this by using an event
callback.

The 15 most difficult questions you'll be asked on a job interview BY anil nain 9416077273

The 15 most difficult questions you'll be asked on a job interview
Being prepared is half the battle.
If you are one of those executive types unhappy at your present post and embarking on a New Year's resolution to find a new one, here's a helping hand. The job interview is considered to be the most critical aspect of every expedition that brings you face-to- face with the future boss. One must prepare for it with the same tenacity and quickness as one does for a fencing tournament or a chess match.
1. Tell me about yourself.
Since this is often the opening question in an interview, be extracareful that you don't run off at the mouth. Keep your answer to a minute or two at most. Cover four topics: early years, education, work history, and recent career experience. Emphasize this last subject. Remember that this is likely to be a warm-up question. Don't waste your best points on it.
2. What do you know about our organization?
You should be able to discuss products or services, revenues, reputation, image, goals, problems, management style, people, history and philosophy. But don't act as if you know everything about the place. Let your answer show that you have taken the time to do some research, but don't overwhelm the interviewer, and make it clear that you wish to learn more.
You might start your answer in this manner: "In my job search, I've investigated a number of companies.
Yours is one of the few that interests me, for these reasons..."
Give your answer a positive tone. Don't say, "Well, everyone tells me that you're in all sorts of trouble, and that's why I'm here", even if that is why you're there.
3. Why do you want to work for us?
The deadliest answer you can give is "Because I like people." What else would you like-animals?
Here, and throughout the interview, a good answer comes from having done your homework so that you can speak in terms of the company's needs. You might say that your research has shown that the company is doing things you would like to be involved with, and that it's doing them in ways that greatly interest you. For example, if the organization is known for strong management, your answer should mention that fact and show that you would like to be a part of that team. If the company places a great deal of emphasis on research and development, emphasize the fact that you want to create new things and that you know this is a place in which such activity is encouraged. If the organization stresses financial controls, your answer should mention a reverence for numbers.
If you feel that you have to concoct an answer to this question - if, for example, the company stresses research, and you feel that you should mention it even though it really doesn't interest you- then you probably should not be taking that interview, because you probably shouldn't be considering a job with that organization.
Your homework should include learning enough about the company to avoid approaching places where you wouldn't be able -or wouldn't want- to function. Since most of us are poor liars, it's difficult to con anyone in an interview. But even if you should succeed at it, your prize is a job you don't really want.
4. What can you do for us that someone else can't?
Here you have every right, and perhaps an obligation, to toot your own horn and be a bit egotistical. Talk about your record of getting things done, and mention specifics from your resume or list of career accomplishments. Say that your skills and interests, combined with this history of getting results, make you valuable. Mention your ability to set priorities, identify problems, and use your experience and energy to solve them.
5. What do you find most attractive about this position? What seems least attractive about it?
List three or four attractive factors of the job, and mention a single, minor, unattractive item.
6. Why should we hire you?
Create your answer by thinking in terms of your ability, your experience, and your energy. (See question 4.)
7. What do you look for in a job?
Keep your answer oriented to opportunities at this organization. Talk about your desire to perform and be recognized for your contributions. Make your answer oriented toward opportunity rather than personal security.
8. Please give me your defintion of [the position for which you are being interviewed].
Keep your answer brief and taskoriented. Think in in terms of responsibilities and accountability. Make sure that you really do understand what the position involves before you attempt an answer. If you are not certain. ask the interviewer; he or she may answer the question for you.
9. How long would it take you to make a meaningful contribution to our firm?
Be realistic. Say that, while you would expect to meet pressing demands and pull your own weight from the first day, it might take six months to a year before you could expect to know the organization and its needs well enough to make a major contribution.
10. How long would you stay with us?
Say that you are interested in a career with the organization, but admit that you would have to continue to feel challenged to remain with any organization. Think in terms of, "As long as we both feel achievement-oriented."
11. Your resume suggests that you may be over-qualified or too experienced for this position. What's Your opinion?
Emphasize your interest in establishing a long-term association with the organization, and say that you assume that if you perform well in his job, new opportunities will open up for you. Mention that a strong company needs a strong staff. Observe that experienced executives are always at a premium. Suggest that since you are so wellqualified, the employer will get a fast return on his investment. Say that a growing, energetic company can never have too much talent.
12. What is your management style?
You should know enough about the company's style to know that your management style will complement it. Possible styles include: task oriented (I'll enjoy problem-solving identifying what's wrong, choosing a solution and implementing it"), results-oriented ("Every management decision I make is determined by how it will affect the bottom line"), or even paternalistic ("I'm committed to taking care of my subordinates and pointing them in the right direction").
A participative style is currently quite popular: an open-door method of managing in which you get things done by motivating people and delegating responsibility.
As you consider this question, think about whether your style will let you work hatppily and effectively within the organization.
13. Are you a good manager? Can you give me some examples? Do you feel that you have top managerial potential?
Keep your answer achievementand ask-oriented. Rely on examples from your career to buttress your argument. Stress your experience and your energy.
14. What do you look for when You hire people?
Think in terms of skills. initiative, and the adaptability to be able to work comfortably and effectively with others. Mention that you like to hire people who appear capable of moving up in the organization.
15. Have you ever had to fire people? What were the reasons, and how did you handle the situation?
Admit that the situation was not easy, but say that it worked out well, both for the company and, you think, for the individual. Show that, like anyone else, you don't enjoy unpleasant tasks but that you can resolve them efficiently and -in the case of firing someone- humanely.

Monday, February 8, 2010

Relational Model Concepts by anil nain

Relational Model Concepts

The relational model is an abstract theory of data that is based on certain aspects of mathematics (principally set theory and predicate logic).

The principles of relational model were originally laid down in 1969-70 by Dr. E.F. Codd at that time a member of IBM. Relational model is a way of looking at data. The relational model is concerned with three aspects of data: Structures, data integrity, manipulation(for example join, projection etc.)

1. Structure aspects: the data in the database is perceived by the user as a table. It means database arranged in the tables & collection of tables called database. Structure means design view of database like data type, its size etc.

2. Integrity aspect: Those tables that satisfy certain integrity constraints like domain constraints, entity integrity, referential integrity and operational constraints.

3. Manipulative aspects: The operators available for the user for manipulating those tables into database e.g. for purpose of retrieval of data like projection, join and restrict.

Top

Relational Model Constraining

PURPOSE: Used to validate data entered for the specified columns (s) namely:

There are two types of constraints

· Table Constraint

· Column

Table Constraint

If the constraint spans across multiple columns, the user will have to use table level constraints. If the data constraint attached to a specific cell in a table references the contents of another cell in the table, then the user will have to use table level constraints.

Primary key as a table level constraint:

E.g. Create table sales-order-details (s_order_no var char2 (6),

Product_no varchar2(6),…. PRIMARY KEY (S_order_no, product no.));

Column Level Constraint

If the constraints are defined with the column definition, it is called as a column level constraint. They are local to a specific column.

Primary key as a column level constraint

Create table client (client _no varchar 2(6) Primary key…);

by anil nain