« first day (1590 days earlier)      last day (3365 days later) » 

2:00 PM
I sound stupid, dont think php has function type i think its callable
 
lmfao
@BenBeri don't worry, Java will never be like PHP
 
@Unihedro I hope so
Would it be good if java gave you an additional feature that lets you control memory, even though there's GC?
 
fge
To be honest, with the way lambdas work and the ability to use method references, Java doesn't really need functions as first class citizens anymore
With a little effort you could even do currying
 
@fge Doesn't that go without saying? xD
@BenBeri that implies that such a feature doesn't exist
AND IT DOES
 
Something I would really find useful is if java would add multi-class inhertion
I think C# allows you to
 
fge
2:03 PM
@Unihedro well, some people will argue that "no, those are not real functional types" etc etc
@BenBeri Java does have multiple inheritance
 
XD
 
fge
But multiple inheritance of behavior, not state
 
@BenBeri Are you comparing Java with C#? xD
 
@fge You can extend 2 classes at a time?
dont think so
 
fge
No, but you can implement two interfaces or more
 
2:04 PM
@BenBeri If you ever need to extend 2 classes at a time, you're doing it wrong.
 
interfaces is a different story
 
fge
As I said: multiple inheritance of behavior
 
That's why C# exists!
@BenBeri Well, exactly.
 
@Unihedro lol no
 
@ItachiUchiha You're too late. We've decided to drop the hangouts. Instead, I'm going to talk about code golf.
 
2:05 PM
and you think @fge will let you do that?
 
@Unihedro And how can you manage memory in java besides creating memory and hoping for GC to work like you want it to?
 
fge
@BenBeri but, ya know, the GC just works
 
@BenBeri By using the stuff java.lang.ref that the Java API just GIVES you? xD
Do you even code? :p
 
reflection?
 
what was the website on which we used to sketch?
 
2:06 PM
That's .reflect.
ref is for references and queues.
 
fge
@Unihedro no, .reflect
 
(Duh.)
@fge Eh.
 
fge
And in 2015 you should use java.lang.invoke anyway
 
Last time i used reflection was so long ago, I am not allowed to use it at where I work because it's too slow but its ok
 
fge
@ItachiUchiha draw.io?
 
2:08 PM
@BenBeri What does reflection have to do with references and queues? xD
 
nothing
 

Java Sucks!

JavaScript Sucks!
You can ramble in there. ^ That's the official room to take rambling about Java.
 
@fge the other one
 
fge
Hmm, I don't recall, sorry
Oh
sketchtoy.com?
 
yes
got it
thanks
Now, how do we create a hangout
 
2:19 PM
Who wants a quick game of super tic-tac-toe?
 
Me!
I like that game.
 
is it possible to use this way of creating thread objects with out getting the following error? "The type Excutor must implement the inherited abstract method Runnable.run()"
public class Excutor implements Runnable{

Thread threadObject = new Thread(){
public void run(){
printshit();
}
};
}
 
Help me draw
 
fge
@ItachiUchiha OK, hang on a second
 
2:23 PM
Can't we use some kind of pre-made software instead?
 
for?
 
@Unihedro Haven't found a decent one that supports online
If you manage to find tell me :)
 
For now, what are you? X or O?
Nice
 
An ever-changing battlefield. xD
 
2:34 PM
I believe I just checkmated you.
 
Yeah, I realized. xD
Oh, but you stepped into the trap. xD
 
Wait, what? XD
lol
WP
 
The correct move on the top square was to take the lower left corner, which would force me to give up either of top or top right box.
I then get a free play, and nothing would change the predestined fate of losing, where you take the other grid to connect a three.
GG
You can make a new game with the rematch button if you want. Doing so lets you have the first player.
I actually haven't been playing this many times. xD
 
Nah, I've work to return to :D
 
Good luck!
 
2:36 PM
Thanks for the game.
 
yw
 
Good morning, Java!
 
Morning, @Michael!
 
Morning
 
