RubyMine on Windows with rails code on OS X server - ruby-on-rails

This is a weird question, so bear with me while I try to explain it properly.
I have a Ruby on Rails app running on Heroku, with source code on Git. In my home, I have a Mac small laptop, and a Windows 7 Desktop PC.
What I want is to be able to work the code on RubyMine on my Windows machine. Because of many many shenanigans, working on Windows and then uploading to heroku just doesn't work.
Instead, I would like to download my code on my Mac, open it somehow from Windows (on LAN), and be able to run it on the Mac (from RubyMine on Windows), and open it in a browser from Windows.
I've been trying for several weeks now. Have anyone done this before? I know it sounds bizarre, but I really wish to work on my 3 monitors Windows setup.

You can let RubyMine use an SDK over SSH.
go to: File => Settings
select: Languages & Frameworks => Ruby SDK and gems
click the add icon (plus symbol)
choose: New remote...
select: SSH Credentials
fill in the host, username, password and path
After adding the remote SDK make sure it is selected as your project SDK.
edit
As #GujMil pointed out in the comments below, when running the application the Windows path is send as parameter to the Ruby SDK. After some fiddling I found that you can map the local path to the remote path in the SDK Configuration or Run/Debug Configurations.
go back to the SDK configuration (step 1 & 2 previous list)
click the Edit Path Mappings icon for your remote Ruby SDK (img)
add your path maps
For me the following was enough (using Linux instead of OS X):
+----------------+-------------+
| Local path | Remote path |
+----------------+-------------+
| //192.168.0.96 | /home |
+----------------+-------------+
For further info see: https://www.jetbrains.com/help/ruby/configuring-remote-interpreters-via-ssh.html

If your question sounds bizarre, so does my answer. I have experimented a similar setup with Linux servers.
Set up a shared folder to host the code on the Mac: Apple
instructions here
Access the folder over your LAN and edit the code in RubyMine.
Open an SSH terminal to your Mac so that you can remotely run the
Rails server, run necessary commands and view the logs (easy with
your multi-monitor setup)
Note: RubyMine will likely complain about missing gems.

Related

Error "LoadLibrary failed with error 126: The module could not be found" when launching Spyder IDE through VPN

Here's what happens:
Using a Macbook Pro, I use the Microsoft Remote Desktop Connection application to connect to my work computer, which is a Windows 10 machine
If I try to launch Spyder on my work computer, I get this error:
Load Library Error
However:
If I am at my work computer (i.e. physically at work instead of logging in remotely), I can launch Spyder successfully
If I leave Spyder open on my work computer, then go home and do a remote log-in to my work computer, I can use Spyder without issue. The problem/error described above arises only if I try to open Spyder through the remote connection.
This error only seems to affect Spyder and I can use all other programs without issue through a remote connection. As a workaround I've been using other IDEs and successfully running scripts, but I strongly prefer Spyder.
What I have tried so far (without success):
The 4 troubleshooting steps posted by Fazil M. to this Microsoft thread
Uninstalling/reinstalling Spyder using Conda
Restarting my work computer
System Information:
Work Computer OS: Windows 10, 64-bit
OS of computer through which I'm logging in to work computer: Mac OS X El Capitan 10.11.6
Spyder version: 4.1.1
Any thoughts as to what could be going on?
Update--More information and trials:
I checked out Issue #3736 on Spyder's GitHub. It says to download and add a file called opengl32sw.dll to the folder ~\Lib\site-packages\PyQt5\Qt\bin. But when I go to the PyQt5 folder, I do not see a subfolder for Qt. I tried placing it into the PyQt5 main folder, but that did not fix the problem.
I've heard this can be a graphics card issue too. On my machine I have two graphics cards: AMD RadeonT R5 430 and Intel(R) HD Graphics 630.
Darren's answer did not work for me. What did work was to:
First option: go into the device manager and disable the Intel HD Graphics card under "display adapters."
Second option:
run "Gpedit.msc"
navigate to Computer Configuration->Administrative
Templates->Windows Components->Remote Desktop Services->Remote
Desktop Session Host->Remote Session Environment
Disable "use WDDM graphics display driver for remote desktop
connections"
Restart the computer
See https://answers.microsoft.com/en-us/windows/forum/all/windows-10-1903-may-update-black-screen-with/23c8a740-0c79-4042-851e-9d98d0efb539
It took help from my organization's IT contractor, but I fixed the issue by doing the following:
Run a file called "gpedit.msc", which will open up a window for Local Group Policy Editor
In the tree menu on the left, navigate to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment, and open the Remote Session Environment folder (not the subfolder within it)
Make sure the following are set to "Enabled":
"Use hardware graphics adapters for all Remote Desktop Services"
"Prioritize H.265/AVC444 graphics mode for Remote Desktop Connections"
"Configure H.264/AVC hardware encoding for Remote Desktop Connections"
Then restart the computer.
Since I was unable to get pass LoadLibrary 126 error using the solutions provided online and on here, I stepped back and realized the obvious workaround. The errors occurs when you open the program while you're using a remote session, right? The obvious solution is to launch the program while a remote session is not in progress. To do this while you're remoting, you should create a batch script to launch the program but make sure to include to a time delay before that (I used 'timeout 10 /nobreak' to do so). Run the batch script and, before your program launchs, disconnect from RDP. After enough time passes for the program to launch, you can reconnect to RDP and your program will be up and ready

