Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
baquerd
Jul 2, 2007

by FactsAreUseless

TRex EaterofCars posted:

Eclipse is a decent program bogged down by half implemented and bug ridden plugins, overly aggressive caching and a horrible UI.

Intellij is better for nearly every professional level development task.

IntelliJ has it's own caching problems, and SVN problems... Still better than Eclipse though.

Adbot
ADBOT LOVES YOU

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

baquerd posted:

IntelliJ has it's own caching problems, and SVN problems... Still better than Eclipse though.

I honestly stopped using svn back in like 2008 so I can't speak to that piece, and I haven't noticed caching issues. What do you notice with the caching?

Max Facetime
Apr 18, 2009

Eclipse's problems are mainly that as you move away from pure Java SE coding the quality of plugins starts to drop, which shows up as bad integration, blocking the UI or plain errors.

And then all the useless buttons in the UI. Let me just illustrate:



I've highlighted all buttons that are used frequently, provide access to something good or are otherwise important.

The ones marked with blue take care of most of things you'd fire up your old text editor for.

The one marked with red is the most important button of them all. You'll never even use it, but once you start getting comfortable with keyboard shortcuts and refactorings like inlining, knowing what that button is and does is going to save you 30 minutes of getting angry wondering why your Eclipse just broke.

baquerd
Jul 2, 2007

by FactsAreUseless

TRex EaterofCars posted:

I honestly stopped using svn back in like 2008 so I can't speak to that piece, and I haven't noticed caching issues. What do you notice with the caching?

Specifically with tomcat instances, I've seen a server apparently restarted with a fresh build not pick up changes until I did a full clean and build.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

I am in posted:

The one marked with red

Oh god thanks for that.

Sedro
Dec 31, 2008
Crappy plugins drove me away from eclipse.


In eclipse the build process was:
1. Make change
2. Maven build
3. Refresh all projects
4. Clean all projects
5. Clean maven
6. Clean web app
7. Clean TomCat working directory
8. Some other "clean" options I forgot?
9. Start server
10. Server didn't start? goto 2
11. Server started but I can't see the change at runtime? goto 2

After switching to netbeans:
1. Make change
2. Build and run

They made the assumption that no third-party tool (including their own plugins) will ever modify the workspace. Since that's obviously not true, they added a million "clean" options to compensate.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

baquerd posted:

Specifically with tomcat instances, I've seen a server apparently restarted with a fresh build not pick up changes until I did a full clean and build.

Ah yeah, I never run app servers in IDE's any more for that exact reason. I just do jpda and connect remotely cause it's just less headaches imo.

ComptimusPrime
Jan 23, 2006
Computer Transformer

Sedro posted:

Crappy plugins drove me away from eclipse.


In eclipse the build process was:
1. Make change
2. Maven build
3. Refresh all projects
4. Clean all projects
5. Clean maven
6. Clean web app
7. Clean TomCat working directory
8. Some other "clean" options I forgot?
9. Start server
10. Server didn't start? goto 2
11. Server started but I can't see the change at runtime? goto 2

After switching to netbeans:
1. Make change
2. Build and run

They made the assumption that no third-party tool (including their own plugins) will ever modify the workspace. Since that's obviously not true, they added a million "clean" options to compensate.

Process for merging conflicts with Git and Netbeans:

Close Netbeans.
Start merge process.
Merge all conflicts.
Add/commit changes.
Finish pull.
Open Netbeans.
Netbeans now thinks you have duplicate class files.
Bang head against wall until finding Netbeans hidden cache folder.
Delete cache folder.

Repeat process for every merge until you remember Netbeans cache folder.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
I never thought to use my IDE for source control. The only thing it does implicitly and I'm OK with because it does it correctly is rename files.

ComptimusPrime
Jan 23, 2006
Computer Transformer
I don't use the IDE for source control. I use git proper. And NetBeans does not like the way it handles merging files.

cenzo
Dec 5, 2003

'roux mad?
The extent to which you all know your IDEs makes me feel like a.... a.... BA. Jeez.

Although it's funny that you all mention caching issues with Eclipse, as that's what happened to me today. Made a bunch of changes to a .js file and nine times out of 10, the on the fly change to the app works. Not in this case. Had to remove the app from the server, clean my entire project, restart my server and re-deploy my app.

