That got me lol
Im still on azure so Iām good. 39 unread, nice. Also, I thought something.
You can ping, with nmapās utility called nping. Itāll simulate TCP handshake and if serverās up, youāll get a response. On linux pc or android phone with termux, install nmap and type nping <your domain>
Oh, lookie⦠I accidentally pushed the mark as answer button to a hosting support question instead of the like button again (I think). This time I almost didnāt notice it.
It hasnāt happened as much now, but it still drives me nuts because for all I know I could accidentally do that and then not notice and move on.
Classic ping (itās a different protocol) does not work because FW blocks ICMP echo-request
(layer 3)
so the article is correct.
And what happens further on layer 4 (TCP or UDP), for example with the http/s server
is something elseā¦
The user can also open his website in the browser and test (directly)
Okay then.
Like @Oxy said, normal ping requests are in layer 3 ( Network Layer), so if FW is blocking ICMP echo requests, we canāt access them within that layer. But we can get a response if we use layer 4 ( Transport Layer) like you did with nmap. But if the FW blocks TCP, we wonāt be able to see that ping request. But nping is not the only way you can send a ping. You can use hping3. (Can use nping too)
sudo hping3 -S 185.27.134.219 -p 80 -c 4
This should do the trick. (btw thatās my websiteās IP )
The key difference is that I used SYN (Synchronize) to send that request. So if the server is reachable, Iāll get a SYN-ACK (Synchronize-Acknowledge) response.
I finally added the part of my website that updates the date each year, with another line of script and some changes to the pages on my website!
Welcome to the club
Hereās what Cody suggested
or you can just shorten it so you donāt use the function()
but this () =>
Now you still have to minify it all or enable brotli on CF
document.addEventListener('DOMContentLoaded', function () {
const cls = document.getElementById('dt');
const el = document.getElementById('elms');
const mn = document.getElementById('main');
const sn = document.getElementById('snd');
const dt = document.getElementById('dts');
let gtm = new Date().getFullYear();
function exon() {
dt.setAttribute('data-dt', gtm);
}
exon();
cls.addEventListener('click', gls);
function gls(){
el.classList.toggle("active");
mn.classList.toggle("active");
sn.classList.toggle("active");
}
function dtex(){
let dtl = dt.getAttribute('data-dt');
dt.innerText = dtl;
}
dtex();
});
This Is my script to get the year. (and some other functions :wink:)
Why do you create a function and immediately call it? Wouldnāt it be better to move the code out of the function? Or do you use it more than once?
Also, wouldnāt it be better to move the variables to a single const and separate with a comma?
The answer to your question is that I like creating individual variables. And no, I donāt use those scripts anywhere else in the code. The reason I create it inside of a function is to make my code more clear (or, in other words, to maintain it easily.). Itās just one of my coding preferences.
I get this is a preference but it seems like it is only going to add three extra lines to the code when there is going to be the same functionality without those.
Functions are there so you wonāt have to copy paste the same boilerplate code in multiple parts again and again in order to re-use.
What part are you talking about buddy?
I personally like to put things in functions, albeit Immediately-Invoked Functions (which is the (()=>{})()
expression) because it means that I can see which parts of the code are separate and a benefit is also not cluttering the global namespace (in most cases window
). And if I do need to make something global from one of those isolated functions, I just slap it into Window.
I see both sides though. I hate how code looks in a function because it can get so complex and hard to read but it also looks bare and incorrect outside of a function (but these are almost purely aesthetic).
Iāve also started dropping the var keyword in favor of let and const and Iāve also started defining functions like let fnName = () => {};
. I feel like itās a lot cleaner and a lot easier to read. One āproblemā is that itās not supported by ancient browsers so I have to get around that somehow.
These are just my opinions feel free to comment or not I donāt really care if you do or donāt :ā)
Defining a function and then using it immediately only once.
I tend to use const
when it comes to defining functions because it is a lot easy for me to forget about its purpose and try to assign a new value to it
I get that what youāre saying is true, but I like to enhance my codeās readability. If I were to add something to that code in the future, I could edit that function and add it.
Also, many coders have different perspectives when it comes to coding. Most coders hate PHP, but I find that fascinating. My code may not be that good, but I know itās doing the job the way I prefer without having any issues.
(Also, when it comes to huge projects, I tend to think about performance; in that case, I use code like you said before, but not entirely.)
Iām back! I was returning home from school, but from tomorrow in these three days I donāt go to school. Anyway:
That is surely readable and ES6-compatible, but I wanted my website to be compatible even with old browsers that also support TLS 1.2! Also, for my websiteās script I didnāt care so much about readability, I cared about making the file size as smaller as I could without minifying everything. Hey @Herbert, at least the part of my script that makes the year work is an one-liner as well!