Tuesday, April 28, 2020

Wordpress, Gravity form - Remove space between currency symbol and amount

Wordpress, Gravity form - Remove space between currency symbol and amount


Remove space between currency symbol and amount

Please use the below WordPress in the theme Function (functions.php) file

add_filter('gform_currencies', 'update_currency');
function update_currency($currencies) {
    $currencies['GBP'] = array(
        'name' => __('Pound', 'gravityforms'),
        'symbol_left' => '£',
        'symbol_right' => '',
        'symbol_padding' => '',
        'thousand_separator' => ',',
        'decimal_separator' => '.',
        'decimals' => 2);
    return $currencies;
}

Change Currency symbol from left to right

Please use the below WordPress in the theme Function (functions.php) file:

add_filter('gform_currencies', 'update_currency');
function update_currency($currencies) {
    $currencies['GBP'] = array(
        'name' => __('Pound', 'gravityforms'),
        'symbol_left' => '',
        'symbol_right' => '£',
        'symbol_padding' => '',
        'thousand_separator' => ',',
        'decimal_separator' => '.',
        'decimals' => 2);
    return $currencies;
}

Wordpress Yoast, Change breadcrumb trail from post to page

WordPress Yoast, Change breadcrumb trail from  to page


Please use the below WordPress in the theme Function (functions.php) file

add_filter('wpseo_breadcrumb_links', 'wpse_post_breadcrumbs');
// $links are the current breadcrumbs
function wpse_post_breadcrumbs($links) {
    // Use is_singular($post_type) to identify a single CPT
    // This assumes your CPT is called "post" - change it as needed 
if(is_singular('post')) {
        // The first item in $links ($links[0]) is Home, so skip it
        // The second item in $links is Projects - we want to change that
        $links[1] = array('text' => 'News', 'url' => '/news/', 'allow_html' => 1);
    }
    // Even if we didn't change anything, always return the breadcrumbs
    return $links;
}

htaccess 301 redirect from one pages to another page

htaccess 301 redirect from one pages to another page

301 Redirect from page1 to page2

please use the below code in the htaccess file:

RewriteEngine On
Redirect 301 /page1/ /page2/
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Saturday, March 7, 2020

Datatable.net - Get Reordering of the columns & Get Column visible

Datatable.net - Get Reordering of the columns & Get Column visible

Please add a button on the form like below
<a class="btn btn-success visiblecheck" href="javascript:void(0);" id="visiblecheck" value="test">visiblecheck</a>

Here is 'table' is variable of Datatable.net like

var table = $('#example').dataTable();


$('.visiblecheck').click(function () {
        alert(table.colReorder.order());
        var columnvisible = '';

        for (i = 0; i < table.columns().count(); i++) {
            if (columnvisible != '') {
                columnvisible += ',';
            }
            if (table.column(i).visible() === true) {
                columnvisible += '1';
            }
            else {
                columnvisible += '0';
            }
        }
        alert(columnvisible);
    });


table.colReorder.order() -  this will return the ordering of columns

Tuesday, January 28, 2020

whats the difference between == and === ?

The difference between == and === is that:


1. == converts the variable values to the same type before performing comparison. This is called type coercion.
2. === does not do any type conversion (coercion) and returns true only if both values and types are identical for the two variables being compared.

Example:

  1. var one = 1;
  2. var one_again = 1;
  3. var one_string = "1"; // note: this is string
  4. console.log(one == one_again); // true
  5. console.log(one === one_again); // true
  6. console.log(one == one_string); // true. See below for explanation.
  7. console.log(one === one_string); // false. See below for explanation

Wednesday, January 15, 2020

System.InvalidCastException: 'Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.HttpWebRequest'

System.InvalidCastException: 'Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.HttpWebRequest'

 The error because the URL is not proper. please pass the proper url containing http:// or https://.

and also check that URL is correct.

SQL Server - Running large Sql files

When we try to open a large Sql file in SQl Server, it's gives the error
"The operation could not be completed. not enough storage is available to complete this operation
The template specified cannot be found. Please check that the full path is correct"

Solution:

use the sqlcmd tool to execute the file.

To execute a SQL script:
  1. Start the Command Prompt
  2. Run the below command  

sqlcmd -S DatabaseServer -d Database -i C:\Users\Administrator\Downloads\script.sql -x


Tuesday, January 14, 2020

Error "A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe"

Error "A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe"


Solution:
This is login authenticate problem. Please check the following things:

  • In the SQL Server Properties, please check that "SQL Server and Windows Authentication Mode" is enabled, if not enable, please enable and restart the SQL Server.
     
  • Is Login have the permission to particular Database?
     
  • This might be a firewall issue as you mentioned it only happens when security agent installed. Please make sure you have properly configured security agent to allow Database Engine Services accesses.
     


Monday, January 13, 2020

How to Update Private Nameserver / Child Nameserver in BigRock?

Register and Update Private Name Servers / Child Name Servers in Big Rock
  1. Login to your Bigrock Account and Select the domain for which you would like to update the nameserver details.
  2. Click on the ‘Child Name Servers’ link.
  3. You have to provide Appropriate Host Name and its appropriate IP address
  4. Go back to the main page and select the “Name Servers” option 
  5. Now, Enter the already registered private nameservers here and update name servers 


Tuesday, October 22, 2019

file upload not working in updatepanel asp.net


The Fileupload Control is not working in the UpdatePanel in asp.net. To use the FileUpload control in the Updatepanel. We need to add the Post back trigger to the UpdatePanel Like the below Code

<asp:UpdatePanel ID="UpnlFileUpload" runat="server">
    <ContentTemplate>
        <asp:FileUpload ID="FlUpload" runat="server" />
        <asp:Button ID="btnFileUpload" runat="server" Text="Upload" OnClick="btnFileUpload_OnClick" /> </ContentTemplate>
    <Triggers> <asp:PostBackTrigger ControlID="btnFileUpload" />
    </Triggers>
</asp:UpdatePanel>
Here we need to pass the Button Control ID in the PostBackTrigger Like the above code.

Generally after adding the PostBackTrigger it works accurate but some time it will not work. In this case you need to add the below code in the Page_Load .

Page.Form.Attributes.Add("enctype", "multipart/form-data");