Featured Post

How to capture long screenshot of apps and website on Android?

Image
Usually, you can take screenshot of only visible area on your display. But what if you could capture screenshot of the app by scrolling up and it will automatically keep capturing the long screenshot until you scroll up. Well, it's easy. In some devices, there is built-in feature called Super Screenshot or Long Screenshot which can capture long screenshot by scrolling up. If your device don't have these features, don't worry, I am going to share best trick to take long screenshot on any Android device. In this tutorial, I am going to share a useful Android app which can be used to take long screenshot of any apps or stitch multiple screenshots into one. The name of the app is LongShot for long screenshot . This is my favorite app to take long screenshot on Android phone. For taking long screenshot, the view must be scrollable. Example, you can take long screenshots on Facebook, Messages, Twitter and any apps which can be scrolled vertically. You can also take the s...

How to install Ruby and run Ruby Programs offline on Android?

Run Ruby Programs On Android

Ruby is a dynamic, object-oriented, high-level, open source and general purpose interpreted Programming Language. Ruby is mostly used for building web applications. The popular web framework Ruby on Rails is made using Ruby. It is used for Server Side Scripting. Ruby has easy and clean syntax which makes it easy to learn even for a new developer.

In this tutorial, we will focus on how you can Install and Run Ruby programs on your Android Device. You will be able to run your Ruby programs offline in your Android after following the below steps.


Installing Ruby on your Android Device.

  1. In order to run your Ruby programs on your Android, you need an app called Termux. Install the app from the Play Store.
    Termux App on Play Store
  2. After installation is complete, open the app and wait till the app configuration is complete.
    You need to turn on the internet to download necessary files for Termux during the first launch after app installation or clearing its data.
  3. After the app's initial configuration is complete, you will see this window.
    Termux App Home
  4. To run Ruby programs, you should install Ruby on Termux. Type the following commands in the terminal to install Ruby in Termux.
    $ pkg install ruby
  5. It may take few seconds for installation depending on your internet speed. After installation completes successfully, you can run Ruby programs on your Android.

Installing Ruby Code Editor in Termux.

To write Ruby program, you need to install an Editor. In this tutorial, we will use Micro text editor. It is a good text editor for Termux which has many cool features. It also supports the shortcut keys that are used in PC like CTRL + V to Paste the Copied Text, CTRL + S to Save File, CTRL + Q to Exit/Quit the Editor, etc.

  1. To install Micro Editor on Termux, use the following command.
    $ pkg install micro
  2. Once you successfully install the Micro Editor, type the following command to create a new Ruby Program.
    $ micro first.rbHere, first.rb is the name of the Ruby Program. You can use any name for your code in place of first.
  3. After you run the command, you can see an editor where you can write your Ruby programs.
    Micro Text Editor on Termux
  4. Write the Ruby program on the Editor and press CTRL + S to Save your program.
    Ruby Code In Micro Editor

Executing the Ruby Programs.

Once you write the Ruby program, you need to run it to see its output.
To run your Ruby code, follow these steps.

  1. Run the following command on the terminal.
    $ ruby first.rbHere, first.rb is the name of the Ruby program you have created.
  2. Once after running the command, you can see its output on the terminal.
    Output Of the Ruby Program

Writing Ruby Programs on External code editor.

Instead of using the Termux Editors, you can also write Ruby programs on any one of your favorite Code Editor app and execute them. I am using Quoda code editor in this tutorial which is my favourite editor with many cool features.

To write your Ruby programs on code editor, follow these steps:

  1. Download any one of your favourite code editor app and create a new file.
  2. Write your Ruby program on the editor as in the image below.
    Writing Ruby Program on Code Editor
  3. Save the file as <filename>.rb.
    You can use your desired name for your Ruby program in place of <filename>.
    You should save your file in the root of your sdcard or where you can easily get its location because you need to provide the file location to run your code.
  4. You are now ready to run your Ruby Program.

Executing Ruby programs from external file.

After writing your program, you can run it to see the output. To run your Ruby code, follow these steps:

  1. First of all, you need to provide permission to read and write files from your Internal or External Storage if your Android is Android 6.0(Marshmallow) or later. To provide storage permission to Termux, run the following command in the terminal and click Allow to allow the permission.
    $ termux-setup-storage
  2. To run the program, you need to get the path of your program file. You can use your file manager and see the details/ properties of the file to see the path.
  3. Once you have the file path, open Termux app.
  4. Type the following command to run your code.
    $ ruby /path/filename.rb
  5. If your program exist on the given path, it will show output accordingly as shown in the given image.
    Executing Ruby Program From External File

Conclusion

Following this tutorial, you have successfully installed Ruby in your Android, and now you can run your Ruby programs offline on your Android.

Comments

Popular posts from this blog

How to capture long screenshot of apps and website on Android?

How to capture long screenshot of apps and website on Android?

How to run VB.NET programs offline on your Android?