fge
@ItachiUchiha question; when you create an archive, processed data may come from any thread, right?
 
2:43 PM
@Gemtastic I sent your CVs today
Fingers crossed :)
 
@fge yes
each thread makes an archive of its own
 
fge
Eh?
Uuh
Why not make another thread which is responsible of creating the archives?
 
@SecondRikudo Oooh! Thank you!
 
100 files -> 5 different threads (each has a queue size of 10) -> 10 archive created by 5 threads (not compulsory 2 by each)
 
Eh, what's the version of "dual licensing" but instead for three licenses?
 
2:46 PM
@fge wanna have a look at my draft and say what you think? docs.google.com/spreadsheets/d/…
It's the db design draft
I'm not sure how to solve the whole one car many owners thing though...
 
@fge That is what the plan is. Since, I told you there is an infinite loop, we are re-using the same threads. The thread, once created, never gets killed. Unless, the shutdown is initiated. But, this IMHO is an overkill. Instead of saving, we are killing resource by this.
 
@Gemtastic there are 3 major types of relationships between entities in a database
 
@SecondRikudo I know
I'm just a little bit puzzled about putting it into practice while avoiding many to many relationships
 
@Gemtastic one car many owners meaning that one car can belong to multiple owners?
 
@SecondRikudo Yes
 
2:49 PM
can you guys see where im going with this? pastebin.com/QNc8xY46 and is it good to do so?
 
In that case, the simplest solution would be to have a car_id column on the owner table, that links to the car_id in the cars table.
Which looks like pretty much what you've done.
 
In reality I don't think that's possible in sweden, there can be many people sharing ownership, but only one person can be registered on it because of the laws regarding fines
 
But who are "owners" in this context?
Are they customers?
 
@SecondRikudo But then there'd be repetitions of the same owner in the owner table when it own many cars...
Owner and customers are the same
 
@Gemtastic So that means there is a many-to-many relationship!
One car can be owned by multiple owners, and one owner can own multiple cars
 
2:52 PM
The ambiguity is from my teachers. I just mimicked ot
 
@Unihedro there?
 
@SecondRikudo Exactly...
 
@somefolk No.
 
That's the definition of many-to-many
 
Did you look at my draft? I put a many to many table in there
 
2:52 PM
So you need 3 tables, the owners (or customers, whatever), the cars and the cars-to-owners
 
Hi everyone, I'm having some problem using UserCredentialsDataSourceAdapter on my tomcat server, does anyone know that subject ?
 
But I grayed it out because I wasn't sure if i could avoid it
 
Okay
Why does it have an id?
 
@Unihedro can you take a look at this pastebin.com/QNc8xY46 and tell me if its right to do so? don't know if i should keep going with this idea
 
Because you need a primary key
 
2:53 PM
57 secs ago, by Unihedro
@somefolk No.
 
@Gemtastic No you don't.
Who said you must have a primary key?
 
@SecondRikudo Oh well, then I don't :P
 
@Gemtastic approach this like I always say
What problem is there that an ID column solves?
 
@Unihedro haha
 
I read a tutorial that said that I should always have a primary key to distinguish the entries.
 
2:54 PM
@Gemtastic Alright, so a primary key is there to distinguish the entries
 
But it might have been wrong then?
That's the only purpose for it in that table.
 
can you light me why its not recommended?
 
Now ask yourself this, in that relationship table, would you ever need to select one single specific row?
 
Not really
 
What does a row represent in that table?
 
2:55 PM
It's just something I was taught and saved in "how it's done"
 
A single connection between an arbitrary car and an arbitrary owner
 
I'm not at the stage where I can reason freely about it yet.
 
You won't ever need to select this particular connection :)
@Gemtastic question everything you're taught
Ask your teacher "why?" and if they can't answer, ask yourself.
 
@SecondRikudo I do, but I start out by just doing what I'm told so that I know how others think, then, I'm gonna go about and do it MY way, when I know enough from all the "why"
@SecondRikudo It's a tutorial. I can't ask a book why :P
But I will ask it in my head
 
