Answer by Schwern for Install Gitlab Repository : Wordlists
The README is instructions on how to contribute to the project, not on how to install the software.Since it has a debian/ directory, this is the source for a Debian package. You need to build it like...
View ArticleAnswer by Schwern for 1 to 1 relation postgres
PostgreSQL supports 1-to-1, but pgAdmin is not PostgreSQL.As others have pointed out in the comments, your relationship is 1-to-many. You're missing the unique constraint necessary to make it...
View ArticleAnswer by Schwern for How to stop my primary key ID from incrementing?
How can I use the primary key multiple times?You can't. A primary key must be unique.How do I get my ID to stay as 62381 for example within userInput.primarykey and not increment?Don't. Leave the ID as...
View ArticleAnswer by Schwern for Write a query to calculate the even and odd records...
Use the modulus operator %. It returns the remainder from division. 1 % 2 is 1, 2 % 2 is 0, 3 % 2 is 1... so if x % 2 is true it is odd.Then you can use a case to turn this into 'odd' or 'even'.select...
View ArticleAnswer by Schwern for Functions to filter missing values in SQL and change...
You can use nullif which returns null if both values match, otherwise it returns the first value.select some_int, nullif(some_int, 0), some_text, nullif(some_text, '0')from some_tablenullif is specific...
View ArticleAnswer by Schwern for how golang starts a task independent of the main task
When main exits, the program ends and all goroutines shut down. main must have a way to wait until all goroutines end. You're correct that there are better ways than sleeping; sleeping in concurrent...
View ArticleAnswer by Schwern for MySQL function generates pseudo-random syntax error
The issue is what you're passing to against. Boolean full text search has a specific syntax, and you're passing it things with syntax errors. The error depends on the values you pass in, so it seems...
View ArticleAnswer by Schwern for How to amend last commit without losing commit tag
Commits cannot be rewritten. You can only make new commits and replace the old. See my answer to What is a Git commit ID? to understand why.If you have this...A - B - C [HEAD][tag]After you commit...
View ArticleAnswer by Schwern for How to store frontend and backend in git?
Definitely don't put them in branches. Branches are for working on the same content simultaneously, not for storing completely different content.With that out of the way, it depends if you want to run...
View ArticleAnswer by Schwern for Exclude a file from merging to the main branch
A convenient approach would be to have a stub db_changes.sql file in the repository that the developers can modify in the feature/bugfix branches, which will be picked up by the build/deployment...
View ArticleAnswer by Schwern for How can I warn about Ruby 3 deprecated code, while...
Rubocop has a few lints to detect deprecated Ruby features. For example, Lint/DeprecatedClassMethods. For most of these Rubocop doesn't care what version of Ruby you're using.To find more issues, set...
View ArticleAnswer by Schwern for what do you do when you're merging develop into master...
Let's say your repo looks like this, and you don't want commit 3.A - 1 - 2 - 3 - 4 - 5 [develop] \ B - C [master]Make a new branch from develop, remove the commit, then merge.One way to accomplish this...
View ArticleAnswer by Schwern for How to select a row group by a column regardless of...
If you want to select a whole row which has a max of something, you need to use window functions to partition and order the rows, then select the first in each partition.with ordered_users as ( select...
View ArticleAnswer by Schwern for VS Code, Golang formatting stubborn situation with...
It is, indeed, the Go style to not indent inside a switch for some reason, possibly a hold over from C styles. For example, this is the style used in Effective Go. In addition, the Go community is...
View ArticleAnswer by Schwern for Github pull request history
What you're looking at is the commit (f4e65) and the merge commit (4a28).Github and git log lie to you. The history is not linear. If you use git log --graph you will see something like this.* 4a28...
View ArticleAnswer by Schwern for What is the historical significance of %s in the...
%s is not part of the C standard, it depends on the implementation. Here on MacOS, which has BSD roots, it is. %s is replaced by the number of seconds since the Epoch, UTC (see mktime(3)).The manual...
View ArticleAnswer by Schwern for What is the typical method for preventing duplicates in...
Create a unique index on name and ingredients.create unique index recipe_uniq_idx on recipe(name, ingredients);This only works if the ingredients are exactly the same, in the same order.This also acts...
View ArticleAnswer by Schwern for Git feature branch workflow with local configurations
Should the main (or master) branch be completely unchanged by me and always synced with the original?tl;dr There's no need to maintain a "clean" main in a fork. Use origin/main.If your forked version...
View ArticleComment by Schwern on Finding CBOR::XS () on mirror http://www.cpan.org failed
Works For Me(tm) with Strawberry 5.38.0.
View ArticleComment by Schwern on Newbie question about line endings in git
It's safer to choose one form of line endings for your project and leave it. A cross-platform project should stick with LF. I recommend adding an EditorConfig file to your project to auto-configure...
View Article