1

that is a great idea, but I don't believe the organisation I work for has any...shame because it would be reallly helpful.

In that case why not take a small example from their current software and build the seq diagram for an easy part (eg user logon). You could even impress them into using seq diagrams more! For me they are the most useful part of the UML toolset.

is it still worth me looking at the Java theory... or just doing some practice

I say practice. Doesn't matter what as long as (a) it's not TOO simple and (b) you don't skip over the tricky bits like handling errors etc.

0

Here is a modification because it worked for comma delimited, but not for my contacts.csv semicolon delimited.

Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions

Public Class CSV

    Dim separator As String
    Dim nErr As Int32
    Private Sub btnLoad_Click(sender As System.Object, e As System.EventArgs) Handles btnLoad.Click
        Try
            btnLoad.Enabled = False
            OpenFileDialog1.Filter = "CSV Files (*.CSV)|*.CSV|All Files (*.*)|*.*"
            OpenFileDialog1.FilterIndex = 1
            Dim r As DialogResult = OpenFileDialog1.ShowDialog
            If r <> Windows.Forms.DialogResult.OK Then
                Exit Try
            End If
            nErr = 0
            Dim ts As New TimeSpan(Now.Ticks)
            Dim dt As DataTable = parseCSV(OpenFileDialog1.FileName)
            Dim ts2 As New TimeSpan(Now.Ticks - ts.Ticks)
            DataGridView1.DataSource = dt
            MessageBox.Show((ts2.TotalMilliseconds).ToString)
        Catch ex As Exception
        Finally
            btnLoad.Enabled = True
        End Try
    End Sub
    Function parseCSV(filename As String) As DataTable
        Dim dt As DataTable = Nothing
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(filename, FileMode.Open)
            Dim sr As New StreamReader(fs)
            Dim sbCSV As New StringBuilder(sr.ReadToEnd)
            fs.Close()
            separator = tbSeparator.Text
            Dim pos As Int32 = 0
            Dim vFields(-1) As String, iv As Int32 = 0
            Dim firsRow() As String = nextRow(pos, sbCSV)
            dt = New DataTable
            For i As Int32 = 0 To firsRow.Length - 1
                dt.Columns.Add(firsRow(i))
            Next
            Do While pos < sbCSV.Length
                dt.Rows.Add(nextRow(pos, sbCSV))
            Loop
        Catch ex As Exception
            If nErr <> 5 Then
                MessageBox.Show(ex.Message)
            End If
        End Try
        Return dt
    End Function
    Function nextRow(ByRef pos As Int32, sbcsv As StringBuilder) As String()
        Dim vRet(-1) As String, iv As Int32 = 0
        Try
            Do
                Dim field As String = nextField(pos, sbcsv)
                If field = vbCrLf Then
                    Exit Do
                End If
                ReDim ...
0

I have tried to allow carriage returns:

Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions

Public Class CSV

    Dim separator As String
    Private Sub btnLoad_Click(sender As System.Object, e As System.EventArgs) Handles btnLoad.Click
        Try
            btnLoad.Enabled = False
            OpenFileDialog1.Filter = "CSV Files (*.CSV)|*.CSV|All Files (*.*)|*.*"
            OpenFileDialog1.FilterIndex = 1
            Dim r As DialogResult = OpenFileDialog1.ShowDialog
            If r <> Windows.Forms.DialogResult.OK Then
                Exit Try
            End If
            Dim dt As DataTable = parseCSV(OpenFileDialog1.FileName)
            DataGridView1.DataSource = dt
        Catch ex As Exception
        Finally
            btnLoad.Enabled = True
        End Try
    End Sub
    Function parseCSV(filename As String) As DataTable
        Dim dt As DataTable = Nothing
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(filename, FileMode.Open)
            Dim sr As New StreamReader(fs)
            Dim sbCSV As New StringBuilder(sr.ReadToEnd)
            fs.Close()
            separator = tbSeparator.Text
            Dim pos As Int32 = 0
            Dim vFields(-1) As String, iv As Int32 = 0
            Dim firsRow() As String = nextRow(pos, sbCSV)
            dt = New DataTable
            For i As Int32 = 0 To firsRow.Length - 1
                dt.Columns.Add(firsRow(i))
            Next
            Do While pos < sbCSV.Length
                dt.Rows.Add(nextRow(pos, sbCSV))
            Loop
        Catch ex As Exception
        End Try
        Return dt
    End Function
    Function nextRow(ByRef pos As Int32, sbcsv As StringBuilder) As String()
        Dim vRet(-1) As String, iv As Int32 = 0
        Try
            Do
                Dim field As String = nextField(pos, sbcsv)
                If field = vbCrLf Then
                    Exit Do
                End If
                ReDim Preserve vRet(iv)
                vRet(iv) = field
                iv += 1
            Loop
        Catch ex As Exception

        End Try
        Return vRet
    End Function
    Function nextField(ByRef pos As Int32, sbcsv As StringBuilder) As String
        Dim sRet As String = ""
        Try
            Select Case ...