Don't mind me, just commiserating.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

ComptimusPrime posted:

Process for merging conflicts with Git and Netbeans:

Close Netbeans.
Start merge process.
Merge all conflicts.
Add/commit changes.
Finish pull.
Open Netbeans.
Netbeans now thinks you have duplicate class files.
Bang head against wall until finding Netbeans hidden cache folder.
Delete cache folder.

Repeat process for every merge until you remember Netbeans cache folder.

Netbeans has like the worst git support. That said it has some of the best mercurial support, probably because it was Sun's and Sun went hg whole hog. I use Netbeans almost exclusively for my php projects that use hg because it's just that good at it.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
TRex, what ComptimusPrime is describing is independent of your source control. It happens anytime you make a nontrivial amount of changes to your files; Netbeans can't figure it out.

I just realized that I always make sure to close Netbeans whenever I switch branches to avoid those kinds of problems and it's worked well for me so far. I just clean an build the project and Netbeans is happy. It's become so ingrained I just don't think about it anymore.

The only time I ever have to clear that cache folder is when I notice that Netbeans doesn't refresh the the stupid Red X icons on your files that don't compile no matter how many restarts you've done.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
Ah, I see, good point.

In any event its git support sucks.

pigdog
Apr 23, 2004

by Smythe

TRex EaterofCars posted:

Ah yeah, I never run app servers in IDE's any more for that exact reason. I just do jpda and connect remotely cause it's just less headaches imo.

also: JRebel.

Doctor w-rw-rw-
Jun 24, 2008

ComptimusPrime posted:

I don't use the IDE for source control. I use git proper. And NetBeans does not like the way it handles merging files.

I actually use git on the command line with EGit in Eclipse, and generally avoid using EGit altogether. Here's why:
* When I check out a different commit, EGit actually refreshes the files instead of giving me a screen telling me to refresh
* When I rename a package, it git mv's the files for me
* If something is conflicted - and stuff rarely is - it'll show up in the IDE, even though I always resolve it manually.

It works pretty great for me. For that matter, Eclipse has never given me any plugin troubles, because I avoid installing them as much as possible. Now if only Scala would auto-import for me like Java does in Eclipse (someone please tell me they added this in the last year, please)

Doctor w-rw-rw- fucked around with this message at 23:03 on Mar 9, 2012

ComptimusPrime
Jan 23, 2006
Computer Transformer
Scala IDE 2.0.0 was just released. You should probably check it out.

Volguus
Mar 3, 2009
I have quite a few plugins installed on eclipse at home and never had troubles. At work, i have a relatively weak computer, therefore i prefer to have multiple installations, each with a set of plugins needed for a specific task (j2ee, STS - Grails, plain java, a php one, etc.).

Works wonders.

But, i have to agree, Idea is a drat good IDE. Too bad the free version is quite limited. Netbeans can go die in a fire.

Nighttheii
Nov 21, 2007
hi
This is probably too basic of a question, but I have an object class and method where RationalNumber is an object with the two int variables numerator and denominator.

This method "add" is supposed to use the RationalNumber object as the return type, allow the main program to add a 2nd RationalNumber to the first (not worrying about lowest common denominators) changing it's value.

