|
Hi Richard
Mainly I wantad to know if that should work, looking around is seems not to be correct..
I dont know how to debug it.
thanks
Peter
|
|
|
|
|
Member 14807823 wrote: I dont know how to debug it. That is the most important skill to have when writing code.
Basically, press F12 in your browser and your browser's developer tools will open. First, check the console to see if you have errors. Then you can click in the line of code you want to test and create a breakpoint.
Too much to go into here, but yes, you'll want to learn to debug.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Hi ZuroDev,
Yes I know
thanks
Peter
|
|
|
|
|
for what this script? can use in website streaming?
|
|
|
|
|
I'm just getting started and learning through a book and this code won't run on google, was wondering why and what I needed to do to fix it. Thank you in advance.
<pre>
function zeroPad(number, width) {
let string = String(number);
while (string.length < width){
string = "0" + string;
}
return string;
}
function printFarmInventory(cows, chickens, pigs) {
console.log(`${zeroPad(cows, 3)} Cows`);
console.log(`${zeroPad(chickens, 3)} Chickens`);
console.log(`${zeroPad([pigs], 3)} Pigs`);
}
printFarmInventory(7, 16, 3);
|
|
|
|
|
Hi JaHowler,
Maybe you can try this.
function zeroPads(animal, width){
let strNumber = animal.toString(),
len = strNumber.length;
while(len < width){
strNumber += `0${strNumber}`;
len++;
}
return strNumber;
}
function printFarmInventory(cows, chickens, pigs){
console.log(`${zeroPads(cows,3)} Cows`);
console.log(`${zeroPads(chickens, 3)} Chickens`);
console.log(`${zeroPads(pigs, 3)} Pigs`);
}
printFarmInventory(7,16,3);
Output:
"7070707 Cows"
"16016 Chickens"
"3030303 Pigs"
Hope this helps. Thanks.
Cheers,
Jin 
|
|
|
|
|
Thank you, I appreciate your time and help
|
|
|
|
|
That code works fine for me in Firefox and Chrome. Which browser are you using, and what errors are you getting?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a Windows alert, after I click ok I want to chain the asychronous methods as synchronous. Not sure how?
alert('test')
.then(() => {
})
.then(() => {
})
.then(() => {
})
.then(() => {
});
I thought about using promise in JavaScript, but not clue so far.
|
|
|
|
|
alert pauses your code until the user clicks "OK", so there's no need for a promise.
NB: Since you've dropped support for Internet Explorer (which doesn't support arrow functions[^]) you might as well use an async function[^]. That will make your code easier to read.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
how can I use it what is it and how can I start hacking easily
|
|
|
|
|
|
var map = new ol.Map({
renderer: 'canvas',
target: 'map',
layers: [layer],
view: view
});
var vectorLayer = new ol.layer.Vector({
source:new ol.source.Vector({
features: [new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857')),
})]
})
|
|
|
|
|
Is that a statement or a question?
|
|
|
|
|
|
Well it needs a lot more detail. It is far from clear what you are asking.
|
|
|
|
|
Is there any way to use map offline with web application.
|
|
|
|
|
What do you mean 'offline'? StreetMap, Google maps etc., are all web based.
|
|
|
|
|
offline mean I Can Access it without Internet also.
|
|
|
|
|
How do you think you could do that?
|
|
|
|
|
is there way to to access the Track Changes log in the microsoft word document using javascript or jquery
|
|
|
|
|
Hi
I need to display subject email on my local website. I found solution in ActiveX but it work only for IE.
But i need it display it on chrome or firefox.
Someone have idea how to do this? Can i do it in javascripts? Maybe other lang? jquery?
Thx for help 
|
|
|
|
|
If you're trying to access or automate the email client installed on the user's PC from a website, give up now. You can't do that, because it would be a major security vulnerability.
If you want to access a mailbox for which you have the credentials, you'll need to use an IMAP library. For example, in .NET, use MailKit[^]. For Javascript, emailJS[^] seems to be the only option, but it doesn't seem to be actively maintained.
NB: Unless this is an intranet application, asking the user for their mailbox credentials will likely get your site blocked for phishing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All I am using Ember even though I am making changes but when I run the ./watch its not producing the JavaScript file with new code - its annoying - I am making the manual change but that's not correct solution right? I made the change to the file even by opening in folder and manually updated the code on ember file - still its writing the old code in app.js file. What could be the reason I don't know. I am using Web Pack to run ./watch and generate the app.js file
Here is my Ember js code:
export default () => {
IMS.registerController("case.details.assignedinspector.edit", {
caseDetails: Ember.inject.controller('caseDetails'),
caseId: Ember.computed.alias('caseDetails.model.imscase.id'),
clearForm: function () {
$('.modal').modal('hide');
},
actions: {
close: function (id) {
$('.modal').modal('hide');
this.transitionToRoute('case.details');
},
async save() {
var scope = this;
if ($("#edit-assignedinspector-form").validate()) {
var data = {
AssignedToInvestigators: Ember.get(scope, 'model.imscase.assignedToInvestigators'),
CaseId: this.get('caseId')
};
try {
let response = await this.api('Case/UpdateAssignedInvestigators').post(data);
$('.modal').modal('hide');
toastr.success("Assigned Inspector Edit Saved.");
scope.transitionToRoute("case.details");
scope.get('caseDetails').refreshData();
scope.clearForm();
} catch (ex) {
toastr.error("Error saving Assigned Inspector.");
}
}
else {
toastr.warning("Please fix the form", "Validation failed");
}
},
didInsert: function () {
$('#edit-assignedinspector-modal').modal();
}
}
});
}
Here is how its generating the old code in app.js file - any help please?
save: function () {
var _save = _asyncToGenerator(
regeneratorRuntime.mark(function _callee() {
var scope, data, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
scope = this;
if (!$("#edit-assignedinspector-form").validate()) {
_context.next = 19;
break;
}
data = {
AssignedToInspectorId: $("#assignedInspectorSelect").chosen().val(),
CaseId: this.get('caseId')
};
_context.prev = 3;
_context.next = 6;
return this.api('Case/UpdateAssignedInspector').post(data);
case 6:
response = _context.sent;
$('.modal').modal('hide');
toastr.success("Assigned Inspector Edit Saved.");
scope.transitionToRoute("case.details");
scope.get('caseDetails').refreshData();
scope.clearForm();
_context.next = 17;
break;
case 14:
_context.prev = 14;
_context.t0 = _context["catch"](3);
toastr.error("Error saving Assigned Inspector.");
case 17:
_context.next = 20;
break;
case 19:
toastr.warning("Please fix the form", "Validation failed");
case 20:
case "end":
return _context.stop();
}
}
}, _callee, this, [[3, 14]]);
}));
function save() {
return _save.apply(this, arguments);
}
return save;
}()
It is supposed to call Case/UpdateAssignedInvestigators instead its still calling the Case/UpdateAssignedInspector, which is incorrect.
Any help would be very very helpful - a link, a suggestion or even a code snippet anything helps thanks in advance.
modified 11-Mar-20 15:09pm.
|
|
|
|
|
Hello, I'm new here.
I am designing an intranet, of which I require that the user when making a request for a product will be able to select it directly from the database and send that request.
From the page where the requests originate, I added a search button for the user to search for the specific product and add it to their product request, this was done with ajax live search.
From the results of that search, a list is usually displayed with the possible results, the objective, and it is where I am blocked, is that from the list with the results, the user chooses the one he wants and this is inserted in the request for the parent page.
I have these live search files in ajax, php and mysql:
search-form.php (popup):
<?php
session_start();
$_SESSION['username'];
$link = mysqli_connect("localhost", "user", "", "database");
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
?>
<html>
<head>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&language=en"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../../bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../../bower_components/Ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="../../dist/css/skins/skin-blue.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
$.ajax({
url:"backend-search.php",
method:"POST",
data:{query:query},
success:function(data){
$('#result').html(data);
}
});
}
$('#search').keyup(function(){
var search = $(this).val();
if(search != ''){
load_data(search);
}else{
load_data();
}
});
});
</script>
</head>
<body>
<div class="container-fluid">
<div class="wall">
<section class="content">
<div class="box box-default">
<div class="box-header with-border"></div>
<div class="box-body">
<div class="row">
<h3>Ricerca Prodotto</h3>
<div class="col-xs-12">
<input type="text" name="search" id="search" placeholder="Cerca il codice" class="form-control" style="width: 300px;" />
<div id="result"></div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</body>
</html>
backend-search.php (same popup)
<?php
$link = mysqli_connect("localhost", "user", "", "database");
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$content = '';
if (isset($_POST["query"])) {
$search = mysqli_real_escape_string($link, $_POST["query"]);
$query = $sql = "SELECT * FROM spesa_articoli_disponibili WHERE Codice_Articolo_CAPP LIKE '%" . $search . "%' OR ARTICOLO_Descrizione LIKE '%" . $search . "%'";
}
$result = mysqli_query($link, $query);
if (mysqli_num_rows($result) > 0) {
$content .= '
<div class="table-responsive">
<table class="table table-bordered" id="item_table">
<div class="group">
</div>';
while ($row = mysqli_fetch_assoc($result)) {
$codice = $row["Codice_Articolo_CAPP"];
$articolo = $row["ARTICOLO_Descrizione"];
$content .= '
<div>
<div>
<table class="table table-bordered">
<form method="post" id="searchform">
<tr>
<th>Codice Articolo</th>
<th>Descrizione Articolo</th>
</tr>
</div>
<div>
<tr>
<td><input type="number" id="codice" name="codice" value="' . $codice . '" style="width: 70px;" readonly="readonly" /></td>
<td><input type="text" id="articolo" name="articolo" value="' . $articolo . '" style="width: 100%" readonly="readonly" /></td>
<td><input type="button" value="Aggiungi" onclick="getValue();" /></td>
<td><a href="JavaScript:window.close()">Chiudi</a></td>
</tr>
</div>
</form>
</table>
<div id="resultado"></div>
</div>';
}
echo $content;
} else {
echo "Non ci sono risultati. Riprova.";
}
mysqli_close($link);
?>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
function getValue() {
var codice = window.opener.document.getElementById("codice");
codice.value = document.getElementById("codice").value;
var articolo = window.opener.document.getElementById("articolo");
articolo.value = document.getElementById("articolo").value;
}
window.close();
}
</script>
So far I have not been able to select the search result and send the values to the parent page.
Ideas, help, suggestions, all will be well received.
Thanks in advance.
Valter.
|
|
|
|
|