• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:11
CET 14:11
KST 22:11
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Behind the Blue - Team Liquid History Book15Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8herO wins SC2 All-Star Invitational14
Community News
ACS replaced by "ASL Season Open" - Starts 21/0218LiuLi Cup: 2025 Grand Finals (Feb 10-16)23Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker10PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)13
StarCraft 2
General
How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker Terran Scanner Sweep Behind the Blue - Team Liquid History Book Weekly Cups (Jan 12-18): herO, MaxPax, Solar win
Tourneys
RSL Season 4 announced for March-April LiuLi Cup: 2025 Grand Finals (Feb 10-16) PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) RSL Revival: Season 4 Korea Qualifier (Feb 14) Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth Mutation # 510 Safety Violation
Brood War
General
Which units you wish saw more use in the game? StarCraft player reflex TE scores [ASL21] Potential Map Candidates Gypsy to Korea ACS replaced by "ASL Season Open" - Starts 21/02
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Fighting Spirit mining rates Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta
Other Games
General Games
Path of Exile Diablo 2 thread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Ask and answer stupid questions here! European Politico-economics QA Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ADHD And Gaming Addiction…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1905 users

The Big Programming Thread - Page 761

Forum Index > General Forum
Post a Reply
Prev 1 759 760 761 762 763 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
teamamerica
Profile Blog Joined July 2010
United States958 Posts
Last Edited: 2016-09-10 10:53:40
September 10 2016 10:02 GMT
#15201
edit: I suck at posting
On September 10 2016 08:42 Manit0u wrote:
Show nested quote +
On September 10 2016 01:37 phar wrote:
Yea this is likely not the important part of the error message. (In fact if you run with sudo the bit about a file not found may go away depending on your setup).


Please give me some credit...

1. I've tried running it with sudo (same result).
2. I've read somewhere on the interwebz that it might be the result of someone using their libraries and paths to compile the code which breaks on my machine. I've created a new C file with a single assert that's failing, compiled it and dbg'd it, the result is the same.
3. I've installed a ton of additional libraries I don't need but might be used by it (libc6-dev etc.), same thing.
4. People on the interwebz keep saying that you should ignore this error but it's driving me mad.

I did stuff like whreis file.c, which returned a manual but not the file. I've found the file eventually but under completely different path (somewhere inside /usr/share/).

I don't even know what provides this specific file and there's no info about it on the net. Please help. My perfectionist soul is dying here because I don't know if valgrind/dbg stop because of this error or errors in the application...

Edit: So far it seems to only show up on uncaught throws and asserts. Need to do more testing but I'm too drunk atm.


Browsing the internet watching GSL - you can get rid of error by putting that file in the path relative to the executable you're running as a quick fix if you rly care (but shouldn't matter tbh).

Real fix is you probably need to recompile whatever is calling it.

based off http://stackoverflow.com/questions/13152775/debugging-c-nptl-sysdeps-unix-sysv-linux-raise-c-no-such-file-or-directo and my testing just run (which is how I'm confident putting the file at relative path will get rid of error at least)


edit: looked into this a bit more since gsl finals sucked and it seems to be something about glibc. keep in mind i literally have written no c++ code ever but glibc abort.c includes signal, signal defines "raise" as an extern function, and has both a raise.c in a few places, including https://github.com/lattera/glibc/blob/master/nptl/sysdeps/unix/sysv/linux/raise.c. I'm not sure how extern is resolved by compiler but I'd assume that when it was compiled it resolved that^^ raise.c, even though it seems the glibc on ubuntu I downloaded from https://launchpad.net/glibc doesn't have the sysdeps under nptl.
RIP GOMTV. RIP PROLEAGUE.
gswittiness
Profile Joined September 2016
4 Posts
September 10 2016 10:47 GMT
#15202
When I skim through the discussions and whatnot I feel like an absolute noob, which I am haha. Started my first year through evening classes for a graduate degree in IT (choose to take the programming road and not networks) after working like an animal in something I really don't see myself doing for another 5 years, going through C# first, are there any websites (like hackerrank for example) where you can practice your C# skills? For exampe being presented with a problem and trying to find the solution and whatnot?
Ktk
Profile Blog Joined May 2010
Korea (South)753 Posts
September 10 2016 11:17 GMT
#15203
On September 10 2016 19:47 gswittiness wrote:
When I skim through the discussions and whatnot I feel like an absolute noob, which I am haha. Started my first year through evening classes for a graduate degree in IT (choose to take the programming road and not networks) after working like an animal in something I really don't see myself doing for another 5 years, going through C# first, are there any websites (like hackerrank for example) where you can practice your C# skills? For exampe being presented with a problem and trying to find the solution and whatnot?


