Using JavaFX in a headless Raspbian server - multithreading

Based on this tutorial, I would like to implement a media player website running in a Raspberry Pi connected to an old (but excellent) amplifier/home theather. This means that a servlet (a thread created by a servlet) will play the music and I will control it via Internet.
What I already did and is working? I removed all graphic references (button, panel, etc) from the example and put the resulting code in a thread. When I try to run this on a Tomcat8 in Ubuntu Desktop, everything works fine! But when I try to run it in the Raspberry without GUI, I got the following error:
Exception in thread "Thread-0" java.lang.UnsupportedOperationException: Unable to open DISPLAY
I know where is the error, but I don't know how to fix it. The problem is in the line below:
com.sun.javafx.application.PlatformImpl.startup(()->{});
Without the line above, I got an error stating that to Toolkit was not initialized.
So,
(1) Is it possible to run JavaFX in a servlet?
(2) How to solve this problem?
Thanks!
Alex

Related

External Control Universal Robots With Ros2 Foxy (PYTHON)

I am attempting to control my ur10e COBOT using ros2 but I have run into some issues.
I followed the steps of the ros2 install.
https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
Then I installed MoveIt2 Foxy. https://moveit.picknik.ai/foxy/doc/move_group_interface/move_group_interface_tutorial.html
Then downloaded UR-ros2-driver.
https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/tree/foxy
One of the issues I ran into with the UR-ros2-driver download was since I'm using foxy, I had to download the ros2-control-demos found in this link https://github.com/ros-controls/ros2_control_demos/tree/foxy
And after removing files in the /workspace/install folder I was able to launch the trajectory program and it ran great. The files I removed were...
(controller_manager_msgs)
(diffbot_description)
(hardware_interface)
(joint_limits)
(ros2_control_demo_hardware)
(rrbot_description)
Okay now after I bore you with all my startup steps, now lets get into some code. Once everything was downloaded, I first had to source my files in the terminal...
source /opt/ros/foxy/setup.bash
source ~/workspace/ros_ur_driver/install/setup.bash
Then I launched...
ros2 launch ur_bringup ur_control.launch.py ur_type:=ur10e robot_ip:=yyy.yyy.yyy.yyy use_fake_hardware:=true launch_rviz:=true
Which ran great and I was able to see my COBOT model in rviz2.
Next, in a second terminal, I launched...
ros2 launch ur_bringup test_joint_trajectory_controller.launch.py
And watched while the virtual COBOT moved to the command.
Now, to make a long story short I managed to get the my PC and the COBOT pendent connected by setting up the COBOT's IP address with my PC's IP address. No issue there.
WHERE MY PROBLEM IS
I went to launch the IP adjusted code...
ros2 launch ur_bringup ur_control.launch.py ur_type:=ur10e robot_ip:=192.168.56.2 launch_rviz:=true
And my model was stuck colorless and crunched up. I'm unable to interact with the virtual COBOT at this Error state. I do recall this happening with my fake_test version when I would forget to source it properly before I launched it. So I was thinking maybe I messed up in the way I sourced my files. Or maybe I didn't add the control_demo packages correctly. If someone could give my some pointers on this that'll be greatly appreciated.

Blueprism Application Modeller showing Launch instead of Identify when spying

I am using BluePrism v6.1.0 and I am trying to identify elements from a launched application in Application Modeller. (I used the Windows application type in the modeler configuration)
From some tutorials I saw, the launch button changes to Identify button after the app is launched, however, mine is still showing "Launch". Please see screenshot below
screenshot
You need to launch the application from the application modeller, not on your own.
Since you are using Windows 10, the built in applications are use differently than normal in windows 7. Here is how you can add the code to make it work with your system Screenshot. Also for future applications use this code in Windows Power Shell to get information about the application you wanted to work with in Window 10 : "Get-AppxPackage"
Not fully explained here but this can also mean not only is the app not launched but blueprism can't "see" the app is launched. Two ways to solve this so close the application and relaunch it then it will change to identify, OR you can attach the current instance of the object to the running application.
Either way the outcome is you're making blueprism see the active application so it will change the launch to an identify option.
Edit: watch out as well, if you connect your application to blue prism and then detach it blue prism will no longer see the running application hence will revert the identify option into a launch option.

auto login Linux 16.04

i installed a minimal ISO of Ubuntu on my virtual machine .
after installing i installed these programs :
open-box
lightdm
everything's work fine
but when i want to do the auto login ,i get stuck .
i have read many forms and watched a lot of videos,consequently found ways but none of them works for me
the one that i'm eager to work with is lightdm.conf file :
sudo nano /etc/lightdm/lightdm.conf
in the file first thing i did was to delete the guess and it worked fine
but the rest of the code dose not work at all
[SeatDefaults]
allow-guest=false
autologin-user=saeed
autologin-user-timeout=0
user-session=ubuntu
since i am not using unity i did not write(but i did try the code before) this code:
greeter-session=unity-greeter
saeed is my only user now , however i did try making another and auto login with it but the result was unsatisfying.
it's been around 12 hours of searching and trying ,it seems that everybody are getting the result but i keep getting the login screen
since i am working on embedded device it is crucial to get rid of the login in the main device,
nevertheless i do need the password for SSH connections security .
your help is appreciated in advance
Maybe you can try to leave out the "autologin-user-timeout=0".
I think there is a bug about that in Ubuntu 16.04.
I hope I could help you.

