|
Thanks for the reply, I'm new to CodeProject. I will go to the forum that you indicate me. Thank you
modified 25-Nov-22 12:02pm.
|
|
|
|
|
I'm going to be developing a .Net Core Web API. I'm not really sure what the best approach is for hosting it. I'd like to get your input. If you need more info, please ask.
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
There is no universal "best" anything. As always, the answer depends on your situation.
There are many questions you need to ask yourself before you can pick the right approach for your specific situation. For example:
- Do you already have a Windows or Linux server you can use?
- If not, what's your budget and requirements for hosting?
- If you're using a database, which DBMS are you using, and where is the database located?
- If you're collecting any data on your API's users, have you researched whether there are legal requirements to host it in a specific country or region?
- Do you need any of the features that IIS offers[^] which Kestrel doesn't (or vice-versa)?
- Are you using any platform-specific APIs?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I don't really know the answers. I'm building a prototype/POC WPF app for a potential client, and I want to host the back end API somewhere where they can get to it.
I probably need some form of cloud based hosting but I don't know much about the topic.
- I'm planning to use ASP.Net Core
- I'll be looking to use SQL Server
- As far as budget, probably not much as it's a POC
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
The good news is that ASP.NET Core can be hosted on Linux (so long as you avoid Windows-specific APIs) which will probably be cheaper than Windows hosting.
SQL Server 2022 can also run on Linux.
So it comes down to whether you want to rent and manage your own VM somewhere in the cloud, or use something like Azure or AWS to host it. The VM would give you more control, but you'd have to set up and manage the server yourself, and you'd probably end up paying a flat rate. With Azure/AWS, you'll likely be charged for what you use, so if you only use it for a couple of hours a month, that's all you'll pay for.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks. I'll look into AWS
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Which is the best library for frontend developer
|
|
|
|
|
The one that meets the requirements of the project, works in all the browsers that project needs to support, and is still being actively maintained.
Seriously, how do you expect anyone to answer such a vague question? Only you and your team know what your project entails, so you need to do your own research.
There is no universal "best" anything.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The best for me might be lousy for you and what might be best for you I might not like at all.
|
|
|
|
|
Great - now I've got the theme tune from Diff'rent Strokes[^] stuck in my head!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
jQuery... it's new and all the rage.
Seriously though, don't use a library at first. Just learn JavaScript itself.
Jeremy Falcon
|
|
|
|
|
Oh and after you've mastered vanilla JavaScript... study React. But not until you can do what you need to do without it.
Jeremy Falcon
|
|
|
|
|
Hello again...
[Thought I could do this on my own in Adobe Dreamweaver, but I guess not]. I need a basic (responsive) html template whereby everything on the page is centered vertically in divs...both image & text content. (I believe I need what is known as a 'wrapper'...that can be set to a certain width...& then all other content would be centered in that wrapper)
If someone can just get me started, w/ just a few centered divs in a wrapper for placement of images & text, I can learn from that basic code & just add content as I go (& will be very appreciative of any effort, from anyone here).
thanx,
mwForman
modified 8-Nov-22 22:32pm.
|
|
|
|
|
Centering in CSS: A Complete Guide | CSS-Tricks - CSS-Tricks[^]
For example:
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
display: grid;
height: 100%;
}
body > div {
margin: auto;
}
</style>
</head>
<body>
<div>
Everything in this element is centered, both horizontally and vertically.
</div>
</body>
</html> Demo[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard...
Thanx. I don't need horizontal centering, tho...only vertical (i.e., all content would be centered on the page vertically, but would be positioned at the top of each div). What would that page code look like?
Thanx again,
MF
|
|
|
|
|
Member 14987492 wrote: I don't need horizontal centering
...
all content ... would be positioned at the top of each div
Those two statements don't match. If you want content positioned at the top, then it's the vertical centering that you don't want. If you don't want the horizontal centering, then you want the content positioned on the left-hand side.
So which is it?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I was pretty clear (I thought). You gave me a code page whereby content was centered on the page but then also centered vertically in the container. I want all the containers (divs) to be centered, but I want the content inside those divs at the *top* of the centered div, not in the *middle* of it.
thanx
|
|
|
|
|
But that's exactly what I gave you.
The content isn't vertically centered within the <div> ; it's just that the <div> is only as tall as the content. If you make it taller, the content will still be at the top of the <div> .
body > div {
margin: auto;
min-height: 5em;
outline: 4px dotted green;
} Demo[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just to add to Richard's great answer, you may wish to adjust your styles:
html,
body {
display: grid;
height: 100vh;
margin: 0;
padding: 0;
}
Technically, having height 100% on the body works out to be the same in that context. But it means 100% of the parent element. If there is a lot of content this may not mean center on the screen - which can be a good thing. Just depends on your use case. The 100vh always means 100% of the viewport height regardless the size of the body container.
Also, the margin and padding is set to zero to avoid the doubling up of the scrollbar.
Jeremy Falcon
|
|
|
|
|
I am making some modifications in a web and opening it with
Firefox on a Linux Debian 11.2 machine and
I need to change the security preferences, unchecking the box
"Delete cookies and site data when Firefox is closed."
However, it won't let me uncheck this box, as it shows up with a
softer color and ignores the mouse click on the check box.
The person who worked on this project before is gone and I don't
may I ask if you established any security mechanism that does not
Let me modify this option.
I have seen that in /home/myuser/.mozilla/firefox folder
the files exist
-rw-r--r-- 1 myname mygroup 58 Jan 26 2022 installs.ini
-rw-r--r-- 1 myname mygroup 247 Jan 26 2022 profiles.ini
I have tried to change the permissions to 777, but despite that it does not allow me to change
that option in Firefox.
Any suggestion or comment is welcome.
|
|
|
|
|
Hi all, first attempt to set up a file upload on web page.
Pretty basic stuff, but my first try so can't see why it isn't working.
Firstly I'm running on apache2 on a VPS debian 10 install.
/etc/php/7.4/apache2/php.ini contains the following:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
; <a href="http://php.net/file-uploads">http:
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; <a href="http://php.net/upload-tmp-dir">http:
;upload_tmp_dir =
; Maximum allowed size for uploaded files.
; <a href="http://php.net/upload-max-filesize">http:
upload_max_filesize = 2M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
index.html looks like this:
<!DOCTYPE html>
<html>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
upload.php as follows:
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
Finally, there is a folder named uploads in the path where the index.html and upload.php files reside.
When I test with a jpeg file (286k in size), I get "sorry there was an error uploading your file".
Any advice would be much appreciated, thanks.
|
|
|
|
|
(groan...)
directory wasn't set to be writeable.
sudo chmod 777 ./uploads
did the trick.
|
|
|
|
|
Congratulations - you've just opened up a potential security vulnerability. You allow users to upload files to a folder which is set to allow any user to execute any file in that folder. Guess how long it will take for someone to upload and execute a virus on your server?
https://linuxize.com/post/what-does-chmod-777-mean/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
, glad you figured it out. But you shouldn't chmod 777. That directory should only be writable by the Apache process. Also, it should not live in your document root.
/var/www
- website.com
- html
- index.php
- uploads
- some_file.pdf
Jeremy Falcon
|
|
|
|
|
I'm trying to store a variable from data loaded through a fetch API, so that it's available for use outside the "promise" - i.e. so that I can generate a variable and them compare it on page reload. So far, I have something like this, but it doesn't work:
let extractedVal = await main(x);
let xml = "";
let apiUrl = "link/to/myfile.xml";
async function getXml() {
let response = await fetch("link/to/myfile.xml");
let text = await response.text();
xml = new DOMParser().parseFromString(text, "text/xml");
return xml;
}
async function main() {
xml = await getXml(apiUrl)
console.log(xml);
var x = 1;
return x;
}
i get the error at line 1:
Uncaught SyntaxError: await is only valid in async functions and the top level
or:
x is not defined
if I don't use await
Surely, I'm not seeking to do the impossible here? All the methods I can find for "hoisting" a local variable into global scope seem to fail.
modified 4-Oct-22 19:44pm.
|
|
|
|