ScriptBundle says Object reference not set to an instance of an object - asp.net-mvc-5

In the Asp.Net MVC BundleConfig if i use ScriptBundle it shows below error for this code:
Code:
bundles.Add(new ScriptBundle("~/node/GobiJs").Include(
"~/node_modules/...../test.js"
));
Error:
But if i use Bundle instead of ScriptBundle like
bundles.Add(new Bundle("~/node/GobiJs").Include(
"~/node_modules/...../test.js"
));
it works fine. Can anybody tell me what's the wrong with ScriptBundle, why it is not working?

Related

How can I debug handlebars in node in VS Code?

I am trying to render a .hbs file
res.render('./reporting/review_email.hbs', { ..._data, layout: false });
however the .hbs file is not properly rendering because there is a property of the _data object which is either missing or incorrect. I know that this is the case because when I replace _data with a JSON object that is manually populated (as opposed to from the database), the template renders fine.
I am wondering how I could debug the issue in VSCode.
Basically I want to know where the compiler encounters the problem.

include validation service in codeigniter4 failed

i try to make my first form validation in codeigniter4.For that i've create a controller with a function to check the post-vars. At the beginning, ci4 need to load the libary, so i do it like in the docu
$validation = \Config\Services::validation();
For this i recieve the following error.
...
message "Class 'Myth\\Auth\\Authentication\\Passwords\\ValidationRules' not found"
file "mypath/system/Validation/Validation.php"
function "loadRuleSets"
class "CodeIgniter\\Validation\\Validation"
function "run"
class "CodeIgniter\\Validation\\Validation"
....
What i do wrong, or is there something to setup for a new project before it works?
omg
i've found the problem. in the app/config autoload.php and validation.php was a class "Myth" wich is not in use. SO i commet it out and the thinks works fine.

LWC test using jest testing framework throws error - unknown public property "smalldevicesize" of element

While testing LWC in VSCode using jest script, unable to render custom LWC component, it throws an error- Unknown public property "smalldevicesize" of element . This is likely a typo on the corresponding attribute "smalldevicesize".
Here is the error screenshot
You are using a wrong attribute name smalldevicesize this should be small-device-size
Here is an example:
<lightning-layout-item small-device-size="">
Here is the Lightning Web Component documentation. I hope this should work.
change the attribute to because it supports to kebab notation.

phppgadmin 5.1 Misc has a deprecated constructor

10 minute ago I tried to connect with phppgadmin 5.1 but i found this error message on web server error log :
" Misc has a deprecated constructor in /usr/share/phppgadmin/classes/Misc.php on line 8"
Phppgadmin is out of work.
I use php 7.0.
Someone knows how to fix it?
Thanks so much.
In my own research, in PHP 7, PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a __construct() method are unaffected.
So my fix is open Misc.php, and locate the class Misc, in it there is a function called Misc, rename the function name with anything except for Misc because it will produce that error you've mentioned.
I found the same problem.Just browse and find Misc.php file it is located in classes folder inside your phpPgAdmin folder.Then,open it and search for Misc function and change it to anything except MIsc.In my case i changed it to Misc1.enter image description here
The easiest way to solve is to locate the Misc.php file in phppgadmin/classes/ and search for the the constructor function.You can see the class name is Misc and the constructor is also Misc.
This (notice) message is based on changes to PHP 7,So an old way of using a constructor is still in use, is what that message means.
What is expected is instead of having a class with a constructor like this:
<?php
class Misc{
function Misc() {
echo 'I am the constructor';
}
}
?>
would now be expected to look like this:
<?php
class Misc{
function __construct() {
echo 'I am the constructor';
}
}
?>
See the first section section of this PHP 7 deprecation info.
You can just comment out the old method and change it to the new method.It should work fine.
/* Constructor line : 15*/
Function __construct() {
}

Typescript/RequireJS having issues with an MVC application

I have the following code in Visual Studio, in an MVC application;
/scripts/bin/models/ViewModel.ts
export class ViewModel {
// view model code
}
Now, I have downloaded requirejs, and set the build mode for typescript to AMD type, so that its output looks such as....
define(["require", "exports"], function(require, exports) {
And so on ...
So then I declare my app/config.js file like so;
require.config({
baseUrl: '/scripts/bin'
});
And I try to load this up, I have requirejs loaded into the scripts, and attempt to call it...
require(['models/ViewModel'], function (viewModel) {
console.log("test");
});
And I am simply told that it is an invalid call. No other details. The path that it shows is completely correct, too. Is there some kind of additional configuration required? The requirejs documentation is extremely vague about this.
SOLUTION
This turned out to have nothing to do with requirejs, but instead had to do with IIS.
By default, IIS has a rule known as hiddenSegments. It does not allow you to bring in any code from a folder with bin in the path. I simply renamed the folder from bin to something else, and it worked fine.
Using require.js with TypeScript is a combination of your .html, require.config, module exports and imports.
For a step-by-step guide on moving from CommonJs TypeScript to AMD and require.js, have a look here.
Have fun.
The TypeScript compiler doesn't have any knowledge of your require.config - so when you use paths relative to that baseUrl they look invalid to the compiler.
Until something is done to bridge that slight mismatch (i.e. make the compiler super-clever so it can look for require.config sections and use them to check paths) it is easier not to set a baseUrl and use the full path in your import statements:
import vm = require('./scripts/bin/models/ViewModel');
Are you sure that the require call is done with [] and not just
require('models/ViewModel', function (viewModel) { // this is an error
console.log("test");
});
See : http://requirejs.org/docs/errors.html#requireargs

Resources