« first day (868 days earlier)      last day (3164 days later) » 

3:06 PM
Greetings
 
How's it going?
 
Yesterday I wrote the syntax os a very basic golfing language in 3 hours
With minimal working stuff
 
3:08 PM
That is
 
olá ismael
 
Are you using a real parser, or a little mock-up one?
 
Receives input, produces output, creates variables and runs functions
Regex
@Alex_n00b Greetings
A single regular expression solved it all
 
@IsmaelMiguel Obligatory:
4427
A: RegEx match open tags except XHTML self-contained tags

bobinceYou 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...

 
... You're showing me that?
 
3:10 PM
Just replace "HTML" with any language name
 
lol
I saw that a LONG time ago
Wait a bit
See that page?
The tiny one on the laptop?
 
oh. my. god.
 
I'm the one who identified it
Which is exactly that link you provided
Besides, the language is too basic to need a full parser
 
Is there a repo somewhere that I can explore?
 
Yup, but it is a bit outdated
I couldn't access github at the time, so, I sent to myself in base64
Over email
Why that name? No idea
The readme is really awful
I wrote it at 5am or so
 
3:19 PM
I've always wanted to design a real language, the problem is, I just don't know enough to do that.
 
Me neither
You could write something like Java
 
Then you don't have to worry about linkers and assemblers
Something that runs on a VM
 
SO is full of questions from people writing their own language.
lambda-the-ultimate even more so.
 
That doesn't surprise me
 
3:21 PM
I want to write a non-imperative language.
 
So at least there are plenty of examples of how not to do it
 
maybe something that's state-based
 
@itsbruce Too many, perhaps?
 
That would be horrendously complex and involve a lot of math I don't know though.
 
3:22 PM
It's amazing how few of those wannabe language creators don't understand how important the syntax is. They see it as just a detail they can bodge.
 
The one I want to make is so easily parseable that a single regular expression is enough to obtain all tokens
 
Syntax is crucial
4
 
They think that moar keywords is better, when it's worse
 
tell that to the designers of C++
 
Syntax determinates how easily you can read something
 
3:23 PM
bingo
 
If your compiler/interpreter can't generate an AST, why bother? So many languages fail there.
 
It helps to keep a clean syntax, since you read it a lot more than you write
 
@EthanBierlein No, tell that to the designers of C.
 
@itsbruce AST?
 
Abstract Syntax Tree
If your compiler can't generate one, many good optimisation strategies can not happen
 
3:25 PM
Well, I have to check how to make one
 
It cannot work out for itself when to inline, for example.
 
@Morwenn Uh, compare the length of this list to this list.
 
No AST, no macros (in the syntax sense, not the C lexical token sense)
 
@EthanBierlein Compare to this list to be fair.
 
Well, the C++ list is still longer
 
3:26 PM
I really have to check how to make those
 
but whatever
I don't think keyword count is as a huge a deal
 
It's a bad smell if the keyword count is large
 
If I was designing a language I'd limit myself to ~10-15 keywords max.
 
It implies failure in language design, worked around via hacks
 
@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.
 
3:28 PM
What the heck is _Imaginary?
(monking)
 
The Io language has no keywords at all.
 
@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.
 
Not one. Which means that the syntax expresses everything you can do in the language.
 
Same for Rebol.
 
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.
Not just for you, but for the compiler.
 
3:31 PM
Well, sugar is sweet but too much ruins any dish/language
 
Once your language is Turing-complete, everything is syntactic sugar.
 
@Phrancis You around?
 
@Morwenn Not at all
Only if you dismiss syntax entirely as a construct
And the Turing machine is only one way to model computation
 
@EBrown Yeah
 
Can you help me with a query quick?
 
3:33 PM
I mean, once you can compute anything, any other layer of abstraction is by definition sugar since it does not allow to do more.
 
Functional languages use the Lambda calculus instead. Syntax that expresses one is very different from syntax that expresses the other.
 
@EBrown Sure, what's up?
 
Monking.
 
@Phrancis I just need help with a WHERE clause, how can I filter it to the last 30 minutes?
 
> I see you're using jQuery. You should totally stop that and find a new job instead
- The Workplace.SE
 
3:35 PM
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.
 
WHERE YourTimeField <= DATEADD(MINUTE, -30, GETDATE())
 
Thank you sir. :)
 
NP!
 
3:36 PM
@Morwenn In some languages, it is a keyword. In others it is a function (a type constructor)
There is a difference and the meaning of keyword is significant, not vague
Laters, folks. Couple of job applications to write
 
