google sheets – Making dynamic number of arguments based on a specific criteria for importrange function

enter image description here

I am counting number of cases per day in each month by importrange data from daily sheets in every month with this formula on D3 for example:

=SUM(IMPORTRANGE($Q$5,R5),IMPORTRANGE($Q$6,R5),IMPORTRANGE($Q$7,R5),IMPORTRANGE($Q$8,R5),IMPORTRANGE($Q$9,R5),IMPORTRANGE($Q$10,R5),IMPORTRANGE($Q$11,R5),IMPORTRANGE($Q$12,R5),IMPORTRANGE($Q$13,R5),IMPORTRANGE($Q$14,R5),IMPORTRANGE($Q$15,R5),IMPORTRANGE($Q$16,R5),IMPORTRANGE($Q$17,R5),IMPORTRANGE($Q$18,R5),IMPORTRANGE($Q$19,R5),IMPORTRANGE($Q$20,R5),IMPORTRANGE($Q$21,R5),IMPORTRANGE($Q$22,R5),IMPORTRANGE($Q$23,R5),IMPORTRANGE($Q$24,R5),IMPORTRANGE($Q$25,R5),IMPORTRANGE($Q$26,R5),IMPORTRANGE($Q$27,R5),IMPORTRANGE($Q$28,R5),IMPORTRANGE($Q$29,R5),IMPORTRANGE($Q$30,R5),IMPORTRANGE($Q$31,R5),IMPORTRANGE($Q$32,R5))

Rows from Q5:Q32 (28 rows) represent IDs of daily sheets for the month of February (C1) & Rows R5:R36 are cells that contains the numbers to be summed. Those cells R5:R36 are fixed in all sheets. For another month like January, the number of rows will be 31 (Q5:Q35) where I need add the following to the previous formula to : Importrange(Q33,R5),Importrange(Q34,R5),Importrange(Q35,R5)) . I am looking for an idea on how to make the formula fixed so I don’t need to change the number of arguments based on number of rows (which represent daily sheet IDs). It makes sense for me so that I can make this sheet a master sheet where the data will change whenever the text in C1 is changed to different month otherwise the formula will show error message if the number of ID rows are less than the number of arguments in the formula (for example, importrange (Q5,R5),…. importrange(Q35:R5) for month of February where the IDs ends on row R32)

functional programming – Passing Multiple Arguments Including A List To A Function In Haskell

Your use of mutliplesOfKLessThanN is not correct

mutliplesOfKLessThanN((3,5) 1000)

Is not interpreted by Haskell as

Apply mutliplesOfKLessThanN with (3,5) and 1000.

but instead it is interpteted as

Apply (3,5) to 1000 and apply multiplesOfKLessThanN to the result.

I think your misconception is in how function application occurs. In many languages function application requires parentheses e.g. f(x). For Haskell parentheses, only ever mean do this operation first, and function application is achieved by putting things next to each other. So f(x) works in Haskell because it is the same as f x, but f(x y) is the same as f(x(y)) and tells Haskell to evaluate x y first and then give it to f.

With your code Haskell can’t apply (3,5) as a function, which is what Haskell is telling you, it expected a function (in fact a specific type of function).

The proper way to write this would be

multiplesOfKLessThanN (3,5) 1000

This should handle that main error you are getting.

8 – How to union two views and pass on arguments

What you can do is to load and execute the $view_by_author view as you are doing but passing the by_year arguments/contextual as this:

$arguments = ($view_by_year->build_info('parameter_you_need'));

$view_by_author = Views::getView('music_by_author');
$view_by_author->setArguments($arguments);
$view_by_author->setDisplay('block_1');
$view_by_author->preExecute();
$view_by_author->execute(); // or build, etc

I believe something like this would work for you.

Also, there is a module called Views Field View that might do what you are trying to do.

expression manipulation – Unpacking list of arguments into parameters

I have a list in the following form:

list = {{a,1,3},{b,1,3},{c,1,3}}

Now I want to apply this list as parameters for the Sum function so that I end up with the following:

Sum(f(a,b,c),{a,1,3},{b,1,3},{c,1,3})

But I don’t know how to unpack the list like that. “Flatten” just gives a completely flat list.
Am I doing something here which you aren’t even supposed to do?
What would be the most elegant way to do this?

