Skip to main content
Weaver's user avatar
Weaver's user avatar
Weaver's user avatar
Weaver
  • Member for 10 years, 4 months
  • Last seen more than 1 year ago
awarded
awarded
awarded
comment
Is it better practice to create a new variable solely for demonstrating something is final?
As an aside, please, please just use the environment variables and other options the OS or language gives you to get at user directories, don't just construct them and don't make your own subdirectories in there. That's what APPDATA and so are for. Codel like this is why I still have programs using folders on my tiny C: when I've relocated everything to another drive, plus it might break on international versions of windows…
comment
Would it be a bad idea to periodically run code formatters on a repository?
That's … I'm going to go have nightmares now >.>
comment
Would it be a bad idea to periodically run code formatters on a repository?
I think if he's talking about having a bot check things in and out of a repository, VCS is a given?
comment
Multiusers systems and CRUD
#3 is what most wikis (at submission) and (distributed) version control systems (at a specifig merge/pull step) do, if you need inspiration.
comment
Controlling permissions for content on web server (pattern/architecture)
If you're serving the content /on/ html pages to the authenticated users i think it would come down to checking referrer tags to make sure requests are coming from your site. There's probably more subtleties to it but from what i understand this is the foundation of all anti-hotlinking systems out there…probably?
awarded
comment
When using generics for both in and out types, why is out type generally last?
It also feels related to the way the vast majority of things in computing with a source and a destination/target come in that order by default (screw microsoft symlink tool thing…); at least i see in/out as the same concept.
comment
Translating external data to the language you're programming in
@ABoschman End of line comments universally refer to the line they're on. I've seen this comment type for simple descriptions of list items hundreds of times…
comment
Is redundant condition checking against best practices?
And since you have it in already, it's not worth the effort of removing, unless it's in a loop or something.
comment
What is the meaning of the 90/10 rule of program optimization?
Of particular note, with things like sorting functions, it's much faster (in dev time) and easier to make a dumb simple algo do the right thing in all cases than to get an elegant algo fully functional and bugless. (Tho the only reasons to write a sort algo outside of acadamea are if you're building a library or working on a platform without one…)
comment
Should I write duplicated tests for 'setDate' and 'isValidDate' methods?
Your wording indicates that you throw an exception from isValidDate; that's not what you want from a function with that name. isFunctions should return true/false unless it somehow can't be determined (isFileUtf8 -> true/false/CantOpenFileException?), and the answers below seem to have guessed that's what you intended.
comment
What is this Algorithm called? [Traveling Salesman Problem]
If extended to quasi-planar points in 3d it'd make for a neat "edge ring from point cloud" function. Of course, in either number of dimensions there's plenty of datasets that would be pathological and create a mess, but hey, in actual use of some kinds you have a person eyeballing some data and deciding that some algorithm would be a good fit fbr the shape of it or a subset.
Loading…
comment
Why does recursion return the first call in the stack and not the last?
Agreeing with martain; for math-related recursion you need to do something with the return value from the recusive call. Heck, I'd say the two main recursion types are "aggregate a return value" and "do something to all nodes in a tree-like structure", the latter being where you don't care about the returns usually.
comment
comment
Does Python's defaultdict violate the LSP?
You can also monkey-stuff a missing onto an existing dict object of the base class and have it work as expected…
comment
Does Python's defaultdict violate the LSP?
That entire paragraph is the documentation for d[key]. You don't get to stop reading at the first period just because they didn't phrase it as "does x unless y then does z"
1
2 3 4 5