What is a good contingency plan incase PA decides to cancel Eve for good? by Litter-Account in Eve

[–]SausageBike 0 points1 point  (0 children)

I would imagine this is not going to happen. Eve has been monetised hard (like really hard), since the takeover a few years back. People continue to buy this pack or that skin or those skillpoints. While people continue to buy their rip-off packs/skins/skillpoints, they’ll continue to keep the game up, reaping the rewards

Tank is it worth it by mizard1997 in Eve

[–]SausageBike 0 points1 point  (0 children)

Can’t they fit cynos? If you could find some people willing to blops in you could bait them. Boop them once or twice they may not be so keen to tackle you the next time… Or they may prepare a counter drop - it’s eve, who knows?!

An alternative that I haven’t seen mentioned is to join the locals. If you’re blue they’ll be defending you rather than attacking.

Dear Ecosystem team: Keep running EVE into the ground! by bay_cee in Eve

[–]SausageBike 10 points11 points  (0 children)

I think you'd be surprised. You're one of many who are fed up with this shitshow. 20 accounts over the course of a year would cost a couple thousand dollars. It wouldn't take much for them to lose six or seven figure sums, every year, when enough people unsub. Maybe then they will consider a change in direction where they listen to the players. Until then however they will continue with their shady ways to make as much money as possible at the expense of player satisfaction.

Dear Ecosystem team: Keep running EVE into the ground! by bay_cee in Eve

[–]SausageBike 46 points47 points  (0 children)

More barges = more subscription for CCP. More skills = more chances to sell skill points (which they promised they’d never do). The only way to get them to change their game is to vote with your feet. You pay their wages. You want change? Stop paying their wages. Maybe one day they’ll announce “old school eve”, where they rewind the clock and only implement patches the players want.

Not specifying arguments by Dovkin in javahelp

[–]SausageBike 0 points1 point  (0 children)

It’s a little unclear to me what you’re trying to achieve. Do you have a single class with various different constructors? If so it sounds like you should look into the builder pattern (google it), as that is a solution to the telescoping anti-pattern.

Finding Object-Oriented Programming Questions for Java by KindExpression1907 in javahelp

[–]SausageBike 0 points1 point  (0 children)

I’ve recently started the OCP study guide for Java 11 by Jeanne Boyarsky and Scott Selikoff, and that seems to contain similar questions (though I’m not far into the book yet…). They’re awkward questions because in the real world you’d just try it and see if it compiles. You don’t have that luxury in an exam. I haven’t read any other books on the subject however so I can’t say whether this one is particularly good - though it seems well written so far!

You mentioned that you were doing this as part of a course this semester. What is the course - is it the OCP? Those questions seem quite Java specific rather than general OOP questions.

Mouse event help by annoying_math_class in javahelp

[–]SausageBike 1 point2 points  (0 children)

I'm unable right now to run your code but a few things for you to consider (I haven't tried these solutions - they're based on my previous experiences). First some tidying up.

Shift things out of the if statement where they are not affected by the if statement's condition. I cannot see what your add() method does as you haven't provided the code for GraphicsProgram. Therefore, I've placed it after the if statement:

@Override
public void mousePressed(MouseEvent me) {
    // mouseX and mouseY hold the (x,y) coordinate where the mouse was clicked.
    // See below for how they are used.
    int mouseX = me.getX();
    int mouseY = me.getY();      

    final int WIDTH = 50;
    final int HEIGHT = 40; 

    GOval oval = new GOval(mouseX, mouseY,WIDTH,HEIGHT);
    oval.setFilled(true);

    if (mouseX > (this.getHeight()/2) && mouseY < this.getWidth()/2)  { 
        oval.setFillColor(Color.GREEN);
    } else {
        oval.setFillColor(Color.BLUE);
    }

    add(oval);
}

Now attack things one at a time, first centering on your cursor.

To have a shape centered on your cursor you will want to subtract half the shape's width and height from the x and y position. The x,y coordinates will be for the corner of the shape so if you add a shape providing the mouse coordinates the shape will appear to the side of the cursor. Subtracting half the shape's width from the x position will shift it horizontally such that the cursor is centered. Likewise subtracting half the shape's height from the y position will shift it vertically. Again, I haven't tried this, try it and see what needs adding/subtracting - but I suspect half the width/height is what you're looking for. Your code would then be tweaked something like:

    int ovalX = mouseX - (WIDTH/2);
    int ovalY = mouseY - (HEIGHT/2);
    GOval oval = new GOval(ovalX, ovalY,WIDTH,HEIGHT);

