Wednesday, November 27, 2019

All About Serializing in Visual Basic

All About Serializing in Visual Basic Serialization is the process of converting an object into a linear sequence of bytes called a byte stream. Deserialization just reverses the process. But why would you want to convert an object into a byte stream? The main reason is so you can move the object around. Consider the possibilities. Since everything is an object in .NET, you can serialize anything and save it to a file. So you could serialize pictures, data files, the current state of a program module (state is like a snapshot of your program at a point in time so you could temporarily suspend execution and start again later) ... whatever you need to do. You can also store these objects on disk in files, send them over the web, pass them to a different program, keep a backup copy for safety or security. The possibilities are quite literally endless. Thats why serialization is such a key process in .NET and Visual Basic. Below is a section on custom serialization by implementing the ISerializable interface and coding a New and a GetObjectData subroutine. As a first example of serialization, lets do one of the easiest programs, but also one of the most useful: serializing data, and then deserializing data in simple class to and from a file. In this example, the data is not only serialized, but the structure of the data is saved too. The structure here is declared in a module to keep things ... well ... structured. Module SerializeParmsSerializable() Public Class ParmExample  Ã‚  Ã‚  Public Parm1Name As String Parm1 Name  Ã‚  Ã‚  Public Parm1Value As Integer 12345  Ã‚  Ã‚  Public Parm2Name As String  Ã‚  Ã‚  Public Parm2Value As DecimalEnd ClassEnd Module Then, individual values can be saved to a file like this: Imports System.Runtime.Serialization.Formatters.BinaryImports System.IOPublic Class Form1  Ã‚  Ã‚  Private Sub mySerialize_Click( _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal sender As System.Object, _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal e As System.EventArgs) _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Handles mySerialize.Click  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim ParmData As New ParmExample  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ParmData.Parm2Name Parm2 Name  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ParmData.Parm2Value 54321.12345  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim s As New FileStream(ParmInfo, FileMode.Create)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim f As New BinaryFormatter  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  f.Serialize(s, ParmData)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  s.Close()  Ã‚  Ã‚  End SubEnd Class And those same values can be retrieved like this: Imports System.Runtime.Serialization.Formatters.BinaryImports System.IOPublic Class Form1  Ã‚  Ã‚  Private Sub myDeserialize_Click( _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal sender As System.Object, _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal e As System.EventArgs) _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Handles myDeserialize.Click  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim s New FileStream(ParmInfo, FileMode.Open)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim f As New BinaryFormatter  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Dim RestoredParms As New ParmExample  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  RestoredParms f.Deserialize(s)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  s.Close()  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Console.WriteLine(RestoredParms.Parm1Name)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Console.WriteLine(RestoredParms.Parm1Value)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Console.WriteLine(RestoredParms.Parm2Name)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Console.WriteLine(RestoredParms.Parm2Value)  Ã‚  Ã‚  End SubEnd Class A Structure or a collection (such as an ArrayList) rather than a Class could also be serialized to a file this same way. Now that we have gone over the basic serializing process, lets look at the specific details that are part of the process on the next page. One of the first things you should notice about this example is the Serializable() attribute in the Class. Attributes are just more information that you can provide to VB.NET about an object and theyre used for a lot of different things.  The attribute in this code tells VB.NET to add extra code so that later on, everything in this class can be serialized. If there are specific items in the Class that you dont want to be serialized, you can use the NonSerialized() attribute to exclude them: NonSerialized() Public Parm3Value As String Whatever In the example, notice is that Serialize and Deserialize are methods of the BinaryFormatter object (f in this example). f.Serialize(s, ParmData) This object takes the FileStream object and the object to be serialized as parameters. Well see that VB.NET offers another object that allows the result to be expressed as XML. And one final note, if your object includes other subordinate objects, theyll be serialized too! But since all objects that are serialized must be marked with the Serializable() attribute, all of these child objects must be marked that way too. Just to be completely clear about what is happening in your program, you might want to display the file named ParmData in Notepad to see what serialized data looks like. (If you followed this code, it should be in the bin.Debug folder in your project.) Since this is a binary file, most of the content isnt readable text, but you should be able to see any strings in your serialized file. Well do an XML version next and you might want to compare the two just to be aware of the difference. Serializing to XML instead of a binary file requires very few changes. XML isnt as fast and cant capture some object information, but its far more flexible. XML can be used by just about any other software technology in the world today. If you want to be sure your file structures dont tie you into Microsoft, this is a good option to look into. Microsoft is emphasizing LINQ to XML to create XML data files in their latest technology but many people still prefer this method. The X in XML stands for eXtensible. In our XML example, were going to use one of those extensions of XML, a technology called SOAP. This used to mean Simple Object Access Protocol but now its just a name. (SOAP has been upgraded so much that the original name doesnt fit that well anymore.) The main thing that we have to change in our subroutines is the declation of the serialization formatter. This has to be changed in both the subroutine that serializes the object and the one that deserializes it again. For the default configuration, this involves three changes to your program. First, you have to add a Reference to the project. Right-click the project and select Add Reference .... Make sure ... System.Runtime.Serialization.Formatters.Soap ... has been added to the project. Then change the two statements in the program that references it. Imports System.Runtime.Serialization.Formatters.SoapDim f As New SoapFormatter This time, if you check out the same ParmData file in Notepad, youll see that the whole thing is in readable XML text such as ... Parm1Name idref-3Parm1 Name/Parm1NameParm1Value12345/Parm1ValueParm2Name idref-4Parm2 Name/Parm2NameParm2Value54321.12345/Parm2Value There is also a lot of additional XML there thats necessary for the SOAP standard in the file as well. If you want to verify what the NonSerialized() attribute does, you can add a variable with that attribute and look at the file to verify that its not included. The example we just coded only serialized the data, but suppose you need to control how the data is serialized. VB.NET can do that too! To accomplish this, you need to get a little deeper into the concept of serialization. VB.NET has a new object to help out here: SerializationInfo. Although you have the ability to code custom serialization behavior, it comes with a cost of extra coding. The basic extra code is shown below. Remember, this class is used instead of the ParmExample class shown in the earlier example. This isnt a complete example. The purpose is to show you the new code that is needed for custom serialization. Imports System.Runtime.SerializationSerializable() _Public Class CustomSerialization  Ã‚  Ã‚  Implements ISerializable  Ã‚  Ã‚   data to be serialized here  Ã‚  Ã‚   Public SerializedVariable as Type  Ã‚  Ã‚  Public Sub New()  Ã‚  Ã‚   default constructor when the class  Ã‚  Ã‚   is created - custom code can be  Ã‚  Ã‚   added here too  Ã‚  Ã‚  End Sub  Ã‚  Ã‚  Public Sub New( _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal info As SerializationInfo, _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal context As StreamingContext)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   initialize your program variables from  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   a serialized data store  Ã‚  Ã‚  End Sub  Ã‚  Ã‚  Public Sub GetObjectData( _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal info As SerializationInfo, _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ByVal context As StreamingContext) _  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Implements ISerializable.GetObjectData  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   update the serialized data store  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   from program variables  Ã‚  Ã‚  End SubEnd Class The idea is that now you can (and, in fact, you must) do all of the updating and reading of data in the serialized data store in the New and GetObjectData subroutines. You must also include a generic New constructor (no parameter list) because youre implementing an interface. The class will normally have formal properties and methods coded as well ... Generic PropertyPrivate newPropertyValue As StringPublic Property NewProperty() As String  Ã‚  Ã‚  Get  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Return newPropertyValue  Ã‚  Ã‚  End Get  Ã‚  Ã‚  Set(ByVal value As String)  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  newPropertyValue value  Ã‚  Ã‚  End SetEnd Property Generic MethodPublic Sub MyMethod()  Ã‚  Ã‚  method codeEnd Sub The resulting serialized class can create unique values in the file based on the code you supply. For example, a real-estate class might update a the value and address of a house but the class would serialize a calculated market classification as well. The New subroutine will look something like this: Public Sub New( _  Ã‚  Ã‚  ByVal info As SerializationInfo, _  Ã‚  Ã‚  ByVal context As StreamingContext)  Ã‚  Ã‚   initialize your program variables from  Ã‚  Ã‚   a serialized data store  Ã‚  Ã‚  Parm1Name info.GetString(a)  Ã‚  Ã‚  Parm1Value info.GetInt32(b)  Ã‚  Ã‚   New sub continues ... When Deserialize is called on a BinaryFormatter object, this sub is executed and a SerializationInfo object is passed to the New subroutine. New can then do whatever is necessary with the serialized data values. For example ... MsgBox(This is Parm1Value Times Pi: _  Ã‚  Ã‚   (Parm1Value * Math.PI).ToString) The reverse happens when Serialize is called, but the BinaryFormatter object calls GetObjectData instead. Public Sub GetObjectData( _  Ã‚  Ã‚  ByVal info As SerializationInfo, _  Ã‚  Ã‚  ByVal context As StreamingContext) _  Ã‚  Ã‚  Implements ISerializable.GetObjectData  Ã‚  Ã‚   update the serialized data store  Ã‚  Ã‚   from program variables  Ã‚  Ã‚  If Parm2Name Test Then  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  info.AddValue(a, This is a test.)  Ã‚  Ã‚  Else  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  info.AddValue(a, No test this time.)  Ã‚  Ã‚  End If  Ã‚  Ã‚  info.AddValue(b, 2) Notice that the data is added to the serialized file as name/value pairs. A lot of the web pages Ive found in writing this article dont seem to have actual working code. One wonders whether the author actually executed any code before writing the article sometimes.