Wampserver not changing the PHP version for WEB (not CLI)

I have WampServer Version 3.1.4 64bit installed on Windows 7 and it comes with PHP versions php5.6.38, php7.0.32, php7.1.22, and php7.2.10. I would like to use php5.6.x rather than php7.x.
So, when I switch from php7.2.10 to php5.6.38 from the server tray icon; it does not update the actual php version which is shown by phpinfo().
On localhost, it still says:
PHP Version: 7.2.10
However, it is updated on CLI side. This is tested with running this in the cmd:
php -v
The result is :
c:\wamp64\bin\apache\apache2.4.35\bin>php -v
PHP 5.6.38 (cli) (built: Sep 13 2018 12:45:08)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
After restarting WAMP services, and re opening the terminal, and restarting computer, it still not updated through phpinfo. It probably related the php version used by Apache service. How can I change this to 5.6.x
Any suggestions ?
Many thanks
Note : The issue is not related with changing php cli version as it was pointed here. I do not understand why some of them insist that this is potential duplication without reading the post carefully.
I have faced kind of similar issue, I have installed wampserver upgrades from https://wampserver.aviatechno.net/?lang=en. I needed php 7.3 and 7.4, after installing the php upgrades, those new versions were not being reflected in wampserver traymenu (left click on wamp icon->php-versions). After spending quite some time looking into this, finally could fix this by following steps :
Clearing logs (right click on wampserver icon -> tools -> empty logs)
[my php log file was 300+ MB].
Restarted wampserver and it was good to go.
I found solution from this thread http://forum.wampserver.com/read.php?2,159184
(TL:DR) Use left click -(instead of right click)- menu to change PHP versions.
(Long explanation)
Hi, this happened to me today. I was trying to change the php version from 7.2 to 5.6 to test something. However, Wampserver was not changing the web version of php. After much searching in the web and noticing in certain videos that some people were getting a different menu than me in the wamp server icon, I realised that there is a whole left click menu in wampserver in which you can change the php version and it does change the web version of php.
I understand that this can be a bit confusing for people who are used to using wampserver, but for someone who is using it for the first time, we are not used to having a left click menu in the bottom right icons. I hope this saves some time for others who have a similar issue than mine.
The wampmanager->Tools->Change PHP CLI Version menu only changes the version of PHP that will be used by wampmanager.exe to run all the PHP scripts that provide all the functionality of WAMPServer.
It has no effect on the version of PHP that will will be run from the command line in Windows.
If when you open a command windows and run the PHP interpreter >php.exe you actually get to the PHP interpreter, then you must have added one of the possible paths to one of WAMPServers PHP folders to the Window's PATH. You should never do this with WAMPServer, so if this is what you did, UNDO IT! This is for obvious reasons as you could have multiple versions of PHP available and want to run any one of them at any time as the CLI Version to test some code against multiple versions of PHP.
Instead create yourself a little batch/cmd file that accepts a php version as a parameter like in this answer I posted a while ago
With that you can set the PATH temporarily for the life of a command window ONLY. You can also make it include a PATH to the PEAR and/or COMPOSER folders at the same time, if you use either of these.
To check All VC Runtimes
There is a tool for checking if you have all the possible required VC Runtimes installed. Go to this page, the backup repo for WAMPServer, and download the little utility called Checks VC++ packages installed you will find it down near the bottom of the page. Download and run it, then throw it away, as it changes over time as new VC Runtimes become required.

