Comment by Schwern on Golang using more than 1 CPU without goroutines
Reference for garbage collection. "The current implementation is a mark-and-sweep collector. If the machine is a multiprocessor, the collector runs on a separate CPU core in parallel with the main...
View ArticleComment by Schwern on Error encountering upon executing CLI "gem install rails"
Does this answer your question? MinGW pacman -Sys Unable to lock database
View ArticleAnswer by Schwern for Postgres locks and deadlock questions
You don't need either lock. Both inserts are atomic.ON CONFLICT DO UPDATE guarantees an atomic INSERT or UPDATE outcome; provided there is no independent error, one of those two outcomes is guaranteed,...
View ArticleComment by Schwern on Golang using more than 1 CPU
Reference for garbage collection. "The current implementation is a mark-and-sweep collector. If the machine is a multiprocessor, the collector runs on a separate CPU core in parallel with the main...
View ArticleComment by Schwern on Postgres locks and deadlock questions
Rather than imagine it, could you show us your looping insert code (or something like it)? It really affects the question.
View ArticleComment by Schwern on Error encountering upon executing CLI "gem install rails"
Glad you got it fixed! This answer would be more helpful to others if you explained what the problem was, what those commands do, and how they solved the problem.
View ArticleComment by Schwern on Insert missing time and add values to avoid gaps/spikes...
What consumption do you want to fill the missing hours in with?
View ArticleComment by Schwern on High-level logic to build SQL query
"For users that have booked at least 2 trips with a hotel discount, it is possible to calculate their average hotel discount..." That's a strange caveat, because you can calculate the average with just...
View ArticleComment by Schwern on Remove unwanted branches from `git branch -a` output
Are they active and valid? Is the project working on 12.1, 12.1.1, 12.2, 12.3, 12.3.1, 12.4, and 12.4.1 at the same time? I hope they aren't. Maybe they could be replaced by tags.
View ArticleAnswer by Schwern for Remove unwanted branches from `git branch -a` output
You can delete the unwanted remote branches with git branch -d --remote <remote branch>, but then they'll just return with your next git fetch.To maintain your trimmed list, you'll have to be...
View ArticleComment by Schwern on Ruby code creating error: NoMethodError: private method...
The error is about "test.txt", but there's no "test.txt" in your program. Are you sure this is the code which actually produced the error? Did you perhaps change the code and forget to save before...
View ArticleComment by Schwern on why .gitignore syntax Invalid
Your original .gitignore should work, tho venv/ makes it specifically about a directory. git rm -rf -cached venv is not correct, you need two dashes --cached. If that's what you ran, you never actually...
View ArticleComment by Schwern on Ruby on Rails use of Ror.find_by_sql
Try Kernel.const_source_location('Ror'). If that fails, check if any dependencies provide it.
View ArticleAnswer by Schwern for Is there a better way to SUM columns?
Bad schemas mean bad queries. We can create a view to pretend it's a good schema with one row per period. Then query that view. At least then you only need to do it once.Here's a simplified version of...
View ArticleAnswer by Schwern for Malloc not properly allocating memory
Memory problems like this can come and go depending on how the memory is perturbed, like by adding a call to malloc. Compiling with an Address Sanitizer makes memory usage more strict and immediately...
View ArticleComment by Schwern on Github sync specific branch of different accounts
When you say "Both projects are under the same GitHub account" do you mean they're in the same repository?
View ArticleComment by Schwern on Git Status failing on a Large Repo only on Windows side...
Sharing a Git repository over a network file system has problems, even worse when it's cross-platform. I don't know what might be causing your particular problem, but you're better off treating it as a...
View ArticleAnswer by Schwern for Access from multiple goroutines to a single array
Yes, you can do that. Here's one way, rather than passing in fixed ranges the workers do their own iteration. Note the use of sync.WaitGroup to ensure main waits for all workers to complete.package...
View ArticleComment by Schwern on Access from multiple goroutines to a single array
Your doSomething is very trivial, the benchmark will emphasize the concurrency overhead. It's not a realistic use of concurrency.
View ArticleComment by Schwern on SQLITE3: printing result gives none but doing same for...
When you run it in console you get a result, but when you run it via the web server you get None? Make sure you're connecting to the same database in both cases.
View Article