You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...
@EthanBierlein For it to be meaningful, count the numbers of C++-specific keywords that could have been used for meaningful identifiers, and take into account the fact that they had to have all the C keywords.
C even has useless keywords, just because.
Now, C++ has them too, but you can't blame the designers of C++ for having them.
@Phrancis An imaginary type for complex numbers. Yeah, C designers thought that it would be a good idea to put that in the language rather than in the library.
Also, there is that macro I in the C standard library.
Most keywords are syntactic sugar. Once added to a language, they can make it harder to reason about. It certainly becomes hard to reason about how different bits of syntactic sugar work together.
And while the Church-Turing thesis holds that the Turing machine and the Lambda calculus correspond in key areas, it doesn't claim that they are wholly equivalent
Also, let's remember that the definition of a keyword is a bit biased. I can consider that [ and ] are valid characters in identifiers, then they become keywords when used alone, and not mere syntax.
for example, i'm potentially looking at getting a new case, an SSD (I only have a HDD at the moment) and maybe an extra graphics card or RAM. I have few requirements (needs to have front-facing headphone slot, be able to play GW2 at 60fps on a linux-based OS)
@Alex_n00b Linus is great, I'm subscribed to nearly all of his channels on YT.
Not even for the content, I just like the way he presents
@IsmaelMiguel that's entirely a matter of opinion. I would prefer a 4k monitor simply for web dev. 1080p is good enough, and it does the job, but if I could afford 4k I'd go for it
In the same way that sure, I could get a crappy 2nd hand card, but if I had the money to go for it I'd prefer a nice new buy instead
@IsmaelMiguel my problem is a few things. My current case has no front-facing headphone slot (That actually works), so any headphones have to be wireless or have super long cables. In addition, its very bulky and old and takes up a lot of space and has poor airflow
My graphics card was £100 (And second hand) when I bought it two years ago
@IsmaelMiguel neither can I ;-) this is going to be a long running project
I figure I have some extra money lying around and I could use some changes.. the main one being an SSD instead of a hard drive because I feel right now my hdd is the bottleneck on a lot of things
@RubberDuck @rolfl What do you think of a method named is()? Suppose if (point.is(ORIGIN)) {/* do something */}. I could move my non-transitive, non-symmetric, approximate comparison approach there.
This is a follow up of this post.
Changes:
I tried harder to make my code readable yet concise.
All Point instances are immutable and unique.
New, useful features have been added (like reflection, rotation, translation, etc.)
This class depends upon this class. Line will follow soon. For the...
I decided to write a simple dictionary to use as a cache. Here is the code:
public class CacheDictionary : Dictionary<string, object>, ICacheDictionary
{
private readonly Dictionary<string, CancellationTokenSource> _expireTasks = new Dictionary<string, CancellationTokenSource>();
private...
@EthanBierlein here's my guess number game I know it could be better, but you asked for it
from random import randint
guesses = 0
randomNum = (randint(0,100))
numPlayer = 0
while (numPlayer!=randomNum):
numPlayer = input("Guess the number(0-100)")
if (numPlayer>randomNum) :
print "It's -"
elif (numPlayer<randomNum) : print "It's +"
guesses=guesses+1
print "Well done you guessed my number in %d guesses" % guesses
@RubberDuck I get it. BTW My method is an instance method. Point, Line, (or anything like that) can have is() implementations. I think it becomes more readable.
What could I improve on this code?
from random import randint
guesses = 0
randomNum = (randint(0,100))
numPlayer = 0
while (numPlayer!=randomNum):
numPlayer = input("Guess the number(0-100)")
if (numPlayer>randomNum) :
print "It's -"
elif (numPlayer<randomNum) : print "It'...
operator overloading requires you to have a much greater understanding of the codebase than just using a method
.equals is a known standard in java, just like RAII is in C++. It enables developers to make meaningful assumptions about your code without having to know all of it
This is a follow up of this post.
Changes:
I tried harder to make my code readable yet concise.
All Point instances are immutable and unique.
New, useful features have been added (like reflection, rotation, translation, etc.)
This class depends upon this class. Line will follow soon. For the...
Floating point inaccuracies are really annoying. I understood that in its true sense while developing the next version of Point (this time I'm actually foolproofing my code). Before I upload it for review, I want a class that I wrote, called Numbers to be reviewed.
Numbers.java
package library....
This is a follow up post for this question.
There aren't a lot of changes. The changes (all of them major) are:
I've decided to ditch my previous approach using Math.ulp() and adopt Tim Leek's suggestion: comparing ratios. In my updated code, I calculate both ratios and ensure that their diffe...
@Alex_n00b I hope you enjoyed my review :), I typed it out at max speed, but @EthanBierlein knows to type faster (I also re-wrote the code before posting though, so that gave Ethan a head-start)
@RubberDuck @ARedHerring You've gone silent. Did you understand the context? The .equals() will be kept for comparing using ==. whereas is() (or isEquivalentTo()) will use Numbers.areNearlyEqual().
@EthanBierlein @Caridorc it's hard to choose according to stack exchange meta I should validate the first one but I won't do that. I want you to give me a reason to validate your answer ;)
@ambigram_maker I don't really understand the question (I didn't see isEquivalentTo in that question), nor am I really the right person to ask. I only weighed in because you were contemplating using .is to address value-equality, which is what .equals is there for.