How to install sudo and mpicc in windows? - c#

I want to run a mpicc code written in C#. But to run the same I'll have to install sudo apt install mpich and to do that I need sudo command in windows cmd window. I tried using git bash and installed gsudo but didn't work. Is there any other way to run my file?
Commands to use to run my file:
mpicc p_mpi.c -o p_mpi
mpirun -np 4 ./p_mpi
Commands I used before using the above and failed:
sudo apt install mpich
winget install gsudo
gsudo apt install mpich

sudo is a linux command for running a program as administrator. It can not be used in windows.
If you are using windows but need to use linux only programs i sugest trying out wsl.
apt is also a program that does not work in windows. It is a program used for installing and updating programs in debian based linux distributions.

Related

How can one dockerize a Terminal Gui application to run on Linux

I have created a terminal app in C# .NET 6 using Terminal Gui. I have dockerized it
but for some reason every time i run the container it keeps exiting with 139, after looking at the logs it initially mentioned that it was missing libncursew.so.5/6 then i added apk add ncurses but after that now I'm getting that same 139 exit code but no additional detail in the logs.
Has anyone dockerized a Terminal.Gui app?
Thanks in advance
From you question I assumed that you are trying to dockerize Terminal.Gui on an alpine based container (you've mentioned an apk package manager).
Here is an example of dockerizing Terminal.Gui template app on an alpine linux image:
Create a template terminal gui app:
dotnet new --install Terminal.Gui.templates
dotnet new tui -n myproj
cd myproj
dotnet run
Publish it, so we'll be able to use it in a container:
dotnet publish -c Release -r linux-musl-x64 --self-contained
-r stands for run runtime, this is important since we'll be publishing our binaries on another OS, just to keep things working. This is a must for alpine linux, otherwise it won't work.
--self-contained means that we won't need to install dotnet framework on a machine where app will run
Create a dockerfile:
FROM alpine:latest
RUN apk add --no-cache ncurses musl-dev gcc icu bash
WORKDIR /app
COPY ./bin/Release/net6.0/linux-musl-x64/publish/ /app
CMD bash -c /app/myproj
ncurses, musl-dev, gcc, icu and bash are requirements of terminal.gui lib, I found it out via trial and error. Probably part of this is an overkill and you won't need to install full packages, just a little subset of libraries that come with those packages.
published app copied under /app folder in a container.
Build an image:
docker build -t tuiapp .
Create and run container:
docker run --tty --interactive --env TERM tuiapp
--tty this is a terminal gui app, have to instruct docker to assigne a pseudo tty
--interactive otherwise controls won't work
--env TERM have to pass TERM variable of a shell that invokes docker run. If your environment doesn't have TERM env variable set (like in windows terminal for example) you can set it explicitly, like this: ```--env TERM=xterm-256color``, tested it on windows terminal as well.
It should work, tested it on a ubuntu wsl, with tmux and without + tested it on a windows terminal from cmd.

Copy file from linux to windows share with C# (.NET core)

I'm using .NET core for an application running on a Linux machine (a docker container, to be exact)
How can I copy a binary file from there to a windows network share (including username & password)?
All solutions I've found were windows specific, but nothing related to Linux.
How about by using CIFS from Samba to mount the share. Once you've installed cifs-utils, you could try something like:
mkdir ~/localMountPoint
mount -t cifs //server/share ~/localMountPoint -o user=myname,pass=mypassword
There's a more in depth tutorial here: https://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/
apt-get update && apt-get install smbclient -y
smbclient //IPADDRESS/shared -c 'put myfile.txt' -U mydomain/username%password -m SMB2
Using P/Invoke

How to programmatically install "Feature update to Windows 10, version 1607"

I have a Windows 10 desktop machine and I want to install "Feature update to Windows 10, version 1607".
I have managed to use PowerShell modules like https://www.petri.com/manage-windows-updates-with-powershell-module here to automate installation of the KBs.
The above mentioned module is also listed as KB3012973 but installing it via the below commands doesn't install it.
Set-ExecutionPolicy Unrestricted
Import-Module PSWindowsUpdate
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false
Get-WUInstall -MicrosoftUpdate -AcceptAll -AutoReboot
It appears that this KB is in fact an ISO.
Can any one please help?

Windows Service Installation using Command Prompt

The only way to install windows-service I know is using "Visual Studio 2010 Command Prompt", Is there a way to install windows-service on a machine which isn't having Visual Studio installed (assume that .Net version 4.X is installed)?
Call to SDK Command prompt, follow
Start>All Programs>Microsoft .NET Framework SDK v2.0>SDK Command prompt
Type in the SDK command prompt
installutil C:\MyWebServiceApp\bin\Debug\MyService.exe
this is your application's .exe path.
Now your Windows service has successfully installed with Windows Environment.
To start that, go to
Start>Run type services.msc and run it.
In this services window, find your Windows Service and Write Click on it and select Properties. Set Startup type as Automatic or Manual.
Now restart you machine and find your Windows Service by Task Manager. It will display in task manager under running services.
Reference here
Try installutil <Path of the Service>
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
you can use batch file and call it from your installer or application
For Installation
#ECHO OFF
REM The following directory is for .NET 4.0
set DOTNETFX4=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319
set PATH=%PATH%;%DOTNETFX4%
echo Installing WindowsService...
echo ---------------------------------------------------
InstallUtil /i YouServiceName.exe
echo ---------------------------------------------------
echo Done.
For Uninstall
#ECHO OFF
REM The following directory is for .NET 4.0
set DOTNETFX4=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319
set PATH=%PATH%;%DOTNETFX4%
echo Installing WindowsService...
echo ---------------------------------------------------
InstallUtil /u YouServiceName.exe
echo ---------------------------------------------------
echo Done.

How can I repair .NET Framework 4.0 on Windows 8?

While trying debug my real problem, I'm trying to repair the .NET framework, because it looks like something in System.Data.SqlClient is hosed. But you can't uninstall this because it's part of the OS in Windows8, and you can't install it because it's already installed, and so I can't find any way to fix my problem. I suppose I could reinstall the whole OS, but that's way too painful.
To Repair corrupted Windows files in Windows 8, open a command prompt with admin rights and run this DISM command:
DISM /Online /Cleanup-Image /RestoreHealth
This downloads the clean files and installs them correctly.

Categories

Resources