Friday, 26 November 2021

connect to Linux by name instead of ip address

 connect to linux by name instead of ip address

Go to ~/.ssh/config

Host dev
  HostName XXX.XX.XX.XXXX
  IdentityFile ~/.ssh/id_rsa
  User xxxxxxxxxxxx
  AddKeysToAgent yes

Monday, 19 July 2021

Search and Replace For a Text String in wordpress posts

 

Search and Replace For a Text String

UPDATE wp_posts SET post_content = REPLACE (  post_content,  'text to find here',  'text to replace here');

Monday, 12 July 2021

Turn off caching using .htaccess

Disabling caching

Add this code at the bottom of the .htaccess file to turn off caching. Delete the code to turn caching on again.

# DISABLE CACHING
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|php|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

Monday, 21 June 2021

Get Last Executed Query in Laravel

 Last Query in Laravel

DB::enableQueryLog();
$product = Product::get();
$query = DB::getQueryLog();
dd($query);
  1. \DB::enableQueryLog();
  2. $list = \DB::table("categories")->get();
  3. $query = \DB::getQueryLog();
  4. print_r(end($query));

Friday, 21 June 2019

Best leading PHP frameworks in 2019

The top 10 PHP frameworks

Here’s a list of the best PHP frameworks, based on popularity and ability to facilitate application development.

  1. Laravel
  2. Symfony
  3. CodeIgniter
  4. Zend
  5. CakePHP
  6. FuelPHP
  7. Yii 2
  8. Phalcon
  9. Slim
  10. PHPixie


1. Laravel


If frameworks were people, Laravel would probably be the king. If you want to code beautiful designs, you’re looking for Laravel since it’s positioned as the go-to PHP framework for web artisans.
The reason for its wide popularity boils down to ease of use and virtually no learning curve. And despite that, it’s a framework developer use for some serious work. So it may seem like a simple tool at first, but it’s a beast when it comes to producing concrete work.

2. Symfony

When it comes to developing large-scale enterprise projects, Symfony makes a perfect choice amongst the PHP frameworks. Its ecosystem is a huge one, with a big set of reusable components and an active community of developers. The components serve the purpose of completing diverse tasks such as for creation, the configuration of objects, authentication, routing, templating, and much more. These components are being used to power up projects such as Drupal, Laravel, PHPBB, PIWIk, and OROCRM.

3. CodeIgniter

CodeIgniter is one of the oldest frameworks but is simple and powerful. It can easily be installed and requires minimal user configuration. It works perfectly on almost all shared and dedicated hosting platforms. CodeIgniter isn’t entirely based on the MVC framework. Models and Views are optional, but Controller classes are a must. Another strength of CodeIgniter is speed. It runs faster with database tasks in comparison to other frameworks. CodeIgniter is well documented and a good framework to start with for PHP beginners.

Sunday, 21 January 2018

Delete Documents in MongoDB Collection

Delete Methods

MongoDB provides the following methods to delete documents of a collection:
db.collection.remove({})Delete a single document or all documents that match a specified filter.
db.collection.deleteOne({})Delete at most a single document that match a specified filter even though multiple documents may match the specified filter.
db.collection.deleteMany({})Delete all documents that match a specified filter.
Eg:-  db.users.deleteMany({ status : "A" })

      db.users.deleteOne( { status: "D" } )

      db.getCollection('Users').find({$and:[{"cid":2}, {"created-at":{ "$gte" : new ISODate("2018-01-22")}} ]})

Friday, 29 December 2017

Tax benefit on Home Loan

Tax benefit on Home Loan (Principal Amount)

The amount paid as Repayment of Principal Amount of Home Loan by an Individual/HUF is allowed as tax deduction under Section 80C of the Income Tax Act. The maximum tax deduction allowed under Section 80C is Rs. 1,50,000.

This tax deduction is the total of the deduction allowed under Section 80C and includes amount invested in PPF Account, Tax Saving Fixed Deposits, Equity Oriented Mutual funds, National Savings Certificate etc.
This tax deduction under Section 80C is available on payment basis irrespective of the year for which the payment has been made. The Amount paid as Stamp Duty & Registration Fee is also allowed as tax deduction under Section 80C even if the Assessee has not taken Loan.

However, tax benefit of home loan under this section for repayment of principal part of the home loan is allowed only after the construction is complete and the completion certificate has been awarded. No deduction would be allowed under this section for repayment of principal for those years during which the property was under construction.

TAX BENEFIT ON HOME LOAN (INTEREST AMOUNT)

Tax Benefit on Home Loan for payment of Interest is allowed as a deduction under Section 24 of the Income Tax Act. As per Section 24, the Income from House Property shall be reduced by the amount of Interest paid on Home Loan where the loan has been taken for the purpose of Purchase/ Construction/ Repair/ Renewal/ Reconstruction of a Residential House Property.
The maximum tax deduction allowed under Section 24 of a self-occupied property is subject to a maximum limit of Rs. 2 Lakhs (increased in Budget 2014 from 1.5 Lakhs to Rs. 2 Lakhs).
In case the property for which the Home Loan has been taken is not self-occupied, no maximum limithas been prescribed in this case and the taxpayer can take tax deduction of the whole interest amount under Section 24.