How to let RubyMine work with cygwin64 - ruby

I'm currently using cygwin64 on my Windows 10 virtual machine. On there, I've installed rvm, and the default (and only) version of Ruby is ruby 2.4.0p0. Through my IDE (RubyMine) I've linked the ruby interpreter to the ruby interpreter installed on my cygwin64 installation. However, there are some issues i'm having which are quite annoying and I though I would ask here for anyone who might have had this issue before and fixed it some how.
The issues are:
Gems not found (requiring files are 'not found': including the standard library, methods not found, classes not found, ...)
Using cmd I cannot use commands such as bundler, gem etc (I have to use the cygwin64 terminal)
Some features on RubyMine don't work (including the Run button, etc)
I've thought about path variables, but I don't really know which ones I have to set (and where to).
Any help would be appriciated.

I managed to get some things working today and I though I might aswell share it here, for anyone having similar issues in the future. I fixed the first issue through setting up a ssh server on my cygwin64 installation and allow localhost connections to it. I then set up a 'remote interpreter' through RubyMine and linked it to the ruby interpreter through the ssh connection. Gems are found, RubyMine no longer complains about unknown files, code completion works, for me a success!
I then went searching a bit and found a alternative for the cmd not allowing commands such as bundler, gem, etc. I didn't fix it, but I managed to link the RubyMine's terminal to my cygwin64 terminal. I now can execute these commands through RubyMine, so that isn't that bad.
Setting up the remote interpreter:
File -> Settings -> Languages & Frameworks -> Ruby SDK and Gems
Linking the terminal:
File -> Settings -> Tools -> Terminal -> Shell path -> C:\cygwin64\Cygwin.bat (in my case)

Related

Windows IDE for Haskell

I need to setup a simple and compelling dev environment for small proyects written in Haskell in Windows machines for freshmen.
I have tried several ways to integrate Haskell into VSCode in Windows with no success.
I had a nice setup a few years ago, but I´m finding problems with dependencies recreating that environment:
Editor: Atom
Global binaries build using: stack with ghc-mod hlint stylish-haskell
Atom plugins: language-haskell, ide-haskell, ide-haskell-repl, haskell-ghc-mod
It seems that the "cool" way right now is Language Server Protocol + VScode. ghc-mod seems not to be mantained anymore, Intero has reached EOL, HEI is merging with another project... Having a stable and updated dev environment looks like a moving target.
So, the question is: does anyone have reproducible step-by-step instructions for having VSCode working with Haskell in Windows?
I will test any suggestion in a fresh Windows 10 64bits VM and report the results.
Note: VSCode + Docker container is not an option. Most of the student´s machines have 4GB RAM.
Thanks in advance.
There's a tool called ghcid (not to be confused with ghcide) that, while nowhere near a full-blown IDE, is pretty robust and provides some niceties like re-compiling on save and showing compile errors. It doesn't support go-to-definition though. It has a VSCode plugin.
Here's a possible way of setting up things in Windows:
Download the GHC 8.8.3 binaries for Windows from here.
Download the cabal-install 3.0.0.0 binaries for Windows from here.
Decompress them in some folder.
Add entries to your PATH environment variable so that it has access to the /bin folder of the GHC installation and to the folder containing the cabal executable.
Open a Powershell console.
Run cabal udpate
Run cabal install --install-method=copy --installdir=somefolder ghcid to install the ghcid executable, where "somefolder" is the destination folder. (If the installation fails, try running the command from a Git Bash or Cygwin terminal as a workaround.) Put the destination folder in PATH.
Open (or restart) VSCode and install the "Haskell Syntax Highlighting" and haskell-ghcid plugins.
Go to an example cabal project, use the Ctrl-Shift-P shortcut, and execute the Start ghcid action. The ghcid terminal will appear.
Example of a ghcid session showing an error:
The haskell-ghcid plugin can read a .ghcid file in the project root containing flags that should be passed to the ghcid command.
Extra instructions to set up code formatting:
Install the ormulu formatter by running cabal install ormolu --install-method=copy --installdir=somefolder. Again, make sure that the destination folder in in PATH.
Open (or restart) VSCode and install the ormulu plugin.
Now the "Format Document" and "Format Selection" actions in VSCode will use ormulu.
Another way of installing GHC and getting to ghcid and ormulu could be by using the stack tool, which handles GHC installation by itself.

Firefox cannot open "libgtk-3.so.0". How to circumvent?

I have two CentOS VMs which use Jenkins to run automated tests through firefox. Both have firefox installed. Both versions of firefox are the same (firefox-56.0.1). I do not know if they are both x86_64 or some other type, but whichever they are, they are the same. (I am using the same .tar.bz2 file. I copied it from one instance to the other.)
In one instance, I am able to run firefox. "firefox --headless" returns "*** You are running in headless mode."
After copying the .tar.bz2 file to the other instance and installing firefox, I find that the new instance does not have the same performance. "firefox --headless" returns the following:
XPCOMGlueLoad error for file /usr/local/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
What might explain this difference? It appears that I did something right in the first instance, but I cannot tell what. Is there some setting that will prevent firefox from trying to use the "libgtk-3.so.0" file? This file does not exist on either instance.
I've seen this question elsewhere, but the answer seems to focus on versions (I know my version has worked in the first instance) and a particular bug that has been backlogged (this bug only bothers me for the new instance).
Problem solved minutes after asking the question.
Simply run:
yum info gtk3
Check if gtk3 is installed. If not:
yum install gtk3
My old instance had gtk3 version 3.22.10 installed. My new instance had the same available but not installed. I don't recall seeing this in any of the guides to running firefox headlessly, but a search result that I did not originally think worth checking was able to resolve this rather quickly. Credit to the folks at https://forums.fedoraforum.org/showthread.php?310652-Udating-Firefox-fedora-19
For Ubuntu or Debian distros use:
apt-get install packagekit-gtk3-module
You probably installed the wrong firefox version for 32bit on a 64bit system.
try downloading firefox with this portable installer download-mozilla-portable.sh which should work on a 64bit linux (tested in Ubuntu 19.10)

