ModX: Where is the insert_metka function? - content-management-system

I have an issue with my ModX Evo site throwing this error:
Fatal error: Cannot redeclare insert_metka() (previously declared in /home/mysite/public_html/manager/includes/document.parser.class.inc.php(794) : eval()'d code:2) in /home/mysite/public_html/manager/includes/document.parser.class.inc.php(794) : eval()'d code on line 12'
I have searched and searched but cannot find where insert_metka() is declared. I even downloaded the entire site and ran a search to no avail. I also tried to updated the version to the latest, also to no avail.
Can anyone please tell me where to find this function?

Download a database dump and look for the this line in it. It seems that the fault one of the plugins, try disabling plugins until you find it. See ModX Evo: PHP error in document.parser.class.inc.php for more advices.

As you can see from your error-code, the function was declared in a snippet. This is because Modx has this way of caching snippets to speed up the performance. They make static files of your snippets wrapped as a function.
This may cause errors if the same function is called twice and you declared a function within it. I suspect that is what is going on here.
To solve this issue, simply wrap your entire function in function_exists like so:
if (!function_exists("insert_metka")) {
function insert_metka() {
// Stuff goes here
}
}
Sidenote: This is in addition to the answer given by Vasis. You should search your snippets, extras and plugins. It should be located somewhere in those files. It is not a function provided from the Modx core.

Related

why is my .gitattribute function not taking out my generated js file

Like many github users, I would benefit from being able to ignore a specific file from the language statistics. I'm generating/bundling a javascript file from react files and I want to exclude it from the statistics. Here's my .gitattributes file.
BlueSlide/static/js/homepage_compiled.js linguist-generated=true
I'm having trouble finding many examples on this, but the few that I do find look like this (https://help.github.com/en/articles/customizing-how-changed-files-appear-on-github) so I'm not sure why it's not working. Maybe it just takes time to update the statistics?
apparently the =true part breaks it, despite it being on there documentation... As soon as I got rid of it, it worked
BlueSlide/static/js/homepage_compiled.js linguist-generated

Matlab rfplot not working

I'm trying to plot the S-Parameters in a file .s4p using the RFtoolbox but it seams that the function that I need rfplot doesn't work.
I searched which rfplot to see if the function exsits, and it is, but it's empty. I opened and inside I have this line:
narginchk(1,Inf)
error(message('MATLAB:UndefinedFunctionTextInputArgumentsType','rfplot',class(varargin{1})))
I tried also with other versions of Matlab (I have R2017a) where I work, but everyone have this kind of function.
Do you know why? Al the other functions of RFtoolbox work perfectly. How can I solve it if this problem is not related to my version?
The function exist, and the code exist too, but its hidden. Its a MATLAB proprietary code and they do not want you to know the real code behind it, so you can not see it.

breeze mongo manager.saveChanges() error

I'm learning from breeze-zza-mongodb sample.
I get some problems when i try to use the saveChanges() function from breeze.
This is the error i get:
"TypeError: Cannot read property 'update' of null at... node_modules\breeze-mongodb\mongoSaveHandler.js : 229:20 at Array.forEach"
Any of you tried and got this error? I searched Google for a bit longer but i can't find this issue. And if i try to manager.getChanges() and put the changes in array, i get my entity with modified state.
The guys from breeze didn't covered this part and i'm completly blind in this. Thank you for your time guys.
I solved my problem. I included the modules in VS so i can debug and i noticed that breeze misnamed my collection name for some reason adding an s at the end.
Anyway.. for now i just removed that, and it works. I will dig deeper to see where and why is breeze adding an s at the end of my collection name because i want to treat the cause, not the effect. Thanks.

Fay: include another Fay file?

I have one Fay file which is the heart of my program, however I need some helpers for my logic, for instance a method to replace substrings. From what I understand, if I need such methods which are offered by many Haskell libraries from Hackage directly, I can't use those Haskell libraries, but I must copy-paste the code in my project. So it's what I did, I copy-pasted a "replace" function together with other helpers from the MissingH library in a new file in my project: Utils.hs.
That Utils.hs compiles without problems with Fay. Also I import it in my main Fay file and I get a JS file for the main project file without problems. However at runtime I get the following error:
ReferenceError: Utils$$36$ is not defined
I don't think that Fay will include the code from the helper file in my main JS file, so I'm including both JS files in the loading HTML. And to make even more sure that when I load the main file, that the utils file is loaded, I load it like that:
$.getScript("Utils.js", function(){
$.getScript("FayConfig.js");
});
But despite this I still get the error. I tried compiling the Utils.hs with "--library" but it didn't help.
So my question is, which setup do I need to achieve that the generated JS will find the helper functions that I put in another HS file, knowing that at compile-time, Fay (apparently) finds them without problems? Is there an example of such a setup online? Most of the Fay uses that I found have all the code in a single HS file, though they often use external Fay code from cabal, as with fay-jquery. In my case, setting up a cabal project just for these simple helpers would be overkill.
Which version of Fay are you using (fay --version)? It seems like you are using a version older than
0.16 where forgetting import Prelude wouldn't give any warnings, see this closed ticket. So upgrade fay and/or add import Prelude.
We're also considering renaming operators in the produced output to make error messages like these easier to understand.
You do not need to invoke fay several times, fay outputs all dependencies into the same js file. So there's no difference from using a cabal package in that regard.
Hope this helps, otherwise please give me a way to reproduce this.

Comment Template variables in Eclipse

I have a comment template in Eclipse (CDT) that I use for function calls which looks like:
//****************************************************************************
//
// Function: ${enclosing_method}
//
// Purpose:
//
// Parameters:
//
//****************************************************************************
My problem is that the ${enclosing_method} template variable doesn't work MOST of the time, but other times it does and I have yet to figure out why. I've tried using the comment template inside of the function and outside (on top of) the function definition even within the same header file. I prefer it to be on top and have seen it work in that position but again I don't know why.
What prerequisites need to be met in order for the enclosing_method variable to place the name within the comment automagically?
Thanks in advance for any insight you can provide.
You are not the only one experiencing issues with this template.
Even in JDT (Java) there is a problem, since 2004! See bug 76661.
It is however not entirely reproducible.
Looked into this to try and find a reproducible case. I can get it happen consistently if I add a new method to a class and then execute the template inside of the method before saving
So far, no patch in sight.