0

Yes, I actually noticed that, in fact one of the applications I'm working at use MVC extensively, but it's just so hard to understand what's going on, and I kind of wondering whether practicing MVC would help me to understand that or whether I should focuss more on how classes interact with one another in large system, as I this in as area where I know I'm weak

0

Hi Friends

I am new to c++ coding, please tell me, i need to create project, if any body can help me, which condition we use the class, when we use the struct, how can use the function,
how can think and get some idea, see brother i am study in online free tutorials , they not explain where to use the for example ( Pointers, Recursion, New, Delete, Polymorphism)........ ......
pls friend guide me to currect way ,

1

I wouldn't get too hung up about design patterns. Use them when they fit is all.
In a large or complex system you will probably find that some were used at quite a low level, and others (eg MVC) at a very high level - in which case you won't see them in the code but you will in the overall module design. Many designers have them in their metal toolkit when designing, but apply them loosely or in a way that's adapted to the situation

0

Thanks, that's helpful :-). Coding-wise, I reckon I'm having a few issues with the MVC model, I mean it's pretty clear what it does and how it works in theory but when you try to look at larger projects it's incredibly difficult to find out what's what. Same things for design patterns in general, it's all OK (well the few design patterns I looked at) when it's a small application but when it grows in size it's a nightmare

1

Well, here are some ideas about debugging in the real world...

Debugging is an art as well as a science! The best deguggers I ever knew were people with huge experience of that kind of program, which enabled them to make really good educated guesses as to the kind of mistakes that usually lead to that kind of problem.

But as a science it's all about small logical reproducable steps. (That's the opposite of making some random change and seeing if that helped.

Start by pinning down the circumstances under which the bug does or does not appear. Keep copies of the cases that fail so you test your fix later. Write them down. You'll need this to test your hypothesis about whet went wrong.
If it's possible to reproduce the bug in a subset of the full system, or in a stand-alone test program, that wil save a lot of time.
If you have a bug that can't be reproduced reliably then settle in for a long and painful process - thread race bugs for example are always a nightmare.
Obviously: read all the log and error files very carefully indeed.
If there is configurable logging turn it to max and reproduce the bug.

Now it's typically a process of working backwards through the code starting from where the bug appears. Reading the code is probably a good idea, but you probably won't see the error - neither did the original programmer or the QA people! Use debug/trace tools ...

0

Hi guys,
I wonder if you can help me.
As I’m now doing java development as a profession now, I’ve realized that I’m a little weak when it comes to fix, modify and understand code within large applications, and, needless to say, I need to find a way to get better at it.
So, I was wondering if any experienced java developer could give me some advices and perhaps help me in getting a little better.
Of course I know the basics, I’ve studied the theory, I know how to create classes, instantiate them, using interfaces etc – although this is more theoretical knowledge than practical in all honesty – but I feel like I’m lacking ‘something’, perhaps just experience…

1

Thanks for the support. I ended up sending the memory stream(s) with the dictionary instead of actual documents. So I saved them for editing purposes using this...

        private void Save (Dictionary<string, MemoryStream> employees)
        {
            string saveToFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "W-2 PDF");
            foreach (var key in employees.Keys)
            {
                var fileStream = File.Create(saveToFolder + "/" + key + ".pdf");
                employees[key].Seek(0, SeekOrigin.Begin);
                employees[key].CopyTo(fileStream);
                fileStream.Close();
            }
        }
0

I agree the dll is unnecessary, but we are using 3 tier arch and was told to create a dll for the legacy program... I'm using itextsharp to add text to the pdf I have stored.

I created a basic console app that created the pdfs flawlessly and saved them, but due to the dll aspect I'm having trouble figuring out how to access the pdf in the dictionary. The code currently is trying to access one of the 3 that were created. Once I can figure out how to save that one pdf from the dictionary the rest will come smoothly.

Here are 2 more classes if u want to test the data

namespace Entities
{
    public class Employee : IAddress
    {
        public double GrossWages { get; set; }
        public double SocialSecurityWages { get; set; }
        public double MedicareWages { get; set; }
        public double FederalTaxWithheld { get; set; }
        public double SocialSecurityTaxWithheld { get; set; }
        public double MedicalTaxWithheld { get; set; }

        public double SocialSecurityTips { get; set; }
        public string NonqualifiedPlans { get; set; }
        public double AllocatedTips { get; set; }
        public string DependentCareBenefits { get; set; }
        public string TwelveALeft { get; set; }
        public double TwelveARight { get; set; }
        public string TwelveBLeft { get; set; }
        public double TwelveBRight { get; set; }
        public string TwelveCLeft { get; set; }
        public double TwelveCRight { get; set; }
        public string TwelveDLeft { get; set; }
        public double TwelveDRight { get; set; }
        public ...
0

While I do have apps out there in C#, why must this be a DLL? That seems unnecessary at first. That is, get your code working before you worry about DLL creation.

I see 200+ lines of code but no mention of your choice of PDF creation software. The last time I did this, I cheated twice. One time I installed a PDF printer, the next time a team member used a PDF library.

0

The goal of this project is to create a dll that will take in employee and employer information then return W2(s) in pdf form. Then the main program will cycle through them and email/print. Currently, the program is adding the SSN and the edited pdf to a dictionary and returning it. When I try to access the pdf from the dictionary to save or email it won't let me. I have a few questions:

  1. Am I headed in the right direction?
  2. How can I save the pdf since it doesn't have a .save similar to images?
  3. Should I attempt serializing instead of dictionary? - I have 0 experience with this though.

        private void createButton_Click(object sender, RoutedEventArgs e)
        {
            var employerInfo = new Employer { City = "Hometown", AddressName = "101 Dalmation ln", State = "MO", Name = "WhileyOnes", ZipCode = "36963", EIN = "1234", SIN = "4321", ControlNumber = "12345" };
            var listOfEmployeeInfo = new List<Employee>()
            {
                new Employee(){
                    GrossWages = 3333.02,
                    SocialSecurityWages = 22.22,
                    MedicareWages = 11.23,
                    FederalTaxWithheld = 633.02,
                    SocialSecurityTaxWithheld = 100.01,
                    MedicalTaxWithheld = 50.00,
                    SocialSecurityTips = 36.99,
                    NonqualifiedPlans = "NONQUALIFIED",
                    AllocatedTips = 50.22,
                    DependentCareBenefits = "",
                    TwelveALeft = "D",
                    TwelveARight = 333.33,
                    TwelveBLeft = "",
                    TwelveBRight = 222.22,
                    TwelveCLeft = "",
                    TwelveCRight = 11.11,
                    TwelveDLeft = "F",
                    TwelveDRight = 123.21,
                    EmployeeSSN = "123456788",
                    StatutoryEmployee = true,
                    RetirementPlan = false,
                    ThirdPartySickPay = false,
                    Other = "23456.22",
                    EmployeeName = "Carl B Flinn",
                    StateWages = 200.02,
                    StateIncomeTax = 350.00,
                    LocalWages = 200.00,
                    LocalIncomeTax = 50.33,
                    LocalityName = ...