@itsbruce good luck
 
Later @itsbruce
 
I'm voting to close this question as off-topic because it is better suited to codereview.stackexchange.com. — Alan Stokes 17 secs ago
 
3:56 PM
@Duga STAHP
 
@AlanStokes Please vote to close as "Too broad". "Belongs on Code Review" is not a valid close reason. — Ethan Bierlein 41 secs ago
 
^that
 
4:14 PM
This question probably belongs on codereview.stackexchange.com. — Cirdec 48 secs ago
 
Anyone got any resources for building a new PC? I need a new case and figured my entire PC is pretty old and could do with some upgrades
 
@ARedHerring newegg.com ?
 
@Phrancis I don't mean sites for buying parts - I mean any kind of resource that helps educate you on Y part over Z part
 
ncix
 
O
 
4:18 PM
(I personally use ebuyer for PC parts)
 
@ARedHerring www.tomshardware.com
and you can watch videos on youtube from linustechtips
 
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
 
I like him too
 
Well, thanks both either way, I at least have two other places to price compare
 
did you check tomshardware.com
 
4:21 PM
I looked briefly
That website looks very old hahah
 
old?
 
The web style of it looks 2005
 
It does a bit
 
The article i'm reading on it looks interesting though
$1600 mini gaming PC
 
@ARedHerring that's your opinion
 
4:23 PM
@Alex_n00b yes, it is.. which is why I said "Looks very old" instead of "is very old"
 
:)
 
I think it (the website) just has fewer bells and whistles, which can also be a good thing
 
It's not an attack on the website, I just think they look stuck 10 years in the past :P
@Phrancis that's true
this article describes a PC I think I would probably use
minus the windows and the dvd writer because who on earth uses DVDs these days
Although I'd be concerned about the overall heat on that system given its small case
 
@ARedHerring that pc is not bad
what monitor do you have 4K or 1080p or 1440p
 
I have 2x 1080p. I'm not rich enough to afford 4k yet lol
 
I would likely be looking to move to 4k before I upgraded the PC I build again
(within the next ~2 years)
brb, restart to upgrade to ubuntu 15
 
there are affordable 4K monitors on amazon
 
You're talking like 1080p isn't enough
 
for about 400$ I think you can get one
 
While I have a 1028x1024 screen
 
4:28 PM
it depends of the size
 
I think it is 17 inches
 
that's ok
because the ppi is higher than if it was 23'
 
To be honest
I'm happy with this screen
 
right know I'm on a 1440 x 900 monitor
 
The CPU would burn down if I tried to play Tera on a 1080p screen
 
4:31 PM
do you think that we can talk portuguese to each other or not?
cause I speak better portuguese than english ;)
 
I think this chat room is English only
 
Lets respect the others and limit our communications, in this chat, to English
 
@Alex_n00b for some values of 'affordable'
£300 is a lot of money to me
 
do you have a budget for your pc upgrade ?
 
@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
 
4:33 PM
@ARedHerring 4K does make a difference for some people like me
 
@Alex_n00b not particularly, but I wouldn't be willing to splash out $400 for a new monitor when I bought a new 1080p one last month
 
@ARedHerring My problem is the CPU. It can't keep up.
 
@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
 
I'm happy with my cheap case
 
if I were to change to a smaller case, I would need a new motherboard
 
4:35 PM
@IsmaelMiguel you can buy an intel pentium for 73€/$ and overclock it and you have the same performance as an i7-4770K
 
so I figure i might aswell go the whole 9 yards and just build an entirely new PC
 
@Alex_n00b It won't be enough. I have a socket 775. Which means that I have to buy on those shady OLX ads.
@ARedHerring sounds like a good idea, but I can't afford yet
 
@IsmaelMiguel that's sad
 
@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
 
@Alex_n00b Yeah, and the CPUs there are quite expencive. Code2Quad (the best ones) cost 90€
 
4:37 PM
my cpu is fast enough to record 60fps 1080p video but my hard drive write speeds just can't keep up
 
Yeah, an SSD is a great idea
I have one
 
you can have a decent gaming pc for 438£ @ARedHerring
 
@Alex_n00b probably, that's about how much I paid for my current one
 
Thanks again
 
NP
 
5:15 PM
possible answer invalidation by itx on question by itx: codereview.stackexchange.com/posts/105011/revisions
 
@Duga Yep
 
