DebugKit CakePHP 3.x ReferenceError: __debug_kit_id is not defined - javascript

I recently upgraded php from 5.6 to 7 and I think it broke CakePHP's DebugKit. On every page I navigate to within my app, the debug_kit javascript file produces an error, specifically when setting the currentRequest. The error is:
ReferenceError: __debug_kit_id is not defined
At first I didn't install sqlite, so I thought that was the issue, but after installing the sqlite, mbstring, and intl extensions the error is still there. I can't seem to find an answer anywhere, most of the problems people encounter with debugkit seem to be solved by installing sqlite.
The code snippet from the debug_kit.js file:
$(document).ready(function() {
toolbar = new Toolbar({
button: $('#toolbar'),
content: $('#panel-content-container'),
panelButtons: $('.panel'),
panelClose: $('#panel-close'),
keyboardScope : $(document),
currentRequest: __debug_kit_id,
originalRequest: __debug_kit_id,
baseUrl: __debug_kit_base_url
});
toolbar.initialize();
Thanks everyone!

This not appear to be a PHP error, but rather a Javascript one because the variable __debug_kit_id is not defined anywhere in your Javascript code. Define it to be something like
var __debug_kit_id = 0;
or whatever value it should have and that will solve your error.

I was able to solve my own problem by removing all remaining php5 packages. I followed bento's answer from this askubuntu question: https://askubuntu.com/questions/59886/how-to-compelety-remove-php and going one by one through the old php5 packages (leaving php7 packages intact). Thanks all

Related

Buddypress jq.cookie not a function

Having some issues with Buddypress, I have installed nearly every version since 2.7 and I still get the same issue with
Uncaught TypeError: jq.cookie is not a function
I found in the folder
plugins/buddypress/bp-themes/bp-default/_inc
there is a js file called
global.js
first line in this file is
var jq = jQuery;
I realise this is not correct as my jQuery uses $ not jQuery
I tried changing this, however.
console log still shows that its not a found function.
I'm using $. cookies in other javascript. So jQuery cookies are installed.
Also, no matter what i change in this global.js
it still results in the same output as a
# VM31193:1784
in chrome inspector as the original file.
Can anyone help me with this?

Foundation Sites (6) javascript order

I am utterly confused as how to insert individual foundation javascript. it always seem to break my code. for example I need to use the dropdown menu js. in the documentation it state
Initializing
The file foundation.dropdownMenu.js must be included in your JavaScript to use this plugin,
along with foundation.core.js.
This plugin also requires these utility libraries:
foundation.util.keyboard.js
foundation.util.box.js
foundation.util.nest.js
this seem simple enough so I did the following in this order
bower_components/foundation-sites/js/foundation.core.js //check
bower_components/foundation-sites/js/foundation.util.mediaQuery.js
bower_components/foundation-sites/js/foundation.util.timerAndImageLoader.js
bower_components/foundation-sites/js/foundation.util.keyboard.js //check
bower_components/foundation-sites/js/foundation.util.box.js //check
bower_components/foundation-sites/js/foundation.util.nest.js //check
bower_components/foundation-sites/js/foundation.dropdown.js
bower_components/foundation-sites/js/foundation.dropdownMenu.js //check
bower_components/foundation-sites/js/foundation.equalizer.js
I follow what logical for me core 1st than util than plugin
yet it told me foundation.util.nest.js:6 Uncaught SyntaxError: Unexpected token =
if I put all foundation.min.js file the error go away, so I know it must be a dependency is missing or the order is not correct
is there any resource out there that is clear on the dependency of foundation js? instead everytime I have to trail and error it.
I'm having the same issue on my end. I am using Foundation as a GIT subtree in my project and actually have used this on a site I made just last week.
It seems that the problem is a newer version of function parameter declarations. In the code I had working, v6.1.2, the code in foundation.util.nest.js is:
Foundation.Nest = {
Feather: function(menu, type){
menu.attr('role', 'menubar');
type = type || 'zf';
versus the code in the newest version 6.2.0 which is:
const Nest = {
Feather(menu, type = 'zf') {
menu.attr('role', 'menubar');
It's that default/fallback declaration of "type" that seems to ruin everything. I look forward to a fix myself.
According to this link, my current version of Chrome (48) doesn't yet support default function parameters.
As of Foundation v6.2.0 the JavaScript codebase has been updated to ES6.
https://github.com/zurb/foundation-sites/releases
You'll need to add Babel to your build process to compile the ES6 code.
They have supplied a tutorial for this here:
https://github.com/zurb/foundation-sites/wiki/Upgrading-to-Foundation-6.2
Hope this helps.

Requiring a .js file in Windows

I'm just starting to pick up javascript and casperjs for a project that I'm doing. I'm trying to create a project that uses babyparse in it.
Currently I have babyparse.js located at C:\js\babyparse.js.
I'm having trouble including babyparse, and I've tried a couple different ways of doing it.
1) eval('C:\js\babyparse.js') - I come up with a syntax error "Invalid Character \u0008". I found this on StackOverflow, but I was unable to find the unicode character in babyparase.js.
2) require('C:\js\babyparse.js') - this just doesn't even find the right path in windows. I'm assuming that's because of the backslash pathing of windows as opposed to the regular unix forwardslash.
3) require('C:\\js\\babyparse.js') - this gets the correct path in windows, but I get the error that CasperJS couldn't find the module C:\js\babyparse.js
I feel like I've looked a lot through stackoverflow, but maybe I'm just missing something obvious. Thanks in advance for the help!
Currently I have babyparse.js located in C:\js\babyparse
require('C:\js\babyparse.js')
You've got the path wrong it seems. The correct path would be
require('C:\\js\\babyparse\\babyparse.js')
Beware that babyparse is a node.js module. It may use some of node.js native modules wich are not present in PhantomJS javascript interpreter in which case your script will break.
If you want to use csv parsing while scraping, it's definitely better to use PapaParse which is specifically designed as general-flavour javascript without dependencies, "not even jQuery".
I managed to solve the problem!
The following snippet worked for me:
var fs = require('fs');
eval(fs.read('papaparse.js'));

Uncaught TypeError: Cannot read property 'prototype' of null using Openerp 7.0

I am using Openerp (Version 7.0-20140429-231256). It was working well for a while one bad day I got a below error. And I don't find any reference to solve the exception.
OpenERP Client Error
Uncaught TypeError: Cannot read property 'prototype' of null
http://localhost:8069/web/webclient/js?db=openerp:3268
In process of debug I wanted to get to the root of problem. Some how I observed that there is openerp.init jquery triggers all the modules where its missing most of the modules which are installed..
i.e.
<script type="text/javascript">
$(function() {
var s = new openerp.init(["web", "web_kanban", "base", "base_setup", "process", "base_import", "web_view_editor", "web_calendar", "web_diagram", "board", "web_gantt", "web_graph", "web_tests"]);
var wc = new s.web.WebClient();wc.appendTo($(document.body));
});
</script>
Though I have installed many module like Point of Sale, Ware house management, Mailing etc. Its not included in init function.
I have installed several module available in openerp not community modules. Am not able to move forward with this error. Please help me how I can able to fix this problem.
Thanks In Advance.
I have solved this problem myself.
Though want to share details with you. So that anyone come across same, then this reference might be helpful.
After debugging the code have found that module information are stored in one particular table called ir_module_module, in this table it store the state of module..
i.e.
1. installed
2. uninstalled
3. to remove
So when we start openerp server then it fetch for modules for js to load which are installed state.
But many of modules are in to remove state. So I used update statement for postgressql (which is similar to mysql) to update all to remove to installed
here is update statement which is used to update table.
update ir_module_module set state ='installed' where state='to remove';
**Though I have no idea how in first play module went into to remove state.

rails3-jquery-autocomplete: Javascript TypeError

Rails 3.2.11
I followed the instructions for this gem: https://github.com/crowdint/rails3-jquery-autocomplete. When I load the page that I want to have the autocompleted field, Jquery, jquery-ui, autocomplete-rails.js, etc are all being loaded. However, upon loading the page, I get this in the error console:
TypeError: 'undefined' is not a function (evaluating 'this.live')
The I uncompress the js file, and this is the function being referred to:
(function(jQuery)
{
var self = null;
jQuery.fn.railsAutocomplete = function() {
return this.live('focus',function() {
if (!this.railsAutoCompleter) {
this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
}
});
};
Anyone have any idea what's going on? Since I'm not using '$' anywhere, the noConflict option doesn't seem to matter, and either way doesn't fix the issue. I didn't make any changes to autocomplete-rails.js
What's weird is that I swear this was working at some point, but I can't for the life of me figure out what changed to break it.
Yup, turns out I had an errant javascript_include_tag that loaded another copy of jquery. That was the issue
I believe the original poster's own answer was part of the solution for me as well. Using rails 3.2.13, jquery 1.9.0 and jquery-ui 1.9.2. More completely I also:
upgraded rails3-jquery-autocomplete to latest (from 1.0.9 to 1.0.11, when I saw: "When possible, use jQuery .on() rather than .live()" in the Changelog in rails3-jquery-autocomplete at github
removed possibly redundant or conflicting jquery includes
reordered includes, specifically placing underscore.js after autocomplete-rails
full stop and clearing of caches and compiled assets
After the first 3 steps, the broken behavior was still there (after each step I restarted server only). The last step was out of laziness, but thankfully showed that the combination of the above worked.

Categories

Resources