What can I use a sandbox for?
The Next Tech sandboxes allow you to quickly jump into a live computing environment in just a few seconds and then access if with a browser-based development environment. Rather than having to download software to your computer, you can just use the preconfigured environments in each sandbox. This means if you need to use a particular programming language to build something, you can get started much faster.
It may be the case that you need to write a quick Java project, perhaps for a course you are working on in university. Maybe you've been tasked with writing a program to check a user's age, and then determine if they're eligible for a discounted fare.1
Rather than having to setup Eclipse locally, you can just go to nt.dev/java and create a file, say
DiscountCalculator.java
, and put this in it:import java.util.Scanner;
public class DiscountCalculator {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
System.out.println("Enter passenger's name: ");
String passengerName = s.next();
System.out.println("Enter passenger's age: ");
int passengerAge = s.nextInt();
// Test to see if this customer is eligible for a 25% discount.
System.out.println("Passenger name: " + passengerName);
System.out.println("Passenger age: " + passengerAge);
if (passengerAge <= 6 || passengerAge >= 65) {
System.out.println("This passenger is eligible for a 25% discount.");
} else {
System.out.println("This passenger is not eligible for a 25% discount.");
}
System.exit(0);
}
}
Then type
javac DiscountCalculator.java
in the terminal to compile your code, then java DiscountCalculator
to run your program.BOOM! 💥
You just built a program with Java without having to install anything.
Sometimes having less software installed is exactly what you need. There are millions of packages and programs out there to try. Say for example, you want to try connecting to the Stripe API using their Ruby library. You could do this on your local computer ― you may even have Ruby installed already ― but what if you end up not using the library? You're then left with it installed, which you need to remember to cleanup. Down the road, you may even run into issues with this library conflicting with new libraries you are using.
With a sandbox, you can just go to nt.dev/ruby and type
sudo gem install stripe
into the terminal. Then create a file called main.rb
with this in it:require "stripe"
Stripe.api_key = "rk_test_..."
# list charges
puts(Stripe::Charge.list())
Now, replace the value for your (test!) API key from the Stripe dashboard and run your file by typing
ruby main.rb
in the terminal.Last modified 3yr ago