AdroidStudio 2.2.2 Empty Activity Error on phone

I just started learning about Android development, so this one is a serious issue for me: I launch Android Studio (2.2.2, but had the issue since 2.2.1) on Win10, make a New project, just keep clicking Next without changing anything (selecting Empty Activity as the template), Finish, try to Run 'app' on my phone and consistently get this error:
Error while executing: am start -n "com.example.android.myapplication/com.example.android.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.myapplication/.MainActivity }
Error type 3
Error: Activity class {com.example.android.myapplication/com.example.android.myapplication.MainActivity} does not exist.
Error while Launching activity
Being a complete newbie who was just supposed to change some text in XML and run the app on a phone, I have no idea what to do or edit to make a pregenerated app actually work. I searched StackOverflow for a more general approach to these errors and tried:
Restarting AS/computer
Disabling InstantRun
Messing with Clean/Rebuild/Synchronize/Sync with Gradle
Deleting .gradle and .idea folders and Syncing with Gradle
Some other obscure shenanigans with build.gradle and AndroidManifest
Various combinations of the above.
... None of which worked (or affected the problem in any way, in fact).
Other observations:
The app isn't even installed (checked All apps, there isn't any com.example.android.myapplication or MyApplication app on my device)
On the development course forum, it was suggested that com.example.android.myapplication/com.example.android.myapplication.MainActivity should only read com.example.android.myapplication/MainActivity. So far I haven't been able to figure out how to change that.
Update 1 New attempted fixes (neither of which worked):
Specified activity directy in Run/Debug window.
Specified no activity whatsoever (doesn't show that error, but doesn't run anything either).
Did File/Invalidate Caches
Changed android.intent.category.MAIN to all-lowercase and back.
Added "category android:name="android.intent.category.DEFAULT"/" to Manifest
Update 2 Managed to run the app on emulator. It seems to be working there, so the error will likely be somewhere between AS and the phone (Android 5.1.1, API 22).
Developer options and USB debugging are on (confirmed the pop-up message, too)
Driver is up to date (AS can see the phone without problem)
Phone is on (and not asleep) while I'm trying to run the app
Any suggestions why the phone won't download and run the app?
In your manifest file edit
with android:name="com.example.android.myapplication.MainActivity"
Make sure that your code doesn't mean any nonsense and that it wouldn't cause the app to crash, which is sometimes the problem. Try finding a problem in code which could crash the app. Maybe in your crash log you can find what causes the crash. Good luck fixing that.
According with your error log I suppose you did not delete previously installed app. See my accepted answer on the same question for details.

How to make webDriver testsuite created in windows machine to run in a linux box

I have got selenium WebDriver testsuite done using TestNg framework. I have used selenium webDriver 2.44.0 & FF32.
Now my build team wants my test to run in their demo box which is linux machine. 10..*.248 box
What i have done till now. I am not using any other tools like jenkis, maven etc.
Created java project 'myproject' testsuite in ecplise luna using
TestNg frame in my windows machine
Created a runnable Jar for myproject( myproject-version-1.0.1.jar)
Placed the runnable jar in 248 box using winSCP in a folder /home/project/
In 248 machine FF37 is available. So i upgraded my script with selenium 2.45.0 . It runs fine in my windows machine with FF32 version also.
Now using putty i logged into 248 machine and reached the folder /home/project/ where my runnable jar is placed.
I executed the shell command java -jar myproject-version-1.0.1.jar
Console shows the following exception:
[TestNG] Running:
Command line suite
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
I know i have not done correctly. I read few links posted here about about setting display in linux machine , using Xvfb – the X Virtual FrameBuffer.
Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
I think the person who posted the question in above link had done the similar settings. !
Can somebody please help me with this as i am not able to understand :( Step by step process so that i can run my script in build team's machine.
I am very new to this field and doing all this for the first time. I read someting about headless GUI etc. I am not able to understand.
Would really appreciate if you could help me understand the steps involved.
You have done pretty much the right things as specified in the question
One thing that I came to observer that you have not specified complete URL in the get method. This might cause you some trouble. So first edit
driver.get("docs.seleniumhq.org/");
to
driver.get("http://docs.seleniumhq.org/");
If the code still doesn't works. Then try bundling latest selenium-java.jar and selenium-standalone.jar
But from the error it also seems that may be port 7055 is not free. (but I think you already checked that.)
So the problem gets a little bit confined to the selenium jars which are often incompatible if they are of different versions.

Resources