Do the problems have to mention C#?

What do you plan on doing with C#?

but here are some mathy problems: https://projecteuler.net/
and bioinformatics problems: http://rosalind.info/problems/locations/

probably not very useful for you though, practically speaking :p
gswittiness
Profile Joined September 2016
4 Posts
September 10 2016 11:21 GMT
#15204
On September 10 2016 20:17 Ktk wrote:
Show nested quote +
On September 10 2016 19:47 gswittiness wrote:
When I skim through the discussions and whatnot I feel like an absolute noob, which I am haha. Started my first year through evening classes for a graduate degree in IT (choose to take the programming road and not networks) after working like an animal in something I really don't see myself doing for another 5 years, going through C# first, are there any websites (like hackerrank for example) where you can practice your C# skills? For exampe being presented with a problem and trying to find the solution and whatnot?


Do the problems have to mention C#?

What do you plan on doing with C#?

but here are some mathy problems: https://projecteuler.net/
and bioinformatics problems: http://rosalind.info/problems/locations/

probably not very useful for you though, practically speaking :p


Well, our prof told us we'd be focusing on C# only (at least this semester) so right now that's also the only thing I want to focus on instead of getting ahead of myself by including other languages, one step at a time. Anything that can be helpful to learn and improve my C# knowledge is basically what I'm looking for.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
September 10 2016 11:30 GMT
#15205
--- Nuked ---
Acrofales
Profile Joined August 2010
Spain18215 Posts
September 10 2016 11:53 GMT
#15206
On September 10 2016 20:21 gswittiness wrote:
Show nested quote +
On September 10 2016 20:17 Ktk wrote:
On September 10 2016 19:47 gswittiness wrote:
When I skim through the discussions and whatnot I feel like an absolute noob, which I am haha. Started my first year through evening classes for a graduate degree in IT (choose to take the programming road and not networks) after working like an animal in something I really don't see myself doing for another 5 years, going through C# first, are there any websites (like hackerrank for example) where you can practice your C# skills? For exampe being presented with a problem and trying to find the solution and whatnot?


Do the problems have to mention C#?

What do you plan on doing with C#?

but here are some mathy problems: https://projecteuler.net/
and bioinformatics problems: http://rosalind.info/problems/locations/

probably not very useful for you though, practically speaking :p


Well, our prof told us we'd be focusing on C# only (at least this semester) so right now that's also the only thing I want to focus on instead of getting ahead of myself by including other languages, one step at a time. Anything that can be helpful to learn and improve my C# knowledge is basically what I'm looking for.


Simply using it is one of the best ways to improve. Stackoverflow has a nice list of sites and forums that give hundreds of programming problems and puzzles. Some are specific for a language, but plenty are just open puzzles. Pick one that interests you and solve using C#.

http://programmers.stackexchange.com/questions/756/where-can-i-find-programming-puzzles-and-challenges
Wrath
Profile Blog Joined July 2014
3174 Posts
September 10 2016 13:59 GMT
#15207
Call me a retard but is it normal to waste full day on setting up eclipse with Symfony and run the code against apache httpd server and still not working?
Hhanh00
Profile Joined May 2016
34 Posts
Last Edited: 2016-09-10 15:08:00
September 10 2016 15:00 GMT
#15208
On September 10 2016 18:58 Manit0u wrote:
Show nested quote +
On September 10 2016 17:55 Hhanh00 wrote:
Your question is about the 'No such file or directory.' or about the reason of the abort?


