53
votes
Accepted
Counting rows in a CSV file that correspond to a database row, each with a million records
Your inner loop appears to be unnecessary. Why not create a lookup:
...
- 16.7k
18
votes
Accepted
Console Library System in C++
Make variables and functions const where appropriate
You used const references in a few places, but you missed a lot of ...
- 42.8k
17
votes
14
votes
Counting rows in a CSV file that correspond to a database row, each with a million records
The code appears to be broken, you're not break;ing after finding a match so all records will likely have row[12] == "N".
You ...
- 2,944
13
votes
13
votes
Accepted
Generalization of any() function with switchable default parameter for empty iterables
I really think this is a bad idea. A function called any returning True if there not only isn't anything true but even not ...
- 3,981
12
votes
Accepted
Simple customer program in C (using binary files)
I see a number of things that may help you improve your code.
Eliminate function prototypes by ordering
Since you put the acadd and ...
- 64.9k
11
votes
Inserting a DBNull value into a database
The most terse and declarative way to write this is to use C#'s ?? operator. Your line becomes:
...
- 281
10
votes
Accepted
Key value flat file system - single header INI replacement
Let's start with your priorities: optimization. You should be primarily optimizing for the most expensive and limited resource, which is almost always developer brain cycles. You optimize for that ...
- 435
10
votes
Creating Original Database Algorithm--Login System
It looks like passwords are stored in plain text form in the pswd.txt file. Never ever store passwords in plain text form. Store passwords salted and cryptographically hashed. That way, if an attacker ...
- 110k
10
votes
Accepted
Generic asynchronous SQLite search builder
Reflection is slow. That line probably doesn't help your performance :
var model = (T)Activator.CreateInstance(typeof(T));
I notice that you always create your ...
- 12.3k
10
votes
Accepted
Inserting a DBNull value into a database
All you have to do is to use the ?: (ternary operator):
...
- 44k
10
votes
Accepted
Reducing the amount of duplicated code (python) - cricket matches
Disclaimer: I know nothing whatsoever about the rules of cricket.
Useless check
Because either info['toss_decision'] equals ...
- 29.1k
9
votes
Accepted
Example script for teaching DDL and CRUD/DML operations
Also said before, but I think it worth mentioning again: there is not need for prefix_ for all columns. As far as I know, Hungarian and Leszynski notations are not exactly recommended. Since column ...
- 1,786
9
votes
Event scheduler in C
Self-documenting code
char h1 = { (e.hour / 10) + '0' }; // Extract the first digit and convert to char (if any, else 0)
As you considered the division by ten ...
- 27.3k
9
votes
Accepted
LinDB: A dictionary type database
Both impressive and ambitious!
Passwords
the absolute requirement of a 32 character long password ensures it will take a considerable amount of time to break the encryption
It will also ensure that ...
- 55.6k
9
votes
Generalization of any() function with switchable default parameter for empty iterables
Any and All
If you are going to override any(...) to return a custom result when given an empty iterable, you should also override ...
- 33k
9
votes
Accepted
Embedded IoT: local data storage when no network coverage
We're missing an include of <stdint.h> in the header, and <stdbool.h> in the implementation.
Some parts of the code ...
- 67.7k
8
votes
Accepted
Manage connection without 'using' statement
I can understand why you want to remove the clutter from your code - but sharing the instance of MySqlConnection isn't a good idea. As soon as multiple threads are ...
- 16.7k
8
votes
Accepted
Creating Original Database Algorithm--Login System
In your function pick_password, you should close the file at the end of the file because this frees up any system resources that were being devoted to working with ...
- 13.2k
8
votes
Marijuana information program
Everything is a String
Welcome to Java and object-oriented programming! You are doing something really strange in Java in your ...
- 19.2k
8
votes
Use PreparedStatement to insert into H2 database
There are some things to improve in this code. Especially when it's underlined that "if it can be maintained later on".
SQL query
The columns where the data will be inserted should always be defined,...
- 3,627
8
votes
Function to get rows from database
Your code will work, of course, but you go to a lot of trouble to grind the result set into an array when that capability is already available. Mysqli would provide the ...
- 283
8
votes
Accepted
MySQL homeowner database
For the table definitions, just use an INT for the keys. You probably aren't saving anything by using SMALLINTs. Schema ...
- 143k
8
votes
Counting rows in a CSV file that correspond to a database row, each with a million records
A few comments:
Avoid memory intensive data types
Instead of using a DataTable for dt, just read from the csv directly, one line at a time (readLine() and then split(','). This will greatly cut ...
- 1,843
8
votes
Invoicing Program Python
What happens if the user types "s"? Your program says:
Enter Buyer Name:
Oops! It was supposed to be uppercase, wasn't it? I'm not sure why you want it to be ...
- 3,787
8
votes
Accepted
Non-Entity framework database interaction model
Application Architecture
The architecture of the application is divided into models and views to separate the data and business model
from the user interface. Within the models there is an ...
- 13.9k
7
votes
7
votes
Accepted
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
database × 545c# × 106
sql × 98
python × 96
php × 86
mysql × 71
java × 65
object-oriented × 46
performance × 44
beginner × 39
sqlite × 25
django × 24
python-3.x × 23
javascript × 21
pdo × 20
postgresql × 20
sql-server × 19
c++ × 16
entity-framework × 15
c × 14
ruby × 13
.net × 12
design-patterns × 11
ruby-on-rails × 10
jdbc × 10