Trouble opening Ncurses Examples in OS X

I recently downloaded ncurses from here and have compiled it using ./configure and make
As it is recommended in the README, I compiled the example programs that come bundled with the package. The programs compiled without any issue, but every time I run the programs I get the following errors:
Terminal type "xterm-256color"
terminals database is inaccessible
Changing the terminal's type using TERM=xterm and export TERM don't seem to solve this issue, and I'm just stuck. Will ncurses work if I included them in my C/C++ programs, or should I make sure the examples work?
Thanks in advance
Probably you did not install the terminal database, or did not tell the programs where to find it.
OSX comes with ncurses 5.7 (old, but not the problem here), with the terminal database in /usr/share/terminfo. However by default the configure script assumes you want to install in /usr/local. You can tell the programs where there's a terminal database by setting the TERMINFO environment variable, or (better), setting TERMINFO_DIRS to list both locations (with the newer one first of course).
For a start, something like
export TERMINFO=/usr/share/terminfo
should be enough to make the examples run.
Further reading:
TERMINFO
TERMINFO_DIRS

How to run ruby programs on Windows 7?

Does anyone know how to run/compile Ruby programs on Windows 7? For example you can compile Java in Eclipse, but I can't seem to find one for Ruby.
http://rubyinstaller.org/ - "The easy way to install Ruby on Windows".
Will give you the language and execution environment - everything you should need to get started.
Ruby isn't compiled, but rather interpreted. You need to install Ruby using the above link given by #ilollar.
Then, if you have the source code of a program in the file some_ruby.rb, you will execute this in cmd:
ruby some_options.rb
This is the general form of a ruby command:
ruby [ruby options] [program name] [program options]
Here is a free online book that will answer most of the question you have about Ruby if you are just starting out: http://ruby.learncodethehardway.org/book/
It's called "Learn Ruby the Hard Way", but don't let the name throw you off - the book is actually pretty easy to follow and doesn't assume you know anything about programming.
It will get you started writing Ruby and running programs for the first time.
Like ilollar said, the Ruby Installer is the best way to put Ruby on your Windows computer.
I'm currently running Ruby on Windows 7 writing Rails applications. You can do a lot on Windows with Ruby, however, you can't do everything. There are bundles of files that you can download that will help you write your Ruby programs - they are called Gems. Some gems will not run on Windows - The Ruby Racer and some versions of EventMachine are two that immediately come to mind.
This can be frustrating, but if it ever happens you can install a version of Linux in a virtual machine on your Windows computer so that you can use these gems without having to get a new machine.
You can also install Linux to run alongside Windows without having to reformat or mess with the partitions on your hard drive. There is a program called 'Wubi' that will install Ubuntu (a version of Linux) to run inside your Windows machine. It will actually let you pick Windows or Linux when you start your machine.
But all this is stuff to think about later on. You can certainly develop Ruby on Windows for now.
Also, in case you want to run just Ruby interactively, find the location where it is installed and browse to the bin subdirectory. For me this was \RailsInstaller\Ruby1.9.3\bin. In this directory there should be a file irb.bat. Double-click on it and you'll get a Ruby console session.
You can create window executables with ocra. That way you can create the app and push the app to another pc that does not have Ruby installed on it.

Aptana Studio 3.0.4 Unable to find a Ruby executable with RVM

I just downloaded Aptana Studio 3.0.4 on Ubuntu 11.04 32 bits. I've been using RVM for Ruby and Rails development. I imported a rails project into Aptana and tried to run it. But when I do, I get the error from the title:
Unable to find a ruby executable.
When I open the Terminal view, it doesn't find ruby with ruby -v either. I think it's correctly configured on my system with the .bash_profile file. But when I open the Terminal view and use "rvm use 1.9.2", and try ruby -v (which does work), Aptana still doesn't find it.
Do you know if there's a way to tell Aptana to use RVM or configure the path to Ruby somewhere?
Thanks in advance.
If we're unable to find ruby inside our Terminal view, it means that somehow the path isn't set up properly. It sounds like it does find it after you run "rvm use 1.9.2", which would lead me to think that rvm is set up, but there's no default ruby set. Try running "rvm use 1.9.2 --default", restart Studio and then try "ruby -v" in the Terminal view.
You can change the path to make it work.
Windows Start Menu -> Computer -> Properties (in the context menu) -> Settings -> Advanced -> Environment variables -> PATH
Add the path of your ruby executable.
I had the same problem, and I just solved it this way.

Resources