Click here to Skip to main content
15,886,689 members
Everything / Programming Languages / Ruby

Ruby

Ruby

Great Reads

by Marc Clifton
Locate your Facebook friends on a Google Map - A Ruby on Rails web application
by Arthur V. Ratz
In this brief article, we will demonstrate how to deploy a Node.js application and run it on Docker's Windows Server Core 2016 Containers
by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
by Paul Aurelian Gagniuc
This article shows how to mix two signals into a third, in variable proportions.

Latest Articles

by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
by Aleksandr Ulanov
In this article, we'll go through the basics of Hotwire, as well as build a sample app using it.
by Paul Aurelian Gagniuc
This article shows how to mix two signals into a third, in variable proportions.
by datarockets
Finding a vulnerability, using it for data extracting from the database, and fixing it with just one line of code

All Articles

Sort by Updated

Ruby 

26 Sep 2022 by shri harshan
sample input: 7 1 2 3 2 2 3 4 sample output: 2 1) 1st line of input is the total number of inputs 'n'. What I have tried: number = gets.champ.to_ for i in 1..number num = gets.champ-to_i
26 Sep 2022 by OriginalGriff
Once you have fixed your code as recommended by CPallini, it's pretty easy to handle the second part, if you think about it. You need the most repeating value, so you need to count all of the identical values - which is complicated with random...
26 Sep 2022 by CPallini
Thisputs "how many items?" items = gets.to_i arr = Array.new(items,10) for i in 0..items-1 puts "please enter item #{i}" arr[i] = gets.to_i end should fix your code. Now it is up to you actually fulfilling the requirements.
24 Sep 2022 by Chang Zying
I’m new in Ruby on Rails, how can I get the outlet id which is not at the product migration table , because category id has at product migration table, I can get it through product but how outlet id? I want to get it and put at the add item there...
21 Sep 2022 by MSameer Asif
hi i was trying to convert code from ruby to PHP slim and want to send data from PHP slim with help of to Json $app->get('/order-info', function (Request $request, Response $response) { $session =...
21 Sep 2022 by Richard MacCutchan
You will probably get a quicker answer from the Slim forum at Slim Framework[^].
20 Sep 2022 by Member 15773088
Hi This is a ruby programming. anyone help me with giving proper explanation step by step for this coding. I need explanations for each lines of coding. I am a beginner for programming. Here is the question Gosu Major Cycle Modify a simple...
20 Sep 2022 by Richard MacCutchan
It is all explained at Index of Files, Classes & Methods in Ruby 2.5.3 (Ruby 2.5.3)[^]
20 Sep 2022 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From...
20 Sep 2022 by MSameer Asif
hi i was trying to convert code from ruby to PHP slim and want to send data from PHP slim with help of to Json $app->get('/order-info', function (Request $request, Response $response) { $session =...
20 Sep 2022 by Member 15773088
Question Gosu Major Cycle Modify a simple Ruby program to move a shape across the screen by modifying the tasks in the Gosu cycle update() and draw() methods. Enhance the code provided as follows:  Add a variable in the initialize() method...
20 Sep 2022 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
29 Aug 2022 by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
11 Aug 2022 by Aleksandr Ulanov
In this article, we'll go through the basics of Hotwire, as well as build a sample app using it.
16 Jul 2022 by Member 15708384
Hello, I had some problems install ruby gem (mysql2) on Windows 10. I have installed "rubyinstaller-devkit-3.1.2-1-x64.exe". And I have installed required gem files for my ruby on rails development. But I can't install mysq2 gem because of error...
20 Jun 2022 by Member 12214576
it's my first time using rails,redis and sidekiq,and I have been facing this error all day and didn't reach any solution , I saw a lot solutions to this error but it didn't work for me, so I don't know where's the problem when i try the end...
20 Jun 2022 by Richard MacCutchan
https://dev.to/ben/nomethoderror-undefined-method-for-nil-nilclass-explained-422b[^].
12 May 2022 by Tyrunt.new("Rix")
Oh, I just needed to add `end` in the `stick(place)` function!
12 May 2022 by Tyrunt.new("Rix")
Hello, coding guys, As you saw in the title, Ruby is throwing me: main.rb:59: syntax error, unexpected end-of-input, expecting `end' and, this is my code: # Logging puts "Hello, world!\n" # Input getting & variables puts "What is your name?"...
20 Mar 2022 by Paul Aurelian Gagniuc
This article shows how to mix two signals into a third, in variable proportions.
13 Feb 2022 by steveb
This is impossible. When machine first powers up, there are no Python interpretes on a BIOS level. There fore this cannot be written in Python. Maybe only after boot code was executed. But why would anyone want to write an OS in a slow...
13 Feb 2022 by آرین عباسی 67
I want to rewrite the Linux kernel written in C and Assembly and Ruby and Python programming languages ​​and integrate it completely with Python. I need some help because I only know Python. I'm looking for a C, Assembly, Ruby, Shell programming...
12 Feb 2022 by Richard MacCutchan
You probably need to start by looking at the existing source code at GitHub - torvalds/linux: Linux kernel source tree[^].
11 Feb 2022 by Patrice T
Quote: I want to rewrite the Linux kernel Bad idea. If there is not millions of Linux written in everyone's favorite language, it is because it is huge and hard, and not every programming language is usable to build an OS. An OS talks to bare...
11 Feb 2022 by OriginalGriff
Forget it. Python needs an OS to work: it's an interpreted scripting language which needs the interpreter (which provides the framework for your app to run) to be executing before your app does. And that needs the OS beneath it to provide...
10 Jan 2022 by James_2012
Hi everyone.I'm a new programmer. I'm starting my new project on how to convert ruby codes into a .net framework. [language]. Would somebody help me start on this? Thanks
18 Oct 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
18 Oct 2021 by Member 15398339
I apologize for my english I'm not able to run the code, it says it must return a number since the constant is in string, how to proceed? def um_numero return um_numero.to_i What I have tried: I tried the to_i command but it didn't work
5 Oct 2021 by Member 11164169
def group_by_owners(files) better_hash = Hash.new { |hash, key| hash[key] = [] } files.each_with_object(better_hash) {|(k, v), hash| hash[v] 'Randy', 'Code.py' => 'Stan', 'Output.txt' =>...
5 Oct 2021 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From...
27 Jul 2021 by Marchan4
My ruby ​​version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5. I use macOS Big Sur(version 11.4) and the text editor "Atom". I'm...
27 Jul 2021 by Richard MacCutchan
$ export SECRET_KEY_BASE=GENERATED_CODE What is the $ sign in column 1 supposed to be for?
2 Jul 2021 by datarockets
Finding a vulnerability, using it for data extracting from the database, and fixing it with just one line of code
25 Apr 2021 by Member 13968986
I have installed Pervasive V10 server x86 and odbc gem. Whenever I make a request to fetch data from the database, I get the following error "IM003 (160) Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL)...
6 Mar 2021 by Member 14915174
Hello, I may have asked the same question but in c++ not too long ago, sorry if I'm a bit noisy. so I got two function to send and receive large data from tcpsockets in ruby but I need help debugging. the problem is I tested these methods on an...
1 Mar 2021 by Sameerahmed786
Hello, I have been working on a personal project to build a website called DevMatch (course on upskill by Robeen Dey) and I have been having trouble as to why I am having an error that displays "Plan must exist" whenever I fill out an email form....
25 Nov 2020 by Patrice T
Posting your homework is not a question. You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork. HomeWork problems are simplified versions of the...
25 Nov 2020 by OriginalGriff
You're running late - the rest of your class was trying to get us to do this homework last week ... But I'll tell you what we told them: Quote: We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it...
20 Oct 2020 by Member 14960261
Misty is fond of pokemons and likes to collect pokemon cards. She has P pokemon cards with her at present. She wants to have a particular number of cards on the Dth day. Her friend Ash is ready to help her to achieve the number. Ash will provide...
11 Oct 2020 by Member 14961422
def main(): n=int(input()) for i in range(n): li=list(int(i) for i in input().strip().split(' ')) p=li[0] N=li[1] d=li[2] for i in range(d-1): mul=(d-1)*N ans=mul+p ...
9 Oct 2020 by Patrice T
First of all, the languages you list are to tell everyone which language the question is about. def main(): n=int(input()) for i in range(n): li=list(int(i) for i in input().strip().split(' ')) P=li[0] N=li[1] ...
9 Oct 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
9 Aug 2020 by Member 14910806
import java.util.*; class Railway { public static void main(String[] args) { int p = 1, res = 1, i = 1, j = 0; Scanner sc = new Scanner(System.in); int N = sc.nextInt(), d; int arr[] = new int[N]; int dep[] = new...
8 Aug 2020 by Patrice T
When posting a question about a challenge from a site, it is a good idea to post a link to the page, as every word in requirement can matters. Quote: i want full solution And I want to win lottery grand price. Quote: well i try to write some...
8 Aug 2020 by Sandeep Mewara
Okay, so if read the requirement here: Quote: Given schedule of trains and their stoppage time at a Railway Station, find minimum number of platforms needed what is expected or would help here is to find maximum trains present at a given point...
8 Aug 2020 by OriginalGriff
Quote: i try to write some function but it didn't work it properly.i want full solution Not going to happen. We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the...
19 Jul 2020 by Member 14892170
I'm pretty new in rails. I've a problem with Oracle. I always get ORA-06413: Connection not open error from oracle when I run the rails server I'm using this configuration ruby '2.6.3' gem 'rails', '~> 5.2.3' gem 'pg', '= 0.18.1' gem...
19 Jul 2020 by Sandeep Mewara
First off, with the error you get, it is not related to Rails here. It's plain simple error related to Oracle that indicates something wrong with the database connection. Now, given the error code, seems handful of information on web/Google for...
21 Jun 2020 by Afzaal Ahmad Zeeshan
I think it is because the testing software is configured to accept only a specific result, as you can see in the following code: Failure/Error: expect($stdout).to receive(:puts).with("Hello Kent Beck!") You can fix this by removing the extra...
21 Jun 2020 by michellekadiehl
I have spent over an hour trying to figure out how to solve the error, but nothing works. Here is the error message: say_hello accepts an argument of a name and prints out Hello with that Name (FAILED - 1) defaults to Ruby Programmer when...
30 Mar 2020 by OriginalGriff
The ** operator just returns X to the power of Y: X ** Y 2 ** 2 = 4 2 ** 3 = 8 10** 2 = 100 So the only place you use it is ... when you want a number raised to a power: the square for example, or the cube.
30 Mar 2020 by yebaha
I'm learning ruby on rails. what are some common scenarios to use ** operator? What I have tried: I'm working through a tutorial ,and it is mentioned that during initilization we can use **operator , of a class. I'm want to know how to use this.
28 Feb 2020 by Christian Specht
After years of executing a “build and upload per FTP” batch on my machine, I now have a GitHub Pages-like experience when updating this site..
8 Nov 2019 by Member 14471936
First of all sorry for my poor english. It's my first time working with ruby on rails and i don't have so much idea. I have a redmine proyect mounted in a virtual machine, i can access to it writting my ip an it works. But the problem is when i want to enter from an external link, (i have my...
30 Sep 2019 by Member 4206974
A Tcl -Tk Form Generator that can be used alone or used to provide a fast Form generation for language in which this activity can be complex
9 Jun 2019 by bigyan sahoo
Hi, I am new in ruby. I will give here one example in .NET. The same encryption data I need in ruby. .Net Code-: using (SHA1 sha = new SHA1CryptoServiceProvider()) { byte[] computeHash = sha.ComputeHash(enc.GetBytes(plainText + "." + ConfigKey)); } First it...
9 Jun 2019 by Richard MacCutchan
sha1 ruby - Google Search[^]
19 May 2019 by Jayson741
Eslint rules says use single quotes but upon autosave it corrects this to double quotes which then comes up as an error.... I've followed the Eslint rules on https://eslint.org/docs/rules/quotes but the autosave function refuses to accept this... this also goes for extra semi and spacing ...
19 May 2019 by Gerry Schmitz
Start here: Single quotes are sometimes replaced with double quotes even when "prettier.singleQuote: true" is specified · Issue #2338 · prettier/prettier · GitHub[^]
3 Apr 2019 by Member 14200783
This is my index.html.erb This is my edit.html.erb:
29 Mar 2019 by Member 14200783
I just started my rails. I try to set routes but my controller format has an underline. Therefore I do not how to write route. What I have tried: This is my controller file name: method_types_controller.rb This is what I have tried on my route: Rails.application.routes.draw do # For...
4 Mar 2019 by Ryan Peden
A brief overview of what Serverless is, and why giving it a try is worth your time.
28 Jan 2019 by Member 14132591
I have to add a text to a filename in Ruby in order for a job to know which files to be picked up in the directory. For example in directory C:\Users\Scripts, I may have files named: 2A_Apple_VC_20180101.txt 2A_Apple_VC_20180201.txt 2A_Apple_VC_20180301.txt etc. How can I insert the phrase...
15 Dec 2018 by Akin0
Okay, so the problem actually was -- Ruby cannot stand checking the names that have other characters than English alphabet in itself. That was actually pretty hard to come up with, but I guess this is the solution.
14 Dec 2018 by Akin0
Hello, So I am working with Ruby, and... I have an error "ERRNO::EEXIST, text line 2 ... File exists" The error occurs if a directory it created (defined in EGGPATH) already exists, which should work in itself because of "unless File.exist?(EGGPATH)" While what I'm trying to do is: def cyhm ...
12 Dec 2018 by Richard MacCutchan
You most likely should use Dir.exist, not File.exist to check for a directory.
10 Dec 2018 by YasIkeda
I needed Ruby in order to run `npm run-script docs` in Bootstrap's project, but the command failed in macOS 10.14.2. It was because Bootstrap's site seems to be created with Jekyll, which works on Ruby, and Ruby installed by default or with XCode did not work well for this purpose.
9 Nov 2018 by Сергей Челноков
10 Sep 2018 by mcne65
require "net/ssh" require 'net/ssh/shell' require 'capistrano/rails' require 'sshkit' require 'sshkit/dsl' include SSHKit::DSL @hostname = "lwa1001.env-10-100-222.iagcloud" @username = "admin" @password = "password1" @cmd = "ls -la" res = "" ssh = Net::SSH.start(@hostname, @username,...
2 Sep 2018 by Member 13969616
I am trying to define a method that checks if a given space on the board is empty and address the scenarios that qualify as an empty space that isn't equal to the literal " ". My tests failed to produce false/true, and instead provided nil. What I have tried: board = [" ", " ", " ", " ", "...
2 Sep 2018 by Member 13969616
def position_taken?(board, index) if board[index] == " " || board[index] == nil || board[index] == "" return false elsif board[index] != " " return true end end Thank you for your help, I ended up finding this solution worked and what the problem was by seeing how you interpreted my code.
1 Sep 2018 by Arthur V. Ratz
In this brief article, we will demonstrate how to deploy a Node.js application and run it on Docker's Windows Server Core 2016 Containers
1 Sep 2018 by Patrice T
Quote: My tests failed to produce false/true, and instead provided nil. The reason is that your code do not cover all cases. Try something like this: board = [" ", " ", " ", " ", " ", " ", " ", " ", " "] def position_taken?(board, index) if board[index] == [" "] || nil # not sure what this...
29 Aug 2018 by KarstenK
I think you can, but you will have a bunch of more basic problems like writing the code and testing. You must dig in all documentations of the languages and work out some command line build process like for instance in Java and glue all in one big batch which triggers the others. This only...
29 Aug 2018 by Питер Каликс
Can I compile Java ,C++ , Python ,PHP & Ruby On Rail at Once ?? And Can i build web application using these all Programming Languages at Once?? What I have tried: I haven't tried ever.Cause of confusion .I want to Compile Or built a web application using Java ,C++ , Python , PHP & Ruby on...
29 Aug 2018 by Jochen Arndt
Short answer: You can't. All these languages are build differently. C++ for example is compiled to executable code for a specific platform. Other languages are full interpreted (an interpreter is "compiling" at run time to executable code) or semi interpreted (the compiler creates a platform...
31 Jul 2018 by Patrice T
Quote: Which language would be best for building billing software. Since all languages are almost on par, your answer is the language you are most familiar with. Quote: I want to build a billing software for my college project and maybe I would also try to sell them. I want to add features like...