Hot answers tagged

17 votes
Accepted

O PC, why are you so slow?

...
Mast's user avatar
  • 13.1k
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. ...
Vogel612's user avatar
  • 25.2k
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 ...
Peilonrayz's user avatar
  • 42.7k
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 ...
Heslacher's user avatar
  • 50.3k
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-...
itchimus's user avatar
  • 111
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 ...
Antot's user avatar
  • 3,637
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 ...
Mathieu Guindon's user avatar
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. ...
Mikael Eriksson's user avatar
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: ...
Pj-'s user avatar
  • 106
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 ...
t3chb0t's user avatar
  • 44.1k
8 votes
Accepted

xml is XML is xml is XML

One should also add that: Both the ReturnNameAsString and the buildString methods could be ...
t3chb0t's user avatar
  • 44.1k
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 ...
Dan Oberlam's user avatar
  • 7,764
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 ...
Grajdeanu Alex's user avatar
7 votes

Locating people by roleId

You can introduce range variables to hold data which you need several times in your query: ...
Sergey Berezovskiy's user avatar
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 ...
aghast's user avatar
  • 12.3k
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 ...
Nkosi's user avatar
  • 3,236
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 ...
TheCoffeeCup's user avatar
  • 9,454
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? ...
Der Kommissar's user avatar
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 ...
Adriano Repetti's user avatar
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: ...
Michael Kay's user avatar
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 ...
t3chb0t's user avatar
  • 44.1k
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 ...
alecxe's user avatar
  • 17.2k
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 ...
ferada's user avatar
  • 11k
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 ...
200_success's user avatar
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 ...
SuperBiasedMan's user avatar
5 votes

Fetching, adding, and viewing games

Disclaimer: I don't review Xaml, I focus on the C# part only. ...
Heslacher's user avatar
  • 50.3k
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 ...
Kaz's user avatar
  • 8,810
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: ...
BCdotWEB's user avatar
  • 11.2k
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 ...
JanDotNet's user avatar
  • 8,538

Only top scored, non community-wiki answers of a minimum length are eligible