user-defined-functions

Add help to “No help available” Excel, VBA , User defined functions

家住魔仙堡 提交于 2019-12-19 11:30:16
问题 I was trying to add some help to my user-defined function(UDF) in Excel, written using VBA(Visual Basic for Applications). I know how to add a description.Any idea how I can add help at the blue link "Help on this function" and not have it lead to a MsgBox that reads "No help available" ? 回答1: You have to first create a help file. You can then use Application.MacroOptions to attach the help file to the function For example Application.MacroOptions Macro:="MyFunction", _ Category:="My Custom

Mongo User Defined Functions and Map Reduce

北慕城南 提交于 2019-12-19 10:39:49
问题 Is there a way in mongo to create user-defined Javascript functions. I have several Map/Reduce functions on the client side that i would like to use within other MR functions. For example, several MR functions calculate all sorts of averages. I want to be able to use them like so : function reduce(k,v) { if (val > myDatabaseAverage()) // ..do something } 回答1: Use db.system.js.save( { _id : "myDatabaseAverage" , value : function(){ // ..do something } } ); That will store the JS function on

Spark UDAF - using generics as input type?

北城余情 提交于 2019-12-19 04:14:15
问题 I want to write Spark UDAF where type of the column could be any that has a Scala Numeric defined on it. I've searched over Internet but found only examples with concrete types like DoubleType , LongType . Isn't this possible? But how then use that UDAFs with other numeric values? 回答1: For simplicity let's assume you want to define a custom sum . You'll have provide a TypeTag for the input type and use Scala reflection to define schemas: import org.apache.spark.sql.expressions._ import org

Pyspark: PicklingError: Could not serialize object:

我的梦境 提交于 2019-12-19 02:31:12
问题 I have the following two data frames: df_whitelist and df_text +-------+--------------------+ |keyword| whitelist_terms | +-------+--------------------+ | LA| LA city| | LA| US LA in da | | client|this client has i...| | client|our client has do...| +-------+--------------------+ +--------------------+----------+ | Text| Keywords| +--------------------+----------+ |the client as ada...|client;ada| |this client has l...| client;LA| +--------------------+----------+ In df_whitelist, each

Add user defined function to Visual Studio Excel Add-in

六眼飞鱼酱① 提交于 2019-12-18 19:08:46
问题 In visual studio I have an Excel 2010 Add-in project. How can I have that project create the following module: I know I can save that workbook with that module then use it with my add in. It will be nice if I can have my add-in create that module... 回答1: It is possible to create the module. However for this to work the setting to "Trust access to the VB Project model" must be selected in Excel. It throws an error that access is denied if the trust setting is not selected. using Excel =

Add user defined function to Visual Studio Excel Add-in

痴心易碎 提交于 2019-12-18 19:08:14
问题 In visual studio I have an Excel 2010 Add-in project. How can I have that project create the following module: I know I can save that workbook with that module then use it with my add in. It will be nice if I can have my add-in create that module... 回答1: It is possible to create the module. However for this to work the setting to "Trust access to the VB Project model" must be selected in Excel. It throws an error that access is denied if the trust setting is not selected. using Excel =

Deterministic function in mysql

隐身守侯 提交于 2019-12-18 18:49:30
问题 I got confused with a seemingly simple concept. Mysql defines deterministic function as a function that always produces the same result for the same input parameters So in my understanding, functions like CREATE FUNCTION foo (val INT) READS SQL DATA BEGIN DECLARE retval INT; SET retval = (SELECT COUNT(*) FROM table_1 WHERE field_1 = val); RETURN retval; END; are not deterministic (there is no guarantee that delete/update/insert does not happen between 2 calls to the function). At the same

MySQL user defined functions

大城市里の小女人 提交于 2019-12-18 13:38:51
问题 I have a table contains a few columns say: column_1, column_2 and column_3. I appended an new column to the table called score. What I want to do is calculate the score based on these three columns and tune the parameters easily. Say my score formula looks like below: score = a * column_1 + b * column_2 + c * column_3 is it possible to create a udf or process(never used before) to easily do that? so I have a function like getScore(a,b,c) and I could do something like: select column_1, column

Nhibernate filtering by user defined function output

空扰寡人 提交于 2019-12-18 13:36:37
问题 I'm reasonably new to NHibernate and everything has been going pretty well so far but I've come across a problem I'm not exactly sure of how to go about solving. Basically I need to filter by the output of a User Defined function. If I was writing in SQL this is what I'd write: declare @Latitude decimal declare @Longitude decimal declare @radius int set @Latitude = -118.4104684 set @Longitude = 34.1030032 select * from store where dbo.CalculateDistance([Latitude], [Longitude], @Latitude,

inner join Vs scalar Function

﹥>﹥吖頭↗ 提交于 2019-12-18 13:07:26
问题 Which of the following query is better... This is just an example, there are numerous situations, where I want the user name to be displayed instead of UserID Select EmailDate, B.EmployeeName as [UserName], EmailSubject from Trn_Misc_Email as A inner join Mst_Users as B on A.CreatedUserID = B.EmployeeLoginName or Select EmailDate, GetUserName(CreatedUserID) as [UserName], EmailSubject from Trn_Misc_Email If there is no performance benefit in using the First, I would prefer using the second...