« first day (2277 days earlier)      last day (2647 days later) » 

1:02 PM
yes, whatever method returns the name of Student and Book respectively
I think, its getStudentName() and getBook()
 
@Hemlata You should just override the toString() method in the Student and Book classes.
 
user6857832
getBook() doesn't work and when I cast it, it says ya can't cast it.
 
@JonahSloan That is a very bad way to do it :)
 
user6857832
@JonahSloan Like this: System.out.println("Key: " + key.toString() + " value: " + value.toString());?
 
@Hemlata code plz
 
I still say override the toString() method in the Student and Book classes.
 
@Hemlata You need to improve how you name your variables and methods
What does returnList() do?
It sounds like it returns something, but it has a return type void
 
Hi anyone have an answer for this?
http://stackoverflow.com/questions/41677215/firefox-405-http-verb-used-to-access-this-page-is-not-allowed-when-loaded
 
user6857832
@JonahSloan How?
 
user6857832
@ItachiUchiha Yea, I will do it.
 
user6857832
1:20 PM
How do I get keys and values?
 
Does the method return a list of books?
the problem with your code is that you have a List<Book> instead of <Book>
 
user6857832
It returns what's inside the map
 
user6857832
I mean it prints it
 
so you need to iterate through the loop to get Book and then use getBook() on it
 
user6857832
for (Book x : bookList) {
System.out.println("value: "+x.getBook());
}
 
user6857832
1:23 PM
Like this?
 
That would work, but I would've just put a public String toString() method in Book.java and Student.java that return getBook() and getStudentName() respectively.
 
pls oracle get your shit together and publish j9! I could really need it now haha :D
 
Because then System.out.println("Key: " + key + " value: " + value); would print "Key: hem value: [English]"
 
@ColdFire the '-s' from friday: Nickstar -s = Nicktar (which is my nickname)
 
1:32 PM
oh i see
quite a bit late reply,hehe
 
1:44 PM
Is here someone with lots of experience with LocalDateTime class (and their derivative) and with DateTimeFormatter ?
I have something strange
 
I was offline for the weekend
 
user6857832
Thanks itachi
 
// trace of s.o.p in unit test
testing: 2016-11-31 11:00  // <-- this is string which is passed to DTF to get instance of LocalDateTime
 // <--- place of error (there is none, so empty)
after set casted value: 2016-11-30T11:00 // <-- place of value (will be shown only if present)
 
@KarelG the strangest things with DateTimeFormatterare usually resolved by remembering that the damn thing isn't thread safe
 
it isn't ?
o.O
 
1:47 PM
@Nicktar Wat
 
@Hemlata The stuff I am trying to teach you is how to represent objects from real world entities and how to use them. I hope you are learning something :)
 
How can a date-time formatted not be thread safe?
 
anyways, string with 31 november gets casted to LocalDateTime of 30 november :|
 
What possible shared state can it have?
 
Sorry mixed it with NumberFormat
 
1:47 PM
@Nicktar Wat
What possible shared state can that have?
 
user6857832
@ItachiUchiha Yea, I am. I will read the whole code again, and I appreciate it lol, thanks! :)
 
DateTimeFormatter is thread safe. DateFormat isn't.
 
@MadaraUchiha I can't imagine but it must be important as the fix to the bug ticket was to add the following to the class comment :"
* Number formats are generally not synchronized.
* It is recommended to create separate format instances for each thread.
* If multiple threads access a format concurrently, it must be synchronized
* externally.
 
@ItachiUchiha @Hemlata It's worth knowing that in the real world, you rarely model actual real world objects like Books and Persons with software objects
You have "controllers" and "decorators" and "models" and "updateable caches" and things like that that have no real world equivalent
 
@MadaraUchiha Don't push her too hard :P
 
user6857832
1:50 PM
@MadaraUchiha How Am I gonna learn that? lol
 
So take it with a grain of salt. You use Objects to model the important concepts of your program. In a Library app, those concepts are the library, books and customers
In a web application that generates reports, it might be something different.
 
user6857832
Yeah.
 
@Hemlata With time, experience and code reviews :)
You're on the right path.
 
user6857832
@MadaraUchiha Yea, but I have no one to teach me lol, cuz my school sucks lol
 
@Hemlata You have us 😀
I found that hanging out in on-topic chat rooms and Stack Overflow (answering too, not just asking) is very very helpful in learning
 