Saturday, November 23, 2019

Optimization of Human Resource Allocation in Software Development essay

Optimization of Human Resource Allocation in Software Development essay Optimization of Human Resource Allocation in Software Development essay Optimization of Human Resource Allocation in Software Development essaySoftware development industry is one of the core industries in the modern world. New software products are used for automating processes in virtually all spheres of human life. This fact contributes to the diversity of domains for software projects. Rapid evolution of software frameworks, technologies and approaches creates a constant need for change. Hence, companies operating in software development industry have to deal with short-term projects, projects with very specific knowledge requirements, projects requiring special expertise, etc. This diversity creates a situation when software developments and other IT professionals are involved in the projects from time to time, often combine working on several projects and deal with various technologies simultaneously. Due to high flexibility of workforce in software projects and very specific requirements to project members, there emerge situations when the resourc es are allocated inefficiently.Problem StatementThe problem considered in this report is the following. The company provides the services of software development to a large number of clients. Due to the varied nature of projects, short-term project life cycle and specific skill sets needed in software projects there emerges the problem of inefficient resource allocation.According to Fairley (2011), companies providing the services of custom software development and companies offering consulting services in software development allocate 85% or more of their operating costs to development costs. In other words, business costs of such companies are formed by the salaries paid to software developers and other IT professionals (Fairley, 2011). However, the company has numerous inefficiencies in the process of workforce allocation to projects. This means that the company spends excess money on development and reduces the chances of successful project completion. Such state of affairs redu ces the companys competitiveness and viability. Therefore, it is important to address and resolve this workplace issue.There are several sources of inefficiency in the current process of resource allocation. The company deals with different projects, the duration of which varies from 2 weeks to 6 months on average. These projects are broken into stages; commonly, these stages include setting requirements and planning, software design, implementation, verification and sometimes maintenance (Martin, 2009). At each stage, the number of IT professionals required is different, and the skill sets needed during different phases also change. However, project team is usually assigned at the first stage, and there are additional resource allocations during implementation and verification phases.Sometimes project members lack the necessary skills for implementation and verification. They have to deal with technologies where they have little experience or perform supplementary tasks. It also ha ppens that team members have no business expertise in the required domain, and there are no professionals with the required technical skills and business knowledge available. In such cases, team members have to master the new domain, which increases their value for future projects but reduces the effectiveness of solutions in the existing project. Finally, the work load is not uniform: there are times when team members have to work overtime and times when team members have to wait until other developers complete their parts of work. Such situation leads to professional burnout after overtimes (which are followed by escalating project costs) and to low performance during the idle time.This report is devoted to analyzing the problem of inefficient resource allocation in a software development company, considering several workplace programs and procedures aimed at resolving this problem and selecting one of the alternatives according to five criteria of software project effectiveness r elevant to the situation. Therefore, this report contributes to improving workplace effectiveness in companies providing the services of custom software development.Overview of AlternativesAlternative AThe first alternative that is commonly used in software development industry relies on the services of outsourcers or freelancers. Analysis of the key factors causing inefficiencies in resource allocation shows that there are three major causes: inflexible or premature allocation of resources, absence of prospective team members with the required characteristics (combined with the inefficiency of hiring developers with these characteristics due to short-time nature of the tasks) and fluctuating workload.The industry-wide practice is to invite freelancers or using the services of outstaffing companies to resolve such issues (Futrell, Shafer Shafer, 2002). Possible implementation of such approach include (Futrell, Shafer Shafer, 2002): placing ads for the required freelance services, contacting potential team members in person or using the services of an outsourcing company. It would be most efficient to use the latter option and sign a contract with several outstaffing companies. These companies would help to add external team members when necessary.Alternative BAnother alternative is using more efficient resource leveling practices and detailed assessment of employee skills and abilities. The proposed program is the following: project managers should divide the stages of the project into smaller sub-stages, assign project roles and responsibilities in accordance with these sub-stages (Schiel, 2009). It is essential that project managers adjust project roles after every sub-stage of the project and align the changes with the schedule containing   activities of potential team members (including previous projects and future projects) (Schiel, 2009). HRM professionals should improve skills assessment process and introduce sub-skills in development and different business domains. These skills should be weighed against current project role requirements so that project managers could assign team members who can add maximal value to the project.CriteriaCriterion 1. Compliance with customer requirementsThis criterion determines to which degree the companys ability to adhere to customer requirements will be changed after implementing the new program.Criterion 2. Adherence to initial budget estimates.This criterion determines the extent to which project teams will be able to match initial budgets after implementing the new program.Criterion 3. Compliance with project timingThis criterion describes the degree of complying with schedule that teams will demonstrate after implementing the new program.Criterion 4. Business risk exposureThis criterion assesses the change in the degree of exposure to business risks achieved due to implementing the new program.Criterion 5. Project risk exposureThis criterion assesses the change in the degree of exposure to project risks achieved due to implementing the new program.Research MethodsThe methods used to research the information needed to determine the best recommended alternative included reviewing literature, analyzing research evidence pertaining to the impact of the use of outstaffing and advanced resource leveling on project resource allocation. In addition, the sources related to the influence of outstaffing and/or resource leveling on software quality, project time and budget, project risks and corporate risks were considered. The information was collected from software project management books, human resource management books and journals, computer science journals and case studies evaluating the effect of project management solutions.

