« first day (2849 days earlier)      last day (2316 days later) » 

00:00
"I know for sure that what we dwell on is who we become." -Oprah Winfrey (source)
 
6 hours later…
05:56
dreams of electric sheep
 
6 hours later…
11:56
dreams of electric sheep
The World Health Organization estimates that 30,000 deaths can be attributed to the Chernobyl disaster. Over seven million people have been exposed to radiation from the accident. (source)
 
2 hours later…
14:05
Man, I think I need a refresher with Java or something. I've been programming for 8 years in Java, and I need to remember how to set the first three bits of a number.
Can someone refresh my memory? What happens if I use super.hashCode() & 0b000? What is the shorthand equivalent of super.hashCode() & 0b11111111111111111111111111111000?
Zoe
Zoe
& is the AND bitwise operator
yes, yes I know that, but lately I've been having a hard time thinking and what not. "brain fog". For some reason, I couldn't figure out that & 0x8 is not the same as & 0xFFFF_FFF8
I don't mean to be bitter, but it is pretty terrible to have been able to remember everything near-instantly and think up complex ideas off the top of my head, to all of a sudden be brought down by "brain fog"; thinking, and your mind just stays blank; saying in your mind, "I need to do this", then arriving and forgetting what it was you were doing, even though you just thought of it 1 second ago.
 