5:29 PM
I have some code that uses Optional (Java 8). What would be the best way to throw an exception if it has no value? For example:
Optional<Point> intersectionOptional
        = line.getIntersectionPointWith(perpendicular);
the point returned may be null.
Ok nevermind, I found .orElseThrow().
 
5:48 PM
@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.
Context:
0
Q: Library Class: Point - Follow up

ambigram_makerThis 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...

This way I can keep the contract for .equals() (and .hashCode()) unbroken.
It's quiet... too quiet.
 
Sorry
 
Lets break the ice
 
crack
 
5:55 PM
@IsmaelMiguel lol.
 
It almost worked
 
Right.
@IsmaelMiguel So, you're well acquainted with JavaScript?
 
Somewhat
 
What do you suggest to a Java person (me) who wants to learn HTML, CSS, JavaScript (that stuff)?
 
Well...
First off, forget everything you know about Java if you want to write HTML, CSS and Javascript
 
6:01 PM
That's true for C as well.
;-)
 
And one more
Stay away from w3schools
5
 
Any suggested books?
 
I don't read books
 
Where do did you learn then?
 
School
Seriously
 
6:03 PM
No... JavaScript
 
School
I've learned both at school
 
I suggest posting the before and after versions at codereview.stackexchange.com. — jaco0646 22 secs ago
 
Seriously, I'm the worst person to ask that kind of thing
You can ask SirPython, he learned Javascript a while ago by himself
 
Fair enough... I've learnt more Java by myself than at school.
 
I've learned more by practicing
And learned about jQuery at work
 
6:07 PM
Seriously though... you must have consulted some (other) resource to improve your code (other than CR), right?
 
I read some bits around the web
Seriously
I know it sounds like I'm just kicking you off, but this is the most pure truth
 
0
Q: Simple cache dictionary

VladI 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...

 
@IsmaelMiguel I'm not being rude, am I?
 
No, you aren't
 
@EthanBierlein what is the syntax in python for "if else"
 
6:11 PM
  return 1 if cond else 2
inline
otherwise on multiple lines
 
thanks
 
if condition:
    ...
The indentation is important, and must be consistent, FYI
 
yes sometimes I forget that @EthanBierlein
 
else:
     ...
 
@ambigram_maker I haven't looked at your question, but it would need to be a pretty "generic" method.
 
6:12 PM
elif condition:
    ...
 
Moq has a static method It.Is()
 
@RubberDuck "generic"? Moq? Could you explain?
 
Like, It.Is<string>(s => s == "foo")
Moq is a mocking framework.
What I'm saying is Is() doesn't say a whole lot on its own. It's a special case where that name makes sense.
 
a two letter name?
 
@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
 
6:16 PM
@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.
 
@Alex_n00b post it on the main site. I have something to say about it
 
@Alex_n00b FYI, I'd recommend using str.format over the % operator, as it's deprecated.
 
ok
 
Also, conditions don't need parentheses around them
You can also use the += operator as well
 
@Caridorc do you want me to put it on codereview?
 
6:17 PM
and you should be writing the bodies of your if statements on separate lines
 
@EthanBierlein ok
 
@Alex_n00b yeah why not? People are giving a lot of feedback, I do not want it forgotten in chat archives
 
And you clearly didn't download Python 3 because that print doesn't have parentheses
 
So.. You want Is() to return reference equality?
 
yes I did but maybe the tutorials weren't python 3.5
 
6:18 PM
What do you mean tutorials?
 
@Alex_n00b python 3.3 is stable
 
Python has 3.x docs
@Caridorc So is 3.4
 
Python 2.x is deprecated
but a lot of people still use it
 
3.5 was released recently, but it's pretty stable at this point
@Caridorc unfortunately
 
@ambigram_maker why not go with the default implementation of Equals for reference equality and Equivalent for... equivalence?
 
6:19 PM
yeah but the docs were confusing me so I used google for the the what I wanted
 