Thursday, November 21, 2019

Entrepreneurial Interview Research Paper Example | Topics and Well Written Essays - 750 words

Entrepreneurial Interview - Research Paper Example The sight of bricks and blocks being placed on top of each other thus making walls and rising into structures fascinated me. I loved the smell of the wet cement as the walls were plastered and would often sit inside the cured plastered building to keep safe from the scorching heat of the sun outside. I was good in studies. After my higher secondary school exam, I got admission in an engineering university. I became a Civil Engineer in four years. When I was granted admission, at that time the scope of Civil Engineering was lesser than that of Electrical or Mechanical Engineering. However, while I was studying, the scope of Civil Engineering increased manifolds particularly as new opportunities of construction and development surfaced after wars in Iraq and Afghanistan. I had joined that course with the view that whether or not I would get the job, I would establish my own business utilizing the skills and experience of my father. When I graduated in 2008, I opted to seek practical experience in field before establishing my own company. I deemed it necessary to seek practical experience first in order to familiarize myself with the complications of the construction work and the way day-to-day challenges are met in construction work. I was fortunate to work at a big project â€Å"Canyon Views† by a prestigious client EMAAR in Islamabad. Meanwhile, I got myself registered with Pakistan Engineering Council (PEC). After about a year of experience, I decided to establish my own company. I compiled the necessary documents and applied for a company in PEC. Within a period of three to four months, I had my own company established. I set up my own office of design and consultation. My father had been constructing houses for over 20 years. I started to supervise the construction and brought improvement in the structural design of the houses so as to make them structurally safer than the old designs. After the houses were constructed,