No such file or directory.


The compiler leaves debugging info (unless you strip them) that relates offsets in the binary code to lines in the source code.
gdb breaks when your app raises SIGABRT (maybe because of an assert?). It tries to decode the stack by looking up return addresses. It found that the closest line is line 56 of raise.c but can't find the actual file on your system. By the way, that line is

int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig);

which shows that we are about to go to the kernel which makes sense since we are raising a signal after all.

If you want to get rid of the message, you can download the source code of glibc and specify its location in .gdbinit
https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html

Obviously, you can also simply ignore it.

Edit: You don't have the file because it is a file from the glibc that was compiled by someone else. gdb doesn't care about what code belongs to who. Your code is treated the same way as any user code - including the C runtime.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-09-10 21:56:24
September 10 2016 21:55 GMT
#15209
Sensing I needed to review and make sure I understand java basics I wrote a pointless program. I wanted to check that I knew how to write things like equals, toString, getters/setters, constructors, and use inheritance correctly.

If anyone has free time could they look at my code and make sure I am not doing anything naughty?
Also I have 3 questions about the code (one in particular is important)


animal class
+ Show Spoiler +

package life;

public class animal {

private String type;
private int age;
private String size;

public animal(){
this.type = "unknown";
this.age = 0;
this.size = "unknown";
}

public animal(int a, String t, String s){
this.age = a;
this.type = t;
this.size = s;
}

public animal(animal oldAnimal){
this.age = oldAnimal.age;
this.type = oldAnimal.type;
this.size = oldAnimal.size;
}




public String toString(){
return ("This is a " + this.type + ", it is " + this.age + " years old, and it is " + this.size);
}


public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof animal)){
return false;
}

animal a = (animal) other;
return this.toString() == a.toString();
}


public void move(){
System.out.println(this.type + " moved");
}

public void eat(String f){
System.out.println(this.type + " ate " + f);
}











public void setType(String t){
this.type = t;
}

public void setAge(int a){
this.age = a;
}

public void setSize(String s){
this.size = s;
}

public String getType(){
return this.type;
}

public int getAge(){
return this.age;
}

public String getSize(){
return this.size;
}


}




Human Class
+ Show Spoiler +

package life;

public class human extends animal {

private String name;

public human(){
super();
this.name = "unnamed";
}

public human(String n, String t, String s, int a){
super(a, t, s);
this.name = n;
}

public human(human oldHuman){
super(oldHuman);
this.name = oldHuman.name;
}

public String toString(){
return (super.toString() + " and it's name is " + this.name);
}

public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof human)){
return false;
}

human h = (human) other;

return this.toString() == h.toString();
}






public void complain(String c){
System.out.println(this.name + " complains about " + c);
}

public void setName(String n){
this.name = n;
}

public String getName(){
return this.name;
}

}



"engine"
+ Show Spoiler +

package life;

import java.util.ArrayList;
import java.util.Iterator;

public class life {

public static void main(String[] args) {

ArrayList<human> humanList = new ArrayList<human>();

humanList.add(new human());
humanList.add(new human("Tim", "mammal", "medium", 25));
humanList.add(new human("Burt", "mammal", "huge", 43));
humanList.add(new human(humanList.get(1)));

Iterator<human> iterate = humanList.iterator();

while(iterate.hasNext()){
human thisHuman = iterate.next();
System.out.println(thisHuman.getName());
}

for(human h : humanList){
System.out.println(h.toString());
}

System.out.println(humanList.get(0).equals(humanList.get(1)));

System.out.println(humanList.get(1).equals(humanList.get(3)));


}

}



