35
votes
Accepted
Filtering a large (50gb+) JSON lines file matching CIDR's
Is there a faster way of accomplishing this? Would Multithreading/Multiprocessing speed things up? Any help or other feedback would be much appreciated!
No, for the most part, multi-threading will ...
17
votes
Accepted
User login database intended for beginners
Avoid wildcard imports
from ... import * is not recommended.
Especially when there are imports from multiple packages,
it makes it difficult to know where some ...
16
votes
Accepted
Prettify JSON class
Thanks for editing the question. I have few ideas how you might want to polish your code.
std::string base class
It caught my eye that JSONPretify is derived ...
16
votes
Accepted
Parsing overly complex JSON
Globals
# TO-DO: GET RID OF GLOBAL STATE
Yep. You seem to already understand this one. Having a reset betrays a place in your ...
15
votes
JSON Parsing in Bash
Bash is not well-suited for transforming JSON. But jq is. But calling jq 3 times for each line of input is certainly going to be ...
13
votes
Accepted
Current ISS latitude / longitude position
Currently your code is not re-useable. To make it re-useable you should move the logic inside a function.
To do this the function we will have two functions here: ...
13
votes
Accepted
Minecraft block generator
I won't repeat @victor's answer, but Python is a language that comes with batteries included; meaning that a lot of behaviour has already been bundled into modules, and is maintained for correctness ...
12
votes
User login database intended for beginners
Your code is confusing, since it refers to encryption in multiple places, e.g. the filename encryption.py, the function name ...
12
votes
Accepted
CodeReview question markdown downloader
PyCharm complains on this line:
m = json.loads(data)
If the above call to fetch_compressed_data fails, and the resulting ...
11
votes
Accepted
A minimal CLI password storage and retrieval manager
I would pinpoint the major problems in the code which I would address first:
do not manually handle provided command-line arguments - there is a great built-in module for it - ...
11
votes
Parsing a JSON file upload
Here are my comments, in order of severity:
Bugs
(or bug-like behavior)
Resource leaks:
You do not close any of the IO resources that you use (DB connection and various ...
10
votes
Current ISS latitude / longitude position
The code is clean and understandable. There are only minor improvements that we can apply.
use more descriptive variable names: latitude_direction and ...
10
votes
Accepted
Repeatable HTTP requests in Python
If you are making many requests, it is worth it to have a look at requests.Session. This re-uses the connection to the server for subsequent requests (and also the ...
10
votes
Minecraft block generator
If all you need is just readability and maintainability, and general best practice, don't reinvent the wheel. You have the json library and it would be a sin not to use it. Firstly, you are greatly ...
10
votes
CodeReview question markdown downloader
Just a couple stylistic points
Function/Variable Naming
Functions and variables should be in snake_case (PEP 8).
...
9
votes
Spring Boot RESTful service
Should be changed:
Request mappings are not that RESTful due to the verbs:
POST /api/cars/add-car => POST /api/cars
...
9
votes
Accepted
Elegantly combine list of records into JSON for a Python post request?
I fail to see a reason for the long way around.
If you already have parsed JSON, why not use it directly?
...
8
votes
From Q to compiler in less than 30 seconds
I have a couple of suggestions which are not specifically about the code, but rather about the user experience.
The first thing I did was copy-paste the script to a file, make it executable and tried ...
8
votes
Accepted
Convert all CSV files in a given directory to JSON using Python
Looks good to me. It's a perfectly sensible approach.
There's just one line I'm going to criticize:
csvfile = os.path.splitext(filename)[0]
Picking off ...
8
votes
User login database intended for beginners
This is also not a very good design from the viewpoint of algorithmic complexity. Whenever you want to check if a user already exists, or to retrieve a user, you need to read the whole file content. ...
8
votes
Accepted
Using decorated methods in a subclass of deque to dump its state to a JSON file
I don't think that what you're doing is good style. I think you're adding a lot of extra complexity and places for things to go wrong, or become hard to understand, or whatever. I don't think you lose ...
8
votes
Accepted
Should my Json storage handle exceptions?
This is how I see things...
Throwing ArgumentException insinde a try/catch that at the same time swollows it is pointless. You ...
8
votes
CodeReview question markdown downloader
Improving HTTP communication scheme
Instead of urllib.request/urllib.error use requests lib as well-known, elegant and simple ...
8
votes
Accepted
JSON reader based on a pushdown automata
I’m going to review your code in the order you’ve presented it in the opening post, simply because that’s the most orderly way to go about it from my perspective. I’ll mention overarching design ...
7
votes
Accepted
Parsing JSON in one go
First of all, let me say well done on the progress made from your first question to now!
Code Review is for reviewing code
As you seem to be seeking advice "about how to implement" an idea (i.e. ...
7
votes
7
votes
Tracking Containers in a Train Station
I'm really sorry, but after starting this review I have to tell you:
Go back, read some more tutorials and try again
This code has so many issues, that I'm not able to point them out reasonably ...
7
votes
Accepted
From Q to compiler in less than 30 seconds
My answer's short because I don't see much wrong with it, but this is what I think:
In fetch_compressed_data(), you define data ...
7
votes
Showing virus scan results from an API and a CSV file
I think that I am brute forcing my way to some of the text fields I am looking for.
Indeed.
csv.reader()
Each row returned by ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
json × 878javascript × 230
python × 218
java × 91
c# × 88
python-3.x × 69
beginner × 68
php × 65
jquery × 62
api × 62
performance × 61
parsing × 57
c++ × 37
node.js × 30
object-oriented × 29
http × 29
html × 27
csv × 27
array × 23
ajax × 23
swift × 21
python-2.x × 19
mysql × 18
serialization × 18
ecmascript-6 × 17