How to run ./script/generate rx_config? - ruby-on-rails

I'm a newbie and i'm working follow this link http://dima.github.com/2009/03/19/working-with-restfulx-model-attachments.html
But I stuck on the step run ./script/generate rx_config. I don't know how can I run it.
I tried to go to the path of folder script and typed generate rx_cofig on command line but it doesn't work.
C:\Data\Workspace\rx_model_attachments\script>generate rx_config
I got the error 'generate' is not recognized as an internal or external command, operable program or batch file.
Anyone can tell me step by step of doing this. Big thanks!

Since you're on windows, you will need to preface all of the scripts in the scripts folder with ruby:
C:\Data\Workspace\rx_model_attachments\script>ruby script/generate rx_config
The usual hash-bang (#!) at the start of the script files to let the shell know which interpreter to run does not work on windows.

Related

Run lua file other than main in replit

I'm trying to run a lua file other than main on replit.com, and I'm not sure how to do that. I know in java you just type "java name_of_file" into the terminal but typing "lua name_of_file) doesn't work.
Here is a screenshot of what I'm trying to do:
Here is my code on replit, so you can try running it: https://replit.com/join/kxisutsa-suzm10
You are currently in console, use shell instead and use lua activity.lua to run the activity.lua file.

Unable to run MiniZinc from command line - Even after adding installation location to PATH

Initially, I had the error: minizinc is not recognized as an internal or external command, operable program or batch file. when running minizinc mzn-cbc model.mzn data.mzn in the Git CMD.
Later on, following the instructions found at https://github.com/MiniZinc/libminizinc/issues/213 with suggestions from https://groups.google.com/forum/#!topic/minizinc/IFpUM_TSNGU, I did: export PATH=$PATH:{MINIZINC} where {MINIZINC} is the installation location. However, my terminal returned the error: 'export' is not recognized as an internal or external command, operable program or batch file. This also happens when I tried running the above with the windows command prompt..
Is there a way to go about solving this?
If it helps, the folder in which MiniZinc is installed looks something like this on my computer:
I'm afraid the instruction given in the GitHub issue only works within bash and derived shells. By default Windows uses batch instead. To change the PATH system variable, which is what it is called on Windows, you need to take different steps. They are explained here: https://java.com/en/download/help/path.xml

'rake' is not recognized as an internal or external command, operable program or batch file

Minutes ago, I downloaded the oscurrency code from github, and I'm installing oscurrency on heroku. Everything seemed to be going perfectly until this command:
rake heroku:install
on the command line, in the directory where I downloaded the source code. I get the error:
'rake' is not recognized as an internal or external command, operable program or batch file.
I'm following the installation instructions at heroku here:
https://github.com/oscurrency/oscurrency/wiki/Heroku-Deployment-Guide
The command "rake heroku:install" is in the third paragraph from the bottom.
The code I downloaded came in a top-level folder called oscurrency. I downloaded that onto my laptop in C:\me\oscurrency. I was issuing the command in that directory when I got the error. I tried issuing the command in the folder C:\me\oscurrency\oscurrency -- same error.
Maybe the command has changed for some reason. Anybody have an idea what's going wrong?
Your problem is most likely that the command prompt is looking for a file named rake.exe and not able to find it because your PATH environment variable is not set to include that directory. I suspect that the rails command won't work either. You should add the ruby install directory (probably C:\Program Files\Ruby on Rails\bin\ to your PATH environment variable.
To do this, open your Computer Properties by right-clicking My Computer and selecting Properties, then find the "Advanced System Settings" link. Click the "Environment Variables" button at the bottom, and paste the path to that directory into the PATH variable, separating it with a semicolon.

Using TDBLoader in JENA

I'm trying to learn how to use TDBLoader using this example I found:
https://github.com/ijdickinson/jena-tdb-ont-example
However, when trying to run the init-demo script, I keep running into issues
https://github.com/ijdickinson/jena-tdb-ont-example/blob/master/src/main/script/init-demo
I'm using cygwin to attempt to run the script, but I keep getting please ensure $Path contains $TDBROOT/bin
I set TDBROOT= C:\Development\apache-jena-2.12.1
And my Path has "%TDBROOT\bin"
I'm really new to using command line and shell scripts, so I'm not at all familiar with how to go about debugging this.
I have my tdbloader in apache-jena-2.12.1\bin , is there a way I can check if this is even working? Or if my path is properly set?
I tried "tdbloader" and "-v tdbloader" in command line and I get "tdbloader" is not recognized...
That's not supposed to happen if my path is set correctly, right?

How do I save a ruby file? (error)

I am receiving the error No such file or directory in my command line and I think it's because I am not saving the ruby files somewhere specific. All I did was create a random folder where I would save my ruby files.
Do I need to save my scripts in the original ruby folder? Thanks!
** This is Windows 7.
More info -
All I did was make a simple file named "Matz.rb" because I'm currently reading the O'reilly Ruby book. In my code all I wrote was puts "Hello Matz". I saved this on my desktop. When I go to the command line it and I write ruby matz.rb it says "ruby: No such file or directory -- matz.rb " Please help :(
If this has something to do with PATH or shells, I honestly have no idea what those really are because I just started coding last night.
You are most likely not in the right folder. You somehow need to tell the ruby interpreter where it is looking for the file.
Either make sure you're in the right folder - the cd command allows you to change location:
cd C:\Users\Username\Desktop
ruby Matz.rb
or specify the path explicitly:
ruby C:\Users\Username\Desktop\Matz.rb
By default, the ruby interpreter will look in your current directory (the location shown in your prompt) for whatever filename you give it.
Edit: I'll attempt to explain what I mean step-by-step.
When you initially open the command prompt, it will indicate what folder you are in (your "current working directory") in the prompt:
C:\Users\YourUsername >
In the above example, you are working in the C:\Users\YourUsername folder.
You can move directories using the cd command. For example, typing cd Desktop moves you into the folder called Desktop, assuming such a folder exists in your current location
You can move to another folder outside your current folder by specifying explicitly where you want to be: cd C:\Another\Place
When you run a ruby command such as ruby Matz.rb, the system knows how to find the ruby program because the installer placed its location into the PATH environment variable. Don't worry about this too much, this just explains the "magic" by which it knows what ruby means, no matter where you are.
Ruby finds the file you specify (in the above example, Matz.rb) by looking in the current directory. To re-iterate, it is looking in whatever folder is written right there in your prompt.
You can tell ruby to look outside the current folder by specifying the full path (as shown in the answer above).
To go from a new command window that you've just opened, to typing ruby Matz.rb and having it work, you need to do the following:
Move to the correct directory
Run the command
If we assume your username is alex and you have a folder on your desktop called "rubycode", which contains Matz.rb, you could do this:
Open a command prompt, which will most likely start in C:\Users\Alex
Move to the rubycode folder on your desktop: cd Desktop\rubycode. All subsequent commands will be working from within this folder.
Run the ruby command, specifying the file: ruby Matz.rb
Continue to run ruby commands as you learn ruby.
I hope that makes sense.

Resources