|
Hi,
My son is interested in coding and would like to learn web development. Which would be the best web development course for kids? Could someone please help me?
|
|
|
|
|
|
Whilst I try to refrain from printing emails, some are required and normally I use print pre-view to check what page(s) I need and select accordingly. If too complex as quick ctl A and copy paste to Word (or your favourite editor) and edit to the smallest number of pages possible.
However, just been caught out with a blood test appointment printed without checking and yes, three lines on the second page (of two sided print) that are not needed. Do Web designers have a secret contract with printer supplies for paper and ink? By the way, the email had masses of White Space!
Bah Humbug, waste of a sheet of paper. 
|
|
|
|
|
I'm SMH on this.
Normally I really never look at the HTTP response payload and just assume it works. But this is a total hack on PHP 4.7 to tweak it to do modern things. I'm confused here, and really just looking for an explanation of why, so here goes.
I wrote this in PHP 4.7; being limited with what I can do, I hand crafted some JSON, and used a hack to encode it.
header('Content-Type: application/json; charset=utf-8');
$json = '{
"projectNumber":' . $sess_proj_no . ',
"projectStage":"' . $sess_proj_stage . '",
"newVersion":' . $new_version_no . ',
"undefinedValue":{
"projectNumber":"' . $projectNumber . '",
"variableContingencyCost":"' . $variableContingencyValue . '",
"variableContingencyValue":"' . $variableContingencyRate . '",
"actualPlusContingencyCost":"' . $actualPlusContingencyCost . '"
}
}';
$jsonTest = '{ "test": "result" }';
$jsonEncode = json_encode($jsonTest);
echo $json;
ob_end_flush();
With encoding, adding slashes to the double quotes,
SyntaxError: JSON.parse: expected property name or '}' at line 2 column 13 of the JSON data
"{
\"projectNumber\":2549,
\"projectStage\":\"engineering\",
\"newVersion\":0,
\"undefinedValue\":{
\"projectNumber\":\"\",
\"variableContingencyCost\":\"\",
\"variableContingencyValue\":\"\",
\"actualPlusContingencyCost\":\"\"
}
}"
Without encoding, no slashes to the double quotes, I get a clean HTTP response payload without errors.
{
"projectNumber": 2549,
"projectStage": "engineering",
"newVersion": 0,
"undefinedValue": {
"projectNumber": "",
"variableContingencyCost": "",
"variableContingencyValue": "",
"actualPlusContingencyCost": ""
}
}
I always thought JSON had to be encoded during transport, and then decoded to consume it.
Unless json_encode is meant to convert JSON created with a class, into a string without slashes. or it has something to do with echo and just spitting out text.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
According to my reading of the PHP manual, json_encode() didn't exist before PHP 5.2.0.
So I have no idea what you're using in 4.7....
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
It looks like you are creating a string in JSON format, then passing it to json_encode() where it is trying to turn it into more JSON. Unless you are actually trying to embed your JSON in the JSON that json_encode() produces, that doesn't make much sense.
This is how json_encode() is supposed to work:
$data = array(
"projectNumber" => $sess_proj_no,
"projectStage" => $sess_proj_stage,
"newVersion" => $new_version_no,
"undefinedValue" => array(
"projectNumber" => $projectNumber,
"variableContingencyCost" => $variableContingencyValue,
"variableContingencyValue" => $variableContingencyRate,
"actualPlusContingencyCost" => $actualPlusContingencyCost,
),
);
$json = json_encode($data);
|
|
|
|
|
Oh!
Wow thanks, I had no idea. That makes sense.
Will give it a try!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I'm using Firefox 68.0.2 (64 bit) and a habit that I have been forming involves "bookmarking" webpages on a daily basis by pulling the site URL directly from the displayed address in the control at the top of the page as it appears in the browser onto the Bookmarks Toolbar (which is loaded with titled folders, as you would imagine, accounting for the passage of time/greater utility/etc). If a user does what I do in this way, he can right-click on any "saved" url and get a PROPERTIES dialog box to pop up and allow access to four things "Name", "Location", "Tags", and "Keyword".
So, a shortcut with properties. Considering a shortcut ... unless I saved a whole webpage to disk and then opened that local page in the browser and THEN pulled the URL to my Bookmarks Toolbar and then set about adding KEYWORDS to that local reference through the PROPERTIES/Keywords control, I would expect that by adding keywords to a link like this, to a REMOTE webpage on some server somewhere on the internet, that such a "save" would involve tracking those added keywords locally (I know it's through a SQLite database in the Mozilla folder) and I can assume that this is indeed what the local SQLite database keeps track of, among other things.
Well the behavior I observe is odd then; why does saving a webpage (as .html document for instance) to a location on a drive on my computer, placing a link to it in the bookmarks toolbar folder of choice, altering the links Properties/Keyword by adding a descriptive component, then saving that add, CHANGE THE PROPERTY OF THAT LOCAL WEBPAGE ... NOT just the link of the bookmark toolbar? It does. Somehow.
Try this yourself by saving a webpage to disk, opening that saved webpage in firefox browser, sliding a link from the address control to the browser toolbar, then opening that link. Once the page is verified "here" right-click the link again, choose Properties, see the Keywords control box, and type in some new/other term. AND now, this is the important part, copy this link, paste it somewhere else in the toolbar (behind a folder perhaps), open it so the local webpage is displayed, click once again on the link, get the properties/keyword control ... see that duplicate keyword you just typed in for the original, DELETE that keyword, and type in another keyword then save.
See my confusion:
Load the original link again, look at properties/keyword and see that the original now has the changed keyword (the original keyword has been erased and replaced with the copy's keyword).
This shouldn't be happening. Despite the fact that the link on the toolbar is connected to a local webpage and not some remote page address found in the browser's lookup under SQLite/Mozilla database, the keyword should still be associated with the LINK ALONE, NOT THE LOCAL FILE.
Yes?
Is not a webpage keyword (remote) stored in the SQLite database? Is not the sole keyword lookup for a given Bookmarked URL on my firefox toolbar being facilitated by a browser's delve into that SQLite data to return the keyword in that property's keyword {space} (for lack of a proper name for an association that a database uses to link such things under cover of it's functionality)?
How could I possibly be dis-explaining this to myself?
|
|
|
|
|
Is it possible to write libraries that contain controls/markup for use by multiple MVC5 apps?
".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
|
|
|
|
|
|
We're not using Core
".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 know - that's why I suggested RazorGenerator.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I installed it and finally figured out how to get it working (the docs aren't exactly forthcoming - or complete).
In any case, it looks like this is my only choice if I want to try doing what I need, so I 5'd you., Thanks for the info.
".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 dismayed to find no tangible examples of its usage - nothing but casual mentions of what people did to make it work.
".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
|
|
|
|
|
Hi there:
I have to debug two branches of the same codebase side-by-side (a development branch vs a release branch), as we're seeing unexplained differences in behaviour between them. I've opened two copies of VS 2019 (latest patch v18.6.3 at 16th Dec 2020), and when launching them, one will succeed, and the other will throw up an error message:
One or more errors occurred.
Failed to launch the debug adapter. Additional information be be available in the output window.
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:4318).
What I've tried:
- Making sure that each web project is set to start on a unique port number, I've selected 53199 for one branch and 53200 for another.
- Delete the applicationhost.config inside .vs, restart VS and let it recreate.
What I've noticed:
- The two Visual Studios try to launch as tabs in the SAME Chrome instance. I loaded a random different project from another codebase and that project launched its own new Chrome instance.
- Inside each applicationhost.config, in the <sites> section, BOTH projects have:
<site name="foo.Web" id="2">
- Their site "id" is the same, but each config file does have the correct virtualdirectorypath for its project location.
- this is new behaviour (maybe a new bug?) and I've been able to run this configuration plenty of times in the past.
- the output window contains only this:
Verbose logs are written to:
C:\Users\Bar\AppData\Local\Temp\visualstudio-js-debugger.txt
The program '' has exited with code -1 (0xffffffff).
The program '[21072] iisexpress.exe' has exited with code 0 (0x0).
- as each site starts up, the visual studio debugger log shows a --remote-debugging-port which is unique for each site, so no conflict there...
Since we're using TFS version control, "two branches" in this context means two completely different folders on disk, each with a full copy of the project source inside. I cannot see why these projects interfere with each other. Each one launches into debug successfully on its own and then the other won't launch.
Can I "fool" VS / IIS Express by manually changing the site "id" or "name" in applicationhost.config?
Any help gratefully appreciated!
-- edit: there are workarounds, e.g. using two different browsers, but still would like to clarify whether it's me or VS or IIS express causing this, and whether it can be fixed!
|
|
|
|
|
You could always just set them up as their own sites in IIS and attach the debugger of each instance of VS to the relevant site. I'm pretty sure what you're trying should work anyway so don't know if there is something odd going on with your project structure or what the sites are doing. I'd try the IIS route though as I know that definitely works.
|
|
|
|
|
I'm trying to diagnose an issue with a mod I wrote.
So I start with $rs2 = -1, then I increment $rs2, but when I print $res2 in the table cell, $rs2 goes ...
0
1
0
1
1
1
1
1
I thought since $rs2 is the origin number to feed into mod, that the number should increment.
0
1
2
3
4
5
6
7
It's works on the other function with the same mechanics here. Just not this one.
I haven't worked PHP since 2005, so I'm a bit rusty.
$rs2++;
$stripe2 = ($rs2 % 2 == 0) ? "rowStripe" : "";
echo "
<tr>
<td class='report-table-body-20 $stripe2'>
<p class='report-table-body-p'> $rs2 $equip_cat_name</p>
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I was in a double while loop.
And incremented in the 2nd internal while, my bad!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Oh, that's a good idea
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hello good, I have a query, what happens is that I want to enter user roles in my code but I don't know how to do it, I have the registration and login form already created, I just need to add the reference that I already mentioned above:
register_user_be.php:
<?php
include 'conexion_be.php';
$nombre_completo = $_POST['nombre_completo'];
$correo = $_POST['correo'];
$usuario = $_POST['usuario'];
$contrasena = $_POST['contrasena'];
$contrasena = hash('sha512', $contrasena);
$query = "INSERT INTO usuarios(nombre_completo, correo, usuario, contrasena)
VALUES('$nombre_completo', '$correo', '$usuario', '$contrasena')";
$verificar_correo = mysqli_query($conexion, "SELECT * FROM usuarios WHERE correo='$correo' ");
if (mysqli_num_rows($verificar_correo) > 0) {
echo '
<script>
alert("Este correo ya está registrado");
window.location = "../index.php";
</script>
';
exit();
}
$verificar_usuario = mysqli_query($conexion, "SELECT * FROM usuarios WHERE usuario='$usuario' ");
if (mysqli_num_rows($verificar_usuario) > 0) {
echo '
<script>
alert("Este usuario ya está registrado");
window.location = "../index.php";
</script>
';
exit();
}
$ejecutar = mysqli_query($conexion, $query);
if ($ejecutar) {
echo '<script>
alert("Usuario registrado correctamente");
window.location = "../index.php";
</script>';
}else{
echo '<script>
alert("Inténtalo de nuevo, usuario no registrado");
window.location = "../index.php";
</script>';
}
mysqli_close($conexion);
?>
login_usuario_be.php:
<?php
session_start();
include 'conexion_be.php';
$correo = $_POST['correo'];
$contrasena = $_POST['contrasena'];
$contrasena = hash('sha512', $contrasena);
$validar_login = mysqli_query($conexion, "SELECT * FROM usuarios where correo='$correo' and contrasena='$contrasena'");
if (mysqli_num_rows($validar_login) > 0) {
$_SESSION['usuario'] = $correo;
header("location: ../inicio.php");
exit;
}else{
echo '
<script>
alert("El usuario no existe, por favor verifique los datos introducidos");
window.location = "../index.php";
</script>
';
exit;
}
?>
index.php:
<?php
session_start();
if (isset($_SESSION['usuario'])) {
header("location: inicio.php");
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Iniciar Sesión</title>
<link rel="stylesheet" type="text/css" href="assets/css/estilos.css">
</head>
<body>
<main>
<div class="contenedor__todo">
<div class="caja__trasera">
<div class="caja__trasera-login">
<h3>¿Ya tienes una cuenta?</h3>
<p>Inicia sesión para entrar a la página</p>
<button id="btn__iniciar-sesion">Iniciar sesión</button>
</div>
<div class="caja__trasera-register">
<h3>¿Aún no tienes una cuenta?</h3>
<p>Regístrate para que puedas iniciar sesión</p>
<button id="btn__registrarse">Regístrate</button>
</div>
</div>
<!--
<div class="contenedor__login-register">
<!--
<form action="php/login_usuario_be.php" method="POST" class="formulario__login">
<h2>Iniciar sesión</h2>
<input type="text" placeholder="Correo electrónico" name="correo">
<input type="password" placeholder="Contraseña" name="contrasena">
<button>Entrar</button>
</form>
<!--
<form action="php/registro_usuario_be.php" method="POST" class="formulario__register">
<h2>Regístrarse</h2>
<input type="text" placeholder="Nombre Completo" name="nombre_completo">
<input type="text" placeholder="Correo Electrónico" name="correo">
<input type="text" placeholder="Usuario" name="usuario">
<input type="password" placeholder="Contraseña" name="contrasena">
<button>Regístrarse</button>
</form>
</div>
</div>
</main>
<script src="assets/js/script.js"></script>
</body>
</html
modified 17-Nov-20 3:47am.
|
|
|
|
|
|
I don't really want to "maintain a web site" but I want to expose some computing functionality for a hobby of mine.
Excel is driving me to tears.... So I am thinking perhaps I could have a single page static SPA!
But most web tech drive me to tears, me think would be nice do a Blazor SPA! Is it possible?
One with 0 server side setup! That I can just drop on web app folder somewhere?
Any links? tutorials?
|
|
|
|
|
hi all,
I am going to build an asp.net core website and an asp.net core webapi. My question is that from design perspective, should I just call into the webapi to get data for my website? or just call into the database to get data directly?
It looks like calling the webapi would promote separation of concerns and I don't have to expose my database connection strings in multiple places, but I am afraid there is a performance hit that will impact the performance of the load time of the website.
Any insight is greatly appreciated.
|
|
|
|
|