Questions tagged [redefine]

101 questions
3
votes
3 answers

How can I redefine 'open' properly in Perl?

Some time ago, I ask a question: How do I redefine built in Perl functions? And the answers have served me well. I have a package that overrides Perl's 'open' function enabling me to log file access. Now I've come to a case that breaks the…
mmccoo
  • 8,386
  • 5
  • 41
  • 60
3
votes
2 answers

How to redefine the .^ operator in MATLAB?

How can I redefine the exponential function .^ in MATLAB? From: x.^y to: sign(x).*abs(x.^y))
h02h001
  • 167
  • 4
  • 11
3
votes
2 answers

How to override the main create method in odoo11?

I have a lot of models (around 30) that overrides the create method to check for a license state and all of them go like this: class Model1(models.Model): _name='testing_model1' @api.model def create(self) check_license(self) …
David Rios
  • 377
  • 4
  • 9
3
votes
1 answer

why using std::sqrt failed if I redefine the sqrt function?

#include double sqrt(double); int main() { double a = std::sqrt(4.0); std::cout << a; return 0; } double sqrt(double a) { return 1.0; } I know I declare the sqrt at first, but I use std::sqrt, it still call my own…
xmzhang
  • 79
  • 1
3
votes
2 answers

When I use java.lang.instrument.Instrumentation#redefineClasses(), should I pass an array to the function?

I used java.lang.instrument.Instrumentation#redefineClasses() to redefine existing classes. Sometimes, I need to redefine several classes. If I redefine classes one by one, I will know which ones were successful and which ones failed. But is it…
wang ming
  • 199
  • 2
  • 9
3
votes
3 answers

How can I change the value or a static char* from a function? C++

I am trying to change the value of a "static char *" I define at startup, I do it from inside a function, and when this function returns the var I am trying to re-set the value doesn't retain it. Example: static char *X = "test_1"; void…
flyout
  • 497
  • 1
  • 9
  • 16
3
votes
1 answer

Is it possible to prevent matlab from defining variables which overwrite function names?

From time to time I have this problem with Matlab where I for example, create a variable named "max" and then get all kinds of weird errors when I try to use the function max() on something, since I overwrote the function by accident with my…
user985366
  • 1,635
  • 3
  • 18
  • 39
3
votes
2 answers

Java. Restrictions on class redefinition

Java Platform SE 5 API specification for method Instrumentation.redefineClasses(ClassDefinition[]) tells: The redefinition may change method bodies, the constant pool and attributes. The redefinition must not add, remove or rename fields or …
2
votes
1 answer

Redefine XMLHTTPRequest in overlay.js in Mozilla Firefox Add-on

I'm building a firefox extension and would like to change the behavior of the XMLHTTPRequest object for every page loaded. I found following code which should do the trick: appcontent.addEventListener("load", function(event){ var…
lamberreke
  • 55
  • 4
2
votes
2 answers

cfset problem with adding to existing variable

I am pulling my hair out working on what would seem to be easy problem. But as a ColdFusion rookie I am just having a hell of a time figuring it out. So ...…
Mitchell
  • 313
  • 5
  • 14
2
votes
3 answers

C++ class redefinition error

I am compiling a logging program, but I am receiving this error and cant figure it out for the life of me... logger.cpp:15: error: redefinition of ‘class Logger’ logger.h:20: error: previous definition of ‘class Logger’ with gcc when i compile with…
Andrew L
  • 534
  • 1
  • 5
  • 9
2
votes
1 answer

Re-defining the Python 3 print function in Jupyter Notebook

I am trying to re-define the built-in print function in Python3 to have the flush keyword argument set to True by default. Something like the following (this does not actually work): def print(message): print(message, flush=True) Alternatively,…
Jo Simon
  • 41
  • 2
2
votes
1 answer

Why same-name variable in different included jsp doesn't cause exception?

I have a index.jsp which has included header.jsp and frontpage.jsp as follow: ... <%@ include file="include/header.jsp"%> ... ....... In header.jsp: ... String __jspName =…
Scott Chu
  • 972
  • 14
  • 26
2
votes
1 answer

Multiple pathways for data through a layer in Caffe

I would like to construct a network in Caffe in which the incoming data is split up initially, passes separately through the same set of layers, and is finally recombined using an eltwise layer. After this, all the parts will move as a single…
2
votes
1 answer

How can I redefine variables in C?

#include int main(void) { int i = 365, j = 100, result = i + j; printf("i + j is %i\n", result); int i = 100, j = 1; printf("i + j is %i\n", result); return 0; } 9.c:10:10: error: declaration shadows a local…
Yellowfun
  • 418
  • 1
  • 9
  • 21
<%@ include file="include/frontpage.jsp"%>