my questions
+ Show Spoiler +

1.) my equals method is based on what I was taught in lecture. my question is, what is the point of casting the object type when I am already checking if it is an instance of that object type?

in the specific example in lecture the professor does call an equals method within the equals method - he uses super.equals(other), but even with that example I don't understand why the casting is necessary.


2.) when I call super(oldHuman) in my constructor - what sorcery is this. it seems like magic. is this one of those things that java can "just do" ?



3.) System.out.println(humanList.get(1).equals(humanList.get(3))); is returning false. why? shouldn't this return true?




thank you to any kind souls who help me out
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2016-09-10 21:58:06
September 10 2016 21:57 GMT
#15210
On September 10 2016 22:59 Wrath wrote:
Call me a retard but is it normal to waste full day on setting up eclipse with Symfony and run the code against apache httpd server and still not working?


After 2 years of work experience, I think one could spend hours/days on stupid things which, once you figure out, could be simple. For example, I've spent about 3 work days trying to debug an application hosted by IIS. I couldn't figure out what the problem was when I was debugging from Visual Studio. It was happening, at least quickly, when there was no debugging/attaching to process involved and when there were a lot of requests in a short time. Anyway, solution was just to use 'using' block. What a stupid problem to have! :D
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2016-09-10 22:46:32
September 10 2016 22:16 GMT
#15211
On September 11 2016 06:55 travis wrote:
Sensing I needed to review and make sure I understand java basics I wrote a pointless program. I wanted to check that I knew how to write things like equals, toString, getters/setters, constructors, and use inheritance correctly.

If anyone has free time could they look at my code and make sure I am not doing anything naughty?
Also I have 3 questions about the code (one in particular is important)


animal class
+ Show Spoiler +

package life;

public class animal {

private String type;
private int age;
private String size;

public animal(){
this.type = "unknown";
this.age = 0;
this.size = "unknown";
}

public animal(int a, String t, String s){
this.age = a;
this.type = t;
this.size = s;
}

public animal(animal oldAnimal){
this.age = oldAnimal.age;
this.type = oldAnimal.type;
this.size = oldAnimal.size;
}




public String toString(){
return ("This is a " + this.type + ", it is " + this.age + " years old, and it is " + this.size);
}


public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof animal)){
return false;
}

animal a = (animal) other;
return this.toString() == a.toString();
}


public void move(){
System.out.println(this.type + " moved");
}

public void eat(String f){
System.out.println(this.type + " ate " + f);
}











public void setType(String t){
this.type = t;
}

public void setAge(int a){
this.age = a;
}

public void setSize(String s){
this.size = s;
}

public String getType(){
return this.type;
}

public int getAge(){
return this.age;
}

public String getSize(){
return this.size;
}


}




Human Class
+ Show Spoiler +

package life;

public class human extends animal {

private String name;

public human(){
super();
this.name = "unnamed";
}

public human(String n, String t, String s, int a){
super(a, t, s);
this.name = n;
}

public human(human oldHuman){
super(oldHuman);
this.name = oldHuman.name;
}

public String toString(){
return (super.toString() + " and it's name is " + this.name);
}

public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof human)){
return false;
}

human h = (human) other;

return this.toString() == h.toString();
}






public void complain(String c){
System.out.println(this.name + " complains about " + c);
}

public void setName(String n){
this.name = n;
}

public String getName(){
return this.name;
}

}



"engine"
+ Show Spoiler +

package life;

import java.util.ArrayList;
import java.util.Iterator;

public class life {

public static void main(String[] args) {

ArrayList<human> humanList = new ArrayList<human>();

humanList.add(new human());
humanList.add(new human("Tim", "mammal", "medium", 25));
humanList.add(new human("Burt", "mammal", "huge", 43));
humanList.add(new human(humanList.get(1)));

Iterator<human> iterate = humanList.iterator();

while(iterate.hasNext()){
human thisHuman = iterate.next();
System.out.println(thisHuman.getName());
}

for(human h : humanList){
System.out.println(h.toString());
}

System.out.println(humanList.get(0).equals(humanList.get(1)));

System.out.println(humanList.get(1).equals(humanList.get(3)));


}

}



