Posts

Showing posts from September, 2020

How to reset MYSQL root password in Windows if root password is forgotten?

Somehow I have forgotten my MYSQL root password. I tried all possible combination, but everything went in vain, so what the options I have? Either uninstall MYSQL and reinstall it again, since it is just my local development instance or need to figure out a solution to find out the password or change it. Uninstalling and reinstalling it, is not a wise solution. So other only option is change it. Below are the steps to change the root password for MYSQL in Windows. 1) Log on to your system as Administrator or make sure that you have the administrator privileges. 2) Stop the MYSQL server. To do that, open the Start Menu and type services. It will open the Services window, if not got to the Control Panel > System and Security > Administrative Tools and click Services there. Find the MYSQL services and stop it. 3) Create a text file containing Sql statement to update the root password, save the file in a specific location. Let assume the file is stored in the C drive, and file nam...

PHP LARAVEL Directory Structure

When you create a fresh laravel project, you will be provided with the following files and directory to start with. Let's walks through the directories one by one.   Directory Description app The app directory contains the core code of your application. Models, controllers, routes all goes in here.     bootstrap The bootstrap directory contains all the bootstrapping scripts (app.php) used for your application. This directory also houses a cache directory which contains framework generated files for performance optimization such as route and service cache files. config The config directory holds all your project configuration files (.config). database The database directory holds your database migrations, models and seeds. public The public directory helps in starting your Laravel project and also holds other scripts (JavaScript and CSS) a...

PHP LARAVEL - Simple CURD example - TUTORIAL - 1

In the post, you will learn how to create a simple LARAVEL CRUD application from scratch. Let's start with how we create a fresh project, configure DB settings and writing the necessary model and controllers to interact with DB. In order to create a fresh installation of Laravel project, open the command prompt and type the below command. This will create a fresh project named curdexample. composer create-project laravel/laravel curdexample Go, to the project and open .env file, and set the DB_CONNECTION to MySQL, since we will be using the MySQL as our database for this example. Update all other details like HOST, DATABASE, USERNAME and PASSWORD. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD= Let's create our first model object. Laravel uses the MVC architecture to organize the application into three separate parts (Model, View and Controller). Model defines the data access layer, so let's creating the model first. Open...

PHP LARAVEL - Hello World Laravel

As part of a new assignment, I have started working on Laravel. After completing the setup, I am writing my first program on Laravel. I am not different from other programmers, so I am starting with the basic Hello world, and it works as sanity test to make sure that application has been installed correctly. Let's how we can write Hello World in Laravel. Through Route In your Laravel project, go to routes/web.php file and add the following chunk of code: Route :: get( '/' , function () { return 'Hello World!' ; }); Now open the application in the browser: http://localhost , you can see the Hello World! in the browser. Through Controller Now we will create a new controller with the artisan command: Go to the project root folder through command prompt and execute below the command. php artisan make:controller HelloWorldController Now go to your controller folder /app/Http/Controllers , you can see HelloWorldController.php and add the following function public ...

Java Future

I am talking about java.util.concurrent.Future interface which is in Java since 1.5, and absolutely not about the future of Java :). Java Future simply represents the result of an asynchronous computation. When the asynchronous task is created, a Java Future object is returned, this is nothing but a placeholder for the value which will be returned in the future. Once the asynchronous task completes, the result can be accessed via the Future object returned when the task was started. The Future interface snippet public interface Future<V> { //Attempts to cancel execution of this task boolean cancel(boolean mayInterruptIfRunning) V get(); //waits and returns the result           //Waits for most of the given time and returns result if available. V get(long timeout, TimeUnit unit); boolean isCancelled(); //Returns true if the task has been cancelled. boolean isDone(); //Return true if the task is completed. } The main impleme...