20000 forum users - Awesome Special Event!

There is no need to; I said explicitly he could use parts of my website without problem :joy:

7 Likes

If it was how it worked. Then half of StackOverflow could sue us.

7 Likes

but if they don’t know that I’m using code from their website, then how are they going to do anything to me :eyes::eyes: ???

8 Likes

If you are putting it in a public Github repository.

8 Likes

That got me lol :rofl: :joy:

7 Likes

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> :slight_smile:

4 Likes

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.

9 Likes

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) :smile:

8 Likes

Okay then.

3 Likes



Why fail2ban-regex found 3 while grepping 400 from access.log found 16 :unamused:

4 Likes

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 :sweat_smile:)

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.

6 Likes

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!

6 Likes

Welcome to the club :slightly_smiling_face:

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

8 Likes
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:) 
3 Likes

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?

7 Likes

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. :upside_down_face: :slightly_smiling_face:

4 Likes

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.

7 Likes

What part are you talking about buddy?

3 Likes

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 :​)

8 Likes

Defining a function and then using it immediately only once.

5 Likes