How do you keep the machine awake?

I use this code to keep my workstation from locking. It’s currently only set to move the mouse once every minute, you could easily adjust it though. It’s a hack, not an elegant solution. import java.awt.*; import java.util.*; public class Hal{ public static void main(String[] args) throws Exception{ Robot hal = new Robot(); Random random … Read more

Check gcc minor in cmake

Use if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.2) as mentioned by onqtam. This obsolete answer was back from the 2.6 CMake days. You could run gcc -dumpversion and parse the output. Here is one way to do that: if (CMAKE_COMPILER_IS_GNUCC) execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) string(REGEX MATCHALL “[0-9]+” GCC_VERSION_COMPONENTS ${GCC_VERSION}) list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) message(STATUS … Read more

Create cross platform Java SWT Application

I’ve just run into the same problem. I haven’t tried it yet, but I plan to include versions of swt.jar for all platforms and load the correct one dynamically in the start of the main method. UPDATE: It worked. build.xml includes all jars: <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_macosx_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_win32_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x64.jar”/> … Read more

tech