由买买提看人间百态

topics

全部话题 - 话题: functions
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
M***7
发帖数: 2420
1
急。
请问SQL有相关function用来算cumulative distribution function of normal
distribution吗?
谢谢
D***h
发帖数: 183
2
For example, for tables A, B with Name, ID
I want to
select A.Name
from A, B
where A.Name = B.Name
but here the = is not strict equal. They are seen to be equal if these two
strings A.Name and B.Name are different with at most 1 character. For
example, 'John' and 'Johnn' are equal.
Is there any way to define a function to deal with this? Can I define a
function else where to define this equal, than then use it after "where"?
Thanks
i****a
发帖数: 36252
3
you can create a function that returns a table of results. but you cannot
overload an operator like "=", nor existing function

two
"where"?
i******7
发帖数: 421
4
来自主题: Database版 - SQL 2008 intelligent function 不见了
我2005用的是red gate promt,type的时候可以提示table什么的。本来2008用得好好
的,自带这个function,可是今天不知道碰了哪个key,只能自己type了。有没有同学
能指点一下在management studio里哪里可以找到这个function reset?
谢谢!
w*m
发帖数: 1806
5
来自主题: Database版 - Help, public function in oracle package
Hi all,
I created an package aa in shema a. inside this package, I have a
function aaa, now I want to use a.aa.aaa(xxxx) in schema b.
how can I make it works in schema b?
in schema b, I launch this function like this: aa.aaa(xxx);
thanks
w********9
发帖数: 461
6
我抄了个function,就是计算n天以后的working day。现在有个holiday table tbl_
holiday,要把holiday排除在外,怎么加进去?
谢谢!
ALTER FUNCTION [dbo].[find_WorkingDayADD](
@date datetime, --start day
@workday int --days to be added
)RETURNS datetime


AS
BEGIN
DECLARE @bz int

