Here's how to print the datatype of an object or a primitive value to the console:
- Object:
Object myobject = “new”; // note: String is an object
Here's how to print the datatype of an object or a primitive value to the console:
If you want to toggle a container which is a flexbox, one of the easiest ways, in fact, is to surround your flex container with a standard block container and then use the toggle function on the block container, like so:
Modifiers in C#:
There are three ways of printing strings in C#:
Console.WriteLine("Hello " + world);
Console.WriteLine("Hello {0}", world);
Console.WriteLine($"Hello {world}, today is {date_time}");
A class should always have a constructor. The constructor initiates the data members.
The keyword this references to current class data members.
Structure of a class:
OOP is based on 4 pillars:
There's also OOAD. OOAD is object-oriented analysis and design. It's a technical approach for analyzing an ddesigning an application, system, or business by applying OOP as well as using visual modeling.
Whereas in some programming languages it doesn't matter if you use single or double quotes, it matters highly in C++ (and some others, such as Java, also). For example, if you're a webdeveloper and write a function in JavaScript, you can even mix them and it will still work and give you the right output (as long as you don't use single ones at the beginning and doubles at the end of the same string).
Just because I couldn't believe it… obviously there's no easier way in JavaScript to show the time in HH:mm (e.g. 11:05) then to build the string yourself, using if-conditions and adding the zero manually where needed:
While in Java, for example, you get an error if you want to run a function which contains a variable that hasn't been initialized java: variable x might not have been initialized
, not so in C++ and that can be tricky.
In C++ variables which haven't been initialized get random values which can or will almost always lead to unexpected results.
While working on a live Laravel project it might be useful to set the page in a maintenance mode, so that users visiting it, won't see any errors while work's in progress.
For this, practically just log into the server where your project is located, navigate to your project folder and there use the command php artisan down
. This sets your application in a maintenance mode. What people visiting your page then will see is a standard Laravel maintenance page.
There are several ways of passing multiple variables to a view in Laravel:
1. Using with()
Xampp:
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=my_db
DB_USERNAME=root
DB_PASSWORD=
Obviously, there are several methods of setting up the language of a date in Laravel. I was finally successful with the following one:
1. AppServiceProvider:
public function register()
{
setlocale(LC_TIME, config('app.locale'));
}
Just because I keep forgetting this command -
if you wish to open your Laravel application not on the standard 8000 port but on a different one, use this:
php artisan serve --port=1234
Also handy if you've got several applications running at the same time.
In Laravel you can use the with() method to pass data to a view for example.
But there are different ways of this with() method as for how the passed parameters are treated by the system in the view they've been passed to:
Something important when creating routes in Laravel is never to use routes consisting of variables only. Make them unique, like so -
Don't: /{id}/{title}
Do: /cat/{id}/{title}
What do you put in resources, what in public?
The resources folder:
Access via: ("../js/yourfile.js")
For your CSS in Laravel you can either use the public folder or use the resources/css folder and npm to manage and compile your CSS.
For this, do the following:
NPM is a NodeJS package manager. So, in order to install and use npm you have to install nodejs first. For Windows there's an installer here: Download | Node.js .
To install nodejs on your local machine, follow these steps (this will also install npm):
Here are the steps to be followed installing and setting up Git on a Windows machine using a GitHub account:
Download and install the latest version of Git.
Set your username in Git: