« first day (2276 days earlier)      last day (2672 days later) » 

12:03 AM
ok, I could make my Java program mush better if I combined it with a web server and some PHP. The only problem is I don't really know much about PHP.
I'll probably end up breaking something.
 
 
1 hour later…
1:20 AM
@JonahSloan Yup. I broke my computer.
 
 
1 hour later…
2:35 AM
I can tell that you don't know much about PHP by the fact that you think it will make your Java program better.
 
2:48 AM
@Unihedron Nope, no one cares about hackerRank. It passes time though.
 
 
4 hours later…
6:30 AM
PHP is exasperating.
@Gemtastic I'm using PHP to synchronize my Java program's file I/O over multiple devices and networks.
 
 
1 hour later…
7:49 AM
people still code with PHP?
 
 
1 hour later…
8:51 AM
@JonahSloan that sounds fairly insane. Care to elaborate?
 
 
2 hours later…
user6754053
10:40 AM
When I use Serializable can I get an array of bytes?
 
10:51 AM
@MarkYisri normally yes, see: stackoverflow.com/questions/2836646/…
 
11:26 AM
 
@Unihedron Was that directed to me or to Jonah as a "h8rs gonna h8"?
Also, aww, random downvote :(
 
@Unihedron OTOH, if somebody is crazy enough to sync Java I/O with PHP, then I would rather know about it :)
Also, there are some Java offerings with reportedly excellent PHP support and integration, e.g. quercus.caucho.com
 
user6857832
11:54 AM
Hi :D
 
user6857832
12:13 PM
@ItachiUchiha pastebin.com/V3QKWqhP
 
user6857832
I have jus did this now.
 
user6857832
Can ya please help me what should I do next?
 
hi
 
@Hemlata You can change
if (!student.issuedBook) {
            return false;
        }
        return true;
to
return student.issuedBook;
 
12:31 PM
@rupinderjeet This does optimize one step, but looking at the code, the if statement is a guard clause and code should be added before return true; when needed, it's better kept this way.
 
user6857832
 
user6857832
@Unihedron Can ya please tell me how do I connect my both classes to each other?
 
user6857832
I don't know how to do..
 
@Hemlata By writing code.
 
user6857832
@Unihedron Um, yea lol.
 
12:34 PM
time to put your java basics into use
 
user6857832
I mean how do I connect map
 
user6857832
List<Student> and a Map<Student, List<Book>>
 
What is connect?
 
Isn't it like :

if(false) return false;
return true;
 
user6857832
I don't know how to do with like Object like student here
 
12:35 PM
@rupinderjeet if (false) return false is a clause that stops the function early so if any new code is added it's added after that line.
 
user6857832
@Unihedron Nvm. I meant I don't know how to put values in it like using Student, but I did with String which is useless
 
They fundamentally work the same, but practically you need space before when it returns true.
 
Oh, you mean the code to actually issue the book.
 
Or anything else really. Like other side effects.
@Hemlata Assuming you want to create a new field to hold a dictionary for students to books - don't
books should be a field within the Student object, such as List<Book> ownedBooks
Student is also not a good key type since they are mutable
 
user6857832
 
user6857832
12:42 PM
I did like that but I don't know how to add values in static HashMap<Student, List<Book>> bookIssued = new HashMap<>(); as I jus wanted to add only student name, but If I'll write "new Student(...)" then I will have to add both student name and roll no
 
user6857832
@Unihedron
 
user6857832
I no need to write static List<Student> student = new ArrayList<>();, right? cuz I'm already doing the same in bookIssued
 
You're right! You can't.
 
user6857832
@Unihedron Then how I do it?
 
user6857832
Can ya please help me?
 
12:47 PM
Well, what are you trying to do?
 
user6857832
Now, you would create a Library Management system using these classes (and more if you feel the need) where you can

* add a Student
* add a Book
* A Student can borrow a Book
* A Student can return a Book
 
Which part?
 
user6857832
To add a student and a book
 
user6857832
I mean this: static HashMap<Student, List<Book>> bookIssued = new HashMap<>();
 
user6857832
Do I need to create List<Book> separately?
 
12:49 PM
Yes.
 
user6857832
List<Book> list = new ArrayList<>();
list.add("Math");
list.add("English");
 
user6857832
Like that?
 
"Math" is a String, not a Book.
 
user6857832
@Unihedron Um, yea.
 
@Hemlata Um, yea.
 
user6857832
12:52 PM
@Unihedron What? lol
 