user6857832
1:52 PM
@MadaraUchiha Um, yea lol. I will appreciate if ya guys gonna help me :)
 
Although, to be honest, I'll also go looking for a more active chat room, maybe ##java in freenode
 
@Hemlata ahem.. ahem..
 
You have the Uchiha siblings at your side, the two strongest ones too! No one can stop you.
 
user6857832
@MadaraUchiha ##java?
 
@Hemlata Do you know how IRC works?
 
1:53 PM
@MadaraUchiha true
 
user6857832
@MadaraUchiha Yea lol :D
 
user6857832
@MadaraUchiha No
 
@Hemlata IRC is an internet protocol (like HTTP for web and SMTP for email) for chat
 
user6857832
Um, yea.
 
There are quite a few IRC servers out there, where the best one for open source projects and programming in general is called freenode
IRC chat features what's called "channels" (same as rooms in this chat)
 
user6857832
1:54 PM
Um yea.
 
One of those channels is ##java, which is the "official" Java channel on freenode
 
user6857832
yep.
 
link? mad
 
You can access IRC with an IRC client, freenode has a web client for you to use
webchat.freenode.net @Hemlata @ColdFire
Choose a nickname, connect to the server, and once you're in type /join ##java
 
oh thanks
 
user6857832
1:56 PM
Ok
 
maybe I'm sleepish but
 
(Or just add ##java to the Channels field)
 
String s = "2016-11-31 11:00";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-M-d HH:mm");
try {
    LocalDateTime ldt = LocalDateTime.parse(s, formatter);
    System.out.println("s: " + s + " -> ldt: " + ldt.toString()); // gives  s: 2016-11-31 11:00 -> ldt: 2016-11-30T11:00
} catch(DateTimeParseException e) {
    System.out.println("The field is not a valid date.");
}
why the hell does it give 30 november instead of 31 ??
 
user6857832
@MadaraUchiha What should I type in channel?
 
@Hemlata It's a chat
A room, like this one
So: whatever you want :)
 
1:57 PM
##java Cannot join channel (+r) - you need to be identified with services
do i need to use auth?
 
@ColdFire Seems like it
 
user6857832
@MadaraUchiha Ok lol
 
It's a bot that manages users
 
@MadaraUchiha ok
 
NickServ will also make it so that the nick you've chosen will be reserved for you
 
user6857832
1:58 PM
I did
 
user6857832
That's kinda different chat lol
 
@Hemlata Yes
After you're registered, type /join ##java again
 
user6857832
in the chat?
 
user6857832
It says: ##java Cannot join channel (+r) - you need to be identified with services
 
awww feels ignored
 
user6857832
2:02 PM
@MadaraUchiha Why it says so?
 
@Hemlata Type /msg NickServ help for help on registering
You need to be registered
 
@KarelG what is the output if s ="2016-11-30 11:00"?
 
um, you can see that s is never modified
 
user6857832
19:33] *NickServ* help
[19:33] -NickServ- ***** NickServ Help *****
[19:33] -NickServ- NickServ allows users to 'register' a nickname, and stop
[19:33] -NickServ- others from using that nick. NickServ allows the owner of a
[19:33] -NickServ- nickname to disconnect a user from the network that is using
[19:33] -NickServ- their nickname.
[19:33] -NickServ-
[19:33] -NickServ- For more information on a command, type:
[19:33] -NickServ- /msg NickServ help <command>
[19:33] -NickServ- For a verbose listing of all commands, type:
 
I know I mean just out of curiosity
 
user6857832
2:04 PM
What I do now?
 
@Hemlata Read 😀
 
user6857832
haha
 
Your aim is to register and login.
 
user6857832
I should type -NickServ-?
 
[19:33] -NickServ- For more information on a command, type:
[19:33] -NickServ- /msg NickServ help <command>
@Hemlata ^
Read
 
2:06 PM
wtf, 2016-11-31 gives 30 november, but 2016-11-32 gives that exception ??
 
well
there arent any months with 32 days
so thats easy to catch an throw an exception
 
ya know, you expect an API to be right
 
user6857832
@MadaraUchiha aww I'm not gettin' it, what should I type to register.
 
it's damn part of the java 8
 
@KarelG true :D
 
