I have pretty heavy project to run locally on my notebook, and it runs on my local server machine. But i want to work with it from my notebook, locally without any screen sharing tool. I've tried to establish sftp connection with server and opened the project with PhpStorm, but it's terrifically slow..
Must say, that loading the files, saving, debugging - rather fast, but search and indexing (MOSTLY INDEXING) very slow. Maybe, is there any phpstorm agent for remote servers, that indexes on host, and sends via network summary data to my local PhpStorm application?
Or, maybe another tool with such remote agent. Like Atom plugins, Sublime.. or whatever?
There are no indexing agents for remote project accessing. It's recommended to work with locally stored project files with JetBrains IDEs.
You need to create 2 copies of source code the project.
One on your workstation, the second on your laptop.
After it, you can write a little script, which would watch your directory on the laptop and copy it to the workstation.
I use chokidar from npm (https://github.com/paulmillr/chokidar)
Code example:
const chokidar = require('chokidar');
var exec = require('child_process').exec;
chokidar.watch('repository', {ignored: /(^|[\/\\])\../}).on('all', (event, path) => {
if (event === 'change') {
console.log(event, path);
exec('scp "' + path + '" "${PATH_TO_WORKSTATION_PROJECT}' + path + '"',
function(err, stdout, stderr) {
if (err) {
console.log(err);
}
console.log(stdout);
});
}
});
Also you would need to configure remote debugging (but it's another topic)
Related
Is there a straightforward way to run Puppeteer on wsl2? I've tried many solutions across the web and read tons of forums looking for answers. So far no success and I've found running Puppeteer very easy in windows but extremely difficult in wsl2.
I've tried downloading chrome and chromium, and specifying the executablePath with no luck.
I know that it works on my windows system, but cannot seem to get Puppeteer to run in wsl2.
I am currently stuck on this error:
Timeout Error: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r1022525 is guaranteed to work.
When looking into node_modules I can see that version 1022525 is in use. I can't understand what Puppeteer's problem is nor how to fix it.
Anyone have any ideas?
As I do not see exactly what are you trying to do , in the moment I can think that this error accused because of your windows defender firewall, which do not allow access of your X-server.
anyway for me I use Puppeteer on wsl2 as following:
I need to install VcXsrc as X-server to display what is going on in the Linux side of the computer. https://sourceforge.net/projects/vcxsrv
notes: you need to allow “Public networks” when the Windows firewall pops up.
You need now to set a DISPLAY environment variable has to be set,becuase wsl has its own IP address, we need to connect to our X-server app using this IP so to do this follow the next steps.
In your .bashrc (or .zshrc if you are using ZSH) add this line exactly to the end:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
now executes the content of your bash use source ~/.bashrc (or source ~/.zshrc if you are using ZSH)
to be sure that your DISPLAY environment variable has set correctly , try this command (echo $DISPLAY) the result should be something like this : # 172.16.210.1:0.0 it will be your wsl IP address.
now Open the VcXsrv program in Windows (called XLaunch), allow this options step after step “Multiple windows” and “Start no client”. and in the end tick the option of disable access control Be sure to disable access control.
as last check go to windows defender firewall and be sure that you enable all network connection for VcXSrv.
now you are ready to go, let suppose I am using puppeteer to test inside jest file like the follwoing :
const puppeteer = require('puppeteer');
test('should create an element...etc', async () => {
const browser = await puppeteer.launch({
headless: false,
args: ['--window-size=1920,1080']
});
const page = await browser.newPage();
await page.goto(
'www.google.com'
);
});
start the last code using (jest nameofyourtestfile) and your puppeteer will work as you like, Chromium will open in your windows ...enjoy...if there is any details which is not clear may you ask again. I hope that I helped
I am unable to show more than one WebView2 control in an application hosted on a network shared folder.
Let me say straight out of the bat that the solutions disused here (including Microsoft article) do not work:
WebView2 Environment Exception (Requested resource is in use)
absolutely do not fix this issue.
The application binaries is hosted on a server, with multiple users launching the application from that single location. Once one user has WebView2 displayed, another user on the network gets the exception.
As you can see in the code snippet, I am creating subfolders for each users session (this has been tested as is working as expected) :
var dataFolder = #"\\someserver\SomeApplicationFolder";
var subfolder = Guid.NewGuid().ToString();
var di = Directory.CreateDirectory(Path.Combine(dataFolder, subfolder))
var fullpath = dataFolder + #"\\" + subfolder;
var env = await CoreWebView2Environment.CreateAsync(userDataFolder: fullpath);
await webView2ReportServer.EnsureCoreWebView2Async(env);
It possible the locks happen on files in the folder "MyApplication.exe.WebView2" which is in the applications binaries folder on the single network share. But I do not want to install the binaries on each individual client's PC as this is bad practice and not desired architecture.
One way i found is to copy the exe file and run each of them on the different computers...
I have the same web application running on 2 different servers. It also runs on 2 different servers. Each of environment have its own database.
The file config.json contains every database informations.
Developement environment: The app.js and database/db.js files, are calling a file getConf which retrieves config.json informations with preprod object.
Production: I update the retrieved object from preprod to prod.
Call:
// Pre-production
var config = require('./database/getConf').preprod
// Production
var config = require('./database/getConf').prod
I would like to do this automatically, which means, to update to production environment, I don't have to update any files. Just a copy paste from the dev but it detect automatically the environment and set the appropriate database.
I tried many modules like nconf, dotconf, and config but they all required to select the environment in the command line before launching the app.
But my 2 apps are running in two different IIS servers in my company and they're launched from IIS and not from the command line.
I hope doing just a copy paste of the hole project folder from thedev to the prod.
According to the documentation, you can find out pretty much every thing you need to know about the system with the module os.
If you're looking for the CPU architecture : os.arch().
If you're looking for which type of OS : os.type().
Hope it can help you ^^.
I have a developed gulp file with both browser-sync and live reload. this gulp file works perfectly for my requirements. for the base idea, I have a root folder in my Apache server and inside it I have my project folders.
--public
---proj1
---proj2
I'm using my gulp file to watch and build project folder and live reload.
currently I'm using browser-sync:
browserSync.init({
proxy: {
target: "localhost/newTest/public", // can be [virtual host, sub-directory, localhost with port]
ws: true // enables websockets
}
});
every changes done inside the 'public' folder, will affect the live reload. if I have opened both projects in two separate windows and do some changes on one project both windows are refreshing(live-reloading). I do not need that to happen. only one window should be live-reloading. how can I do it.
reason:
I want to implement this to server side level for many users, how can I do it? A change from a user should not affect other users.
I create a b.js script file like below. when i run this using node.exe program then it correctly open "word2code.exe" file.
How can i add this script in a .html page (as link or button onclick event) in appjs for windows?
var exec = require('child_process').execFile;
var fun =function(){
console.log("fun() start");
exec('word2code.exe', function(err, data) {
console.log(err)
console.log(data.toString());
});
}
fun();
You cannot run an exe directly on the client side in an HTML page -- the browser cannot understand binaries. Instead, if you basically want to fire off a process like this, you could take another approach:
Build a website that has a button.
This button, when clicked, should make a request to your server on some URL (like /execute).
Write a separate web server process on your windows machine, that runs the web server.
Write a route on your web server that handles /execute requests.
Make this route run your exe file LOCALLY ON YOUR SERVER when the route is executed.
By doing things this way, you're essentially allowing a web user to run an exe indirectly (your server will be the one running the binary, not the user).
Node.js runs on the server. The browser is on the client side. You cannot execute a nodejs app from the browser as the environment does not support nodejs.