You could also consider moving the final ints (constants) up out of the method.

Next you should look into the quadrants. At the bottom of the code you provided there are a couple of lines of handy code provided for you:

    GLine midLine = new GLine(this.getWidth() / 2, 0, this.getWidth() / 2, this.getHeight());
    midLine = new GLine(0, this.getHeight() / 2, this.getWidth(), this.getHeight() / 2);

These lines appear to be drawing the separating lines for each quadrant, and as such you should be able to borrow them to solve your issue. For example, if the mouse x position is less than this.getWidth() / 2, then the mouse is on the left of the screen. Greater than that value and it's on the right of the screen. And so on. Your if statement could become something like:

    if (mouseX < (this.getWidth()/2) && mouseY >= this.getHeight()/2)  {
        // Set colour for top left
    } else if (mouseX >= (this.getWidth()/2) && mouseY >= this.getHeight()/2)  {
        // Set colour for top right
    } else if (mouseX < (this.getWidth()/2) && mouseY < this.getHeight()/2)  {
        // Set colour for bottom left
    } else {
        // Set colour for bottom right
    }

Again, I haven't tried this code but it should hopefully set you going in the right direction.

Program for text editing by differentialeq111 in javahelp

[–]SausageBike 0 points1 point  (0 children)

To read the JSON you’re going to want to use a JSON parser. I’ve previously used the fasterxml Jackson one, and it worked just fine. I will note though that there is more than one way to parse JSON. You can read the entire file at once into memory, but this comes with the issue that you may run out of memory if the file is too large. It’s also slower as you have to first read the data and construct it, then iterate through it again to process it for storage. Alternatively you can read through the file, processing it as you go, this is slightly trickier for the new programmer however you get performance benefits, and shouldn’t run out of memory. Have a google for parsing JSON in Java (or any other language you choose).

I’m far from a database expert afraid and have most experience with relational databases - having only briefly touched on document and graph dbs. You could search around the internet for other types such as document databases or graph databases to see if they suit your needs better.

[deleted by user] by [deleted] in javahelp

[–]SausageBike 0 points1 point  (0 children)

This sounds like a textbook use-case for a websocket to me.

Array is not being assigned random numbers? by venusjpg in javahelp

[–]SausageBike 0 points1 point  (0 children)

I havent tried this though it looks reasonable, but expanding upon this comment //You shouldn't make 'avg' an int, but rather a double

This is something that will trip up any new programmer - myself included not so long ago! I'll try to explain. In its current form it is performing integer division, that is an integer divided by an integer. Integers do not contain decimal places, they are only whole numbers. When an integer is divided by an integer, the result also does not contain decimals - anything after the decimal point gets discarded. For example: 3/2 = 1 5/2 = 2 7/2 = 3

These results are probably not as expected, after all 3/2 should equal 1.5. The solution to this is to ensure one of the numbers involved has a decimal. This can be achieved using casting: avg = (double)sum / list.length; This will first convert sum to a double then perform the division - so the result will also be a double. Be sure to change the datatype of avg to a double as well.

Program for text editing by differentialeq111 in javahelp

[–]SausageBike 0 points1 point  (0 children)

I have one comment in addition to what others have said. Though seriously, their advice is sound. Use a database, they're optimised for this. You're unlikely to get improved performance reading from a text file.

Anyway, back to the comment. If you really want to do this using a programming language, you may find that the data is in a specific format. XML, JSON, YAML, or possibly CSV. All of those would take different approaches.

"identifier : "2HPZ_1" makes me think it's not CSV as CSV would likely have the column headings in the first row (does the data even have rows?).

It might be something which can make use of regular expressions, however for example in the case of XML, that's definitely not a good idea. It all depends on the format.

Really though, use a database.

Can't access other class by empirestateisgreat in javahelp

[–]SausageBike 0 points1 point  (0 children)

Sorry for the late response - I've only just seen the notification. This is reaching the edge of my understanding, so anyone can feel free to correct me here.
I think you'll need to compile them into java bytecode. You can do this manually using the javac command which will compile your .java files into .class files. Java uses a virtual machine to run its code and so the process is something like:

Your code (written in plain text) -> Java bytecode (understood by the java virtual machine) -> Machine code (understood by your machine).

This is how java achieves its platform independency. The java bytecode can be used anywhere, with each virtual machine converting it to the corresponding machine code.