2:07 PM
[19:33] -NickServ- The following commands are available:

...

[19:33] -NickServ- REGISTER Registers a nickname.

...
Read :)
 
read.. read.. search engine.. read.. read.. search engine.. read.. read.. repeat..
 
user6857832
aww I'm not gettin anythin
 
@hem search engine is your friend. Sometimes trying things on your own helps.
 
user6857832
Um, yea.
 
"my school sucks"
no
you are the problem
 
user6857832
2:13 PM
No, that's not true.
 
user6857832
My school really sucks
 
elaborate
 
user6857832
They don't teach anythin related to programming.
 
@Unihedron I used to think that too
My brother kept complaining that his teacher sucked, and that's why he was having troubles (this is in highschool)
It wasn't until I actually took a look at what they were doing before I realized just how right he was
 
@MadaraUchiha for completion's sake, every school sucks if you intend to finish school and become a talented individual who is good at what you want to do
that's not what a school is for
 
user6857832
2:17 PM
Well if they gonna teach ya jus theory stuff, plus nothin related to programming then yeah it sucks.
 
high school is a place where students practice a mild and pointless curriculum so they can finish it with a useless piece of paper that lets you feel like you know something but doesn't, if you actually want to learn something
read books
 
@MadaraUchiha well i did graduation in Computer Science and only language they taught us was C and C++ theory
 
user6857832
But schools are supposed to teach ya, not waste your time by askin students to learn theory stuffs, atleast I can't learn that crap
 
schools don't suck "because it doesn't make people high achievers", schools works because "they practice a curriculum for the students" regardless if the curriculum makes you a better person
@Hemlata no, they aren't
 
@Unihedron The examples they gave them had syntax errors in them.
They taught them that JavaScript arrays start from 1
 
user6857832
2:19 PM
Well ya don't know about india education system prob, but yeah.
 
They taught them to use document.write()
They taught them to use <body bgcolor=
 
in high school?
that definitely won't happen in college.
I didn't even know they teach programming in high school.
 
@Unihedron "teach" "programming"
 
@MadaraUchiha I didn't even know they introduced anything mildly relevant to coding in high school.
speaking of arrays starting at 1
 
@Unihedron They do in Israel
 
2:21 PM
yeah
what kind of high school is that
 
user6857832
Did @MadaraUchiha
 
It's heavily .NETesque and like I said, it's pretty bad
 
where you program :o
 
the only languages used in schools that does that that I can think of would be some flavours of NET and Pascal
and pascal even recommends first-element-zero-index arrays, schools just uses the non-default for some odd reason
that odd reason being, of course, it'd make their job easier
(the teachers')
(after all, once the students graduate, it's not their problem)
 
is it a wise idea to put the JPS diagnostics tool into my program's jar file? I need it to extract PID on windows to kill processes if needed and the problem happens to be that some computers only have the JRE installed where JPS is not part of.
 
2:23 PM
The stuff they taught there in 1 year, I could have done in 3 months, and properly
 
user6857832
@MadaraUchiha I registered, now what should I do? Lol
 
@Hemlata Now /join ##java
 
I'd be pretty certain the current you with practical knowledge could teach it to him in 5 days
 
user6857832
Did
 
morn
 
user6857832
2:25 PM
What's your name in ##java?@MadaraUchiha
 
a few years ago I would fish around people who wanted to learn something and taught them programming
 
@Hemlata I'll give you 1 guess
 
user6857832
Um ok lol
 
user6857832
I though you have different name lol
 
also, on and before high school they are just there so you can learn mildly useless stuff in the curriculum to qualify for exams that lets you enrol in the next schools upwards
it's only in college and vocational education courses that you learn anything even barely useful in real life
 
2:28 PM
@MadaraUchiha i have msg you
is this how it is supposed to work
 
@ColdFire Yup
IRC has both channels and private messaging
 
ok great :)
 
Although take note that private messaging without first asking for permission is considered rude
(similarly to inviting random people to chat rooms to beg for help)
 
ohk
 
user6857832
@MadaraUchiha How do ya send private message? I also wanna try once.
 
2:35 PM
@Hemlata Try :)
 
user6857832
From query?
 
31 secs ago, by Madara Uchiha
@Hemlata Try :)
 
user6857832
Did ya got? Lol
 
ah my cloud weechat isn't connected to ##java
rip
now it is
 