--不是整周
SELECT @bz=CASE WHEN @workday<0 THEN -1 ELSE 1 END
,@date=DATEADD(Week,@workday/5,@date)
,@workday=@workday%5
-- 整周
WHILE @workday<>0
SELECT @date=DATEADD(Day,@bz,@date),
@workday=CASE WHEN (... 阅读全帖
y****9
发帖数: 144
7

SQL> CREATE or replace FUNCTION f_test (in_activity_id IN INTEGER)
2 RETURN VARCHAR2
3 AS
4 cursor p_cur is
5 select object_name p_name from user_objects e
6 where e.object_id = in_activity_id;
7 p_rec p_cur%ROWTYPE;
8 lcl_p_list varchar2(4000);
9 BEGIN
10 OPEN p_cur;
11 LOOP
12 FETCH p_cur INTO p_rec;
13 EXIT WHEN p_cur%NOTFOUND;
14 lcl_p_list := lcl_p_list || ';' || p_rec.p_name;
15 END LOOP;
16 CLOSE p_cur;
1... 阅读全帖
e******u
发帖数: 211
8
来自主题: Database版 - oracle pl sql recursive function
The function occasionally doesn't have the return value. Anyone knows what
might be the issue?
FUNCTION chk_and_gen_ic (cnt IN NUMBER)
RETURN VARCHAR2
IS
n_invitation_code VARCHAR2 (20);
t_ic_chk NUMBER;
BEGIN
SELECT DBMS_RANDOM.STRING ('X', 10)
INTO n_invitation_code
FROM DUAL;
select count(*) into t_ic_chk from invitation_code where
invitation_code = n_invitation_code and rownum = 1;
IF t_i... 阅读全帖
s********1
发帖数: 581
9
来自主题: Java版 - 什么是functionality test?
什么是functionality test?
software QA 中的functionality test 与其他的QA test 有什么区别?
谢了。
c*m
发帖数: 836
10
来自主题: Java版 - 什么是functionality test?
It could be a generic term about functional test, or a special term that
refers to the test for Functional Spec. In that context, there's also User
Acceptance Test for User Requirements Spec, etc.
s******e
发帖数: 493
11
You misunderstood what dynamic variable and dynamic functions mean. they are
not someting that preexist at the compiling time.
both js ans as allow you to define a new memeber of class on the fly.
.for example, adding a new variable/function to a class at run time.
g*****g
发帖数: 34805
12
How you want to coin the names is not that important. The OP wants
to call some function by parsing a string from DB. And Spring IoC
is a perfect example for that. If you want to add new variable/function,
look at AspectJ.

are
s******e
发帖数: 493
13
if so, even dynamic functions are not enough. Dynamic functions are not real
dynamic, you still need to code them in your code base.
what you need is either using db or xml file or any format file to act as a
configuration file, treating your first name as operand one, and last name
as operand two (if you are sure that you will only have two operands, and
they will be stored in columns that you know ahead. Otherwise if even the
operands are unknown at compilation time, it will be way too compli
s******e
发帖数: 493
14
just have thought, you may be able to take advantage of jdk 1.6 with mozilla
rhino(the only built-in Jscript implemntation support in hotspot)
for example you have a formula (op1 * 13 - op2)/13 *op2, you store in
formula in db or xml, because java new script engine allows you to define
your js function in java, you can just simply replace op1 and op2 at run
time, and send the defined function to js engine. this way you just take
advantage of exsiting js engine parser and interpreter. You do not
x****d
发帖数: 1766
15
来自主题: Java版 - functional programming for java
Is it possible to borrow functional language characters/features to Java?
How much benefit can we get?
I know there is AKKA, anyone care to introduce how AKKA benefits Java?
If I make myself some immutable data structure, or declarative feature, do I
automatically get functional programming benefit, if not, why? Can anyone
explain? Is it due to compiling optimization process or what?
What FP benefit I can get in Java by using FP concept, what cannot be
achieved by simply mimicking FP?
Or do we h... 阅读全帖
c******o
发帖数: 1277
16
来自主题: Java版 - functional programming why? (转载)
【 以下文字转载自 Programming 讨论区 】
发信人: coltzhao (coltzhao), 信区: Programming
标 题: functional programming why?
发信站: BBS 未名空间站 (Fri Nov 1 14:53:02 2013, 美东)
编了一段FP的code了,来说说我的理解。
FP其实不是编程方式的不同,是实现你想法到working code的方法不同。
大家说起FP,一般都先想到function first.没错,但是FP还有很多很重要但是不为人
了解的侧重点。
1. immutability (不变性),这个很多人说不实用,没错,在某些意义上是不适用。
但是对于非IO瓶颈的项目,你总能把你最看重的那部分分离出来做纯FP,immutable.其
他的继续imperative.其实实际编程时考究的主要是建模/抽象/算法,把它变成
parallellable,其他都容易,FP就是让它容易的工具。让你能多想建模/抽象/算法。
2. lazy evaluation,这个其实也是各种FP强调的一点。也很好,和 immutabi... 阅读全帖
c******o
发帖数: 1277
17
来自主题: Java版 - functional programming why? (转载)
【 以下文字转载自 Programming 讨论区 】
发信人: coltzhao (coltzhao), 信区: Programming
标 题: functional programming why?
发信站: BBS 未名空间站 (Fri Nov 1 14:53:02 2013, 美东)
编了一段FP的code了,来说说我的理解。
FP其实不是编程方式的不同,是实现你想法到working code的方法不同。
大家说起FP,一般都先想到function first.没错,但是FP还有很多很重要但是不为人
了解的侧重点。
1. immutability (不变性),这个很多人说不实用,没错,在某些意义上是不适用。
但是对于非IO瓶颈的项目,你总能把你最看重的那部分分离出来做纯FP,immutable.其
他的继续imperative.其实实际编程时考究的主要是建模/抽象/算法,把它变成
parallellable,其他都容易,FP就是让它容易的工具。让你能多想建模/抽象/算法。
2. lazy evaluation,这个其实也是各种FP强调的一点。也很好,和 immutabi... 阅读全帖
w*s
发帖数: 7227
18
【 以下文字转载自 Programming 讨论区 】
发信人: wds (大盘5000不是梦), 信区: Programming
标 题: 关于在c++ member function里用signal( )
发信站: BBS 未名空间站 (Wed Aug 19 19:10:27 2015, 美东)
linux里这个例子
void my_handler (int param)
{
signaled = 1;
my_handler2(...);
}
int main ()
{
signal (SIGINT, my_handler);
}
如果my_handler, my_handler2是c++ member function,那么怎么整?
我老用了巨复杂的办法,奶奶的。。。
f**t
发帖数: 14
19
来自主题: Programming版 - Can HttpServlet call a C/C++ function ?
Can HttpServlet call a C/C++ function ? Assume C/C++ functions are coded as
shared library.
I read it, different places give different answer. Some places says untrusted
servlets cannot "calling native methods". So how to do this with HttpServlet ?
Thanks.
X****r
发帖数: 3557
20
来自主题: Programming版 - inline functions in C++
If there are some common parts within many functions, why didn't make them
a separate function in the first place?

funcs
X****r
发帖数: 3557
21
来自主题: Programming版 - inline functions in C++
If there are some common parts within many functions, why didn't make them
a separate function in the first place?

funcs
p*u
发帖数: 2454
22
来自主题: Programming版 - how to get runtime caller function?
i got a function which is called by many others, now i want to
know who the callers are at runtime. How can I do this in C++, say
print out the caller functions names? thanks.
A**********e
发帖数: 3102
23
来自主题: Programming版 - How to stop a function in MATLAB?
what do u mean?
if you can even type `exit', then your function most likely is not running.
so i guess you were asking how to quit a function and return back to the
main program. in this case, use `return'

If I use "exit", it will exit the entire MATLAB environment. But how can I
stop the my program without exiting the MATLAB? Thanks.
i***w
发帖数: 9
24
来自主题: Programming版 - MATLAB function call too slow
After I profiled my programe, I found that the most time consuming part (
self time) in a function f(...) is something like this:
[A,B,C]= g(x,A,B,C);
I'm wondering why this statement will be slow? Since it's self time of f(...
),
it's not the time within function g(...). Does this mean the time is
consumed in copying matrix parameters A,B,C ? How can I improve the
speed? Thanks a lot.
n*****d
发帖数: 956
25
来自主题: Programming版 - MATLAB function call too slow
You may need to look inside the function. For example, if you have a number
of nested 'for', 'while' loops, it's bound to be slow. Change those into
matrix operations if you can.
Rewriting it in C is a good idea, if speed is an issue. I got a nonlinear
filter function running at least 20 times faster after rewritting it in C.
l******e
发帖数: 94
26
来自主题: Programming版 - Interview questions about hash function
Phone screen question:
You have a billion urls , where each has a huge page, how to detect the
duplicate documents?
I said hashing the document contents, so the interviewer asker do I know
which hash function should I used? I have no clue about what specific
function can hash a large file into a small key that takes relatively less
space.
Anybody give can give me some hint?
n********u
发帖数: 5
27
I need to pass a cell matrix with variable size (m X n) to a own defined VBA
fuction myfun(dataRange as Range). In this function the selected cell
matrix will be stored in an data array. I used to use Range.CurrentArray or
Range.Value2 to store the data into an assigned array variable successfully.
However, it requires the cells contain no formula. If the data in the cells
are obtained by a formula, everything screws up.
The code is shown below:
‘The function stores the data in selected cell mat
o**f
发帖数: 76
28
来自主题: Programming版 - Question: Given a pointer to a function
Question: Given a pointer to a function, can you find out which function it
is? Thx in advanced!
Example:
typedef void (*foo)();
void abc();
... ...
foo f_ = abc;
... ...
now if f_ is used later, can we tell its name is "abc"?
c****e
发帖数: 1453
29
来自主题: Programming版 - How to check the virtual function table size?
Statically, I think you can count the number of virtual functions and times
4.
Here is my guess:
suppose we want to know the vtable size of class B.
build D,
class D : public B
{
virtual void test(){}
};
now, in the memory:
D:
+0: pointer to vtable
vtabble:
... v functions in class B
test()
D * pd= new D;
void (*p)()=pd->test;
char * vtable_base=(char *)(*(int *)pd);
vsize=(char *)p - vtable_base;
c*****g
发帖数: 119
30
来自主题: Programming版 - How to check the virtual function table size?
2.是说:程序运行的时候没法知道到底一个object有几个virtual functions。如果
class里virtual function改变了,其他的code相应地都得变。

the
y***y
发帖数: 295
31
假设我的class MyClass overload了function call operator
MyClass::operator()(int, int);
我如何能够通过this调用这个operator呢?
试过this.operator ()(a, b);
在gcc下编译似乎不通过...
谢谢!!!
r*********r
发帖数: 3195
32
来自主题: Programming版 - boost::function 的 syntax 问题
搞定了, bool (int) 是 function 类型, 而不是 function pointer 类型.
下面的小程序中 T *t_ 如果换成了 T t_ 就不能编译.
#include
template
class foo {
T *t_;
public:
foo(T *t) : t_(t) {}
void call(int n) { std::cout << (*t_)(n) << std::endl; }
};
bool bar(int x) { return x == 0; }
int main()
{
foo f(&bar);
f.call(0);
return 0;
}
s********1
发帖数: 581
33
来自主题: Programming版 - 什么是functionality test?
什么是functionality test?
software QA 中的functionality test 与其他的QA test 有什么区别?
谢了。
g*****g
发帖数: 34805
34
functions in C++ are non-virtual by default,
non-static methods in Java can only be virtual.
r*********r
发帖数: 3195
35
来自主题: Programming版 - pointer to function
there are implicit type conversions between a function name and
the corresponding function pointer both ways.
&, * are therefore both optional.
n**d
发帖数: 9764
36
来自主题: Programming版 - pointer to function
I see. Thanks!
We use typedef to declare FT as a type of pointer to function and then use
FT to declare a[2]. If we don't use typedef, how could we declare elements
of a[2] as pointers to functions?
h**o
发帖数: 548
37
来自主题: Programming版 - how to count the times a function is used
I have a files which records some activities of all functions.
I want to count how many times each of the function is called.
How to write a unix shell to count them?
or is there any other way?
Thanks
i***h
发帖数: 12655
38
来自主题: Programming版 - how to count the times a function is used
What function? You mean C/C++ function?
if in C,
void f() {
static int count = 0;
count++;
}
h**o
发帖数: 548
39
来自主题: Programming版 - how to count the times a function is used
yes, I don't have. Here are some format I can parse the name of the
functions:
90861840 90001000 d80ca215c298 1
cd9028 cc69c0 0
libumem.so.1`umem_cache_alloc_debug+0x12b
libumem.so.1`umem_cache_alloc+0xc8
libumem.so.1`umem_alloc+0xaf
libumem.so.1`malloc+0x2e
libumem.so.1`calloc+0x35
xcalloc+0x3b
memPoolAlloc+0x28d
0x4e6f81
functionA+0x130
0x4eaa53
functionB+0x11b
libwebproxy.so.1`functionC+0x6ab
libwebproxy.so.1`functionD+0xa8
libwebproxy.so.1`functionE+0x6dc
libwebproxy.so.1`functionF+0x6d4
...
r*******y
发帖数: 290
40
来自主题: Programming版 - C++: friend function
then what's the point of keeping a private function or data member private?
in many cases, you only trust some non-member functions or classes
r*******y
发帖数: 290
41
来自主题: Programming版 - C++: friend function
take the following example:
class Base
{
private:
virtual f();
}
class Derived : public Base
{
public:
virtual f(); //Error, cannot override base
}
If you don't declare Derived as a friend of Base,
you will have compilation errors in many mordern compilers
friend is not just for convenience, a friend function is considered an
interface
of the class, you can just treat it as a public member function
k**f
发帖数: 372
42
来自主题: Programming版 - C++: friend function

Not necessary friend functions. As long as the implementation can get
everything it need from the public interface.
Of course, I agree that they have to be non-member functions.
f******y
发帖数: 2971
43
【 以下文字转载自 JobHunting 讨论区 】
发信人: hours16 (你好), 信区: JobHunting
标 题: interview question: make all class member functions virtual
发信站: BBS 未名空间站 (Mon Aug 25 21:52:32 2008)
the drawbacks of making all class member functions are virtual,
1. virtual table is bigger and lower the efficiency.
2. any more?
it seems the interviewer expect for more drawback, Thanks
d******n
发帖数: 42
44
it can be inline function but the complier will probably not treat it as
inline function:)
g*****g
发帖数: 34805
45
Efficiency is the only benefit of non-virtual function.
By making all non-static functions virtual, Java simplifies
its syntax a lot.
g*****g
发帖数: 34805
46
On the contrary, it's more complicated in C++ way.
Let's say Child inherits from Parent, both have a do function.
Parent a = new Child();
Child b = new Child();
In C++, a.do() will call Parent.do(), b.do() will call Child.do() if
do() is not virtual.
but both a and b are an instance of Child in runtime. This can
be confusing, you have to check declaration of Parent before you know
whether it's virtual and which function is called.
In java, it's always calling Child.do().

about
b***y
发帖数: 2799
47
来自主题: Programming版 - [合集] C++ pure virtual function question
☆─────────────────────────────────────☆
gebitan (she is coming soon...........) 于 (Thu Jul 21 16:54:29 2005) 提到:
I always thought that a pure virtual function can not have implementation. But
after I read scott meyers's effective C++ (2nd ed) item 36, he did make the i
mplementation for the pure virtual function. but I can not understand why he u
se it.What's the advantage of using it? Anybody can explain it a little bit?
Thanks a lot.
☆─────────────────────────────────────☆
crystalike
s***e
发帖数: 122
48
来自主题: Programming版 - virtual function question

struct Derived 3 : public Derived 2{
virtual int vf2 (int);
// diferent from vf1!
==============
WHY DIFFERENT? WHY SHOULD BE CAREFUL HERE? I AM LOST
================
they are different because they have different name.
be careful because this vf1() has different signature than vf1() derived
from its superclass: int vf1(int) <=> int vf1(void), so it's a new function.
i personally think they have nothing to do with virtual functions, but trick
things.
================
virtual int vf1 (int); // B
s*******u
发帖数: 1855
49
【 以下文字转载自 JobHunting 讨论区 】
发信人: siriusliu (天狼), 信区: JobHunting
标 题: 问题:vptr/vtable for virtual function & vptr/vtable for virtual inheritance, are they the same?
发信站: BBS 未名空间站 (Wed Nov 5 00:58:56 2008)
we know that both virtual function and virtual inheritance have vptr
pointing to vtable. My question is: do they use one SAME table/ptr, or TWO separate table/ptr?
For ex:
r**u
发帖数: 130
50
是什么原因?
是一个写tif图形文件的function,这个function还调用了一个tiff静态库。
在c++中头文件以extern "C" 引用。
输出的tif文件不一样,一个是灰度图,一个几乎全白,边界倒是有点像。
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)