How to apply a function to one part while keeping the rest

I have a list and want to apply a function just on the second Part and keep the rest.

t1 = Table({k, 2^k + 1}, {k, 2, 7})

yielding

{{2, 5}, {3, 9}, {4, 17}, {5, 33}, {6, 65}, {7, 129}}

I want to FactorInteger the second parts to get

 {{2, {5}}, {3, {3}}, {4, {17}}, {5, {3, 11}}, {6, {5, 13}}, {7, {3, 43}}}

By not using Cases like

 Cases(t1, {a_, b_} :> {a, FactorInteger(b)((All, 1))})

but by applying a function (maybe Hold or HoldPattern) which leaves k untouched when applying FactorInteger on the whole of t1. (I hope it makes sense what I am looking for.)

computer science – Do CFGs’ concepts of derivation and derivation tree apply to grammars more general than CFGs?

Ullman’s Introduction to Automata, Languages and Computation (1979) says that given a CFG $G$, derivation is defined as:

Two strings are related by $to_G$ exactly when the second is obtained
from the first by one application of some production.

$to^*_G$ is the reflexive and transitive closure of $to_G$. We say $alpha_1$ derives $alpha_m$ in grammar $G$, if $alpha_1 to^*_G alpha_m$.

and then a derivation can be represented as a tree, called derivation tree or parse tree.

In grammars that are more general than CFGs (such as CSGs i.e. type 1 grammars, unrestricted grammars i.e. type 0 grammars),

  • do the concepts of derivation and derivation tree (also called parse tree) still exist, or
  • what concepts are they generalized to?

Thanks.

WHM says VPS must be reboot to apply patches


Hi,

Several times I have logged into WHM on my VPS’s and there is a orange button at the top right of the screen that says something like

“Must reboot to apply patches”

or something along those terms. I would like to know what that means?

Does it means that WHM as detected that there was kernel update and that WHM will not update itself until the VPS has been rebooted?

Thank you

Dennis

How to apply confidence percentage to values to obtain overall confidence?

Here is a table with Confidence Percentage that I’ve made up as an example. What would be the best way to find out how much revenue would be by the end of week 3 along with a percentage of confidence.

I know that if I look at week 1 then I’m at 100% confident that I’ll make at least 1,000. If I were to add week 2 do I simply add the revenue and average the confidence percentage? With that technique I would be 97.5% confident that by the end of week 2 I’ll have $2,500.

views – Remove one of the two “Apply to selected items” submit buttons with Node Bulk Operations

If you make a view and add the Node operations bulk form, two “Apply to selected items” boxes are automatically generated like this:

two apply to selected items boxes

How do I get rid of one of these?

I turned on twig debugging, but the template that is outputting the button is core/modules/system/templates/container.html.twig, which is not something that I can easily customize to remove one of the buttons.

How I created the view:

  1. Create a new view of content showing fields.
  2. Add Node operations bulk form under Fields.
  3. Save the view.

sql server 2016 – Get values from table if this or that applies, but not when both apply

I’m currently struggling with a seemingly simple task.

The goal is to get the corresponding prices according to the customer number – OR – the customer price group if the customer number does not exist in the table. I think my problem here is that those values are saved in the same table.
The table looks like this (shortened):

Sales Code | Item No | Unit price

SC1 | 711111 | 345.12

SC2 | 711111 | 501.24

SC3 | 711111 | 242.70

CustomerNo1 | 711111 | 242.70

CustomerNo2 | 711111 | 250.00

SC1 | 711112 | 345.12

SC2 | 711112 | 501.24

SC3 | 711112 | 242.70

CustomerNo2 | 711112 | 250.00

I am using a parameter for the customer number and I already got the customer price group of the customer, for the case if the customer number is not available in the table for the sales prices.

A short snipped of my code so far:

