Copy files from a running docker container to your local machine.

You can use the docker cp command to copy files from a running container to your local machine. Here’s an example command:

docker cp container_name:/usr/local/etc/php ./config/php/
Replace container_name with the name of your container. This command will copy all the files and folders in the /usr/local/etc/php directory of the container to the ./config/php directory on your local machine.

Top 10 best programming language for 2023

Here are the top 10 best programming languages for 2023, based on various industry reports and surveys:

    1. Python: Python continues to be one of the most popular programming languages, due to its ease of use and versatility.
    2. JavaScript: JavaScript remains a dominant language for web development and is widely used for creating dynamic and interactive web pages.
    3. Java: Java is widely used for building enterprise applications and has a large community of developers.
    4. C++: C++ is a powerful, fast, and efficient language that is used in many areas such as game development, system programming, and more.
    5. C#: C# is widely used for developing Windows desktop applications and games, and has strong support from Microsoft.
    6. Swift: Swift is a fast and modern language used for developing iOS and macOS applications.
    7. Kotlin: Kotlin is a cross-platform language that can be used for developing Android apps, web apps, and more.
    8. Ruby: Ruby is a dynamic, open-source language that is widely used for building web applications.
    9. Go: Go is a fast and efficient language that is used for building scalable network services and large scale system software.
    10. TypeScript: TypeScript is a statically typed superset of JavaScript that is used for building large-scale applications.

It is important to note that the popularity of programming languages can change rapidly, and these rankings may not be the same in the future. The choice of programming language often depends on the specific project requirements and individual preferences.

This report given on below surveys report 

    1. TIOBE Index: The TIOBE Index is a monthly report that tracks the popularity of programming languages based on the number of search engine results.
    2. GitHub Octoverse: GitHub’s Octoverse report provides an overview of the most popular programming languages used on the platform.
    3. Redmonk Programming Language Rankings: Redmonk’s Programming Language Rankings are based on the number of Stack Overflow questions and GitHub projects related to a particular language.
    4. Stack Overflow Developer Survey: Stack Overflow’s annual Developer Survey is one of the largest surveys of developers, and it includes data on the most popular programming languages.
    5. Developer Survey by JetBrains: JetBrains conducts an annual developer survey that includes data on the popularity of programming languages.

React Js hello world using docker.

In this blog we will follow 2 steps. In first step we will install react js then we will create docker environment. Let proceed.

1st Step :

Once you have Node.js and npm installed, follow these steps to install React:

    1. Open your terminal or command prompt and navigate to the directory where you want to create your React project.
    2. Run the following command to create a new React project using the “create-react-app” tool:
npm create-react-app my-react-app
    1. Replace “my-react-app” with the name of your project.

Wait for the process to complete, then navigate into the project directory:

cd my-react-app
    1. To start the development server and run the application, run the following command:
npm start
  1. Open your web browser and go to http://localhost:3000. You should see the default React application running.2nd Step :

Now for docker env , first we will create 3 files


Now make your Dockerfile like below

FROM node:14
COPY package*.json ./
RUN npm install
COPY . .
CMD [ "npm", "start" ]

You can add below code for docker-compose.yml file

version: "3"
    container_name: react-app
    build: .
      - "3000:3000"
      - ./:/app

You can add below code in makefile

# Define the image name
IMAGE_NAME = react-app

# Define the command to build the Docker image
docker build -t $(IMAGE_NAME) .

# Define the command to run the Docker container
docker-compose up

# Define the command to stop the Docker container
docker stop $(IMAGE_NAME)

Use below command to build container

Make run

Now you should see your react js app in your browser in 3000 port


Laravel Dynamodb connection

Here’s a basic example of how to connect to DynamoDB and retrieve data using the AWS SDK for PHP in Laravel:

composer require aws/aws-sdk-php

In your Laravel application, create an AWS service client for DynamoDB:Install the AWS SDK for PHP via Composer by running the following command:

use Aws\DynamoDb\DynamoDbClient;

$client = new DynamoDbClient([
    'region' => 'us-west-2',
    'version' => '2012-08-10',
    'credentials' => [
        'key'    => 'YOUR_AWS_ACCESS_KEY_ID',
        'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY',

Use the client to retrieve data from your DynamoDB table:

use Aws\DynamoDb\Exception\DynamoDbException;

try {
    $result = $client->getItem([
        'TableName' => 'YOUR_TABLE_NAME',
        'Key' => [
            'KEY_NAME' => [
                'S' => 'KEY_VALUE',
} catch (DynamoDbException $e) {
    echo "Unable to retrieve item:\n";
    echo $e->getMessage() . "\n";

This is just a basic example. You can refer to the official AWS SDK for PHP documentation for more information and options:


Cakephp JWT implement in API

We will follow 4 steps to implement JWT token in API

    1. Install a package to encode and decode JWT token
    2. Create a public and a private key to verify and for encode JWT token.
    3. Change middleware.
    4. Update login function.Install a package to encode and decode JWT tokenWe will use below package
      Link :
      To install this package you have to give below composer command

      composer require firebase/php-jwt

      Create a public and a private key to verify and for encode JWT token.

      To generate public and private key in project directory we give below commands

      # generate private key
      openssl genrsa -out config/jwt.key 1024
      # generate public key
      openssl rsa -in config/jwt.key -outform PEM -pubout -out config/jwt.pem

 Change middleware


public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface


$service = newAuthenticationService();

$fields = [

IdentifierInterface::CREDENTIAL_USERNAME => 'email',

IdentifierInterface::CREDENTIAL_PASSWORD => 'password'


$service->loadIdentifier('Authentication.Password', [

'returnPayload' => false,

'fields' => $fields,


$service->loadAuthenticator('Authentication.Form', [

    'fields' => $fields,


if($request->getParam('prefix') === 'Api'){


  $service->loadAuthenticator('Authentication.Jwt', [

     'secretKey' => file_get_contents(CONFIG .'/jwt.pem'),

    'algorithm' => 'RS256',

     'returnPayload' => false




'unauthenticatedRedirect' => Router::url('/login'),

'queryParam' => 'redirect',






Changing login method :


public function login()


$result = $this->Authentication->getResult();

if( $result->isValid() )


$user = $result->getData();

$privateKey = file_get_contents(CONFIG .'/jwt.key');

$payload = [

'sub' => $user->id,

'exp' => time()+60


$user = [

'token' => JWT::encode($payload,$privateKey,'RS256'),

'userEnt' => $user



$this->response = $this->response->withStatus(401);

$user = [

'message' => 'invalid user'






That’s it.

Laravel custom pagination


Custom pagination easy to create in laravel. Example we have a html like below

<div class="pager">
    <a href="#"><i class="fa-solid fa-chevron-left"></i><span>前へ</span></a>
    <a href="#" class="page-num">1</a>
    <a href="#" class="page-num">2</a>
    <a href="#" class="page-num">3</a>
    <a href="#" class="page-num">4</a>
    <span class="current page-num">5</span>
    <a href="#" class="page-num">6</a>
    <a href="#" class="page-num">7</a>
    <a href="#" class="page-num">8</a>
    <a href="#" class="page-num">9</a>
    <a href="#"><span>次へ</span><i class="fa-solid fa-chevron-right"></i></a>

Output will example like below with my custom css


For custom design you can follow below tutorial in


Now , for convert this pagination in laravel we can create blade file example in location resources/views/elements/pagination.blade.php

The pagination file will looks like below

@if ($paginator->hasPages())

    <div class="pager">

        {{-- Previous Page Link --}}

        @if ($paginator->onFirstPage())

        <a class="disabled" href="{{ $paginator->previousPageUrl() }}"><i class="fa-solid fa-chevron-left"></i><span>前へ</span></a>


            <a href="{{ $paginator->previousPageUrl() }}"><i class="fa-solid fa-chevron-left"></i><span>前へ</span></a>


        {{-- Pagination Elements --}}

        @foreach ($elements as $element)

            {{-- "Three Dots" Separator --}}

            @if (is_string($element))

                <a class="disabled" aria-disabled="true"><span>{{ $element }}</span></a>


            {{-- Array Of Links --}}

            @if (is_array($element))

                @foreach ($element as $page => $url)

                    @if ($page == $paginator->currentPage())

                        <a class="current page-num" href="{{ $url }}">{{ $page }}</a>


                        <a class="page-num" href="{{ $url }}">{{ $page }}</a>





        {{-- Next Page Link --}}

        @if ($paginator->hasMorePages())

            <a href="{{ $paginator->nextPageUrl() }}"><span>次へ</span><i class="fa-solid fa-chevron-right"></i></a>


            <a class="disabled" aria-disabled="true" href="{{ $paginator->nextPageUrl() }}"><span>次へ</span><i class="fa-solid fa-chevron-right"></i></a>




Now , In view file you can add your pagination like below

{{ $books->links('../elements/pagination') }}

Here books is your object which you have sent from controller.

Now your output should like

output image
Command for get laravel existing helper template

php artisan vendor:publish --tag=laravel-pagination

Set Background image in Flutter

If you use a Container as the body of the Scaffold, its size will be accordingly the size of its child, and usually that is not what you want when you try to add a background image to your app.

Widget build(BuildContext context) {
  return new Scaffold(
    body: new Stack(
      children: <Widget>[
        new Container(
          decoration: new BoxDecoration(
            image: new DecorationImage(image: new AssetImage("images/background.jpg"), fit: BoxFit.cover,),
        new Center(
          child: new Text("Hello background"),

Cakephp get last month summary report.

Example we have a table called transactions.Where transactions has 3 fields 

Id | amount | created 

We need to fetch last month’s summary by the created date. So, in cakephp we can write like below

public function report()

       $targetDate = FrozenTime::now()->modify('1 month ago');
       $query = $this->Transactions->find();
               'amount'=> $query->func()->sum('Transactions.amount')
           'Transactions.created >=' => $targetDate->startOfMonth(),
           'Transactions.created <=' => $targetDate->endOfMonth()

Here I have used cakephp FrozenTime class.
So, top in our class we have to use

use Cake\I18n\FrozenTime;

In view you can write below foreach loop to print data.

<?php foreach ($transactions as $transaction): ?>
             <td><?= $transaction->created->format("Y-m-d") ?></td>
             <td><?= $transaction->amount ?></td>
 <?php endforeach; ?>

Cakephp gives a limit on associative/relational data.

Example we have two tables, one is articles and another is comments table. Articles hasMany relations with comments. 

Example our articles table looks like 


id |  title | created | modifier 


Id | comment | article_id | created | modified 

Assuming in articles table we have build  a  hasMany relation with comments like below example


$this->hasMany('Comments', [
     'foreignKey' => 'article_id',

Here, article_id is the foreign key.

Now, in the ArticlesController/index method we will write a query where we want only the last two comments. 

So, we can write our index method like below

public function index()
   $article = $this->Articles->find()
       ->contain('Comments', function($q){
       return $q
              ->order(['Comments.created' => 'DESC']);

So now in view you will get articles with 2 recent comments.

What is VAR hosting in JavaScript ?

If you write a variable and assigned it before declare, like below example

a = 10
var a

It will work perfectly.
Here, I have assigned a variable by value 10, and I also used this variable in console.log() , and it has given output 30.
This behavior is called “hoisting“. Where a variable can appear to be used before it’s declared.

In JavaScript new feature they has introduced LET . Now if you change var a  to let a . You will get an error. If we want to avoid var hosting we can write like below example.

let a
a = 10