I am creating a on demand web job which launches an executable in a directory off my FTP tree, but I can't find the directory on the cd command or the executable since the cd failed.
My batch file looks like this:
cd exedir\w32
file.exe
Note: I am FTPing all the files up there for this application, so Visual Studio is not involved.
How can I set up this batch file so it runs correctly?
cd %WEBROOT_PATH% got me to the wwwroot directory and from there it was just a matter of ..\;.\ ok now I know where I am good to go.
Related
I am developing a Django project (nothing) and trying to use using WSL2.
so if I use the Ubuntu Terminal from Windows to create a project and try running it in VScode, I got this little message,
I just don't know how to do that at all,
it's the first time I tried to use WSL2 (which is awesome), if someone could help, thank you very much.
If you have your project in some mounted folder -> linux path starting with /mnt/ e.g.
/mnt/c/Users/rasto/Desktop/some_folder/my_project/
When you open VS Code in this directory (via running command code . or opening the VS Code from windows) you get the warning:
This workspace is on the Windows file system (/mnt/). For best performance, we recommend moving the workspace to the Linux file system (~/home).
The solution is easy -> move/copy the project folder to ~/my_project/ directory:
In WSL terminal:
Recursively copy all files from source-path to destination-path and if the folder ~/my_project/ does not exists, it will be created
cp -R /mnt/c/Users/rasto/Desktop/some_folder/my_project/ ~/my_project
Move to the directory in your terminal
cd ~/my_project
And open VS Code from console with
code .
Note: To open VS Code from terminal you must have installe extension Remote Development extension pack
Note2: To access the linux folder from windows file explorer just right click in VS Code explorer and Reveal in explorer or with the path like: \\wsl$\Ubuntu-18.04\home\rasto\my_projects
I am a total newbie to programming and Ubuntu and Swift is my first language to learn.
I am learning with a book but I encountered a problem when I was supposed to build an application. Here is what I had to do:
Make a new directory called PMExample so that's easy mkdir PMExample
and then go to this directory cd PMExample.
Then I had to use ~/swift package init and got 2 directories called Sources and Tests and a file Package.swift.
So in the Sources folder there was one text file and I had to create another one to build an application.
And I did all those steps correctly, but now there is a problem. The book tells me to use swift build command. The book says that this will build the application and if all is well, I will have an executable application in the
PMExample/.build/debug directory named PMExample...
But after ~/swift build while being in the PMExample dir, there isn't any new directory called .build or anything. There are no errors popping up after using that ~/swift build command. Just nothing happens and I can't understand what am I doing wrong.
Thanks in advance.
But after ~/swift build while being in the PMExample dir, there isn't any new directory called .build or anything.
How do you know that? It is likely that you are not seeing the directory because it starts with a dot (it is called .build), therefore it is not shown by default with ls. You have to pass the -a argument to ls, such as in:
ls -a PMExample
Background
Here's the set up:
Multi-developer environment using Subversion
NetBeans 8.0.2
JDK 1.7
Java EE6
JBoss 6.2 EAP running standalone
We may not change the tools; we may use neither Maven nor JRebel. Hardware upgrades are also not in scope.
Code Organisation
The source code, including web-related files, are checked out into:
C:\Apps\07-Work\Project\Project-Admin\Project-Admin-User-war\
This directory includes a common development structure (bold are checked out from the repository):
build - compiled files
dist - .war file
nbproject - project files
src - Java source code
web - JSF pages, WEB-INF directory, CSS files, etc.
build.xml - Ant script
JBoss Installation
The web application server is installed into:
C:\Apps\04-Tools\jboss-eap-6.2
Problem
The develop - deploy - test cycle is painfully slow. It can take upwards of 30 seconds to test a single change to a web page. Here's the current flow:
Edit file in NetBeans.
Save file.
Shift+F11 (Run >> Clean and Build).
Switch to browser tab (http://localhost:9990/console/App.html#deployments).
Click Replace.
Click Choose File.
Select Project-Admin-User-war.war file.
Click Open.
Click Next.
Click Save.
Switch to browser tab (http://localhost:8080/admin/users/).
F5 to reload the page.
The build (step 3) takes about 26 seconds; manual deployment adds to that.
Here's the ideal development cycle:
Change a JSF page in NetBeans (note: this is a file checked out from repository).
Save the JSF page.
Alt+Tab to a browser window.
F5 to reload the page.
It isn't as important to have hot deploy on Java source changes, as code development time tends to take much longer than simple web page layout changes.
Editing the exploded contents would mean developers are no longer editing files checked out from the repository and would therefore incur additional steps, or scripts, or possible loss of work.
Others have suggested the Deploy on save feature, which is disabled:
Another suggestion (as per the screen shot) is to run the application in debug mode, but selecting Debug >> Project (Ctrl+F5) didn't show page updates after changes.
Question
Is hot deploy of JSF pages possible using the given tools and constraints? If so, what are the exact steps required to achieve the ideal development cycle?
Standalone Configuration
The README.txt file shows that it is possible to "live deploy" content:
H) Manual mode only: Live replace portions of currently deployed unzipped content without redeploying:
cp -r target/example.war/foo.html $AS/standalone/deployments/example.war
Where the cp command on Windows translates to:
xcopy /e /s /y src dest
This leads to:
Open a command prompt.
Change directory: cd C:\Apps\04-Tools\jboss-eap-6.2\standalone\deployments
Create skipdeploy to prevent deployment while copying is in progress: type nul >> Project-Admin-User-war.war.skipdeploy
Copy files to create a directory containing the files that have changed:
xcopy /i /y /e /s C:\Apps\07-Work\Project\Project-Admin\Project-Admin-User-war\web Project-Admin-User-war.war
Next:
Delete skipdeploy: rm Project-Admin-User-war.war.skipdeploy
Create dodeploy: type nul >> Project-Admin-User-war.war.dodeploy
Return to the browser.
Press F5 to refresh.
The result is that a resource bundle has gone missing:
Related
Is it possible to deploy an exploded war file (unzipped war) in JBoss AS 7
How can I get JBoss to explode a deployed WAR file?
Jboss step by step set hot deploy
https://jasonmarley.wordpress.com/2014/09/11/how-to-deploy-exploded-archives-jboss-eap-6/
Here is a description of a Ant script change from 2009 found on http://wiki.netbeans.org. Maybe it is useful still.
http://wiki.netbeans.org/TaT_DeployOnBuildUsingJBoss
And another script solution:
How to setup JBoss server with Netbeans?
Overview
Achieving hot deploy using JBoss 6.2 EAP running in standalone mode is accomplished in three parts: configuration, exploding, and hot deployment.
Configuration
Ensure that a deployment scanner is configured as shown:
Ensure the web subsystem and system properties are configured:
Stop JBoss.
Edit %JBOSS_HOME%\standalone\configuration\standalone.xml.
Immediately after </extensions> (before <management>), disable caching:
<system-properties>
<property name="java.net.preferIPv4Stack" value="true"/>
<property name="org.jboss.as.web.deployment.DELETE_WORK_DIR_ONCONTEXTDESTROY" value="true"/>
</system-properties>
Find the web subsystem (e.g., xmlns="urn:jboss:domain:web...).
Append the following element:
<configuration>
<jsp-configuration development="true"/>
</configuration>
Save the file.
Start JBoss.
Exploding
Exploding requires extracting the full contents of a WAR file with contents that will be deployed in the (very near) future.
Clean and build the application (Shift+F11 in NetBeans).
Change to the JBoss standalone deployments directory.
Create a skip deploy file.
Create the WAR directory.
Extract the WAR file.
Delete the skip deploy file.
Create the do deploy file.
This resembles the following (on Windows platforms; substitute paths for %JBOSS_HOME% and %PROJECT_HOME% as required):
cd %JBOSS_HOME%\standalone\deployments
type nul >> Project-Admin-User-war.war.skipdeploy
mkdir Project-Admin-User-war.war
cd Project-Admin-User-war.war
jar -xvf %PROJECT_HOME%\dist\Project-Admin-User-war.war
cd ..
del *skipdeploy
type nul >> Project-Admin-User-war.war.dodeploy
Hot Deployment
Create a batch file that contains the following:
cd %JBOSS_HOME%\standalone\deployments
type nul >> Project-Admin-User-war.war.skipdeploy
xcopy /i /y /e /s %PROJECT_HOME%\web Project-Admin-User-war.war
del *skipdeploy
type nul >> Project-Admin-User-war.war.dodeploy
Web Development
The ideal development cycle has almost been achieved:
Edit file in NetBeans.
Save file.
Run batch file.
Alt+Tab to browser.
F5 to refresh.
Ant has an OnSaveTask that can likely be coerced to run the batch, or even substitute for the batch file completely. Left as an exercise for the reader.
I'm creating a mono app and I've build up a *.deb installer.
In windows I write quite a bit of configuration information into the program data directory. The linux corollary seems to be /var/lib/[appname]. I've figured out how to create the directories as part of the install package, but when the app goes to run I get an excpetion because the app doesn't have write permission.
How do I get my app to have write permission to the /var/lib/[appname] folder? Is that the correct place to put things like a local db for an app?
It seems the only way to do this is via the postinst script file.
You can use that hook to execute a script to chmod the directories to anything you want. You can find the complete documentation for the postinst file here: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#maintscripts
how can I set the working directory for MS Tests projects, like I can do it for normal application projects? My Component that is tested need to access some config files that are also used by other applications. So far I have to copy these files the bin/debug folder of my test project, as these files are expected to be in the working directory.
Is it possible to set a working directory for test projects?
For those who use Visual Studio 2012, if you set the output directory of the test project under Properties|Build|OutputPath then that will become the working directory when you run the tests from Visual Studio (since it is using Vstest.console.exe). If you don't want to have your test dlls, etc output to the same directory as your other files and you don't want to have the other files as content in your test project (as suggested by Schaliasos) then you can set the path on startup in a method that has the [AssemblyInitialize] attribute. You do this by assigning System.Environment.CurrentDirectory as usual. You will probably want to have the working directory as a setting or read from a configuration file.
Edit
As pointed out by Rohit.Net, when you choose Run All Tests the default path would be under TestResults. The same applies when using a runsettings file. The output folder will be the default working directory when you are not using DeploymentItems and: -
You right click the test(s) in Visual Studio and choose to run / debug, or
You run from the command line using vstest.console.exe.
The working directory for test projects is created at the time you start running your tests.
If you run them locally this is created in a folder TestResults inside your project folder. If you run them in remote machines a different folder is created in each test agent in the following path:
C:\Users{userRunsTheTest}\AppData\Local\VSEQT\QTAgent\{GuidForThisRun}
In order your files to be deployed in these folder and have access to them you have to:
Set the Copy to Output Directory = Copy Always
In the test that needs these files set them as DeploymentItems.
Acarlon's suggestion does not work when you select Run All tests from Test Explorer in Visual Studio 2012.
The default path you would get is something like ...\TestResults\Deploy_<YourName>2014-01-13 14_48_20\Out folder.
Because of this there may be possibility that your DB would not be accessible when entity would try to open connection for running entity related Test.
In my case I am using SQL CE which is set as resource file and always compiled and gets itself dropped into the Bin/Debug/Resource folder.