Surprisingly, this question has no satisfactory answer. A safe usage of a LockCloseable would be like
try (LockCloseable lockCloseable = LockCloseable.lock(lock)) {
doSomethingUnderLock();
} // automatic release
or using @lombok.Cleanup
{
@Cleanup LockCloseable lockCloseable = LockClo...
I have written a wrapper for my code that allows basic namespacing and I'd like some feedback on how it can be improved.
It is designed so that a module can define it's namespace and get access to all of the parent namespaces. These are spread in reverse order across the arguments of the module ...
Better off on code review for working code. You can take a look at this answer I provided to make the check less verbose. The question also has various different methods to use, it's merely matter of preference in the end. — Rob51 secs ago
I'm voting to close this question as off-topic because it belongs on code review — Pythonista22 secs ago
I have implemented a metaclass in Python 3 that apart from the usual instance constructor (i.e. __init__) enables you to define a class constructor (as a class method that I called __init_class__). The metaclass extends abc.ABCMeta so it supports abstract classes, i.e. the class constructor is no...
I'm writing a shell and I can do Hello World:
$ echo Hello World
echo Hello World
30417: executing echo
Now I should do hello world with variables:
#!/bin/bash
STR="Hello World!"
echo $STR
I'm saving the variable in a hashtable (because I looked and bash does not save a shell variable as an...
I have written a simple wrapper for a 2D grid in JavaScript that allows me to resize the grid dynamically and I'd like to know if there's any way I can improve on my code.
Here is the code itself:
function Grid(width, height, defaultValue) {
width = Math.max(0, width);
height = Math.max(0, ...
In an effort to keep all of the Google Maps Javascript API in it's own little world, I have created a googleMaps object that will contain all of the functions that directly make google maps webservice calls. This object will be imported once on every page. For now, it only has one function.
if...
I was told to post this question in code review:) So here it goes:)
I am about to start a small/medium sized project. I am by no means a software architect. But i tend to question every move i make at times. Since i want to do things correct.
I found a way to implement a simple repository, and...
Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one Cache instance supports multiple object properties):
class Multiplication
{
public int Arg1 { get; set; }
public int Arg2 { g...
For codereviews, please turn to codereview.stackexchange.com. My quick comments: a lot of bad ideas. static can be pretty dangerous as it can make testing of your code really hard. Then: constructors should only construct objects ... you might want to decouple that from "real action" like starting threads and so on. Long story short: you want to read about en.wikipedia.org/wiki/SOLID_(object-oriented_design) for example. Then you want to practice TDD in order to come up with a design that is actually unit testable ... — Jägermeister40 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com — Jägermeister54 secs ago
@Jägermeister Regarding codereview: I'm not asking for people to analyze my code, I have very specific questions about specific programming conventions, does that not make the article eligible to stay here? — Chexxor45 secs ago
@MacroMan since there is no migration path to Code Review you shouldn't vote to close questions as "belongs on another site". Alas the UI is confusing :/ The "correct" way to handle code-review-ish questions on Stackoverflow is to VTC as "too broad" and mention Code Review in a comment :) thanks — Vogel612just now
Thanks for your response, I hope you would be able to do so, as reporting is an integral part of the tool that is used more than often specially in code reviews. — Mahm0ud53 secs ago
I think many here are familiar with the graph data structure. Not very long ago, I implemented as an exercise a supposedly simple Graph application that does some traversals. To note, the most complex operations in this class are those that exhaustively find Paths: findDirectPaths, findPathsWithM...
I'm making my own programming language called Jazz and are currently implementing the stdlib. I'm working on util.map at the moment, and want advice on optimisation.
I'm reading through a website, namely this one and are porting it from Java -> Jazz, and don't know if I could possibly make it an...
@CaptainObvious no language tag, because using their own language... not sure whether we need a language tag for that. This particular language isn't released, there is a language named jazz already
@Vogel612 People are uninformed. There is a difference. When they should know enough to know better and they come out with stuff like that, then you can say they're dumb.
@DanPantry Sure, but actually, for the majority of people, they know nothing about secure vs unsecured connections, and their bank accounts don't get emptied as a matter of course. If you're surrounded by that reality, then deciding to spend your time learning something else is not an irrational decision.
I just don't like calling people dumb for not knowing things we think they should know.
A strong argument could be made that making our programs secure even for users who willfully take risks they shouldn't is part of the service people expect these days.
See, for example, car safety measures. Most advances in car mortality in the last 50 years have been in preventing deaths caused by reckless driving.
Same reason that banks are responsible for stopping fraud. Because they have the experience, information, means and capability to do it much better than 100 Million individual consumers.
It would be nice if we could just say "that's the user's responsibility", but that's a cop out.
This question qualifies for the codereview.stackexchange.com. And no, this is not the right way to use php oop and mysqli. Even though only one result set is created. — Your Common Sense36 secs ago
Thanks for your nice comment. But I don't know how to post in codereview as I have no account in codereview.stackexchange.com. Do I need to create another account for that or the existing will enough to post this code there? — Abdullah Mamun-Ur- Rashidjust now
The only problem is if a program gets access to a user's memory, and as much as you can try and limited collateral damage there, if a program has access to a user's memory that user is toast anyway
I agree that users shouldn't be called dumb for being ignorant but they should have a crash course on basic security on the internet. It's just far too important not to be informed.
Just basic stuff like "Don't grant admin access to everything you download from the internet"
3
And "check the URL before you enter credentials"
And "check for the lock icon when you're entering credentials".
Thanks. I already have posted this question to codereview. I did not know about codereview before. Thanks again for your information and suggestion. Hope you will give me sample code there (in codereview) which can be best alternative of my code to use php oop and mysqli efficiently. The link in codereview for same post is codereview.stackexchange.com/questions/129088/… — Abdullah Mamun-Ur- Rashid53 secs ago
I am not very experienced in php oop. Moreover, when mysqli comes with php oop, it make me more confused about using it in best efficient way. Anyway, first look at my connection class:
<?php
//connectionclass.php
class connection{
public $conn;
public $warn;
public $err;
function __construct()...
If only we could make the 'How to ask' an obligatory read.
@Vogel612 The rest of the text is odd at best. I'm perfectly aware asking questions is hard on the internet and not having English as your first language doesn't help either. But there's so many crap incoming and crap questions are unnecessarily hard to review.
So many new users forget somebody else has to read their code, read their question and understand what's it about.
For free.
It's not like we're paid tech-support or anything.
I should figure out what performance Rust gives to know if it's really an interesting language... for example Groovy codes nicer than Java but the performance is just not good enough
This application is designed to query an active directory, and at the moment, performs only two tasks:
Save a list of all users to a file.
Save a list of all groups that all users are in to a file.
I tried to implement a print all groups method, but ended up removing it. I believe I removed a...
I am playing a bit with vanila JavaScript and was trying to create a simple JavaScript calculator using eval(). I would like to share my code for review and suggestions are very welcome.
var keys = document.getElementsByClassName('number'),
getTotal = document.getElementById('showTotal'),
...
background:
I have a model called FileInfo, which represents a sftp file / windows dfs file.
class FileInfo(object):
def __init__(self, server_info, folder_path, file_name):
self.server_info = server_info
self.folder_path = folder_path
self.file_name = file_name
def get_file_full_...
I have a few files that contain a lot of button definitions like this:
$(document).on('click', 'button#search', function(){
// todo: implement
});
$(document).on('click', 'button#another-button', function(){
// todo: implement
});
Is there a better and more clean way of laying out t...
You are correct that the security of your system is similar to that of most password reset systems. It is as secure as the email addresss - no more and no less. Be aware that some password reset processes ask additional questions (e.g. what's the name of your first pet?) which do provide some add...
but it is a lot easier to convince people to use a good, complicated password on their e-mail account than ask them to use a complicated password everywhere
you have the risk that one account being compromised = you're screwed if you use the password everywhere. you have that issue with e-mail, of course, but there's less surface area if you only use that one password for one thing and you're with a reputable, secure e-mail firm.. like Micro$
of course, but if you get people to use a password they will likely use the same password veverywhere, right?
So let's say a user is signed up to 5 sites and they use the same password for each of them, one of them is their e-mail provider
if any one of those 5 sites gets hacked, their email is vulnerable and they are buggered
if the user just uses 1 password for their e-mail and uses OTP sent to their e-mail, the e-mail passowrd has to be guessed or that siteh acked - if the otehr 4 sites are compromised, hackers only get the e-mail & not the password
so in that sense, having even a crap password for your e-mail is more secure than having the same crap password for 5 accounts
What about protecting from other people that use your PC (maliciously)? With a regular login/password the password is generally not visible anywhere, but with this system such other user could open the e-mail client paste the token and get access to everything
and if someone has access your PC you're screwed anyway.
Your PC is your fortress. The goal of security for web devs is to be a moat. If there are people already inside the fortress and killing the king, the moat is pretty useless.
If you don't use passwords, just OTPs, there's nothing for you to remember. That already cuts out the biggest weakness in any security system; the user
Meme: Law #x of Security. (Or Law #x of Security Administration)
Originator: Scott Culp (Microsoft TechNet Contributor)
Background: In November of 2000, Scott Culp published two articles on Microsoft TechNet regarding what he saw to be "Immutable Laws" of Security and Security Administration....
It uses a neural network to make words readable for neural networks such that you can use the neural network representation fo the words in your own neural networks
lol
> monkey:human::dinosaur:[fossil, fossilized, Ice_Age_mammals, fossilization] //Humans are fossilized monkeys? Humans are what's left //over from monkeys? Humans are the species that beat monkeys //just as Ice Age mammals beat dinosaurs? Plausible.
This password hashing thing for LoL is still going on.
Worst still, I just got asked this:
> What should people who play from public computers do to protect themselves now that this is exploit is known to exist?
To which I reply: why are you trusting public computers with sensitive login information anyway?
Yes, if you log into LoL in a PC bang, you might have a "hacked" version of LoL that will log your password. You know what you might also have? A keylogger!