4 hours later…
17:53
@AMDG x|0b111 is x with the lowest 3 bits set.
Thanks
but how would you ensure the lowest 3 bits are 0
Can't with OR
x&~0b111 or, alternatively x>>3<<3
but won't that change the original number ? AND is a bitwise mask.
No, binary operators don't change their operands. Just like x+1 does not increment x.
0xFF & 0xF I thought resulted in 0xF?
That isn't what I meant; Java is not pass-by-reference
17:59
int a = 0x12;
int b = a & 0xf;
// a is 0x12 (unchanged)
// b is 0x02
This has nothing to do with pass-by-whatever.
18:22
But see you think I'm talking about a variable. I said value
When 0xFF & 0xF is processed, the value returned is 0xF, correct?
I'm trying to make it convenient to create Token objects and find their ID by the hashCode
I don't need a token.getID() for each token considering each Token always one of 5 possible IDs (the ID is the type of Token)
Now I'm just trying to figure out if I should make all Productions flyweights, or just make a class for all of these: docs.oracle.com/javase/specs/jls/se10/html/jls-19.html
(I'm building a compiler for context)
@AMDG Values never change.
@AMDG Sure, and this is very simple to test: println(0xFF & 0xF); prints 15.
constant values do not change, but you're making my question about values too objective now
Sounds like premature optimization to me.
what does?
flyweights
18:34
I'm just trying to figure out if I should make a class for each defined Production, or if I should just have one class called JavaProduction that I can instantiate and give a name that stands for the type of Production.
The latter seems like the obvious solution.
Are you writing a parser generator?
I'm writing a parser for a compiler. Unless that's the same thing as what you just said.
If you are writing a concrete compiler for one specific language (Java?) just use recursive descent.
You don't need objects for productions.
Yeah, I should have made it clear that this is an academic project of mine.
In that case, have fun with it and do whatever feels cool :)
18:37
Yes, but it is for a public library that I'm writing, and I want it to have a good structure and design.
I need feedback
Not on the project, just what I'm trying to design.
I asked this question here before, but couldn't find a good conclusion really: is there something better than instance factory methods for instantiating a Production after looking it up using a Trie?
It doesn't make the code look any prettier. It doesn't feel right to have a non-static factory generator, even if it is powerful.
@AMDG I doubt an "outsider" can give you concrete feedback without immersing himself in your code for a while.
It would probably help if I also stated that the purpose of this compiler is to be able to compile any arbitrary Token sequence to valid bytecode iff the given Token sequence resolves to valid syntax and correct grammar.
The Trie is essentially a forest of 5 different trees for each kind of Token type as defined by the JLS: Identifier, Keyword, Literal, Operator, Separator.
each Node contains an array of 5 Nodes.
So essentially, you have an arbitrary Token sequence, you get the ID of the token, and access the root node for the corresponding Token ID, and you walk the hierarchy of Tokens down the tree in the same manner for the given Token sequence until you reach the end or a fatal condition occurs. You would then create a Production from the Tokens.
@AMDG What's the difference between "valid syntax" and "correct grammar"?
@fredoverflow you can correctly declare int int = int;, but it is invalid grammar since you are 1) defining a variable called "int" and "int" is reserved; and for the same reason, 2) you are defining the value as int which, given any context (arbitrary or not), cannot compile because there cannot exist a variable named "int".
Hence, the above expression is valid but illicit
No it's not, int is a keyword in Java, not an identifier.
18:49
I don't know, perhaps "correct grammar" is the wrong clause to describe the above scenario and all scenarios like it, but its just what popped into my head. I think anyone reading the above will get the point, despite how I initially described it. If you have more questions about it, I am glad to answer.
@fredoverflow that is what I just said, it is a "reserved word", hence the above is syntactically correct, but grammatically incorrect.
It is not syntactically correct.
An example that is syntactically correct but doesn't compile is int x = false;
it's the difference between "I can has variable?" which is not grammatically correct, vs. "Can I have a variable?"
@fredoverflow well in that case, then that is the example I will prefer to mine.
The reason it doesn't compile is not syntactic, but semantic. To be precise, the static type system doesn't like int x = false;
Yes, thank you, I must have forgotten about that word "semantics".
Do you understand, though, what I meant by the process for identifying a particular Production from a series of Tokens?
I should also note that the compiler works in one pass without back-tracking or look-ahead inasmuch as it will push Productions onto a stack and walk the tree until it finds the largest possible matching Production sequence in the Trie.
@AMDG Sounds like something from the Dragon book :)
Is it a bottom up parser?
18:59
I really wouldn't know how to classify my parser as I haven't read any books on parser architecture or parsing algorithms. I just came up with it.
The only thing I know in common is just the names of the data objects that I work on, such as Productions, and Tokens.
Here is my basic idea for the compiling process: pastebin.com/dtfw7Pu5
You never read anything? Not even craftinginterpreters.com ?
nope
I actually haven't even heard of that site until now
I enjoy philosophy
I figured making a compiler from scratch wasn't that hard. So I thought one up. It works, in theory, and I believe it will work in practice, though I don't believe it will be the most efficient or versatile compiler.
I say easy because really it is just a matter of converting a higher-level grammar to a lower-level one (considering the chomsky hierarchy)
In the formal languages of computer science and linguistics, the Chomsky hierarchy (occasionally referred to as Chomsky–Schützenberger hierarchy) is a containment hierarchy of classes of formal grammars. This hierarchy of grammars was described by Noam Chomsky in 1956. It is also named after Marcel-Paul Schützenberger, who played a crucial role in the development of the theory of formal languages. == Formal grammars == A formal grammar of this type consists of a finite set of production rules (left-hand side → right-hand side), where each side consists of a finite sequence of the following symbols...
Java is type-2
We are effectively converting from type-2 to type-3 (no different than a CLI)
If we wanted to convert type-0 to type-3, we would just convert to type-1, then type-2, and finally type-3...
For Java specifically and it's grammars, converting this type-2 language to JVM bytecode is actually quite simple to perform if we create an arbitrary token parser that treats the type-2 tokens as type-3 instructions: we assign a definite parse operation for every possible kind of Token and production, and a previous Token alters the state of the machine and determines what is done with the next Token.
How much overlap is there between philosophy and computer science?
Did you just ask me how real is the abstract?
There is a balance between the two.
You have to believe in the abstract and also believe in what is real, or else you are not real [not a realist].
Considering that mathematics is based entirely on logic, and philosophy just uses a priori and a posteriori knowledge to make conclusions on some concept, philosophy would have much use of computers as a tool to come to a conclusion about a certain concept insofar as it helps with logical computation.
@AMDG Speaking of logic, how do you like fredoverflow.github.io/boole ?
19:14
I have to say I don't know what Boole is
George Boole? Never heard of him? The guy who noticed that you can compute with the values false, true.
Nope, but now I know the etymology of boolean :P
Then that means the abbreviation for boolean in GLSL, and other languages, is wrong and should be abbreviated "boole" :P
19:17
I just know logic, and everything that I have ever thought of, it is like trying to understand all of science, but on your own, and with nothing but our feeble minds to simulate our ideas and theories. Quite limiting if you ask me, but it has served me well enough, else I would have learned nothing useful in school!
"His wife believed that remedies should resemble their cause, so she poured water on him,"
Well, she wasn't entirely wrong
what would be the difference between "Spring MVC: Beginners Guide" and "Spring into Action" books?
You make an antidote from the venom which infected you
@Permian Presumably, Spring MVC is just about the Model View Controller part of Spring? I own Springing into Action, and it covers much more (for example, security).
@AMDG Anyway, the tool uses a "Top Down Operator Precedence" parser (aka Pratt parser) which is beautifully simple. The core algorithm is just:
let temp = tokens[index++].nud();
while (tokens[index].precedence > precedence) {
    temp = tokens[index++].led(temp);
}
19:22
I cant see the best way to start learning about the spring framework to do web apps
what tool are we talking about?
@Permian Type "spring web app" into YouTube?
Is there a list of terms so I can tell you what my Parser is, or can I just tell you all about it so you can classify it for me @fredoverflow ?
@fredoverflow dont you read books first?
@Permian I love reading books about programming languages and theory. Practical stuff? I mostly dive into YouTube tutorials. But everybody is different!
19:25
I found tutorialspoint.com/compiler_design/… so I can thus far declare this is a kind of top-down parser
@AMDG It's probably a one-of-a-kind AMDG parser ;)
XD
@fredoverflow yeah im a little lost as to where to go to become a web dev past knowing core java from reading java the complete reference
@Permian Herbert Schildt? He wrote terrible books about C and C++.
@fredoverflow yeah him
19:27
But who knows, maybe he's a Java genius?
i meant that book covered core java, but no web dev java
and hence i wasnt sure how to learn java web development
1200 pages? Holy cow.
Does it cover the entire standard library or what? :)
its a standard text
@fredoverflow Okay, I've declared that my parser is a Top-Down, Recursive Descent, Non-backtracking, non-predictive, LL(k) parser, where k varies according to the length of the current (plausible) production. How is that?
Very thorough. If you like classifying things so much, have you considered a carreer in paleontology? :)
19:32
lol
All I did was make a quick google search, consider all the given kinds of parsers on that page from tutorialspoint, and make a conclusion based on their descriptions.
@Permian He uses oldschool String args[] instead of String[] args syntax. Shows the C lineage in him, I guess :)
@fredoverflow how hard is learning java web dev?
@Permian Impossible to answer in general. Just dive in and see for yourself.
@fredoverflow well does it take longer or shorter than core java?
how much of it can you learn on the go
Can you write simple Java console applications that do something useful?
Like, I don't know... simple games like Naughts and Crosses or Connect Four?
19:38
@fredoverflow I guess you could technically consider it a Backtracking parser since if you removed the Trie array lookup, you would have to backtrack on the waiting stack (containing all the Tokens which would have matched to something on the Trie array) every time, causing the parser to be, instead of O(n), more like O(n*(k*i)) where n is the number of Tokens, and k is the size of the stack on the current loop iteration, i.
@fredoverflow yes core java is all fine
Then you can get a basic web application running in a couple of hours.
Just follow some tutorials.
using spring? I want to do things professionally
I would suggest using Spring Boot, it's much easier to set up.
@fredoverflow why bother reading spring in action then? its 500 pages!
19:39
Because I like reading on the bus.
@fredoverflow lol
I would estimate that 90% of professional developers hardly read any books at all.
@fredoverflow because they are shit devs?
I have Effective Java out right now. I guess I'm not 90% :P
@Permian The books or the developers?
19:41
@fredoverflow developers
@AMDG Effective Java is the best second Java book you can buy. Latest edition covering Java 8 and 9?
3e with J9 yep
What's the first? Thinking in Java?
I never read a first Java book :)
I don't quite get it
If you don't know Java and want to learn it from a book, Effective Java would be a terrible choice, because Effective Java assumes that you are already somewhat familiar with Java.
19:43
Yeah that makes sense.
And Thinking in Java is for programmers transitioning from C/C++
and "Microsoft Windows C++ Systems Programming" is for people who want to waste their time :P
Head First Java is a reasonable choice for complete programmer noobs who want to start with Java.
@fredoverflow i found that gimmicky
I guess the style is not for everybody.
i like things dry though!
19:45
This goes with it: greenfoot.org/doc/joy-of-code
Can't get a better learning environment than that. That's where I started in 2011, until I got bored, played a flash game, liked it a lot, and starting trying to recreate that 2D game as my first program, even though I just started programming... well, it got me into the wonderful world of Eclipse IDE, and everything went uphill from there and I... yeah... now I'm using IntelliJ IDEA.
The best third Java book is Concurrency in Practice. It makes you realize how little you know about the whole multi-threading thingie.
@AMDG Greenfoot is excellent to get curious minds interested in programming.
No, the best third Java book is wiki.osdev.org/Introduction XD
The best Java book of them all is K&R!
what is that?
K&R??? isnt that a c book?
19:51
Wouldn't know... never used C or C++ formally
The C Programming Language (sometimes termed K&R, after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as co-designed the Unix operating system with which development of the language was closely intertwined. The book was central to the development and popularization of the C programming language and is still widely read and used today. Because the book was co-authored by the original language designer, and because the first edition of the book served for many years...
Oh
@Permian Hey, if AMDG can name an OS book, I can name a C book!
@fredoverflow the thing with all these books
you learn the language, but to acutally use it productively you need to know some libraries/frameworks
19:52
Real programming noobs read "Intel amd64 architecture reference manual.pdf"
@Permian agreed
@AMDG 64 bit Java is the best Java!
Yeah it is
Because it doesn't run on SysWOW64
@fredoverflow this is the step taht isnt well defined
Anyway, Spring (Boot) is an excellent choice, because it is very relevant in the real world.
@fredoverflow whats the difference between boot and mvc?
doesnt it solve the same problem
19:55
Spring Boot is just Spring with lots of stuff pre-configured. You can use MVC with both.
boot is for web app backends and mvc is as well?
If you don't know Quantum Physics, obviously, you're a bad programmer because you can't make code that runs efficiently on the universe(tm)
@Permian You can use Spring MVC or Spring Boot MVC.
@fredoverflow whats the difference
its like two tools for the same problem
but i may be wrong
19:57
Spring Boot is just Spring with lots of stuff pre-configured.
whats spring mvc then?
It is much easier to "get off the ground" with Spring Boot.
MVC is one of many parts of Spring (Boot).
oh ok
Other parts are Spring Dependency Injection, Spring Security...
i would like everything preconfigured
19:58
Why was Spring made the way it was... I mean I hardly know a thing about it; I just know that it uses reflection and Annotations. The web is slow enough as it is; we don't need to add another 50ms of latency to our backend web applications!
Spring Boot it is then!
also do you know a good way to try out backend development without having a frontend to send stuff to?
@AMDG The annotations are processed at program startup.
Ah, so it takes forever for Sping to Boot... I see.
@Permian With MVC, you send out html pages. So the frontend is just the browser.
@AMDG The typical Hello World Spring Boot app boots in a couple of seconds.
20:00
@fredoverflow oh yeah mvc is different from restful apis
Yikes. Seconds.
How many?
Also, it makes it look worse if you change it to milliseconds, or better, nanoseconds.
I wonder how long Spring Boot would take to load on ARM and Java ME :thinking:
(You know, just in case you wanted to make insecure ATMs)
@fredoverflow ive realised what i actually want to learn in spring restful apis. I thought this was the most common thing in modern web apps
@AMDG Empty project with MVC, JPA and embedded H2 database:
> Started DemoApplication in 3.45 seconds (JVM running for 6.182)
Did you just do that?
@Permian It is. But you specifically asked about MVC, so I assumed you wanted to generate HTML on the server.
20:04
@fredoverflow my mistake
i thought there no point in learning techs that dont fully separate frontend and backend
@AMDG Sure. You just go to start.spring.io and select Web, JPA and H2. Then you download the zip, extract it and type mvn spring-boot:run
Huh, ok
@Permian Okay, so what will you use for frontend? Angular? Vue? React? Plain old JavaScript?
angular
Mandatory warning: Angular is not the same as AngularJS. Angular is the shiny new thing with TypeScript support, and AngularJS is the dusty legacy stuff.
20:07
@fredoverflow the frontend tech is irrevelant
From the backend perspective it is, I guess.
exactly
You could use Postman as a frontend replacement :)
true
looks like its just spring rest
mvc nowadays looks like baggage
 
1 hour later…
21:22
HI all anyone here know anything about jsf ?
I am looking to display images on a webpage that I have in a file but since images and info can change I am looking for a solution where the system does it dynamically
hope that makes sense
Generally something like jsf dynamic image should probably bring something useful, I assume.
I have read around 50 examples today by eyes are starting to twitch at this point but I am going to code that example up and see if it brings me more luck then I have been having today, thanks for the link
Good luck! I am not sure how well that approach would go but maybe linking the source attribute of whatever the jsf equivalent of the image tag is to a String in a Bean might even work as well?
22:28
Alright, so I'm going to go back here again and ask what would be better in terms of API and performance. Should I implement all Productions as their own classes so that a method and its parameter is insert(Statement statement);, or have one concrete class changing the method to insert(JavaProduction statement);

« first day (2849 days earlier)      last day (2316 days later) »