I’ve watched multiple videos and read articles about recursion but I’m still confused. I’ve got this problem here but I’m unsure how to answer it. Could someone help explain? Thanks
Tag: functions
SharePoint JS Button Ribbon is not reading functions
I am trying to add a new button to the ribbon in my list. The button shows fine but no action is taken, the main idea is this button will update status column that have In Progress Status to Finished and whenever i select a line in a list that contain the status Complete the button will not be clickable anymore.
The problem is the button is not clickable so i think there is a mistake in the code, and maybe the issue from CountDictionary.
Code Pastebin
Console Error:
Refused to display 'https://MYURL' in a frame because it set 'XFrameOptions' to 'deny'. core.js:1 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. GetTenantAppData @ core.js:1 InsertFeatureMenuItems @ core.js:1 BuildMenu @ core.js:1 BuildMenuWithInit @ core.js:1 $ 21_0 @ sp.core.js:2 $ 1a_0 @ sp.core.js:2 $ 1c_0 @ sp.core.js:2 canHandleECBCommand @ sp.core.js:2 canHandleCommand @ sp.ribbon.js:2 canHandleCommand @ sp.ribbon.js:2 callCommandHandlerForEnabled @ cui.js:1 canHandleCommand @ cui.js:1 callCommandHandlerForEnabled @ cui.js:1 isCommandEnabled @ cui.js:1 isRootCommandEnabled @ cui.js:1 $ 3x_1 @ cui.js:1 pollForStateAndUpdateInternal @ cui.js:1 $ AK_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 $ 4i_0 @ cui.js:1 pollForStateAndUpdate @ cui.js:1 $ 8L_0 @ cui.js:1 $ Cu_1 @ cui.js:1 (anonymous) @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 onDataReturned @ cui.js:1 (anonymous) @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 (anonymous) @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 completed @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 _onReadyStateChange @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 XMLHttpRequest.send (async) executeRequest @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 executeRequest @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 invoke @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 runQuery @ cui.js:1 $ Bc_1 @ cui.js:1 (anonymous) @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 doDelayedInit @ cui.js:1 set_selected @ cui.js:1 $ Ae_2 @ cui.js:1 $ AI_2 @ cui.js:1 (anonymous) @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 b @ ScriptResource.axd?d=TA1MgOAPt2S0wFM8dFGwuWKHg2XaPc684eJp7FP_67rlJqh_Fy_Xjkn5ziwJMbCkOJ41oX9o_cKAJX0xzg0HbwlWBEFNuArPY86NsLzD6R_SKXLQjGle6rEuZZHL1xOiP3frbFnmLL3MqFYYdqlsNUyoNBczQFixGIl_YkLIm7HCn1_2zKXUNLUgAZm0&t=ffffffffa580202a:5 Show 5 more frames VM1354:1 Uncaught ReferenceError: EnableFinishedButton is not defined at eval (eval at $ 39_1 (sp.ribbon.js:2), <anonymous>:1:12) at SP.Ribbon.CommandUIExtensionPageComponent.$ 39_1 (sp.ribbon.js:2) at SP.Ribbon.CommandUIExtensionPageComponent.canHandleCommand (sp.ribbon.js:2) at CUI.Page.CommandDispatcher.callCommandHandlerForEnabled (cui.js:1) at CUI.Page.CommandDispatcher.isCommandEnabled (cui.js:1) at SP.Ribbon.PageManager.isRootCommandEnabled (cui.js:1) at CUI.Ribbon.$ 3x_1 (cui.js:1) at CUI.Controls.Button.pollForStateAndUpdateInternal (cui.js:1) at CUI.Controls.Button.$ AK_0 (cui.js:1) at CUI.ControlComponent.$ 4i_0 (cui.js:1)
Any idea how could i fix it ?
Thank you !
Are type abstraction values and universal types not for non functions, but only for functions?
In Types and Programming Languages by Pierce, Chapter 23 Universal Types has a summary of System F in the following figure, in particular, “type abstraction values” and their types “universal types”.
In all the examples I have seen so far in the chapter, in particular Section 23.4 Examples, (not sure if I miss any example):
 all the type abstraction values are parametrically polymorphic functions, by allowing the types of their arguments to have any type, and
 all the universal types, i.e. the types of type abstraction values, are types of parametrically polymorphic functions.
