Comment by Schwern on Why is `setblocking(False)` used in Python's socketpair...
@RSIMBGO setblocking(False) is really setting a 0 timeout. I wonder if usually the socket is created with a 0 timeout, but there's a condition where the socket can begin with a non-zero timeout....
View ArticleComment by Schwern on When I navigate to the URL and get the contents of the...
You're issuing a simple GET, but a web request is also made up of cookies and request headers. These might be important to getting the response you want; web sites often quietly reject simple requests...
View ArticleComment by Schwern on How can I mitigate or minimise this MariaDB deadlock?
LOCK WAIT 8 lock struct(s) is suspicious. You might have a hung process. See stackoverflow.com/questions/5462249/…
View ArticleComment by Schwern on I need to see how many whole numbers a value is over...
Right now it looks like all you need is subtraction. What would 55 return? What about 13?
View ArticleComment by Schwern on How can you turrn off or disable active storage...
@pvawser My mistake. Use - to delete multiple items. I've updated. Here's the 7.1 docs. api.rubyonrails.org/v7.1.0/classes/ActiveStorage/Preview.htm‌​l
View ArticleAnswer by Schwern for Grouping a table by its type on different columns
SQL queries are row based, but you want columns. This requires a pivot. We need something in common for each row so we can group them together. We can add a row_number to each row to put them in order....
View ArticleAnswer by Schwern for Time complexity of this algorithm with 4 nested for loops
Yes, it will be O(height * width). for row in range(0, height, 2): for col in range(0, width, 2):This will execute height/2 * width / 2 iterations. Throw out the constants and it's O(height * width)....
View ArticleAnswer by Schwern for add after_save callback on the instance level
You can accomplish this with a normal callback which looks for a special flag on the instance.class MyModel << ActiveRecord::Base after_save do MyWorker.perform_async(self.id) if...
View ArticleComment by Schwern on SQL table join changes case aggregate expression logic
Note that you can simplify your case statement with in. when STRING_AGG(t1.AS_REGION_ID, ',') in ('AS_SP26,AS_SP15', 'AS_SP15,AS_SP26') then 'SP15'
View ArticleAnswer by Schwern for Getting the UTC offset for a given chrono::DateTime
When they say "local" they mean the time zone of the FixedOffset. We can see this from their own tests.#[test]fn test_parse_offset() { let offset = FixedOffset::from_str("-0500").unwrap();...
View ArticleComment by Schwern on DateTime filtering based on a date range and a time range
You say you "need data between 2024-09-13 20:00:00 and 2024-09-14 2:00:00" but your expected result contains 2024-09-13 00:07:42.3220570 which is before 2024-09-13 20:00:00.
View ArticleComment by Schwern on Most efficient way to join tables with duplicate IDs...
Depends on the size of the tables, the data distribution, and the particular database. The most important thing is that TransID and both ID columns are indexed. For example, if Table_2 has a small...
View ArticleAnswer by Schwern for What library does Github use for parsing markdown?
As of Dec 2024...Github Markup"is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: 1. github-markup selects an underlying library to...
View ArticleComment by Schwern on Why is a git 'pull request' not called a 'push request'?
That's just merging, and a "pull" does not refer to simply merging. A pull request is about pulling: fetching commits from a remote repository and then merging them. The key is the remote repository.
View ArticleComment by Schwern on Why is a git 'pull request' not called a 'push request'?
I think a lot of confusion stems from a lot of people who are only familiar with a single central repository for work where they have permission to push changes directly to the repository. However, Git...
View ArticleAnswer by Schwern for As a SQL developer, what are the differences between...
While they both use SQL, Amazon RDS and Redshift are two very different things.Amazon RDS is a traditional SQL database hosted on AWS. It supports IBM Db2, MariaDB, Microsoft SQL Server, MySQL, Oracle...
View ArticleComment by Schwern on How to store frontend and backend in git?
@RaghavendraN It's not necessary to have a single repo in that case, but it is simpler. If you split the repositories you might put the docker config into the backend repository, because the frontend...
View ArticleComment by Schwern on Invalid datetime 05 Jan 1970 Linux
"Invoking date with no format argument is equivalent to invoking it with a default format that depends on the LC_TIME locale category." What's your LC_TIME set to? And why are you sending the output to...
View ArticleComment by Schwern on Any way to resolve type mismatches between...
Could we see the error, please?
View ArticleComment by Schwern on Is this a goroutine Leak using Timer?
Note that you don't have to stop it. As long as it's not causing a deadlock it's fine for a goroutine to block indefinitely.
View Article