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']);

 }
}




Thursday, June 29, 2017

Helper Method in laravel

1. view
2.

Laravel Routing

1. Route::any("test",function(){

});

2. Route::match(['get', 'post'], '/test', function () {
});
 
 
3. Route::get("abc", TestController@abcFunction);
 
4. Route::post("abc", TestController@abcFunction); 
 
5. Route::controller('admin', TestController); missingMethod($parameter=array)
 
6. php artisan route:list
 
7. Route(/test/{number}, TestController@test);
 
8. Route::get('user/{name}', function ($name) {})->where('name', '[A-Za-z]+'); 
 
9. Route::middleware(['first', 'second'])->group(function () {
    Route::get('/', function () {
        // Uses first & second Middleware
    });

    Route::get('user/profile', function () {
        // Uses first & second Middleware
    });
});
 
10. Route::namespace('Admin')->group(function () {
    // Controllers Within The "App\Http\Controllers\Admin" Namespace
});  
 
11. Route::group(["prefix"=>'admin','middleware'=['web']],function(){
}); 
 
12. Route::controller("admin-panel", ) 
 

Thursday, June 15, 2017

Sublime Learning

Create Project In Sublime

Select Project . It will select all files


1. Open Window in tab
command + ,
"open_files_in_new_window": false


2. Find + Replace
commmand + alt()  + F

3. Search File in particular directory

Command +P

4. Search  functions
Command + R


