How do I edit Laravel app source code when developing in Docker? - laravel

I am trying to develop Laravel app using WSL 2 and Docker. I have followed official Laravel instructions for Windows development (https://laravel.com/docs/9.x/installation#getting-started-on-windows).
in WSL console I run:
curl -s https://laravel.build/example-app | bash
cd example-app
./vendor/bin/sail up
Everything seems to be fine (example-app is running on http://localhost), except I don't know how to do the actual development, i.e. edit the sources to see changes in the app.
I believe I have to somehow 'mount' directory sources from inside WSL/Docker into my Windows file system, but I don't know how.
I don't want to use VSCode (Laravel docs suggest that), I want to use IDE of my choice and access project files in general.

In the end I found out that this problem boils down to accessing WSL file system - Docker/Laravel files are synced automatically from there.
WSL file-system can be accessed through a path that looks something like this:
\\wsl$\Ubuntu\home\your-username\example-app
For some reason this was not visible in the Network section of Windows Explorer. You must type it manually or use the following trick:
Open WSL Linux console and go to the folder with your Laravel app. Then type the following:
explorer.exe .
(notice the dot)
This will open Windows Explorer at your current location and you will be able to copy the path and paste into your IDE.

Related

iFuse to access iPhone files on Windows

Trying to use iFuse to access iPhone files on Windows but not getting anyway. Would appreciate if people can share instructions/steps on how to get this to work?
iFuse to access iPhone files on Ubuntu works well; therefore, I am confident the issue is on Windows.
Using https://github.com/hooby3dfx/ifuse/releases/tag/win-dokany-0.1
Unzip test.zip in the above link
make sure iTune is installed
Install the specified Dokan version; doesn't seem to work with the latest Dokan version
Open a command window in Admin mode to run the command (e.g. ifuse tmnt --container bundle ID)
While the command is still running in the Admin window, open another command window to list the mounted directory

let lldb's working directory be XCode's project directory

When debugging in XCode (8.0), I'd like to have lldb's working directory to be the respective project directory.
What I'd like to achieve is to access project files from processes that I launch in lldb or in .lldbinit, and I'd like to access them without having to type/know the full path.
For example, I'd like to spawn a local web server with php -S localhost:2345 within the project directory, such that - in debugging mode - I can simulate downloading well known files (instead of accessing them through the bundle).
I've also tried to use environment variables, e.g. platform shell -- cd $PROJECT_DIR or similar, yet without success.
Any ideas?
You can use the Python interpreter to change lldb's working directory. For instance:
(lldb) script os.chdir("/tmp/")
(lldb) script os.getcwd()
'/private/tmp'
(lldb) platform shell echo $PWD
/private/tmp
Note, this doesn't change Xcode's working directory since lldb actually runs as a service (lldb-rpc-server) rather than being a library linked directly into Xcode.

Bash on Windows - debug a python file with Visual Code or Visual Studio

I have a python file in my Bash on Windows environment.
Is it possible to debug it with Visual Code or Visual Studio?
Can a debugger be attached to the Linux python version that exists in the Bash on Windows environment?
I think you've got a few options for this. If you're attempting to debug a python file that's saved on your home directory in Bash on Windows, you can navigate to your home directory in Windows by going to "C:\Users\[windows username]\AppData\Local\lxss\home\[ubuntu username]\". Then you can open any of your projects or files saved on your home folder in Ubuntu. You can even make a shortcut on your desktop or something to make it easier to access this folder.
However, if you need the environment that you have on Bash for dependencies or python modules, your other option is to install a GUI and Linux-compatible IDE of your preference on Ubuntu, and use Xming on Windows to run the IDE on your screen. A tutorial on how to do this can be found here.
If you need to debug a linux python program from Visual Studio, a simple Google search yielded this. I haven't tried it but this seems to be the solution you are looking for. For connecting over the network to Bash on Windows from Windows, use localhost for the host.
Your best bet might be to just move the file. Your normal windows system is mounted under /mnt/c.
You can just copy it to your desktop by doing
cp (path to your file) /mnt/c/(your username)/Desktop
When you need to access or edit it from bash, just cd to that location (or wherever else you choose to store it).
Interesting other idea: you could mount cloud storage (e.g. google drive) via fuse in linux then set it up in windows. Copy the python to it and you can edit in windows and access in linux as needed. (Google is your friend here; look into google-drive-ocamlfuse or gdrivefs).
Hope this helps!
jBit
I would suggest making use of the Remote - WSL extension for Visual Studio code. It allows you to easily access your Windows Subsystem for Linux (WSL) and use it as a full-time dev environment.
Here is an article on how to set up Visual Studio Code Remote-WSL.
After that is set up, you can quickly load your python file in the VS Code editor using a command like: code path/to/python_file.py

Meteor Vagrant: Where should the project code files be?

I have successfully configured Meteor on my Windows machine via vagrant along with running the sample app in the browser by following the tutorial given at https://gist.github.com/ahoereth/2607d2ee99103a0a9bc9.
For the last two hours, I have explored all of the Window's directories in search of the code created by meteor create sampleapp command, but I can't find any clue where the code is. As vagrant claims that code is in the Windows directory not the VM box, can anyone give me a hint where it could be hiding?
The directory that's shared with the Windows host is the /vagrant directory. In the VM, the home directory might be different, and won't be visible from Windows.
However, if you want to run the Meteor app from the shared directory, be prepared for a world of pain whenever you install a package that has a : in its name, as Windows won't support that character in the filename, and you'll get a cryptic error in the VM.
Since packages in Meteor 0.9+ regularly have : in their names, developing Meteor apps in the VM/Windows shared directory is a no-go.

Symfony2 and Assetics : symlink on Windows 7?

I'm having a hard time using assetics to load resources in my views (I work with Symfony2).
I was working on Linux (Ubuntu 10.4) and switched to Windows 7 a few days ago. I've always been having trouble (some images didn't load for example), but at least most images, and all styles and scripts were loading alright.
When I switched to Windows, some resources weren't loading, so I tried a php app/console assets:install web --symlink
I was quite surprised to see that it had deleted the whole public folder of the bundle I was working on. And there was no way to find the sources again (fortunately, I had saved some of them, and I was able to retrieve most of my work thanks to cached files).
After I've recovered my files (and backed them up), I tried to command again. Same result. I tried without the --symlink and it created some folders in the web/bundle folder, instead of files that were there before (supposedly, the symlinks).
Now the command doesn't even answer anymore (it has been erasing my sources even in some of my backup folders!!).
Bottom-line : is there a way to configure assetics on Windows 7 so that it doesn't eat my files and loads the resources (including images in css) correctly?
Thanks in advance!
Edit :
I just ran the command again and this time it worked (copied the files in web/bundle/...). I must say I don't really understand how or why it worked this time... If by chance anyone knows...
In order to run assets:install web --symlink on a PC you need an elevated command prompt (fancy word for cmd.exe in Administrator mode).
Symfony2 uses the PHP symlink function, according to the docs it should work for Windows Vista, Server 2008 or greater.
By default only Administrators can create symlinks in Windows. So you'll have to use an elevated prompt or give your user the SeCreateSymbolicLinkPrivilege privilege.
You can do it with windows console, but Git Bash is much nicer. Get it and download. Ps. If you never used git before this is the right time to start. :)
When you installed it search in windows programs for git bash and right click it to run as administrator. If you have Git bash opened from the right click in the current folder "git bash here" it wont work because it is not launched by default in administrator mode. If you done this you get this warning.
app/console assets:install web --symlink
Warnings. Hard copy where used instead of symlinks.
However if you play nice and do it as i said. (run as administrator.. you will get everything work nice and smooth.
app/console assets:install web --symlink
Symlinks where created! :) Now you don't need to assets:install every time you made changes to your css files.
Ps. git bash console is nicer then native windows console but... for example Unix system such as Ubuntu would look even better. Also Symfony on Windows with Xamp will run much slower than on Linux Ubuntu system. I am talking about 5x to 20x faster page response on Linux.
You can use configure the composer.json and use forever without any problems,puting in it --symlink.Here is how you can do it.
http://www.w3docs.com/snippets/symfony/how-to-keep-symlinks-in-web-bundles-after-composer-update.html
You can add this configuration option in your composer.json:
{
"extra": {
"symfony-assets-install" : "symlink",
}
}

Resources