my questions
+ Show Spoiler +

1.) my equals method is based on what I was taught in lecture. my question is, what is the point of casting the object type when I am already checking if it is an instance of that object type?

in the specific example in lecture the professor does call an equals method within the equals method - he uses super.equals(other), but even with that example I don't understand why the casting is necessary.


2.) when I call super(oldHuman) in my constructor - what sorcery is this. it seems like magic. is this one of those things that java can "just do" ?



3.) System.out.println(humanList.get(1).equals(humanList.get(3))); is returning false. why? shouldn't this return true?




thank you to any kind souls who help me out


1. It's standard practice to do an instanceof on a type before you cast it. In this specific case, you're checking if it isn't an instance of Human because if it's not an instanceof Human then it can't be equal. The way you're comparing the objects seems strange though. You should be ensuring that the fields have the same values rather than checking their toString output even though these technically produce the same thing.

2. This is a copy constructor. I'll just let you google java copy constructor and read about it.

Conventions wise; are all your class names lower case? Class names should be uppercase.
I'll always be your shadow and veil your eyes from states of ain soph aur.
ShAsTa
Profile Joined November 2002
Belgium2841 Posts
Last Edited: 2016-09-10 22:22:05
September 10 2016 22:17 GMT
#15212
On September 11 2016 06:55 travis wrote:
Sensing I needed to review and make sure I understand java basics I wrote a pointless program. I wanted to check that I knew how to write things like equals, toString, getters/setters, constructors, and use inheritance correctly.

If anyone has free time could they look at my code and make sure I am not doing anything naughty?
Also I have 3 questions about the code (one in particular is important)


animal class
+ Show Spoiler +

package life;

public class animal {

private String type;
private int age;
private String size;

public animal(){
this.type = "unknown";
this.age = 0;
this.size = "unknown";
}

public animal(int a, String t, String s){
this.age = a;
this.type = t;
this.size = s;
}

public animal(animal oldAnimal){
this.age = oldAnimal.age;
this.type = oldAnimal.type;
this.size = oldAnimal.size;
}




public String toString(){
return ("This is a " + this.type + ", it is " + this.age + " years old, and it is " + this.size);
}


public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof animal)){
return false;
}

animal a = (animal) other;
return this.toString() == a.toString();
}


public void move(){
System.out.println(this.type + " moved");
}

public void eat(String f){
System.out.println(this.type + " ate " + f);
}











public void setType(String t){
this.type = t;
}

public void setAge(int a){
this.age = a;
}

public void setSize(String s){
this.size = s;
}

public String getType(){
return this.type;
}

public int getAge(){
return this.age;
}

public String getSize(){
return this.size;
}


}




Human Class
+ Show Spoiler +

package life;

public class human extends animal {

private String name;

public human(){
super();
this.name = "unnamed";
}

public human(String n, String t, String s, int a){
super(a, t, s);
this.name = n;
}

public human(human oldHuman){
super(oldHuman);
this.name = oldHuman.name;
}

public String toString(){
return (super.toString() + " and it's name is " + this.name);
}

public boolean equals(Object other){
if(this == other){
return true;
}
if(!(other instanceof human)){
return false;
}

human h = (human) other;

return this.toString() == h.toString();
}






public void complain(String c){
System.out.println(this.name + " complains about " + c);
}

public void setName(String n){
this.name = n;
}

public String getName(){
return this.name;
}

}



"engine"
+ Show Spoiler +

package life;

import java.util.ArrayList;
import java.util.Iterator;

