Why does the MongoDB Java driver use a random number generator in a conditional?

After inspecting the history of that line, my main conclusion is that there has been some incompetent programming at work. That line is gratuitously convoluted. The general form a? true : b for boolean a, b is equivalent to the simple a || b The surrounding negation and excessive parentheses convolute things further. Keeping in … Read more

Making email addresses safe from bots on a webpage? [closed]

Working with content and attr in CSS: .cryptedmail:after { content: attr(data-name) “@” attr(data-domain) “.” attr(data-tld); } <a href=”#” class=”cryptedmail” data-name=”info” data-domain=”example” data-tld=”org” onclick=”window.location.href=”https://stackoverflow.com/questions/483212/mailto:” + this.dataset.name + ‘@’ + this.dataset.domain + ‘.’ + this.dataset.tld; return false;”></a> When javascript is disabled, just the click event will not work, email is still displayed. Another interesting approach (at least … Read more

Strange definitions of TRUE and FALSE macros

Let’s see: “https://stackoverflow.com/” / “https://stackoverflow.com/” means the char literal /, divided by the char literal “https://stackoverflow.com/” itself. The result is one, which sounds reasonable for TRUE. And ‘-‘ – ‘-‘ means the char literal ‘-‘, subtracted from itself. This is zero (FALSE). There are two problems with this: first, it’s not readable. Using 1 and … Read more

Simple insecure two-way data “obfuscation”?

Other answers here work fine, but AES is a more secure and up-to-date encryption algorithm. This is a class that I obtained a few years ago to perform AES encryption that I have modified over time to be more friendly for web applications (e,g. I’ve built Encrypt/Decrypt methods that work with URL-friendly string). It also … Read more

How do I protect Python code from being read by users?

“Is there a good way to handle this problem?” No. Nothing can be protected against reverse engineering. Even the firmware on DVD machines has been reverse engineered and the AACS Encryption key exposed. And that’s in spite of the DMCA making that a criminal offense. Since no technical method can stop your customers from reading … Read more

How can I obfuscate (protect) JavaScript? [closed]

Obfuscation: Try YUI Compressor. It’s a very popular tool, built, enhanced and maintained by the Yahoo UI team. You may also use: Google Closure Compiler UglifyJS UPDATE: This question was originally asked on 2008, and The mentioned technologies are deprecated. you can use: terser – more information in web.dev. Private String Data: Keeping string values … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)