When to generate a new Application Key in Laravel?

php artisan key:generate is a command that sets the APP_KEY value in your .env file. By default, this command is run following a composer create-project laravel/laravel command. If you use a version control system like git to manage your project for development, calling git push … will push a copy of your Laravel project to wherever it is going, but will not include your .env file. Therefore, if … Read more

How can I get the application’s path in a .NET console application?

System.Reflection.Assembly.GetExecutingAssembly().Location1 Combine that with System.IO.Path.GetDirectoryName if all you want is the directory. 1As per Mr.Mindor’s comment:System.Reflection.Assembly.GetExecutingAssembly().Location returns where the executing assembly is currently located, which may or may not be where the assembly is located when not executing. In the case of shadow copying assemblies, you will get a path in a temp directory. System.Reflection.Assembly.GetExecutingAssembly().CodeBase will return the ‘permanent’ path … Read more

What’s the difference between console.dir and console.log?

In Firefox, these function behave quite differently: log only prints out a toString representation, whereas dir prints out a navigable tree. In Chrome, log already prints out a tree — most of the time. However, Chrome’s log still stringifies certain classes of objects, even if they have properties. Perhaps the clearest example of a difference is a regular expression: You can also see a clear difference … Read more

Reading \r (carriage return) vs \n (newline) from console with getc?

\n is the newline character, while \r is the carriage return. They differ in what uses them. Windows uses \r\n to signify the enter key was pressed, while Linux and Unix use \n to signify that the enter key was pressed. Thus, I’d always use \n because it’s used by all; and if (x == ‘\n’) is the proper way to test character equality.

How can I write to the console in PHP?

Firefox On Firefox you can use an extension called FirePHP which enables the logging and dumping of information from your PHP applications to the console. This is an addon to the awesome web development extension Firebug. http://www.studytrails.com/blog/using-firephp-in-firefox-to-debug-php/ Chrome However if you are using Chrome there is a PHP debugging tool called Chrome Logger or webug (webug has problems with the order of … Read more

Getting Keyboard Input

You can use Scanner class Import first : Then you use like this. Side note : If you are using nextInt() with nextLine() you probably could have some trouble cause nextInt() does not read the last newline character of input and so nextLine() then is not gonna to be executed with desired behaviour. Read more in how to solve it in this previous question Skipping nextLine … Read more

How to clear the console?

Since there are several answers here showing non-working code for Windows, here is a clarification: This command does not work, for two reasons: There is no executable named cls.exe or cls.com in a standard Windows installation that could be invoked via Runtime.exec, as the well-known command cls is builtin to Windows’ command line interpreter. When launching a new process via Runtime.exec, the standard output gets … Read more