hypnos | Ever write little scripts like to do things | Cron Utils library
kandi X-RAY | hypnos Summary
kandi X-RAY | hypnos Summary
Ever write little scripts like to do things on some interval?. Want it to be more like cron? And start repeatedly at specific times?.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Main entry point
- Sleep returns the duration for the given interval .
hypnos Key Features
hypnos Examples and Code Snippets
Community Discussions
Trending Discussions on hypnos
QUESTION
My ant build stopped working sometime recently. I don't know exactly when, since I only do ant builds occasionally in this project. I get the following popup:
The error is only for this project. I can run a build from another project no problem.
The build.xml file can be extremely simple, and still cause the error:
...ANSWER
Answered 2020-Oct-16 at 07:42This seems to be related to the Java used to run the Ant script.
In the run configuration, in the JRE tab, make sure a JRE/JDK is selected (for an existing Ant run configuration it can happen that the previously selected JRE/JDK is lost due to changes in the preferences Java > Installed JREs or when updating Java). If a JRE/JDK is already selected, try another JRE/JDK setting here (if there are VM arguments specify, try it without them, since they might be illegal for the chosen VM).
QUESTION
Background:
I am writing a cross platform audio player in Java. On Linux, I am distributing it in the form of an appimage (https://appimage.org/). I am using VLC/VLCJ as the decoding engine.
The basic guideline for appimages is to include all necessary libraries with the appimage which can't be reasonably expected to be included by default with the distribution. This is done so the user isn't required to resolve dependencies and/or wrestle with versioning differences between libraries and programs. They also recommend testing against the previous version of a handful of Linux distributions to confirm everything works.
Ubuntu 16.04 and Fedora 27.16 do not install libvlc by default. I'm sure this is common for many other distributions. Accordingly, I would like to package libvlc libraries in my appimage.
Issue:
On Linux, I am not able to get vlcj to recognize/find libvlc.so
and libvlccore.so
unless they are installed through the distribution.
Setup:
I installed VLC through my distribution and my program runs and works properly.
I copied
libvlc.so
,libvlccore.so
, and other associated libraries from their default location in my distribution to a folder within my project.I added that folder to the Native Library Search path (see code below).
I uninstalled VLC.
I tried to run my program. It crashes with the error pasted below.
Note: I used this same basic method for Windows, and it works perfectly there.
Simplified Code:
...ANSWER
Answered 2018-Aug-08 at 16:52I'll bet the distro's version of the native lib has been built with hard-coded paths, possibly absolute paths. Unfortunately, it is not uncommon for libraries to be written to require these -- they're usually passed as flags into the ./configure script or makefile or whatever at build-time. The only fix is to build the lib yourself, or install parallel symlinks/hardlinks, in the distro's lib's expected system dirs, on the target system, to point to your libs. Or execute under chroot, but that is an extreme option that is probably impractical for you.
QUESTION
I have written a Java program that targets from Windows Vista to Windows 10.
The program runs on an embedded java runtime environment so the user doesn't have to fiddle with installing Java to get it to work. The goal for this project is the user experience to be download -> run a single installer -> run program and have it feel native. No other steps required by user.
In order to accomplish this goal, I needed to write a native executable in C++ that invokes the JVM directly (rather than by calling java.exe) so the windows takbar feature pinning works right -- if I use an executable wrapper like launch4j to pass execution off to java.exe at any point, then pinning doesn't work the way it's supposed to. My own executable needs to stay the running program for the duration in order for pinning to work right.
I have written a native launcher C++ program that uses JNI to invoke the Java Virtual Machine through jvm.dll
instead of java.exe
and it works. It is a 100 line shim (code at bottom of this post). It only imports windows.h
and uses the following features: HINSTANCE
, GetProcAddress
, WinMain
. It explicitly links against the embedded jvm.dll
during runtime.
However, if I compile this shim using Visual Studio 2017, the resultant executable depends on the user having installed Visual C++ 2015 Redistributable. If they do not, the program gives the error ""can't start because VCRUNTIME140.dll is missing from your computer".
I have tried compiling this program using the /MT flag and also by selecting "Use MFC in a Static Library" in Visual Studio's General Project Property page. It did not make a difference; I get the same error regardless.
Although many users on Windows Vista / Windows 7 will already have the runtimes installed, some may not, and my priority for this project is a smooth, error-free user experience from download through install to run.
I have no problem bundling additional dlls with my project. I have no problem compiling with MinGW or Cygwin if that makes more sense. The only thing I want is some guaranteed path to download -> install -> run
for any version of Windows from Vista to Windows 10.
How do I create an executable that stands alone or can be distributed along with a handful of dlls such that it is self-contained on Vista and newer version of Windows?
Minimum Complete Verifiable Example: You can download a zip or do everything manually yourself via the following steps:
Step 1 - Initialize: Create a folder josh-problem
.
Step 2 - Download JRE: Download the Windows 64 bit zip of Java 11 and put it josh-problem/jre
such that the contents of josh-problem/jre
are the java folders named lib
, legal
, jmods
, include
, conf
, bin
, etc.
Step 3 - Setup Java Program: Createjosh-problem/src/net/joshuad/test/Main.java
. Make its contents:
ANSWER
Answered 2018-Dec-05 at 08:02You don't need to target a specific SDK, just change "c++", "code generation", "runtime library" to "multi-threaded" or "multi-threaded debug" to statically link to the visual studio runtimes. This will make your application bigger but it will only depend on Windows DLLs.
QUESTION
I have a bash script that launches my program using an embedded JRE. This script works:
...ANSWER
Answered 2018-Nov-26 at 15:08This
QUESTION
I have written a music player in Java/JavaFX that (among other things) watches the user's music library folder for any changes and updates the program's library data if there is a change on the filesystem.
I accomplish this with a SimpleFileVisitor and a WatchService. The SimpleFileVisitor
recurively walks through the target folder heirarchy, and registers each folder with the WatchService
. Full code below.
On my Ubuntu 18.04, if I try to register a number of folders that each have a lot of subfolders in this way, I eventually get the error java.io.IOException: User limit of inotify watches reached
.
It turns out that the Linux kernel limits the number of inotify watches that can be done in the file /proc/sys/fs/inotify/max_user_watches
. The common default is 8192. This limit is for every program run by the user, and there are other popular programs which use a lot, like DropBox.
My library potentially wants a lot as well. For the sort of user who might use this program, 1000 - 25000 folders that want to be watched is a reasonable estimate. I would expect most users to fall in the 2000 - 5000 range.
A solution is to notify the users of the error and tell them to increase the max_user_watches
number in the kernel, which can be done, but I don't like putting that burden on the user if it can be avoided.
Is there another good way to be notified of changes in a folder hierarchy in java without overloading the inotify number on Linux?
My full watcher code can be found here, starting on line 545: https://github.com/JoshuaD84/HypnosMusicPlayer/blob/55da2819a3862d5c2a14797a9ce45e9171f7076e/src/net/joshuad/hypnos/Library.java#L545
You can also see the main walker code here:
...ANSWER
Answered 2018-Nov-18 at 09:39Your approach is the correct one, and inotify
is the most performant way to do this. If you run into this issue, you could just prompt the user to increase limit on their behalf to provide a better user experience (you have to perform a privilege escalation by asking for password for this).
QUESTION
I wrote a custom TableColumn width resize policy. You can see its code under Java
8 / JavaFX 8 here on github. As you can see, in the method distributeSpaceRatio()
and other places, it depends on TableColumn.impl_setWidth()
to set the width of the columns to the desired value after doing our calculations.
I am migrating my project to Java 11 / JavaFX 11 and the method impl_setWidth()
has been removed from public view.
Is there another method to tell a table column to set its width? I'm open to any solution as long as it is reliable and sets the with to (or close to) the requested value.
Here are two ideas I've tried so far that didn't work:
Attempt 1:
This one gives NoMethodFoundException:
...ANSWER
Answered 2018-Nov-12 at 05:40Based on testing and the help of others, I found this solution:
QUESTION
I have a table whose rows are filtered based on a text input.
I recently put the predicate in a delayed system (full code below) to avoid freezing the UI while the large dataset is filtered.
I can generate the following exception by spamming the filter input text box right as the program launches. As you will see, the entire exception takes place within Oracle's code base. I don't see any of my project's classes on the stacktrace.
...ANSWER
Answered 2018-Jan-08 at 07:29This is definitely concurrency issue.
The TableView
is trying to render during a render pulse, and the backing list is changing when this is happening. NullPointerException
is being thrown because the Element
object holding the actual element has "mysteriously" disappeared.
Relying on sleep time is a very bad idea - I'm sure you have realized that as well. There are two main methods to solve this:
Modifying UI on the UI thread (i.e. JavaFX Application thread)You can do the same, except that you would wrap the filteredList.setPredicate()
call in Platform.runLater()
.
In other words, it should look like this:
QUESTION
I am trying to write a custom resize policy that acts like TableView.CONSTRAINED_RESIZE_POLICY
in that it set the total width of all visible to columns to the total available width in the table, so that the horizontal scroll bar never appears.
I am using the line double widthAvailable = table.getWidth() - getScrollbarWidth(table);
to try do to this (see full code below).
Unfortunately, this calculation seems to return 4
too many. My guess is that there is some other thing I am also supposed to be subtracting from the table width that I am missing, which happens to be 4 pixels wide in the default JavaFX theme.
Here is a complete program demonstrating the problem:
...ANSWER
Answered 2017-Dec-18 at 00:12Scenic View is a useful tool to get acquainted with. It gives you many details about the scene graph. The space you are looking for is clipped-container
:
Note that setting a CustomResizePolicy
the way you did effectively does not allow columns to be resized as they are always allocated an equal share of available space.
Here is the calculation you are probably looking for:
QUESTION
I have a program that writes its settings and data out to disk every so often (15 seconds or so).
If the program is running and the computer is shut off abruptly -- for example, with the power being cut at the wall -- somehow all of my data files on disk are changed to empty files.
Here is my code, which I thought I designed to protect against this failure, but based on testing the failure still exists:
SaveAllData -- Called every so often, and also when JavaFX.Application.stop() is called.
...ANSWER
Answered 2017-Nov-09 at 16:50Adding StandardCopyOption.ATOMIC_MOVE
to the Files.move()
call solves the problem:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hypnos
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page