In python for example I would just do this

Sum(f,*list)

categories – Can I add arguments to a woocommerce block – to show more products or paginator

I’m trying to have a page/post show all products in a specified category.
I want to use a simple method if possible. I have the theme “NewEStore Pro” to use…

There are now separate pages/posts corresponding to each/every category… in each I place a block (comment: and after that block have a custom shortcode from stackexch link if youre interrested).

The block:

<!-- wp:woocommerce/product-category {"categories":(29)} /-->

I get to see 9 products…

So, can I add an argument to this block to allow viewing all products in the category?

My thoughts are, either an argument like “count_limit”:100 … or “pagination”:true

I would be grateful for an answer. Greetings

Trouble passing arguments to action

I know there are several posts on this topic. I have followed many of them as well as other resources on the web and thought I had it down, but it does not seem to be working. In my case, I have 2 functions hooked to 2 separate actions that need the same data.

$data = array('red', 'green', 'blue');

do_action('use_colors_here', $data);
add_action('wp_body_open', 'use_numbers_here', 10, 1); 
function use_colors_here($data) {
  $out = '<h1>Colors</h1>';
  $out .= '<p>Color 1: ' . $data(1) . '</p>';
  $out .= '<p>Color 2: ' . $data(2) . '</p>';

  echo $out;
}

do_action('use_colors_there', $data);
add_action('wp_enqueue_scripts', 'use_numbers_there', 10, 1); 
function use_colors_there($data) {
  wp_enqueue_script('color-script-1', get_stylesheet_directory_uri() . '/js/colors_' . $data(1) . '.js');
  wp_enqueue_script('color-script-2', get_stylesheet_directory_uri() . '/js/colors_' . $data(2) . '.js');
}

The expected behavior was for the values of $data(1) and $data(2) (green and blue respectively) to be accessible by the 2 functions and printed out in the markup each is responsible for adding to the page. Unfortunately, $data was not accessible inside the functions and I en up with markup looking like:

<h1>Colors</h1>
<p>Color 1: </p>
<p>Color 2: </p>

What am I doing wrong?

python – Syntax error while passing arguments in pandas sql query

I’m using f notation in a pandas sql query on a postgres database. The following works fine:

areas = pd.read_sql_query(f"SELECT * FROM Areas WHERE dwelling_id={dwelling_id}", con=db.engine)

But when I repeat the same with a different table:

windows = pd.read_sql_query(f"SELECT * FROM Window WHERE area_id={area_id}", con=db.engine)

I get the following error:

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) syntax error at or near "Window"
LINE 1: SELECT * FROM Window WHERE area_id=1
^
(SQL: SELECT * FROM Window WHERE area_id=1)

Note that I abandoned the usual params=(variable, ) approach because I couldn’t get it to work. Strange that the f notation approach works with the first query but not the second.

Can anyone help!

machine learning – Is it bad design to pass around a dictionary of arguments to all your functions?

In my machine learning pipeline, I have all the arguments collected into a dictionary.

args = {'save_model': True,
'learning_rate': 0.01,
'batch_size': 4,
'model': 'my_model',
'momentum': 0.9,
'random_brighness': 0.5,
'random_flipping': 0.5,
...}

Then I have a bunch of functions that take the entire args dictionary as an input. Each of these only uses a small subset of all the arguments. Is there anything wrong with this design?

model = get_model(args)
data = get_data(args)
transformed_data = transform_data(data, args)

from the perspective of the function, it looks like:

def get_trainer(args):
loss_function = args('loss_function')
optimizer = args('optimizer')
class_weights = args('class_weights')
...

versus:

def get_trainer(loss_function, optimizer, class_weights)
...

cms – Exception calling “Open” with “0” argument(s): “The specified path format is not supported.”

I was trying to do some data base(sqlite3 database) operation using powerShell scripting.
But, facing error called “Exception calling “Open” with “0” argument(s): “The specified path format is not supported.”

Code snippet:
Add-Type -Path “$PSScriptRoot..sqliteSystem.Data.SQLite.dll”
$conn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
$conn.ConnectionString = “Data Source=$PSScriptRoot..TestData-{0}.sqlite3” -f $url
$conn.Open()

Error throw in line $conn.Open()
Any pointers what or where i am making mistake.