What do I put in the return statement for the add method? (There might be other problems, i'm kind of new at this.)
code:
public class RationalNumber {
    int numerator;
    int denominator;

    public RationalNumber(int newNumerator, int newDenominator) {
        numerator = newNumerator;
        denominator = newDenominator;
    }
    public RationalNumber add(RationalNumber other) {
        if (denominator == other.denominator) {
            numerator += other.numerator;
        } else {
            int temp = 0;
            denominator = denominator * other.denominator;
            temp = denominator / other.denominator;    
            numerator = (numerator * temp) + (other.numerator *temp);
        }
        return _____;
    }
}

ivantod
Mar 27, 2010

Mahalo, fuckers.

rhag posted:

I have quite a few plugins installed on eclipse at home and never had troubles. At work, i have a relatively weak computer, therefore i prefer to have multiple installations, each with a set of plugins needed for a specific task (j2ee, STS - Grails, plain java, a php one, etc.).

Works wonders.

I have found this also. Rather than making one installation of Eclipse with all sorts of stuff in, it's better to have several with fewer plugins each. I used to have one installation with about a million things and it literally takes 5 min until it's ready to be used after it's been started.

More generally, as people have said before, I feel that overall Eclipse is a decent enough basic IDE (especially for a free product), but the issue is that the quality of different parts is extremely variable, depending on how much love they get from the various development teams. Like, the basic Java app development is great, but as soon as you start to move into the Web application territory (WTP and all that), it starts to get a bit dodgy, and so on.

In my previous job I had to use RAD due to Websphere dependency, and yeah... let's not go there.

BTW, check this one out: http://images2.wikia.nocookie.net/__cb20070215172454/inciclopedia/images/e/e7/Error_interno.jpg. It's an old version of Eclipse and the screenshot is in Spanish, but basically it shows Eclipse experiencing an internal error of some kind and then another internal error while trying to display an internal error message. It's pretty funny.

rhag posted:

But, i have to agree, Idea is a drat good IDE. Too bad the free version is quite limited. Netbeans can go die in a fire.

I have been considering this for quite a while, especially since I use PyCharm for my Python work from the same authors. But a couple of (halfhearted) attempts to try out Idea have not ended successfully for me. I'm kind of trying to find time for a proper trial, rather than giving up when I can't find the appropriate shortcut, especially since now I have experience with PyCharm which I like very much. How is the plugin ecosystem on Idea? I'm guessing probably more limited compared to Eclipse? Or not?

Luminous
May 19, 2004

Girls
Games
Gains

Nighttheii posted:

This is probably too basic of a question, but I have an object class and method where RationalNumber is an object with the two int variables numerator and denominator.

This method "add" is supposed to use the RationalNumber object as the return type, allow the main program to add a 2nd RationalNumber to the first (not worrying about lowest common denominators) changing it's value.

What do I put in the return statement for the add method? (There might be other problems, i'm kind of new at this.)
code:
public class RationalNumber {
    int numerator;
    int denominator;

    public RationalNumber(int newNumerator, int newDenominator) {
        numerator = newNumerator;
        denominator = newDenominator;
    }
    public RationalNumber add(RationalNumber other) {
        if (denominator == other.denominator) {
            numerator += other.numerator;
        } else {
            int temp = 0;
            denominator = denominator * other.denominator;
            temp = denominator / other.denominator;    
            numerator = (numerator * temp) + (other.numerator *temp);
        }
        return _____;
    }
}

return new RationalNumber(numerator, denominator);

However, understand that your logic modifies the value of the rational number you're using already.

code:
RationalNumber first = new RationalNumber(1, 2);
RationalNumber second = new RationalNumber(3, 4);
RationalNumber third = first.add(second);
In this case, both first and third are representative of the same RationalNumber you want.

I'd personally recommend eliminating that side effect so that first remains unchanged. This is accomplished by introducing local variables to the .add method, not modifying the class members for numerator and denominator, and then using those (the local variables) as the input for a new RationalNumber.

Contra Duck
Nov 4, 2004

#1 DAD

Nighttheii posted:

This is probably too basic of a question, but I have an object class and method where RationalNumber is an object with the two int variables numerator and denominator.

This method "add" is supposed to use the RationalNumber object as the return type, allow the main program to add a 2nd RationalNumber to the first (not worrying about lowest common denominators) changing it's value.

What do I put in the return statement for the add method? (There might be other problems, i'm kind of new at this.)

You could either return void on the method (since it's the object itself that is being modified) or you could return 'this', which would allow for chaining of methods like n1.add(n2).add(n3).

If you've got a choice though I'd advise making the class immutable like the other standard java number classes. Don't provide any methods that modify the state of the object at all, instead make your add method (and all other operations) return a brand new RationalNumber containing the result rather than modifying either of the two input RationalNumbers. Knowing that your objects will never change values will make things a hell of a lot easier to reason about, allow you to safely use them in sets and as keys in maps, and you won't get strange behaviour on something like n1.add(n1).add(n1).

e: changing my last example

Contra Duck fucked around with this message at 23:53 on Mar 11, 2012

Sedro
Dec 31, 2008
You should also mark the fields final so the compiler won't let you change them.

Nighttheii
Nov 21, 2007
hi
I'll make that change so object won't be modified, thank you all for the help!

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

ivantod posted:

I have been considering this for quite a while, especially since I use PyCharm for my Python work from the same authors. But a couple of (halfhearted) attempts to try out Idea have not ended successfully for me. I'm kind of trying to find time for a proper trial, rather than giving up when I can't find the appropriate shortcut, especially since now I have experience with PyCharm which I like very much. How is the plugin ecosystem on Idea? I'm guessing probably more limited compared to Eclipse? Or not?

It's more limited but the most useful plugins are made by JetBrains themselves, and are of higher quality than stuff like WTP. I personally use the Clojure, Ruby, Grails, Spring and Maven plugins and I haven't really had any issues.

narbsy
Jun 2, 2007

ivantod posted:

I have been considering this for quite a while, especially since I use PyCharm for my Python work from the same authors. But a couple of (halfhearted) attempts to try out Idea have not ended successfully for me. I'm kind of trying to find time for a proper trial, rather than giving up when I can't find the appropriate shortcut, especially since now I have experience with PyCharm which I like very much. How is the plugin ecosystem on Idea? I'm guessing probably more limited compared to Eclipse? Or not?


If you can't find a shortcut, you can always search for one using Ctrl-Shift-A in the Linux keybindings. Typing an action will show you the shortcut and let you execute it.

There are a couple of good keyboard shortcut cheat sheets for it as well.

n0manarmy
Mar 18, 2003

I'm going crazy here: Friend has a stereo unit in his car that will play mp3s and bases the play list off of date that the directories were created, not modified. I'm trying to write a simple java app that will:
  1. take the directory specified
  2. list it
  3. ask to verify before proceeding
  4. and then randomize a number for the year and replace it with the date created for the directory.

I cannot seem to figure out how to set the time. I keep getting stuck because Java 1.7 says to use the Files function but this function requires that I specify a Path. However my paths are contained in an array of type File because I'm using the dir.listFiles() to create this array. I can use the Paths function to convert a string to a path but not a File to a path.

I know I have errors, I've just stopped and am beating my head against a wall to trying to figure out what I'm doing wrong.

code:

package randomyou;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileTime;

public class Randomain {
	
	public static void main(String[] args) {
		
		System.out.println("What is the directory?...this is impotenet!");
		String fileDir = Input.multiWordText();
		File dir = new File(fileDir);
		File[] fileList = dir.listFiles();
		//calls list of files for verification and then calls date change to happen if user oks
		if(listFilesForUser(fileList) == true){changeCreatedDate(fileDir, fileList);} 
		else {System.out.println("Uhoh!");}		
	}
	//Lists files in array
	private static Boolean listFilesForUser(File[] fileList) {
		for (int x = 0; x < fileList.length; x++) {
			System.out.println(x + " -- " + fileList[x]);
		}
		
		System.out.println("Proceed with modification? 1 for yes and 0 for no");
		int temp = Input.number();
		if (temp == 1) {
			return true;
		}
		else return false;
	}
	private static void changeCreatedDate(String fileDir, File[] fileList) {
		long currentTime = System.currentTimeMillis();
		long lowCurrentTime = (1000000000 - System.currentTimeMillis());
		Path filePath = null;
		FileTime ft;
		for (int x = 0; x < fileList.length; x++) {
			currentTime = currentTime + (int)(Math.random() * (lowCurrentTime - currentTime));
			filePath = fileList[x].toPath();
			try {
				ft = FileTime.fromMillis(currentTime);
				Files.getFileAttributeView(filePath, BasicFileAttributeView.class).setTimes(null, null, ft);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}

n0manarmy fucked around with this message at 12:54 on Mar 14, 2012

Sedro
Dec 31, 2008
There are methods on File to get the path string.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
file.toPath() is what you want.

n0manarmy
Mar 18, 2003

I got it working, thank you both for your help. Now, the program isn't doing what I had intended it to do though :( It's just modifying the time, not the actual date. I'd love to randomize the year but all I can seem to do is randomize the time. which won't help with the folder dates.

Sedro
Dec 31, 2008
The problem is in your code. Check whether randomYear is ever getting used.

Airconswitch
Aug 23, 2010

Boston is truly where it all began. Join me in continuing this bold endeavor, so that future generations can say 'this is where the promise was fulfilled.'
Hey, Java novice with a small problem with a method intended to iterate through an array searching for the (only) location containing a specified value, and return an array with said location. Eclipse is claiming that "This method must return a result of type int[]", which makes no sense because it should be doing so. What is my mistake?

code:
public int[] getstart()
	{
		for (int row = 0; row < mazearray.length; row++)
		{
			for (int column = 0; row < mazearray[row].length; column++)
			{
				if (mazearray[row][column] == 3)
				{
					int[] result = {row, column};
					return result;
				}
						
			}
		}
	}

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
What happens if your code runs all the way to the end without finding the specified value?

Airconswitch
Aug 23, 2010

Boston is truly where it all began. Join me in continuing this bold endeavor, so that future generations can say 'this is where the promise was fulfilled.'
D'oh! Thanks!

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I'm still lovely at java/programming, but I think I've nailed down a question concerning a particular situation which, if clarified, might make me a little less lovely.

I'm trying to learn about file system management in java so I've been writing a small test class to experiment with the java.io.File object's methods.

This is how far I've gotten:

code:
import java.io.File;

public class FileTester{
	public static void main(String[] args){
		System.out.println(new File("FileTester.java").exists());
		System.out.println(new File("sdfsdfsdf").exists());
		System.out.println(new File("users").exists());
		System.out.println(new File("users").isFile());
		new File("produced").mkdir();
	**	new File("alsoProduced/test.txt").createNewFile();
	}
}
This code compiles / runs as expected when the ** line is omitted, but compiling with ** included produces the following error:

code:
FileTester.java:10: unreported exception java.io.IOException; must be caught or declared to be thrown
		new File("alsoProduced/test.txt").createNewFile();
		                                               ^
1 error
I've investigated the methods exists(), isFile(), createNewFile(), etc, and found that all of these methods throw exceptions under particular circumstances. My question is why the compiler insists on try/catch error handling for the createNewFile() line when it didn't for any of the others?

Newf fucked around with this message at 18:52 on Mar 22, 2012

Sedro
Dec 31, 2008
Read up on the difference between checked and unchecked exceptions.

Xerophyte
Mar 17, 2008

This space intentionally left blank

Newf posted:

I've investigated the methods exists(), isFile(), createNewFile(), etc, and found that all of these methods throw exceptions under particular circumstances. My question is why the compiler insists on try/catch error handling for the createNewFile() line when it didn't for any of the others?

Not all exceptions are equal. The first set of methods throw only SecurityExceptions, which is a subclass of RuntimeException. RuntimeExceptions are unchecked and catching them is not enforced by the compiler, generally because they indicate programmer error rather than some special circumstance you need to take into account. You don't need to try/catch all the divisions in your code for ArithmeticException in case you happened to divide by 0, for instance.

In contrast, createNewFile throws an IOException which is a direct subclass of Exception. These are checked exceptions and handling them is enforced by the compiler. Such exceptions generally represent a specified behaviour that you must take into account when calling a method.

Here's the Java tutorial on the subject.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I feel less lovely already! Thanks!

Volti
Aug 26, 2005
Working as intended
So for the last 2 hours I've been trying to make a simple UI for a dota 2 program but I am having some major issues getting a background image to work.

So far I have a layered pane, a foreground and background pane, but I am still quite stuck.

code:
        setLayout(new BorderLayout());
        add(lpane, BorderLayout.CENTER);
        lpane.setBounds(0, 0, WIDTH, HEIGHT);
        bg.setBounds(0, 0, WIDTH, HEIGHT);
        bg.setOpaque(true);
        fg.setBounds(0, 0, WIDTH, HEIGHT);
        fg.setOpaque(false);
        lpane.add(bg, new Integer(0), 0);
        lpane.add(fg, new Integer(1), 0);
        pack();
        setSize(WIDTH,HEIGHT);
I think the panel on top completely blocks out the one underneath. At this point I am welcome to any solution.

This might not have been the ideal way to solve this, but I didn't feel knowledgable enough to do the graphics component override stuff.
Will the top layer always completely block the one underneath?

Adbot
ADBOT LOVES YOU

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
I am a tard.... ignore me.

thegasman2000 fucked around with this message at 22:15 on Mar 26, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply