Where is _on function defined in jquery-file-upload Javascript library? - jquery-file-upload

After setting up , I get an error
Uncaught TypeError: undefined is not a function
on the line of 1273 which is the following
this._on(this.options.dropZone, {
I can't find where the function is defined in the javascript file (https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload.js). Do I have to use it with other Javascript files in the package?

it looks You haven't connected widget part of jquery.
http://jqueryui.com/download/#!themeParams=none
I had the same problem, so I added it and now file upload works.

Related

Autoprefixer in VSCode - TypeError: Cannot read property 'warnings' of null?

I'm trying use "Autoprefixer" in VS Code but instead of using it vs code output
"[Autoprefixer]
TypeError: Cannot read property 'warnings' of null"
I tried reinstall vs Code and extensions but didnt work.
[Autoprefixer]
TypeError: Cannot read property 'warnings' of null
I got the same error when I used it when the file was a .html file. But if I used a .css file with my CSS formatted correctly, it worked. I didn't get any response and my code was updated with the prefixes.

What does this line of code reference: "var io = require('../..')(server);"?

I followed this tutorial to create a chatroom using socket.io: https://github.com/socketio/socket.io.
I then created a page incorporating the chatroom (within the tutorial file structure) and now I am trying to export this into a different project...
I can't seem to do this without incorporating ALL the files from this tutorial.
I think I have narrowed down the issue to be this one line of code within the chat index.js page:
var io = require('../..')(server);
What does the above line reference to within the tutorial?
The error I get in my new project structure is this:
module.js:339
throw err;
^
Error: Cannot find module '../..'
Here is a link to the index.js file that has that line of code:
https://github.com/socketio/socket.io/blob/master/examples/chat/index.js
require() accepts a module name or a path to a module.
Per the node.js docs for require(), one of the argument options leads to this:
LOAD_AS_DIRECTORY(X)
1. If X/package.json is a file,
a. Parse X/package.json, and look for "main" field.
b. let M = X + (json main field)
c. LOAD_AS_FILE(M)
2. If X/index.js is a file, load X/index.js as JavaScript text. STOP
3. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
4. If X/index.node is a file, load X/index.node as binary addon. STOP
This would mean that ../.. is trying to go up the directory tree and load package.json, index.js, index.json or index.node from that directory.
You can read about the allowed syntax for require() here in the node.js docs.
FYI, there's a chat room demo on the socket.io site here.

AEM 6 integration with Adobe Target problems

I am integratign AEM 6 with Adobe Target and have some problems with it.
Particularly, when I add "Adobe Target Mbox" component on the page - T&T request is sends but in console there is an error :
Uncaught TypeError: undefined is not a function.
I found that it throws when mboxOfferDefault.prototype.show(content) function is called from /etc/clientlibs/foundation/testandtarget/util/source/init.js.
The problem is that this function calls this.hide(content) which doesn't exists in mboxOfferDefault.prototype and that's why I suppose this error is thrown.
Can anyone tell me why this function in init.js is overriding default mboxOfferDefault.prototype.show(content) defined in mbox.js and what will be the risks if i'll remove this function from /etc/clientlibs/foundation/testandtarget/util/source/init.js ?
I will be appreciated if some one will help me with this problem.
Thanks!

Trying to use shorten the text output using truncate smarty tag in PHP 5.4.19

trying to use {$articleTitle|truncate:30:""} to shorten the text output
its working in localhost correctly
but not working in server with PHP 5.4.19
am unable to find solution.
I think there is no problem with code problem in server.
any suggestions plz.
error info.
Fatal error! Your request can not be executed!
Fatal error: Call to undefined function mb_substr() in Smarty/plugins/modifier.truncate.php on line 36

Ways to call Blocks within Magento: createBlock vs Layout xml file

Context: I'm trying to include Adminhtml blocks in the frontend of the site to replace some of the user account blocks. The first thing I'm trying to do is simply display the block on the correct page. I can replace the entire page by setting the Body of the response inside the controller, but I'm having a hard time including the block in the layout xml file and then calling it within the template.
This block's default template is adminhtml/default/default/widget/grid.phtml. So I have placed widget/grid.phtml and widget/grid/ folder (needed by widget/grid.phtml) inside of the frontend theme.
I'm using community edition v1.3.2.2
Why would I be able to create an adminhtml/sales_order_grid from Mage_Sales_OrderController using createBlock:
$this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/sales_order_grid')->toHtml());
But not from a frontend layout, using a declaration
<sales_order_history>
<reference name="content">
<block type="adminhtml/sales_order_grid" name="orders_widget"/>
</reference>
</sales_order_history>
within app/design/frontend/default/default/layout/sales.xml
The latter produces an error without a stack trace:
Fatal error: Call to a member function toHtml() on a non-object in app/code/core/Mage/Core/Model/Layout.php on line 526
That line is the function getOutput() that Alan refers to below. The data in callback[0] is blank. As far as I can tell, it's null. When output to a log, it's blank. get_class(callback[0]) returns nothing discernable as well.
As far as I can tell, no blocks are rendered. There is nothing shown in the browser except the error message. In the log, the only output from the getOutput() method within app/code/core/Mage/Core/Model/Layout.php is the one where it breaks - no block name in callback[0].
However, I do know that _prepareCollection on the sales_order_grid block is being called.
Update: It turns out that I can get the block to render by adding it to the layout file. The call that throws the error is in app/code/core/Mage/Sales/controllers/OrderController.php in public function historyAction(). The call to $this->renderLayout() is what causes the problem. Evidently, I can't have both the grid block and the history template rendered in the same action. I'm not sure why though.
Thanks for any guidance!
More details about the other customizations you've done to get yourself to this point might help people troubleshoot your problem. When I tried your "create the block programmatically" code I got the following error.
Warning: include(/path/to/magento1point4.dev/app/design/frontend/base/default/template/widget/grid.phtml) [function.include]: failed to open stream: No such file or directory in /path/to/magento1point4.dev/app/code/core/Mage/Core/Block/Template.php on line 189
I added a simple phtml template to the above location and was able to insert the block via a layout file succfully after that
<reference name="content">
<block type="adminhtml/sales_order_grid" name="orders_widget"/>
</reference>
So I suspect something you've done along the way already is tripping things up.
Also, a Magento version would help things. Line 526 of the current version of community edition is a comment.
All that said my best guess is things are failing in the getOutput method of the Layout class. I'd add some logging to the function on your dev server to see what Magento is trying to do/instantiate when it bails on you.
public function getOutput()
{
$out = '';
if (!empty($this->_output)) {
foreach ($this->_output as $callback) {
Mage:Log('Trying to get the block ' . $callback[0] . ' and call its ' . $callback[1] . 'method');
$out .= $this->getBlock($callback[0])->$callback[1]();
}
}
return $out;
}