Are type abstraction values and their universal types not for non functions, but only for functions?
More specifically, in any type abstraction value, say $ \lambda X.t$ , must $ t$ have a function type, not a nonfunction type?
In Section 23.4 Examples, values of base types and of recursive types are type abstraction values, because their definitions in the section are functions by Church encodings.
Thanks.
Minimization of superlinear functions
Let $ A\in\mathbb N_+$ , and let $ f:\mathbb N_+\to\mathbb N_+$ be nondecreasing function that satisfies $ f(n)\in \Omega(n)$ .
Is it true that
$ \displaystyle\min_{a\in\{1,\dots,A\}}\{f(a)+f(Aa)\}=f\Big(\Big\lceil\frac A 2\Big\rceil\Big)+f\Big(\Big\lfloor\frac A 2\Big\rfloor\Big)$ ?
Thanks in advance!
Why are noncollisionresistant hash functions considered insecure for signatures
Let we have a hash function that is second preimage resistant but not collisionresistant.
Then an adversary can create a pair of different messages M and M’, M is benign and M’ is malicious, for both of which the signature will be valid.
I don’t understand why it is an issue in the setting where signatures are used to authenticate origin of data created by the same entity. So if one signs some software he claims “I have created this content myself, if it contains malware, blame me”. And for keys: “this public key has a corresponding private key, I have access to it”.
If one crafts a collision and signs selfgenerated data … he still claims the above statements.
So should such hash functions be considered secure for things like selfsigned certificates and code signing?
Which algorithm would be better to integrate “step” like functions
I have a function f[wr], in which the appearance is step like, first of all, the NIntegrate
function is not handling this function, so I decided to do the integration algorithm by hand.
Without joined in plot
I have tried to integrate f[wr] using Riemann’s sum
data[mu_] := Module[{Te = 300., sum = 0., sum1 = 0., kb = 8.61*10^5, a}, Do[ sum = sum + (f[wr] 0.01); sum1 = sum1 + (f[wr] (wr  mu) 0.01);, {wr, mu  30 kb Te, mu + 30 kb Te, 0.01}]; sum1/(Te*sum)]
and then, evaluate it with
Table[{data[mu],{mu,1,1}]
I think the results could be better if I try other algorithm. Could you suggest one?
edit: f[wr] algorithm https://pastebin.com/tfbGmhDa
How to pass objects between functions in PnP PowerShell
I have to functions. In the first, I create a reference to a SharePoint list. I would like to pass the list to a second function. In the second functions list of parameters, I declare it as String
This doesn’t work. How do I declare the parameter as being a list?
function GetList() { param( [string] $ listID, [string] $ listName ) WriteHost "Provided ListName: " $ listName ForegroundColor Cyan WriteHost "The list id is: " $ listID ForegroundColor Red $ list = GetPnPList Identity $ listName CreateView list $ list } function CreateView() { param( [string] $ list ) AddPnpView Title "Test View" List $ list Fields "Title" WriteHost "Creating New View" }
multiple functions with same filter
I want to use the same filter hook in different locations, and I just want to make sure this is OK to do so ( preliminary test shows it works, but I am not 100% sure it is OK to do so).
So the add_filter(‘check_powers’, …. ) is in one location only ( not that it matters)
function define_user_powers() { if ( user_is_powerful() ){ add_filter('check_powers', 'give_super_power'); } } function give_super_power( $ powers ){ $ powers = true; return $ powers; }
But the apply_filters(‘check_powers’) is in several locations:
function kick_ass() { $ powers = apply_filters('check_powers', false ); if ( $ powers ) { do_smthng(); } } function fly() { $ powers = apply_filters('check_powers', false ); if ( $ powers ) { do_smthng_else(); } }
All questions i have found relates to the other way around ( multiple add_filter to same hook).
Plotting Integral of Exponential functions
I am trying to Plot an integral equation that involves exponential function. My code is as follow,
L[\[Alpha]_] := NIntegrate[ 1/(k + I*0.1) ( Exp[I*k*x] (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w]  1) (Exp[k*w]  1 + I*0.1) Sqrt[ k^2 + \[Alpha]/ w^2])/((Sqrt[k^2 + \[Alpha]/w^2] + k) (Exp[ Sqrt[k^2 + \[Alpha]/w^2]*w  Exp[k*w]]) + (Sqrt[ k^2 + \[Alpha]/w^2]  k) (Exp[(k + Sqrt[k^2 + \[Alpha]/w^2]) w]  1)), {k, 100, 100}]; Plot[{Re[L[10]], Re[L[100]], Re[L[500]]}, {x, 0.45, 0.45}, PlotRange > Full].
But this integral gives a lot of oscillations which it should not. This is fig 2 in this article “https://arxiv.org/pdf/1508.00836.pdf” that I am trying to plot. Any help will be highly appreciated.
How can we convert between a program using `call/cc` and a program using functions written in CPS?
The Scheme Programming Language says
It turns out that any program that uses call/cc can be rewritten in CPS without call/cc, but a total rewrite of the program (sometimes including even systemdefined primitives) might be necessary.
What are the general techniques to

convert a program using call/cc to a program using functions written in CPS

convert in the reverse direction?