|
Okay, try this for size:
We have a flask web app that provides a back-end portal, managing authorisation, user login, resource allocation, other stuffTM.
We have a react dashboard that is used to slash and burn [slice and dice] through data held in Mongo to view results.
The API to read and write the data has been moved into the Flask component, I now want to add the js/react into it.
Has anyone done such stupidity and if so can they point the way out of this maze of twisty little passages, all alike?
veni bibi saltavi
|
|
|
|
|
Is it reasonable to put scripts in the cshtml page. Example I want to include tooltips on most pages and it requires the following script.
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
I have placed it in the cshtml page and it works fine.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Not sure, but it seems to be not reasonable at all... Imagine, you may want to use view, which does not need such of script...
I'd follow MSDN documentation, which states that it's better to use Sections.
So, in a layout:
@RenderSection("Scripts", false)
In a view:
@section Scripts {
<script type="text/javascript">
</script>
}
|
|
|
|
|
I found out why you don't put in the cshtml file - debug gets stuck on it and repeats for each page you have visited. It now resides in a Section at the end of each page.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I have two script partial views and a styles partial view.
_TopOfLayoutScripts.cshtml contains the standard framework scripts, such as jquery and jqeury-ui.
_StylesForLayout.cshtml contains all of the style stuff used throughout the app (bootstrap, jquery-ui and other stuff)
_BottomOfLayoutScripts.cshtml contains scripts that can be put at the bottom of the layout file (things that happen after the page has loaded).
This lets me restrict meddling to reasonably named files, AND allows me to use these partial views in additional layout pages. My main layout page has maybe 30 lines in it, and I haven't touched it in months.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Thanks - had similar question.
|
|
|
|
|
Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\xampp\htdocs\gco\core\classes\user.php:16 Stack trace: #0 C:\xampp\htdocs\gco\includes\login.php(15): User->login('rahul@yahoo.com', 'password') #1 C:\xampp\htdocs\gco\index.php(66): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\gco\core\classes\user.php on line 16
this error happens in these line of code =
public function login($email,$password){
$stmt = $this->pdo->prepare("SELECT 'user_id' FROM 'users' WHERE 'email'=:email AND 'password'=:password");
$stmt->bindParam(":email",$email,PDO::PARAM_STR);
$stmt->bindParam(":password",md5($password),PDO::PARAM_STR);
$stmt->execute();
i dont have any idea why this happen in these lines of code.
modified 16-Apr-19 2:54am.
|
|
|
|
|
It means that the variable $this->pdo has not been initialised to a valid reference.
|
|
|
|
|
In an Apache linux server,
Can I put SQLite database in a folder before root folder(public-html folder where index.php file could be placed in) of server and give the database folder full time read and write access permission(600)?
Isn't there ant security issue?
|
|
|
|
|
Using VS2017, writing a MVC5 app...
I added a new controller, and a view to go with it (not using the scaffolding thing, just creating them individually). Something I've done dozens of times.
In the Controllers folder I have this class:
DemosController
And in that class, I have:
public ActionResult DemoTreeView()
{
return View();
} In the Views folder, I have a Demos folder, and in thast folder I have this file:
DemoTreeView.cshtml
When I try to "render in browser", I get a 404 error saying that "mynewcontroller/mynewview" couldn't be found.
What I Tried
0) I verified that the controller and view are named appropriately.
1) I tried deleting the view and recreating it
2) I tried decorating the associated ActionResult method in the controller with HttpGet and AllowAnonymous (neither of which should be necessary).
3) I tried doing the same controller/view creation in a new project (using VS2015), and it works fine (this was just to proved to myself that what I was doing was appropriate).
I'm out of ideas...
EDIT ===================================
Well, I tried it by creating the controller with get/set methods, and it created the views folder for me. When I moved the views to that folder and added the appropriate methods to the controller, it worked.
My (rhetorical) question is why does it matter how I created the folder if all the necessary parts are there?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 12-Apr-19 13:29pm.
|
|
|
|
|
One thing I've seen cause that is if the controller isn't in the correct namespace.
Otherwise, is it failing to find the action, or failing to find the view? If it's the view, then try loading it locally, and it should give you a list of where it looked to try to find the view. If it's the route, then Phil Haack's URL Routing Debugger[^] might help.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I verified that the namespace was correct, that it was inheriting from Controlleer (as opposed to APIController), and that the method names matched the view file names. Everything was aligned, and the 404 error even gave the expected path. I deleted all associated files, and created the controller with insert/edit/delete methods (that I deleted), which created the view subfolder. I re-added my methods and view files, and it worked.
High strangeness...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I am working on a serverless application in Reactjs. I need to implement a scenario to download multiple files in the same folder with the browser.
Currently, I have used the JsZip, But it fails for larger files and crashes the browser.
So, I want an alternative for it. As an alternative, I want to download and save all files into the same directory.
Anyone have any idea. Please share your answers.
Thank in advance.
|
|
|
|
|
Simple question. What is an IPrincipal?
This is a typical MS help page. Technically accurate but practically useless.
A principal object represents the security context of the user on whose behalf the code is running, including that user's identity (IIdentity) and any roles to which they belong.
OK, so what exactly is a Principal? An example would be helpful.
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
I googled all weekend, and never stumbled on a way to do these two things:
0) I want to pre-decorate all required fields with a red border (as opposed to an asterisk) when the form loads.
1) I want to validate on the fly, as the user types in the fields, and selects in drop downs.
If anyone can direct me to one or more pages that describes either or both of these things, I'd appreciate it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
good job! I have been looking for this information for a long time 192.168.l.l
|
|
|
|
|
I have the brilliant idea that I want to write a html/js/css webpage from scratch.
My current issue is with bundling, or for development unbundled auto added files.
Is there a way that on the HTML that the script tag for external .js files could be written once?
<script src="scripts/*.js"> </script>
Using VS Code with Live Preview extension.
Are the "best" options going to be use node/php/aspnet?
With asp.net applications I am familiar with and would love something similar like the bundling functionality.
If in debug - then each file of the bundle is included as individual script links, allowing for debugging.
Then switch to prod, and becomes 1 file.
But the bundler also allows for wildcards, making any new files created added into the bundle.
|
|
|
|
|
What about bundling your external JavaScript files into one file, using a bundling tool (like webpack) and, write one script tag for the bundled file?
|
|
|
|
|
|
I know that you experiment with shampoos,conditioners, and other products for hair care to learn how to take care of your hair . what do you experiment with for web design to learn how to build and design beautiful or etc. blogs ?
|
|
|
|
|
Start with defining some minimum parameters that you need. Not "wants" but "needs".
Do you want raw code editing to allow for those little tweaks?
Or if ok limited to GUI edits?
Integration support to other services? Face/Twitter?
Custom Domain options?
...
Form with list and hopfully will help when scanning through a list of top 10 web blogs makers, you can tweak or skip testing a bunch of things.
Keep in mind to separate your Needs and Wants.
|
|
|
|
|
Is it possible to copy values from an Excel column and paste it to a specific column at a specific point in an aspx GridView.
|
|
|
|
|
Assuming you've set the GridView up so that every cell contains a textbox, you can use Javascript to handle the paste:
Copy and paste from excel spreadsheet into HTML table with cloned rows using Javascript? - Stack Overflow[^]
$('<%= YourGridView.ClientID %>').on('paste', 'input', function(e){
var $this = $(this);
$.each(e.originalEvent.clipboardData.items, function(i, v){
if (v.type === 'text/plain'){
v.getAsString(function(text){
var x = $this.closest('td').index(), y = $this.closest('tr').index();
text = text.trim('\r\n');
$.each(text.split('\r\n'), function(i2, v2){
$.each(v2.split('\t'), function(i3, v3){
var row = y + i2, col = x + i3;
$this.closest('table').find('tr:eq('+row+') td:eq('+col+') input').val(v3);
});
});
});
}
});
return false;
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|