-- Get the customer price group
SET @query = 
    'SELECT @CustomerPriceGroup = (CASE (Customer Price Group) WHEN '''' THEN ''SC1'' ELSE (Customer Price Group) END)
    FROM (customers) 
    WHERE (No) = ''' + @CustomerNo + ''''
EXEC sp_executesql @query, N'@CustomerPriceGroup NVARCHAR(3) OUTPUT', @CustomerPriceGroup = @CustomerPriceGroup OUTPUT

-- Get the item data
    SET @query = 'SELECT sp.(Sales Code) AS (SalesCode),
            i.(No) AS (ItemNo),
            i.(Name) AS (ItemName),
            sp.(Unit Price) AS (UnitPrice)
    FROM (items) i
    INNER JOIN (salesprices) sp ON i.(No) = sp.(ItemNo)
    WHERE (sp.(Sales Code) = ''' + @CustomerNo + ''' OR sp.(Sales Code) = ''' + @CustomerPriceGroup + ''')'

    EXEC (@query)

I already tried to use EXIST or a window function (example from here https://stackoverflow.com/questions/15723326/if-exists-in-where-clause), but I was not successful. I got the prices for the customer itself without the customer price group, but not the customer price group if no customer number is available (always nothing, both or only the customer price).

I need to get the following fields:

  • Sales Code
  • Item number
  • Item name
  • Unit price (according to the sales code, either CustomerNo or sales code)
  • Grouped by the item number

I am using Microsoft SQL Server 2016.

Any idea how I can solve that?

BR Raphi

unity – Apply external effects to player movement

In a 2D downhill game with the following, custom movement code, how do I apply external effects to the player’s movement?

For example, when the player hits an obstacle, I want them to get bounced off the obstacle and briefly stop before they are able to continue moving. How do I best integrate those types of external effects into my movement code in a way that is scalable?

private void UpdatePlayerVelocity()
{
    // Calculate the player's vertical movement speed
    float speedY = maxSpeed.y * Time.fixedDeltaTime;

    // Calculate the player's horizontal movement speed
    float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

    // Set the player's new velocity
    rb.velocity = new Vector2(speedX, speedY);
}

My player-obstacle collision is handled in the obstacle class, and I am using an action to notify the player about the collision. So I have the ability to have a corresponding method in the player class that get’s called when the collision occurs:

public void OnPlayerCollidedWithObstacle()
{
    // TODO:
    // Integrate the following into the above movement code ???
    // 1. Bounce the player off the obstacle
    // 2. Briefly stop the player from moving
    // 3. Continue moving
}

As a first step, I am thinking to wrap my default movement code in a bool check, so that it doesn’t get run when the collision movement code is run.

However, I was hoping for a better, more scalable way?

PS: I would like to keep my movement code custom, so no Unity physics / AddForce / etc.

csom – How to apply site-design in SharePoint Online?

Using CSOM, you can use tenant.applySiteDesign(). You need to pass the web URL and site design ID to this method.

Syntax:

public ClientObjectList<TenantSiteScriptActionResult> ApplySiteDesign(
    string webUrl,
    Guid siteDesignId
)

Official documentation can be found here:

Tenant.ApplySiteDesign method

Also, you can get complete code at: The Ultimate Guide to SharePoint Site Designs and Site Scripts

i use database first in entity framework in visual studio but when I click ” update model from database ” changes do not apply

i use database first in entity framework in visual studio but when I click ” update model from database ” then I see the message ” using this text template can potentially harm your computer . do not run it if you obtained it from an unstructed source” I click Ok ; but model dont update from database

usa – Can you apply for UK Tier IV visa from outside your home country?

I’m trying to apply for a UK tier IV visa to start on a PhD course starting in October. While the UKVI office is taking applications, there are no visa application centers open (or any date given to reopen) in the US to collect biometric data. So, I have two questions:

  1. Can the visa office use previous biometric data for a new residence card?
  2. Is it possible to apply for a Tier IV visa outside of your home country while on a visitor visa to another country?