Okay I succeeded in creating a custom Minecraft launcher for my server. Everything is working fine but there is one cool thing i would like to add. I think it would be cool if people can instantly join a server upon launching minecraft. Does anyone know if this is possible to do?
Have you seen:
http://minecraft.gamepedia.com/Minecraft_launcher
Specifically the section called
Command Line usage
MinecraftDev.jar (all systems): java -cp Minecraft.jar net.minecraft.bootstrap.Bootstrap <username> <server:port>.
Beginning with the launcher released with Minecraft 1.6.1, there are
other commands for the launcher. These can be seen by running java
-jar Minecraft.jar -help.
this shows you it is possible to launch minecraft telling it to connect to server. you should check out the -help to see the full list of command line arguments
Related
I am having a serial communication problem on Linux. I am trying to send and receive information between an arduino and the Unity3D engine which uses C# (mono) to open the serial communication. But I suspect that this is an issue with Linux permissions, which is why I post this here.
I already added the user to the dialout group and serial communication is actually working when I compile and run the following C# using mono:
using System.IO.Ports;
sp = new SerialPort("/dev/ttyACM0", 9600);
sp.Open();
However, the same code in Unity3D at runtime tells me:
IOException: No such file or directory
The frustrating thing is that this is actually working on another Linux machine and I am having trouble understanding what the difference could be that is causing it not to work on the other.
Here are some differences on both systems:
The working Linux is Lubuntu 19 with the Unity3D installation inside of /home, which is on the same partition as root. The Unity3D version is 2019.2.
The non-working system is Linux Mint 19.3 with the Unity3D installation also in /home, but this is a different partition from root. The Unity3D version is 2019.3.
The permissions look slightly different too:
crw-rw----+ 1 root dialout 166, 0 mei 1 05:08 /dev/ttyACM0 --> Lubuntu
crw-rw---- 1 root dialout 166, 0 May 1 15:03 /dev/ttyACM0 --> Mint
Also:
getfacl /dev/ttyACM0
gives me the following on Lubuntu:
# file: dev/ttyACM0
# owner: root
# group: dialout
user::rw-
user:myname:rw-
group::rw-
mask::rw-
other::---
and the following on Linux Mint:
# file: dev/ttyACM0
# owner: root
# group: dialout
user::rw-
group::rw-
other::---
Does anyone have any insight into why in one scenario Unity3D can't access /dev/ttyACM0, while in the other one it can? Or any idea's how I might find out?
EDIT:
I played around a bit with the following to check what the program is allowed to read:
string[] fileArray = Directory.GetFiles(#"/dev");
foreach(string s in fileArray)
{
Console.WriteLine(s);
}
And when run inside of Unity3D only a handful of files are recognized, only those with "other" read permissions.
In contrast, when I compile it outside of unity with mono, all the files in /dev are printed.
This confuses me, shouldn't Unity3D also be run with my user ID, and in turn have access to the dialout group permissions?
Unity3D is launched through a launcher application, could this cause it to not be run as my user?
I would double check that the ACM device isnt reconnecting and being given ACM1/2/3 etc instead of 0. I've had the issue that it has timed out, reconnected and the number has incremented, because they are virtual this can happen very quickly and the system doesn't remove the previous devicefile before creating the new one. If you type dmesg into terminal it will show any re connections and what port they got assigned, running sudo dmesg -c will clear the output as it can be quite verbose.
Hope this helps. Hardware can be painful to work with sometimes.
I finally found the culprit. Apparently Unity3D recently changed their launcher (Unity Hub) to a sandbox version using flatpak, and for some reason /dev is blacklisted by default.
To get around this Unity Hub should be launched with the parameter:
--device=all
The entire command to get this to work for me is:
/usr/bin/flatpak run --branch=stable --arch=x86_64 --device=all --command=start-unityhub com.unity.UnityHub
I want to automate a process, which is invoked after a successful build on TFS. The process will RDP to a test server, then call a C# application on that server, and reset IIS on that server. Each step will return the result so whether or not to call next step is based on the previous step.
There are a few obstacles in implementing it. Below is what I want to know if it is possible, and how to code it.
1) Invoking the process via a build on TFS
There is an option in Build definition to invoke automated test. I assume that the process can be invoked by implementing it as a test.
2) RDP to remote server
I found the links below, which might be a solution
Process rdcProcess = new Process();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(#"%SystemRoot%\system32\cmdkey.exe");
rdcProcess.StartInfo.Arguments = "/generic:TERMSRV/192.168.0.217 /user:" + "username" + " /pass:" + "password";
rdcProcess.Start();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(#"%SystemRoot%\system32\mstsc.exe");
rdcProcess.StartInfo.Arguments = "/v " + "192.168.0.217"; // ip or name of computer to connect
rdcProcess.Start();
Run mstsc.exe with specified username and password
Automating remote desktop connection
3) IISReset
I think it should be simply invoke "IISRESET" after RDP, but the problem is that, HOW to captrue the result of running IISRESET.
The tools that might be suitable are:
1) Powershell - I don't know much about Powershell but am willing to learn if required
2) C#
My question is that how to implement it, any code example, and idea would be very much appreciated.
Check my answer here which is somewhat related: Answer
If the user which runs the TFSBuild Service on the build server have enough rights on the test server then you can use psexec or powershell to run your commands remotely. Read the below links:
PSEXEC
PowerShell Remote commands
There is no inbuilt activity/process which can help you run scripts on remote machines in TFS build workflow.
Step 1 for you is to identify how you are going to run scripts on the remote machine, as mentioned above you can either use PSEXEC or Powershell (though running PowerShell on remote computers may be a little more complicated to set up).
Step2, write the actual scripts to do the work, stop services, install MSI etc.
Step3, Edit your current build defintion - create a new custom activity or make use of InvokeProcess activity from within your build definition to invoke the script that you have created in Step 2. InvokeProcess Activity
in most cases you do not need to run iisreset
if you want to upgrade an asp.net application, try to put app_offline.htm in the application folder, it will stop an application and application files will be unlocked
after upgrading an application, it will restart automatically, or you can "touch" web.config to force restart
You might be better using the Lab Build to run the scripts as part of an environment ob the target computer. It can run any powershell against that machine as well as deploy and execute applications....
Question: HOW to capture the result of running IISRESET
I believe the old fashioned way, Hope this is what you are looking for
c:> IISRESET >> C:\temp.log
You can use the above either from CMD or powershell
In the past I have used Psexec to run commands against a remote server and where ever we need to control flow on the result of that command, we simply piped the console out to a shared folder and checked for our success flag.
I am not sure if TFS can run commands in this manner but we implemented it on hudson/jenkins.
This won't answer your question directly but it may offer a better way forward
An Example:
psexec.exe \remoteserver "iisreset > h:\iisreset.log"
Then run a grep or similar against the iisreset.log with your success flag as a condition to run the next step.
I have an .apk package that i want to push it into android emulator and run in emulator and then receive events and debug message to show to user with C# console program.
How should i connect to android emulator for receiving debug message from C# code console?
please help me. Thanks.
This depends on how much detail you want. Do you simply want to view the logcat or get full debug info(like breakpoints and device statistics)?
In the case of the former:
You can use the adb(Android Debug Bridge):
ProcessStartInfo adbStart = new ProcessStartInfo(#"your_path\android-sdk\platform-tools\adb.exe", "-e logcat *:D");
adbStart.UseShellExecute = false;
Process adb = new Process() { StartInfo = adbStart };
adb.Start();
Replace the first parameter in the constructor of adbStart with the path to your adb.exe, found in the platform_tools folder of your Android SDK. The second parameter is console flags. The above code forces the adb to only connect to an emulator using the -e flag and filters to debug messages only using the *:D flag. You should replace the * with a relevant filter for your app(like a package name). Just type adb help in a console for info on the different flags.
Since your program runs in the console, the standard output of the adb SHOULD be directed to your console. If it isn't, use the StreamReader at adb.StandardOutput to read the output of the adb. You can use adb.WaitForExit() to block the thread until adb dies.
In the case of the latter:
The official way to do this is via the Dalvik Debug Monitor(android_sdk\tools\ddms.bat). Since there is no official support for C# in android, the debug monitor is written in Java and so are the libs. I can't find any substitutes, sorry. Java is very similar to C# though, maybe you can jump languages for this particular project?
I would like to create a streaming audio from a Nao to my WPF form.
The only way that i have found is that we can download a recorded sound on Nao over SSH.
But its not a real streaming ...
If anyone has an idea !
Thanks
run this command on your NAO (login via ssh) gst-launch-0.10 pulsesrc ! audioconvert ! vorbisenc ! oggmux ! tcpserversink port=1234
list via VLC: vlc tcp://IP:1234/
You should look at gstreamer that is embedded in the robot. It would be a bit slow, but it'll be real streaming...
For windows:
Download the latest pulseaudio (not the official one) and creat a config.pa file with these two lines:
load-module module-native-protocol-tcp listen=0.0.0.0 auth-anonymous=1
load-module module-waveout
Run pulseaudio on your windows machine first with pulseaudio -F config.pa
On your NAO:
pacmd load-module module-tunnel-sink sink_name=nao server=192.168.1.152
(change this address to your windows one. Also make sure pulseaudio is running on windows otherwise this wont work)
qicli call ALAudioDevice._listOutputs
The previous command will show you the index number of the pulseaudio device you just created. Use this number in the next commands
pacmd set-default-sink 1
qicli call ALAudioDevice._setDefaultOutput 1
Thats it. Now everything comes through your pc speakers. index 0 is NAO's soundcard
For Linux:
Run this on terminal:
pactl load-module module-rtp-recv
On NAO:
pactl load-module module-null-sink sink_name=nao (creates the sink)
qicli call ALAudioDevice._listOutputs (checks the index on sink)
qicli call ALAudioDevice._setDefaultOutput 1
pactl load-module module-rtp-send source=nao.monitor
I find the Linux approach more stable. The TCP one on windows might break after some time.
I have a c# console application that I invoke with a server call in PHP
chdir($filePath);
exec($filePath.$fileName);
This works great, the application is run. The data it is designed to collect is collected and everyone is happy.
Currently I have plans on storing the one time use information on a server or a flat file, but then I noticed that while the console application is running and doing it's magic the page hangs waiting for the application to stop. This intrigued me, and now i'm wondering if there is a way for the application to pass it's data back to the page directly?
Note: I'm running Apache2 on Windows 7
Update:
Ended up using
$runCommand = "D:\\ScanBoyConsole\\ScanBoy_Console.exe COM1 9600 8 1 0 1";
$WshShell = new COM("WScript.Shell");
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;
json_decode($output);
If you mean by "directly" that you want the application's output sent to the client while it's still running you might be interested in passthru().
If you're also the author of the C# application you could skip the console application and expose the functionality in a way accessible via php's COM and .Net module.
The console app should be able to print (using Console.WriteLine), and PHP can take the results of that...
Back in my PHP days, we called scripts all the time (that are nothing but console apps basically) and had the results spit out to the page.
"shell_exec — Execute command via shell and return the complete output
as a string"
http://php.net/manual/en/function.shell-exec.php
[So, the only difference is that you should use shell_exec instead of a regular exec]