@RubberDuck Approximate equality. equals() would then be for exact comparison. (See @rolfl 's answer on my post).
 
@EthanBierlein I hate that Python 2 and 3 are not compatible
 
@Alex_n00b Most of Python 2 and 3 are similar, so you shouldn't have too many issues
Seriously though, use Python 3.x
 
Maybe I'm talking CSharp idioms to a Java guy. Idk.
 
@EthanBierlein They are very similar, you can just from one to the other in a minute
 
6:21 PM
@RubberDuck That's what I was asking. I thought about it and it seems is() is short and can't be made shorter.
 
It's also a bit ambiguous IMO.
 
@RubberDuck Maybe you're right.
 
I would not use 1 / 2 / 3 character names for anything that is not a loop counter
 
What do you want "Is()" for? I would expect it to be reference equality.
 
6:23 PM
I was thinking isEquivalentTo() would be overkill. So: is(). Like:
 
Wouldn't reference equality just work for === ? I've missed this entire conversation, by the way
 
@ARedHerring The context is Java.
(not the Script).
 
Oh right.
 
@Caridorc you can now say what you want
 
== is reference equality in Java, though? Except with value types
 
6:24 PM
@Alex_n00b yuo
 
.equals is for a more 'abstract' equality comparison.
 
@Caridorc ethan said that in python 3 you don't use those
 
@RubberDuck @ARedHerring Something like this:
Point p1 = Point.Factory.cartesianForm(3, 4);
Point p2 = Point.Factory.polarForm(5, Math.atan2(4.0, 3.0));
assert p1.is(p2);
 
...Yeah, don't do that. Use .equals
 
@Alex_n00b those = ?
 
6:27 PM
That ^^
 
To me, .is would imply referential equality
(which I can do with ==)
 
@Caridorc parenthesis
 
0
Q: Guess number game in Python

Alex_n00bWhat 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'...

 
@Alex_n00b opposite you must use them
And you must exlìplicitly convert input -> int(input())
 
@RubberDuck @ARedHerring Ok.. back to isEquivalentTo(), I guess. :-/
 
6:28 PM
no overriding of == in java?
 
There's no operator overloading in Java
 
I don't believe so.
 
@JohanLarsson No, but you could override the .equals method.
 
@SirPython this, which all objects implement.
 
@JohanLarsson Java is not C++. You are limited to using long, descriptive names.
 
6:29 PM
Don't reinvent the wheel, use .equals.
@ambigram_maker and this is a bad thing.. why?
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
 
I think Equivalent is handy in certain cases.
I'm not sure how often you see it in Java.
 
Or you could implement comparable (I believe java has an interface similar to IComparable of C#)
 
@ARedHerring Wait, you are unaware of the full context. See how I dealt with floating point inaccuracies.
2
Q: Library Class: Point - Follow up

ambigram_makerThis 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...

 
@ambigram_maker are x and y ints or doubles?
 
@ARedHerring Also:
21
Q: Floating point equality in "Numbers.java"

ambigram_makerFloating 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....

@JohanLarsson See the post (the first one).
 
6:33 PM
ok if they are doubles p1.DistanceTo(p2) < tolerance makes sense
 
Damn... I posted the older link. The new one:
8
Q: Floating point equality in Java - follow-up

ambigram_makerThis 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...

 
Point.Factory.cartesianForm(3, 4); I would write the factory methods directly in the point class in C#
 
@JohanLarsson It helps me organise stuff. Line (which I haven't posted yet) has 6-7 different factory methods.
 
possible answer invalidation by Ethan Bierlein on question by Alex_n00b: codereview.stackexchange.com/posts/105108/revisions
 
6:41 PM
ignore that
I'm helping out the OP
 
We know.
@Caridorc It would be better if you include the final code (like @200_success does).
 
@ambigram_maker final code added
 
@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)
 
@Caridorc I enjoyed both answer and you type really fast
 
6:48 PM
@Alex_n00b thanks :),
 
@Caridorc @EthanBierlein now what answer to validate? Let me re-read both answer to see which one is better for my game
 
@EthanBierlein good luck :D
 
Oh, nvm
Thanks! :-)
 
@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().
 
time for dinner, bye for now
 
6:51 PM
@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 ;)
@Caridorc WAITTT
 
bbl, gonna go for a walk
 
maybe I'll wait for more answers @Caridorc @EthanBierlein
 
@Alex_n00b It's only been ~20 minutes. You should definitely wait for more answers.
 
@JohanLarsson snorts
"You can't tell the difference between software programming and cooking spaghetti"
 
@ARedHerring Final verdict?
 
6:57 PM
@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.
 
@ARedHerring I'm just asking for an opinion (and trying not to break contracts).
 
Instead of coming up with a separate method to work around the .equals/.getHashCode contract, IMO you should just implement the contract.
But I am not a Java guy, I do JavaScript
 
@ARedHerring That's what I'm trying to say!!!
equals will follow the contract.
 

« first day (868 days earlier)      last day (3164 days later) »