Task Manager Like App using Java Swing - swing

I want to how know how to set about writing a monitoring app such as Windows task manager using Java Swing. The main feature I am concerned with is the grid with a graph which get drawn with time. What are the features that I need to accomplish this? (e.g.: Java2D etc).

JFreeChart can handle the graphing, as shown in the demo, but you'll have to use ProcessBuilder to query the host operating system for its notion of task.
Addendum: For an example, see the Memory Usage tab of the demo.

Related

Out-out-process WinRT component + runFullTrust?

I'm working on a UWP app (C++/WinRT) that must communicate extensively with a background process. Unfortunately, the background process must remain a full trust "Win32" process. Both are packaged in an MSIX.
For performance and programmability reasons, my first choice would be to turn the background process into an out-of-process WinRT component. App Services is a possibility but not ideal.
I've found numerous code samples for creating an OOP WinRT component via WRL. However, activation is performed via CoreApplication::RunWithActivationFactories(), which (as far as I know) requires an AppContainer.
I know I can consume a WinRT component in a Win32 process. Can I create one? If so, what would activation look like in C++/WinRT?
Yes, from the Windows 10 Version 1903, May 2019 Update, the windows have added support for non-packaged desktop apps to make use of user-defined (3rd party) Windows Runtime (WinRT) Components, which means that we can consume a Winrt component from the Win32 process directly. To successfully reference a C++ Windows Runtime component from a Win32 app, you need to use C++/WinRT to generate projection header files of your component. You can then include these header files in your app code to call your component.
For the detailed information, please refer to this article:
https://blogs.windows.com/windowsdeveloper/2019/04/30/enhancing-non-packaged-desktop-apps-using-windows-runtime-components/.
For the detailed sample, please refer to here:
https://github.com/microsoft/RegFree_WinRT/tree/master/Cpp.
Thanks.

call Win32 API in flex to set Window Display Affinity

I have created a Flex Desktop Application with Adobe Air.
I need to protect the application from being captured. By changing the window display affinity of the application, the application can be protected from being captured.
How to use win API in flex?
Is there any other way to protect the window from being captured?
First you have to make sure that the main window does not have the WS_EX_LAYERED Windows style. That style makes SetWindowDisplayAffinity fails with code 8 (ERROR_NOT_ENOUGH_MEMORY), at least on my machine (Seven Pro 64 bits). In your -app.xml file, set the value to false for the node <transparent> under <initialWindow>.
Second, you have to choose how to inject a regular C DLL in the application process, as the API will fail with error 5 (ERROR_ACCESS_DENIED) if you try to change the affinity of a window not living in the caller process.
One possible injection method is using the SetWindowsHookEx API. Google will give you many hits about that one. Feel free to ask for some details. You obviously needs cooperation of another process, here (and some Win32 APIs practice).
Another possible way is coding an 'ACTIONSCRIPT® Extensions for ADOBE® AIR®' (PDF).
The later seems preferable:
No collaboration from an external process needed.
Adobe AIR does the DLL loading for you.
C/C++ code much more simple.
I used the first technique, as I am more fluent in raw Win32 APIs about DLL, than I am with AIR and Action Script...
I successfully tested that first technique with a very simple "Hello World" AIR Desktop application, and get a nice "All Black" image after Print Screen.

MVVMCross View blocked by sqlite call

I am trying to build a fairly simple sqlite database based mobile app using mvvmcross and Portable class libraries. The database I have running is fairly large so querying it takes enough time where I don't want the UI to get blocked while running queries.
The way I currently have it set up is in a few classes based on the mvvmcross n+1 tutorials n=10 tutorial. I have two services that manage the look-ups for the two entities.
How can I perform these database calls on a separate thread and have the view be updated when completed. I assume that this capability exists within mvvmcross I just haven't been able to track down the documentation or any tutorials on it specifically.
Any help pointing me to the right direction would be much appreciated.
Thanks,
JH
Portable class libraries do give you access to the ThreadPool - so you could use that to marshall the work onto a background thread? http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem.aspx
Alternatively, if you have a setup/configuration which allows the TPL to be used in your library, then you could use the TaskFactory or async and await to provide some background threading - this is probably the better long-term route, but getting this setup and working initially may take longer as Xamarin's async support is very new and it's PCL support is changing.

Using an IDE to develop OpenSplice DDS applications

I keep trying to configure Open Splice on the Eclipse platform but I'm not making any progress. I use the Open Splice DDS in the Java Standalone mode. The Eclipse platform I work on is the Eclipse edition for Java EE developers (Helios).
The problem is: when I try to create a run configuration I need to select an application type from the left hand side menu. It seems that none of the available application types can be used to create a working run configuration for a batch file. I want to be able to start, stop, and open splice from inside Eclipse as well as to run the preprocessor and my applications without having to use a cmd console. I'm new to both Eclipse and OpenSplice and any help would be really important to me.
Thanks in advance.
If you are developing Java applications can now use OpenSplice Mobile which is a pure Java DDS implementation for j2se and Android.
OpenSplice Mobile comes with a mvn build system that can be easily used to create eclipse project (or simply imported into eclipse or IntelliJ).
You can find some examples at:
https://github.com/kydos/mobile-dds-demo
And get OpenSplice Mobile at:
http://www.prismtech.com/opensplice/software-downloads
A+
The problem is: when I try to create a run configuration I need to
select an application type from the left hand side menu. It seems that
none of the available application types can be used to create a
working run configuration for a batch file.
This explanation assumes you are in the Java perspective. Other perspectives will be very similar or the same.
Do not use the Run Configurations dialog box. In stead, select Run in the menu, which will show External Tools as its bottom item, which has a sub-item External Tools Configurations.... Clicking that will display a dialog box showing a list of possible configuration types on the left-hand side. Select the type Program, followed by clicking the New Launch Configuration icon on the top-left of your list. On the right-hand side, a number of edit boxes will appear allowing you to change the name of this launch configuration (which you can set to something like ospl start) set the launch command (like ospl.bat to be selected via Browse...), its arguments (like start) and several others like working directory and environment variables.
Click apply when done. From now on, the ospl start command can be run via the Run menu item, External Tools and then ospl start. Make this a favorite so it will be moved up in the menu to decrease the number of clicks.
The process can be repeated for any number of applications you want to start.

Using graphs generated my Munin in a Swing application

I'm able to generate a usage statistics graph in my browser for a particular PC using Munin. The problem is that I want to use the graphs in a Swing application where the graphs will be displayed. Is there any way to do so? What are the other options available to generate the same graphs on Swing? Do I have to manually generate the readings and plot the graph accordingly?
As Munin is written in perl, it should possible to use ProcessBuilder to evoke the desired graph. A related example is seen here.
Alternatively, it may be possible to install Munin locally and fetch the image as suggested in this example.