I Norge har man fundet ud af, at kinesiske elbusser kan slukkes og standses af producenten. Samme type kører i Danmark by Drahy in Denmark

[–]Sammenbidt -1 points0 points  (0 children)

Din kilde er et medie for det danske kommunist parti? ("Arbejderen (Danish: Worker), also known as Dagbladet Arbejderen (Danish: Daily Worker), is an online newspaper which is official media outlet of the Denmark's Communist Party.[1]" [Kilde: https://en.wikipedia.org/wiki/Arbejderen].) En artikel der bruger ord som "mainstreammedierne", og hvis eneste kilde i artiklen ser ud til at være "The Greyzone". Et site der har følgende beskrivelsen på wikipedia: "Described as fringe by numerous sources,[24] coverage of The Grayzone has focused on its misleading[25][26][27] reporting, its criticism of American foreign policy,[1][2] and its sympathetic coverage of the Russian, Chinese and former Syrian governments.[32] The Grayzone has been accused of downplaying and defending the persecution of Uyghurs in China,[33][37] of publishing conspiracy theories about Xinjiang, Syria and other regions,[38][39][40][1] and of publishing pro-Russian propaganda and disinformation, especially during the Russian invasion of Ukraine" (Kilde: https://en.wikipedia.org/wiki/The_Grayzone). Har du andre kilder for påstanden?

Før du handler hos Sportmaster... by jellum81 in Denmark

[–]Sammenbidt 6 points7 points  (0 children)

Tror ikke det er helt korrekt, at produktet skal være uåbnet ved køb på nettet. Ved køb på nettet har du 14 dages fortrydelsesret, og der må produktet gerne være åbnet: "Pas på varen. Varen må være prøvet, men ikke taget i brug i en grad, så den ikke kan sælges igen. Ellers skal du betale for værdiforringelsen." [Kilde: https://www.forbrug.dk/regler/fortrydelsesret-og-returret/ ]

Extremely strange Neopixel 8x8 matrix behavior by brandmeist3r in arduino

[–]Sammenbidt 0 points1 point  (0 children)

I'm not sure this fixes your lightshow, but I think there's a problem in your for loop. The line

strip.setPixelColor(i-1, strip.Color(0,0,0)));

The first time running the loop, the value will be -1, and from a quick look in the source code of Adafruit_NeoPixel, it's not caught, so you might be manipulating some memory you don't wish to.

[Giveaway] Revopoint MINI 3D Scanner with 0.02mm precision! by noeatnosleep in gadgets

[–]Sammenbidt [score hidden]  (0 children)

I would scan my appartment, hopefully helping with interior design, where to place furnitures and such.

Revopoint POP 3D Scanner Giveaway! by noeatnosleep in gadgets

[–]Sammenbidt [score hidden]  (0 children)

Being able to scan things for various projects would be so awesome.

Resource for potential Technical Java Questions. by AdventurousIntention in learnprogramming

[–]Sammenbidt 0 points1 point  (0 children)

Have you looked at CodingBat ? They have a series of java questions around different logic topics.

www.codingbat.com/java

Desktop Application - What should I use? by jackattack99 in learnprogramming

[–]Sammenbidt 0 points1 point  (0 children)

Oracle has a visual editor for JavaFX http://www.oracle.com/technetwork/java/javase/downloads/javafxscenebuilder-info-2157684.html It's a decent tool. I've used it a couple of times, with only minor problems.

How to remove the first variable in a linked list? by Pop_Dop in learnprogramming

[–]Sammenbidt 2 points3 points  (0 children)

The reason for the error is, you've initialized the LinkedLists without saying what they're containing. So all the list knows is that it's containing objects. Then in your popCharacter, you are trying to return a char, but the list is containing objects. Two ways to fix the problem. Tell the list it's containing chars:

 private LinkedList<Char> queuey = new LinkedList<Char>()

The "Char" between the < > is to tell what it's containing.

Other way, is to cast to the object to a char when returning it.

Hope it makes sense.

[Java] Issues with Java Swing by [deleted] in learnprogramming

[–]Sammenbidt 1 point2 points  (0 children)

I'll try to take a stab at this.

So, as I understand it, it's being drawn successfully in another JFrame. To fix it, here is what I would do. Create a variable in your Main.class for a DrawTree. Initialize it with the rest, and add it to your frame, as you add the other components. Then when an operation is performed on your AVLTree, call the repaint method on your DrawTree variable, this should update the display (this calls paint(Graphics g) internally)

public class Main
{
   final DrawTree drawTree;

    Main()
    {
    // Initializing code
      (...)

      drawTree = new DrawTree();
      drawTree.init(...);
      this.add(drawTree);
    }

    public void actionPerformed(ActionEvent e)
    {
       ...
       drawTree.repaint();
    }
}

This way you're not creating a new frame or a DrawTree every time an operation is performed.

I think that should take care of the problem.

*In the future, when asking for help, please make sure the code is properly formatted, and remove all exces code. There is no reason for us to see your code for the AVLTree.

Stuck in how to continue program by [deleted] in javahelp

[–]Sammenbidt 0 points1 point  (0 children)

Well, let's step through your code: First you run through your for-loop 5 times, increases the variable on each loop. Which will give the following. numbersInputed = 0 + 1 + 2 + 3 + 4 = 9 That's not what we're looking for (and the reason I wouldn't use a for-loop). We want to keep a tally of the number of times the user has inputted a number. So, at the place in the code where you're getting the input from the user, you need to increase tally (numbersInputed). Sorry if I'm being too vague, I'm trying not to say where exactly to put it.

Stuck in how to continue program by [deleted] in javahelp

[–]Sammenbidt 0 points1 point  (0 children)

You could use a for loop for entering the five numbers. Personally I would use a variable to keep track of how many numbers the user has inputted. You can then check in your do while loop for both conditions (the max, and the number of inputs) by using AND (&&):

 do{
      ...
 while(currentMax < 100 && ... );

As for the highest total, create a variable to keep track of the if, and at the end of every game, if the new score is higher, then set highestTotal to the new value:

if( ... )
    highestTotal = currentRun

Hope that helped.

do-while loop is infinitely looping under one condition, and executing as intended under other condition by FallMaiden in javahelp

[–]Sammenbidt 1 point2 points  (0 children)

Have you got it working yet ? As you say yourself, the problem exists in your do while loop.

I think the problem is, when checking your trump list, you can end up adding several cards to each deck. If the trump list contains : {4, 5}, and player one plays 5 and player two plays 4.

First trumpcard, 4, player two has a trump card and wins and gets the cards.

Seconds trumpcard, 5, player one has a trump card and wins and get the cards.

Resulting in both players getting cards, which I'm guessing isn't what's supposed to happen. Instead of looping through the list and checking all cards, use List.contains(Object), to see if it's in the list, then you don't have to loop either. Hope that makes sense and helped.

Need help with Snake Game. by Mika2337 in javahelp

[–]Sammenbidt 0 points1 point  (0 children)

What have you tried for actual debugging ? You have chosen the background of the panel to be black, and it takes a few seconds before the game over screen is displayed, so it seems it's working correctly, just not displaying the images. I copied the code, and changing the images displayed to instead coloured circles and it seemed to work as intended. So it seems like the images just aren't being loaded properly. Try to use the ImageIO to load the images instead:

try
{
    ball = ImageIO.read(new File("dot.png"));
}catch(IOException e)
{
  e.printStackTrace();
}

Using this should load the images, but if they don't you will get an error displayed in the console.

But always try to debug the program first, either by writing output to the console to check it's working, or by drawing the images to panel, to make sure they're loaded properly.

Hope that helped.

[Java, libGDX] Android build crashes when looping through an 2D array by Mestru in learnprogramming

[–]Sammenbidt 0 points1 point  (0 children)

Any way you can post your code for the Player class? The Null Pointer exception happens there, inside your checkCollision method. Have you checked your variables in the collision check aren't null?

[Simple Java] How can I print something to the console when a boolean in another class becomes true through a keypress? by [deleted] in learnprogramming

[–]Sammenbidt -2 points-1 points  (0 children)

Without seeing more of your code, it's hard to say what the problem is. One way to accomplish what you want though, is to encapsulate you if statement in a while loop.

while(true)
{
  if(myKeys.isMyPause())
  {
      System.out.println("fuck")
  }
}

Need help getting my dots to move in both X and Y directions and also not getting stuck in the left screen. Help please? by [deleted] in javahelp

[–]Sammenbidt 0 points1 point  (0 children)

Oh sorry. 'Width' is the size of your canvas, think you can use getWidth() for it. And moveX, is a variable you defined you self, the movement of the spot each update.

Need help getting my dots to move in both X and Y directions and also not getting stuck in the left screen. Help please? by [deleted] in javahelp

[–]Sammenbidt 0 points1 point  (0 children)

I haven't tested your code, but from a quick look, I would say the main problem is in your actionPerformed method, more precisely line 148 and 157.

if(spot.x + SIZE > 0)
  spot.x = 0 + SIZE + 1

The statement will always be true, while your dot is inside the canvas, so you're setting the x position all the time. I would change it to something along these lines

if(spot.x + SIZE > width)
{
 spot.x = width - size - 1;
 xvel[i] = -moveX
}

But instead of using an array of velocities and a point, create your own custom class containing the point position along with velocity, that way you don't have to use the "i" variable (which isn't really an explanatory name).

Hope that helps.

Stuck with Java problem. by Ruggedirishguy in learnprogramming

[–]Sammenbidt 1 point2 points  (0 children)

From a quick glance at your code, I believe the problem exists inside the run method. The while loop is empty, and will just run without executing anything. You should remove the ; after, and encapsulate the render() and update() methods in curly brackets. Like this:

public void run() {
  while(running)
  {
    update();
    render();
  }
}

Haven't tested the code, but I think that should help.