user6857832
List<Book> list = new ArrayList<>();
list.add("Physics");
list.add("English"); ?
 
yeah try to run that
 
user6857832
But where I'm using Book object in " List<Book>"?
 
Make them.
Realistically you should either only record the student roll id (number) -> books isbn list (ordered list of numbers) because it's easier to fill a database with that format, but you need to create Book objects where relevant and cache them in a set.
Again, write code.
 
user6857832
 
user6857832
12:56 PM
@Unihedron Yea
 
user6857832
I did this but I don't want main method in all classes, but I can't add in list without main method
 
"I did this" I'm not seeing any of it.
 
user6857832
The code I shared?
 
user6857832
 
Yeah it's not doing anything relevant to what I said.
 
user6857832
12:58 PM
Yea.
 
Should I show you an example of what Book should look like?
 
user6857832
Yea, sure.
 
public class Book {

    private final String bookName;
    private List<Student> issuedTo;

    private static final HashMap<String, Book> BOOKS = new HashMap<>();

    private Book(String bookName) {
        this.bookName = bookName;
    }

    /** @returns A book of the name - if it does not yet exist, it will be made */
    public static Book of(String name) {
        if (exists(name))
            return BOOKS.get(hasBook);
        Book newBook = new Book(name);
        BOOKS.put(name, newBook);
You forgot to add a getter for bookName by the way, I'm assuming that's not done on purpose.
 
user6857832
@Unihedron Which getter?
 
For bookName, since it's private.
Use Book.of() to get the book you need.
 
user6857832
1:10 PM
Oh yea, I forgot to add it.
 
It will always give the same object if the name is the same - you probably don't want that, so migrate to a proper ID system
again
write code
 
user6857832
Yea
 
java basics
 
user6857832
Yea lol
 
also, I coded all that in gedit with zero proofreading, be wary of errors.
 
user6857832
1:11 PM
Yeah.
 
user6857832
I need to make my own exist and hasBook, right?
 
I think the existing one works. But that's only if you want to keep using a hashmap.
 
user6857832
Nah, exists is also not predefined, I gotta create it.
 
user6857832
If book exist then shouldn't we return book? what's that "hasBook"?
 
user6857832
I didn't get.
 
user6857832
1:20 PM
Cuz hasBook means if the book exists, but we're already checking if(exists(name)), that means if book exists, right?
 
user6857832
I'm hungry lol, be back in a few.
 
It should be name, not hasBook
I was using a getOrElse clause at first, but I changed it and didn't change everything entirely.
 
anyone here know to to find the list of extensions in Google Chrome? My installation has a virus that opens up a pop-up when i open Chrome. I've tried reinstalling chome but it's still happening
When I go to the Preferences-setting-extensions, Chrome just opens the list of Apps
 
"My installation has a virus" fix that
 
how? I ran avast and it found nothing
 
user6857832
1:39 PM
@TheCoder Go to "more tools" and then extensions.
 
@TheCoder Take a hammer. Smack the motherboard of your computer. Take a picture of your smacked computer, and burn it. Take the ashes, mix it with sugar, and eat it.
 
user6857832
@Unihedron Lmao
 
Windows 8's defender is powerful than avast.
 
Or just not use windows and install a proper OS.
 
Hahaha
I just assumed he's on windows.
 
but im on mac
 
>mac
 
> My installation has a virus that opens up a pop-up when i open Chrome.
funny
 
>virus
virus isn't the problem
 
isn't it weird how tech people make folk beg for information.
 
user6857832
1:42 PM
@TheCoder When ya try to open something in chrome, does it open some other website?
 
yes
 
@TheCoder As good people have suggested, you need to radically change your approach. I would not go so far as to suggest a hammer, but I would suggest you install QubesOS (qubes-os.org).
 
user6857832
@TheCoder It was same on my mac
 
user6857832
wait let me tell ya what I installed
 
... if you manage to be back online, come back here and tell us of your experience :)
 
1:42 PM
it opens up google, then a popup comes up
 
user6857832
@TheCoder Yea, wait I had the same problem. Lemme tell ya what I installed.
 
thanks a lot
 
user6857832
It's AdBlock plus
 
Tails OS is another good one, you can burn it on a USB and run it anywhere safely.
 
or uBlock.
 
user6857832
1:44 PM
Go in get more extension and then install form there @TheCoder
 
i already have adblick plus
adblock
I'm going to reset all settings
 
user6857832
@TheCoder Is it enabled?
 
here goes
yes
 
user6857832
Like does it show in the side of your chrome?
 
user6857832
In top right?
 
1:46 PM
yes
 
user6857832
Then It should work
 
well what do you know - resetting the settings has worked!
 
user6857832
Cool.
 
Use tor.
 
@Hemlata many thanks for your help btw
 
user6857832
1:47 PM
I had the same problem and when I installed it, It worked.
 
user6857832
@TheCoder Np.
 
Actually, tor is good and all, but it's hella slow.
 
because its node based. There are really very less relay nodes, and opposite is the number of users.
 
Well yeah, if you want privacy and goodness and all that good stuff then tor is a fabulous choice, but speed is the price to pay, and I'm fairly certain for most general purpose users surfing the net, that's not a good price.
If you want to surf not-to-be-named, then you'd have to use tor anyway
 
Tor network depends on people donating bandwidth to keep the network fast and healthy. That's the price.
 
1:50 PM
Exactly
 
you guys be up to lots of illegal stuff them yea?
 
should we all go to illegal sites then?
 
nope.
 
I don't get all this talk about if you surf the deep web then you're up to illegal stuff
 
1:52 PM
I just use it for .... ehh piracy...
 
firstly, the illegal part is the dark web
secondly, just because I can watch porn doesn't mean I will, what if I don't want to get addicted?
 
right. don't go in there, its too dark.
It is also a amazingly good source of hidden knowledge.
 
what if I'm a person with morals and respect the society I live in? :) (I really don't but you get the point)
also, tor isn't illegal, using tor for dishonest purposes is illegal
you don't even need tor to commit cyber crime, anyway
 
