Hot answers tagged

3

Externalize your DML Given the length of the query written in GetArticleChangesAsync, I would expect that either it be moved to a stored procedure (common but IMO overkill); or moved to a view (my usual preference given read-only queries like this). There are several reasons for this, including: If you have a DBA, they will have more control over the fine-...


2

Good stuff lots of good comments indenting your function definition putting variables inside of double quotes when you use them Suggestions indent between then and fi, as you would in other languages with conditionals combine then with if line using ; use [[ forms of conditionals to avoid surprises Those three things would lead to code like: if [[ ! -d &...


2

The query title is Questions answered by more than 3 50k users But that doesn't describe what the query actually does. The query selects questions with three answers given by three distinct top n rated users. They happen to have more than 50k rep on that site, but that's a mere coincidence. That can also be done by this query, containing only 1 subquery to ...


1

Discarded sums You calculate these sums: sum(case when s.type = 'in' then s.quantity else 0 end) as 'in', sum(case when s.type = 'out' then s.quantity else 0 end) as 'out' but then reduce them to a 0/1 here: if(coalesce(x.in - x.out, 0) = 0, 0, 1) as quantity, This means that a sum is not appropriate at all. This should be refactored to an if exists, ...


1

I discovered what I think is a flaw - in Flush() I call simply Flush() on the underlying stream, however I think this needs to be Flush(true) to ensure that all the changes are written before the log file is reset. I made the same change in Log.cs. This means changing the type of BaseStream to FileStream, as Flush(true) is specific to FileStream. The ...


1

Reviewing your T-SQL script I see that you have a cursor to iterate over Posts from a specific owner. For each body you use a neat trick to determine the word count of the body and use an extra variable to keep the running sum. You use FORMATMESSAGE to shape the data in each row. Do know that the neat trick for the word count doesn't compensate for cases ...


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