@Gemtastic Fair enough. It's also part of the reason you put this up for review :)
An ID column solves a particular problem, a problem that doesn't exist in this particular case, so it's simply a waste of space/
 
2:57 PM
@SecondRikudo Exactly. I want to hear as many ideas as possible. The truth is probably in there somewhere.
Truth in this case would be "best practice"
 
@Unihedro any quick two-words explanation why not to? its highly craving me
 
So from this DB design I take it your assignment is to create some sort of managing application for a car shop?
 
@somefolk 'I busy.
 
The owner table is/was my big questionmark, I feel fairly confident about the other tables, but i still want feedback because I don't know what I might be missing
 
Two words.
 
2:59 PM
@Unihedro i noticed that ;) can you try to explain it later when you have time to? i'll just take a pause for now
 
@Second I forgot you didn't see the project desription: docs.google.com/document/d/…
 
> The program is meant for industrial (work related) use so the focus is on function, not the looks of the GUI.
This is the biggest load of bullshit that exists in the industry today
(And it's not your fault)
"It's for work, so it doesn't have to look pretty"
Because employees are robots, right? They have completely different needs and actions than normal human beings :D
 
fge
@Gemtastic at a first glance --> not 2NF, bad
 
@SecondRikudo It's written by my "teacher" and I've pretty much made a direct translation (that still makes sense). It displays what kind of teachers I've had this course...
@fge What is it about it that's bad?
 
@Gemtastic It's not even his fault, he was probably taught that way too.
 
fge
3:01 PM
Look at your vehicle table for instance
 
But from personal experience, people work better when they have nicer, less crappy looking tools.
Transitions for instance is a UX thing, not just UI.
@Gemtastic "modellate" probably modularize
 
@SecondRikudo He's probably an ok developer, but he doesn't know nearly enough to be teaching
 
Or "model the problem domain"
 
@fge Yes?
@SecondRikudo It does state in the swedish version that it needs to have a easy to read and navigate UI, but it doesn't have to be pretty, just readable. So only half of what a GUI should be (still dumb)
 
@Gemtastic brand, model and year are bound to be duplicated in the Cars table
@fge is that what you're going to say?
 
3:04 PM
I'm allowed to prettify it, but it's just not required for the grade of the course
@SecondRikudo Why does that matter? They will never be the same car though because of the license plate?
 
@Gemtastic The idea of normalizing a table is to remove duplication
 
I could add 'colour' to it... since a car does have colour...
 
@Gemtastic Think about it this way
What if I have 5000 cars in my database, which are all white Mazdas from 2004?
You'd rather have white, mazda and 2004 duplicated 5000 times? Or have it written once, and refer to it with an ID?
 
fge
@Gemtastic this table is not 2NF
 
(So essentially you get license_plate and model_id for instance)
 
fge
3:08 PM
You don't have a dependency on the whole key
 
@SecondRikudo But no matter how you do it, there will be duplication; if you tie the brand and colour to another table, you'll still have the same reference to that table all over..?
 
fge
@Gemtastic no, you can avoid duplication
 
@fge Could you show me an example, there's obviously something I misunderstood...
 
fge
If you have a table, say, vehicle_model, you can have an id on this table and in vehicle reference the id of this table
OK, hold on, I'll create a text file of "pseudo SQL" to show you what I mean
 
@fge You're about 50 messages too late :P
 
fge
3:09 PM
Well, sorry :p
 
@Gemtastic It's true, you'll have to repeat the reference to the vehicle_model
But a single int is cheaper to repeat N times than 2 strings and an int.
 
I still wonder why having a key from another table repeated in a table would be any difference from the plain text
 
@Gemtastic Takes less space
 
@SecondRikudo So that's the answer then?
 
That's what I suspect @fge's answer would be.
My approach is usually the opposite
 
3:11 PM
What do you do?
 
I want to be able to, in a single I/O call, to select all of the data I ever need.
 
I thought having many tables were more space consuming
 
For that, a NoSQL (document-based) DB like Mongo works nicely.
In Mongo, anything short of many-to-many will be stored in the same document.
 
Ah, you like to work with another method than SQL offers?
 
Imagine a gigantic JSON that describes anything and everything about a car.
 
3:12 PM
That sounds more similar to what I've been doing
 
the model, the colour, the list of owners (each a complete object with all the data of the owner)
 
Then I select a car with the license plate of 123456, and get all of the information required about that car.
This method is more duplication prone, and takes more space.
 
Does ubuntu.com take donations?
 
But unless you only need data from one table in SQL, and don't need a JOIN, the document-based approach is always faster for writes.
@Unihedro Yes
 
3:14 PM
@fge But now we have model, year model and brand as three things which will reappear very often. Do i make one table for them each?
 
fge
No, they appear only once
In the vehicle_model table
 
Wait, what?
 
fge
You are not going to create two models for a Honda Civic Type R year 2005
 
@Gemtastic @fge perhaps it's better if you showed it on the spreadsheet
 
fge
You're going to create that model once
 
3:15 PM
@Gemtastic can you open write access to a new sheet?
 
@fge Yes?
 
fge
And all vehicles which are Civic Type Rs from 2005 will "share" the same entry in vehicle_model
This means that when you enter your new vehicle, the existing models will be searched; if it exists you're good, if not you create a new model
No duplication
 
@fge Technically there is a duplication. You'll have to call the same model_id
But like I said, that duplication is very cheap relatively to all the data you store in models
 
fge
No, that's not duplication since this is not a duplicate relation
 
But then there will still be duplication in the model table because you'll have the same brand appearing many time for just one model because of what year it's been made
 
fge
3:18 PM
@Gemtastic so what? This fits the business requirements
Don't go and create data for data's sake
And note that you can always filter by brand, and year
Since the tables are 1NF
 
SJD
Hello. I want to know if it is possible to invoke manually an ActionListener which is applied on a JSpinner?
 
fge
What you need to add is vehicle models; you don't need to individually add brands, or years. And your application is there to present to the user a list of brands if need be (select distinct brand from vehicle_models etc)
 
@SJD Just invoke the actionPerformed() method.
 
SJD
for instance, when I open a JFrame which contains a JSpinner, as I see it doesn't invoke the action listener so I need to invoke it manually because it generates something on GUI. Is that possible? Tx in advance
 
But I don't get how the repeptitions in another table is ok, but not in the first?!
 
fge
3:21 PM
Because your original vehicle table is not 2NF
You don't have an attribute dependency on the primary key
 
@fge 2NF is not a magic fairy dust to be sprinkled on tables
 
fge
Whereas in the tables I wrote, this dependency is here
 
Please explain why 2NF is important
What makes your method better than hers?
 
fge
Well, it's important to avoid data duplication AND it allows better data consistency
If your new Honda Civic of the same year happens to be spelled Hnoda, you're screwed
And this is why 2NF is important
 
With the table I first made, there are no references to other tables, and no repetetive columns, in the second table, there will still be repetition of the brand, model and year, the exact same repetitions as in my original table
 
fge
3:23 PM
No there won't, again
Look carefully
 
@fge There would if there's something different...
Only if all 3 happen to be the same will there not be repetition
If it's the same model and brand, but not the same year, model and color will be repeated.
 
@fge: look at the last table there now: REPETITION! docs.google.com/spreadsheets/d/…
 
fge
@SecondRikudo so what? This is not part of the business requirements; also, why would the color be part of the vehicle model and not, say, of the vehicle?
 
@fge changed to brand
 
fge
@Gemtastic yes, and? A 2001 model and a 2002 model are different
 
3:25 PM
Also, what are the business requirements here?
 
fge
So, this is not a repetition
 
@Gemtastic I think I know where you're going with this.
 
@fge Here's a requirement; You CAN NOT complain about the amouont of data. ;P
 
If you really want, you can further normalize the models table and move the year away
 
@SecondRikudo Can you help me try to communicate it to fge? I'm really bad at explaining things :/
 
3:26 PM
But that's only useful if you have a lot of different years for the same model:brand pairs.
 
fge
A car model ALSO depends on the year it was produced
There's nothing in common between a 2003 Honda Civic and a 2013 Honda Civic
 
It does say in the requirements that a car has to have a brand, a model and a year
 
The duplication prevented here is where model:brand:year are the same
 
fge
But again, and I will never repeat it enough, don't create data for data's sake
 
"Statistics for brands and models (of the vehicles)
Display how often vehicles of certain brands or year model are being surveyed. One example could be Honda cars on average get surveyed every other year while Volvo are surveyed every year."
 
fge
3:27 PM
Well, yes, then how does the table not fit the bill?
It has everything you need
And not more
 
@Gemtastic That's a matter of selecting cars and inner joining with the models table, then filtering based on what you want.
Think about it this way @Gemtastic
A "vehicle_model" is a compound of "brand:model:year"
 
If I understand it correct, it's better to say; if there are going to be more than one of something in the rows, it safer to refer it to another table so that you always have the exact same reference when it appears again.
 
SJD
@Michael thanks bro!
 
By separating "vehicle_model" to its own table, you make sure there's no duplication of any one "vehicle_model"
 
The thing is, for statistics, it's sometimes only interesting to see the brand, and sometimes you need to see the year
 
fge
3:29 PM
Well, it only depends on the filtering criterion
 
@Gemtastic in every table there's what I like to call the "conceptual primary key"
 
fge
In one case you'll select where brand = xx and in another you'll select where year = xx
 
The "conceptual primary key" is what distinguishes each row, and it's not necessarily an ID column.
 
fge
That's all
And you can precisely do this because the table is 1NF: you can use the row in a where clause in full
 
@SecondRikudo Then we are back on my question I asked in the beginning; do I make a separate table for models, one for year and one for brand?
 
fge
3:30 PM
No, no need
Just a table for the vehicle models
 
@Gemtastic No, there's no need.
Conceptually speaking, a "vehicle_modle" is comprised of those three factors
 
fge
@SecondRikudo well, what you define here is a relation :p
 
There's no need to overnormalize (Even though it is technically possible)
 
fge
And that's the fundamental of the relational model
 
Model = yaris on a Toyota yaris produced in 2003
 
3:32 PM
@Gemtastic try to imagine this in Java code
class VehicleModel {
    private String brand;
    private String model;
    private int year;
}
And each Vehicle holds a reference to a single VehicleModel object
Instead of Vehicle having to potentially repeat those 3 parameters
 
So the licenceplate in this is the reference ID to the specific instance of the object?
 
@Gemtastic You can visualize it that way, yes (even though it's not 100% accurate)
A table holding a reference to a licenseplate is like an Object holding a reference to a Vehicle object
(And that Vehicle object, in turn, holds a VehicleModel object)
 
fge
Hmwell, making the license plate the id of a vehicle does not seem like a good idea
License plates can change
(the vehicle can change owner; this implies a new license plate)
 
What I see in that table that makes it "impure" is that it holds a reference to another table that's containing the owners, because of that, you should break out the vehicle part of it, and make the vehicle table a "clean" table of references to other table; it's only being referenced?
 
@fge I don't know how it's like where you live
But when a car changes ownership, the license plate does not change
 
3:36 PM
@fge In sweden they can't
 
fge
Ah, yeah, this was true here until last year
But not anymore
@Gemtastic replace "impure" with "not a relation" and you'll have the gist of what the relational model is about
 
@Gemtastic HR lady asked me if you're looking for any particular opening in the London office
 
But I'll slap on an ID column too then.
 
(You or your SO)
@Gemtastic In a relational database, many-to-many relationship is best represented with a third table, that neither parties are aware of
 
fge
Yeah, and when you have that, this is where common ORMs suck and where JooQ really shines
 
3:40 PM
@SecondRikudo If he can get a superintendant position that's good, he's also very good with people so a "boss" position where he's having personnel responsibilities is also something he's good at. But he'll take anything they have that pays a living wage
@SecondRikudo My first step is to try and avoid many to many as much as I can, the second step, when you HAVE to have many to many, then I'd do what I did in that document which is exactly what you say; create a new table.
 
fge
@Gemtastic why avoid many to many? This is not "evil"
This is the bane to get to work with Hibernate but then this is why I don't use Hibernate :p
An ORM should help me, not limit my options
 
@fge cough I feel the same about Java cough
 
cough
Ugh, it's so cold. I should go to sleep.
 
@fge Because it's bad practice because it eats more memory. If you can avoid it, do.
Is what I've read
It's not like it hurts to go about it with the thought in mind to first try and make it without many to many
I see it as a challenge
 
@Gemtastic it's not a question of avoiding it or accepting it
If there's a many-to-many relationship between two entities, there's a many-to-many relationship between two entities
That's all there is to it.
 
3:55 PM
@SecondRikudo Yes, but if you can design it in a way where they happen as little as possible, it's a fun challenge
 
If one car can have multiple owners, and one owner can have multiple cars, there's an m:n relationship between them, it's not a question of modelling it's a question of how things are actually like.
 
Technically, I don't have to make it possible for a car to have many owners, but since I decided to fill all the requirements, I have to do it :P
I like challenges.
 
I don't. I like practical things that are more productive than challenging random aspects.
 
The challenge of finding systems that are more effective and productive is fun for me.
Then I can master them; that's the next step! ;p
 
@Unihedro Things are different while you're learning.
 
fge
4:02 PM
@Gemtastic where did you read that? It's completely false
 
You won't be at your most productive or at your most efficient when learning something new.
 
Bye.
 
Can anyone please explain to me how to work with application.properties?
 
fge
But given your requirements, you'll have to have many to many relationships
 
Where should I put the file? Keep in mind I'm working with Spring >_>
 
fge
4:05 PM
@SecondRikudo at the root of your classpath?
(no idea, just guessing here)
 
I'm looking at other projects we have, and I see it being put in resources/config but putting it there I see no indication that it's being used at all..
 
@fge In the book we were provided
@SecondRikudo And I am currently learning.
 
fge
Well, not all books are good it seems :p
 
@SecondRikudo As far as I know it has to be in resources
But I never managed to make more than one .properties file
 
fge
hesitates to browse the Spring docs and see what's what
 
4:19 PM
Resources is not a spring thing
But you should know that
src/main/resources
 
@SecondRikudo what is that?
are you talking about the context configuration file?
 
4:40 PM
Unihedro has stopped a feed from being posted into this room
 
mawersoft.co.uk, the provider for the blog I post onto, is now dead. Alas.
Don't worry, I'll make my own blog.
 
@fge dude!!! im using JOOQ now... can i ask for an opinion...
@fge I have a table that has an unsigned int data type in DB.... so when jooq generated the classes and im trying to place where clause using an int, the compiler of course whines... how do you work around with this?? there is no native unsigned short in java right
this is how im trying to do it for now:
The method findById(UShort) in the type DAOImpl<AuthorRecord,Author,UShort> is not applicable for the arguments (int)
 
fge
5:01 PM
I can't really help without seeing the code
 
found it man... what i tried to reference was the class pertaining to tables Author... not the POJO Author..
do you have any tip on this, its quite a collision... personally how do you setup difference in generated table class vs. generated pojo classes
 
fge
Well, in most cases I nearly never use a (row in a) table as a POJO directly; I create POJOs are RecordMappers accordingly. Note that nothing prevents you from renaming the generated classes
 
right~! thanks @fge
 

« first day (1590 days earlier)      last day (3365 days later) »