user6857832
Lol who goes to illegal websites?
 
As if anyone would admit it.
 
user6857832
2:01 PM
I never been to illegal website lol, cuz there is no reason to go haha
 
user6857832
I only go to hershey chocolate websites lmao
 
@rupinderjeet lol did you completed the app?
 
user6857832
I didn't get "BOOKS.put(name, newBook);"? Why are we adding two books? Shouldn't we add here a student name and a book name? @Unihedron
 
@Hemlata what does put in HashMap do?
 
user6857832
Like key and values?
 
2:14 PM
incorrect answer buzzer
 
user6857832
Lol
 
user6857832
Can ya please explain me?
 
considering that you've "already learned all the basics", you should already know this
 
user6857832
Thanks lol
 
No, CF not yet. Until, I test a lot devices.
I need to be sure
 
user6857832
2:17 PM
@Unihedron Um, it's not basics.
 
@rupinderjeet i see how many devices you are testing on?
also lol release the app already
 
@Hemlata Um, considering that Wiktionary defines basics as "an elementary building block", it is.
 
CF, should I remove ViewPager, because I can wrap everything in two activities. Camera and Settings, I feel like ViewPager is useless.
 
user6857832
@Unihedron Um, maybe..
 
Tested almost all major Samsung. Nexus.
 
2:19 PM
honestly the UI is confusing
maybe 2 activities will work
 
Is it heavy too? for low-end phones.
 
what feedback other testers gave?
 
> Note5, Note7, S6, S7 Edge, Galaxy Tab S2 (Both sizes). Google Pixel, OnePlus 1, OnePlus 2, OnePlus 3 (Both versions). Samsung Galaxy Tab 2. Galaxy Tab Pro

I tested on them
 
wow that is a lot i test on only 1 device
before publishing
 
Some get black pictures, Some can take only one image(then need to restart the device to take another)
I found a guy with that many devices.
 
2:21 PM
yeah camera has quite a ton of issues
PITA on android
 
So, can you recommend an example theme for those two activities. I am out of good-looking ideas.
 
use material ......
 
I can't test it on 4.1.2 :(
 
why??
why are you even supporting 4.1 :/
 
2:27 PM
it is not supported, material is only for 5+ devices.
are we talking about ripple effects?
 
ofcourse not
 
4.1 is 97% of market?
if i dont support it, i cant develop anymore :D i have only 4.1.2 galaxy s2 with me.
 
Morning, Java!
 
morning.
 
Hey @rupinderjeet
 
2:37 PM
hi
I got a general question which goes a little to the android section
 
post it on the main site.
 
you mean with main the general question site?
Well it is basically this: how do I import this library github.com/fyhertz/libstreaming into a fresh projec
 
> If you are willing to integrate this project into a close source application, please contact me at fyhertz at gmail.com
 
@rupinderjeet do you mean me?
 
just read the ending of that page.
 
2:42 PM
ah ok I get it
 
its GPL Licensed
 
what means GP licensed?
GPL*
 