public class life {

public static void main(String[] args) {

ArrayList<human> humanList = new ArrayList<human>();

humanList.add(new human());
humanList.add(new human("Tim", "mammal", "medium", 25));
humanList.add(new human("Burt", "mammal", "huge", 43));
humanList.add(new human(humanList.get(1)));

Iterator<human> iterate = humanList.iterator();

while(iterate.hasNext()){
human thisHuman = iterate.next();
System.out.println(thisHuman.getName());
}

for(human h : humanList){
System.out.println(h.toString());
}

System.out.println(humanList.get(0).equals(humanList.get(1)));

System.out.println(humanList.get(1).equals(humanList.get(3)));


}

}



my questions
+ Show Spoiler +

1.) my equals method is based on what I was taught in lecture. my question is, what is the point of casting the object type when I am already checking if it is an instance of that object type?

in the specific example in lecture the professor does call an equals method within the equals method - he uses super.equals(other), but even with that example I don't understand why the casting is necessary.


2.) when I call super(oldHuman) in my constructor - what sorcery is this. it seems like magic. is this one of those things that java can "just do" ?



3.) System.out.println(humanList.get(1).equals(humanList.get(3))); is returning false. why? shouldn't this return true?




thank you to any kind souls who help me out


I advise you to test for equals using the attributes themselves and not the toString. Also you need to call equals on the toString result because now you're testing for reference equality (which will fail) and not the kind of equals you want. That's probably the reason for 3)
Most IDEs can generate the equals (and hashCode) for you. Btw, if you define your own equals you should also define a hashCode method that's compatible.
If we hit that bull's eye, the rest of the dominoes will fall like a house of cards. Checkmate.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
September 10 2016 23:21 GMT
#15213
ah thanks guys

okay so class names capitalized, got it

shasta, you are correct about the problem with my equals method and your explanation makes sense. Don't know what a hashCode method is but I guess that's something new to learn
Manit0u
Profile Blog Joined August 2004
Poland17660 Posts
Last Edited: 2016-09-11 02:15:01
September 11 2016 02:11 GMT
#15214
On September 10 2016 22:59 Wrath wrote:
Call me a retard but is it normal to waste full day on setting up eclipse with Symfony and run the code against apache httpd server and still not working?


First of all, if you're developing with Symfony you don't even need Apache. Symfony has its own built-in server for development purposes if you need one.

