Quantcast
Channel: User Schwern - Stack Overflow
Browsing all 581 articles
Browse latest View live
↧

Answer by Schwern for Max QTY with price

First, get a rolling sum of quantity and price * quantity. Use a window ordered by price to ensure you spend your money on the best deals first. Since price is not unique, we can also order by the...

View Article


Comment by Schwern on Create an XML table from a SQL table where the SQL...

Formatting in SQL is cumbersome, and it ties the data query to the format. If you want something more elegant, retrieve the results and format them in the receiving code. Then you can separte the...

View Article


Comment by Schwern on Github push limit bandwidth 2,22 MiB/s

Many, many, many things can affect your throughput to different sites. It's like a giant plumbing system, "a series of tubes".

View Article

Answer by Schwern for why does the image show as null in the table?

The simplest explanation is load_file did not load the file. This is probably because it didn't find it. It didn't find it because load_file runs on the server. It's looking for your file on the MySQL...

View Article

Comment by Schwern on GitPython unable to execute command in existing repository

Does git pull -v -- origin work if you run it manually? Do you need authorization to pull from the remote repository? Remember, Jenkins is (probably) running as a different user than you.

View Article


Comment by Schwern on Return condition from CASE expression in where clause...

Is it Incorrect syntax near '<' or Incorrect syntax near '>'?

View Article

Comment by Schwern on Create a dataset based on an ID and create columns for...

It's called a "pivot". It's certainly possible in MySQL 5.7, but it might be simpler to do it in a spreadsheet.

View Article

Comment by Schwern on Duplicate commits after using git filter-repo and merging

@BenVessely Yes. When you "rewrite" commits you're actually creating new commits. Instead of merging with upstream, you want to replace it with the new commits.

View Article


Answer by Schwern for Require multiple strings

expr can be followed by any valid expression. You can use a !~, but it must be followed by a regex in the form /regex/ or m#regex#.Require expr %{HTTP_USER_AGENT} !~ m#python-requests/#

View Article


Comment by Schwern on How do I simplify this model with a double reference?

Consider using GORM.

View Article

Comment by Schwern on How do I simplify this model with a double reference?

@FlameDra Yes, definitely. Use it for the ORM and the SQL builder and the cross database compatibility.

View Article

Answer by Schwern for How can I change my longest and shortest functions to...

The function can be simplified by iterating using a for loop.def find_shortest(words): shortest = words[0] for word in words: if len(shortest) >= len(word): shortest = word return shortestAt which...

View Article

Comment by Schwern on Read same file from src and test in PyCharm

Note that open('words.txt') looks for words.txt in the current directory. It will only work if you run board.py from src/scrabble. It will fall if you run, for example, python src/scrabble/board.py...

View Article


Comment by Schwern on Read same file from src and test in PyCharm

I see. Since none of that context is here, perhaps it's better as a comment on the question. They have an explanation in their question, seems they're struggling to understand the idea of a current...

View Article

Answer by Schwern for Read same file from src and test in PyCharm

open('words.txt') looks for words.txt in the current directory. It will only work if you run board.py from src/scrabble. If it works when you run board.py directly in Pycharm, Pycharm must be setting...

View Article


Answer by Schwern for How can I change my function to allow finding both...

The function can be simplified by iterating using a for loop.def find_shortest(words): shortest = words[0] for word in words: if len(shortest) >= len(word): shortest = word return shortestAt which...

View Article

Comment by Schwern on programmatically restructuring weakly normalized database

This is too broad and open-ended and lacking in detail (no details about the before and after schemas, "as requested", "appropriately") to be a good fit for Stack Overflow. Feels more like something...

View Article


Comment by Schwern on Gorm/PostgreSQL: How to Ensure Connection to Specific...

I suspect the problem is between .env and app.Config.DB.*. Could you show us the output of printing dsn inside ConnectToPostgres?

View Article

Comment by Schwern on Why is `setblocking(False)` used in Python's socketpair...

The initial commit of this code in Python is from asyncio. It's to emulate socketpair on Windows. The code is originally from gist.github.com/4325783 by Geert Jansen. The original asyncio repository...

View Article

Comment by Schwern on How can you turrn off or disable active storage...

Could you describe the behavior more precisely? And which version of Rails, please?

View Article
Browsing all 581 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>