Wednesday, November 27, 2019

Using Namespaces in VB.NET

Using Namespaces in VB.NET The most common way VB.NET namespaces are used by most programmers is to tell the compiler which .NET Framework libraries are needed for a particular program. When you choose a template for your project (such as Windows Forms Application) one of the things that youre choosing is the specific set of namespaces that will be automatically referenced in your project. This makes the code in those namespaces available to your program. For example, some of the namespaces and the actual files they are in for a Windows Forms Application are: System in System.dllSystem.Data in System.Data.dllSystem.Deployment System.Deployment.dllSystem.Drawing System.Drawing.dllSystem.Windows.Forms System.Windows.Forms.dll You can see (and change) the namespaces and references for your project in the project properties under the References tab. This way of thinking about namespaces makes them seem to be just the same thing as code library but thats only part of the idea. The real benefit of namespaces is organization. Most of us wont get the chance to establish a new namespace hierarchy because its generally only done once in the beginning for a large and complicated code library. But, here, youll learn  how to interpret the namespaces that you will be asked to use in many organizations. What Namespaces Do Namespaces make it possible to organize the tens of thousands of .NET Framework objects and all the objects that VB programmers create in projects, too, so they dont clash. For example, if you search .NET for a Color object, you find two. There is a Color object in both: System.DrawingSystem.Windows.Media If you add an Imports statement for both namespaces (a reference may also be necessary for the project properties) ... Imports System.DrawingImports System.Windows.Media ... then a statement like ... Dim a As Color ... will be flagged as an error with the note, Color is ambiguous and .NET will point out that both namespaces contain an object with that name. This kind of error is called a name collision. This is the real reason for namespaces and its also the way namespaces are used in other technologies (such as XML). Namespaces make it possible to use the same object name, such as Color, when the name fits and still keep things organized. You could define a Color object in your own code and keep it distinct from the ones in .NET (or the code of other programmers). Namespace MyColorPublic Class ColorSub Color() Do somethingEnd SubEnd ClassEnd Namespace You can also use the Color object somewhere else in your program like this: Dim c As New MyColor.Colorc.Color() Before getting into some of the other features, be aware that every project is contained in a namespace. VB.NET uses the name of your project (WindowsApplication1 for a standard forms application if you dont change it) as the default namespace. To see this, create a new project (we used the name NSProj and check out the Object Browser tool): Click Here to display the illustrationClick the Back button on your browser to return The Object Browser shows your new project namespace (and the automatically defined objects in it) right along with the .NET Framework namespaces. This ability of VB.NET to make your objects equal to .NET objects is one of the keys to the power and flexibility. For example, this is why Intellisense will show your own objects as soon as you define them. To kick it up a notch, lets define a new project (We named ours NewNSProj in the same solution (use File Add New Project ...) and code a new namespace in that project. And just to make it more fun, lets put the new namespace in a new module (we named it NewNSMod). And since an object must be coded as a class, we also added a class block (named NewNSObj). Heres the code and Solution Explorer to show how it fits together: Click Here to display the illustrationClick the Back button on your browser to return Since your own code is just like Framework code, its necessary to add a reference to NewNSMod in NSProj to use the object in the namespace, even though theyre in the same solution. Once thats done, you can declare an object in NSProj based on the method in NewNSMod. You also need to build the project so an actual object exists to reference. Dim o As New NewNSProj.AVBNS.NewNSMod.NewNSObjo.AVBNSMethod() Thats quite a Dim statement though. We can shorten that by using an Imports statement with an alias. Imports NS NewNSProj.AVBNS.NewNSMod.NewNSObj...Dim o As New NSo.AVBNSMethod() Clicking the Run button displays the MsgBox from the AVBNS namespace, Hey! It worked! When and Why to Use Namespaces Everything so far has really just been syntax - the coding rules that you have to follow in using namespaces. But to really take advantage, you need two things: A requirement for namespace organization in the first place. You need more than just a Hello World project before the organization of namespaces starts to pay off.A plan to use them. In general, Microsoft recommends that you organize your organizations code using a combination of your company name with the product name. So, for example, if youre the Chief Software Architect for Dr. Nos Nose Knows Plastic Surgery, then you might want to organize your namespaces like ... DRNoConsultingReadTheirWatchNChargeEmTellEmNuthinSurgeryElephantManMyEyeLidsRGone This is similar to .NETs organization ... ObjectSystemCoreIOLinqDataOdbcSql The multilevel namespaces are achieved by simply nesting the namespace blocks. Namespace DRNoNamespace SurgeryNamespace MyEyeLidsRGone VB CodeEnd NamespaceEnd NamespaceEnd Namespace or Namespace DRNo.Surgery.MyEyeLidsRGone VB CodeEnd Namespace

Saturday, November 23, 2019

My Last Duchess Essays

My Last Duchess Essays My Last Duchess Paper My Last Duchess Paper Robert Browning’s â€Å"My Last Duchess† Published 1842 Our world is changing and evolving at an astounding rate. Within the last 200 years, we have seen two World Wars and countless disputes over false borders created by colonialists, slavery, and every horrid form of human suffering imaginable!! Human lifestyles and cultures are changing every minute. While our grandparents and ancestors were growing up, do you ever think they imagined the world we live in today? What is to come is almost inconceivable to us now. In this world, the only thing we can be sure of is that things will change. With all of these transformations occurring, it is a wonder that a great poet like Robert Browning may write words so many years ago, that are still relevant to you and I in todays modern society. Browning’s first dramatic monologue â€Å"My last duchess† was written during the Italian Renaissance when egotism, marriage and aristocracy influenced the society. The monologue is loosely based on historical events involving Alfonso, the Duke of Ferrara, who lived in the 16th century. The Duke is the reciter of the monologue, and tells us he is entertaining an emissary who has come to negotiate the Duke’s marriage (he has recently been widowed) to the daughter of another powerful family. As he shows the visitor through his palace, he stops before a portrait of the late Duchess, apparently a young and lovely girl. The Duke begins reminiscing about the portrait sessions, then about the Duchess herself. His musings give way to a diatribe on her disgraceful behaviour: he claims she flirted with everyone and did not appreciate his â€Å"gift of a nine-hundred-years- old name. † As his monologue continues, the reader realizes with ever-more chilling certainty that the Duke in fact caused the Duchess’s early demise: when her behaviour escalated, â€Å"[he] gave commands; / Then all smiles stopped together. † But Browning has more in mind than simply creating a colourful character and placing him in a picturesque historical scene. Rather, the specific historical setting of the poem harbours much significance: the Italian Renaissance held a particular fascination for Browning and his contemporaries, for it represented the flowering of the aesthetic and the human alongside, or in some cases in the place of, the religious and the moral. Thus the temporal setting allows Browning to again explore sex, violence, and aesthetics as all entangled, complicating and confusing each other: the lushness of the language belies the fact that the Duchess was punished for her natural sexuality. The Duke’s ravings suggest that most of the supposed transgressions took place only in his mind. Like some of Browning’s fellow Victorians, the Duke sees sin lurking in every corner. The reason the speaker here gives for killing the Duchess ostensibly differs from that given by the speaker of â€Å"Porphyria’s Lover† for murder Porphyria; however, both women are nevertheless victims of a male desire to inscribe and fix female sexuality. The desperate need to do this mirrors the efforts of Victorian society to mould the behaviour- sexual and otherwise- of individuals. For people confronted with an increasingly complex and anonymous modern world, this impulse comes naturally: to control would seem to be to conserve and stabilize. The Renaissance was a time when morally dissolute men like the Duke exercised absolute power, and as such it is a fascinating study for the Victorians: works like this imply that, surely, a time that produced magnificent art like t he Duchess’s portrait couldn’t have been entirely evil in its allocation of societal control- even though it put men like the Duke in power.

Thursday, November 21, 2019

Being in high school and being in college Essay

Being in high school and being in college - Essay Example Thus student’s life is characterized by two distinctive phases, one being the school life and other being college life. Though education and gaining of knowledge is the primary thing, which is common between a student attending a high school or college, still there are many differences which exists between them. This is because both the high school and college are two different types of worlds, with their own distinctive characteristics which make them unique. Teachers, classes and a whole range of other factors are the ones, which makes a deep impact in the minds of students, while being in high school or in college. But it will be seen in most cases that, there will be quite different types of liking for the students, during their life in college and in high school. (www.associatedcontent.com) High school is often characterized by strict supervision by the faculty and it is often characterized by lesser freedom, being experienced by the students in general. The environment o f college is totally different from that of high school, where the students enjoy more freedom and expression of thought, which is very vital for any individual’s growth. Students mostly prefer college than high school, since there are various reasons that they feel, they can enjoy being in college rather than at high school. These factors like selection of the classes and various courses, attendance to the classes, general open climate that exists in the college and many others are the things, which make them to have more liking for college than towards high school. Students who attend college are bound by lesser restrictions, than those attending high school. (www.associatedcontent.com) Since the high school lays the base for any individual, it is considered as something that is very much significant for rightly molding them and which cannot be missed. But in the case of college the scenario is totally different. It is up to the wish of individuals to opt for the higher stu dies in college, if they have an idea to further their career. During college studies, individuals have to shoulder more responsibilities when compared to high school, where parents and teachers are there to guide and lead individuals in the right direction. When it comes to the aspect of fees, the college fees is always found to be much higher than that of high school. If the individual opts for attending any public school, which is run by means of the government then it is totally free. But this is not the case of college, which puts much pressure on the individuals as well as their parents for funding the studies. Thus any individual who hails from a low income family, can very well attend high school but it becomes a much tougher choice when opting for higher studies in college, since they will have to pay much more. This is a big disadvantage that crops up in the case of college studies. (www.associatedcontent.com) Time management is yet another area of great contrast wherein t he case of college, students have to manage their own time whereas in high school, the student’s time is managed by their parents and guardians. The student class strength is also found to be very high in the case of college while in case of the high school, the maximum strength varies anywhere between thirty and forty. In high school the notes can be copied easily from other class mates, even if one misses out some classes but this is not the same in case of college. As a result attending each and every lecture is of utmost important in the case of college than high school, where classes missed can be easily overcome through classmates and consultation with teachers. In the case of coll