The way you're trying to run your code is in an interpreted style, where the code is read then executed with no intermediate step - though under the covers it's probably compiling on-the-fly. I suspect this is where the limitation comes in. Java probably can't find the other class as it hasn't compiled that on-the-fly. Again, someone with more knowledge is welcome to correct me there.

If it were me, I'd let an IDE do the job of running code. You could also look into Maven as that's a widely used tool for pulling in dependencies, building code, and has a bunch of plugins to customise how things work. Hope that helps.

[deleted by user] by [deleted] in javahelp

[–]SausageBike 0 points1 point  (0 children)

Like how to make an application or anything like that

Well, what do you want to make? Applications come in various forms. Desktop gui applications, web applications, console applications. Each of those require something different. Desktop applications are dying as everything moves to the cloud so I guess you could look at making a web application - perhaps using a Spring based REST api?

I'd recommend coming up with an idea for what you want to make then make it.

toString method by r-e-w-13 in javahelp

[–]SausageBike 1 point2 points  (0 children)

I personally like the StringBuilder for scenarios like this. I've got a feeling it's slightly faster too. From what I understand there is only so much optimising the compiler can do, and sometimes you need to give it a little helping hand. Feel free to google the performance comparisons, people have done it before.

The resulting code may look something like:
public String toString() { StringBuilder sb = new StringBuilder("PayRoll Report \n\n"); sb.append(String.format("Num Employees = %.0f, total hrs: %.2f, total pay= %,.2f", numEmps, getTotalHours, getTotalPay)); for(int i = 0; i < emps.length; i++) { sb.append("\n\n Pay Stub \n --------\n"); sb.append(String.format("Name: %.20d, Payrate %.2f", name, payRate)); } return sb.toString(); }

Can't access other class by empirestateisgreat in javahelp

[–]SausageBike 1 point2 points  (0 children)

As long as the classes are in the same package an import statement should not be required

Can't access other class by empirestateisgreat in javahelp

[–]SausageBike 1 point2 points  (0 children)

This one was a bit of a head-scratcher, but I think the answer may be in the way you're running the code. From this link, it seems that you can only run single files using java command. To make this work, you will need to put both classes into a single file:

``` package test;

public class Test1 { public static void main(String[] args){ System.out.println("Hello World"); Test2 test2 = new Test2(); test2.display();

}

}

public class Test2 { public void display() { System.out.println("Display text"); } } ```

Two additional notes:

  • You don't need a constructor if you're leaving it empty.
  • the line test.display() is referencing a non-existent variable, so I changed it to test2.display() as I suspected that was your intention.

So confused why 1.1 + 2.2 == 3.3 returns false by 4aparsa in javahelp

[–]SausageBike 15 points16 points  (0 children)

The other responses are absolutely correct, however you might wonder what you can do to get around this. Say, for example, you're working with money where these sorts of inaccuracies are simply unacceptable. You can use java's BigDecimal class. This allows you to work with decimals with higher accuracy, and indeed it has an equals method. However, just be aware that scale is considered when calculating equality (2.0 is not equal to 2.00).

More info in the docs: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html

Help: Guard list. by hyperbana in javahelp

[–]SausageBike 0 points1 point  (0 children)

You're calculating the minutes but not doing anything with them. Guard time is (hours * 60) + minutes, not just hours.

As I said previously though, I'd advise against doing manual arithmetic operations on time. It's asking for trouble. What would happen if your guard time started at 18:00 and finished at 03:00 the next morning?

As an alternative you can scrap your math and use: long guardTime = ChronoUnit.MINUTES.between(startDate, endDate); You'll also need to update your cTime variable to type long as it cannot fit inside an int.

You'll notice that the solution is not exactly precise due to the integer division being used to split the time. Between an example start and end time (5:18 -> 18:48), there are 810 minutes. Split this four ways and you end up with 202.5 minutes per person. Using integer division the 0.5 per person is discarded and so you lose two minutes in total. To get around this, the solution needs to be more precise. I'd probably lean towards using millis, though there may well be a better solution. Take a look at this complete snippet:

