17
votes
Accepted
15
votes
Accepted
Stock control system
Start using New IO
The java.io packages have been replaced for a reason. They don't integrate well into what the language tries to become and are at best unwieldy. ...
15
votes
Accepted
#TODO Remove duplication in XML parsing
Low hanging fruit
Most of this will come down to reading PEP8, however I'll state them here anyway.
From the top down:
If statements don't need brackets, so don't put them around them.
Functions at ...
13
votes
xml is XML is xml is XML
Naming
There are .NET Naming Guidelines which state that methods should be named using PascalCase casing. You haven't done this for ...
11
votes
Stock control system
Firstly, I'm not familiar with the JavaFX nor PostgreSQL technologies, so my comments will be aimed more at Java-specific code practices. See also the answers by Vogel612 and Antot.
Use "try-with-...
10
votes
Stock control system
I totally agree with Vogel612's observations.
Since there is a lot of code for this review, I'd like to add a couple of items.
DatabaseAdapter Class
In ...
10
votes
Learning by translating - Follow the Rubberduck - Part 2: Beta
public static final String RUBBERDUCK_PATH = "RetailCoder.VBE/UI";
This value shouldn't be compiled into the binary. It should be a configurable setting that's ...
9
votes
Accepted
SQL query to compare two XML columns
Try this query instead on your data and tell how it performs. Not sure it will return exactly the same as your query but it should be close enough so you can adjust to what you want.
...
9
votes
Accepted
Convert XML to CSV
First of all, I'd split the convert method out into it's own thing - separate from the loading and saving:
...
8
votes
Accepted
Return XML file from Web API
Dependency Inversion Priciple
The smell is that your code violates the Dependency Inversion Priciple which reads
Entities must depend on abstractions not on concretions. It states that the high ...
8
votes
Accepted
xml is XML is xml is XML
One should also add that:
Both the ReturnNameAsString and the buildString methods could be ...
7
votes
O PC, why are you so slow?
It's going to be hard to improve this very much, because your code is likely limited by the network IO you're doping to connect to OPC. On my machine I've disabled the OPC calls (I don't have it ...
7
votes
Determine if a file is either in JSON or XML format
Well, if you only need to distinguish between JSON and XML formats I'd keep it simple. If the encoding of that string is known ...
7
votes
Locating people by roleId
You can introduce range variables to hold data which you need several times in your query:
...
7
votes
Accepted
Getting information about music that is popular in a country
Imports
First, let me suggest you look at the PEP 8 style guide. I don't follow all of the suggestions myself, but some of them make good sense, including the suggestions on the arrangement and ...
7
votes
XML design for parsing in C#
You are trying to recreate functionality that is already provided out of the box.
Reference Configure an ASP.NET Core App
From documentation it supports providers for INI, JSON, and XML.
Each ...
6
votes
Accepted
Learning by translating - Follow the Rubberduck - Part 2: Beta
Main
What is the purpose of:
private Main() {
}
I can currently think of two possibilities:
To prevent inheritance: Easily fixed with the ...
6
votes
VB.NET code to AES encrypt and decrypt
This is draft 2 of my answer, didn't notice the beginner so I'll try to be gentle:
Why do you use a Module instead of a Class? ...
6
votes
Classes for reading XML from a file
It's a small code snippet but IMO you may improve few things about style:
Usually (in .NET environment) properties are TitleCase as well as classes.
Whatever your favorite naming convention is you ...
6
votes
Converting XML to DOT
There's an XML syntax for DOT called DotML at http://martin-loetzsch.de/DOTML/. Generating a generic DotML tree from XML is very straightforward using XSLT. Most of it is just:
...
6
votes
Program to search many files and remove a certain string
I cannot look at it. You treat a XML like it was a normal text file. This is insane.
You should parse it with the XDocument.Load, find all the ...
6
votes
Parsing XML commands and parameters
Multiple things to fix:
variable naming - class names should be in camel-case and start with a capital letter (reference); when there are multiple words in a variable, you should put underscore ...
5
votes
Converting partial XML (Node List) to a String
Reading the documentation for
Transformer,
where it says:
A Transformer may be used multiple times. Parameters and output
properties are preserved across ...
5
votes
Python script to delete sections of text
Iterating
Flag variables make stylistically poor code: you test for some condition, set some flag, with the understanding that some other code will later check the flag and vary its behaviour as a ...
5
votes
Python script to delete sections of text
Program flow
You have a lot of booleans being thrown around and you could clear out a lot. if nextFlag == True is the same as ...
5
votes
Fetching, adding, and viewing games
Disclaimer: I don't review Xaml, I focus on the C# part only.
...
5
votes
Import multiple XML files into Excel
Not knowing what your XMl files are like or what you're trying to extract from them, this is mostly speculative:
Generally, you want to strip away as much unwanted data as early as possible in the ...
5
votes
Gracefully handling xml api that returns error or success responses
This coding style is unusual for C#:
private string apiUrl, apiUser, apiPass;
The standard is to have one per line:
...
5
votes
Xml serialize to object
I would suggest not to recreate the instance of XmlSerializer each time, because it creates an assembly in memory that is not reused / unloaded. To avoid that, just ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
xml × 443c# × 117
python × 87
java × 74
parsing × 68
performance × 38
php × 32
beginner × 30
android × 30
python-3.x × 22
linq × 22
javascript × 17
object-oriented × 17
c++ × 16
dom × 13
xslt × 13
.net × 12
json × 12
csv × 12
sql × 11
serialization × 11
strings × 10
layout × 10
xsd × 10
ruby × 9