interpolation – Is it possible to modify options inside an InterpolationFunction object?

When dealing with a slow function (e.g., a numerical integration) it is sometimes useful to tabulate it and create an interpolation function to work with instead. I found that one can deal with a possible extrapolation issues with "ExtrapolationHandler", e.g.,

FInterpolation(f_) := 
 Interpolation({#, f(#)} & /@ Range(0., 10., 0.1), 
  "ExtrapolationHandler" -> {f(#) &, "WarningMessage" -> False})

will return an InterpolationFunction object that will use function f outside of the interpolation domain. But as far as I can see there is no similar functionality when using FunctionInterpolation instead. Naively I’d expect that as the latter returns an InterpolationFunction object as well, it should be possible to use

ifunc = FunctionInterpolation(f(x), {x, 0., 10.})

and then modify the "ExtrapolationHandler" inside ifunc. Can one do that somehow?

My workaround was to use

FInterpolationExt(func_, domain_) := Module({ifunc},
  ifunc = FunctionInterpolation(func(x), {x, domain((1)), domain((2))});
    If(domain((1)) <= # <= domain((2)), ifunc(#), func(#) ) & )

which however does not return a simple InterpolationFunction (and perhaps is not optimal?).

filters – How do I target a single page to modify the comment form of only that page?

If I want to globally change the comment form for a theme I would use add_filter for “comment_form_default_fields”. Then I might use add_action for “comment_form_logged_in_after” and “comment_form_after_fields”. What I want to do, however, is create a single page with customised comment form fields.

My first thought was to add filters and use hooks in a custom page template. But that will, at best, work for one or two sites. What I am hoping to find is another way that I can target a chosen page. Is there a hook, filter, or logical test I can apply to modify a single page?

powershell – How to modify the same attribute of multiple lists with exact schemas in Sharepoint online through coding or ms flow

I have several lists with the same exact schemas in SharePoint Online. How can I do the following?

1- How to add/remove a column to/from all of them?

2- How to add/remove an option to a choice/multichoice column?

I think there should be a way to accomplish this in C#/Python or through Powershell. I prefer coding as it makes life much easier and faster. MS flow is fine.

Please let me know if it would be better to break this question into two seprate questions.

powershell – How to modify the same attribute of multiple lists with exact schema in Sharepoint online through coding or ms flow

I have several lists with the same exact schema in SharePoint Online. How can I do the following?

1- Add to add/remove a column to/from all of them?
2- How to add/remove an option to a choice/multichoice column?

I think there should be a way to accomplish this in C#/Python or through Powershell. I prefer coding as it makes life much easier and faster. MS flow is fine.

Please let me know if it would be better to break this question into two seprate questions.

algorithms – How to modify the following Dijkstra/ Uniform-cost search to return the result for all end points?

I know there is a lot of code out there that does this, but in particular, I’m trying to modify the following code to not just return the goal node/ one end point, but all endpoints. How do I go about it? I tried thinking of keeping a seen/visited set, but that seems redundant and kills the whole point of the reached map.

def best_first_search(problem, f):
    "Search nodes with minimum f(node) value first."
    node = Node(problem.initial)
    frontier = PriorityQueue((node), key=f)
    reached = {problem.initial: node}
    while frontier:
        node = frontier.pop()
        if problem.is_goal(node.state):
            return node
        for child in expand(problem, node):
            s = child.state
            if s not in reached or child.path_cost < reached(s).path_cost:
                reached(s) = child
                frontier.add(child)
    return failure

postgresql – Modify owners in all tables. How to run a selected query?

I need to write a script which modifies all table owners in a Cloud SQL Postgre db. So far I have gotten this far:

SELECT format(
        'ALTER TABLE %I.%I.%I OWNER TO %I gexec;',
        table_catalog,
        table_schema,
        table_name,
        {new_user}  
        )
        FROM information_schema.tables
        WHERE table_schema = 'mySchema';
        ''')

It returns the right commands like:ALTER TABLE schema_version OWNER TO ali;

ALTER TABLE .. OWNER TO ..;
ALTER TABLE .. OWNER TO ..;

But how do I run these now? My code is below. Ask you kindly to provide any suggestions!

import sqlalchemy ​ 
    """ Connect to the PostgreSQL database server """
    conn = None
    try: ​
        # connect to the PostgreSQL server
        print('Connecting to the PostgreSQL database...')     ​
        db_url = 'postgresql+psycopg2://{}:{}@{}:{}/{}'.format(
        username, password, host, port, database) ​
        engine = sqlalchemy.create_engine(db_url) ​
        conn = engine.connect()
    # create a cursor
        cur = conn.cursor()
            # execute a statement
        print('Reassigning the owners:')
        cur.execute(
        '''
        SELECT format(
        'ALTER TABLE %I.%I.%I OWNER TO %I gexec;',
        table_catalog,
        table_schema,
        table_name,
        {new_user}  
        )
        FROM information_schema.tables
        WHERE table_schema = 'mySchema';
        ''') ​
        # commit the changes to the DB
        con.commit()
        print("The owner has been altered successfully")

sharepoint online – How to modify (Hyperlink or Picture) Column if end user does not provide picture in Gallery View

In SharePoint JSON formatting, you can get the hyperlink/picture column value using:

($Picture)

Picture is internal name of hyperlink/picture column.

Also, you can get the description of hyperlink/picture column using:

($Picture.desc)

Hiding hyperlink/picture column from list form:

Use conditional formula on column like:

=if(($Picture), true, false)

Hiding hyperlink/picture column in JSON formatting:

"style": {
    "display": "=if(($Picture), 'block', 'none')"
}

Use default image in JSON formatting if Picture column is blank:

{
  "elmType": "img",
  "attributes": {
    "src": "=if(($Picture), ($Picture), '<default-image-url>')"
  }
}

Replace <default-image-url> with the URL of default image to show if Picture column is blank.


Update from Comments:

If you want to hide the default preview from “Gallery View””, follow below steps:

  1. Open Gallery view in your list
  2. Select “Format current view” from “Switch view options” dropdown
  3. Select “Edit card” under “Card Designer”
  4. Turn off toggle button near Show preview
  5. Click Save

enter image description here

Note that it will hide preview for all list items and not conditionally based on Picture column value.

magento2 – how to hide the filter in product listing page without modify the code base?

Your question is pretty confusing as you want to hide it without touching code, but you also want to do it by CSS or JS which is code?

Either way, you can hide it with CSS by using this:

.sidebar .filter {
    display: none !important;
}

Although the better method would be to remove it with layout XML then you don’t even need to load it, there’s no point in loading a block just to always hide it.