|
From the top of my head, stock() returns an array, which has a filter() function.
The filter() function takes a predicate as parameter, which is simply a function that returns true or false for each element p in the array.
In this case the predicate (function (p) { ... }) returns true when element p.id === id (where the id variable declaration is not visible in this code sample).
The filter function returns a new array containing all elements for which the predicate returned true.
From that array I'm selecting the 0th element (since an id is unique we expect 0 or 1 elements to be returned).
|
|
|
|
|
OK, I see, except for stock(). What is stock()? Looks like a method call..?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
im create collage project and iwill add comment box but some problem plz helm me toown comment box
Chiru mistry
|
|
|
|
|
|
what have you tried and what issue you are facing...
modified 20-Sep-20 21:01pm.
|
|
|
|
|
There are over 1 million ways to do a comment box and we cannot guess which one you chose. So, please ask a proper question so we can help you.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I've got a javaScript function that handles a SignalR callback:
proxy.on('notifyAllClientsOfChanges', function () {
var searchUrl = "Home/GetData";
$.ajax({
url: searchUrl,
type: "GET",
success: function (data) {
$("#divData").html(data);
}
});
});
When it's called I get the 404. My controller code is
public class HomeController : Controller
{
private IDataAccess _dal;
public HomeController()
{
_dal = new DataAccess();
}
public ActionResult Index()
{
var data = GetData();
return View(data);
}
public IEnumerable<AssayDashboardInfoEntity> GetData()
{
IEnumerable<AssayDashboardInfoEntity> data = _dal.GetDashboardInfos(new DashboardInfoQueryArgs());
return data;
}
}
On startup the code works fine and I see the data, yet when the JS function is called it fails.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
If it's 404 then it can't find "Home/GetData". We don't have access to your system so we have no way of knowing what that is. If I had to guess I'd say it's because "Home/GetData" is a relative path so it is relative to the current page, so if you are on
/Home/MyAction
then it is trying to call
/Home/MyAction/Home/GetData
you can fix that by changing the action to "/Home/GetData", however you should really be using @Url.Action to get the urls to your actions as it works all these issues out for you.
|
|
|
|
|
Hi, I'm going to be applying for a school very soon, and I need some ideas for a front page for my website to show the school. The problem is, I'm not very creative, and can't think of any real projects to display on the front page. Can anybody give me any ideas on what I can put on my front page to make it look good? (The code for the website isn't a problem).
Thanks
|
|
|
|
|
How about a picture of the school?
|
|
|
|
|
|
I have this WebGrid. When I run this from inside Visual Studio it works fine. When I host on IIS I get "A data source must be bound before this operation can be performed".
@using (@Html.BeginForm("Index", "Home"))
{
<div id="divData">
@{
var grid = new WebGrid(Model);
<pre>
@grid.GetHtml(
tableStyle: "webgrid-table",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
selectedRowStyle: "webgrid-selected-row",
rowStyle: "webgrid-row-style",
mode: WebGridPagerModes.All,
columns:
grid.Columns
(
grid.Column(columnName: "SiteId", header: "Site Id", format: @<text>@item.SiteId</text>),
grid.Column(columnName: "Instrument", header: "Instrument", format: @<text>@item.InstrumentId</text> ),
grid.Column(columnName: "TowerLocation", header: "Tower", format: @<text>@item.TowerLocation</text>),
grid.Column(columnName: "BayLocation", header: "Bay Location", format: @<text>@item.BayLocation</text>),
grid.Column(columnName: "BaySerialNo", header: "Bay Serial #", format: @<text>@item.BaySerialNo</text>),
grid.Column(columnName: "BayStatus", header: "Bay Status", format: @<text>@item.BayStatus</text>),
grid.Column(columnName: "AccessionId", header: "Accession ID", format: @<text>@item.AccessionId</text>),
grid.Column(columnName: "Result", header: "Result", format: @<text>@item.Result</text>),
grid.Column(columnName: "AssayName", header: "Assay Name", format: @<text>@item.AssayName</text>),
grid.Column(columnName: "TestStarted", header: "Started", format: @<text>@item.Started</text>),
grid.Column(columnName: "TestCompleted", header: "Completed", format: @<text>@item.Completed</text>),
grid.Column(columnName: "TestSummary", header: "Test Summary", format: @<text>@item.TestSummary</text> )
))
}
}
I see this error
Line 127: var grid = new WebGrid(Model);
Line 128:
Line 129: @grid.GetHtml(
Line 130: tableStyle: "webgrid-table",
Line 131: headerStyle: "webgrid-header",
The line highlited in the browser is where it's failing.
The Controller code
public class HomeController : Controller
{
private IDataAccess _dal;
public HomeController()
{
_dal = new DataAccess();
}
public ActionResult Index()
{
var data = GetData();
return View(data);
}
public IEnumerable<AssayDashboardInfoEntity> GetData()
{
var data = _dal.GetDashboardInfos(new DashboardInfoQueryArgs());
return data;
}
}
What am I doing wrong here?
[UPDATE]
In the controller if I change
IEnumerable<AssayDashboardInfoEntity> data = _dal.GetDashboardInfos(new DashboardInfoQueryArgs());
to
IEnumerable<AssayDashboardInfoEntity> data = new List<AssayDashboardInfoEntity>();
The I see the grid OK. This makes me think it's not reaching the server for the data. How can I test this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 22-Mar-17 12:18pm.
|
|
|
|
|
It sounds like your GetDashboardInfos method is returning an unevaluated LINQ query, and then closing the context / connection before the grid is rendered.
Try adding .ToList() to force the query to be evaluated:
IEnumerable<AssayDashboardInfoEntity> data = _dal.GetDashboardInfos(new DashboardInfoQueryArgs()).ToList();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, figured it out...
After some debugging I found that the DAL was returning NULL.. Kept digging and found that the Connection String was wrong.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Soo...that's 6 things.
What the heck are you asking?
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
The first essential skill is the ability to count.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Three essential skills - HTML, CSS and JavaScript.
|
|
|
|
|
Hello Everyone
I need help with html form using php. I have created a form on my web page where customer can fill up the form and with submit button to send to my email the entire data content filled in and to be displayed to my email. When i press the submit button no email is coming, Could someone please help me solve this problem and just for reference i'm new to php technology. I have the php code which i will provide.
<?php
if(isset($_POST['submit'])) {
$full_name=$_POST['full_name'];
$email=$_POST['email'];
$telephone=$_POST['telephone'];
$purposeJourney=$_POST['purposeJourney'];
$Vehicle-Type=$_POST['Vehicle-Type'];
$journeyFrom=$_POST['journeyFrom'];
$startDestinationPostcode=$_POST['startDestinationPostcode'];
$date=$_POST['date'];
$Hour-Field[h]=$_POST['Hour-Field[h]'];
$Minute-Field[m]=$_POST['Minute-Field[m]'];
$AM_PM-Field[ap]=$_POST['AM_PM-Field[ap]'];
$journeyTo=$_POST['journeyTo'];
$endDestinationPostcode=$_POST['endDestinationPostcode'];
$return=$_POST['return'];
$return=$_POST['return'];
$returnJourneyDate=$_POST['returnJourneyDate'];
$Return-Journey-Time[h]=$_POST['Return-Journey-Time[h]'];
$Return-Journey-Time[m]=$_POST['Return-Journey-Time[m]'];
$Return-Journey-Time[ap]=$_POST['Return-Journey-Time[ap]'];
$message=$_POST['message'];
$to="e_chauffeur@hotmail.com";
$subject='the subject';
$message="Name: ".$full_name."\n" "Email: ".$email."\n" .$telephone."\n" .$purposeJourney."\n" .$Vehicle-Type."\n"
.$journeyFrom."\n" .$startDestinationPostcode."\n" .$date."\n" .$Hour-Field[h]."\n" .$Minute-Field[m]."\n" .$AM_PM-Field[ap]."\n"
.$journeyTo."\n" .$endDestinationPostcode."\n" .$return."\n" .$return."\n" .$returnJourneyDate."\n"
.$Return-Journey-Time[h]."\n" .$Return-Journey-Time[m]."\n" .$Return-Journey-Time[ap]. "Wrote the following: "."\n\n" .$message;
$headers="From: ".$email;
if(mail($to, $subject, $message, $headers)) {
echo '<h1>Your message has been send successfully, Thank you' .$full_name.' We will contact you very shortly...</h1>';
}
else {
echo '<h3>Something went wrong!</h3>';
}
}
?>
|
|
|
|
|
|
Hello Jochen
Thanks for your reply, do you think you could help me (with the php code that i provided earlier) i really don't understand it very much. If you can help me it would be great.
thanks in advance
Roni
|
|
|
|
|
Your approach can be only used if there is a local SMTP server (Windows) or a sendmail (Linux) running on the server and able to forward mail. You have to ask the administrator or web hoster.
When it is a web hoster he should have some documentation on generating mail from web pages and might also have already installed a PHP mailer module or some other kind of mail support.
Otherwise use a PHP mailer module as already suggested and configure that (read the documentation) to use the SMTP server of the mail recipient address providing the required authentication credentials.
|
|
|
|
|
display any error masssage after submitting the form?
you can try to change this
$message="Name: ".$full_name."\n" "Email: " to
$message="Name: ".$full_name."\n Email: "
|
|
|
|
|
Creating a web application using ASP.Net and WebForms, properties in the Web.Config file could be accessed in code using the following:
<namespace>.Properties.Settings.Default.<propertyname>
In code within a project using ASP.Net Core, how are properties in the Config file accessed?
|
|
|
|
|
ASP.NET Core applications do not use web.config file for configuration... It may be there in case your application hosted under IIS, but it is there for IIS and not for your application...
Read about your options here: Configuration in ASP.NET Core | Microsoft Docs[^]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|