You can of course still use Apache, Nginx or whatever else you need (for Apache note that Symfony doesn't use .htaccess and you must have proper Require All Granted etc. set in your host settings, you can look those up in the Symfony docs).

Second thing is the fact that you should not use Eclipse for that. NetBeans would be better but still shitty. Just for learning you could be using PhpStorm (with super duper mega excellent symfony plugin) in its 30-day free trial (or endless trial if you're a student). Trust me, it's miles apart from any freeware solution. I can't even look at Eclipse or NetBeans after using jetbrains products...
Time is precious. Waste it wisely.
Hhanh00
Profile Joined May 2016
34 Posts
Last Edited: 2016-09-11 03:21:58
September 11 2016 03:09 GMT
#15215
The amount of boilerplate code required to implement a trivial struct in Java is sad.

+ Show Spoiler +


public class Animal {
private String type;
private int age;
private String size;

public Animal(String type, int age, String size) {
this.type = type;
this.age = age;
this.size = size;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getSize() {
return size;
}

public void setSize(String size) {
this.size = size;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

Animal animal = (Animal) o;

if (age != animal.age) return false;
if (type != null ? !type.equals(animal.type) : animal.type != null) return false;
return size != null ? size.equals(animal.size) : animal.size == null;
}

@Override
public int hashCode() {
int result = type != null ? type.hashCode() : 0;
result = 31 * result + age;
result = 31 * result + (size != null ? size.hashCode() : 0);
return result;
}

@Override
public String toString() {
return "Animal{" +
"type='" + type + '\'' +
", age=" + age +
", size='" + size + '\'' +
'}';
}
}



Fortunately some IDEs can generate this for you but it's still a hassle when you don't have one or you want to update the class definition later.

It's also so easy to forget about checking for null values and forgetting about hashCode() when you implement equals.

Compare this to scala:


case class Animal(tpe: String, age: Int, size: String)


A single line is all it takes.

In case you are stuck with Java, you may want to take a look at Project Lombok that uses AOP to inject the boiler plate.

The java code becomes

@Data
public class Animal {
private String type;
private int age;
private String size;
}


and ends up being the same bytecode.

PS: To the @OP, in additional to what other people told you, the main issue in your code is that equals doesn't handle null values and will throw an exception.
Also, equals is supposed to return true only if both values have the same class so an animal cannot be equal to a human. With instanceof T you are checking if the right hand side is T or derived from T.
phar
Profile Joined August 2011
United States1080 Posts
September 11 2016 03:25 GMT
#15216
Ideally you never construct a new struct-like class yourself and just use some autogens like AutoValue.
Who after all is today speaking about the destruction of the Armenians?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
September 11 2016 04:21 GMT
#15217
Also you don't have to make getters and setters unless you need to control access. Just make the members public.
There is no one like you in the universe.
Wrath
Profile Blog Joined July 2014
3174 Posts
September 11 2016 05:44 GMT
#15218
On September 11 2016 11:11 Manit0u wrote:
Show nested quote +
On September 10 2016 22:59 Wrath wrote:
Call me a retard but is it normal to waste full day on setting up eclipse with Symfony and run the code against apache httpd server and still not working?


First of all, if you're developing with Symfony you don't even need Apache. Symfony has its own built-in server for development purposes if you need one.

You can of course still use Apache, Nginx or whatever else you need (for Apache note that Symfony doesn't use .htaccess and you must have proper Require All Granted etc. set in your host settings, you can look those up in the Symfony docs).

Second thing is the fact that you should not use Eclipse for that. NetBeans would be better but still shitty. Just for learning you could be using PhpStorm (with super duper mega excellent symfony plugin) in its 30-day free trial (or endless trial if you're a student). Trust me, it's miles apart from any freeware solution. I can't even look at Eclipse or NetBeans after using jetbrains products...


I'm not a student and I can't guarantee that the workplace will provide me a phpstorm. That is why I'm trying to get a free IDE...
teamamerica
Profile Blog Joined July 2010
United States958 Posts
September 11 2016 06:19 GMT
#15219
On September 11 2016 13:21 Blisse wrote:
Also you don't have to make getters and setters unless you need to control access. Just make the members public.


The downside is in Java is that if you wanna change it to a method you have to change every callsite. You can argue that in the case you're refactoring a public property into a method that's not a big deal, but other languages let $object.property be either a direct instance variable lookup or a method call.


On September 11 2016 14:44 Wrath wrote:
Show nested quote +
On September 11 2016 11:11 Manit0u wrote:
On September 10 2016 22:59 Wrath wrote:
Call me a retard but is it normal to waste full day on setting up eclipse with Symfony and run the code against apache httpd server and still not working?


First of all, if you're developing with Symfony you don't even need Apache. Symfony has its own built-in server for development purposes if you need one.

You can of course still use Apache, Nginx or whatever else you need (for Apache note that Symfony doesn't use .htaccess and you must have proper Require All Granted etc. set in your host settings, you can look those up in the Symfony docs).

Second thing is the fact that you should not use Eclipse for that. NetBeans would be better but still shitty. Just for learning you could be using PhpStorm (with super duper mega excellent symfony plugin) in its 30-day free trial (or endless trial if you're a student). Trust me, it's miles apart from any freeware solution. I can't even look at Eclipse or NetBeans after using jetbrains products...


I'm not a student and I can't guarantee that the workplace will provide me a phpstorm. That is why I'm trying to get a free IDE...


If for some reason work refuses to pay for it I'd really recommend just buying it yourself. Idk if you're not in US but if you are it's pretty cheap; I did that for my first job and I didn't regret it at all.
RIP GOMTV. RIP PROLEAGUE.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 11 2016 07:31 GMT
#15220
On September 11 2016 12:09 Hhanh00 wrote:
In case you are stuck with Java, you may want to take a look at Project Lombok that uses AOP to inject the boiler plate.

The java code becomes

@Data
public class Animal {
private String type;
private int age;
private String size;
}


and ends up being the same bytecode.

I've looked into AOP but never actually used it. You probably have some actual experience with it. I've always wondered how it affects debugging - you obviously can't step through single lines of code if you never write them. How's that working out for you?
If you have a good reason to disagree with the above, please tell me. Thank you.
Prev 1 759 760 761 762 763 1032 Next
Please log in or register to reply.
Live Events Refresh
uThermal 2v2 Circuit
12:00
Bonus Cup #3
uThermal306
Liquipedia
LiuLi Cup
11:00
2025 Grand Finals Playoffs
Clem vs MaruLIVE!
Rogue vs TriGGeR
ByuN vs Serral
RotterdaM1904
ComeBackTV 1686
PiGStarcraft581
IndyStarCraft 395
BRAT_OK 222
Rex163
3DClanTV 64
IntoTheiNu 28
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 1904
PiGStarcraft581
IndyStarCraft 395
uThermal 306
BRAT_OK 222
Rex 163
goblin 80
StarCraft: Brood War
Britney 45225
Barracks 6366
Jaedong 1502
Flash 1495
Hyuk 1047
Stork 535
Soma 509
firebathero 438
Light 385
Soulkey 257
[ Show more ]
Snow 249
Rush 183
Last 177
Leta 145
Pusan 113
Killer 64
Aegong 60
Sea.KH 58
sorry 40
Bonyth 40
Movie 40
Yoon 35
Hm[arnc] 35
Free 32
ToSsGirL 31
Sharp 29
soO 29
Terrorterran 24
yabsab 23
Shine 20
910 18
IntoTheRainbow 17
zelot 16
Shinee 16
JulyZerg 15
HiyA 15
ivOry 15
Calm 0
Dota 2
Gorgc2931
singsing2362
XcaliburYe163
febbydoto3
Counter-Strike
olofmeister3295
fl0m1980
byalli440
Super Smash Bros
Mew2King94
Heroes of the Storm
Khaldor254
Other Games
B2W.Neo1087
crisheroes455
KnowMe56
ArmadaUGS47
DeMusliM11
Organizations
Counter-Strike
PGL19931
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH118
• Adnapsc2 7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• FirePhoenix4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos3252
Upcoming Events
PSISTORM Gaming Misc
3h 44m
RSL Revival
4h 49m
AI Arena Tournament
6h 49m
Replay Cast
10h 49m
Sparkling Tuna Cup
20h 49m
LiuLi Cup
21h 49m
Ladder Legends
1d 4h
Replay Cast
1d 10h
Replay Cast
1d 19h
Wardi Open
1d 22h
[ Show More ]
Monday Night Weeklies
2 days
OSC
2 days
WardiTV Winter Champion…
2 days
Replay Cast
3 days
WardiTV Winter Champion…
3 days
Replay Cast
4 days
PiG Sty Festival
4 days
The PondCast
4 days
KCM Race Survival
4 days
WardiTV Winter Champion…
4 days
Replay Cast
5 days
PiG Sty Festival
5 days
Epic.LAN
5 days
Replay Cast
6 days
PiG Sty Festival
6 days
CranKy Ducklings
6 days
Epic.LAN
6 days
Liquipedia Results

Completed

Escore Tournament S1: W8
Rongyi Cup S3
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
LiuLi Cup: 2025 Grand Finals
Nations Cup 2026
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

Escore Tournament S1: King of Kings
[S:21] ASL SEASON OPEN 1st Round
[S:21] ASL SEASON OPEN 1st Round Qualifier
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
WardiTV Winter 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.