user6857832
Do people respond to questions of java in ##java chat?
 
2:40 PM
yes
@Hemlata
 
2:54 PM
I have a class running on a jvm that starts another jvm using ProcessBuilder. All fine so far since I got a hook on that Process object. The problem is that when for some reason the first jvm crashes the second one keeps running and I can't kill it manually since I lost the hook.
Any ideas on how to regain control of that jvm?
 
user6857832
@MadaraUchiha Do I need to register every time I log out?
 
@Hemlata No
You need to login with your password every time you log out
 
@Hemlata you need to re-auth every time you log in
 
user6857832
Cuz I already did once and then it says the same again
 
with NS identify, not NS register
 
2:57 PM
@motaa What do you really mean by regaining control over the second one? Do you just want to kill it or what?
 
@unserializable yes in my case I just have to kill it
 
user6857832
@MadaraUchiha Can ya please send me link for log in?
 
"since I lost the hook. " <- don't lose the hook
 
user6857832
Or is it same?
 
Ok, but then maybe the second one perform suicide, when the first one dies.
 
3:00 PM
my programm can set N number of remote servers on N computers
all is interconnected using postgresql dbs
 
great
 
the thing is that from my Client I can control any servers currently working on a specific simulation
 
@motaa ... so is suicide of 'second' VM acceptable to you? Your 'second' VM is aware of the first one dying, yes/no? If not, 'suicide solution' would require setting up some ping mechanism between spawn and the spawner.
 
thats a good question @unserializable
I start a server like this:
Process p = new ProcessBuilder(command).inheritIO().redirectErrorStream(true).start();
p.waitFor();
so no the second one does not know about the first one dying :D
but it should not be a problem the second vm knowing about the first vm
when i restart vm1 it creates a new vm2 but the old vm2 is still there and locking a lot of memory
the new vm2 is obviously created and running
@unserializable and yes suicide is definitely an option
 
@motaa Aha, this codes makes things a bit more understandable.
 
3:11 PM
here is the command:
String[] command = new String[] {"java", "-cp", System.getProperty("java.class.path", "."), SimulationServer.class.getName(),passingparameters};
 
1) for cases where 'parent' VM is gracefully killed, you can set up shutdown hook that also takes down the child, e.g.: stackoverflow.com/a/272728/5583149
 
Morning, Java!
 
morn
 
2) for cases where 'parent' VM is killed ungracefully, you probably can do two good things
2.a) mechanism for child to die after it parent dies (e.g. as a process ping) of some kind
 
Hey @Hans
 
3:13 PM
o/
 
2.b) when the parent is started again but finds old orphan child running, it kills it (e.g. github.com/zeroturnaround/zt-process-killer library might be helpful with that)
 
they way you write it , it sounds like those classes are humans
but they are NOT!
!!lightsout
 
I was thinking about putting vm information into a DB and when vm1 restarts I check with the db and check if a process of that kind exists in the processes list
 
@motaa Ay, if you have actually several machines that this VM needs to manage, you will probably need a DB anyway. I was just looking at the current code, which does not really support spawning remote processes :)
 
3:17 PM
well vm1 runs on every computer and only manages one server
 
@motaa in that case, I'd assume you can get by without a database.
... as you should know the classnames of your own processes :)
 
@unserializable vm1 is just there to manage the server that runs on vm2
 
@motaa yeah, that is clear :)
 
and of course I have RMI stuff to build the communication bridge between vm2 and client
@unserializable but to manage processes I would still need the JPS from the jdk?
otherwise I barely see an easy way to manage a process on windows :)
 
@motaa no, why, look at the lib I linked, e.g: github.com/zeroturnaround/zt-process-killer/blob/master/src/…
 
3:28 PM
ah ye
@unserializable that should do the trick!
 
@motaa that alone, no, it just returns the usable PID from (OS) process listing.
 
yes
I can store that pid in db.... when relaunching vm1 I can check if that PID with its name still exist in the system... if so I kill it
 
@motaa read the docs and if you're on windows then pay attention to Windows specific process handling too.
@motaa you most certainly should be able to that.
 
ye thats the problem... several machines are linux and others are windows :D
 
@motaa but i still think DB is overkill. You know the Java class name for the VM2 process, don't you?
 
