How to math url to react-router path manually - react-router

For example, I get a url like: /user/123, and I want to check if whether math path /user/:id manually
So there is some way to math url to path ?

Related

generate a variable in index.html variable in flutter web

Is there any way that I can generate the index.html file with a global variable for example a base URL using flutter.so that if I change it in the index.html file later on, it will use the same value through out the app. For example if I have a string variable with a base URL value and it is used in URLs as a base and after creating the build if I change it in index.html file, It starts using the new value of it thoroughly. So, that I won't have to go to the dart code again and again?

Relative file path for json schemas in VS Code

Is there any way to use a relative file path for JSON schemas ?
Below mentioned syntax not work in vscode :
$schema = "file:///foo.schema.json"
And this one works :
$schema = "file:///c:/test/foo.schema.json"
If you have a scheme like file:, that forms a full (absolute) URI, instead of a (relative) URI Reference.
A full URI is supposed to mean the same thing everywhere, so it doesn't make sense to have a relative file path. Also note that file:///foo.schema.json is the same thing as file://localhost/foo.schema.json
To write a relative filename, use a URI Reference, like foo.schema.json. This will be resolved against a URI base — typically the URI of the document — to form the correct URI, even if the file moves on the filesystem.
For example, if you use this in a file at c:\test\main.json, then the Base URI will be file:///c:/test/main.json, and the URI Reference will resolve to file:///c:/test/foo.schema.json, which is correct.
See File Uri Scheme and Relative Files for more information on this.

How to Shorten Image URL in Asp.Net

Want to shorten image url in asp.net
My Code in Asp.net is
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("images/") + filename);
And It store url in my Database as
C:\Users\A\Documents\Visual Studio 2012\WebSites\WebSite1\images\IMG_20190802_114524.jpg
I want to shorten my image url in Mysql DB
/image/imagename
The Concept of saving file URL in DB is you have to save relative path only. In your case
let spouse:
C:\Users\A\Documents\Visual Studio 2012\WebSites\WebSite1\images\IMG_20190802_114524.jpg
This part is same for all images so why you are saving this in db make a constant and asign this path.
C:\Users\A\Documents\Visual Studio 2012\WebSites\WebSite1\images\
Now you have to save only file name in db.
IMG_20190802_114524.jpg
So when you want to access image concatenate constant value and file name and you get image.
Hope this'll help you.

How do I concatenate 2 strings in Django

I need to show an image of the database, but I need to insert a slash before {{...}} because only then does the file access the static folder. What should I do?
You can do this like recommended in the two comments but actually django coveres this exact usecase. What you are searching is an administration of your static files, the docs are here: https://docs.djangoproject.com/en/1.11/howto/static-files/ .
If you want to have your files organised with the orm, checkout https://docs.djangoproject.com/en/1.11/topics/files/ especially the second code snippet. A File object gives you a name, path and url which should cover all your needs including absolute and relativ paths for your files.

Is a file name with its file extension (without the path) considered a URL?

I was wondering if index.html is a relative URL or not.
I know that Website/Pages/index.html is a URL. But what if it was just the file name and file extension without the path? Would it still be called a URL?
Both of your examples are relative paths, not urls.
Relative url examples:
Suppliers
<IMG src="../icons/logo.gif" alt="logo">
<IMG src="image/logo.gif" alt="logo">
A relative URL (defined in [RFC1808]) doesn't contain any protocol or
machine information. Its path generally refers to a resource on the
same machine as the current document. Relative URLs may contain
relative path components (".." means one level up in the hierarchy
defined by the path), and may contain fragment identifiers.
SRC: http://www.w3.org/TR/WD-html40-970917/htmlweb.html
URL Definition:
URL is an acronym for Uniform Resource Locator and is a reference (an
address) to a resource on the Internet. A URL has two main components:
Protocol identifier: For the URL http://example.com , the protocol
identifier is http . Resource name: For the URL http://example.com ,
the resource name is example.com.
SRC: https://docs.oracle.com/javase/tutorial/networking/urls/definition.html (this is a url)
Absolute path:
/home/you/index.html
Relative path:
you/index.html
index.html
Absolute and relative paths
An absolute or full path points to the same location in a file system
regardless of the current working directory. To do that, it must
contain the root directory.
By contrast, a relative path starts from some given working directory,
avoiding the need to provide the full absolute path. A filename can be
considered as a relative path based at the current working directory.
If the working directory is not the file's parent directory, a file
not found error will result if the file is addressed by its name.
SRC: http://en.wikipedia.org/wiki/Path_(computing)
What a path relative URL is
And, yes, index.html can be a relative url.
When referring to a file that occurs in the same directory as the referring page, a URL can be as simple as the name of the file
If you want to link to your index.html page from your about.html page, as long as they're in the same directory you could very simply do:
Index
What i think you are confusing is absolute vs relative paths. As other's are describing, a URL with an absolute path needs to be defined by:
protocol: (http://)
domain: (bobsjingles.)
extension: (edu)
directory path: (/journeycovers)
fragment: (/index.html)
http://bobsjingles.edu/journeycovers/index.html
All that absolute path does (essentially) is point to an IP / port on a machine, where you can send a request under a specific protocol (http), and get an expected data result (html.)
In a HTTP URL like http://example.com/index.html, /index.html is the URL’s path.
HTTP URLs don’t "know" or care about file names or file extensions.
There is no conceptual difference between paths like /index.html, /index_html, /index, /index/foo/html, or /foooo. (Servers, on the other hand, might use various conventions, like appending a dot followed by a file extension, to do something if such a URL is requested.)
URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on the Internet.
Having said that, a file name with its extension is not a URL as it is not enough to determine the location of the file on the internet.
However, a file name and its extension can be referred to as a URI.
URI can be a locator (http://example.com) or a filename (example.txt) and the combination of both is the URL (and can still be called a URI).
Here is the complete RFC3986 for your reference.
Read this article to help you understand more the difference between URIs and URLs along with some examples