use google.
 
user6857832
2:59 PM
@Unihedron I read it.
 
user6857832
But I still didn't get BOOKS.put(name, newBook);?
 
user6857832
@ItachiUchiha can ya please tell me?
 
user6857832
cuz they both are same book name.
 
@Hemlata can you link the code?
If BOOKS is a HashMap, .put(key, value) is used to store data in HashMap. Later, you can get this data using .get(key). Here, 'bookName' is key and 'newBook' is some kind of object being stored as value.
 
user6857832
@rupinderjeet Sure.
 
user6857832
3:12 PM
public class Book {

private final String bookName;
private List<Student> issuedTo;

private static final HashMap<String, Book> BOOKS = new HashMap<>();

private Book(String bookName) {
this.bookName = bookName;
}

/** @returns A book of the name - if it does not yet exist, it will be made */
public static Book of(String name) {
if (exists(name))
return BOOKS.get(hasBook);
Book newBook = new Book(name);
BOOKS.put(name, newBook);
return newBook;
}

/** @returns Whether such a book exists */
public static boolean exists(String name) {
 
book has books?
 
Hi, maybe someone know how I could get specific cell from JavaFX tableView?
 
nope no idea
 
@Hemlata Please don't post unformatted code or longer code snippets in the chat. Use a pastebin.
(or other pastie service)
 
user6857832
@Gemtastic Um, sorry.
 
3:17 PM
@Hemlata put(K key, V value) creates a pairing where value (type V) is stored and can be accessed by key (type K).
 
/** @returns A book of the name - if it does not yet exist, it will be made */
public static Book of(String name) {

// use brackets here - for readability
if (exists(name)) {
return BOOKS.get(hasBook);
}

// create new book with this name
Book newBook = new Book(name);

// add it to HashMap, name is the key and newBook is the instance object of this book
BOOKS.put(name, newBook);

// return a book of that name
return newBook;
}
 
user6857832
Yea, but why we have like BOOKS.put("English", "English")?
 
@Hemlata
 
user6857832
Cuz they both are storing the same book
 
No, you have BOOKS.put("English", new Book("English"))
 
3:20 PM
second parameter is the instance object of "English" book. So that you can call other methods of Book on it, later. Like BOOKS.get("English").issueBook();
 
user6857832
@Unihedron But shouldn't be like Some book number instead of "English" and then new Book("English")
 
@Hemlata The map is <String, Book>, it doesn't use a number as the key.
 
for that, change to HashMap<Integer, Book>
 
user6857832
@Unihedron Yea, I know, but that's kinda confusing that you've same key and value.
 
user6857832
@rupinderjeet Yea
 
3:22 PM
You might need:
Book(int bookId, String bookName) {}
 
@Hemlata The key is a string - the name - and the value is the Book instance.
 
user6857832
Yea
 
This is so if the book by the name exists, we will have it and can get it and reuse that instead of making a new one.
"English" is the retrieving key, Book { bookName == "English" } is what we want
and a hashmap is one way to store them
 
user6857832
Um yea, I got it sorta.
 
user6857832
So, it's workin like first it will check if that book exists and if it does It'll simply return it, but if it doesn't then it will add to the list, right?
 
3:28 PM
It will create a Book, and then:
1. Assign it to the map so we have it
2. Return the same book that we put in the map
So when you do Book.of("the same name") again it's the same thing
 
just here for a few seconds. I don't like the Book model since it's not the responsibility of the book to keep a tag on who has issued the book. Neither is it the responsibility of a Book to issue itself to a Student. These are the responsibility of some other class. May be a library.
Ok bye.
 
user6857832
Well I will start all over.
 
you should
I'm only demonstrating how a model that works by itself should look, not that a model that works all by itself is a good idea
 
@ItachiUchiha TRUE
 
@ItachiUchiha agree with those notes. And for issuing, Library better consist of Exemplars of Books.
 
3:34 PM
abstraction = encapsulation = works more intuitively = good
 
OakBot Online.
 
Hello, allmighty @OakBot. /javadoc java.util.Map#put
 
@unserializable Type /help to see all my commands.
 
/javadoc java.util.Map#put
 
@unserializable Object put(Object key, Object value): Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)
 
3:39 PM
@OakBot thanks, you could have said it earlier though, instead of buggering me with /help offers :)
 
@unserializable Type /help to see all my commands.
 
user6857832
Should I create Student class with just student name and Book class with a list of books?
 
user6857832
@unserializable Can ya tell me what field should I have in student class and book class?
 