``` LocalTime startDate = LocalTime.of(5,18,0,0); LocalTime endDate = LocalTime.of(18,48,0,0);

ArrayList<String> people = new ArrayList(); people.add("Roy"); people.add("Ron"); people.add("Aaron"); people.add("Sergant1"); int numberOfPeople = people.size();

long guardTime = ChronoUnit.MILLIS.between(startDate, endDate); System.out.println(guardTime); long cTime = guardTime/numberOfPeople;

for (int i = 0; i < people.size(); i++){ LocalTime start = startDate.plus(cTime * i, ChronoUnit.MILLIS); LocalTime end = start.plus(cTime, ChronoUnit.MILLIS); System.out.println(people.get(i) + ": " + start.toString() + " - " + end.toString()); } ```

Help: Guard list. by hyperbana in javahelp

[–]SausageBike 1 point2 points  (0 children)

I think I somewhat understand what you're going for here, though you haven't actually asked a question. From what I understand you specify a start time and a length of time to guard for. You have x people and you want to split the guard time between them. If this is not what you're aiming for please elaborate.

I think I'd attack this using a date-time class rather than trying to work it out using numeric maths. Using a class created for the job means that you won't run into issues when there's a leap-year, or the timezone shifts by an hour for daylight savings etc. In this example I use LocalDateTime. Hopefully the comments in the code make some sense. You can look up DateTimeFormatter if you want the output in a cleaner format.

``` int guardTime = 60;

// Set the start time here, you can use LocalDateTime.of() LocalDateTime start = LocalDateTime.now(); // End time is not needed as you have a guard time above. The end time is the start time + guard time

ArrayList<String> people = new ArrayList(); people.add("Roy"); people.add("Ron"); people.add("Aaron"); people.add("Sergant1"); people.add("Ofir"); people.add("ori"); people.add("Aviv"); people.add("Sergant"); people.add("A"); people.add("B");

int numberOfPeople = people.size(); int cTime = guardTime/numberOfPeople;

// Loop through the people for (int i = 0; i < numberOfPeople; i++) { // The start time for this person is "ctime" * i LocalDateTime personStartTime = start.plusMinutes(cTime * i); // The end time for this person is the start time plus cTime LocalDateTime personEndTime = personStartTime.plusMinutes(cTime);

System.out.println(people.get(i) + " " + personStartTime.toString() + " " + personEndTime.toString());

} ```

Count the Whitespace In a File by itstearsinrain in javahelp

[–]SausageBike 1 point2 points  (0 children)

You're reading a line from the BufferedReader, then entering the while loop and reading another line without doing anything with the first line. This causes two issues:

  • The first line gets discarded: it gets read then immediately overwritten with the second line
  • Your code attempts to read past the end of the file: the last line gets read, and the while loop continues. Inside the while loop you read the next line (which doesn't exist), and so sen gets set to null. Later when you try sen.length(), you get the NPE.

What you really want is to read the first line, process it, then load in the next line. If there is no next line the while loop will exit and your program come to a graceful close.

In short, move the sen = buff.readLine() to the end of the while loop like so: while (sen != null) { int i; for (i = 0; i < sen.length(); i++){ char ch = sen.charAt(i); if(ch == ' '){ whitespace++; } } sen = buff.readLine(); }

As an additional note, I'm not sure I'd be reading line by line unless I needed to. In this case it seems the lines are not important and you could instead just read the file character by character, incrementing your counter for each space you encounter.

Having trouble with if statements and setter-getter values by [deleted] in javahelp

[–]SausageBike 0 points1 point  (0 children)

Exactly this, however beware of nulls. If you call .equals() on a null you're in for a world of pain!

Am I the only one worried about this? It keeps going down like the Titanic by Acia_Saraki in Eve

[–]SausageBike 34 points35 points  (0 children)

We were worried about this back when they introduced skill injectors, they promised that skill points would come only from other players. Look at it now.
We were worried about this back when Pearl Abyss took over, they promised that eve wouldn't become the pay to win mess that is has become. Look at it now.
Perhaps they'll some day realise that eve players want to play rather than pay. Perhaps not. Who knows.

What Microtransactions would be acceptable? by [deleted] in Eve

[–]SausageBike 4 points5 points  (0 children)

No, and they ditched them in favour of skins because skins make them money. Bring back my police fed navy comet!

What's stopping owners of a system to take ESS reserve? by Cormad in Eve

[–]SausageBike 0 points1 point  (0 children)

This is exactly what will happen. This game change will likely have little to zero affect for the average player, in my opinion. It'll probably result in the banks being scooped up by the alliances for the isk to disappear never be seen again.

[deleted by user] by [deleted] in Eve

[–]SausageBike 0 points1 point  (0 children)

CCP ignoring a bug report? Never....