5. Switching File
Shift+Command + ] and shift + Command + [








Learning Laravel




If Not installed composer install it

curl -sS https://getcomposer.org/installer | php




sudo mv composer.phar /usr/local/bin/
vim ~/.bash_profile
alias composer="php /usr/local/bin/composer.phar"
composer global require "laravel/installer"
export PATH=~/.composer/vendor/bin:$PATH


Create Project In Laravel
 
laravel new blog
composer update --no-scripts 
cp .env.example .env
php artisan key:generate
 
 
Open .env file 
Change User name and Password  and database for mysql
php artisan migrate
 
create table in laravel
php artisan make:migration create_users_table --create=users 
 
php artisan migrate 
 
php artisan make:model Task 

1. Routes files
app/http/routes.php


2. view files
resources/views/

3. js/css files
public
authController.js

4. Query Enabling

DB::enableQueryLog();
      
DB::getQueryLog();

Wednesday, June 14, 2017

Mac(OSX) MONGODB PHP Driver

brew doctor
 
brew update
 
brew upgrade  

xcode-select --install

brew install pkg-config

brew install autoconfbrew install openssl

ln -s ../opt/openssl/include/openssl .

sudo pecl install mongodb

sudo cp /etc/php.ini.default /etc/php.ini

php -i | grep php.ini

subl /etc/php.ini

sudo apachectl restart

Monday, May 15, 2017

Mac Learning


1.  Double Click
        - Click with 2 fingers

2.  Home Button
       - Command + Left Key

3.  End Button 
       - Command  + Right key

4.  Page Up
      - Command + Up Key

5.  Page down
       - Command + Down Key

6.  Start of document
      - Fn + up key

7.  end of document
      Fn + down key

8. To Go Desktop
    Fn + F11

9.  Install subversion
brew install subversion

10. Set up Ssh

https://docs.joyent.com/public-cloud/getting-started/ssh-keys/generating-an-ssh-key-manually/manually-generating-your-ssh-key-in-mac-os-x


11. set sort command
nano .bash_profile
alias test="command"

12. Delete current cursor
ctrl +D

13. print screen and desktop
shift +command + 3

14.  print screen in cursor
shift + command + ctrl +3

15. Best SQL connector
Sequel Pro

16. Best Editor
Sublime

17. Delete anything
Command + delete

18. option + command  + Q


19. Sublime replace in mac
commad + option +f

20. find and replace in nano
ctrl + \


21. start apache , stop and restart
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
apachectl configtest


22. Apache version
httpd -v

23. Apache troubleshott
pachectl configtest
 
 
24.System Level Web Root
/Library/WebServer/Documents/
 
  
25. Setup php
http://www.alphansotech.com/blogs/setup-apache-mysql-php-phpmyadmin-mac-osx/


26. run command with super user
sudo su -


27. Clean up by Name
command + option +1  



       


     

Wednesday, November 20, 2013

Eclipse Usefull shortcuts

1.  Open file in Particular directory

  • Use Ctrl+Shift+R to bring up the 'Open Resource' dialog
  • Type '*X/' to list all files in the folder X

Monday, August 12, 2013

remove duplicate rows in mysql

ALTER IGNORE TABLE jobs ADD UNIQUE INDEX idx_name (site_id, title, company );\

http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql

Monday, August 5, 2013

usefull regular expression

/\*(.|[\r\n])*?\*/   for removing comments
^\s*\n  for removing blank lines
//.*$   for single line comment

\d+:  for line removing

Sunday, July 28, 2013

Team Planning

Create Team Leader Projects
Create xls for projects  Create Sheet to manage for each projects
Create xls for team work . Create Sheet to manage for each employee work
Create management xls and note down each point of xls


Everyday Process

A .Come office
B. Start PC
C. Check First management xls and check deadline and Time Frame
D. Now open projects xls and check if there is anything critical and manage task.
E.  Now open xls for developer  and manage task

Now Open Jira and bug tracking tools.

1. Check Client issues and manage project excel

Now take Scrum meeting
 1. Manage developer xls

Now Send email to management or take meeting with project manager and update status of each project , task and developer status













 


 


1. Create Excel For each Project

Wednesday, July 24, 2013

set up viertual host in window apache

<VirtualHost 127.0.0.1:80>
    ServerName  www.test.com
    ServerAlias www.test.com
    ServerAdmin test@test.com
    DocumentRoot "d:/test/"
    ErrorLog d:/test/error.log
    <Directory "d:/test">
    Options Indexes FollowSymLinks
    AllowOverride FileInfo
    Order allow,deny
    Allow from all
   </Directory>
</VirtualHost>

php unit testing


I am using simpletest.org

class test extends unitTestCase{

 function test_pass (){

$bool=false;
$this->assertFalse($bool) ;


}

}


assertTrue($x) asserts that $x is true
assertFalse($x) asserts that $x is false
assertEqual($x, $y) asserts that $x is equivalent to $y
asserNotEqual($x, $y) asserts that $x is not equal to $y
assertNull($x) asserts that $x is null
assertNotNull($x) asserts that $x is not null
assertIsA($x, $t) asserts that $x is of type $t
assertNotA($x, $t) asserts that $x is not of type $t
assertWithinMargin($x, $y, $m) asserts that |$x-$y| < $m is true
assertOutsideMargin($x, $y, $m) asserts that |$x-$y| < $m is false
assertIdentical($x, $y) asserts that $x == $y and that $x and $y are of the same type
asserNotIdentical($x, $y) asserts that either $x != $y and/or $x and $y are of a different type
assertClone($x, $y) asserts that $x and $y are identical copies
assertReference($x, $y) asserts that $x and $y are the same variable
assertPattern($p, $x) asserts that the regular expression $p matches $x
assertNoPattern($p, $y) asserts that the regular expression $p doesn't match $x
expectError($x) swallows any upcoming matching error
assert($e) asserts that we get error error $e




Sunday, July 21, 2013

spring learning tutorial without theory

Do not try to learn what spring do ..you will confuse?
make spring programs then you will know what spring can do ?

Start

1. Download Eclipse -
   do googling download enterprise eclipse

2. make dynamic project and run index php
 
 ------------------------------------------------------------

Start Spring Tutorial
-------------------------------------------------

1. make spring-servlet.xml in WEB-INF folder.

Then Write below code in spring-servlet.xml




2. Do below changes in web.xml
3. Now create app-config.xml
4. Now Create package.
A. com.study.controllers