@Hemlata Frankly, if the end goal is to do the Library emulation, I think you should design Libary model now.
 
user6857832
@unserializable Nah, I wanna create all classes again.
 
3:45 PM
@Hemlata So create the Library (not again, but for the first time) and think how Books, Students (and any other concepts that crop up) relate to it.
 
Think it as in real, Library contains Books. Books contain book properties. Students borrow Books from Library.
 
Basically Library is "the HashMap" except instead of using the implementations of a HashMap it uses the implementations of librarians in the library.
 
user6857832
Um, ok. Thanks!
 
user6857832
 
user6857832
Do anyone thinks I need to add somethin more in my code?
 
user6857832
@Unihedron @unserializable
 
@unserializable I'm using PHP to synchronize Java I/O because the server it was originally getting data from doesn't like the same IP address accessing it too often, therefore when you have multiple devices with the same external IP address, not all machines running the Java program will be able to access the data they need. So I'm essentially using a web server wIth PHP as a central data I/O device to avoid flooding the main data server with requests.
 
@JonahSloan aha, a scheduling proxy in PHP for "managing Java IO". It still sounds quite insane, but as long as it works, why not :D
@Hemlata Book name is inaccessible after creation w/ current design. Book#isBorrowed() is 3 lines too much. Book#borrowed() does not belong in the Book object really.
 
user6857832
I added getter for book name
 
user6857832
4:11 PM
Then how should I make it shorted (Book#isBorrowed)?
 
Maybe I'm just insane
 
@Hemlata also, please use some code specific pastesite that does some syntax highlghting and does not have horrific in-page scrollbars.
@Hemlata e.g gist.github.com (allows commenting on code).
@Hemlata or paste.ofcode.org (removes the code in one week, so nobody can look at it later).
 
user6857832
Um, ok. I'll use it.
 
user6857832
Book#borrowed is so I can know if someone borrowed it or not.
 
user6857832
@unserializable
 
user6857832
Now I have getter for book as well.
 
@Hemlata boolean shortening expression was already pointed out repeatedly today, by @rupinderjeet
 
user6857832
public boolean isBorrowed() {
if (borrowed) return true;
return false;
}
 
user6857832
Like this?
 
@Hemlata one line too much
 
user6857832
4:15 PM
@unserializable Can it be more shorter ya mean?
 
@Hemlata Can't you do return borrowed; ?
 
user6857832
@JonahSloan Oh, yea that's better.
 
user6857832
Now what should I add in my library class?
 
user6857832
Like how should I make it borrow books and make a list where which student borrowed which book?
 
user6857832
Can anyone please tell me?
 
user6857832
4:24 PM
@MadaraUchiha Can ya tell me please?
 
Busy at work, try later
 
user6857832
Um, ok.
 
4:39 PM
You can have another HashMap of issuedBooks, remove the book from Library Books HashMap, and add it to BorrowedBooks HashMap. Just an idea.
 
4:50 PM
anyone here that knows jUnit well? I need to ask something about it.
 
user6857832
@ItachiUchiha
 
user6857832
Have a look at it, It's still not workin tho, but let me know if I'm using atleast concept right or not.@ItachiUchiha
 
user6857832
Plus what am I doing wrong in my code? @ItachiUchiha
 
user6857832
@unserializable Can ya also have a look at my code?
 
On line 61, you will have a NullPointerException, because private Student student; is not initialized.
@Hemlata
Similar with book object.
 
5:53 PM
@Hemlata you are trying to let Library loan out Books that it does not actually have (new Book()) and then return the same new Book, instead of borrowing from the Books that Library actually has.
 
6:22 PM
@ItachiUchiha hey o/
 
6:34 PM
Hi!
Finally home :)
 
7:03 PM
@Carlton ask
 
so what goes on in these chat rooms?
 
7:44 PM
@Ryan Anything you want it to be
 
8:00 PM
@ItachiUchiha nice
 
is there Someone here?
 
Do you know about JDBC and prepared statement?
and that stuff?
 
does mac have a shortcut to open mac mail and send an email,? something like Alfred
 
mmm, no idea
 
8:20 PM
anyone know any good rss feed apps for mac?
 
8:31 PM
I want to collate a group pf tech blogs that i will read their latest posting in the morning - is there a handy way to do this so that i can see if they have updated their blog? do RSS feeds do this?
 
 
3 hours later…
11:41 PM
@ItachiUchiha Do you really need 41 repositories on GitHub?
 

« first day (2276 days earlier)      last day (2672 days later) »