How do I access Linux binaries from Windows when using WSL?

I'm experimenting with the new Windows Subsystem for Linux as a way to develop Rails applications in Windows. I have WSL installed and I have Ruby in it but how do I use that Ruby from a Windows GUI application, specifically, RubyMine:
This is so I can easily start rails, run tests, etc.
If anyone is wondering how this can be done at this time with the latest version of Ruby, there is a WSL connector for the remote repo of ruby.
[Update 2020-10-30]
Updating the response below as a lot has changed and improved since my initial reply in 2017 😜
The awesome team at JetBrains have enabled RubyMine to talk to WSL via SSH and to use the "remote" Ruby interpreter, and even debug Ruby code running in WSL! :)
Also, in Windows 10 1903, WSL provides the ability to access Linux distros' filesystems from Windows via the \\wsl$\ pseudo-UNC path.
In Windows 10 2004, WSL added a Linux icon to File Explorer making it easier to discover this pseudo-UNC path.
So, in Windows 10 >= 1903, Windows apps, editors, IDEs, etc. can also access files stored in, for example, \\wsl$\Ubuntu\...!
👉 Notes:
Accessing files in Linux via \\wsl$\... will be slower than accessing files locally because file IO requests have to be marshalled back and forth via a 9P fileserver. If you intend on accessing files intensively, we recommend storing the files in the filesystem closest to whatever you'll be using to access those files most intensively.
Thus ... while you can access files directly via the pseudo-path, using WSL integrations built-in to tools like RubyMine, VSCode, Visual Studio, etc. should be preferred if available.

How do you setup a RubyMine rails project to work with a remote ruby install?

My dev machine is running Windows, IntelliJ Idea 13 (EAP), and VirtualBox. I run a virtual linux server with ruby (setup to match the production server I'll deploy to). I have configured IntelliJ to use the ruby SDK on the (virtually) remote server, but I am having problems creating new rails projects because it is trying to pass windows local paths to the remote ruby install.
On my windows, I try to create the project in D:\Projects\MyRubyProject
On the VM, that dir maps to /projects/MyRubyProject
In the new project dialog, I would like to set the content root to /projects/MyRubyProject, but if I do it says it doesnt exists and ask to create it, when it creates it, it is created in the IntelliJ install dir. I tried giving it the same type of ssh:// path that the remote SDK accepts, but it just silentl fails.
Any suggestions or is this something that is just not supported?
i tried also.
just use "Configuring Remote Interpreters via Virtual Boxes" https://www.jetbrains.com/ruby/webhelp/configuring-remote-interpreters-via-virtual-boxes.html
Rubymine don't offer the possibility to create new rails project remotely.

Search over ssh with eclipse

i have a working environment for my rails app hosted on vm.
I'm using Eclipse + Remote System Explorer on ubuntu to edit the files.
The thing is that i'm unable to use the remote search option (the search button seems to be greyed out).
It's pretty usefull and i will need it to improve productivity...
the thing i did for now was :
- add the ssh route on fstab
- search the files with the local search option
This method is not good for me cause i'm working on a vm so i need to do it all over again, and it only works on one particulare network...
thx
I resolved the VM issue by using kvm instead of virtualbox

Resources