How to correct indentation in IntelliJ

Code → Reformat Code… (default Ctrl + Alt + L) for the whole file or Code → Auto-Indent Lines (default Ctrl + Alt + I) for the current line or selection. You can customise the settings for how code is auto-formatted under File → Settings → Editor → Code Style. To ensure comments are also indented to the same level as the code, you can simply do as follows:

How can I call a shell command in my Perl script?

How to run a shell script from a Perl program 1. Using system system($command, @arguments); For example: System will execute the $command with @arguments and return to your script when finished. You may check $! for certain errors passed to the OS by the external application. Read the documentation for system for the nuances of how … Read more

Sublime Text from Command Line

Windows Command Prompt For Windows cmd.exe you could just add the sublime text installation directory to your PATH environment variable, this would allow you to type: Personally, I add a doskey (in a .bat file set to autorun with cmd) so I can type subl file.rb: Cygwin For the default bash shell add an alias to your ~/.bashrc file, e.g:

how to convert .java file to a .class file

A .java file is the code file. A .class file is the compiled file. It’s not exactly “conversion” – it’s compilation. Suppose your file was called “herb.java”, you would write (in the command prompt): It will create a herb.class file in the current folder. It is “executable” only if it contains a static void main(String[]) method inside it. If it does, … Read more

How do I make a JSON object with multiple arrays?

On the outermost level, a JSON object starts with a { and end with a }. Sample data: If the JSON is assigned to a variable called data, then accessing it would be like the following: Another approach (using an associative array for car models rather than an indexed array): Edit: Correction: A JSON object starts with { and ends … Read more

set head to NULL (‘NULL’ : undeclared identifier)

As written, NULL isn’t defined in your program. Usually, that’s defined in a standard header file — specifically <cstddef> or <stddef.h>. Since you’re restricted to iostream, if yours doesn’t get NULL implicitly from that header, you can use 0 or, in C++11, nullptr, which is a keyword and doesn’t require a header. (It is not recommended to define NULL yourself. It might work sometimes, but it is technically … Read more

what does x– or x++ do here?

x– will decrement value of x by 1. It is a postfix decrement operator, –x is a prefix decrement operator. So, what’s going on here? By analogy, the ++ will increase a value by 1. It also has a prefix and postfix variant.