Wednesday, October 21, 2020

GIT

To store global credential

 

git config --global credential.helper store
git pull origin <branch name>
it will ask username and password
once u enter username pass it will store for future
then again do
git pull origin <branch name>
it wont ask you for username and password

Wednesday, June 12, 2019

Linux

Important Command

grep -irl "Search Words " --include=*.php

Saturday, June 1, 2019

ETC

if .htaccess is not working

https://stackoverflow.com/questions/17162214/htaccess-not-working-on-localhost-with-xampp

<Directory "c:\Projects\example.site">
        Require all granted
         AllowOverride All <-----This line is required
 </Directory>
 
 
 
 
 
Mysql 
Create User "username"; 
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password'; 
 
 
 
 
 

Sunday, February 4, 2018

Mysql Speed Too Many Opening tables

Thanks
https://pantheon.io/blog/profiling-mysql-queries-better-performance


SET profiling = 1;
SHOW PROFILES; 
SHOW PROFILE FOR QUERY 1;

SELECT STATE, SUM(DURATION) AS Total_R,
   ROUND(
   100 * SUM(DURATION) / (SELECT SUM(DURATION) FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = @query_id), 2
   ) AS Pct_R,
   COUNT(*) AS Calls,
   SUM(DURATION) / COUNT(*) AS "R/Call"
   FROM INFORMATION_SCHEMA.PROFILING
   WHERE QUERY_ID = @query_id
   GROUP BY STATE
   ORDER BY Total_R DESC;


show status where `variable_name` = 'Threads_connected';
innodb_buffer_pool_size=Try to Maximum 
 
Disable query caching 

//SET GLOBAL query_cache_size = 1000000;
 
Thanks 
 
https://web.archive.org/web/20160129162137/http://www.psce.com/blog/kb/how-query-cache-can-cause-performance-problems/
https://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html
 
Try to add  
 Localhost or internal ip 
 
https://dba.stackexchange.com/questions/54756/large-database-too-much-time-spent-opening-and-closing-tables 
https://www.percona.com/blog/2009/11/18/how-innodb_open_files-affects-performance/ 
 
https://stackoverflow.com/questions/9930556/innodb-table-optimization-w-o-locking-table 
 

  

Wednesday, July 5, 2017

Laravel Blade Learning

Laravel Blade Learning
echo


1. No PHP open tag / close  Tag required
2. Laravel Blade support inheritance -Header and Footer
@yield('content')
@extends("master.layout")
@section('content')
@endsection
@parent

3. We put in resource folder

4. We can put php code

5. put data with double curly bracket

6. it convert htmlentities convert

7. without {!! $data !!} without htmlentities 

8. we can use php functions {{  date("Y-m-d H:i:s")}}

9. @{{ $data }} for plain text

10. {{ $data or 'Not Available'}}

Conditions
 A.
@if (check)
@elseif(check2)
@endif
@if (!check)
 
B. unless(check)

@for
@endfor

C. @foreach
     @endforeach
D. @break

F. @forelse
    @empty
     @endforelse

@include('abc')

G. @each('div')

h. @push ('css')
    @endpush

i. @stack

j. comments {{-- --}}
   








 

Tuesday, July 4, 2017

OOPs Learning


1. What is oops
2. Inheritance- You are inheriting something
    Do Not repeate 
3. Encapsulation - We set Access Level
   -  Private can use within class
   - Protected can use for inherit class
   - public can use anyone

4. Abstract classses
   - Means Incomplete
   - Declare with Abstract
No Base Employee -
- No Object created for base class
- It uses for enforcement


5. Interfaces
  its works like abstract class
  Why Use
  Multiple class do not extends
  No variable declaration
 No constructor
You can not make private   function

6. Static Variable and Static Method
No Object Creation  required
Scope resolution operation required
It is related to class not with object
How many objects created
can call with parent :: getCount

7.Dependency Injection
   - It is design patter like mvc
   - code usability -
   - One Library can use other Library
  - DRY concept - Do not repeat yourself
- Type Hinting
You should not instantiate object inside class
 


 
 






  

 
 

Monday, July 3, 2017

Laravel Middleware Learning

1. It runs in middle
2. Application Load and before calling your function at controller
3. It works like police check
4. app/http/middleware
5. handle there is only method
6. pass parameter request , closure next  , guard
7. next is used for next middleware

example 

public function handle(Request $request, Closure $next , guard null){

return $next($next)
}


8. Generate through command line
php artisan make:middleware Test

9. Route::get("/",function(){
 echo "Hello World";
})->middleware(''Log");

Route::get("/",function(){
 echo "Hello World";
},middleware =['test','test2']);

Route::get("/",function(){
 echo "Hello World";
},middleware =['web']);



10. Register middleware
There is 2 types of Kernel
app/http/Kernel.php

Three types of middeware
$middleware
$middlewareGroups
$routeMiddleware

Add in
$routeMiddleware

'logger' => \App\Http\Middleware\LoggerMiddleWare::class,

10.
Route::group(["prefix"=>'admin','middleware'=['web']],function(){
}); 

11. Route::post("/doTest",['uses'=>"AdminController",'middleware' => ['test','test2'] )
 

12. AdminController extends Controller {

  public function __construct(){
   $this->middleware(['auth','web'], 'only'=>['dashboard']);

 }

public function __construct(){
   $this->middleware(['auth','web'], 'except'=>['dashboard']);
$this->middleware('admin', 'only'=>['postMethod']);

 }
}