3:35 PM
I was hoping Java 9 would come sooner though haha... might simplify things a lot!
@unserializable of course as I put it in the command String
 
@motaa yeah! so DB sounds like a bit of an overkill. maybe a PIDfile in TMP directory, if you really want to have 'persistent storage'.
 
now that u are mentioning the overkill... you are totally right!
 
4:09 PM
leaving
bye
 
user6857832
4:25 PM
Itachi, Do ya have any other program for me which I can code? Like the one ya gave me (Library).
 
4:37 PM
@Hemlata this is a very classic and good coding exercise: bowling2u.com/trivia/game/scoring.asp
very good if you want to learn TDD
 
user6857832
@Tavo What's TDD?
 
test-driven development
 
user6857832
And, Yeah I'll have a look :)
 
I had to do it once for an interview
it took me a full weekend, some 25 hours of coding
 
and was is bugfree @Tavo? :P
 
user6857832
4:40 PM
Yea, does it have easy questions or they tough?
 
@motaa very much so. Or at least nobody found a bug in my code ;)
@Hemlata the task is easy. You need to code a program that keeps track of bowling scores
that's all
the link I've sent you explains the rules for that
 
but as mentioned it is a good example for tdd
 
user6857832
Sounds good.
 
Uncle Bob recommends it :D
 
user6857832
Lol
 
4:42 PM
Uncle Bob is a real guy, btw. A bit crazy. But he is a really good dev
 
@Tavo He makes a lot of sense too
 
user6857832
Yea, I don't know him tho lol
 
@MadaraUchiha when his speech doesn't wander, he does indeed :P
 
@Hemlata His talks are bit too advanced for you at the moment
But when you get to that level, he's a must-watch
 
@Hemlata to make for more differing opinions and emulate the usual confusion in software development ... I still think you could program the killer robots
 
4:44 PM
@Tavo That point about OOP being solely for reversing the dependency arrows was a real eye opener
 
@MadaraUchiha link for me ?
 
@MadaraUchiha my reference about him has always been the Clean Code book
it's a must read
 
user6857832
@MadaraUchiha Yea.
 
anyway @Hem. It's a really good exercise for you
 
user6857832
@Tavo Yea.
 
4:48 PM
@MadaraUchiha what was the name of that game where you had to code your minions in JS?
it might be a good starting point for my JS skills
 
If anyone here gets bored and wants to see me and my gf playing a drinking game on camera check this out lmao
 
@Tavo Screeps
 
@ballBreaker I'll burn you in the comments tomorrow. I'm about to head ;)
@MadaraUchiha awesome, thanks!
 
@Tavo lol do it
 
user6857832
@MadaraUchiha The link tavo gave me, I got it, it's bout bowling game, but how am I gonna code? I mean do I need GUI as well?
 
4:53 PM
@Hemlata Don't think so
The task it to just keep score, right?
You need need to be inputted numbers
 
@Hemlata no
just an input
 
user6857832
Um yea.
 
mad , can you give me that uncle bob link?
 
all you have to do is either accept parameters until the game is complete, or accept a list of numbers that define a whole game
 
@unserializable looking deeper into the library you mentioned earlier (zt-process) aswell as the ManagementFactory Package I don't see any part in there that might benefit me in knowing the entrypoint of vm2 :)
 
4:54 PM
@ColdFire I'll see if I can findi t
 
you can decide later whether you want more than one player, etc
all of that is not really important
 
ok no worries
 
Well
That was easier than I had thought
 
what's important is that your code can keep score of a bowling game
 
user6857832
@Tavo Um yea
 
4:54 PM
@Hemlata If you want a bit of extra challenge
 
user6857832
Yea I will read it all first, hopefully I able to code.
 
user6857832
@MadaraUchiha Yea, sure.
 
In addition to your code, write another Main class that calls your code with a bunch of inputs, and makes sure that the output is correct.
 
user6857832
Yeah.
 
Such that if I took all of your code, and called your other Main class (also called "test"), I can be relatively sure that your code works correctly.
 
4:57 PM
@MadaraUchiha thanks mad
 
See what happens when you have all strikes, all misses, some strikes, some misses, some spares, etc.
 
user6857832
Yea, I will.
 
user6857832
I'm still reading the link tavo gave me, sounds tough haha
 
user6857832
But I will still do.
 

« first day (2277 days earlier)      last day (2647 days later) »