[Solved] How to check if the mouse did not move for 2 minutes in WPF?

Add a timer control to your application. Subscribe to mouseover and keydown events – when they fire, reset the timer. When the timer fires (ie mouse hasn’t moved and key’s haven’t been pressed for x amount of time), lock the screen / prompt for login. This could also help: http://www.codeproject.com/Articles/13756/Detecting-Application-Idleness solved How to check if … Read more

[Solved] How to reduce memory leak in java?

lets analyze a few of the the possible error messages: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: PermGen space java.lang.OutOfMemoryError: Requested array size exceeds VM limit java.lang.OutOfMemoryError: request <size> bytes for <reason>. Out of swap space? java.lang.OutOfMemoryError: <reason> <stack trace> (Native method) Here’s the MemLeak class: package com.post.memory.leak; import java.util.Map; public class MemLeak { public final String … Read more

[Solved] Gcc/G++ doesn’t give correct results when compiling more than 3 times

Ok, i figured it out. Thanks @TartanLlama for the last comment it makes total sense. So the “core error” (the thing that i wanted to know) was in here: float /* */ soma_transmissor, soma_recetor; for(i=0;i<n;i++){ soma_transmissor+=distobj[i]; /* */ } for(i=n-1,k=n;i>=0;i–){ soma_recetor+=distobj[i+1]; /* */ } I just needed to inicialize soma_transmissor and soma_recetor. Now if anyone … Read more

[Solved] While loop runs when false

You might want to check your while condition! Since the conditions are in the negation, you would use AND ( && ) instead of OR (||) to combine them. EDIT: And as pointed out, you ought to be comparing Die1 and Die2 to numbers. If you’d like to keep the characters as is, you could … Read more

[Solved] How do I make my stay in one position while I move the page around [duplicate]

Using the marquee tag is not standard. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee Also I would avoid to wrap a div with a p tag as it’s semantically not correct and are supposed to contain only inline elements. I would separate the styling from the div tag. and do something like this: https://jsfiddle.net/Mehdikit/bs9shwt0/ HTML & CSS .container { position: relative; … Read more

[Solved] How to convert every other character to upper case in a string [closed]

If you want to get the uppercase of a char, you should use Character.toUpperCase(c), not String’s toUpperCase. So, I think you might be looking for something like this: public static void main(String[] args) { String alphabet = “abcdefghijklmnopqrstuvwxyzåäö”; System.out.println(alphabet); StringBuilder sb = new StringBuilder(); for (int i = 0; i < alphabet.length(); i++) { char … Read more

[Solved] Debugging a Biased Coin Flip (C++)

You declared: int FLIP_RESULT = rand() % 2 + 1; at the start of your code. This means that the flip happens only once at the start of the program, regardless of the number of flips the user inputs. Try randoming the FLIP_RESULT as first line of your for loop, and you’ll see it working. … Read more

[Solved] Optimizing thread calls in Java [closed]

Use a loop and an ExecutorService. ExecutorService executor = Executors.newCachedThreadPool(); for (int i = 0; i < count; i++) { executor.execute(new TokenStarter()); } That should recreate your code, but is not optimal. You probably want to limit the amount of threads that run concurrently: ExecutorService executor = Executors.newFixedThreadPool(desiredParallelism); solved Optimizing thread calls in Java [closed]

[Solved] What does the .0 and .1 mean Swift 3.0.1

The .0 in somePoint.0 is accessing the first element (at index 0) of the tuple somePoint. .1 is accessing the second element (at index 1). As others have pointed out, this is covered in the first section of the language guide, “The Basics”. 3 solved What does the .0 and .1 mean Swift 3.0.1

[Solved] I need to convert this function from C# to VB.net – Convert INT to multi character string [closed]

If you’re being LAZY and i mean lazy you can use http://converter.telerik.com/ Here’s the output for you: Public Shared Function getColumnNameFromIndex(column As Integer) As String column -= 1 Dim col As String = Chr(Asc(“A”) + (column Mod 26)) While column >= 26 column = (column \ 26) – 1 col = Chr(Asc(“A”) + (column Mod … Read more